mobility-toolbox-js 2.0.0-beta.56 → 2.0.0-beta.58

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.
Files changed (2) hide show
  1. package/mbt.min.js +2 -2
  2. package/package.json +3 -2
package/mbt.min.js CHANGED
@@ -1072,12 +1072,12 @@ uniform ${se} ${pe} u_${xe};
1072
1072
  `),mt=X.createShader(X.FRAGMENT_SHADER);if(X.isContextLost())return void(this.failedToCreate=!0);X.shaderSource(mt,ht),X.compileShader(mt),X.attachShader(this.program,mt);let pt=X.createShader(X.VERTEX_SHADER);if(X.isContextLost())return void(this.failedToCreate=!0);X.shaderSource(pt,je),X.compileShader(pt),X.attachShader(this.program,pt),this.attributes={};let vt={};this.numAttributes=pe.length;for(let Et=0;Et<this.numAttributes;Et++)pe[Et]&&(X.bindAttribLocation(this.program,Et,pe[Et]),this.attributes[pe[Et]]=Et);X.linkProgram(this.program),X.deleteShader(pt),X.deleteShader(mt);for(let Et=0;Et<tt.length;Et++){let zt=tt[Et];if(zt&&!vt[zt]){let xt=X.getUniformLocation(this.program,zt);xt&&(vt[zt]=xt)}}this.fixedUniforms=M(i,vt),this.terrainUniforms=((Et,zt)=>({u_depth:new s.Uniform1i(Et,zt.u_depth),u_terrain:new s.Uniform1i(Et,zt.u_terrain),u_terrain_dim:new s.Uniform1f(Et,zt.u_terrain_dim),u_terrain_matrix:new s.UniformMatrix4f(Et,zt.u_terrain_matrix),u_terrain_unpack:new s.Uniform4f(Et,zt.u_terrain_unpack),u_terrain_offset:new s.Uniform1f(Et,zt.u_terrain_offset),u_terrain_exaggeration:new s.Uniform1f(Et,zt.u_terrain_exaggeration)}))(i,vt),this.binderUniforms=T?T.getUniforms(i,vt):[]}draw(i,d,x,T,M,U,q,X,Y,se,pe,xe,Ve,ze,Be,tt,st,ht){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),X){i.activeTexture.set(je.TEXTURE2),je.bindTexture(je.TEXTURE_2D,X.depthTexture),i.activeTexture.set(je.TEXTURE3),je.bindTexture(je.TEXTURE_2D,X.texture);for(let pt in this.terrainUniforms)this.terrainUniforms[pt].set(X[pt])}for(let pt in this.fixedUniforms)this.fixedUniforms[pt].set(q[pt]);Be&&Be.setUniforms(i,this.binderUniforms,Ve,{zoom:ze});let mt=0;switch(d){case je.LINES:mt=2;break;case je.TRIANGLES:mt=3;break;case je.LINE_STRIP:mt=1}for(let pt of xe.get()){let vt=pt.vaos||(pt.vaos={});(vt[Y]||(vt[Y]=new Cs)).bind(i,this,se,Be?Be.getPaintVertexBuffers():[],pe,pt.vertexOffset,tt,st,ht),je.drawElements(d,pt.primitiveLength*mt,je.UNSIGNED_SHORT,pt.primitiveOffset*mt*2)}}}function Yn(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 X=T.properties.get("color");return{u_matrix:E,u_lightpos:U,u_lightintensity:T.properties.get("intensity"),u_lightcolor:[X.r,X.g,X.b],u_vertical_gradient:+d,u_opacity:x}},Zo=(E,i,d,x,T,M,U)=>s.extend(_n(E,i,d,x),Yn(M,i,U),{u_height_factor:-Math.pow(2,T.overscaledZ)/U.tileSize/8}),Ti=E=>({u_matrix:E}),Ro=(E,i,d,x)=>s.extend(Ti(E),Yn(d,i,x)),Eo=(E,i)=>({u_matrix:E,u_world:i}),ku=(E,i,d,x,T)=>s.extend(Ro(E,i,d,x),{u_world:T}),zo=(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}},Do=(E,i,d=1)=>({u_matrix:E,u_color:i,u_overlay:0,u_overlay_scale:d}),cn=E=>({u_matrix:E}),Oo=(E,i,d,x)=>({u_matrix:E,u_extrude_scale:te(i,1,d),u_intensity:x});function Rn(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]]}},Lu=(E,i,d,x,T)=>s.extend(Wo(E,i,d,T),{u_image:0,u_image_height:x}),Kl=(E,i,d,x,T)=>{let M=E.transform,U=Ki(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=Ki(i,E.transform),X=d.layout.get("line-cap")==="round",Y=U.getDash(x.from,X),se=U.getDash(x.to,X),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 Ki(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:Ru(T.paint.get("raster-hue-rotate"))};var M,U};function Ru(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 Hl=(E,i,d,x,T,M,U,q,X,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:+X,u_pitch_with_map:+x,u_texsize:Y,u_texture:0}},Da=(E,i,d,x,T,M,U,q,X,Y,se)=>{let pe=T.transform;return s.extend(Hl(E,i,d,x,T,M,U,q,X,Y),{u_gamma_scale:x?Math.cos(pe._pitch)*pe.cameraToCenterDistance:1,u_device_pixel_ratio:T.pixelRatio,u_is_halo:+se})},Yl=(E,i,d,x,T,M,U,q,X,Y)=>s.extend(Da(E,i,d,x,T,M,U,q,!0,X,!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,X,Y){let se=X.imageManager.getPattern(U.from.toString()),pe=X.imageManager.getPattern(U.to.toString()),{width:xe,height:Ve}=X.imageManager.getPixelSize(),ze=Math.pow(2,Y.tileID.overscaledZ),Be=Y.tileSize*Math.pow(2,X.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,Ve],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,X.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 To{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 ni{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 ni{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 ni{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class ts extends ni{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}class Bn extends ni{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 hn extends ni{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class Un extends ni{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class Jl extends ni{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 Ql extends ni{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 eu extends ni{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 ni{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 ni{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 ni{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 ni{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 tu extends ni{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 ni{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 ni{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 ni{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 ni{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 ni{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}class Nn extends ni{getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}}class zu extends ni{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 ni{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 ni{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 ni{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 ni{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 ni{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 ni{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 ni{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 Fo extends ni{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 Du extends ni{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 Ou extends ni{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 ni{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 Fi{constructor(i,d,x){this.blendFunction=i,this.blendColor=d,this.mask=x}}Fi.Replace=[1,0],Fi.disabled=new Fi(Fi.Replace,s.Color.transparent,[!1,!1,!1,!1]),Fi.unblended=new Fi(Fi.Replace,s.Color.transparent,[!0,!0,!0,!0]),Fi.alphaBlended=new Fi([1,771],s.Color.transparent,[!0,!0,!0,!0]);class Fu{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 Bn(this),this.depthMask=new hn(this),this.stencilMask=new Un(this),this.stencilFunc=new Jl(this),this.stencilOp=new Ql(this),this.stencilTest=new eu(this),this.depthRange=new El(this),this.depthTest=new Tl(this),this.depthFunc=new el(this),this.blend=new Sl(this),this.blendFunc=new tu(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 Nn(this),this.activeTexture=new zu(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 Fo(this),this.pixelStoreUnpackPremultiplyAlpha=new Du(this),this.pixelStoreUnpackFlipY=new Ou(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 To(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){N(i.blendFunction,Fi.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 ri{constructor(i,d,x){this.func=i,this.mask=d,this.range=x}}ri.ReadOnly=!1,ri.ReadWrite=!0,ri.disabled=new ri(519,ri.ReadOnly,[0,1]);let oi=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,oi,oi,oi);class Ei{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,X=q.gl,Y=E.useProgram("collisionBox"),se=[],pe=0,xe=0;for(let je=0;je<x.length;je++){let mt=x[je],pt=i.getTile(mt),vt=pt.getBucket(d);if(!vt)continue;let Et=mt.posMatrix;T[0]===0&&T[1]===0||(Et=E.translatePosMatrix(mt.posMatrix,pt,T,M));let zt=U?vt.textCollisionBox:vt.iconCollisionBox,xt=vt.collisionCircleArray;if(xt.length>0){let rr=s.create(),h=Et;s.mul(rr,vt.placementInvProjMatrix,E.transform.glCoordMatrix),s.mul(rr,rr,vt.placementViewportMatrix),se.push({circleArray:xt,circleOffset:xe,transform:h,invTransform:rr,coord:mt}),pe+=xt.length/4,xe=pe}zt&&Y.draw(q,X.LINES,ri.disabled,hi.disabled,E.colorModeForRenderPass(),Ei.disabled,As(Et,E.transform,pt),E.style.terrain&&E.style.terrain.getTerrainData(mt),d.id,zt.layoutVertexBuffer,zt.indexBuffer,zt.segments,null,E.transform.zoom,null,null,zt.collisionVertexBuffer)}if(!U||!se.length)return;let Ve=E.useProgram("collisionCircle"),ze=new s.CollisionCircleLayoutArray;ze.resize(4*pe),ze._trim();let Be=0;for(let je of se)for(let mt=0;mt<je.circleArray.length/4;mt++){let pt=4*mt,vt=je.circleArray[pt+0],Et=je.circleArray[pt+1],zt=je.circleArray[pt+2],xt=je.circleArray[pt+3];ze.emplace(Be++,vt,Et,zt,xt,0),ze.emplace(Be++,vt,Et,zt,xt,1),ze.emplace(Be++,vt,Et,zt,xt,2),ze.emplace(Be++,vt,Et,zt,xt,3)}(!rl||rl.length<2*pe)&&(rl=function(je){let mt=2*je,pt=new s.QuadTriangleArray;pt.resize(mt),pt._trim();for(let vt=0;vt<mt;vt++){let Et=6*vt;pt.uint16[Et+0]=4*vt+0,pt.uint16[Et+1]=4*vt+1,pt.uint16[Et+2]=4*vt+2,pt.uint16[Et+3]=4*vt+2,pt.uint16[Et+4]=4*vt+3,pt.uint16[Et+5]=4*vt+0}return pt}(pe));let tt=q.createIndexBuffer(rl,!0),st=q.createVertexBuffer(ze,s.collisionCircleLayout.members,!0);for(let je of se){let mt={u_matrix:je.transform,u_inv_matrix:je.invTransform,u_camera_to_center_distance:(ht=E.transform).cameraToCenterDistance,u_viewport_size:[ht.width,ht.height]};Ve.draw(q,X.TRIANGLES,ri.disabled,hi.disabled,E.colorModeForRenderPass(),Ei.disabled,mt,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 ht;st.destroy(),tt.destroy()}Ei.disabled=new Ei(!1,1029,2305),Ei.backCCW=new Ei(!0,1029,2305);let Bu=s.identity(new Float32Array(16));function zs(E,i,d,x,T,M){let{horizontalAlign:U,verticalAlign:q}=s.getAnchorAlignment(E),X=-(U-.5)*i,Y=-(q-.5)*d,se=s.evaluateVariableOffset(E,x);return new s.pointGeometry((X/T+se[0])*M,(Y/T+se[1])*M)}function Uu(E,i,d,x,T,M,U,q,X,Y,se){let pe=E.text.placedSymbolArray,xe=E.text.dynamicLayoutVertexArray,Ve=E.icon.dynamicLayoutVertexArray,ze={};xe.clear();for(let Be=0;Be<pe.length;Be++){let tt=pe.get(Be),st=E.allowVerticalPlacement&&!tt.placedOrientation,ht=tt.hidden||!tt.crossTileID||st?null:x[tt.crossTileID];if(ht){let je=new s.pointGeometry(tt.anchorX,tt.anchorY),mt=Wr(je,d?U:M,se),pt=kn(T.cameraToCenterDistance,mt.signedDistanceFromCamera),vt=s.evaluateSizeForFeature(E.textSizeData,X,tt)*pt/s.ONE_EM;d&&(vt*=E.tilePixelRatio/q);let{width:Et,height:zt,anchor:xt,textOffset:rr,textBoxScale:h}=ht,m=zs(xt,Et,zt,rr,h,vt),f=d?Wr(je.add(m),M,se).point:mt.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 Ar(tt.numGlyphs,xe)}if(Y){Ve.clear();let Be=E.icon.placedSymbolArray;for(let tt=0;tt<Be.length;tt++){let st=Be.get(tt);if(st.hidden)Ar(st.numGlyphs,Ve);else{let ht=ze[tt];if(ht)for(let je=0;je<st.numGlyphs;je++)s.addDynamicAttributes(Ve,ht.shiftedAnchor,ht.angle);else Ar(st.numGlyphs,Ve)}}E.icon.dynamicLayoutVertexBuffer.updateData(Ve)}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,X,Y,se,pe){let xe=E.context,Ve=xe.gl,ze=E.transform,Be=q==="map",tt=X==="map",st=q!=="viewport"&&d.layout.get("symbol-placement")!=="point",ht=Be&&!tt&&!st,je=!d.layout.get("symbol-sort-key").isConstant(),mt=!1,pt=E.depthModeForSublayer(0,ri.ReadOnly),vt=d.layout.get("text-variable-anchor"),Et=[];for(let zt of x){let xt=i.getTile(zt),rr=xt.getBucket(d);if(!rr)continue;let h=T?rr.text:rr.icon;if(!h||!h.segments.get().length)continue;let m=h.programConfigurations.get(d.id),f=T||rr.sdfIcons,v=T?rr.textSizeData:rr.iconSizeData,I=tt||ze.pitch!==0,L=E.useProgram(Ds(f,T,rr),m),D=s.evaluateSizeForZoom(v,ze.zoom),G=E.style.terrain&&E.style.terrain.getTerrainData(zt),K,ne,ye,be,Ee=[0,0],Fe=null;if(T){if(ne=xt.glyphAtlasTexture,ye=Ve.LINEAR,K=xt.glyphAtlasTexture.size,rr.iconsInText){Ee=xt.imageAtlasTexture.size,Fe=xt.imageAtlasTexture;let kt=v.kind==="composite"||v.kind==="camera";be=I||E.options.rotating||E.options.zooming||kt?Ve.LINEAR:Ve.NEAREST}}else{let kt=d.layout.get("icon-size").constantOr(0)!==1||rr.iconsNeedLinear;ne=xt.imageAtlasTexture,ye=f||E.options.rotating||E.options.zooming||kt||I?Ve.LINEAR:Ve.NEAREST,K=xt.imageAtlasTexture.size}let De=te(xt,1,E.transform.zoom),Ze=ho(zt.posMatrix,tt,Be,E.transform,De),Me=yn(zt.posMatrix,tt,Be,E.transform,De),We=vt&&rr.hasTextData(),et=d.layout.get("icon-text-fit")!=="none"&&We&&rr.hasIconData();if(st){let kt=E.style.terrain?(fr,dr)=>E.style.terrain.getElevation(zt,fr,dr):null,Ht=d.layout.get("text-rotation-alignment")==="map";dn(rr,zt.posMatrix,E,T,Ze,Me,tt,Y,Ht,kt)}let it=E.translatePosMatrix(zt.posMatrix,xt,M,U),at=st||T&&vt||et?Bu:Ze,lt=E.translatePosMatrix(Me,xt,M,U,!0),ft=f&&d.paint.get(T?"text-halo-width":"icon-halo-width").constantOr(1)!==0,bt;bt=f?rr.iconsInText?Yl(v.kind,D,ht,tt,E,it,at,lt,K,Ee):Da(v.kind,D,ht,tt,E,it,at,lt,T,K,!0):Hl(v.kind,D,ht,tt,E,it,at,lt,T,K);let It={program:L,buffers:h,uniformValues:bt,atlasTexture:ne,atlasTextureIcon:Fe,atlasInterpolation:ye,atlasInterpolationIcon:be,isSDF:f,hasHalo:ft};if(je&&rr.canOverlap){mt=!0;let kt=h.segments.get();for(let Ht of kt)Et.push({segments:new s.SegmentVector([Ht]),sortKey:Ht.sortKey,state:It,terrainData:G})}else Et.push({segments:h.segments,sortKey:0,state:It,terrainData:G})}mt&&Et.sort((zt,xt)=>zt.sortKey-xt.sortKey);for(let zt of Et){let xt=zt.state;if(xe.activeTexture.set(Ve.TEXTURE0),xt.atlasTexture.bind(xt.atlasInterpolation,Ve.CLAMP_TO_EDGE),xt.atlasTextureIcon&&(xe.activeTexture.set(Ve.TEXTURE1),xt.atlasTextureIcon&&xt.atlasTextureIcon.bind(xt.atlasInterpolationIcon,Ve.CLAMP_TO_EDGE)),xt.isSDF){let rr=xt.uniformValues;xt.hasHalo&&(rr.u_is_halo=1,il(xt.buffers,zt.segments,d,E,xt.program,pt,se,pe,rr,zt.terrainData)),rr.u_is_halo=0}il(xt.buffers,zt.segments,d,E,xt.program,pt,se,pe,xt.uniformValues,zt.terrainData)}}function il(E,i,d,x,T,M,U,q,X,Y){let se=x.context;T.draw(se,se.gl.TRIANGLES,M,U,q,Ei.disabled,X,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,X=d.paint.get("fill-pattern"),Y=X&&X.constantOr(1),se=d.getCrossfadeParameters(),pe,xe,Ve,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 ht=st.getBucket(d);if(!ht)continue;let je=ht.programConfigurations.get(d.id),mt=E.useProgram(xe,je),pt=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=X.constantOr(null);if(vt&&st.imageAtlas){let xt=st.imageAtlas,rr=xt.patternPositions[vt.to.toString()],h=xt.patternPositions[vt.from.toString()];rr&&h&&je.setConstantPatternPositions(rr,h)}let Et=pt?tt:null,zt=E.translatePosMatrix(Et?Et.posMatrix:tt.posMatrix,st,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(U){ze=ht.indexBuffer2,Be=ht.segments2;let xt=[q.drawingBufferWidth,q.drawingBufferHeight];Ve=xe==="fillOutlinePattern"&&Y?ku(zt,E,se,st,xt):Eo(zt,xt)}else ze=ht.indexBuffer,Be=ht.segments,Ve=Y?Ro(zt,E,se,st):Ti(zt);mt.draw(E.context,pe,T,E.stencilModeForClipping(tt),M,Ei.disabled,Ve,pt,d.id,ht.layoutVertexBuffer,ze,Be,d.paint,E.transform.zoom,je)}}function mi(E,i,d,x,T,M,U){let q=E.context,X=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 Ve of x){let ze=i.getTile(Ve),Be=ze.getBucket(d);if(!Be)continue;let tt=E.style.terrain&&E.style.terrain.getTerrainData(Ve),st=Be.programConfigurations.get(d.id),ht=E.useProgram(se?"fillExtrusionPattern":"fillExtrusion",st);se&&(E.context.activeTexture.set(X.TEXTURE0),ze.imageAtlasTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE),st.updatePaintBuffers(pe));let je=Y.constantOr(null);if(je&&ze.imageAtlas){let Et=ze.imageAtlas,zt=Et.patternPositions[je.to.toString()],xt=Et.patternPositions[je.from.toString()];zt&&xt&&st.setConstantPatternPositions(zt,xt)}let mt=E.translatePosMatrix(Ve.posMatrix,ze,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),pt=d.paint.get("fill-extrusion-vertical-gradient"),vt=se?Zo(mt,E,pt,xe,Ve,pe,ze):_n(mt,E,pt,xe);ht.draw(q,q.gl.TRIANGLES,T,M,U,Ei.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,X=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(X.TEXTURE0),X.bindTexture(X.TEXTURE_2D,Y.colorAttachment.get()),se.draw(q,X.TRIANGLES,T,M,U,Ei.disabled,((xe,Ve,ze,Be)=>{let tt=ze.paint.get("hillshade-shadow-color"),st=ze.paint.get("hillshade-highlight-color"),ht=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 mt=!xe.options.moving;return{u_matrix:Be?Be.posMatrix:xe.transform.calculatePosMatrix(Ve.tileID.toUnwrapped(),mt),u_image:0,u_latrange:Rn(0,Ve.tileID),u_light:[ze.paint.get("hillshade-exaggeration"),je],u_shadow:tt,u_highlight:st,u_accent:ht}})(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,X=i.dem;if(X&&X.data){let Y=X.dim,se=X.stride,pe=X.getPixels();if(U.activeTexture.set(q.TEXTURE1),U.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||E.getTileTexture(se),i.demTexture){let Ve=i.demTexture;Ve.update(pe,{premultiply:!1}),Ve.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 Ve=new Se(U,{width:Y,height:Y,data:null},q.RGBA);Ve.bind(q.LINEAR,q.CLAMP_TO_EDGE),xe=i.fbo=U.createFramebuffer(Y,Y,!0),xe.colorAttachment.set(Ve.texture)}U.bindFramebuffer.set(xe.framebuffer),U.viewport.set([0,0,Y,Y]),E.useProgram("hillshadePrepare").draw(U,q.TRIANGLES,x,T,M,Ei.disabled,((Ve,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:Ve.overscaledZ,u_unpack:ze.getUnpackVector()}})(i.tileID,X),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(),X=(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),Ve=xe&&E.refreshedUponExpiration?1:s.clamp(xe?X:1-Y,0,1);return E.refreshedUponExpiration&&X>=1&&(E.refreshedUponExpiration=!1),i?{opacity:1,mix:1-Ve}:{opacity:Ve,mix:0}}return{opacity:1,mix:0}}let Al=new s.Color(1,0,0,1),aa=new s.Color(0,1,0,1),Nu=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=ri.disabled,X=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,Ve=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,ht){st.initDebugOverlayCanvas();let je=st.debugOverlayCanvas,mt=st.context.gl,pt=st.debugOverlayCanvas.getContext("2d");pt.clearRect(0,0,je.width,je.height),pt.shadowColor="white",pt.shadowBlur=2,pt.lineWidth=1.5,pt.strokeStyle="white",pt.textBaseline="top",pt.font="bold 36px Open Sans, sans-serif",pt.fillText(ht,5,5),pt.strokeText(ht,5,5),st.debugOverlayTexture.update(je),st.debugOverlayTexture.bind(mt.LINEAR,mt.CLAMP_TO_EDGE)}(E,`${tt} ${Ve}kB`),U.draw(x,T.TRIANGLES,q,X,Fi.alphaBlended,Ei.disabled,Do(M,s.Color.transparent,Be),null,se,E.debugBuffer,E.quadTriangleIndexBuffer,E.debugSegments),U.draw(x,T.LINE_STRIP,q,X,Y,Ei.disabled,Do(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 ri(T.LEQUAL,ri.ReadWrite,E.depthRangeFor3D),q=E.useProgram("terrain"),X=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,Ei.backCCW,{u_matrix:se,u_texture:0},Y,"terrain",X.vertexBuffer,X.indexBuffer,X.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 Xo{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,X=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<X.length;se++){let pe=x.style._layers[X[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,X,Y,se,pe,xe,Ve){let ze=X.transform,Be=pe==="map",tt=xe==="map";for(let st of q){let ht=se.getTile(st),je=ht.getBucket(Y);if(!je||!je.text||!je.text.segments.get().length)continue;let mt=s.evaluateSizeForZoom(je.textSizeData,ze.zoom),pt=te(ht,1,X.transform.zoom),vt=ho(st.posMatrix,tt,Be,X.transform,pt),Et=Y.layout.get("icon-text-fit")!=="none"&&je.hasIconData();if(mt){let zt=Math.pow(2,ze.zoom-ht.tileID.overscaledZ);Uu(je,Be,tt,Ve,ze,vt,st.posMatrix,zt,mt,Et,X.style.terrain?(xt,rr)=>X.style.terrain.getElevation(st,xt,rr):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 X=E.context,Y=X.gl,se=E.depthModeForSublayer(0,ri.ReadOnly),pe=hi.disabled,xe=E.colorModeForRenderPass(),Ve=[];for(let ze=0;ze<x.length;ze++){let Be=x[ze],tt=i.getTile(Be),st=tt.getBucket(d);if(!st)continue;let ht=st.programConfigurations.get(d.id),je=E.useProgram("circle",ht),mt=st.layoutVertexBuffer,pt=st.indexBuffer,vt=E.style.terrain&&E.style.terrain.getTerrainData(Be),Et={programConfiguration:ht,program:je,layoutVertexBuffer:mt,indexBuffer:pt,uniformValues:zo(E,Be,tt,d),terrainData:vt};if(q){let zt=st.segments.get();for(let xt of zt)Ve.push({segments:new s.SegmentVector([xt]),sortKey:xt.sortKey,state:Et})}else Ve.push({segments:st.segments,sortKey:0,state:Et})}q&&Ve.sort((ze,Be)=>ze.sortKey-Be.sortKey);for(let ze of Ve){let{programConfiguration:Be,program:tt,layoutVertexBuffer:st,indexBuffer:ht,uniformValues:je,terrainData:mt}=ze.state;tt.draw(X,Y.TRIANGLES,se,pe,xe,Ei.disabled,je,mt,d.id,st,ht,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 Fi([M.ONE,M.ONE],s.Color.transparent,[!0,!0,!0,!0]);(function(X,Y,se){let pe=X.gl;X.activeTexture.set(pe.TEXTURE1),X.viewport.set([0,0,Y.width/4,Y.height/4]);let xe=se.heatmapFbo;if(xe)pe.bindTexture(pe.TEXTURE_2D,xe.colorAttachment.get()),X.bindFramebuffer.set(xe.framebuffer);else{let Ve=pe.createTexture();pe.bindTexture(pe.TEXTURE_2D,Ve),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=X.createFramebuffer(Y.width/4,Y.height/4,!1),function(ze,Be,tt,st){let ht=ze.gl;ht.texImage2D(ht.TEXTURE_2D,0,ht.RGBA,Be.width/4,Be.height/4,0,ht.RGBA,ze.extRenderToTextureHalfFloat?ze.extTextureHalfFloat.HALF_FLOAT_OES:ht.UNSIGNED_BYTE,null),st.colorAttachment.set(tt)}(X,Y,Ve,xe)}})(T,E,d),T.clear({color:s.Color.transparent});for(let X=0;X<x.length;X++){let Y=x[X];if(i.hasRenderableParent(Y))continue;let se=i.getTile(Y),pe=se.getBucket(d);if(!pe)continue;let xe=pe.programConfigurations.get(d.id),Ve=E.useProgram("heatmap",xe),{zoom:ze}=E.transform;Ve.draw(T,M.TRIANGLES,ri.disabled,U,q,Ei.disabled,Oo(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,X=M.heatmapFbo;if(!X)return;U.activeTexture.set(q.TEXTURE0),q.bindTexture(q.TEXTURE_2D,X.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,ri.disabled,hi.disabled,T.colorModeForRenderPass(),Ei.disabled,((se,pe,xe,Ve)=>{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,ri.ReadOnly),q=E.colorModeForRenderPass(),X=d.paint.get("line-dasharray"),Y=d.paint.get("line-pattern"),se=Y.constantOr(1),pe=d.paint.get("line-gradient"),xe=d.getCrossfadeParameters(),Ve=se?"linePattern":X?"lineSDF":pe?"lineGradient":"line",ze=E.context,Be=ze.gl,tt=!0;for(let st of x){let ht=i.getTile(st);if(se&&!ht.patternsLoaded())continue;let je=ht.getBucket(d);if(!je)continue;let mt=je.programConfigurations.get(d.id),pt=E.context.program.get(),vt=E.useProgram(Ve,mt),Et=tt||vt.program!==pt,zt=E.style.terrain&&E.style.terrain.getTerrainData(st),xt=Y.constantOr(null);if(xt&&ht.imageAtlas){let m=ht.imageAtlas,f=m.patternPositions[xt.to.toString()],v=m.patternPositions[xt.from.toString()];f&&v&&mt.setConstantPatternPositions(f,v)}let rr=zt?st:null,h=se?Kl(E,ht,d,xe,rr):X?Ps(E,ht,d,X,xe,rr):pe?Lu(E,ht,d,je.lineClipsArray.length,rr):Wo(E,ht,d,rr);if(se)ze.activeTexture.set(Be.TEXTURE0),ht.imageAtlasTexture.bind(Be.LINEAR,Be.CLAMP_TO_EDGE),mt.updatePaintBuffers(xe);else if(X&&(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,Ei.disabled,h,zt,d.id,je.layoutVertexBuffer,je.indexBuffer,je.segments,d.paint,E.transform.zoom,mt,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"),X=E.opaquePassEnabledForLayer()&&!q.constantOr(1)&&T.constantOr(s.Color.transparent).a===1&&M.constantOr(0)===1?"opaque":"translucent";if(E.renderPass===X){let Y=E.depthModeForSublayer(1,E.renderPass==="opaque"?ri.ReadWrite:ri.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,ri.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 ri(E.context.gl.LEQUAL,ri.ReadWrite,E.depthRangeFor3D);if(T!==1||d.paint.get("fill-extrusion-pattern").constantOr(1))mi(E,i,d,x,M,hi.disabled,Fi.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,ri.ReadOnly),U=E.colorModeForRenderPass(),[q,X]=E.renderPass==="translucent"?E.stencilConfigForOverlap(x):[{},x];for(let Y of X){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"),X=E.colorModeForRenderPass(),[Y,se]=U instanceof zr?[{},x]:E.stencilConfigForOverlap(x),pe=se[se.length-1].overscaledZ,xe=!E.options.moving;for(let Ve of se){let ze=E.depthModeForSublayer(Ve.overscaledZ-pe,d.paint.get("raster-opacity")===1?ri.ReadWrite:ri.ReadOnly,M.LESS),Be=i.getTile(Ve);Be.registerFadeDuration(d.paint.get("raster-fade-duration"));let tt=i.findLoadedParent(Ve,0),st=Va(Be,tt,i,d,E.transform,E.style.terrain),ht,je,mt=d.paint.get("raster-resampling")==="nearest"?M.NEAREST:M.LINEAR;T.activeTexture.set(M.TEXTURE0),Be.texture.bind(mt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),T.activeTexture.set(M.TEXTURE1),tt?(tt.texture.bind(mt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),ht=Math.pow(2,tt.tileID.overscaledZ-Be.tileID.overscaledZ),je=[Be.tileID.canonical.x*ht%1,Be.tileID.canonical.y*ht%1]):Be.texture.bind(mt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST);let pt=E.style.terrain&&E.style.terrain.getTerrainData(Ve),vt=pt?Ve:null,Et=vt?vt.posMatrix:E.transform.calculatePosMatrix(Ve.toUnwrapped(),xe),zt=vc(Et,je||[0,0],ht||1,st,d);U instanceof zr?q.draw(T,M.TRIANGLES,ze,hi.disabled,X,Ei.disabled,zt,pt,d.id,U.boundsBuffer,E.quadTriangleIndexBuffer,U.boundsSegments):q.draw(T,M.TRIANGLES,ze,Y[Ve.overscaledZ],X,Ei.disabled,zt,pt,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,X=E.transform,Y=X.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,Ve=E.depthModeForSublayer(0,pe==="opaque"?ri.ReadWrite:ri.ReadOnly),ze=E.colorModeForRenderPass(),Be=E.useProgram(se?"backgroundPattern":"background"),tt=x||X.coveringTiles({tileSize:Y,terrain:E.style.terrain});se&&(U.activeTexture.set(q.TEXTURE0),E.imageManager.bind(E.context));let st=d.getCrossfadeParameters();for(let ht of tt){let je=x?ht.posMatrix:E.transform.calculatePosMatrix(ht.toUnwrapped()),mt=se?xc(je,M,E,se,{tileID:ht,tileSize:Y},st):wl(je,M,T),pt=E.style.terrain&&E.style.terrain.getTerrainData(ht);Be.draw(U,q.TRIANGLES,Ve,xe,ze,Ei.disabled,mt,pt,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 ri(E.context.gl.LEQUAL,ri.ReadWrite,E.depthRangeFor3D):E.depthModeForSublayer(0,ri.ReadOnly);x.setDepthMode(M),T.render(x.gl,E.transform.customLayerMatrix()),x.setDirty(),E.setBaseState(),x.bindFramebuffer.set(null)}}};class ru{constructor(i,d){this.context=new Fu(i),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:s.create(),renderTime:0},this.setup(),this.numSublayers=Br.maxUnderzooming+Br.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,Nr.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,Nr.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,Er.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,Nr.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 X=this.context.gl;this.stencilClearMode=new hi({func:X.ALWAYS,mask:0},0,255,X.ZERO,X.ZERO,X.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,ri.disabled,this.stencilClearMode,Fi.disabled,Ei.disabled,cn(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(Fi.disabled),x.setDepthMode(ri.disabled);let M=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let U of d){let q=this._tileClippingMaskIDs[U.key]=this.nextStencilID++,X=this.style.terrain&&this.style.terrain.getTerrainData(U);M.draw(x,T.TRIANGLES,ri.disabled,new hi({func:T.ALWAYS,mask:0},q,255,T.KEEP,T.KEEP,T.REPLACE),Fi.disabled,Ei.disabled,cn(U.posMatrix),X,"$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 Fi([i.CONSTANT_COLOR,i.ONE],new s.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Fi.unblended:Fi.alphaBlended}depthModeForSublayer(i,d,x){if(!this.opaquePassEnabledForLayer())return ri.disabled;let T=1-((1+this.currentLayer)*this.numSublayers+i)*this.depthEpsilon;return new ri(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 Xo(this);for(let Y in T){let se=T[Y];se.used&&se.prepare(this.context)}let U={},q={},X={};for(let Y in T){let se=T[Y];U[Y]=se.getVisibleCoordinates(),q[Y]=U[Y].slice().reverse(),X[Y]=se.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let Y=0;Y<x.length;Y++)if(this.style._layers[x[Y]].is3D()){this.opaquePassCutoff=Y;break}if(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,Ve=xe.gl,ze=Fi.unblended,Be=new ri(Ve.LEQUAL,ri.ReadWrite,[0,1]),tt=pe.getTerrainMesh(),st=pe.sourceCache.getRenderableTiles(),ht=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 mt=pe.getTerrainData(je.tileID),pt=se.transform.calculatePosMatrix(je.tileID.toUnwrapped());ht.draw(xe,Ve.TRIANGLES,Be,hi.disabled,ze,Ei.backCCW,{u_matrix:pt},mt,"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,Ve=xe.gl,ze=Fi.unblended,Be=new ri(Ve.LEQUAL,ri.ReadWrite,[0,1]),tt=pe.getTerrainMesh(),st=pe.getCoordsTexture(),ht=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 mt of ht){let pt=pe.getTerrainData(mt.tileID);xe.activeTexture.set(Ve.TEXTURE0),Ve.bindTexture(Ve.TEXTURE_2D,st.texture);let vt=se.transform.calculatePosMatrix(mt.tileID.toUnwrapped());je.draw(xe,Ve.TRIANGLES,Be,hi.disabled,ze,Ei.backCCW,{u_matrix:vt,u_terrain_coords_id:(255-pe.coordsIndex.length)/255,u_texture:0},pt,"terrain",tt.vertexBuffer,tt.indexBuffer,tt.segments),pe.coordsIndex.push(mt.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"?X: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,Nu),ns(Y,Y.transform.width-(se.right||0),3,ol);let pe=Y.transform.centerPoint;(function(xe,Ve,ze,Be){Sa(xe,Ve-1,ze-10,2,20,Be),Sa(xe,Ve-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],X=new Float32Array(16);return s.translate(X,i,q),X}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,Ln[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 X=1/(q=s.transformMat4([],q,i))[3]/d*T;return s.mul$1(q,q,[X,X,1/q[3],X])}),U=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(q=>{let X=s.sub([],M[q[0]],M[q[1]]),Y=s.sub([],M[q[2]],M[q[1]]),se=s.normalize([],s.cross([],X,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 X=i.points[q][T]-this.min[T];M=Math.min(M,X),U=Math.max(U,X)}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],X=M[1],Y=M[2],se=M[3],pe=Math.sin(U),xe=Math.cos(U);T[0]=q*xe+Y*pe,T[1]=X*xe+se*pe,T[2]=q*-pe+Y*xe,T[3]=X*-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)),X=Math.floor(Math.max(x.x,T.x,M.x,U.x)),Y=1;for(let se=q-Y;se<=X+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),X=Math.pow(2,T),Y=[X*U.x,X*U.y,0],se=[X*q.x,X*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 Ve=i.terrain?2/Math.min(this.tileSize,i.tileSize)*this.tileSize:3,ze=je=>({aabb:new la([je*X,0,0],[(je+1)*X,X,0]),zoom:0,x:0,y:0,wrap:je,fullyVisible:!1}),Be=[],tt=[],st=T,ht=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(),mt=je.x,pt=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,zt=je.aabb.distanceX(Et),xt=je.aabb.distanceY(Et),rr=Math.max(Math.abs(zt),Math.abs(xt)),h=Ve+(1<<st-je.zoom)-2;if(je.zoom===st||rr>h&&je.zoom>=xe){let m=st-je.zoom,f=Y[0]-.5-(mt<<m),v=Y[1]-.5-(pt<<m);tt.push({tileID:new s.OverscaledTileID(je.zoom===st?ht:je.zoom,je.wrap,je.zoom,mt,pt),distanceSq:s.sqrLen([se[0]-.5-mt,se[1]-.5-pt]),tileDistanceToCamera:Math.sqrt(f*f+v*v)})}else for(let m=0;m<4;m++){let f=(mt<<1)+m%2,v=(pt<<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,mt)=>je.distanceSq-mt.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),X=Math.floor(U/s.EXTENT),Y=new s.OverscaledTileID(this.tileZoom,0,this.tileZoom,q,X);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,X=M.y-U.y,Y=M.z-U.z,se=Math.sqrt(q*q+X*X+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,X=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,X,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,X=s.identity(new Float64Array(16));return s.translate(X,X,[q*U,M.y*U,0]),s.scale(X,X,[U/s.EXTENT,U/s.EXTENT,1]),s.multiply(X,d?this.alignedProjMatrix:this.projMatrix,X),T[x]=new Float32Array(X),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,X=180,Y=this.size,se=this._unmodified;if(this.latRange){let Ve=this.latRange;M=s.mercatorYfromLat(Ve[1])*this.worldSize,U=s.mercatorYfromLat(Ve[0])*this.worldSize,i=U-M<Y.y?Y.y/(U-M):0}if(this.lngRange){let Ve=this.lngRange;q=s.wrap(s.mercatorXfromLng(Ve[0])*this.worldSize,0,this.worldSize),X=s.wrap(s.mercatorXfromLng(Ve[1])*this.worldSize,0,this.worldSize),X<q&&(X+=this.worldSize),d=X-q<Y.x?Y.x/(X-q):0}let pe=this.point,xe=Math.max(d||0,i||0);if(xe)return this.center=this.unproject(new s.pointGeometry(d?(X+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 Ve=pe.y,ze=Y.y/2;Ve-ze<M&&(T=M+ze),Ve+ze>U&&(T=U-ze)}if(this.lngRange){let Ve=(q+X)/2,ze=s.wrap(pe.x,Ve-this.worldSize/2,Ve+this.worldSize/2),Be=Y.x/2;ze-Be<q&&(x=q+Be),ze+Be>X&&(x=X-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)),X=this.getHorizon(),Y=2*Math.atan(X/this.cameraToCenterDistance)*(.5+i.y/(2*X)),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,Ve=1.01*Math.min(pe,xe),ze=this.height/50;T=new Float64Array(16),s.perspective(T,this._fov,this.width/this.height,ze,Ve),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),ht=Math.sin(this.angle),je=d-Math.round(d)+st*Be+ht*tt,mt=x-Math.round(x)+st*tt+ht*Be,pt=new Float64Array(T);if(s.translate(pt,pt,[je>.5?je-1:je,mt>.5?mt-1:mt,0]),this.alignedProjMatrix=pt,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 iu{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,X=this._map.getBearing(),Y=this._map.getPitch(),se="";if(se+=i?`/${U}/${q}/${x}`:`${x}/${q}/${U}`,(X||Y)&&(se+="/"+Math.round(10*X)/10),Y&&(se+=`/${Math.round(Y)}`),this._hashName){let pe=this._hashName,xe=!1,Ve=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||Ve.push(`${pe}=${se}`),`#${Ve.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),nu=s.extend({deceleration:1e3,maxSpeed:360},as),Bs=s.extend({deceleration:1e3,maxSpeed:90},as);class Vu{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,nu);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=V.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=V.touchPos(d.getCanvasContainer(),T),U=M.map(X=>d.unproject(X)),q=M.reduce((X,Y,se,pe)=>X.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 Jn 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 Jn(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 So{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 Ri{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&&(V.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=V.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),X=Math.max(T.y,x.y);V.setTransform(this._box,`translate(${M}px,${q}px)`),this._box.style.width=U-M+"px",this._box.style.height=X-q+"px"}mouseupWindow(i,d){if(!this._active||i.button!==0)return;let x=this._startPos,T=d;if(this.reset(),V.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&&(V.remove(this._box),this._box=null),V.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(i,d){return this._map.fire(new s.Event(i,{originalEvent:d}))}}function $o(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=$o(x,d)))}touchmove(i,d,x){if(this.aborted||!this.centroid)return;let T=$o(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 ei{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 Pi={0:1,2:2};class io{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=V.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=Pi[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&&V.mouseButton(i)===this._eventButton&&(this._moved&&V.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ga extends io{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 Io extends io{_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 sr extends io{_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=$o(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 X=U.div(q);return this._sum._add(X),this._sum.mag()<this._clickTolerance?void 0:{around:M.div(q),panDelta:X}}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=Ko(x,d,T),q=Ko(x,d,M);if(!U||!q)return;let X=this._aroundCenter?null:U.add(q).div(2);return this._move([U,q],X,i)}touchend(i,d,x){if(!this._firstTwoTouches)return;let[T,M]=this._firstTwoTouches,U=Ko(x,d,T),q=Ko(x,d,M);U&&q||(this._active&&V.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 Ko(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 Qt 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 rn(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:rn(this._vector,x),pinchAround:d}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());let d=25/(Math.PI*this._minDiameter)*360,x=rn(i,this._startVector);return Math.abs(x)<d}}function ou(E){return Math.abs(E.y)>Math.abs(E.x)}class nn 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,ou(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 ou(i)&&ou(d)&&U}}let tr={panStep:100,bearingStep:15,pitchStep:10};class fo{constructor(){let i=tr;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 X=q.getZoom();q.easeTo({duration:300,easeId:"keyboardHandler",easing:au,zoom:d?Math.round(X)+d*(i.shiftKey?2:1):X,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 au(E){return E*(2-E)}let js=4.000244140625;class Bo{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=V.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,X=2/(1+Math.exp(-Math.abs(this._delta*q)));this._delta<0&&X!==0&&(X=1/X);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*X))),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),X=T(q);M=s.number(x,d,X),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 no{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 oo{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 su{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 Qn=E=>E.zoom||E.drag||E.pitch||E.rotate;class ao 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 Vu(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)V.addEventListener(T,M,T===document?this.handleWindowEvent:this.handleEvent,U)}destroy(){for(let[i,d,x]of this._listeners)V.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 Ri(d,i);this._add("boxZoom",T);let M=new ei,U=new Rl;d.doubleClickZoom=new no(U,M),this._add("tapZoom",M),this._add("clickZoom",U);let q=new qt;this._add("tapDragZoom",q);let X=d.touchPitch=new nn(d);this._add("touchPitch",X);let Y=new Io(i),se=new sr(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 oo(x,pe,xe),this._add("mousePan",pe),this._add("touchPan",xe,["touchZoom","touchRotate"]);let Ve=new Ll,ze=new Qt;d.touchZoomRotate=new su(x,ze,Ve,q),this._add("touchRotate",Ve,["touchPan","touchZoom"]),this._add("touchZoom",ze,["touchPan","touchRotate"]);let Be=d.scrollZoom=new Bo(d,this);this._add("scrollZoom",Be,["mousePan"]);let tt=d.keyboard=new fo;this._add("keyboard",tt),this._add("blockableMapEvent",new So(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(Qn(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,X=q?this._getMapTouches(q):void 0,Y=X?V.touchPos(this._el,X):V.mousePos(this._el,i);for(let{handlerName:xe,handler:Ve,allowed:ze}of this._handlers){if(!Ve.isEnabled())continue;let Be;this._blockedByActive(U,ze,xe)?Ve.reset():Ve[d||i.type]&&(Be=Ve[d||i.type](i,Y,X),this.mergeHandlerResult(T,M,Be,xe,x),Be&&Be.needsRenderFrame&&this._triggerRenderFrame()),(Be||Ve.isActive())&&(U[xe]=Ve)}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:X,bearingDelta:Y,pitchDelta:se,around:pe,pinchAround:xe}=i;xe!==void 0&&(pe=xe),T._stop(!0),pe=pe||T.transform.centerPoint;let Ve=M.pointLocation(q?pe.sub(q):pe);Y&&(M.bearing+=Y),se&&(M.pitch+=se),X&&(M.zoom+=X),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(Ve,pe),this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(d,x,!0)}_fireEvents(i,d,x){let T=Qn(this._eventsInProgress),M=Qn(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={},X;for(let se in this._eventsInProgress){let{handlerName:pe,originalEvent:xe}=this._eventsInProgress[se];this._handlersById[pe].isActive()||(delete this._eventsInProgress[se],X=d[pe]||xe,q[`${se}end`]=X)}for(let se in q)this._fireEvent(se,q[se]);let Y=Qn(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:X})):(this._map.fire(new s.Event("moveend",{originalEvent:X})),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 ao("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}let Hi={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 pt=T.padding;T.padding={top:pt,bottom:pt,right:pt,left:pt}}T.padding=s.extend(M,T.padding);let U=this.transform,q=U.padding,X=U.project(s.LngLat.convert(i)),Y=U.project(s.LngLat.convert(d)),se=X.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)),Ve=new s.pointGeometry(Math.min(se.x,pe.x),Math.min(se.y,pe.y)),ze=xe.sub(Ve),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),ht=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),mt=ht.add(je).mult(U.scale/U.zoomScale(st));return{center:U.unproject(X.add(Y).div(2).sub(mt)),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,X=U.y-M.y,Y=U.z-M.z,se=Math.hypot(q,X,Y);if(se===0)throw new Error("Can't calculate camera options with same From and To");let pe=Math.hypot(q,X),xe=this.transform.scaleZoom(this.transform.cameraToCenterDistance/se/this.transform.tileSize),Ve=180*Math.atan2(q,-X)/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:Ve}}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(),X="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),Ve=x.centerPoint.add(xe),ze=x.pointLocation(Ve),Be=s.LngLat.convert(i.center||ze);this._normalizeCenter(Be);let tt=x.project(ze),st=x.project(Be).sub(tt),ht=x.zoomScale(X-T),je,mt;i.around&&(je=s.LngLat.convert(i.around),mt=x.locationPoint(je));let pt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||X!==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,pt),this._ease(vt=>{if(this._zooming&&(x.zoom=s.number(T,X,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),Ve=x.centerPoint.add(xe)),je)x.setLocationAtPoint(je,mt);else{let Et=x.zoomScale(x.zoom-T),zt=X>T?Math.min(2,ht):Math.max(.5,ht),xt=Math.pow(zt,1-vt),rr=x.unproject(tt.add(st.mult(vt*xt)).mult(Et));x.setLocationAtPoint(x.renderWorldCopies?rr.wrap():rr,Ve)}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(),X="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(X-T),Ve=s.pointGeometry.convert(i.offset),ze=x.centerPoint.add(Ve),Be=x.pointLocation(ze),tt=s.LngLat.convert(i.center||Be);this._normalizeCenter(tt);let st=x.project(Be),ht=x.project(tt).sub(st),je=i.curve,mt=Math.max(x.width,x.height),pt=mt/xe,vt=ht.mag();if("minZoom"in i){let I=s.clamp(Math.min(i.minZoom,T,X),x.minZoom,x.maxZoom),L=mt/x.zoomScale(I-T);je=Math.sqrt(L/vt*2)}let Et=je*je;function zt(I){let L=(pt*pt-mt*mt+(I?-1:1)*Et*Et*vt*vt)/(2*(I?pt:mt)*Et*vt);return Math.log(Math.sqrt(L*L+1)-L)}function xt(I){return(Math.exp(I)-Math.exp(-I))/2}function rr(I){return(Math.exp(I)+Math.exp(-I))/2}let h=zt(0),m=function(I){return rr(h)/rr(h+je*I)},f=function(I){return mt*((rr(h)*(xt(L=h+je*I)/rr(L))-xt(h))/Et)/vt;var L},v=(zt(1)-h)/je;if(Math.abs(vt)<1e-6||!isFinite(v)){if(Math.abs(mt-pt)<1e-6)return this.easeTo(i,d);let I=pt<mt?-1:1;v=Math.abs(Math.log(pt/mt))/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?X: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(Ve));let G=I===1?tt:x.unproject(st.add(ht.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=V.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=V.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=V.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){V.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(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=V.create("div","maplibregl-ctrl mapboxgl-ctrl");let d=V.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return d.target="_blank",d.rel="noopener nofollow",d.href="https://maplibre.org/",d.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),d.setAttribute("rel","noopener nofollow"),this._container.appendChild(d),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){V.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){let 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 lu{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 uu={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},Ho={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},Uo={showCompass:!0,showZoom:!0,visualizePitch:!1};class Fr{constructor(i,d,x=!1){this._clickTolerance=10,this.element=d,this.mouseRotate=new Io({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,x&&(this.mousePitch=new sr({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),s.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),V.addEventListener(d,"mousedown",this.mousedown),V.addEventListener(d,"touchstart",this.touchstart,{passive:!1}),V.addEventListener(d,"touchmove",this.touchmove),V.addEventListener(d,"touchend",this.touchend),V.addEventListener(d,"touchcancel",this.reset)}down(i,d){this.mouseRotate.mousedown(i,d),this.mousePitch&&this.mousePitch.mousedown(i,d),V.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;V.removeEventListener(i,"mousedown",this.mousedown),V.removeEventListener(i,"touchstart",this.touchstart,{passive:!1}),V.removeEventListener(i,"touchmove",this.touchmove),V.removeEventListener(i,"touchend",this.touchend),V.removeEventListener(i,"touchcancel",this.reset),this.offTemp()}offTemp(){V.enableDrag(),V.removeEventListener(window,"mousemove",this.mousemove),V.removeEventListener(window,"mouseup",this.mouseup)}mousedown(i){this.down(s.extend({},i,{ctrlKey:!0,preventDefault:()=>i.preventDefault()}),V.mousePos(this.element,i)),V.addEventListener(window,"mousemove",this.mousemove),V.addEventListener(window,"mouseup",this.mouseup)}mousemove(i){this.move(i,V.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=V.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=V.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 Co(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 lr={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 hr(E,i,d){let x=E.classList;for(let T in lr)x.remove(`maplibregl-${d}-anchor-${T}`,`mapboxgl-${d}-anchor-${T}`);x.add(`maplibregl-${d}-anchor-${i}`,`mapboxgl-${d}-anchor-${i}`)}class Yo 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=V.create("div"),this._element.setAttribute("aria-label","Map marker");let x=V.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=V.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"stroke","none"),U.setAttributeNS(null,"stroke-width","1"),U.setAttributeNS(null,"fill","none"),U.setAttributeNS(null,"fill-rule","evenodd");let q=V.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"fill-rule","nonzero");let X=V.createNS("http://www.w3.org/2000/svg","g");X.setAttributeNS(null,"transform","translate(3.0, 29.0)"),X.setAttributeNS(null,"fill","#000000");let Y=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let ht of Y){let je=V.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",ht.rx),je.setAttributeNS(null,"ry",ht.ry),X.appendChild(je)}let se=V.createNS("http://www.w3.org/2000/svg","g");se.setAttributeNS(null,"fill",this._color);let pe=V.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=V.createNS("http://www.w3.org/2000/svg","g");xe.setAttributeNS(null,"opacity","0.25"),xe.setAttributeNS(null,"fill","#000000");let Ve=V.createNS("http://www.w3.org/2000/svg","path");Ve.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(Ve);let ze=V.createNS("http://www.w3.org/2000/svg","g");ze.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ze.setAttributeNS(null,"fill","#FFFFFF");let Be=V.createNS("http://www.w3.org/2000/svg","g");Be.setAttributeNS(null,"transform","translate(8.0, 8.0)");let tt=V.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=V.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(X),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()}),hr(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),V.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=Co(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()),V.setTransform(this._element,`${lr[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},Vn,xi=0,Jo=!1,cr={maxWidth:100,unit:"metric"};function ur(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 X=3.2808*q;X>5280?ha(i,x,X/5280,E._getUIString("ScaleControl.Miles")):ha(i,x,X,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(X){let Y=Math.pow(10,Math.ceil(-Math.log(X)/Math.LN10));return Math.round(X*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"},Si=["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 so={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({},Ho,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 lu,this._controls=[],this._mapId=s.uniqueId(),this._locale=s.extend({},uu,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 iu(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:X,data:Y}=s.exported.getImageData(i);this.style.addImage(E,{data:new s.RGBAImage({width:q,height:X},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:X,data:Y}=i,se=i;this.style.addImage(E,{data:new s.RGBAImage({width:q,height:X},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=V.create("div","maplibregl-canvas-container mapboxgl-canvas-container",E);this._interactive&&i.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=V.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=V.create("div","maplibregl-control-container mapboxgl-control-container",E),T=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(M=>{T[M]=V.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=V.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 ru(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 X=new s.EvaluationParameters(U,{now:q,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Y=X.crossFadingFactor();Y===1&&Y===this._crossFadingFactor||(T=!0,this._crossFadingFactor=Y),this.style.update(X)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new 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),V.remove(this._canvasContainer),V.remove(this._controlContainer),this._cooperativeGestures&&V.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({},Uo,E),this._container=V.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})),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),V.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=V.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 Fr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){V.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(E,i){let d=V.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=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),i=this._setupUI,Vn!==void 0?i(Vn):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Vn=d.state!=="denied",i(Vn)}):(Vn=!!window.navigator.geolocation,i(Vn)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),V.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xi=0,Jo=!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&&Jo)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=V.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",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=V.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Yo(this._dotElement),this._circleElement=V.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Yo({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--,Jo=!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},Jo=!0):(E=this.options.positionOptions,Jo=!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({},cr,E),s.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ur(this._map,this._container,this.options)}onAdd(E){return this._map=E,this._container=V.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(){V.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(E){this.options.unit=E,ur(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=V.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(){V.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){let E=this._fullscreenButton=V.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);V.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=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=V.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){V.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends 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&&V.remove(this._content),this._container&&(V.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new 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=V.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=V.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(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=V.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=V.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(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=Co(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();V.setTransform(this._container,`${lr[d]} translate(${T.x}px,${T.y}px)`),hr(this._container,d,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let E=this._container.querySelector(Si);E&&E.focus()}_onClose(){this.remove()}},Marker:Yo,Style:In,LngLat:s.LngLat,LngLatBounds:s.LngLatBounds,Point:s.pointGeometry,MercatorCoordinate:s.MercatorCoordinate,Evented:s.Evented,AJAXError:s.AJAXError,config:s.config,CanvasSource:Sr,GeoJSONSource:Vr,ImageSource:zr,RasterDEMTileSource:At,RasterTileSource:Jt,VectorTileSource:jt,VideoSource:br,prewarm:function(){ln().acquire(Ni)},clearPrewarmedResources:function(){let E=Zi;E&&(E.isPreloaded()&&E.numActive()===1?(E.release(Ni),Zi=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 Cr.workerCount},set workerCount(E){Cr.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 Hi.extend(so,{isSafari:s.isSafari,getPerformanceMetrics:s.PerformanceUtils.getPerformanceMetrics}),so});var r=n;return r})});var l1=qf((IB,s1)=>{var IE="Expected a function",o1=NaN,CE="[object Symbol]",AE=/^\s+|\s+$/g,PE=/^[-+]0x[0-9a-f]+$/i,ME=/^0b[01]+$/i,kE=/^0o[0-7]+$/i,LE=parseInt,RE=typeof global=="object"&&global&&global.Object===Object&&global,zE=typeof self=="object"&&self&&self.Object===Object&&self,DE=RE||zE||Function("return this")(),OE=Object.prototype,FE=OE.toString,BE=Math.max,UE=Math.min,F_=function(){return DE.Date.now()};function NE(y,p,n){var u,r,s,P,z,F,N=0,V=!1,me=!1,_e=!0;if(typeof y!="function")throw new TypeError(IE);p=a1(p)||0,B_(n)&&(V=!!n.leading,me="maxWait"in n,s=me?BE(a1(n.maxWait)||0,p):s,_e="trailing"in n?!!n.trailing:_e);function Se(ct){var Tt=u,St=r;return u=r=void 0,N=ct,P=y.apply(St,Tt),P}function Ue(ct){return N=ct,z=setTimeout(Ge,p),V?Se(ct):P}function He(ct){var Tt=ct-F,St=ct-N,Lt=p-Tt;return me?UE(Lt,s-St):Lt}function Ie(ct){var Tt=ct-F,St=ct-N;return F===void 0||Tt>=p||Tt<0||me&&St>=s}function Ge(){var ct=F_();if(Ie(ct))return Je(ct);z=setTimeout(Ge,He(ct))}function Je(ct){return z=void 0,_e&&u?Se(ct):(u=r=void 0,P)}function rt(){z!==void 0&&clearTimeout(z),N=0,u=F=r=z=void 0}function _t(){return z===void 0?P:Je(F_())}function yt(){var ct=F_(),Tt=Ie(ct);if(u=arguments,r=this,F=ct,Tt){if(z===void 0)return Ue(F);if(me)return z=setTimeout(Ge,p),Se(F)}return z===void 0&&(z=setTimeout(Ge,p)),P}return yt.cancel=rt,yt.flush=_t,yt}function B_(y){var p=typeof y;return!!y&&(p=="object"||p=="function")}function VE(y){return!!y&&typeof y=="object"}function GE(y){return typeof y=="symbol"||VE(y)&&FE.call(y)==CE}function a1(y){if(typeof y=="number")return y;if(GE(y))return o1;if(B_(y)){var p=typeof y.valueOf=="function"?y.valueOf():y;y=B_(p)?p+"":p}if(typeof y!="string")return y===0?y:+y;y=y.replace(AE,"");var n=ME.test(y);return n||kE.test(y)?LE(y.slice(2),n?2:8):PE.test(y)?o1:+y}s1.exports=NE});var f1=qf((CB,p1)=>{var h1="Expected a function",u1=NaN,jE="[object Symbol]",qE=/^\s+|\s+$/g,ZE=/^[-+]0x[0-9a-f]+$/i,WE=/^0b[01]+$/i,XE=/^0o[0-7]+$/i,$E=parseInt,KE=typeof global=="object"&&global&&global.Object===Object&&global,HE=typeof self=="object"&&self&&self.Object===Object&&self,YE=KE||HE||Function("return this")(),JE=Object.prototype,QE=JE.toString,eT=Math.max,tT=Math.min,U_=function(){return YE.Date.now()};function rT(y,p,n){var u,r,s,P,z,F,N=0,V=!1,me=!1,_e=!0;if(typeof y!="function")throw new TypeError(h1);p=c1(p)||0,mg(n)&&(V=!!n.leading,me="maxWait"in n,s=me?eT(c1(n.maxWait)||0,p):s,_e="trailing"in n?!!n.trailing:_e);function Se(ct){var Tt=u,St=r;return u=r=void 0,N=ct,P=y.apply(St,Tt),P}function Ue(ct){return N=ct,z=setTimeout(Ge,p),V?Se(ct):P}function He(ct){var Tt=ct-F,St=ct-N,Lt=p-Tt;return me?tT(Lt,s-St):Lt}function Ie(ct){var Tt=ct-F,St=ct-N;return F===void 0||Tt>=p||Tt<0||me&&St>=s}function Ge(){var ct=U_();if(Ie(ct))return Je(ct);z=setTimeout(Ge,He(ct))}function Je(ct){return z=void 0,_e&&u?Se(ct):(u=r=void 0,P)}function rt(){z!==void 0&&clearTimeout(z),N=0,u=F=r=z=void 0}function _t(){return z===void 0?P:Je(U_())}function yt(){var ct=U_(),Tt=Ie(ct);if(u=arguments,r=this,F=ct,Tt){if(z===void 0)return Ue(F);if(me)return z=setTimeout(Ge,p),Se(F)}return z===void 0&&(z=setTimeout(Ge,p)),P}return yt.cancel=rt,yt.flush=_t,yt}function iT(y,p,n){var u=!0,r=!0;if(typeof y!="function")throw new TypeError(h1);return mg(n)&&(u="leading"in n?!!n.leading:u,r="trailing"in n?!!n.trailing:r),rT(y,p,{leading:u,maxWait:p,trailing:r})}function mg(y){var p=typeof y;return!!y&&(p=="object"||p=="function")}function nT(y){return!!y&&typeof y=="object"}function oT(y){return typeof y=="symbol"||nT(y)&&QE.call(y)==jE}function c1(y){if(typeof y=="number")return y;if(oT(y))return u1;if(mg(y)){var p=typeof y.valueOf=="function"?y.valueOf():y;y=mg(p)?p+"":p}if(typeof y!="string")return y===0?y:+y;y=y.replace(qE,"");var n=WE.test(y);return n||XE.test(y)?$E(y.slice(2),n?2:8):ZE.test(y)?u1:+y}p1.exports=iT});var _g={};ay(_g,{CopyrightControl:()=>ux,Layer:()=>Is,MapboxLayer:()=>np,MapboxStyleLayer:()=>n1,MaplibreLayer:()=>op,RealtimeAPI:()=>$f,RealtimeLayer:()=>m1,RealtimeModes:()=>ia,RoutingAPI:()=>Zf,RoutingControl:()=>H0,RoutingLayer:()=>pg,StopFinderControl:()=>J0,StopsAPI:()=>Wf,VectorLayer:()=>g1,WMSLayer:()=>y1,compareDepartures:()=>id,createRealtimeFilters:()=>hy,debounceDeparturesMessages:()=>Ay,debounceWebsocketMessages:()=>Xf,fullTrajectoryDelayStyle:()=>d1,fullTrajectoryStyle:()=>yg,getCircleCanvas:()=>Oy,getDelayBgCanvas:()=>zy,getDelayTextCanvas:()=>Dy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>Kf,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getTextCanvas:()=>Fy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Zh,pad:()=>zm,realtimeConfig:()=>rf,realtimeDefaultStyle:()=>Kh,realtimeDelayStyle:()=>By,realtimeSimpleStyle:()=>Uy,removeDuplicate:()=>Wh,renderTrajectories:()=>Hf,sortAndFilterDepartures:()=>nd,sortByDelay:()=>py});var H1=function(){function y(p){this.propagationStopped,this.defaultPrevented,this.type=p,this.target=null}return y.prototype.preventDefault=function(){this.defaultPrevented=!0},y.prototype.stopPropagation=function(){this.propagationStopped=!0},y}();var sn=H1;var jp={PROPERTYCHANGE:"propertychange"};var Y1=function(){function y(){this.disposed=!1}return y.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},y.prototype.disposeInternal=function(){},y}(),yv=Y1;function _v(y,p,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],p),r<0?P=u+1:(z=u,F=!r);return F?P:~P}function rh(y,p){return y>p?1:y<p?-1:0}function vv(y,p){return y.indexOf(p)>=0}function xv(y,p,n){for(;p<n;){var u=y[p];y[p]=y[n],y[n]=u,++p,--n}}function Ka(y,p){for(var n=Array.isArray(p)?p:[p],u=n.length,r=0;r<u;r++)y[y.length]=n[r]}function _s(y,p){var n=y.length;if(n!==p.length)return!1;for(var u=0;u<n;u++)if(y[u]!==p[u])return!1;return!0}function Am(){return!0}function qh(){}function bv(y){var p=!1,n,u,r;return function(){var s=Array.prototype.slice.call(arguments);return(!p||this!==r||!_s(s,u))&&(p=!0,r=this,u=s,n=y.apply(this,arguments)),n}}var Ra=typeof Object.assign=="function"?Object.assign:function(y,p){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 p in y)delete y[p]}var Pm=typeof Object.values=="function"?Object.values:function(y){var p=[];for(var n in y)p.push(y[n]);return p};function Vl(y){var p;for(p in y)return!1;return!p}var J1=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q1=function(y){J1(p,y);function p(n){var u=y.call(this)||this;return u.eventTarget_=n,u.pendingRemovals_=null,u.dispatching_=null,u.listeners_=null,u}return p.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)}},p.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 sn(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 N,V=0,me=s.length;V<me;++V)if("handleEvent"in s[V]?N=s[V].handleEvent(P):N=s[V].call(this,P),N===!1||P.propagationStopped){N=!1;break}if(--z[r]===0){var _e=F[r];for(delete F[r];_e--;)this.removeEventListener(r,qh);delete z[r]}return N}},p.prototype.disposeInternal=function(){this.listeners_&&ih(this.listeners_)},p.prototype.getListeners=function(n){return this.listeners_&&this.listeners_[n]||void 0},p.prototype.hasListener=function(n){return this.listeners_?n?n in this.listeners_:Object.keys(this.listeners_).length>0:!1},p.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]=qh,++this.pendingRemovals_[n]):(r.splice(s,1),r.length===0&&delete this.listeners_[n]))}},p}(yv),nh=Q1;var Ji={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 uo(y,p,n,u,r){if(u&&u!==y&&(n=n.bind(u)),r){var s=n;n=function(){y.removeEventListener(p,n),s.apply(this,arguments)}}var P={target:y,type:p,listener:n};return y.addEventListener(p,n),P}function qp(y,p,n,u){return uo(y,p,n,u,!0)}function Po(y){y&&y.target&&(y.target.removeEventListener(y.type,y.listener),ih(y))}var eb=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Mm=function(y){eb(p,y);function p(){var n=y.call(this)||this;return n.on=n.onInternal,n.once=n.onceInternal,n.un=n.unInternal,n.revision_=0,n}return p.prototype.changed=function(){++this.revision_,this.dispatchEvent(Ji.CHANGE)},p.prototype.getRevision=function(){return this.revision_},p.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]=uo(this,n[P],u);return s}else return uo(this,n,u)},p.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]=qp(this,n[P],u)}else r=qp(this,n,u);return u.ol_key=r,r},p.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)},p}(nh);Mm.prototype.on;Mm.prototype.once;Mm.prototype.un;function Ha(y){if(Array.isArray(y))for(var p=0,n=y.length;p<n;++p)Po(y[p]);else Po(y)}var km=Mm;function jr(){return function(){throw new Error("Unimplemented abstract method.")}()}var tb=0;function Ai(y){return y.ol_uid||(y.ol_uid=String(++tb))}var Lm="6.14.1";var Ev=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),wv=function(y){Ev(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.key=u,s.oldValue=r,s}return p}(sn);var rb=function(y){Ev(p,y);function p(n){var u=y.call(this)||this;return u.on,u.once,u.un,Ai(u),u.values_=null,n!==void 0&&u.setProperties(n),u}return p.prototype.get=function(n){var u;return this.values_&&this.values_.hasOwnProperty(n)&&(u=this.values_[n]),u},p.prototype.getKeys=function(){return this.values_&&Object.keys(this.values_)||[]},p.prototype.getProperties=function(){return this.values_&&Ra({},this.values_)||{}},p.prototype.hasProperties=function(){return!!this.values_},p.prototype.notify=function(n,u){var r;r="change:".concat(n),this.hasListener(r)&&this.dispatchEvent(new wv(r,n,u)),r=jp.PROPERTYCHANGE,this.hasListener(r)&&this.dispatchEvent(new wv(r,n,u))},p.prototype.addChangeListener=function(n,u){this.addEventListener("change:".concat(n),u)},p.prototype.removeChangeListener=function(n,u){this.removeEventListener("change:".concat(n),u)},p.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)}},p.prototype.setProperties=function(n,u){for(var r in n)this.set(r,n[r],u)},p.prototype.applyProperties=function(n){!n.values_||Ra(this.values_||(this.values_={}),n.values_)},p.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)}},p}(km),Mo=rb;var ib=(y,p)=>{let n=new URL(y);return Object.entries(p||{}).forEach(([r,s])=>{s!=null&&n.searchParams.set(r,s)}),n},Zh=ib;var sy=class extends Mo{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=Zh(`${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))}})}},Rm=sy;var ly=class extends Rm{constructor(p={}){super({url:"https://api.geops.io/routing/v1/",...p})}route(p,n){return this.fetch("",p,n)}},Zf=ly;var uy=class extends Rm{constructor(p={}){super({url:"https://api.geops.io/stops/v1/",...p})}search(p,n){return this.fetch("",p,n)}},Wf=uy;var Zp=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(p,n={}){let u=`${p} ${n.channel}`;return u+=n.args?` ${n.args}`:"",u+=n.id?` ${n.id}`:"",u.trim()}connect(p,n=()=>{}){this.websocket&&!this.closed&&this.websocket.close(),this.websocket=new WebSocket(p),this.open?(n(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{n(),this.subscribePreviousSubscriptions()})}close(){this.websocket&&(this.websocket.onclose=null,this.websocket.close(),this.websocket=void 0,this.messagesOnOpen=[])}send(p){if(!this.websocket)return;let n=()=>{this.websocket?.send(p)};this.open?this.messagesOnOpen.includes(p)||n():this.messagesOnOpen.includes(p)||(this.messagesOnOpen.push(p),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],n()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}addEvents(p,n){this.websocket&&(this.websocket.addEventListener("message",p),n&&(this.websocket.addEventListener("error",n),this.websocket.addEventListener("close",n)))}removeEvents(p,n){this.websocket&&(this.websocket.removeEventListener("message",p),n&&(this.websocket.removeEventListener("error",n),this.websocket.removeEventListener("close",n)))}listen(p,n,u){this.unlisten(p,n);let r=s=>{let P;try{P=JSON.parse(s.data)}catch(N){console.error("WebSocket: unable to parse JSON data",N,s.data);return}let z=p.channel;z+=p.args?` ${p.args}`:"";let F;P.source==="buffer"?F=P.content:F=[P],F.forEach(N=>{N?.source===z&&(!p.id||p.id===P.client_reference)&&n(N)})};return this.addEvents(r,u),{onMessageCb:r,onErrorCb:u}}unlisten(p,n){[...this.subscriptions||[],...this.requests||[]].filter(u=>u.params.channel===p.channel&&(!n||u.cb===n)).forEach(({onMessageCb:u,onErrorCb:r})=>{this.removeEvents(u,r)})}get(p,n,u){let r=Zp.getRequestString("GET",p);this.send(r);let s=V=>(...me)=>{V(...me);let _e=this.requests.findIndex(He=>r===He.requestString&&n===He.cb),{onMessageCb:Se,onErrorCb:Ue}=this.requests[_e];this.removeEvents(Se,Ue),this.requests.splice(_e,1)},{onMessageCb:P,onErrorCb:z}=this.listen(p,s(n),u&&s(u));this.requests||(this.requests=[]);let F=this.requests.findIndex(V=>r===V.requestString&&n===V.cb),N={params:p,requestString:r,cb:n,errorCb:u,onMessageCb:P,onErrorCb:z};F>-1?this.requests[F]=N:this.requests.push(N)}subscribe(p,n,u,r=!1){let{onMessageCb:s,onErrorCb:P}=this.listen(p,n,u),z=Zp.getRequestString("",p),F=this.subscriptions.findIndex(V=>p.channel===V.params.channel&&n===V.cb),N={params:p,cb:n,errorCb:u,onMessageCb:s,onErrorCb:P,quiet:r};F>-1?this.subscriptions[F]=N:this.subscriptions.push(N),this.subscribed[z]||(N.quiet||(this.send(`GET ${z}`),this.send(`SUB ${z}`)),this.subscribed[z]=!0)}unsubscribe(p,n){let u=this.subscriptions.filter(r=>r.params.channel===p&&(!n||r.cb===n));u.forEach(({onMessageCb:r,onErrorCb:s})=>{this.removeEvents(r,s)}),this.subscriptions=this.subscriptions.filter(r=>r.params.channel!==p||n&&r.cb!==n),p&&this.subscribed[p]&&!this.subscriptions.find(r=>r.params.channel===p)&&u.find(r=>!r.quiet)&&(this.send(`DEL ${p}`),this.subscribed[p]=!1)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(p=>{this.subscribed[p]=!1}),[...this.subscriptions].forEach(p=>{this.subscribe(p.params,p.cb,p.errorCb,p.quiet)})}},Tv=Zp;var nb=(y,p,n=100)=>{let u={},r={},s=[];return P=>{let{source:z,content:F}=P;u[z]&&window.clearTimeout(u[z]),p?r[p(F)]=F:s.push(F),u[z]=window.setTimeout(()=>{let N=p?Object.values(r):s;y(N)},n)}},Xf=nb;var ob=(y,p)=>y===p.SCHEMATIC?"_schematic":"",xu=ob;var ia={RAW:"raw",TOPOGRAPHIC:"topographic",SCHEMATIC:"schematic"},cy=class{constructor(p={}){this.defineProperties(p),this.prefix=p.prefix||"",this.onOpen=this.onOpen.bind(this)}defineProperties(p){let n=p;typeof p=="string"&&(n={url:p});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:N=>{r=N,this.open()}},projection:{get:()=>s,set:N=>{N!==s&&(s=N,this.wsApi&&this.wsApi.send(`PROJECTION ${s}`))}},bbox:{get:()=>P,set:N=>{JSON.stringify(N)!==JSON.stringify(P)&&(P=N,this.wsApi&&P&&this.wsApi.send(`BBOX ${P.join(" ")}`))}},buffer:{get:()=>z,set:N=>{JSON.stringify(N)!==JSON.stringify(z)&&(z=N,this.wsApi&&this.wsApi.send(`BUFFER ${z.join(" ")}`))}},wsApi:{value:F,writable:!0},pingIntervalMs:{value:p.pingIntervalMs||1e4,writable:!0},reconnectTimeoutMs:{value:p.pingIntervalMs||100,writable:!0}})}open(){this.close(),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(p,n,u=()=>{},r=!1){!p||!n||this.wsApi.subscribe({channel:p},n,u,r)}unsubscribe(p,n="",u){let r=xu(ia.SCHEMATIC,ia),s=xu(ia.TOPOGRAPHIC,ia);this.wsApi.unsubscribe(`${p}${r}${n||""}`,u),this.wsApi.unsubscribe(`${p}${s}${n||""}`,u)}subscribeDepartures(p,n,u=()=>{},r=!1){this.subscribe(`timetable_${p}`,n,u,r)}unsubscribeDepartures(p,n){this.unsubscribe(`timetable_${p}`,"",n)}subscribeDisruptions(p,n=()=>{},u=!1){this.subscribe(`${this.prefix}newsticker`,p,n,u)}unsubscribeDisruptions(p){this.unsubscribe(`${this.prefix}newsticker`,"",p)}getStation(p,n){let u={channel:`station${xu(n,ia)}`,args:p};return new Promise((r,s)=>{this.wsApi.get(u,r,s)})}getStations(p,n=100){return new Promise(u=>{this.wsApi.get({channel:`station${xu(p,ia)}`},Xf(u,void 0,n))})}subscribeStations(p,n,u=()=>{},r=!1){this.subscribe(`station${xu(p,ia)}`,n,u,r)}unsubscribeStations(p){this.unsubscribe("station","",p)}subscribeExtraGeoms(p,n=()=>{},u=!1){this.subscribe("extra_geoms",p,n,u)}unsubscribeExtraGeoms(p){this.unsubscribe("extra_geoms","",p)}subscribeTrajectory(p,n,u=()=>{},r=!1){this.unsubscribeTrajectory(n),this.subscribe(`trajectory${xu(p,ia)}`,n,u,r)}unsubscribeTrajectory(p){this.unsubscribe("trajectory","",p)}subscribeDeletedVehicles(p,n,u=()=>{},r=!1){this.unsubscribeDeletedVehicles(n),this.subscribe(`deleted_vehicles${xu(p,ia)}`,n,u,r)}unsubscribeDeletedVehicles(p){this.unsubscribe("deleted_vehicles","",p)}getFullTrajectory(p,n,u){let r=[`full_trajectory${xu(n,ia)}`];p&&r.push(p),(!n||n===ia.TOPOGRAPHIC)&&u&&r.push(`gen${u}`);let s={channel:r.join("_")};return new Promise((P,z)=>{this.wsApi.get(s,P,z)})}subscribeFullTrajectory(p,n,u,r=()=>{},s=!1){this.subscribe(`full_trajectory${xu(n,ia)}_${p}`,u,r,s)}unsubscribeFullTrajectory(p,n){this.unsubscribe("full_trajectory",`_${p}`,n)}getStopSequence(p){return new Promise((n,u)=>{this.wsApi.get({channel:`stopsequence_${p}`},n,u)})}subscribeStopSequence(p,n,u=()=>{},r=!1){this.subscribe(`stopsequence_${p}`,n,u,r)}unsubscribeStopSequence(p,n){this.unsubscribe("stopsequence",`_${p}`,n)}subscribeHealthCheck(p,n=()=>{},u=!1){this.subscribe("healthcheck",p,n,u)}unsubscribeHealthCheck(p){this.unsubscribe("healthcheck","",p)}},$f=cy;var ab=y=>{let p=y.filter(s=>s!=null&&s.trim&&s.trim()),n=p.map(s=>s.toLowerCase());return[...new Set(n)].map(s=>p.find(P=>P.toLowerCase()===s))},Wh=ab;var sb=y=>{if(!y)return[];let{style:p}=y;if(!p)return[];let{sourceCaches:n}=p,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)},oc=sb;var lb=(y,p,n,u)=>{let r=[];if(!y&&!p&&!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(N=>new RegExp(N,"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:N,name:V}=F.properties,me=(V||N&&N.name||"").toUpperCase();return me?P.includes(me):!1};r.push(z)}if(p){let P=(typeof p=="string"?p.split(","):p).map(F=>parseInt(F,10)),z=F=>{let N=F.properties.route_identifier||F.properties.routeIdentifier||"",V=parseInt(N.split(".")[0],10);return P.includes(V)};r.push(z)}if(n){let s=typeof n=="string"?[n]:n,P=z=>s.some(F=>{let N=z.properties.operator||z.properties.tenant||"";return new RegExp(F,"i").test(N)});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},hy=lb;var Sv=y=>{let p=y;Array.isArray(p)||(p=[y]);let n=[];return p.forEach(u=>{n.push(u);let{children:r}=u;n=n.concat(Sv(r||[]))}),n},Kf=Sv;var Iv=(y=new Date)=>{let p=(y.getUTCMonth()+1).toString();p=p.length===1?`0${p}`:p;let n=y.getUTCDate().toString();return n=n.length===1?`0${n}`:n,[y.getUTCFullYear(),p,n].join("")},Cv=y=>[y.getUTCHours(),y.getUTCMinutes(),`${y.getUTCSeconds()}.${y.getUTCMilliseconds()}`].join(":"),zm=y=>y<10?`0${y}`:`${y}`,Av=y=>{if(!y||y<=0)return"";let p=new Date(y);return`${zm(p.getHours())}:${zm(p.getMinutes())}`};var ub=(y,p)=>{let n=y.properties,u=p.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},py=ub;var oh=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",CS=oh.indexOf("firefox")!==-1,cb=oh.indexOf("safari")!==-1&&oh.indexOf("chrom")==-1,AS=cb&&!!(oh.indexOf("version/15.4")>=0||oh.match(/cpu (os|iphone os) 15_4 like mac os x/)),PS=oh.indexOf("webkit")!==-1&&oh.indexOf("edge")==-1,MS=oh.indexOf("macintosh")!==-1;var ah=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Pv=typeof Image<"u"&&Image.prototype.decode,kS=function(){var y=!1;try{var p=Object.defineProperty({},"passive",{get:function(){y=!0}});window.addEventListener("_",null,p),window.removeEventListener("_",null,p)}catch{}return y}();var hb=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),pb=function(y){hb(p,y);function p(n){var u=this,r=Lm==="latest"?Lm:"v"+Lm.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 p}(Error),Dm=pb;function En(y,p){if(!y)throw new Dm(p)}var US=new Array(6);function za(){return[1,0,0,1,0,0]}function fb(y,p,n,u,r,s,P){return y[0]=p,y[1]=n,y[2]=u,y[3]=r,y[4]=s,y[5]=P,y}function kv(y,p){return y[0]=p[0],y[1]=p[1],y[2]=p[2],y[3]=p[3],y[4]=p[4],y[5]=p[5],y}function bo(y,p){var n=p[0],u=p[1];return p[0]=y[0]*n+y[2]*u+y[4],p[1]=y[1]*n+y[3]*u+y[5],p}function Lv(y,p,n){return fb(y,p,0,0,n,0,0)}function vs(y,p,n,u,r,s,P,z){var F=Math.sin(s),N=Math.cos(s);return y[0]=u*N,y[1]=r*F,y[2]=-u*F,y[3]=r*N,y[4]=P*u*N-z*u*F+p,y[5]=P*r*F+z*r*N+n,y}function Rv(y,p,n,u,r,s,P){return fy(vs(za(),y,p,n,u,r,s,P))}function zv(y,p){var n=db(p);En(n!==0,32);var u=p[0],r=p[1],s=p[2],P=p[3],z=p[4],F=p[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 db(y){return y[0]*y[3]-y[1]*y[2]}var Mv;function fy(y){var p="matrix("+y.join(", ")+")";if(ah)return p;var n=Mv||(Mv=document.createElement("div"));return n.style.transform=p,n.style.transform}var Mt={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 mb=(y,p,n)=>{let{time_intervals:u,olGeometry:r,coordinate:s}=p.properties,P,z;if(n&&s)P=s;else if(r.getType()===Mt.POINT)P=r.getCoordinates();else if(r.getType()===Mt.LINE_STRING){let F=u||[[]],N=F[0],V=F[F.length-1];if(y<N[0])[,,z]=N,P=r.getFirstCoordinate();else if(y>V[0])[,,z]=V,P=r.getLastCoordinate();else for(let me=0;me<F.length-1;me+=1){let[_e,Se]=F[me],[Ue,He]=F[me+1];if(_e<=y&&y<=Ue){let Ge=Math.min((y-_e)/(Ue-_e),1)*(He-Se)+Se;P=r.getCoordinateAt(Ge),[,,z]=F[me];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",r);return{coord:P,rotation:z}},Dv=mb;var gb=(y,p,n,u,r)=>{if(!y)return{renderedTrajectories:[]};let{time:s=Date.now(),size:P=[],center:z,resolution:F,rotation:N=0,pixelRatio:V=1}=u;if(!F||!z)return{renderedTrajectories:[]};let{noInterpolate:me=!1,hoverVehicleId:_e,selectedVehicleId:Se,filter:Ue}=r,He=y.getContext("2d");He?.clearRect(0,0,y.width,y.height);let[Ie,Ge]=P;Ie&&Ge&&(y.width!==Ie||y.height!==Ge)&&([y.width,y.height]=[Ie*V,Ge*V]);let Je=vs(za(),P[0]/2,P[1]/2,1/F,-1/F,-N,-z[0],-z[1]);y.style&&(y.style.width=`${y.width/V}px`,y.style.height=`${y.height/V}px`);let rt,_t,yt,ct,Tt,St,Lt,nr,jt=[];for(let Jt=p.length-1;Jt>=0;Jt-=1){let or=p[Jt];if(Ue&&!Ue(or))continue;let{train_id:At,timeOffset:Vr}=or.properties,{coord:Er,rotation:zr}=Dv(s-(Vr||0),or,me);if(p[Jt].properties.coordinate=Er,p[Jt].properties.rotation=zr,!Er)continue;let br=bo(Je,[...Er]);if(!br||(br=br.map(Vt=>Vt*V),br[0]<0||br[0]>y.width||br[1]<0||br[1]>y.height))continue;let Sr=n(or,u,r);if(!Sr)continue;let xr=Sr.width,Qr=Sr.height;_e!==At&&Se!==At&&He?.drawImage(Sr,br[0]-xr/2,br[1]-Qr/2,xr,Qr),_e&&_e===At&&(rt=Sr,_t=br,yt=xr,ct=Qr),Se&&Se===At&&(Tt=Sr,St=br,Lt=xr,nr=Qr),jt.push(or)}return Tt&&St&&Lt&&nr&&He?.drawImage(Tt,St[0]-Lt/2,St[1]-nr/2,Lt,nr),rt&&_t&&yt&&ct&&He?.drawImage(rt,_t[0]-yt/2,_t[1]-ct/2,yt,ct),{renderedTrajectories:jt}},Hf=gb;var Gl={RADIANS:"radians",DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},XS={9001:Gl.METERS,9002:Gl.FEET,9003:Gl.USFEET,9101:Gl.RADIANS,9102:Gl.DEGREES};var bu={};bu[Gl.RADIANS]=6370997/(2*Math.PI);bu[Gl.DEGREES]=2*Math.PI*6370997/360;bu[Gl.FEET]=.3048;bu[Gl.METERS]=1;bu[Gl.USFEET]=1200/3937;var ac=Gl;var yb=function(){function y(p){this.code_=p.code,this.units_=p.units,this.extent_=p.extent!==void 0?p.extent:null,this.worldExtent_=p.worldExtent!==void 0?p.worldExtent:null,this.axisOrientation_=p.axisOrientation!==void 0?p.axisOrientation:"enu",this.global_=p.global!==void 0?p.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=p.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=p.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_||bu[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(p){this.global_=p,this.canWrapX_=!!(p&&this.extent_)},y.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},y.prototype.setDefaultTileGrid=function(p){this.defaultTileGrid_=p},y.prototype.setExtent=function(p){this.extent_=p,this.canWrapX_=!!(this.global_&&p)},y.prototype.setWorldExtent=function(p){this.worldExtent_=p},y.prototype.setGetPointResolution=function(p){this.getPointResolutionFunc_=p},y.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},y}(),Om=yb;function jl(y,p,n){return Math.min(Math.max(y,p),n)}var Ov=function(){var y;return"cosh"in Math?y=Math.cosh:y=function(p){var n=Math.exp(p);return(n+1/n)/2},y}(),YS=function(){var y;return"log2"in Math?y=Math.log2:y=function(p){return Math.log(p)*Math.LOG2E},y}();function Fv(y,p,n,u,r,s){var P=r-n,z=s-u;if(P!==0||z!==0){var F=((y-n)*P+(p-u)*z)/(P*P+z*z);F>1?(n=r,u=s):F>0&&(n+=P*F,u+=z*F)}return ql(y,p,n,u)}function ql(y,p,n,u){var r=n-y,s=u-p;return r*r+s*s}function Bv(y){return y*180/Math.PI}function Fm(y,p){var n=y%p;return n*p<0?n+p:n}function gl(y,p,n){return y+n*(p-y)}var _b=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Yf=6378137,Xp=Math.PI*Yf,vb=[-Xp,-Xp,Xp,Xp],xb=[-180,-85,180,85],Bm=Yf*Math.log(Math.tan(Math.PI/2)),Wp=function(y){_b(p,y);function p(n){return y.call(this,{code:n,units:ac.METERS,extent:vb,global:!0,worldExtent:xb,getPointResolution:function(u,r){return u/Ov(r[1]/Yf)}})||this}return p}(Om),dy=[new Wp("EPSG:3857"),new Wp("EPSG:102100"),new Wp("EPSG:102113"),new Wp("EPSG:900913"),new Wp("http://www.opengis.net/def/crs/EPSG/0/3857"),new Wp("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Uv(y,p,n){var u=y.length,r=n>1?n:2,s=p;s===void 0&&(r>2?s=y.slice():s=new Array(u));for(var P=0;P<u;P+=r){s[P]=Xp*y[P]/180;var z=Yf*Math.log(Math.tan(Math.PI*(+y[P+1]+90)/360));z>Bm?z=Bm:z<-Bm&&(z=-Bm),s[P+1]=z}return s}function Nv(y,p,n){var u=y.length,r=n>1?n:2,s=p;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]/Xp,s[P+1]=360*Math.atan(Math.exp(y[P+1]/Yf))/Math.PI-90;return s}var bb=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),wb=6378137,Vv=[-180,-90,180,90],Eb=Math.PI*wb/180,Xh=function(y){bb(p,y);function p(n,u){return y.call(this,{code:n,units:ac.DEGREES,extent:Vv,axisOrientation:u,global:!0,metersPerUnit:Eb,worldExtent:Vv})||this}return p}(Om),my=[new Xh("CRS:84"),new Xh("EPSG:4326","neu"),new Xh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Xh("urn:ogc:def:crs:OGC:2:84"),new Xh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Xh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Xh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var gy={};function Gv(y){return gy[y]||gy[y.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function jv(y,p){gy[y]=p}var $p={};function Jf(y,p,n){var u=y.getCode(),r=p.getCode();u in $p||($p[u]={}),$p[u][r]=n}function qv(y,p){var n;return y in $p&&p in $p[y]&&(n=$p[y][p]),n}var ko={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function wu(y){for(var p=Ya(),n=0,u=y.length;n<u;++n)yy(p,y[n]);return p}function Tb(y,p,n){var u=Math.min.apply(null,y),r=Math.min.apply(null,p),s=Math.max.apply(null,y),P=Math.max.apply(null,p);return sh(u,r,s,P,n)}function yl(y,p,n){return n?(n[0]=y[0]-p,n[1]=y[1]-p,n[2]=y[2]+p,n[3]=y[3]+p,n):[y[0]-p,y[1]-p,y[2]+p,y[3]+p]}function Zv(y,p){return p?(p[0]=y[0],p[1]=y[1],p[2]=y[2],p[3]=y[3],p):y.slice()}function xs(y,p,n){var u,r;return p<y[0]?u=y[0]-p:y[2]<p?u=p-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 Kp(y,p){return Qf(y,p[0],p[1])}function sc(y,p){return y[0]<=p[0]&&p[2]<=y[2]&&y[1]<=p[1]&&p[3]<=y[3]}function Qf(y,p,n){return y[0]<=p&&p<=y[2]&&y[1]<=n&&n<=y[3]}function Um(y,p){var n=y[0],u=y[1],r=y[2],s=y[3],P=p[0],z=p[1],F=ko.UNKNOWN;return P<n?F=F|ko.LEFT:P>r&&(F=F|ko.RIGHT),z<u?F=F|ko.BELOW:z>s&&(F=F|ko.ABOVE),F===ko.UNKNOWN&&(F=ko.INTERSECTING),F}function Ya(){return[1/0,1/0,-1/0,-1/0]}function sh(y,p,n,u,r){return r?(r[0]=y,r[1]=p,r[2]=n,r[3]=u,r):[y,p,n,u]}function Hp(y){return sh(1/0,1/0,-1/0,-1/0,y)}function Yp(y,p){var n=y[0],u=y[1];return sh(n,u,n,u,p)}function Nm(y,p,n,u,r){var s=Hp(r);return _y(s,y,p,n,u)}function Vm(y,p){return y[0]==p[0]&&y[2]==p[2]&&y[1]==p[1]&&y[3]==p[3]}function Wv(y,p){return p[0]<y[0]&&(y[0]=p[0]),p[2]>y[2]&&(y[2]=p[2]),p[1]<y[1]&&(y[1]=p[1]),p[3]>y[3]&&(y[3]=p[3]),y}function yy(y,p){p[0]<y[0]&&(y[0]=p[0]),p[0]>y[2]&&(y[2]=p[0]),p[1]<y[1]&&(y[1]=p[1]),p[1]>y[3]&&(y[3]=p[1])}function _y(y,p,n,u,r){for(;n<u;n+=r)Sb(y,p[n],p[n+1]);return y}function Sb(y,p,n){y[0]=Math.min(y[0],p),y[1]=Math.min(y[1],n),y[2]=Math.max(y[2],p),y[3]=Math.max(y[3],n)}function Xv(y,p){var n;return n=p(vy(y)),n||(n=p(xy(y)),n)||(n=p(wy(y)),n)||(n=p(by(y)),n)?n:!1}function vy(y){return[y[0],y[1]]}function xy(y){return[y[2],y[1]]}function $h(y){return[(y[0]+y[2])/2,(y[1]+y[3])/2]}function Eu(y){return y[3]-y[1]}function $v(y,p,n){var u=n||Ya();return Lo(y,p)?(y[0]>p[0]?u[0]=y[0]:u[0]=p[0],y[1]>p[1]?u[1]=y[1]:u[1]=p[1],y[2]<p[2]?u[2]=y[2]:u[2]=p[2],y[3]<p[3]?u[3]=y[3]:u[3]=p[3]):Hp(u),u}function by(y){return[y[0],y[3]]}function wy(y){return[y[2],y[3]]}function bs(y){return y[2]-y[0]}function Lo(y,p){return y[0]<=p[2]&&y[2]>=p[0]&&y[1]<=p[3]&&y[3]>=p[1]}function Kv(y,p){return p?(p[0]=y[0],p[1]=y[1],p[2]=y[2],p[3]=y[3],p):y}function Hv(y,p,n){var u=!1,r=Um(y,p),s=Um(y,n);if(r===ko.INTERSECTING||s===ko.INTERSECTING)u=!0;else{var P=y[0],z=y[1],F=y[2],N=y[3],V=p[0],me=p[1],_e=n[0],Se=n[1],Ue=(Se-me)/(_e-V),He=void 0,Ie=void 0;!!(s&ko.ABOVE)&&!(r&ko.ABOVE)&&(He=_e-(Se-N)/Ue,u=He>=P&&He<=F),!u&&!!(s&ko.RIGHT)&&!(r&ko.RIGHT)&&(Ie=Se-(_e-F)*Ue,u=Ie>=z&&Ie<=N),!u&&!!(s&ko.BELOW)&&!(r&ko.BELOW)&&(He=_e-(Se-z)/Ue,u=He>=P&&He<=F),!u&&!!(s&ko.LEFT)&&!(r&ko.LEFT)&&(Ie=Se-(_e-P)*Ue,u=Ie>=z&&Ie<=N)}return u}function Yv(y,p,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]];p(r,r,2);for(var F=[],N=[],z=0,V=r.length;z<V;z+=2)F.push(r[z]),N.push(r[z+1]);return Tb(F,N,n)}function Jv(y,p){var n=p.getExtent(),u=$h(y);if(p.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}function Ey(y,p){var n=y[0],u=y[1],r=p[0],s=p[1],P=r[0],z=r[1],F=s[0],N=s[1],V=F-P,me=N-z,_e=V===0&&me===0?0:(V*(n-P)+me*(u-z))/(V*V+me*me||0),Se,Ue;return _e<=0?(Se=P,Ue=z):_e>=1?(Se=F,Ue=N):(Se=P+_e*V,Ue=z+_e*me),[Se,Ue]}function Tu(y,p){for(var n=!0,u=y.length-1;u>=0;--u)if(y[u]!=p[u]){n=!1;break}return n}function Jp(y,p){var n=y[0]-p[0],u=y[1]-p[1];return n*n+u*u}function Ty(y,p){return Math.sqrt(Jp(y,p))}function Qv(y,p){return Jp(y,Ey(y,p))}function ex(y,p){if(p.canWrapX()){var n=bs(p.getExtent()),u=tx(y,p,n);u&&(y[0]-=u*n)}return y}function tx(y,p,n){var u=p.getExtent(),r=0;if(p.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 Sy=!0;function Ib(y){var p=y===void 0?!0:y;Sy=!p}function Iy(y,p,n){var u;if(p!==void 0){for(var r=0,s=y.length;r<s;++r)p[r]=y[r];u=p}else u=y.slice();return u}function Cb(y,p,n){if(p!==void 0&&y!==p){for(var u=0,r=y.length;u<r;++u)p[u]=y[u];y=p}return y}function Ab(y){jv(y.getCode(),y),Jf(y,y,Iy)}function Pb(y){y.forEach(Ab)}function ya(y){return typeof y=="string"?Gv(y):y||null}function rx(y){Pb(y),y.forEach(function(p){y.forEach(function(n){p!==n&&Jf(p,n,Iy)})})}function Mb(y,p,n,u){y.forEach(function(r){p.forEach(function(s){Jf(r,s,n),Jf(s,r,u)})})}function co(y,p){return Ib(),jm(y,"EPSG:4326",p!==void 0?p:"EPSG:3857")}function lh(y,p){var n=jm(y,p!==void 0?p:"EPSG:3857","EPSG:4326"),u=n[0];return(u<-180||u>180)&&(n[0]=Fm(u+180,360)-180),n}function ix(y,p){if(y===p)return!0;var n=y.getUnits()===p.getUnits();if(y.getCode()===p.getCode())return n;var u=Gm(y,p);return u===Iy&&n}function Gm(y,p){var n=y.getCode(),u=p.getCode(),r=qv(n,u);return r||(r=Cb),r}function ed(y,p){var n=ya(y),u=ya(p);return Gm(n,u)}function jm(y,p,n){var u=ed(p,n);return u(y,void 0,y.length)}function td(y,p,n,u){var r=ed(p,n);return Yv(y,r,void 0,u)}var Zl=null;function uh(){return Zl}function Cy(y,p){return Zl?jm(y,p,Zl):y}function Wl(y,p){return Zl?jm(y,Zl,p):(Sy&&!Tu(y,[0,0])&&y[0]>=-180&&y[0]<=180&&y[1]>=-90&&y[1]<=90&&(Sy=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),y)}function Qp(y,p){return Zl?td(y,p,Zl):y}function rd(y,p){return Zl?td(y,Zl,p):y}function nx(y,p){if(!Zl)return y;var n=ya(p).getUnits(),u=Zl.getUnits();return n&&u?y*bu[n]/bu[u]:y}function kb(){rx(dy),rx(my),Mb(my,dy,Uv,Nv)}kb();function ef(y){let p=document.createElement("div");return n=>{let{map:u,mbMap:r,olLayer:s}=y;if(!u||!r)return p;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:Bv(-z.rotation)}),P.isConnected?(P.width!==n.size[0]||P.height!==n.size[1])&&r.resize():u.render(),r.redraw(),r.getContainer()}}function tf(y){let p=document.createElement("div");return n=>{let{map:u,mbMap:r,renderState:s,olLayer:P}=y;if(!u||!r)return p;let z=!1,F=r.getCanvas(),{viewState:N}=n,V=P?.getVisible();s&&s?.visible!==V&&(F.style.display=V?"block":"none",s.visible=V,F.style.position="absolute");let me=P?.getOpacity();F&&s&&s.opacity!==me&&(F.style.opacity=me,s.opacity=me);let{rotation:_e}=N;s&&s.rotation!==_e&&(r.rotateTo(-(_e||0)*180/Math.PI,{animate:!1}),z=!0,s.rotation=_e),s&&s.center&&(s.zoom!==N.zoom||s.center[0]!==N.center[0]||s.center[1]!==N.center[1])&&(r.jumpTo({center:lh(N.center),zoom:N.zoom-1}),z=!0,s.zoom=N.zoom,s.center=N.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 Lb=(y,p,n=!1)=>{let u=["HIDDEN","LEAVING","BOARDING"],r=y.has_fzo&&u.indexOf(y.state)>-1,s=p.has_fzo&&u.indexOf(p.state)>-1;if(r||s){if(r!==s)return r?-1:1;if(y.state!==p.state)return u.indexOf(y.state)-u.indexOf(p.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(p.min_arrival_time||p.time).getTime()-F):(P=new Date(y.time).getTime()-F,z=new Date(p.time).getTime()-F),P-z},id=Lb;var Rb=(y,p=!1,n=30)=>{let u=Object.keys(y).map(me=>y[me]);u.sort((me,_e)=>id(me,_e,p));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=[],N=[],V=null;for(let me=u.length-1;me>=0;me-=1){let _e={...u[me]},Se=new Date(_e.time).getTime();Se>z&&Se<s&&(_e.state==="BOARDING"&&(N.includes(_e.platform)?_e.state="HIDDEN":N.push(_e.platform)),V&&_e.to[0]===V.to[0]&&Math.abs(Se-V.time)<1e3&&_e.line.name===V.line.name&&(_e.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(_e.state)&&(_e.cancelled=!0),V=_e,V.time=Se,F.unshift(_e))}return F},nd=Rb;var zb=(y,p=!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 N=nd(s,p||!1,n);y(N)},u)}},Ay=zb;var rf={};ay(rf,{bgColors:()=>ax,getBgColor:()=>Fb,getDelayColor:()=>Nb,getDelayText:()=>Vb,getRadius:()=>Ob,getTextColor:()=>Bb,getTextSize:()=>Ub,getTypeIndex:()=>qm,textColors:()=>sx,types:()=>ox});var Db=[[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]],ox=[/^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],ax=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],sx=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],qm=y=>typeof y=="string"?ox.findIndex(p=>p.test(y)):y,Ob=(y,p)=>{try{let n=qm(y||0);return Db[n][p]}catch{return 1}},Fb=y=>{try{let p=qm(y);return ax[p]}catch{return"#ffffff"}},Bb=y=>{try{let p=qm(y);return sx[p]}catch{return"#ffffff"}},Ub=(y,p,n,u)=>{if(!y)return 0;y.font=`bold ${u}px Arial`;let r=y.measureText(n),s=25,P=0;for(;r.width>p-6&&P<s;)u-=.5,y.font=`bold ${u}px arial, sans-serif`,r=y.measureText(n),P+=1;return u},Nb=(y,p,n)=>p?n?"#ff0000":"#a0a0a0":y>=36e5?"#ed004c":y>=5e5?"#e80000":y>=3e5?"#ff4a00":y>=18e4?"#f7bf00":y===null?"#a0a0a0":"#00a00c",Vb=(y,p)=>p?String.fromCodePoint(215):y>36e5?`+${Math.round(y/36e5)}h`:y>59e3?`+${Math.round(y/6e4)}m`:y>0?`+${y}s`:"";var Gb=(y,p)=>{let n=null;return typeof window>"u"?null:(document?.createElement?(n=document.createElement("canvas"),n.width=y,n.height=p):OffscreenCanvas?n=new OffscreenCanvas(y,p):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),n)},nf=Gb;var Py={},zy=(y,p,n)=>{let u=`${y}, ${p}, ${n}`;if(!Py[u]){let r=nf(y*2,y*2);if(r){let s=r.getContext("2d");if(!s)return null;s.beginPath(),s.arc(y,y,p,0,2*Math.PI,!1),s.fillStyle=n,s.filter="blur(1px)",s.fill(),Py[u]=r}}return Py[u]},My={},Dy=(y,p,n,u,r,s="#000",P=1)=>{let z=`${y}, ${p}, ${u}, ${r}, ${s}, ${P}`;if(!My[z]){let F=nf(y,n+8*P);if(F){let N=F.getContext("2d");if(!N)return null;N.textAlign="left",N.textBaseline="middle",N.font=u,N.fillStyle=r,N.strokeStyle=s,N.lineWidth=1.5*P;let V=p;N.strokeText(V,0,n),N.fillText(V,0,n),My[z]=F}}return My[z]},ky={},Oy=(y,p,n,u,r,s)=>{let P=`${y}, ${p}, ${n}, ${u}, ${r}, ${s}`;if(!ky[P]){let z=nf(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,p,0,2*Math.PI,!1),F.fill(),r&&F.setLineDash([5,3]),u&&F.stroke(),ky[P]=z}}return ky[P]},Ly={},Fy=(y,p,n,u,r,s,P)=>{let z=`${y}, ${p}, ${n}, ${u},${r}, ${s}, ${P}`;if(!Ly[z]){let F=nf(p*2,p*2);if(F){let N=F.getContext("2d");if(!N)return null;s&&(N.save(),N.textBaseline="middle",N.textAlign="center",N.font=`bold ${n+2}px Arial`,N.strokeStyle=r,N.strokeText(y,p,p),N.restore()),N.textBaseline="middle",N.textAlign="center",N.fillStyle=u,N.font=`bold ${n}px Arial`,N.strokeStyle=r,N.strokeText(y,p,p),N.fillText(y,p,p),Ly[z]=F}}return Ly[z]},Ry={},jb=(y,p,n)=>{let{hoverVehicleId:u,selectedVehicleId:r,useDelayStyle:s,delayOutlineColor:P="#000",delayDisplay:z=3e5,getRadius:F=()=>0,getBgColor:N=()=>"#000",getDelayColor:V=()=>"#000",getDelayText:me=()=>null,getTextColor:_e=()=>"#000",getTextSize:Se=()=>0}=n,{zoom:Ue,pixelRatio:He=1}=p,{type:Ie}=y.properties,{train_id:Ge,line:Je,delay:rt,state:_t,operator_provides_realtime_journey:yt}=y.properties,{name:ct,text_color:Tt,color:St}=Je||{},Lt=_t==="JOURNEY_CANCELLED";Ie||(Ie="Rail"),ct||(ct="I"),Tt||(Tt="#000000"),St&&St[0]!=="#"&&(St=`#${St}`),Tt[0]!=="#"&&(Tt=`#${Tt}`);let nr=Math.min(Math.floor(Ue||1),16),jt=!!(u&&u===Ge),Jt=!!(r&&r===Ge),or=F(Ie,nr)*He,At=or>=7*He;(jt||Jt)&&(or=At?or+5*He:14*He);let Vr=or>10*He,Er=`${or}${jt}${Jt}${Lt}${rt}`;if(s?Er+=`${yt}`:Er+=`${Ie}${St}`,Vr&&(Er+=`${ct}${Tt}`),!Ry[Er]){if(or===0)return null;let zr=1*He,br=or+2,Sr=or*2,xr=br*2+zr*2+100*He,Qr=xr/2,Vt=nf(xr,xr);if(Vt){let Yr=Vt.getContext("2d");if(!Yr)return null;if(At&&rt!==null){let Li=zy(Qr,br,V(rt,Lt));Li&&Yr.drawImage(Li,0,0)}if(At&&(jt||(rt||0)>=z||Lt)){let Li=Math.max(Lt?19:14,Math.min(Lt?19:17,or*1.2))*He,Mn=me(rt,Lt);if(Mn){let Ni=Mn.length*Li,Cr=Dy(Ni,Mn,Li,`bold ${Li}px arial, sans-serif`,V(rt,Lt,!0),P,He);Cr&&Yr.drawImage(Cr,Qr+br+zr,Qr-Li)}}let vi;s?vi=V(rt,Lt):vi=St||N(Ie);let Br=Oy(Qr,or,vi,At||jt||Jt,!!At&&!!s&&rt===null&&yt==="yes",He);if(Br&&Yr.drawImage(Br,0,0),Vr&&Yr){let Li=Math.max(or,10),Mn=Se(Yr,Sr,ct,Li),Ni=s?"#000000":Tt||_e(Ie),Wn=Fy(ct,Qr,Mn,Ni,vi,!!s&&rt===null&&yt==="yes",He);Wn&&Yr.drawImage(Wn,0,0)}Ry[Er]=Vt}}return Ry[Er]},Kh=jb;var qb=(y,p,n)=>Kh(y,p,{...n,useDelayStyle:!0}),By=qb;var of,Zb=()=>{if(!of){of=document.createElement("canvas"),of.width=15,of.height=15;let y=of.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 of},Uy=Zb;var Qi={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 Wb=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Xb=function(y){Wb(p,y);function p(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[Qi.OPACITY]=n.opacity!==void 0?n.opacity:1,En(typeof r[Qi.OPACITY]=="number",64),r[Qi.VISIBLE]=n.visible!==void 0?n.visible:!0,r[Qi.Z_INDEX]=n.zIndex,r[Qi.MAX_RESOLUTION]=n.maxResolution!==void 0?n.maxResolution:1/0,r[Qi.MIN_RESOLUTION]=n.minResolution!==void 0?n.minResolution:0,r[Qi.MIN_ZOOM]=n.minZoom!==void 0?n.minZoom:-1/0,r[Qi.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 p.prototype.getBackground=function(){return this.background_},p.prototype.getClassName=function(){return this.className_},p.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},p.prototype.getLayersArray=function(n){return jr()},p.prototype.getLayerStatesArray=function(n){return jr()},p.prototype.getExtent=function(){return this.get(Qi.EXTENT)},p.prototype.getMaxResolution=function(){return this.get(Qi.MAX_RESOLUTION)},p.prototype.getMinResolution=function(){return this.get(Qi.MIN_RESOLUTION)},p.prototype.getMinZoom=function(){return this.get(Qi.MIN_ZOOM)},p.prototype.getMaxZoom=function(){return this.get(Qi.MAX_ZOOM)},p.prototype.getOpacity=function(){return this.get(Qi.OPACITY)},p.prototype.getSourceState=function(){return jr()},p.prototype.getVisible=function(){return this.get(Qi.VISIBLE)},p.prototype.getZIndex=function(){return this.get(Qi.Z_INDEX)},p.prototype.setBackground=function(n){this.background_=n,this.changed()},p.prototype.setExtent=function(n){this.set(Qi.EXTENT,n)},p.prototype.setMaxResolution=function(n){this.set(Qi.MAX_RESOLUTION,n)},p.prototype.setMinResolution=function(n){this.set(Qi.MIN_RESOLUTION,n)},p.prototype.setMaxZoom=function(n){this.set(Qi.MAX_ZOOM,n)},p.prototype.setMinZoom=function(n){this.set(Qi.MIN_ZOOM,n)},p.prototype.setOpacity=function(n){En(typeof n=="number",64),this.set(Qi.OPACITY,n)},p.prototype.setVisible=function(n){this.set(Qi.VISIBLE,n)},p.prototype.setZIndex=function(n){this.set(Qi.Z_INDEX,n)},p.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),y.prototype.disposeInternal.call(this)},p}(Mo),Zm=Xb;var od={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Su={UNDEFINED:"undefined",LOADING:"loading",READY:"ready",ERROR:"error"};var $b=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Kb=function(y){$b(p,y);function p(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(Qi.SOURCE,u.handleSourcePropertyChange_);var s=n.source?n.source:null;return u.setSource(s),u}return p.prototype.getLayersArray=function(n){var u=n||[];return u.push(this),u},p.prototype.getLayerStatesArray=function(n){var u=n||[];return u.push(this.getLayerState()),u},p.prototype.getSource=function(){return this.get(Qi.SOURCE)||null},p.prototype.getRenderSource=function(){return this.getSource()},p.prototype.getSourceState=function(){var n=this.getSource();return n?n.getState():Su.UNDEFINED},p.prototype.handleSourceChange_=function(){this.changed()},p.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(Po(this.sourceChangeKey_),this.sourceChangeKey_=null);var n=this.getSource();n&&(this.sourceChangeKey_=uo(n,Ji.CHANGE,this.handleSourceChange_,this)),this.changed()},p.prototype.getFeatures=function(n){return this.renderer_?this.renderer_.getFeatures(n):new Promise(function(u){return u([])})},p.prototype.getData=function(n){return!this.renderer_||!this.rendered?null:this.renderer_.getData(n)},p.prototype.render=function(n,u){var r=this.getRenderer();if(r.prepareFrame(n))return this.rendered=!0,r.renderFrame(n,u)},p.prototype.unrender=function(){this.rendered=!1},p.prototype.setMapInternal=function(n){n||this.unrender(),this.set(Qi.MAP,n)},p.prototype.getMapInternal=function(){return this.get(Qi.MAP)},p.prototype.setMap=function(n){this.mapPrecomposeKey_&&(Po(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),n||this.changed(),this.mapRenderKey_&&(Po(this.mapRenderKey_),this.mapRenderKey_=null),n&&(this.mapPrecomposeKey_=uo(n,od.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_=uo(this,Ji.CHANGE,n.render,n),this.changed())},p.prototype.setSource=function(n){this.set(Qi.SOURCE,n)},p.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},p.prototype.hasRenderer=function(){return!!this.renderer_},p.prototype.createRenderer=function(){return null},p.prototype.disposeInternal=function(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),y.prototype.disposeInternal.call(this)},p}(Zm);function lx(y,p){if(!y.visible)return!1;var n=p.resolution;if(n<y.minResolution||n>=y.maxResolution)return!1;var u=p.zoom;return u>y.minZoom&&u<=y.maxZoom}var Hh=Kb;var Ny=class extends Mo{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")}},af=Ny;var Vy=class extends af{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),[]}},Wm=Vy;var Gy=class extends Wm{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&&lx(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())}},ux=Gy;var ws={ADD:"add",REMOVE:"remove"};var hx=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),cx={LENGTH:"length"},Xm=function(y){hx(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.element=u,s.index=r,s}return p}(sn);var Hb=function(y){hx(p,y);function p(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 p.prototype.clear=function(){for(;this.getLength()>0;)this.pop()},p.prototype.extend=function(n){for(var u=0,r=n.length;u<r;++u)this.push(n[u]);return this},p.prototype.forEach=function(n){for(var u=this.array_,r=0,s=u.length;r<s;++r)n(u[r],r,u)},p.prototype.getArray=function(){return this.array_},p.prototype.item=function(n){return this.array_[n]},p.prototype.getLength=function(){return this.get(cx.LENGTH)},p.prototype.insertAt=function(n,u){this.unique_&&this.assertUnique_(u),this.array_.splice(n,0,u),this.updateLength_(),this.dispatchEvent(new Xm(ws.ADD,u,n))},p.prototype.pop=function(){return this.removeAt(this.getLength()-1)},p.prototype.push=function(n){this.unique_&&this.assertUnique_(n);var u=this.getLength();return this.insertAt(u,n),this.getLength()},p.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)},p.prototype.removeAt=function(n){var u=this.array_[n];return this.array_.splice(n,1),this.updateLength_(),this.dispatchEvent(new Xm(ws.REMOVE,u,n)),u},p.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 Xm(ws.REMOVE,s,n)),this.dispatchEvent(new Xm(ws.ADD,u,n))}else{for(var P=r;P<n;++P)this.insertAt(P,void 0);this.insertAt(n,u)}},p.prototype.updateLength_=function(){this.set(cx.LENGTH,this.array_.length)},p.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 Dm(58)},p}(Mo),ch=Hb;var Yb=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Jb=function(y){Yb(p,y);function p(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 p.prototype.clone=function(){var n=new p(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},p.prototype.getGeometry=function(){return this.get(this.geometryName_)},p.prototype.getId=function(){return this.id_},p.prototype.getGeometryName=function(){return this.geometryName_},p.prototype.getStyle=function(){return this.style_},p.prototype.getStyleFunction=function(){return this.styleFunction_},p.prototype.handleGeometryChange_=function(){this.changed()},p.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(Po(this.geometryChangeKey_),this.geometryChangeKey_=null);var n=this.getGeometry();n&&(this.geometryChangeKey_=uo(n,Ji.CHANGE,this.handleGeometryChange_,this)),this.changed()},p.prototype.setGeometry=function(n){this.set(this.geometryName_,n)},p.prototype.setStyle=function(n){this.style_=n,this.styleFunction_=n?Qb(n):void 0,this.changed()},p.prototype.setId=function(n){this.id_=n,this.changed()},p.prototype.setGeometryName=function(n){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=n,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()},p}(Mo);function Qb(y){if(typeof y=="function")return y;var p;if(Array.isArray(y))p=y;else{En(typeof y.getZIndex=="function",41);var n=y;p=[n]}return function(){return p}}var lc=Jb;var Pn={XY:"XY",XYZ:"XYZ",XYM:"XYM",XYZM:"XYZM"};function _l(y,p,n,u,r,s){for(var P=s||[],z=0,F=p;F<n;F+=u){var N=y[F],V=y[F+1];P[z++]=r[0]*N+r[2]*V+r[4],P[z++]=r[1]*N+r[3]*V+r[5]}return s&&P.length!=z&&(P.length=z),P}function $m(y,p,n,u,r,s,P){for(var z=P||[],F=Math.cos(r),N=Math.sin(r),V=s[0],me=s[1],_e=0,Se=p;Se<n;Se+=u){var Ue=y[Se]-V,He=y[Se+1]-me;z[_e++]=V+Ue*F-He*N,z[_e++]=me+Ue*N+He*F;for(var Ie=Se+2;Ie<Se+u;++Ie)z[_e++]=y[Ie]}return P&&z.length!=_e&&(z.length=_e),z}function px(y,p,n,u,r,s,P,z){for(var F=z||[],N=P[0],V=P[1],me=0,_e=p;_e<n;_e+=u){var Se=y[_e]-N,Ue=y[_e+1]-V;F[me++]=N+r*Se,F[me++]=V+s*Ue;for(var He=_e+2;He<_e+u;++He)F[me++]=y[He]}return z&&F.length!=me&&(F.length=me),F}function fx(y,p,n,u,r,s,P){for(var z=P||[],F=0,N=p;N<n;N+=u){z[F++]=y[N]+r,z[F++]=y[N+1]+s;for(var V=N+2;V<N+u;++V)z[F++]=y[V]}return P&&z.length!=F&&(z.length=F),z}var ew=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),dx=za(),tw=function(y){ew(p,y);function p(){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 p.prototype.simplifyTransformed=function(n,u){return this.simplifyTransformedInternal(this.getRevision(),n,u)},p.prototype.clone=function(){return jr()},p.prototype.closestPointXY=function(n,u,r,s){return jr()},p.prototype.containsXY=function(n,u){var r=this.getClosestPoint([n,u]);return r[0]===n&&r[1]===u},p.prototype.getClosestPoint=function(n,u){var r=u||[NaN,NaN];return this.closestPointXY(n[0],n[1],r,1/0),r},p.prototype.intersectsCoordinate=function(n){return this.containsXY(n[0],n[1])},p.prototype.computeExtent=function(n){return jr()},p.prototype.getExtent=function(n){if(this.extentRevision_!=this.getRevision()){var u=this.computeExtent(this.extent_);(isNaN(u[0])||isNaN(u[1]))&&Hp(u),this.extentRevision_=this.getRevision()}return Kv(this.extent_,n)},p.prototype.rotate=function(n,u){jr()},p.prototype.scale=function(n,u,r){jr()},p.prototype.simplify=function(n){return this.getSimplifiedGeometry(n*n)},p.prototype.getSimplifiedGeometry=function(n){return jr()},p.prototype.getType=function(){return jr()},p.prototype.applyTransform=function(n){jr()},p.prototype.intersectsExtent=function(n){return jr()},p.prototype.translate=function(n,u){jr()},p.prototype.transform=function(n,u){var r=ya(n),s=r.getUnits()==ac.TILE_PIXELS?function(P,z,F){var N=r.getExtent(),V=r.getWorldExtent(),me=Eu(V)/Eu(N);return vs(dx,V[0],V[3],me,-me,0,0,0),_l(P,0,P.length,F,dx,z),ed(r,u)(P,z,F)}:ed(r,u);return this.applyTransform(s),this},p}(Mo),Km=tw;var rw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),iw=function(y){rw(p,y);function p(){var n=y.call(this)||this;return n.layout=Pn.XY,n.stride=2,n.flatCoordinates=null,n}return p.prototype.computeExtent=function(n){return Nm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},p.prototype.getCoordinates=function(){return jr()},p.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},p.prototype.getFlatCoordinates=function(){return this.flatCoordinates},p.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},p.prototype.getLayout=function(){return this.layout},p.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)},p.prototype.getSimplifiedGeometryInternal=function(n){return this},p.prototype.getStride=function(){return this.stride},p.prototype.setFlatCoordinates=function(n,u){this.stride=mx(n),this.layout=n,this.flatCoordinates=u},p.prototype.setCoordinates=function(n,u){jr()},p.prototype.setLayout=function(n,u,r){var s;if(n)s=mx(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=nw(s)}this.layout=n,this.stride=s},p.prototype.applyTransform=function(n){this.flatCoordinates&&(n(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())},p.prototype.rotate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();$m(r,0,r.length,s,n,u,r),this.changed()}},p.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();px(z,0,z.length,F,n,s,P,z),this.changed()}},p.prototype.translate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();fx(r,0,r.length,s,n,u,r),this.changed()}},p}(Km);function nw(y){var p;return y==2?p=Pn.XY:y==3?p=Pn.XYZ:y==4&&(p=Pn.XYZM),p}function mx(y){var p;return y==Pn.XY?p=2:y==Pn.XYZ||y==Pn.XYM?p=3:y==Pn.XYZM&&(p=4),p}function gx(y,p,n){var u=y.getFlatCoordinates();if(u){var r=y.getStride();return _l(u,0,u.length,r,p,n)}else return null}var Es=iw;function yx(y,p,n,u,r,s,P){var z=y[p],F=y[p+1],N=y[n]-z,V=y[n+1]-F,me;if(N===0&&V===0)me=p;else{var _e=((r-z)*N+(s-F)*V)/(N*N+V*V);if(_e>1)me=n;else if(_e>0){for(var Se=0;Se<u;++Se)P[Se]=gl(y[p+Se],y[n+Se],_e);P.length=u;return}else me=p}for(var Se=0;Se<u;++Se)P[Se]=y[me+Se];P.length=u}function ad(y,p,n,u,r){var s=y[p],P=y[p+1];for(p+=u;p<n;p+=u){var z=y[p],F=y[p+1],N=ql(s,P,z,F);N>r&&(r=N),s=z,P=F}return r}function sd(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=ad(y,p,z,u,r),p=z}return r}function _x(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=sd(y,p,z,u,r),p=z[z.length-1]}return r}function ld(y,p,n,u,r,s,P,z,F,N,V){if(p==n)return N;var me,_e;if(r===0)if(_e=ql(P,z,y[p],y[p+1]),_e<N){for(me=0;me<u;++me)F[me]=y[p+me];return F.length=u,_e}else return N;for(var Se=V||[NaN,NaN],Ue=p+u;Ue<n;)if(yx(y,Ue-u,Ue,u,P,z,Se),_e=ql(P,z,Se[0],Se[1]),_e<N){for(N=_e,me=0;me<u;++me)F[me]=Se[me];F.length=u,Ue+=u}else Ue+=u*Math.max((Math.sqrt(_e)-Math.sqrt(N))/r|0,1);if(s&&(yx(y,n-u,p,u,P,z,Se),_e=ql(P,z,Se[0],Se[1]),_e<N)){for(N=_e,me=0;me<u;++me)F[me]=Se[me];F.length=u}return N}function ud(y,p,n,u,r,s,P,z,F,N,V){for(var me=V||[NaN,NaN],_e=0,Se=n.length;_e<Se;++_e){var Ue=n[_e];N=ld(y,p,Ue,u,r,s,P,z,F,N,me),p=Ue}return N}function vx(y,p,n,u,r,s,P,z,F,N,V){for(var me=V||[NaN,NaN],_e=0,Se=n.length;_e<Se;++_e){var Ue=n[_e];N=ud(y,p,Ue,u,r,s,P,z,F,N,me),p=Ue[Ue.length-1]}return N}function xx(y,p,n,u){for(var r=0,s=n.length;r<s;++r)y[p++]=n[r];return p}function Yh(y,p,n,u){for(var r=0,s=n.length;r<s;++r)for(var P=n[r],z=0;z<u;++z)y[p++]=P[z];return p}function cd(y,p,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var N=Yh(y,p,n[z],u);s[P++]=N,p=N}return s.length=P,s}function bx(y,p,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var N=cd(y,p,n[z],u,s[P]);s[P++]=N,p=N[N.length-1]}return s.length=P,s}function hd(y,p,n,u,r,s,P){var z=(n-p)/u;if(z<3){for(;p<n;p+=u)s[P++]=y[p],s[P++]=y[p+1];return P}var F=new Array(z);F[0]=1,F[z-1]=1;for(var N=[p,n-u],V=0;N.length>0;){for(var me=N.pop(),_e=N.pop(),Se=0,Ue=y[_e],He=y[_e+1],Ie=y[me],Ge=y[me+1],Je=_e+u;Je<me;Je+=u){var rt=y[Je],_t=y[Je+1],yt=Fv(rt,_t,Ue,He,Ie,Ge);yt>Se&&(V=Je,Se=yt)}Se>r&&(F[(V-p)/u]=1,_e+u<V&&N.push(_e,V),V+u<me&&N.push(V,me))}for(var Je=0;Je<z;++Je)F[Je]&&(s[P++]=y[p+Je*u],s[P++]=y[p+Je*u+1]);return P}function wx(y,p,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F];P=hd(y,p,V,u,r,s,P),z.push(P),p=V}return P}function hh(y,p){return p*Math.round(y/p)}function ow(y,p,n,u,r,s,P){if(p==n)return P;var z=hh(y[p],r),F=hh(y[p+1],r);p+=u,s[P++]=z,s[P++]=F;var N,V;do if(N=hh(y[p],r),V=hh(y[p+1],r),p+=u,p==n)return s[P++]=N,s[P++]=V,P;while(N==z&&V==F);for(;p<n;){var me=hh(y[p],r),_e=hh(y[p+1],r);if(p+=u,!(me==N&&_e==V)){var Se=N-z,Ue=V-F,He=me-z,Ie=_e-F;if(Se*Ie==Ue*He&&(Se<0&&He<Se||Se==He||Se>0&&He>Se)&&(Ue<0&&Ie<Ue||Ue==Ie||Ue>0&&Ie>Ue)){N=me,V=_e;continue}s[P++]=N,s[P++]=V,z=N,F=V,N=me,V=_e}}return s[P++]=N,s[P++]=V,P}function jy(y,p,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F];P=ow(y,p,V,u,r,s,P),z.push(P),p=V}return P}function Ex(y,p,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F],me=[];P=jy(y,p,V,u,r,s,P,me),z.push(me),p=V[V.length-1]}return P}function vl(y,p,n,u,r){for(var s=r!==void 0?r:[],P=0,z=p;z<n;z+=u)s[P++]=y.slice(z,z+u);return s.length=P,s}function ph(y,p,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var N=n[z];s[P++]=vl(y,p,N,u,s[P]),p=N}return s.length=P,s}function pd(y,p,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var N=n[z];s[P++]=ph(y,p,N,u,s[P]),p=N[N.length-1]}return s.length=P,s}function qy(y,p,n,u){for(var r=0,s=y[n-u],P=y[n-u+1];p<n;p+=u){var z=y[p],F=y[p+1];r+=P*z-s*F,s=z,P=F}return r/2}function Zy(y,p,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=qy(y,p,z,u),p=z}return r}function Tx(y,p,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=Zy(y,p,z,u),p=z[z.length-1]}return r}var aw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),sw=function(y){aw(p,y);function p(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 p.prototype.clone=function(){return new p(this.flatCoordinates.slice(),this.layout)},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ad(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ld(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,n,u,r,s))},p.prototype.getArea=function(){return qy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=hd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new p(u,Pn.XY)},p.prototype.getType=function(){return Mt.LINEAR_RING},p.prototype.intersectsExtent=function(n){return!1},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},p}(Es),Wy=sw;var lw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),uw=function(y){lw(p,y);function p(n,u){var r=y.call(this)||this;return r.setCoordinates(n,u),r}return p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},p.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,N=0;N<F;++N)r[N]=P[N];return r.length=F,z}else return s},p.prototype.getCoordinates=function(){return this.flatCoordinates?this.flatCoordinates.slice():[]},p.prototype.computeExtent=function(n){return Yp(this.flatCoordinates,n)},p.prototype.getType=function(){return Mt.POINT},p.prototype.intersectsExtent=function(n){return Qf(n,this.flatCoordinates[0],this.flatCoordinates[1])},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xx(this.flatCoordinates,0,n,this.stride),this.changed()},p}(Es),_a=uw;function Sx(y,p,n,u,r){var s=Xv(r,function(P){return!fh(y,p,n,u,P[0],P[1])});return!s}function fh(y,p,n,u,r,s){for(var P=0,z=y[n-u],F=y[n-u+1];p<n;p+=u){var N=y[p],V=y[p+1];F<=s?V>s&&(N-z)*(s-F)-(r-z)*(V-F)>0&&P++:V<=s&&(N-z)*(s-F)-(r-z)*(V-F)<0&&P--,z=N,F=V}return P!==0}function fd(y,p,n,u,r,s){if(n.length===0||!fh(y,p,n[0],u,r,s))return!1;for(var P=1,z=n.length;P<z;++P)if(fh(y,n[P-1],n[P],u,r,s))return!1;return!0}function Ix(y,p,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(fd(y,p,F,u,r,s))return!0;p=F[F.length-1]}return!1}function Xy(y,p,n,u,r,s,P){for(var z,F,N,V,me,_e,Se,Ue=r[s+1],He=[],Ie=0,Ge=n.length;Ie<Ge;++Ie){var Je=n[Ie];for(V=y[Je-u],_e=y[Je-u+1],z=p;z<Je;z+=u)me=y[z],Se=y[z+1],(Ue<=_e&&Se<=Ue||_e<=Ue&&Ue<=Se)&&(N=(Ue-_e)/(Se-_e)*(me-V)+V,He.push(N)),V=me,_e=Se}var rt=NaN,_t=-1/0;for(He.sort(rh),V=He[0],z=1,F=He.length;z<F;++z){me=He[z];var yt=Math.abs(me-V);yt>_t&&(N=(V+me)/2,fd(y,p,n,u,N,Ue)&&(rt=N,_t=yt)),V=me}return isNaN(rt)&&(rt=r[s]),P?(P.push(rt,Ue,_t),P):[rt,Ue,_t]}function Cx(y,p,n,u,r){for(var s=[],P=0,z=n.length;P<z;++P){var F=n[P];s=Xy(y,p,F,u,r,2*P,s),p=F[F.length-1]}return s}function Hm(y,p,n,u,r){var s;for(p+=u;p<n;p+=u)if(s=r(y.slice(p-u,p),y.slice(p,p+u)),s)return s;return!1}function dd(y,p,n,u,r){var s=_y(Ya(),y,p,n,u);return Lo(r,s)?sc(r,s)||s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Hm(y,p,n,u,function(P,z){return Hv(r,P,z)}):!1}function Ax(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s){if(dd(y,p,n[s],u,r))return!0;p=n[s]}return!1}function cw(y,p,n,u,r){return!!(dd(y,p,n,u,r)||fh(y,p,n,u,r[0],r[1])||fh(y,p,n,u,r[0],r[3])||fh(y,p,n,u,r[2],r[1])||fh(y,p,n,u,r[2],r[3]))}function $y(y,p,n,u,r){if(!cw(y,p,n[0],u,r))return!1;if(n.length===1)return!0;for(var s=1,P=n.length;s<P;++s)if(Sx(y,n[s-1],n[s],u,r)&&!dd(y,n[s-1],n[s],u,r))return!1;return!0}function Px(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if($y(y,p,z,u,r))return!0;p=z[z.length-1]}return!1}function Mx(y,p,n,u){for(;p<n-u;){for(var r=0;r<u;++r){var s=y[p+r];y[p+r]=y[n-u+r],y[n-u+r]=s}p+=u,n-=u}}function kx(y,p,n,u){for(var r=0,s=y[n-u],P=y[n-u+1];p<n;p+=u){var z=y[p],F=y[p+1];r+=(z-s)*(F+P),s=z,P=F}return r===0?void 0:r>0}function Ky(y,p,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],N=kx(y,p,F,u);if(P===0){if(s&&N||!s&&!N)return!1}else if(s&&!N||!s&&N)return!1;p=F}return!0}function Lx(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if(!Ky(y,p,z,u,r))return!1;z.length&&(p=z[z.length-1])}return!0}function Ym(y,p,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],N=kx(y,p,F,u),V=P===0?s&&N||!s&&!N:s&&!N||!s&&N;V&&Mx(y,p,F,u),p=F}return p}function Hy(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s)p=Ym(y,p,n[s],u,r);return p}var hw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Rx=function(y){hw(p,y);function p(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 p.prototype.appendLinearRing=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ud(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,n,u,r,s))},p.prototype.containsXY=function(n,u){return fd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,u)},p.prototype.getArea=function(){return Zy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)},p.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Ym(u,0,this.ends_,this.stride,n)):u=this.flatCoordinates,ph(u,0,this.ends_,this.stride)},p.prototype.getEnds=function(){return this.ends_},p.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var n=$h(this.getExtent());this.flatInteriorPoint_=Xy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_},p.prototype.getInteriorPoint=function(){return new _a(this.getFlatInteriorPoint(),Pn.XYM)},p.prototype.getLinearRingCount=function(){return this.ends_.length},p.prototype.getLinearRing=function(n){return n<0||this.ends_.length<=n?null:new Wy(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},p.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 N=r[z],V=new Wy(u.slice(P,N),n);s.push(V),P=N}return s},p.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Ky(n,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Ym(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=jy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(n),u,0,r),new p(u,Pn.XY,r)},p.prototype.getType=function(){return Mt.POLYGON},p.prototype.intersectsExtent=function(n){return $y(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=cd(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},p}(Es),md=Rx;function Yy(y,p,n){for(var u=p||32,r=y.getStride(),s=y.getLayout(),P=y.getCenter(),z=r*(u+1),F=new Array(z),N=0;N<z;N+=r){F[N]=0,F[N+1]=0;for(var V=2;V<r;V++)F[N+V]=P[V]}var me=[F.length],_e=new Rx(F,s,me);return pw(_e,P,y.getRadius(),n),_e}function pw(y,p,n,u){for(var r=y.getFlatCoordinates(),s=y.getStride(),P=r.length/s-1,z=u||0,F=0;F<=P;++F){var N=F*s,V=z+Fm(F,P)*2*Math.PI/P;r[N]=p[0]+n*Math.cos(V),r[N+1]=p[1]+n*Math.sin(V)}y.changed()}var fw=function(){function y(p){var n=p||{};this.color_=n.color!==void 0?n.color:null}return y.prototype.clone=function(){var p=this.getColor();return new y({color:Array.isArray(p)?p.slice():p||void 0})},y.prototype.getColor=function(){return this.color_},y.prototype.setColor=function(p){this.color_=p},y}(),Ks=fw;function Qm(y,p,n,u,r,s,P){var z,F,N=(n-p)/u;if(N===1)z=p;else if(N===2)z=p,F=r;else if(N!==0){for(var V=y[p],me=y[p+1],_e=0,Se=[0],Ue=p+u;Ue<n;Ue+=u){var He=y[Ue],Ie=y[Ue+1];_e+=Math.sqrt((He-V)*(He-V)+(Ie-me)*(Ie-me)),Se.push(_e),V=He,me=Ie}var Ge=r*_e,Je=_v(Se,Ge);Je<0?(F=(Ge-Se[-Je-2])/(Se[-Je-1]-Se[-Je-2]),z=p+(-Je-2)*u):z=p+Je*u}for(var rt=P>1?P:2,_t=s||new Array(rt),Ue=0;Ue<rt;++Ue)_t[Ue]=z===void 0?NaN:F===void 0?y[z+Ue]:gl(y[z+Ue],y[z+u+Ue],F);return _t}function Jm(y,p,n,u,r,s){if(n==p)return null;var P;if(r<y[p+u-1])return s?(P=y.slice(p,p+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[p+u-1])return y.slice(p,p+u);for(var z=p/u,F=n/u;z<F;){var N=z+F>>1;r<y[(N+1)*u-1]?F=N:z=N+1}var V=y[z*u-1];if(r==V)return y.slice((z-1)*u,(z-1)*u+u);var me=y[(z+1)*u-1],_e=(r-V)/(me-V);P=[];for(var Se=0;Se<u-1;++Se)P.push(gl(y[(z-1)*u+Se],y[z*u+Se],_e));return P.push(r),P}function zx(y,p,n,u,r,s,P){if(P)return Jm(y,p,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,N=n.length;F<N;++F){var V=n[F];if(p!=V){if(r<y[p+u-1])return null;if(r<=y[V-1])return Jm(y,p,V,u,r,!1);p=V}}return null}function eg(y,p,n,u){for(var r=y[p],s=y[p+1],P=0,z=p+u;z<n;z+=u){var F=y[z],N=y[z+1];P+=Math.sqrt((F-r)*(F-r)+(N-s)*(N-s)),r=F,s=N}return P}var dw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),mw=function(y){dw(p,y);function p(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 p.prototype.appendCoordinate=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n):this.flatCoordinates=n.slice(),this.changed()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ad(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ld(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,n,u,r,s))},p.prototype.forEachSegment=function(n){return Hm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},p.prototype.getCoordinateAtM=function(n,u){if(this.layout!=Pn.XYM&&this.layout!=Pn.XYZM)return null;var r=u!==void 0?u:!1;return Jm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,r)},p.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.prototype.getCoordinateAt=function(n,u){return Qm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,this.stride)},p.prototype.getLength=function(){return eg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.prototype.getFlatMidpoint=function(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=hd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new p(u,Pn.XY)},p.prototype.getType=function(){return Mt.LINE_STRING},p.prototype.intersectsExtent=function(n){return dd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},p}(Es),uc=mw;var gw=function(){function y(p){var n=p||{};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 p=this.getColor();return new y({color:Array.isArray(p)?p.slice():p||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(p){this.color_=p},y.prototype.setLineCap=function(p){this.lineCap_=p},y.prototype.setLineDash=function(p){this.lineDash_=p},y.prototype.setLineDashOffset=function(p){this.lineDashOffset_=p},y.prototype.setLineJoin=function(p){this.lineJoin_=p},y.prototype.setMiterLimit=function(p){this.miterLimit_=p},y.prototype.setWidth=function(p){this.width_=p},y}(),va=gw;var qi={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Jy(y,p){return Array.isArray(y)?y:(p===void 0?p=[y,y]:(p[0]=y,p[1]=y),p)}var yw=function(){function y(p){this.opacity_=p.opacity,this.rotateWithView_=p.rotateWithView,this.rotation_=p.rotation,this.scale_=p.scale,this.scaleArray_=Jy(p.scale),this.displacement_=p.displacement}return y.prototype.clone=function(){var p=this.getScale();return new y({opacity:this.getOpacity(),scale:Array.isArray(p)?p.slice():p,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(p){return jr()},y.prototype.getHitDetectionImage=function(){return jr()},y.prototype.getPixelRatio=function(p){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(p){this.displacement_=p},y.prototype.setOpacity=function(p){this.opacity_=p},y.prototype.setRotateWithView=function(p){this.rotateWithView_=p},y.prototype.setRotation=function(p){this.rotation_=p},y.prototype.setScale=function(p){this.scale_=p,this.scaleArray_=Jy(p)},y.prototype.listenImageChange=function(p){jr()},y.prototype.load=function(){jr()},y.prototype.unlistenImageChange=function(p){jr()},y}(),tg=yw;var _w=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,vw=/^([a-z]*)$|^hsla?\(.*\)$/i;function rg(y){return typeof y=="string"?y:Qy(y)}function xw(y){var p=document.createElement("div");if(p.style.color=y,p.style.color!==""){document.body.appendChild(p);var n=getComputedStyle(p).color;return document.body.removeChild(p),n}else return""}var bw=function(){var y=1024,p={},n=0;return function(u){var r;if(p.hasOwnProperty(u))r=p[u];else{if(n>=y){var s=0;for(var P in p)(s++&3)===0&&(delete p[P],--n)}r=ww(u),p[u]=r,++n}return r}}();function Jh(y){return Array.isArray(y)?y:bw(y)}function ww(y){var p,n,u,r,s;if(vw.exec(y)&&(y=xw(y)),_w.exec(y)){var P=y.length-1,z=void 0;P<=4?z=1:z=2;var F=P===4||P===8;p=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&&(p=(p<<4)+p,n=(n<<4)+n,u=(u<<4)+u,F&&(r=(r<<4)+r)),s=[p,n,u,r/255]}else y.indexOf("rgba(")==0?(s=y.slice(5,-1).split(",").map(Number),Dx(s)):y.indexOf("rgb(")==0?(s=y.slice(4,-1).split(",").map(Number),s.push(1),Dx(s)):En(!1,14);return s}function Dx(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 Qy(y){var p=y[0];p!=(p|0)&&(p=p+.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("+p+","+n+","+u+","+r+")"}function Ts(y){return Array.isArray(y)?Qy(y):y}function Ja(y,p,n,u){var r;return n&&n.length?r=n.shift():ah?r=new OffscreenCanvas(y||300,p||300):r=document.createElement("canvas"),y&&(r.width=y),p&&(r.height=p),r.getContext("2d",u)}var Ew=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"),Ox=["style","variant","weight","size","lineHeight","family"],e_=function(y){var p=y.match(Ew);if(!p)return null;for(var n={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},u=0,r=Ox.length;u<r;++u){var s=p[u+1];s!==void 0&&(n[Ox[u]]=s)}return n.families=n.family.split(/,\s?/),n};function Fx(y){return y===1?"":String(Math.round(y*100)/100)}var ng="10px sans-serif",Ss="#000",Qh="round",cc=[],hc=0,Iu="round",pc=10,fc="#000",mh="center",ep="middle",dc=[0,0,0,0],mc=1,dh=new Mo,Tw=new nh;Tw.setSize=function(){console.warn("labelCache is deprecated.")};var sf=null,t_,r_={},Bx=function(){var y=100,p="32px ",n=["monospace","serif"],u=n.length,r="wmytzilWMYTZIL@#/&?$%10\uF013",s,P;function z(N,V,me){for(var _e=!0,Se=0;Se<u;++Se){var Ue=n[Se];if(P=ig(N+" "+V+" "+p+Ue,r),me!=Ue){var He=ig(N+" "+V+" "+p+me+","+Ue,r);_e=_e&&He!=P}}return!!_e}function F(){for(var N=!0,V=dh.getKeys(),me=0,_e=V.length;me<_e;++me){var Se=V[me];dh.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 ru(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 X=new s.EvaluationParameters(U,{now:q,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Y=X.crossFadingFactor();Y===1&&Y===this._crossFadingFactor||(T=!0,this._crossFadingFactor=Y),this.style.update(X)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new 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),V.remove(this._canvasContainer),V.remove(this._controlContainer),this._cooperativeGestures&&V.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({},Uo,E),this._container=V.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})),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),V.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=V.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 Fr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){V.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(E,i){let d=V.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=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),i=this._setupUI,Vn!==void 0?i(Vn):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Vn=d.state!=="denied",i(Vn)}):(Vn=!!window.navigator.geolocation,i(Vn)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),V.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xi=0,Jo=!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&&Jo)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=V.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",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=V.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Yo(this._dotElement),this._circleElement=V.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Yo({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--,Jo=!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},Jo=!0):(E=this.options.positionOptions,Jo=!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({},cr,E),s.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ur(this._map,this._container,this.options)}onAdd(E){return this._map=E,this._container=V.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(){V.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(E){this.options.unit=E,ur(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=V.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(){V.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){let E=this._fullscreenButton=V.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);V.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=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=V.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){V.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends 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&&V.remove(this._content),this._container&&(V.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new 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=V.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=V.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(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=V.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=V.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(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=Co(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();V.setTransform(this._container,`${lr[d]} translate(${T.x}px,${T.y}px)`),hr(this._container,d,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let E=this._container.querySelector(Si);E&&E.focus()}_onClose(){this.remove()}},Marker:Yo,Style:In,LngLat:s.LngLat,LngLatBounds:s.LngLatBounds,Point:s.pointGeometry,MercatorCoordinate:s.MercatorCoordinate,Evented:s.Evented,AJAXError:s.AJAXError,config:s.config,CanvasSource:Sr,GeoJSONSource:Vr,ImageSource:zr,RasterDEMTileSource:At,RasterTileSource:Jt,VectorTileSource:jt,VideoSource:br,prewarm:function(){ln().acquire(Ni)},clearPrewarmedResources:function(){let E=Zi;E&&(E.isPreloaded()&&E.numActive()===1?(E.release(Ni),Zi=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 Cr.workerCount},set workerCount(E){Cr.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 Hi.extend(so,{isSafari:s.isSafari,getPerformanceMetrics:s.PerformanceUtils.getPerformanceMetrics}),so});var r=n;return r})});var l1=qf((EB,s1)=>{var IE="Expected a function",o1=NaN,CE="[object Symbol]",AE=/^\s+|\s+$/g,PE=/^[-+]0x[0-9a-f]+$/i,ME=/^0b[01]+$/i,kE=/^0o[0-7]+$/i,LE=parseInt,RE=typeof global=="object"&&global&&global.Object===Object&&global,zE=typeof self=="object"&&self&&self.Object===Object&&self,DE=RE||zE||Function("return this")(),OE=Object.prototype,FE=OE.toString,BE=Math.max,UE=Math.min,F_=function(){return DE.Date.now()};function NE(y,p,n){var u,r,s,P,z,F,N=0,V=!1,me=!1,_e=!0;if(typeof y!="function")throw new TypeError(IE);p=a1(p)||0,B_(n)&&(V=!!n.leading,me="maxWait"in n,s=me?BE(a1(n.maxWait)||0,p):s,_e="trailing"in n?!!n.trailing:_e);function Se(ct){var Tt=u,St=r;return u=r=void 0,N=ct,P=y.apply(St,Tt),P}function Ue(ct){return N=ct,z=setTimeout(Ge,p),V?Se(ct):P}function He(ct){var Tt=ct-F,St=ct-N,Lt=p-Tt;return me?UE(Lt,s-St):Lt}function Ie(ct){var Tt=ct-F,St=ct-N;return F===void 0||Tt>=p||Tt<0||me&&St>=s}function Ge(){var ct=F_();if(Ie(ct))return Je(ct);z=setTimeout(Ge,He(ct))}function Je(ct){return z=void 0,_e&&u?Se(ct):(u=r=void 0,P)}function rt(){z!==void 0&&clearTimeout(z),N=0,u=F=r=z=void 0}function _t(){return z===void 0?P:Je(F_())}function yt(){var ct=F_(),Tt=Ie(ct);if(u=arguments,r=this,F=ct,Tt){if(z===void 0)return Ue(F);if(me)return z=setTimeout(Ge,p),Se(F)}return z===void 0&&(z=setTimeout(Ge,p)),P}return yt.cancel=rt,yt.flush=_t,yt}function B_(y){var p=typeof y;return!!y&&(p=="object"||p=="function")}function VE(y){return!!y&&typeof y=="object"}function GE(y){return typeof y=="symbol"||VE(y)&&FE.call(y)==CE}function a1(y){if(typeof y=="number")return y;if(GE(y))return o1;if(B_(y)){var p=typeof y.valueOf=="function"?y.valueOf():y;y=B_(p)?p+"":p}if(typeof y!="string")return y===0?y:+y;y=y.replace(AE,"");var n=ME.test(y);return n||kE.test(y)?LE(y.slice(2),n?2:8):PE.test(y)?o1:+y}s1.exports=NE});var f1=qf((TB,p1)=>{var h1="Expected a function",u1=NaN,jE="[object Symbol]",qE=/^\s+|\s+$/g,ZE=/^[-+]0x[0-9a-f]+$/i,WE=/^0b[01]+$/i,XE=/^0o[0-7]+$/i,$E=parseInt,KE=typeof global=="object"&&global&&global.Object===Object&&global,HE=typeof self=="object"&&self&&self.Object===Object&&self,YE=KE||HE||Function("return this")(),JE=Object.prototype,QE=JE.toString,eT=Math.max,tT=Math.min,U_=function(){return YE.Date.now()};function rT(y,p,n){var u,r,s,P,z,F,N=0,V=!1,me=!1,_e=!0;if(typeof y!="function")throw new TypeError(h1);p=c1(p)||0,mg(n)&&(V=!!n.leading,me="maxWait"in n,s=me?eT(c1(n.maxWait)||0,p):s,_e="trailing"in n?!!n.trailing:_e);function Se(ct){var Tt=u,St=r;return u=r=void 0,N=ct,P=y.apply(St,Tt),P}function Ue(ct){return N=ct,z=setTimeout(Ge,p),V?Se(ct):P}function He(ct){var Tt=ct-F,St=ct-N,Lt=p-Tt;return me?tT(Lt,s-St):Lt}function Ie(ct){var Tt=ct-F,St=ct-N;return F===void 0||Tt>=p||Tt<0||me&&St>=s}function Ge(){var ct=U_();if(Ie(ct))return Je(ct);z=setTimeout(Ge,He(ct))}function Je(ct){return z=void 0,_e&&u?Se(ct):(u=r=void 0,P)}function rt(){z!==void 0&&clearTimeout(z),N=0,u=F=r=z=void 0}function _t(){return z===void 0?P:Je(U_())}function yt(){var ct=U_(),Tt=Ie(ct);if(u=arguments,r=this,F=ct,Tt){if(z===void 0)return Ue(F);if(me)return z=setTimeout(Ge,p),Se(F)}return z===void 0&&(z=setTimeout(Ge,p)),P}return yt.cancel=rt,yt.flush=_t,yt}function iT(y,p,n){var u=!0,r=!0;if(typeof y!="function")throw new TypeError(h1);return mg(n)&&(u="leading"in n?!!n.leading:u,r="trailing"in n?!!n.trailing:r),rT(y,p,{leading:u,maxWait:p,trailing:r})}function mg(y){var p=typeof y;return!!y&&(p=="object"||p=="function")}function nT(y){return!!y&&typeof y=="object"}function oT(y){return typeof y=="symbol"||nT(y)&&QE.call(y)==jE}function c1(y){if(typeof y=="number")return y;if(oT(y))return u1;if(mg(y)){var p=typeof y.valueOf=="function"?y.valueOf():y;y=mg(p)?p+"":p}if(typeof y!="string")return y===0?y:+y;y=y.replace(qE,"");var n=WE.test(y);return n||XE.test(y)?$E(y.slice(2),n?2:8):ZE.test(y)?u1:+y}p1.exports=iT});var _g={};ay(_g,{CopyrightControl:()=>ux,Layer:()=>Is,MapboxLayer:()=>np,MapboxStyleLayer:()=>n1,MaplibreLayer:()=>op,RealtimeAPI:()=>$f,RealtimeLayer:()=>m1,RealtimeModes:()=>ia,RoutingAPI:()=>Zf,RoutingControl:()=>H0,RoutingLayer:()=>pg,StopFinderControl:()=>J0,StopsAPI:()=>Wf,VectorLayer:()=>g1,WMSLayer:()=>y1,compareDepartures:()=>id,createRealtimeFilters:()=>hy,debounceDeparturesMessages:()=>Ay,debounceWebsocketMessages:()=>Xf,fullTrajectoryDelayStyle:()=>d1,fullTrajectoryStyle:()=>yg,getCircleCanvas:()=>Oy,getDelayBgCanvas:()=>zy,getDelayTextCanvas:()=>Dy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>Kf,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getTextCanvas:()=>Fy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Zh,pad:()=>zm,realtimeConfig:()=>rf,realtimeDefaultStyle:()=>Kh,realtimeDelayStyle:()=>By,realtimeSimpleStyle:()=>Uy,removeDuplicate:()=>Wh,renderTrajectories:()=>Hf,sortAndFilterDepartures:()=>nd,sortByDelay:()=>py});var H1=function(){function y(p){this.propagationStopped,this.defaultPrevented,this.type=p,this.target=null}return y.prototype.preventDefault=function(){this.defaultPrevented=!0},y.prototype.stopPropagation=function(){this.propagationStopped=!0},y}();var sn=H1;var jp={PROPERTYCHANGE:"propertychange"};var Y1=function(){function y(){this.disposed=!1}return y.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},y.prototype.disposeInternal=function(){},y}(),yv=Y1;function _v(y,p,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],p),r<0?P=u+1:(z=u,F=!r);return F?P:~P}function rh(y,p){return y>p?1:y<p?-1:0}function vv(y,p){return y.indexOf(p)>=0}function xv(y,p,n){for(;p<n;){var u=y[p];y[p]=y[n],y[n]=u,++p,--n}}function Ka(y,p){for(var n=Array.isArray(p)?p:[p],u=n.length,r=0;r<u;r++)y[y.length]=n[r]}function _s(y,p){var n=y.length;if(n!==p.length)return!1;for(var u=0;u<n;u++)if(y[u]!==p[u])return!1;return!0}function Am(){return!0}function qh(){}function bv(y){var p=!1,n,u,r;return function(){var s=Array.prototype.slice.call(arguments);return(!p||this!==r||!_s(s,u))&&(p=!0,r=this,u=s,n=y.apply(this,arguments)),n}}var Ra=typeof Object.assign=="function"?Object.assign:function(y,p){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 p in y)delete y[p]}var Pm=typeof Object.values=="function"?Object.values:function(y){var p=[];for(var n in y)p.push(y[n]);return p};function Vl(y){var p;for(p in y)return!1;return!p}var J1=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q1=function(y){J1(p,y);function p(n){var u=y.call(this)||this;return u.eventTarget_=n,u.pendingRemovals_=null,u.dispatching_=null,u.listeners_=null,u}return p.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)}},p.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 sn(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 N,V=0,me=s.length;V<me;++V)if("handleEvent"in s[V]?N=s[V].handleEvent(P):N=s[V].call(this,P),N===!1||P.propagationStopped){N=!1;break}if(--z[r]===0){var _e=F[r];for(delete F[r];_e--;)this.removeEventListener(r,qh);delete z[r]}return N}},p.prototype.disposeInternal=function(){this.listeners_&&ih(this.listeners_)},p.prototype.getListeners=function(n){return this.listeners_&&this.listeners_[n]||void 0},p.prototype.hasListener=function(n){return this.listeners_?n?n in this.listeners_:Object.keys(this.listeners_).length>0:!1},p.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]=qh,++this.pendingRemovals_[n]):(r.splice(s,1),r.length===0&&delete this.listeners_[n]))}},p}(yv),nh=Q1;var Ji={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 uo(y,p,n,u,r){if(u&&u!==y&&(n=n.bind(u)),r){var s=n;n=function(){y.removeEventListener(p,n),s.apply(this,arguments)}}var P={target:y,type:p,listener:n};return y.addEventListener(p,n),P}function qp(y,p,n,u){return uo(y,p,n,u,!0)}function Po(y){y&&y.target&&(y.target.removeEventListener(y.type,y.listener),ih(y))}var eb=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Mm=function(y){eb(p,y);function p(){var n=y.call(this)||this;return n.on=n.onInternal,n.once=n.onceInternal,n.un=n.unInternal,n.revision_=0,n}return p.prototype.changed=function(){++this.revision_,this.dispatchEvent(Ji.CHANGE)},p.prototype.getRevision=function(){return this.revision_},p.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]=uo(this,n[P],u);return s}else return uo(this,n,u)},p.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]=qp(this,n[P],u)}else r=qp(this,n,u);return u.ol_key=r,r},p.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)},p}(nh);Mm.prototype.on;Mm.prototype.once;Mm.prototype.un;function Ha(y){if(Array.isArray(y))for(var p=0,n=y.length;p<n;++p)Po(y[p]);else Po(y)}var km=Mm;function jr(){return function(){throw new Error("Unimplemented abstract method.")}()}var tb=0;function Ai(y){return y.ol_uid||(y.ol_uid=String(++tb))}var Lm="6.14.1";var Ev=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),wv=function(y){Ev(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.key=u,s.oldValue=r,s}return p}(sn);var rb=function(y){Ev(p,y);function p(n){var u=y.call(this)||this;return u.on,u.once,u.un,Ai(u),u.values_=null,n!==void 0&&u.setProperties(n),u}return p.prototype.get=function(n){var u;return this.values_&&this.values_.hasOwnProperty(n)&&(u=this.values_[n]),u},p.prototype.getKeys=function(){return this.values_&&Object.keys(this.values_)||[]},p.prototype.getProperties=function(){return this.values_&&Ra({},this.values_)||{}},p.prototype.hasProperties=function(){return!!this.values_},p.prototype.notify=function(n,u){var r;r="change:".concat(n),this.hasListener(r)&&this.dispatchEvent(new wv(r,n,u)),r=jp.PROPERTYCHANGE,this.hasListener(r)&&this.dispatchEvent(new wv(r,n,u))},p.prototype.addChangeListener=function(n,u){this.addEventListener("change:".concat(n),u)},p.prototype.removeChangeListener=function(n,u){this.removeEventListener("change:".concat(n),u)},p.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)}},p.prototype.setProperties=function(n,u){for(var r in n)this.set(r,n[r],u)},p.prototype.applyProperties=function(n){!n.values_||Ra(this.values_||(this.values_={}),n.values_)},p.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)}},p}(km),Mo=rb;var ib=(y,p)=>{let n=new URL(y);return Object.entries(p||{}).forEach(([r,s])=>{s!=null&&n.searchParams.set(r,s)}),n},Zh=ib;var sy=class extends Mo{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=Zh(`${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))}})}},Rm=sy;var ly=class extends Rm{constructor(p={}){super({url:"https://api.geops.io/routing/v1/",...p})}route(p,n){return this.fetch("",p,n)}},Zf=ly;var uy=class extends Rm{constructor(p={}){super({url:"https://api.geops.io/stops/v1/",...p})}search(p,n){return this.fetch("",p,n)}},Wf=uy;var Zp=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(p,n={}){let u=`${p} ${n.channel}`;return u+=n.args?` ${n.args}`:"",u+=n.id?` ${n.id}`:"",u.trim()}connect(p,n=()=>{}){this.websocket&&!this.closed&&this.websocket.close(),this.websocket=new WebSocket(p),this.open?(n(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{n(),this.subscribePreviousSubscriptions()})}close(){this.websocket&&(this.websocket.onclose=null,this.websocket.close(),this.websocket=void 0,this.messagesOnOpen=[])}send(p){if(!this.websocket)return;let n=()=>{this.websocket?.send(p)};this.open?this.messagesOnOpen.includes(p)||n():this.messagesOnOpen.includes(p)||(this.messagesOnOpen.push(p),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],n()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}addEvents(p,n){this.websocket&&(this.websocket.addEventListener("message",p),n&&(this.websocket.addEventListener("error",n),this.websocket.addEventListener("close",n)))}removeEvents(p,n){this.websocket&&(this.websocket.removeEventListener("message",p),n&&(this.websocket.removeEventListener("error",n),this.websocket.removeEventListener("close",n)))}listen(p,n,u){this.unlisten(p,n);let r=s=>{let P;try{P=JSON.parse(s.data)}catch(N){console.error("WebSocket: unable to parse JSON data",N,s.data);return}let z=p.channel;z+=p.args?` ${p.args}`:"";let F;P.source==="buffer"?F=P.content:F=[P],F.forEach(N=>{N?.source===z&&(!p.id||p.id===P.client_reference)&&n(N)})};return this.addEvents(r,u),{onMessageCb:r,onErrorCb:u}}unlisten(p,n){[...this.subscriptions||[],...this.requests||[]].filter(u=>u.params.channel===p.channel&&(!n||u.cb===n)).forEach(({onMessageCb:u,onErrorCb:r})=>{this.removeEvents(u,r)})}get(p,n,u){let r=Zp.getRequestString("GET",p);this.send(r);let s=V=>(...me)=>{V(...me);let _e=this.requests.findIndex(He=>r===He.requestString&&n===He.cb),{onMessageCb:Se,onErrorCb:Ue}=this.requests[_e];this.removeEvents(Se,Ue),this.requests.splice(_e,1)},{onMessageCb:P,onErrorCb:z}=this.listen(p,s(n),u&&s(u));this.requests||(this.requests=[]);let F=this.requests.findIndex(V=>r===V.requestString&&n===V.cb),N={params:p,requestString:r,cb:n,errorCb:u,onMessageCb:P,onErrorCb:z};F>-1?this.requests[F]=N:this.requests.push(N)}subscribe(p,n,u,r=!1){let{onMessageCb:s,onErrorCb:P}=this.listen(p,n,u),z=Zp.getRequestString("",p),F=this.subscriptions.findIndex(V=>p.channel===V.params.channel&&n===V.cb),N={params:p,cb:n,errorCb:u,onMessageCb:s,onErrorCb:P,quiet:r};F>-1?this.subscriptions[F]=N:this.subscriptions.push(N),this.subscribed[z]||(N.quiet||(this.send(`GET ${z}`),this.send(`SUB ${z}`)),this.subscribed[z]=!0)}unsubscribe(p,n){let u=this.subscriptions.filter(r=>r.params.channel===p&&(!n||r.cb===n));u.forEach(({onMessageCb:r,onErrorCb:s})=>{this.removeEvents(r,s)}),this.subscriptions=this.subscriptions.filter(r=>r.params.channel!==p||n&&r.cb!==n),p&&this.subscribed[p]&&!this.subscriptions.find(r=>r.params.channel===p)&&u.find(r=>!r.quiet)&&(this.send(`DEL ${p}`),this.subscribed[p]=!1)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(p=>{this.subscribed[p]=!1}),[...this.subscriptions].forEach(p=>{this.subscribe(p.params,p.cb,p.errorCb,p.quiet)})}},Tv=Zp;var nb=(y,p,n=100)=>{let u={},r={},s=[];return P=>{let{source:z,content:F}=P;u[z]&&window.clearTimeout(u[z]),p?r[p(F)]=F:s.push(F),u[z]=window.setTimeout(()=>{let N=p?Object.values(r):s;y(N)},n)}},Xf=nb;var ob=(y,p)=>y===p.SCHEMATIC?"_schematic":"",xu=ob;var ia={RAW:"raw",TOPOGRAPHIC:"topographic",SCHEMATIC:"schematic"},cy=class{constructor(p={}){this.defineProperties(p),this.prefix=p.prefix||"",this.onOpen=this.onOpen.bind(this)}defineProperties(p){let n=p;typeof p=="string"&&(n={url:p});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:N=>{r=N,this.open()}},projection:{get:()=>s,set:N=>{N!==s&&(s=N,this.wsApi&&this.wsApi.send(`PROJECTION ${s}`))}},bbox:{get:()=>P,set:N=>{JSON.stringify(N)!==JSON.stringify(P)&&(P=N,this.wsApi&&P&&this.wsApi.send(`BBOX ${P.join(" ")}`))}},buffer:{get:()=>z,set:N=>{JSON.stringify(N)!==JSON.stringify(z)&&(z=N,this.wsApi&&this.wsApi.send(`BUFFER ${z.join(" ")}`))}},wsApi:{value:F,writable:!0},pingIntervalMs:{value:p.pingIntervalMs||1e4,writable:!0},reconnectTimeoutMs:{value:p.pingIntervalMs||100,writable:!0}})}open(){this.close(),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(p,n,u=()=>{},r=!1){!p||!n||this.wsApi.subscribe({channel:p},n,u,r)}unsubscribe(p,n="",u){let r=xu(ia.SCHEMATIC,ia),s=xu(ia.TOPOGRAPHIC,ia);this.wsApi.unsubscribe(`${p}${r}${n||""}`,u),this.wsApi.unsubscribe(`${p}${s}${n||""}`,u)}subscribeDepartures(p,n,u=()=>{},r=!1){this.subscribe(`timetable_${p}`,n,u,r)}unsubscribeDepartures(p,n){this.unsubscribe(`timetable_${p}`,"",n)}subscribeDisruptions(p,n=()=>{},u=!1){this.subscribe(`${this.prefix}newsticker`,p,n,u)}unsubscribeDisruptions(p){this.unsubscribe(`${this.prefix}newsticker`,"",p)}getStation(p,n){let u={channel:`station${xu(n,ia)}`,args:p};return new Promise((r,s)=>{this.wsApi.get(u,r,s)})}getStations(p,n=100){return new Promise(u=>{this.wsApi.get({channel:`station${xu(p,ia)}`},Xf(u,void 0,n))})}subscribeStations(p,n,u=()=>{},r=!1){this.subscribe(`station${xu(p,ia)}`,n,u,r)}unsubscribeStations(p){this.unsubscribe("station","",p)}subscribeExtraGeoms(p,n=()=>{},u=!1){this.subscribe("extra_geoms",p,n,u)}unsubscribeExtraGeoms(p){this.unsubscribe("extra_geoms","",p)}subscribeTrajectory(p,n,u=()=>{},r=!1){this.unsubscribeTrajectory(n),this.subscribe(`trajectory${xu(p,ia)}`,n,u,r)}unsubscribeTrajectory(p){this.unsubscribe("trajectory","",p)}subscribeDeletedVehicles(p,n,u=()=>{},r=!1){this.unsubscribeDeletedVehicles(n),this.subscribe(`deleted_vehicles${xu(p,ia)}`,n,u,r)}unsubscribeDeletedVehicles(p){this.unsubscribe("deleted_vehicles","",p)}getFullTrajectory(p,n,u){let r=[`full_trajectory${xu(n,ia)}`];p&&r.push(p),(!n||n===ia.TOPOGRAPHIC)&&u&&r.push(`gen${u}`);let s={channel:r.join("_")};return new Promise((P,z)=>{this.wsApi.get(s,P,z)})}subscribeFullTrajectory(p,n,u,r=()=>{},s=!1){this.subscribe(`full_trajectory${xu(n,ia)}_${p}`,u,r,s)}unsubscribeFullTrajectory(p,n){this.unsubscribe("full_trajectory",`_${p}`,n)}getStopSequence(p){return new Promise((n,u)=>{this.wsApi.get({channel:`stopsequence_${p}`},n,u)})}subscribeStopSequence(p,n,u=()=>{},r=!1){this.subscribe(`stopsequence_${p}`,n,u,r)}unsubscribeStopSequence(p,n){this.unsubscribe("stopsequence",`_${p}`,n)}subscribeHealthCheck(p,n=()=>{},u=!1){this.subscribe("healthcheck",p,n,u)}unsubscribeHealthCheck(p){this.unsubscribe("healthcheck","",p)}},$f=cy;var ab=y=>{let p=y.filter(s=>s!=null&&s.trim&&s.trim()),n=p.map(s=>s.toLowerCase());return[...new Set(n)].map(s=>p.find(P=>P.toLowerCase()===s))},Wh=ab;var sb=y=>{if(!y)return[];let{style:p}=y;if(!p)return[];let{sourceCaches:n}=p,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)},oc=sb;var lb=(y,p,n,u)=>{let r=[];if(!y&&!p&&!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(N=>new RegExp(N,"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:N,name:V}=F.properties,me=(V||N&&N.name||"").toUpperCase();return me?P.includes(me):!1};r.push(z)}if(p){let P=(typeof p=="string"?p.split(","):p).map(F=>parseInt(F,10)),z=F=>{let N=F.properties.route_identifier||F.properties.routeIdentifier||"",V=parseInt(N.split(".")[0],10);return P.includes(V)};r.push(z)}if(n){let s=typeof n=="string"?[n]:n,P=z=>s.some(F=>{let N=z.properties.operator||z.properties.tenant||"";return new RegExp(F,"i").test(N)});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},hy=lb;var Sv=y=>{let p=y;Array.isArray(p)||(p=[y]);let n=[];return p.forEach(u=>{n.push(u);let{children:r}=u;n=n.concat(Sv(r||[]))}),n},Kf=Sv;var Iv=(y=new Date)=>{let p=(y.getUTCMonth()+1).toString();p=p.length===1?`0${p}`:p;let n=y.getUTCDate().toString();return n=n.length===1?`0${n}`:n,[y.getUTCFullYear(),p,n].join("")},Cv=y=>[y.getUTCHours(),y.getUTCMinutes(),`${y.getUTCSeconds()}.${y.getUTCMilliseconds()}`].join(":"),zm=y=>y<10?`0${y}`:`${y}`,Av=y=>{if(!y||y<=0)return"";let p=new Date(y);return`${zm(p.getHours())}:${zm(p.getMinutes())}`};var ub=(y,p)=>{let n=y.properties,u=p.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},py=ub;var oh=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",CS=oh.indexOf("firefox")!==-1,cb=oh.indexOf("safari")!==-1&&oh.indexOf("chrom")==-1,AS=cb&&!!(oh.indexOf("version/15.4")>=0||oh.match(/cpu (os|iphone os) 15_4 like mac os x/)),PS=oh.indexOf("webkit")!==-1&&oh.indexOf("edge")==-1,MS=oh.indexOf("macintosh")!==-1;var ah=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Pv=typeof Image<"u"&&Image.prototype.decode,kS=function(){var y=!1;try{var p=Object.defineProperty({},"passive",{get:function(){y=!0}});window.addEventListener("_",null,p),window.removeEventListener("_",null,p)}catch{}return y}();var hb=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),pb=function(y){hb(p,y);function p(n){var u=this,r=Lm==="latest"?Lm:"v"+Lm.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 p}(Error),Dm=pb;function En(y,p){if(!y)throw new Dm(p)}var US=new Array(6);function za(){return[1,0,0,1,0,0]}function fb(y,p,n,u,r,s,P){return y[0]=p,y[1]=n,y[2]=u,y[3]=r,y[4]=s,y[5]=P,y}function kv(y,p){return y[0]=p[0],y[1]=p[1],y[2]=p[2],y[3]=p[3],y[4]=p[4],y[5]=p[5],y}function bo(y,p){var n=p[0],u=p[1];return p[0]=y[0]*n+y[2]*u+y[4],p[1]=y[1]*n+y[3]*u+y[5],p}function Lv(y,p,n){return fb(y,p,0,0,n,0,0)}function vs(y,p,n,u,r,s,P,z){var F=Math.sin(s),N=Math.cos(s);return y[0]=u*N,y[1]=r*F,y[2]=-u*F,y[3]=r*N,y[4]=P*u*N-z*u*F+p,y[5]=P*r*F+z*r*N+n,y}function Rv(y,p,n,u,r,s,P){return fy(vs(za(),y,p,n,u,r,s,P))}function zv(y,p){var n=db(p);En(n!==0,32);var u=p[0],r=p[1],s=p[2],P=p[3],z=p[4],F=p[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 db(y){return y[0]*y[3]-y[1]*y[2]}var Mv;function fy(y){var p="matrix("+y.join(", ")+")";if(ah)return p;var n=Mv||(Mv=document.createElement("div"));return n.style.transform=p,n.style.transform}var Mt={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 mb=(y,p,n)=>{let{time_intervals:u,olGeometry:r,coordinate:s}=p.properties,P,z;if(n&&s)P=s;else if(r.getType()===Mt.POINT)P=r.getCoordinates();else if(r.getType()===Mt.LINE_STRING){let F=u||[[]],N=F[0],V=F[F.length-1];if(y<N[0])[,,z]=N,P=r.getFirstCoordinate();else if(y>V[0])[,,z]=V,P=r.getLastCoordinate();else for(let me=0;me<F.length-1;me+=1){let[_e,Se]=F[me],[Ue,He]=F[me+1];if(_e<=y&&y<=Ue){let Ge=Math.min((y-_e)/(Ue-_e),1)*(He-Se)+Se;P=r.getCoordinateAt(Ge),[,,z]=F[me];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",r);return{coord:P,rotation:z}},Dv=mb;var gb=(y,p,n,u,r)=>{if(!y)return{renderedTrajectories:[]};let{time:s=Date.now(),size:P=[],center:z,resolution:F,rotation:N=0,pixelRatio:V=1}=u;if(!F||!z)return{renderedTrajectories:[]};let{noInterpolate:me=!1,hoverVehicleId:_e,selectedVehicleId:Se,filter:Ue}=r,He=y.getContext("2d");He?.clearRect(0,0,y.width,y.height);let[Ie,Ge]=P;Ie&&Ge&&(y.width!==Ie||y.height!==Ge)&&([y.width,y.height]=[Ie*V,Ge*V]);let Je=vs(za(),P[0]/2,P[1]/2,1/F,-1/F,-N,-z[0],-z[1]);y.style&&(y.style.width=`${y.width/V}px`,y.style.height=`${y.height/V}px`);let rt,_t,yt,ct,Tt,St,Lt,nr,jt=[];for(let Jt=p.length-1;Jt>=0;Jt-=1){let or=p[Jt];if(Ue&&!Ue(or))continue;let{train_id:At,timeOffset:Vr}=or.properties,{coord:Er,rotation:zr}=Dv(s-(Vr||0),or,me);if(p[Jt].properties.coordinate=Er,p[Jt].properties.rotation=zr,!Er)continue;let br=bo(Je,[...Er]);if(!br||(br=br.map(Vt=>Vt*V),br[0]<0||br[0]>y.width||br[1]<0||br[1]>y.height))continue;let Sr=n(or,u,r);if(!Sr)continue;let xr=Sr.width,Qr=Sr.height;_e!==At&&Se!==At&&He?.drawImage(Sr,br[0]-xr/2,br[1]-Qr/2,xr,Qr),_e&&_e===At&&(rt=Sr,_t=br,yt=xr,ct=Qr),Se&&Se===At&&(Tt=Sr,St=br,Lt=xr,nr=Qr),jt.push(or)}return Tt&&St&&Lt&&nr&&He?.drawImage(Tt,St[0]-Lt/2,St[1]-nr/2,Lt,nr),rt&&_t&&yt&&ct&&He?.drawImage(rt,_t[0]-yt/2,_t[1]-ct/2,yt,ct),{renderedTrajectories:jt}},Hf=gb;var Gl={RADIANS:"radians",DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},XS={9001:Gl.METERS,9002:Gl.FEET,9003:Gl.USFEET,9101:Gl.RADIANS,9102:Gl.DEGREES};var bu={};bu[Gl.RADIANS]=6370997/(2*Math.PI);bu[Gl.DEGREES]=2*Math.PI*6370997/360;bu[Gl.FEET]=.3048;bu[Gl.METERS]=1;bu[Gl.USFEET]=1200/3937;var ac=Gl;var yb=function(){function y(p){this.code_=p.code,this.units_=p.units,this.extent_=p.extent!==void 0?p.extent:null,this.worldExtent_=p.worldExtent!==void 0?p.worldExtent:null,this.axisOrientation_=p.axisOrientation!==void 0?p.axisOrientation:"enu",this.global_=p.global!==void 0?p.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=p.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=p.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_||bu[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(p){this.global_=p,this.canWrapX_=!!(p&&this.extent_)},y.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},y.prototype.setDefaultTileGrid=function(p){this.defaultTileGrid_=p},y.prototype.setExtent=function(p){this.extent_=p,this.canWrapX_=!!(this.global_&&p)},y.prototype.setWorldExtent=function(p){this.worldExtent_=p},y.prototype.setGetPointResolution=function(p){this.getPointResolutionFunc_=p},y.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},y}(),Om=yb;function jl(y,p,n){return Math.min(Math.max(y,p),n)}var Ov=function(){var y;return"cosh"in Math?y=Math.cosh:y=function(p){var n=Math.exp(p);return(n+1/n)/2},y}(),YS=function(){var y;return"log2"in Math?y=Math.log2:y=function(p){return Math.log(p)*Math.LOG2E},y}();function Fv(y,p,n,u,r,s){var P=r-n,z=s-u;if(P!==0||z!==0){var F=((y-n)*P+(p-u)*z)/(P*P+z*z);F>1?(n=r,u=s):F>0&&(n+=P*F,u+=z*F)}return ql(y,p,n,u)}function ql(y,p,n,u){var r=n-y,s=u-p;return r*r+s*s}function Bv(y){return y*180/Math.PI}function Fm(y,p){var n=y%p;return n*p<0?n+p:n}function gl(y,p,n){return y+n*(p-y)}var _b=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Yf=6378137,Xp=Math.PI*Yf,vb=[-Xp,-Xp,Xp,Xp],xb=[-180,-85,180,85],Bm=Yf*Math.log(Math.tan(Math.PI/2)),Wp=function(y){_b(p,y);function p(n){return y.call(this,{code:n,units:ac.METERS,extent:vb,global:!0,worldExtent:xb,getPointResolution:function(u,r){return u/Ov(r[1]/Yf)}})||this}return p}(Om),dy=[new Wp("EPSG:3857"),new Wp("EPSG:102100"),new Wp("EPSG:102113"),new Wp("EPSG:900913"),new Wp("http://www.opengis.net/def/crs/EPSG/0/3857"),new Wp("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Uv(y,p,n){var u=y.length,r=n>1?n:2,s=p;s===void 0&&(r>2?s=y.slice():s=new Array(u));for(var P=0;P<u;P+=r){s[P]=Xp*y[P]/180;var z=Yf*Math.log(Math.tan(Math.PI*(+y[P+1]+90)/360));z>Bm?z=Bm:z<-Bm&&(z=-Bm),s[P+1]=z}return s}function Nv(y,p,n){var u=y.length,r=n>1?n:2,s=p;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]/Xp,s[P+1]=360*Math.atan(Math.exp(y[P+1]/Yf))/Math.PI-90;return s}var bb=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),wb=6378137,Vv=[-180,-90,180,90],Eb=Math.PI*wb/180,Xh=function(y){bb(p,y);function p(n,u){return y.call(this,{code:n,units:ac.DEGREES,extent:Vv,axisOrientation:u,global:!0,metersPerUnit:Eb,worldExtent:Vv})||this}return p}(Om),my=[new Xh("CRS:84"),new Xh("EPSG:4326","neu"),new Xh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Xh("urn:ogc:def:crs:OGC:2:84"),new Xh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Xh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Xh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var gy={};function Gv(y){return gy[y]||gy[y.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function jv(y,p){gy[y]=p}var $p={};function Jf(y,p,n){var u=y.getCode(),r=p.getCode();u in $p||($p[u]={}),$p[u][r]=n}function qv(y,p){var n;return y in $p&&p in $p[y]&&(n=$p[y][p]),n}var ko={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function wu(y){for(var p=Ya(),n=0,u=y.length;n<u;++n)yy(p,y[n]);return p}function Tb(y,p,n){var u=Math.min.apply(null,y),r=Math.min.apply(null,p),s=Math.max.apply(null,y),P=Math.max.apply(null,p);return sh(u,r,s,P,n)}function yl(y,p,n){return n?(n[0]=y[0]-p,n[1]=y[1]-p,n[2]=y[2]+p,n[3]=y[3]+p,n):[y[0]-p,y[1]-p,y[2]+p,y[3]+p]}function Zv(y,p){return p?(p[0]=y[0],p[1]=y[1],p[2]=y[2],p[3]=y[3],p):y.slice()}function xs(y,p,n){var u,r;return p<y[0]?u=y[0]-p:y[2]<p?u=p-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 Kp(y,p){return Qf(y,p[0],p[1])}function sc(y,p){return y[0]<=p[0]&&p[2]<=y[2]&&y[1]<=p[1]&&p[3]<=y[3]}function Qf(y,p,n){return y[0]<=p&&p<=y[2]&&y[1]<=n&&n<=y[3]}function Um(y,p){var n=y[0],u=y[1],r=y[2],s=y[3],P=p[0],z=p[1],F=ko.UNKNOWN;return P<n?F=F|ko.LEFT:P>r&&(F=F|ko.RIGHT),z<u?F=F|ko.BELOW:z>s&&(F=F|ko.ABOVE),F===ko.UNKNOWN&&(F=ko.INTERSECTING),F}function Ya(){return[1/0,1/0,-1/0,-1/0]}function sh(y,p,n,u,r){return r?(r[0]=y,r[1]=p,r[2]=n,r[3]=u,r):[y,p,n,u]}function Hp(y){return sh(1/0,1/0,-1/0,-1/0,y)}function Yp(y,p){var n=y[0],u=y[1];return sh(n,u,n,u,p)}function Nm(y,p,n,u,r){var s=Hp(r);return _y(s,y,p,n,u)}function Vm(y,p){return y[0]==p[0]&&y[2]==p[2]&&y[1]==p[1]&&y[3]==p[3]}function Wv(y,p){return p[0]<y[0]&&(y[0]=p[0]),p[2]>y[2]&&(y[2]=p[2]),p[1]<y[1]&&(y[1]=p[1]),p[3]>y[3]&&(y[3]=p[3]),y}function yy(y,p){p[0]<y[0]&&(y[0]=p[0]),p[0]>y[2]&&(y[2]=p[0]),p[1]<y[1]&&(y[1]=p[1]),p[1]>y[3]&&(y[3]=p[1])}function _y(y,p,n,u,r){for(;n<u;n+=r)Sb(y,p[n],p[n+1]);return y}function Sb(y,p,n){y[0]=Math.min(y[0],p),y[1]=Math.min(y[1],n),y[2]=Math.max(y[2],p),y[3]=Math.max(y[3],n)}function Xv(y,p){var n;return n=p(vy(y)),n||(n=p(xy(y)),n)||(n=p(wy(y)),n)||(n=p(by(y)),n)?n:!1}function vy(y){return[y[0],y[1]]}function xy(y){return[y[2],y[1]]}function $h(y){return[(y[0]+y[2])/2,(y[1]+y[3])/2]}function Eu(y){return y[3]-y[1]}function $v(y,p,n){var u=n||Ya();return Lo(y,p)?(y[0]>p[0]?u[0]=y[0]:u[0]=p[0],y[1]>p[1]?u[1]=y[1]:u[1]=p[1],y[2]<p[2]?u[2]=y[2]:u[2]=p[2],y[3]<p[3]?u[3]=y[3]:u[3]=p[3]):Hp(u),u}function by(y){return[y[0],y[3]]}function wy(y){return[y[2],y[3]]}function bs(y){return y[2]-y[0]}function Lo(y,p){return y[0]<=p[2]&&y[2]>=p[0]&&y[1]<=p[3]&&y[3]>=p[1]}function Kv(y,p){return p?(p[0]=y[0],p[1]=y[1],p[2]=y[2],p[3]=y[3],p):y}function Hv(y,p,n){var u=!1,r=Um(y,p),s=Um(y,n);if(r===ko.INTERSECTING||s===ko.INTERSECTING)u=!0;else{var P=y[0],z=y[1],F=y[2],N=y[3],V=p[0],me=p[1],_e=n[0],Se=n[1],Ue=(Se-me)/(_e-V),He=void 0,Ie=void 0;!!(s&ko.ABOVE)&&!(r&ko.ABOVE)&&(He=_e-(Se-N)/Ue,u=He>=P&&He<=F),!u&&!!(s&ko.RIGHT)&&!(r&ko.RIGHT)&&(Ie=Se-(_e-F)*Ue,u=Ie>=z&&Ie<=N),!u&&!!(s&ko.BELOW)&&!(r&ko.BELOW)&&(He=_e-(Se-z)/Ue,u=He>=P&&He<=F),!u&&!!(s&ko.LEFT)&&!(r&ko.LEFT)&&(Ie=Se-(_e-P)*Ue,u=Ie>=z&&Ie<=N)}return u}function Yv(y,p,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]];p(r,r,2);for(var F=[],N=[],z=0,V=r.length;z<V;z+=2)F.push(r[z]),N.push(r[z+1]);return Tb(F,N,n)}function Jv(y,p){var n=p.getExtent(),u=$h(y);if(p.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}function Ey(y,p){var n=y[0],u=y[1],r=p[0],s=p[1],P=r[0],z=r[1],F=s[0],N=s[1],V=F-P,me=N-z,_e=V===0&&me===0?0:(V*(n-P)+me*(u-z))/(V*V+me*me||0),Se,Ue;return _e<=0?(Se=P,Ue=z):_e>=1?(Se=F,Ue=N):(Se=P+_e*V,Ue=z+_e*me),[Se,Ue]}function Tu(y,p){for(var n=!0,u=y.length-1;u>=0;--u)if(y[u]!=p[u]){n=!1;break}return n}function Jp(y,p){var n=y[0]-p[0],u=y[1]-p[1];return n*n+u*u}function Ty(y,p){return Math.sqrt(Jp(y,p))}function Qv(y,p){return Jp(y,Ey(y,p))}function ex(y,p){if(p.canWrapX()){var n=bs(p.getExtent()),u=tx(y,p,n);u&&(y[0]-=u*n)}return y}function tx(y,p,n){var u=p.getExtent(),r=0;if(p.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 Sy=!0;function Ib(y){var p=y===void 0?!0:y;Sy=!p}function Iy(y,p,n){var u;if(p!==void 0){for(var r=0,s=y.length;r<s;++r)p[r]=y[r];u=p}else u=y.slice();return u}function Cb(y,p,n){if(p!==void 0&&y!==p){for(var u=0,r=y.length;u<r;++u)p[u]=y[u];y=p}return y}function Ab(y){jv(y.getCode(),y),Jf(y,y,Iy)}function Pb(y){y.forEach(Ab)}function ya(y){return typeof y=="string"?Gv(y):y||null}function rx(y){Pb(y),y.forEach(function(p){y.forEach(function(n){p!==n&&Jf(p,n,Iy)})})}function Mb(y,p,n,u){y.forEach(function(r){p.forEach(function(s){Jf(r,s,n),Jf(s,r,u)})})}function co(y,p){return Ib(),jm(y,"EPSG:4326",p!==void 0?p:"EPSG:3857")}function lh(y,p){var n=jm(y,p!==void 0?p:"EPSG:3857","EPSG:4326"),u=n[0];return(u<-180||u>180)&&(n[0]=Fm(u+180,360)-180),n}function ix(y,p){if(y===p)return!0;var n=y.getUnits()===p.getUnits();if(y.getCode()===p.getCode())return n;var u=Gm(y,p);return u===Iy&&n}function Gm(y,p){var n=y.getCode(),u=p.getCode(),r=qv(n,u);return r||(r=Cb),r}function ed(y,p){var n=ya(y),u=ya(p);return Gm(n,u)}function jm(y,p,n){var u=ed(p,n);return u(y,void 0,y.length)}function td(y,p,n,u){var r=ed(p,n);return Yv(y,r,void 0,u)}var Zl=null;function uh(){return Zl}function Cy(y,p){return Zl?jm(y,p,Zl):y}function Wl(y,p){return Zl?jm(y,Zl,p):(Sy&&!Tu(y,[0,0])&&y[0]>=-180&&y[0]<=180&&y[1]>=-90&&y[1]<=90&&(Sy=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),y)}function Qp(y,p){return Zl?td(y,p,Zl):y}function rd(y,p){return Zl?td(y,Zl,p):y}function nx(y,p){if(!Zl)return y;var n=ya(p).getUnits(),u=Zl.getUnits();return n&&u?y*bu[n]/bu[u]:y}function kb(){rx(dy),rx(my),Mb(my,dy,Uv,Nv)}kb();function ef(y){let p=document.createElement("div");return n=>{let{map:u,mbMap:r,olLayer:s}=y;if(!u||!r)return p;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:Bv(-z.rotation)}),P.isConnected?(P.width!==n.size[0]||P.height!==n.size[1])&&r.resize():u.render(),r.redraw(),r.getContainer()}}function tf(y){let p=document.createElement("div");return n=>{let{map:u,mbMap:r,renderState:s,olLayer:P}=y;if(!u||!r)return p;let z=!1,F=r.getCanvas(),{viewState:N}=n,V=P?.getVisible();s&&s?.visible!==V&&(F.style.display=V?"block":"none",s.visible=V,F.style.position="absolute");let me=P?.getOpacity();F&&s&&s.opacity!==me&&(F.style.opacity=me,s.opacity=me);let{rotation:_e}=N;s&&s.rotation!==_e&&(r.rotateTo(-(_e||0)*180/Math.PI,{animate:!1}),z=!0,s.rotation=_e),s&&s.center&&(s.zoom!==N.zoom||s.center[0]!==N.center[0]||s.center[1]!==N.center[1])&&(r.jumpTo({center:lh(N.center),zoom:N.zoom-1}),z=!0,s.zoom=N.zoom,s.center=N.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 Lb=(y,p,n=!1)=>{let u=["HIDDEN","LEAVING","BOARDING"],r=y.has_fzo&&u.indexOf(y.state)>-1,s=p.has_fzo&&u.indexOf(p.state)>-1;if(r||s){if(r!==s)return r?-1:1;if(y.state!==p.state)return u.indexOf(y.state)-u.indexOf(p.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(p.min_arrival_time||p.time).getTime()-F):(P=new Date(y.time).getTime()-F,z=new Date(p.time).getTime()-F),P-z},id=Lb;var Rb=(y,p=!1,n=30)=>{let u=Object.keys(y).map(me=>y[me]);u.sort((me,_e)=>id(me,_e,p));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=[],N=[],V=null;for(let me=u.length-1;me>=0;me-=1){let _e={...u[me]},Se=new Date(_e.time).getTime();Se>z&&Se<s&&(_e.state==="BOARDING"&&(N.includes(_e.platform)?_e.state="HIDDEN":N.push(_e.platform)),V&&_e.to[0]===V.to[0]&&Math.abs(Se-V.time)<1e3&&_e.line.name===V.line.name&&(_e.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(_e.state)&&(_e.cancelled=!0),V=_e,V.time=Se,F.unshift(_e))}return F},nd=Rb;var zb=(y,p=!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 N=nd(s,p||!1,n);y(N)},u)}},Ay=zb;var rf={};ay(rf,{bgColors:()=>ax,getBgColor:()=>Fb,getDelayColor:()=>Nb,getDelayText:()=>Vb,getRadius:()=>Ob,getTextColor:()=>Bb,getTextSize:()=>Ub,getTypeIndex:()=>qm,textColors:()=>sx,types:()=>ox});var Db=[[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]],ox=[/^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],ax=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],sx=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],qm=y=>typeof y=="string"?ox.findIndex(p=>p.test(y)):y,Ob=(y,p)=>{try{let n=qm(y||0);return Db[n][p]}catch{return 1}},Fb=y=>{try{let p=qm(y);return ax[p]}catch{return"#ffffff"}},Bb=y=>{try{let p=qm(y);return sx[p]}catch{return"#ffffff"}},Ub=(y,p,n,u)=>{if(!y)return 0;y.font=`bold ${u}px Arial`;let r=y.measureText(n),s=25,P=0;for(;r.width>p-6&&P<s;)u-=.5,y.font=`bold ${u}px arial, sans-serif`,r=y.measureText(n),P+=1;return u},Nb=(y,p,n)=>p?n?"#ff0000":"#a0a0a0":y>=36e5?"#ed004c":y>=5e5?"#e80000":y>=3e5?"#ff4a00":y>=18e4?"#f7bf00":y===null?"#a0a0a0":"#00a00c",Vb=(y,p)=>p?String.fromCodePoint(215):y>36e5?`+${Math.round(y/36e5)}h`:y>59e3?`+${Math.round(y/6e4)}m`:y>0?`+${y}s`:"";var Gb=(y,p)=>{let n=null;return typeof window>"u"?null:(document?.createElement?(n=document.createElement("canvas"),n.width=y,n.height=p):OffscreenCanvas?n=new OffscreenCanvas(y,p):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),n)},nf=Gb;var Py={},zy=(y,p,n)=>{let u=`${y}, ${p}, ${n}`;if(!Py[u]){let r=nf(y*2,y*2);if(r){let s=r.getContext("2d");if(!s)return null;s.beginPath(),s.arc(y,y,p,0,2*Math.PI,!1),s.fillStyle=n,s.filter="blur(1px)",s.fill(),Py[u]=r}}return Py[u]},My={},Dy=(y,p,n,u,r,s="#000",P=1)=>{let z=`${y}, ${p}, ${u}, ${r}, ${s}, ${P}`;if(!My[z]){let F=nf(y,n+8*P);if(F){let N=F.getContext("2d");if(!N)return null;N.textAlign="left",N.textBaseline="middle",N.font=u,N.fillStyle=r,N.strokeStyle=s,N.lineWidth=1.5*P;let V=p;N.strokeText(V,0,n),N.fillText(V,0,n),My[z]=F}}return My[z]},ky={},Oy=(y,p,n,u,r,s)=>{let P=`${y}, ${p}, ${n}, ${u}, ${r}, ${s}`;if(!ky[P]){let z=nf(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,p,0,2*Math.PI,!1),F.fill(),r&&F.setLineDash([5,3]),u&&F.stroke(),ky[P]=z}}return ky[P]},Ly={},Fy=(y,p,n,u,r,s,P)=>{let z=`${y}, ${p}, ${n}, ${u},${r}, ${s}, ${P}`;if(!Ly[z]){let F=nf(p*2,p*2);if(F){let N=F.getContext("2d");if(!N)return null;s&&(N.save(),N.textBaseline="middle",N.textAlign="center",N.font=`bold ${n+2}px Arial`,N.strokeStyle=r,N.strokeText(y,p,p),N.restore()),N.textBaseline="middle",N.textAlign="center",N.fillStyle=u,N.font=`bold ${n}px Arial`,N.strokeStyle=r,N.strokeText(y,p,p),N.fillText(y,p,p),Ly[z]=F}}return Ly[z]},Ry={},jb=(y,p,n)=>{let{hoverVehicleId:u,selectedVehicleId:r,useDelayStyle:s,delayOutlineColor:P="#000",delayDisplay:z=3e5,getRadius:F=()=>0,getBgColor:N=()=>"#000",getDelayColor:V=()=>"#000",getDelayText:me=()=>null,getTextColor:_e=()=>"#000",getTextSize:Se=()=>0}=n,{zoom:Ue,pixelRatio:He=1}=p,{type:Ie}=y.properties,{train_id:Ge,line:Je,delay:rt,state:_t,operator_provides_realtime_journey:yt}=y.properties,{name:ct,text_color:Tt,color:St}=Je||{},Lt=_t==="JOURNEY_CANCELLED";Ie||(Ie="Rail"),ct||(ct="I"),Tt||(Tt="#000000"),St&&St[0]!=="#"&&(St=`#${St}`),Tt[0]!=="#"&&(Tt=`#${Tt}`);let nr=Math.min(Math.floor(Ue||1),16),jt=!!(u&&u===Ge),Jt=!!(r&&r===Ge),or=F(Ie,nr)*He,At=or>=7*He;(jt||Jt)&&(or=At?or+5*He:14*He);let Vr=or>10*He,Er=`${or}${jt}${Jt}${Lt}${rt}`;if(s?Er+=`${yt}`:Er+=`${Ie}${St}`,Vr&&(Er+=`${ct}${Tt}`),!Ry[Er]){if(or===0)return null;let zr=1*He,br=or+2,Sr=or*2,xr=br*2+zr*2+100*He,Qr=xr/2,Vt=nf(xr,xr);if(Vt){let Yr=Vt.getContext("2d");if(!Yr)return null;if(At&&rt!==null){let Li=zy(Qr,br,V(rt,Lt));Li&&Yr.drawImage(Li,0,0)}if(At&&(jt||(rt||0)>=z||Lt)){let Li=Math.max(Lt?19:14,Math.min(Lt?19:17,or*1.2))*He,Mn=me(rt,Lt);if(Mn){let Ni=Mn.length*Li,Cr=Dy(Ni,Mn,Li,`bold ${Li}px arial, sans-serif`,V(rt,Lt,!0),P,He);Cr&&Yr.drawImage(Cr,Qr+br+zr,Qr-Li)}}let vi;s?vi=V(rt,Lt):vi=St||N(Ie);let Br=Oy(Qr,or,vi,At||jt||Jt,!!At&&!!s&&rt===null&&yt==="yes",He);if(Br&&Yr.drawImage(Br,0,0),Vr&&Yr){let Li=Math.max(or,10),Mn=Se(Yr,Sr,ct,Li),Ni=s?"#000000":Tt||_e(Ie),Wn=Fy(ct,Qr,Mn,Ni,vi,!!s&&rt===null&&yt==="yes",He);Wn&&Yr.drawImage(Wn,0,0)}Ry[Er]=Vt}}return Ry[Er]},Kh=jb;var qb=(y,p,n)=>Kh(y,p,{...n,useDelayStyle:!0}),By=qb;var of,Zb=()=>{if(!of){of=document.createElement("canvas"),of.width=15,of.height=15;let y=of.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 of},Uy=Zb;var Qi={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 Wb=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Xb=function(y){Wb(p,y);function p(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[Qi.OPACITY]=n.opacity!==void 0?n.opacity:1,En(typeof r[Qi.OPACITY]=="number",64),r[Qi.VISIBLE]=n.visible!==void 0?n.visible:!0,r[Qi.Z_INDEX]=n.zIndex,r[Qi.MAX_RESOLUTION]=n.maxResolution!==void 0?n.maxResolution:1/0,r[Qi.MIN_RESOLUTION]=n.minResolution!==void 0?n.minResolution:0,r[Qi.MIN_ZOOM]=n.minZoom!==void 0?n.minZoom:-1/0,r[Qi.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 p.prototype.getBackground=function(){return this.background_},p.prototype.getClassName=function(){return this.className_},p.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},p.prototype.getLayersArray=function(n){return jr()},p.prototype.getLayerStatesArray=function(n){return jr()},p.prototype.getExtent=function(){return this.get(Qi.EXTENT)},p.prototype.getMaxResolution=function(){return this.get(Qi.MAX_RESOLUTION)},p.prototype.getMinResolution=function(){return this.get(Qi.MIN_RESOLUTION)},p.prototype.getMinZoom=function(){return this.get(Qi.MIN_ZOOM)},p.prototype.getMaxZoom=function(){return this.get(Qi.MAX_ZOOM)},p.prototype.getOpacity=function(){return this.get(Qi.OPACITY)},p.prototype.getSourceState=function(){return jr()},p.prototype.getVisible=function(){return this.get(Qi.VISIBLE)},p.prototype.getZIndex=function(){return this.get(Qi.Z_INDEX)},p.prototype.setBackground=function(n){this.background_=n,this.changed()},p.prototype.setExtent=function(n){this.set(Qi.EXTENT,n)},p.prototype.setMaxResolution=function(n){this.set(Qi.MAX_RESOLUTION,n)},p.prototype.setMinResolution=function(n){this.set(Qi.MIN_RESOLUTION,n)},p.prototype.setMaxZoom=function(n){this.set(Qi.MAX_ZOOM,n)},p.prototype.setMinZoom=function(n){this.set(Qi.MIN_ZOOM,n)},p.prototype.setOpacity=function(n){En(typeof n=="number",64),this.set(Qi.OPACITY,n)},p.prototype.setVisible=function(n){this.set(Qi.VISIBLE,n)},p.prototype.setZIndex=function(n){this.set(Qi.Z_INDEX,n)},p.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),y.prototype.disposeInternal.call(this)},p}(Mo),Zm=Xb;var od={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Su={UNDEFINED:"undefined",LOADING:"loading",READY:"ready",ERROR:"error"};var $b=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Kb=function(y){$b(p,y);function p(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(Qi.SOURCE,u.handleSourcePropertyChange_);var s=n.source?n.source:null;return u.setSource(s),u}return p.prototype.getLayersArray=function(n){var u=n||[];return u.push(this),u},p.prototype.getLayerStatesArray=function(n){var u=n||[];return u.push(this.getLayerState()),u},p.prototype.getSource=function(){return this.get(Qi.SOURCE)||null},p.prototype.getRenderSource=function(){return this.getSource()},p.prototype.getSourceState=function(){var n=this.getSource();return n?n.getState():Su.UNDEFINED},p.prototype.handleSourceChange_=function(){this.changed()},p.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(Po(this.sourceChangeKey_),this.sourceChangeKey_=null);var n=this.getSource();n&&(this.sourceChangeKey_=uo(n,Ji.CHANGE,this.handleSourceChange_,this)),this.changed()},p.prototype.getFeatures=function(n){return this.renderer_?this.renderer_.getFeatures(n):new Promise(function(u){return u([])})},p.prototype.getData=function(n){return!this.renderer_||!this.rendered?null:this.renderer_.getData(n)},p.prototype.render=function(n,u){var r=this.getRenderer();if(r.prepareFrame(n))return this.rendered=!0,r.renderFrame(n,u)},p.prototype.unrender=function(){this.rendered=!1},p.prototype.setMapInternal=function(n){n||this.unrender(),this.set(Qi.MAP,n)},p.prototype.getMapInternal=function(){return this.get(Qi.MAP)},p.prototype.setMap=function(n){this.mapPrecomposeKey_&&(Po(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),n||this.changed(),this.mapRenderKey_&&(Po(this.mapRenderKey_),this.mapRenderKey_=null),n&&(this.mapPrecomposeKey_=uo(n,od.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_=uo(this,Ji.CHANGE,n.render,n),this.changed())},p.prototype.setSource=function(n){this.set(Qi.SOURCE,n)},p.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},p.prototype.hasRenderer=function(){return!!this.renderer_},p.prototype.createRenderer=function(){return null},p.prototype.disposeInternal=function(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),y.prototype.disposeInternal.call(this)},p}(Zm);function lx(y,p){if(!y.visible)return!1;var n=p.resolution;if(n<y.minResolution||n>=y.maxResolution)return!1;var u=p.zoom;return u>y.minZoom&&u<=y.maxZoom}var Hh=Kb;var Ny=class extends Mo{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")}},af=Ny;var Vy=class extends af{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),[]}},Wm=Vy;var Gy=class extends Wm{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&&lx(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())}},ux=Gy;var ws={ADD:"add",REMOVE:"remove"};var hx=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),cx={LENGTH:"length"},Xm=function(y){hx(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.element=u,s.index=r,s}return p}(sn);var Hb=function(y){hx(p,y);function p(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 p.prototype.clear=function(){for(;this.getLength()>0;)this.pop()},p.prototype.extend=function(n){for(var u=0,r=n.length;u<r;++u)this.push(n[u]);return this},p.prototype.forEach=function(n){for(var u=this.array_,r=0,s=u.length;r<s;++r)n(u[r],r,u)},p.prototype.getArray=function(){return this.array_},p.prototype.item=function(n){return this.array_[n]},p.prototype.getLength=function(){return this.get(cx.LENGTH)},p.prototype.insertAt=function(n,u){this.unique_&&this.assertUnique_(u),this.array_.splice(n,0,u),this.updateLength_(),this.dispatchEvent(new Xm(ws.ADD,u,n))},p.prototype.pop=function(){return this.removeAt(this.getLength()-1)},p.prototype.push=function(n){this.unique_&&this.assertUnique_(n);var u=this.getLength();return this.insertAt(u,n),this.getLength()},p.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)},p.prototype.removeAt=function(n){var u=this.array_[n];return this.array_.splice(n,1),this.updateLength_(),this.dispatchEvent(new Xm(ws.REMOVE,u,n)),u},p.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 Xm(ws.REMOVE,s,n)),this.dispatchEvent(new Xm(ws.ADD,u,n))}else{for(var P=r;P<n;++P)this.insertAt(P,void 0);this.insertAt(n,u)}},p.prototype.updateLength_=function(){this.set(cx.LENGTH,this.array_.length)},p.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 Dm(58)},p}(Mo),ch=Hb;var Yb=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Jb=function(y){Yb(p,y);function p(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 p.prototype.clone=function(){var n=new p(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},p.prototype.getGeometry=function(){return this.get(this.geometryName_)},p.prototype.getId=function(){return this.id_},p.prototype.getGeometryName=function(){return this.geometryName_},p.prototype.getStyle=function(){return this.style_},p.prototype.getStyleFunction=function(){return this.styleFunction_},p.prototype.handleGeometryChange_=function(){this.changed()},p.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(Po(this.geometryChangeKey_),this.geometryChangeKey_=null);var n=this.getGeometry();n&&(this.geometryChangeKey_=uo(n,Ji.CHANGE,this.handleGeometryChange_,this)),this.changed()},p.prototype.setGeometry=function(n){this.set(this.geometryName_,n)},p.prototype.setStyle=function(n){this.style_=n,this.styleFunction_=n?Qb(n):void 0,this.changed()},p.prototype.setId=function(n){this.id_=n,this.changed()},p.prototype.setGeometryName=function(n){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=n,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()},p}(Mo);function Qb(y){if(typeof y=="function")return y;var p;if(Array.isArray(y))p=y;else{En(typeof y.getZIndex=="function",41);var n=y;p=[n]}return function(){return p}}var lc=Jb;var Pn={XY:"XY",XYZ:"XYZ",XYM:"XYM",XYZM:"XYZM"};function _l(y,p,n,u,r,s){for(var P=s||[],z=0,F=p;F<n;F+=u){var N=y[F],V=y[F+1];P[z++]=r[0]*N+r[2]*V+r[4],P[z++]=r[1]*N+r[3]*V+r[5]}return s&&P.length!=z&&(P.length=z),P}function $m(y,p,n,u,r,s,P){for(var z=P||[],F=Math.cos(r),N=Math.sin(r),V=s[0],me=s[1],_e=0,Se=p;Se<n;Se+=u){var Ue=y[Se]-V,He=y[Se+1]-me;z[_e++]=V+Ue*F-He*N,z[_e++]=me+Ue*N+He*F;for(var Ie=Se+2;Ie<Se+u;++Ie)z[_e++]=y[Ie]}return P&&z.length!=_e&&(z.length=_e),z}function px(y,p,n,u,r,s,P,z){for(var F=z||[],N=P[0],V=P[1],me=0,_e=p;_e<n;_e+=u){var Se=y[_e]-N,Ue=y[_e+1]-V;F[me++]=N+r*Se,F[me++]=V+s*Ue;for(var He=_e+2;He<_e+u;++He)F[me++]=y[He]}return z&&F.length!=me&&(F.length=me),F}function fx(y,p,n,u,r,s,P){for(var z=P||[],F=0,N=p;N<n;N+=u){z[F++]=y[N]+r,z[F++]=y[N+1]+s;for(var V=N+2;V<N+u;++V)z[F++]=y[V]}return P&&z.length!=F&&(z.length=F),z}var ew=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),dx=za(),tw=function(y){ew(p,y);function p(){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 p.prototype.simplifyTransformed=function(n,u){return this.simplifyTransformedInternal(this.getRevision(),n,u)},p.prototype.clone=function(){return jr()},p.prototype.closestPointXY=function(n,u,r,s){return jr()},p.prototype.containsXY=function(n,u){var r=this.getClosestPoint([n,u]);return r[0]===n&&r[1]===u},p.prototype.getClosestPoint=function(n,u){var r=u||[NaN,NaN];return this.closestPointXY(n[0],n[1],r,1/0),r},p.prototype.intersectsCoordinate=function(n){return this.containsXY(n[0],n[1])},p.prototype.computeExtent=function(n){return jr()},p.prototype.getExtent=function(n){if(this.extentRevision_!=this.getRevision()){var u=this.computeExtent(this.extent_);(isNaN(u[0])||isNaN(u[1]))&&Hp(u),this.extentRevision_=this.getRevision()}return Kv(this.extent_,n)},p.prototype.rotate=function(n,u){jr()},p.prototype.scale=function(n,u,r){jr()},p.prototype.simplify=function(n){return this.getSimplifiedGeometry(n*n)},p.prototype.getSimplifiedGeometry=function(n){return jr()},p.prototype.getType=function(){return jr()},p.prototype.applyTransform=function(n){jr()},p.prototype.intersectsExtent=function(n){return jr()},p.prototype.translate=function(n,u){jr()},p.prototype.transform=function(n,u){var r=ya(n),s=r.getUnits()==ac.TILE_PIXELS?function(P,z,F){var N=r.getExtent(),V=r.getWorldExtent(),me=Eu(V)/Eu(N);return vs(dx,V[0],V[3],me,-me,0,0,0),_l(P,0,P.length,F,dx,z),ed(r,u)(P,z,F)}:ed(r,u);return this.applyTransform(s),this},p}(Mo),Km=tw;var rw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),iw=function(y){rw(p,y);function p(){var n=y.call(this)||this;return n.layout=Pn.XY,n.stride=2,n.flatCoordinates=null,n}return p.prototype.computeExtent=function(n){return Nm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},p.prototype.getCoordinates=function(){return jr()},p.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},p.prototype.getFlatCoordinates=function(){return this.flatCoordinates},p.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},p.prototype.getLayout=function(){return this.layout},p.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)},p.prototype.getSimplifiedGeometryInternal=function(n){return this},p.prototype.getStride=function(){return this.stride},p.prototype.setFlatCoordinates=function(n,u){this.stride=mx(n),this.layout=n,this.flatCoordinates=u},p.prototype.setCoordinates=function(n,u){jr()},p.prototype.setLayout=function(n,u,r){var s;if(n)s=mx(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=nw(s)}this.layout=n,this.stride=s},p.prototype.applyTransform=function(n){this.flatCoordinates&&(n(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())},p.prototype.rotate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();$m(r,0,r.length,s,n,u,r),this.changed()}},p.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();px(z,0,z.length,F,n,s,P,z),this.changed()}},p.prototype.translate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();fx(r,0,r.length,s,n,u,r),this.changed()}},p}(Km);function nw(y){var p;return y==2?p=Pn.XY:y==3?p=Pn.XYZ:y==4&&(p=Pn.XYZM),p}function mx(y){var p;return y==Pn.XY?p=2:y==Pn.XYZ||y==Pn.XYM?p=3:y==Pn.XYZM&&(p=4),p}function gx(y,p,n){var u=y.getFlatCoordinates();if(u){var r=y.getStride();return _l(u,0,u.length,r,p,n)}else return null}var Es=iw;function yx(y,p,n,u,r,s,P){var z=y[p],F=y[p+1],N=y[n]-z,V=y[n+1]-F,me;if(N===0&&V===0)me=p;else{var _e=((r-z)*N+(s-F)*V)/(N*N+V*V);if(_e>1)me=n;else if(_e>0){for(var Se=0;Se<u;++Se)P[Se]=gl(y[p+Se],y[n+Se],_e);P.length=u;return}else me=p}for(var Se=0;Se<u;++Se)P[Se]=y[me+Se];P.length=u}function ad(y,p,n,u,r){var s=y[p],P=y[p+1];for(p+=u;p<n;p+=u){var z=y[p],F=y[p+1],N=ql(s,P,z,F);N>r&&(r=N),s=z,P=F}return r}function sd(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=ad(y,p,z,u,r),p=z}return r}function _x(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=sd(y,p,z,u,r),p=z[z.length-1]}return r}function ld(y,p,n,u,r,s,P,z,F,N,V){if(p==n)return N;var me,_e;if(r===0)if(_e=ql(P,z,y[p],y[p+1]),_e<N){for(me=0;me<u;++me)F[me]=y[p+me];return F.length=u,_e}else return N;for(var Se=V||[NaN,NaN],Ue=p+u;Ue<n;)if(yx(y,Ue-u,Ue,u,P,z,Se),_e=ql(P,z,Se[0],Se[1]),_e<N){for(N=_e,me=0;me<u;++me)F[me]=Se[me];F.length=u,Ue+=u}else Ue+=u*Math.max((Math.sqrt(_e)-Math.sqrt(N))/r|0,1);if(s&&(yx(y,n-u,p,u,P,z,Se),_e=ql(P,z,Se[0],Se[1]),_e<N)){for(N=_e,me=0;me<u;++me)F[me]=Se[me];F.length=u}return N}function ud(y,p,n,u,r,s,P,z,F,N,V){for(var me=V||[NaN,NaN],_e=0,Se=n.length;_e<Se;++_e){var Ue=n[_e];N=ld(y,p,Ue,u,r,s,P,z,F,N,me),p=Ue}return N}function vx(y,p,n,u,r,s,P,z,F,N,V){for(var me=V||[NaN,NaN],_e=0,Se=n.length;_e<Se;++_e){var Ue=n[_e];N=ud(y,p,Ue,u,r,s,P,z,F,N,me),p=Ue[Ue.length-1]}return N}function xx(y,p,n,u){for(var r=0,s=n.length;r<s;++r)y[p++]=n[r];return p}function Yh(y,p,n,u){for(var r=0,s=n.length;r<s;++r)for(var P=n[r],z=0;z<u;++z)y[p++]=P[z];return p}function cd(y,p,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var N=Yh(y,p,n[z],u);s[P++]=N,p=N}return s.length=P,s}function bx(y,p,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var N=cd(y,p,n[z],u,s[P]);s[P++]=N,p=N[N.length-1]}return s.length=P,s}function hd(y,p,n,u,r,s,P){var z=(n-p)/u;if(z<3){for(;p<n;p+=u)s[P++]=y[p],s[P++]=y[p+1];return P}var F=new Array(z);F[0]=1,F[z-1]=1;for(var N=[p,n-u],V=0;N.length>0;){for(var me=N.pop(),_e=N.pop(),Se=0,Ue=y[_e],He=y[_e+1],Ie=y[me],Ge=y[me+1],Je=_e+u;Je<me;Je+=u){var rt=y[Je],_t=y[Je+1],yt=Fv(rt,_t,Ue,He,Ie,Ge);yt>Se&&(V=Je,Se=yt)}Se>r&&(F[(V-p)/u]=1,_e+u<V&&N.push(_e,V),V+u<me&&N.push(V,me))}for(var Je=0;Je<z;++Je)F[Je]&&(s[P++]=y[p+Je*u],s[P++]=y[p+Je*u+1]);return P}function wx(y,p,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F];P=hd(y,p,V,u,r,s,P),z.push(P),p=V}return P}function hh(y,p){return p*Math.round(y/p)}function ow(y,p,n,u,r,s,P){if(p==n)return P;var z=hh(y[p],r),F=hh(y[p+1],r);p+=u,s[P++]=z,s[P++]=F;var N,V;do if(N=hh(y[p],r),V=hh(y[p+1],r),p+=u,p==n)return s[P++]=N,s[P++]=V,P;while(N==z&&V==F);for(;p<n;){var me=hh(y[p],r),_e=hh(y[p+1],r);if(p+=u,!(me==N&&_e==V)){var Se=N-z,Ue=V-F,He=me-z,Ie=_e-F;if(Se*Ie==Ue*He&&(Se<0&&He<Se||Se==He||Se>0&&He>Se)&&(Ue<0&&Ie<Ue||Ue==Ie||Ue>0&&Ie>Ue)){N=me,V=_e;continue}s[P++]=N,s[P++]=V,z=N,F=V,N=me,V=_e}}return s[P++]=N,s[P++]=V,P}function jy(y,p,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F];P=ow(y,p,V,u,r,s,P),z.push(P),p=V}return P}function Ex(y,p,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F],me=[];P=jy(y,p,V,u,r,s,P,me),z.push(me),p=V[V.length-1]}return P}function vl(y,p,n,u,r){for(var s=r!==void 0?r:[],P=0,z=p;z<n;z+=u)s[P++]=y.slice(z,z+u);return s.length=P,s}function ph(y,p,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var N=n[z];s[P++]=vl(y,p,N,u,s[P]),p=N}return s.length=P,s}function pd(y,p,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var N=n[z];s[P++]=ph(y,p,N,u,s[P]),p=N[N.length-1]}return s.length=P,s}function qy(y,p,n,u){for(var r=0,s=y[n-u],P=y[n-u+1];p<n;p+=u){var z=y[p],F=y[p+1];r+=P*z-s*F,s=z,P=F}return r/2}function Zy(y,p,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=qy(y,p,z,u),p=z}return r}function Tx(y,p,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=Zy(y,p,z,u),p=z[z.length-1]}return r}var aw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),sw=function(y){aw(p,y);function p(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 p.prototype.clone=function(){return new p(this.flatCoordinates.slice(),this.layout)},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ad(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ld(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,n,u,r,s))},p.prototype.getArea=function(){return qy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=hd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new p(u,Pn.XY)},p.prototype.getType=function(){return Mt.LINEAR_RING},p.prototype.intersectsExtent=function(n){return!1},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},p}(Es),Wy=sw;var lw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),uw=function(y){lw(p,y);function p(n,u){var r=y.call(this)||this;return r.setCoordinates(n,u),r}return p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},p.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,N=0;N<F;++N)r[N]=P[N];return r.length=F,z}else return s},p.prototype.getCoordinates=function(){return this.flatCoordinates?this.flatCoordinates.slice():[]},p.prototype.computeExtent=function(n){return Yp(this.flatCoordinates,n)},p.prototype.getType=function(){return Mt.POINT},p.prototype.intersectsExtent=function(n){return Qf(n,this.flatCoordinates[0],this.flatCoordinates[1])},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xx(this.flatCoordinates,0,n,this.stride),this.changed()},p}(Es),_a=uw;function Sx(y,p,n,u,r){var s=Xv(r,function(P){return!fh(y,p,n,u,P[0],P[1])});return!s}function fh(y,p,n,u,r,s){for(var P=0,z=y[n-u],F=y[n-u+1];p<n;p+=u){var N=y[p],V=y[p+1];F<=s?V>s&&(N-z)*(s-F)-(r-z)*(V-F)>0&&P++:V<=s&&(N-z)*(s-F)-(r-z)*(V-F)<0&&P--,z=N,F=V}return P!==0}function fd(y,p,n,u,r,s){if(n.length===0||!fh(y,p,n[0],u,r,s))return!1;for(var P=1,z=n.length;P<z;++P)if(fh(y,n[P-1],n[P],u,r,s))return!1;return!0}function Ix(y,p,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(fd(y,p,F,u,r,s))return!0;p=F[F.length-1]}return!1}function Xy(y,p,n,u,r,s,P){for(var z,F,N,V,me,_e,Se,Ue=r[s+1],He=[],Ie=0,Ge=n.length;Ie<Ge;++Ie){var Je=n[Ie];for(V=y[Je-u],_e=y[Je-u+1],z=p;z<Je;z+=u)me=y[z],Se=y[z+1],(Ue<=_e&&Se<=Ue||_e<=Ue&&Ue<=Se)&&(N=(Ue-_e)/(Se-_e)*(me-V)+V,He.push(N)),V=me,_e=Se}var rt=NaN,_t=-1/0;for(He.sort(rh),V=He[0],z=1,F=He.length;z<F;++z){me=He[z];var yt=Math.abs(me-V);yt>_t&&(N=(V+me)/2,fd(y,p,n,u,N,Ue)&&(rt=N,_t=yt)),V=me}return isNaN(rt)&&(rt=r[s]),P?(P.push(rt,Ue,_t),P):[rt,Ue,_t]}function Cx(y,p,n,u,r){for(var s=[],P=0,z=n.length;P<z;++P){var F=n[P];s=Xy(y,p,F,u,r,2*P,s),p=F[F.length-1]}return s}function Hm(y,p,n,u,r){var s;for(p+=u;p<n;p+=u)if(s=r(y.slice(p-u,p),y.slice(p,p+u)),s)return s;return!1}function dd(y,p,n,u,r){var s=_y(Ya(),y,p,n,u);return Lo(r,s)?sc(r,s)||s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Hm(y,p,n,u,function(P,z){return Hv(r,P,z)}):!1}function Ax(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s){if(dd(y,p,n[s],u,r))return!0;p=n[s]}return!1}function cw(y,p,n,u,r){return!!(dd(y,p,n,u,r)||fh(y,p,n,u,r[0],r[1])||fh(y,p,n,u,r[0],r[3])||fh(y,p,n,u,r[2],r[1])||fh(y,p,n,u,r[2],r[3]))}function $y(y,p,n,u,r){if(!cw(y,p,n[0],u,r))return!1;if(n.length===1)return!0;for(var s=1,P=n.length;s<P;++s)if(Sx(y,n[s-1],n[s],u,r)&&!dd(y,n[s-1],n[s],u,r))return!1;return!0}function Px(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if($y(y,p,z,u,r))return!0;p=z[z.length-1]}return!1}function Mx(y,p,n,u){for(;p<n-u;){for(var r=0;r<u;++r){var s=y[p+r];y[p+r]=y[n-u+r],y[n-u+r]=s}p+=u,n-=u}}function kx(y,p,n,u){for(var r=0,s=y[n-u],P=y[n-u+1];p<n;p+=u){var z=y[p],F=y[p+1];r+=(z-s)*(F+P),s=z,P=F}return r===0?void 0:r>0}function Ky(y,p,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],N=kx(y,p,F,u);if(P===0){if(s&&N||!s&&!N)return!1}else if(s&&!N||!s&&N)return!1;p=F}return!0}function Lx(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if(!Ky(y,p,z,u,r))return!1;z.length&&(p=z[z.length-1])}return!0}function Ym(y,p,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],N=kx(y,p,F,u),V=P===0?s&&N||!s&&!N:s&&!N||!s&&N;V&&Mx(y,p,F,u),p=F}return p}function Hy(y,p,n,u,r){for(var s=0,P=n.length;s<P;++s)p=Ym(y,p,n[s],u,r);return p}var hw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Rx=function(y){hw(p,y);function p(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 p.prototype.appendLinearRing=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ud(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,n,u,r,s))},p.prototype.containsXY=function(n,u){return fd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,u)},p.prototype.getArea=function(){return Zy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)},p.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Ym(u,0,this.ends_,this.stride,n)):u=this.flatCoordinates,ph(u,0,this.ends_,this.stride)},p.prototype.getEnds=function(){return this.ends_},p.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var n=$h(this.getExtent());this.flatInteriorPoint_=Xy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_},p.prototype.getInteriorPoint=function(){return new _a(this.getFlatInteriorPoint(),Pn.XYM)},p.prototype.getLinearRingCount=function(){return this.ends_.length},p.prototype.getLinearRing=function(n){return n<0||this.ends_.length<=n?null:new Wy(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},p.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 N=r[z],V=new Wy(u.slice(P,N),n);s.push(V),P=N}return s},p.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Ky(n,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Ym(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=jy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(n),u,0,r),new p(u,Pn.XY,r)},p.prototype.getType=function(){return Mt.POLYGON},p.prototype.intersectsExtent=function(n){return $y(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=cd(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},p}(Es),md=Rx;function Yy(y,p,n){for(var u=p||32,r=y.getStride(),s=y.getLayout(),P=y.getCenter(),z=r*(u+1),F=new Array(z),N=0;N<z;N+=r){F[N]=0,F[N+1]=0;for(var V=2;V<r;V++)F[N+V]=P[V]}var me=[F.length],_e=new Rx(F,s,me);return pw(_e,P,y.getRadius(),n),_e}function pw(y,p,n,u){for(var r=y.getFlatCoordinates(),s=y.getStride(),P=r.length/s-1,z=u||0,F=0;F<=P;++F){var N=F*s,V=z+Fm(F,P)*2*Math.PI/P;r[N]=p[0]+n*Math.cos(V),r[N+1]=p[1]+n*Math.sin(V)}y.changed()}var fw=function(){function y(p){var n=p||{};this.color_=n.color!==void 0?n.color:null}return y.prototype.clone=function(){var p=this.getColor();return new y({color:Array.isArray(p)?p.slice():p||void 0})},y.prototype.getColor=function(){return this.color_},y.prototype.setColor=function(p){this.color_=p},y}(),Ks=fw;function Qm(y,p,n,u,r,s,P){var z,F,N=(n-p)/u;if(N===1)z=p;else if(N===2)z=p,F=r;else if(N!==0){for(var V=y[p],me=y[p+1],_e=0,Se=[0],Ue=p+u;Ue<n;Ue+=u){var He=y[Ue],Ie=y[Ue+1];_e+=Math.sqrt((He-V)*(He-V)+(Ie-me)*(Ie-me)),Se.push(_e),V=He,me=Ie}var Ge=r*_e,Je=_v(Se,Ge);Je<0?(F=(Ge-Se[-Je-2])/(Se[-Je-1]-Se[-Je-2]),z=p+(-Je-2)*u):z=p+Je*u}for(var rt=P>1?P:2,_t=s||new Array(rt),Ue=0;Ue<rt;++Ue)_t[Ue]=z===void 0?NaN:F===void 0?y[z+Ue]:gl(y[z+Ue],y[z+u+Ue],F);return _t}function Jm(y,p,n,u,r,s){if(n==p)return null;var P;if(r<y[p+u-1])return s?(P=y.slice(p,p+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[p+u-1])return y.slice(p,p+u);for(var z=p/u,F=n/u;z<F;){var N=z+F>>1;r<y[(N+1)*u-1]?F=N:z=N+1}var V=y[z*u-1];if(r==V)return y.slice((z-1)*u,(z-1)*u+u);var me=y[(z+1)*u-1],_e=(r-V)/(me-V);P=[];for(var Se=0;Se<u-1;++Se)P.push(gl(y[(z-1)*u+Se],y[z*u+Se],_e));return P.push(r),P}function zx(y,p,n,u,r,s,P){if(P)return Jm(y,p,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,N=n.length;F<N;++F){var V=n[F];if(p!=V){if(r<y[p+u-1])return null;if(r<=y[V-1])return Jm(y,p,V,u,r,!1);p=V}}return null}function eg(y,p,n,u){for(var r=y[p],s=y[p+1],P=0,z=p+u;z<n;z+=u){var F=y[z],N=y[z+1];P+=Math.sqrt((F-r)*(F-r)+(N-s)*(N-s)),r=F,s=N}return P}var dw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),mw=function(y){dw(p,y);function p(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 p.prototype.appendCoordinate=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n):this.flatCoordinates=n.slice(),this.changed()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ad(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ld(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,n,u,r,s))},p.prototype.forEachSegment=function(n){return Hm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},p.prototype.getCoordinateAtM=function(n,u){if(this.layout!=Pn.XYM&&this.layout!=Pn.XYZM)return null;var r=u!==void 0?u:!1;return Jm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,r)},p.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.prototype.getCoordinateAt=function(n,u){return Qm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,this.stride)},p.prototype.getLength=function(){return eg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.prototype.getFlatMidpoint=function(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=hd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new p(u,Pn.XY)},p.prototype.getType=function(){return Mt.LINE_STRING},p.prototype.intersectsExtent=function(n){return dd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},p}(Es),uc=mw;var gw=function(){function y(p){var n=p||{};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 p=this.getColor();return new y({color:Array.isArray(p)?p.slice():p||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(p){this.color_=p},y.prototype.setLineCap=function(p){this.lineCap_=p},y.prototype.setLineDash=function(p){this.lineDash_=p},y.prototype.setLineDashOffset=function(p){this.lineDashOffset_=p},y.prototype.setLineJoin=function(p){this.lineJoin_=p},y.prototype.setMiterLimit=function(p){this.miterLimit_=p},y.prototype.setWidth=function(p){this.width_=p},y}(),va=gw;var qi={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Jy(y,p){return Array.isArray(y)?y:(p===void 0?p=[y,y]:(p[0]=y,p[1]=y),p)}var yw=function(){function y(p){this.opacity_=p.opacity,this.rotateWithView_=p.rotateWithView,this.rotation_=p.rotation,this.scale_=p.scale,this.scaleArray_=Jy(p.scale),this.displacement_=p.displacement}return y.prototype.clone=function(){var p=this.getScale();return new y({opacity:this.getOpacity(),scale:Array.isArray(p)?p.slice():p,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(p){return jr()},y.prototype.getHitDetectionImage=function(){return jr()},y.prototype.getPixelRatio=function(p){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(p){this.displacement_=p},y.prototype.setOpacity=function(p){this.opacity_=p},y.prototype.setRotateWithView=function(p){this.rotateWithView_=p},y.prototype.setRotation=function(p){this.rotation_=p},y.prototype.setScale=function(p){this.scale_=p,this.scaleArray_=Jy(p)},y.prototype.listenImageChange=function(p){jr()},y.prototype.load=function(){jr()},y.prototype.unlistenImageChange=function(p){jr()},y}(),tg=yw;var _w=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,vw=/^([a-z]*)$|^hsla?\(.*\)$/i;function rg(y){return typeof y=="string"?y:Qy(y)}function xw(y){var p=document.createElement("div");if(p.style.color=y,p.style.color!==""){document.body.appendChild(p);var n=getComputedStyle(p).color;return document.body.removeChild(p),n}else return""}var bw=function(){var y=1024,p={},n=0;return function(u){var r;if(p.hasOwnProperty(u))r=p[u];else{if(n>=y){var s=0;for(var P in p)(s++&3)===0&&(delete p[P],--n)}r=ww(u),p[u]=r,++n}return r}}();function Jh(y){return Array.isArray(y)?y:bw(y)}function ww(y){var p,n,u,r,s;if(vw.exec(y)&&(y=xw(y)),_w.exec(y)){var P=y.length-1,z=void 0;P<=4?z=1:z=2;var F=P===4||P===8;p=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&&(p=(p<<4)+p,n=(n<<4)+n,u=(u<<4)+u,F&&(r=(r<<4)+r)),s=[p,n,u,r/255]}else y.indexOf("rgba(")==0?(s=y.slice(5,-1).split(",").map(Number),Dx(s)):y.indexOf("rgb(")==0?(s=y.slice(4,-1).split(",").map(Number),s.push(1),Dx(s)):En(!1,14);return s}function Dx(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 Qy(y){var p=y[0];p!=(p|0)&&(p=p+.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("+p+","+n+","+u+","+r+")"}function Ts(y){return Array.isArray(y)?Qy(y):y}function Ja(y,p,n,u){var r;return n&&n.length?r=n.shift():ah?r=new OffscreenCanvas(y||300,p||300):r=document.createElement("canvas"),y&&(r.width=y),p&&(r.height=p),r.getContext("2d",u)}var Ew=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"),Ox=["style","variant","weight","size","lineHeight","family"],e_=function(y){var p=y.match(Ew);if(!p)return null;for(var n={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},u=0,r=Ox.length;u<r;++u){var s=p[u+1];s!==void 0&&(n[Ox[u]]=s)}return n.families=n.family.split(/,\s?/),n};function Fx(y){return y===1?"":String(Math.round(y*100)/100)}var ng="10px sans-serif",Ss="#000",Qh="round",cc=[],hc=0,Iu="round",pc=10,fc="#000",mh="center",ep="middle",dc=[0,0,0,0],mc=1,dh=new Mo,Tw=new nh;Tw.setSize=function(){console.warn("labelCache is deprecated.")};var sf=null,t_,r_={},Bx=function(){var y=100,p="32px ",n=["monospace","serif"],u=n.length,r="wmytzilWMYTZIL@#/&?$%10\uF013",s,P;function z(N,V,me){for(var _e=!0,Se=0;Se<u;++Se){var Ue=n[Se];if(P=ig(N+" "+V+" "+p+Ue,r),me!=Ue){var He=ig(N+" "+V+" "+p+me+","+Ue,r);_e=_e&&He!=P}}return!!_e}function F(){for(var N=!0,V=dh.getKeys(),me=0,_e=V.length;me<_e;++me){var Se=V[me];dh.get(Se)<y&&(z.apply(this,Se.split(`
1076
1076
  `))?(ih(r_),sf=null,t_=void 0,dh.set(Se,y)):(dh.set(Se,dh.get(Se)+1,!0),N=!1))}N&&(clearInterval(s),s=void 0)}return function(N){var V=e_(N);if(!!V)for(var me=V.families,_e=0,Se=me.length;_e<Se;++_e){var Ue=me[_e],He=V.style+`
1077
1077
  `+V.weight+`
1078
1078
  `+Ue;dh.get(He)===void 0&&(dh.set(He,y,!0),z(V.style,V.weight,Ue)||(dh.set(He,0,!0),s===void 0&&(s=setInterval(F,32))))}}}(),Sw=function(){var y;return function(p){var n=r_[p];if(n==null){if(ah){var u=e_(p),r=Ux(p,"\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=p,document.body.appendChild(y),n=y.offsetHeight,document.body.removeChild(y);r_[p]=n}return n}}();function Ux(y,p){return sf||(sf=Ja(1,1)),y!=t_&&(sf.font=y,t_=sf.font),sf.measureText(p)}function ig(y,p){return Ux(y,p).width}function i_(y,p,n){if(p in n)return n[p];var u=ig(y,p);return n[p]=u,u}function Nx(y,p){for(var n=[],u=[],r=[],s=0,P=0,z=0,F=0,N=0,V=p.length;N<=V;N+=2){var me=p[N];if(me===`
1079
1079
  `||N===V){s=Math.max(s,P),r.push(P),P=0,z+=F;continue}var _e=p[N+1]||y.font,Se=ig(_e,me);n.push(Se),P+=Se;var Ue=Sw(_e);u.push(Ue),F=Math.max(F,Ue)}return{width:s,height:z,widths:n,heights:u,lineWidths:r}}function Vx(y,p,n,u,r,s,P,z,F,N,V){y.save(),n!==1&&(y.globalAlpha*=n),p&&y.setTransform.apply(y,p),u.contextInstructions?(y.translate(F,N),y.scale(V[0],V[1]),Iw(u,y)):V[0]<0||V[1]<0?(y.translate(F,N),y.scale(V[0],V[1]),y.drawImage(u,r,s,P,z,0,0,P,z)):y.drawImage(u,r,s,P,z,F,N,P*V[0],z*V[1]),y.restore()}function Iw(y,p){for(var n=y.contextInstructions,u=0,r=n.length;u<r;u+=2)Array.isArray(n[u+1])?p[n[u]].apply(p,n[u+1]):p[n[u]]=n[u+1]}var Cw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Aw=function(y){Cw(p,y);function p(n){var u=this,r=n.rotateWithView!==void 0?n.rotateWithView:!1;return u=y.call(this,{opacity:1,rotateWithView:r,rotation:n.rotation!==void 0?n.rotation:0,scale:n.scale!==void 0?n.scale:1,displacement:n.displacement!==void 0?n.displacement:[0,0]})||this,u.canvas_=void 0,u.hitDetectionCanvas_=null,u.fill_=n.fill!==void 0?n.fill:null,u.origin_=[0,0],u.points_=n.points,u.radius_=n.radius!==void 0?n.radius:n.radius1,u.radius2_=n.radius2,u.angle_=n.angle!==void 0?n.angle:0,u.stroke_=n.stroke!==void 0?n.stroke:null,u.size_=null,u.renderOptions_=null,u.render(),u}return p.prototype.clone=function(){var n=this.getScale(),u=new p({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(n)?n.slice():n,displacement:this.getDisplacement().slice()});return u.setOpacity(this.getOpacity()),u},p.prototype.getAnchor=function(){var n=this.size_;if(!n)return null;var u=this.getDisplacement();return[n[0]/2-u[0],n[1]/2+u[1]]},p.prototype.getAngle=function(){return this.angle_},p.prototype.getFill=function(){return this.fill_},p.prototype.getHitDetectionImage=function(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_},p.prototype.getImage=function(n){var u=this.canvas_[n];if(!u){var r=this.renderOptions_,s=Ja(r.size*n,r.size*n);this.draw_(r,s,n),u=s.canvas,this.canvas_[n]=u}return u},p.prototype.getPixelRatio=function(n){return n},p.prototype.getImageSize=function(){return this.size_},p.prototype.getImageState=function(){return qi.LOADED},p.prototype.getOrigin=function(){return this.origin_},p.prototype.getPoints=function(){return this.points_},p.prototype.getRadius=function(){return this.radius_},p.prototype.getRadius2=function(){return this.radius2_},p.prototype.getSize=function(){return this.size_},p.prototype.getStroke=function(){return this.stroke_},p.prototype.listenImageChange=function(n){},p.prototype.load=function(){},p.prototype.unlistenImageChange=function(n){},p.prototype.calculateLineJoinSize_=function(n,u,r){if(u===0||this.points_===1/0||n!=="bevel"&&n!=="miter")return u;var s=this.radius_,P=this.radius2_===void 0?s:this.radius2_;if(s<P){var z=s;s=P,P=z}var F=this.radius2_===void 0?this.points_:this.points_*2,N=2*Math.PI/F,V=P*Math.sin(N),me=Math.sqrt(P*P-V*V),_e=s-me,Se=Math.sqrt(V*V+_e*_e),Ue=Se/V;if(n==="miter"&&Ue<=r)return Ue*u;var He=u/2/Ue,Ie=u/2*(_e/Se),Ge=Math.sqrt((s+He)*(s+He)+Ie*Ie),Je=Ge-s;if(this.radius2_===void 0||n==="bevel")return Je*2;var rt=s*Math.sin(N),_t=Math.sqrt(s*s-rt*rt),yt=P-_t,ct=Math.sqrt(rt*rt+yt*yt),Tt=ct/rt;if(Tt<=r){var St=Tt*u/2-P-s;return 2*Math.max(Je,St)}return Je*2},p.prototype.createRenderOptions=function(){var n=Iu,u=0,r=null,s=0,P,z=0;this.stroke_&&(P=this.stroke_.getColor(),P===null&&(P=fc),P=Ts(P),z=this.stroke_.getWidth(),z===void 0&&(z=mc),r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),n=this.stroke_.getLineJoin(),n===void 0&&(n=Iu),u=this.stroke_.getMiterLimit(),u===void 0&&(u=pc));var F=this.calculateLineJoinSize_(n,z,u),N=Math.max(this.radius_,this.radius2_||0),V=Math.ceil(2*N+F);return{strokeStyle:P,strokeWidth:z,size:V,lineDash:r,lineDashOffset:s,lineJoin:n,miterLimit:u}},p.prototype.render=function(){this.renderOptions_=this.createRenderOptions();var n=this.renderOptions_.size;this.canvas_={},this.size_=[n,n]},p.prototype.draw_=function(n,u,r){if(u.scale(r,r),u.translate(n.size/2,n.size/2),this.createPath_(u),this.fill_){var s=this.fill_.getColor();s===null&&(s=Ss),u.fillStyle=Ts(s),u.fill()}this.stroke_&&(u.strokeStyle=n.strokeStyle,u.lineWidth=n.strokeWidth,u.setLineDash&&n.lineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.miterLimit=n.miterLimit,u.stroke())},p.prototype.createHitDetectionCanvas_=function(n){if(this.fill_){var u=this.fill_.getColor(),r=0;if(typeof u=="string"&&(u=Jh(u)),u===null?r=1:Array.isArray(u)&&(r=u.length===4?u[3]:1),r===0){var s=Ja(n.size,n.size);this.hitDetectionCanvas_=s.canvas,this.drawHitDetectionCanvas_(n,s)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))},p.prototype.createPath_=function(n){var u=this.points_,r=this.radius_;if(u===1/0)n.arc(0,0,r,0,2*Math.PI);else{var s=this.radius2_===void 0?r:this.radius2_;this.radius2_!==void 0&&(u*=2);for(var P=this.angle_-Math.PI/2,z=2*Math.PI/u,F=0;F<u;F++){var N=P+F*z,V=F%2===0?r:s;n.lineTo(V*Math.cos(N),V*Math.sin(N))}n.closePath()}},p.prototype.drawHitDetectionCanvas_=function(n,u){u.translate(n.size/2,n.size/2),this.createPath_(u),u.fillStyle=Ss,u.fill(),this.stroke_&&(u.strokeStyle=n.strokeStyle,u.lineWidth=n.strokeWidth,n.lineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.miterLimit=n.miterLimit,u.stroke())},p}(tg),Gx=Aw;var Pw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Mw=function(y){Pw(p,y);function p(n){var u=n||{};return y.call(this,{points:1/0,fill:u.fill,radius:u.radius,stroke:u.stroke,scale:u.scale!==void 0?u.scale:1,rotation:u.rotation!==void 0?u.rotation:0,rotateWithView:u.rotateWithView!==void 0?u.rotateWithView:!1,displacement:u.displacement!==void 0?u.displacement:[0,0]})||this}return p.prototype.clone=function(){var n=this.getScale(),u=new p({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(n)?n.slice():n,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return u.setOpacity(this.getOpacity()),u},p.prototype.setRadius=function(n){this.radius_=n,this.render()},p}(Gx),xl=Mw;var lf=function(){function y(p){var n=p||{};this.geometry_=null,this.geometryFunction_=jx,n.geometry!==void 0&&this.setGeometry(n.geometry),this.fill_=n.fill!==void 0?n.fill:null,this.image_=n.image!==void 0?n.image:null,this.renderer_=n.renderer!==void 0?n.renderer:null,this.hitDetectionRenderer_=n.hitDetectionRenderer!==void 0?n.hitDetectionRenderer:null,this.stroke_=n.stroke!==void 0?n.stroke:null,this.text_=n.text!==void 0?n.text:null,this.zIndex_=n.zIndex}return y.prototype.clone=function(){var p=this.getGeometry();return p&&typeof p=="object"&&(p=p.clone()),new y({geometry:p,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},y.prototype.getRenderer=function(){return this.renderer_},y.prototype.setRenderer=function(p){this.renderer_=p},y.prototype.setHitDetectionRenderer=function(p){this.hitDetectionRenderer_=p},y.prototype.getHitDetectionRenderer=function(){return this.hitDetectionRenderer_},y.prototype.getGeometry=function(){return this.geometry_},y.prototype.getGeometryFunction=function(){return this.geometryFunction_},y.prototype.getFill=function(){return this.fill_},y.prototype.setFill=function(p){this.fill_=p},y.prototype.getImage=function(){return this.image_},y.prototype.setImage=function(p){this.image_=p},y.prototype.getStroke=function(){return this.stroke_},y.prototype.setStroke=function(p){this.stroke_=p},y.prototype.getText=function(){return this.text_},y.prototype.setText=function(p){this.text_=p},y.prototype.getZIndex=function(){return this.zIndex_},y.prototype.setGeometry=function(p){typeof p=="function"?this.geometryFunction_=p:typeof p=="string"?this.geometryFunction_=function(n){return n.get(p)}:p?p!==void 0&&(this.geometryFunction_=function(){return p}):this.geometryFunction_=jx,this.geometry_=p},y.prototype.setZIndex=function(p){this.zIndex_=p},y}();function qx(y){var p;if(typeof y=="function")p=y;else{var n;if(Array.isArray(y))n=y;else{En(typeof y.getZIndex=="function",41);var u=y;n=[u]}p=function(){return n}}return p}var n_=null;function Zx(y,p){if(!n_){var n=new Ks({color:"rgba(255,255,255,0.4)"}),u=new va({color:"#3399CC",width:1.25});n_=[new lf({image:new xl({fill:n,stroke:u,radius:5}),fill:n,stroke:u})]}return n_}function Wx(){var y={},p=[255,255,255,1],n=[0,153,255,1],u=3;return y[Mt.POLYGON]=[new lf({fill:new Ks({color:[255,255,255,.5]})})],y[Mt.MULTI_POLYGON]=y[Mt.POLYGON],y[Mt.LINE_STRING]=[new lf({stroke:new va({color:p,width:u+2})}),new lf({stroke:new va({color:n,width:u})})],y[Mt.MULTI_LINE_STRING]=y[Mt.LINE_STRING],y[Mt.CIRCLE]=y[Mt.POLYGON].concat(y[Mt.LINE_STRING]),y[Mt.POINT]=[new lf({image:new xl({radius:u*2,fill:new Ks({color:n}),stroke:new va({color:p,width:u/2})}),zIndex:1/0})],y[Mt.MULTI_POINT]=y[Mt.POINT],y[Mt.GEOMETRY_COLLECTION]=y[Mt.POLYGON].concat(y[Mt.LINE_STRING],y[Mt.POINT]),y}function jx(y){return y.getGeometry()}var Xl=lf;var Xx={POINT:"point",LINE:"line"};var Kx=Gp(s_(),1);var kw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),$x={RENDER_ORDER:"renderOrder"},Lw=function(y){kw(p,y);function p(n){var u=this,r=n||{},s=Ra({},r);return delete s.style,delete s.renderBuffer,delete s.updateWhileAnimating,delete s.updateWhileInteracting,u=y.call(this,s)||this,u.declutter_=r.declutter!==void 0?r.declutter:!1,u.renderBuffer_=r.renderBuffer!==void 0?r.renderBuffer:100,u.style_=null,u.styleFunction_=void 0,u.setStyle(r.style),u.updateWhileAnimating_=r.updateWhileAnimating!==void 0?r.updateWhileAnimating:!1,u.updateWhileInteracting_=r.updateWhileInteracting!==void 0?r.updateWhileInteracting:!1,u}return p.prototype.getDeclutter=function(){return this.declutter_},p.prototype.getFeatures=function(n){return y.prototype.getFeatures.call(this,n)},p.prototype.getRenderBuffer=function(){return this.renderBuffer_},p.prototype.getRenderOrder=function(){return this.get($x.RENDER_ORDER)},p.prototype.getStyle=function(){return this.style_},p.prototype.getStyleFunction=function(){return this.styleFunction_},p.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},p.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},p.prototype.renderDeclutter=function(n){n.declutterTree||(n.declutterTree=new Kx.default(9)),this.getRenderer().renderDeclutter(n)},p.prototype.setRenderOrder=function(n){this.set($x.RENDER_ORDER,n)},p.prototype.setStyle=function(n){this.style_=n!==void 0?n:Zx,this.styleFunction_=n===null?void 0:qx(this.style_),this.changed()},p}(Hh),Hx=Lw;var gd={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},yd=[gd.FILL],Cu=[gd.STROKE],gc=[gd.BEGIN_PATH],l_=[gd.CLOSE_PATH],qr=gd;var Rw=function(){function y(){}return y.prototype.drawCustom=function(p,n,u,r){},y.prototype.drawGeometry=function(p){},y.prototype.setStyle=function(p){},y.prototype.drawCircle=function(p,n){},y.prototype.drawFeature=function(p,n){},y.prototype.drawGeometryCollection=function(p,n){},y.prototype.drawLineString=function(p,n){},y.prototype.drawMultiLineString=function(p,n){},y.prototype.drawMultiPoint=function(p,n){},y.prototype.drawMultiPolygon=function(p,n){},y.prototype.drawPoint=function(p,n){},y.prototype.drawPolygon=function(p,n){},y.prototype.drawText=function(p,n){},y.prototype.setFillStrokeStyle=function(p,n){},y.prototype.setImageStyle=function(p,n){},y.prototype.setTextStyle=function(p,n){},y}(),og=Rw;var zw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Dw=function(y){zw(p,y);function p(n,u,r,s){var P=y.call(this)||this;return P.tolerance=n,P.maxExtent=u,P.pixelRatio=s,P.maxLineWidth=0,P.resolution=r,P.beginGeometryInstruction1_=null,P.beginGeometryInstruction2_=null,P.bufferedMaxExtent_=null,P.instructions=[],P.coordinates=[],P.tmpCoordinate_=[],P.hitDetectionInstructions=[],P.state={},P}return p.prototype.applyPixelRatio=function(n){var u=this.pixelRatio;return u==1?n:n.map(function(r){return r*u})},p.prototype.appendFlatPointCoordinates=function(n,u){for(var r=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,P=this.coordinates,z=P.length,F=0,N=n.length;F<N;F+=u)s[0]=n[F],s[1]=n[F+1],Kp(r,s)&&(P[z++]=s[0],P[z++]=s[1]);return z},p.prototype.appendFlatLineCoordinates=function(n,u,r,s,P,z){var F=this.coordinates,N=F.length,V=this.getBufferedMaxExtent();z&&(u+=s);var me=n[u],_e=n[u+1],Se=this.tmpCoordinate_,Ue=!0,He,Ie,Ge;for(He=u+s;He<r;He+=s)Se[0]=n[He],Se[1]=n[He+1],Ge=Um(V,Se),Ge!==Ie?(Ue&&(F[N++]=me,F[N++]=_e,Ue=!1),F[N++]=Se[0],F[N++]=Se[1]):Ge===ko.INTERSECTING?(F[N++]=Se[0],F[N++]=Se[1],Ue=!1):Ue=!0,me=Se[0],_e=Se[1],Ie=Ge;return(P&&Ue||He===u+s)&&(F[N++]=me,F[N++]=_e),N},p.prototype.drawCustomCoordinates_=function(n,u,r,s,P){for(var z=0,F=r.length;z<F;++z){var N=r[z],V=this.appendFlatLineCoordinates(n,u,N,s,!1,!1);P.push(V),u=N}return u},p.prototype.drawCustom=function(n,u,r,s){this.beginGeometry(n,u);var P=n.getType(),z=n.getStride(),F=this.coordinates.length,N,V,me,_e,Se;switch(P){case Mt.MULTI_POLYGON:N=n.getOrientedFlatCoordinates(),_e=[];var Ue=n.getEndss();Se=0;for(var He=0,Ie=Ue.length;He<Ie;++He){var Ge=[];Se=this.drawCustomCoordinates_(N,Se,Ue[He],z,Ge),_e.push(Ge)}this.instructions.push([qr.CUSTOM,F,_e,n,r,pd]),this.hitDetectionInstructions.push([qr.CUSTOM,F,_e,n,s||r,pd]);break;case Mt.POLYGON:case Mt.MULTI_LINE_STRING:me=[],N=P==Mt.POLYGON?n.getOrientedFlatCoordinates():n.getFlatCoordinates(),Se=this.drawCustomCoordinates_(N,0,n.getEnds(),z,me),this.instructions.push([qr.CUSTOM,F,me,n,r,ph]),this.hitDetectionInstructions.push([qr.CUSTOM,F,me,n,s||r,ph]);break;case Mt.LINE_STRING:case Mt.CIRCLE:N=n.getFlatCoordinates(),V=this.appendFlatLineCoordinates(N,0,N.length,z,!1,!1),this.instructions.push([qr.CUSTOM,F,V,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r,vl]);break;case Mt.MULTI_POINT:N=n.getFlatCoordinates(),V=this.appendFlatPointCoordinates(N,z),V>F&&(this.instructions.push([qr.CUSTOM,F,V,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r,vl]));break;case Mt.POINT:N=n.getFlatCoordinates(),this.coordinates.push(N[0],N[1]),V=this.coordinates.length,this.instructions.push([qr.CUSTOM,F,V,n,r]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r]);break;default:}this.endGeometry(u)},p.prototype.beginGeometry=function(n,u){this.beginGeometryInstruction1_=[qr.BEGIN_GEOMETRY,u,0,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[qr.BEGIN_GEOMETRY,u,0,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},p.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},p.prototype.reverseHitDetectionInstructions=function(){var n=this.hitDetectionInstructions;n.reverse();var u,r=n.length,s,P,z=-1;for(u=0;u<r;++u)s=n[u],P=s[0],P==qr.END_GEOMETRY?z=u:P==qr.BEGIN_GEOMETRY&&(s[2]=u,xv(this.hitDetectionInstructions,z,u),z=-1)},p.prototype.setFillStrokeStyle=function(n,u){var r=this.state;if(n){var s=n.getColor();r.fillStyle=Ts(s||Ss)}else r.fillStyle=void 0;if(u){var P=u.getColor();r.strokeStyle=Ts(P||fc);var z=u.getLineCap();r.lineCap=z!==void 0?z:Qh;var F=u.getLineDash();r.lineDash=F?F.slice():cc;var N=u.getLineDashOffset();r.lineDashOffset=N||hc;var V=u.getLineJoin();r.lineJoin=V!==void 0?V:Iu;var me=u.getWidth();r.lineWidth=me!==void 0?me:mc;var _e=u.getMiterLimit();r.miterLimit=_e!==void 0?_e:pc,r.lineWidth>this.maxLineWidth&&(this.maxLineWidth=r.lineWidth,this.bufferedMaxExtent_=null)}else r.strokeStyle=void 0,r.lineCap=void 0,r.lineDash=null,r.lineDashOffset=void 0,r.lineJoin=void 0,r.lineWidth=void 0,r.miterLimit=void 0},p.prototype.createFill=function(n){var u=n.fillStyle,r=[qr.SET_FILL_STYLE,u];return typeof u!="string"&&r.push(!0),r},p.prototype.applyStroke=function(n){this.instructions.push(this.createStroke(n))},p.prototype.createStroke=function(n){return[qr.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth*this.pixelRatio,n.lineCap,n.lineJoin,n.miterLimit,this.applyPixelRatio(n.lineDash),n.lineDashOffset*this.pixelRatio]},p.prototype.updateFillStyle=function(n,u){var r=n.fillStyle;(typeof r!="string"||n.currentFillStyle!=r)&&(r!==void 0&&this.instructions.push(u.call(this,n)),n.currentFillStyle=r)},p.prototype.updateStrokeStyle=function(n,u){var r=n.strokeStyle,s=n.lineCap,P=n.lineDash,z=n.lineDashOffset,F=n.lineJoin,N=n.lineWidth,V=n.miterLimit;(n.currentStrokeStyle!=r||n.currentLineCap!=s||P!=n.currentLineDash&&!_s(n.currentLineDash,P)||n.currentLineDashOffset!=z||n.currentLineJoin!=F||n.currentLineWidth!=N||n.currentMiterLimit!=V)&&(r!==void 0&&u.call(this,n),n.currentStrokeStyle=r,n.currentLineCap=s,n.currentLineDash=P,n.currentLineDashOffset=z,n.currentLineJoin=F,n.currentLineWidth=N,n.currentMiterLimit=V)},p.prototype.endGeometry=function(n){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var u=[qr.END_GEOMETRY,n];this.instructions.push(u),this.hitDetectionInstructions.push(u)},p.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Zv(this.maxExtent),this.maxLineWidth>0)){var n=this.resolution*(this.maxLineWidth+1)/2;yl(this.bufferedMaxExtent_,n,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},p}(og),Au=Dw;var Ow=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Fw=function(y){Ow(p,y);function p(n,u,r,s){var P=y.call(this,n,u,r,s)||this;return P.hitDetectionImage_=null,P.image_=null,P.imagePixelRatio_=void 0,P.anchorX_=void 0,P.anchorY_=void 0,P.height_=void 0,P.opacity_=void 0,P.originX_=void 0,P.originY_=void 0,P.rotateWithView_=void 0,P.rotation_=void 0,P.scale_=void 0,P.width_=void 0,P.declutterImageWithText_=void 0,P}return p.prototype.drawPoint=function(n,u){if(!!this.image_){this.beginGeometry(n,u);var r=n.getFlatCoordinates(),s=n.getStride(),P=this.coordinates.length,z=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,z,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([qr.DRAW_IMAGE,P,z,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(u)}},p.prototype.drawMultiPoint=function(n,u){if(!!this.image_){this.beginGeometry(n,u);var r=n.getFlatCoordinates(),s=n.getStride(),P=this.coordinates.length,z=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,z,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([qr.DRAW_IMAGE,P,z,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(u)}},p.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,y.prototype.finish.call(this)},p.prototype.setImageStyle=function(n,u){var r=n.getAnchor(),s=n.getSize(),P=n.getHitDetectionImage(),z=n.getImage(this.pixelRatio),F=n.getOrigin();this.imagePixelRatio_=n.getPixelRatio(this.pixelRatio),this.anchorX_=r[0],this.anchorY_=r[1],this.hitDetectionImage_=P,this.image_=z,this.height_=s[1],this.opacity_=n.getOpacity(),this.originX_=F[0]*this.imagePixelRatio_,this.originY_=F[1]*this.imagePixelRatio_,this.rotateWithView_=n.getRotateWithView(),this.rotation_=n.getRotation(),this.scale_=n.getScaleArray(),this.width_=s[0],this.declutterImageWithText_=u},p}(Au),Yx=Fw;var Bw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Uw=function(y){Bw(p,y);function p(n,u,r,s){return y.call(this,n,u,r,s)||this}return p.prototype.drawFlatCoordinates_=function(n,u,r,s){var P=this.coordinates.length,z=this.appendFlatLineCoordinates(n,u,r,s,!1,!1),F=[qr.MOVE_TO_LINE_TO,P,z];return this.instructions.push(F),this.hitDetectionInstructions.push(F),r},p.prototype.drawLineString=function(n,u){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(n,u),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,cc,hc],gc);var z=n.getFlatCoordinates(),F=n.getStride();this.drawFlatCoordinates_(z,0,z.length,F),this.hitDetectionInstructions.push(Cu),this.endGeometry(u)}},p.prototype.drawMultiLineString=function(n,u){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(n,u),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],gc);for(var z=n.getEnds(),F=n.getFlatCoordinates(),N=n.getStride(),V=0,me=0,_e=z.length;me<_e;++me)V=this.drawFlatCoordinates_(F,V,z[me],N);this.hitDetectionInstructions.push(Cu),this.endGeometry(u)}},p.prototype.finish=function(){var n=this.state;return n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&this.instructions.push(Cu),this.reverseHitDetectionInstructions(),this.state=null,y.prototype.finish.call(this)},p.prototype.applyStroke=function(n){n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&(this.instructions.push(Cu),n.lastStroke=this.coordinates.length),n.lastStroke=0,y.prototype.applyStroke.call(this,n),this.instructions.push(gc)},p}(Au),Jx=Uw;var Nw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Vw=function(y){Nw(p,y);function p(n,u,r,s){return y.call(this,n,u,r,s)||this}return p.prototype.drawFlatCoordinatess_=function(n,u,r,s){var P=this.state,z=P.fillStyle!==void 0,F=P.strokeStyle!==void 0,N=r.length;this.instructions.push(gc),this.hitDetectionInstructions.push(gc);for(var V=0;V<N;++V){var me=r[V],_e=this.coordinates.length,Se=this.appendFlatLineCoordinates(n,u,me,s,!0,!F),Ue=[qr.MOVE_TO_LINE_TO,_e,Se];this.instructions.push(Ue),this.hitDetectionInstructions.push(Ue),F&&(this.instructions.push(l_),this.hitDetectionInstructions.push(l_)),u=me}return z&&(this.instructions.push(yd),this.hitDetectionInstructions.push(yd)),F&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),u},p.prototype.drawCircle=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var z=n.getFlatCoordinates(),F=n.getStride(),N=this.coordinates.length;this.appendFlatLineCoordinates(z,0,z.length,F,!1,!1);var V=[qr.CIRCLE,N];this.instructions.push(gc,V),this.hitDetectionInstructions.push(gc,V),r.fillStyle!==void 0&&(this.instructions.push(yd),this.hitDetectionInstructions.push(yd)),r.strokeStyle!==void 0&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),this.endGeometry(u)}},p.prototype.drawPolygon=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var z=n.getEnds(),F=n.getOrientedFlatCoordinates(),N=n.getStride();this.drawFlatCoordinatess_(F,0,z,N),this.endGeometry(u)}},p.prototype.drawMultiPolygon=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);for(var z=n.getEndss(),F=n.getOrientedFlatCoordinates(),N=n.getStride(),V=0,me=0,_e=z.length;me<_e;++me)V=this.drawFlatCoordinatess_(F,V,z[me],N);this.endGeometry(u)}},p.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.state=null;var n=this.tolerance;if(n!==0)for(var u=this.coordinates,r=0,s=u.length;r<s;++r)u[r]=hh(u[r],n);return y.prototype.finish.call(this)},p.prototype.setFillStrokeStyles_=function(){var n=this.state,u=n.fillStyle;u!==void 0&&this.updateFillStyle(n,this.createFill),n.strokeStyle!==void 0&&this.updateStrokeStyle(n,this.applyStroke)},p}(Au),u_=Vw;function Qx(y,p,n,u,r){var s=n,P=n,z=0,F=0,N=n,V,me,_e,Se,Ue,He,Ie,Ge,Je,rt;for(me=n;me<u;me+=r){var _t=p[me],yt=p[me+1];Ue!==void 0&&(Je=_t-Ue,rt=yt-He,Se=Math.sqrt(Je*Je+rt*rt),Ie!==void 0&&(F+=_e,V=Math.acos((Ie*Je+Ge*rt)/(_e*Se)),V>y&&(F>z&&(z=F,s=N,P=me),F=0,N=me-r)),_e=Se,Ie=Je,Ge=rt),Ue=_t,He=yt}return F+=Se,F>z?[N,me]:[s,P]}var Gw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),_d={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},jw=function(y){Gw(p,y);function p(n,u,r,s){var P=y.call(this,n,u,r,s)||this;return P.labels_=null,P.text_="",P.textOffsetX_=0,P.textOffsetY_=0,P.textRotateWithView_=void 0,P.textRotation_=0,P.textFillState_=null,P.fillStates={},P.textStrokeState_=null,P.strokeStates={},P.textState_={},P.textStates={},P.textKey_="",P.fillKey_="",P.strokeKey_="",P.declutterImageWithText_=void 0,P}return p.prototype.finish=function(){var n=y.prototype.finish.call(this);return n.textStates=this.textStates,n.fillStates=this.fillStates,n.strokeStates=this.strokeStates,n},p.prototype.drawText=function(n,u){var r=this.textFillState_,s=this.textStrokeState_,P=this.textState_;if(!(this.text_===""||!P||!r&&!s)){var z=this.coordinates,F=z.length,N=n.getType(),V=null,me=n.getStride();if(P.placement===Xx.LINE&&(N==Mt.LINE_STRING||N==Mt.MULTI_LINE_STRING||N==Mt.POLYGON||N==Mt.MULTI_POLYGON)){if(!Lo(this.getBufferedMaxExtent(),n.getExtent()))return;var _e=void 0;if(V=n.getFlatCoordinates(),N==Mt.LINE_STRING)_e=[V.length];else if(N==Mt.MULTI_LINE_STRING)_e=n.getEnds();else if(N==Mt.POLYGON)_e=n.getEnds().slice(0,1);else if(N==Mt.MULTI_POLYGON){var Se=n.getEndss();_e=[];for(var Ue=0,He=Se.length;Ue<He;++Ue)_e.push(Se[Ue][0])}this.beginGeometry(n,u);for(var Ie=P.textAlign,Ge=0,Je=void 0,rt=0,_t=_e.length;rt<_t;++rt){if(Ie==null){var yt=Qx(P.maxAngle,V,Ge,_e[rt],me);Ge=yt[0],Je=yt[1]}else Je=_e[rt];for(var Ue=Ge;Ue<Je;Ue+=me)z.push(V[Ue],V[Ue+1]);var ct=z.length;Ge=_e[rt],this.drawChars_(F,ct),F=ct}this.endGeometry(u)}else{var Tt=P.overflow?null:[];switch(N){case Mt.POINT:case Mt.MULTI_POINT:V=n.getFlatCoordinates();break;case Mt.LINE_STRING:V=n.getFlatMidpoint();break;case Mt.CIRCLE:V=n.getCenter();break;case Mt.MULTI_LINE_STRING:V=n.getFlatMidpoints(),me=2;break;case Mt.POLYGON:V=n.getFlatInteriorPoint(),P.overflow||Tt.push(V[2]/this.resolution),me=3;break;case Mt.MULTI_POLYGON:var St=n.getFlatInteriorPoints();V=[];for(var Ue=0,He=St.length;Ue<He;Ue+=3)P.overflow||Tt.push(St[Ue+2]/this.resolution),V.push(St[Ue],St[Ue+1]);if(V.length===0)return;me=2;break;default:}var ct=this.appendFlatPointCoordinates(V,me);if(ct===F)return;if(Tt&&(ct-F)/2!==V.length/me){var Lt=F/2;Tt=Tt.filter(function(br,Sr){var xr=z[(Lt+Sr)*2]===V[Sr*me]&&z[(Lt+Sr)*2+1]===V[Sr*me+1];return xr||--Lt,xr})}this.saveTextStates_(),(P.backgroundFill||P.backgroundStroke)&&(this.setFillStrokeStyle(P.backgroundFill,P.backgroundStroke),P.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),P.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(n,u);var nr=P.padding;if(nr!=dc&&(P.scale[0]<0||P.scale[1]<0)){var jt=P.padding[0],Jt=P.padding[1],or=P.padding[2],At=P.padding[3];P.scale[0]<0&&(Jt=-Jt,At=-At),P.scale[1]<0&&(jt=-jt,or=-or),nr=[jt,Jt,or,At]}var Vr=this.pixelRatio;this.instructions.push([qr.DRAW_IMAGE,F,ct,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterImageWithText_,nr==dc?dc:nr.map(function(br){return br*Vr}),!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]);var Er=1/Vr;this.hitDetectionInstructions.push([qr.DRAW_IMAGE,F,ct,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[Er,Er],NaN,this.declutterImageWithText_,nr,!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]),this.endGeometry(u)}}},p.prototype.saveTextStates_=function(){var n=this.textStrokeState_,u=this.textState_,r=this.textFillState_,s=this.strokeKey_;n&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:n.strokeStyle,lineCap:n.lineCap,lineDashOffset:n.lineDashOffset,lineWidth:n.lineWidth,lineJoin:n.lineJoin,miterLimit:n.miterLimit,lineDash:n.lineDash}));var P=this.textKey_;P in this.textStates||(this.textStates[P]={font:u.font,textAlign:u.textAlign||mh,textBaseline:u.textBaseline||ep,scale:u.scale});var z=this.fillKey_;r&&(z in this.fillStates||(this.fillStates[z]={fillStyle:r.fillStyle}))},p.prototype.drawChars_=function(n,u){var r=this.textStrokeState_,s=this.textState_,P=this.strokeKey_,z=this.textKey_,F=this.fillKey_;this.saveTextStates_();var N=this.pixelRatio,V=_d[s.textBaseline],me=this.textOffsetY_*N,_e=this.text_,Se=r?r.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([qr.DRAW_CHARS,n,u,V,s.overflow,F,s.maxAngle,N,me,P,Se*N,_e,z,1]),this.hitDetectionInstructions.push([qr.DRAW_CHARS,n,u,V,s.overflow,F,s.maxAngle,1,me,P,Se,_e,z,1/N])},p.prototype.setTextStyle=function(n,u){var r,s,P;if(!n)this.text_="";else{var z=n.getFill();z?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=Ts(z.getColor()||Ss)):(s=null,this.textFillState_=s);var F=n.getStroke();if(!F)P=null,this.textStrokeState_=P;else{P=this.textStrokeState_,P||(P={},this.textStrokeState_=P);var N=F.getLineDash(),V=F.getLineDashOffset(),me=F.getWidth(),_e=F.getMiterLimit();P.lineCap=F.getLineCap()||Qh,P.lineDash=N?N.slice():cc,P.lineDashOffset=V===void 0?hc:V,P.lineJoin=F.getLineJoin()||Iu,P.lineWidth=me===void 0?mc:me,P.miterLimit=_e===void 0?pc:_e,P.strokeStyle=Ts(F.getColor()||fc)}r=this.textState_;var Se=n.getFont()||ng;Bx(Se);var Ue=n.getScaleArray();r.overflow=n.getOverflow(),r.font=Se,r.maxAngle=n.getMaxAngle(),r.placement=n.getPlacement(),r.textAlign=n.getTextAlign(),r.textBaseline=n.getTextBaseline()||ep,r.backgroundFill=n.getBackgroundFill(),r.backgroundStroke=n.getBackgroundStroke(),r.padding=n.getPadding()||dc,r.scale=Ue===void 0?[1,1]:Ue;var He=n.getOffsetX(),Ie=n.getOffsetY(),Ge=n.getRotateWithView(),Je=n.getRotation();this.text_=n.getText()||"",this.textOffsetX_=He===void 0?0:He,this.textOffsetY_=Ie===void 0?0:Ie,this.textRotateWithView_=Ge===void 0?!1:Ge,this.textRotation_=Je===void 0?0:Je,this.strokeKey_=P?(typeof P.strokeStyle=="string"?P.strokeStyle:Ai(P.strokeStyle))+P.lineCap+P.lineDashOffset+"|"+P.lineWidth+P.lineJoin+P.miterLimit+"["+P.lineDash.join()+"]":"",this.textKey_=r.font+r.scale+(r.textAlign||"?")+(r.textBaseline||"?"),this.fillKey_=s?typeof s.fillStyle=="string"?s.fillStyle:"|"+Ai(s.fillStyle):""}this.declutterImageWithText_=u},p}(Au),e0=jw;var qw={Circle:u_,Default:Au,Image:Yx,LineString:Jx,Polygon:u_,Text:e0},Zw=function(){function y(p,n,u,r){this.tolerance_=p,this.maxExtent_=n,this.pixelRatio_=r,this.resolution_=u,this.buildersByZIndex_={}}return y.prototype.finish=function(){var p={};for(var n in this.buildersByZIndex_){p[n]=p[n]||{};var u=this.buildersByZIndex_[n];for(var r in u){var s=u[r].finish();p[n][r]=s}}return p},y.prototype.getBuilder=function(p,n){var u=p!==void 0?p.toString():"0",r=this.buildersByZIndex_[u];r===void 0&&(r={},this.buildersByZIndex_[u]=r);var s=r[n];if(s===void 0){var P=qw[n];s=new P(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[n]=s}return s},y}(),c_=Zw;var Ww=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Xw=function(y){Ww(p,y);function p(n){var u=y.call(this)||this;return u.ready=!0,u.boundHandleImageChange_=u.handleImageChange_.bind(u),u.layer_=n,u.declutterExecutorGroup=null,u}return p.prototype.getFeatures=function(n){return jr()},p.prototype.getData=function(n){return null},p.prototype.prepareFrame=function(n){return jr()},p.prototype.renderFrame=function(n,u){return jr()},p.prototype.loadedTileCallback=function(n,u,r){n[u]||(n[u]={}),n[u][r.tileCoord.toString()]=r},p.prototype.createLoadedTileFinder=function(n,u,r){return function(s,P){var z=this.loadedTileCallback.bind(this,r,s);return n.forEachLoadedTile(u,s,P,z)}.bind(this)},p.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){},p.prototype.getDataAtPixel=function(n,u,r){return null},p.prototype.getLayer=function(){return this.layer_},p.prototype.handleFontsChanged=function(){},p.prototype.handleImageChange_=function(n){var u=n.target;u.getState()===qi.LOADED&&this.renderIfReadyAndVisible()},p.prototype.loadImage=function(n){var u=n.getState();return u!=qi.LOADED&&u!=qi.ERROR&&n.addEventListener(Ji.CHANGE,this.boundHandleImageChange_),u==qi.IDLE&&(n.load(),u=n.getState()),u==qi.LOADED},p.prototype.renderIfReadyAndVisible=function(){var n=this.getLayer();n.getVisible()&&n.getSourceState()==Su.READY&&n.changed()},p.prototype.disposeInternal=function(){delete this.layer_,y.prototype.disposeInternal.call(this)},p}(km),t0=Xw;var $w=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Kw=function(y){$w(p,y);function p(n,u,r,s){var P=y.call(this,n)||this;return P.inversePixelTransform=u,P.frameState=r,P.context=s,P}return p}(sn),r0=Kw;var Hw=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vd=null;function Yw(){var y=document.createElement("canvas");y.width=1,y.height=1,vd=y.getContext("2d")}var Jw=function(y){Hw(p,y);function p(n){var u=y.call(this,n)||this;return u.container=null,u.renderedResolution,u.tempTransform=za(),u.pixelTransform=za(),u.inversePixelTransform=za(),u.context=null,u.containerReused=!1,u.pixelContext_=null,u.frameState=null,u}return p.prototype.getImageData=function(n,u,r){vd||Yw(),vd.clearRect(0,0,1,1);var s;try{vd.drawImage(n,u,r,1,1,0,0,1,1),s=vd.getImageData(0,0,1,1).data}catch{return null}return s},p.prototype.getBackground=function(n){var u=this.getLayer(),r=u.getBackground();return typeof r=="function"&&(r=r(n.viewState.resolution)),r||void 0},p.prototype.useContainer=function(n,u,r,s){var P=this.getLayer().getClassName(),z,F;if(n&&n.className===P&&n.style.opacity===""&&r===1&&(!s||n.style.backgroundColor&&_s(Jh(n.style.backgroundColor),Jh(s)))){var N=n.firstElementChild;N instanceof HTMLCanvasElement&&(F=N.getContext("2d"))}if(F&&F.canvas.style.transform===u?(this.container=n,this.context=F,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){z=document.createElement("div"),z.className=P;var V=z.style;V.position="absolute",V.width="100%",V.height="100%",s&&(V.backgroundColor=s),F=Ja();var N=F.canvas;z.appendChild(N),V=N.style,V.position="absolute",V.left="0",V.transformOrigin="top left",this.container=z,this.context=F}},p.prototype.clipUnrotated=function(n,u,r){var s=by(r),P=wy(r),z=xy(r),F=vy(r);bo(u.coordinateToPixelTransform,s),bo(u.coordinateToPixelTransform,P),bo(u.coordinateToPixelTransform,z),bo(u.coordinateToPixelTransform,F);var N=this.inversePixelTransform;bo(N,s),bo(N,P),bo(N,z),bo(N,F),n.save(),n.beginPath(),n.moveTo(Math.round(s[0]),Math.round(s[1])),n.lineTo(Math.round(P[0]),Math.round(P[1])),n.lineTo(Math.round(z[0]),Math.round(z[1])),n.lineTo(Math.round(F[0]),Math.round(F[1])),n.clip()},p.prototype.dispatchRenderEvent_=function(n,u,r){var s=this.getLayer();if(s.hasListener(n)){var P=new r0(n,this.inversePixelTransform,r,u);s.dispatchEvent(P)}},p.prototype.preRender=function(n,u){this.frameState=u,this.dispatchRenderEvent_(od.PRERENDER,n,u)},p.prototype.postRender=function(n,u){this.dispatchRenderEvent_(od.POSTRENDER,n,u)},p.prototype.getRenderTransform=function(n,u,r,s,P,z,F){var N=P/2,V=z/2,me=s/u,_e=-me,Se=-n[0]+F,Ue=-n[1];return vs(this.tempTransform,N,V,me,_e,-r,Se,Ue)},p.prototype.getDataAtPixel=function(n,u,r){var s=bo(this.inversePixelTransform,n.slice()),P=this.context,z=this.getLayer(),F=z.getExtent();if(F){var N=bo(u.pixelToCoordinateTransform,n.slice());if(!Kp(F,N))return null}var V=Math.round(s[0]),me=Math.round(s[1]),_e=this.pixelContext_;if(!_e){var Se=document.createElement("canvas");Se.width=1,Se.height=1,_e=Se.getContext("2d"),this.pixelContext_=_e}_e.clearRect(0,0,1,1);var Ue;try{_e.drawImage(P.canvas,V,me,1,1,0,0,1,1),Ue=_e.getImageData(0,0,1,1).data}catch(He){return He.name==="SecurityError"?(this.pixelContext_=null,new Uint8Array):Ue}return Ue[3]===0?null:Ue},p.prototype.disposeInternal=function(){delete this.frameState,y.prototype.disposeInternal.call(this)},p}(t0),i0=Jw;var On={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};function n0(y,p,n,u,r,s,P,z,F,N,V,me){var _e=y[p],Se=y[p+1],Ue=0,He=0,Ie=0,Ge=0;function Je(){Ue=_e,He=Se,p+=u,_e=y[p],Se=y[p+1],Ge+=Ie,Ie=Math.sqrt((_e-Ue)*(_e-Ue)+(Se-He)*(Se-He))}do Je();while(p<n-u&&Ge+Ie<s);for(var rt=Ie===0?0:(s-Ge)/Ie,_t=gl(Ue,_e,rt),yt=gl(He,Se,rt),ct=p-u,Tt=Ge,St=s+z*F(N,r,V);p<n-u&&Ge+Ie<St;)Je();rt=Ie===0?0:(St-Ge)/Ie;var Lt=gl(Ue,_e,rt),nr=gl(He,Se,rt),jt;if(me){var Jt=[_t,yt,Lt,nr];$m(Jt,0,4,2,me,Jt,Jt),jt=Jt[0]>Jt[2]}else jt=_t>Lt;var or=Math.PI,At=[],Vr=ct+u===p;p=ct,Ie=0,Ge=Tt,_e=y[p],Se=y[p+1];var Er;if(Vr){Je(),Er=Math.atan2(Se-He,_e-Ue),jt&&(Er+=Er>0?-or:or);var zr=(Lt+_t)/2,br=(nr+yt)/2;return At[0]=[zr,br,(St-s)/2,Er,r],At}for(var Sr=0,xr=r.length;Sr<xr;){Je();var Qr=Math.atan2(Se-He,_e-Ue);if(jt&&(Qr+=Qr>0?-or:or),Er!==void 0){var Vt=Qr-Er;if(Vt+=Vt>or?-2*or:Vt<-or?2*or:0,Math.abs(Vt)>P)return null}Er=Qr;for(var Yr=Sr,vi=0;Sr<xr;++Sr){var di=jt?xr-Sr-1:Sr,en=z*F(N,r[di],V);if(p+u<n&&Ge+Ie<s+vi+en/2)break;vi+=en}if(Sr!==Yr){var Br=jt?r.substring(xr-Yr,xr-Sr):r.substring(Yr,Sr);rt=Ie===0?0:(s+vi/2-Ge)/Ie;var zr=gl(Ue,_e,rt),br=gl(He,Se,rt);At.push([zr,br,vi/2,Qr,Br]),s+=vi}}return At}var uf=Ya(),gh=[],yc=[],_c=[],yh=[];function o0(y){return y[3].declutterBox}var Qw=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function a0(y,p){return(p==="start"||p==="end")&&!Qw.test(y)&&(p=p==="start"?"left":"right"),_d[p]}function e2(y,p,n){return n>0&&y.push(`
1080
1080
  `,""),y.push(p,""),y}var t2=function(){function y(p,n,u,r){this.overlaps=u,this.pixelRatio=n,this.resolution=p,this.alignFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=za(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={}}return y.prototype.createLabel=function(p,n,u,r){var s=p+n+u+r;if(this.labels_[s])return this.labels_[s];var P=r?this.strokeStates[r]:null,z=u?this.fillStates[u]:null,F=this.textStates[n],N=this.pixelRatio,V=[F.scale[0]*N,F.scale[1]*N],me=Array.isArray(p),_e=a0(me?p[0]:p,F.textAlign||mh),Se=r&&P.lineWidth?P.lineWidth:0,Ue=me?p:p.split(`
1081
1081
  `).reduce(e2,[]),He=Nx(F,Ue),Ie=He.width,Ge=He.height,Je=He.widths,rt=He.heights,_t=He.lineWidths,yt=Ie+Se,ct=[],Tt=(yt+2)*V[0],St=(Ge+Se)*V[1],Lt={width:Tt<0?Math.floor(Tt):Math.ceil(Tt),height:St<0?Math.floor(St):Math.ceil(St),contextInstructions:ct};if((V[0]!=1||V[1]!=1)&&ct.push("scale",V),r){ct.push("strokeStyle",P.strokeStyle),ct.push("lineWidth",Se),ct.push("lineCap",P.lineCap),ct.push("lineJoin",P.lineJoin),ct.push("miterLimit",P.miterLimit);var nr=ah?OffscreenCanvasRenderingContext2D:CanvasRenderingContext2D;nr.prototype.setLineDash&&(ct.push("setLineDash",[P.lineDash]),ct.push("lineDashOffset",P.lineDashOffset))}u&&ct.push("fillStyle",z.fillStyle),ct.push("textBaseline","middle"),ct.push("textAlign","center");for(var jt=.5-_e,Jt=_e*yt+jt*Se,or=[],At=[],Vr=0,Er=0,zr=0,br=0,Sr,xr=0,Qr=Ue.length;xr<Qr;xr+=2){var Vt=Ue[xr];if(Vt===`
1082
- `){Er+=Vr,Vr=0,Jt=_e*yt+jt*Se,++br;continue}var Yr=Ue[xr+1]||F.font;Yr!==Sr&&(r&&or.push("font",Yr),u&&At.push("font",Yr),Sr=Yr),Vr=Math.max(Vr,rt[zr]);var vi=[Vt,Jt+jt*Je[zr]+_e*(Je[zr]-_t[br]),.5*(Se+Vr)+Er];Jt+=Je[zr],r&&or.push("strokeText",vi),u&&At.push("fillText",vi),++zr}return Array.prototype.push.apply(ct,or),Array.prototype.push.apply(ct,At),this.labels_[s]=Lt,Lt},y.prototype.replayTextBackground_=function(p,n,u,r,s,P,z){p.beginPath(),p.moveTo.apply(p,n),p.lineTo.apply(p,u),p.lineTo.apply(p,r),p.lineTo.apply(p,s),p.lineTo.apply(p,n),P&&(this.alignFill_=P[2],this.fill_(p)),z&&(this.setStrokeStyle_(p,z),p.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(p,n,u,r,s,P,z,F,N,V,me,_e,Se,Ue,He,Ie){z*=_e[0],F*=_e[1];var Ge=u-z,Je=r-F,rt=s+N>p?p-N:s,_t=P+V>n?n-V:P,yt=Ue[3]+rt*_e[0]+Ue[1],ct=Ue[0]+_t*_e[1]+Ue[2],Tt=Ge-Ue[3],St=Je-Ue[0];(He||me!==0)&&(gh[0]=Tt,yh[0]=Tt,gh[1]=St,yc[1]=St,yc[0]=Tt+yt,_c[0]=yc[0],_c[1]=St+ct,yh[1]=_c[1]);var Lt;return me!==0?(Lt=vs(za(),u,r,1,1,me,-u,-r),bo(Lt,gh),bo(Lt,yc),bo(Lt,_c),bo(Lt,yh),sh(Math.min(gh[0],yc[0],_c[0],yh[0]),Math.min(gh[1],yc[1],_c[1],yh[1]),Math.max(gh[0],yc[0],_c[0],yh[0]),Math.max(gh[1],yc[1],_c[1],yh[1]),uf)):sh(Math.min(Tt,Tt+yt),Math.min(St,St+ct),Math.max(Tt,Tt+yt),Math.max(St,St+ct),uf),Se&&(Ge=Math.round(Ge),Je=Math.round(Je)),{drawImageX:Ge,drawImageY:Je,drawImageW:rt,drawImageH:_t,originX:N,originY:V,declutterBox:{minX:uf[0],minY:uf[1],maxX:uf[2],maxY:uf[3],value:Ie},canvasTransform:Lt,scale:_e}},y.prototype.replayImageOrLabel_=function(p,n,u,r,s,P,z){var F=!!(P||z),N=r.declutterBox,V=p.canvas,me=z?z[2]*r.scale[0]/2:0,_e=N.minX-me<=V.width/n&&N.maxX+me>=0&&N.minY-me<=V.height/n&&N.maxY+me>=0;return _e&&(F&&this.replayTextBackground_(p,gh,yc,_c,yh,P,z),Vx(p,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(p){if(this.alignFill_){var n=bo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;p.save(),p.translate(n[0]%u,n[1]%u),p.rotate(this.viewRotation_)}p.fill(),this.alignFill_&&p.restore()},y.prototype.setStrokeStyle_=function(p,n){p.strokeStyle=n[1],p.lineWidth=n[2],p.lineCap=n[3],p.lineJoin=n[4],p.miterLimit=n[5],p.setLineDash&&(p.lineDashOffset=n[7],p.setLineDash(n[6]))},y.prototype.drawLabelWithPointPlacement_=function(p,n,u,r){var s=this.textStates[n],P=this.createLabel(p,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,N=a0(Array.isArray(p)?p[0]:p,s.textAlign||mh),V=_d[s.textBaseline||ep],me=z&&z.lineWidth?z.lineWidth:0,_e=P.width/F-2*s.scale[0],Se=N*_e+2*(.5-N)*me,Ue=V*P.height/F+2*(.5-V)*me;return{label:P,anchorX:Se,anchorY:Ue}},y.prototype.execute_=function(p,n,u,r,s,P,z,F){var N;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?N=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),N=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),kv(this.renderedTransform_,u));for(var V=0,me=r.length,_e=0,Se,Ue,He,Ie,Ge,Je,rt,_t,yt,ct,Tt,St,Lt=0,nr=0,jt=null,Jt=null,or=this.coordinateCache_,At=this.viewRotation_,Vr=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,Er={context:p,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:At},zr=this.instructions!=r||this.overlaps?0:200,br,Sr,xr,Qr;V<me;){var Vt=r[V],Yr=Vt[0];switch(Yr){case qr.BEGIN_GEOMETRY:br=Vt[1],Qr=Vt[3],br.getGeometry()?z!==void 0&&!Lo(z,Qr.getExtent())?V=Vt[2]+1:++V:V=Vt[2];break;case qr.BEGIN_PATH:Lt>zr&&(this.fill_(p),Lt=0),nr>zr&&(p.stroke(),nr=0),!Lt&&!nr&&(p.beginPath(),Ie=NaN,Ge=NaN),++V;break;case qr.CIRCLE:_e=Vt[1];var vi=N[_e],di=N[_e+1],en=N[_e+2],Br=N[_e+3],Li=en-vi,Mn=Br-di,Ni=Math.sqrt(Li*Li+Mn*Mn);p.moveTo(vi+Ni,di),p.arc(vi,di,Ni,0,2*Math.PI,!0),++V;break;case qr.CLOSE_PATH:p.closePath(),++V;break;case qr.CUSTOM:_e=Vt[1],Se=Vt[2];var Cr=Vt[3],Wn=Vt[4],Zi=Vt.length==6?Vt[5]:void 0;Er.geometry=Cr,Er.feature=br,V in or||(or[V]=[]);var ln=or[V];Zi?Zi(N,_e,Se,2,ln):(ln[0]=N[_e],ln[1]=N[_e+1],ln.length=2),Wn(ln,Er),++V;break;case qr.DRAW_IMAGE:_e=Vt[1],Se=Vt[2],_t=Vt[3],Ue=Vt[4],He=Vt[5];var qo=Vt[6],Xn=Vt[7],Jr=Vt[8],un=Vt[9],$n=Vt[10],Kn=Vt[11],Fn=Vt[12],Wi=Vt[13],gn=Vt[14];if(!_t&&Vt.length>=19){yt=Vt[18],ct=Vt[19],Tt=Vt[20],St=Vt[21];var Tn=this.drawLabelWithPointPlacement_(yt,ct,Tt,St);_t=Tn.label,Vt[3]=_t;var wo=Vt[22];Ue=(Tn.anchorX-wo)*this.pixelRatio,Vt[4]=Ue;var wt=Vt[23];He=(Tn.anchorY-wt)*this.pixelRatio,Vt[5]=He,qo=_t.height,Vt[6]=qo,Wi=_t.width,Vt[13]=Wi}var Xt=void 0;Vt.length>24&&(Xt=Vt[24]);var ho=void 0,yn=void 0,Wr=void 0;Vt.length>16?(ho=Vt[15],yn=Vt[16],Wr=Vt[17]):(ho=dc,yn=!1,Wr=!1),$n&&Vr?Kn+=At:!$n&&!Vr&&(Kn-=At);for(var kn=0;_e<Se;_e+=2)if(!(Xt&&Xt[kn++]<Wi/this.pixelRatio)){var Oi=this.calculateImageOrLabelDimensions_(_t.width,_t.height,N[_e],N[_e+1],Wi,qo,Ue,He,Jr,un,Kn,Fn,s,ho,yn||Wr,br),dn=[p,n,_t,Oi,Xn,yn?jt:null,Wr?Jt:null],Hn=void 0,Zt=void 0;if(F&&gn){var Ur=Se-_e;if(!gn[Ur]){gn[Ur]=dn;continue}if(Hn=gn[Ur],delete gn[Ur],Zt=o0(Hn),F.collides(Zt))continue}F&&F.collides(Oi.declutterBox)||(Hn&&(F&&F.insert(Zt),this.replayImageOrLabel_.apply(this,Hn)),F&&F.insert(Oi.declutterBox),this.replayImageOrLabel_.apply(this,dn))}++V;break;case qr.DRAW_CHARS:var Dr=Vt[1],Vi=Vt[2],Sn=Vt[3],Ar=Vt[4];St=Vt[5];var ro=Vt[6],Xi=Vt[7],bi=Vt[8];Tt=Vt[9];var te=Vt[10];yt=Vt[11],ct=Vt[12];var he=[Vt[13],Vt[13]],de=this.textStates[ct],Te=de.font,Re=[de.scale[0]*Xi,de.scale[1]*Xi],Xe=void 0;Te in this.widths_?Xe=this.widths_[Te]:(Xe={},this.widths_[Te]=Xe);var Qe=eg(N,Dr,Vi,2),we=Math.abs(Re[0])*i_(Te,yt,Xe);if(Ar||we<=Qe){var Ne=this.textStates[ct].textAlign,ie=(Qe-we)*_d[Ne],W=n0(N,Dr,Vi,2,yt,ie,ro,Math.abs(Re[0]),i_,Te,Xe,Vr?0:this.viewRotation_);e:if(W){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=W.length;re<le;++re){ge=W[re],Ae=ge[4],ke=this.createLabel(Ae,ct,"",Tt),Ue=ge[2]+(Re[0]<0?-te:te),He=Sn*ke.height+(.5-Sn)*2*te*Re[1]/Re[0]-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,He,0,0,ge[3],he,!1,dc,!1,br);if(F&&F.collides(Oi.declutterBox))break e;J.push([p,n,ke,Oi,1,null,null])}if(St)for(re=0,le=W.length;re<le;++re){ge=W[re],Ae=ge[4],ke=this.createLabel(Ae,ct,St,""),Ue=ge[2],He=Sn*ke.height-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,He,0,0,ge[3],he,!1,dc,!1,br);if(F&&F.collides(Oi.declutterBox))break e;J.push([p,n,ke,Oi,1,null,null])}F&&F.load(J.map(o0));for(var Ce=0,Le=J.length;Ce<Le;++Ce)this.replayImageOrLabel_.apply(this,J[Ce])}}++V;break;case qr.END_GEOMETRY:if(P!==void 0){br=Vt[1];var Ke=P(br,Qr);if(Ke)return Ke}++V;break;case qr.FILL:zr?Lt++:this.fill_(p),++V;break;case qr.MOVE_TO_LINE_TO:for(_e=Vt[1],Se=Vt[2],Sr=N[_e],xr=N[_e+1],Je=Sr+.5|0,rt=xr+.5|0,(Je!==Ie||rt!==Ge)&&(p.moveTo(Sr,xr),Ie=Je,Ge=rt),_e+=2;_e<Se;_e+=2)Sr=N[_e],xr=N[_e+1],Je=Sr+.5|0,rt=xr+.5|0,(_e==Se-2||Je!==Ie||rt!==Ge)&&(p.lineTo(Sr,xr),Ie=Je,Ge=rt);++V;break;case qr.SET_FILL_STYLE:jt=Vt,this.alignFill_=Vt[2],Lt&&(this.fill_(p),Lt=0,nr&&(p.stroke(),nr=0)),p.fillStyle=Vt[1],++V;break;case qr.SET_STROKE_STYLE:Jt=Vt,nr&&(p.stroke(),nr=0),this.setStrokeStyle_(p,Vt),++V;break;case qr.STROKE:zr?nr++:p.stroke(),++V;break;default:++V;break}}Lt&&this.fill_(p),nr&&p.stroke()},y.prototype.execute=function(p,n,u,r,s,P){this.viewRotation_=r,this.execute_(p,n,u,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(p,n,u,r,s){return this.viewRotation_=u,this.execute_(p,1,n,this.hitDetectionInstructions,!0,r,s)},y}(),s0=t2;var h_=[On.POLYGON,On.CIRCLE,On.LINE_STRING,On.IMAGE,On.TEXT,On.DEFAULT],r2=function(){function y(p,n,u,r,s,P){this.maxExtent_=p,this.overlaps_=r,this.pixelRatio_=u,this.resolution_=n,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return y.prototype.clip=function(p,n){var u=this.getClipCoords(n);p.beginPath(),p.moveTo(u[0],u[1]),p.lineTo(u[2],u[3]),p.lineTo(u[4],u[5]),p.lineTo(u[6],u[7]),p.clip()},y.prototype.createExecutors_=function(p){for(var n in p){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=p[n];for(var s in r){var P=r[s];u[s]=new s0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(p){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=p.length;r<s;++r)if(p[r]in u)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(p,n,u,r,s,P){r=Math.round(r);var z=r*2+1,F=vs(this.hitDetectionTransform_,r+.5,r+.5,1/n,-1/n,-u,-p[0],-p[1]),N=!this.hitDetectionContext_;N&&(this.hitDetectionContext_=Ja(z,z));var V=this.hitDetectionContext_;V.canvas.width!==z||V.canvas.height!==z?(V.canvas.width=z,V.canvas.height=z):N||V.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),yy(me,p),yl(me,n*(this.renderBuffer_+r),me));var _e=i2(r),Se;function Ue(ct,Tt){for(var St=V.getImageData(0,0,z,z).data,Lt=0,nr=_e.length;Lt<nr;Lt++)if(St[_e[Lt]]>0){if(!P||Se!==On.IMAGE&&Se!==On.TEXT||P.indexOf(ct)!==-1){var jt=(_e[Lt]-3)/4,Jt=r-jt%z,or=r-(jt/z|0),At=s(ct,Tt,Jt*Jt+or*or);if(At)return At}V.clearRect(0,0,z,z);break}}var He=Object.keys(this.executorsByZIndex_).map(Number);He.sort(rh);var Ie,Ge,Je,rt,_t;for(Ie=He.length-1;Ie>=0;--Ie){var yt=He[Ie].toString();for(Je=this.executorsByZIndex_[yt],Ge=h_.length-1;Ge>=0;--Ge)if(Se=h_[Ge],rt=Je[Se],rt!==void 0&&(_t=rt.executeHitDetection(V,F,u,Ue,me),_t))return _t}},y.prototype.getClipCoords=function(p){var n=this.maxExtent_;if(!n)return null;var u=n[0],r=n[1],s=n[2],P=n[3],z=[u,r,u,P,s,P,s,r];return _l(z,0,8,2,p,z),z},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(p,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(p.save(),this.clip(p,u));var N=P||h_,V,me,_e,Se,Ue,He;for(z&&F.reverse(),V=0,me=F.length;V<me;++V){var Ie=F[V].toString();for(Ue=this.executorsByZIndex_[Ie],_e=0,Se=N.length;_e<Se;++_e){var Ge=N[_e];He=Ue[Ge],He!==void 0&&He.execute(p,n,u,r,s,z)}}this.maxExtent_&&p.restore()},y}(),p_={};function i2(y){if(p_[y]!==void 0)return p_[y];for(var p=y*2+1,n=y*y,u=new Array(n+1),r=0;r<=y;++r)for(var s=0;s<=y;++s){var P=r*r+s*s;if(P>n)break;var z=u[P];z||(z=[],u[P]=z),z.push(((y+r)*p+(y+s))*4+3),r>0&&z.push(((y-r)*p+(y+s))*4+3),s>0&&(z.push(((y+r)*p+(y-s))*4+3),r>0&&z.push(((y-r)*p+(y-s))*4+3))}for(var F=[],r=0,N=u.length;r<N;++r)u[r]&&F.push.apply(F,u[r]);return p_[y]=F,F}var f_=r2;var xd={ANIMATING:0,INTERACTING:1};var n2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),o2=function(y){n2(p,y);function p(n,u,r,s,P,z,F){var N=y.call(this)||this;return N.context_=n,N.pixelRatio_=u,N.extent_=r,N.transform_=s,N.viewRotation_=P,N.squaredTolerance_=z,N.userTransform_=F,N.contextFillState_=null,N.contextStrokeState_=null,N.contextTextState_=null,N.fillState_=null,N.strokeState_=null,N.image_=null,N.imageAnchorX_=0,N.imageAnchorY_=0,N.imageHeight_=0,N.imageOpacity_=0,N.imageOriginX_=0,N.imageOriginY_=0,N.imageRotateWithView_=!1,N.imageRotation_=0,N.imageScale_=[0,0],N.imageWidth_=0,N.text_="",N.textOffsetX_=0,N.textOffsetY_=0,N.textRotateWithView_=!1,N.textRotation_=0,N.textScale_=[0,0],N.textFillState_=null,N.textStrokeState_=null,N.textState_=null,N.pixelCoordinates_=[],N.tmpLocalTransform_=za(),N}return p.prototype.drawImages_=function(n,u,r,s){if(!!this.image_){var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.tmpLocalTransform_,N=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=N*this.imageOpacity_);var V=this.imageRotation_;this.imageRotateWithView_&&(V+=this.viewRotation_);for(var me=0,_e=P.length;me<_e;me+=2){var Se=P[me]-this.imageAnchorX_,Ue=P[me+1]-this.imageAnchorY_;if(V!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var He=Se+this.imageAnchorX_,Ie=Ue+this.imageAnchorY_;vs(F,He,Ie,1,1,V,-He,-Ie),z.setTransform.apply(z,F),z.translate(He,Ie),z.scale(this.imageScale_[0],this.imageScale_[1]),z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),z.setTransform(1,0,0,1,0,0)}else z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Se,Ue,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=N)}},p.prototype.drawText_=function(n,u,r,s){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);u<r;u+=s){var N=P[u]+this.textOffsetX_,V=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,N,V,1,1,F,-N,-V);z.setTransform.apply(z,me),z.translate(N,V),z.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&z.strokeText(this.text_,0,0),this.textFillState_&&z.fillText(this.text_,0,0),z.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&z.strokeText(this.text_,N,V),this.textFillState_&&z.fillText(this.text_,N,V)}}},p.prototype.moveToLineTo_=function(n,u,r,s,P){var z=this.context_,F=_l(n,u,r,s,this.transform_,this.pixelCoordinates_);z.moveTo(F[0],F[1]);var N=F.length;P&&(N-=2);for(var V=2;V<N;V+=2)z.lineTo(F[V],F[V+1]);return P&&z.closePath(),r},p.prototype.drawRings_=function(n,u,r,s){for(var P=0,z=r.length;P<z;++P)u=this.moveToLineTo_(n,u,r[P],s,!0);return u},p.prototype.drawCircle=function(n){if(!!Lo(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=gx(n,this.transform_,this.pixelCoordinates_),r=u[2]-u[0],s=u[3]-u[1],P=Math.sqrt(r*r+s*s),z=this.context_;z.beginPath(),z.arc(u[0],u[1],P,0,2*Math.PI),this.fillState_&&z.fill(),this.strokeState_&&z.stroke()}this.text_!==""&&this.drawText_(n.getCenter(),0,2,2)}},p.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},p.prototype.setTransform=function(n){this.transform_=n},p.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Mt.POINT:this.drawPoint(n);break;case Mt.LINE_STRING:this.drawLineString(n);break;case Mt.POLYGON:this.drawPolygon(n);break;case Mt.MULTI_POINT:this.drawMultiPoint(n);break;case Mt.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Mt.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Mt.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Mt.CIRCLE:this.drawCircle(n);break;default:}},p.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!Lo(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},p.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},p.prototype.drawPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},p.prototype.drawMultiPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},p.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(r,0,r.length,n.getStride(),!1),u.stroke()}if(this.text_!==""){var s=n.getFlatMidpoint();this.drawText_(s,0,2,2)}}},p.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!Lo(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=n.getFlatCoordinates(),P=0,z=n.getEnds(),F=n.getStride();r.beginPath();for(var N=0,V=z.length;N<V;++N)P=this.moveToLineTo_(s,P,z[N],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},p.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_;u.beginPath(),this.drawRings_(n.getOrientedFlatCoordinates(),0,n.getEnds(),n.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var r=n.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},p.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getOrientedFlatCoordinates(),s=0,P=n.getEndss(),z=n.getStride();u.beginPath();for(var F=0,N=P.length;F<N;++F){var V=P[F];s=this.drawRings_(r,s,V,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},p.prototype.setContextFillState_=function(n){var u=this.context_,r=this.contextFillState_;r?r.fillStyle!=n.fillStyle&&(r.fillStyle=n.fillStyle,u.fillStyle=n.fillStyle):(u.fillStyle=n.fillStyle,this.contextFillState_={fillStyle:n.fillStyle})},p.prototype.setContextStrokeState_=function(n){var u=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=n.lineCap&&(r.lineCap=n.lineCap,u.lineCap=n.lineCap),u.setLineDash&&(_s(r.lineDash,n.lineDash)||u.setLineDash(r.lineDash=n.lineDash),r.lineDashOffset!=n.lineDashOffset&&(r.lineDashOffset=n.lineDashOffset,u.lineDashOffset=n.lineDashOffset)),r.lineJoin!=n.lineJoin&&(r.lineJoin=n.lineJoin,u.lineJoin=n.lineJoin),r.lineWidth!=n.lineWidth&&(r.lineWidth=n.lineWidth,u.lineWidth=n.lineWidth),r.miterLimit!=n.miterLimit&&(r.miterLimit=n.miterLimit,u.miterLimit=n.miterLimit),r.strokeStyle!=n.strokeStyle&&(r.strokeStyle=n.strokeStyle,u.strokeStyle=n.strokeStyle)):(u.lineCap=n.lineCap,u.setLineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.lineWidth=n.lineWidth,u.miterLimit=n.miterLimit,u.strokeStyle=n.strokeStyle,this.contextStrokeState_={lineCap:n.lineCap,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset,lineJoin:n.lineJoin,lineWidth:n.lineWidth,miterLimit:n.miterLimit,strokeStyle:n.strokeStyle})},p.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:mh;r?(r.font!=n.font&&(r.font=n.font,u.font=n.font),r.textAlign!=s&&(r.textAlign=s,u.textAlign=s),r.textBaseline!=n.textBaseline&&(r.textBaseline=n.textBaseline,u.textBaseline=n.textBaseline)):(u.font=n.font,u.textAlign=s,u.textBaseline=n.textBaseline,this.contextTextState_={font:n.font,textAlign:s,textBaseline:n.textBaseline})},p.prototype.setFillStrokeStyle=function(n,u){var r=this;if(!n)this.fillState_=null;else{var s=n.getColor();this.fillState_={fillStyle:Ts(s||Ss)}}if(!u)this.strokeState_=null;else{var P=u.getColor(),z=u.getLineCap(),F=u.getLineDash(),N=u.getLineDashOffset(),V=u.getLineJoin(),me=u.getWidth(),_e=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:Qh,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ue){return Ue*r.pixelRatio_}),lineDashOffset:(N||hc)*this.pixelRatio_,lineJoin:V!==void 0?V:Iu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}},p.prototype.setImageStyle=function(n){var u;if(!n||!(u=n.getSize())){this.image_=null;return}var r=n.getAnchor(),s=n.getOrigin();this.image_=n.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=u[1]*this.pixelRatio_,this.imageOpacity_=n.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=n.getRotateWithView(),this.imageRotation_=n.getRotation(),this.imageScale_=n.getScaleArray(),this.imageWidth_=u[0]*this.pixelRatio_},p.prototype.setTextStyle=function(n){if(!n)this.text_="";else{var u=n.getFill();if(!u)this.textFillState_=null;else{var r=u.getColor();this.textFillState_={fillStyle:Ts(r||Ss)}}var s=n.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),z=s.getLineCap(),F=s.getLineDash(),N=s.getLineDashOffset(),V=s.getLineJoin(),me=s.getWidth(),_e=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:Qh,lineDash:F||cc,lineDashOffset:N||hc,lineJoin:V!==void 0?V:Iu,lineWidth:me!==void 0?me:mc,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ue=n.getOffsetX(),He=n.getOffsetY(),Ie=n.getRotateWithView(),Ge=n.getRotation(),Je=n.getScaleArray(),rt=n.getText(),_t=n.getTextAlign(),yt=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:ng,textAlign:_t!==void 0?_t:mh,textBaseline:yt!==void 0?yt:ep},this.text_=rt!==void 0?Array.isArray(rt)?rt.reduce(function(ct,Tt,St){return ct+=St%2?" ":Tt},""):rt:"",this.textOffsetX_=Ue!==void 0?this.pixelRatio_*Ue:0,this.textOffsetY_=He!==void 0?this.pixelRatio_*He:0,this.textRotateWithView_=Ie!==void 0?Ie:!1,this.textRotation_=Ge!==void 0?Ge:0,this.textScale_=[this.pixelRatio_*Je[0],this.pixelRatio_*Je[1]]}},p}(og),l0=o2;var Pu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var a2=function(){function y(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return y.prototype.clear=function(){this.cache_={},this.cacheSize_=0},y.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},y.prototype.expire=function(){if(this.canExpireCache()){var p=0;for(var n in this.cache_){var u=this.cache_[n];(p++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},y.prototype.get=function(p,n,u){var r=u0(p,n,u);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(p,n,u,r){var s=u0(p,n,u);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(p){this.maxCacheSize_=p,this.expire()},y}();function u0(y,p,n){var u=n?rg(n):"null";return p+":"+y+":"+u}var d_=new a2;var s2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),l2=function(y){s2(p,y);function p(n,u,r,s){var P=y.call(this)||this;return P.extent=n,P.pixelRatio_=r,P.resolution=u,P.state=s,P}return p.prototype.changed=function(){this.dispatchEvent(Ji.CHANGE)},p.prototype.getExtent=function(){return this.extent},p.prototype.getImage=function(){return jr()},p.prototype.getPixelRatio=function(){return this.pixelRatio_},p.prototype.getResolution=function(){return this.resolution},p.prototype.getState=function(){return this.state},p.prototype.load=function(){jr()},p}(nh),c0=l2;var u2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),mL=function(y){u2(p,y);function p(n,u,r,s,P,z){var F=y.call(this,n,u,r,qi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=qi.IDLE,F.imageLoadFunction_=z,F}return p.prototype.getImage=function(){return this.image_},p.prototype.handleImageError_=function(){this.state=qi.ERROR,this.unlistenImage_(),this.changed()},p.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Eu(this.extent)/this.image_.height),this.state=qi.LOADED,this.unlistenImage_(),this.changed()},p.prototype.load=function(){(this.state==qi.IDLE||this.state==qi.ERROR)&&(this.state=qi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=m_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},p.prototype.setImage=function(n){this.image_=n,this.resolution=Eu(this.extent)/this.image_.height},p.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},p}(c0);function m_(y,p,n){var u=y,r=!0,s=!1,P=!1,z=[qp(u,Ji.LOAD,function(){P=!0,s||p()})];return u.src&&Pv?(s=!0,u.decode().then(function(){r&&p()}).catch(function(F){r&&(P?p():n())})):z.push(qp(u,Ji.ERROR,n)),function(){r=!1,z.forEach(Po)}}var c2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),bd=null,h2=function(y){c2(p,y);function p(n,u,r,s,P,z){var F=y.call(this)||this;return F.hitDetectionImage_=null,F.image_=n||new Image,s!==null&&(F.image_.crossOrigin=s),F.canvas_={},F.color_=z,F.unlisten_=null,F.imageState_=P,F.size_=r,F.src_=u,F.tainted_,F}return p.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===qi.LOADED){bd||(bd=Ja(1,1)),bd.drawImage(this.image_,0,0);try{bd.getImageData(0,0,1,1),this.tainted_=!1}catch{bd=null,this.tainted_=!0}}return this.tainted_===!0},p.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Ji.CHANGE)},p.prototype.handleImageError_=function(){this.imageState_=qi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},p.prototype.handleImageLoad_=function(){this.imageState_=qi.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},p.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},p.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},p.prototype.getImageState=function(){return this.imageState_},p.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var n=this.size_[0],u=this.size_[1],r=Ja(n,u);r.fillRect(0,0,n,u),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},p.prototype.getSize=function(){return this.size_},p.prototype.getSrc=function(){return this.src_},p.prototype.load=function(){if(this.imageState_==qi.IDLE){this.imageState_=qi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=m_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},p.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==qi.LOADED)){var u=document.createElement("canvas");this.canvas_[n]=u,u.width=Math.ceil(this.image_.width*n),u.height=Math.ceil(this.image_.height*n);var r=u.getContext("2d");if(r.scale(n,n),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=rg(this.color_),r.fillRect(0,0,u.width/n,u.height/n),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,u.width,u.height),P=s.data,z=this.color_[0]/255,F=this.color_[1]/255,N=this.color_[2]/255,V=this.color_[3],me=0,_e=P.length;me<_e;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=N,P[me+3]*=V;r.putImageData(s,0,0)}}},p.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},p}(nh);function h0(y,p,n,u,r,s){var P=d_.get(p,u,s);return P||(P=new h2(y,p,n,u,r,s),d_.set(p,u,s,P)),P}var p2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),f2=function(y){p2(p,y);function p(n){var u=this,r=n||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,z=r.scale!==void 0?r.scale:1,F=r.rotateWithView!==void 0?r.rotateWithView:!1;u=y.call(this,{opacity:s,rotation:P,scale:z,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:F})||this,u.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],u.normalizedAnchor_=null,u.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Hs.TOP_LEFT,u.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Pu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Pu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var N=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var V=r.src;En(!(V!==void 0&&N),4),En(!N||N&&u.imgSize_,5),(V===void 0||V.length===0)&&N&&(V=N.src||Ai(N)),En(V!==void 0&&V.length>0,6);var me=r.src!==void 0?qi.IDLE:qi.LOADED;return u.color_=r.color!==void 0?Jh(r.color):null,u.iconImage_=h0(N,V,u.imgSize_!==void 0?u.imgSize_:null,u.crossOrigin_,me,u.color_),u.offset_=r.offset!==void 0?r.offset:[0,0],u.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Hs.TOP_LEFT,u.origin_=null,u.size_=r.size!==void 0?r.size:null,u}return p.prototype.clone=function(){var n=this.getScale();return new p({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(n)?n.slice():n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},p.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Pu.FRACTION||this.anchorYUnits_==Pu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Pu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Pu.FRACTION&&(n[1]*=u[1])}if(this.anchorOrigin_!=Hs.TOP_LEFT){if(!u)return null;n===this.anchor_&&(n=this.anchor_.slice()),(this.anchorOrigin_==Hs.TOP_RIGHT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=-n[0]+u[0]),(this.anchorOrigin_==Hs.BOTTOM_LEFT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=-n[1]+u[1])}this.normalizedAnchor_=n}var r=this.getDisplacement();return[n[0]-r[0],n[1]+r[1]]},p.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},p.prototype.getColor=function(){return this.color_},p.prototype.getImage=function(n){return this.iconImage_.getImage(n)},p.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},p.prototype.getImageSize=function(){return this.iconImage_.getSize()},p.prototype.getImageState=function(){return this.iconImage_.getImageState()},p.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},p.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var n=this.offset_;if(this.offsetOrigin_!=Hs.TOP_LEFT){var u=this.getSize(),r=this.iconImage_.getSize();if(!u||!r)return null;n=n.slice(),(this.offsetOrigin_==Hs.TOP_RIGHT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=r[0]-u[0]-n[0]),(this.offsetOrigin_==Hs.BOTTOM_LEFT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=r[1]-u[1]-n[1])}return this.origin_=n,this.origin_},p.prototype.getSrc=function(){return this.iconImage_.getSrc()},p.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},p.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(Ji.CHANGE,n)},p.prototype.load=function(){this.iconImage_.load()},p.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(Ji.CHANGE,n)},p}(tg),g_=f2;var $l=.5;function p0(y,p,n,u,r,s,P){var z=y[0]*$l,F=y[1]*$l,N=Ja(z,F);N.imageSmoothingEnabled=!1;for(var V=N.canvas,me=new l0(N,$l,r,null,P),_e=n.length,Se=Math.floor((256*256*256-1)/_e),Ue={},He=1;He<=_e;++He){var Ie=n[He-1],Ge=Ie.getStyleFunction()||u;if(!!u){var Je=Ge(Ie,s);if(!!Je){Array.isArray(Je)||(Je=[Je]);for(var rt=He*Se,_t="#"+("000000"+rt.toString(16)).slice(-6),yt=0,ct=Je.length;yt<ct;++yt){var Tt=Je[yt],St=Tt.getGeometryFunction()(Ie);if(!(!St||!Lo(r,St.getExtent()))){var Lt=Tt.clone(),nr=Lt.getFill();nr&&nr.setColor(_t);var jt=Lt.getStroke();jt&&(jt.setColor(_t),jt.setLineDash(null)),Lt.setText(void 0);var Jt=Tt.getImage();if(Jt&&Jt.getOpacity()!==0){var or=Jt.getImageSize();if(!or)continue;var At=Ja(or[0],or[1],void 0,{alpha:!1}),Vr=At.canvas;At.fillStyle=_t,At.fillRect(0,0,Vr.width,Vr.height),Lt.setImage(new g_({img:Vr,imgSize:or,anchor:Jt.getAnchor(),anchorXUnits:Pu.PIXELS,anchorYUnits:Pu.PIXELS,offset:Jt.getOrigin(),opacity:1,size:Jt.getSize(),scale:Jt.getScale(),rotation:Jt.getRotation(),rotateWithView:Jt.getRotateWithView()}))}var Er=Lt.getZIndex()||0,zr=Ue[Er];zr||(zr={},Ue[Er]=zr,zr[Mt.POLYGON]=[],zr[Mt.CIRCLE]=[],zr[Mt.LINE_STRING]=[],zr[Mt.POINT]=[]),zr[St.getType().replace("Multi","")].push(St,Lt)}}}}}for(var br=Object.keys(Ue).map(Number).sort(rh),He=0,Sr=br.length;He<Sr;++He){var zr=Ue[br[He]];for(var xr in zr)for(var Qr=zr[xr],yt=0,ct=Qr.length;yt<ct;yt+=2){me.setStyle(Qr[yt+1]);for(var Vt=0,Yr=p.length;Vt<Yr;++Vt)me.setTransform(p[Vt]),me.drawGeometry(Qr[yt])}}return N.getImageData(0,0,V.width,V.height)}function f0(y,p,n){var u=[];if(n){var r=Math.floor(Math.round(y[0])*$l),s=Math.floor(Math.round(y[1])*$l),P=(jl(r,0,n.width-1)+jl(s,0,n.height-1)*n.width)*4,z=n.data[P],F=n.data[P+1],N=n.data[P+2],V=N+256*(F+256*z),me=Math.floor((256*256*256-1)/p.length);V&&V%me===0&&u.push(p[V/me-1])}return u}var d2=.5,d0={Point:b2,LineString:_2,Polygon:E2,MultiPoint:w2,MultiLineString:v2,MultiPolygon:x2,GeometryCollection:y2,Circle:m2};function m0(y,p){return parseInt(Ai(y),10)-parseInt(Ai(p),10)}function g0(y,p){var n=ag(y,p);return n*n}function ag(y,p){return d2*y/p}function m2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),On.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(p,u)}}function y_(y,p,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var N=F.getImageState();N==qi.LOADED||N==qi.ERROR?F.unlistenImageChange(r):(N==qi.IDLE&&F.load(),N=F.getImageState(),F.listenImageChange(r),z=!0)}return g2(y,p,n,u,s,P),z}function g2(y,p,n,u,r,s){var P=n.getGeometryFunction()(p);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)y0(y,z,n,p);else{var N=d0[z.getType()];N(y,z,n,p,s)}}}function y0(y,p,n,u){if(p.getType()==Mt.GEOMETRY_COLLECTION){for(var r=p.getGeometries(),s=0,P=r.length;s<P;++s)y0(y,r[s],n,u);return}var z=y.getBuilder(n.getZIndex(),On.DEFAULT);z.drawCustom(p,u,n.getRenderer(),n.getHitDetectionRenderer())}function y2(y,p,n,u,r){var s=p.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=d0[s[P].getType()];F(y,s[P],n,u,r)}}function _2(y,p,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),On.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(p,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),On.TEXT);F.setTextStyle(z),F.drawText(p,u)}}function v2(y,p,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),On.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(p,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),On.TEXT);F.setTextStyle(z),F.drawText(p,u)}}function x2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=y.getBuilder(n.getZIndex(),On.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(p,u)}}function b2(y,p,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=y.getBuilder(n.getZIndex(),On.IMAGE);F.setImageStyle(s,z),F.drawPoint(p,u)}if(P&&P.getText()){var N=y.getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(P,z),N.drawText(p,u)}}function w2(y,p,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=y.getBuilder(n.getZIndex(),On.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(p,u)}if(P&&P.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(P,z),N.drawText(p,u)}}function E2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),On.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(p,u)}}var T2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),S2=function(y){T2(p,y);function p(n){var u=y.call(this,n)||this;return u.boundHandleStyleImageChange_=u.handleStyleImageChange_.bind(u),u.animatingOrInteracting_,u.dirty_=!1,u.hitDetectionImageData_=null,u.renderedFeatures_=null,u.renderedRevision_=-1,u.renderedResolution_=NaN,u.renderedExtent_=Ya(),u.wrappedRenderedExtent_=Ya(),u.renderedRotation_,u.renderedCenter_=null,u.renderedProjection_=null,u.renderedRenderOrder_=null,u.replayGroup_=null,u.replayGroupChanged=!0,u.declutterExecutorGroup=null,u.clipping=!0,u}return p.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,N=P.projection,V=P.rotation,me=N.getExtent(),_e=this.getLayer().getSource(),Se=u.pixelRatio,Ue=u.viewHints,He=!(Ue[xd.ANIMATING]||Ue[xd.INTERACTING]),Ie=this.context,Ge=Math.round(u.size[0]*Se),Je=Math.round(u.size[1]*Se),rt=_e.getWrapX()&&N.canWrapX(),_t=rt?bs(me):null,yt=rt?Math.ceil((s[2]-me[2])/_t)+1:1,ct=rt?Math.floor((s[0]-me[0])/_t):0;do{var Tt=this.getRenderTransform(z,F,V,Se,Ge,Je,ct*_t);n.execute(Ie,1,Tt,V,He,void 0,r)}while(++ct<yt)},p.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},p.prototype.renderFrame=function(n,u){var r=n.pixelRatio,s=n.layerStatesArray[n.layerIndex];Lv(this.pixelTransform,1/r,1/r),zv(this.inversePixelTransform,this.pixelTransform);var P=fy(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,N=this.replayGroup_,V=this.declutterExecutorGroup;if((!N||N.isEmpty())&&(!V||V.isEmpty()))return null;var me=Math.round(n.size[0]*r),_e=Math.round(n.size[1]*r);F.width!=me||F.height!=_e?(F.width=me,F.height=_e,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,_e),this.preRender(z,n);var Se=n.viewState,Ue=Se.projection,He=!1,Ie=!0;if(s.extent&&this.clipping){var Ge=rd(s.extent,Ue);Ie=Lo(Ge,n.extent),He=Ie&&!sc(Ge,n.extent),He&&this.clipUnrotated(z,n,Ge)}Ie&&this.renderWorlds(N,n),He&&z.restore(),this.postRender(z,n);var Je=Fx(s.opacity),rt=this.container;return Je!==rt.style.opacity&&(rt.style.opacity=Je),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},p.prototype.getFeatures=function(n){return new Promise(function(u){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];bo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,z=this.renderedRotation_,F=this.renderedProjection_,N=this.wrappedRenderedExtent_,V=this.getLayer(),me=[],_e=r[0]*$l,Se=r[1]*$l;me.push(this.getRenderTransform(s,P,z,$l,_e,Se,0).slice());var Ue=V.getSource(),He=F.getExtent();if(Ue.getWrapX()&&F.canWrapX()&&!sc(He,N)){for(var Ie=N[0],Ge=bs(He),Je=0,rt=void 0;Ie<He[0];)--Je,rt=Ge*Je,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ie+=Ge;for(Je=0,Ie=N[2];Ie>He[2];)++Je,rt=Ge*Je,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ie-=Ge}this.hitDetectionImageData_=p0(r,me,this.renderedFeatures_,V.getStyleFunction(),N,P,z)}u(f0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},p.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,N=u.viewState.rotation,V=this.getLayer(),me={},_e=function(He,Ie,Ge){var Je=Ai(He),rt=me[Je];if(rt){if(rt!==!0&&Ge<rt.distanceSq){if(Ge===0)return me[Je]=!0,P.splice(P.lastIndexOf(rt),1),s(He,V,Ie);rt.geometry=Ie,rt.distanceSq=Ge}}else{if(Ge===0)return me[Je]=!0,s(He,V,Ie);P.push(me[Je]={feature:He,layer:V,geometry:Ie,distanceSq:Ge,callback:s})}},Se,Ue=[this.replayGroup_];return this.declutterExecutorGroup&&Ue.push(this.declutterExecutorGroup),Ue.some(function(He){return Se=He.forEachFeatureAtCoordinate(n,F,N,r,_e,He===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ie){return Ie.value}):null)}),Se}},p.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},p.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},p.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[xd.ANIMATING],P=n.viewHints[xd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var N=n.extent,V=n.viewState,me=V.projection,_e=V.resolution,Se=n.pixelRatio,Ue=u.getRevision(),He=u.getRenderBuffer(),Ie=u.getRenderOrder();Ie===void 0&&(Ie=m0);var Ge=V.center.slice(),Je=yl(N,He*_e),rt=Je.slice(),_t=[Je.slice()],yt=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!sc(yt,n.extent)){var ct=bs(yt),Tt=Math.max(bs(Je)/2,ct);Je[0]=yt[0]-Tt,Je[2]=yt[2]+Tt,ex(Ge,me);var St=Jv(_t[0],me);St[0]<yt[0]&&St[2]<yt[2]?_t.push([St[0]+ct,St[1],St[2]+ct,St[3]]):St[0]>yt[0]&&St[2]>yt[2]&&_t.push([St[0]-ct,St[1],St[2]-ct,St[3]])}if(!this.dirty_&&this.renderedResolution_==_e&&this.renderedRevision_==Ue&&this.renderedRenderOrder_==Ie&&sc(this.wrappedRenderedExtent_,Je))return _s(this.renderedExtent_,rt)||(this.hitDetectionImageData_=null,this.renderedExtent_=rt),this.renderedCenter_=Ge,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Lt=new c_(ag(_e,Se),Je,_e,Se),nr;this.getLayer().getDeclutter()&&(nr=new c_(ag(_e,Se),Je,_e,Se));var jt=uh(),Jt;if(jt){for(var or=0,At=_t.length;or<At;++or){var Vr=_t[or],Er=Qp(Vr,me);r.loadFeatures(Er,nx(_e,me),jt)}Jt=Gm(jt,me)}else for(var or=0,At=_t.length;or<At;++or)r.loadFeatures(_t[or],_e,me);var zr=g0(_e,Se),br=function(Yr){var vi,di=Yr.getStyleFunction()||u.getStyleFunction();if(di&&(vi=di(Yr,_e)),vi){var en=this.renderFeature(Yr,zr,vi,Lt,Jt,nr);this.dirty_=this.dirty_||en}}.bind(this),Sr=Qp(Je,me),xr=r.getFeaturesInExtent(Sr);Ie&&xr.sort(Ie);for(var or=0,At=xr.length;or<At;++or)br(xr[or]);this.renderedFeatures_=xr;var Qr=Lt.finish(),Vt=new f_(Je,_e,Se,r.getOverlaps(),Qr,u.getRenderBuffer());return nr&&(this.declutterExecutorGroup=new f_(Je,_e,Se,r.getOverlaps(),nr.finish(),u.getRenderBuffer())),this.renderedResolution_=_e,this.renderedRevision_=Ue,this.renderedRenderOrder_=Ie,this.renderedExtent_=rt,this.wrappedRenderedExtent_=Je,this.renderedCenter_=Ge,this.renderedProjection_=me,this.replayGroup_=Vt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},p.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var N=0,V=r.length;N<V;++N)F=y_(s,n,r[N],u,this.boundHandleStyleImageChange_,P,z)||F;else F=y_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},p}(i0),_0=S2;var I2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),C2=function(y){I2(p,y);function p(n){return y.call(this,n)||this}return p.prototype.createRenderer=function(){return new _0(this)},p}(Hx),tp=C2;var v0=Gp(s_(),1);var A2=function(){function y(p){this.rbush_=new v0.default(p),this.items_={}}return y.prototype.insert=function(p,n){var u={minX:p[0],minY:p[1],maxX:p[2],maxY:p[3],value:n};this.rbush_.insert(u),this.items_[Ai(n)]=u},y.prototype.load=function(p,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=p[r],z=n[r],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:z};u[r]=F,this.items_[Ai(z)]=F}this.rbush_.load(u)},y.prototype.remove=function(p){var n=Ai(p),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},y.prototype.update=function(p,n){var u=this.items_[Ai(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Vm(r,p)||(this.remove(n),this.insert(p,n))},y.prototype.getAll=function(){var p=this.rbush_.all();return p.map(function(n){return n.value})},y.prototype.getInExtent=function(p){var n={minX:p[0],minY:p[1],maxX:p[2],maxY:p[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},y.prototype.forEach=function(p){return this.forEach_(this.getAll(),p)},y.prototype.forEachInExtent=function(p,n){return this.forEach_(this.getInExtent(p),n)},y.prototype.forEach_=function(p,n){for(var u,r=0,s=p.length;r<s;r++)if(u=n(p[r]),u)return u;return u},y.prototype.isEmpty=function(){return Vl(this.items_)},y.prototype.clear=function(){this.rbush_.clear(),this.items_={}},y.prototype.getExtent=function(p){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,p)},y.prototype.concat=function(p){this.rbush_.load(p.rbush_.all());for(var n in p.items_)this.items_[n]=p.items_[n]},y}(),wd=A2;var P2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),M2=function(y){P2(p,y);function p(n){var u=y.call(this)||this;u.projection=ya(n.projection),u.attributions_=x0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Su.READY,u.wrapX_=n.wrapX!==void 0?n.wrapX:!1,u.interpolate_=!!n.interpolate,u.viewResolver=null,u.viewRejector=null;var r=u;return u.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),u}return p.prototype.getAttributions=function(){return this.attributions_},p.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},p.prototype.getProjection=function(){return this.projection},p.prototype.getResolutions=function(){return jr()},p.prototype.getView=function(){return this.viewPromise_},p.prototype.getState=function(){return this.state_},p.prototype.getWrapX=function(){return this.wrapX_},p.prototype.getInterpolate=function(){return this.interpolate_},p.prototype.refresh=function(){this.changed()},p.prototype.setAttributions=function(n){this.attributions_=x0(n),this.changed()},p.prototype.setState=function(n){this.state_=n,this.changed()},p}(Mo);function x0(y){return y?Array.isArray(y)?function(p){return y}:typeof y=="function"?y:function(p){return[y]}:null}var cf=M2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function b0(y,p){return[[-1/0,-1/0,1/0,1/0]]}var _h={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var k2=!1;function L2(y,p,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof y=="function"?y(n,u,r):y,!0),p.getType()==_h.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=k2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var N=p.getType(),V=void 0;N==_h.JSON||N==_h.TEXT?V=z.responseText:N==_h.XML?(V=z.responseXML,V||(V=new DOMParser().parseFromString(z.responseText,"application/xml"))):N==_h.ARRAY_BUFFER&&(V=z.response),V?s(p.readFeatures(V,{extent:n,featureProjection:r}),p.readProjection(V)):P()}else P()},z.onerror=P,z.send()}function __(y,p){return function(n,u,r,s,P){var z=this;L2(y,p,n,u,r,function(F,N){z.addFeatures(F),s!==void 0&&s(F)},P||qh)}}var w0=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vh=function(y){w0(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.feature=u,s.features=r,s}return p}(sn);var R2=function(y){w0(p,y);function p(n){var u=this,r=n||{};u=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Su.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=qh,u.format_=r.format,u.overlaps_=r.overlaps===void 0?!0:r.overlaps,u.url_=r.url,r.loader!==void 0?u.loader_=r.loader:u.url_!==void 0&&(En(u.format_,7),u.loader_=__(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:b0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new wd:null,u.loadedExtentsRtree_=new wd,u.loadingExtentsCount_=0,u.nullGeometryFeatures_={},u.idIndex_={},u.uidIndex_={},u.featureChangeKeys_={},u.featuresCollection_=null;var P,z;return Array.isArray(r.features)?z=r.features:r.features&&(P=r.features,z=P.getArray()),!s&&P===void 0&&(P=new ch(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return p.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},p.prototype.addFeatureInternal=function(n){var u=Ai(n);if(!this.addToIndex_(u,n)){this.featuresCollection_&&this.featuresCollection_.remove(n);return}this.setupChangeEvents_(u,n);var r=n.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,n)}else this.nullGeometryFeatures_[u]=n;this.dispatchEvent(new vh(Qa.ADDFEATURE,n))},p.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[uo(u,Ji.CHANGE,this.handleFeatureChange_,this),uo(u,jp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},p.prototype.addToIndex_=function(n,u){var r=!0,s=u.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=u),r&&(En(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},p.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},p.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],N=Ai(F);this.addToIndex_(N,F)&&r.push(F)}for(var P=0,V=r.length;P<V;P++){var F=r[P],N=Ai(F);this.setupChangeEvents_(N,F);var me=F.getGeometry();if(me){var _e=me.getExtent();u.push(_e),s.push(F)}else this.nullGeometryFeatures_[N]=F}if(this.featuresRtree_&&this.featuresRtree_.load(u,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,Se=r.length;P<Se;P++)this.dispatchEvent(new vh(Qa.ADDFEATURE,r[P]))},p.prototype.bindFeaturesCollection_=function(n){var u=!1;this.addEventListener(Qa.ADDFEATURE,function(r){u||(u=!0,n.push(r.feature),u=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){u||(u=!0,n.remove(r.feature),u=!1)}),n.addEventListener(ws.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(ws.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},p.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Po)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(s);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var z=new vh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},p.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},p.prototype.forEachFeatureAtCoordinateDirect=function(n,u){var r=[n[0],n[1],n[0],n[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(n))return u(s)})},p.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},p.prototype.forEachFeatureIntersectingExtent=function(n,u){return this.forEachFeatureInExtent(n,function(r){var s=r.getGeometry();if(s.intersectsExtent(n)){var P=u(r);if(P)return P}})},p.prototype.getFeaturesCollection=function(){return this.featuresCollection_},p.prototype.getFeatures=function(){var n;return this.featuresCollection_?n=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(n=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ka(n,Pm(this.nullGeometryFeatures_))),n},p.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},p.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},p.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,N=[-1/0,-1/0,1/0,1/0],V=u||Am;return this.featuresRtree_.forEachInExtent(N,function(me){if(V(me)){var _e=me.getGeometry(),Se=F;if(F=_e.closestPointXY(r,s,z,F),F<Se){P=me;var Ue=Math.sqrt(F);N[0]=r-Ue,N[1]=s-Ue,N[2]=r+Ue,N[3]=s+Ue}}}),P},p.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},p.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},p.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},p.prototype.getFormat=function(){return this.format_},p.prototype.getOverlaps=function(){return this.overlaps_},p.prototype.getUrl=function(){return this.url_},p.prototype.handleFeatureChange_=function(n){var u=n.target,r=Ai(u),s=u.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[r]=u);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,u)):this.featuresRtree_&&this.featuresRtree_.update(P,u)}var z=u.getId();if(z!==void 0){var F=z.toString();this.idIndex_[F]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[F]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[r]=u;this.changed(),this.dispatchEvent(new vh(Qa.CHANGEFEATURE,u))},p.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Ai(n)in this.uidIndex_},p.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},p.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,_e){var Se=P[me],Ue=s.forEachInExtent(Se,function(He){return sc(He.extent,Se)});Ue||(++F.loadingExtentsCount_,F.dispatchEvent(new vh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(He){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADEND,void 0,He))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,N=0,V=P.length;N<V;++N)z(N,V);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},p.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},p.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Vm(s.extent,n))return r=s,!0}),r&&u.remove(r)},p.prototype.removeFeature=function(n){if(!!n){var u=Ai(n);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(n);var r=this.removeFeatureInternal(n);r&&this.changed()}},p.prototype.removeFeatureInternal=function(n){var u=Ai(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Po),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new vh(Qa.REMOVEFEATURE,n)),n}},p.prototype.removeFromIdIndex_=function(n){var u=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===n){delete this.idIndex_[r],u=!0;break}return u},p.prototype.setLoader=function(n){this.loader_=n},p.prototype.setUrl=function(n){En(this.format_,7),this.url_=n,this.setLoader(__(n,this.format_))},p}(cf),rp=R2;var E0=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hf=function(y){E0(p,y);function p(n,u){var r=y.call(this,n)||this;return r.layer=u,r}return p}(sn);var v_={LAYERS:"layers"},z2=function(y){E0(p,y);function p(n){var u=this,r=n||{},s=Ra({},r);delete s.layers;var P=r.layers;return u=y.call(this,s)||this,u.on,u.once,u.un,u.layersListenerKeys_=[],u.listenerKeys_={},u.addChangeListener(v_.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new ch(P.slice(),{unique:!0}):En(typeof P.getArray=="function",43):P=new ch(void 0,{unique:!0}),u.setLayers(P),u}return p.prototype.handleLayerChange_=function(){this.changed()},p.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Po),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(uo(n,ws.ADD,this.handleLayersAdd_,this),uo(n,ws.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Po);ih(this.listenerKeys_);for(var r=n.getArray(),s=0,P=r.length;s<P;s++){var z=r[s];this.registerLayerListeners_(z),this.dispatchEvent(new hf("addlayer",z))}this.changed()},p.prototype.registerLayerListeners_=function(n){var u=[uo(n,jp.PROPERTYCHANGE,this.handleLayerChange_,this),uo(n,Ji.CHANGE,this.handleLayerChange_,this)];n instanceof p&&u.push(uo(n,"addlayer",this.handleLayerGroupAdd_,this),uo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ai(n)]=u},p.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new hf("addlayer",n.layer))},p.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new hf("removelayer",n.layer))},p.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new hf("addlayer",u)),this.changed()},p.prototype.handleLayersRemove_=function(n){var u=n.element,r=Ai(u);this.listenerKeys_[r].forEach(Po),delete this.listenerKeys_[r],this.dispatchEvent(new hf("removelayer",u)),this.changed()},p.prototype.getLayers=function(){return this.get(v_.LAYERS)},p.prototype.setLayers=function(n){var u=this.getLayers();if(u)for(var r=u.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new hf("removelayer",r[s]));this.set(v_.LAYERS,n)},p.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},p.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(V){V.getLayerStatesArray(u)});var s=this.getLayerState(),P=s.zIndex;!n&&s.zIndex===void 0&&(P=0);for(var z=r,F=u.length;z<F;z++){var N=u[z];N.opacity*=s.opacity,N.visible=N.visible&&s.visible,N.maxResolution=Math.min(N.maxResolution,s.maxResolution),N.minResolution=Math.max(N.minResolution,s.minResolution),N.minZoom=Math.max(N.minZoom,s.minZoom),N.maxZoom=Math.min(N.maxZoom,s.maxZoom),s.extent!==void 0&&(N.extent!==void 0?N.extent=$v(N.extent,s.extent):N.extent=s.extent),N.zIndex===void 0&&(N.zIndex=P)}return u},p.prototype.getSourceState=function(){return Su.READY},p}(Zm),x_=z2;var na={SINGLECLICK:"singleclick",CLICK:Ji.CLICK,DBLCLICK:Ji.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var b_={ACTIVE:"active"};var D2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O2=function(y){D2(p,y);function p(n){var u=y.call(this)||this;return u.on,u.once,u.un,n&&n.handleEvent&&(u.handleEvent=n.handleEvent),u.map_=null,u.setActive(!0),u}return p.prototype.getActive=function(){return this.get(b_.ACTIVE)},p.prototype.getMap=function(){return this.map_},p.prototype.handleEvent=function(n){return!0},p.prototype.setActive=function(n){this.set(b_.ACTIVE,n)},p.prototype.setMap=function(n){this.map_=n},p}(Mo);var T0=O2;var F2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),B2=function(y){F2(p,y);function p(n){var u=this,r=n||{};return u=y.call(this,r)||this,r.handleDownEvent&&(u.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(u.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(u.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(u.handleUpEvent=r.handleUpEvent),r.stopDown&&(u.stopDown=r.stopDown),u.handlingDownUpSequence=!1,u.trackedPointers_={},u.targetPointers=[],u}return p.prototype.getPointerCount=function(){return this.targetPointers.length},p.prototype.handleDownEvent=function(n){return!1},p.prototype.handleDragEvent=function(n){},p.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;var u=!1;if(this.updateTrackedPointers_(n),this.handlingDownUpSequence){if(n.type==na.POINTERDRAG)this.handleDragEvent(n),n.originalEvent.preventDefault();else if(n.type==na.POINTERUP){var r=this.handleUpEvent(n);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(n.type==na.POINTERDOWN){var s=this.handleDownEvent(n);this.handlingDownUpSequence=s,u=this.stopDown(s)}else n.type==na.POINTERMOVE&&this.handleMoveEvent(n);return!u},p.prototype.handleMoveEvent=function(n){},p.prototype.handleUpEvent=function(n){return!1},p.prototype.stopDown=function(n){return n},p.prototype.updateTrackedPointers_=function(n){if(U2(n)){var u=n.originalEvent,r=u.pointerId.toString();n.type==na.POINTERUP?delete this.trackedPointers_[r]:n.type==na.POINTERDOWN?this.trackedPointers_[r]=u:r in this.trackedPointers_&&(this.trackedPointers_[r]=u),this.targetPointers=Pm(this.trackedPointers_)}},p}(T0);function U2(y){var p=y.type;return p===na.POINTERDOWN||p===na.POINTERDRAG||p===na.POINTERUP}var S0=B2;var I0=function(y){var p=y.originalEvent;return p.altKey&&!(p.metaKey||p.ctrlKey)&&!p.shiftKey};var C0=Am,A0=function(y){return y.type==na.CLICK};var P0=function(y){return y.type==na.SINGLECLICK};var M0=function(y){var p=y.originalEvent;return En(p!==void 0,56),p.isPrimary&&p.button===0};var N2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),V2=function(y){N2(p,y);function p(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=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout()),Ka(F,_e.getFlatCoordinates()),N.push(F.length)}s.setFlatCoordinates(P,F),s.ends_=N}return s}return p.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()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ud(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,n,u,r,s))},p.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 zx(this.flatCoordinates,0,this.ends_,this.stride,n,s,P)},p.prototype.getCoordinates=function(){return ph(this.flatCoordinates,0,this.ends_,this.stride)},p.prototype.getEnds=function(){return this.ends_},p.prototype.getLineString=function(n){return n<0||this.ends_.length<=n?null:new uc(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},p.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 N=u[z],V=new uc(n.slice(P,N),r);s.push(V),P=N}return s},p.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 N=s[z],V=Qm(u,r,N,P,.5);Ka(n,V),r=N}return n},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=wx(this.flatCoordinates,0,this.ends_,this.stride,n,u,0,r),new p(u,Pn.XY,r)},p.prototype.getType=function(){return Mt.MULTI_LINE_STRING},p.prototype.intersectsExtent=function(n){return Ax(this.flatCoordinates,0,this.ends_,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=cd(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},p}(Es),k0=V2;var G2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),j2=function(y){G2(p,y);function p(n,u){var r=y.call(this)||this;return u&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return p.prototype.appendPoint=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.changed()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},p.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,N=P.length;F<N;F+=z){var V=ql(n,u,P[F],P[F+1]);if(V<s){s=V;for(var me=0;me<z;++me)r[me]=P[F+me];r.length=z}}return s},p.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.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)},p.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},p.prototype.getType=function(){return Mt.MULTI_POINT},p.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(Qf(n,z,F))return!0}return!1},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},p}(Es),sg=j2;function L0(y,p,n,u){for(var r=[],s=Ya(),P=0,z=n.length;P<z;++P){var F=n[P];s=Nm(y,p,F[0],u),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),p=F[F.length-1]}return r}var q2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Z2=function(y){q2(p,y);function p(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=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout());for(var Se=F.length,Ue=_e.getEnds(),He=0,Ie=Ue.length;He<Ie;++He)Ue[He]+=Se;Ka(F,_e.getFlatCoordinates()),N.push(Ue)}u=P,n=F,r=N}return u!==void 0&&r?(s.setFlatCoordinates(u,n),s.endss_=r):s.setCoordinates(n,u),s}return p.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()},p.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 p(this.flatCoordinates.slice(),this.layout,u);return s.applyProperties(this),s},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_x(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),vx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,n,u,r,s))},p.prototype.containsXY=function(n,u){return Ix(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n,u)},p.prototype.getArea=function(){return Tx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},p.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Hy(u,0,this.endss_,this.stride,n)):u=this.flatCoordinates,pd(u,0,this.endss_,this.stride)},p.prototype.getEndss=function(){return this.endss_},p.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var n=L0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Cx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},p.prototype.getInteriorPoints=function(){return new sg(this.getFlatInteriorPoints().slice(),Pn.XYM)},p.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Lx(n,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Hy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=Ex(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(n),u,0,r),new p(u,Pn.XY,r)},p.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 md(this.flatCoordinates.slice(u,P),this.layout,s)},p.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 N=r[z].slice(),V=N[N.length-1];if(P!==0)for(var me=0,_e=N.length;me<_e;++me)N[me]-=P;var Se=new md(u.slice(P,V),n,N);s.push(Se),P=V}return s},p.prototype.getType=function(){return Mt.MULTI_POLYGON},p.prototype.intersectsExtent=function(n){return Px(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=bx(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()},p}(Es),R0=Z2;var B0=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),z0=0,Ed=1,D0=[0,0,0,0],pf=[],w_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},E_=function(y){B0(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return p}(sn);var W2=function(y){B0(p,y);function p(n){var u=y.call(this,n)||this;u.on,u.once,u.un,u.boundHandleFeatureChange_=u.handleFeatureChange_.bind(u),u.condition_=n.condition?n.condition:M0,u.defaultDeleteCondition_=function(s){return I0(s)&&P0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:C0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new wd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new tp({source:new rp({useSpatialIndex:!1,wrapX:!!n.wrapX}),style:n.style?n.style:$2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),u.SEGMENT_WRITERS_={Point:u.writePointGeometry_.bind(u),LineString:u.writeLineStringGeometry_.bind(u),LinearRing:u.writeLineStringGeometry_.bind(u),Polygon:u.writePolygonGeometry_.bind(u),MultiPoint:u.writeMultiPointGeometry_.bind(u),MultiLineString:u.writeMultiLineStringGeometry_.bind(u),MultiPolygon:u.writeMultiPolygonGeometry_.bind(u),Circle:u.writeCircleGeometry_.bind(u),GeometryCollection:u.writeGeometryCollectionGeometry_.bind(u)},u.source_=null,u.hitDetection_=null;var r;if(n.features?r=n.features:n.source&&(u.source_=n.source,r=new ch(u.source_.getFeatures()),u.source_.addEventListener(Qa.ADDFEATURE,u.handleSourceAdd_.bind(u)),u.source_.addEventListener(Qa.REMOVEFEATURE,u.handleSourceRemove_.bind(u))),!r)throw new Error("The modify interaction requires features, a source or a layer");return n.hitDetection&&(u.hitDetection_=n.hitDetection),u.features_=r,u.features_.forEach(u.addFeature_.bind(u)),u.features_.addEventListener(ws.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(ws.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return p.prototype.addFeature_=function(n){var u=n.getGeometry();if(u){var r=this.SEGMENT_WRITERS_[u.getType()];r&&r(n,u)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),n.addEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},p.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ch;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,N=z.length;F<N;++F){var V=z[F].feature;V&&r.indexOf(V)===-1&&this.featuresBeingModified_.push(V)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new E_(w_.MODIFYSTART,this.featuresBeingModified_,n))}},p.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},p.prototype.removeFeatureSegmentData_=function(n){var u=this.rBush_,r=[];u.forEach(function(F){n===F.feature&&r.push(F)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],z=this.dragSegments_.length-1;z>=0;--z)this.dragSegments_[z][0]===P&&this.dragSegments_.splice(z,1);u.remove(P)}},p.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,n)},p.prototype.setMap=function(n){this.overlay_.setMap(n),y.prototype.setMap.call(this,n)},p.prototype.getOverlay=function(){return this.overlay_},p.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},p.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},p.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},p.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},p.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},p.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},p.prototype.writeMultiPointGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s){var z=r[s],F={feature:n,geometry:u,depth:[s],index:s,segment:[z,z]};this.rBush_.insert(u.getExtent(),F)}},p.prototype.writeLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length-1;s<P;++s){var z=r.slice(s,s+2),F={feature:n,geometry:u,index:s,segment:z};this.rBush_.insert(wu(z),F)}},p.prototype.writeMultiLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},p.prototype.writePolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},p.prototype.writeMultiPolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length;F<N;++F)for(var V=z[F],me=0,_e=V.length-1;me<_e;++me){var Se=V.slice(me,me+2),Ue={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(wu(Se),Ue)}},p.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:z0,segment:[r,r]},P={feature:n,geometry:u,index:Ed,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Yp(r),s);var F=u,N=uh();if(N&&this.getMap()){var V=this.getMap().getView().getProjection();F=F.clone().transform(N,V),F=Yy(F).transform(V,N)}this.rBush_.insert(F.getExtent(),P)},p.prototype.writeGeometryCollectionGeometry_=function(n,u){for(var r=u.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],z=this.SEGMENT_WRITERS_[P.getType()];z(n,P)}},p.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new lc(new _a(n)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(n)}return s.set("features",u),s.set("geometries",r),s},p.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;this.lastPointerEvent_=n;var u;return!n.map.getView().getInteracting()&&n.type==na.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(n),this.vertexFeature_&&this.deleteCondition_(n)&&(n.type!=na.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),n.type==na.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),y.prototype.handleEvent.call(this,n)&&!u},p.prototype.handleDragEvent=function(n){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(n,this.dragSegments_);for(var u=[n.coordinate[0]+this.delta_[0],n.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,z=this.dragSegments_.length;P<z;++P){var F=this.dragSegments_[P],N=F[0],V=N.feature;r.indexOf(V)===-1&&r.push(V);var me=N.geometry;s.indexOf(me)===-1&&s.push(me);for(var _e=N.depth,Se=void 0,Ue=N.segment,He=F[1];u.length<me.getStride();)u.push(Ue[He][u.length]);switch(me.getType()){case Mt.POINT:Se=u,Ue[0]=u,Ue[1]=u;break;case Mt.MULTI_POINT:Se=me.getCoordinates(),Se[N.index]=u,Ue[0]=u,Ue[1]=u;break;case Mt.LINE_STRING:Se=me.getCoordinates(),Se[N.index+He]=u,Ue[He]=u;break;case Mt.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.POLYGON:Se=me.getCoordinates(),Se[_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.MULTI_POLYGON:Se=me.getCoordinates(),Se[_e[1]][_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.CIRCLE:if(Ue[0]=u,Ue[1]=u,N.index===z0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ie=n.map.getView().getProjection(),Ge=Ty(Wl(me.getCenter(),Ie),Wl(u,Ie)),Je=uh();if(Je){var rt=me.clone().transform(Je,Ie);rt.setRadius(Ge),Ge=rt.transform(Ie,Je).getRadius()}me.setRadius(Ge),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},p.prototype.handleDownEvent=function(n){if(!this.condition_(n))return!1;var u=n.coordinate;this.handlePointerAtPixel_(n.pixel,n.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=n.map.getView().getProjection(),P=[],z=r.getGeometry().getCoordinates(),F=wu([z]),N=this.rBush_.getInExtent(F),V={};N.sort(X2);for(var me=0,_e=N.length;me<_e;++me){var Se=N[me],Ue=Se.segment,He=Ai(Se.geometry),Ie=Se.depth;if(Ie&&(He+="-"+Ie.join("-")),V[He]||(V[He]=new Array(2)),Se.geometry.getType()===Mt.CIRCLE&&Se.index===Ed){var Ge=F0(u,Se,s);Tu(Ge,z)&&!V[He][0]&&(this.dragSegments_.push([Se,0]),V[He][0]=Se);continue}if(Tu(Ue[0],z)&&!V[He][0]){this.dragSegments_.push([Se,0]),V[He][0]=Se;continue}if(Tu(Ue[1],z)&&!V[He][1]){if((Se.geometry.getType()===Mt.LINE_STRING||Se.geometry.getType()===Mt.MULTI_LINE_STRING)&&V[He][0]&&V[He][0].index===0)continue;this.dragSegments_.push([Se,1]),V[He][1]=Se;continue}Ai(Ue)in this.vertexSegments_&&!V[He][0]&&!V[He][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var Je=P.length-1;Je>=0;--Je)this.insertVertex_(P[Je],z)}return!!this.vertexFeature_},p.prototype.handleUpEvent=function(n){for(var u=this.dragSegments_.length-1;u>=0;--u){var r=this.dragSegments_[u][0],s=r.geometry;if(s.getType()===Mt.CIRCLE){var P=s.getCenter(),z=r.featureSegments[0],F=r.featureSegments[1];z.segment[0]=P,z.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Yp(P),z);var N=s,V=uh();if(V){var me=n.map.getView().getProjection();N=N.clone().transform(V,me),N=Yy(N).transform(me,V)}this.rBush_.update(N.getExtent(),F)}else this.rBush_.update(wu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new E_(w_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},p.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},p.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(At,Vr){return O0(P,At,z)-O0(P,Vr,z)},N,V;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(At){return At===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(At,Vr,Er){if(Er=Er||At.getGeometry(),Er.getType()===Mt.POINT&&vv(s.features_.getArray(),At)){V=Er;var zr=Er.getFlatCoordinates().slice(0,2);N=[{feature:At,geometry:Er,segment:[zr,zr]}]}return!0},{layerFilter:me})}if(!N){var _e=rd(Yp(P,D0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ue=Qp(yl(_e,Se,D0),z);N=this.rBush_.getInExtent(Ue)}if(N&&N.length>0){var He=N.sort(F)[0],Ie=He.segment,Ge=F0(P,He,z),Je=u.getPixelFromCoordinate(Ge),rt=Ty(n,Je);if(V||rt<=this.pixelTolerance_){var _t={};if(_t[Ai(Ie)]=!0,this.snapToPointer_||(this.delta_[0]=Ge[0]-P[0],this.delta_[1]=Ge[1]-P[1]),He.geometry.getType()===Mt.CIRCLE&&He.index===Ed)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ge,[He.feature],[He.geometry]);else{var yt=u.getPixelFromCoordinate(Ie[0]),ct=u.getPixelFromCoordinate(Ie[1]),Tt=Jp(Je,yt),St=Jp(Je,ct);rt=Math.sqrt(Math.min(Tt,St)),this.snappedToVertex_=rt<=this.pixelTolerance_,this.snappedToVertex_&&(Ge=Tt>St?Ie[1]:Ie[0]),this.createOrUpdateVertexFeature_(Ge,[He.feature],[He.geometry]);var Lt={};Lt[Ai(He.geometry)]=!0;for(var nr=1,jt=N.length;nr<jt;++nr){var Jt=N[nr].segment;if(Tu(Ie[0],Jt[0])&&Tu(Ie[1],Jt[1])||Tu(Ie[0],Jt[1])&&Tu(Ie[1],Jt[0])){var or=Ai(N[nr].geometry);or in Lt||(Lt[or]=!0,_t[Ai(Jt)]=!0)}else break}}this.vertexSegments_=_t;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},p.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,N;u.length<P.getStride();)u.push(0);switch(P.getType()){case Mt.MULTI_LINE_STRING:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.POLYGON:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.MULTI_POLYGON:N=P.getCoordinates(),N[z[1]][z[0]].splice(F+1,0,u);break;case Mt.LINE_STRING:N=P.getCoordinates(),N.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,N);var V=this.rBush_;V.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};V.insert(wu(me.segment),me),this.dragSegments_.push([me,1]);var _e={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};V.insert(wu(_e.segment),_e),this.dragSegments_.push([_e,0]),this.ignoreNextSingleClick_=!0},p.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=na.POINTERDRAG){var n=this.lastPointerEvent_;this.willModifyFeatures_(n,this.dragSegments_);var u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new E_(w_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},p.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,N,V,me,_e,Se,Ue,He;for(N=n.length-1;N>=0;--N)z=n[N],Ue=z[0],He=Ai(Ue.feature),Ue.depth&&(He+="-"+Ue.depth.join("-")),He in u||(u[He]={}),z[1]===0?(u[He].right=Ue,u[He].index=Ue.index):z[1]==1&&(u[He].left=Ue,u[He].index=Ue.index+1);for(He in u){switch(Se=u[He].right,me=u[He].left,V=u[He].index,_e=V-1,me!==void 0?Ue=me:Ue=Se,_e<0&&(_e=0),F=Ue.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Mt.MULTI_LINE_STRING:P[Ue.depth[0]].length>2&&(P[Ue.depth[0]].splice(V,1),r=!0);break;case Mt.LINE_STRING:P.length>2&&(P.splice(V,1),r=!0);break;case Mt.MULTI_POLYGON:s=s[Ue.depth[1]];case Mt.POLYGON:s=s[Ue.depth[0]],s.length>4&&(V==s.length-1&&(V=0),s.splice(V,1),r=!0,V===0&&(s.pop(),s.push(s[0]),_e=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ie=[];if(me!==void 0&&(this.rBush_.remove(me),Ie.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ie.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ge={depth:Ue.depth,feature:Ue.feature,geometry:Ue.geometry,index:_e,segment:Ie};this.rBush_.insert(wu(Ge.segment),Ge)}this.updateSegmentIndices_(F,V,Ue.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},p.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},p.prototype.updateSegmentIndices_=function(n,u,r,s){this.rBush_.forEachInExtent(n.getExtent(),function(P){P.geometry===n&&(r===void 0||P.depth===void 0||_s(P.depth,r))&&P.index>u&&(P.index+=s)})},p}(S0);function X2(y,p){return y.index-p.index}function O0(y,p,n){var u=p.geometry;if(u.getType()===Mt.CIRCLE){var r=u;if(p.index===Ed){var s=uh();s&&(r=r.clone().transform(s,n));var P=Jp(r.getCenter(),Wl(y,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Wl(y,n);return pf[0]=Wl(p.segment[0],n),pf[1]=Wl(p.segment[1],n),Qv(F,pf)}function F0(y,p,n){var u=p.geometry;if(u.getType()===Mt.CIRCLE&&p.index===Ed){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Cy(r.getClosestPoint(Wl(y,n)),n)}var P=Wl(y,n);return pf[0]=Wl(p.segment[0],n),pf[1]=Wl(p.segment[1],n),Cy(Ey(P,pf),n)}function $2(){var y=Wx();return function(p,n){return y[Mt.POINT]}}var T_=W2;var K2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),H2=function(y){K2(p,y);function p(n){var u=y.call(this)||this;return u.geometries_=n||null,u.changeEventsKeys_=[],u.listenGeometriesChange_(),u}return p.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Po),this.changeEventsKeys_.length=0},p.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var n=0,u=this.geometries_.length;n<u;++n)this.changeEventsKeys_.push(uo(this.geometries_[n],Ji.CHANGE,this.changed,this))},p.prototype.clone=function(){var n=new p(null);return n.setGeometries(this.geometries_),n.applyProperties(this),n},p.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},p.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},p.prototype.computeExtent=function(n){Hp(n);for(var u=this.geometries_,r=0,s=u.length;r<s;++r)Wv(n,u[r].getExtent());return n},p.prototype.getGeometries=function(){return U0(this.geometries_)},p.prototype.getGeometriesArray=function(){return this.geometries_},p.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},p.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],N=F.getSimplifiedGeometry(n);u.push(N),N!==F&&(s=!0)}if(s){var V=new p(null);return V.setGeometriesArray(u),V}else return this.simplifiedGeometryMaxMinSquaredTolerance=n,this},p.prototype.getType=function(){return Mt.GEOMETRY_COLLECTION},p.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},p.prototype.isEmpty=function(){return this.geometries_.length===0},p.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()},p.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()},p.prototype.setGeometries=function(n){this.setGeometriesArray(U0(n))},p.prototype.setGeometriesArray=function(n){this.unlistenGeometriesChange_(),this.geometries_=n,this.listenGeometriesChange_(),this.changed()},p.prototype.applyTransform=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].applyTransform(n);this.changed()},p.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()},p.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),y.prototype.disposeInternal.call(this)},p}(Km);function U0(y){for(var p=[],n=0,u=y.length;n<u;++n)p.push(y[n].clone());return p}var N0=H2;var Y2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(p,n){var u;if(n){var r=n.dataProjection?ya(n.dataProjection):this.readProjection(p);n.extent&&r&&r.getUnits()===ac.TILE_PIXELS&&(r=ya(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},y.prototype.adaptOptions=function(p){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},p)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(p,n){return jr()},y.prototype.readFeatures=function(p,n){return jr()},y.prototype.readGeometry=function(p,n){return jr()},y.prototype.readProjection=function(p){return jr()},y.prototype.writeFeature=function(p,n){return jr()},y.prototype.writeFeatures=function(p,n){return jr()},y.prototype.writeGeometry=function(p,n){return jr()},y}(),V0=Y2;function S_(y,p,n){var u=n?ya(n.featureProjection):null,r=n?ya(n.dataProjection):null,s;if(u&&r&&!ix(u,r)?s=(p?y.clone():y).transform(p?u:r,p?r:u):s=y,p&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var N=0,V=F.length;N<V;++N)F[N]=Math.round(F[N]*P)/P;return F};s===y&&(s=y.clone()),s.applyTransform(z)}return s}var J2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q2=function(y){J2(p,y);function p(){return y.call(this)||this}return p.prototype.getType=function(){return _h.JSON},p.prototype.readFeature=function(n,u){return this.readFeatureFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readFeatureFromObject=function(n,u){return jr()},p.prototype.readFeaturesFromObject=function(n,u){return jr()},p.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readGeometryFromObject=function(n,u){return jr()},p.prototype.readProjection=function(n){return this.readProjectionFromObject(lg(n))},p.prototype.readProjectionFromObject=function(n){return jr()},p.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},p.prototype.writeFeatureObject=function(n,u){return jr()},p.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},p.prototype.writeFeaturesObject=function(n,u){return jr()},p.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},p.prototype.writeGeometryObject=function(n,u){return jr()},p}(V0);function lg(y){if(typeof y=="string"){var p=JSON.parse(y);return p||null}else return y!==null?y:null}var G0=Q2;var eE=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),tE=function(y){eE(p,y);function p(n){var u=this,r=n||{};return u=y.call(this)||this,u.dataProjection=ya(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(u.defaultFeatureProjection=ya(r.featureProjection)),u.geometryName_=r.geometryName,u.extractGeometryName_=r.extractGeometryName,u.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],u}return p.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=I_(r.geometry,u),P=new lc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},p.prototype.readFeaturesFromObject=function(n,u){var r=n,s=null;if(r.type==="FeatureCollection"){var P=n;s=[];for(var z=P.features,F=0,N=z.length;F<N;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},p.prototype.readGeometryFromObject=function(n,u){return I_(n,u)},p.prototype.readProjectionFromObject=function(n){var u=n.crs,r;return u?u.type=="name"?r=ya(u.properties.name):u.type==="EPSG"?r=ya("EPSG:"+u.properties.code):En(!1,36):r=this.dataProjection,r},p.prototype.writeFeatureObject=function(n,u){u=this.adaptOptions(u);var r={type:"Feature",geometry:null,properties:null},s=n.getId();if(s!==void 0&&(r.id=s),!n.hasProperties())return r;var P=n.getProperties(),z=n.getGeometry();return z&&(r.geometry=C_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},p.prototype.writeFeaturesObject=function(n,u){u=this.adaptOptions(u);for(var r=[],s=0,P=n.length;s<P;++s)r.push(this.writeFeatureObject(n[s],u));return{type:"FeatureCollection",features:r}},p.prototype.writeGeometryObject=function(n,u){return C_(n,this.adaptOptions(u))},p}(G0);function I_(y,p){if(!y)return null;var n;switch(y.type){case Mt.POINT:{n=iE(y);break}case Mt.LINE_STRING:{n=nE(y);break}case Mt.POLYGON:{n=lE(y);break}case Mt.MULTI_POINT:{n=aE(y);break}case Mt.MULTI_LINE_STRING:{n=oE(y);break}case Mt.MULTI_POLYGON:{n=sE(y);break}case Mt.GEOMETRY_COLLECTION:{n=rE(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return S_(n,!1,p)}function rE(y,p){var n=y.geometries.map(function(u){return I_(u,p)});return new N0(n)}function iE(y){return new _a(y.coordinates)}function nE(y){return new uc(y.coordinates)}function oE(y){return new k0(y.coordinates)}function aE(y){return new sg(y.coordinates)}function sE(y){return new R0(y.coordinates)}function lE(y){return new md(y.coordinates)}function C_(y,p){y=S_(y,!0,p);var n=y.getType(),u;switch(n){case Mt.POINT:{u=dE(y,p);break}case Mt.LINE_STRING:{u=cE(y,p);break}case Mt.POLYGON:{u=mE(y,p);break}case Mt.MULTI_POINT:{u=pE(y,p);break}case Mt.MULTI_LINE_STRING:{u=hE(y,p);break}case Mt.MULTI_POLYGON:{u=fE(y,p);break}case Mt.GEOMETRY_COLLECTION:{u=uE(y,p);break}case Mt.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function uE(y,p){var n=y.getGeometriesArray().map(function(u){var r=Ra({},p);return delete r.featureProjection,C_(u,r)});return{type:"GeometryCollection",geometries:n}}function cE(y,p){return{type:"LineString",coordinates:y.getCoordinates()}}function hE(y,p){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function pE(y,p){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function fE(y,p){var n;return p&&(n=p.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(n)}}function dE(y,p){return{type:"Point",coordinates:y.getCoordinates()}}function mE(y,p){var n;return p&&(n=p.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(n)}}var bl=tE;var ug,gE=new Uint8Array(16);function A_(){if(!ug&&(ug=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ug))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ug(gE)}var j0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function yE(y){return typeof y=="string"&&j0.test(y)}var q0=yE;var xa=[];for(cg=0;cg<256;++cg)xa.push((cg+256).toString(16).substr(1));var cg;function _E(y){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(xa[y[p+0]]+xa[y[p+1]]+xa[y[p+2]]+xa[y[p+3]]+"-"+xa[y[p+4]]+xa[y[p+5]]+"-"+xa[y[p+6]]+xa[y[p+7]]+"-"+xa[y[p+8]]+xa[y[p+9]]+"-"+xa[y[p+10]]+xa[y[p+11]]+xa[y[p+12]]+xa[y[p+13]]+xa[y[p+14]]+xa[y[p+15]]).toLowerCase();if(!q0(n))throw TypeError("Stringified UUID is invalid");return n}var Z0=_E;function vE(y,p,n){y=y||{};var u=y.random||(y.rng||A_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,p){n=n||0;for(var r=0;r<16;++r)p[n+r]=u[r];return p}return Z0(u)}var P_=vE;var ip=class extends Mo{constructor(n={}){super();this.properties={};this.options={};this.defineProperties(n),n.properties&&this.setProperties(n.properties),this.options=n,this.visible=n.visible===void 0?!0:!!n.visible,this.group=n.group,this.copyrights=n.copyrights,this.children=n.children,this.on("change:visible:group",u=>{this.group===u.target.group&&this!==u.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(r=>r.dispatchEvent(u))})}defineProperties(n={}){let{name:u,key:r,properties:s,hitTolerance:P}={...n},z=P_();Object.defineProperties(this,{name:{value:u},key:{value:r||u||z},group:{get:()=>this.get("group"),set:F=>{this.set("group",F)}},copyrights:{get:()=>this.get("copyrights"),set:F=>{let N=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",N||[])}},options:{value:n},map:{writable:!0},visible:{get:()=>this.get("visible"),set:F=>{if(F!==this.visible)if(this.set("visible",F),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(N=>N.visible)&&this.children.forEach(N=>{N.visible=!0}),this.parent&&this.group){let N=this.parent;for(;N.parent;)N=N.parent;let V=new sn("change:visible:group");V.target=this,N.dispatchEvent(V)}}else this.visible||(this.children&&this.children.forEach(N=>{N.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(N=>N.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:F=>{this.set("disabled",F)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:F=>{(this.children||[]).forEach(N=>{N.parent=void 0}),Array.isArray(F)&&F.forEach(N=>{N.parent=this}),this.set("children",F||[])}},hitTolerance:{value:P||5,writable:!0},properties:{value:{...s||{}}}})}attachToMap(n){this.detachFromMap(),this.map=n,this.children&&this.children.forEach(u=>{u.attachToMap(n)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(n,u){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:n})}flat(){return Kf(this)}};function xE(y){return class extends y{constructor(n={}){super(n);let{userInteractions:u=!0,userClickInteractions:r=!0,userHoverInteractions:s=!0,defaultUserInteractions:P=!0}=n;this.userInteractions=u,this.userClickInteractions=r,this.userHoverInteractions=s,this.defaultUserInteractions=P,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:F}=n;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&F&&this.onHover(F)}attachToMap(n){super.attachToMap(n),this.userInteractions&&this.defaultUserInteractions&&this.userClickInteractions&&this.onFeatureClick&&this.onClick(this.onFeatureClick),this.userInteractions&&this.defaultUserInteractions&&this.userHoverInteractions&&this.onFeatureHover&&this.onHover(this.onFeatureHover),this.listenEvents()}detachFromMap(){this.unlistenEvents(),super.detachFromMap()}listenEvents(){this.unlistenEvents(),this.userClickCallbacks.forEach(n=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))}),this.userHoverCallbacks.forEach(n=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))})}unlistenEvents(){Ha(this.userClickEventsKeys),Ha(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(n){this.userClickCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(n){this.userHoverCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(n){let u=this.userClickCallbacks.indexOf(n);u===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(u,1),this.map&&this.listenEvents())}unHover(n){let u=this.userHoverCallbacks.indexOf(n);u===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(u,1),this.map&&this.listenEvents())}onUserClickCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:click");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:hover");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var hg=xE;var Td=class extends hg(ip){constructor(n){super(n);this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(n){super.defineProperties(n),Object.defineProperties(this,{olLayer:{value:n.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(n){if(super.attachToMap(n),!!this.map&&(this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.on("change:visible",()=>{this.olLayer&&this.olLayer.setVisible(this.visible)})),this.olListenersKeys.push(this.map.getLayers().on("remove",u=>{u.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let u=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(r=>{r.getSource&&r.getSource()?.setAttributions(u)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(u)}}detachFromMap(){this.deactivateUserInteractions(),Ha(this.olListenersKeys),this.olLayer&&this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.removeLayer(this.olLayer),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&(this.singleClickListenerKey=this.map.on("singleclick",this.onUserClickCallback),this.olListenersKeys.push(this.singleClickListenerKey)),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&(this.pointerMoveListenerKey=this.map.on("pointermove",this.onUserMoveCallback))}deactivateUserInteractions(){Ha([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(n){return new Td({...this.options,...n})}},Is=Td;var W0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new va({color:[0,0,0,1],width:1})}),bE=new Xl({stroke:new va({color:[0,0,0,1],width:5})}),wE=new Xl({image:W0,stroke:new va({color:[255,0,0,1],width:3})}),EE=new Xl({image:W0,stroke:new va({color:[255,0,0,1],width:3,lineDash:[1,10]})}),TE=(y,p)=>{let n=y.get("minResolution"),u=y.get("maxResolution"),r=p<=n&&p>u;return n&&u&&!r?[]:y.get("mot")!=="foot"?[bE,wE]:[EE]},Sd=class extends Is{constructor(n){super(n);this.options={};this.olLayer=n.olLayer||new tp({source:new rp,style:n.style||TE})}clone(n){return new Sd({...this.options,...n})}},pg=Sd;var SE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,X0=/^([\d.]+),([\d.]+)$/,$0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,fg="stop-fetch",K0=y=>{let p=[];return y.forEach(n=>{let u=n.getGeometry()?.getCoordinates();u?.length&&p.push(...u)}),p},Id=class extends af{constructor(n={}){super(n);this.viaPoints=[];this.loading=!1;this.graphs=[];this.modify=!0;this.useRawViaPoints=!1;this.snapToClosestStation=!1;this.cacheStationData={};this.abortControllers={};this.segments=[];this.format=new bl({featureProjection:"EPSG:3857"});this.initialRouteDrag={};Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:u=>{u&&(this.set("mot",u),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:u=>{this.set("loading",u)}},modify:{get:()=>this.get("modify"),set:u=>{this.set("modify",u)}}}),this.loading=!1,this.graphs=n.graphs||[["osm",0,99]],this.mot=n.mot||"bus",this.modify=n.modify!==!1,this.routingApiParams=n.routingApiParams,this.useRawViaPoints=n.useRawViaPoints||!1,this.snapToClosestStation=n.snapToClosestStation||!1,this.apiKey=n.apiKey,this.stopsApiKey=n.stopsApiKey||this.apiKey,this.stopsApiUrl=n.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Zf({...n}),this.routingLayer=n.routingLayer||new pg({name:"routing-layer",style:n.style}),this.onRouteError=n.onRouteError||(u=>{this.dispatchEvent(new sn("change:route")),this.reset(),console.error(u)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction()}static getGraphsResolutions(n,u){let r=u.getView();return n.map(([,s,P])=>[r.getResolutionForZoom(s),r.getResolutionForZoom(P||s+1)])}addViaPoint(n,u=-1,r=0){this.viaPoints.splice(u===-1?this.viaPoints.length:u,r,n),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}removeViaPoint(n=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[n]&&this.viaPoints.splice(n,1),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}setViaPoints(n){this.viaPoints=[...n],this.drawRoute(),this.dispatchEvent(new sn("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new sn("change:route"))}abortRequests(){this.graphs.forEach(n=>{let u=n[0];this.abortControllers[u]&&this.abortControllers[u].abort(),this.abortControllers[u]=new AbortController}),this.abortControllers[fg]?.abort(),this.abortControllers[fg]=new AbortController,this.loading=!1}drawRoute(){if(this.abortRequests(),this.routingLayer?.olLayer?.getSource()?.clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[fg]);let n=this.viaPoints.map(u=>{if(Array.isArray(u)){let r=this.map?.getView().getProjection(),[s,P]=lh(u,r);return this.snapToClosestStation?[`@${P}`,s]:[P,s]}return this.useRawViaPoints?u:`!${u}`});return this.loading=!0,this.routingLayer?.olLayer?.getSource()?.clear(),this.viaPoints.forEach((u,r)=>this.drawViaPoint(u,r,this.abortControllers[fg])),Promise.all(this.graphs.map(([u],r)=>{let{signal:s}=this.abortControllers[u];return this.api?this.api.route({graph:u,via:`${n.join("|")}`,mot:this.mot,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams||{}},{signal:s}).then(P=>{if(this.segments=this.format.readFeatures(P),this.mot==="foot"){let N=this.segments.reduce((V,me)=>{let _e=me.get("trg");return V.find(Se=>Se[0]===_e[0]&&Se[1]===_e[1])?V:[...V,_e]},[]);this.segments=N.map(V=>{let me=this.segments.filter(Se=>{let Ue=Se.get("trg");return Ue[0]===V[0]&&Ue[1]===V[1]}),_e=K0(me);return new lc({geometry:new uc(_e)})})}let z=K0(this.segments),F=new lc({geometry:new uc(z)});F.set("graph",u),F.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[r]?.length>=2&&(F.set("minResolution",this.graphsResolutions[r][0]),F.set("maxResolution",this.graphsResolutions[r][1])),this.routingLayer?.olLayer?.getSource()?.addFeature(F),this.loading=!1}).catch(P=>{P.name!=="AbortError"&&(this.segments=[],this.dispatchEvent(new sn("error")),this.onRouteError(P,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(n,u,r){let s=new lc;if(s.set("viaPointIdx",u),Array.isArray(n))return s.setGeometry(new _a(n)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s);if(!this.useRawViaPoints||$0.test(n)){let V,me;return this.useRawViaPoints?[,V,,me]=$0.exec(n)||[]:[V,me]=n.split("$"),fetch(`${this.stopsApiUrl}lookup/${V}?key=${this.stopsApiKey}`,{signal:r.signal}).then(_e=>_e.json()).then(_e=>{let{coordinates:Se}=_e.features[0].geometry;return this.cacheStationData[n]=co(Se),s.set("viaPointTrack",me),s.setGeometry(new _a(co(Se))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(_e=>{_e.name!=="AbortError"&&(this.dispatchEvent(new sn("error")),this.onRouteError(_e,this),this.loading=!1)})}if(this.useRawViaPoints&&X0.test(n)){let[V,me]=X0.exec(n)||[],_e=co([parseFloat(me),parseFloat(V)],this.map?.getView().getProjection());return s.setGeometry(new _a(_e)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}let[,P,,z,F,,N]=SE.exec(n)||[];if(F&&z){let V=co([parseFloat(F),parseFloat(z)],this.map?.getView().getProjection());return s.set("viaPointTrack",N),s.setGeometry(new _a(V)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}return P?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${P}&limit=1`,{signal:r.signal}).then(V=>V.json()).then(V=>{let{coordinates:me}=V.features[0].geometry;return this.cacheStationData[n]=co(me),s.set("viaPointTrack",N),s.setGeometry(new _a(co(me))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(V=>(this.dispatchEvent(new sn("error")),this.onRouteError(V,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(n){let r=n.target.getFeaturesAtPixel(n.pixel).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("viaPointIdx")!==void 0);if(r){this.removeViaPoint(r.get("viaPointIdx"));return}this.addViaPoint(n.coordinate)}onModifyStart(n){let u=-1,r=n.features.getArray().find(P=>P.getGeometry()?.getType()===Mt.LINE_STRING);if(r&&r.getGeometry()&&n.mapBrowserEvent.coordinate){let P=yl(new _a(r.getGeometry()?.getClosestPoint(n.mapBrowserEvent.coordinate)).getExtent(),.001);u=this.segments.findIndex(z=>z.getGeometry()?.intersectsExtent(P))}let s=(n.features.getArray().filter(P=>P.getGeometry()?.getType()===Mt.POINT)||[])[0];this.initialRouteDrag={viaPoint:s,oldRoute:r&&r.clone(),segmentIndex:u}}onModifyEnd(n){let u=n.mapBrowserEvent.coordinate,{oldRoute:r,viaPoint:s,segmentIndex:P}=this.initialRouteDrag||{};return s?this.addViaPoint(u,s.get("viaPointIdx"),1):r?P===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(u,(P||0)+1):this.addViaPoint(u,0,1)}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new T_({source:this.routingLayer?.olLayer?.getSource()||void 0,pixelTolerance:4,hitDetection:this.routingLayer?.olLayer,deleteCondition:n=>{let r=n.target.getFeaturesAtPixel(n.pixel,{hitTolerance:5}).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("index"));return A0(n)&&r?(this.removeViaPoint(r.get("index")),!0):!1}}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}addListeners(){!this.modify||(this.removeListeners(),this.onMapClickKey=this.map?.on("singleclick",this.onMapClick))}removeListeners(){this.onMapClickKey&&Ha(this.onMapClickKey)}activate(){super.activate(),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Id.getGraphsResolutions(this.graphs,this.map),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.routingLayer?.attachToMap(this.map),this.modifyInteraction&&this.map.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}deactivate(){this.map&&(this.routingLayer?.detachFromMap(),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}render(){}},H0=Id;var M_=class extends af{constructor(n){super(n);let{apiParams:u,apiKey:r,url:s,placeholder:P}=n||{};this.apiParams={limit:20,...u||{}},this.placeholder=P||"Search for a stop...";let z={apiKey:r};s&&(z.url=s),this.api=new Wf(z),this.abortController=new AbortController}deactivate(){}render(n){let u=n?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=u.length?"block":"none",this.suggestionsElt.innerHTML="",u.forEach(r=>{let s=document.createElement("div");s.innerHTML=r?.properties?.name,s.onclick=()=>{this.onSuggestionClick(r)},Object.assign(s.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(s)}))}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-search",Object.assign(this.element.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px"}),this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=n=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(n.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),this.element.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",overflowY:"auto",cursor:"pointer"}),this.element.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{display:"none",position:"absolute",right:"0",padding:"0 10px",fontSize:"200%",cursor:"pointer"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),this.element.appendChild(this.clearElt)}search(n,u){return(n!==void 0||n!==null)&&(this.apiParams.q=n),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,u&&{signal:u.signal}).then(r=>{this.render(r)}).catch(()=>{this.render()})}onSuggestionClick(n){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},Y0=M_;var k_=class extends Y0{onSuggestionClick(p){let n=co(p.geometry.coordinates);this.map.getView().setCenter(n)}},J0=k_;var e1=Gp(Q0());var z_=class extends Is{constructor(n){super(n);this.olLayer=new Hh({source:new cf({}),render:this.getOlLayerRender()}),this.styleUrl=n.url,this.apiKey=n.apiKey,this.apiKeyName=n.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(n){super.attachToMap(n),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=void 0),this.loaded=!1,super.detachFromMap()}loadMbMap(){if(this.olListenersKeys.push(this.map?.on("change:target",()=>{this.loadMbMap()})),!this.map?.getTargetElement())return;if(!this.visible){this.olListenersKeys.push(this.once("change:visible",()=>{this.loadMbMap()}));return}let n=document.createElement("div");if(n.style.position="absolute",n.style.width="100%",n.style.height="100%",!this.styleUrl){console.error(`No styleUrl defined for mapbox layer: ${this.styleUrl}`);return}!this.apiKey&&!this.styleUrl?.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let u=this.getMapboxMapClass();this.mbMap=new u({style:Zh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:n,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new sn("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=oc(n.target)||[];this.copyrights?.toString()!==u.toString()&&(this.copyrights=u,this.olLayer?.getSource()?.setAttributions(u))}getFeatureInfoAtCoordinate(n,u){if(!u||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=n&&this.mbMap.project(lh(n)),s;if(this.hitTolerance){let{x:z,y:F}=r;s=[{x:z-this.hitTolerance,y:F-this.hitTolerance},{x:z+this.hitTolerance,y:F+this.hitTolerance}]}let P=this.mbMap.queryRenderedFeatures(s||r,u).map(z=>{let F=this.format.readFeature(z);return F&&F.set("mapboxFeature",z),F});return Promise.resolve({layer:this,features:P,coordinate:n})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let n=document.createElement("div");return()=>n}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},dg=z_;var np=class extends dg{attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(u){console.warn(u)}}))}loadMbMap(){let[n,u]=this.map?.getView().getCenter()||[];if((!n||!u)&&(n=0,u=0),this.renderState={center:[n,u],zoom:void 0,rotation:void 0,visible:void 0,opacity:void 0,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{!this.mbMap||(this.mbMap.resize(),this.copyrights=oc(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let r=this.mbMap.getCanvas();r&&(this.options.tabIndex?r.setAttribute("tabindex",`${this.options.tabIndex}`):r.removeAttribute("tabindex"))}getOlLayerRender(){return tf(this)}getMapboxMapClass(){return e1.Map}clone(n){return new np({...this.options,...n})}};var i1=Gp(r1());var op=class extends dg{getOlLayerRender(){return ef(this)}getMapboxMapClass(){return i1.Map}clone(n){return new op({...this.options,...n})}};var Cd=class extends Is{constructor(n){super(n);this.mapboxLayer=n.mapboxLayer,this.disabled=!1,this.styleLayersFilter=n.styleLayersFilter,this.beforeId=n.beforeId,this.featureInfoFilter=n.featureInfoFilter||(u=>u),this.queryRenderedLayersFilter=n.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(n.styleLayer?[n.styleLayer]:n.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),n.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof n.filters=="function"?n.filters(this):n.filters)}),!this.styleLayersFilter&&this.styleLayers&&(this.styleLayersFilter=u=>!!this.styleLayers?.find(r=>u.id===r.id))}attachToMap(n){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(n),super.attachToMap(n),!this.map||!this.mapboxLayer)return;let{mbMap:u}=this.mapboxLayer;if(!u){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(n)}));return}this.mapboxLayer.loaded||u.isStyleLoaded()||u.loaded()?this.onLoad():u.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",r=>{this.applyLayoutVisibility(r)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:n}=this.mapboxLayer;n.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r,source:s}=u;n.getSource(s)&&r&&!n.getLayer(r)&&n.addLayer(u,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r}=u;r&&n.getLayer(r)&&n.removeLayer(r)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer,u=n.getStyle();if(u&&this.styleLayersFilter){let r=u.layers.filter(this.styleLayersFilter);this.disabled=!r.length}}getFeatureInfoAtCoordinate(n){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:n,features:[],layer:this});let{mbMap:u}=this.mapboxLayer;if(!u.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=this.styleLayers||[];return this.styleLayersFilter&&(r=u.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(r=u.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(n,{layers:r.map(s=>s&&s.id),validate:!1}).then(s=>{let P=s.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(P),{...s,features:P,layer:this}})}setFilter(n){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(({id:r})=>{r&&n&&u.getLayer(r)&&u.setFilter(r,n)})}setHoverState(n,u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:r}=this.mapboxLayer;!n||!r||n.forEach(s=>{let{source:P,sourceLayer:z}=s.get("mapboxFeature")||{};if(!P&&!z||!s.getId()){s.getId()||console.warn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/mapbox/tippecanoe#adding-calculated-attributes.",s.getId(),s.getProperties());return}r.setFeatureState({id:s.getId(),source:P,sourceLayer:z},{hover:u})})}select(n=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=n,this.setHoverState(this.selectedFeatures||[],!0)}highlight(n=[]){let u=this.highlightedFeatures?.filter(r=>!(this.selectedFeatures||[]).map(s=>s.getId()).includes(r.getId()))||[];this.setHoverState(u,!1),this.highlightedFeatures=n,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(n){let{visible:u}=this,r=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:s}=this.mapboxLayer,P=s.getStyle();if(!!P&&r){let z=u?"visible":"none";for(let F=0;F<P.layers.length;F+=1){let N=P.layers[F];r(N)&&s.getLayer(N.id)&&s.setLayoutProperty(N.id,"visibility",z)}}}clone(n){return new Cd({...this.options,...n})}},n1=Cd;var N_=Gp(l1()),V_=Gp(f1());function aT(y){return class extends y{constructor(u){super({hitTolerance:10,...u});this.debug=u.debug||!1,this.mode=u.mode||ia.TOPOGRAPHIC,this.api=u.api||new $f(u),this.tenant=u.tenant||"",this.minZoomInterpolation=u.minZoomInterpolation||8,this.format=new bl;let r=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"];this.motsByZoom=u.motsByZoom||[r],this.getMotsByZoom=s=>u.getMotsByZoom&&u.getMotsByZoom(s,this.motsByZoom)||this.motsByZoom[s]||this.motsByZoom[this.motsByZoom.length-1],this.generalizationLevelByZoom=u.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=s=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(s,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[s],this.renderTimeIntervalByZoom=u.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=s=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(s,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[s],this.isUpdateBboxOnMoveEnd=u.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,50,{leading:!0,trailing:!0,maxWait:5e3}),this.onFeatureHover=this.onFeatureHover.bind(this),this.onFeatureClick=this.onFeatureClick.bind(this),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}defineProperties(u){let{style:r,speed:s,pixelRatio:P,hoverVehicleId:z,selectedVehicleId:F,filter:N,sort:V,time:me,live:_e,canvas:Se,styleOptions:Ue}=u,He=s||1,Ie=me||new Date,Ge=r||Kh;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:Se||document.createElement("canvas")},style:{get:()=>Ge,set:Je=>{Ge=Je,this.renderTrajectories()}},styleOptions:{value:{...rf,...Ue||{}}},speed:{get:()=>He,set:Je=>{He=Je,this.start()}},filter:{value:N,writable:!0},sort:{value:V,writable:!0},live:{value:_e===!1?_e:!0,writable:!0},time:{get:()=>Ie,set:Je=>{Ie=Je&&Je.getTime?Je:new Date(Je),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:F,writable:!0},pixelRatio:{value:P||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:u.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:u.useThrottle!==!1,writable:!0},useDebounce:{value:u.useDebounce||!1,writable:!0}})}attachToMap(u){super.attachToMap(u),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",r=>{r.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas&&(this.canvas.getContext("2d")?.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap())}start(){this.stop(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox()}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close()}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(u,r=!1){if(!this.map||!this.trajectories)return!1;let s=this.live?Date.now():this.time?.getTime(),P=Object.values(this.trajectories);return this.sort&&P.sort(this.sort),!this.canvas||!this.style||(this.renderState=Hf(this.canvas,P,this.style,{...u,pixelRatio:this.pixelRatio||1,time:s},{filter:this.filter,noInterpolate:(u.zoom||0)<this.minZoomInterpolation?!0:r,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(u,r){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),u&&(!r&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(u,r)}):!r&&this.useDebounce?this.debounceRenderTrajectories(u,r):!r&&this.useThrottle?this.throttleRenderTrajectories(u,r):this.renderTrajectoriesInternal(u,r))}setBbox(u,r){if(this.trajectories&&u&&r){let P=Object.keys(this.trajectories);for(let z=P.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[P[z]],u,r)}if(!u)return;let s=[...u];this.isUpdateBboxOnMoveEnd&&r&&(s.push(r),this.tenant&&s.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(r),this.generalizationLevel&&s.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(r),this.mots&&s.push(`mots=${this.mots}`)),this.api.bbox=s}setMode(u){this.mode!==u&&(this.mode=u,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(u=0){let r=u!==void 0?Math.round(u):-1,s=this.getRenderTimeIntervalByZoom(r)||25,P=Math.max(25,s/(this.speed||1)),z=Math.min(P,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,F]=this.api.buffer;this.api.buffer=[z,F]}return P}getVehicle(u){return this.trajectories&&Object.values(this.trajectories).filter(u)||[]}getFeatureInfoAtCoordinate(u,r){let{resolution:s,nb:P}=r,z=yl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let N=[];for(let V=0;V<F.length&&(F[V].properties.coordinate&&Kp(z,F[V].properties.coordinate)&&N.push(F[V]),N.length!==P);V+=1);return Promise.resolve({layer:this,features:N.map(V=>this.format.readFeature(V)),coordinate:u})}getTrajectoryInfos(u){let r=[this.api.getStopSequence(u),this.api.getFullTrajectory(u,this.mode,this.generalizationLevel)];return Promise.all(r).then(([s,P])=>({stopSequence:s,fullTrajectory:P}))}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!Lo(r,z)||this.mots&&!this.mots.includes(P)||P!=="rail"&&s<9?(this.removeTrajectory(u),!0):!1}addTrajectory(u){this.filter&&!this.filter(u)||(this.trajectories||(this.trajectories={}),this.trajectories[u.properties.train_id]=u,this.renderTrajectories())}removeTrajectory(u){let r;typeof u!="string"?r=u?.properties?.train_id:r=u,this.trajectories&&delete this.trajectories[r]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?this.stop():this.start())}onTrajectoryMessage(u){if(!u.content)return;let r=u.content,{geometry:s,properties:{train_id:P,time_since_update:z,raw_coordinates:F}}=r;z<0||this.purgeTrajectory(r)||(this.debug&&this.mode===ia.TOPOGRAPHIC&&F?r.properties.olGeometry={type:"Point",coordinates:co(F,this.map.getView().getProjection())}:r.properties.olGeometry=this.format.readGeometry(s),r.properties.timeOffset=Date.now()-u.timestamp,this.addTrajectory(r))}onDeleteTrajectoryMessage(u){!u.content||this.removeTrajectory(u.content)}onFeatureHover(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=P,this.renderTrajectories(!0))}}}var gg=aT;var sT=new Xl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),lT=(y,p,n)=>{let u="#ffffff",r=y.get("type"),s=y.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),u=s||n?.getBgColor(r),u=/#ffffff/i.test(u)?"#ff0000":u,[sT,new Xl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:u})}),stroke:new va({color:u,width:4})})]},yg=lT;var uT=new Xl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),cT=new Xl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new va({color:"#a0a0a0",width:4})}),hT=()=>[uT,cT],d1=hT;var pT=new bl,Ad=class extends gg(Is){constructor(n){super({...n});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!n.allowRenderWhenAnimating,this.olLayer=n.olLayer||new x_({layers:[new tp({source:new rp({features:[]}),style:(u,r)=>(n.fullTrajectoryStyle||yg)(u,r,this.styleOptions)}),new Hh({source:new cf({}),render:u=>{if(this.container||(this.container=document.createElement("div"),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",this.transformContainer=document.createElement("div"),this.transformContainer.style.position="absolute",this.transformContainer.style.width="100%",this.transformContainer.style.height="100%",this.container.appendChild(this.transformContainer),this.canvas&&(this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.transformOrigin="top left",this.transformContainer.appendChild(this.canvas))),this.renderedViewState){let{center:r,resolution:s,rotation:P}=u.viewState,{center:z,resolution:F,rotation:N}=this.renderedViewState;if(F/s>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let V=this.map.getPixelFromCoordinate(z),me=this.map.getPixelFromCoordinate(r);this.transformContainer.style.transform=Rv(V[0]-me[0],V[1]-me[1],F/s,F/s,P-N,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],u=>{let r=(u.map||u.target).getView();if(r.getAnimating()||r.getInteracting())return;let s=r.getZoom();this.currentZoom!==s&&this.onZoomEnd(),this.currentZoom=s,this.onMoveEnd(u)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(n){if(this.map&&this.canvas){let u=this.canvas.getContext("2d"),r=this.map.getPixelFromCoordinate(n);return!!u?.getImageData(r[0]*(this.pixelRatio||1),r[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(n){if(!this.map)return;let u=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:u.calculateExtent(),resolution:u.getResolution(),rotation:u.getRotation(),zoom:u.getZoom(),pixelRatio:this.pixelRatio},n)}renderTrajectoriesInternal(n,u){if(!this.map)return!1;let r=!1;return r=(this.allowRenderWhenAnimating?!1:this.map.getView().getAnimating()||this.map.getView().getInteracting())?!1:super.renderTrajectoriesInternal(n,u),r&&(this.renderedViewState={...n},this.transformContainer&&(this.transformContainer.style.transform="")),r}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(n,u={}){let r=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(n,{resolution:r,...u})}onMoveEnd(n){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(){super.onZoomEnd()}onFeatureHover(n,u,r){super.onFeatureHover(n,u,r),this.map.getTargetElement().style.cursor=n.length?"pointer":"auto"}onFeatureClick(n,u,r){super.onFeatureClick(n,u,r),!n.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(n,u,r){return super.purgeTrajectory(n,u||this.map.getView().calculateExtent(),r||this.map.getView().getZoom())}setBbox(n,u){let r=n,s=u;!r&&this.isUpdateBboxOnMoveEnd&&(r=n||this.map.getView().calculateExtent(),s=Math.floor(this.map.getView().getZoom())),super.setBbox(r,s)}highlightTrajectory(n){this.api.getFullTrajectory(n,this.mode,this.generalizationLevel).then(u=>{let r=u.content;if(this.vectorLayer.getSource().clear(),!r||!r.features||!r.features.length)return;let s=pT.readFeatures(r);this.vectorLayer.getSource().addFeatures(s)})}clone(n){return new Ad({...this.options,...n})}},m1=Ad;var Pd=class extends Is{getFeatureInfoAtCoordinate(p){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(p);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:p})}clone(p){return new Pd({...this.options,...p})}},g1=Pd;var Md=class extends Is{constructor(n){super(n);this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(n){if(!this.map)return;let u=this.map.getView().getProjection(),r=this.map.getView().getResolution();if(r&&u&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(n,r,u,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(n){this.abortController?.abort(),this.abortController=new AbortController;let{signal:u}=this.abortController,r=this.getFeatureInfoUrl(n);return r?fetch(r,{signal:u}).then(s=>s.json()).then(s=>s.features).then(s=>({layer:this,coordinate:n,features:s.map(P=>this.format.readFeature(P))})).catch(()=>Promise.resolve({features:[],coordinate:n,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:n,layer:this}))}clone(n){return new Md({...this.options,...n})}},y1=Md;var wg={};ay(wg,{CopyrightControl:()=>_1,Layer:()=>vg,RealtimeAPI:()=>$f,RealtimeLayer:()=>L1,RealtimeModes:()=>ia,RoutingAPI:()=>Zf,StopsAPI:()=>Wf,compareDepartures:()=>id,createRealtimeFilters:()=>hy,debounceDeparturesMessages:()=>Ay,debounceWebsocketMessages:()=>Xf,getCircleCanvas:()=>Oy,getDelayBgCanvas:()=>zy,getDelayTextCanvas:()=>Dy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>Kf,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getMercatorResolution:()=>bg,getSourceCoordinates:()=>Rd,getTextCanvas:()=>Fy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Zh,pad:()=>zm,realtimeConfig:()=>rf,realtimeDefaultStyle:()=>Kh,realtimeDelayStyle:()=>By,realtimeSimpleStyle:()=>Uy,removeDuplicate:()=>Wh,renderTrajectories:()=>Hf,sortAndFilterDepartures:()=>nd,sortByDelay:()=>py});var G_=class extends Wm{constructor(p){super(p),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return oc(this.map)}},_1=G_;var kd=class extends hg(ip){attachToMap(n){super.attachToMap(n),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ha(this.onChangeVisibleKey)),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&this.map.on("click",this.onUserClickCallback),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&this.map.on("mousemove",this.onUserMoveCallback)}deactivateUserInteractions(){this.map&&(this.map.off("mousemove",this.onUserMoveCallback),this.map.off("click",this.onUserClickCallback))}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}getMercatorExtent(){let n=this.map.getBounds().toArray();return td([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new kd({...this.options,...n})}},vg=kd;var jo=63710088e-1,v1={centimeters:jo*100,centimetres:jo*100,degrees:jo/111325,feet:jo*3.28084,inches:jo*39.37,kilometers:jo/1e3,kilometres:jo/1e3,meters:jo,metres:jo,miles:jo/1609.344,millimeters:jo*1e3,millimetres:jo*1e3,nauticalmiles:jo/1852,radians:1,yards:jo*1.0936},L5={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/jo,yards:1.0936133};function x1(y,p,n){n===void 0&&(n={});var u={type:"Feature"};return(n.id===0||n.id)&&(u.id=n.id),n.bbox&&(u.bbox=n.bbox),u.properties=p||{},u.geometry=y,u}function xh(y,p,n){if(n===void 0&&(n={}),!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!j_(y[0])||!j_(y[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:y};return x1(u,p,n)}function fT(y,p){p===void 0&&(p="kilometers");var n=v1[p];if(!n)throw new Error(p+" units is invalid");return y*n}function dT(y,p){p===void 0&&(p="kilometers");var n=v1[p];if(!n)throw new Error(p+" units is invalid");return y/n}function b1(y){var p=y%(2*Math.PI);return p*180/Math.PI}function ap(y){var p=y%360;return p*Math.PI/180}function xg(y,p,n){if(p===void 0&&(p="kilometers"),n===void 0&&(n="kilometers"),!(y>=0))throw new Error("length must be a positive number");return fT(dT(y,p),n)}function j_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function q_(y){return!!y&&y.constructor===Object}function Ld(y,p,n){if(y!==null)for(var u,r,s,P,z,F,N,V=0,me=0,_e,Se=y.type,Ue=Se==="FeatureCollection",He=Se==="Feature",Ie=Ue?y.features.length:1,Ge=0;Ge<Ie;Ge++){N=Ue?y.features[Ge].geometry:He?y.geometry:y,_e=N?N.type==="GeometryCollection":!1,z=_e?N.geometries.length:1;for(var Je=0;Je<z;Je++){var rt=0,_t=0;if(P=_e?N.geometries[Je]:N,P!==null){F=P.coordinates;var yt=P.type;switch(V=n&&(yt==="Polygon"||yt==="MultiPolygon")?1:0,yt){case null:break;case"Point":if(p(F,me,Ge,rt,_t)===!1)return!1;me++,rt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(p(F[u],me,Ge,rt,_t)===!1)return!1;me++,yt==="MultiPoint"&&rt++}yt==="LineString"&&rt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-V;r++){if(p(F[u][r],me,Ge,rt,_t)===!1)return!1;me++}yt==="MultiLineString"&&rt++,yt==="Polygon"&&_t++}yt==="Polygon"&&rt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(_t=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-V;s++){if(p(F[u][r][s],me,Ge,rt,_t)===!1)return!1;me++}_t++}rt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(Ld(P.geometries[u],p,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function mT(y,p){p===void 0&&(p={});var n=0,u=0,r=0;return Ld(y,function(s){n+=s[0],u+=s[1],r++},!0),xh([n/r,u/r],p.properties)}var w1=mT;function Mu(y){if(!y)throw new Error("coord is required");if(!Array.isArray(y)){if(y.type==="Feature"&&y.geometry!==null&&y.geometry.type==="Point")return y.geometry.coordinates;if(y.type==="Point")return y.coordinates}if(Array.isArray(y)&&y.length>=2&&!Array.isArray(y[0])&&!Array.isArray(y[1]))return y;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function E1(y){if(Array.isArray(y))return y;if(y.type==="Feature"){if(y.geometry!==null)return y.geometry.coordinates}else if(y.coordinates)return y.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function gT(y,p,n){n===void 0&&(n={});var u;n.final?u=T1(Mu(p),Mu(y)):u=T1(Mu(y),Mu(p));var r=u>180?-(360-u):u;return r}function T1(y,p){var n=ap(y[1]),u=ap(p[1]),r=ap(p[0]-y[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),P=Math.atan2(r,s);return(b1(P)+360)%360}var S1=gT;function yT(y,p,n){n===void 0&&(n={});var u=Mu(y),r=Mu(p);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=_T(u,r),P=xg(s,"meters",n.units);return P}function _T(y,p,n){n=n===void 0?jo:Number(n);var u=n,r=y[1]*Math.PI/180,s=p[1]*Math.PI/180,P=s-r,z=Math.abs(p[0]-y[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var F=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),N=Math.abs(F)>1e-11?P/F:Math.cos(r),V=Math.sqrt(P*P+N*N*z*z),me=V*u;return me}var I1=yT;function vT(y,p,n,u){u===void 0&&(u={});var r=p<0,s=xg(Math.abs(p),u.units,"meters");r&&(s=-Math.abs(s));var P=Mu(y),z=xT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,xh(z,u.properties)}function xT(y,p,n,u){u=u===void 0?jo:Number(u);var r=p/u,s=y[0]*Math.PI/180,P=ap(y[1]),z=ap(n),F=r*Math.cos(z),N=P+F;Math.abs(N)>Math.PI/2&&(N=N>0?Math.PI-N:-Math.PI-N);var V=Math.log(Math.tan(N/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(V)>1e-11?F/V:Math.cos(P),_e=r*Math.sin(z)/me,Se=s+_e;return[(Se*180/Math.PI+540)%360-180,N*180/Math.PI]}var C1=vT;function bT(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return A1(y);case"FeatureCollection":return wT(y);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Z_(y);default:throw new Error("unknown GeoJSON type")}}function A1(y){var p={type:"Feature"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:p[n]=y[n]}}),p.properties=P1(y.properties),p.geometry=Z_(y.geometry),p}function P1(y){var p={};return y&&Object.keys(y).forEach(function(n){var u=y[n];typeof u=="object"?u===null?p[n]=null:Array.isArray(u)?p[n]=u.map(function(r){return r}):p[n]=P1(u):p[n]=u}),p}function wT(y){var p={type:"FeatureCollection"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"features":return;default:p[n]=y[n]}}),p.features=y.features.map(function(n){return A1(n)}),p}function Z_(y){var p={type:y.type};return y.bbox&&(p.bbox=y.bbox),y.type==="GeometryCollection"?(p.geometries=y.geometries.map(function(n){return Z_(n)}),p):(p.coordinates=M1(y.coordinates),p)}function M1(y){var p=y;return typeof p[0]!="object"?p.slice():p.map(function(n){return M1(n)})}var k1=bT;function ET(y,p,n){if(n=n||{},!q_(n))throw new Error("options is invalid");var u=n.pivot,r=n.mutate;if(!y)throw new Error("geojson is required");if(p==null||isNaN(p))throw new Error("angle is required");return p===0||(u||(u=w1(y)),(r===!1||r===void 0)&&(y=k1(y)),Ld(y,function(s){var P=S1(u,s),z=P+p,F=I1(u,s),N=E1(C1(u,F,z));s[0]=N[0],s[1]=N[1]})),y}var W_=ET;var TT=(y,p=1)=>{let{width:n,height:u}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:u/p}),P=y.unproject({x:n/p,y:u/p}),z=y.unproject({x:n/p,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Rd=TT;var ST=y=>{let p=y.getBounds().toArray(),n=co(p[0]),u=co(p[1]),r=[...n,...u],{width:s,height:P}=y.getCanvas(),z=bs(r)/s,F=Eu(r)/P;return Math.max(z,F)},bg=ST;var X_=class extends gg(vg){constructor(p={}){super({...p}),this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this)}attachToMap(p,n){!p||(super.attachToMap(p),this.source={type:"canvas",canvas:this.canvas,coordinates:Rd(p,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=n,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},p.isStyleLoaded()&&this.onLoad(),this.map.on("load",this.onLoad),this.listeners=[this.on("change:visible",this.onVisibilityChange)])}detachFromMap(){this.map&&(this.map.off("load",this.onLoad),this.listeners.forEach(p=>{Ha(p)}),this.map.style&&this.map.getLayer(this.key)&&this.map.removeLayer(this.key),this.map.style&&this.map.getSource(this.key)&&this.map.removeSource(this.key)),super.detachFromMap()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map&&(this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd),this.map.off("zoomend",this.onZoomEnd))}onLoad(){this.map.getSource(this.key)||this.map.addSource(this.key,this.source),this.map.getLayer(this.key)||this.map.addLayer(this.layer,this.beforeId)}onUserMoveCallback(p){super.onUserMoveCallback({coordinate:co(p.lngLat.toArray()),...p})}renderTrajectories(p=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:n,height:u}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:u/this.pixelRatio}),P=this.map.unproject({x:n/this.pixelRatio,y:0}),z=W_(xh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=W_(xh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,N=[...co(z),...co(F)],V=bs(N)/(n/this.pixelRatio),me=Eu(N)/(u/this.pixelRatio),_e=Math.max(V,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:co([r.lng,r.lat]),extent:N,resolution:_e,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,p)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(p,n={}){let u=bg(this.map);return super.getFeatureInfoAtCoordinate(p,{resolution:u,...n})}onVisibilityChange(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}purgeTrajectory(p,n,u){return super.purgeTrajectory(p,n||this.getMercatorExtent(),u||Math.floor(this.map.getZoom()+1))}setBbox(p,n){let u=p,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=p||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(p,n=!1){let u=super.renderTrajectoriesInternal(p,n);if(u&&this.map.style){let r=Rd(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return u}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(p,n,u){super.onFeatureHover(p,n,u),this.map.getCanvasContainer().style.cursor=p.length?"pointer":"auto"}},L1=X_;var $_={ol:_g,mapbox:wg};typeof window<"u"&&(window.mbt=$_);var R3=$_;})();
1082
+ `){Er+=Vr,Vr=0,Jt=_e*yt+jt*Se,++br;continue}var Yr=Ue[xr+1]||F.font;Yr!==Sr&&(r&&or.push("font",Yr),u&&At.push("font",Yr),Sr=Yr),Vr=Math.max(Vr,rt[zr]);var vi=[Vt,Jt+jt*Je[zr]+_e*(Je[zr]-_t[br]),.5*(Se+Vr)+Er];Jt+=Je[zr],r&&or.push("strokeText",vi),u&&At.push("fillText",vi),++zr}return Array.prototype.push.apply(ct,or),Array.prototype.push.apply(ct,At),this.labels_[s]=Lt,Lt},y.prototype.replayTextBackground_=function(p,n,u,r,s,P,z){p.beginPath(),p.moveTo.apply(p,n),p.lineTo.apply(p,u),p.lineTo.apply(p,r),p.lineTo.apply(p,s),p.lineTo.apply(p,n),P&&(this.alignFill_=P[2],this.fill_(p)),z&&(this.setStrokeStyle_(p,z),p.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(p,n,u,r,s,P,z,F,N,V,me,_e,Se,Ue,He,Ie){z*=_e[0],F*=_e[1];var Ge=u-z,Je=r-F,rt=s+N>p?p-N:s,_t=P+V>n?n-V:P,yt=Ue[3]+rt*_e[0]+Ue[1],ct=Ue[0]+_t*_e[1]+Ue[2],Tt=Ge-Ue[3],St=Je-Ue[0];(He||me!==0)&&(gh[0]=Tt,yh[0]=Tt,gh[1]=St,yc[1]=St,yc[0]=Tt+yt,_c[0]=yc[0],_c[1]=St+ct,yh[1]=_c[1]);var Lt;return me!==0?(Lt=vs(za(),u,r,1,1,me,-u,-r),bo(Lt,gh),bo(Lt,yc),bo(Lt,_c),bo(Lt,yh),sh(Math.min(gh[0],yc[0],_c[0],yh[0]),Math.min(gh[1],yc[1],_c[1],yh[1]),Math.max(gh[0],yc[0],_c[0],yh[0]),Math.max(gh[1],yc[1],_c[1],yh[1]),uf)):sh(Math.min(Tt,Tt+yt),Math.min(St,St+ct),Math.max(Tt,Tt+yt),Math.max(St,St+ct),uf),Se&&(Ge=Math.round(Ge),Je=Math.round(Je)),{drawImageX:Ge,drawImageY:Je,drawImageW:rt,drawImageH:_t,originX:N,originY:V,declutterBox:{minX:uf[0],minY:uf[1],maxX:uf[2],maxY:uf[3],value:Ie},canvasTransform:Lt,scale:_e}},y.prototype.replayImageOrLabel_=function(p,n,u,r,s,P,z){var F=!!(P||z),N=r.declutterBox,V=p.canvas,me=z?z[2]*r.scale[0]/2:0,_e=N.minX-me<=V.width/n&&N.maxX+me>=0&&N.minY-me<=V.height/n&&N.maxY+me>=0;return _e&&(F&&this.replayTextBackground_(p,gh,yc,_c,yh,P,z),Vx(p,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(p){if(this.alignFill_){var n=bo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;p.save(),p.translate(n[0]%u,n[1]%u),p.rotate(this.viewRotation_)}p.fill(),this.alignFill_&&p.restore()},y.prototype.setStrokeStyle_=function(p,n){p.strokeStyle=n[1],p.lineWidth=n[2],p.lineCap=n[3],p.lineJoin=n[4],p.miterLimit=n[5],p.setLineDash&&(p.lineDashOffset=n[7],p.setLineDash(n[6]))},y.prototype.drawLabelWithPointPlacement_=function(p,n,u,r){var s=this.textStates[n],P=this.createLabel(p,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,N=a0(Array.isArray(p)?p[0]:p,s.textAlign||mh),V=_d[s.textBaseline||ep],me=z&&z.lineWidth?z.lineWidth:0,_e=P.width/F-2*s.scale[0],Se=N*_e+2*(.5-N)*me,Ue=V*P.height/F+2*(.5-V)*me;return{label:P,anchorX:Se,anchorY:Ue}},y.prototype.execute_=function(p,n,u,r,s,P,z,F){var N;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?N=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),N=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),kv(this.renderedTransform_,u));for(var V=0,me=r.length,_e=0,Se,Ue,He,Ie,Ge,Je,rt,_t,yt,ct,Tt,St,Lt=0,nr=0,jt=null,Jt=null,or=this.coordinateCache_,At=this.viewRotation_,Vr=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,Er={context:p,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:At},zr=this.instructions!=r||this.overlaps?0:200,br,Sr,xr,Qr;V<me;){var Vt=r[V],Yr=Vt[0];switch(Yr){case qr.BEGIN_GEOMETRY:br=Vt[1],Qr=Vt[3],br.getGeometry()?z!==void 0&&!Lo(z,Qr.getExtent())?V=Vt[2]+1:++V:V=Vt[2];break;case qr.BEGIN_PATH:Lt>zr&&(this.fill_(p),Lt=0),nr>zr&&(p.stroke(),nr=0),!Lt&&!nr&&(p.beginPath(),Ie=NaN,Ge=NaN),++V;break;case qr.CIRCLE:_e=Vt[1];var vi=N[_e],di=N[_e+1],en=N[_e+2],Br=N[_e+3],Li=en-vi,Mn=Br-di,Ni=Math.sqrt(Li*Li+Mn*Mn);p.moveTo(vi+Ni,di),p.arc(vi,di,Ni,0,2*Math.PI,!0),++V;break;case qr.CLOSE_PATH:p.closePath(),++V;break;case qr.CUSTOM:_e=Vt[1],Se=Vt[2];var Cr=Vt[3],Wn=Vt[4],Zi=Vt.length==6?Vt[5]:void 0;Er.geometry=Cr,Er.feature=br,V in or||(or[V]=[]);var ln=or[V];Zi?Zi(N,_e,Se,2,ln):(ln[0]=N[_e],ln[1]=N[_e+1],ln.length=2),Wn(ln,Er),++V;break;case qr.DRAW_IMAGE:_e=Vt[1],Se=Vt[2],_t=Vt[3],Ue=Vt[4],He=Vt[5];var qo=Vt[6],Xn=Vt[7],Jr=Vt[8],un=Vt[9],$n=Vt[10],Kn=Vt[11],Fn=Vt[12],Wi=Vt[13],gn=Vt[14];if(!_t&&Vt.length>=19){yt=Vt[18],ct=Vt[19],Tt=Vt[20],St=Vt[21];var Tn=this.drawLabelWithPointPlacement_(yt,ct,Tt,St);_t=Tn.label,Vt[3]=_t;var wo=Vt[22];Ue=(Tn.anchorX-wo)*this.pixelRatio,Vt[4]=Ue;var wt=Vt[23];He=(Tn.anchorY-wt)*this.pixelRatio,Vt[5]=He,qo=_t.height,Vt[6]=qo,Wi=_t.width,Vt[13]=Wi}var Xt=void 0;Vt.length>24&&(Xt=Vt[24]);var ho=void 0,yn=void 0,Wr=void 0;Vt.length>16?(ho=Vt[15],yn=Vt[16],Wr=Vt[17]):(ho=dc,yn=!1,Wr=!1),$n&&Vr?Kn+=At:!$n&&!Vr&&(Kn-=At);for(var kn=0;_e<Se;_e+=2)if(!(Xt&&Xt[kn++]<Wi/this.pixelRatio)){var Oi=this.calculateImageOrLabelDimensions_(_t.width,_t.height,N[_e],N[_e+1],Wi,qo,Ue,He,Jr,un,Kn,Fn,s,ho,yn||Wr,br),dn=[p,n,_t,Oi,Xn,yn?jt:null,Wr?Jt:null],Hn=void 0,Zt=void 0;if(F&&gn){var Ur=Se-_e;if(!gn[Ur]){gn[Ur]=dn;continue}if(Hn=gn[Ur],delete gn[Ur],Zt=o0(Hn),F.collides(Zt))continue}F&&F.collides(Oi.declutterBox)||(Hn&&(F&&F.insert(Zt),this.replayImageOrLabel_.apply(this,Hn)),F&&F.insert(Oi.declutterBox),this.replayImageOrLabel_.apply(this,dn))}++V;break;case qr.DRAW_CHARS:var Dr=Vt[1],Vi=Vt[2],Sn=Vt[3],Ar=Vt[4];St=Vt[5];var ro=Vt[6],Xi=Vt[7],bi=Vt[8];Tt=Vt[9];var te=Vt[10];yt=Vt[11],ct=Vt[12];var he=[Vt[13],Vt[13]],de=this.textStates[ct],Te=de.font,Re=[de.scale[0]*Xi,de.scale[1]*Xi],Xe=void 0;Te in this.widths_?Xe=this.widths_[Te]:(Xe={},this.widths_[Te]=Xe);var Qe=eg(N,Dr,Vi,2),we=Math.abs(Re[0])*i_(Te,yt,Xe);if(Ar||we<=Qe){var Ne=this.textStates[ct].textAlign,ie=(Qe-we)*_d[Ne],W=n0(N,Dr,Vi,2,yt,ie,ro,Math.abs(Re[0]),i_,Te,Xe,Vr?0:this.viewRotation_);e:if(W){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=W.length;re<le;++re){ge=W[re],Ae=ge[4],ke=this.createLabel(Ae,ct,"",Tt),Ue=ge[2]+(Re[0]<0?-te:te),He=Sn*ke.height+(.5-Sn)*2*te*Re[1]/Re[0]-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,He,0,0,ge[3],he,!1,dc,!1,br);if(F&&F.collides(Oi.declutterBox))break e;J.push([p,n,ke,Oi,1,null,null])}if(St)for(re=0,le=W.length;re<le;++re){ge=W[re],Ae=ge[4],ke=this.createLabel(Ae,ct,St,""),Ue=ge[2],He=Sn*ke.height-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,He,0,0,ge[3],he,!1,dc,!1,br);if(F&&F.collides(Oi.declutterBox))break e;J.push([p,n,ke,Oi,1,null,null])}F&&F.load(J.map(o0));for(var Ce=0,Le=J.length;Ce<Le;++Ce)this.replayImageOrLabel_.apply(this,J[Ce])}}++V;break;case qr.END_GEOMETRY:if(P!==void 0){br=Vt[1];var Ke=P(br,Qr);if(Ke)return Ke}++V;break;case qr.FILL:zr?Lt++:this.fill_(p),++V;break;case qr.MOVE_TO_LINE_TO:for(_e=Vt[1],Se=Vt[2],Sr=N[_e],xr=N[_e+1],Je=Sr+.5|0,rt=xr+.5|0,(Je!==Ie||rt!==Ge)&&(p.moveTo(Sr,xr),Ie=Je,Ge=rt),_e+=2;_e<Se;_e+=2)Sr=N[_e],xr=N[_e+1],Je=Sr+.5|0,rt=xr+.5|0,(_e==Se-2||Je!==Ie||rt!==Ge)&&(p.lineTo(Sr,xr),Ie=Je,Ge=rt);++V;break;case qr.SET_FILL_STYLE:jt=Vt,this.alignFill_=Vt[2],Lt&&(this.fill_(p),Lt=0,nr&&(p.stroke(),nr=0)),p.fillStyle=Vt[1],++V;break;case qr.SET_STROKE_STYLE:Jt=Vt,nr&&(p.stroke(),nr=0),this.setStrokeStyle_(p,Vt),++V;break;case qr.STROKE:zr?nr++:p.stroke(),++V;break;default:++V;break}}Lt&&this.fill_(p),nr&&p.stroke()},y.prototype.execute=function(p,n,u,r,s,P){this.viewRotation_=r,this.execute_(p,n,u,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(p,n,u,r,s){return this.viewRotation_=u,this.execute_(p,1,n,this.hitDetectionInstructions,!0,r,s)},y}(),s0=t2;var h_=[On.POLYGON,On.CIRCLE,On.LINE_STRING,On.IMAGE,On.TEXT,On.DEFAULT],r2=function(){function y(p,n,u,r,s,P){this.maxExtent_=p,this.overlaps_=r,this.pixelRatio_=u,this.resolution_=n,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return y.prototype.clip=function(p,n){var u=this.getClipCoords(n);p.beginPath(),p.moveTo(u[0],u[1]),p.lineTo(u[2],u[3]),p.lineTo(u[4],u[5]),p.lineTo(u[6],u[7]),p.clip()},y.prototype.createExecutors_=function(p){for(var n in p){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=p[n];for(var s in r){var P=r[s];u[s]=new s0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(p){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=p.length;r<s;++r)if(p[r]in u)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(p,n,u,r,s,P){r=Math.round(r);var z=r*2+1,F=vs(this.hitDetectionTransform_,r+.5,r+.5,1/n,-1/n,-u,-p[0],-p[1]),N=!this.hitDetectionContext_;N&&(this.hitDetectionContext_=Ja(z,z));var V=this.hitDetectionContext_;V.canvas.width!==z||V.canvas.height!==z?(V.canvas.width=z,V.canvas.height=z):N||V.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),yy(me,p),yl(me,n*(this.renderBuffer_+r),me));var _e=i2(r),Se;function Ue(ct,Tt){for(var St=V.getImageData(0,0,z,z).data,Lt=0,nr=_e.length;Lt<nr;Lt++)if(St[_e[Lt]]>0){if(!P||Se!==On.IMAGE&&Se!==On.TEXT||P.indexOf(ct)!==-1){var jt=(_e[Lt]-3)/4,Jt=r-jt%z,or=r-(jt/z|0),At=s(ct,Tt,Jt*Jt+or*or);if(At)return At}V.clearRect(0,0,z,z);break}}var He=Object.keys(this.executorsByZIndex_).map(Number);He.sort(rh);var Ie,Ge,Je,rt,_t;for(Ie=He.length-1;Ie>=0;--Ie){var yt=He[Ie].toString();for(Je=this.executorsByZIndex_[yt],Ge=h_.length-1;Ge>=0;--Ge)if(Se=h_[Ge],rt=Je[Se],rt!==void 0&&(_t=rt.executeHitDetection(V,F,u,Ue,me),_t))return _t}},y.prototype.getClipCoords=function(p){var n=this.maxExtent_;if(!n)return null;var u=n[0],r=n[1],s=n[2],P=n[3],z=[u,r,u,P,s,P,s,r];return _l(z,0,8,2,p,z),z},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(p,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(p.save(),this.clip(p,u));var N=P||h_,V,me,_e,Se,Ue,He;for(z&&F.reverse(),V=0,me=F.length;V<me;++V){var Ie=F[V].toString();for(Ue=this.executorsByZIndex_[Ie],_e=0,Se=N.length;_e<Se;++_e){var Ge=N[_e];He=Ue[Ge],He!==void 0&&He.execute(p,n,u,r,s,z)}}this.maxExtent_&&p.restore()},y}(),p_={};function i2(y){if(p_[y]!==void 0)return p_[y];for(var p=y*2+1,n=y*y,u=new Array(n+1),r=0;r<=y;++r)for(var s=0;s<=y;++s){var P=r*r+s*s;if(P>n)break;var z=u[P];z||(z=[],u[P]=z),z.push(((y+r)*p+(y+s))*4+3),r>0&&z.push(((y-r)*p+(y+s))*4+3),s>0&&(z.push(((y+r)*p+(y-s))*4+3),r>0&&z.push(((y-r)*p+(y-s))*4+3))}for(var F=[],r=0,N=u.length;r<N;++r)u[r]&&F.push.apply(F,u[r]);return p_[y]=F,F}var f_=r2;var xd={ANIMATING:0,INTERACTING:1};var n2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),o2=function(y){n2(p,y);function p(n,u,r,s,P,z,F){var N=y.call(this)||this;return N.context_=n,N.pixelRatio_=u,N.extent_=r,N.transform_=s,N.viewRotation_=P,N.squaredTolerance_=z,N.userTransform_=F,N.contextFillState_=null,N.contextStrokeState_=null,N.contextTextState_=null,N.fillState_=null,N.strokeState_=null,N.image_=null,N.imageAnchorX_=0,N.imageAnchorY_=0,N.imageHeight_=0,N.imageOpacity_=0,N.imageOriginX_=0,N.imageOriginY_=0,N.imageRotateWithView_=!1,N.imageRotation_=0,N.imageScale_=[0,0],N.imageWidth_=0,N.text_="",N.textOffsetX_=0,N.textOffsetY_=0,N.textRotateWithView_=!1,N.textRotation_=0,N.textScale_=[0,0],N.textFillState_=null,N.textStrokeState_=null,N.textState_=null,N.pixelCoordinates_=[],N.tmpLocalTransform_=za(),N}return p.prototype.drawImages_=function(n,u,r,s){if(!!this.image_){var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.tmpLocalTransform_,N=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=N*this.imageOpacity_);var V=this.imageRotation_;this.imageRotateWithView_&&(V+=this.viewRotation_);for(var me=0,_e=P.length;me<_e;me+=2){var Se=P[me]-this.imageAnchorX_,Ue=P[me+1]-this.imageAnchorY_;if(V!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var He=Se+this.imageAnchorX_,Ie=Ue+this.imageAnchorY_;vs(F,He,Ie,1,1,V,-He,-Ie),z.setTransform.apply(z,F),z.translate(He,Ie),z.scale(this.imageScale_[0],this.imageScale_[1]),z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),z.setTransform(1,0,0,1,0,0)}else z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Se,Ue,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=N)}},p.prototype.drawText_=function(n,u,r,s){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);u<r;u+=s){var N=P[u]+this.textOffsetX_,V=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,N,V,1,1,F,-N,-V);z.setTransform.apply(z,me),z.translate(N,V),z.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&z.strokeText(this.text_,0,0),this.textFillState_&&z.fillText(this.text_,0,0),z.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&z.strokeText(this.text_,N,V),this.textFillState_&&z.fillText(this.text_,N,V)}}},p.prototype.moveToLineTo_=function(n,u,r,s,P){var z=this.context_,F=_l(n,u,r,s,this.transform_,this.pixelCoordinates_);z.moveTo(F[0],F[1]);var N=F.length;P&&(N-=2);for(var V=2;V<N;V+=2)z.lineTo(F[V],F[V+1]);return P&&z.closePath(),r},p.prototype.drawRings_=function(n,u,r,s){for(var P=0,z=r.length;P<z;++P)u=this.moveToLineTo_(n,u,r[P],s,!0);return u},p.prototype.drawCircle=function(n){if(!!Lo(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=gx(n,this.transform_,this.pixelCoordinates_),r=u[2]-u[0],s=u[3]-u[1],P=Math.sqrt(r*r+s*s),z=this.context_;z.beginPath(),z.arc(u[0],u[1],P,0,2*Math.PI),this.fillState_&&z.fill(),this.strokeState_&&z.stroke()}this.text_!==""&&this.drawText_(n.getCenter(),0,2,2)}},p.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},p.prototype.setTransform=function(n){this.transform_=n},p.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Mt.POINT:this.drawPoint(n);break;case Mt.LINE_STRING:this.drawLineString(n);break;case Mt.POLYGON:this.drawPolygon(n);break;case Mt.MULTI_POINT:this.drawMultiPoint(n);break;case Mt.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Mt.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Mt.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Mt.CIRCLE:this.drawCircle(n);break;default:}},p.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!Lo(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},p.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},p.prototype.drawPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},p.prototype.drawMultiPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},p.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(r,0,r.length,n.getStride(),!1),u.stroke()}if(this.text_!==""){var s=n.getFlatMidpoint();this.drawText_(s,0,2,2)}}},p.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!Lo(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=n.getFlatCoordinates(),P=0,z=n.getEnds(),F=n.getStride();r.beginPath();for(var N=0,V=z.length;N<V;++N)P=this.moveToLineTo_(s,P,z[N],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},p.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_;u.beginPath(),this.drawRings_(n.getOrientedFlatCoordinates(),0,n.getEnds(),n.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var r=n.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},p.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getOrientedFlatCoordinates(),s=0,P=n.getEndss(),z=n.getStride();u.beginPath();for(var F=0,N=P.length;F<N;++F){var V=P[F];s=this.drawRings_(r,s,V,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},p.prototype.setContextFillState_=function(n){var u=this.context_,r=this.contextFillState_;r?r.fillStyle!=n.fillStyle&&(r.fillStyle=n.fillStyle,u.fillStyle=n.fillStyle):(u.fillStyle=n.fillStyle,this.contextFillState_={fillStyle:n.fillStyle})},p.prototype.setContextStrokeState_=function(n){var u=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=n.lineCap&&(r.lineCap=n.lineCap,u.lineCap=n.lineCap),u.setLineDash&&(_s(r.lineDash,n.lineDash)||u.setLineDash(r.lineDash=n.lineDash),r.lineDashOffset!=n.lineDashOffset&&(r.lineDashOffset=n.lineDashOffset,u.lineDashOffset=n.lineDashOffset)),r.lineJoin!=n.lineJoin&&(r.lineJoin=n.lineJoin,u.lineJoin=n.lineJoin),r.lineWidth!=n.lineWidth&&(r.lineWidth=n.lineWidth,u.lineWidth=n.lineWidth),r.miterLimit!=n.miterLimit&&(r.miterLimit=n.miterLimit,u.miterLimit=n.miterLimit),r.strokeStyle!=n.strokeStyle&&(r.strokeStyle=n.strokeStyle,u.strokeStyle=n.strokeStyle)):(u.lineCap=n.lineCap,u.setLineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.lineWidth=n.lineWidth,u.miterLimit=n.miterLimit,u.strokeStyle=n.strokeStyle,this.contextStrokeState_={lineCap:n.lineCap,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset,lineJoin:n.lineJoin,lineWidth:n.lineWidth,miterLimit:n.miterLimit,strokeStyle:n.strokeStyle})},p.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:mh;r?(r.font!=n.font&&(r.font=n.font,u.font=n.font),r.textAlign!=s&&(r.textAlign=s,u.textAlign=s),r.textBaseline!=n.textBaseline&&(r.textBaseline=n.textBaseline,u.textBaseline=n.textBaseline)):(u.font=n.font,u.textAlign=s,u.textBaseline=n.textBaseline,this.contextTextState_={font:n.font,textAlign:s,textBaseline:n.textBaseline})},p.prototype.setFillStrokeStyle=function(n,u){var r=this;if(!n)this.fillState_=null;else{var s=n.getColor();this.fillState_={fillStyle:Ts(s||Ss)}}if(!u)this.strokeState_=null;else{var P=u.getColor(),z=u.getLineCap(),F=u.getLineDash(),N=u.getLineDashOffset(),V=u.getLineJoin(),me=u.getWidth(),_e=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:Qh,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ue){return Ue*r.pixelRatio_}),lineDashOffset:(N||hc)*this.pixelRatio_,lineJoin:V!==void 0?V:Iu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}},p.prototype.setImageStyle=function(n){var u;if(!n||!(u=n.getSize())){this.image_=null;return}var r=n.getAnchor(),s=n.getOrigin();this.image_=n.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=u[1]*this.pixelRatio_,this.imageOpacity_=n.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=n.getRotateWithView(),this.imageRotation_=n.getRotation(),this.imageScale_=n.getScaleArray(),this.imageWidth_=u[0]*this.pixelRatio_},p.prototype.setTextStyle=function(n){if(!n)this.text_="";else{var u=n.getFill();if(!u)this.textFillState_=null;else{var r=u.getColor();this.textFillState_={fillStyle:Ts(r||Ss)}}var s=n.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),z=s.getLineCap(),F=s.getLineDash(),N=s.getLineDashOffset(),V=s.getLineJoin(),me=s.getWidth(),_e=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:Qh,lineDash:F||cc,lineDashOffset:N||hc,lineJoin:V!==void 0?V:Iu,lineWidth:me!==void 0?me:mc,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ue=n.getOffsetX(),He=n.getOffsetY(),Ie=n.getRotateWithView(),Ge=n.getRotation(),Je=n.getScaleArray(),rt=n.getText(),_t=n.getTextAlign(),yt=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:ng,textAlign:_t!==void 0?_t:mh,textBaseline:yt!==void 0?yt:ep},this.text_=rt!==void 0?Array.isArray(rt)?rt.reduce(function(ct,Tt,St){return ct+=St%2?" ":Tt},""):rt:"",this.textOffsetX_=Ue!==void 0?this.pixelRatio_*Ue:0,this.textOffsetY_=He!==void 0?this.pixelRatio_*He:0,this.textRotateWithView_=Ie!==void 0?Ie:!1,this.textRotation_=Ge!==void 0?Ge:0,this.textScale_=[this.pixelRatio_*Je[0],this.pixelRatio_*Je[1]]}},p}(og),l0=o2;var Pu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var a2=function(){function y(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return y.prototype.clear=function(){this.cache_={},this.cacheSize_=0},y.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},y.prototype.expire=function(){if(this.canExpireCache()){var p=0;for(var n in this.cache_){var u=this.cache_[n];(p++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},y.prototype.get=function(p,n,u){var r=u0(p,n,u);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(p,n,u,r){var s=u0(p,n,u);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(p){this.maxCacheSize_=p,this.expire()},y}();function u0(y,p,n){var u=n?rg(n):"null";return p+":"+y+":"+u}var d_=new a2;var s2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),l2=function(y){s2(p,y);function p(n,u,r,s){var P=y.call(this)||this;return P.extent=n,P.pixelRatio_=r,P.resolution=u,P.state=s,P}return p.prototype.changed=function(){this.dispatchEvent(Ji.CHANGE)},p.prototype.getExtent=function(){return this.extent},p.prototype.getImage=function(){return jr()},p.prototype.getPixelRatio=function(){return this.pixelRatio_},p.prototype.getResolution=function(){return this.resolution},p.prototype.getState=function(){return this.state},p.prototype.load=function(){jr()},p}(nh),c0=l2;var u2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),pL=function(y){u2(p,y);function p(n,u,r,s,P,z){var F=y.call(this,n,u,r,qi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=qi.IDLE,F.imageLoadFunction_=z,F}return p.prototype.getImage=function(){return this.image_},p.prototype.handleImageError_=function(){this.state=qi.ERROR,this.unlistenImage_(),this.changed()},p.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Eu(this.extent)/this.image_.height),this.state=qi.LOADED,this.unlistenImage_(),this.changed()},p.prototype.load=function(){(this.state==qi.IDLE||this.state==qi.ERROR)&&(this.state=qi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=m_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},p.prototype.setImage=function(n){this.image_=n,this.resolution=Eu(this.extent)/this.image_.height},p.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},p}(c0);function m_(y,p,n){var u=y,r=!0,s=!1,P=!1,z=[qp(u,Ji.LOAD,function(){P=!0,s||p()})];return u.src&&Pv?(s=!0,u.decode().then(function(){r&&p()}).catch(function(F){r&&(P?p():n())})):z.push(qp(u,Ji.ERROR,n)),function(){r=!1,z.forEach(Po)}}var c2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),bd=null,h2=function(y){c2(p,y);function p(n,u,r,s,P,z){var F=y.call(this)||this;return F.hitDetectionImage_=null,F.image_=n||new Image,s!==null&&(F.image_.crossOrigin=s),F.canvas_={},F.color_=z,F.unlisten_=null,F.imageState_=P,F.size_=r,F.src_=u,F.tainted_,F}return p.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===qi.LOADED){bd||(bd=Ja(1,1)),bd.drawImage(this.image_,0,0);try{bd.getImageData(0,0,1,1),this.tainted_=!1}catch{bd=null,this.tainted_=!0}}return this.tainted_===!0},p.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Ji.CHANGE)},p.prototype.handleImageError_=function(){this.imageState_=qi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},p.prototype.handleImageLoad_=function(){this.imageState_=qi.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},p.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},p.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},p.prototype.getImageState=function(){return this.imageState_},p.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var n=this.size_[0],u=this.size_[1],r=Ja(n,u);r.fillRect(0,0,n,u),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},p.prototype.getSize=function(){return this.size_},p.prototype.getSrc=function(){return this.src_},p.prototype.load=function(){if(this.imageState_==qi.IDLE){this.imageState_=qi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=m_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},p.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==qi.LOADED)){var u=document.createElement("canvas");this.canvas_[n]=u,u.width=Math.ceil(this.image_.width*n),u.height=Math.ceil(this.image_.height*n);var r=u.getContext("2d");if(r.scale(n,n),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=rg(this.color_),r.fillRect(0,0,u.width/n,u.height/n),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,u.width,u.height),P=s.data,z=this.color_[0]/255,F=this.color_[1]/255,N=this.color_[2]/255,V=this.color_[3],me=0,_e=P.length;me<_e;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=N,P[me+3]*=V;r.putImageData(s,0,0)}}},p.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},p}(nh);function h0(y,p,n,u,r,s){var P=d_.get(p,u,s);return P||(P=new h2(y,p,n,u,r,s),d_.set(p,u,s,P)),P}var p2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),f2=function(y){p2(p,y);function p(n){var u=this,r=n||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,z=r.scale!==void 0?r.scale:1,F=r.rotateWithView!==void 0?r.rotateWithView:!1;u=y.call(this,{opacity:s,rotation:P,scale:z,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:F})||this,u.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],u.normalizedAnchor_=null,u.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Hs.TOP_LEFT,u.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Pu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Pu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var N=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var V=r.src;En(!(V!==void 0&&N),4),En(!N||N&&u.imgSize_,5),(V===void 0||V.length===0)&&N&&(V=N.src||Ai(N)),En(V!==void 0&&V.length>0,6);var me=r.src!==void 0?qi.IDLE:qi.LOADED;return u.color_=r.color!==void 0?Jh(r.color):null,u.iconImage_=h0(N,V,u.imgSize_!==void 0?u.imgSize_:null,u.crossOrigin_,me,u.color_),u.offset_=r.offset!==void 0?r.offset:[0,0],u.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Hs.TOP_LEFT,u.origin_=null,u.size_=r.size!==void 0?r.size:null,u}return p.prototype.clone=function(){var n=this.getScale();return new p({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(n)?n.slice():n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},p.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Pu.FRACTION||this.anchorYUnits_==Pu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Pu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Pu.FRACTION&&(n[1]*=u[1])}if(this.anchorOrigin_!=Hs.TOP_LEFT){if(!u)return null;n===this.anchor_&&(n=this.anchor_.slice()),(this.anchorOrigin_==Hs.TOP_RIGHT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=-n[0]+u[0]),(this.anchorOrigin_==Hs.BOTTOM_LEFT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=-n[1]+u[1])}this.normalizedAnchor_=n}var r=this.getDisplacement();return[n[0]-r[0],n[1]+r[1]]},p.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},p.prototype.getColor=function(){return this.color_},p.prototype.getImage=function(n){return this.iconImage_.getImage(n)},p.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},p.prototype.getImageSize=function(){return this.iconImage_.getSize()},p.prototype.getImageState=function(){return this.iconImage_.getImageState()},p.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},p.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var n=this.offset_;if(this.offsetOrigin_!=Hs.TOP_LEFT){var u=this.getSize(),r=this.iconImage_.getSize();if(!u||!r)return null;n=n.slice(),(this.offsetOrigin_==Hs.TOP_RIGHT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=r[0]-u[0]-n[0]),(this.offsetOrigin_==Hs.BOTTOM_LEFT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=r[1]-u[1]-n[1])}return this.origin_=n,this.origin_},p.prototype.getSrc=function(){return this.iconImage_.getSrc()},p.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},p.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(Ji.CHANGE,n)},p.prototype.load=function(){this.iconImage_.load()},p.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(Ji.CHANGE,n)},p}(tg),g_=f2;var $l=.5;function p0(y,p,n,u,r,s,P){var z=y[0]*$l,F=y[1]*$l,N=Ja(z,F);N.imageSmoothingEnabled=!1;for(var V=N.canvas,me=new l0(N,$l,r,null,P),_e=n.length,Se=Math.floor((256*256*256-1)/_e),Ue={},He=1;He<=_e;++He){var Ie=n[He-1],Ge=Ie.getStyleFunction()||u;if(!!u){var Je=Ge(Ie,s);if(!!Je){Array.isArray(Je)||(Je=[Je]);for(var rt=He*Se,_t="#"+("000000"+rt.toString(16)).slice(-6),yt=0,ct=Je.length;yt<ct;++yt){var Tt=Je[yt],St=Tt.getGeometryFunction()(Ie);if(!(!St||!Lo(r,St.getExtent()))){var Lt=Tt.clone(),nr=Lt.getFill();nr&&nr.setColor(_t);var jt=Lt.getStroke();jt&&(jt.setColor(_t),jt.setLineDash(null)),Lt.setText(void 0);var Jt=Tt.getImage();if(Jt&&Jt.getOpacity()!==0){var or=Jt.getImageSize();if(!or)continue;var At=Ja(or[0],or[1],void 0,{alpha:!1}),Vr=At.canvas;At.fillStyle=_t,At.fillRect(0,0,Vr.width,Vr.height),Lt.setImage(new g_({img:Vr,imgSize:or,anchor:Jt.getAnchor(),anchorXUnits:Pu.PIXELS,anchorYUnits:Pu.PIXELS,offset:Jt.getOrigin(),opacity:1,size:Jt.getSize(),scale:Jt.getScale(),rotation:Jt.getRotation(),rotateWithView:Jt.getRotateWithView()}))}var Er=Lt.getZIndex()||0,zr=Ue[Er];zr||(zr={},Ue[Er]=zr,zr[Mt.POLYGON]=[],zr[Mt.CIRCLE]=[],zr[Mt.LINE_STRING]=[],zr[Mt.POINT]=[]),zr[St.getType().replace("Multi","")].push(St,Lt)}}}}}for(var br=Object.keys(Ue).map(Number).sort(rh),He=0,Sr=br.length;He<Sr;++He){var zr=Ue[br[He]];for(var xr in zr)for(var Qr=zr[xr],yt=0,ct=Qr.length;yt<ct;yt+=2){me.setStyle(Qr[yt+1]);for(var Vt=0,Yr=p.length;Vt<Yr;++Vt)me.setTransform(p[Vt]),me.drawGeometry(Qr[yt])}}return N.getImageData(0,0,V.width,V.height)}function f0(y,p,n){var u=[];if(n){var r=Math.floor(Math.round(y[0])*$l),s=Math.floor(Math.round(y[1])*$l),P=(jl(r,0,n.width-1)+jl(s,0,n.height-1)*n.width)*4,z=n.data[P],F=n.data[P+1],N=n.data[P+2],V=N+256*(F+256*z),me=Math.floor((256*256*256-1)/p.length);V&&V%me===0&&u.push(p[V/me-1])}return u}var d2=.5,d0={Point:b2,LineString:_2,Polygon:E2,MultiPoint:w2,MultiLineString:v2,MultiPolygon:x2,GeometryCollection:y2,Circle:m2};function m0(y,p){return parseInt(Ai(y),10)-parseInt(Ai(p),10)}function g0(y,p){var n=ag(y,p);return n*n}function ag(y,p){return d2*y/p}function m2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),On.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(p,u)}}function y_(y,p,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var N=F.getImageState();N==qi.LOADED||N==qi.ERROR?F.unlistenImageChange(r):(N==qi.IDLE&&F.load(),N=F.getImageState(),F.listenImageChange(r),z=!0)}return g2(y,p,n,u,s,P),z}function g2(y,p,n,u,r,s){var P=n.getGeometryFunction()(p);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)y0(y,z,n,p);else{var N=d0[z.getType()];N(y,z,n,p,s)}}}function y0(y,p,n,u){if(p.getType()==Mt.GEOMETRY_COLLECTION){for(var r=p.getGeometries(),s=0,P=r.length;s<P;++s)y0(y,r[s],n,u);return}var z=y.getBuilder(n.getZIndex(),On.DEFAULT);z.drawCustom(p,u,n.getRenderer(),n.getHitDetectionRenderer())}function y2(y,p,n,u,r){var s=p.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=d0[s[P].getType()];F(y,s[P],n,u,r)}}function _2(y,p,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),On.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(p,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),On.TEXT);F.setTextStyle(z),F.drawText(p,u)}}function v2(y,p,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),On.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(p,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),On.TEXT);F.setTextStyle(z),F.drawText(p,u)}}function x2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=y.getBuilder(n.getZIndex(),On.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(p,u)}}function b2(y,p,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=y.getBuilder(n.getZIndex(),On.IMAGE);F.setImageStyle(s,z),F.drawPoint(p,u)}if(P&&P.getText()){var N=y.getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(P,z),N.drawText(p,u)}}function w2(y,p,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=y.getBuilder(n.getZIndex(),On.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(p,u)}if(P&&P.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(P,z),N.drawText(p,u)}}function E2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),On.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(p,u)}}var T2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),S2=function(y){T2(p,y);function p(n){var u=y.call(this,n)||this;return u.boundHandleStyleImageChange_=u.handleStyleImageChange_.bind(u),u.animatingOrInteracting_,u.dirty_=!1,u.hitDetectionImageData_=null,u.renderedFeatures_=null,u.renderedRevision_=-1,u.renderedResolution_=NaN,u.renderedExtent_=Ya(),u.wrappedRenderedExtent_=Ya(),u.renderedRotation_,u.renderedCenter_=null,u.renderedProjection_=null,u.renderedRenderOrder_=null,u.replayGroup_=null,u.replayGroupChanged=!0,u.declutterExecutorGroup=null,u.clipping=!0,u}return p.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,N=P.projection,V=P.rotation,me=N.getExtent(),_e=this.getLayer().getSource(),Se=u.pixelRatio,Ue=u.viewHints,He=!(Ue[xd.ANIMATING]||Ue[xd.INTERACTING]),Ie=this.context,Ge=Math.round(u.size[0]*Se),Je=Math.round(u.size[1]*Se),rt=_e.getWrapX()&&N.canWrapX(),_t=rt?bs(me):null,yt=rt?Math.ceil((s[2]-me[2])/_t)+1:1,ct=rt?Math.floor((s[0]-me[0])/_t):0;do{var Tt=this.getRenderTransform(z,F,V,Se,Ge,Je,ct*_t);n.execute(Ie,1,Tt,V,He,void 0,r)}while(++ct<yt)},p.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},p.prototype.renderFrame=function(n,u){var r=n.pixelRatio,s=n.layerStatesArray[n.layerIndex];Lv(this.pixelTransform,1/r,1/r),zv(this.inversePixelTransform,this.pixelTransform);var P=fy(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,N=this.replayGroup_,V=this.declutterExecutorGroup;if((!N||N.isEmpty())&&(!V||V.isEmpty()))return null;var me=Math.round(n.size[0]*r),_e=Math.round(n.size[1]*r);F.width!=me||F.height!=_e?(F.width=me,F.height=_e,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,_e),this.preRender(z,n);var Se=n.viewState,Ue=Se.projection,He=!1,Ie=!0;if(s.extent&&this.clipping){var Ge=rd(s.extent,Ue);Ie=Lo(Ge,n.extent),He=Ie&&!sc(Ge,n.extent),He&&this.clipUnrotated(z,n,Ge)}Ie&&this.renderWorlds(N,n),He&&z.restore(),this.postRender(z,n);var Je=Fx(s.opacity),rt=this.container;return Je!==rt.style.opacity&&(rt.style.opacity=Je),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},p.prototype.getFeatures=function(n){return new Promise(function(u){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];bo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,z=this.renderedRotation_,F=this.renderedProjection_,N=this.wrappedRenderedExtent_,V=this.getLayer(),me=[],_e=r[0]*$l,Se=r[1]*$l;me.push(this.getRenderTransform(s,P,z,$l,_e,Se,0).slice());var Ue=V.getSource(),He=F.getExtent();if(Ue.getWrapX()&&F.canWrapX()&&!sc(He,N)){for(var Ie=N[0],Ge=bs(He),Je=0,rt=void 0;Ie<He[0];)--Je,rt=Ge*Je,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ie+=Ge;for(Je=0,Ie=N[2];Ie>He[2];)++Je,rt=Ge*Je,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ie-=Ge}this.hitDetectionImageData_=p0(r,me,this.renderedFeatures_,V.getStyleFunction(),N,P,z)}u(f0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},p.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,N=u.viewState.rotation,V=this.getLayer(),me={},_e=function(He,Ie,Ge){var Je=Ai(He),rt=me[Je];if(rt){if(rt!==!0&&Ge<rt.distanceSq){if(Ge===0)return me[Je]=!0,P.splice(P.lastIndexOf(rt),1),s(He,V,Ie);rt.geometry=Ie,rt.distanceSq=Ge}}else{if(Ge===0)return me[Je]=!0,s(He,V,Ie);P.push(me[Je]={feature:He,layer:V,geometry:Ie,distanceSq:Ge,callback:s})}},Se,Ue=[this.replayGroup_];return this.declutterExecutorGroup&&Ue.push(this.declutterExecutorGroup),Ue.some(function(He){return Se=He.forEachFeatureAtCoordinate(n,F,N,r,_e,He===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ie){return Ie.value}):null)}),Se}},p.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},p.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},p.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[xd.ANIMATING],P=n.viewHints[xd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var N=n.extent,V=n.viewState,me=V.projection,_e=V.resolution,Se=n.pixelRatio,Ue=u.getRevision(),He=u.getRenderBuffer(),Ie=u.getRenderOrder();Ie===void 0&&(Ie=m0);var Ge=V.center.slice(),Je=yl(N,He*_e),rt=Je.slice(),_t=[Je.slice()],yt=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!sc(yt,n.extent)){var ct=bs(yt),Tt=Math.max(bs(Je)/2,ct);Je[0]=yt[0]-Tt,Je[2]=yt[2]+Tt,ex(Ge,me);var St=Jv(_t[0],me);St[0]<yt[0]&&St[2]<yt[2]?_t.push([St[0]+ct,St[1],St[2]+ct,St[3]]):St[0]>yt[0]&&St[2]>yt[2]&&_t.push([St[0]-ct,St[1],St[2]-ct,St[3]])}if(!this.dirty_&&this.renderedResolution_==_e&&this.renderedRevision_==Ue&&this.renderedRenderOrder_==Ie&&sc(this.wrappedRenderedExtent_,Je))return _s(this.renderedExtent_,rt)||(this.hitDetectionImageData_=null,this.renderedExtent_=rt),this.renderedCenter_=Ge,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Lt=new c_(ag(_e,Se),Je,_e,Se),nr;this.getLayer().getDeclutter()&&(nr=new c_(ag(_e,Se),Je,_e,Se));var jt=uh(),Jt;if(jt){for(var or=0,At=_t.length;or<At;++or){var Vr=_t[or],Er=Qp(Vr,me);r.loadFeatures(Er,nx(_e,me),jt)}Jt=Gm(jt,me)}else for(var or=0,At=_t.length;or<At;++or)r.loadFeatures(_t[or],_e,me);var zr=g0(_e,Se),br=function(Yr){var vi,di=Yr.getStyleFunction()||u.getStyleFunction();if(di&&(vi=di(Yr,_e)),vi){var en=this.renderFeature(Yr,zr,vi,Lt,Jt,nr);this.dirty_=this.dirty_||en}}.bind(this),Sr=Qp(Je,me),xr=r.getFeaturesInExtent(Sr);Ie&&xr.sort(Ie);for(var or=0,At=xr.length;or<At;++or)br(xr[or]);this.renderedFeatures_=xr;var Qr=Lt.finish(),Vt=new f_(Je,_e,Se,r.getOverlaps(),Qr,u.getRenderBuffer());return nr&&(this.declutterExecutorGroup=new f_(Je,_e,Se,r.getOverlaps(),nr.finish(),u.getRenderBuffer())),this.renderedResolution_=_e,this.renderedRevision_=Ue,this.renderedRenderOrder_=Ie,this.renderedExtent_=rt,this.wrappedRenderedExtent_=Je,this.renderedCenter_=Ge,this.renderedProjection_=me,this.replayGroup_=Vt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},p.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var N=0,V=r.length;N<V;++N)F=y_(s,n,r[N],u,this.boundHandleStyleImageChange_,P,z)||F;else F=y_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},p}(i0),_0=S2;var I2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),C2=function(y){I2(p,y);function p(n){return y.call(this,n)||this}return p.prototype.createRenderer=function(){return new _0(this)},p}(Hx),tp=C2;var v0=Gp(s_(),1);var A2=function(){function y(p){this.rbush_=new v0.default(p),this.items_={}}return y.prototype.insert=function(p,n){var u={minX:p[0],minY:p[1],maxX:p[2],maxY:p[3],value:n};this.rbush_.insert(u),this.items_[Ai(n)]=u},y.prototype.load=function(p,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=p[r],z=n[r],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:z};u[r]=F,this.items_[Ai(z)]=F}this.rbush_.load(u)},y.prototype.remove=function(p){var n=Ai(p),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},y.prototype.update=function(p,n){var u=this.items_[Ai(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Vm(r,p)||(this.remove(n),this.insert(p,n))},y.prototype.getAll=function(){var p=this.rbush_.all();return p.map(function(n){return n.value})},y.prototype.getInExtent=function(p){var n={minX:p[0],minY:p[1],maxX:p[2],maxY:p[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},y.prototype.forEach=function(p){return this.forEach_(this.getAll(),p)},y.prototype.forEachInExtent=function(p,n){return this.forEach_(this.getInExtent(p),n)},y.prototype.forEach_=function(p,n){for(var u,r=0,s=p.length;r<s;r++)if(u=n(p[r]),u)return u;return u},y.prototype.isEmpty=function(){return Vl(this.items_)},y.prototype.clear=function(){this.rbush_.clear(),this.items_={}},y.prototype.getExtent=function(p){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,p)},y.prototype.concat=function(p){this.rbush_.load(p.rbush_.all());for(var n in p.items_)this.items_[n]=p.items_[n]},y}(),wd=A2;var P2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),M2=function(y){P2(p,y);function p(n){var u=y.call(this)||this;u.projection=ya(n.projection),u.attributions_=x0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Su.READY,u.wrapX_=n.wrapX!==void 0?n.wrapX:!1,u.interpolate_=!!n.interpolate,u.viewResolver=null,u.viewRejector=null;var r=u;return u.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),u}return p.prototype.getAttributions=function(){return this.attributions_},p.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},p.prototype.getProjection=function(){return this.projection},p.prototype.getResolutions=function(){return jr()},p.prototype.getView=function(){return this.viewPromise_},p.prototype.getState=function(){return this.state_},p.prototype.getWrapX=function(){return this.wrapX_},p.prototype.getInterpolate=function(){return this.interpolate_},p.prototype.refresh=function(){this.changed()},p.prototype.setAttributions=function(n){this.attributions_=x0(n),this.changed()},p.prototype.setState=function(n){this.state_=n,this.changed()},p}(Mo);function x0(y){return y?Array.isArray(y)?function(p){return y}:typeof y=="function"?y:function(p){return[y]}:null}var cf=M2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function b0(y,p){return[[-1/0,-1/0,1/0,1/0]]}var _h={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var k2=!1;function L2(y,p,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof y=="function"?y(n,u,r):y,!0),p.getType()==_h.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=k2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var N=p.getType(),V=void 0;N==_h.JSON||N==_h.TEXT?V=z.responseText:N==_h.XML?(V=z.responseXML,V||(V=new DOMParser().parseFromString(z.responseText,"application/xml"))):N==_h.ARRAY_BUFFER&&(V=z.response),V?s(p.readFeatures(V,{extent:n,featureProjection:r}),p.readProjection(V)):P()}else P()},z.onerror=P,z.send()}function __(y,p){return function(n,u,r,s,P){var z=this;L2(y,p,n,u,r,function(F,N){z.addFeatures(F),s!==void 0&&s(F)},P||qh)}}var w0=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vh=function(y){w0(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.feature=u,s.features=r,s}return p}(sn);var R2=function(y){w0(p,y);function p(n){var u=this,r=n||{};u=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Su.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=qh,u.format_=r.format,u.overlaps_=r.overlaps===void 0?!0:r.overlaps,u.url_=r.url,r.loader!==void 0?u.loader_=r.loader:u.url_!==void 0&&(En(u.format_,7),u.loader_=__(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:b0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new wd:null,u.loadedExtentsRtree_=new wd,u.loadingExtentsCount_=0,u.nullGeometryFeatures_={},u.idIndex_={},u.uidIndex_={},u.featureChangeKeys_={},u.featuresCollection_=null;var P,z;return Array.isArray(r.features)?z=r.features:r.features&&(P=r.features,z=P.getArray()),!s&&P===void 0&&(P=new ch(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return p.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},p.prototype.addFeatureInternal=function(n){var u=Ai(n);if(!this.addToIndex_(u,n)){this.featuresCollection_&&this.featuresCollection_.remove(n);return}this.setupChangeEvents_(u,n);var r=n.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,n)}else this.nullGeometryFeatures_[u]=n;this.dispatchEvent(new vh(Qa.ADDFEATURE,n))},p.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[uo(u,Ji.CHANGE,this.handleFeatureChange_,this),uo(u,jp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},p.prototype.addToIndex_=function(n,u){var r=!0,s=u.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=u),r&&(En(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},p.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},p.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],N=Ai(F);this.addToIndex_(N,F)&&r.push(F)}for(var P=0,V=r.length;P<V;P++){var F=r[P],N=Ai(F);this.setupChangeEvents_(N,F);var me=F.getGeometry();if(me){var _e=me.getExtent();u.push(_e),s.push(F)}else this.nullGeometryFeatures_[N]=F}if(this.featuresRtree_&&this.featuresRtree_.load(u,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,Se=r.length;P<Se;P++)this.dispatchEvent(new vh(Qa.ADDFEATURE,r[P]))},p.prototype.bindFeaturesCollection_=function(n){var u=!1;this.addEventListener(Qa.ADDFEATURE,function(r){u||(u=!0,n.push(r.feature),u=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){u||(u=!0,n.remove(r.feature),u=!1)}),n.addEventListener(ws.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(ws.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},p.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Po)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(s);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var z=new vh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},p.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},p.prototype.forEachFeatureAtCoordinateDirect=function(n,u){var r=[n[0],n[1],n[0],n[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(n))return u(s)})},p.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},p.prototype.forEachFeatureIntersectingExtent=function(n,u){return this.forEachFeatureInExtent(n,function(r){var s=r.getGeometry();if(s.intersectsExtent(n)){var P=u(r);if(P)return P}})},p.prototype.getFeaturesCollection=function(){return this.featuresCollection_},p.prototype.getFeatures=function(){var n;return this.featuresCollection_?n=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(n=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ka(n,Pm(this.nullGeometryFeatures_))),n},p.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},p.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},p.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,N=[-1/0,-1/0,1/0,1/0],V=u||Am;return this.featuresRtree_.forEachInExtent(N,function(me){if(V(me)){var _e=me.getGeometry(),Se=F;if(F=_e.closestPointXY(r,s,z,F),F<Se){P=me;var Ue=Math.sqrt(F);N[0]=r-Ue,N[1]=s-Ue,N[2]=r+Ue,N[3]=s+Ue}}}),P},p.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},p.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},p.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},p.prototype.getFormat=function(){return this.format_},p.prototype.getOverlaps=function(){return this.overlaps_},p.prototype.getUrl=function(){return this.url_},p.prototype.handleFeatureChange_=function(n){var u=n.target,r=Ai(u),s=u.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[r]=u);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,u)):this.featuresRtree_&&this.featuresRtree_.update(P,u)}var z=u.getId();if(z!==void 0){var F=z.toString();this.idIndex_[F]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[F]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[r]=u;this.changed(),this.dispatchEvent(new vh(Qa.CHANGEFEATURE,u))},p.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Ai(n)in this.uidIndex_},p.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},p.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,_e){var Se=P[me],Ue=s.forEachInExtent(Se,function(He){return sc(He.extent,Se)});Ue||(++F.loadingExtentsCount_,F.dispatchEvent(new vh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(He){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADEND,void 0,He))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,N=0,V=P.length;N<V;++N)z(N,V);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},p.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},p.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Vm(s.extent,n))return r=s,!0}),r&&u.remove(r)},p.prototype.removeFeature=function(n){if(!!n){var u=Ai(n);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(n);var r=this.removeFeatureInternal(n);r&&this.changed()}},p.prototype.removeFeatureInternal=function(n){var u=Ai(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Po),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new vh(Qa.REMOVEFEATURE,n)),n}},p.prototype.removeFromIdIndex_=function(n){var u=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===n){delete this.idIndex_[r],u=!0;break}return u},p.prototype.setLoader=function(n){this.loader_=n},p.prototype.setUrl=function(n){En(this.format_,7),this.url_=n,this.setLoader(__(n,this.format_))},p}(cf),rp=R2;var E0=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hf=function(y){E0(p,y);function p(n,u){var r=y.call(this,n)||this;return r.layer=u,r}return p}(sn);var v_={LAYERS:"layers"},z2=function(y){E0(p,y);function p(n){var u=this,r=n||{},s=Ra({},r);delete s.layers;var P=r.layers;return u=y.call(this,s)||this,u.on,u.once,u.un,u.layersListenerKeys_=[],u.listenerKeys_={},u.addChangeListener(v_.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new ch(P.slice(),{unique:!0}):En(typeof P.getArray=="function",43):P=new ch(void 0,{unique:!0}),u.setLayers(P),u}return p.prototype.handleLayerChange_=function(){this.changed()},p.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Po),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(uo(n,ws.ADD,this.handleLayersAdd_,this),uo(n,ws.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Po);ih(this.listenerKeys_);for(var r=n.getArray(),s=0,P=r.length;s<P;s++){var z=r[s];this.registerLayerListeners_(z),this.dispatchEvent(new hf("addlayer",z))}this.changed()},p.prototype.registerLayerListeners_=function(n){var u=[uo(n,jp.PROPERTYCHANGE,this.handleLayerChange_,this),uo(n,Ji.CHANGE,this.handleLayerChange_,this)];n instanceof p&&u.push(uo(n,"addlayer",this.handleLayerGroupAdd_,this),uo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ai(n)]=u},p.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new hf("addlayer",n.layer))},p.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new hf("removelayer",n.layer))},p.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new hf("addlayer",u)),this.changed()},p.prototype.handleLayersRemove_=function(n){var u=n.element,r=Ai(u);this.listenerKeys_[r].forEach(Po),delete this.listenerKeys_[r],this.dispatchEvent(new hf("removelayer",u)),this.changed()},p.prototype.getLayers=function(){return this.get(v_.LAYERS)},p.prototype.setLayers=function(n){var u=this.getLayers();if(u)for(var r=u.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new hf("removelayer",r[s]));this.set(v_.LAYERS,n)},p.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},p.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(V){V.getLayerStatesArray(u)});var s=this.getLayerState(),P=s.zIndex;!n&&s.zIndex===void 0&&(P=0);for(var z=r,F=u.length;z<F;z++){var N=u[z];N.opacity*=s.opacity,N.visible=N.visible&&s.visible,N.maxResolution=Math.min(N.maxResolution,s.maxResolution),N.minResolution=Math.max(N.minResolution,s.minResolution),N.minZoom=Math.max(N.minZoom,s.minZoom),N.maxZoom=Math.min(N.maxZoom,s.maxZoom),s.extent!==void 0&&(N.extent!==void 0?N.extent=$v(N.extent,s.extent):N.extent=s.extent),N.zIndex===void 0&&(N.zIndex=P)}return u},p.prototype.getSourceState=function(){return Su.READY},p}(Zm),x_=z2;var na={SINGLECLICK:"singleclick",CLICK:Ji.CLICK,DBLCLICK:Ji.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var b_={ACTIVE:"active"};var D2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O2=function(y){D2(p,y);function p(n){var u=y.call(this)||this;return u.on,u.once,u.un,n&&n.handleEvent&&(u.handleEvent=n.handleEvent),u.map_=null,u.setActive(!0),u}return p.prototype.getActive=function(){return this.get(b_.ACTIVE)},p.prototype.getMap=function(){return this.map_},p.prototype.handleEvent=function(n){return!0},p.prototype.setActive=function(n){this.set(b_.ACTIVE,n)},p.prototype.setMap=function(n){this.map_=n},p}(Mo);var T0=O2;var F2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),B2=function(y){F2(p,y);function p(n){var u=this,r=n||{};return u=y.call(this,r)||this,r.handleDownEvent&&(u.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(u.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(u.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(u.handleUpEvent=r.handleUpEvent),r.stopDown&&(u.stopDown=r.stopDown),u.handlingDownUpSequence=!1,u.trackedPointers_={},u.targetPointers=[],u}return p.prototype.getPointerCount=function(){return this.targetPointers.length},p.prototype.handleDownEvent=function(n){return!1},p.prototype.handleDragEvent=function(n){},p.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;var u=!1;if(this.updateTrackedPointers_(n),this.handlingDownUpSequence){if(n.type==na.POINTERDRAG)this.handleDragEvent(n),n.originalEvent.preventDefault();else if(n.type==na.POINTERUP){var r=this.handleUpEvent(n);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(n.type==na.POINTERDOWN){var s=this.handleDownEvent(n);this.handlingDownUpSequence=s,u=this.stopDown(s)}else n.type==na.POINTERMOVE&&this.handleMoveEvent(n);return!u},p.prototype.handleMoveEvent=function(n){},p.prototype.handleUpEvent=function(n){return!1},p.prototype.stopDown=function(n){return n},p.prototype.updateTrackedPointers_=function(n){if(U2(n)){var u=n.originalEvent,r=u.pointerId.toString();n.type==na.POINTERUP?delete this.trackedPointers_[r]:n.type==na.POINTERDOWN?this.trackedPointers_[r]=u:r in this.trackedPointers_&&(this.trackedPointers_[r]=u),this.targetPointers=Pm(this.trackedPointers_)}},p}(T0);function U2(y){var p=y.type;return p===na.POINTERDOWN||p===na.POINTERDRAG||p===na.POINTERUP}var S0=B2;var I0=function(y){var p=y.originalEvent;return p.altKey&&!(p.metaKey||p.ctrlKey)&&!p.shiftKey};var C0=Am,A0=function(y){return y.type==na.CLICK};var P0=function(y){return y.type==na.SINGLECLICK};var M0=function(y){var p=y.originalEvent;return En(p!==void 0,56),p.isPrimary&&p.button===0};var N2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),V2=function(y){N2(p,y);function p(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=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout()),Ka(F,_e.getFlatCoordinates()),N.push(F.length)}s.setFlatCoordinates(P,F),s.ends_=N}return s}return p.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()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ud(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,n,u,r,s))},p.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 zx(this.flatCoordinates,0,this.ends_,this.stride,n,s,P)},p.prototype.getCoordinates=function(){return ph(this.flatCoordinates,0,this.ends_,this.stride)},p.prototype.getEnds=function(){return this.ends_},p.prototype.getLineString=function(n){return n<0||this.ends_.length<=n?null:new uc(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},p.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 N=u[z],V=new uc(n.slice(P,N),r);s.push(V),P=N}return s},p.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 N=s[z],V=Qm(u,r,N,P,.5);Ka(n,V),r=N}return n},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=wx(this.flatCoordinates,0,this.ends_,this.stride,n,u,0,r),new p(u,Pn.XY,r)},p.prototype.getType=function(){return Mt.MULTI_LINE_STRING},p.prototype.intersectsExtent=function(n){return Ax(this.flatCoordinates,0,this.ends_,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=cd(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},p}(Es),k0=V2;var G2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),j2=function(y){G2(p,y);function p(n,u){var r=y.call(this)||this;return u&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return p.prototype.appendPoint=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.changed()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},p.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,N=P.length;F<N;F+=z){var V=ql(n,u,P[F],P[F+1]);if(V<s){s=V;for(var me=0;me<z;++me)r[me]=P[F+me];r.length=z}}return s},p.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.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)},p.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},p.prototype.getType=function(){return Mt.MULTI_POINT},p.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(Qf(n,z,F))return!0}return!1},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},p}(Es),sg=j2;function L0(y,p,n,u){for(var r=[],s=Ya(),P=0,z=n.length;P<z;++P){var F=n[P];s=Nm(y,p,F[0],u),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),p=F[F.length-1]}return r}var q2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Z2=function(y){q2(p,y);function p(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=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout());for(var Se=F.length,Ue=_e.getEnds(),He=0,Ie=Ue.length;He<Ie;++He)Ue[He]+=Se;Ka(F,_e.getFlatCoordinates()),N.push(Ue)}u=P,n=F,r=N}return u!==void 0&&r?(s.setFlatCoordinates(u,n),s.endss_=r):s.setCoordinates(n,u),s}return p.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()},p.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 p(this.flatCoordinates.slice(),this.layout,u);return s.applyProperties(this),s},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_x(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),vx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,n,u,r,s))},p.prototype.containsXY=function(n,u){return Ix(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n,u)},p.prototype.getArea=function(){return Tx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},p.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Hy(u,0,this.endss_,this.stride,n)):u=this.flatCoordinates,pd(u,0,this.endss_,this.stride)},p.prototype.getEndss=function(){return this.endss_},p.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var n=L0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Cx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},p.prototype.getInteriorPoints=function(){return new sg(this.getFlatInteriorPoints().slice(),Pn.XYM)},p.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Lx(n,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Hy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=Ex(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(n),u,0,r),new p(u,Pn.XY,r)},p.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 md(this.flatCoordinates.slice(u,P),this.layout,s)},p.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 N=r[z].slice(),V=N[N.length-1];if(P!==0)for(var me=0,_e=N.length;me<_e;++me)N[me]-=P;var Se=new md(u.slice(P,V),n,N);s.push(Se),P=V}return s},p.prototype.getType=function(){return Mt.MULTI_POLYGON},p.prototype.intersectsExtent=function(n){return Px(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=bx(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()},p}(Es),R0=Z2;var B0=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),z0=0,Ed=1,D0=[0,0,0,0],pf=[],w_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},E_=function(y){B0(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return p}(sn);var W2=function(y){B0(p,y);function p(n){var u=y.call(this,n)||this;u.on,u.once,u.un,u.boundHandleFeatureChange_=u.handleFeatureChange_.bind(u),u.condition_=n.condition?n.condition:M0,u.defaultDeleteCondition_=function(s){return I0(s)&&P0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:C0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new wd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new tp({source:new rp({useSpatialIndex:!1,wrapX:!!n.wrapX}),style:n.style?n.style:$2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),u.SEGMENT_WRITERS_={Point:u.writePointGeometry_.bind(u),LineString:u.writeLineStringGeometry_.bind(u),LinearRing:u.writeLineStringGeometry_.bind(u),Polygon:u.writePolygonGeometry_.bind(u),MultiPoint:u.writeMultiPointGeometry_.bind(u),MultiLineString:u.writeMultiLineStringGeometry_.bind(u),MultiPolygon:u.writeMultiPolygonGeometry_.bind(u),Circle:u.writeCircleGeometry_.bind(u),GeometryCollection:u.writeGeometryCollectionGeometry_.bind(u)},u.source_=null,u.hitDetection_=null;var r;if(n.features?r=n.features:n.source&&(u.source_=n.source,r=new ch(u.source_.getFeatures()),u.source_.addEventListener(Qa.ADDFEATURE,u.handleSourceAdd_.bind(u)),u.source_.addEventListener(Qa.REMOVEFEATURE,u.handleSourceRemove_.bind(u))),!r)throw new Error("The modify interaction requires features, a source or a layer");return n.hitDetection&&(u.hitDetection_=n.hitDetection),u.features_=r,u.features_.forEach(u.addFeature_.bind(u)),u.features_.addEventListener(ws.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(ws.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return p.prototype.addFeature_=function(n){var u=n.getGeometry();if(u){var r=this.SEGMENT_WRITERS_[u.getType()];r&&r(n,u)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),n.addEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},p.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ch;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,N=z.length;F<N;++F){var V=z[F].feature;V&&r.indexOf(V)===-1&&this.featuresBeingModified_.push(V)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new E_(w_.MODIFYSTART,this.featuresBeingModified_,n))}},p.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},p.prototype.removeFeatureSegmentData_=function(n){var u=this.rBush_,r=[];u.forEach(function(F){n===F.feature&&r.push(F)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],z=this.dragSegments_.length-1;z>=0;--z)this.dragSegments_[z][0]===P&&this.dragSegments_.splice(z,1);u.remove(P)}},p.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,n)},p.prototype.setMap=function(n){this.overlay_.setMap(n),y.prototype.setMap.call(this,n)},p.prototype.getOverlay=function(){return this.overlay_},p.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},p.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},p.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},p.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},p.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},p.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},p.prototype.writeMultiPointGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s){var z=r[s],F={feature:n,geometry:u,depth:[s],index:s,segment:[z,z]};this.rBush_.insert(u.getExtent(),F)}},p.prototype.writeLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length-1;s<P;++s){var z=r.slice(s,s+2),F={feature:n,geometry:u,index:s,segment:z};this.rBush_.insert(wu(z),F)}},p.prototype.writeMultiLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},p.prototype.writePolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},p.prototype.writeMultiPolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length;F<N;++F)for(var V=z[F],me=0,_e=V.length-1;me<_e;++me){var Se=V.slice(me,me+2),Ue={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(wu(Se),Ue)}},p.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:z0,segment:[r,r]},P={feature:n,geometry:u,index:Ed,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Yp(r),s);var F=u,N=uh();if(N&&this.getMap()){var V=this.getMap().getView().getProjection();F=F.clone().transform(N,V),F=Yy(F).transform(V,N)}this.rBush_.insert(F.getExtent(),P)},p.prototype.writeGeometryCollectionGeometry_=function(n,u){for(var r=u.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],z=this.SEGMENT_WRITERS_[P.getType()];z(n,P)}},p.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new lc(new _a(n)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(n)}return s.set("features",u),s.set("geometries",r),s},p.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;this.lastPointerEvent_=n;var u;return!n.map.getView().getInteracting()&&n.type==na.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(n),this.vertexFeature_&&this.deleteCondition_(n)&&(n.type!=na.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),n.type==na.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),y.prototype.handleEvent.call(this,n)&&!u},p.prototype.handleDragEvent=function(n){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(n,this.dragSegments_);for(var u=[n.coordinate[0]+this.delta_[0],n.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,z=this.dragSegments_.length;P<z;++P){var F=this.dragSegments_[P],N=F[0],V=N.feature;r.indexOf(V)===-1&&r.push(V);var me=N.geometry;s.indexOf(me)===-1&&s.push(me);for(var _e=N.depth,Se=void 0,Ue=N.segment,He=F[1];u.length<me.getStride();)u.push(Ue[He][u.length]);switch(me.getType()){case Mt.POINT:Se=u,Ue[0]=u,Ue[1]=u;break;case Mt.MULTI_POINT:Se=me.getCoordinates(),Se[N.index]=u,Ue[0]=u,Ue[1]=u;break;case Mt.LINE_STRING:Se=me.getCoordinates(),Se[N.index+He]=u,Ue[He]=u;break;case Mt.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.POLYGON:Se=me.getCoordinates(),Se[_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.MULTI_POLYGON:Se=me.getCoordinates(),Se[_e[1]][_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.CIRCLE:if(Ue[0]=u,Ue[1]=u,N.index===z0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ie=n.map.getView().getProjection(),Ge=Ty(Wl(me.getCenter(),Ie),Wl(u,Ie)),Je=uh();if(Je){var rt=me.clone().transform(Je,Ie);rt.setRadius(Ge),Ge=rt.transform(Ie,Je).getRadius()}me.setRadius(Ge),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},p.prototype.handleDownEvent=function(n){if(!this.condition_(n))return!1;var u=n.coordinate;this.handlePointerAtPixel_(n.pixel,n.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=n.map.getView().getProjection(),P=[],z=r.getGeometry().getCoordinates(),F=wu([z]),N=this.rBush_.getInExtent(F),V={};N.sort(X2);for(var me=0,_e=N.length;me<_e;++me){var Se=N[me],Ue=Se.segment,He=Ai(Se.geometry),Ie=Se.depth;if(Ie&&(He+="-"+Ie.join("-")),V[He]||(V[He]=new Array(2)),Se.geometry.getType()===Mt.CIRCLE&&Se.index===Ed){var Ge=F0(u,Se,s);Tu(Ge,z)&&!V[He][0]&&(this.dragSegments_.push([Se,0]),V[He][0]=Se);continue}if(Tu(Ue[0],z)&&!V[He][0]){this.dragSegments_.push([Se,0]),V[He][0]=Se;continue}if(Tu(Ue[1],z)&&!V[He][1]){if((Se.geometry.getType()===Mt.LINE_STRING||Se.geometry.getType()===Mt.MULTI_LINE_STRING)&&V[He][0]&&V[He][0].index===0)continue;this.dragSegments_.push([Se,1]),V[He][1]=Se;continue}Ai(Ue)in this.vertexSegments_&&!V[He][0]&&!V[He][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var Je=P.length-1;Je>=0;--Je)this.insertVertex_(P[Je],z)}return!!this.vertexFeature_},p.prototype.handleUpEvent=function(n){for(var u=this.dragSegments_.length-1;u>=0;--u){var r=this.dragSegments_[u][0],s=r.geometry;if(s.getType()===Mt.CIRCLE){var P=s.getCenter(),z=r.featureSegments[0],F=r.featureSegments[1];z.segment[0]=P,z.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Yp(P),z);var N=s,V=uh();if(V){var me=n.map.getView().getProjection();N=N.clone().transform(V,me),N=Yy(N).transform(me,V)}this.rBush_.update(N.getExtent(),F)}else this.rBush_.update(wu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new E_(w_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},p.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},p.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(At,Vr){return O0(P,At,z)-O0(P,Vr,z)},N,V;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(At){return At===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(At,Vr,Er){if(Er=Er||At.getGeometry(),Er.getType()===Mt.POINT&&vv(s.features_.getArray(),At)){V=Er;var zr=Er.getFlatCoordinates().slice(0,2);N=[{feature:At,geometry:Er,segment:[zr,zr]}]}return!0},{layerFilter:me})}if(!N){var _e=rd(Yp(P,D0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ue=Qp(yl(_e,Se,D0),z);N=this.rBush_.getInExtent(Ue)}if(N&&N.length>0){var He=N.sort(F)[0],Ie=He.segment,Ge=F0(P,He,z),Je=u.getPixelFromCoordinate(Ge),rt=Ty(n,Je);if(V||rt<=this.pixelTolerance_){var _t={};if(_t[Ai(Ie)]=!0,this.snapToPointer_||(this.delta_[0]=Ge[0]-P[0],this.delta_[1]=Ge[1]-P[1]),He.geometry.getType()===Mt.CIRCLE&&He.index===Ed)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ge,[He.feature],[He.geometry]);else{var yt=u.getPixelFromCoordinate(Ie[0]),ct=u.getPixelFromCoordinate(Ie[1]),Tt=Jp(Je,yt),St=Jp(Je,ct);rt=Math.sqrt(Math.min(Tt,St)),this.snappedToVertex_=rt<=this.pixelTolerance_,this.snappedToVertex_&&(Ge=Tt>St?Ie[1]:Ie[0]),this.createOrUpdateVertexFeature_(Ge,[He.feature],[He.geometry]);var Lt={};Lt[Ai(He.geometry)]=!0;for(var nr=1,jt=N.length;nr<jt;++nr){var Jt=N[nr].segment;if(Tu(Ie[0],Jt[0])&&Tu(Ie[1],Jt[1])||Tu(Ie[0],Jt[1])&&Tu(Ie[1],Jt[0])){var or=Ai(N[nr].geometry);or in Lt||(Lt[or]=!0,_t[Ai(Jt)]=!0)}else break}}this.vertexSegments_=_t;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},p.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,N;u.length<P.getStride();)u.push(0);switch(P.getType()){case Mt.MULTI_LINE_STRING:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.POLYGON:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.MULTI_POLYGON:N=P.getCoordinates(),N[z[1]][z[0]].splice(F+1,0,u);break;case Mt.LINE_STRING:N=P.getCoordinates(),N.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,N);var V=this.rBush_;V.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};V.insert(wu(me.segment),me),this.dragSegments_.push([me,1]);var _e={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};V.insert(wu(_e.segment),_e),this.dragSegments_.push([_e,0]),this.ignoreNextSingleClick_=!0},p.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=na.POINTERDRAG){var n=this.lastPointerEvent_;this.willModifyFeatures_(n,this.dragSegments_);var u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new E_(w_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},p.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,N,V,me,_e,Se,Ue,He;for(N=n.length-1;N>=0;--N)z=n[N],Ue=z[0],He=Ai(Ue.feature),Ue.depth&&(He+="-"+Ue.depth.join("-")),He in u||(u[He]={}),z[1]===0?(u[He].right=Ue,u[He].index=Ue.index):z[1]==1&&(u[He].left=Ue,u[He].index=Ue.index+1);for(He in u){switch(Se=u[He].right,me=u[He].left,V=u[He].index,_e=V-1,me!==void 0?Ue=me:Ue=Se,_e<0&&(_e=0),F=Ue.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Mt.MULTI_LINE_STRING:P[Ue.depth[0]].length>2&&(P[Ue.depth[0]].splice(V,1),r=!0);break;case Mt.LINE_STRING:P.length>2&&(P.splice(V,1),r=!0);break;case Mt.MULTI_POLYGON:s=s[Ue.depth[1]];case Mt.POLYGON:s=s[Ue.depth[0]],s.length>4&&(V==s.length-1&&(V=0),s.splice(V,1),r=!0,V===0&&(s.pop(),s.push(s[0]),_e=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ie=[];if(me!==void 0&&(this.rBush_.remove(me),Ie.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ie.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ge={depth:Ue.depth,feature:Ue.feature,geometry:Ue.geometry,index:_e,segment:Ie};this.rBush_.insert(wu(Ge.segment),Ge)}this.updateSegmentIndices_(F,V,Ue.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},p.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},p.prototype.updateSegmentIndices_=function(n,u,r,s){this.rBush_.forEachInExtent(n.getExtent(),function(P){P.geometry===n&&(r===void 0||P.depth===void 0||_s(P.depth,r))&&P.index>u&&(P.index+=s)})},p}(S0);function X2(y,p){return y.index-p.index}function O0(y,p,n){var u=p.geometry;if(u.getType()===Mt.CIRCLE){var r=u;if(p.index===Ed){var s=uh();s&&(r=r.clone().transform(s,n));var P=Jp(r.getCenter(),Wl(y,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Wl(y,n);return pf[0]=Wl(p.segment[0],n),pf[1]=Wl(p.segment[1],n),Qv(F,pf)}function F0(y,p,n){var u=p.geometry;if(u.getType()===Mt.CIRCLE&&p.index===Ed){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Cy(r.getClosestPoint(Wl(y,n)),n)}var P=Wl(y,n);return pf[0]=Wl(p.segment[0],n),pf[1]=Wl(p.segment[1],n),Cy(Ey(P,pf),n)}function $2(){var y=Wx();return function(p,n){return y[Mt.POINT]}}var T_=W2;var K2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),H2=function(y){K2(p,y);function p(n){var u=y.call(this)||this;return u.geometries_=n||null,u.changeEventsKeys_=[],u.listenGeometriesChange_(),u}return p.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Po),this.changeEventsKeys_.length=0},p.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var n=0,u=this.geometries_.length;n<u;++n)this.changeEventsKeys_.push(uo(this.geometries_[n],Ji.CHANGE,this.changed,this))},p.prototype.clone=function(){var n=new p(null);return n.setGeometries(this.geometries_),n.applyProperties(this),n},p.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},p.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},p.prototype.computeExtent=function(n){Hp(n);for(var u=this.geometries_,r=0,s=u.length;r<s;++r)Wv(n,u[r].getExtent());return n},p.prototype.getGeometries=function(){return U0(this.geometries_)},p.prototype.getGeometriesArray=function(){return this.geometries_},p.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},p.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],N=F.getSimplifiedGeometry(n);u.push(N),N!==F&&(s=!0)}if(s){var V=new p(null);return V.setGeometriesArray(u),V}else return this.simplifiedGeometryMaxMinSquaredTolerance=n,this},p.prototype.getType=function(){return Mt.GEOMETRY_COLLECTION},p.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},p.prototype.isEmpty=function(){return this.geometries_.length===0},p.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()},p.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()},p.prototype.setGeometries=function(n){this.setGeometriesArray(U0(n))},p.prototype.setGeometriesArray=function(n){this.unlistenGeometriesChange_(),this.geometries_=n,this.listenGeometriesChange_(),this.changed()},p.prototype.applyTransform=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].applyTransform(n);this.changed()},p.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()},p.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),y.prototype.disposeInternal.call(this)},p}(Km);function U0(y){for(var p=[],n=0,u=y.length;n<u;++n)p.push(y[n].clone());return p}var N0=H2;var Y2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(p,n){var u;if(n){var r=n.dataProjection?ya(n.dataProjection):this.readProjection(p);n.extent&&r&&r.getUnits()===ac.TILE_PIXELS&&(r=ya(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},y.prototype.adaptOptions=function(p){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},p)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(p,n){return jr()},y.prototype.readFeatures=function(p,n){return jr()},y.prototype.readGeometry=function(p,n){return jr()},y.prototype.readProjection=function(p){return jr()},y.prototype.writeFeature=function(p,n){return jr()},y.prototype.writeFeatures=function(p,n){return jr()},y.prototype.writeGeometry=function(p,n){return jr()},y}(),V0=Y2;function S_(y,p,n){var u=n?ya(n.featureProjection):null,r=n?ya(n.dataProjection):null,s;if(u&&r&&!ix(u,r)?s=(p?y.clone():y).transform(p?u:r,p?r:u):s=y,p&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var N=0,V=F.length;N<V;++N)F[N]=Math.round(F[N]*P)/P;return F};s===y&&(s=y.clone()),s.applyTransform(z)}return s}var J2=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q2=function(y){J2(p,y);function p(){return y.call(this)||this}return p.prototype.getType=function(){return _h.JSON},p.prototype.readFeature=function(n,u){return this.readFeatureFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readFeatureFromObject=function(n,u){return jr()},p.prototype.readFeaturesFromObject=function(n,u){return jr()},p.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readGeometryFromObject=function(n,u){return jr()},p.prototype.readProjection=function(n){return this.readProjectionFromObject(lg(n))},p.prototype.readProjectionFromObject=function(n){return jr()},p.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},p.prototype.writeFeatureObject=function(n,u){return jr()},p.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},p.prototype.writeFeaturesObject=function(n,u){return jr()},p.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},p.prototype.writeGeometryObject=function(n,u){return jr()},p}(V0);function lg(y){if(typeof y=="string"){var p=JSON.parse(y);return p||null}else return y!==null?y:null}var G0=Q2;var eE=function(){var y=function(p,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(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),tE=function(y){eE(p,y);function p(n){var u=this,r=n||{};return u=y.call(this)||this,u.dataProjection=ya(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(u.defaultFeatureProjection=ya(r.featureProjection)),u.geometryName_=r.geometryName,u.extractGeometryName_=r.extractGeometryName,u.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],u}return p.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=I_(r.geometry,u),P=new lc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},p.prototype.readFeaturesFromObject=function(n,u){var r=n,s=null;if(r.type==="FeatureCollection"){var P=n;s=[];for(var z=P.features,F=0,N=z.length;F<N;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},p.prototype.readGeometryFromObject=function(n,u){return I_(n,u)},p.prototype.readProjectionFromObject=function(n){var u=n.crs,r;return u?u.type=="name"?r=ya(u.properties.name):u.type==="EPSG"?r=ya("EPSG:"+u.properties.code):En(!1,36):r=this.dataProjection,r},p.prototype.writeFeatureObject=function(n,u){u=this.adaptOptions(u);var r={type:"Feature",geometry:null,properties:null},s=n.getId();if(s!==void 0&&(r.id=s),!n.hasProperties())return r;var P=n.getProperties(),z=n.getGeometry();return z&&(r.geometry=C_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},p.prototype.writeFeaturesObject=function(n,u){u=this.adaptOptions(u);for(var r=[],s=0,P=n.length;s<P;++s)r.push(this.writeFeatureObject(n[s],u));return{type:"FeatureCollection",features:r}},p.prototype.writeGeometryObject=function(n,u){return C_(n,this.adaptOptions(u))},p}(G0);function I_(y,p){if(!y)return null;var n;switch(y.type){case Mt.POINT:{n=iE(y);break}case Mt.LINE_STRING:{n=nE(y);break}case Mt.POLYGON:{n=lE(y);break}case Mt.MULTI_POINT:{n=aE(y);break}case Mt.MULTI_LINE_STRING:{n=oE(y);break}case Mt.MULTI_POLYGON:{n=sE(y);break}case Mt.GEOMETRY_COLLECTION:{n=rE(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return S_(n,!1,p)}function rE(y,p){var n=y.geometries.map(function(u){return I_(u,p)});return new N0(n)}function iE(y){return new _a(y.coordinates)}function nE(y){return new uc(y.coordinates)}function oE(y){return new k0(y.coordinates)}function aE(y){return new sg(y.coordinates)}function sE(y){return new R0(y.coordinates)}function lE(y){return new md(y.coordinates)}function C_(y,p){y=S_(y,!0,p);var n=y.getType(),u;switch(n){case Mt.POINT:{u=dE(y,p);break}case Mt.LINE_STRING:{u=cE(y,p);break}case Mt.POLYGON:{u=mE(y,p);break}case Mt.MULTI_POINT:{u=pE(y,p);break}case Mt.MULTI_LINE_STRING:{u=hE(y,p);break}case Mt.MULTI_POLYGON:{u=fE(y,p);break}case Mt.GEOMETRY_COLLECTION:{u=uE(y,p);break}case Mt.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function uE(y,p){var n=y.getGeometriesArray().map(function(u){var r=Ra({},p);return delete r.featureProjection,C_(u,r)});return{type:"GeometryCollection",geometries:n}}function cE(y,p){return{type:"LineString",coordinates:y.getCoordinates()}}function hE(y,p){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function pE(y,p){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function fE(y,p){var n;return p&&(n=p.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(n)}}function dE(y,p){return{type:"Point",coordinates:y.getCoordinates()}}function mE(y,p){var n;return p&&(n=p.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(n)}}var bl=tE;var ug,gE=new Uint8Array(16);function A_(){if(!ug&&(ug=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ug))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ug(gE)}var j0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function yE(y){return typeof y=="string"&&j0.test(y)}var q0=yE;var xa=[];for(cg=0;cg<256;++cg)xa.push((cg+256).toString(16).substr(1));var cg;function _E(y){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(xa[y[p+0]]+xa[y[p+1]]+xa[y[p+2]]+xa[y[p+3]]+"-"+xa[y[p+4]]+xa[y[p+5]]+"-"+xa[y[p+6]]+xa[y[p+7]]+"-"+xa[y[p+8]]+xa[y[p+9]]+"-"+xa[y[p+10]]+xa[y[p+11]]+xa[y[p+12]]+xa[y[p+13]]+xa[y[p+14]]+xa[y[p+15]]).toLowerCase();if(!q0(n))throw TypeError("Stringified UUID is invalid");return n}var Z0=_E;function vE(y,p,n){y=y||{};var u=y.random||(y.rng||A_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,p){n=n||0;for(var r=0;r<16;++r)p[n+r]=u[r];return p}return Z0(u)}var P_=vE;var ip=class extends Mo{constructor(n={}){super();this.properties={};this.options={};this.defineProperties(n),n.properties&&this.setProperties(n.properties),this.options=n,this.visible=n.visible===void 0?!0:!!n.visible,this.group=n.group,this.copyrights=n.copyrights,this.children=n.children,this.on("change:visible:group",u=>{this.group===u.target.group&&this!==u.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(r=>r.dispatchEvent(u))})}defineProperties(n={}){let{name:u,key:r,properties:s,hitTolerance:P}={...n},z=P_();Object.defineProperties(this,{name:{value:u},key:{value:r||u||z},group:{get:()=>this.get("group"),set:F=>{this.set("group",F)}},copyrights:{get:()=>this.get("copyrights"),set:F=>{let N=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",N||[])}},options:{value:n},map:{writable:!0},visible:{get:()=>this.get("visible"),set:F=>{if(F!==this.visible)if(this.set("visible",F),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(N=>N.visible)&&this.children.forEach(N=>{N.visible=!0}),this.parent&&this.group){let N=this.parent;for(;N.parent;)N=N.parent;let V=new sn("change:visible:group");V.target=this,N.dispatchEvent(V)}}else this.visible||(this.children&&this.children.forEach(N=>{N.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(N=>N.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:F=>{this.set("disabled",F)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:F=>{(this.children||[]).forEach(N=>{N.parent=void 0}),Array.isArray(F)&&F.forEach(N=>{N.parent=this}),this.set("children",F||[])}},hitTolerance:{value:P||5,writable:!0},properties:{value:{...s||{}}}})}attachToMap(n){this.detachFromMap(),this.map=n,this.children&&this.children.forEach(u=>{u.attachToMap(n)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(n,u){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:n})}flat(){return Kf(this)}};function xE(y){return class extends y{constructor(n={}){super(n);let{userInteractions:u=!0,userClickInteractions:r=!0,userHoverInteractions:s=!0,defaultUserInteractions:P=!0}=n;this.userInteractions=u,this.userClickInteractions=r,this.userHoverInteractions=s,this.defaultUserInteractions=P,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:F}=n;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&F&&this.onHover(F)}attachToMap(n){super.attachToMap(n),this.userInteractions&&this.defaultUserInteractions&&this.userClickInteractions&&this.onFeatureClick&&this.onClick(this.onFeatureClick),this.userInteractions&&this.defaultUserInteractions&&this.userHoverInteractions&&this.onFeatureHover&&this.onHover(this.onFeatureHover),this.listenEvents()}detachFromMap(){this.unlistenEvents(),super.detachFromMap()}listenEvents(){this.unlistenEvents(),this.userClickCallbacks.forEach(n=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))}),this.userHoverCallbacks.forEach(n=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))})}unlistenEvents(){Ha(this.userClickEventsKeys),Ha(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(n){this.userClickCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(n){this.userHoverCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(n){let u=this.userClickCallbacks.indexOf(n);u===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(u,1),this.map&&this.listenEvents())}unHover(n){let u=this.userHoverCallbacks.indexOf(n);u===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(u,1),this.map&&this.listenEvents())}onUserClickCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:click");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:hover");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var hg=xE;var Td=class extends hg(ip){constructor(n){super(n);this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(n){super.defineProperties(n),Object.defineProperties(this,{olLayer:{value:n.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(n){if(super.attachToMap(n),!!this.map&&(this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.on("change:visible",()=>{this.olLayer&&this.olLayer.setVisible(this.visible)})),this.olListenersKeys.push(this.map.getLayers().on("remove",u=>{u.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let u=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(r=>{r.getSource&&r.getSource()?.setAttributions(u)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(u)}}detachFromMap(){this.deactivateUserInteractions(),Ha(this.olListenersKeys),this.olLayer&&this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.removeLayer(this.olLayer),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&(this.singleClickListenerKey=this.map.on("singleclick",this.onUserClickCallback),this.olListenersKeys.push(this.singleClickListenerKey)),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&(this.pointerMoveListenerKey=this.map.on("pointermove",this.onUserMoveCallback))}deactivateUserInteractions(){Ha([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(n){return new Td({...this.options,...n})}},Is=Td;var W0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new va({color:[0,0,0,1],width:1})}),bE=new Xl({stroke:new va({color:[0,0,0,1],width:5})}),wE=new Xl({image:W0,stroke:new va({color:[255,0,0,1],width:3})}),EE=new Xl({image:W0,stroke:new va({color:[255,0,0,1],width:3,lineDash:[1,10]})}),TE=(y,p)=>{let n=y.get("minResolution"),u=y.get("maxResolution"),r=p<=n&&p>u;return n&&u&&!r?[]:y.get("mot")!=="foot"?[bE,wE]:[EE]},Sd=class extends Is{constructor(n){super(n);this.options={};this.olLayer=n.olLayer||new tp({source:new rp,style:n.style||TE})}clone(n){return new Sd({...this.options,...n})}},pg=Sd;var SE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,X0=/^([\d.]+),([\d.]+)$/,$0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,fg="stop-fetch",K0=y=>{let p=[];return y.forEach(n=>{let u=n.getGeometry()?.getCoordinates();u?.length&&p.push(...u)}),p},Id=class extends af{constructor(n={}){super(n);this.viaPoints=[];this.loading=!1;this.graphs=[];this.modify=!0;this.useRawViaPoints=!1;this.snapToClosestStation=!1;this.cacheStationData={};this.abortControllers={};this.segments=[];this.format=new bl({featureProjection:"EPSG:3857"});this.initialRouteDrag={};Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:u=>{u&&(this.set("mot",u),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:u=>{this.set("loading",u)}},modify:{get:()=>this.get("modify"),set:u=>{this.set("modify",u)}}}),this.loading=!1,this.graphs=n.graphs||[["osm",0,99]],this.mot=n.mot||"bus",this.modify=n.modify!==!1,this.routingApiParams=n.routingApiParams,this.useRawViaPoints=n.useRawViaPoints||!1,this.snapToClosestStation=n.snapToClosestStation||!1,this.apiKey=n.apiKey,this.stopsApiKey=n.stopsApiKey||this.apiKey,this.stopsApiUrl=n.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Zf({...n}),this.routingLayer=n.routingLayer||new pg({name:"routing-layer",style:n.style}),this.onRouteError=n.onRouteError||(u=>{this.dispatchEvent(new sn("change:route")),this.reset(),console.error(u)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction()}static getGraphsResolutions(n,u){let r=u.getView();return n.map(([,s,P])=>[r.getResolutionForZoom(s),r.getResolutionForZoom(P||s+1)])}addViaPoint(n,u=-1,r=0){this.viaPoints.splice(u===-1?this.viaPoints.length:u,r,n),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}removeViaPoint(n=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[n]&&this.viaPoints.splice(n,1),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}setViaPoints(n){this.viaPoints=[...n],this.drawRoute(),this.dispatchEvent(new sn("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new sn("change:route"))}abortRequests(){this.graphs.forEach(n=>{let u=n[0];this.abortControllers[u]&&this.abortControllers[u].abort(),this.abortControllers[u]=new AbortController}),this.abortControllers[fg]?.abort(),this.abortControllers[fg]=new AbortController,this.loading=!1}drawRoute(){if(this.abortRequests(),this.routingLayer?.olLayer?.getSource()?.clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[fg]);let n=this.viaPoints.map(u=>{if(Array.isArray(u)){let r=this.map?.getView().getProjection(),[s,P]=lh(u,r);return this.snapToClosestStation?[`@${P}`,s]:[P,s]}return this.useRawViaPoints?u:`!${u}`});return this.loading=!0,this.routingLayer?.olLayer?.getSource()?.clear(),this.viaPoints.forEach((u,r)=>this.drawViaPoint(u,r,this.abortControllers[fg])),Promise.all(this.graphs.map(([u],r)=>{let{signal:s}=this.abortControllers[u];return this.api?this.api.route({graph:u,via:`${n.join("|")}`,mot:this.mot,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams||{}},{signal:s}).then(P=>{if(this.segments=this.format.readFeatures(P),this.mot==="foot"){let N=this.segments.reduce((V,me)=>{let _e=me.get("trg");return V.find(Se=>Se[0]===_e[0]&&Se[1]===_e[1])?V:[...V,_e]},[]);this.segments=N.map(V=>{let me=this.segments.filter(Se=>{let Ue=Se.get("trg");return Ue[0]===V[0]&&Ue[1]===V[1]}),_e=K0(me);return new lc({geometry:new uc(_e)})})}let z=K0(this.segments),F=new lc({geometry:new uc(z)});F.set("graph",u),F.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[r]?.length>=2&&(F.set("minResolution",this.graphsResolutions[r][0]),F.set("maxResolution",this.graphsResolutions[r][1])),this.routingLayer?.olLayer?.getSource()?.addFeature(F),this.loading=!1}).catch(P=>{P.name!=="AbortError"&&(this.segments=[],this.dispatchEvent(new sn("error")),this.onRouteError(P,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(n,u,r){let s=new lc;if(s.set("viaPointIdx",u),Array.isArray(n))return s.setGeometry(new _a(n)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s);if(!this.useRawViaPoints||$0.test(n)){let V,me;return this.useRawViaPoints?[,V,,me]=$0.exec(n)||[]:[V,me]=n.split("$"),fetch(`${this.stopsApiUrl}lookup/${V}?key=${this.stopsApiKey}`,{signal:r.signal}).then(_e=>_e.json()).then(_e=>{let{coordinates:Se}=_e.features[0].geometry;return this.cacheStationData[n]=co(Se),s.set("viaPointTrack",me),s.setGeometry(new _a(co(Se))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(_e=>{_e.name!=="AbortError"&&(this.dispatchEvent(new sn("error")),this.onRouteError(_e,this),this.loading=!1)})}if(this.useRawViaPoints&&X0.test(n)){let[V,me]=X0.exec(n)||[],_e=co([parseFloat(me),parseFloat(V)],this.map?.getView().getProjection());return s.setGeometry(new _a(_e)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}let[,P,,z,F,,N]=SE.exec(n)||[];if(F&&z){let V=co([parseFloat(F),parseFloat(z)],this.map?.getView().getProjection());return s.set("viaPointTrack",N),s.setGeometry(new _a(V)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}return P?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${P}&limit=1`,{signal:r.signal}).then(V=>V.json()).then(V=>{let{coordinates:me}=V.features[0].geometry;return this.cacheStationData[n]=co(me),s.set("viaPointTrack",N),s.setGeometry(new _a(co(me))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(V=>(this.dispatchEvent(new sn("error")),this.onRouteError(V,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(n){let r=n.target.getFeaturesAtPixel(n.pixel).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("viaPointIdx")!==void 0);if(r){this.removeViaPoint(r.get("viaPointIdx"));return}this.addViaPoint(n.coordinate)}onModifyStart(n){let u=-1,r=n.features.getArray().find(P=>P.getGeometry()?.getType()===Mt.LINE_STRING);if(r&&r.getGeometry()&&n.mapBrowserEvent.coordinate){let P=yl(new _a(r.getGeometry()?.getClosestPoint(n.mapBrowserEvent.coordinate)).getExtent(),.001);u=this.segments.findIndex(z=>z.getGeometry()?.intersectsExtent(P))}let s=(n.features.getArray().filter(P=>P.getGeometry()?.getType()===Mt.POINT)||[])[0];this.initialRouteDrag={viaPoint:s,oldRoute:r&&r.clone(),segmentIndex:u}}onModifyEnd(n){let u=n.mapBrowserEvent.coordinate,{oldRoute:r,viaPoint:s,segmentIndex:P}=this.initialRouteDrag||{};return s?this.addViaPoint(u,s.get("viaPointIdx"),1):r?P===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(u,(P||0)+1):this.addViaPoint(u,0,1)}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new T_({source:this.routingLayer?.olLayer?.getSource()||void 0,pixelTolerance:4,hitDetection:this.routingLayer?.olLayer,deleteCondition:n=>{let r=n.target.getFeaturesAtPixel(n.pixel,{hitTolerance:5}).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("index"));return A0(n)&&r?(this.removeViaPoint(r.get("index")),!0):!1}}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}addListeners(){!this.modify||(this.removeListeners(),this.onMapClickKey=this.map?.on("singleclick",this.onMapClick))}removeListeners(){this.onMapClickKey&&Ha(this.onMapClickKey)}activate(){super.activate(),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Id.getGraphsResolutions(this.graphs,this.map),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.routingLayer?.attachToMap(this.map),this.modifyInteraction&&this.map.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}deactivate(){this.map&&(this.routingLayer?.detachFromMap(),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}render(){}},H0=Id;var M_=class extends af{constructor(n){super(n);let{apiParams:u,apiKey:r,url:s,placeholder:P}=n||{};this.apiParams={limit:20,...u||{}},this.placeholder=P||"Search for a stop...";let z={apiKey:r};s&&(z.url=s),this.api=new Wf(z),this.abortController=new AbortController}deactivate(){}render(n){let u=n?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=u.length?"block":"none",this.suggestionsElt.innerHTML="",u.forEach(r=>{let s=document.createElement("div");s.innerHTML=r?.properties?.name,s.onclick=()=>{this.onSuggestionClick(r)},Object.assign(s.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(s)}))}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-search",Object.assign(this.element.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px"}),this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=n=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(n.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),this.element.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",overflowY:"auto",cursor:"pointer"}),this.element.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{display:"none",position:"absolute",right:"0",padding:"0 10px",fontSize:"200%",cursor:"pointer"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),this.element.appendChild(this.clearElt)}search(n,u){return(n!==void 0||n!==null)&&(this.apiParams.q=n),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,u&&{signal:u.signal}).then(r=>{this.render(r)}).catch(()=>{this.render()})}onSuggestionClick(n){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},Y0=M_;var k_=class extends Y0{onSuggestionClick(p){let n=co(p.geometry.coordinates);this.map.getView().setCenter(n)}},J0=k_;var e1=Gp(Q0());var z_=class extends Is{constructor(n){super(n);this.olLayer=new Hh({source:new cf({}),render:this.getOlLayerRender()}),this.styleUrl=n.url,this.apiKey=n.apiKey,this.apiKeyName=n.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(n){super.attachToMap(n),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=void 0),this.loaded=!1,super.detachFromMap()}loadMbMap(){if(this.olListenersKeys.push(this.map?.on("change:target",()=>{this.loadMbMap()})),!this.map?.getTargetElement())return;if(!this.visible){this.olListenersKeys.push(this.once("change:visible",()=>{this.loadMbMap()}));return}let n=document.createElement("div");if(n.style.position="absolute",n.style.width="100%",n.style.height="100%",!this.styleUrl){console.error(`No styleUrl defined for mapbox layer: ${this.styleUrl}`);return}!this.apiKey&&!this.styleUrl?.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let u=this.getMapboxMapClass();this.mbMap=new u({style:Zh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:n,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new sn("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=oc(n.target)||[];this.copyrights?.toString()!==u.toString()&&(this.copyrights=u,this.olLayer?.getSource()?.setAttributions(u))}getFeatureInfoAtCoordinate(n,u){if(!u||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=n&&this.mbMap.project(lh(n)),s;if(this.hitTolerance){let{x:z,y:F}=r;s=[{x:z-this.hitTolerance,y:F-this.hitTolerance},{x:z+this.hitTolerance,y:F+this.hitTolerance}]}let P=this.mbMap.queryRenderedFeatures(s||r,u).map(z=>{let F=this.format.readFeature(z);return F&&F.set("mapboxFeature",z),F});return Promise.resolve({layer:this,features:P,coordinate:n})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let n=document.createElement("div");return()=>n}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},dg=z_;var np=class extends dg{attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(u){console.warn(u)}}))}loadMbMap(){let[n,u]=this.map?.getView().getCenter()||[];if((!n||!u)&&(n=0,u=0),this.renderState={center:[n,u],zoom:void 0,rotation:void 0,visible:void 0,opacity:void 0,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{!this.mbMap||(this.mbMap.resize(),this.copyrights=oc(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let r=this.mbMap.getCanvas();r&&(this.options.tabIndex?r.setAttribute("tabindex",`${this.options.tabIndex}`):r.removeAttribute("tabindex"))}getOlLayerRender(){return tf(this)}getMapboxMapClass(){return e1.Map}clone(n){return new np({...this.options,...n})}};var i1=Gp(r1());var op=class extends dg{getOlLayerRender(){return ef(this)}getMapboxMapClass(){return i1.Map}clone(n){return new op({...this.options,...n})}};var Cd=class extends Is{constructor(n){super(n);this.mapboxLayer=n.mapboxLayer,this.disabled=!1,this.styleLayersFilter=n.styleLayersFilter,this.beforeId=n.beforeId,this.featureInfoFilter=n.featureInfoFilter||(u=>u),this.queryRenderedLayersFilter=n.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(n.styleLayer?[n.styleLayer]:n.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),n.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof n.filters=="function"?n.filters(this):n.filters)}),!this.styleLayersFilter&&this.styleLayers&&(this.styleLayersFilter=u=>!!this.styleLayers?.find(r=>u.id===r.id))}attachToMap(n){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(n),super.attachToMap(n),!this.map||!this.mapboxLayer)return;let{mbMap:u}=this.mapboxLayer;if(!u){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(n)}));return}this.mapboxLayer.loaded||u.isStyleLoaded()||u.loaded()?this.onLoad():u.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",r=>{this.applyLayoutVisibility(r)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:n}=this.mapboxLayer;n.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r,source:s}=u;n.getSource(s)&&r&&!n.getLayer(r)&&n.addLayer(u,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r}=u;r&&n.getLayer(r)&&n.removeLayer(r)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer,u=n.getStyle();if(u&&this.styleLayersFilter){let r=u.layers.filter(this.styleLayersFilter);this.disabled=!r.length}}getFeatureInfoAtCoordinate(n){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:n,features:[],layer:this});let{mbMap:u}=this.mapboxLayer;if(!u.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=this.styleLayers||[];return this.styleLayersFilter&&(r=u.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(r=u.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(n,{layers:r.map(s=>s&&s.id),validate:!1}).then(s=>{let P=s.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(P),{...s,features:P,layer:this}})}setFilter(n){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(({id:r})=>{r&&n&&u.getLayer(r)&&u.setFilter(r,n)})}setHoverState(n,u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:r}=this.mapboxLayer;!n||!r||n.forEach(s=>{let{source:P,sourceLayer:z}=s.get("mapboxFeature")||{};if(!P&&!z||!s.getId()){s.getId()||console.warn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/mapbox/tippecanoe#adding-calculated-attributes.",s.getId(),s.getProperties());return}r.setFeatureState({id:s.getId(),source:P,sourceLayer:z},{hover:u})})}select(n=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=n,this.setHoverState(this.selectedFeatures||[],!0)}highlight(n=[]){let u=this.highlightedFeatures?.filter(r=>!(this.selectedFeatures||[]).map(s=>s.getId()).includes(r.getId()))||[];this.setHoverState(u,!1),this.highlightedFeatures=n,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(n){let{visible:u}=this,r=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:s}=this.mapboxLayer,P=s.getStyle();if(!!P&&r){let z=u?"visible":"none";for(let F=0;F<P.layers.length;F+=1){let N=P.layers[F];r(N)&&s.getLayer(N.id)&&s.setLayoutProperty(N.id,"visibility",z)}}}clone(n){return new Cd({...this.options,...n})}},n1=Cd;var N_=Gp(l1()),V_=Gp(f1());function aT(y){return class extends y{constructor(u){super({hitTolerance:10,...u});this.debug=u.debug||!1,this.mode=u.mode||ia.TOPOGRAPHIC,this.api=u.api||new $f(u),this.tenant=u.tenant||"",this.minZoomInterpolation=u.minZoomInterpolation||8,this.format=new bl;let r=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"];this.motsByZoom=u.motsByZoom||[r],this.getMotsByZoom=s=>u.getMotsByZoom&&u.getMotsByZoom(s,this.motsByZoom)||this.motsByZoom[s]||this.motsByZoom[this.motsByZoom.length-1],this.generalizationLevelByZoom=u.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=s=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(s,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[s],this.renderTimeIntervalByZoom=u.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=s=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(s,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[s],this.isUpdateBboxOnMoveEnd=u.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,50,{leading:!0,trailing:!0,maxWait:5e3}),this.onFeatureHover=this.onFeatureHover.bind(this),this.onFeatureClick=this.onFeatureClick.bind(this),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}defineProperties(u){let{style:r,speed:s,pixelRatio:P,hoverVehicleId:z,selectedVehicleId:F,filter:N,sort:V,time:me,live:_e,canvas:Se,styleOptions:Ue}=u,He=s||1,Ie=me||new Date,Ge=r||Kh;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:Se||document.createElement("canvas")},style:{get:()=>Ge,set:Je=>{Ge=Je,this.renderTrajectories()}},styleOptions:{value:{...rf,...Ue||{}}},speed:{get:()=>He,set:Je=>{He=Je,this.start()}},filter:{value:N,writable:!0},sort:{value:V,writable:!0},live:{value:_e===!1?_e:!0,writable:!0},time:{get:()=>Ie,set:Je=>{Ie=Je&&Je.getTime?Je:new Date(Je),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:F,writable:!0},pixelRatio:{value:P||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:u.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:u.useThrottle!==!1,writable:!0},useDebounce:{value:u.useDebounce||!1,writable:!0}})}attachToMap(u){super.attachToMap(u),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",r=>{r.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas&&(this.canvas.getContext("2d")?.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap())}start(){this.stop(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox()}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close()}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(u,r=!1){if(!this.map||!this.trajectories)return!1;let s=this.live?Date.now():this.time?.getTime(),P=Object.values(this.trajectories);return this.sort&&P.sort(this.sort),!this.canvas||!this.style||(this.renderState=Hf(this.canvas,P,this.style,{...u,pixelRatio:this.pixelRatio||1,time:s},{filter:this.filter,noInterpolate:(u.zoom||0)<this.minZoomInterpolation?!0:r,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(u,r){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),u&&(!r&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(u,r)}):!r&&this.useDebounce?this.debounceRenderTrajectories(u,r):!r&&this.useThrottle?this.throttleRenderTrajectories(u,r):this.renderTrajectoriesInternal(u,r))}setBbox(u,r){if(this.trajectories&&u&&r){let P=Object.keys(this.trajectories);for(let z=P.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[P[z]],u,r)}if(!u)return;let s=[...u];this.isUpdateBboxOnMoveEnd&&r&&(s.push(r),this.tenant&&s.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(r),this.generalizationLevel&&s.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(r),this.mots&&s.push(`mots=${this.mots}`)),this.api.bbox=s}setMode(u){this.mode!==u&&(this.mode=u,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(u=0){let r=u!==void 0?Math.round(u):-1,s=this.getRenderTimeIntervalByZoom(r)||25,P=Math.max(25,s/(this.speed||1)),z=Math.min(P,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,F]=this.api.buffer;this.api.buffer=[z,F]}return P}getVehicle(u){return this.trajectories&&Object.values(this.trajectories).filter(u)||[]}getFeatureInfoAtCoordinate(u,r){let{resolution:s,nb:P}=r,z=yl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let N=[];for(let V=0;V<F.length&&(F[V].properties.coordinate&&Kp(z,F[V].properties.coordinate)&&N.push(F[V]),N.length!==P);V+=1);return Promise.resolve({layer:this,features:N.map(V=>this.format.readFeature(V)),coordinate:u})}getTrajectoryInfos(u){let r=[this.api.getStopSequence(u),this.api.getFullTrajectory(u,this.mode,this.generalizationLevel)];return Promise.all(r).then(([s,P])=>({stopSequence:s,fullTrajectory:P}))}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!Lo(r,z)||this.mots&&!this.mots.includes(P)||P!=="rail"&&s<9?(this.removeTrajectory(u),!0):!1}addTrajectory(u){this.filter&&!this.filter(u)||(this.trajectories||(this.trajectories={}),this.trajectories[u.properties.train_id]=u,this.renderTrajectories())}removeTrajectory(u){let r;typeof u!="string"?r=u?.properties?.train_id:r=u,this.trajectories&&delete this.trajectories[r]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?this.stop():this.start())}onTrajectoryMessage(u){if(!u.content)return;let r=u.content,{geometry:s,properties:{train_id:P,time_since_update:z,raw_coordinates:F}}=r;z<0||this.purgeTrajectory(r)||(this.debug&&this.mode===ia.TOPOGRAPHIC&&F?r.properties.olGeometry={type:"Point",coordinates:co(F,this.map.getView().getProjection())}:r.properties.olGeometry=this.format.readGeometry(s),r.properties.timeOffset=Date.now()-u.timestamp,this.addTrajectory(r))}onDeleteTrajectoryMessage(u){!u.content||this.removeTrajectory(u.content)}onFeatureHover(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=P,this.renderTrajectories(!0))}}}var gg=aT;var sT=new Xl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),lT=(y,p,n)=>{let u="#ffffff",r=y.get("type"),s=y.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),u=s||n?.getBgColor(r),u=/#ffffff/i.test(u)?"#ff0000":u,[sT,new Xl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:u})}),stroke:new va({color:u,width:4})})]},yg=lT;var uT=new Xl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),cT=new Xl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new va({color:"#a0a0a0",width:4})}),hT=()=>[uT,cT],d1=hT;var pT=new bl,Ad=class extends gg(Is){constructor(n){super({...n});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!n.allowRenderWhenAnimating,this.olLayer=n.olLayer||new x_({layers:[new tp({source:new rp({features:[]}),style:(u,r)=>(n.fullTrajectoryStyle||yg)(u,r,this.styleOptions)}),new Hh({source:new cf({}),render:u=>{if(this.container||(this.container=document.createElement("div"),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",this.transformContainer=document.createElement("div"),this.transformContainer.style.position="absolute",this.transformContainer.style.width="100%",this.transformContainer.style.height="100%",this.container.appendChild(this.transformContainer),this.canvas&&(this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.transformOrigin="top left",this.transformContainer.appendChild(this.canvas))),this.renderedViewState){let{center:r,resolution:s,rotation:P}=u.viewState,{center:z,resolution:F,rotation:N}=this.renderedViewState;if(F/s>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let V=this.map.getPixelFromCoordinate(z),me=this.map.getPixelFromCoordinate(r);this.transformContainer.style.transform=Rv(V[0]-me[0],V[1]-me[1],F/s,F/s,P-N,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],u=>{let r=(u.map||u.target).getView();if(r.getAnimating()||r.getInteracting())return;let s=r.getZoom();this.currentZoom!==s&&this.onZoomEnd(),this.currentZoom=s,this.onMoveEnd(u)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(n){if(this.map&&this.canvas){let u=this.canvas.getContext("2d"),r=this.map.getPixelFromCoordinate(n);return!!u?.getImageData(r[0]*(this.pixelRatio||1),r[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(n){if(!this.map)return;let u=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:u.calculateExtent(),resolution:u.getResolution(),rotation:u.getRotation(),zoom:u.getZoom(),pixelRatio:this.pixelRatio},n)}renderTrajectoriesInternal(n,u){if(!this.map)return!1;let r=!1;return r=(this.allowRenderWhenAnimating?!1:this.map.getView().getAnimating()||this.map.getView().getInteracting())?!1:super.renderTrajectoriesInternal(n,u),r&&(this.renderedViewState={...n},this.transformContainer&&(this.transformContainer.style.transform="")),r}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(n,u={}){let r=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(n,{resolution:r,...u})}onMoveEnd(n){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(){super.onZoomEnd()}onFeatureHover(n,u,r){super.onFeatureHover(n,u,r),this.map.getTargetElement().style.cursor=n.length?"pointer":"auto"}onFeatureClick(n,u,r){super.onFeatureClick(n,u,r),!n.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(n,u,r){return super.purgeTrajectory(n,u||this.map.getView().calculateExtent(),r||this.map.getView().getZoom())}setBbox(n,u){let r=n,s=u;!r&&this.isUpdateBboxOnMoveEnd&&(r=n||this.map.getView().calculateExtent(),s=Math.floor(this.map.getView().getZoom())),super.setBbox(r,s)}highlightTrajectory(n){this.api.getFullTrajectory(n,this.mode,this.generalizationLevel).then(u=>{let r=u.content;if(this.vectorLayer.getSource().clear(),!r||!r.features||!r.features.length)return;let s=pT.readFeatures(r);this.vectorLayer.getSource().addFeatures(s)})}clone(n){return new Ad({...this.options,...n})}},m1=Ad;var Pd=class extends Is{getFeatureInfoAtCoordinate(p){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(p);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:p})}clone(p){return new Pd({...this.options,...p})}},g1=Pd;var Md=class extends Is{constructor(n){super(n);this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(n){if(!this.map)return;let u=this.map.getView().getProjection(),r=this.map.getView().getResolution();if(r&&u&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(n,r,u,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(n){this.abortController?.abort(),this.abortController=new AbortController;let{signal:u}=this.abortController,r=this.getFeatureInfoUrl(n);return r?fetch(r,{signal:u}).then(s=>s.json()).then(s=>s.features).then(s=>({layer:this,coordinate:n,features:s.map(P=>this.format.readFeature(P))})).catch(()=>Promise.resolve({features:[],coordinate:n,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:n,layer:this}))}clone(n){return new Md({...this.options,...n})}},y1=Md;var wg={};ay(wg,{CopyrightControl:()=>_1,Layer:()=>vg,RealtimeAPI:()=>$f,RealtimeLayer:()=>L1,RealtimeModes:()=>ia,RoutingAPI:()=>Zf,StopsAPI:()=>Wf,compareDepartures:()=>id,createRealtimeFilters:()=>hy,debounceDeparturesMessages:()=>Ay,debounceWebsocketMessages:()=>Xf,getCircleCanvas:()=>Oy,getDelayBgCanvas:()=>zy,getDelayTextCanvas:()=>Dy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>Kf,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getMercatorResolution:()=>bg,getSourceCoordinates:()=>Rd,getTextCanvas:()=>Fy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Zh,pad:()=>zm,realtimeConfig:()=>rf,realtimeDefaultStyle:()=>Kh,realtimeDelayStyle:()=>By,realtimeSimpleStyle:()=>Uy,removeDuplicate:()=>Wh,renderTrajectories:()=>Hf,sortAndFilterDepartures:()=>nd,sortByDelay:()=>py});var G_=class extends Wm{constructor(p){super(p),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return oc(this.map)}},_1=G_;var kd=class extends hg(ip){attachToMap(n){super.attachToMap(n),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ha(this.onChangeVisibleKey)),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&this.map.on("click",this.onUserClickCallback),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&this.map.on("mousemove",this.onUserMoveCallback)}deactivateUserInteractions(){this.map&&(this.map.off("mousemove",this.onUserMoveCallback),this.map.off("click",this.onUserClickCallback))}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}getMercatorExtent(){let n=this.map.getBounds().toArray();return td([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new kd({...this.options,...n})}},vg=kd;var jo=63710088e-1,v1={centimeters:jo*100,centimetres:jo*100,degrees:jo/111325,feet:jo*3.28084,inches:jo*39.37,kilometers:jo/1e3,kilometres:jo/1e3,meters:jo,metres:jo,miles:jo/1609.344,millimeters:jo*1e3,millimetres:jo*1e3,nauticalmiles:jo/1852,radians:1,yards:jo*1.0936},P5={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/jo,yards:1.0936133};function x1(y,p,n){n===void 0&&(n={});var u={type:"Feature"};return(n.id===0||n.id)&&(u.id=n.id),n.bbox&&(u.bbox=n.bbox),u.properties=p||{},u.geometry=y,u}function xh(y,p,n){if(n===void 0&&(n={}),!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!j_(y[0])||!j_(y[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:y};return x1(u,p,n)}function fT(y,p){p===void 0&&(p="kilometers");var n=v1[p];if(!n)throw new Error(p+" units is invalid");return y*n}function dT(y,p){p===void 0&&(p="kilometers");var n=v1[p];if(!n)throw new Error(p+" units is invalid");return y/n}function b1(y){var p=y%(2*Math.PI);return p*180/Math.PI}function ap(y){var p=y%360;return p*Math.PI/180}function xg(y,p,n){if(p===void 0&&(p="kilometers"),n===void 0&&(n="kilometers"),!(y>=0))throw new Error("length must be a positive number");return fT(dT(y,p),n)}function j_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function q_(y){return!!y&&y.constructor===Object}function Ld(y,p,n){if(y!==null)for(var u,r,s,P,z,F,N,V=0,me=0,_e,Se=y.type,Ue=Se==="FeatureCollection",He=Se==="Feature",Ie=Ue?y.features.length:1,Ge=0;Ge<Ie;Ge++){N=Ue?y.features[Ge].geometry:He?y.geometry:y,_e=N?N.type==="GeometryCollection":!1,z=_e?N.geometries.length:1;for(var Je=0;Je<z;Je++){var rt=0,_t=0;if(P=_e?N.geometries[Je]:N,P!==null){F=P.coordinates;var yt=P.type;switch(V=n&&(yt==="Polygon"||yt==="MultiPolygon")?1:0,yt){case null:break;case"Point":if(p(F,me,Ge,rt,_t)===!1)return!1;me++,rt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(p(F[u],me,Ge,rt,_t)===!1)return!1;me++,yt==="MultiPoint"&&rt++}yt==="LineString"&&rt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-V;r++){if(p(F[u][r],me,Ge,rt,_t)===!1)return!1;me++}yt==="MultiLineString"&&rt++,yt==="Polygon"&&_t++}yt==="Polygon"&&rt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(_t=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-V;s++){if(p(F[u][r][s],me,Ge,rt,_t)===!1)return!1;me++}_t++}rt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(Ld(P.geometries[u],p,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function mT(y,p){p===void 0&&(p={});var n=0,u=0,r=0;return Ld(y,function(s){n+=s[0],u+=s[1],r++},!0),xh([n/r,u/r],p.properties)}var w1=mT;function Mu(y){if(!y)throw new Error("coord is required");if(!Array.isArray(y)){if(y.type==="Feature"&&y.geometry!==null&&y.geometry.type==="Point")return y.geometry.coordinates;if(y.type==="Point")return y.coordinates}if(Array.isArray(y)&&y.length>=2&&!Array.isArray(y[0])&&!Array.isArray(y[1]))return y;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function E1(y){if(Array.isArray(y))return y;if(y.type==="Feature"){if(y.geometry!==null)return y.geometry.coordinates}else if(y.coordinates)return y.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function gT(y,p,n){n===void 0&&(n={});var u;n.final?u=T1(Mu(p),Mu(y)):u=T1(Mu(y),Mu(p));var r=u>180?-(360-u):u;return r}function T1(y,p){var n=ap(y[1]),u=ap(p[1]),r=ap(p[0]-y[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),P=Math.atan2(r,s);return(b1(P)+360)%360}var S1=gT;function yT(y,p,n){n===void 0&&(n={});var u=Mu(y),r=Mu(p);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=_T(u,r),P=xg(s,"meters",n.units);return P}function _T(y,p,n){n=n===void 0?jo:Number(n);var u=n,r=y[1]*Math.PI/180,s=p[1]*Math.PI/180,P=s-r,z=Math.abs(p[0]-y[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var F=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),N=Math.abs(F)>1e-11?P/F:Math.cos(r),V=Math.sqrt(P*P+N*N*z*z),me=V*u;return me}var I1=yT;function vT(y,p,n,u){u===void 0&&(u={});var r=p<0,s=xg(Math.abs(p),u.units,"meters");r&&(s=-Math.abs(s));var P=Mu(y),z=xT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,xh(z,u.properties)}function xT(y,p,n,u){u=u===void 0?jo:Number(u);var r=p/u,s=y[0]*Math.PI/180,P=ap(y[1]),z=ap(n),F=r*Math.cos(z),N=P+F;Math.abs(N)>Math.PI/2&&(N=N>0?Math.PI-N:-Math.PI-N);var V=Math.log(Math.tan(N/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(V)>1e-11?F/V:Math.cos(P),_e=r*Math.sin(z)/me,Se=s+_e;return[(Se*180/Math.PI+540)%360-180,N*180/Math.PI]}var C1=vT;function bT(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return A1(y);case"FeatureCollection":return wT(y);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Z_(y);default:throw new Error("unknown GeoJSON type")}}function A1(y){var p={type:"Feature"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:p[n]=y[n]}}),p.properties=P1(y.properties),p.geometry=Z_(y.geometry),p}function P1(y){var p={};return y&&Object.keys(y).forEach(function(n){var u=y[n];typeof u=="object"?u===null?p[n]=null:Array.isArray(u)?p[n]=u.map(function(r){return r}):p[n]=P1(u):p[n]=u}),p}function wT(y){var p={type:"FeatureCollection"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"features":return;default:p[n]=y[n]}}),p.features=y.features.map(function(n){return A1(n)}),p}function Z_(y){var p={type:y.type};return y.bbox&&(p.bbox=y.bbox),y.type==="GeometryCollection"?(p.geometries=y.geometries.map(function(n){return Z_(n)}),p):(p.coordinates=M1(y.coordinates),p)}function M1(y){var p=y;return typeof p[0]!="object"?p.slice():p.map(function(n){return M1(n)})}var k1=bT;function ET(y,p,n){if(n=n||{},!q_(n))throw new Error("options is invalid");var u=n.pivot,r=n.mutate;if(!y)throw new Error("geojson is required");if(p==null||isNaN(p))throw new Error("angle is required");return p===0||(u||(u=w1(y)),(r===!1||r===void 0)&&(y=k1(y)),Ld(y,function(s){var P=S1(u,s),z=P+p,F=I1(u,s),N=E1(C1(u,F,z));s[0]=N[0],s[1]=N[1]})),y}var W_=ET;var TT=(y,p=1)=>{let{width:n,height:u}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:u/p}),P=y.unproject({x:n/p,y:u/p}),z=y.unproject({x:n/p,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Rd=TT;var ST=y=>{let p=y.getBounds().toArray(),n=co(p[0]),u=co(p[1]),r=[...n,...u],{width:s,height:P}=y.getCanvas(),z=bs(r)/s,F=Eu(r)/P;return Math.max(z,F)},bg=ST;var X_=class extends gg(vg){constructor(p={}){super({...p}),this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this)}attachToMap(p,n){!p||(super.attachToMap(p),this.source={type:"canvas",canvas:this.canvas,coordinates:Rd(p,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=n,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},p.isStyleLoaded()&&this.onLoad(),this.map.on("load",this.onLoad),this.listeners=[this.on("change:visible",this.onVisibilityChange)])}detachFromMap(){this.map&&(this.map.off("load",this.onLoad),this.listeners.forEach(p=>{Ha(p)}),this.map.style&&this.map.getLayer(this.key)&&this.map.removeLayer(this.key),this.map.style&&this.map.getSource(this.key)&&this.map.removeSource(this.key)),super.detachFromMap()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map&&(this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd),this.map.off("zoomend",this.onZoomEnd))}onLoad(){this.map.getSource(this.key)||this.map.addSource(this.key,this.source),this.map.getLayer(this.key)||this.map.addLayer(this.layer,this.beforeId)}onUserMoveCallback(p){super.onUserMoveCallback({coordinate:co(p.lngLat.toArray()),...p})}renderTrajectories(p=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:n,height:u}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:u/this.pixelRatio}),P=this.map.unproject({x:n/this.pixelRatio,y:0}),z=W_(xh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=W_(xh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,N=[...co(z),...co(F)],V=bs(N)/(n/this.pixelRatio),me=Eu(N)/(u/this.pixelRatio),_e=Math.max(V,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:co([r.lng,r.lat]),extent:N,resolution:_e,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,p)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(p,n={}){let u=bg(this.map);return super.getFeatureInfoAtCoordinate(p,{resolution:u,...n})}onVisibilityChange(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}purgeTrajectory(p,n,u){return super.purgeTrajectory(p,n||this.getMercatorExtent(),u||Math.floor(this.map.getZoom()+1))}setBbox(p,n){let u=p,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=p||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(p,n=!1){let u=super.renderTrajectoriesInternal(p,n);if(u&&this.map.style){let r=Rd(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return u}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(p,n,u){super.onFeatureHover(p,n,u),this.map.getCanvasContainer().style.cursor=p.length?"pointer":"auto"}},L1=X_;var $_={ol:_g,mapbox:wg};typeof window<"u"&&(window.mbt=$_);var M3=$_;})();
1083
1083
  //# sourceMappingURL=mbt.min.js.map