From 683eb68e30a929dc4a229c6e7005eefd8d9b308b Mon Sep 17 00:00:00 2001 From: yuiseki Date: Sun, 17 Dec 2023 08:32:09 +0000 Subject: [PATCH] deploy: bf66f0591cd6a0d9a8e24513aa16555bc65c169b --- assets/{index-qqCuPnjh.js => index-S0NYEXJl.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-qqCuPnjh.js => index-S0NYEXJl.js} (99%) diff --git a/assets/index-qqCuPnjh.js b/assets/index-S0NYEXJl.js similarity index 99% rename from assets/index-qqCuPnjh.js rename to assets/index-S0NYEXJl.js index a77dc71..6d021dd 100644 --- a/assets/index-qqCuPnjh.js +++ b/assets/index-S0NYEXJl.js @@ -616,7 +616,7 @@ uniform ${P} ${M} u_${F}; `),K=b.createShader(b.FRAGMENT_SHADER);if(b.isContextLost())return void(this.failedToCreate=!0);if(b.shaderSource(K,re),b.compileShader(K),!b.getShaderParameter(K,b.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${b.getShaderInfoLog(K)}`);b.attachShader(this.program,K);const oe=b.createShader(b.VERTEX_SHADER);if(b.isContextLost())return void(this.failedToCreate=!0);if(b.shaderSource(oe,pe),b.compileShader(oe),!b.getShaderParameter(oe,b.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${b.getShaderInfoLog(oe)}`);b.attachShader(this.program,oe),this.attributes={};const me={};this.numAttributes=P.length;for(let ge=0;ge({u_depth:new u.aL(ge,xe.u_depth),u_terrain:new u.aL(ge,xe.u_terrain),u_terrain_dim:new u.aM(ge,xe.u_terrain_dim),u_terrain_matrix:new u.aN(ge,xe.u_terrain_matrix),u_terrain_unpack:new u.aO(ge,xe.u_terrain_unpack),u_terrain_exaggeration:new u.aM(ge,xe.u_terrain_exaggeration)}))(t,me),this.binderUniforms=c?c.getUniforms(t,me):[]}draw(t,o,c,d,g,x,b,T,E,P,M,F,Z,$,G,U,re,pe){const K=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(c),t.setStencilMode(d),t.setColorMode(g),t.setCullFace(x),T){t.activeTexture.set(K.TEXTURE2),K.bindTexture(K.TEXTURE_2D,T.depthTexture),t.activeTexture.set(K.TEXTURE3),K.bindTexture(K.TEXTURE_2D,T.texture);for(const me in this.terrainUniforms)this.terrainUniforms[me].set(T[me])}for(const me in this.fixedUniforms)this.fixedUniforms[me].set(b[me]);G&&G.setUniforms(t,this.binderUniforms,Z,{zoom:$});let oe=0;switch(o){case K.LINES:oe=2;break;case K.TRIANGLES:oe=3;break;case K.LINE_STRIP:oe=1}for(const me of F.get()){const ge=me.vaos||(me.vaos={});(ge[E]||(ge[E]=new Is)).bind(t,this,P,G?G.getPaintVertexBuffers():[],M,me.vertexOffset,U,re,pe),K.drawElements(o,me.primitiveLength*oe,K.UNSIGNED_SHORT,me.primitiveOffset*oe*2)}}}function Wn(f,t,o){const c=1/ie(o,1,t.transform.tileZoom),d=Math.pow(2,o.tileID.overscaledZ),g=o.tileSize*Math.pow(2,t.transform.tileZoom)/d,x=g*(o.tileID.canonical.x+o.tileID.wrap*d),b=g*o.tileID.canonical.y;return{u_image:0,u_texsize:o.imageAtlasTexture.size,u_scale:[c,f.fromScale,f.toScale],u_fade:f.t,u_pixel_coord_upper:[x>>16,b>>16],u_pixel_coord_lower:[65535&x,65535&b]}}const Wl=(f,t,o,c)=>{const d=t.style.light,g=d.properties.get("position"),x=[g.x,g.y,g.z],b=function(){var E=new u.A(9);return u.A!=Float32Array&&(E[1]=0,E[2]=0,E[3]=0,E[5]=0,E[6]=0,E[7]=0),E[0]=1,E[4]=1,E[8]=1,E}();d.properties.get("anchor")==="viewport"&&function(E,P){var M=Math.sin(P),F=Math.cos(P);E[0]=F,E[1]=M,E[2]=0,E[3]=-M,E[4]=F,E[5]=0,E[6]=0,E[7]=0,E[8]=1}(b,-t.transform.angle),function(E,P,M){var F=P[0],Z=P[1],$=P[2];E[0]=F*M[0]+Z*M[3]+$*M[6],E[1]=F*M[1]+Z*M[4]+$*M[7],E[2]=F*M[2]+Z*M[5]+$*M[8]}(x,x,b);const T=d.properties.get("color");return{u_matrix:f,u_lightpos:x,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+o,u_opacity:c}},us=(f,t,o,c,d,g,x)=>u.e(Wl(f,t,o,c),Wn(g,t,x),{u_height_factor:-Math.pow(2,d.overscaledZ)/x.tileSize/8}),Wc=f=>({u_matrix:f}),Xl=(f,t,o,c)=>u.e(Wc(f),Wn(o,t,c)),Aa=(f,t)=>({u_matrix:f,u_world:t}),Da=(f,t,o,c,d)=>u.e(Xl(f,t,o,c),{u_world:d}),cs=(f,t,o,c)=>{const d=f.transform;let g,x;if(c.paint.get("circle-pitch-alignment")==="map"){const b=ie(o,1,d.zoom);g=!0,x=[b,b]}else g=!1,x=d.pixelsToGLUnits;return{u_camera_to_center_distance:d.cameraToCenterDistance,u_scale_with_map:+(c.paint.get("circle-pitch-scale")==="map"),u_matrix:f.translatePosMatrix(t.posMatrix,o,c.paint.get("circle-translate"),c.paint.get("circle-translate-anchor")),u_pitch_with_map:+g,u_device_pixel_ratio:f.pixelRatio,u_extrude_scale:x}},Kl=(f,t,o)=>{const c=ie(o,1,t.zoom),d=Math.pow(2,t.zoom-o.tileID.overscaledZ),g=o.tileID.overscaleFactor();return{u_matrix:f,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:c,u_extrude_scale:[t.pixelsToGLUnits[0]/(c*d),t.pixelsToGLUnits[1]/(c*d)],u_overscale_factor:g}},Go=(f,t,o=1)=>({u_matrix:f,u_color:t,u_overlay:0,u_overlay_scale:o}),Xc=f=>({u_matrix:f}),xp=(f,t,o,c)=>({u_matrix:f,u_extrude_scale:ie(t,1,o),u_intensity:c});function Yl(f,t){const o=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new u.U(0,c/o).toLngLat().lat,new u.U(0,(c+1)/o).toLngLat().lat]}const Ql=(f,t,o,c)=>{const d=f.transform;return{u_matrix:La(f,t,o,c),u_ratio:1/ie(t,1,d.zoom),u_device_pixel_ratio:f.pixelRatio,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},Kc=(f,t,o,c,d)=>u.e(Ql(f,t,o,d),{u_image:0,u_image_height:c}),wp=(f,t,o,c,d)=>{const g=f.transform,x=Qc(t,g);return{u_matrix:La(f,t,o,d),u_texsize:t.imageAtlasTexture.size,u_ratio:1/ie(t,1,g.zoom),u_device_pixel_ratio:f.pixelRatio,u_image:0,u_scale:[x,c.fromScale,c.toScale],u_fade:c.t,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},Yc=(f,t,o,c,d,g)=>{const x=f.lineAtlas,b=Qc(t,f.transform),T=o.layout.get("line-cap")==="round",E=x.getDash(c.from,T),P=x.getDash(c.to,T),M=E.width*d.fromScale,F=P.width*d.toScale;return u.e(Ql(f,t,o,g),{u_patternscale_a:[b/M,-E.height/2],u_patternscale_b:[b/F,-P.height/2],u_sdfgamma:x.width/(256*Math.min(M,F)*f.pixelRatio)/2,u_image:0,u_tex_y_a:E.y,u_tex_y_b:P.y,u_mix:d.t})};function Qc(f,t){return 1/ie(f,1,t.tileZoom)}function La(f,t,o,c){return f.translatePosMatrix(c?c.posMatrix:t.tileID.posMatrix,t,o.paint.get("line-translate"),o.paint.get("line-translate-anchor"))}const Jc=(f,t,o,c,d)=>{return{u_matrix:f,u_tl_parent:t,u_scale_parent:o,u_buffer_scale:1,u_fade_t:c.mix,u_opacity:c.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:(x=d.paint.get("raster-saturation"),x>0?1-1/(1.001-x):-x),u_contrast_factor:(g=d.paint.get("raster-contrast"),g>0?1/(1-g):1+g),u_spin_weights:eh(d.paint.get("raster-hue-rotate"))};var g,x};function eh(f){f*=Math.PI/180;const t=Math.sin(f),o=Math.cos(f);return[(2*o+1)/3,(-Math.sqrt(3)*t-o+1)/3,(Math.sqrt(3)*t-o+1)/3]}const Jl=(f,t,o,c,d,g,x,b,T,E)=>{const P=d.transform;return{u_is_size_zoom_constant:+(f==="constant"||f==="source"),u_is_size_feature_constant:+(f==="constant"||f==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:P.cameraToCenterDistance,u_pitch:P.pitch/360*2*Math.PI,u_rotate_symbol:+o,u_aspect_ratio:P.width/P.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:g,u_label_plane_matrix:x,u_coord_matrix:b,u_is_text:+T,u_pitch_with_map:+c,u_texsize:E,u_texture:0}},eu=(f,t,o,c,d,g,x,b,T,E,P)=>{const M=d.transform;return u.e(Jl(f,t,o,c,d,g,x,b,T,E),{u_gamma_scale:c?Math.cos(M._pitch)*M.cameraToCenterDistance:1,u_device_pixel_ratio:d.pixelRatio,u_is_halo:+P})},Cs=(f,t,o,c,d,g,x,b,T,E)=>u.e(eu(f,t,o,c,d,g,x,b,!0,T,!0),{u_texsize_icon:E,u_texture_icon:1}),Ra=(f,t,o)=>({u_matrix:f,u_opacity:t,u_color:o}),Xn=(f,t,o,c,d,g)=>u.e(function(x,b,T,E){const P=T.imageManager.getPattern(x.from.toString()),M=T.imageManager.getPattern(x.to.toString()),{width:F,height:Z}=T.imageManager.getPixelSize(),$=Math.pow(2,E.tileID.overscaledZ),G=E.tileSize*Math.pow(2,T.transform.tileZoom)/$,U=G*(E.tileID.canonical.x+E.tileID.wrap*$),re=G*E.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:P.tl,u_pattern_br_a:P.br,u_pattern_tl_b:M.tl,u_pattern_br_b:M.br,u_texsize:[F,Z],u_mix:b.t,u_pattern_size_a:P.displaySize,u_pattern_size_b:M.displaySize,u_scale_a:b.fromScale,u_scale_b:b.toScale,u_tile_units_to_pixels:1/ie(E,1,T.transform.tileZoom),u_pixel_coord_upper:[U>>16,re>>16],u_pixel_coord_lower:[65535&U,65535&re]}}(c,g,o,d),{u_matrix:f,u_opacity:t}),Fa={fillExtrusion:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_lightpos:new u.aP(f,t.u_lightpos),u_lightintensity:new u.aM(f,t.u_lightintensity),u_lightcolor:new u.aP(f,t.u_lightcolor),u_vertical_gradient:new u.aM(f,t.u_vertical_gradient),u_opacity:new u.aM(f,t.u_opacity)}),fillExtrusionPattern:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_lightpos:new u.aP(f,t.u_lightpos),u_lightintensity:new u.aM(f,t.u_lightintensity),u_lightcolor:new u.aP(f,t.u_lightcolor),u_vertical_gradient:new u.aM(f,t.u_vertical_gradient),u_height_factor:new u.aM(f,t.u_height_factor),u_image:new u.aL(f,t.u_image),u_texsize:new u.aQ(f,t.u_texsize),u_pixel_coord_upper:new u.aQ(f,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aQ(f,t.u_pixel_coord_lower),u_scale:new u.aP(f,t.u_scale),u_fade:new u.aM(f,t.u_fade),u_opacity:new u.aM(f,t.u_opacity)}),fill:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix)}),fillPattern:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_image:new u.aL(f,t.u_image),u_texsize:new u.aQ(f,t.u_texsize),u_pixel_coord_upper:new u.aQ(f,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aQ(f,t.u_pixel_coord_lower),u_scale:new u.aP(f,t.u_scale),u_fade:new u.aM(f,t.u_fade)}),fillOutline:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_world:new u.aQ(f,t.u_world)}),fillOutlinePattern:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_world:new u.aQ(f,t.u_world),u_image:new u.aL(f,t.u_image),u_texsize:new u.aQ(f,t.u_texsize),u_pixel_coord_upper:new u.aQ(f,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aQ(f,t.u_pixel_coord_lower),u_scale:new u.aP(f,t.u_scale),u_fade:new u.aM(f,t.u_fade)}),circle:(f,t)=>({u_camera_to_center_distance:new u.aM(f,t.u_camera_to_center_distance),u_scale_with_map:new u.aL(f,t.u_scale_with_map),u_pitch_with_map:new u.aL(f,t.u_pitch_with_map),u_extrude_scale:new u.aQ(f,t.u_extrude_scale),u_device_pixel_ratio:new u.aM(f,t.u_device_pixel_ratio),u_matrix:new u.aN(f,t.u_matrix)}),collisionBox:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_camera_to_center_distance:new u.aM(f,t.u_camera_to_center_distance),u_pixels_to_tile_units:new u.aM(f,t.u_pixels_to_tile_units),u_extrude_scale:new u.aQ(f,t.u_extrude_scale),u_overscale_factor:new u.aM(f,t.u_overscale_factor)}),collisionCircle:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_inv_matrix:new u.aN(f,t.u_inv_matrix),u_camera_to_center_distance:new u.aM(f,t.u_camera_to_center_distance),u_viewport_size:new u.aQ(f,t.u_viewport_size)}),debug:(f,t)=>({u_color:new u.aR(f,t.u_color),u_matrix:new u.aN(f,t.u_matrix),u_overlay:new u.aL(f,t.u_overlay),u_overlay_scale:new u.aM(f,t.u_overlay_scale)}),clippingMask:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix)}),heatmap:(f,t)=>({u_extrude_scale:new u.aM(f,t.u_extrude_scale),u_intensity:new u.aM(f,t.u_intensity),u_matrix:new u.aN(f,t.u_matrix)}),heatmapTexture:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_world:new u.aQ(f,t.u_world),u_image:new u.aL(f,t.u_image),u_color_ramp:new u.aL(f,t.u_color_ramp),u_opacity:new u.aM(f,t.u_opacity)}),hillshade:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_image:new u.aL(f,t.u_image),u_latrange:new u.aQ(f,t.u_latrange),u_light:new u.aQ(f,t.u_light),u_shadow:new u.aR(f,t.u_shadow),u_highlight:new u.aR(f,t.u_highlight),u_accent:new u.aR(f,t.u_accent)}),hillshadePrepare:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_image:new u.aL(f,t.u_image),u_dimension:new u.aQ(f,t.u_dimension),u_zoom:new u.aM(f,t.u_zoom),u_unpack:new u.aO(f,t.u_unpack)}),line:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_ratio:new u.aM(f,t.u_ratio),u_device_pixel_ratio:new u.aM(f,t.u_device_pixel_ratio),u_units_to_pixels:new u.aQ(f,t.u_units_to_pixels)}),lineGradient:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_ratio:new u.aM(f,t.u_ratio),u_device_pixel_ratio:new u.aM(f,t.u_device_pixel_ratio),u_units_to_pixels:new u.aQ(f,t.u_units_to_pixels),u_image:new u.aL(f,t.u_image),u_image_height:new u.aM(f,t.u_image_height)}),linePattern:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_texsize:new u.aQ(f,t.u_texsize),u_ratio:new u.aM(f,t.u_ratio),u_device_pixel_ratio:new u.aM(f,t.u_device_pixel_ratio),u_image:new u.aL(f,t.u_image),u_units_to_pixels:new u.aQ(f,t.u_units_to_pixels),u_scale:new u.aP(f,t.u_scale),u_fade:new u.aM(f,t.u_fade)}),lineSDF:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_ratio:new u.aM(f,t.u_ratio),u_device_pixel_ratio:new u.aM(f,t.u_device_pixel_ratio),u_units_to_pixels:new u.aQ(f,t.u_units_to_pixels),u_patternscale_a:new u.aQ(f,t.u_patternscale_a),u_patternscale_b:new u.aQ(f,t.u_patternscale_b),u_sdfgamma:new u.aM(f,t.u_sdfgamma),u_image:new u.aL(f,t.u_image),u_tex_y_a:new u.aM(f,t.u_tex_y_a),u_tex_y_b:new u.aM(f,t.u_tex_y_b),u_mix:new u.aM(f,t.u_mix)}),raster:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_tl_parent:new u.aQ(f,t.u_tl_parent),u_scale_parent:new u.aM(f,t.u_scale_parent),u_buffer_scale:new u.aM(f,t.u_buffer_scale),u_fade_t:new u.aM(f,t.u_fade_t),u_opacity:new u.aM(f,t.u_opacity),u_image0:new u.aL(f,t.u_image0),u_image1:new u.aL(f,t.u_image1),u_brightness_low:new u.aM(f,t.u_brightness_low),u_brightness_high:new u.aM(f,t.u_brightness_high),u_saturation_factor:new u.aM(f,t.u_saturation_factor),u_contrast_factor:new u.aM(f,t.u_contrast_factor),u_spin_weights:new u.aP(f,t.u_spin_weights)}),symbolIcon:(f,t)=>({u_is_size_zoom_constant:new u.aL(f,t.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aL(f,t.u_is_size_feature_constant),u_size_t:new u.aM(f,t.u_size_t),u_size:new u.aM(f,t.u_size),u_camera_to_center_distance:new u.aM(f,t.u_camera_to_center_distance),u_pitch:new u.aM(f,t.u_pitch),u_rotate_symbol:new u.aL(f,t.u_rotate_symbol),u_aspect_ratio:new u.aM(f,t.u_aspect_ratio),u_fade_change:new u.aM(f,t.u_fade_change),u_matrix:new u.aN(f,t.u_matrix),u_label_plane_matrix:new u.aN(f,t.u_label_plane_matrix),u_coord_matrix:new u.aN(f,t.u_coord_matrix),u_is_text:new u.aL(f,t.u_is_text),u_pitch_with_map:new u.aL(f,t.u_pitch_with_map),u_texsize:new u.aQ(f,t.u_texsize),u_texture:new u.aL(f,t.u_texture)}),symbolSDF:(f,t)=>({u_is_size_zoom_constant:new u.aL(f,t.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aL(f,t.u_is_size_feature_constant),u_size_t:new u.aM(f,t.u_size_t),u_size:new u.aM(f,t.u_size),u_camera_to_center_distance:new u.aM(f,t.u_camera_to_center_distance),u_pitch:new u.aM(f,t.u_pitch),u_rotate_symbol:new u.aL(f,t.u_rotate_symbol),u_aspect_ratio:new u.aM(f,t.u_aspect_ratio),u_fade_change:new u.aM(f,t.u_fade_change),u_matrix:new u.aN(f,t.u_matrix),u_label_plane_matrix:new u.aN(f,t.u_label_plane_matrix),u_coord_matrix:new u.aN(f,t.u_coord_matrix),u_is_text:new u.aL(f,t.u_is_text),u_pitch_with_map:new u.aL(f,t.u_pitch_with_map),u_texsize:new u.aQ(f,t.u_texsize),u_texture:new u.aL(f,t.u_texture),u_gamma_scale:new u.aM(f,t.u_gamma_scale),u_device_pixel_ratio:new u.aM(f,t.u_device_pixel_ratio),u_is_halo:new u.aL(f,t.u_is_halo)}),symbolTextAndIcon:(f,t)=>({u_is_size_zoom_constant:new u.aL(f,t.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aL(f,t.u_is_size_feature_constant),u_size_t:new u.aM(f,t.u_size_t),u_size:new u.aM(f,t.u_size),u_camera_to_center_distance:new u.aM(f,t.u_camera_to_center_distance),u_pitch:new u.aM(f,t.u_pitch),u_rotate_symbol:new u.aL(f,t.u_rotate_symbol),u_aspect_ratio:new u.aM(f,t.u_aspect_ratio),u_fade_change:new u.aM(f,t.u_fade_change),u_matrix:new u.aN(f,t.u_matrix),u_label_plane_matrix:new u.aN(f,t.u_label_plane_matrix),u_coord_matrix:new u.aN(f,t.u_coord_matrix),u_is_text:new u.aL(f,t.u_is_text),u_pitch_with_map:new u.aL(f,t.u_pitch_with_map),u_texsize:new u.aQ(f,t.u_texsize),u_texsize_icon:new u.aQ(f,t.u_texsize_icon),u_texture:new u.aL(f,t.u_texture),u_texture_icon:new u.aL(f,t.u_texture_icon),u_gamma_scale:new u.aM(f,t.u_gamma_scale),u_device_pixel_ratio:new u.aM(f,t.u_device_pixel_ratio),u_is_halo:new u.aL(f,t.u_is_halo)}),background:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_opacity:new u.aM(f,t.u_opacity),u_color:new u.aR(f,t.u_color)}),backgroundPattern:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_opacity:new u.aM(f,t.u_opacity),u_image:new u.aL(f,t.u_image),u_pattern_tl_a:new u.aQ(f,t.u_pattern_tl_a),u_pattern_br_a:new u.aQ(f,t.u_pattern_br_a),u_pattern_tl_b:new u.aQ(f,t.u_pattern_tl_b),u_pattern_br_b:new u.aQ(f,t.u_pattern_br_b),u_texsize:new u.aQ(f,t.u_texsize),u_mix:new u.aM(f,t.u_mix),u_pattern_size_a:new u.aQ(f,t.u_pattern_size_a),u_pattern_size_b:new u.aQ(f,t.u_pattern_size_b),u_scale_a:new u.aM(f,t.u_scale_a),u_scale_b:new u.aM(f,t.u_scale_b),u_pixel_coord_upper:new u.aQ(f,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aQ(f,t.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aM(f,t.u_tile_units_to_pixels)}),terrain:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_texture:new u.aL(f,t.u_texture),u_ele_delta:new u.aM(f,t.u_ele_delta)}),terrainDepth:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_ele_delta:new u.aM(f,t.u_ele_delta)}),terrainCoords:(f,t)=>({u_matrix:new u.aN(f,t.u_matrix),u_texture:new u.aL(f,t.u_texture),u_terrain_coords_id:new u.aM(f,t.u_terrain_coords_id),u_ele_delta:new u.aM(f,t.u_ele_delta)})};class Ba{constructor(t,o,c){this.context=t;const d=t.gl;this.buffer=d.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete o.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const o=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ho={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Oa{constructor(t,o,c,d){this.length=o.length,this.attributes=c,this.itemSize=o.bytesPerElement,this.dynamicDraw=d,this.context=t;const g=t.gl;this.buffer=g.createBuffer(),t.bindVertexBuffer.set(this.buffer),g.bufferData(g.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete o.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,o){for(let c=0;c0){const Pe=u.Z(),Xe=xe;u.aU(Pe,ge.placementInvProjMatrix,f.transform.glCoordMatrix),u.aU(Pe,Pe,ge.placementViewportMatrix),P.push({circleArray:Te,circleOffset:F,transform:Xe,invTransform:Pe,coord:oe}),M+=Te.length/4,F=M}Ee&&E.draw(b,T.LINES,St.disabled,ei.disabled,f.colorModeForRenderPass(),Kt.disabled,Kl(xe,f.transform,me),f.style.map.terrain&&f.style.map.terrain.getTerrainData(oe),o.id,Ee.layoutVertexBuffer,Ee.indexBuffer,Ee.segments,null,f.transform.zoom,null,null,Ee.collisionVertexBuffer)}if(!x||!P.length)return;const Z=f.useProgram("collisionCircle"),$=new u.aV;$.resize(4*M),$._trim();let G=0;for(const K of P)for(let oe=0;oe=0&&($[U.associatedIconIndex]={shiftedAnchor:vt,angle:Fe})}else V(U.numGlyphs,F)}if(E){Z.clear();const G=f.icon.placedSymbolArray;for(let U=0;Uf.style.map.terrain.getElevation(Ee,vn,di):null,Pi=o.layout.get("text-rotation-alignment")==="map";Re(Pe,Ee.posMatrix,f,d,Wt,Sr,U,E,Pi,hi)}const Rs=f.translatePosMatrix(Ee.posMatrix,Te,g,x),_o=re||d&&ge||ms?hu:Wt,Ki=f.translatePosMatrix(Sr,Te,g,x,!0),$i=Fe&&o.paint.get(d?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ln;ln=Fe?Pe.iconsInText?Cs(ot.kind,_t,pe,U,f,Rs,_o,Ki,xt,Ci):eu(ot.kind,_t,pe,U,f,Rs,_o,Ki,d,xt,!0):Jl(ot.kind,_t,pe,U,f,Rs,_o,Ki,d,xt);const Fs={program:Ot,buffers:Xe,uniformValues:ln,atlasTexture:ci,atlasTextureIcon:yi,atlasInterpolation:qt,atlasInterpolationIcon:ji,isSDF:Fe,hasHalo:$i};if(K&&Pe.canOverlap){oe=!0;const hi=Xe.segments.get();for(const Pi of hi)xe.push({segments:new u.S([Pi]),sortKey:Pi.sortKey,state:Fs,terrainData:mt})}else xe.push({segments:Xe.segments,sortKey:0,state:Fs,terrainData:mt})}oe&&xe.sort((Ee,Te)=>Ee.sortKey-Te.sortKey);for(const Ee of xe){const Te=Ee.state;if(F.activeTexture.set(Z.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,Z.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(F.activeTexture.set(Z.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,Z.CLAMP_TO_EDGE)),Te.isSDF){const Pe=Te.uniformValues;Te.hasHalo&&(Pe.u_is_halo=1,pu(Te.buffers,Ee.segments,o,f,Te.program,me,P,M,Pe,Ee.terrainData)),Pe.u_is_halo=0}pu(Te.buffers,Ee.segments,o,f,Te.program,me,P,M,Te.uniformValues,Ee.terrainData)}}function pu(f,t,o,c,d,g,x,b,T,E){const P=c.context;d.draw(P,P.gl.TRIANGLES,g,x,b,Kt.disabled,T,E,o.id,f.layoutVertexBuffer,f.indexBuffer,t,o.paint,c.transform.zoom,f.programConfigurations.get(o.id),f.dynamicLayoutVertexBuffer,f.opacityVertexBuffer)}function Xo(f,t,o,c,d){if(!o||!c||!c.imageAtlas)return;const g=c.imageAtlas.patternPositions;let x=g[o.to.toString()],b=g[o.from.toString()];if(!x&&b&&(x=b),!b&&x&&(b=x),!x||!b){const T=d.getPaintProperty(t);x=g[T],b=g[T]}x&&b&&f.setConstantPatternPositions(x,b)}function Ko(f,t,o,c,d,g,x){const b=f.context.gl,T="fill-pattern",E=o.paint.get(T),P=E&&E.constantOr(1),M=o.getCrossfadeParameters();let F,Z,$,G,U;x?(Z=P&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",F=b.LINES):(Z=P?"fillPattern":"fill",F=b.TRIANGLES);const re=E.constantOr(null);for(const pe of c){const K=t.getTile(pe);if(P&&!K.patternsLoaded())continue;const oe=K.getBucket(o);if(!oe)continue;const me=oe.programConfigurations.get(o.id),ge=f.useProgram(Z,me),xe=f.style.map.terrain&&f.style.map.terrain.getTerrainData(pe);P&&(f.context.activeTexture.set(b.TEXTURE0),K.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),me.updatePaintBuffers(M)),Xo(me,T,re,K,o);const Ee=xe?pe:null,Te=f.translatePosMatrix(Ee?Ee.posMatrix:pe.posMatrix,K,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));if(x){G=oe.indexBuffer2,U=oe.segments2;const Pe=[b.drawingBufferWidth,b.drawingBufferHeight];$=Z==="fillOutlinePattern"&&P?Da(Te,f,M,K,Pe):Aa(Te,Pe)}else G=oe.indexBuffer,U=oe.segments,$=P?Xl(Te,f,M,K):Wc(Te);ge.draw(f.context,F,d,f.stencilModeForClipping(pe),g,Kt.disabled,$,xe,o.id,oe.layoutVertexBuffer,G,U,o.paint,f.transform.zoom,me)}}function Yo(f,t,o,c,d,g,x){const b=f.context,T=b.gl,E="fill-extrusion-pattern",P=o.paint.get(E),M=P.constantOr(1),F=o.getCrossfadeParameters(),Z=o.paint.get("fill-extrusion-opacity"),$=P.constantOr(null);for(const G of c){const U=t.getTile(G),re=U.getBucket(o);if(!re)continue;const pe=f.style.map.terrain&&f.style.map.terrain.getTerrainData(G),K=re.programConfigurations.get(o.id),oe=f.useProgram(M?"fillExtrusionPattern":"fillExtrusion",K);M&&(f.context.activeTexture.set(T.TEXTURE0),U.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),K.updatePaintBuffers(F)),Xo(K,E,$,U,o);const me=f.translatePosMatrix(G.posMatrix,U,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),ge=o.paint.get("fill-extrusion-vertical-gradient"),xe=M?us(me,f,ge,Z,G,F,U):Wl(me,f,ge,Z);oe.draw(b,b.gl.TRIANGLES,d,g,x,Kt.backCCW,xe,pe,o.id,re.layoutVertexBuffer,re.indexBuffer,re.segments,o.paint,f.transform.zoom,K,f.style.map.terrain&&re.centroidVertexBuffer)}}function Pp(f,t,o,c,d,g,x){const b=f.context,T=b.gl,E=o.fbo;if(!E)return;const P=f.useProgram("hillshade"),M=f.style.map.terrain&&f.style.map.terrain.getTerrainData(t);b.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,E.colorAttachment.get()),P.draw(b,T.TRIANGLES,d,g,x,Kt.disabled,((F,Z,$,G)=>{const U=$.paint.get("hillshade-shadow-color"),re=$.paint.get("hillshade-highlight-color"),pe=$.paint.get("hillshade-accent-color");let K=$.paint.get("hillshade-illumination-direction")*(Math.PI/180);$.paint.get("hillshade-illumination-anchor")==="viewport"&&(K-=F.transform.angle);const oe=!F.options.moving;return{u_matrix:G?G.posMatrix:F.transform.calculatePosMatrix(Z.tileID.toUnwrapped(),oe),u_image:0,u_latrange:Yl(0,Z.tileID),u_light:[$.paint.get("hillshade-exaggeration"),K],u_shadow:U,u_highlight:re,u_accent:pe}})(f,o,c,M?t:null),M,c.id,f.rasterBoundsBuffer,f.quadTriangleIndexBuffer,f.rasterBoundsSegments)}function fu(f,t,o,c,d,g){const x=f.context,b=x.gl,T=t.dem;if(T&&T.data){const E=T.dim,P=T.stride,M=T.getPixels();if(x.activeTexture.set(b.TEXTURE1),x.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||f.getTileTexture(P),t.demTexture){const Z=t.demTexture;Z.update(M,{premultiply:!1}),Z.bind(b.NEAREST,b.CLAMP_TO_EDGE)}else t.demTexture=new Ge(x,M,b.RGBA,{premultiply:!1}),t.demTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE);x.activeTexture.set(b.TEXTURE0);let F=t.fbo;if(!F){const Z=new Ge(x,{width:E,height:E,data:null},b.RGBA);Z.bind(b.LINEAR,b.CLAMP_TO_EDGE),F=t.fbo=x.createFramebuffer(E,E,!0,!1),F.colorAttachment.set(Z.texture)}x.bindFramebuffer.set(F.framebuffer),x.viewport.set([0,0,E,E]),f.useProgram("hillshadePrepare").draw(x,b.TRIANGLES,c,d,g,Kt.disabled,((Z,$)=>{const G=$.stride,U=u.Z();return u.aS(U,0,u.N,-u.N,0,0,1),u.$(U,U,[0,-u.N,0]),{u_matrix:U,u_image:1,u_dimension:[G,G],u_zoom:Z.overscaledZ,u_unpack:$.getUnpackVector()}})(t.tileID,T),null,o.id,f.rasterBoundsBuffer,f.quadTriangleIndexBuffer,f.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Mp(f,t,o,c,d,g){const x=c.paint.get("raster-fade-duration");if(!g&&x>0){const b=u.h.now(),T=(b-f.timeAdded)/x,E=t?(b-t.timeAdded)/x:-1,P=o.getSource(),M=d.coveringZoomLevel({tileSize:P.tileSize,roundZoom:P.roundZoom}),F=!t||Math.abs(t.tileID.overscaledZ-M)>Math.abs(f.tileID.overscaledZ-M),Z=F&&f.refreshedUponExpiration?1:u.ad(F?T:1-E,0,1);return f.refreshedUponExpiration&&T>=1&&(f.refreshedUponExpiration=!1),t?{opacity:1,mix:1-Z}:{opacity:Z,mix:0}}return{opacity:1,mix:0}}const lh=new u.aT(1,0,0,1),Wa=new u.aT(0,1,0,1),mu=new u.aT(0,0,1,1),uh=new u.aT(1,0,1,1),ch=new u.aT(0,1,1,1);function Qo(f,t,o,c){Ka(f,0,t+o/2,f.transform.width,o,c)}function Xa(f,t,o,c){Ka(f,t-o/2,0,o,f.transform.height,c)}function Ka(f,t,o,c,d,g){const x=f.context,b=x.gl;b.enable(b.SCISSOR_TEST),b.scissor(t*f.pixelRatio,o*f.pixelRatio,c*f.pixelRatio,d*f.pixelRatio),x.clear({color:g}),b.disable(b.SCISSOR_TEST)}function hh(f,t,o){const c=f.context,d=c.gl,g=o.posMatrix,x=f.useProgram("debug"),b=St.disabled,T=ei.disabled,E=f.colorModeForRenderPass(),P="$debug",M=f.style.map.terrain&&f.style.map.terrain.getTerrainData(o);c.activeTexture.set(d.TEXTURE0);const F=t.getTileByID(o.key).latestRawTileData,Z=Math.floor((F&&F.byteLength||0)/1024),$=t.getTile(o).tileSize,G=512/Math.min($,512)*(o.overscaledZ/f.transform.zoom)*.5;let U=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(U+=` => ${o.overscaledZ}`),function(re,pe){re.initDebugOverlayCanvas();const K=re.debugOverlayCanvas,oe=re.context.gl,me=re.debugOverlayCanvas.getContext("2d");me.clearRect(0,0,K.width,K.height),me.shadowColor="white",me.shadowBlur=2,me.lineWidth=1.5,me.strokeStyle="white",me.textBaseline="top",me.font="bold 36px Open Sans, sans-serif",me.fillText(pe,5,5),me.strokeText(pe,5,5),re.debugOverlayTexture.update(K),re.debugOverlayTexture.bind(oe.LINEAR,oe.CLAMP_TO_EDGE)}(f,`${U} ${Z}kB`),x.draw(c,d.TRIANGLES,b,T,Jt.alphaBlended,Kt.disabled,Go(g,u.aT.transparent,G),null,P,f.debugBuffer,f.quadTriangleIndexBuffer,f.debugSegments),x.draw(c,d.LINE_STRIP,b,T,E,Kt.disabled,Go(g,u.aT.red),M,P,f.debugBuffer,f.tileBorderIndexBuffer,f.debugSegments)}function si(f,t,o){const c=f.context,d=c.gl,g=f.colorModeForRenderPass(),x=new St(d.LEQUAL,St.ReadWrite,f.depthRangeFor3D),b=f.useProgram("terrain"),T=t.getTerrainMesh();c.bindFramebuffer.set(null),c.viewport.set([0,0,f.width,f.height]);for(const E of o){const P=f.renderToTexture.getTexture(E),M=t.getTerrainData(E.tileID);c.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,P.texture);const F={u_matrix:f.transform.calculatePosMatrix(E.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(f.transform.zoom)};b.draw(c,d.TRIANGLES,x,ei.disabled,g,Kt.backCCW,F,M,"terrain",T.vertexBuffer,T.indexBuffer,T.segments)}}class zs{constructor(t,o){this.context=new Cp(t),this.transform=o,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.Z(),renderTime:0},this.setup(),this.numSublayers=gn.maxUnderzooming+gn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Pa}resize(t,o,c){if(this.width=Math.floor(t*c),this.height=Math.floor(o*c),this.pixelRatio=c,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const d of this.style._order)this.style._layers[d].resize()}setup(){const t=this.context,o=new u.a_;o.emplaceBack(0,0),o.emplaceBack(u.N,0),o.emplaceBack(0,u.N),o.emplaceBack(u.N,u.N),this.tileExtentBuffer=t.createVertexBuffer(o,Ma.members),this.tileExtentSegments=u.S.simpleSegment(0,0,4,2);const c=new u.a_;c.emplaceBack(0,0),c.emplaceBack(u.N,0),c.emplaceBack(0,u.N),c.emplaceBack(u.N,u.N),this.debugBuffer=t.createVertexBuffer(c,Ma.members),this.debugSegments=u.S.simpleSegment(0,0,4,5);const d=new u.V;d.emplaceBack(0,0,0,0),d.emplaceBack(u.N,0,u.N,0),d.emplaceBack(0,u.N,0,u.N),d.emplaceBack(u.N,u.N,u.N,u.N),this.rasterBoundsBuffer=t.createVertexBuffer(d,Pn.members),this.rasterBoundsSegments=u.S.simpleSegment(0,0,4,2);const g=new u.a_;g.emplaceBack(0,0),g.emplaceBack(1,0),g.emplaceBack(0,1),g.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(g,Ma.members),this.viewportSegments=u.S.simpleSegment(0,0,4,2);const x=new u.a$;x.emplaceBack(0),x.emplaceBack(1),x.emplaceBack(3),x.emplaceBack(2),x.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(x);const b=new u.b0;b.emplaceBack(0,1,2),b.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(b);const T=this.context.gl;this.stencilClearMode=new ei({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO)}clearStencil(){const t=this.context,o=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const c=u.Z();u.aS(c,0,this.width,this.height,0,0,1),u.a0(c,c,[o.drawingBufferWidth,o.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,o.TRIANGLES,St.disabled,this.stencilClearMode,Jt.disabled,Kt.disabled,Xc(c),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,o){if(this.currentStencilSource===t.source||!t.isTileClipped()||!o||!o.length)return;this.currentStencilSource=t.source;const c=this.context,d=c.gl;this.nextStencilID+o.length>256&&this.clearStencil(),c.setColorMode(Jt.disabled),c.setDepthMode(St.disabled);const g=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const x of o){const b=this._tileClippingMaskIDs[x.key]=this.nextStencilID++,T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x);g.draw(c,d.TRIANGLES,St.disabled,new ei({func:d.ALWAYS,mask:0},b,255,d.KEEP,d.KEEP,d.REPLACE),Jt.disabled,Kt.disabled,Xc(x.posMatrix),T,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,o=this.context.gl;return new ei({func:o.NOTEQUAL,mask:255},t,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(t){const o=this.context.gl;return new ei({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(t){const o=this.context.gl,c=t.sort((x,b)=>b.overscaledZ-x.overscaledZ),d=c[c.length-1].overscaledZ,g=c[0].overscaledZ-d+1;if(g>1){this.currentStencilSource=void 0,this.nextStencilID+g>256&&this.clearStencil();const x={};for(let b=0;b=0;this.currentLayer--){const T=this.style._layers[c[this.currentLayer]],E=d[T.source],P=g[T.source];this._renderTileClippingMasks(T,P),this.renderLayer(this,E,T,P)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerU.source&&!U.isHidden(P)?[E.sourceCaches[U.source]]:[]),Z=F.filter(U=>U.getSource().type==="vector"),$=F.filter(U=>U.getSource().type!=="vector"),G=U=>{(!M||M.getSource().maxzoomG(U)),M||$.forEach(U=>G(U)),M}(this.style,this.transform.zoom);T&&function(E,P,M){for(let F=0;FZ.style.map.terrain.getElevation(ge,ot,Ye):null)}}}(T,g,b,x,b.layout.get("text-rotation-alignment"),b.layout.get("text-pitch-alignment"),E),b.paint.get("icon-opacity").constantOr(1)!==0&&Ha(g,x,b,T,!1,b.paint.get("icon-translate"),b.paint.get("icon-translate-anchor"),b.layout.get("icon-rotation-alignment"),b.layout.get("icon-pitch-alignment"),b.layout.get("icon-keep-upright"),P,M),b.paint.get("text-opacity").constantOr(1)!==0&&Ha(g,x,b,T,!0,b.paint.get("text-translate"),b.paint.get("text-translate-anchor"),b.layout.get("text-rotation-alignment"),b.layout.get("text-pitch-alignment"),b.layout.get("text-keep-upright"),P,M),x.map.showCollisionBoxes&&(ah(g,x,b,T,b.paint.get("text-translate"),b.paint.get("text-translate-anchor"),!0),ah(g,x,b,T,b.paint.get("icon-translate"),b.paint.get("icon-translate-anchor"),!1))})(t,o,c,d,this.style.placement.variableOffsets);break;case"circle":(function(g,x,b,T){if(g.renderPass!=="translucent")return;const E=b.paint.get("circle-opacity"),P=b.paint.get("circle-stroke-width"),M=b.paint.get("circle-stroke-opacity"),F=!b.layout.get("circle-sort-key").isConstant();if(E.constantOr(1)===0&&(P.constantOr(1)===0||M.constantOr(1)===0))return;const Z=g.context,$=Z.gl,G=g.depthModeForSublayer(0,St.ReadOnly),U=ei.disabled,re=g.colorModeForRenderPass(),pe=[];for(let K=0;KK.sortKey-oe.sortKey);for(const K of pe){const{programConfiguration:oe,program:me,layoutVertexBuffer:ge,indexBuffer:xe,uniformValues:Ee,terrainData:Te}=K.state;me.draw(Z,$.TRIANGLES,G,U,re,Kt.disabled,Ee,Te,b.id,ge,xe,K.segments,b.paint,g.transform.zoom,oe)}})(t,o,c,d);break;case"heatmap":(function(g,x,b,T){if(b.paint.get("heatmap-opacity")!==0)if(g.renderPass==="offscreen"){const E=g.context,P=E.gl,M=ei.disabled,F=new Jt([P.ONE,P.ONE],u.aT.transparent,[!0,!0,!0,!0]);(function(Z,$,G){const U=Z.gl;Z.activeTexture.set(U.TEXTURE1),Z.viewport.set([0,0,$.width/4,$.height/4]);let re=G.heatmapFbo;if(re)U.bindTexture(U.TEXTURE_2D,re.colorAttachment.get()),Z.bindFramebuffer.set(re.framebuffer);else{const pe=U.createTexture();U.bindTexture(U.TEXTURE_2D,pe),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_WRAP_S,U.CLAMP_TO_EDGE),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_WRAP_T,U.CLAMP_TO_EDGE),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MIN_FILTER,U.LINEAR),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MAG_FILTER,U.LINEAR),re=G.heatmapFbo=Z.createFramebuffer($.width/4,$.height/4,!1,!1),function(K,oe,me,ge){var xe,Ee;const Te=K.gl,Pe=(xe=K.HALF_FLOAT)!==null&&xe!==void 0?xe:Te.UNSIGNED_BYTE,Xe=(Ee=K.RGBA16F)!==null&&Ee!==void 0?Ee:Te.RGBA;Te.texImage2D(Te.TEXTURE_2D,0,Xe,oe.width/4,oe.height/4,0,Te.RGBA,Pe,null),ge.colorAttachment.set(me)}(Z,$,pe,re)}})(E,g,b),E.clear({color:u.aT.transparent});for(let Z=0;Z{const K=u.Z();u.aS(K,0,G.width,G.height,0,0,1);const oe=G.context.gl;return{u_matrix:K,u_world:[oe.drawingBufferWidth,oe.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:U.paint.get("heatmap-opacity")}})(E,P),null,P.id,E.viewportBuffer,E.quadTriangleIndexBuffer,E.viewportSegments,P.paint,E.transform.zoom)}(g,b))})(t,o,c,d);break;case"line":(function(g,x,b,T){if(g.renderPass!=="translucent")return;const E=b.paint.get("line-opacity"),P=b.paint.get("line-width");if(E.constantOr(1)===0||P.constantOr(1)===0)return;const M=g.depthModeForSublayer(0,St.ReadOnly),F=g.colorModeForRenderPass(),Z=b.paint.get("line-dasharray"),$=b.paint.get("line-pattern"),G=$.constantOr(1),U=b.paint.get("line-gradient"),re=b.getCrossfadeParameters(),pe=G?"linePattern":Z?"lineSDF":U?"lineGradient":"line",K=g.context,oe=K.gl;let me=!0;for(const ge of T){const xe=x.getTile(ge);if(G&&!xe.patternsLoaded())continue;const Ee=xe.getBucket(b);if(!Ee)continue;const Te=Ee.programConfigurations.get(b.id),Pe=g.context.program.get(),Xe=g.useProgram(pe,Te),vt=me||Xe.program!==Pe,Fe=g.style.map.terrain&&g.style.map.terrain.getTerrainData(ge),ot=$.constantOr(null);if(ot&&xe.imageAtlas){const _t=xe.imageAtlas,mt=_t.patternPositions[ot.to.toString()],xt=_t.patternPositions[ot.from.toString()];mt&&xt&&Te.setConstantPatternPositions(mt,xt)}const Ye=Fe?ge:null,Ot=G?wp(g,xe,b,re,Ye):Z?Yc(g,xe,b,Z,re,Ye):U?Kc(g,xe,b,Ee.lineClipsArray.length,Ye):Ql(g,xe,b,Ye);if(G)K.activeTexture.set(oe.TEXTURE0),xe.imageAtlasTexture.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),Te.updatePaintBuffers(re);else if(Z&&(vt||g.lineAtlas.dirty))K.activeTexture.set(oe.TEXTURE0),g.lineAtlas.bind(K);else if(U){const _t=Ee.gradients[b.id];let mt=_t.texture;if(b.gradientVersion!==_t.version){let xt=256;if(b.stepInterpolant){const ci=x.getSource().maxzoom,qt=ge.canonical.z===ci?Math.ceil(1<0?o.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const o=this.imageManager.getPattern(t.from.toString()),c=this.imageManager.getPattern(t.to.toString());return!o||!c}useProgram(t,o){this.cache=this.cache||{};const c=t+(o?o.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[c]||(this.cache[c]=new za(this.context,Qt[t],o,Fa[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[c]}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(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ge(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:o}=this.context.gl;return this.width!==t||this.height!==o}}class yn{constructor(t,o){this.points=t,this.planes=o}static fromInvProjectionMatrix(t,o,c){const d=Math.pow(2,c),g=[[-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(b=>{const T=1/(b=u.ag([],b,t))[3]/o*d;return u.b3(b,b,[T,T,1/b[3],T])}),x=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(b=>{const T=function(F,Z){var $=Z[0],G=Z[1],U=Z[2],re=$*$+G*G+U*U;return re>0&&(re=1/Math.sqrt(re)),F[0]=Z[0]*re,F[1]=Z[1]*re,F[2]=Z[2]*re,F}([],function(F,Z,$){var G=Z[0],U=Z[1],re=Z[2],pe=$[0],K=$[1],oe=$[2];return F[0]=U*oe-re*K,F[1]=re*pe-G*oe,F[2]=G*K-U*pe,F}([],He([],g[b[0]],g[b[1]]),He([],g[b[2]],g[b[1]]))),E=-((P=T)[0]*(M=g[b[1]])[0]+P[1]*M[1]+P[2]*M[2]);var P,M;return T.concat(E)});return new yn(g,x)}}class ho{constructor(t,o){this.min=t,this.max=o,this.center=function(c,d,g){return c[0]=.5*d[0],c[1]=.5*d[1],c[2]=.5*d[2],c}([],function(c,d,g){return c[0]=d[0]+g[0],c[1]=d[1]+g[1],c[2]=d[2]+g[2],c}([],this.min,this.max))}quadrant(t){const o=[t%2==0,t<2],c=Se(this.min),d=Se(this.max);for(let g=0;g=0&&x++;if(x===0)return 0;x!==o.length&&(c=!1)}if(c)return 2;for(let d=0;d<3;d++){let g=Number.MAX_VALUE,x=-Number.MAX_VALUE;for(let b=0;bthis.max[d]-this.min[d])return 0}return 1}}class Jo{constructor(t=0,o=0,c=0,d=0){if(isNaN(t)||t<0||isNaN(o)||o<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=o,this.left=c,this.right=d}interpolate(t,o,c){return o.top!=null&&t.top!=null&&(this.top=u.B.number(t.top,o.top,c)),o.bottom!=null&&t.bottom!=null&&(this.bottom=u.B.number(t.bottom,o.bottom,c)),o.left!=null&&t.left!=null&&(this.left=u.B.number(t.left,o.left,c)),o.right!=null&&t.right!=null&&(this.right=u.B.number(t.right,o.right,c)),this}getCenter(t,o){const c=u.ad((this.left+t-this.right)/2,0,t),d=u.ad((this.top+o-this.bottom)/2,0,o);return new u.P(c,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Jo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Ya{constructor(t,o,c,d,g){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=g===void 0||!!g,this._minZoom=t||0,this._maxZoom=o||22,this._minPitch=c??0,this._maxPitch=d??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new u.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Jo,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new Ya(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this._minEleveationForCurrentTile=t._minEleveationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new u.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const o=-u.b5(t,-180,180)*Math.PI/180;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=function(){var c=new u.A(4);return u.A!=Float32Array&&(c[1]=0,c[2]=0),c[0]=1,c[3]=1,c}(),function(c,d,g){var x=d[0],b=d[1],T=d[2],E=d[3],P=Math.sin(g),M=Math.cos(g);c[0]=x*M+T*P,c[1]=b*M+E*P,c[2]=x*-P+T*M,c[3]=b*-P+E*M}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const o=u.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const o=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._zoom=o,this.tileZoom=Math.max(0,Math.floor(o)),this.scale=this.zoomScale(o),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,o,c){this._unmodified=!1,this._edgeInsets.interpolate(t,o,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const o=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(t){const o=[new u.b6(0,t)];if(this._renderWorldCopies){const c=this.pointCoordinate(new u.P(0,0)),d=this.pointCoordinate(new u.P(this.width,0)),g=this.pointCoordinate(new u.P(this.width,this.height)),x=this.pointCoordinate(new u.P(0,this.height)),b=Math.floor(Math.min(c.x,d.x,g.x,x.x)),T=Math.floor(Math.max(c.x,d.x,g.x,x.x)),E=1;for(let P=b-E;P<=T+E;P++)P!==0&&o.push(new u.b6(P,t))}return o}coveringTiles(t){var o,c;let d=this.coveringZoomLevel(t);const g=d;if(t.minzoom!==void 0&&dt.maxzoom&&(d=t.maxzoom);const x=this.pointCoordinate(this.getCameraPoint()),b=u.U.fromLngLat(this.center),T=Math.pow(2,d),E=[T*x.x,T*x.y,0],P=[T*b.x,T*b.y,0],M=yn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,d);let F=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(F=d);const Z=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,$=K=>({aabb:new ho([K*T,0,0],[(K+1)*T,T,0]),zoom:0,x:0,y:0,wrap:K,fullyVisible:!1}),G=[],U=[],re=d,pe=t.reparseOverscaled?g:d;if(this._renderWorldCopies)for(let K=1;K<=3;K++)G.push($(-K)),G.push($(K));for(G.push($(0));G.length>0;){const K=G.pop(),oe=K.x,me=K.y;let ge=K.fullyVisible;if(!ge){const Xe=K.aabb.intersects(M);if(Xe===0)continue;ge=Xe===2}const xe=t.terrain?E:P,Ee=K.aabb.distanceX(xe),Te=K.aabb.distanceY(xe),Pe=Math.max(Math.abs(Ee),Math.abs(Te));if(K.zoom===re||Pe>Z+(1<=F){const Xe=re-K.zoom,vt=E[0]-.5-(oe<>1),ot=K.zoom+1;let Ye=K.aabb.quadrant(Xe);if(t.terrain){const Ot=new u.O(ot,K.wrap,ot,vt,Fe),_t=t.terrain.getMinMaxElevation(Ot),mt=(o=_t.minElevation)!==null&&o!==void 0?o:this.elevation,xt=(c=_t.maxElevation)!==null&&c!==void 0?c:this.elevation;Ye=new ho([Ye.min[0],Ye.min[1],mt],[Ye.max[0],Ye.max[1],xt])}G.push({aabb:Ye,zoom:ot,x:vt,y:Fe,wrap:K.wrap,fullyVisible:ge})}}return U.sort((K,oe)=>K.distanceSq-oe.distanceSq).map(K=>K.tileID)}resize(t,o){this.width=t,this.height=o,this.pixelsToGLUnits=[2/t,-2/o],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const o=u.ad(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new u.P(u.G(t.lng)*this.worldSize,u.H(o)*this.worldSize)}unproject(t){return new u.U(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const o=this.pointLocation(this.centerPoint,t),c=t.getElevationForLngLatZoom(o,this.tileZoom);if(!(this.elevation-c))return;const d=this.getCameraPosition(),g=u.U.fromLngLat(d.lngLat,d.altitude),x=u.U.fromLngLat(o,c),b=g.x-x.x,T=g.y-x.y,E=g.z-x.z,P=Math.sqrt(b*b+T*T+E*E),M=this.scaleZoom(this.cameraToCenterDistance/P/this.tileSize);this._elevation=c,this._center=o,this.zoom=M}setLocationAtPoint(t,o){const c=this.pointCoordinate(o),d=this.pointCoordinate(this.centerPoint),g=this.locationCoordinate(t),x=new u.U(g.x-(c.x-d.x),g.y-(c.y-d.y));this.center=this.coordinateLocation(x),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,o){return o?this.coordinatePoint(this.locationCoordinate(t),o.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,o){return this.coordinateLocation(this.pointCoordinate(t,o))}locationCoordinate(t){return u.U.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,o){if(o){const F=o.pointCoordinate(t);if(F!=null)return F}const c=[t.x,t.y,0,1],d=[t.x,t.y,1,1];u.ag(c,c,this.pixelMatrixInverse),u.ag(d,d,this.pixelMatrixInverse);const g=c[3],x=d[3],b=c[1]/g,T=d[1]/x,E=c[2]/g,P=d[2]/x,M=E===P?0:(0-E)/(P-E);return new u.U(u.B.number(c[0]/g,d[0]/x,M)/this.worldSize,u.B.number(b,T,M)/this.worldSize)}coordinatePoint(t,o=0,c=this.pixelMatrix){const d=[t.x*this.worldSize,t.y*this.worldSize,o,1];return u.ag(d,d,c),new u.P(d[0]/d[3],d[1]/d[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new It().extend(this.pointLocation(new u.P(0,t))).extend(this.pointLocation(new u.P(this.width,t))).extend(this.pointLocation(new u.P(this.width,this.height))).extend(this.pointLocation(new u.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new It([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(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,o=!1){const c=t.key,d=o?this._alignedPosMatrixCache:this._posMatrixCache;if(d[c])return d[c];const g=t.canonical,x=this.worldSize/this.zoomScale(g.z),b=g.x+Math.pow(2,g.z)*t.wrap,T=u.ao(new Float64Array(16));return u.$(T,T,[b*x,g.y*x,0]),u.a0(T,T,[x/u.N,x/u.N,1]),u.a1(T,o?this.alignedProjMatrix:this.projMatrix,T),d[c]=new Float32Array(T),d[c]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,o,c,d,g=-90,x=90,b=-180,T=180;const E=this.size,P=this._unmodified;if(this.latRange){const Z=this.latRange;g=u.H(Z[1])*this.worldSize,x=u.H(Z[0])*this.worldSize,t=x-gx&&(d=x-$)}if(this.lngRange){const Z=(b+T)/2,$=u.b5(M.x,Z-this.worldSize/2,Z+this.worldSize/2),G=E.x/2;$-GT&&(c=T-G)}c===void 0&&d===void 0||(this.center=this.unproject(new u.P(c!==void 0?c:M.x,d!==void 0?d:M.y)).wrap()),this._unmodified=P,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,o=this.point.x,c=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b7(1,this.center.lat)*this.worldSize;let d=u.ao(new Float64Array(16));u.a0(d,d,[this.width/2,-this.height/2,1]),u.$(d,d,[1,-1,0]),this.labelPlaneMatrix=d,d=u.ao(new Float64Array(16)),u.a0(d,d,[1,-1,1]),u.$(d,d,[-1,-1,0]),u.a0(d,d,[2/this.width,2/this.height,1]),this.glCoordMatrix=d;const g=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),x=Math.min(this.elevation,this._minEleveationForCurrentTile),b=g-x*this._pixelPerMeter/Math.cos(this._pitch),T=x<0?b:g,E=Math.PI/2+this._pitch,P=this._fov*(.5+t.y/this.height),M=Math.sin(P)*T/Math.sin(u.ad(Math.PI-E-P,.01,Math.PI-.01)),F=this.getHorizon(),Z=2*Math.atan(F/this.cameraToCenterDistance)*(.5+t.y/(2*F)),$=Math.sin(Z)*T/Math.sin(u.ad(Math.PI-E-Z,.01,Math.PI-.01)),G=Math.min(M,$),U=1.01*(Math.cos(Math.PI/2-this._pitch)*G+T),re=this.height/50;d=new Float64Array(16),u.b8(d,this._fov,this.width/this.height,re,U),d[8]=2*-t.x/this.width,d[9]=2*t.y/this.height,u.a0(d,d,[1,-1,1]),u.$(d,d,[0,0,-this.cameraToCenterDistance]),u.b9(d,d,this._pitch),u.ae(d,d,this.angle),u.$(d,d,[-o,-c,0]),this.mercatorMatrix=u.a0([],d,[this.worldSize,this.worldSize,this.worldSize]),u.a0(d,d,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.a1(new Float64Array(16),this.labelPlaneMatrix,d),u.$(d,d,[0,0,-this.elevation]),this.projMatrix=d,this.invProjMatrix=u.as([],d),this.pixelMatrix3D=u.a1(new Float64Array(16),this.labelPlaneMatrix,d);const pe=this.width%2/2,K=this.height%2/2,oe=Math.cos(this.angle),me=Math.sin(this.angle),ge=o-Math.round(o)+oe*pe+me*K,xe=c-Math.round(c)+oe*K+me*pe,Ee=new Float64Array(d);if(u.$(Ee,Ee,[ge>.5?ge-1:ge,xe>.5?xe-1:xe,0]),this.alignedProjMatrix=Ee,d=u.as(new Float64Array(16),this.pixelMatrix),!d)throw new Error("failed to invert matrix");this.pixelMatrixInverse=d,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new u.P(0,0)),o=[t.x*this.worldSize,t.y*this.worldSize,0,1];return u.ag(o,o,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,t))}getCameraQueryGeometry(t){const o=this.getCameraPoint();if(t.length===1)return[t[0],o];{let c=o.x,d=o.y,g=o.x,x=o.y;for(const b of t)c=Math.min(c,b.x),d=Math.min(d,b.y),g=Math.max(g,b.x),x=Math.max(x,b.y);return[new u.P(c,d),new u.P(g,d),new u.P(g,x),new u.P(c,x),new u.P(c,d)]}}}function As(f,t){let o,c=!1,d=null,g=null;const x=()=>{d=null,c&&(f.apply(g,o),d=setTimeout(x,t),c=!1)};return(...b)=>(c=!0,g=this,o=b,d||x(),d)}class ea{constructor(t){this._getCurrentHash=()=>{const o=window.location.hash.replace("#","");if(this._hashName){let c;return o.split("&").map(d=>d.split("=")).forEach(d=>{d[0]===this._hashName&&(c=d)}),(c&&c[1]||"").split("/")}return o.split("/")},this._onHashChange=()=>{const o=this._getCurrentHash();if(o.length>=3&&!o.some(c=>isNaN(c))){const c=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(o[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:c,pitch:+(o[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const o=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,o)}catch{}},this._updateHash=As(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,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(t){const o=this._map.getCenter(),c=Math.round(100*this._map.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,d),x=Math.round(o.lng*g)/g,b=Math.round(o.lat*g)/g,T=this._map.getBearing(),E=this._map.getPitch();let P="";if(P+=t?`/${x}/${b}/${c}`:`${c}/${b}/${x}`,(T||E)&&(P+="/"+Math.round(10*T)/10),E&&(P+=`/${Math.round(E)}`),this._hashName){const M=this._hashName;let F=!1;const Z=window.location.hash.slice(1).split("&").map($=>{const G=$.split("=")[0];return G===M?(F=!0,`${G}=${P}`):$}).filter($=>$);return F||Z.push(`${M}=${P}`),`#${Z.join("&")}`}return`#${P}`}}const po={linearity:.3,easing:u.ba(0,0,.3,1)},dh=u.e({deceleration:2500,maxSpeed:1400},po),ph=u.e({deceleration:20,maxSpeed:1400},po),fh=u.e({deceleration:1e3,maxSpeed:360},po),mh=u.e({deceleration:1e3,maxSpeed:90},po);class gh{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:u.h.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,o=u.h.now();for(;t.length>0&&o-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const o={zoom:0,bearing:0,pitch:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:g}of this._inertiaBuffer)o.zoom+=g.zoomDelta||0,o.bearing+=g.bearingDelta||0,o.pitch+=g.pitchDelta||0,g.panDelta&&o.pan._add(g.panDelta),g.around&&(o.around=g.around),g.pinchAround&&(o.pinchAround=g.pinchAround);const c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(o.pan.mag()){const g=ta(o.pan.mag(),c,u.e({},dh,t||{}));d.offset=o.pan.mult(g.amount/o.pan.mag()),d.center=this._map.transform.center,br(d,g)}if(o.zoom){const g=ta(o.zoom,c,ph);d.zoom=this._map.transform.zoom+g.amount,br(d,g)}if(o.bearing){const g=ta(o.bearing,c,fh);d.bearing=this._map.transform.bearing+u.ad(g.amount,-179,179),br(d,g)}if(o.pitch){const g=ta(o.pitch,c,mh);d.pitch=this._map.transform.pitch+g.amount,br(d,g)}if(d.zoom||d.bearing){const g=o.pinchAround===void 0?o.around:o.pinchAround;d.around=g?this._map.unproject(g):this._map.getCenter()}return this.clear(),u.e(d,{noMoveStart:!0})}}function br(f,t){(!f.duration||f.durationo.unproject(T)),b=g.reduce((T,E,P,M)=>T.add(E.div(M.length)),new u.P(0,0));super(t,{points:g,point:b,lngLats:x,lngLat:o.unproject(b),originalEvent:c}),this._defaultPrevented=!1}}class yh extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,c){super(t,{originalEvent:c}),this._defaultPrevented=!1}}class _h{constructor(t,o){this._map=t,this._clickTolerance=o.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new yh(t.type,this._map,t))}mousedown(t,o){return this._mousedownPos=o,this._firePreventable(new Dn(t.type,this._map,t))}mouseup(t){this._map.fire(new Dn(t.type,this._map,t))}click(t,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||this._map.fire(new Dn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Dn(t.type,this._map,t))}mouseover(t){this._map.fire(new Dn(t.type,this._map,t))}mouseout(t){this._map.fire(new Dn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ia(t.type,this._map,t))}touchmove(t){this._map.fire(new ia(t.type,this._map,t))}touchend(t){this._map.fire(new ia(t.type,this._map,t))}touchcancel(t){this._map.fire(new ia(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class vh{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Dn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Dn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Dn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vr{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(u.P.convert(t),this._map.terrain)}}class xh{constructor(t,o){this._map=t,this._tr=new Vr(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,o){this.isEnabled()&&t.shiftKey&&t.button===0&&(L.disableDrag(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(t,o){if(!this._active)return;const c=o;if(this._lastPos.equals(c)||!this._box&&c.dist(this._startPos)g.fitScreenCoordinates(c,d,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(L.remove(this._box),this._box=null),L.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,o){return this._map.fire(new u.k(t,{originalEvent:o}))}}function Kn(f,t){if(f.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${f.length}, points ${t.length}`);const o={};for(let c=0;cthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),c.length===this.numTouches&&(this.centroid=function(d){const g=new u.P(0,0);for(const x of d)g._add(x);return g.div(d.length)}(o),this.touches=Kn(c,o)))}touchmove(t,o,c){if(this.aborted||!this.centroid)return;const d=Kn(c,o);for(const g in this.touches){const x=d[g];(!x||x.dist(this.touches[g])>30)&&(this.aborted=!0)}}touchend(t,o,c){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class Qa{constructor(t){this.singleTap=new Ur(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,o,c){this.singleTap.touchstart(t,o,c)}touchmove(t,o,c){this.singleTap.touchmove(t,o,c)}touchend(t,o,c){const d=this.singleTap.touchend(t,o,c);if(d){const g=t.timeStamp-this.lastTime<500,x=!this.lastTap||this.lastTap.dist(d)<30;if(g&&x||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class jr{constructor(t){this._tr=new Vr(t),this._zoomIn=new Qa({numTouches:1,numTaps:2}),this._zoomOut=new Qa({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,o,c){this._zoomIn.touchstart(t,o,c),this._zoomOut.touchstart(t,o,c)}touchmove(t,o,c){this._zoomIn.touchmove(t,o,c),this._zoomOut.touchmove(t,o,c)}touchend(t,o,c){const d=this._zoomIn.touchend(t,o,c),g=this._zoomOut.touchend(t,o,c),x=this._tr;return d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:x.zoom+1,around:x.unproject(d)},{originalEvent:t})}):g?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:x.zoom-1,around:x.unproject(g)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $r{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const o=this._moveFunction(...t);if(o.bearingDelta||o.pitchDelta||o.around||o.panDelta)return this._active=!0,o}dragStart(t,o){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=o.length?o[0]:o,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,o){if(!this.isEnabled())return;const c=this._lastPoint;if(!c)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const d=o.length?o[0]:o;return!this._moved&&d.dist(c){f.mousedown=f.dragStart,f.mousemoveWindow=f.dragMove,f.mouseup=f.dragEnd,f.contextmenu=function(t){t.preventDefault()}},fo=({enable:f,clickTolerance:t,bearingDegreesPerPixelMoved:o=.8})=>{const c=new gu({checkCorrectEvent:d=>L.mouseButton(d)===0&&d.ctrlKey||L.mouseButton(d)===2});return new $r({clickTolerance:t,move:(d,g)=>({bearingDelta:(g.x-d.x)*o}),moveStateManager:c,enable:f,assignEvents:Ja})},Zr=({enable:f,clickTolerance:t,pitchDegreesPerPixelMoved:o=-.5})=>{const c=new gu({checkCorrectEvent:d=>L.mouseButton(d)===0&&d.ctrlKey||L.mouseButton(d)===2});return new $r({clickTolerance:t,move:(d,g)=>({pitchDelta:(g.y-d.y)*o}),moveStateManager:c,enable:f,assignEvents:Ja})};class Ze{constructor(t,o){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=o,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,o,c){return this._calculateTransform(t,o,c)}touchmove(t,o,c){if(this._map._cooperativeGestures&&(this._minTouches===2&&c.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,c.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(c.length0&&(this._active=!0);const d=Kn(c,o),g=new u.P(0,0),x=new u.P(0,0);let b=0;for(const E in d){const P=d[E],M=this._touches[E];M&&(g._add(P),x._add(P.sub(M)),b++,d[E]=P)}if(this._touches=d,bMath.abs(f.x)}class Ap extends el{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,o,c){super.touchstart(t,o,c),this._currentTouchCount=c.length}_start(t){this._lastPoints=t,_u(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,o,c){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const d=t[0].sub(this._lastPoints[0]),g=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(d,g,c.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(d.y+g.y)/2*-.5}):void 0}gestureBeginsVertically(t,o,c){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,g=o.mag()>=2;if(!d&&!g)return;if(!d||!g)return this._firstMove===void 0&&(this._firstMove=c),c-this._firstMove<100&&void 0;const x=t.y>0==o.y>0;return _u(t)&&_u(o)&&x}}const vu={panStep:100,bearingStep:15,pitchStep:10};class Sh{constructor(t){this._tr=new Vr(t);const o=vu;this._panStep=o.panStep,this._bearingStep=o.bearingStep,this._pitchStep=o.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let o=0,c=0,d=0,g=0,x=0;switch(t.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:t.shiftKey?c=-1:(t.preventDefault(),g=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),g=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),x=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),x=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:b=>{const T=this._tr;b.easeTo({duration:300,easeId:"keyboardHandler",easing:Th,zoom:o?Math.round(T.zoom)+o*(t.shiftKey?2:1):T.zoom,bearing:T.bearing+c*this._bearingStep,pitch:T.pitch+d*this._pitchStep,offset:[-g*this._panStep,-x*this._panStep],center:T.center},{originalEvent:t})}}}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 Th(f){return f*(2-f)}const kh=4.000244140625;class Dp{constructor(t,o){this._onTimeout=c=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(c)},this._map=t,this._tr=new Vr(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=o,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let o=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=u.h.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,o!==0&&o%kh==0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=o,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),t.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=t,this._delta-=o,this._active||this._start(t)),t.preventDefault()}_start(t){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);const o=L.mousePos(this._el,t),c=this._tr;this._around=u.L.convert(this._aroundCenter?c.center:c.unproject(o)),this._aroundPoint=c.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const b=this._type==="wheel"&&Math.abs(this._delta)>kh?this._wheelZoomRate:this._defaultZoomRate;let T=2/(1+Math.exp(-Math.abs(this._delta*b)));this._delta<0&&T!==0&&(T=1/T);const E=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(E*T))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const o=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,c=this._startZoom,d=this._easing;let g,x=!1;if(this._type==="wheel"&&c&&d){const b=Math.min((u.h.now()-this._lastWheelEventTime)/200,1),T=d(b);g=u.B.number(c,o,T),b<1?this._frameId||(this._frameId=!0):x=!0}else g=o,x=!0;return this._active=!0,x&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!x,zoomDelta:g-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let o=u.bb;if(this._prevEase){const c=this._prevEase,d=(u.h.now()-c.start)/c.duration,g=c.easing(d+.01)-c.easing(d),x=.27/Math.sqrt(g*g+1e-4)*.01,b=Math.sqrt(.0729-x*x);o=u.ba(x,b,.25,1)}return this._prevEase={start:u.h.now(),duration:t,easing:o},o}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class xu{constructor(t,o){this._clickZoom=t,this._tapZoom=o}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 wu{constructor(t){this._tr=new Vr(t),this.reset()}reset(){this._active=!1}dblclick(t,o){return t.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(o)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class bu{constructor(){this._tap=new Qa({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,o,c){if(!this._swipePoint)if(this._tapTime){const d=o[0],g=t.timeStamp-this._tapTime<500,x=this._tapPoint.dist(d)<30;g&&x?c.length>0&&(this._swipePoint=d,this._swipeTouch=c[0].identifier):this.reset()}else this._tap.touchstart(t,o,c)}touchmove(t,o,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=o[0],g=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:g/128}}}else this._tap.touchmove(t,o,c)}touchend(t,o,c){if(this._tapTime)this._swipePoint&&c.length===0&&this.reset();else{const d=this._tap.touchend(t,o,c);d&&(this._tapTime=t.timeStamp,this._tapPoint=d)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Su{constructor(t,o,c){this._el=t,this._mousePan=o,this._touchPan=c}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class _n{constructor(t,o,c){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=o,this._mousePitch=c}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 fs{constructor(t,o,c,d){this._el=t,this._touchZoom=o,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-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()}}const na=f=>f.zoom||f.drag||f.pitch||f.rotate;class Tu extends u.k{}function ra(f){return f.panDelta&&f.panDelta.mag()||f.zoomDelta||f.bearingDelta||f.pitchDelta}class ku{constructor(t,o){this.handleWindowEvent=d=>{this.handleEvent(d,`${d.type}Window`)},this.handleEvent=(d,g)=>{if(d.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const x=d.type==="renderFrame"?void 0:d,b={needsRenderFrame:!1},T={},E={},P=d.touches,M=P?this._getMapTouches(P):void 0,F=M?L.touchPos(this._el,M):L.mousePos(this._el,d);for(const{handlerName:G,handler:U,allowed:re}of this._handlers){if(!U.isEnabled())continue;let pe;this._blockedByActive(E,re,G)?U.reset():U[g||d.type]&&(pe=U[g||d.type](d,F,M),this.mergeHandlerResult(b,T,pe,G,x),pe&&pe.needsRenderFrame&&this._triggerRenderFrame()),(pe||U.isActive())&&(E[G]=U)}const Z={};for(const G in this._previousActiveHandlers)E[G]||(Z[G]=x);this._previousActiveHandlers=E,(Object.keys(Z).length||ra(b))&&(this._changes.push([b,T,Z]),this._triggerRenderFrame()),(Object.keys(E).length||ra(b))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:$}=b;$&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],$(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new gh(t),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(o);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,g,x]of this._listeners)L.addEventListener(d,g,d===document?this.handleWindowEvent:this.handleEvent,x)}destroy(){for(const[t,o,c]of this._listeners)L.removeEventListener(t,o,t===document?this.handleWindowEvent:this.handleEvent,c)}_addDefaultHandlers(t){const o=this._map,c=o.getCanvasContainer();this._add("mapEvent",new _h(o,t));const d=o.boxZoom=new xh(o,t);this._add("boxZoom",d),t.interactive&&t.boxZoom&&d.enable();const g=new jr(o),x=new wu(o);o.doubleClickZoom=new xu(x,g),this._add("tapZoom",g),this._add("clickZoom",x),t.interactive&&t.doubleClickZoom&&o.doubleClickZoom.enable();const b=new bu;this._add("tapDragZoom",b);const T=o.touchPitch=new Ap(o);this._add("touchPitch",T),t.interactive&&t.touchPitch&&o.touchPitch.enable(t.touchPitch);const E=fo(t),P=Zr(t);o.dragRotate=new _n(t,E,P),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",P,["mouseRotate"]),t.interactive&&t.dragRotate&&o.dragRotate.enable();const M=(({enable:re,clickTolerance:pe})=>{const K=new gu({checkCorrectEvent:oe=>L.mouseButton(oe)===0&&!oe.ctrlKey});return new $r({clickTolerance:pe,move:(oe,me)=>({around:me,panDelta:me.sub(oe)}),activateOnStart:!0,moveStateManager:K,enable:re,assignEvents:Ja})})(t),F=new Ze(t,o);o.dragPan=new Su(c,M,F),this._add("mousePan",M),this._add("touchPan",F,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&o.dragPan.enable(t.dragPan);const Z=new yu,$=new bh;o.touchZoomRotate=new fs(c,$,Z,b),this._add("touchRotate",Z,["touchPan","touchZoom"]),this._add("touchZoom",$,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&o.touchZoomRotate.enable(t.touchZoomRotate);const G=o.scrollZoom=new Dp(o,()=>this._triggerRenderFrame());this._add("scrollZoom",G,["mousePan"]),t.interactive&&t.scrollZoom&&o.scrollZoom.enable(t.scrollZoom);const U=o.keyboard=new Sh(o);this._add("keyboard",U),t.interactive&&t.keyboard&&o.keyboard.enable(),this._add("blockableMapEvent",new vh(o))}_add(t,o,c){this._handlers.push({handlerName:t,handler:o,allowed:c}),this._handlersById[t]=o}stop(t){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!na(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,o,c){for(const d in t)if(d!==c&&(!o||o.indexOf(d)<0))return!0;return!1}_getMapTouches(t){const o=[];for(const c of t)this._el.contains(c.target)&&o.push(c);return o}mergeHandlerResult(t,o,c,d,g){if(!c)return;u.e(t,c);const x={handlerName:d,originalEvent:c.originalEvent||g};c.zoomDelta!==void 0&&(o.zoom=x),c.panDelta!==void 0&&(o.drag=x),c.pitchDelta!==void 0&&(o.pitch=x),c.bearingDelta!==void 0&&(o.rotate=x)}_applyChanges(){const t={},o={},c={};for(const[d,g,x]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new u.P(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),u.e(o,g),u.e(c,x);this._updateMapTransform(t,o,c),this._changes=[]}_updateMapTransform(t,o,c){const d=this._map,g=d._getTransformForUpdate(),x=d.terrain;if(!(ra(t)||x&&this._terrainMovement))return this._fireEvents(o,c,!0);let{panDelta:b,zoomDelta:T,bearingDelta:E,pitchDelta:P,around:M,pinchAround:F}=t;F!==void 0&&(M=F),d._stop(!0),M=M||d.transform.centerPoint;const Z=g.pointLocation(b?M.sub(b):M);E&&(g.bearing+=E),P&&(g.pitch+=P),T&&(g.zoom+=T),x?this._terrainMovement||!o.drag&&!o.zoom?o.drag&&this._terrainMovement?g.center=g.pointLocation(g.centerPoint.sub(b)):g.setLocationAtPoint(Z,M):(this._terrainMovement=!0,this._map._elevationFreeze=!0,g.setLocationAtPoint(Z,M),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,g.recalculateZoom(d.terrain)})):g.setLocationAtPoint(Z,M),d._applyUpdatedTransform(g),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(o,c,!0)}_fireEvents(t,o,c){const d=na(this._eventsInProgress),g=na(t),x={};for(const P in t){const{originalEvent:M}=t[P];this._eventsInProgress[P]||(x[`${P}start`]=M),this._eventsInProgress[P]=t[P]}!d&&g&&this._fireEvent("movestart",g.originalEvent);for(const P in x)this._fireEvent(P,x[P]);g&&this._fireEvent("move",g.originalEvent);for(const P in t){const{originalEvent:M}=t[P];this._fireEvent(P,M)}const b={};let T;for(const P in this._eventsInProgress){const{handlerName:M,originalEvent:F}=this._eventsInProgress[P];this._handlersById[M].isActive()||(delete this._eventsInProgress[P],T=o[M]||F,b[`${P}end`]=T)}for(const P in b)this._fireEvent(P,b[P]);const E=na(this._eventsInProgress);if(c&&(d||g)&&!E){this._updatingCamera=!0;const P=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=F=>F!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Tu("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Eh extends u.E{constructor(t,o){super(),this._renderFrameCallback=()=>{const c=Math.min((u.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(c)),c<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=o.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new u.L(this.transform.center.lng,this.transform.center.lat)}setCenter(t,o){return this.jumpTo({center:t},o)}panBy(t,o,c){return t=u.P.convert(t).mult(-1),this.panTo(this.transform.center,u.e({offset:t},o),c)}panTo(t,o,c){return this.easeTo(u.e({center:t},o),c)}getZoom(){return this.transform.zoom}setZoom(t,o){return this.jumpTo({zoom:t},o),this}zoomTo(t,o,c){return this.easeTo(u.e({zoom:t},o),c)}zoomIn(t,o){return this.zoomTo(this.getZoom()+1,t,o),this}zoomOut(t,o){return this.zoomTo(this.getZoom()-1,t,o),this}getBearing(){return this.transform.bearing}setBearing(t,o){return this.jumpTo({bearing:t},o),this}getPadding(){return this.transform.padding}setPadding(t,o){return this.jumpTo({padding:t},o),this}rotateTo(t,o,c){return this.easeTo(u.e({bearing:t},o),c)}resetNorth(t,o){return this.rotateTo(0,u.e({duration:1e3},t),o),this}resetNorthPitch(t,o){return this.easeTo(u.e({bearing:0,pitch:0,duration:1e3},t),o),this}snapToNorth(t,o){return Math.abs(this.getBearing()){if(this._zooming&&(c.zoom=u.B.number(d,T,ge)),this._rotating&&(c.bearing=u.B.number(g,E,ge)),this._pitching&&(c.pitch=u.B.number(x,P,ge)),this._padding&&(c.interpolatePadding(b,M,ge),Z=c.centerPoint.add(F)),this.terrain&&!t.freezeElevation&&this._updateElevation(ge),K)c.setLocationAtPoint(K,oe);else{const xe=c.zoomScale(c.zoom-d),Ee=T>d?Math.min(2,pe):Math.max(.5,pe),Te=Math.pow(Ee,1-ge),Pe=c.unproject(U.add(re.mult(ge*Te)).mult(xe));c.setLocationAtPoint(c.renderWorldCopies?Pe.wrap():Pe,Z)}this._applyUpdatedTransform(c),this._fireMoveEvents(o)},ge=>{this.terrain&&this._finalizeElevation(),this._afterEase(o,ge)},t),this}_prepareEase(t,o,c={}){this._moving=!0,o||c.moving||this.fire(new u.k("movestart",t)),this._zooming&&!c.zooming&&this.fire(new u.k("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new u.k("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new u.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const o=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&o!==this._elevationTarget){const c=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(c-(o-(c*t+this._elevationStart))/(1-t)),this._elevationTarget=o}this.transform.elevation=u.B.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const o=t.clone(),{center:c,zoom:d,pitch:g,bearing:x,elevation:b}=this.transformCameraUpdate(o);c&&(o.center=c),d!==void 0&&(o.zoom=d),g!==void 0&&(o.pitch=g),x!==void 0&&(o.bearing=x),b!==void 0&&(o.elevation=b),this.transform.apply(o)}_fireMoveEvents(t){this.fire(new u.k("move",t)),this._zooming&&this.fire(new u.k("zoom",t)),this._rotating&&this.fire(new u.k("rotate",t)),this._pitching&&this.fire(new u.k("pitch",t))}_afterEase(t,o){if(this._easeId&&o&&this._easeId===o)return;delete this._easeId;const c=this._zooming,d=this._rotating,g=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new u.k("zoomend",t)),d&&this.fire(new u.k("rotateend",t)),g&&this.fire(new u.k("pitchend",t)),this.fire(new u.k("moveend",t))}flyTo(t,o){if(!t.essential&&u.h.prefersReducedMotion){const Ye=u.F(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ye,o)}this.stop(),t=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.bb},t);const c=this._getTransformForUpdate(),d=this.getZoom(),g=this.getBearing(),x=this.getPitch(),b=this.getPadding(),T="zoom"in t?u.ad(+t.zoom,c.minZoom,c.maxZoom):d,E="bearing"in t?this._normalizeBearing(t.bearing,g):g,P="pitch"in t?+t.pitch:x,M="padding"in t?t.padding:c.padding,F=c.zoomScale(T-d),Z=u.P.convert(t.offset);let $=c.centerPoint.add(Z);const G=c.pointLocation($),U=u.L.convert(t.center||G);this._normalizeCenter(U);const re=c.project(G),pe=c.project(U).sub(re);let K=t.curve;const oe=Math.max(c.width,c.height),me=oe/F,ge=pe.mag();if("minZoom"in t){const Ye=u.ad(Math.min(t.minZoom,d,T),c.minZoom,c.maxZoom),Ot=oe/c.zoomScale(Ye-d);K=Math.sqrt(Ot/ge*2)}const xe=K*K;function Ee(Ye){const Ot=(me*me-oe*oe+(Ye?-1:1)*xe*xe*ge*ge)/(2*(Ye?me:oe)*xe*ge);return Math.log(Math.sqrt(Ot*Ot+1)-Ot)}function Te(Ye){return(Math.exp(Ye)-Math.exp(-Ye))/2}function Pe(Ye){return(Math.exp(Ye)+Math.exp(-Ye))/2}const Xe=Ee(!1);let vt=function(Ye){return Pe(Xe)/Pe(Xe+K*Ye)},Fe=function(Ye){return oe*((Pe(Xe)*(Te(Ot=Xe+K*Ye)/Pe(Ot))-Te(Xe))/xe)/ge;var Ot},ot=(Ee(!0)-Xe)/K;if(Math.abs(ge)<1e-6||!isFinite(ot)){if(Math.abs(oe-me)<1e-6)return this.easeTo(t,o);const Ye=met.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=g!==E,this._pitching=P!==x,this._padding=!c.isPaddingEqual(M),this._prepareEase(o,!1),this.terrain&&this._prepareElevation(U),this._ease(Ye=>{const Ot=Ye*ot,_t=1/vt(Ot);c.zoom=Ye===1?T:d+c.scaleZoom(_t),this._rotating&&(c.bearing=u.B.number(g,E,Ye)),this._pitching&&(c.pitch=u.B.number(x,P,Ye)),this._padding&&(c.interpolatePadding(b,M,Ye),$=c.centerPoint.add(Z)),this.terrain&&!t.freezeElevation&&this._updateElevation(Ye);const mt=Ye===1?U:c.unproject(re.add(pe.mult(Fe(Ot))).mult(_t));c.setLocationAtPoint(c.renderWorldCopies?mt.wrap():mt,$),this._applyUpdatedTransform(c),this._fireMoveEvents(o)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(o)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,o){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const c=this._onEaseEnd;delete this._onEaseEnd,c.call(this,o)}if(!t){const c=this.handlers;c&&c.stop(!1)}return this}_ease(t,o,c){c.animate===!1||c.duration===0?(t(1),o()):(this._easeStart=u.h.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,o){t=u.b5(t,-180,180);const c=Math.abs(t-o);return Math.abs(t-360-o)180?-360:c<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(u.L.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}class Ln{constructor(t={}){this._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")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=o=>{!o||o.sourceDataType!=="metadata"&&o.sourceDataType!=="visibility"&&o.dataType!=="style"&&o.type!=="terrain"||this._updateAttributions()},this._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","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=L.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=L.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=L.create("div","maplibregl-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(){L.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(t,o){const c=this._map._getUIString(`AttributionControl.${o}`);t.title=c,t.setAttribute("aria-label",c)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(d=>typeof d!="string"?"":d)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const o=this._map.style.sourceCaches;for(const d in o){const g=o[d];if(g.used||g.usedForTerrain){const x=g.getSource();x.attribution&&t.indexOf(x.attribution)<0&&t.push(x.attribution)}}t=t.filter(d=>String(d).trim()),t.sort((d,g)=>d.length-g.length),t=t.filter((d,g)=>{for(let x=g+1;x=0)return!1;return!0});const c=t.join(" | ");c!==this._attribHTML&&(this._attribHTML=c,t.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ht{constructor(t={}){this._updateCompact=()=>{const o=this._container.children;if(o.length){const c=o[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&c.classList.add("maplibregl-compact"):c.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=L.create("div","maplibregl-ctrl");const o=L.create("a","maplibregl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://maplibre.org/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){L.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class tl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const o=++this._id;return this._queue.push({callback:t,id:o,cancelled:!1}),o}remove(t){const o=this._currentlyRunning,c=o?this._queue.concat(o):this._queue;for(const d of c)if(d.id===t)return void(d.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const o=this._currentlyRunning=this._queue;this._queue=[];for(const c of o)if(!c.cancelled&&(c.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Eu={"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"};var Ih=u.Q([{name:"a_pos3d",type:"Int16",components:3}]);class Ch extends u.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,o){this.sourceCache.update(t,o),this._renderableTilesKeys=[];const c={};for(const d of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:o}))c[d.key]=!0,this._renderableTilesKeys.push(d.key),this._tiles[d.key]||(d.posMatrix=new Float64Array(16),u.aS(d.posMatrix,0,u.N,0,u.N,0,1),this._tiles[d.key]=new as(d,this.tileSize));for(const d in this._tiles)c[d]||delete this._tiles[d]}freeRtt(t){for(const o in this._tiles){const c=this._tiles[o];(!t||c.tileID.equals(t)||c.tileID.isChildOf(t)||t.isChildOf(c.tileID))&&(c.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const o={};for(const c of this._renderableTilesKeys){const d=this._tiles[c].tileID;if(d.canonical.equals(t.canonical)){const g=t.clone();g.posMatrix=new Float64Array(16),u.aS(g.posMatrix,0,u.N,0,u.N,0,1),o[c]=g}else if(d.canonical.isChildOf(t.canonical)){const g=t.clone();g.posMatrix=new Float64Array(16);const x=d.canonical.z-t.canonical.z,b=d.canonical.x-(d.canonical.x>>x<>x<>x;u.aS(g.posMatrix,0,E,0,E,0,1),u.$(g.posMatrix,g.posMatrix,[-b*E,-T*E,0]),o[c]=g}else if(t.canonical.isChildOf(d.canonical)){const g=t.clone();g.posMatrix=new Float64Array(16);const x=t.canonical.z-d.canonical.z,b=t.canonical.x-(t.canonical.x>>x<>x<>x;u.aS(g.posMatrix,0,u.N,0,u.N,0,1),u.$(g.posMatrix,g.posMatrix,[b*E,T*E,0]),u.a0(g.posMatrix,g.posMatrix,[1/2**x,1/2**x,0]),o[c]=g}}return o}getSourceTile(t,o){const c=this.sourceCache._source;let d=t.overscaledZ-this.deltaZoom;if(d>c.maxzoom&&(d=c.maxzoom),d=c.minzoom&&(!g||!g.dem);)g=this.sourceCache.getTileByID(t.scaledTo(d--).key);return g}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(o=>o.timeAdded>=t)}}class Ph{constructor(t,o,c){this.painter=t,this.sourceCache=new Ch(o),this.options=c,this.exaggeration=typeof c.exaggeration=="number"?c.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,o,c,d=u.N){var g;if(!(o>=0&&o=0&&ct.canonical.z&&(t.canonical.z>=d?g=t.canonical.z-d:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const x=t.canonical.x-(t.canonical.x>>g<>g<>8<<4|g>>8,o[x+3]=0;const c=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(o.buffer)),d=new Ge(t,c,t.gl.RGBA,{premultiply:!1});return d.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=d,d}pointCoordinate(t){const o=new Uint8Array(4),c=this.painter.context,d=c.gl;c.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),d.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,d.RGBA,d.UNSIGNED_BYTE,o),c.bindFramebuffer.set(null);const g=o[0]+(o[2]>>4<<8),x=o[1]+((15&o[2])<<8),b=this.coordsIndex[255-o[3]],T=b&&this.sourceCache.getTileByID(b);if(!T)return null;const E=this._coordsTextureSize,P=(1<0&&Math.sign(g)<0||!c&&Math.sign(d)<0&&Math.sign(g)>0?(d=360*Math.sign(g)+d,u.G(d)):o}}class Lp{constructor(t,o,c){this._context=t,this._size=o,this._tileSize=c,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const o=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),c=new Ge(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return c.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),o.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),o.colorAttachment.set(c.texture),{id:t,fbo:o,texture:c,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(o=>t.id!==o),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const o of this._recentlyUsed)if(!this._objects[o].inUse)return this._objects[o];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse)===!1}}const an={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class il{constructor(t,o){this.painter=t,this.terrain=o,this.pool=new Lp(t.context,30,o.sourceCache.tileSize*o.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,o){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(c=>!t._layers[c].isHidden(o)),this._coordsDescendingInv={};for(const c in t.sourceCaches){this._coordsDescendingInv[c]={};const d=t.sourceCaches[c].getVisibleCoordinates();for(const g of d){const x=this.terrain.sourceCache.getTerrainCoords(g);for(const b in x)this._coordsDescendingInv[c][b]||(this._coordsDescendingInv[c][b]=[]),this._coordsDescendingInv[c][b].push(x[b])}}this._coordsDescendingInvStr={};for(const c of t._order){const d=t._layers[c],g=d.source;if(an[d.type]&&!this._coordsDescendingInvStr[g]){this._coordsDescendingInvStr[g]={};for(const x in this._coordsDescendingInv[g])this._coordsDescendingInvStr[g][x]=this._coordsDescendingInv[g][x].map(b=>b.key).sort().join()}}for(const c of this._renderableTiles)for(const d in this._coordsDescendingInvStr){const g=this._coordsDescendingInvStr[d][c.tileID.key];g&&g!==c.rttCoords[d]&&(c.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const o=t.type,c=this.painter,d=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(an[o]&&(this._prevType&&an[this._prevType]||this._stacks.push([]),this._prevType=o,this._stacks[this._stacks.length-1].push(t.id),!d))return!0;if(an[this._prevType]||an[o]&&d){this._prevType=o;const g=this._stacks.length-1,x=this._stacks[g]||[];for(const b of this._renderableTiles){if(this.pool.isFull()&&(si(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(b),b.rtt[g]){const E=this.pool.getObjectForId(b.rtt[g].id);if(E.stamp===b.rtt[g].stamp){this.pool.useObject(E);continue}}const T=this.pool.getOrCreateFreeObject();this.pool.useObject(T),this.pool.stampObject(T),b.rtt[g]={id:T.id,stamp:T.stamp},c.context.bindFramebuffer.set(T.fbo.framebuffer),c.context.clear({color:u.aT.transparent,stencil:0}),c.currentStencilSource=void 0;for(let E=0;E{f.touchstart=f.dragStart,f.touchmoveWindow=f.dragMove,f.touchend=f.dragEnd},Iu={showCompass:!0,showZoom:!0,visualizePitch:!1};class Cu{constructor(t,o,c=!1){this.mousedown=x=>{this.startMouse(u.e({},x,{ctrlKey:!0,preventDefault:()=>x.preventDefault()}),L.mousePos(this.element,x)),L.addEventListener(window,"mousemove",this.mousemove),L.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=x=>{this.moveMouse(x,L.mousePos(this.element,x))},this.mouseup=x=>{this.mouseRotate.dragEnd(x),this.mousePitch&&this.mousePitch.dragEnd(x),this.offTemp()},this.touchstart=x=>{x.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=L.touchPos(this.element,x.targetTouches)[0],this.startTouch(x,this._startPos),L.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.addEventListener(window,"touchend",this.touchend))},this.touchmove=x=>{x.targetTouches.length!==1?this.reset():(this._lastPos=L.touchPos(this.element,x.targetTouches)[0],this.moveTouch(x,this._lastPos))},this.touchend=x=>{x.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const d=t.dragRotate._mouseRotate.getClickTolerance(),g=t.dragRotate._mousePitch.getClickTolerance();this.element=o,this.mouseRotate=fo({clickTolerance:d,enable:!0}),this.touchRotate=(({enable:x,clickTolerance:b,bearingDegreesPerPixelMoved:T=.8})=>{const E=new wh;return new $r({clickTolerance:b,move:(P,M)=>({bearingDelta:(M.x-P.x)*T}),moveStateManager:E,enable:x,assignEvents:sa})})({clickTolerance:d,enable:!0}),this.map=t,c&&(this.mousePitch=Zr({clickTolerance:g,enable:!0}),this.touchPitch=(({enable:x,clickTolerance:b,pitchDegreesPerPixelMoved:T=-.5})=>{const E=new wh;return new $r({clickTolerance:b,move:(P,M)=>({pitchDelta:(M.y-P.y)*T}),moveStateManager:E,enable:x,assignEvents:sa})})({clickTolerance:g,enable:!0})),L.addEventListener(o,"mousedown",this.mousedown),L.addEventListener(o,"touchstart",this.touchstart,{passive:!1}),L.addEventListener(o,"touchcancel",this.reset)}startMouse(t,o){this.mouseRotate.dragStart(t,o),this.mousePitch&&this.mousePitch.dragStart(t,o),L.disableDrag()}startTouch(t,o){this.touchRotate.dragStart(t,o),this.touchPitch&&this.touchPitch.dragStart(t,o),L.disableDrag()}moveMouse(t,o){const c=this.map,{bearingDelta:d}=this.mouseRotate.dragMove(t,o)||{};if(d&&c.setBearing(c.getBearing()+d),this.mousePitch){const{pitchDelta:g}=this.mousePitch.dragMove(t,o)||{};g&&c.setPitch(c.getPitch()+g)}}moveTouch(t,o){const c=this.map,{bearingDelta:d}=this.touchRotate.dragMove(t,o)||{};if(d&&c.setBearing(c.getBearing()+d),this.touchPitch){const{pitchDelta:g}=this.touchPitch.dragMove(t,o)||{};g&&c.setPitch(c.getPitch()+g)}}off(){const t=this.element;L.removeEventListener(t,"mousedown",this.mousedown),L.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend),L.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){L.enableDrag(),L.removeEventListener(window,"mousemove",this.mousemove),L.removeEventListener(window,"mouseup",this.mouseup),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend)}}let gi;function Pu(f,t,o){if(f=new u.L(f.lng,f.lat),t){const c=new u.L(f.lng-360,f.lat),d=new u.L(f.lng+360,f.lat),g=o.locationPoint(f).distSqr(t);o.locationPoint(c).distSqr(t)180;){const c=o.locationPoint(f);if(c.x>=0&&c.y>=0&&c.x<=o.width&&c.y<=o.height)break;f.lng>o.center.lng?f.lng-=360:f.lng+=360}return f}const Yn={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 Mh(f,t,o){const c=f.classList;for(const d in Yn)c.remove(`maplibregl-${o}-anchor-${d}`);c.add(`maplibregl-${o}-anchor-${t}`)}class Ds extends u.E{constructor(t){if(super(),this._onKeyPress=o=>{const c=o.code,d=o.charCode||o.keyCode;c!=="Space"&&c!=="Enter"&&d!==32&&d!==13||this.togglePopup()},this._onMapClick=o=>{const c=o.originalEvent.target,d=this._element;this._popup&&(c===d||d.contains(c))&&this.togglePopup()},this._update=o=>{if(!this._map)return;const c=this._map.loaded()&&!this._map.isMoving();((o==null?void 0:o.type)==="terrain"||(o==null?void 0:o.type)==="render"&&!c)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=Pu(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 g="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?g="rotateX(0deg)":this._pitchAlignment==="map"&&(g=`rotateX(${this._map.getPitch()}deg)`),o&&o.type!=="moveend"||(this._pos=this._pos.round()),L.setTransform(this._element,`${Yn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${g} ${d}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const x=this._map.unproject(this._pos),b=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=x.distanceTo(this._lngLat)>20*b?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=o=>{if(!this._isDragging){const c=this._clickTolerance||this._map._clickTolerance;this._isDragging=o.point.dist(this._pointerdownPos)>=c}this._isDragging&&(this._pos=o.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 u.k("dragstart"))),this.fire(new u.k("drag")))},this._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 u.k("dragend")),this._state="inactive"},this._addDragHandler=o=>{this._element.contains(o.originalEvent.target)&&(o.preventDefault(),this._positionDelta=o.point.sub(this._pos).add(this._offset),this._pointerdownPos=o.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))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=u.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=L.create("div"),this._element.setAttribute("aria-label","Map marker");const o=L.createNS("http://www.w3.org/2000/svg","svg"),c=41,d=27;o.setAttributeNS(null,"display","block"),o.setAttributeNS(null,"height",`${c}px`),o.setAttributeNS(null,"width",`${d}px`),o.setAttributeNS(null,"viewBox",`0 0 ${d} ${c}`);const g=L.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"stroke","none"),g.setAttributeNS(null,"stroke-width","1"),g.setAttributeNS(null,"fill","none"),g.setAttributeNS(null,"fill-rule","evenodd");const x=L.createNS("http://www.w3.org/2000/svg","g");x.setAttributeNS(null,"fill-rule","nonzero");const b=L.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"transform","translate(3.0, 29.0)"),b.setAttributeNS(null,"fill","#000000");const T=[{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(const re of T){const pe=L.createNS("http://www.w3.org/2000/svg","ellipse");pe.setAttributeNS(null,"opacity","0.04"),pe.setAttributeNS(null,"cx","10.5"),pe.setAttributeNS(null,"cy","5.80029008"),pe.setAttributeNS(null,"rx",re.rx),pe.setAttributeNS(null,"ry",re.ry),b.appendChild(pe)}const E=L.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill",this._color);const P=L.createNS("http://www.w3.org/2000/svg","path");P.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"),E.appendChild(P);const M=L.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"opacity","0.25"),M.setAttributeNS(null,"fill","#000000");const F=L.createNS("http://www.w3.org/2000/svg","path");F.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"),M.appendChild(F);const Z=L.createNS("http://www.w3.org/2000/svg","g");Z.setAttributeNS(null,"transform","translate(6.0, 7.0)"),Z.setAttributeNS(null,"fill","#FFFFFF");const $=L.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(8.0, 8.0)");const G=L.createNS("http://www.w3.org/2000/svg","circle");G.setAttributeNS(null,"fill","#000000"),G.setAttributeNS(null,"opacity","0.25"),G.setAttributeNS(null,"cx","5.5"),G.setAttributeNS(null,"cy","5.5"),G.setAttributeNS(null,"r","5.4999962");const U=L.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#FFFFFF"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962"),$.appendChild(G),$.appendChild(U),x.appendChild(b),x.appendChild(E),x.appendChild(M),x.appendChild(Z),x.appendChild($),o.appendChild(x),o.setAttributeNS(null,"height",c*this._scale+"px"),o.setAttributeNS(null,"width",d*this._scale+"px"),this._element.appendChild(o),this._offset=u.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",o=>{o.preventDefault()}),this._element.addEventListener("mousedown",o=>{o.preventDefault()}),Mh(this._element,this._anchor,"marker"),t&&t.className)for(const o of t.className.split(" "))this._element.classList.add(o);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",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),L.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=u.L.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const d=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,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}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(t){return this._offset=u.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(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(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const oi={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ti=0,go=!1;const oa={maxWidth:100,unit:"metric"};function aa(f,t,o){const c=o&&o.maxWidth||100,d=f._container.clientHeight/2,g=f.unproject([0,d]),x=f.unproject([c,d]),b=g.distanceTo(x);if(o&&o.unit==="imperial"){const T=3.2808*b;T>5280?Ls(t,c,T/5280,f._getUIString("ScaleControl.Miles")):Ls(t,c,T,f._getUIString("ScaleControl.Feet"))}else o&&o.unit==="nautical"?Ls(t,c,b/1852,f._getUIString("ScaleControl.NauticalMiles")):b>=1e3?Ls(t,c,b/1e3,f._getUIString("ScaleControl.Kilometers")):Ls(t,c,b,f._getUIString("ScaleControl.Meters"))}function Ls(f,t,o,c){const d=function(g){const x=Math.pow(10,`${Math.floor(g)}`.length-1);let b=g/x;return b=b>=10?10:b>=5?5:b>=3?3:b>=2?2:b>=1?1:function(T){const E=Math.pow(10,Math.ceil(-Math.log(T)/Math.LN10));return Math.round(T*E)/E}(b),x*b}(o);f.style.width=t*(d/o)+"px",f.innerHTML=`${d} ${c}`}const Mu={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},zu=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function yo(f){if(f){if(typeof f=="number"){const t=Math.round(Math.abs(f)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,f),"top-left":new u.P(t,t),"top-right":new u.P(-t,t),bottom:new u.P(0,-f),"bottom-left":new u.P(t,-t),"bottom-right":new u.P(-t,-t),left:new u.P(f,0),right:new u.P(-f,0)}}if(f instanceof u.P||Array.isArray(f)){const t=u.P.convert(f);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:u.P.convert(f.center||[0,0]),top:u.P.convert(f.top||[0,0]),"top-left":u.P.convert(f["top-left"]||[0,0]),"top-right":u.P.convert(f["top-right"]||[0,0]),bottom:u.P.convert(f.bottom||[0,0]),"bottom-left":u.P.convert(f["bottom-left"]||[0,0]),"bottom-right":u.P.convert(f["bottom-right"]||[0,0]),left:u.P.convert(f.left||[0,0]),right:u.P.convert(f.right||[0,0])}}return yo(new u.P(0,0))}const Au={extend:(f,...t)=>u.e(f,...t),run(f){f()},logToElement(f,t=!1,o="log"){const c=window.document.getElementById(o);c&&(t&&(c.innerHTML=""),c.innerHTML+=`
${f}`)}},Du=N;class At{static get version(){return Du}static get workerCount(){return vr.workerCount}static set workerCount(t){vr.workerCount=t}static get maxParallelImageRequests(){return u.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(t){u.c.MAX_PARALLEL_IMAGE_REQUESTS=t}static get workerUrl(){return u.c.WORKER_URL}static set workerUrl(t){u.c.WORKER_URL=t}static addProtocol(t,o){u.c.REGISTERED_PROTOCOLS[t]=o}static removeProtocol(t){delete u.c.REGISTERED_PROTOCOLS[t]}}return At.Map=class extends Eh{constructor(f){if(u.bg.mark(u.bh.create),(f=u.e({},st,f)).minZoom!=null&&f.maxZoom!=null&&f.minZoom>f.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(f.minPitch!=null&&f.maxPitch!=null&&f.minPitch>f.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(f.minPitch!=null&&f.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(f.maxPitch!=null&&f.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ya(f.minZoom,f.maxZoom,f.minPitch,f.maxPitch,f.renderWorldCopies),{bearingSnap:f.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=t=>{t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new u.k("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.k("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=f.interactive,this._cooperativeGestures=f.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=f.maxTileCacheSize,this._maxTileCacheZoomLevels=f.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=f.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=f.preserveDrawingBuffer,this._antialias=f.antialias,this._trackResize=f.trackResize,this._bearingSnap=f.bearingSnap,this._refreshExpiredTiles=f.refreshExpiredTiles,this._fadeDuration=f.fadeDuration,this._crossSourceCollisions=f.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=f.collectResourceTiming,this._renderTaskQueue=new tl,this._controls=[],this._mapId=u.a2(),this._locale=u.e({},Eu,f.locale),this._clickTolerance=f.clickTolerance,this._overridePixelRatio=f.pixelRatio,this._maxCanvasSize=f.maxCanvasSize,this.transformCameraUpdate=f.transformCameraUpdate,this._imageQueueHandle=ut.addThrottleControl(()=>this.isMoving()),this._requestManager=new J(f.transformRequest),typeof f.container=="string"){if(this._container=document.getElementById(f.container),!this._container)throw new Error(`Container '${f.container}' not found.`)}else{if(!(f.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=f.container}if(f.maxBounds&&this.setMaxBounds(f.maxBounds),this._setupContainer(),this._setupPainter(),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)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let t=!1;const o=As(c=>{this._trackResize&&!this._removed&&this.resize(c)._update()},50);this._resizeObserver=new ResizeObserver(c=>{t?o(c):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new ku(this,f),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=f.hash&&new ea(typeof f.hash=="string"&&f.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:f.center,zoom:f.zoom,bearing:f.bearing,pitch:f.pitch}),f.bounds&&(this.resize(),this.fitBounds(f.bounds,u.e({},f.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=f.localIdeographFontFamily,this._validateStyle=f.validateStyle,f.style&&this.setStyle(f.style,{localIdeographFontFamily:f.localIdeographFontFamily}),f.attributionControl&&this.addControl(new Ln({customAttribution:f.customAttribution})),f.maplibreLogo&&this.addControl(new Ht,f.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update(t.dataType==="style"),this.fire(new u.k(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new u.k(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new u.k("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(f,t){if(t===void 0&&(t=f.getDefaultPosition?f.getDefaultPosition():"top-right"),!f||!f.onAdd)return this.fire(new u.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=f.onAdd(this);this._controls.push(f);const c=this._controlPositions[t];return t.indexOf("bottom")!==-1?c.insertBefore(o,c.firstChild):c.appendChild(o),this}removeControl(f){if(!f||!f.onRemove)return this.fire(new u.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(f);return t>-1&&this._controls.splice(t,1),f.onRemove(this),this}hasControl(f){return this._controls.indexOf(f)>-1}calculateCameraOptionsFromTo(f,t,o,c){return c==null&&this.terrain&&(c=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(f,t,o,c)}resize(f){var t;const o=this._containerDimensions(),c=o[0],d=o[1],g=this._getClampedPixelRatio(c,d);if(this._resizeCanvas(c,d,g),this.painter.resize(c,d,g),this.painter.overLimit()){const b=this.painter.context.gl;this._maxCanvasSize=[b.drawingBufferWidth,b.drawingBufferHeight];const T=this._getClampedPixelRatio(c,d);this._resizeCanvas(c,d,T),this.painter.resize(c,d,T)}this.transform.resize(c,d),(t=this._requestedCameraState)===null||t===void 0||t.resize(c,d);const x=!this._moving;return x&&(this.stop(),this.fire(new u.k("movestart",f)).fire(new u.k("move",f))),this.fire(new u.k("resize",f)),x&&this.fire(new u.k("moveend",f)),this}_getClampedPixelRatio(f,t){const{0:o,1:c}=this._maxCanvasSize,d=this.getPixelRatio(),g=f*d,x=t*d;return Math.min(g>o?o/g:1,x>c?c/x:1)*d}getPixelRatio(){var f;return(f=this._overridePixelRatio)!==null&&f!==void 0?f:devicePixelRatio}setPixelRatio(f){this._overridePixelRatio=f,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(f){return this.transform.setMaxBounds(It.convert(f)),this._update()}setMinZoom(f){if((f=f??-2)>=-2&&f<=this.transform.maxZoom)return this.transform.minZoom=f,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=f,this._update(),this.getZoom()>f&&this.setZoom(f),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(f){if((f=f??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(f>=0&&f<=this.transform.maxPitch)return this.transform.minPitch=f,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(f>=this.transform.minPitch)return this.transform.maxPitch=f,this._update(),this.getPitch()>f&&this.setPitch(f),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(f){return this.transform.renderWorldCopies=f,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(f){return this._cooperativeGestures=f,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(f){return this.transform.locationPoint(u.L.convert(f),this.style&&this.terrain)}unproject(f){return this.transform.pointLocation(u.P.convert(f),this.terrain)}isMoving(){var f;return this._moving||((f=this.handlers)===null||f===void 0?void 0:f.isMoving())}isZooming(){var f;return this._zooming||((f=this.handlers)===null||f===void 0?void 0:f.isZooming())}isRotating(){var f;return this._rotating||((f=this.handlers)===null||f===void 0?void 0:f.isRotating())}_createDelegatedListener(f,t,o){if(f==="mouseenter"||f==="mouseover"){let c=!1;return{layer:t,listener:o,delegates:{mousemove:g=>{const x=this.getLayer(t)?this.queryRenderedFeatures(g.point,{layers:[t]}):[];x.length?c||(c=!0,o.call(this,new Dn(f,this,g.originalEvent,{features:x}))):c=!1},mouseout:()=>{c=!1}}}}if(f==="mouseleave"||f==="mouseout"){let c=!1;return{layer:t,listener:o,delegates:{mousemove:x=>{(this.getLayer(t)?this.queryRenderedFeatures(x.point,{layers:[t]}):[]).length?c=!0:c&&(c=!1,o.call(this,new Dn(f,this,x.originalEvent)))},mouseout:x=>{c&&(c=!1,o.call(this,new Dn(f,this,x.originalEvent)))}}}}{const c=d=>{const g=this.getLayer(t)?this.queryRenderedFeatures(d.point,{layers:[t]}):[];g.length&&(d.features=g,o.call(this,d),delete d.features)};return{layer:t,listener:o,delegates:{[f]:c}}}}on(f,t,o){if(o===void 0)return super.on(f,t);const c=this._createDelegatedListener(f,t,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[f]=this._delegatedListeners[f]||[],this._delegatedListeners[f].push(c);for(const d in c.delegates)this.on(d,c.delegates[d]);return this}once(f,t,o){if(o===void 0)return super.once(f,t);const c=this._createDelegatedListener(f,t,o);for(const d in c.delegates)this.once(d,c.delegates[d]);return this}off(f,t,o){return o===void 0?super.off(f,t):(this._delegatedListeners&&this._delegatedListeners[f]&&(c=>{const d=this._delegatedListeners[f];for(let g=0;gthis._updateStyle(f,t));const o=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!f)),f?(this.style=new Ui(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof f=="string"?this.style.loadURL(f,t,o):this.style.loadJSON(f,t,o),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Ui(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(f,t){if(typeof f=="string"){const o=this._requestManager.transformRequest(f,se.Style);u.f(o,(c,d)=>{c?this.fire(new u.j(c)):d&&this._updateDiff(d,t)})}else typeof f=="object"&&this._updateDiff(f,t)}_updateDiff(f,t){try{this.style.setState(f,t)&&this._update(!0)}catch(o){u.w(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(f,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():u.w("There is no style added to the map.")}addSource(f,t){return this._lazyInitEmptyStyle(),this.style.addSource(f,t),this._update(!0)}isSourceLoaded(f){const t=this.style&&this.style.sourceCaches[f];if(t!==void 0)return t.loaded();this.fire(new u.j(new Error(`There is no source with ID '${f}'`)))}setTerrain(f){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),f){const t=this.style.sourceCaches[f.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${f.source}`);for(const o in this.style._layers){const c=this.style._layers[o];c.type==="hillshade"&&c.source===f.source&&u.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Ph(this.painter,t,f),this.painter.renderToTexture=new il(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=o=>{o.dataType==="style"?this.terrain.sourceCache.freeRtt():o.dataType==="source"&&o.tile&&(o.sourceId!==f.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(o.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new u.k("terrain",{terrain:f})),this}getTerrain(){var f,t;return(t=(f=this.terrain)===null||f===void 0?void 0:f.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const f=this.style&&this.style.sourceCaches;for(const t in f){const o=f[t]._tiles;for(const c in o){const d=o[c];if(d.state!=="loaded"&&d.state!=="errored")return!1}}return!0}addSourceType(f,t,o){return this._lazyInitEmptyStyle(),this.style.addSourceType(f,t,o)}removeSource(f){return this.style.removeSource(f),this._update(!0)}getSource(f){return this.style.getSource(f)}addImage(f,t,o={}){const{pixelRatio:c=1,sdf:d=!1,stretchX:g,stretchY:x,content:b}=o;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||u.a(t))){if(t.width===void 0||t.height===void 0)return this.fire(new u.j(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`")));{const{width:T,height:E,data:P}=t,M=t;return this.style.addImage(f,{data:new u.R({width:T,height:E},new Uint8Array(P)),pixelRatio:c,stretchX:g,stretchY:x,content:b,sdf:d,version:0,userImage:M}),M.onAdd&&M.onAdd(this,f),this}}{const{width:T,height:E,data:P}=u.h.getImageData(t);this.style.addImage(f,{data:new u.R({width:T,height:E},P),pixelRatio:c,stretchX:g,stretchY:x,content:b,sdf:d,version:0})}}updateImage(f,t){const o=this.style.getImage(f);if(!o)return this.fire(new u.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const c=t instanceof HTMLImageElement||u.a(t)?u.h.getImageData(t):t,{width:d,height:g,data:x}=c;if(d===void 0||g===void 0)return this.fire(new u.j(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(d!==o.data.width||g!==o.data.height)return this.fire(new u.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const b=!(t instanceof HTMLImageElement||u.a(t));return o.data.replace(x,b),this.style.updateImage(f,o),this}getImage(f){return this.style.getImage(f)}hasImage(f){return f?!!this.style.getImage(f):(this.fire(new u.j(new Error("Missing required image id"))),!1)}removeImage(f){this.style.removeImage(f)}loadImage(f,t){ut.getImage(this._requestManager.transformRequest(f,se.Image),t)}listImages(){return this.style.listImages()}addLayer(f,t){return this._lazyInitEmptyStyle(),this.style.addLayer(f,t),this._update(!0)}moveLayer(f,t){return this.style.moveLayer(f,t),this._update(!0)}removeLayer(f){return this.style.removeLayer(f),this._update(!0)}getLayer(f){return this.style.getLayer(f)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(f,t,o){return this.style.setLayerZoomRange(f,t,o),this._update(!0)}setFilter(f,t,o={}){return this.style.setFilter(f,t,o),this._update(!0)}getFilter(f){return this.style.getFilter(f)}setPaintProperty(f,t,o,c={}){return this.style.setPaintProperty(f,t,o,c),this._update(!0)}getPaintProperty(f,t){return this.style.getPaintProperty(f,t)}setLayoutProperty(f,t,o,c={}){return this.style.setLayoutProperty(f,t,o,c),this._update(!0)}getLayoutProperty(f,t){return this.style.getLayoutProperty(f,t)}setGlyphs(f,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(f,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(f,t,o={}){return this._lazyInitEmptyStyle(),this.style.addSprite(f,t,o,c=>{c||this._update(!0)}),this}removeSprite(f){return this._lazyInitEmptyStyle(),this.style.removeSprite(f),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(f,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(f,t,o=>{o||this._update(!0)}),this}setLight(f,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(f,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(f,t){return this.style.setFeatureState(f,t),this._update()}removeFeatureState(f,t){return this.style.removeFeatureState(f,t),this._update()}getFeatureState(f){return this.style.getFeatureState(f)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let f=0,t=0;return this._container&&(f=this._container.clientWidth||400,t=this._container.clientHeight||300),[f,t]}_setupContainer(){const f=this._container;f.classList.add("maplibregl-map");const t=this._canvasContainer=L.create("div","maplibregl-canvas-container",f);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=L.create("canvas","maplibregl-canvas",t),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");const o=this._containerDimensions(),c=this._getClampedPixelRatio(o[0],o[1]);this._resizeCanvas(o[0],o[1],c);const d=this._controlContainer=L.create("div","maplibregl-control-container",f),g=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(x=>{g[x]=L.create("div",`maplibregl-ctrl-${x} `,d)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=L.create("div","maplibregl-cooperative-gesture-screen",this._container);let f=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(f=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
${f}
${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
- `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){L.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(f,t,o){this._canvas.width=Math.floor(o*f),this._canvas.height=Math.floor(o*t),this._canvas.style.width=`${f}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const f={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",c=>{t={requestedAttributes:f},c&&(t.statusMessage=c.statusMessage,t.type=c.type)},{once:!0});const o=this._canvas.getContext("webgl2",f)||this._canvas.getContext("webgl",f);if(!o){const c="Failed to initialize WebGL";throw t?(t.message=c,new Error(JSON.stringify(t))):new Error(c)}this.painter=new zs(o,this.transform),ne.testSupport(o)}_onCooperativeGesture(f,t,o){return!t&&o<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(f){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||f,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(f){return this._update(),this._renderTaskQueue.add(f)}_cancelRenderFrame(f){this._renderTaskQueue.remove(f)}_render(f){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(f),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const d=this.transform.zoom,g=u.h.now();this.style.zoomHistory.update(d,g);const x=new u.a8(d,{now:g,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),b=x.crossFadingFactor();b===1&&b===this._crossFadingFactor||(o=!0,this._crossFadingFactor=b),this.style.update(x)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.bg.mark(u.bh.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const c=this._sourcesDirty||this._styleDirty||this._placementDirty;return c||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.k("idle")),!this._loaded||this._fullyLoaded||c||(this._fullyLoaded=!0,u.bg.mark(u.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var f;this._hash&&this._hash.remove();for(const o of this._controls)o.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("online",this._onWindowOnline,!1),ut.removeThrottleControl(this._imageQueueHandle),(f=this._resizeObserver)===null||f===void 0||f.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),L.remove(this._canvasContainer),L.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),u.bg.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=u.h.frame(f=>{u.bg.frame(f),this._frame=null,this._render(f)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(f){this._showTileBoundaries!==f&&(this._showTileBoundaries=f,this._update())}get showPadding(){return!!this._showPadding}set showPadding(f){this._showPadding!==f&&(this._showPadding=f,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(f){this._showCollisionBoxes!==f&&(this._showCollisionBoxes=f,f?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(f){this._showOverdrawInspector!==f&&(this._showOverdrawInspector=f,this._update())}get repaint(){return!!this._repaint}set repaint(f){this._repaint!==f&&(this._repaint=f,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(f){this._vertices=f,this._update()}get version(){return et}getCameraTargetElevation(){return this.transform.elevation}},At.NavigationControl=class{constructor(f){this._updateZoomButtons=()=>{const t=this._map.getZoom(),o=t===this._map.getMaxZoom(),c=t===this._map.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())},this._rotateCompassArrow=()=>{const t=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=t},this._setButtonTitle=(t,o)=>{const c=this._map._getUIString(`NavigationControl.${o}`);t.title=c,t.setAttribute("aria-label",c)},this.options=u.e({},Iu,f),this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),L.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),L.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=L.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(f){return this._map=f,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 Cu(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){L.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(f,t){const o=L.create("button",f,this._container);return o.type="button",o.addEventListener("click",t),o}},At.GeolocateControl=class extends u.E{constructor(f){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new u.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new u.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const o=new u.L(t.coords.longitude,t.coords.latitude),c=t.coords.accuracy,d=this._map.getBearing(),g=u.e({bearing:d},this.options.fitBoundsOptions),x=It.fromLngLat(o,c);this._map.fitBounds(x,g,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const o=new u.L(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(o).addTo(this._map),this._userLocationDotMarker.setLngLat(o).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&go)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",o=>o.preventDefault()),this._geolocateButton=L.create("button","maplibregl-ctrl-geolocate",this._container),L.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=L.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ds({element:this._dotElement}),this._circleElement=L.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ds({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",o=>{o.geolocateSource||this._watchState!=="ACTIVE_LOCK"||o.originalEvent&&o.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new u.k("trackuserlocationend")))})}},this.options=u.e({},oi,f)}onAdd(f){return this._map=f,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,o=!1){gi===void 0||o?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(c=>{gi=c.state!=="denied",t(gi)}).catch(()=>{gi=!!window.navigator.geolocation,t(gi)}):(gi=!!window.navigator.geolocation,t(gi)):t(gi)}(this._setupUI),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(),L.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ti=0,go=!1}_isOutOfMapMaxBounds(f){const t=this._map.getMaxBounds(),o=f.coords;return t&&(o.longitudet.getEast()||o.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const f=this._map.getBounds(),t=f.getSouthEast(),o=f.getNorthEast(),c=t.distanceTo(o),d=Math.ceil(this._accuracy/(c/this._map._container.clientHeight)*2);this._circleElement.style.width=`${d}px`,this._circleElement.style.height=`${d}px`}trigger(){if(!this._setup)return u.w("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 u.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ti--,go=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new u.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new u.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-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 f;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ti++,ti>1?(f={maximumAge:6e5,timeout:0},go=!0):(f=this.options.positionOptions,go=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,f)}}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"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},At.AttributionControl=Ln,At.LogoControl=Ht,At.ScaleControl=class{constructor(f){this._onMove=()=>{aa(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,aa(this._map,this._container,this.options)},this.options=u.e({},oa,f)}getDefaultPosition(){return"bottom-left"}onAdd(f){return this._map=f,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-scale",f.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){L.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},At.FullscreenControl=class extends u.E{constructor(f={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,f&&f.container&&(f.container instanceof HTMLElement?this._container=f.container:u.w("Full screen control 'container' must be a DOM element.")),"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(f){return this._map=f,this._container||(this._container=this._map.getContainer()),this._controlContainer=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){L.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const f=this._fullscreenButton=L.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);L.create("span","maplibregl-ctrl-icon",f).setAttribute("aria-hidden","true"),f.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const f=this._getTitle();this._fullscreenButton.setAttribute("aria-label",f),this._fullscreenButton.title=f}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new u.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new u.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){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._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},At.TerrainControl=class{constructor(f){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=f}onAdd(f){return this._map=f,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=L.create("button","maplibregl-ctrl-terrain",this._container),L.create("span","maplibregl-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(){L.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},At.Popup=class extends u.E{constructor(f){super(),this.remove=()=>(this._content&&L.remove(this._content),this._container&&(L.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 u.k("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=L.create("div","maplibregl-popup",this._map.getContainer()),this._tip=L.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const x of this.options.className.split(" "))this._container.classList.add(x);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(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=Pu(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const o=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let c=this.options.anchor;const d=yo(this.options.offset);if(!c){const x=this._container.offsetWidth,b=this._container.offsetHeight;let T;T=o.y+d.bottom.ythis._map.transform.height-b?["bottom"]:[],o.xthis._map.transform.width-x/2&&T.push("right"),c=T.length===0?"bottom":T.join("-")}const g=o.add(d[c]).round();L.setTransform(this._container,`${Yn[c]} translate(${g.x}px,${g.y}px)`),Mh(this._container,c,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(Mu),f)}addTo(f){return this._map&&this.remove(),this._map=f,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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new u.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(f){return this._lngLat=u.L.convert(f),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"),this._map._canvasContainer.classList.remove("maplibregl-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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(f){return this.setDOMContent(document.createTextNode(f))}setHTML(f){const t=document.createDocumentFragment(),o=document.createElement("body");let c;for(o.innerHTML=f;c=o.firstChild,c;)t.appendChild(c);return this.setDOMContent(t)}getMaxWidth(){var f;return(f=this._container)===null||f===void 0?void 0:f.style.maxWidth}setMaxWidth(f){return this.options.maxWidth=f,this._update(),this}setDOMContent(f){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=L.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(f),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(f){this._container&&this._container.classList.add(f)}removeClassName(f){this._container&&this._container.classList.remove(f)}setOffset(f){return this.options.offset=f,this._update(),this}toggleClassName(f){if(this._container)return this._container.classList.toggle(f)}_createCloseButton(){this.options.closeButton&&(this._closeButton=L.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const f=this._container.querySelector(zu);f&&f.focus()}},At.Marker=Ds,At.Style=Ui,At.LngLat=u.L,At.LngLatBounds=It,At.Point=u.P,At.MercatorCoordinate=u.U,At.Evented=u.E,At.AJAXError=u.bi,At.config=u.c,At.CanvasSource=or,At.GeoJSONSource=sr,At.ImageSource=sn,At.RasterDEMTileSource=rn,At.RasterTileSource=Oi,At.VectorTileSource=nn,At.VideoSource=ss,At.setRTLTextPlugin=u.bj,At.getRTLTextPluginStatus=u.bk,At.prewarm=function(){Ca().acquire(Ct)},At.clearPrewarmedResources=function(){const f=Br;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(Ct),Br=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()"))},Au.extend(At,{isSafari:u.ac,getPerformanceMetrics:u.bg.getPerformanceMetrics}),At});var I=_;return I})})(u1);var h1=u1.exports;const Wm=Xv(h1),GS=vb({__proto__:null,default:Wm},[h1]),HS="modulepreload",WS=function(i){return"/"+i},Fv={},XS=function(r,l,p){let _=Promise.resolve();if(l&&l.length>0){const w=document.getElementsByTagName("link");_=Promise.all(l.map(I=>{if(I=WS(I),I in Fv)return;Fv[I]=!0;const u=I.endsWith(".css"),N=u?'[rel="stylesheet"]':"";if(!!p)for(let le=w.length-1;le>=0;le--){const te=w[le];if(te.href===I&&(!u||te.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${I}"]${N}`))return;const ne=document.createElement("link");if(ne.rel=u?"stylesheet":HS,u||(ne.as="script",ne.crossOrigin=""),ne.href=I,document.head.appendChild(ne),u)return new Promise((le,te)=>{ne.addEventListener("load",le),ne.addEventListener("error",()=>te(new Error(`Unable to preload CSS for ${I}`)))})}))}return _.then(()=>r()).catch(w=>{const I=new Event("vite:preloadError",{cancelable:!0});if(I.payload=w,window.dispatchEvent(I),!I.defaultPrevented)throw w})},KS=at.createContext(null);function YS(i,r){const l=Array.isArray(i)?i[0]:i?i.x:0,p=Array.isArray(i)?i[1]:i?i.y:0,_=Array.isArray(r)?r[0]:r?r.x:0,w=Array.isArray(r)?r[1]:r?r.y:0;return l===_&&p===w}function Gs(i,r){if(i===r)return!0;if(!i||!r)return!1;if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let l=0;l{let _=null;"interactive"in p&&(_=Object.assign({},p),delete _.interactive);const w=r[p.ref];if(w){_=_||Object.assign({},p),delete _.ref;for(const I of JS)I in w&&(_[I]=w[I])}return _||p});return{...i,layers:l}}var Uv={};const jv={version:8,sources:{},layers:[]},$v={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Qf={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},Zv={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},eT=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],tT=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class $l{constructor(r,l,p){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=_=>{const w=this.props[Zv[_.type]];w?w(_):_.type==="error"&&console.error(_.error)},this._onPointerEvent=_=>{(_.type==="mousemove"||_.type==="mouseout")&&this._updateHover(_);const w=this.props[$v[_.type]];w&&(this.props.interactiveLayerIds&&_.type!=="mouseover"&&_.type!=="mouseout"&&(_.features=this._hoveredFeatures||this._queryRenderedFeatures(_.point)),w(_),delete _.features)},this._onCameraEvent=_=>{if(!this._internalUpdate){const w=this.props[Qf[_.type]];w&&w(_)}_.type in this._deferredEvents&&(this._deferredEvents[_.type]=!1)},this._MapClass=r,this.props=l,this._initialize(p)}get map(){return this._map}get transform(){return this._renderTransform}setProps(r){const l=this.props;this.props=r;const p=this._updateSettings(r,l);p&&this._createShadowTransform(this._map);const _=this._updateSize(r),w=this._updateViewState(r,!0);this._updateStyle(r,l),this._updateStyleComponents(r,l),this._updateHandlers(r,l),(p||_||w&&!this._map.isMoving())&&this.redraw()}static reuse(r,l){const p=$l.savedMaps.pop();if(!p)return null;const _=p.map,w=_.getContainer();for(l.className=w.className;w.childNodes.length>0;)l.appendChild(w.childNodes[0]);_._container=l;const I=_._resizeObserver;I&&(I.disconnect(),I.observe(l)),p.setProps({...r,styleDiffing:!1}),_.resize();const{initialViewState:u}=r;return u&&(u.bounds?_.fitBounds(u.bounds,{...u.fitBoundsOptions,duration:0}):p._updateViewState(u,!1)),_.isStyleLoaded()?_.fire("load"):_.once("styledata",()=>_.fire("load")),_._update(),p}_initialize(r){const{props:l}=this,{mapStyle:p=jv}=l,_={...l,...l.initialViewState,accessToken:l.mapboxAccessToken||iT()||null,container:r,style:Vv(p)},w=_.initialViewState||_.viewState||_;if(Object.assign(_,{center:[w.longitude||0,w.latitude||0],zoom:w.zoom||0,pitch:w.pitch||0,bearing:w.bearing||0}),l.gl){const ne=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=ne,l.gl)}const I=new this._MapClass(_);w.padding&&I.setPadding(w.padding),l.cursor&&(I.getCanvas().style.cursor=l.cursor),this._createShadowTransform(I);const u=I._render;I._render=ne=>{this._inRender=!0,u.call(I,ne),this._inRender=!1};const N=I._renderTaskQueue.run;I._renderTaskQueue.run=ne=>{N.call(I._renderTaskQueue,ne),this._onBeforeRepaint()},I.on("render",()=>this._onAfterRepaint());const L=I.fire;I.fire=this._fireEvent.bind(this,L),I.on("resize",()=>{this._renderTransform.resize(I.transform.width,I.transform.height)}),I.on("styledata",()=>{this._updateStyleComponents(this.props,{}),Bv(I.transform,this._renderTransform)}),I.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const ne in $v)I.on(ne,this._onPointerEvent);for(const ne in Qf)I.on(ne,this._onCameraEvent);for(const ne in Zv)I.on(ne,this._onEvent);this._map=I}recycle(){const l=this.map.getContainer().querySelector("[mapboxgl-children]");l==null||l.remove(),$l.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const r=this._map;!this._inRender&&r.style&&(r._frame&&(r._frame.cancel(),r._frame=null),r._render())}_createShadowTransform(r){const l=QS(r.transform);r.painter.transform=l,this._renderTransform=l}_updateSize(r){const{viewState:l}=r;if(l){const p=this._map;if(l.width!==p.transform.width||l.height!==p.transform.height)return p.resize(),!0}return!1}_updateViewState(r,l){if(this._internalUpdate)return!1;const p=this._map,_=this._renderTransform,{zoom:w,pitch:I,bearing:u}=_,N=p.isMoving();N&&(_.cameraElevationReference="sea");const L=Nv(_,{...Ov(p.transform),...r});if(N&&(_.cameraElevationReference="ground"),L&&l){const ne=this._deferredEvents;ne.move=!0,ne.zoom||(ne.zoom=w!==_.zoom),ne.rotate||(ne.rotate=u!==_.bearing),ne.pitch||(ne.pitch=I!==_.pitch)}return N||Nv(p.transform,r),L}_updateSettings(r,l){const p=this._map;let _=!1;for(const w of eT)if(w in r&&!Gs(r[w],l[w])){_=!0;const I=p[`set${w[0].toUpperCase()}${w.slice(1)}`];I==null||I.call(p,r[w])}return _}_updateStyle(r,l){if(r.cursor!==l.cursor&&(this._map.getCanvas().style.cursor=r.cursor||""),r.mapStyle!==l.mapStyle){const{mapStyle:p=jv,styleDiffing:_=!0}=r,w={diff:_};return"localIdeographFontFamily"in r&&(w.localIdeographFontFamily=r.localIdeographFontFamily),this._map.setStyle(Vv(p),w),!0}return!1}_updateStyleComponents(r,l){const p=this._map;let _=!1;return p.isStyleLoaded()&&("light"in r&&p.setLight&&!Gs(r.light,l.light)&&(_=!0,p.setLight(r.light)),"fog"in r&&p.setFog&&!Gs(r.fog,l.fog)&&(_=!0,p.setFog(r.fog)),"terrain"in r&&p.setTerrain&&!Gs(r.terrain,l.terrain)&&(!r.terrain||p.getSource(r.terrain.source))&&(_=!0,p.setTerrain(r.terrain))),_}_updateHandlers(r,l){var p,_;const w=this._map;let I=!1;for(const u of tT){const N=(p=r[u])!==null&&p!==void 0?p:!0,L=(_=l[u])!==null&&_!==void 0?_:!0;Gs(N,L)||(I=!0,N?w[u].enable(N):w[u].disable())}return I}_queryRenderedFeatures(r){const l=this._map,p=l.transform,{interactiveLayerIds:_=[]}=this.props;try{return l.transform=this._renderTransform,l.queryRenderedFeatures(r,{layers:_.filter(l.getLayer.bind(l))})}catch{return[]}finally{l.transform=p}}_updateHover(r){var l;const{props:p}=this;if(p.interactiveLayerIds&&(p.onMouseMove||p.onMouseEnter||p.onMouseLeave)){const w=r.type,I=((l=this._hoveredFeatures)===null||l===void 0?void 0:l.length)>0,u=this._queryRenderedFeatures(r.point),N=u.length>0;!N&&I&&(r.type="mouseleave",this._onPointerEvent(r)),this._hoveredFeatures=u,N&&!I&&(r.type="mouseenter",this._onPointerEvent(r)),r.type=w}else this._hoveredFeatures=null}_fireEvent(r,l,p){const _=this._map,w=_.transform,I=typeof l=="string"?l:l.type;return I==="move"&&this._updateViewState(this.props,!1),I in Qf&&(typeof l=="object"&&(l.viewState=Ov(w)),this._map.isMoving())?(_.transform=this._renderTransform,r.call(_,l,p),_.transform=w,_):(r.call(_,l,p),_)}_onBeforeRepaint(){const r=this._map;this._internalUpdate=!0;for(const p in this._deferredEvents)this._deferredEvents[p]&&r.fire(p);this._internalUpdate=!1;const l=this._map.transform;r.transform=this._renderTransform,this._onAfterRepaint=()=>{Bv(this._renderTransform,l),r.transform=l}}}$l.savedMaps=[];function iT(){let i=null;if(typeof location<"u"){const r=/access_token=([^&\/]*)/.exec(location.search);i=r&&r[1]}try{i=i||Uv.MapboxAccessToken}catch{}try{i=i||Uv.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return i}const nT=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function rT(i){if(!i)return null;const r=i.map,l={getMap:()=>r,getCenter:()=>i.transform.center,getZoom:()=>i.transform.zoom,getBearing:()=>i.transform.bearing,getPitch:()=>i.transform.pitch,getPadding:()=>i.transform.padding,getBounds:()=>i.transform.getBounds(),project:p=>{const _=r.transform;r.transform=i.transform;const w=r.project(p);return r.transform=_,w},unproject:p=>{const _=r.transform;r.transform=i.transform;const w=r.unproject(p);return r.transform=_,w},queryTerrainElevation:(p,_)=>{const w=r.transform;r.transform=i.transform;const I=r.queryTerrainElevation(p,_);return r.transform=w,I},queryRenderedFeatures:(p,_)=>{const w=r.transform;r.transform=i.transform;const I=r.queryRenderedFeatures(p,_);return r.transform=w,I}};for(const p of sT(r))!(p in l)&&!nT.includes(p)&&(l[p]=r[p].bind(r));return l}function sT(i){const r=new Set;let l=i;for(;l;){for(const p of Object.getOwnPropertyNames(l))p[0]!=="_"&&typeof i[p]=="function"&&p!=="fire"&&p!=="setEventedParent"&&r.add(p);l=Object.getPrototypeOf(l)}return Array.from(r)}const oT=typeof document<"u"?at.useLayoutEffect:at.useEffect,aT=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function lT(i,r){for(const p of aT)p in r&&(i[p]=r[p]);const{RTLTextPlugin:l="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=r;l&&i.getRTLTextPluginStatus&&i.getRTLTextPluginStatus()==="unavailable"&&i.setRTLTextPlugin(l,p=>{p&&console.error(p)},!1)}const yp=at.createContext(null);function uT(i,r,l){const p=at.useContext(KS),[_,w]=at.useState(null),I=at.useRef(),{current:u}=at.useRef({mapLib:null,map:null});at.useEffect(()=>{const ne=i.mapLib;let le=!0,te;return Promise.resolve(ne||l).then(ke=>{if(!le)return;if(!ke)throw new Error("Invalid mapLib");const Ie="Map"in ke?ke:ke.default;if(!Ie.Map)throw new Error("Invalid mapLib");if(lT(Ie,i),!Ie.supported||Ie.supported(i))i.reuseMaps&&(te=$l.reuse(i,I.current)),te||(te=new $l(Ie.Map,i,I.current)),u.map=rT(te),u.mapLib=Ie,w(te),p==null||p.onMapMount(u.map,i.id);else throw new Error("Map is not supported by this browser")}).catch(ke=>{const{onError:Ie}=i;Ie?Ie({type:"error",target:null,originalEvent:null,error:ke}):console.error(ke)}),()=>{le=!1,te&&(p==null||p.onMapUnmount(i.id),i.reuseMaps?te.recycle():te.destroy())}},[]),oT(()=>{_&&_.setProps(i)}),at.useImperativeHandle(r,()=>u.map,[_]);const N=at.useMemo(()=>({position:"relative",width:"100%",height:"100%",...i.style}),[i.style]),L={height:"100%"};return at.createElement("div",{id:i.id,ref:I,style:N},_&&at.createElement(yp.Provider,{value:u},at.createElement("div",{"mapboxgl-children":"",style:L},i.children)))}const cT=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Ia(i,r){if(!i||!r)return;const l=i.style;for(const p in r){const _=r[p];Number.isFinite(_)&&!cT.test(p)?l[p]=`${_}px`:l[p]=_}}function hT(i,r){const{map:l,mapLib:p}=at.useContext(yp),_=at.useRef({props:i});_.current.props=i;const w=at.useMemo(()=>{let De=!1;at.Children.forEach(i.children,J=>{J&&(De=!0)});const ut={...i,element:De?document.createElement("div"):null},se=new p.Marker(ut);return se.setLngLat([i.longitude,i.latitude]),se.getElement().addEventListener("click",J=>{var de,Se;(Se=(de=_.current.props).onClick)===null||Se===void 0||Se.call(de,{type:"click",target:se,originalEvent:J})}),se.on("dragstart",J=>{var de,Se;const Oe=J;Oe.lngLat=w.getLngLat(),(Se=(de=_.current.props).onDragStart)===null||Se===void 0||Se.call(de,Oe)}),se.on("drag",J=>{var de,Se;const Oe=J;Oe.lngLat=w.getLngLat(),(Se=(de=_.current.props).onDrag)===null||Se===void 0||Se.call(de,Oe)}),se.on("dragend",J=>{var de,Se;const Oe=J;Oe.lngLat=w.getLngLat(),(Se=(de=_.current.props).onDragEnd)===null||Se===void 0||Se.call(de,Oe)}),se},[]);at.useEffect(()=>(w.addTo(l.getMap()),()=>{w.remove()}),[]);const{longitude:I,latitude:u,offset:N,style:L,draggable:ne=!1,popup:le=null,rotation:te=0,rotationAlignment:ke="auto",pitchAlignment:Ie="auto"}=i;return at.useEffect(()=>{Ia(w.getElement(),L)},[L]),at.useImperativeHandle(r,()=>w,[]),(w.getLngLat().lng!==I||w.getLngLat().lat!==u)&&w.setLngLat([I,u]),N&&!YS(w.getOffset(),N)&&w.setOffset(N),w.isDraggable()!==ne&&w.setDraggable(ne),w.getRotation()!==te&&w.setRotation(te),w.getRotationAlignment()!==ke&&w.setRotationAlignment(ke),w.getPitchAlignment()!==Ie&&w.setPitchAlignment(Ie),w.getPopup()!==le&&w.setPopup(le),qg.createPortal(i.children,w.getElement())}at.memo(at.forwardRef(hT));function qv(i){return new Set(i?i.trim().split(/\s+/):[])}function dT(i,r){const{map:l,mapLib:p}=at.useContext(yp),_=at.useMemo(()=>document.createElement("div"),[]),w=at.useRef({props:i});w.current.props=i;const I=at.useMemo(()=>{const u={...i},N=new p.Popup(u);return N.setLngLat([i.longitude,i.latitude]),N.once("open",L=>{var ne,le;(le=(ne=w.current.props).onOpen)===null||le===void 0||le.call(ne,L)}),N},[]);if(at.useEffect(()=>{const u=N=>{var L,ne;(ne=(L=w.current.props).onClose)===null||ne===void 0||ne.call(L,N)};return I.on("close",u),I.setDOMContent(_).addTo(l.getMap()),()=>{I.off("close",u),I.isOpen()&&I.remove()}},[]),at.useEffect(()=>{Ia(I.getElement(),i.style)},[i.style]),at.useImperativeHandle(r,()=>I,[]),I.isOpen()&&((I.getLngLat().lng!==i.longitude||I.getLngLat().lat!==i.latitude)&&I.setLngLat([i.longitude,i.latitude]),i.offset&&!Gs(I.options.offset,i.offset)&&I.setOffset(i.offset),(I.options.anchor!==i.anchor||I.options.maxWidth!==i.maxWidth)&&(I.options.anchor=i.anchor,I.setMaxWidth(i.maxWidth)),I.options.className!==i.className)){const u=qv(I.options.className),N=qv(i.className);for(const L of u)N.has(L)||I.removeClassName(L);for(const L of N)u.has(L)||I.addClassName(L);I.options.className=i.className}return qg.createPortal(i.children,_)}at.memo(at.forwardRef(dT));function qc(i,r,l,p){const _=at.useContext(yp),w=at.useMemo(()=>i(_),[]);return at.useEffect(()=>{const I=p||l||r,u=typeof r=="function"&&typeof l=="function"?r:null,N=typeof l=="function"?l:typeof r=="function"?r:null,{map:L}=_;return L.hasControl(w)||(L.addControl(w,I==null?void 0:I.position),u&&u(_)),()=>{N&&N(_),L.hasControl(w)&&L.removeControl(w)}},[]),w}function pT(i){const r=qc(({mapLib:l})=>new l.AttributionControl(i),{position:i.position});return at.useEffect(()=>{Ia(r._container,i.style)},[i.style]),null}at.memo(pT);function fT(i){const r=qc(({mapLib:l})=>new l.FullscreenControl({container:i.containerId&&document.getElementById(i.containerId)}),{position:i.position});return at.useEffect(()=>{Ia(r._controlContainer,i.style)},[i.style]),null}at.memo(fT);function mT(i,r){const l=at.useRef({props:i}),p=qc(({mapLib:_})=>{const w=new _.GeolocateControl(i),I=w._setupUI;return w._setupUI=u=>{w._container.hasChildNodes()||I(u)},w.on("geolocate",u=>{var N,L;(L=(N=l.current.props).onGeolocate)===null||L===void 0||L.call(N,u)}),w.on("error",u=>{var N,L;(L=(N=l.current.props).onError)===null||L===void 0||L.call(N,u)}),w.on("outofmaxbounds",u=>{var N,L;(L=(N=l.current.props).onOutOfMaxBounds)===null||L===void 0||L.call(N,u)}),w.on("trackuserlocationstart",u=>{var N,L;(L=(N=l.current.props).onTrackUserLocationStart)===null||L===void 0||L.call(N,u)}),w.on("trackuserlocationend",u=>{var N,L;(L=(N=l.current.props).onTrackUserLocationEnd)===null||L===void 0||L.call(N,u)}),w},{position:i.position});return l.current.props=i,at.useImperativeHandle(r,()=>p,[]),at.useEffect(()=>{Ia(p._container,i.style)},[i.style]),null}at.memo(at.forwardRef(mT));function gT(i){const r=qc(({mapLib:l})=>new l.NavigationControl(i),{position:i.position});return at.useEffect(()=>{Ia(r._container,i.style)},[i.style]),null}at.memo(gT);function yT(i){const r=qc(({mapLib:w})=>new w.ScaleControl(i),{position:i.position}),l=at.useRef(i),p=l.current;l.current=i;const{style:_}=i;return i.maxWidth!==void 0&&i.maxWidth!==p.maxWidth&&(r.options.maxWidth=i.maxWidth),i.unit!==void 0&&i.unit!==p.unit&&r.setUnit(i.unit),at.useEffect(()=>{Ia(r._container,_)},[_]),null}at.memo(yT);const _T=XS(()=>Promise.resolve().then(()=>GS),void 0),vT=at.forwardRef(function(r,l){return uT(r,l,_T)});var Un=(i,r,l)=>new Promise((p,_)=>{var w=N=>{try{u(l.next(N))}catch(L){_(L)}},I=N=>{try{u(l.throw(N))}catch(L){_(L)}},u=N=>N.done?p(N.value):Promise.resolve(N.value).then(w,I);u((l=l.apply(i,r)).next())}),pr=Uint8Array,Cl=Uint16Array,xT=Int32Array,d1=new pr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),p1=new pr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),wT=new pr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),f1=function(i,r){for(var l=new Cl(31),p=0;p<31;++p)l[p]=r+=1<>1|(Ut&21845)<<1,$s=($s&52428)>>2|($s&13107)<<2,$s=($s&61680)>>4|($s&3855)<<4,Xm[Ut]=(($s&65280)>>8|($s&255)<<8)>>1;var $s,Ut,bc=function(i,r,l){for(var p=i.length,_=0,w=new Cl(r);_>N]=L}else for(u=new Cl(p),_=0;_>15-i[_]);return u},Gc=new pr(288);for(Ut=0;Ut<144;++Ut)Gc[Ut]=8;var Ut;for(Ut=144;Ut<256;++Ut)Gc[Ut]=9;var Ut;for(Ut=256;Ut<280;++Ut)Gc[Ut]=7;var Ut;for(Ut=280;Ut<288;++Ut)Gc[Ut]=8;var Ut,y1=new pr(32);for(Ut=0;Ut<32;++Ut)y1[Ut]=5;var Ut,kT=bc(Gc,9,1),ET=bc(y1,5,1),Jf=function(i){for(var r=i[0],l=1;lr&&(r=i[l]);return r},Yr=function(i,r,l){var p=r/8|0;return(i[p]|i[p+1]<<8)>>(r&7)&l},em=function(i,r){var l=r/8|0;return(i[l]|i[l+1]<<8|i[l+2]<<16)>>(r&7)},IT=function(i){return(i+7)/8|0},CT=function(i,r,l){(r==null||r<0)&&(r=0),(l==null||l>i.length)&&(l=i.length);var p=new pr(l-r);return p.set(i.subarray(r,l)),p},PT=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],dr=function(i,r,l){var p=new Error(r||PT[i]);if(p.code=i,Error.captureStackTrace&&Error.captureStackTrace(p,dr),!l)throw p;return p},Gg=function(i,r,l,p){var _=i.length,w=p?p.length:0;if(!_||r.f&&!r.l)return l||new pr(0);var I=!l||r.i!=2,u=r.i;l||(l=new pr(_*3));var N=function(sn){var ss=l.length;if(sn>ss){var or=new pr(Math.max(ss*2,sn));or.set(l),l=or}},L=r.f||0,ne=r.p||0,le=r.b||0,te=r.l,ke=r.d,Ie=r.m,De=r.n,ut=_*8;do{if(!te){L=Yr(i,ne,1);var se=Yr(i,ne+1,3);if(ne+=3,se)if(se==1)te=kT,ke=ET,Ie=9,De=5;else if(se==2){var Oe=Yr(i,ne,31)+257,He=Yr(i,ne+10,15)+4,Je=Oe+Yr(i,ne+5,31)+1;ne+=14;for(var $e=new pr(Je),Ft=new pr(19),Ge=0;Ge>4;if(J<16)$e[Ge++]=J;else{var ui=0,Bi=0;for(J==16?(Bi=3+Yr(i,ne,3),ne+=2,ui=$e[Ge-1]):J==17?(Bi=3+Yr(i,ne,7),ne+=3):J==18&&(Bi=11+Yr(i,ne,127),ne+=7);Bi--;)$e[Ge++]=ui}}var Ii=$e.subarray(0,Oe),Ne=$e.subarray(Oe);Ie=Jf(Ii),De=Jf(Ne),te=bc(Ii,Ie,1),ke=bc(Ne,De,1)}else dr(1);else{var J=IT(ne)+4,de=i[J-4]|i[J-3]<<8,Se=J+de;if(Se>_){u&&dr(0);break}I&&N(le+de),l.set(i.subarray(J,Se),le),r.b=le+=de,r.p=ne=Se*8,r.f=L;continue}if(ne>ut){u&&dr(0);break}}I&&N(le+131072);for(var ct=(1<>4;if(ne+=ui&15,ne>ut){u&&dr(0);break}if(ui||dr(2),kt<256)l[le++]=kt;else if(kt==256){Lt=ne,te=null;break}else{var It=kt-254;if(kt>264){var Ge=kt-257,jt=d1[Ge];It=Yr(i,ne,(1<>4;nn||dr(3),ne+=nn&15;var Ne=TT[Oi];if(Oi>3){var jt=p1[Oi];Ne+=em(i,ne)&(1<ut){u&&dr(0);break}I&&N(le+131072);var rn=le+It;if(le>3&1)+(r>>4&1);p>0;p-=!i[l++]);return l+(r&2)},AT=function(i){var r=i.length;return(i[r-4]|i[r-3]<<8|i[r-2]<<16|i[r-1]<<24)>>>0},DT=function(i,r){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&dr(6,"invalid zlib data"),(i[1]>>5&1)==+!r&&dr(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function LT(i,r){return Gg(i,{i:2},r&&r.out,r&&r.dictionary)}function RT(i,r){var l=zT(i);return l+8>i.length&&dr(6,"invalid gzip data"),Gg(i.subarray(l,-8),{i:2},r&&r.out||new pr(AT(i)),r&&r.dictionary)}function FT(i,r){return Gg(i.subarray(DT(i,r&&r.dictionary),-4),{i:2},r&&r.out,r&&r.dictionary)}function Km(i,r){return i[0]==31&&i[1]==139&&i[2]==8?RT(i,r):(i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31?LT(i,r):FT(i,r)}var BT=typeof TextDecoder<"u"&&new TextDecoder,OT=0;try{BT.decode(MT,{stream:!0}),OT=1}catch{}var _1=(i,r)=>i*Math.pow(2,r),ac=(i,r)=>Math.floor(i/Math.pow(2,r)),ep=(i,r)=>_1(i.getUint16(r+1,!0),8)+i.getUint8(r),v1=(i,r)=>_1(i.getUint32(r+2,!0),16)+i.getUint16(r,!0),NT=(i,r,l,p,_)=>{if(i!=p.getUint8(_))return i-p.getUint8(_);const w=ep(p,_+1);if(r!=w)return r-w;const I=ep(p,_+4);return l!=I?l-I:0},VT=(i,r,l,p)=>{const _=x1(i,r|128,l,p);return _?{z:r,x:l,y:p,offset:_[0],length:_[1],is_dir:!0}:null},Gv=(i,r,l,p)=>{const _=x1(i,r,l,p);return _?{z:r,x:l,y:p,offset:_[0],length:_[1],is_dir:!1}:null},x1=(i,r,l,p)=>{let _=0,w=i.byteLength/17-1;for(;_<=w;){const I=w+_>>1,u=NT(r,l,p,i,I*17);if(u>0)_=I+1;else if(u<0)w=I-1;else return[v1(i,I*17+7),i.getUint32(I*17+13,!0)]}return null},UT=(i,r)=>i.is_dir&&!r.is_dir?1:!i.is_dir&&r.is_dir?-1:i.z!==r.z?i.z-r.z:i.x!==r.x?i.x-r.x:i.y-r.y,w1=(i,r)=>{const l=i.getUint8(r*17);return{z:l&127,x:ep(i,r*17+1),y:ep(i,r*17+4),offset:v1(i,r*17+7),length:i.getUint32(r*17+13,!0),is_dir:l>>7===1}},Hv=i=>{const r=[],l=new DataView(i);for(let p=0;p{i.sort(UT);const r=new ArrayBuffer(17*i.length),l=new Uint8Array(r);for(let p=0;p>8&255,l[p*17+3]=_.x>>16&255,l[p*17+4]=_.y&255,l[p*17+5]=_.y>>8&255,l[p*17+6]=_.y>>16&255,l[p*17+7]=_.offset&255,l[p*17+8]=ac(_.offset,8)&255,l[p*17+9]=ac(_.offset,16)&255,l[p*17+10]=ac(_.offset,24)&255,l[p*17+11]=ac(_.offset,32)&255,l[p*17+12]=ac(_.offset,48)&255,l[p*17+13]=_.length&255,l[p*17+14]=_.length>>8&255,l[p*17+15]=_.length>>16&255,l[p*17+16]=_.length>>24&255}return r},$T=(i,r)=>{if(i.byteLength<17)return null;const l=i.byteLength/17,p=w1(i,l-1);if(p.is_dir){const _=p.z,w=r.z-_,I=Math.trunc(r.x/(1<{if(i.type=="json"){const l=i.url.substr(10);let p=this.tiles.get(l);return p||(p=new Wv(l),this.tiles.set(l,p)),p.getHeader().then(_=>{const w={tiles:[i.url+"/{z}/{x}/{y}"],minzoom:_.minZoom,maxzoom:_.maxZoom,bounds:[_.minLon,_.minLat,_.maxLon,_.maxLat]};r(null,w,null,null)}).catch(_=>{r(_,null,null,null)}),{cancel:()=>{}}}else{const l=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),p=i.url.match(l);if(!p)throw new Error("Invalid PMTiles protocol URL");const _=p[1];let w=this.tiles.get(_);w||(w=new Wv(_),this.tiles.set(_,w));const I=p[2],u=p[3],N=p[4],L=new AbortController,ne=L.signal;let le=()=>{L.abort()};return w.getHeader().then(te=>{w.getZxy(+I,+u,+N,ne).then(ke=>{ke?r(null,new Uint8Array(ke.data),ke.cacheControl,ke.expires):te.tileType==1?r(null,new Uint8Array,null,null):r(null,null,null,null)}).catch(ke=>{ke.name!=="AbortError"&&r(ke,null,null,null)})}),{cancel:le}}},this.tiles=new Map}add(i){this.tiles.set(i.source.getKey(),i)}get(i){return this.tiles.get(i)}};function ml(i,r){return(r>>>0)*4294967296+(i>>>0)}function HT(i,r){const l=r.buf;let p,_;if(_=l[r.pos++],p=(_&112)>>4,_<128||(_=l[r.pos++],p|=(_&127)<<3,_<128)||(_=l[r.pos++],p|=(_&127)<<10,_<128)||(_=l[r.pos++],p|=(_&127)<<17,_<128)||(_=l[r.pos++],p|=(_&127)<<24,_<128)||(_=l[r.pos++],p|=(_&1)<<31,_<128))return ml(i,p);throw new Error("Expected varint not more than 10 bytes")}function lc(i){const r=i.buf;let l,p;return p=r[i.pos++],l=p&127,p<128||(p=r[i.pos++],l|=(p&127)<<7,p<128)||(p=r[i.pos++],l|=(p&127)<<14,p<128)||(p=r[i.pos++],l|=(p&127)<<21,p<128)?l:(p=r[i.pos],l|=(p&15)<<28,HT(l,i))}function WT(i,r,l,p){if(p==0){l==1&&(r[0]=i-1-r[0],r[1]=i-1-r[1]);const _=r[0];r[0]=r[1],r[1]=_}}var XT=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function KT(i,r,l){if(i>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(r>Math.pow(2,i)-1||l>Math.pow(2,i)-1)throw Error("tile x/y outside zoom level bounds");const p=XT[i],_=Math.pow(2,i);let w=0,I=0,u=0;const N=[r,l];let L=_/2;for(;L>0;)w=(N[0]&L)>0?1:0,I=(N[1]&L)>0?1:0,u+=L*L*(3*w^I),WT(L,N,w,I),L=L/2;return p+u}function S1(i,r){return Un(this,null,function*(){if(r===1||r===0)return i;if(r===2){if(typeof globalThis.DecompressionStream>"u")return Km(new Uint8Array(i));{let p=new Response(i).body.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(p).arrayBuffer()}}else throw Error("Compression method not supported")})}var YT=127;function QT(i,r){let l=0,p=i.length-1;for(;l<=p;){const _=p+l>>1,w=r-i[_].tileId;if(w>0)l=_+1;else if(w<0)p=_-1;else return i[_]}return p>=0&&(i[p].runLength===0||r-i[p].tileId=300)throw Error("Bad response code: "+w.status);const I=w.headers.get("Content-Length");if(w.status===200&&(!I||+I>r))throw p&&p.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield w.arrayBuffer(),etag:w.headers.get("ETag")||void 0,cacheControl:w.headers.get("Cache-Control")||void 0,expires:w.headers.get("Expires")||void 0}})}};function Qr(i,r){const l=i.getUint32(r+4,!0),p=i.getUint32(r+0,!0);return l*Math.pow(2,32)+p}function ek(i,r){const l=new DataView(i),p=l.getUint8(7);if(p>3)throw Error(`Archive is spec version ${p} but this library supports up to spec version 3`);return{specVersion:p,rootDirectoryOffset:Qr(l,8),rootDirectoryLength:Qr(l,16),jsonMetadataOffset:Qr(l,24),jsonMetadataLength:Qr(l,32),leafDirectoryOffset:Qr(l,40),leafDirectoryLength:Qr(l,48),tileDataOffset:Qr(l,56),tileDataLength:Qr(l,64),numAddressedTiles:Qr(l,72),numTileEntries:Qr(l,80),numTileContents:Qr(l,88),clustered:l.getUint8(96)===1,internalCompression:l.getUint8(97),tileCompression:l.getUint8(98),tileType:l.getUint8(99),minZoom:l.getUint8(100),maxZoom:l.getUint8(101),minLon:l.getInt32(102,!0)/1e7,minLat:l.getInt32(106,!0)/1e7,maxLon:l.getInt32(110,!0)/1e7,maxLat:l.getInt32(114,!0)/1e7,centerZoom:l.getUint8(118),centerLon:l.getInt32(119,!0)/1e7,centerLat:l.getInt32(123,!0)/1e7,etag:r}}function T1(i){const r={buf:new Uint8Array(i),pos:0},l=lc(r),p=[];let _=0;for(let w=0;w0?p[w].offset=p[w-1].offset+p[w-1].length:p[w].offset=I-1}return p}function tk(i){const r=new DataView(i);return r.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):r.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var Pl=class extends Error{};function ik(i,r,l,p){return Un(this,null,function*(){const _=yield i.getBytes(0,16384);if(new DataView(_.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(tk(_.data)<3)return[yield b1.getHeader(i)];const I=_.data.slice(0,YT);let u=_.etag;p&&_.etag!=p&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+i.getKey()),u=void 0);const N=ek(I,u);if(l){const L=_.data.slice(N.rootDirectoryOffset,N.rootDirectoryOffset+N.rootDirectoryLength),ne=i.getKey()+"|"+(N.etag||"")+"|"+N.rootDirectoryOffset+"|"+N.rootDirectoryLength,le=T1(yield r(L,N.internalCompression));return[N,[ne,le.length,le]]}return[N,void 0]})}function nk(i,r,l,p,_){return Un(this,null,function*(){const w=yield i.getBytes(l,p);if(_.etag&&_.etag!==w.etag)throw new Pl(w.etag);const I=yield r(w.data,_.internalCompression),u=T1(I);if(u.length===0)throw new Error("Empty directory is invalid");return u})}var rk=class{constructor(i=100,r=!0,l=S1){this.cache=new Map,this.maxCacheEntries=i,this.counter=1,this.prefetch=r,this.decompress=l}getHeader(i,r){return Un(this,null,function*(){const l=i.getKey();if(this.cache.has(l))return this.cache.get(l).lastUsed=this.counter++,yield this.cache.get(l).data;const p=new Promise((_,w)=>{ik(i,this.decompress,this.prefetch,r).then(I=>{I[1]&&this.cache.set(I[1][0],{lastUsed:this.counter++,data:Promise.resolve(I[1][2])}),_(I[0]),this.prune()}).catch(I=>{w(I)})});return this.cache.set(l,{lastUsed:this.counter++,data:p}),p})}getDirectory(i,r,l,p){return Un(this,null,function*(){const _=i.getKey()+"|"+(p.etag||"")+"|"+r+"|"+l;if(this.cache.has(_))return this.cache.get(_).lastUsed=this.counter++,yield this.cache.get(_).data;const w=new Promise((I,u)=>{nk(i,this.decompress,r,l,p).then(N=>{I(N),this.prune()}).catch(N=>{u(N)})});return this.cache.set(_,{lastUsed:this.counter++,data:w}),w})}getArrayBuffer(i,r,l,p){return Un(this,null,function*(){const _=i.getKey()+"|"+(p.etag||"")+"|"+r+"|"+l;if(this.cache.has(_))return this.cache.get(_).lastUsed=this.counter++,yield this.cache.get(_).data;const w=new Promise((I,u)=>{i.getBytes(r,l).then(N=>{if(p.etag&&p.etag!==N.etag)throw new Pl(N.etag);I(N.data),this.cache.has(_),this.prune()}).catch(N=>{u(N)})});return this.cache.set(_,{lastUsed:this.counter++,data:w}),w})}prune(){if(this.cache.size>=this.maxCacheEntries){let i=1/0,r;this.cache.forEach((l,p)=>{l.lastUsedw.maxZoom)return;let I=w.rootDirectoryOffset,u=w.rootDirectoryLength;for(let N=0;N<=3;N++){const L=yield this.cache.getDirectory(this.source,I,u,w),ne=QT(L,_);if(ne)if(ne.runLength>0){const le=yield this.source.getBytes(w.tileDataOffset+ne.offset,ne.length,p);if(w.etag&&w.etag!==le.etag)throw new Pl(le.etag);return{data:yield this.decompress(le.data,w.tileCompression),cacheControl:le.cacheControl,expires:le.expires}}else I=w.leafDirectoryOffset+ne.offset,u=ne.length;else return}throw Error("Maximum directory depth exceeded")})}getZxy(i,r,l,p){return Un(this,null,function*(){try{return yield this.getZxyAttempt(i,r,l,p)}catch(_){if(_ instanceof Pl)return this.cache.invalidate(this.source,_.message),yield this.getZxyAttempt(i,r,l,p);throw _}})}getMetadataAttempt(){return Un(this,null,function*(){const i=yield this.cache.getHeader(this.source),r=yield this.source.getBytes(i.jsonMetadataOffset,i.jsonMetadataLength);if(i.etag&&i.etag!==r.etag)throw new Pl(r.etag);const l=yield this.decompress(r.data,i.internalCompression),p=new TextDecoder("utf-8");return JSON.parse(p.decode(l))})}getMetadata(){return Un(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(i){if(i instanceof Pl)return this.cache.invalidate(this.source,i.message),yield this.getMetadataAttempt();throw i}})}};function sk(){const[i,r]=at.useState();return at.useEffect(()=>{const l=setInterval(()=>{fetch("./style.json").then(p=>p.json()).then(p=>{JSON.stringify(i)!==JSON.stringify(p)&&r(p)})},1e3);return()=>clearInterval(l)},[i]),at.useEffect(()=>{const l=new GT;return Wm.addProtocol("pmtiles",l.tile),()=>{Wm.removeProtocol("pmtiles")}},[]),Pd.jsx("div",{style:{width:"100vw",height:"100vh"},children:Pd.jsx(vT,{initialViewState:{longitude:139.7673068,latitude:35.6809591,zoom:6},style:{position:"absolute",width:"100%",height:"100%"},hash:!0,mapStyle:i})})}tm.createRoot(document.getElementById("root")).render(Pd.jsx(Fb.StrictMode,{children:Pd.jsx(sk,{})})); + `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){L.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(f,t,o){this._canvas.width=Math.floor(o*f),this._canvas.height=Math.floor(o*t),this._canvas.style.width=`${f}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const f={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",c=>{t={requestedAttributes:f},c&&(t.statusMessage=c.statusMessage,t.type=c.type)},{once:!0});const o=this._canvas.getContext("webgl2",f)||this._canvas.getContext("webgl",f);if(!o){const c="Failed to initialize WebGL";throw t?(t.message=c,new Error(JSON.stringify(t))):new Error(c)}this.painter=new zs(o,this.transform),ne.testSupport(o)}_onCooperativeGesture(f,t,o){return!t&&o<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(f){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||f,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(f){return this._update(),this._renderTaskQueue.add(f)}_cancelRenderFrame(f){this._renderTaskQueue.remove(f)}_render(f){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(f),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const d=this.transform.zoom,g=u.h.now();this.style.zoomHistory.update(d,g);const x=new u.a8(d,{now:g,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),b=x.crossFadingFactor();b===1&&b===this._crossFadingFactor||(o=!0,this._crossFadingFactor=b),this.style.update(x)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.bg.mark(u.bh.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const c=this._sourcesDirty||this._styleDirty||this._placementDirty;return c||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.k("idle")),!this._loaded||this._fullyLoaded||c||(this._fullyLoaded=!0,u.bg.mark(u.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var f;this._hash&&this._hash.remove();for(const o of this._controls)o.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("online",this._onWindowOnline,!1),ut.removeThrottleControl(this._imageQueueHandle),(f=this._resizeObserver)===null||f===void 0||f.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),L.remove(this._canvasContainer),L.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),u.bg.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=u.h.frame(f=>{u.bg.frame(f),this._frame=null,this._render(f)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(f){this._showTileBoundaries!==f&&(this._showTileBoundaries=f,this._update())}get showPadding(){return!!this._showPadding}set showPadding(f){this._showPadding!==f&&(this._showPadding=f,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(f){this._showCollisionBoxes!==f&&(this._showCollisionBoxes=f,f?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(f){this._showOverdrawInspector!==f&&(this._showOverdrawInspector=f,this._update())}get repaint(){return!!this._repaint}set repaint(f){this._repaint!==f&&(this._repaint=f,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(f){this._vertices=f,this._update()}get version(){return et}getCameraTargetElevation(){return this.transform.elevation}},At.NavigationControl=class{constructor(f){this._updateZoomButtons=()=>{const t=this._map.getZoom(),o=t===this._map.getMaxZoom(),c=t===this._map.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())},this._rotateCompassArrow=()=>{const t=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=t},this._setButtonTitle=(t,o)=>{const c=this._map._getUIString(`NavigationControl.${o}`);t.title=c,t.setAttribute("aria-label",c)},this.options=u.e({},Iu,f),this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),L.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),L.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=L.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(f){return this._map=f,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 Cu(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){L.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(f,t){const o=L.create("button",f,this._container);return o.type="button",o.addEventListener("click",t),o}},At.GeolocateControl=class extends u.E{constructor(f){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new u.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new u.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const o=new u.L(t.coords.longitude,t.coords.latitude),c=t.coords.accuracy,d=this._map.getBearing(),g=u.e({bearing:d},this.options.fitBoundsOptions),x=It.fromLngLat(o,c);this._map.fitBounds(x,g,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const o=new u.L(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(o).addTo(this._map),this._userLocationDotMarker.setLngLat(o).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&go)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",o=>o.preventDefault()),this._geolocateButton=L.create("button","maplibregl-ctrl-geolocate",this._container),L.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=L.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ds({element:this._dotElement}),this._circleElement=L.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ds({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",o=>{o.geolocateSource||this._watchState!=="ACTIVE_LOCK"||o.originalEvent&&o.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new u.k("trackuserlocationend")))})}},this.options=u.e({},oi,f)}onAdd(f){return this._map=f,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,o=!1){gi===void 0||o?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(c=>{gi=c.state!=="denied",t(gi)}).catch(()=>{gi=!!window.navigator.geolocation,t(gi)}):(gi=!!window.navigator.geolocation,t(gi)):t(gi)}(this._setupUI),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(),L.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ti=0,go=!1}_isOutOfMapMaxBounds(f){const t=this._map.getMaxBounds(),o=f.coords;return t&&(o.longitudet.getEast()||o.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const f=this._map.getBounds(),t=f.getSouthEast(),o=f.getNorthEast(),c=t.distanceTo(o),d=Math.ceil(this._accuracy/(c/this._map._container.clientHeight)*2);this._circleElement.style.width=`${d}px`,this._circleElement.style.height=`${d}px`}trigger(){if(!this._setup)return u.w("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 u.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ti--,go=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new u.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new u.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-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 f;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ti++,ti>1?(f={maximumAge:6e5,timeout:0},go=!0):(f=this.options.positionOptions,go=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,f)}}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"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},At.AttributionControl=Ln,At.LogoControl=Ht,At.ScaleControl=class{constructor(f){this._onMove=()=>{aa(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,aa(this._map,this._container,this.options)},this.options=u.e({},oa,f)}getDefaultPosition(){return"bottom-left"}onAdd(f){return this._map=f,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-scale",f.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){L.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},At.FullscreenControl=class extends u.E{constructor(f={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,f&&f.container&&(f.container instanceof HTMLElement?this._container=f.container:u.w("Full screen control 'container' must be a DOM element.")),"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(f){return this._map=f,this._container||(this._container=this._map.getContainer()),this._controlContainer=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){L.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const f=this._fullscreenButton=L.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);L.create("span","maplibregl-ctrl-icon",f).setAttribute("aria-hidden","true"),f.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const f=this._getTitle();this._fullscreenButton.setAttribute("aria-label",f),this._fullscreenButton.title=f}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new u.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new u.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){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._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},At.TerrainControl=class{constructor(f){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=f}onAdd(f){return this._map=f,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=L.create("button","maplibregl-ctrl-terrain",this._container),L.create("span","maplibregl-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(){L.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},At.Popup=class extends u.E{constructor(f){super(),this.remove=()=>(this._content&&L.remove(this._content),this._container&&(L.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 u.k("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=L.create("div","maplibregl-popup",this._map.getContainer()),this._tip=L.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const x of this.options.className.split(" "))this._container.classList.add(x);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(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=Pu(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const o=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let c=this.options.anchor;const d=yo(this.options.offset);if(!c){const x=this._container.offsetWidth,b=this._container.offsetHeight;let T;T=o.y+d.bottom.ythis._map.transform.height-b?["bottom"]:[],o.xthis._map.transform.width-x/2&&T.push("right"),c=T.length===0?"bottom":T.join("-")}const g=o.add(d[c]).round();L.setTransform(this._container,`${Yn[c]} translate(${g.x}px,${g.y}px)`),Mh(this._container,c,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(Mu),f)}addTo(f){return this._map&&this.remove(),this._map=f,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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new u.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(f){return this._lngLat=u.L.convert(f),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"),this._map._canvasContainer.classList.remove("maplibregl-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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(f){return this.setDOMContent(document.createTextNode(f))}setHTML(f){const t=document.createDocumentFragment(),o=document.createElement("body");let c;for(o.innerHTML=f;c=o.firstChild,c;)t.appendChild(c);return this.setDOMContent(t)}getMaxWidth(){var f;return(f=this._container)===null||f===void 0?void 0:f.style.maxWidth}setMaxWidth(f){return this.options.maxWidth=f,this._update(),this}setDOMContent(f){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=L.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(f),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(f){this._container&&this._container.classList.add(f)}removeClassName(f){this._container&&this._container.classList.remove(f)}setOffset(f){return this.options.offset=f,this._update(),this}toggleClassName(f){if(this._container)return this._container.classList.toggle(f)}_createCloseButton(){this.options.closeButton&&(this._closeButton=L.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const f=this._container.querySelector(zu);f&&f.focus()}},At.Marker=Ds,At.Style=Ui,At.LngLat=u.L,At.LngLatBounds=It,At.Point=u.P,At.MercatorCoordinate=u.U,At.Evented=u.E,At.AJAXError=u.bi,At.config=u.c,At.CanvasSource=or,At.GeoJSONSource=sr,At.ImageSource=sn,At.RasterDEMTileSource=rn,At.RasterTileSource=Oi,At.VectorTileSource=nn,At.VideoSource=ss,At.setRTLTextPlugin=u.bj,At.getRTLTextPluginStatus=u.bk,At.prewarm=function(){Ca().acquire(Ct)},At.clearPrewarmedResources=function(){const f=Br;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(Ct),Br=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()"))},Au.extend(At,{isSafari:u.ac,getPerformanceMetrics:u.bg.getPerformanceMetrics}),At});var I=_;return I})})(u1);var h1=u1.exports;const Wm=Xv(h1),GS=vb({__proto__:null,default:Wm},[h1]),HS="modulepreload",WS=function(i){return"/"+i},Fv={},XS=function(r,l,p){let _=Promise.resolve();if(l&&l.length>0){const w=document.getElementsByTagName("link");_=Promise.all(l.map(I=>{if(I=WS(I),I in Fv)return;Fv[I]=!0;const u=I.endsWith(".css"),N=u?'[rel="stylesheet"]':"";if(!!p)for(let le=w.length-1;le>=0;le--){const te=w[le];if(te.href===I&&(!u||te.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${I}"]${N}`))return;const ne=document.createElement("link");if(ne.rel=u?"stylesheet":HS,u||(ne.as="script",ne.crossOrigin=""),ne.href=I,document.head.appendChild(ne),u)return new Promise((le,te)=>{ne.addEventListener("load",le),ne.addEventListener("error",()=>te(new Error(`Unable to preload CSS for ${I}`)))})}))}return _.then(()=>r()).catch(w=>{const I=new Event("vite:preloadError",{cancelable:!0});if(I.payload=w,window.dispatchEvent(I),!I.defaultPrevented)throw w})},KS=at.createContext(null);function YS(i,r){const l=Array.isArray(i)?i[0]:i?i.x:0,p=Array.isArray(i)?i[1]:i?i.y:0,_=Array.isArray(r)?r[0]:r?r.x:0,w=Array.isArray(r)?r[1]:r?r.y:0;return l===_&&p===w}function Gs(i,r){if(i===r)return!0;if(!i||!r)return!1;if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let l=0;l{let _=null;"interactive"in p&&(_=Object.assign({},p),delete _.interactive);const w=r[p.ref];if(w){_=_||Object.assign({},p),delete _.ref;for(const I of JS)I in w&&(_[I]=w[I])}return _||p});return{...i,layers:l}}var Uv={};const jv={version:8,sources:{},layers:[]},$v={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Qf={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},Zv={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},eT=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],tT=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class $l{constructor(r,l,p){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=_=>{const w=this.props[Zv[_.type]];w?w(_):_.type==="error"&&console.error(_.error)},this._onPointerEvent=_=>{(_.type==="mousemove"||_.type==="mouseout")&&this._updateHover(_);const w=this.props[$v[_.type]];w&&(this.props.interactiveLayerIds&&_.type!=="mouseover"&&_.type!=="mouseout"&&(_.features=this._hoveredFeatures||this._queryRenderedFeatures(_.point)),w(_),delete _.features)},this._onCameraEvent=_=>{if(!this._internalUpdate){const w=this.props[Qf[_.type]];w&&w(_)}_.type in this._deferredEvents&&(this._deferredEvents[_.type]=!1)},this._MapClass=r,this.props=l,this._initialize(p)}get map(){return this._map}get transform(){return this._renderTransform}setProps(r){const l=this.props;this.props=r;const p=this._updateSettings(r,l);p&&this._createShadowTransform(this._map);const _=this._updateSize(r),w=this._updateViewState(r,!0);this._updateStyle(r,l),this._updateStyleComponents(r,l),this._updateHandlers(r,l),(p||_||w&&!this._map.isMoving())&&this.redraw()}static reuse(r,l){const p=$l.savedMaps.pop();if(!p)return null;const _=p.map,w=_.getContainer();for(l.className=w.className;w.childNodes.length>0;)l.appendChild(w.childNodes[0]);_._container=l;const I=_._resizeObserver;I&&(I.disconnect(),I.observe(l)),p.setProps({...r,styleDiffing:!1}),_.resize();const{initialViewState:u}=r;return u&&(u.bounds?_.fitBounds(u.bounds,{...u.fitBoundsOptions,duration:0}):p._updateViewState(u,!1)),_.isStyleLoaded()?_.fire("load"):_.once("styledata",()=>_.fire("load")),_._update(),p}_initialize(r){const{props:l}=this,{mapStyle:p=jv}=l,_={...l,...l.initialViewState,accessToken:l.mapboxAccessToken||iT()||null,container:r,style:Vv(p)},w=_.initialViewState||_.viewState||_;if(Object.assign(_,{center:[w.longitude||0,w.latitude||0],zoom:w.zoom||0,pitch:w.pitch||0,bearing:w.bearing||0}),l.gl){const ne=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=ne,l.gl)}const I=new this._MapClass(_);w.padding&&I.setPadding(w.padding),l.cursor&&(I.getCanvas().style.cursor=l.cursor),this._createShadowTransform(I);const u=I._render;I._render=ne=>{this._inRender=!0,u.call(I,ne),this._inRender=!1};const N=I._renderTaskQueue.run;I._renderTaskQueue.run=ne=>{N.call(I._renderTaskQueue,ne),this._onBeforeRepaint()},I.on("render",()=>this._onAfterRepaint());const L=I.fire;I.fire=this._fireEvent.bind(this,L),I.on("resize",()=>{this._renderTransform.resize(I.transform.width,I.transform.height)}),I.on("styledata",()=>{this._updateStyleComponents(this.props,{}),Bv(I.transform,this._renderTransform)}),I.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const ne in $v)I.on(ne,this._onPointerEvent);for(const ne in Qf)I.on(ne,this._onCameraEvent);for(const ne in Zv)I.on(ne,this._onEvent);this._map=I}recycle(){const l=this.map.getContainer().querySelector("[mapboxgl-children]");l==null||l.remove(),$l.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const r=this._map;!this._inRender&&r.style&&(r._frame&&(r._frame.cancel(),r._frame=null),r._render())}_createShadowTransform(r){const l=QS(r.transform);r.painter.transform=l,this._renderTransform=l}_updateSize(r){const{viewState:l}=r;if(l){const p=this._map;if(l.width!==p.transform.width||l.height!==p.transform.height)return p.resize(),!0}return!1}_updateViewState(r,l){if(this._internalUpdate)return!1;const p=this._map,_=this._renderTransform,{zoom:w,pitch:I,bearing:u}=_,N=p.isMoving();N&&(_.cameraElevationReference="sea");const L=Nv(_,{...Ov(p.transform),...r});if(N&&(_.cameraElevationReference="ground"),L&&l){const ne=this._deferredEvents;ne.move=!0,ne.zoom||(ne.zoom=w!==_.zoom),ne.rotate||(ne.rotate=u!==_.bearing),ne.pitch||(ne.pitch=I!==_.pitch)}return N||Nv(p.transform,r),L}_updateSettings(r,l){const p=this._map;let _=!1;for(const w of eT)if(w in r&&!Gs(r[w],l[w])){_=!0;const I=p[`set${w[0].toUpperCase()}${w.slice(1)}`];I==null||I.call(p,r[w])}return _}_updateStyle(r,l){if(r.cursor!==l.cursor&&(this._map.getCanvas().style.cursor=r.cursor||""),r.mapStyle!==l.mapStyle){const{mapStyle:p=jv,styleDiffing:_=!0}=r,w={diff:_};return"localIdeographFontFamily"in r&&(w.localIdeographFontFamily=r.localIdeographFontFamily),this._map.setStyle(Vv(p),w),!0}return!1}_updateStyleComponents(r,l){const p=this._map;let _=!1;return p.isStyleLoaded()&&("light"in r&&p.setLight&&!Gs(r.light,l.light)&&(_=!0,p.setLight(r.light)),"fog"in r&&p.setFog&&!Gs(r.fog,l.fog)&&(_=!0,p.setFog(r.fog)),"terrain"in r&&p.setTerrain&&!Gs(r.terrain,l.terrain)&&(!r.terrain||p.getSource(r.terrain.source))&&(_=!0,p.setTerrain(r.terrain))),_}_updateHandlers(r,l){var p,_;const w=this._map;let I=!1;for(const u of tT){const N=(p=r[u])!==null&&p!==void 0?p:!0,L=(_=l[u])!==null&&_!==void 0?_:!0;Gs(N,L)||(I=!0,N?w[u].enable(N):w[u].disable())}return I}_queryRenderedFeatures(r){const l=this._map,p=l.transform,{interactiveLayerIds:_=[]}=this.props;try{return l.transform=this._renderTransform,l.queryRenderedFeatures(r,{layers:_.filter(l.getLayer.bind(l))})}catch{return[]}finally{l.transform=p}}_updateHover(r){var l;const{props:p}=this;if(p.interactiveLayerIds&&(p.onMouseMove||p.onMouseEnter||p.onMouseLeave)){const w=r.type,I=((l=this._hoveredFeatures)===null||l===void 0?void 0:l.length)>0,u=this._queryRenderedFeatures(r.point),N=u.length>0;!N&&I&&(r.type="mouseleave",this._onPointerEvent(r)),this._hoveredFeatures=u,N&&!I&&(r.type="mouseenter",this._onPointerEvent(r)),r.type=w}else this._hoveredFeatures=null}_fireEvent(r,l,p){const _=this._map,w=_.transform,I=typeof l=="string"?l:l.type;return I==="move"&&this._updateViewState(this.props,!1),I in Qf&&(typeof l=="object"&&(l.viewState=Ov(w)),this._map.isMoving())?(_.transform=this._renderTransform,r.call(_,l,p),_.transform=w,_):(r.call(_,l,p),_)}_onBeforeRepaint(){const r=this._map;this._internalUpdate=!0;for(const p in this._deferredEvents)this._deferredEvents[p]&&r.fire(p);this._internalUpdate=!1;const l=this._map.transform;r.transform=this._renderTransform,this._onAfterRepaint=()=>{Bv(this._renderTransform,l),r.transform=l}}}$l.savedMaps=[];function iT(){let i=null;if(typeof location<"u"){const r=/access_token=([^&\/]*)/.exec(location.search);i=r&&r[1]}try{i=i||Uv.MapboxAccessToken}catch{}try{i=i||Uv.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return i}const nT=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function rT(i){if(!i)return null;const r=i.map,l={getMap:()=>r,getCenter:()=>i.transform.center,getZoom:()=>i.transform.zoom,getBearing:()=>i.transform.bearing,getPitch:()=>i.transform.pitch,getPadding:()=>i.transform.padding,getBounds:()=>i.transform.getBounds(),project:p=>{const _=r.transform;r.transform=i.transform;const w=r.project(p);return r.transform=_,w},unproject:p=>{const _=r.transform;r.transform=i.transform;const w=r.unproject(p);return r.transform=_,w},queryTerrainElevation:(p,_)=>{const w=r.transform;r.transform=i.transform;const I=r.queryTerrainElevation(p,_);return r.transform=w,I},queryRenderedFeatures:(p,_)=>{const w=r.transform;r.transform=i.transform;const I=r.queryRenderedFeatures(p,_);return r.transform=w,I}};for(const p of sT(r))!(p in l)&&!nT.includes(p)&&(l[p]=r[p].bind(r));return l}function sT(i){const r=new Set;let l=i;for(;l;){for(const p of Object.getOwnPropertyNames(l))p[0]!=="_"&&typeof i[p]=="function"&&p!=="fire"&&p!=="setEventedParent"&&r.add(p);l=Object.getPrototypeOf(l)}return Array.from(r)}const oT=typeof document<"u"?at.useLayoutEffect:at.useEffect,aT=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function lT(i,r){for(const p of aT)p in r&&(i[p]=r[p]);const{RTLTextPlugin:l="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=r;l&&i.getRTLTextPluginStatus&&i.getRTLTextPluginStatus()==="unavailable"&&i.setRTLTextPlugin(l,p=>{p&&console.error(p)},!1)}const yp=at.createContext(null);function uT(i,r,l){const p=at.useContext(KS),[_,w]=at.useState(null),I=at.useRef(),{current:u}=at.useRef({mapLib:null,map:null});at.useEffect(()=>{const ne=i.mapLib;let le=!0,te;return Promise.resolve(ne||l).then(ke=>{if(!le)return;if(!ke)throw new Error("Invalid mapLib");const Ie="Map"in ke?ke:ke.default;if(!Ie.Map)throw new Error("Invalid mapLib");if(lT(Ie,i),!Ie.supported||Ie.supported(i))i.reuseMaps&&(te=$l.reuse(i,I.current)),te||(te=new $l(Ie.Map,i,I.current)),u.map=rT(te),u.mapLib=Ie,w(te),p==null||p.onMapMount(u.map,i.id);else throw new Error("Map is not supported by this browser")}).catch(ke=>{const{onError:Ie}=i;Ie?Ie({type:"error",target:null,originalEvent:null,error:ke}):console.error(ke)}),()=>{le=!1,te&&(p==null||p.onMapUnmount(i.id),i.reuseMaps?te.recycle():te.destroy())}},[]),oT(()=>{_&&_.setProps(i)}),at.useImperativeHandle(r,()=>u.map,[_]);const N=at.useMemo(()=>({position:"relative",width:"100%",height:"100%",...i.style}),[i.style]),L={height:"100%"};return at.createElement("div",{id:i.id,ref:I,style:N},_&&at.createElement(yp.Provider,{value:u},at.createElement("div",{"mapboxgl-children":"",style:L},i.children)))}const cT=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Ia(i,r){if(!i||!r)return;const l=i.style;for(const p in r){const _=r[p];Number.isFinite(_)&&!cT.test(p)?l[p]=`${_}px`:l[p]=_}}function hT(i,r){const{map:l,mapLib:p}=at.useContext(yp),_=at.useRef({props:i});_.current.props=i;const w=at.useMemo(()=>{let De=!1;at.Children.forEach(i.children,J=>{J&&(De=!0)});const ut={...i,element:De?document.createElement("div"):null},se=new p.Marker(ut);return se.setLngLat([i.longitude,i.latitude]),se.getElement().addEventListener("click",J=>{var de,Se;(Se=(de=_.current.props).onClick)===null||Se===void 0||Se.call(de,{type:"click",target:se,originalEvent:J})}),se.on("dragstart",J=>{var de,Se;const Oe=J;Oe.lngLat=w.getLngLat(),(Se=(de=_.current.props).onDragStart)===null||Se===void 0||Se.call(de,Oe)}),se.on("drag",J=>{var de,Se;const Oe=J;Oe.lngLat=w.getLngLat(),(Se=(de=_.current.props).onDrag)===null||Se===void 0||Se.call(de,Oe)}),se.on("dragend",J=>{var de,Se;const Oe=J;Oe.lngLat=w.getLngLat(),(Se=(de=_.current.props).onDragEnd)===null||Se===void 0||Se.call(de,Oe)}),se},[]);at.useEffect(()=>(w.addTo(l.getMap()),()=>{w.remove()}),[]);const{longitude:I,latitude:u,offset:N,style:L,draggable:ne=!1,popup:le=null,rotation:te=0,rotationAlignment:ke="auto",pitchAlignment:Ie="auto"}=i;return at.useEffect(()=>{Ia(w.getElement(),L)},[L]),at.useImperativeHandle(r,()=>w,[]),(w.getLngLat().lng!==I||w.getLngLat().lat!==u)&&w.setLngLat([I,u]),N&&!YS(w.getOffset(),N)&&w.setOffset(N),w.isDraggable()!==ne&&w.setDraggable(ne),w.getRotation()!==te&&w.setRotation(te),w.getRotationAlignment()!==ke&&w.setRotationAlignment(ke),w.getPitchAlignment()!==Ie&&w.setPitchAlignment(Ie),w.getPopup()!==le&&w.setPopup(le),qg.createPortal(i.children,w.getElement())}at.memo(at.forwardRef(hT));function qv(i){return new Set(i?i.trim().split(/\s+/):[])}function dT(i,r){const{map:l,mapLib:p}=at.useContext(yp),_=at.useMemo(()=>document.createElement("div"),[]),w=at.useRef({props:i});w.current.props=i;const I=at.useMemo(()=>{const u={...i},N=new p.Popup(u);return N.setLngLat([i.longitude,i.latitude]),N.once("open",L=>{var ne,le;(le=(ne=w.current.props).onOpen)===null||le===void 0||le.call(ne,L)}),N},[]);if(at.useEffect(()=>{const u=N=>{var L,ne;(ne=(L=w.current.props).onClose)===null||ne===void 0||ne.call(L,N)};return I.on("close",u),I.setDOMContent(_).addTo(l.getMap()),()=>{I.off("close",u),I.isOpen()&&I.remove()}},[]),at.useEffect(()=>{Ia(I.getElement(),i.style)},[i.style]),at.useImperativeHandle(r,()=>I,[]),I.isOpen()&&((I.getLngLat().lng!==i.longitude||I.getLngLat().lat!==i.latitude)&&I.setLngLat([i.longitude,i.latitude]),i.offset&&!Gs(I.options.offset,i.offset)&&I.setOffset(i.offset),(I.options.anchor!==i.anchor||I.options.maxWidth!==i.maxWidth)&&(I.options.anchor=i.anchor,I.setMaxWidth(i.maxWidth)),I.options.className!==i.className)){const u=qv(I.options.className),N=qv(i.className);for(const L of u)N.has(L)||I.removeClassName(L);for(const L of N)u.has(L)||I.addClassName(L);I.options.className=i.className}return qg.createPortal(i.children,_)}at.memo(at.forwardRef(dT));function qc(i,r,l,p){const _=at.useContext(yp),w=at.useMemo(()=>i(_),[]);return at.useEffect(()=>{const I=p||l||r,u=typeof r=="function"&&typeof l=="function"?r:null,N=typeof l=="function"?l:typeof r=="function"?r:null,{map:L}=_;return L.hasControl(w)||(L.addControl(w,I==null?void 0:I.position),u&&u(_)),()=>{N&&N(_),L.hasControl(w)&&L.removeControl(w)}},[]),w}function pT(i){const r=qc(({mapLib:l})=>new l.AttributionControl(i),{position:i.position});return at.useEffect(()=>{Ia(r._container,i.style)},[i.style]),null}at.memo(pT);function fT(i){const r=qc(({mapLib:l})=>new l.FullscreenControl({container:i.containerId&&document.getElementById(i.containerId)}),{position:i.position});return at.useEffect(()=>{Ia(r._controlContainer,i.style)},[i.style]),null}at.memo(fT);function mT(i,r){const l=at.useRef({props:i}),p=qc(({mapLib:_})=>{const w=new _.GeolocateControl(i),I=w._setupUI;return w._setupUI=u=>{w._container.hasChildNodes()||I(u)},w.on("geolocate",u=>{var N,L;(L=(N=l.current.props).onGeolocate)===null||L===void 0||L.call(N,u)}),w.on("error",u=>{var N,L;(L=(N=l.current.props).onError)===null||L===void 0||L.call(N,u)}),w.on("outofmaxbounds",u=>{var N,L;(L=(N=l.current.props).onOutOfMaxBounds)===null||L===void 0||L.call(N,u)}),w.on("trackuserlocationstart",u=>{var N,L;(L=(N=l.current.props).onTrackUserLocationStart)===null||L===void 0||L.call(N,u)}),w.on("trackuserlocationend",u=>{var N,L;(L=(N=l.current.props).onTrackUserLocationEnd)===null||L===void 0||L.call(N,u)}),w},{position:i.position});return l.current.props=i,at.useImperativeHandle(r,()=>p,[]),at.useEffect(()=>{Ia(p._container,i.style)},[i.style]),null}at.memo(at.forwardRef(mT));function gT(i){const r=qc(({mapLib:l})=>new l.NavigationControl(i),{position:i.position});return at.useEffect(()=>{Ia(r._container,i.style)},[i.style]),null}at.memo(gT);function yT(i){const r=qc(({mapLib:w})=>new w.ScaleControl(i),{position:i.position}),l=at.useRef(i),p=l.current;l.current=i;const{style:_}=i;return i.maxWidth!==void 0&&i.maxWidth!==p.maxWidth&&(r.options.maxWidth=i.maxWidth),i.unit!==void 0&&i.unit!==p.unit&&r.setUnit(i.unit),at.useEffect(()=>{Ia(r._container,_)},[_]),null}at.memo(yT);const _T=XS(()=>Promise.resolve().then(()=>GS),void 0),vT=at.forwardRef(function(r,l){return uT(r,l,_T)});var Un=(i,r,l)=>new Promise((p,_)=>{var w=N=>{try{u(l.next(N))}catch(L){_(L)}},I=N=>{try{u(l.throw(N))}catch(L){_(L)}},u=N=>N.done?p(N.value):Promise.resolve(N.value).then(w,I);u((l=l.apply(i,r)).next())}),pr=Uint8Array,Cl=Uint16Array,xT=Int32Array,d1=new pr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),p1=new pr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),wT=new pr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),f1=function(i,r){for(var l=new Cl(31),p=0;p<31;++p)l[p]=r+=1<>1|(Ut&21845)<<1,$s=($s&52428)>>2|($s&13107)<<2,$s=($s&61680)>>4|($s&3855)<<4,Xm[Ut]=(($s&65280)>>8|($s&255)<<8)>>1;var $s,Ut,bc=function(i,r,l){for(var p=i.length,_=0,w=new Cl(r);_>N]=L}else for(u=new Cl(p),_=0;_>15-i[_]);return u},Gc=new pr(288);for(Ut=0;Ut<144;++Ut)Gc[Ut]=8;var Ut;for(Ut=144;Ut<256;++Ut)Gc[Ut]=9;var Ut;for(Ut=256;Ut<280;++Ut)Gc[Ut]=7;var Ut;for(Ut=280;Ut<288;++Ut)Gc[Ut]=8;var Ut,y1=new pr(32);for(Ut=0;Ut<32;++Ut)y1[Ut]=5;var Ut,kT=bc(Gc,9,1),ET=bc(y1,5,1),Jf=function(i){for(var r=i[0],l=1;lr&&(r=i[l]);return r},Yr=function(i,r,l){var p=r/8|0;return(i[p]|i[p+1]<<8)>>(r&7)&l},em=function(i,r){var l=r/8|0;return(i[l]|i[l+1]<<8|i[l+2]<<16)>>(r&7)},IT=function(i){return(i+7)/8|0},CT=function(i,r,l){(r==null||r<0)&&(r=0),(l==null||l>i.length)&&(l=i.length);var p=new pr(l-r);return p.set(i.subarray(r,l)),p},PT=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],dr=function(i,r,l){var p=new Error(r||PT[i]);if(p.code=i,Error.captureStackTrace&&Error.captureStackTrace(p,dr),!l)throw p;return p},Gg=function(i,r,l,p){var _=i.length,w=p?p.length:0;if(!_||r.f&&!r.l)return l||new pr(0);var I=!l||r.i!=2,u=r.i;l||(l=new pr(_*3));var N=function(sn){var ss=l.length;if(sn>ss){var or=new pr(Math.max(ss*2,sn));or.set(l),l=or}},L=r.f||0,ne=r.p||0,le=r.b||0,te=r.l,ke=r.d,Ie=r.m,De=r.n,ut=_*8;do{if(!te){L=Yr(i,ne,1);var se=Yr(i,ne+1,3);if(ne+=3,se)if(se==1)te=kT,ke=ET,Ie=9,De=5;else if(se==2){var Oe=Yr(i,ne,31)+257,He=Yr(i,ne+10,15)+4,Je=Oe+Yr(i,ne+5,31)+1;ne+=14;for(var $e=new pr(Je),Ft=new pr(19),Ge=0;Ge>4;if(J<16)$e[Ge++]=J;else{var ui=0,Bi=0;for(J==16?(Bi=3+Yr(i,ne,3),ne+=2,ui=$e[Ge-1]):J==17?(Bi=3+Yr(i,ne,7),ne+=3):J==18&&(Bi=11+Yr(i,ne,127),ne+=7);Bi--;)$e[Ge++]=ui}}var Ii=$e.subarray(0,Oe),Ne=$e.subarray(Oe);Ie=Jf(Ii),De=Jf(Ne),te=bc(Ii,Ie,1),ke=bc(Ne,De,1)}else dr(1);else{var J=IT(ne)+4,de=i[J-4]|i[J-3]<<8,Se=J+de;if(Se>_){u&&dr(0);break}I&&N(le+de),l.set(i.subarray(J,Se),le),r.b=le+=de,r.p=ne=Se*8,r.f=L;continue}if(ne>ut){u&&dr(0);break}}I&&N(le+131072);for(var ct=(1<>4;if(ne+=ui&15,ne>ut){u&&dr(0);break}if(ui||dr(2),kt<256)l[le++]=kt;else if(kt==256){Lt=ne,te=null;break}else{var It=kt-254;if(kt>264){var Ge=kt-257,jt=d1[Ge];It=Yr(i,ne,(1<>4;nn||dr(3),ne+=nn&15;var Ne=TT[Oi];if(Oi>3){var jt=p1[Oi];Ne+=em(i,ne)&(1<ut){u&&dr(0);break}I&&N(le+131072);var rn=le+It;if(le>3&1)+(r>>4&1);p>0;p-=!i[l++]);return l+(r&2)},AT=function(i){var r=i.length;return(i[r-4]|i[r-3]<<8|i[r-2]<<16|i[r-1]<<24)>>>0},DT=function(i,r){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&dr(6,"invalid zlib data"),(i[1]>>5&1)==+!r&&dr(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function LT(i,r){return Gg(i,{i:2},r&&r.out,r&&r.dictionary)}function RT(i,r){var l=zT(i);return l+8>i.length&&dr(6,"invalid gzip data"),Gg(i.subarray(l,-8),{i:2},r&&r.out||new pr(AT(i)),r&&r.dictionary)}function FT(i,r){return Gg(i.subarray(DT(i,r&&r.dictionary),-4),{i:2},r&&r.out,r&&r.dictionary)}function Km(i,r){return i[0]==31&&i[1]==139&&i[2]==8?RT(i,r):(i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31?LT(i,r):FT(i,r)}var BT=typeof TextDecoder<"u"&&new TextDecoder,OT=0;try{BT.decode(MT,{stream:!0}),OT=1}catch{}var _1=(i,r)=>i*Math.pow(2,r),ac=(i,r)=>Math.floor(i/Math.pow(2,r)),ep=(i,r)=>_1(i.getUint16(r+1,!0),8)+i.getUint8(r),v1=(i,r)=>_1(i.getUint32(r+2,!0),16)+i.getUint16(r,!0),NT=(i,r,l,p,_)=>{if(i!=p.getUint8(_))return i-p.getUint8(_);const w=ep(p,_+1);if(r!=w)return r-w;const I=ep(p,_+4);return l!=I?l-I:0},VT=(i,r,l,p)=>{const _=x1(i,r|128,l,p);return _?{z:r,x:l,y:p,offset:_[0],length:_[1],is_dir:!0}:null},Gv=(i,r,l,p)=>{const _=x1(i,r,l,p);return _?{z:r,x:l,y:p,offset:_[0],length:_[1],is_dir:!1}:null},x1=(i,r,l,p)=>{let _=0,w=i.byteLength/17-1;for(;_<=w;){const I=w+_>>1,u=NT(r,l,p,i,I*17);if(u>0)_=I+1;else if(u<0)w=I-1;else return[v1(i,I*17+7),i.getUint32(I*17+13,!0)]}return null},UT=(i,r)=>i.is_dir&&!r.is_dir?1:!i.is_dir&&r.is_dir?-1:i.z!==r.z?i.z-r.z:i.x!==r.x?i.x-r.x:i.y-r.y,w1=(i,r)=>{const l=i.getUint8(r*17);return{z:l&127,x:ep(i,r*17+1),y:ep(i,r*17+4),offset:v1(i,r*17+7),length:i.getUint32(r*17+13,!0),is_dir:l>>7===1}},Hv=i=>{const r=[],l=new DataView(i);for(let p=0;p{i.sort(UT);const r=new ArrayBuffer(17*i.length),l=new Uint8Array(r);for(let p=0;p>8&255,l[p*17+3]=_.x>>16&255,l[p*17+4]=_.y&255,l[p*17+5]=_.y>>8&255,l[p*17+6]=_.y>>16&255,l[p*17+7]=_.offset&255,l[p*17+8]=ac(_.offset,8)&255,l[p*17+9]=ac(_.offset,16)&255,l[p*17+10]=ac(_.offset,24)&255,l[p*17+11]=ac(_.offset,32)&255,l[p*17+12]=ac(_.offset,48)&255,l[p*17+13]=_.length&255,l[p*17+14]=_.length>>8&255,l[p*17+15]=_.length>>16&255,l[p*17+16]=_.length>>24&255}return r},$T=(i,r)=>{if(i.byteLength<17)return null;const l=i.byteLength/17,p=w1(i,l-1);if(p.is_dir){const _=p.z,w=r.z-_,I=Math.trunc(r.x/(1<{if(i.type=="json"){const l=i.url.substr(10);let p=this.tiles.get(l);return p||(p=new Wv(l),this.tiles.set(l,p)),p.getHeader().then(_=>{const w={tiles:[i.url+"/{z}/{x}/{y}"],minzoom:_.minZoom,maxzoom:_.maxZoom,bounds:[_.minLon,_.minLat,_.maxLon,_.maxLat]};r(null,w,null,null)}).catch(_=>{r(_,null,null,null)}),{cancel:()=>{}}}else{const l=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),p=i.url.match(l);if(!p)throw new Error("Invalid PMTiles protocol URL");const _=p[1];let w=this.tiles.get(_);w||(w=new Wv(_),this.tiles.set(_,w));const I=p[2],u=p[3],N=p[4],L=new AbortController,ne=L.signal;let le=()=>{L.abort()};return w.getHeader().then(te=>{w.getZxy(+I,+u,+N,ne).then(ke=>{ke?r(null,new Uint8Array(ke.data),ke.cacheControl,ke.expires):te.tileType==1?r(null,new Uint8Array,null,null):r(null,null,null,null)}).catch(ke=>{ke.name!=="AbortError"&&r(ke,null,null,null)})}),{cancel:le}}},this.tiles=new Map}add(i){this.tiles.set(i.source.getKey(),i)}get(i){return this.tiles.get(i)}};function ml(i,r){return(r>>>0)*4294967296+(i>>>0)}function HT(i,r){const l=r.buf;let p,_;if(_=l[r.pos++],p=(_&112)>>4,_<128||(_=l[r.pos++],p|=(_&127)<<3,_<128)||(_=l[r.pos++],p|=(_&127)<<10,_<128)||(_=l[r.pos++],p|=(_&127)<<17,_<128)||(_=l[r.pos++],p|=(_&127)<<24,_<128)||(_=l[r.pos++],p|=(_&1)<<31,_<128))return ml(i,p);throw new Error("Expected varint not more than 10 bytes")}function lc(i){const r=i.buf;let l,p;return p=r[i.pos++],l=p&127,p<128||(p=r[i.pos++],l|=(p&127)<<7,p<128)||(p=r[i.pos++],l|=(p&127)<<14,p<128)||(p=r[i.pos++],l|=(p&127)<<21,p<128)?l:(p=r[i.pos],l|=(p&15)<<28,HT(l,i))}function WT(i,r,l,p){if(p==0){l==1&&(r[0]=i-1-r[0],r[1]=i-1-r[1]);const _=r[0];r[0]=r[1],r[1]=_}}var XT=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function KT(i,r,l){if(i>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(r>Math.pow(2,i)-1||l>Math.pow(2,i)-1)throw Error("tile x/y outside zoom level bounds");const p=XT[i],_=Math.pow(2,i);let w=0,I=0,u=0;const N=[r,l];let L=_/2;for(;L>0;)w=(N[0]&L)>0?1:0,I=(N[1]&L)>0?1:0,u+=L*L*(3*w^I),WT(L,N,w,I),L=L/2;return p+u}function S1(i,r){return Un(this,null,function*(){if(r===1||r===0)return i;if(r===2){if(typeof globalThis.DecompressionStream>"u")return Km(new Uint8Array(i));{let p=new Response(i).body.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(p).arrayBuffer()}}else throw Error("Compression method not supported")})}var YT=127;function QT(i,r){let l=0,p=i.length-1;for(;l<=p;){const _=p+l>>1,w=r-i[_].tileId;if(w>0)l=_+1;else if(w<0)p=_-1;else return i[_]}return p>=0&&(i[p].runLength===0||r-i[p].tileId=300)throw Error("Bad response code: "+w.status);const I=w.headers.get("Content-Length");if(w.status===200&&(!I||+I>r))throw p&&p.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield w.arrayBuffer(),etag:w.headers.get("ETag")||void 0,cacheControl:w.headers.get("Cache-Control")||void 0,expires:w.headers.get("Expires")||void 0}})}};function Qr(i,r){const l=i.getUint32(r+4,!0),p=i.getUint32(r+0,!0);return l*Math.pow(2,32)+p}function ek(i,r){const l=new DataView(i),p=l.getUint8(7);if(p>3)throw Error(`Archive is spec version ${p} but this library supports up to spec version 3`);return{specVersion:p,rootDirectoryOffset:Qr(l,8),rootDirectoryLength:Qr(l,16),jsonMetadataOffset:Qr(l,24),jsonMetadataLength:Qr(l,32),leafDirectoryOffset:Qr(l,40),leafDirectoryLength:Qr(l,48),tileDataOffset:Qr(l,56),tileDataLength:Qr(l,64),numAddressedTiles:Qr(l,72),numTileEntries:Qr(l,80),numTileContents:Qr(l,88),clustered:l.getUint8(96)===1,internalCompression:l.getUint8(97),tileCompression:l.getUint8(98),tileType:l.getUint8(99),minZoom:l.getUint8(100),maxZoom:l.getUint8(101),minLon:l.getInt32(102,!0)/1e7,minLat:l.getInt32(106,!0)/1e7,maxLon:l.getInt32(110,!0)/1e7,maxLat:l.getInt32(114,!0)/1e7,centerZoom:l.getUint8(118),centerLon:l.getInt32(119,!0)/1e7,centerLat:l.getInt32(123,!0)/1e7,etag:r}}function T1(i){const r={buf:new Uint8Array(i),pos:0},l=lc(r),p=[];let _=0;for(let w=0;w0?p[w].offset=p[w-1].offset+p[w-1].length:p[w].offset=I-1}return p}function tk(i){const r=new DataView(i);return r.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):r.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var Pl=class extends Error{};function ik(i,r,l,p){return Un(this,null,function*(){const _=yield i.getBytes(0,16384);if(new DataView(_.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(tk(_.data)<3)return[yield b1.getHeader(i)];const I=_.data.slice(0,YT);let u=_.etag;p&&_.etag!=p&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+i.getKey()),u=void 0);const N=ek(I,u);if(l){const L=_.data.slice(N.rootDirectoryOffset,N.rootDirectoryOffset+N.rootDirectoryLength),ne=i.getKey()+"|"+(N.etag||"")+"|"+N.rootDirectoryOffset+"|"+N.rootDirectoryLength,le=T1(yield r(L,N.internalCompression));return[N,[ne,le.length,le]]}return[N,void 0]})}function nk(i,r,l,p,_){return Un(this,null,function*(){const w=yield i.getBytes(l,p);if(_.etag&&_.etag!==w.etag)throw new Pl(w.etag);const I=yield r(w.data,_.internalCompression),u=T1(I);if(u.length===0)throw new Error("Empty directory is invalid");return u})}var rk=class{constructor(i=100,r=!0,l=S1){this.cache=new Map,this.maxCacheEntries=i,this.counter=1,this.prefetch=r,this.decompress=l}getHeader(i,r){return Un(this,null,function*(){const l=i.getKey();if(this.cache.has(l))return this.cache.get(l).lastUsed=this.counter++,yield this.cache.get(l).data;const p=new Promise((_,w)=>{ik(i,this.decompress,this.prefetch,r).then(I=>{I[1]&&this.cache.set(I[1][0],{lastUsed:this.counter++,data:Promise.resolve(I[1][2])}),_(I[0]),this.prune()}).catch(I=>{w(I)})});return this.cache.set(l,{lastUsed:this.counter++,data:p}),p})}getDirectory(i,r,l,p){return Un(this,null,function*(){const _=i.getKey()+"|"+(p.etag||"")+"|"+r+"|"+l;if(this.cache.has(_))return this.cache.get(_).lastUsed=this.counter++,yield this.cache.get(_).data;const w=new Promise((I,u)=>{nk(i,this.decompress,r,l,p).then(N=>{I(N),this.prune()}).catch(N=>{u(N)})});return this.cache.set(_,{lastUsed:this.counter++,data:w}),w})}getArrayBuffer(i,r,l,p){return Un(this,null,function*(){const _=i.getKey()+"|"+(p.etag||"")+"|"+r+"|"+l;if(this.cache.has(_))return this.cache.get(_).lastUsed=this.counter++,yield this.cache.get(_).data;const w=new Promise((I,u)=>{i.getBytes(r,l).then(N=>{if(p.etag&&p.etag!==N.etag)throw new Pl(N.etag);I(N.data),this.cache.has(_),this.prune()}).catch(N=>{u(N)})});return this.cache.set(_,{lastUsed:this.counter++,data:w}),w})}prune(){if(this.cache.size>=this.maxCacheEntries){let i=1/0,r;this.cache.forEach((l,p)=>{l.lastUsedw.maxZoom)return;let I=w.rootDirectoryOffset,u=w.rootDirectoryLength;for(let N=0;N<=3;N++){const L=yield this.cache.getDirectory(this.source,I,u,w),ne=QT(L,_);if(ne)if(ne.runLength>0){const le=yield this.source.getBytes(w.tileDataOffset+ne.offset,ne.length,p);if(w.etag&&w.etag!==le.etag)throw new Pl(le.etag);return{data:yield this.decompress(le.data,w.tileCompression),cacheControl:le.cacheControl,expires:le.expires}}else I=w.leafDirectoryOffset+ne.offset,u=ne.length;else return}throw Error("Maximum directory depth exceeded")})}getZxy(i,r,l,p){return Un(this,null,function*(){try{return yield this.getZxyAttempt(i,r,l,p)}catch(_){if(_ instanceof Pl)return this.cache.invalidate(this.source,_.message),yield this.getZxyAttempt(i,r,l,p);throw _}})}getMetadataAttempt(){return Un(this,null,function*(){const i=yield this.cache.getHeader(this.source),r=yield this.source.getBytes(i.jsonMetadataOffset,i.jsonMetadataLength);if(i.etag&&i.etag!==r.etag)throw new Pl(r.etag);const l=yield this.decompress(r.data,i.internalCompression),p=new TextDecoder("utf-8");return JSON.parse(p.decode(l))})}getMetadata(){return Un(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(i){if(i instanceof Pl)return this.cache.invalidate(this.source,i.message),yield this.getMetadataAttempt();throw i}})}};function sk(){const[i,r]=at.useState();return at.useEffect(()=>{const l=setInterval(()=>{fetch("./style.json").then(p=>p.json()).then(p=>{JSON.stringify(i)!==JSON.stringify(p)&&r(p)})},1e3);return()=>clearInterval(l)},[i]),at.useEffect(()=>{const l=new GT;return Wm.addProtocol("pmtiles",l.tile),()=>{Wm.removeProtocol("pmtiles")}},[]),Pd.jsx("div",{style:{width:"100vw",height:"100vh"},children:Pd.jsx(vT,{initialViewState:{longitude:139.7673068,latitude:35.6809591,zoom:6},style:{position:"absolute",width:"100%",height:"100%"},hash:!1,mapStyle:i})})}tm.createRoot(document.getElementById("root")).render(Pd.jsx(Fb.StrictMode,{children:Pd.jsx(sk,{})})); function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] diff --git a/index.html b/index.html index 425cd90..f9eab1b 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Vite + React + TS - +