@arenarium/maps 1.0.72 → 1.0.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -739,4 +739,4 @@ uniform ${P} ${A} u_${E};
739
739
  `),se=ee.concat(ur.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
740
740
  `);er(P)||(ie=function(xe){return xe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(ie),se=function(xe){return xe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(se));const re=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(re,ie),P.compileShader(re),!P.getShaderParameter(re,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(re)}`);P.attachShader(this.program,re);const pe=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(pe,se),P.compileShader(pe),!P.getShaderParameter(pe,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(pe)}`);P.attachShader(this.program,pe),this.attributes={};const Me={};this.numAttributes=F.length;for(let xe=0;xe<this.numAttributes;xe++)F[xe]&&(P.bindAttribLocation(this.program,xe,F[xe]),this.attributes[F[xe]]=xe);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(pe),P.deleteShader(re);for(let xe=0;xe<te.length;xe++){const ve=te[xe];if(ve&&!Me[ve]){const be=P.getUniformLocation(this.program,ve);be&&(Me[ve]=be)}}this.fixedUniforms=l(e,Me),this.terrainUniforms=((xe,ve)=>({u_depth:new o.bH(xe,ve.u_depth),u_terrain:new o.bH(xe,ve.u_terrain),u_terrain_dim:new o.b8(xe,ve.u_terrain_dim),u_terrain_matrix:new o.bJ(xe,ve.u_terrain_matrix),u_terrain_unpack:new o.bK(xe,ve.u_terrain_unpack),u_terrain_exaggeration:new o.b8(xe,ve.u_terrain_exaggeration)}))(e,Me),this.projectionUniforms=((xe,ve)=>({u_projection_matrix:new o.bJ(xe,ve.u_projection_matrix),u_projection_tile_mercator_coords:new o.bK(xe,ve.u_projection_tile_mercator_coords),u_projection_clipping_plane:new o.bK(xe,ve.u_projection_clipping_plane),u_projection_transition:new o.b8(xe,ve.u_projection_transition),u_projection_fallback_matrix:new o.bJ(xe,ve.u_projection_fallback_matrix)}))(e,Me),this.binderUniforms=s?s.getUniforms(e,Me):[]}draw(e,i,s,l,h,f,_,x,T,P,A,E,F,O,H,q,W,K,te){const ee=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(l),e.setColorMode(h),e.setCullFace(f),x){e.activeTexture.set(ee.TEXTURE2),ee.bindTexture(ee.TEXTURE_2D,x.depthTexture),e.activeTexture.set(ee.TEXTURE3),ee.bindTexture(ee.TEXTURE_2D,x.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(x[se])}if(T)for(const se in T)this.projectionUniforms[zo[se]].set(T[se]);if(_)for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);q&&q.setUniforms(e,this.binderUniforms,O,{zoom:H});let ie=0;switch(i){case ee.LINES:ie=2;break;case ee.TRIANGLES:ie=3;break;case ee.LINE_STRIP:ie=1}for(const se of F.get()){const re=se.vaos||(se.vaos={});(re[P]||(re[P]=new zd)).bind(e,this,A,q?q.getPaintVertexBuffers():[],E,se.vertexOffset,W,K,te),ee.drawElements(i,se.primitiveLength*ie,ee.UNSIGNED_SHORT,se.primitiveOffset*ie*2)}}}function Do(u,e,i){const s=1/o.az(i,1,e.transform.tileZoom),l=Math.pow(2,i.tileID.overscaledZ),h=i.tileSize*Math.pow(2,e.transform.tileZoom)/l,f=h*(i.tileID.canonical.x+i.tileID.wrap*l),_=h*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[s,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const Lo=(u,e,i,s)=>{const l=u.style.light,h=l.properties.get("position"),f=[h.x,h.y,h.z],_=o.bN();l.properties.get("anchor")==="viewport"&&o.bO(_,u.transform.bearingInRadians),o.bP(f,f,_);const x=u.transform.transformLightDirection(f),T=l.properties.get("color");return{u_lightpos:f,u_lightpos_globe:x,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:s}},fn=(u,e,i,s,l,h,f)=>o.e(Lo(u,e,i,s),Do(h,u,f),{u_height_factor:-Math.pow(2,l.overscaledZ)/f.tileSize/8}),qu=(u,e,i,s)=>o.e(Do(e,u,i),{u_fill_translate:s}),nc=(u,e)=>({u_world:u,u_fill_translate:e}),Os=(u,e,i,s,l)=>o.e(qu(u,e,i,l),{u_world:s}),js=(u,e,i,s,l)=>{const h=u.transform;let f,_,x=0;if(i.paint.get("circle-pitch-alignment")==="map"){const T=o.az(e,1,h.zoom);f=!0,_=[T,T],x=T/(o.Z*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*l}else f=!1,_=h.pixelsToGLUnits;return{u_camera_to_center_distance:h.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+f,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:x,u_translate:s}},Dd=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),Bo=u=>({u_viewport_size:[u.width,u.height]}),Hu=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),va=(u,e,i,s)=>{const l=o.az(u,1,e)/(o.Z*Math.pow(2,u.tileID.overscaledZ))*2*Math.PI*s;return{u_extrude_scale:o.az(u,1,e),u_intensity:i,u_globe_extrude_scale:l}},Wu=(u,e,i,s)=>{const l=o.K();o.bQ(l,0,u.width,u.height,0,0,1);const h=u.context.gl;return{u_matrix:l,u_world:[h.drawingBufferWidth,h.drawingBufferHeight],u_image:i,u_color_ramp:s,u_opacity:e.paint.get("heatmap-opacity")}},Xu=(u,e,i)=>{const s=i.paint.get("hillshade-accent-color");let l;switch(i.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}const h=i.getIlluminationProperties();for(let f=0;f<h.directionRadians.length;f++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(h.directionRadians[f]+=u.transform.bearingInRadians);return{u_image:0,u_latrange:Ku(0,e.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:h.altitudeRadians,u_azimuths:h.directionRadians,u_accent:s,u_method:l,u_highlights:h.highlightColor,u_shadows:h.shadowColor}},Ld=(u,e)=>{const i=e.stride,s=o.K();return o.bQ(s,0,o.Z,-8192,0,0,1),o.L(s,s,[0,-8192,0]),{u_matrix:s,u_image:1,u_dimension:[i,i],u_zoom:u.overscaledZ,u_unpack:e.getUnpackVector()}};function Ku(u,e){const i=Math.pow(2,e.canonical.z),s=e.canonical.y;return[new o.$(0,s/i).toLngLat().lat,new o.$(0,(s+1)/i).toLngLat().lat]}const Ns=(u,e,i,s)=>{const l=u.transform;return{u_translation:Wn(u,e,i),u_ratio:s/o.az(e,1,l.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},Yu=(u,e,i,s,l)=>o.e(Ns(u,e,i,s),{u_image:0,u_image_height:l}),Ju=(u,e,i,s,l)=>{const h=u.transform,f=ac(e,h);return{u_translation:Wn(u,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:s/o.az(e,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[f,l.fromScale,l.toScale],u_fade:l.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Qu=(u,e,i,s,l,h)=>{const f=u.lineAtlas,_=ac(e,u.transform),x=i.layout.get("line-cap")==="round",T=f.getDash(l.from,x),P=f.getDash(l.to,x),A=T.width*h.fromScale,E=P.width*h.toScale;return o.e(Ns(u,e,i,s),{u_patternscale_a:[_/A,-T.height/2],u_patternscale_b:[_/E,-P.height/2],u_sdfgamma:f.width/(256*Math.min(A,E)*u.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:P.y,u_mix:h.t})};function ac(u,e){return 1/o.az(u,1,e.tileZoom)}function Wn(u,e,i){return o.aA(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const eh=(u,e,i,s,l)=>{return{u_tl_parent:u,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(f=s.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(h=s.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:th(s.paint.get("raster-hue-rotate")),u_coords_top:[l[0].x,l[0].y,l[1].x,l[1].y],u_coords_bottom:[l[3].x,l[3].y,l[2].x,l[2].y]};var h,f};function th(u){u*=Math.PI/180;const e=Math.sin(u),i=Math.cos(u);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Xa=(u,e,i,s,l,h,f,_,x,T,P,A,E)=>{const F=f.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:F.cameraToCenterDistance,u_pitch:F.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:F.width/F.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+P,u_pitch_with_map:+s,u_is_along_line:l,u_is_variable_anchor:h,u_texsize:A,u_texture:0,u_translation:T,u_pitched_scale:E}},ih=(u,e,i,s,l,h,f,_,x,T,P,A,E,F)=>{const O=f.transform;return o.e(Xa(u,e,i,s,l,h,f,_,x,T,P,A,F),{u_gamma_scale:s?Math.cos(O.pitch*Math.PI/180)*O.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},Fo=(u,e,i,s,l,h,f,_,x,T,P,A,E)=>o.e(ih(u,e,i,s,l,h,f,_,x,T,!0,P,0,E),{u_texsize_icon:A,u_texture_icon:1}),Bd=(u,e)=>({u_opacity:u,u_color:e}),Fd=(u,e,i,s,l)=>o.e(function(h,f,_,x){const T=_.imageManager.getPattern(h.from.toString()),P=_.imageManager.getPattern(h.to.toString()),{width:A,height:E}=_.imageManager.getPixelSize(),F=Math.pow(2,x.tileID.overscaledZ),O=x.tileSize*Math.pow(2,_.transform.tileZoom)/F,H=O*(x.tileID.canonical.x+x.tileID.wrap*F),q=O*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[A,E],u_mix:f.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/o.az(x,1,_.transform.tileZoom),u_pixel_coord_upper:[H>>16,q>>16],u_pixel_coord_lower:[65535&H,65535&q]}}(i,l,e,s),{u_opacity:u}),sc=(u,e)=>{},rh={fillExtrusion:(u,e)=>({u_lightpos:new o.bL(u,e.u_lightpos),u_lightpos_globe:new o.bL(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bL(u,e.u_lightcolor),u_vertical_gradient:new o.b8(u,e.u_vertical_gradient),u_opacity:new o.b8(u,e.u_opacity),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillExtrusionPattern:(u,e)=>({u_lightpos:new o.bL(u,e.u_lightpos),u_lightpos_globe:new o.bL(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bL(u,e.u_lightcolor),u_vertical_gradient:new o.b8(u,e.u_vertical_gradient),u_height_factor:new o.b8(u,e.u_height_factor),u_opacity:new o.b8(u,e.u_opacity),u_fill_translate:new o.bM(u,e.u_fill_translate),u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),fill:(u,e)=>({u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillPattern:(u,e)=>({u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillOutline:(u,e)=>({u_world:new o.bM(u,e.u_world),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillOutlinePattern:(u,e)=>({u_world:new o.bM(u,e.u_world),u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bM(u,e.u_fill_translate)}),circle:(u,e)=>({u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_scale_with_map:new o.bH(u,e.u_scale_with_map),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_extrude_scale:new o.bM(u,e.u_extrude_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_globe_extrude_scale:new o.b8(u,e.u_globe_extrude_scale),u_translate:new o.bM(u,e.u_translate)}),collisionBox:(u,e)=>({u_pixel_extrude_scale:new o.bM(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_viewport_size:new o.bM(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new o.bI(u,e.u_color),u_overlay:new o.bH(u,e.u_overlay),u_overlay_scale:new o.b8(u,e.u_overlay_scale)}),depth:sc,clippingMask:sc,heatmap:(u,e)=>({u_extrude_scale:new o.b8(u,e.u_extrude_scale),u_intensity:new o.b8(u,e.u_intensity),u_globe_extrude_scale:new o.b8(u,e.u_globe_extrude_scale)}),heatmapTexture:(u,e)=>({u_matrix:new o.bJ(u,e.u_matrix),u_world:new o.bM(u,e.u_world),u_image:new o.bH(u,e.u_image),u_color_ramp:new o.bH(u,e.u_color_ramp),u_opacity:new o.b8(u,e.u_opacity)}),hillshade:(u,e)=>({u_image:new o.bH(u,e.u_image),u_latrange:new o.bM(u,e.u_latrange),u_exaggeration:new o.b8(u,e.u_exaggeration),u_altitudes:new o.bS(u,e.u_altitudes),u_azimuths:new o.bS(u,e.u_azimuths),u_accent:new o.bI(u,e.u_accent),u_method:new o.bH(u,e.u_method),u_shadows:new o.bR(u,e.u_shadows),u_highlights:new o.bR(u,e.u_highlights)}),hillshadePrepare:(u,e)=>({u_matrix:new o.bJ(u,e.u_matrix),u_image:new o.bH(u,e.u_image),u_dimension:new o.bM(u,e.u_dimension),u_zoom:new o.b8(u,e.u_zoom),u_unpack:new o.bK(u,e.u_unpack)}),line:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_image:new o.bH(u,e.u_image),u_image_height:new o.b8(u,e.u_image_height)}),linePattern:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_texsize:new o.bM(u,e.u_texsize),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_image:new o.bH(u,e.u_image),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),lineSDF:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_patternscale_a:new o.bM(u,e.u_patternscale_a),u_patternscale_b:new o.bM(u,e.u_patternscale_b),u_sdfgamma:new o.b8(u,e.u_sdfgamma),u_image:new o.bH(u,e.u_image),u_tex_y_a:new o.b8(u,e.u_tex_y_a),u_tex_y_b:new o.b8(u,e.u_tex_y_b),u_mix:new o.b8(u,e.u_mix)}),raster:(u,e)=>({u_tl_parent:new o.bM(u,e.u_tl_parent),u_scale_parent:new o.b8(u,e.u_scale_parent),u_buffer_scale:new o.b8(u,e.u_buffer_scale),u_fade_t:new o.b8(u,e.u_fade_t),u_opacity:new o.b8(u,e.u_opacity),u_image0:new o.bH(u,e.u_image0),u_image1:new o.bH(u,e.u_image1),u_brightness_low:new o.b8(u,e.u_brightness_low),u_brightness_high:new o.b8(u,e.u_brightness_high),u_saturation_factor:new o.b8(u,e.u_saturation_factor),u_contrast_factor:new o.b8(u,e.u_contrast_factor),u_spin_weights:new o.bL(u,e.u_spin_weights),u_coords_top:new o.bK(u,e.u_coords_top),u_coords_bottom:new o.bK(u,e.u_coords_bottom)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texture:new o.bH(u,e.u_texture),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),symbolSDF:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texture:new o.bH(u,e.u_texture),u_gamma_scale:new o.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_is_halo:new o.bH(u,e.u_is_halo),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),symbolTextAndIcon:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texsize_icon:new o.bM(u,e.u_texsize_icon),u_texture:new o.bH(u,e.u_texture),u_texture_icon:new o.bH(u,e.u_texture_icon),u_gamma_scale:new o.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_is_halo:new o.bH(u,e.u_is_halo),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),background:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_color:new o.bI(u,e.u_color)}),backgroundPattern:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_image:new o.bH(u,e.u_image),u_pattern_tl_a:new o.bM(u,e.u_pattern_tl_a),u_pattern_br_a:new o.bM(u,e.u_pattern_br_a),u_pattern_tl_b:new o.bM(u,e.u_pattern_tl_b),u_pattern_br_b:new o.bM(u,e.u_pattern_br_b),u_texsize:new o.bM(u,e.u_texsize),u_mix:new o.b8(u,e.u_mix),u_pattern_size_a:new o.bM(u,e.u_pattern_size_a),u_pattern_size_b:new o.bM(u,e.u_pattern_size_b),u_scale_a:new o.b8(u,e.u_scale_a),u_scale_b:new o.b8(u,e.u_scale_b),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_tile_units_to_pixels:new o.b8(u,e.u_tile_units_to_pixels)}),terrain:(u,e)=>({u_texture:new o.bH(u,e.u_texture),u_ele_delta:new o.b8(u,e.u_ele_delta),u_fog_matrix:new o.bJ(u,e.u_fog_matrix),u_fog_color:new o.bI(u,e.u_fog_color),u_fog_ground_blend:new o.b8(u,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new o.b8(u,e.u_fog_ground_blend_opacity),u_horizon_color:new o.bI(u,e.u_horizon_color),u_horizon_fog_blend:new o.b8(u,e.u_horizon_fog_blend),u_is_globe_mode:new o.b8(u,e.u_is_globe_mode)}),terrainDepth:(u,e)=>({u_ele_delta:new o.b8(u,e.u_ele_delta)}),terrainCoords:(u,e)=>({u_texture:new o.bH(u,e.u_texture),u_terrain_coords_id:new o.b8(u,e.u_terrain_coords_id),u_ele_delta:new o.b8(u,e.u_ele_delta)}),projectionErrorMeasurement:(u,e)=>({u_input:new o.b8(u,e.u_input),u_output_expected:new o.b8(u,e.u_output_expected)}),atmosphere:(u,e)=>({u_sun_pos:new o.bL(u,e.u_sun_pos),u_atmosphere_blend:new o.b8(u,e.u_atmosphere_blend),u_globe_position:new o.bL(u,e.u_globe_position),u_globe_radius:new o.b8(u,e.u_globe_radius),u_inv_proj_matrix:new o.bJ(u,e.u_inv_proj_matrix)}),sky:(u,e)=>({u_sky_color:new o.bI(u,e.u_sky_color),u_horizon_color:new o.bI(u,e.u_horizon_color),u_horizon:new o.bM(u,e.u_horizon),u_horizon_normal:new o.bM(u,e.u_horizon_normal),u_sky_horizon_blend:new o.b8(u,e.u_sky_horizon_blend),u_sky_blend:new o.b8(u,e.u_sky_blend)})};class nh{constructor(e,i,s){this.context=e;const l=e.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const i=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const oc={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ah{constructor(e,i,s,l){this.length=i.length,this.attributes=s,this.itemSize=i.bytesPerElement,this.dynamicDraw=l,this.context=e;const h=e.gl;this.buffer=h.createBuffer(),e.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,i){for(let s=0;s<this.attributes.length;s++){const l=i.attributes[this.attributes[s].name];l!==void 0&&e.enableVertexAttribArray(l)}}setVertexAttribPointers(e,i,s){for(let l=0;l<this.attributes.length;l++){const h=this.attributes[l],f=i.attributes[h.name];f!==void 0&&e.vertexAttribPointer(f,h.components,e[oc[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class At{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class kn extends At{getDefault(){return o.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class lc extends At{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class cc extends At{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class uc extends At{getDefault(){return[!0,!0,!0,!0]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class sh extends At{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class hc extends At{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class ba extends At{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const i=this.current;(e.func!==i.func||e.ref!==i.ref||e.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class dc extends At{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Od extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=e,this.dirty=!1}}class jd extends At{getDefault(){return[0,1]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Nd extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=e,this.dirty=!1}}class Zd extends At{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class oh extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.BLEND):i.disable(i.BLEND),this.current=e,this.dirty=!1}}class Vd extends At{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class lh extends At{getDefault(){return o.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Oo extends At{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class jo extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=e,this.dirty=!1}}class No extends At{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class pc extends At{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class wa extends At{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Zo extends At{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Ka extends At{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Gr extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class ch extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class uh extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindTexture(i.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class fc extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Ta extends At{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Vo extends At{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;er(s)?s.bindVertexArray(e):(i=s.getExtension("OES_vertex_array_object"))===null||i===void 0||i.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class Uo extends At{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Zs extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class $o extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Go extends At{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Ya extends Go{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Ja extends Go{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class hh extends Go{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const qo="Framebuffer is not complete";class xt{constructor(e,i,s,l,h){this.context=e,this.width=i,this.height=s;const f=e.gl,_=this.framebuffer=f.createFramebuffer();if(this.colorAttachment=new Ya(e,_),l)this.depthAttachment=h?new hh(e,_):new Ja(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(qo)}destroy(){const e=this.context.gl,i=this.colorAttachment.get();if(i&&e.deleteTexture(i),this.depthAttachment){const s=this.depthAttachment.get();s&&e.deleteRenderbuffer(s)}e.deleteFramebuffer(this.framebuffer)}}class Ho{constructor(e){var i,s;if(this.gl=e,this.clearColor=new kn(this),this.clearDepth=new lc(this),this.clearStencil=new cc(this),this.colorMask=new uc(this),this.depthMask=new sh(this),this.stencilMask=new hc(this),this.stencilFunc=new ba(this),this.stencilOp=new dc(this),this.stencilTest=new Od(this),this.depthRange=new jd(this),this.depthTest=new Nd(this),this.depthFunc=new Zd(this),this.blend=new oh(this),this.blendFunc=new Vd(this),this.blendColor=new lh(this),this.blendEquation=new Oo(this),this.cullFace=new jo(this),this.cullFaceSide=new No(this),this.frontFace=new pc(this),this.program=new wa(this),this.activeTexture=new Zo(this),this.viewport=new Ka(this),this.bindFramebuffer=new Gr(this),this.bindRenderbuffer=new ch(this),this.bindTexture=new uh(this),this.bindVertexBuffer=new fc(this),this.bindElementBuffer=new Ta(this),this.bindVertexArray=new Vo(this),this.pixelStoreUnpack=new Uo(this),this.pixelStoreUnpackPremultiplyAlpha=new Zs(this),this.pixelStoreUnpackFlipY=new $o(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),er(e)){this.HALF_FLOAT=e.HALF_FLOAT;const l=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(i=e.RGBA16F)!==null&&i!==void 0?i:l==null?void 0:l.RGBA16F_EXT,this.RGB16F=(s=e.RGB16F)!==null&&s!==void 0?s:l==null?void 0:l.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const l=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=l==null?void 0:l.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,i){return new nh(this,e,i)}createVertexBuffer(e,i,s){return new ah(this,e,i,s)}createRenderbuffer(e,i,s){const l=this.gl,h=l.createRenderbuffer();return this.bindRenderbuffer.set(h),l.renderbufferStorage(l.RENDERBUFFER,e,i,s),this.bindRenderbuffer.set(null),h}createFramebuffer(e,i,s,l){return new xt(this,e,i,s,l)}clear({color:e,depth:i,stencil:s}){const l=this.gl;let h=0;e&&(h|=l.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),i!==void 0&&(h|=l.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),s!==void 0&&(h|=l.STENCIL_BUFFER_BIT,this.clearStencil.set(s),this.stencilMask.set(255)),l.clear(h)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){o.bE(e.blendFunction,Vt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return er(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var i;return er(this.gl)?this.gl.deleteVertexArray(e):(i=this.gl.getExtension("OES_vertex_array_object"))===null||i===void 0?void 0:i.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let Wo;function mc(u,e,i,s,l){const h=u.context,f=u.transform,_=h.gl,x=u.useProgram("collisionBox"),T=[];let P=0,A=0;for(let W=0;W<s.length;W++){const K=s[W],te=e.getTile(K).getBucket(i);if(!te)continue;const ee=l?te.textCollisionBox:te.iconCollisionBox,ie=te.collisionCircleArray;ie.length>0&&(T.push({circleArray:ie,circleOffset:A,coord:K}),P+=ie.length/4,A=P),ee&&x.draw(h,_.LINES,lt.disabled,mt.disabled,u.colorModeForRenderPass(),St.disabled,Dd(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),f.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,u.transform.zoom,null,null,ee.collisionVertexBuffer)}if(!l||!T.length)return;const E=u.useProgram("collisionCircle"),F=new o.bT;F.resize(4*P),F._trim();let O=0;for(const W of T)for(let K=0;K<W.circleArray.length/4;K++){const te=4*K,ee=W.circleArray[te+0],ie=W.circleArray[te+1],se=W.circleArray[te+2],re=W.circleArray[te+3];F.emplace(O++,ee,ie,se,re,0),F.emplace(O++,ee,ie,se,re,1),F.emplace(O++,ee,ie,se,re,2),F.emplace(O++,ee,ie,se,re,3)}(!Wo||Wo.length<2*P)&&(Wo=function(W){const K=2*W,te=new o.bV;te.resize(K),te._trim();for(let ee=0;ee<K;ee++){const ie=6*ee;te.uint16[ie+0]=4*ee+0,te.uint16[ie+1]=4*ee+1,te.uint16[ie+2]=4*ee+2,te.uint16[ie+3]=4*ee+2,te.uint16[ie+4]=4*ee+3,te.uint16[ie+5]=4*ee+0}return te}(P));const H=h.createIndexBuffer(Wo,!0),q=h.createVertexBuffer(F,o.bU.members,!0);for(const W of T){const K=Bo(u.transform);E.draw(h,_.TRIANGLES,lt.disabled,mt.disabled,u.colorModeForRenderPass(),St.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),null,i.id,q,H,o.aJ.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}q.destroy(),H.destroy()}const Vs=o.ad(new Float32Array(16));function Ud(u,e,i,s,l,h){const{horizontalAlign:f,verticalAlign:_}=o.aE(u);return new o.P((-(f-.5)*e/l+s[0])*h,(-(_-.5)*i/l+s[1])*h)}function $d(u,e,i,s,l,h){const f=e.tileAnchorPoint.add(new o.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=s.mult(h);i||(_=_.rotate(-l));const x=f.add(_);return we(x.x,x.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=li(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),x=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(s.rotate(x))}return u.add(s)}function dh(u,e,i,s,l,h,f,_,x,T,P,A){const E=u.text.placedSymbolArray,F=u.text.dynamicLayoutVertexArray,O=u.icon.dynamicLayoutVertexArray,H={};F.clear();for(let q=0;q<E.length;q++){const W=E.get(q),K=W.hidden||!W.crossTileID||u.allowVerticalPlacement&&!W.placedOrientation?null:s[W.crossTileID];if(K){const te=new o.P(W.anchorX,W.anchorY),ee={getElevation:A,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:te,translation:T,unwrappedTileID:P},ie=i?ft(te.x,te.y,ee):li(te.x,te.y,ee),se=Lt(l.cameraToCenterDistance,ie.signedDistanceFromCamera);let re=o.am(u.textSizeData,_,W)*se/o.ay;i&&(re*=u.tilePixelRatio/f);const{width:pe,height:Me,anchor:xe,textOffset:ve,textBoxScale:be}=K,Ne=Ud(xe,pe,Me,ve,be,re),Oe=l.getPitchedTextCorrection(te.x+T[0],te.y+T[1],P),Re=$d(ie.point,ee,e,Ne,-l.bearingInRadians,Oe),He=u.allowVerticalPlacement&&W.placedOrientation===o.al.vertical?Math.PI/2:0;for(let gt=0;gt<W.numGlyphs;gt++)o.as(F,Re,He);x&&W.associatedIconIndex>=0&&(H[W.associatedIconIndex]={shiftedAnchor:Re,angle:He})}else En(W.numGlyphs,F)}if(x){O.clear();const q=u.icon.placedSymbolArray;for(let W=0;W<q.length;W++){const K=q.get(W);if(K.hidden)En(K.numGlyphs,O);else{const te=H[W];if(te)for(let ee=0;ee<K.numGlyphs;ee++)o.as(O,te.shiftedAnchor,te.angle);else En(K.numGlyphs,O)}}u.icon.dynamicLayoutVertexBuffer.updateData(O)}u.text.dynamicLayoutVertexBuffer.updateData(F)}function Gd(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Xo(u,e,i,s,l,h,f,_,x,T,P,A,E){const F=u.context,O=F.gl,H=u.transform,q=_==="map",W=x==="map",K=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",te=q&&!W&&!K,ee=!i.layout.get("symbol-sort-key").isConstant();let ie=!1;const se=u.getDepthModeForSublayer(0,lt.ReadOnly),re=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),pe=[],Me=H.getCircleRadiusCorrection();for(const xe of s){const ve=e.getTile(xe),be=ve.getBucket(i);if(!be)continue;const Ne=l?be.text:be.icon;if(!Ne||!Ne.segments.get().length||!Ne.hasVisibleVertices)continue;const Oe=Ne.programConfigurations.get(i.id),Re=l||be.sdfIcons,He=l?be.textSizeData:be.iconSizeData,gt=W||H.pitch!==0,Pt=u.useProgram(Gd(Re,l,be),Oe),ri=o.ak(He,H.zoom),Ut=u.style.map.terrain&&u.style.map.terrain.getTerrainData(xe);let ni,ai,Gt,zt,Ai=[0,0],Bi=null;if(l)ai=ve.glyphAtlasTexture,Gt=O.LINEAR,ni=ve.glyphAtlasTexture.size,be.iconsInText&&(Ai=ve.imageAtlasTexture.size,Bi=ve.imageAtlasTexture,zt=gt||u.options.rotating||u.options.zooming||He.kind==="composite"||He.kind==="camera"?O.LINEAR:O.NEAREST);else{const Mi=i.layout.get("icon-size").constantOr(0)!==1||be.iconsNeedLinear;ai=ve.imageAtlasTexture,Gt=Re||u.options.rotating||u.options.zooming||Mi||gt?O.LINEAR:O.NEAREST,ni=ve.imageAtlasTexture.size}const qi=o.az(ve,1,u.transform.zoom),Rt=Qe(q,u.transform,qi),Kn=o.K();o.an(Kn,Rt);const _n=dt(W,q,u.transform,qi),Yn=o.aA(H,ve,h,f),Pa=H.getProjectionData({overscaledTileID:xe,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),ro=re&&be.hasTextData(),Jn=i.layout.get("icon-text-fit")!=="none"&&ro&&be.hasIconData();if(K){const Mi=u.style.map.terrain?(fr,Kt)=>u.style.map.terrain.getElevation(xe,fr,Kt):null,Si=i.layout.get("text-rotation-alignment")==="map";kt(be,u,l,Rt,Kn,W,T,Si,xe.toUnwrapped(),H.width,H.height,Yn,Mi)}const Ca=l&&re||Jn,Fr=K||Ca?Vs:W?Rt:u.transform.clipSpaceToPixelsMatrix,Qn=Re&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Rn;Rn=Re?be.iconsInText?Fo(He.kind,ri,te,W,K,Ca,u,Fr,_n,Yn,ni,Ai,Me):ih(He.kind,ri,te,W,K,Ca,u,Fr,_n,Yn,l,ni,0,Me):Xa(He.kind,ri,te,W,K,Ca,u,Fr,_n,Yn,l,ni,Me);const ea={program:Pt,buffers:Ne,uniformValues:Rn,projectionData:Pa,atlasTexture:ai,atlasTextureIcon:Bi,atlasInterpolation:Gt,atlasInterpolationIcon:zt,isSDF:Re,hasHalo:Qn};if(ee&&be.canOverlap){ie=!0;const Mi=Ne.segments.get();for(const Si of Mi)pe.push({segments:new o.aJ([Si]),sortKey:Si.sortKey,state:ea,terrainData:Ut})}else pe.push({segments:Ne.segments,sortKey:0,state:ea,terrainData:Ut})}ie&&pe.sort((xe,ve)=>xe.sortKey-ve.sortKey);for(const xe of pe){const ve=xe.state;if(F.activeTexture.set(O.TEXTURE0),ve.atlasTexture.bind(ve.atlasInterpolation,O.CLAMP_TO_EDGE),ve.atlasTextureIcon&&(F.activeTexture.set(O.TEXTURE1),ve.atlasTextureIcon&&ve.atlasTextureIcon.bind(ve.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),ve.isSDF){const be=ve.uniformValues;ve.hasHalo&&(be.u_is_halo=1,Us(ve.buffers,xe.segments,i,u,ve.program,se,P,A,be,ve.projectionData,xe.terrainData)),be.u_is_halo=0}Us(ve.buffers,xe.segments,i,u,ve.program,se,P,A,ve.uniformValues,ve.projectionData,xe.terrainData)}}function Us(u,e,i,s,l,h,f,_,x,T,P){const A=s.context;l.draw(A,A.gl.TRIANGLES,h,f,_,St.backCCW,x,P,T,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function Ko(u,e,i,s,l){const h=u.context,f=h.gl,_=mt.disabled,x=new Vt([f.ONE,f.ONE],o.b7.transparent,[!0,!0,!0,!0]),T=e.getBucket(i);if(!T)return;const P=s.key;let A=i.heatmapFbos.get(P);A||(A=Yo(h,e.tileSize,e.tileSize),i.heatmapFbos.set(P,A)),h.bindFramebuffer.set(A.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.b7.transparent});const E=T.programConfigurations.get(i.id),F=u.useProgram("heatmap",E,!l),O=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),H=u.style.map.terrain.getTerrainData(s);F.draw(h,f.TRIANGLES,lt.disabled,_,x,St.disabled,va(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),H,O,i.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,i.paint,u.transform.zoom,E)}function gc(u,e,i,s,l){const h=u.context,f=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const x=_c(h,e),T=i.key,P=e.heatmapFbos.get(T);if(!P)return;h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,P.colorAttachment.get()),h.activeTexture.set(f.TEXTURE1),x.bind(f.LINEAR,f.CLAMP_TO_EDGE);const A=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,lt.disabled,mt.disabled,u.colorModeForRenderPass(),St.disabled,Wu(u,e,0,1),null,A,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),P.destroy(),e.heatmapFbos.delete(T)}function Yo(u,e,i){var s,l;const h=u.gl,f=h.createTexture();h.bindTexture(h.TEXTURE_2D,f),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);const _=(s=u.HALF_FLOAT)!==null&&s!==void 0?s:h.UNSIGNED_BYTE,x=(l=u.RGBA16F)!==null&&l!==void 0?l:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,x,e,i,0,h.RGBA,_,null);const T=u.createFramebuffer(e,i,!1,!1);return T.colorAttachment.set(f),T}function _c(u,e){return e.colorRampTexture||(e.colorRampTexture=new jt(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function $s(u,e,i,s,l){if(!i||!s||!s.imageAtlas)return;const h=s.imageAtlas.patternPositions;let f=h[i.to.toString()],_=h[i.from.toString()];if(!f&&_&&(f=_),!_&&f&&(_=f),!f||!_){const x=l.getPaintProperty(e);f=h[x],_=h[x]}f&&_&&u.setConstantPatternPositions(f,_)}function Gs(u,e,i,s,l,h,f,_){const x=u.context.gl,T="fill-pattern",P=i.paint.get(T),A=P&&P.constantOr(1),E=i.getCrossfadeParameters();let F,O,H,q,W;const K=u.transform,te=i.paint.get("fill-translate"),ee=i.paint.get("fill-translate-anchor");f?(O=A&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",F=x.LINES):(O=A?"fillPattern":"fill",F=x.TRIANGLES);const ie=P.constantOr(null);for(const se of s){const re=e.getTile(se);if(A&&!re.patternsLoaded())continue;const pe=re.getBucket(i);if(!pe)continue;const Me=pe.programConfigurations.get(i.id),xe=u.useProgram(O,Me),ve=u.style.map.terrain&&u.style.map.terrain.getTerrainData(se);A&&(u.context.activeTexture.set(x.TEXTURE0),re.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),Me.updatePaintBuffers(E)),$s(Me,T,ie,re,i);const be=K.getProjectionData({overscaledTileID:se,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),Ne=o.aA(K,re,te,ee);if(f){q=pe.indexBuffer2,W=pe.segments2;const Re=[x.drawingBufferWidth,x.drawingBufferHeight];H=O==="fillOutlinePattern"&&A?Os(u,E,re,Re,Ne):nc(Re,Ne)}else q=pe.indexBuffer,W=pe.segments,H=A?qu(u,E,re,Ne):{u_fill_translate:Ne};const Oe=u.stencilModeForClipping(se);xe.draw(u.context,F,l,Oe,h,St.backCCW,H,ve,be,i.id,pe.layoutVertexBuffer,q,W,i.paint,u.transform.zoom,Me)}}function qs(u,e,i,s,l,h,f,_){const x=u.context,T=x.gl,P="fill-extrusion-pattern",A=i.paint.get(P),E=A.constantOr(1),F=i.getCrossfadeParameters(),O=i.paint.get("fill-extrusion-opacity"),H=A.constantOr(null),q=u.transform;for(const W of s){const K=e.getTile(W),te=K.getBucket(i);if(!te)continue;const ee=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),ie=te.programConfigurations.get(i.id),se=u.useProgram(E?"fillExtrusionPattern":"fillExtrusion",ie);E&&(u.context.activeTexture.set(T.TEXTURE0),K.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ie.updatePaintBuffers(F));const re=q.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!_,applyTerrainMatrix:!0});$s(ie,P,H,K,i);const pe=o.aA(q,K,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),Me=i.paint.get("fill-extrusion-vertical-gradient"),xe=E?fn(u,Me,O,pe,W,F,K):Lo(u,Me,O,pe);se.draw(x,x.gl.TRIANGLES,l,h,f,St.backCCW,xe,ee,re,i.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,i.paint,u.transform.zoom,ie,u.style.map.terrain&&te.centroidVertexBuffer)}}function yc(u,e,i,s,l,h,f,_,x){var T;const P=u.style.projection,A=u.context,E=u.transform,F=A.gl,O=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],H=u.useProgram("hillshade",null,!1,O),q=!u.options.moving;for(const W of s){const K=e.getTile(W),te=K.fbo;if(!te)continue;const ee=P.getMeshFromTileID(A,W.canonical,_,!0,"raster"),ie=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(W);A.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,te.colorAttachment.get());const se=E.getProjectionData({overscaledTileID:W,aligned:q,applyGlobeMatrix:!x,applyTerrainMatrix:!0});H.draw(A,F.TRIANGLES,h,l[W.overscaledZ],f,St.backCCW,Xu(u,K,i),ie,se,i.id,ee.vertexBuffer,ee.indexBuffer,ee.segments)}}const Hs=[new o.P(0,0),new o.P(o.Z,0),new o.P(o.Z,o.Z),new o.P(0,o.Z)];function Jo(u,e,i,s,l,h,f,_,x=!1,T=!1){const P=s[s.length-1].overscaledZ,A=u.context,E=A.gl,F=u.useProgram("raster"),O=u.transform,H=u.style.projection,q=u.colorModeForRenderPass(),W=!u.options.moving;for(const K of s){const te=u.getDepthModeForSublayer(K.overscaledZ-P,i.paint.get("raster-opacity")===1?lt.ReadWrite:lt.ReadOnly,E.LESS),ee=e.getTile(K);ee.registerFadeDuration(i.paint.get("raster-fade-duration"));const ie=e.findLoadedParent(K,0),se=e.findLoadedSibling(K),re=ph(ee,ie||se||null,e,i,u.transform,u.style.map.terrain);let pe,Me;const xe=i.paint.get("raster-resampling")==="nearest"?E.NEAREST:E.LINEAR;A.activeTexture.set(E.TEXTURE0),ee.texture.bind(xe,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),A.activeTexture.set(E.TEXTURE1),ie?(ie.texture.bind(xe,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),pe=Math.pow(2,ie.tileID.overscaledZ-ee.tileID.overscaledZ),Me=[ee.tileID.canonical.x*pe%1,ee.tileID.canonical.y*pe%1]):ee.texture.bind(xe,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),ee.texture.useMipmap&&A.extTextureFilterAnisotropic&&u.transform.pitch>20&&E.texParameterf(E.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const ve=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),be=O.getProjectionData({overscaledTileID:K,aligned:W,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),Ne=eh(Me||[0,0],pe||1,re,i,_),Oe=H.getMeshFromTileID(A,K.canonical,h,f,"raster");F.draw(A,E.TRIANGLES,te,l?l[K.overscaledZ]:mt.disabled,q,x?St.frontCCW:St.backCCW,Ne,ve,be,i.id,Oe.vertexBuffer,Oe.indexBuffer,Oe.segments)}}function ph(u,e,i,s,l,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const _=Ee.now(),x=(_-u.timeAdded)/f,T=e?(_-e.timeAdded)/f:-1,P=i.getSource(),A=ge(l,{tileSize:P.tileSize,roundZoom:P.roundZoom}),E=!e||Math.abs(e.tileID.overscaledZ-A)>Math.abs(u.tileID.overscaledZ-A),F=E&&u.refreshedUponExpiration?1:o.ae(E?x:1-T,0,1);return u.refreshedUponExpiration&&x>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const Qo=new o.b7(1,0,0,1),xc=new o.b7(0,1,0,1),fh=new o.b7(0,0,1,1),mh=new o.b7(1,0,1,1),el=new o.b7(0,1,1,1);function tl(u,e,i,s){Ws(u,0,e+i/2,u.transform.width,i,s)}function gh(u,e,i,s){Ws(u,e-i/2,0,i,u.transform.height,s)}function Ws(u,e,i,s,l,h){const f=u.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*u.pixelRatio,i*u.pixelRatio,s*u.pixelRatio,l*u.pixelRatio),f.clear({color:h}),_.disable(_.SCISSOR_TEST)}function gi(u,e,i){const s=u.context,l=s.gl,h=u.useProgram("debug"),f=lt.disabled,_=mt.disabled,x=u.colorModeForRenderPass(),T="$debug",P=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(l.TEXTURE0);const A=e.getTileByID(i.key).latestRawTileData,E=Math.floor((A&&A.byteLength||0)/1024),F=e.getTile(i).tileSize,O=512/Math.min(F,512)*(i.overscaledZ/u.transform.zoom)*.5;let H=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(H+=` => ${i.overscaledZ}`),function(W,K){W.initDebugOverlayCanvas();const te=W.debugOverlayCanvas,ee=W.context.gl,ie=W.debugOverlayCanvas.getContext("2d");ie.clearRect(0,0,te.width,te.height),ie.shadowColor="white",ie.shadowBlur=2,ie.lineWidth=1.5,ie.strokeStyle="white",ie.textBaseline="top",ie.font="bold 36px Open Sans, sans-serif",ie.fillText(K,5,5),ie.strokeText(K,5,5),W.debugOverlayTexture.update(te),W.debugOverlayTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE)}(u,`${H} ${E}kB`);const q=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,l.TRIANGLES,f,_,Vt.alphaBlended,St.disabled,Hu(o.b7.transparent,O),null,q,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,l.LINE_STRIP,f,_,x,St.disabled,Hu(o.b7.red),P,q,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function Xn(u,e,i,s){const{isRenderingGlobe:l}=s,h=u.context,f=h.gl,_=u.transform,x=u.colorModeForRenderPass(),T=u.getDepthModeFor3D(),P=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const A of i){const E=e.getTerrainMesh(A.tileID),F=u.renderToTexture.getTexture(A),O=e.getTerrainData(A.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,F.texture);const H=e.getMeshFrameDelta(_.zoom),q=_.calculateFogMatrix(A.tileID.toUnwrapped()),W=Rd(H,q,u.style.sky,_.pitch,l),K=_.getProjectionData({overscaledTileID:A.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(h,f.TRIANGLES,T,mt.disabled,x,St.backCCW,W,O,K,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}}function Br(u,e){if(!e.mesh){const i=new o.aI;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const s=new o.aK;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),e.mesh=new Ua(u.createVertexBuffer(i,hr.members),u.createIndexBuffer(s),o.aJ.simpleSegment(0,0,i.length,s.length))}return e.mesh}class vc{constructor(e,i){this.context=new Ho(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.ad(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=de.maxUnderzooming+de.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Is}resize(e,i,s){if(this.width=Math.floor(e*s),this.height=Math.floor(i*s),this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const l of this.style._order)this.style._layers[l].resize()}setup(){const e=this.context,i=new o.aI;i.emplaceBack(0,0),i.emplaceBack(o.Z,0),i.emplaceBack(0,o.Z),i.emplaceBack(o.Z,o.Z),this.tileExtentBuffer=e.createVertexBuffer(i,hr.members),this.tileExtentSegments=o.aJ.simpleSegment(0,0,4,2);const s=new o.aI;s.emplaceBack(0,0),s.emplaceBack(o.Z,0),s.emplaceBack(0,o.Z),s.emplaceBack(o.Z,o.Z),this.debugBuffer=e.createVertexBuffer(s,hr.members),this.debugSegments=o.aJ.simpleSegment(0,0,4,5);const l=new o.b_;l.emplaceBack(0,0,0,0),l.emplaceBack(o.Z,0,o.Z,0),l.emplaceBack(0,o.Z,0,o.Z),l.emplaceBack(o.Z,o.Z,o.Z,o.Z),this.rasterBoundsBuffer=e.createVertexBuffer(l,kd.members),this.rasterBoundsSegments=o.aJ.simpleSegment(0,0,4,2);const h=new o.aI;h.emplaceBack(0,0),h.emplaceBack(o.Z,0),h.emplaceBack(0,o.Z),h.emplaceBack(o.Z,o.Z),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(h,hr.members),this.rasterBoundsSegmentsPosOnly=o.aJ.simpleSegment(0,0,4,5);const f=new o.aI;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,hr.members),this.viewportSegments=o.aJ.simpleSegment(0,0,4,2);const _=new o.b$;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const x=new o.aK;x.emplaceBack(1,0,2),x.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(x);const T=this.context.gl;this.stencilClearMode=new mt({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.tileExtentMesh=new Ua(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=o.K();o.bQ(s,0,this.width,this.height,0,0,1),o.M(s,s,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const l={mainMatrix:s,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,lt.disabled,this.stencilClearMode,Vt.disabled,St.disabled,null,null,l,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,i,s){if(this.currentStencilSource===e.source||!e.isTileClipped()||!i||!i.length)return;this.currentStencilSource=e.source,this.nextStencilID+i.length>256&&this.clearStencil();const l=this.context;l.setColorMode(Vt.disabled),l.setDepthMode(lt.disabled);const h={};for(const f of i)h[f.key]=this.nextStencilID++;this._renderTileMasks(h,i,s,!0),this._renderTileMasks(h,i,s,!1),this._tileClippingMaskIDs=h}_renderTileMasks(e,i,s,l){const h=this.context,f=h.gl,_=this.style.projection,x=this.transform,T=this.useProgram("clippingMask");for(const P of i){const A=e[P.key],E=this.style.map.terrain&&this.style.map.terrain.getTerrainData(P),F=_.getMeshFromTileID(this.context,P.canonical,l,!0,"stencil"),O=x.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!s,applyTerrainMatrix:!0});T.draw(h,f.TRIANGLES,lt.disabled,new mt({func:f.ALWAYS,mask:0},A,255,f.KEEP,f.KEEP,f.REPLACE),Vt.disabled,s?St.disabled:St.backCCW,null,E,O,"$clipping",F.vertexBuffer,F.indexBuffer,F.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,s=this.style.projection,l=this.transform,h=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=oe(l,{tileSize:l.tileSize});for(const x of _){const T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x),P=s.getMeshFromTileID(this.context,x.canonical,!0,!0,"raster"),A=l.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,mt.disabled,Vt.disabled,St.backCCW,null,T,A,"$clipping",P.vertexBuffer,P.indexBuffer,P.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new mt({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new mt({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const f={};for(let _=0;_<h;_++)f[_+l]=new mt({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[l]:mt.disabled},s]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(this.clearStencil(),h>1){const f={},_={};for(let x=0;x<h;x++)f[x+l]=new mt({func:i.GREATER,mask:255},h+1+x,255,i.KEEP,i.KEEP,i.REPLACE),_[x+l]=new mt({func:i.GREATER,mask:255},1+x,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[f,_,s]}return this.nextStencilID=3,[{[l]:new mt({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new mt({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Vt([e.CONSTANT_COLOR,e.ONE],new o.b7(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Vt.unblended:Vt.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return lt.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new lt(s||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new lt(this.context.gl.LEQUAL,lt.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var s,l;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(Ee.now()),this.imageManager.beginFrame();const h=this.style._order,f=this.style.sourceCaches,_={},x={},T={},P={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const E in f){const F=f[E];F.used&&F.prepare(this.context),_[E]=F.getVisibleCoordinates(!1),x[E]=_[E].slice().reverse(),T[E]=F.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let E=0;E<h.length;E++)if(this.style._layers[h[E]].is3D()){this.opaquePassCutoff=E;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const E of h){const F=this.style._layers[E];if(!F.hasOffscreenPass()||F.isHidden(this.transform.zoom))continue;const O=x[F.source];(F.type==="custom"||O.length)&&this.renderLayer(this,f[F.source],F,O,P)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:E=>this.useProgram(E)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?o.b7.black:o.b7.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(E,F){const O=E.context,H=O.gl,q=((se,re,pe)=>{const Me=Math.cos(re.rollInRadians),xe=Math.sin(re.rollInRadians),ve=ce(re),be=re.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:se.properties.get("sky-color"),u_horizon_color:se.properties.get("horizon-color"),u_horizon:[(re.width/2-ve*xe)*pe,(re.height/2+ve*Me)*pe],u_horizon_normal:[-xe,Me],u_sky_horizon_blend:se.properties.get("sky-horizon-blend")*re.height/2*pe,u_sky_blend:be}})(F,E.style.map.transform,E.pixelRatio),W=new lt(H.LEQUAL,lt.ReadWrite,[0,1]),K=mt.disabled,te=E.colorModeForRenderPass(),ee=E.useProgram("sky"),ie=Br(O,F);ee.draw(O,H.TRIANGLES,W,K,te,St.disabled,q,null,void 0,"sky",ie.vertexBuffer,ie.indexBuffer,ie.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=h.length-1;this.currentLayer>=0;this.currentLayer--){const E=this.style._layers[h[this.currentLayer]],F=f[E.source],O=_[E.source];this._renderTileClippingMasks(E,O,!1),this.renderLayer(this,F,E,O,P)}this.renderPass="translucent";let A=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const E=this.style._layers[h[this.currentLayer]],F=f[E.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(E,P))continue;this.opaquePassEnabledForLayer()||A||(A=!0,P.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const O=(E.type==="symbol"?T:x)[E.source];this._renderTileClippingMasks(E,_[E.source],!!this.renderToTexture),this.renderLayer(this,F,E,O,P)}if(P.isRenderingGlobe&&function(E,F,O){const H=E.context,q=H.gl,W=E.useProgram("atmosphere"),K=new lt(q.LEQUAL,lt.ReadOnly,[0,1]),te=E.transform,ee=function(be,Ne){const Oe=be.properties.get("position"),Re=[-Oe.x,-Oe.y,-Oe.z],He=o.ad(new Float64Array(16));return be.properties.get("anchor")==="map"&&(o.a_(He,He,Ne.rollInRadians),o.a$(He,He,-Ne.pitchInRadians),o.a_(He,He,Ne.bearingInRadians),o.a$(He,He,Ne.center.lat*Math.PI/180),o.bp(He,He,-Ne.center.lng*Math.PI/180)),o.bZ(Re,Re,He),Re}(O,E.transform),ie=te.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),se=F.properties.get("atmosphere-blend")*ie.projectionTransition;if(se===0)return;const re=_a(te.worldSize,te.center.lat),pe=te.inverseProjectionMatrix,Me=new Float64Array(4);Me[3]=1,o.at(Me,Me,te.modelViewProjectionMatrix),Me[0]/=Me[3],Me[1]/=Me[3],Me[2]/=Me[3],Me[3]=1,o.at(Me,Me,pe),Me[0]/=Me[3],Me[1]/=Me[3],Me[2]/=Me[3],Me[3]=1;const xe=((be,Ne,Oe,Re,He)=>({u_sun_pos:be,u_atmosphere_blend:Ne,u_globe_position:Oe,u_globe_radius:Re,u_inv_proj_matrix:He}))(ee,se,[Me[0],Me[1],Me[2]],re,pe),ve=Br(H,F);W.draw(H,q.TRIANGLES,K,mt.disabled,Vt.alphaBlended,St.disabled,xe,null,null,"atmosphere",ve.vertexBuffer,ve.indexBuffer,ve.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const E=function(F,O){let H=null;const q=Object.values(F._layers).flatMap(ee=>ee.source&&!ee.isHidden(O)?[F.sourceCaches[ee.source]]:[]),W=q.filter(ee=>ee.getSource().type==="vector"),K=q.filter(ee=>ee.getSource().type!=="vector"),te=ee=>{(!H||H.getSource().maxzoom<ee.getSource().maxzoom)&&(H=ee)};return W.forEach(ee=>te(ee)),H||K.forEach(ee=>te(ee)),H}(this.style,this.transform.zoom);E&&function(F,O,H){for(let q=0;q<H.length;q++)gi(F,O,H[q])}(this,E,E.getVisibleCoordinates())}this.options.showPadding&&function(E){const F=E.transform.padding;tl(E,E.transform.height-(F.top||0),3,Qo),tl(E,F.bottom||0,3,xc),gh(E,F.left||0,3,fh),gh(E,E.transform.width-(F.right||0),3,mh);const O=E.transform.centerPoint;(function(H,q,W,K){Ws(H,q-1,W-10,2,20,K),Ws(H,q-10,W-1,20,2,K)})(E,O.x,E.transform.height-O.y,el)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,s=this.transform.modelViewProjectionMatrix;let l=this.terrainFacilitator.dirty;l||(l=e?!o.c0(i,s):!o.c1(i,s)),l||(l=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(o.c2(i,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,f){const _=h.context,x=_.gl,T=h.transform,P=Vt.unblended,A=new lt(x.LEQUAL,lt.ReadWrite,[0,1]),E=f.sourceCache.getRenderableTiles(),F=h.useProgram("terrainDepth");_.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.b7.transparent,depth:1});for(const O of E){const H=f.getTerrainMesh(O.tileID),q=f.getTerrainData(O.tileID),W=T.getProjectionData({overscaledTileID:O.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),K={u_ele_delta:f.getMeshFrameDelta(T.zoom)};F.draw(_,x.TRIANGLES,A,mt.disabled,P,St.backCCW,K,q,W,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,f){const _=h.context,x=_.gl,T=h.transform,P=Vt.unblended,A=new lt(x.LEQUAL,lt.ReadWrite,[0,1]),E=f.getCoordsTexture(),F=f.sourceCache.getRenderableTiles(),O=h.useProgram("terrainCoords");_.bindFramebuffer.set(f.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.b7.transparent,depth:1}),f.coordsIndex=[];for(const H of F){const q=f.getTerrainMesh(H.tileID),W=f.getTerrainData(H.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,E.texture);const K={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(T.zoom)},te=T.getProjectionData({overscaledTileID:H.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});O.draw(_,x.TRIANGLES,A,mt.disabled,P,St.backCCW,K,W,te,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),f.coordsIndex.push(H.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(e,i,s,l,h){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(l||[]).length)&&(this.id=s.id,o.c3(s)?function(f,_,x,T,P,A){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=A,F=mt.disabled,O=f.colorModeForRenderPass();(x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(H,q,W,K,te,ee,ie,se,re){const pe=q.transform,Me=q.style.map.terrain,xe=te==="map",ve=ee==="map";for(const be of H){const Ne=K.getTile(be),Oe=Ne.getBucket(W);if(!Oe||!Oe.text||!Oe.text.segments.get().length)continue;const Re=o.ak(Oe.textSizeData,pe.zoom),He=o.az(Ne,1,q.transform.zoom),gt=Qe(xe,q.transform,He),Pt=W.layout.get("icon-text-fit")!=="none"&&Oe.hasIconData();if(Re){const ri=Math.pow(2,pe.zoom-Ne.tileID.overscaledZ),Ut=Me?(ni,ai)=>Me.getElevation(be,ni,ai):null;dh(Oe,xe,ve,re,pe,gt,ri,Re,Pt,o.aA(pe,Ne,ie,se),be.toUnwrapped(),Ut)}}}(T,f,x,_,x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),P),x.paint.get("icon-opacity").constantOr(1)!==0&&Xo(f,_,x,T,!1,x.paint.get("icon-translate"),x.paint.get("icon-translate-anchor"),x.layout.get("icon-rotation-alignment"),x.layout.get("icon-pitch-alignment"),x.layout.get("icon-keep-upright"),F,O,E),x.paint.get("text-opacity").constantOr(1)!==0&&Xo(f,_,x,T,!0,x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.layout.get("text-keep-upright"),F,O,E),_.map.showCollisionBoxes&&(mc(f,_,x,T,!0),mc(f,_,x,T,!1))}(e,i,s,l,this.style.placement.variableOffsets,h):o.c4(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=P,E=x.paint.get("circle-opacity"),F=x.paint.get("circle-stroke-width"),O=x.paint.get("circle-stroke-opacity"),H=!x.layout.get("circle-sort-key").isConstant();if(E.constantOr(1)===0&&(F.constantOr(1)===0||O.constantOr(1)===0))return;const q=f.context,W=q.gl,K=f.transform,te=f.getDepthModeForSublayer(0,lt.ReadOnly),ee=mt.disabled,ie=f.colorModeForRenderPass(),se=[],re=K.getCircleRadiusCorrection();for(let pe=0;pe<T.length;pe++){const Me=T[pe],xe=_.getTile(Me),ve=xe.getBucket(x);if(!ve)continue;const be=x.paint.get("circle-translate"),Ne=x.paint.get("circle-translate-anchor"),Oe=o.aA(K,xe,be,Ne),Re=ve.programConfigurations.get(x.id),He=f.useProgram("circle",Re),gt=ve.layoutVertexBuffer,Pt=ve.indexBuffer,ri=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Me),Ut={programConfiguration:Re,program:He,layoutVertexBuffer:gt,indexBuffer:Pt,uniformValues:js(f,xe,x,Oe,re),terrainData:ri,projectionData:K.getProjectionData({overscaledTileID:Me,applyGlobeMatrix:!A,applyTerrainMatrix:!0})};if(H){const ni=ve.segments.get();for(const ai of ni)se.push({segments:new o.aJ([ai]),sortKey:ai.sortKey,state:Ut})}else se.push({segments:ve.segments,sortKey:0,state:Ut})}H&&se.sort((pe,Me)=>pe.sortKey-Me.sortKey);for(const pe of se){const{programConfiguration:Me,program:xe,layoutVertexBuffer:ve,indexBuffer:be,uniformValues:Ne,terrainData:Oe,projectionData:Re}=pe.state;xe.draw(q,W.TRIANGLES,te,ee,ie,St.backCCW,Ne,Oe,Re,x.id,ve,be,pe.segments,x.paint,f.transform.zoom,Me)}}(e,i,s,l,h):o.c5(s)?function(f,_,x,T,P){if(x.paint.get("heatmap-opacity")===0)return;const A=f.context,{isRenderingToTexture:E,isRenderingGlobe:F}=P;if(f.style.map.terrain){for(const O of T){const H=_.getTile(O);_.hasRenderableParent(O)||(f.renderPass==="offscreen"?Ko(f,H,x,O,F):f.renderPass==="translucent"&&gc(f,x,O,E,F))}A.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(O,H,q,W){const K=O.context,te=K.gl,ee=O.transform,ie=mt.disabled,se=new Vt([te.ONE,te.ONE],o.b7.transparent,[!0,!0,!0,!0]);(function(re,pe,Me){const xe=re.gl;re.activeTexture.set(xe.TEXTURE1),re.viewport.set([0,0,pe.width/4,pe.height/4]);let ve=Me.heatmapFbos.get(o.bW);ve?(xe.bindTexture(xe.TEXTURE_2D,ve.colorAttachment.get()),re.bindFramebuffer.set(ve.framebuffer)):(ve=Yo(re,pe.width/4,pe.height/4),Me.heatmapFbos.set(o.bW,ve))})(K,O,q),K.clear({color:o.b7.transparent});for(let re=0;re<W.length;re++){const pe=W[re];if(H.hasRenderableParent(pe))continue;const Me=H.getTile(pe),xe=Me.getBucket(q);if(!xe)continue;const ve=xe.programConfigurations.get(q.id),be=O.useProgram("heatmap",ve),Ne=ee.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Oe=ee.getCircleRadiusCorrection();be.draw(K,te.TRIANGLES,lt.disabled,ie,se,St.backCCW,va(Me,ee.zoom,q.paint.get("heatmap-intensity"),Oe),null,Ne,q.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,q.paint,ee.zoom,ve)}K.viewport.set([0,0,O.width,O.height])}(f,_,x,T):f.renderPass==="translucent"&&function(O,H){const q=O.context,W=q.gl;q.setColorMode(O.colorModeForRenderPass());const K=H.heatmapFbos.get(o.bW);K&&(q.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,K.colorAttachment.get()),q.activeTexture.set(W.TEXTURE1),_c(q,H).bind(W.LINEAR,W.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(q,W.TRIANGLES,lt.disabled,mt.disabled,O.colorModeForRenderPass(),St.disabled,Wu(O,H,0,1),null,null,H.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,H.paint,O.transform.zoom))}(f,x)}(e,i,s,l,h):o.c6(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=P,E=x.paint.get("line-opacity"),F=x.paint.get("line-width");if(E.constantOr(1)===0||F.constantOr(1)===0)return;const O=f.getDepthModeForSublayer(0,lt.ReadOnly),H=f.colorModeForRenderPass(),q=x.paint.get("line-dasharray"),W=x.paint.get("line-pattern"),K=W.constantOr(1),te=x.paint.get("line-gradient"),ee=x.getCrossfadeParameters(),ie=K?"linePattern":q?"lineSDF":te?"lineGradient":"line",se=f.context,re=se.gl,pe=f.transform;let Me=!0;for(const xe of T){const ve=_.getTile(xe);if(K&&!ve.patternsLoaded())continue;const be=ve.getBucket(x);if(!be)continue;const Ne=be.programConfigurations.get(x.id),Oe=f.context.program.get(),Re=f.useProgram(ie,Ne),He=Me||Re.program!==Oe,gt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(xe),Pt=W.constantOr(null);if(Pt&&ve.imageAtlas){const Gt=ve.imageAtlas,zt=Gt.patternPositions[Pt.to.toString()],Ai=Gt.patternPositions[Pt.from.toString()];zt&&Ai&&Ne.setConstantPatternPositions(zt,Ai)}const ri=pe.getProjectionData({overscaledTileID:xe,applyGlobeMatrix:!A,applyTerrainMatrix:!0}),Ut=pe.getPixelScale(),ni=K?Ju(f,ve,x,Ut,ee):q?Qu(f,ve,x,Ut,q,ee):te?Yu(f,ve,x,Ut,be.lineClipsArray.length):Ns(f,ve,x,Ut);if(K)se.activeTexture.set(re.TEXTURE0),ve.imageAtlasTexture.bind(re.LINEAR,re.CLAMP_TO_EDGE),Ne.updatePaintBuffers(ee);else if(q&&(He||f.lineAtlas.dirty))se.activeTexture.set(re.TEXTURE0),f.lineAtlas.bind(se);else if(te){const Gt=be.gradients[x.id];let zt=Gt.texture;if(x.gradientVersion!==Gt.version){let Ai=256;if(x.stepInterpolant){const Bi=_.getSource().maxzoom,qi=xe.canonical.z===Bi?Math.ceil(1<<f.transform.maxZoom-xe.canonical.z):1;Ai=o.ae(o.bX(be.maxLineLength/o.Z*1024*qi),256,se.maxTextureSize)}Gt.gradient=o.bY({expression:x.gradientExpression(),evaluationKey:"lineProgress",resolution:Ai,image:Gt.gradient||void 0,clips:be.lineClipsArray}),Gt.texture?Gt.texture.update(Gt.gradient):Gt.texture=new jt(se,Gt.gradient,re.RGBA),Gt.version=x.gradientVersion,zt=Gt.texture}se.activeTexture.set(re.TEXTURE0),zt.bind(x.stepInterpolant?re.NEAREST:re.LINEAR,re.CLAMP_TO_EDGE)}const ai=f.stencilModeForClipping(xe);Re.draw(se,re.TRIANGLES,O,ai,H,St.disabled,ni,gt,ri,x.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,x.paint,f.transform.zoom,Ne,be.layoutVertexBuffer2),Me=!1}}(e,i,s,l,h):o.c7(s)?function(f,_,x,T,P){const A=x.paint.get("fill-color"),E=x.paint.get("fill-opacity");if(E.constantOr(1)===0)return;const{isRenderingToTexture:F}=P,O=f.colorModeForRenderPass(),H=x.paint.get("fill-pattern"),q=f.opaquePassEnabledForLayer()&&!H.constantOr(1)&&A.constantOr(o.b7.transparent).a===1&&E.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===q){const W=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?lt.ReadWrite:lt.ReadOnly);Gs(f,_,x,T,W,O,!1,F)}if(f.renderPass==="translucent"&&x.paint.get("fill-antialias")){const W=f.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,lt.ReadOnly);Gs(f,_,x,T,W,O,!0,F)}}(e,i,s,l,h):o.c8(s)?function(f,_,x,T,P){const A=x.paint.get("fill-extrusion-opacity");if(A===0)return;const{isRenderingToTexture:E}=P;if(f.renderPass==="translucent"){const F=new lt(f.context.gl.LEQUAL,lt.ReadWrite,f.depthRangeFor3D);if(A!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))qs(f,_,x,T,F,mt.disabled,Vt.disabled,E),qs(f,_,x,T,F,f.stencilModeFor3D(),f.colorModeForRenderPass(),E);else{const O=f.colorModeForRenderPass();qs(f,_,x,T,F,mt.disabled,O,E)}}}(e,i,s,l,h):o.c9(s)?function(f,_,x,T,P){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=P,E=f.context,F=f.style.projection.useSubdivision,O=f.getDepthModeForSublayer(0,lt.ReadOnly),H=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(q,W,K,te,ee,ie,se){const re=q.context,pe=re.gl;for(const Me of K){const xe=W.getTile(Me),ve=xe.dem;if(!ve||!ve.data||!xe.needsHillshadePrepare)continue;const be=ve.dim,Ne=ve.stride,Oe=ve.getPixels();if(re.activeTexture.set(pe.TEXTURE1),re.pixelStoreUnpackPremultiplyAlpha.set(!1),xe.demTexture=xe.demTexture||q.getTileTexture(Ne),xe.demTexture){const He=xe.demTexture;He.update(Oe,{premultiply:!1}),He.bind(pe.NEAREST,pe.CLAMP_TO_EDGE)}else xe.demTexture=new jt(re,Oe,pe.RGBA,{premultiply:!1}),xe.demTexture.bind(pe.NEAREST,pe.CLAMP_TO_EDGE);re.activeTexture.set(pe.TEXTURE0);let Re=xe.fbo;if(!Re){const He=new jt(re,{width:be,height:be,data:null},pe.RGBA);He.bind(pe.LINEAR,pe.CLAMP_TO_EDGE),Re=xe.fbo=re.createFramebuffer(be,be,!0,!1),Re.colorAttachment.set(He.texture)}re.bindFramebuffer.set(Re.framebuffer),re.viewport.set([0,0,be,be]),q.useProgram("hillshadePrepare").draw(re,pe.TRIANGLES,ee,ie,se,St.disabled,Ld(xe.tileID,ve),null,null,te.id,q.rasterBoundsBuffer,q.quadTriangleIndexBuffer,q.rasterBoundsSegments),xe.needsHillshadePrepare=!1}})(f,_,T,x,O,mt.disabled,H),E.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(F){const[q,W,K]=f.stencilConfigForOverlapTwoPass(T);yc(f,_,x,K,q,O,H,!1,A),yc(f,_,x,K,W,O,H,!0,A)}else{const[q,W]=f.getStencilConfigForOverlapAndUpdateStencilID(T);yc(f,_,x,W,q,O,H,!1,A)}}(e,i,s,l,h):o.ca(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent"||x.paint.get("raster-opacity")===0||!T.length)return;const{isRenderingToTexture:A}=P,E=_.getSource(),F=f.style.projection.useSubdivision;if(E instanceof Ce)Jo(f,_,x,T,null,!1,!1,E.tileCoords,E.flippedWindingOrder,A);else if(F){const[O,H,q]=f.stencilConfigForOverlapTwoPass(T);Jo(f,_,x,q,O,!1,!0,Hs,!1,A),Jo(f,_,x,q,H,!0,!0,Hs,!1,A)}else{const[O,H]=f.getStencilConfigForOverlapAndUpdateStencilID(T);Jo(f,_,x,H,O,!1,!0,Hs,!1,A)}}(e,i,s,l,h):o.cb(s)?function(f,_,x,T,P){const A=x.paint.get("background-color"),E=x.paint.get("background-opacity");if(E===0)return;const{isRenderingToTexture:F}=P,O=f.context,H=O.gl,q=f.style.projection,W=f.transform,K=W.tileSize,te=x.paint.get("background-pattern");if(f.isPatternMissing(te))return;const ee=!te&&A.a===1&&E===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==ee)return;const ie=mt.disabled,se=f.getDepthModeForSublayer(0,ee==="opaque"?lt.ReadWrite:lt.ReadOnly),re=f.colorModeForRenderPass(),pe=f.useProgram(te?"backgroundPattern":"background"),Me=T||oe(W,{tileSize:K,terrain:f.style.map.terrain});te&&(O.activeTexture.set(H.TEXTURE0),f.imageManager.bind(f.context));const xe=x.getCrossfadeParameters();for(const ve of Me){const be=W.getProjectionData({overscaledTileID:ve,applyGlobeMatrix:!F,applyTerrainMatrix:!0}),Ne=te?Fd(E,f,te,{tileID:ve,tileSize:K},xe):Bd(E,A),Oe=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ve),Re=q.getMeshFromTileID(O,ve.canonical,!1,!0,"raster");pe.draw(O,H.TRIANGLES,se,ie,re,St.backCCW,Ne,Oe,be,x.id,Re.vertexBuffer,Re.indexBuffer,Re.segments)}}(e,0,s,l,h):o.cc(s)&&function(f,_,x,T){const{isRenderingGlobe:P}=T,A=f.context,E=x.implementation,F=f.style.projection,O=f.transform,H=O.getProjectionDataForCustomLayer(P),q={farZ:O.farZ,nearZ:O.nearZ,fov:O.fov*Math.PI/180,modelViewProjectionMatrix:O.modelViewProjectionMatrix,projectionMatrix:O.projectionMatrix,shaderData:{variantName:F.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
741
741
  uniform mat4 u_projection_matrix;
742
- ${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:H},W=E.renderingMode?E.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=E.prerender;K&&(f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),K.call(E,A.gl,q),A.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),A.setStencilMode(mt.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,lt.ReadOnly);A.setDepthMode(K),E.render(A.gl,q),A.setDirty(),f.setBaseState(),A.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1,l=[]){this.cache=this.cache||{};const h=!!this.style.map.terrain,f=this.style.projection,_=s?ur.projectionMercator:f.shaderPreludeCode,x=s?ma:f.shaderDefine,T=e+(i?i.cacheKey:"")+`/${s?Mt:f.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(h?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[T]||(this.cache[T]=new Ro(this.context,ur[e],i,rh[e],this._showOverdrawInspector,h,_,x,l)),this.cache[T]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new jt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:i}=this.context.gl;return this.width!==e||this.height!==i}}function Xs(u,e){let i,s=!1,l=null,h=null;const f=()=>{l=null,s&&(u.apply(h,i),l=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,l||f(),l)}class bc{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let s;return i.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(s=l)}),(s&&s[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:s,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const s=i.join("/");let l=s;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${s}`);let h=window.location.hash.replace(l,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let f=window.location.href.replace(/(#.+)?$/,h);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=Xs(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(P+="/"+Math.round(10*x)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const A=this._hashName;let E=!1;const F=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===A?(E=!0,`${H}=${P}`):O}).filter(O=>O);return E||F.push(`${A}=${P}`),`#${F.join("&")}`}return`#${P}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.Q(+e[2],+e[1])}catch{return!1}const i=+e[0],s=+(e[3]||0),l=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&s>=-180&&s<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const mn={linearity:.3,easing:o.cd(0,0,.3,1)},wc=o.e({deceleration:2500,maxSpeed:1400},mn),Ks=o.e({deceleration:20,maxSpeed:1400},mn),Tc=o.e({deceleration:1e3,maxSpeed:360},mn),_h=o.e({deceleration:1e3,maxSpeed:90},mn),yh=o.e({deceleration:1e3,maxSpeed:360},mn);class xh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ee.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ee.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)i.zoom+=h.zoomDelta||0,i.bearing+=h.bearingDelta||0,i.pitch+=h.pitchDelta||0,i.roll+=h.rollDelta||0,h.panDelta&&i.pan._add(h.panDelta),h.around&&(i.around=h.around),h.pinchAround&&(i.pinchAround=h.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(i.pan.mag()){const h=es(i.pan.mag(),s,o.e({},wc,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,Qa(l,h)}if(i.zoom){const h=es(i.zoom,s,Ks);l.zoom=this._map.transform.zoom+h.amount,Qa(l,h)}if(i.bearing){const h=es(i.bearing,s,Tc);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),Qa(l,h)}if(i.pitch){const h=es(i.pitch,s,_h);l.pitch=this._map.transform.pitch+h.amount,Qa(l,h)}if(i.roll){const h=es(i.roll,s,yh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),Qa(l,h)}if(l.zoom||l.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;l.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),o.e(l,{noMoveStart:!0})}}function Qa(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function es(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class Ei extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s,l={}){s=s instanceof MouseEvent?s:new MouseEvent(e,s);const h=le.mousePos(i.getCanvas(),s),f=i.unproject(h);super(e,o.e({point:h,lngLat:f,originalEvent:s},l)),this._defaultPrevented=!1,this.target=i}}class ts extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){const l=e==="touchend"?s.changedTouches:s.touches,h=le.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,P,A)=>x.add(T.div(A.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class Mc extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class vh{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Mc(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new Ei(e.type,this._map,e))}mouseup(e){this._map.fire(new Ei(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new Ei(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ei(e.type,this._map,e))}mouseover(e){this._map.fire(new Ei(e.type,this._map,e))}mouseout(e){this._map.fire(new Ei(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ts(e.type,this._map,e))}touchmove(e){this._map.fire(new ts(e.type,this._map,e))}touchend(e){this._map.fire(new ts(e.type,this._map,e))}touchcancel(e){this._map.fire(new ts(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class bh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ei(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ei("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ei(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class is{constructor(e){this._map=e}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(e){return this.transform.screenPointToLocation(o.P.convert(e),this._map.terrain)}}class Sc{constructor(e,i){this._map=e,this._tr=new is(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(le.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const s=i;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=s,this._box||(this._box=le.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);le.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),le.suppressClick(),s.x!==l.x||s.y!==l.y)return this._map.fire(new o.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(s,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(le.remove(this._box),this._box=null),le.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function il(u,e){if(u.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${e.length}`);const i={};for(let s=0;s<u.length;s++)i[u[s].identifier]=e[s];return i}class wh{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(l){const h=new o.P(0,0);for(const f of l)h._add(f);return h.div(l.length)}(i),this.touches=il(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=il(s,i);for(const h in this.touches){const f=l[h];(!f||f.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(e,i,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class rs{constructor(e){this.singleTap=new wh(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,s){this.singleTap.touchstart(e,i,s)}touchmove(e,i,s){this.singleTap.touchmove(e,i,s)}touchend(e,i,s){const l=this.singleTap.touchend(e,i,s);if(l){const h=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(l)<30;if(h&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class Th{constructor(e){this._tr=new is(e),this._zoomIn=new rs({numTouches:1,numTaps:2}),this._zoomOut=new rs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const l=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(h)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ir{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(i)?i[0]:i;return!this._moved&&l.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(s,l))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&le.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Qr={0:1,2:2};class ns{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=le.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=Qr[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return le.mouseButton(e)===this._eventButton}}class en{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class as{constructor(e=new ns({checkCorrectEvent:()=>!0}),i=new en){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,s){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?s(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const rl=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class qd{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,s){return this._calculateTransform(e,i,s)}touchmove(e,i,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,i,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,s){this._calculateTransform(e,i,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,s){s.length>0&&(this._active=!0);const l=il(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const P=l[T],A=this._touches[T];A&&(h._add(P),f._add(P.sub(A)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const x=f.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pc{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,s){if(!this._firstTwoTouches)return;e.preventDefault();const[l,h]=this._firstTwoTouches,f=nl(s,i,l),_=nl(s,i,h);if(!f||!_)return;const x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=nl(s,i,l),_=nl(s,i,h);f&&_||(this._active&&le.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function nl(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function Cc(u,e){return Math.log(u/e)/Math.LN2}class ss extends Pc{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){const s=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Cc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cc(this._distance,s),pinchAround:i}}}function gn(u,e){return 180*u.angleWith(e)/Math.PI}class $e extends Pc{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i,s){const l=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:gn(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=gn(e,this._startVector);return Math.abs(s)<i}}function al(u){return Math.abs(u.y)>Math.abs(u.x)}class sl extends Pc{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,i,s){super.touchstart(e,i,s),this._currentTouchCount=s.length}_start(e){this._lastPoints=e,al(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,h,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,s){if(this._valid!==void 0)return this._valid;const l=e.mag()>=2,h=i.mag()>=2;if(!l&&!h)return;if(!l||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return al(e)&&al(i)&&f}}const Mh={panStep:100,bearingStep:15,pitchStep:10};class os{constructor(e){this._tr=new is(e);const i=Mh;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ys,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}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 Ys(u){return u*(2-u)}const Ic=4.000244140625;class vt{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new is(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const s=Ee.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%Ic==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){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 i=le.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.Q.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Ic?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),o.ah(T*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,s=this._startZoom,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=Ee.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.B.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cf;if(this._prevEase){const s=this._prevEase,l=(Ee.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=o.cd(f,_,.25,1)}return this._prevEase={start:Ee.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ol{constructor(e,i){this._clickZoom=e,this._tapZoom=i}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 Hd{constructor(e){this._tr=new is(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ec{constructor(){this._tap=new rs({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(e,i,s){if(!this._swipePoint)if(this._tapTime){const l=i[0],h=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(l)<30;h&&f?s.length>0&&(this._swipePoint=l,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,i,s)}touchmove(e,i,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const l=i[0],h=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(e,i,s)}touchend(e,i,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const l=this._tap.touchend(e,i,s);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Sh{constructor(e,i,s){this._el=e,this._mousePan=i,this._touchPan=s}enable(e){this._inertiaOptions=e||{},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 Ph{constructor(e,i,s,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=s,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Ac{constructor(e,i,s,l){this._el=e,this._touchZoom=i,this._touchRotate=s,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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()}}class ll{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=le.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=i,this._container.appendChild(l);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(le.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new o.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Js=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Wd extends o.l{}function cl(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class Xd{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:E,handler:F,allowed:O}of this._handlers){if(!F.isEnabled())continue;let H;if(this._blockedByActive(T,O,E))F.reset();else if(F[h||l.type]){if(o.cg(l,h||l.type)){const q=le.mousePos(this._map.getCanvas(),l);H=F[h||l.type](l,q)}else if(o.ch(l,h||l.type)){const q=this._getMapTouches(l.touches),W=le.touchPos(this._map.getCanvas(),q);H=F[h||l.type](l,W,q)}else o.ci(h||l.type)||(H=F[h||l.type](l));this.mergeHandlerResult(_,x,H,E,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||F.isActive())&&(T[E]=F)}const P={};for(const E in this._previousActiveHandlers)T[E]||(P[E]=f);this._previousActiveHandlers=T,(Object.keys(P).length||cl(_))&&(this._changes.push([_,x,P]),this._triggerRenderFrame()),(Object.keys(T).length||cl(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=_;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xh(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,h,f]of this._listeners)le.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)le.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new vh(i,e));const l=i.boxZoom=new Sc(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new ll(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new Th(i),_=new Hd(i);i.doubleClickZoom=new ol(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new Ec;this._add("tapDragZoom",x);const T=i.touchPitch=new sl(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),A=function({enable:ee,clickTolerance:ie,aroundCenter:se=!0,minPixelCenterThreshold:re=100,rotateDegreesPerPixelMoved:pe=.8},Me){const xe=new ns({checkCorrectEvent:ve=>le.mouseButton(ve)===0&&ve.ctrlKey||le.mouseButton(ve)===2&&!ve.ctrlKey});return new ir({clickTolerance:ie,move:(ve,be)=>{const Ne=Me();if(se&&Math.abs(Ne.y-ve.y)>re)return{bearingDelta:o.ce(new o.P(ve.x,be.y),be,Ne)};let Oe=(be.x-ve.x)*pe;return se&&be.y<Ne.y&&(Oe=-Oe),{bearingDelta:Oe}},moveStateManager:xe,enable:ee,assignEvents:rl})}(e,P),E=function({enable:ee,clickTolerance:ie,pitchDegreesPerPixelMoved:se=-.5}){const re=new ns({checkCorrectEvent:pe=>le.mouseButton(pe)===0&&pe.ctrlKey||le.mouseButton(pe)===2});return new ir({clickTolerance:ie,move:(pe,Me)=>({pitchDelta:(Me.y-pe.y)*se}),moveStateManager:re,enable:ee,assignEvents:rl})}(e),F=function({enable:ee,clickTolerance:ie,rollDegreesPerPixelMoved:se=.3},re){const pe=new ns({checkCorrectEvent:Me=>le.mouseButton(Me)===2&&Me.ctrlKey});return new ir({clickTolerance:ie,move:(Me,xe)=>{const ve=re();let be=(xe.x-Me.x)*se;return xe.y<ve.y&&(be=-be),{rollDelta:be}},moveStateManager:pe,enable:ee,assignEvents:rl})}(e,P);i.dragRotate=new Ph(e,A,E,F),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",E,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:ee,clickTolerance:ie}){const se=new ns({checkCorrectEvent:re=>le.mouseButton(re)===0&&!re.ctrlKey});return new ir({clickTolerance:ie,move:(re,pe)=>({around:pe,panDelta:pe.sub(re)}),activateOnStart:!0,moveStateManager:se,enable:ee,assignEvents:rl})}(e),H=new qd(e,i);i.dragPan=new Sh(s,O,H),this._add("mousePan",O),this._add("touchPan",H,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new $e,W=new ss;i.touchZoomRotate=new Ac(s,W,q,x),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new vt(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const te=i.keyboard=new os(i);this._add("keyboard",te),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new bh(i))}_add(e,i,s){this._handlers.push({handlerName:e,handler:i,allowed:s}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Js(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,s){for(const l in e)if(l!==s&&(!i||i.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const s of e)this._el.contains(s.target)&&i.push(s);return i}mergeHandlerResult(e,i,s,l,h){if(!s)return;o.e(e,s);const f={handlerName:l,originalEvent:s.originalEvent||h};s.zoomDelta!==void 0&&(i.zoom=f),s.panDelta!==void 0&&(i.drag=f),s.rollDelta!==void 0&&(i.roll=f),s.pitchDelta!==void 0&&(i.pitch=f),s.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},s={};for(const[l,h,f]of this._changes)l.panDelta&&(e.panDelta=(e.panDelta||new o.P(0,0))._add(l.panDelta)),l.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(e.rollDelta=(e.rollDelta||0)+l.rollDelta),l.around!==void 0&&(e.around=l.around),l.pinchAround!==void 0&&(e.pinchAround=l.pinchAround),l.noInertia&&(e.noInertia=l.noInertia),o.e(i,h),o.e(s,f);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(e,i,s){const l=this._map,h=l._getTransformForUpdate(),f=l.terrain;if(!(cl(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:P,rollDelta:A,around:E,pinchAround:F}=e;F!==void 0&&(E=F),E=E||l.transform.centerPoint,f&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:A,pitchDelta:P,bearingDelta:T,around:E};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const H=E.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?E.sub(_):E);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,H):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,H))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,H)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Js(this._eventsInProgress),h=Js(e),f={};for(const A in e){const{originalEvent:E}=e[A];this._eventsInProgress[A]||(f[`${A}start`]=E),this._eventsInProgress[A]=e[A]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const A in f)this._fireEvent(A,f[A]);h&&this._fireEvent("move",h.originalEvent);for(const A in e){const{originalEvent:E}=e[A];this._fireEvent(A,E)}const _={};let x;for(const A in this._eventsInProgress){const{handlerName:E,originalEvent:F}=this._eventsInProgress[A];this._handlersById[E].isActive()||(delete this._eventsInProgress[A],x=i[E]||F,_[`${A}end`]=x)}for(const A in _)this._fireEvent(A,_[A]);const T=Js(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const A=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&A.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(A)}if(s&&P){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),E=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!A||!A.essential&&Ee.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),E(this._map.getBearing())&&this._map.resetNorth()):(E(A.bearing||this._map.getBearing())&&(A.bearing=0),A.freezeElevation=!0,this._map.easeTo(A,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Wd("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Kd extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((Ee.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new o.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,s){return e=o.P.convert(e).mult(-1),this.panTo(this.transform.center,o.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(o.e({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,s){return this.easeTo(o.e({zoom:e},i),s)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)).fire(new o.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,s){return this.easeTo(o.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,o.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(o.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=Zt.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new Zt(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.$.fromLngLat(e,i),f=o.$.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,x,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(_,x),E=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),F=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(A/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:E,pitch:O,bearing:F}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,s,l,h){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,s,l);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:s,pitch:l,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=o.e({offset:[0,0],duration:500,easing:o.cf},e)).animate===!1||!e.essential&&Ee.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let E,F;e.around&&(E=o.Q.convert(e.around),F=s.locationToScreenPoint(E));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},H=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:P,around:E,aroundPoint:F,offsetAsPoint:A,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(P),this._zooming=this._zooming||H.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(H.elevationCenter),this._ease(q=>{H.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:P,elevation:A}=l(h);f&&h.setCenter(f),A!==void 0&&h.setElevation(A),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),P!==void 0&&h.setBearing(P),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new o.l("move",e)),this._zooming&&this.fire(new o.l("zoom",e)),this._rotating&&this.fire(new o.l("rotate",e)),this._pitching&&this.fire(new o.l("pitch",e)),this._rolling&&this.fire(new o.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,l=this._rotating,h=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,s&&this.fire(new o.l("zoomend",e)),l&&this.fire(new o.l("rotateend",e)),h&&this.fire(new o.l("pitchend",e)),f&&this.fire(new o.l("rollend",e)),this.fire(new o.l("moveend",e))}flyTo(e,i){if(!e.essential&&Ee.prefersReducedMotion){const be=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(be,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cf},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,P="roll"in e?this._normalizeBearing(e.roll,f):f,A="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let F=s.centerPoint.add(E);const O=s.screenPointToLocation(F),H=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:P,padding:A,locationAtOffset:O,offsetAsPoint:E,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const W=Math.max(s.width,s.height),K=W/H.scaleOfZoom,te=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/te*2));const ee=q*q;function ie(be){const Ne=(K*K-W*W+(be?-1:1)*ee*ee*te*te)/(2*(be?K:W)*ee*te);return Math.log(Math.sqrt(Ne*Ne+1)-Ne)}function se(be){return(Math.exp(be)-Math.exp(-be))/2}function re(be){return(Math.exp(be)+Math.exp(-be))/2}const pe=ie(!1);let Me=function(be){return re(pe)/re(pe+q*be)},xe=function(be){return W*((re(pe)*(se(Ne=pe+q*be)/re(Ne))-se(pe))/ee)/te;var Ne},ve=(ie(!0)-pe)/q;if(Math.abs(te)<2e-6||!isFinite(ve)){if(Math.abs(W-K)<1e-6)return this.easeTo(e,i);const be=K<W?-1:1;ve=Math.abs(Math.log(K/W))/q,xe=()=>0,Me=Ne=>Math.exp(be*q*Ne)}return e.duration="duration"in e?+e.duration:1e3*ve/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(A),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(be=>{const Ne=be*ve,Oe=1/Me(Ne),Re=xe(Ne);this._rotating&&s.setBearing(o.B.number(l,x,be)),this._pitching&&s.setPitch(o.B.number(h,T,be)),this._rolling&&s.setRoll(o.B.number(f,P,be)),this._padding&&(s.interpolatePadding(_,A,be),F=s.centerPoint.add(E)),H.easeFunc(be,Oe,Re,F),this.terrain&&!e.freezeElevation&&this._updateElevation(be),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,i)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,i,s){s.animate===!1||s.duration===0?(e(1),i()):(this._easeStart=Ee.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aL(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(o.Q.convert(e),this.transform.tileZoom):null}}const zn={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Xt{constructor(e=zn){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=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=le.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=le.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=le.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(){le.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(e,i){const s=this._map._getUIString(`AttributionControl.${i}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const i=this._map.style.sourceCaches;for(const l in i){const h=i[l];if(h.used||h.usedForTerrain){const f=h.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(l=>String(l).trim()),e.sort((l,h)=>l.length-h.length),e=e.filter((l,h)=>{for(let f=h+1;f<e.length;f++)if(e[f].indexOf(l)>=0)return!1;return!0});const s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=le.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Qs{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const s=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=le.create("div","maplibregl-ctrl");const i=le.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){le.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class kc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,s=i?this._queue.concat(i):this._queue;for(const l of s)if(l.id===e)return void(l.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const s of i)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ch=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class Ih extends o.E{constructor(e){super(),this._lastTilesetChange=Ee.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const l of oe(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))s[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),o.bQ(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new In(l,this.tileSize),this._lastTilesetChange=Ee.now());for(const l in this._tiles)s[l]||delete this._tiles[l]}freeRtt(e){for(const i in this._tiles){const s=this._tiles[i];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const s of this._renderableTilesKeys){const l=this._tiles[s].tileID,h=e.clone(),f=o.b2();if(l.canonical.equals(e.canonical))o.bQ(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,P,P,0,0,1),o.L(f,f,[-x*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[x*P,T*P,0]),o.M(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=o.b2();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bQ(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[x*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),P=h.canonical.y-(h.canonical.y>>x<<x),A=e.canonical.x-(h.canonical.x>>x),E=e.canonical.y-(h.canonical.y>>x),F=o.Z>>x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[-T*F+A*o.Z,-P*F+E*o.Z,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),P=e.canonical.y-(e.canonical.y>>x<<x),A=(e.canonical.x>>x)-h.canonical.x,E=(e.canonical.y>>x)-h.canonical.y,F=o.Z<<x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[T*o.Z+A*F,P*o.Z+E*F,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[l]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class Eh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new Ih(i),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,s,l=o.Z){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.cj([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],P=Math.floor(T[0]),A=Math.floor(T[1]),E=T[0]-P,F=T[1]-A;return _.get(P,A)*(1-E)*(1-F)+_.get(P+1,A)*E*(1-F)+_.get(P,A+1)*(1-E)*F+_.get(P+1,A+1)*E*F}getElevationForLngLatZoom(e,i){if(!o.ck(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.Z,h%o.Z,o.Z)}getElevation(e,i,s,l=o.Z){return this.getDEMElevation(e,i,s,l)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const l=this.painter.context,h=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new jt(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new jt(l,new o.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.ad([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const l=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new jt(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.cl(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(x,x,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new jt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new jt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,f=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&h,i[f+2]=_>>8<<4|h>>8,i[f+3]=0;const s=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new jt(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],A=P&&this.sourceCache.getTileByID(P);if(!A)return null;const E=this._coordsTextureSize,F=(1<<A.tileID.canonical.z)*E;return new o.$((A.tileID.canonical.x*E+x)/F+A.tileID.wrap,(A.tileID.canonical.y*E+T)/F,this.getElevation(A.tileID,x,T,E))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.cm,T=new o.aK,P=this.meshSize,A=o.Z/P,E=P*P;for(let re=0;re<=P;re++)for(let pe=0;pe<=P;pe++)x.emplaceBack(pe*A,re*A,0);for(let re=0;re<E;re+=P+1)for(let pe=0;pe<P;pe++)T.emplaceBack(pe+re,P+pe+re+1,P+pe+re+2),T.emplaceBack(pe+re,P+pe+re+2,pe+re+1);const F=x.length,O=F+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,te=h?0:1;for(let re=0;re<=P;re++)x.emplaceBack(re*A,q,W);for(let re=0;re<=P;re++)x.emplaceBack(re*A,K,te);for(let re=0;re<P;re++)T.emplaceBack(H+re,O+re,O+re+1),T.emplaceBack(H+re,O+re+1,H+re+1),T.emplaceBack(0+re,F+re+1,F+re),T.emplaceBack(0+re,0+re+1,F+re+1);const ee=x.length,ie=ee+2*(P+1);for(const re of[0,1])for(let pe=0;pe<=P;pe++)for(const Me of[0,1])x.emplaceBack(re*o.Z,pe*A,Me);for(let re=0;re<2*P;re+=2)T.emplaceBack(ee+re,ee+re+1,ee+re+3),T.emplaceBack(ee+re,ee+re+3,ee+re+2),T.emplaceBack(ie+re,ie+re+3,ie+re+1),T.emplaceBack(ie+re,ie+re+2,ie+re+3);const se=new Ua(_.createVertexBuffer(x,Ch.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=se,se}getMeshFrameDelta(e){return 2*Math.PI*o.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var s;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(s=this.getMinMaxElevation(l).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,s={minElevation:null,maxElevation:null};return i&&i.dem&&(s.minElevation=i.dem.min*this.exaggeration,s.maxElevation=i.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(e,i){const s=o.$.fromLngLat(e.wrap()),l=(1<<i)*o.Z,h=s.x*l,f=s.y*l,_=Math.floor(h/o.Z),x=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class Yd{constructor(e,i,s){this._context=e,this._size=i,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new jt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(s.texture),{id:e,fbo:i,texture:s,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>e.id!==i),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const i of this._recentlyUsed)if(!this._objects[i].inUse)return this._objects[i];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const pr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ul{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Yd(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(i)),this._coordsAscending={};for(const s in e.sourceCaches){this._coordsAscending[s]={};const l=e.sourceCaches[s].getVisibleCoordinates(),h=e.sourceCaches[s].getSource(),f=h instanceof Ce?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(pr[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][s.tileID.key];h&&h!==s.rttCoords[l]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(pr[l]&&(this._prevType&&pr[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(pr[this._prevType]||pr[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(Xn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const A=this.pool.getObjectForId(T.rtt[_].id);if(A.stamp===T.rtt[_].stamp){this.pool.useObject(A);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),T.rtt[_]={id:P.id,stamp:P.stamp},h.context.bindFramebuffer.set(P.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let A=0;A<x.length;A++){const E=h.style._layers[x[A]],F=E.source?this._coordsAscending[E.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),h._renderTileClippingMasks(E,F,!0),h.renderLayer(h,h.style.sourceCaches[E.source],E,F,s),E.source&&(T.rttCoords[E.source]=this._coordsAscendingStr[E.source][T.tileID.key])}}return Xn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),pr[l]}return!1}}const Ke={"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":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},rt=he,eo={hash:!1,interactive:!0,bearingSnap:7,attributionControl:zn,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:o.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},zc={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Rc{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,le.mousePos(this.element,h)),le.addEventListener(window,"mousemove",this.mousemove),le.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,le.mousePos(this.element,h))},this.mouseup=h=>{this._rotatePitchHanlder.dragEnd(h),this.offTemp()},this.touchstart=h=>{h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),le.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const l=new as;this._rotatePitchHanlder=new ir({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.ce(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,le.addEventListener(i,"mousedown",this.mousedown),le.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),le.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),le.disableDrag()}move(e,i){const s=this.map,{bearingDelta:l,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};l&&s.setBearing(s.getBearing()+l),h&&s.setPitch(s.getPitch()+h)}off(){const e=this.element;le.removeEventListener(e,"mousedown",this.mousedown),le.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend),le.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){le.enableDrag(),le.removeEventListener(window,"mousemove",this.mousemove),le.removeEventListener(window,"mouseup",this.mouseup),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend)}}let Ti;function Dc(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const h=new o.Q(u.lng-360,u.lat),f=new o.Q(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(f).distSqr(e)<_&&(u=f)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const qr={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 Ah(u,e,i){const s=u.classList;for(const l in qr)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Ma extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,l=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=Dc(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),le.setTransform(this._element,`${qr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),Ee.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=i.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.l("dragstart"))),this.fire(new o.l("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 o.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=o.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=le.create("div");const i=le.createNS("http://www.w3.org/2000/svg","svg"),s=41,l=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${s}px`),i.setAttributeNS(null,"width",`${l}px`),i.setAttributeNS(null,"viewBox",`0 0 ${l} ${s}`);const h=le.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const f=le.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=le.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{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 W of x){const K=le.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",W.rx),K.setAttributeNS(null,"ry",W.ry),_.appendChild(K)}const T=le.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=le.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"),T.appendChild(P);const A=le.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const E=le.createNS("http://www.w3.org/2000/svg","path");E.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"),A.appendChild(E);const F=le.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=le.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=le.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const q=le.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(q),f.appendChild(_),f.appendChild(T),f.appendChild(A),f.appendChild(F),f.appendChild(O),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),Ah(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",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("terrain",this._update),this._map.off("projectiontransition",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),le.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;const l=(i=this._map)===null||i===void 0?void 0:i.terrain,h=this._map.transform.isLocationOccluded(this._lngLat);if(!l||h){const F=h?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==F&&(this._element.style.opacity=F))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),x=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/f.transform.pixelsPerMeter,P=Math.sin(f.getPitch()*Math.PI/180)*T,A=f.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),E=f.transform.lngLatToCameraDepth(this._lngLat,x+P)-A>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&E&&this._popup.remove(),this._element.style.opacity=E?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=o.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const ui={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ii=0,ls=!1;const to={maxWidth:100,unit:"metric"};function io(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const A=3.2808*P;A>5280?Sa(e,T,A/5280,u._getUIString("ScaleControl.Miles")):Sa(e,T,A,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Sa(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Sa(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):Sa(e,T,P,u._getUIString("ScaleControl.Meters"))}function Sa(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const Lc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Bc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function cs(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,u),"top-left":new o.P(e,e),"top-right":new o.P(-e,e),bottom:new o.P(0,-u),"bottom-left":new o.P(e,-e),"bottom-right":new o.P(-e,-e),left:new o.P(u,0),right:new o.P(-u,0)}}if(u instanceof o.P||Array.isArray(u)){const e=o.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:o.P.convert(u.center||[0,0]),top:o.P.convert(u.top||[0,0]),"top-left":o.P.convert(u["top-left"]||[0,0]),"top-right":o.P.convert(u["top-right"]||[0,0]),bottom:o.P.convert(u.bottom||[0,0]),"bottom-left":o.P.convert(u["bottom-left"]||[0,0]),"bottom-right":o.P.convert(u["bottom-right"]||[0,0]),left:o.P.convert(u.left||[0,0]),right:o.P.convert(u.right||[0,0])}}return cs(new o.P(0,0))}const Fc=he;S.AJAXError=o.cq,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cr,S.config=o.a,S.removeProtocol=o.cs,S.AttributionControl=Xt,S.BoxZoomHandler=Sc,S.CanvasSource=Ue,S.CooperativeGesturesHandler=ll,S.DoubleClickZoomHandler=ol,S.DragPanHandler=Sh,S.DragRotateHandler=Ph,S.EdgeInsets=As,S.FullscreenControl=class extends o.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.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(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){le.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=le.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);le.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_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 o.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_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()}},S.GeoJSONSource=Cn,S.GeolocateControl=class extends o.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new o.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),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(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new o.Q(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=Zt.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(e.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 i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&ls)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=le.create("button","maplibregl-ctrl-geolocate",this._container),le.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=le.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ma({element:this._dotElement}),this._circleElement=le.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ma({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new o.l("trackuserlocationend")),this.fire(new o.l("userlocationlostfocus")))})}},this.options=o.e({},ui,u)}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(Ti!==void 0&&!e)return Ti;if(window.navigator.permissions===void 0)return Ti=!!window.navigator.geolocation,Ti;try{Ti=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Ti=!!window.navigator.geolocation}return Ti})}().then(e=>this._finishSetupUI(e)),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(),le.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ii=0,ls=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),i=u.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.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 u=this._map.getBounds(),e=u.getSouthEast(),i=u.getNorthEast(),s=e.distanceTo(i),l=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}trigger(){if(!this._setup)return o.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 o.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ii--,ls=!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 o.l("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 o.l("trackuserlocationstart")),this.fire(new o.l("userlocationfocus"));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 u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ii++,ii>1?(u={maximumAge:6e5,timeout:0},ls=!0):(u=this.options.positionOptions,ls=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}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)}},S.GlobeControl=class{constructor(){this._toggleProjection=()=>{var u;const e=(u=this._map.getProjection())===null||u===void 0?void 0:u.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var u;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((u=this._map.getProjection())===null||u===void 0?void 0:u.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=le.create("button","maplibregl-ctrl-globe",this._container),le.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=bc,S.ImageSource=Ce,S.KeyboardHandler=os,S.LngLatBounds=Zt,S.LogoControl=Qs,S.Map=class extends Kd{constructor(u){var e,i;o.cn.mark(o.co.create);const s=Object.assign(Object.assign(Object.assign({},eo),u),{canvasContextAttributes:Object.assign(Object.assign({},eo.canvasContextAttributes),u.canvasContextAttributes)});if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new Ga,h=new ks;if(s.minZoom!==void 0&&l.setMinZoom(s.minZoom),s.maxZoom!==void 0&&l.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&l.setMinPitch(s.minPitch),s.maxPitch!==void 0&&l.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&l.setRenderWorldCopies(s.renderWorldCopies),super(l,h,{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new kc,this._controls=[],this._mapId=o.a4(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Ke),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Ft.addThrottleControl(()=>this.isMoving()),this._requestManager=new It(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),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 _=!1;const x=Xs(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Xd(this,s),this._hash=s.hash&&new bc(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,roll:s.roll}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,o.e({},s.fitBoundsOptions,{duration:0}))));const f=typeof s.style=="string"||((i=(e=s.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new Xt(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Qs,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(i,s.firstChild):s.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,i,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,s)}resize(u,e=!0){const[i,s]=this._containerDimensions(),l=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,l),this.painter.resize(i,s,l),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,_),this.painter.resize(i,s,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,s]=this._containerDimensions();this.transform.resize(i,s,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,s,u)}_getClampedPixelRatio(u,e){const{0:i,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,f=e*l;return Math.min(h>i?i/h:1,f>s?s/f:1)*l}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(Zt.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.setMinZoom(u),this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.setMaxZoom(u),this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.setMinPitch(u),this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(u>=this.transform.minPitch)return this.transform.setMaxPitch(u),this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.setRenderWorldCopies(u),this._update()}project(u){return this.transform.locationToScreenPoint(o.Q.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new Ei(u,this,h.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(x=>this.getLayer(x));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new Ei(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new Ei(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];f.length&&(l.features=f,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:s}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const s=this._delegatedListeners[u];for(let l=0;l<s.length;l++){const h=s[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(f=>e.includes(f))){for(const f in h.delegates)this.off(f,h.delegates[f]);return void s.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,s,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);for(const h in l.delegates){const f=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const s=u instanceof o.P||Array.isArray(u),l=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),f=o.P.convert(l[1]);i=[h,new o.P(f.x,h.y),f,new o.P(h.x,f.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){var i,s;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new rc(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,l):this.style.loadJSON(u,e,l),this):((s=(i=this.style)===null||i===void 0?void 0:i.projection)===null||s===void 0||s.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new rc(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const i=this._requestManager.transformRequest(u,"Style");o.j(i,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new o.k(s))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){o.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.w("There is no style added to the map.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new o.k(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const s=this.style._layers[i];s.type==="hillshade"&&s.source===u.source&&o.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 Eh(this.painter,e,u),this.painter.renderToTexture=new ul(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var s;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((s=i.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.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.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const i=u[e]._tiles;for(const s in i){const l=i[s];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const s=this.getSource(i);if(!s)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);s.calculateTileZoom=ae(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=ae(Math.max(1,u),Math.max(1,e));return this._update(!0),this}refreshTiles(u,e){const i=this.style.sourceCaches[u];if(!i)throw new Error(`There is no source cache with ID "${u}", cannot refresh tile`);e===void 0?i.reload():i.refreshTiles(e.map(s=>new o.a1(s.z,s.x,s.y)))}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(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:P,height:A,data:E}=e,F=e;return this.style.addImage(u,{data:new o.R({width:P,height:A},new Uint8Array(E)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:P,height:A,data:E}=Ee.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:A},E),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?Ee.getImageData(e):e,{width:l,height:h,data:f}=s;if(l===void 0||h===void 0)return this.fire(new o.k(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(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return Ft.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,e){return this._lazyInitEmptyStyle(),this.style.addLayer(u,e),this._update(!0)}moveLayer(u,e){return this.style.moveLayer(u,e),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,e,i){return this.style.setLayerZoomRange(u,e,i),this._update(!0)}setFilter(u,e,i={}){return this.style.setFilter(u,e,i),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,i,s={}){return this.style.setPaintProperty(u,e,i,s),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,i,s={}){return this.style.setLayoutProperty(u,e,i,s),this._update(!0)}getLayoutProperty(u,e){return this.style.getLayoutProperty(u,e)}setGlyphs(u,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,i,s=>{s||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,e,i=>{i||this._update(!0)}),this}setLight(u,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(u,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,e){return this.style.setFeatureState(u,e),this._update()}removeFeatureState(u,e){return this.style.removeFeatureState(u,e),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,e=0;return this._container&&(u=this._container.clientWidth||400,e=this._container.clientHeight||300),[u,e]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const e=this._canvasContainer=le.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=le.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),s=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],s);const l=this._controlContainer=le.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=le.create("div",`maplibregl-ctrl-${f} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,i){this._canvas.width=Math.floor(i*u),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:u},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,u):this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u),!i){const s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new vc(i,this.transform),Fe.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const A=this.transform.zoom,E=Ee.now();this.style.zoomHistory.update(A,E);const F=new o.C(A,{now:E,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=F.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(F)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||T)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,T),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cn.mark(o.co.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,o.cn.mark(o.co.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Ft.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),le.remove(this._canvasContainer),le.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cn.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ee.frame(this._frameRequest,u=>{o.cn.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cp(e)&&!function(i){return i.message===qo}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return rt}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=Ei,S.MapTouchEvent=ts,S.MapWheelEvent=Mc,S.Marker=Ma,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const s=this._map._getUIString(`NavigationControl.${i}`);e.title=s,e.setAttribute("aria-label",s)},this.options=o.e({},zc,u),this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=le.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Rc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){le.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const i=le.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},S.Popup=class extends o.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&le.remove(this._content),this._container&&(le.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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=le.create("div","maplibregl-popup",this._map.getContainer()),this._tip=le.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),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._lngLat=Dc(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor;const l=cs(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),le.setTransform(this._container,`${qr[s]} translate(${h.x}px,${h.y}px)`),Ah(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Lc),u)}addTo(u){return this._map&&this.remove(),this._map=u,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 o.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.Q.convert(u),this._pos=null,this._flatPos=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._flatPos=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(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=u;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=le.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=le.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Bc);u&&u.focus()}},S.RasterDEMTileSource=Pn,S.RasterTileSource=br,S.ScaleControl=class{constructor(u){this._onMove=()=>{io(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,io(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},to),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){le.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=vt,S.Style=rc,S.TerrainControl=class{constructor(u){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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=le.create("button","maplibregl-ctrl-terrain",this._container),le.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(){le.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=sl,S.TwoFingersTouchRotateHandler=$e,S.TwoFingersTouchZoomHandler=ss,S.TwoFingersTouchZoomRotateHandler=Ac,S.VectorTileSource=hn,S.VideoSource=Ye,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(Nt(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{_t[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=xr;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(cn),xr=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()"))},S.createTileMesh=zs,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return Rr().getRTLTextPluginStatus()},S.getVersion=function(){return Fc},S.getWorkerCount=function(){return kr.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return Sn().broadcast("IS",u)},S.prewarm=function(){vr().acquire(cn)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return Rr().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){kr.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var B=b;return B})}(Iu)),Iu.exports}var sy=ay();const _d=ry(sy);class Ff{constructor(g,b,I,z,B){qt(this,"bounds1");qt(this,"bounds2");qt(this,"getBounds",(g,b,I,z)=>new _d.LngLatBounds([g,b],[I,z]));qt(this,"contains",(g,b)=>this.bounds1.contains([b,g])||this.bounds2.contains([b,g]));const S=g.unproject([b,I]),o=g.unproject([z,B]);if(S.lng<-180){this.bounds1=this.getBounds(-180,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(S.wrap().lng,S.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(S.lng,S.lat,180,o.lat),this.bounds2=this.getBounds(-180,S.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(S.lng,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const oy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(120, 120, 120, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(128, 128, 128, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(56, 56, 56, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(153, 153, 153, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(104, 104, 104, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(56, 56, 56, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(136, 136, 136, 1)","fill-outline-color":"rgba(102, 102, 102, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(50, 50, 50, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(52, 52, 52, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(88, 88, 88, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20],"line-color":"rgba(102, 102, 102, 1)"}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23],"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":2,"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(51, 51, 51, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(51, 51, 51, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(255, 255, 255, 1)","text-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]},ly={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(220, 220, 220, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(228, 228, 228, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(156, 156, 156, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(253, 253, 253, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(204, 204, 204, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(156, 156, 156, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(236, 236, 236, 1)","fill-outline-color":"rgba(202, 202, 202, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(185, 185, 185)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(150, 150, 150, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(152, 152, 152, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(188, 188, 188)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(185, 185, 185)","line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23]}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":2}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(151, 151, 151, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(151, 151, 151, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1.5}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(0, 0, 0, 1)","text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]};var Dt;(function(v){v.assertEqual=z=>z;function g(z){}v.assertIs=g;function b(z){throw new Error}v.assertNever=b,v.arrayToEnum=z=>{const B={};for(const S of z)B[S]=S;return B},v.getValidEnumValues=z=>{const B=v.objectKeys(z).filter(o=>typeof z[z[o]]!="number"),S={};for(const o of B)S[o]=z[o];return v.objectValues(S)},v.objectValues=z=>v.objectKeys(z).map(function(B){return z[B]}),v.objectKeys=typeof Object.keys=="function"?z=>Object.keys(z):z=>{const B=[];for(const S in z)Object.prototype.hasOwnProperty.call(z,S)&&B.push(S);return B},v.find=(z,B)=>{for(const S of z)if(B(S))return S},v.isInteger=typeof Number.isInteger=="function"?z=>Number.isInteger(z):z=>typeof z=="number"&&isFinite(z)&&Math.floor(z)===z;function I(z,B=" | "){return z.map(S=>typeof S=="string"?`'${S}'`:S).join(B)}v.joinValues=I,v.jsonStringifyReplacer=(z,B)=>typeof B=="bigint"?B.toString():B})(Dt||(Dt={}));var yd;(function(v){v.mergeShapes=(g,b)=>({...g,...b})})(yd||(yd={}));const Xe=Dt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),na=v=>{switch(typeof v){case"undefined":return Xe.undefined;case"string":return Xe.string;case"number":return isNaN(v)?Xe.nan:Xe.number;case"boolean":return Xe.boolean;case"function":return Xe.function;case"bigint":return Xe.bigint;case"symbol":return Xe.symbol;case"object":return Array.isArray(v)?Xe.array:v===null?Xe.null:v.then&&typeof v.then=="function"&&v.catch&&typeof v.catch=="function"?Xe.promise:typeof Map<"u"&&v instanceof Map?Xe.map:typeof Set<"u"&&v instanceof Set?Xe.set:typeof Date<"u"&&v instanceof Date?Xe.date:Xe.object;default:return Xe.unknown}},je=Dt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),cy=v=>JSON.stringify(v,null,2).replace(/"([^"]+)":/g,"$1:");class Jr extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const b=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,b):this.__proto__=b,this.name="ZodError",this.issues=g}format(g){const b=g||function(B){return B.message},I={_errors:[]},z=B=>{for(const S of B.issues)if(S.code==="invalid_union")S.unionErrors.map(z);else if(S.code==="invalid_return_type")z(S.returnTypeError);else if(S.code==="invalid_arguments")z(S.argumentsError);else if(S.path.length===0)I._errors.push(b(S));else{let o=I,he=0;for(;he<S.path.length;){const me=S.path[he];he===S.path.length-1?(o[me]=o[me]||{_errors:[]},o[me]._errors.push(b(S))):o[me]=o[me]||{_errors:[]},o=o[me],he++}}};return z(this),I}static assert(g){if(!(g instanceof Jr))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Dt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=b=>b.message){const b={},I=[];for(const z of this.issues)z.path.length>0?(b[z.path[0]]=b[z.path[0]]||[],b[z.path[0]].push(g(z))):I.push(g(z));return{formErrors:I,fieldErrors:b}}get formErrors(){return this.flatten()}}Jr.create=v=>new Jr(v);const xo=(v,g)=>{let b;switch(v.code){case je.invalid_type:v.received===Xe.undefined?b="Required":b=`Expected ${v.expected}, received ${v.received}`;break;case je.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(v.expected,Dt.jsonStringifyReplacer)}`;break;case je.unrecognized_keys:b=`Unrecognized key(s) in object: ${Dt.joinValues(v.keys,", ")}`;break;case je.invalid_union:b="Invalid input";break;case je.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${Dt.joinValues(v.options)}`;break;case je.invalid_enum_value:b=`Invalid enum value. Expected ${Dt.joinValues(v.options)}, received '${v.received}'`;break;case je.invalid_arguments:b="Invalid function arguments";break;case je.invalid_return_type:b="Invalid function return type";break;case je.invalid_date:b="Invalid date";break;case je.invalid_string:typeof v.validation=="object"?"includes"in v.validation?(b=`Invalid input: must include "${v.validation.includes}"`,typeof v.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${v.validation.position}`)):"startsWith"in v.validation?b=`Invalid input: must start with "${v.validation.startsWith}"`:"endsWith"in v.validation?b=`Invalid input: must end with "${v.validation.endsWith}"`:Dt.assertNever(v.validation):v.validation!=="regex"?b=`Invalid ${v.validation}`:b="Invalid";break;case je.too_small:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at least":"more than"} ${v.minimum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at least":"over"} ${v.minimum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${v.minimum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(v.minimum))}`:b="Invalid input";break;case je.too_big:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at most":"less than"} ${v.maximum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at most":"under"} ${v.maximum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="bigint"?b=`BigInt must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly":v.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(v.maximum))}`:b="Invalid input";break;case je.custom:b="Invalid input";break;case je.invalid_intersection_types:b="Intersection results could not be merged";break;case je.not_multiple_of:b=`Number must be a multiple of ${v.multipleOf}`;break;case je.not_finite:b="Number must be finite";break;default:b=g.defaultError,Dt.assertNever(v)}return{message:b}};let Of=xo;function uy(v){Of=v}function Eu(){return Of}const Au=v=>{const{data:g,path:b,errorMaps:I,issueData:z}=v,B=[...b,...z.path||[]],S={...z,path:B};if(z.message!==void 0)return{...z,path:B,message:z.message};let o="";const he=I.filter(me=>!!me).slice().reverse();for(const me of he)o=me(S,{data:g,defaultError:o}).message;return{...z,path:B,message:o}},hy=[];function qe(v,g){const b=Eu(),I=Au({issueData:g,data:v.data,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,b,b===xo?void 0:xo].filter(z=>!!z)});v.common.issues.push(I)}class gr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,b){const I=[];for(const z of b){if(z.status==="aborted")return ht;z.status==="dirty"&&g.dirty(),I.push(z.value)}return{status:g.value,value:I}}static async mergeObjectAsync(g,b){const I=[];for(const z of b){const B=await z.key,S=await z.value;I.push({key:B,value:S})}return gr.mergeObjectSync(g,I)}static mergeObjectSync(g,b){const I={};for(const z of b){const{key:B,value:S}=z;if(B.status==="aborted"||S.status==="aborted")return ht;B.status==="dirty"&&g.dirty(),S.status==="dirty"&&g.dirty(),B.value!=="__proto__"&&(typeof S.value<"u"||z.alwaysSet)&&(I[B.value]=S.value)}return{status:g.value,value:I}}}const ht=Object.freeze({status:"aborted"}),vo=v=>({status:"dirty",value:v}),Er=v=>({status:"valid",value:v}),xd=v=>v.status==="aborted",vd=v=>v.status==="dirty",xs=v=>v.status==="valid",Al=v=>typeof Promise<"u"&&v instanceof Promise;function ku(v,g,b,I){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot read private member from an object whose class did not declare it");return g.get(v)}function jf(v,g,b,I,z){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot write private member to an object whose class did not declare it");return g.set(v,b),b}typeof SuppressedError=="function"&&SuppressedError;var tt;(function(v){v.errToObj=g=>typeof g=="string"?{message:g}:g||{},v.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(tt||(tt={}));var kl,zl;class Un{constructor(g,b,I,z){this._cachedPath=[],this.parent=g,this.data=b,this._path=I,this._key=z}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Nf=(v,g)=>{if(xs(g))return{success:!0,data:g.value};if(!v.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const b=new Jr(v.common.issues);return this._error=b,this._error}}};function yt(v){if(!v)return{};const{errorMap:g,invalid_type_error:b,required_error:I,description:z}=v;if(g&&(b||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:z}:{errorMap:(S,o)=>{var he,me;const{message:Pe}=v;return S.code==="invalid_enum_value"?{message:Pe??o.defaultError}:typeof o.data>"u"?{message:(he=Pe??I)!==null&&he!==void 0?he:o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:(me=Pe??b)!==null&&me!==void 0?me:o.defaultError}},description:z}}class wt{get description(){return this._def.description}_getType(g){return na(g.data)}_getOrReturnCtx(g,b){return b||{common:g.parent.common,data:g.data,parsedType:na(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new gr,ctx:{common:g.parent.common,data:g.data,parsedType:na(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const b=this._parse(g);if(Al(b))throw new Error("Synchronous parse encountered promise.");return b}_parseAsync(g){const b=this._parse(g);return Promise.resolve(b)}parse(g,b){const I=this.safeParse(g,b);if(I.success)return I.data;throw I.error}safeParse(g,b){var I;const z={common:{issues:[],async:(I=b==null?void 0:b.async)!==null&&I!==void 0?I:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)},B=this._parseSync({data:g,path:z.path,parent:z});return Nf(z,B)}"~validate"(g){var b,I;const z={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)};if(!this["~standard"].async)try{const B=this._parseSync({data:g,path:[],parent:z});return xs(B)?{value:B.value}:{issues:z.common.issues}}catch(B){!((I=(b=B==null?void 0:B.message)===null||b===void 0?void 0:b.toLowerCase())===null||I===void 0)&&I.includes("encountered")&&(this["~standard"].async=!0),z.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:z}).then(B=>xs(B)?{value:B.value}:{issues:z.common.issues})}async parseAsync(g,b){const I=await this.safeParseAsync(g,b);if(I.success)return I.data;throw I.error}async safeParseAsync(g,b){const I={common:{issues:[],contextualErrorMap:b==null?void 0:b.errorMap,async:!0},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)},z=this._parse({data:g,path:I.path,parent:I}),B=await(Al(z)?z:Promise.resolve(z));return Nf(I,B)}refine(g,b){const I=z=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(z):b;return this._refinement((z,B)=>{const S=g(z),o=()=>B.addIssue({code:je.custom,...I(z)});return typeof Promise<"u"&&S instanceof Promise?S.then(he=>he?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(g,b){return this._refinement((I,z)=>g(I)?!0:(z.addIssue(typeof b=="function"?b(I,z):b),!1))}_refinement(g){return new wn({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:b=>this["~validate"](b)}}optional(){return Gn.create(this,this._def)}nullable(){return Fa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bn.create(this)}promise(){return Mo.create(this,this._def)}or(g){return Bl.create([this,g],this._def)}and(g){return Fl.create(this,g,this._def)}transform(g){return new wn({...yt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const b=typeof g=="function"?g:()=>g;return new Vl({...yt(this._def),innerType:this,defaultValue:b,typeName:ut.ZodDefault})}brand(){return new Td({typeName:ut.ZodBranded,type:this,...yt(this._def)})}catch(g){const b=typeof g=="function"?g:()=>g;return new Ul({...yt(this._def),innerType:this,catchValue:b,typeName:ut.ZodCatch})}describe(g){const b=this.constructor;return new b({...this._def,description:g})}pipe(g){return $l.create(this,g)}readonly(){return Gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dy=/^c[^\s-]{8,}$/i,py=/^[0-9a-z]+$/,fy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,my=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gy=/^[a-z0-9_-]{21}$/i,_y=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yy=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let bd;const by=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ty=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,My=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Py=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zf="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Cy=new RegExp(`^${Zf}$`);function Vf(v){let g="[0-5]\\d";v.precision?g=`${g}\\.\\d{${v.precision}}`:v.precision==null&&(g=`${g}(\\.\\d+)?`);const b=v.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${b}`}function Iy(v){return new RegExp(`^${Vf(v)}$`)}function Uf(v){let g=`${Zf}T${Vf(v)}`;const b=[];return b.push(v.local?"Z?":"Z"),v.offset&&b.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${b.join("|")})`,new RegExp(`^${g}$`)}function Ey(v,g){return!!((g==="v4"||!g)&&by.test(v)||(g==="v6"||!g)&&Ty.test(v))}function Ay(v,g){if(!_y.test(v))return!1;try{const[b]=v.split("."),I=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),z=JSON.parse(atob(I));return!(typeof z!="object"||z===null||!z.typ||!z.alg||g&&z.alg!==g)}catch{return!1}}function ky(v,g){return!!((g==="v4"||!g)&&wy.test(v)||(g==="v6"||!g)&&My.test(v))}class vn extends wt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Xe.string){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.string,received:B.parsedType}),ht}const I=new gr;let z;for(const B of this._def.checks)if(B.kind==="min")g.data.length<B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="max")g.data.length>B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="length"){const S=g.data.length>B.value,o=g.data.length<B.value;(S||o)&&(z=this._getOrReturnCtx(g,z),S?qe(z,{code:je.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}):o&&qe(z,{code:je.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}),I.dirty())}else if(B.kind==="email")xy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"email",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="emoji")bd||(bd=new RegExp(vy,"u")),bd.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"emoji",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="uuid")my.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"uuid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="nanoid")gy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"nanoid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid")dy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cuid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid2")py.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cuid2",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="ulid")fy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"ulid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="url")try{new URL(g.data)}catch{z=this._getOrReturnCtx(g,z),qe(z,{validation:"url",code:je.invalid_string,message:B.message}),I.dirty()}else B.kind==="regex"?(B.regex.lastIndex=0,B.regex.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"regex",code:je.invalid_string,message:B.message}),I.dirty())):B.kind==="trim"?g.data=g.data.trim():B.kind==="includes"?g.data.includes(B.value,B.position)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{includes:B.value,position:B.position},message:B.message}),I.dirty()):B.kind==="toLowerCase"?g.data=g.data.toLowerCase():B.kind==="toUpperCase"?g.data=g.data.toUpperCase():B.kind==="startsWith"?g.data.startsWith(B.value)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{startsWith:B.value},message:B.message}),I.dirty()):B.kind==="endsWith"?g.data.endsWith(B.value)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{endsWith:B.value},message:B.message}),I.dirty()):B.kind==="datetime"?Uf(B).test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"datetime",message:B.message}),I.dirty()):B.kind==="date"?Cy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"date",message:B.message}),I.dirty()):B.kind==="time"?Iy(B).test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"time",message:B.message}),I.dirty()):B.kind==="duration"?yy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"duration",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="ip"?Ey(g.data,B.version)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"ip",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="jwt"?Ay(g.data,B.alg)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"jwt",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="cidr"?ky(g.data,B.version)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cidr",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="base64"?Sy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"base64",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="base64url"?Py.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"base64url",code:je.invalid_string,message:B.message}),I.dirty()):Dt.assertNever(B);return{status:I.value,value:g.data}}_regex(g,b,I){return this.refinement(z=>g.test(z),{validation:b,code:je.invalid_string,...tt.errToObj(I)})}_addCheck(g){return new vn({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...tt.errToObj(g)})}url(g){return this._addCheck({kind:"url",...tt.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...tt.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...tt.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...tt.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...tt.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...tt.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...tt.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...tt.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...tt.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...tt.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...tt.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...tt.errToObj(g)})}datetime(g){var b,I;return typeof g=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,offset:(b=g==null?void 0:g.offset)!==null&&b!==void 0?b:!1,local:(I=g==null?void 0:g.local)!==null&&I!==void 0?I:!1,...tt.errToObj(g==null?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return typeof g=="string"?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,...tt.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...tt.errToObj(g)})}regex(g,b){return this._addCheck({kind:"regex",regex:g,...tt.errToObj(b)})}includes(g,b){return this._addCheck({kind:"includes",value:g,position:b==null?void 0:b.position,...tt.errToObj(b==null?void 0:b.message)})}startsWith(g,b){return this._addCheck({kind:"startsWith",value:g,...tt.errToObj(b)})}endsWith(g,b){return this._addCheck({kind:"endsWith",value:g,...tt.errToObj(b)})}min(g,b){return this._addCheck({kind:"min",value:g,...tt.errToObj(b)})}max(g,b){return this._addCheck({kind:"max",value:g,...tt.errToObj(b)})}length(g,b){return this._addCheck({kind:"length",value:g,...tt.errToObj(b)})}nonempty(g){return this.min(1,tt.errToObj(g))}trim(){return new vn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new vn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new vn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(g=>g.kind==="datetime")}get isDate(){return!!this._def.checks.find(g=>g.kind==="date")}get isTime(){return!!this._def.checks.find(g=>g.kind==="time")}get isDuration(){return!!this._def.checks.find(g=>g.kind==="duration")}get isEmail(){return!!this._def.checks.find(g=>g.kind==="email")}get isURL(){return!!this._def.checks.find(g=>g.kind==="url")}get isEmoji(){return!!this._def.checks.find(g=>g.kind==="emoji")}get isUUID(){return!!this._def.checks.find(g=>g.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(g=>g.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(g=>g.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(g=>g.kind==="cuid2")}get isULID(){return!!this._def.checks.find(g=>g.kind==="ulid")}get isIP(){return!!this._def.checks.find(g=>g.kind==="ip")}get isCIDR(){return!!this._def.checks.find(g=>g.kind==="cidr")}get isBase64(){return!!this._def.checks.find(g=>g.kind==="base64")}get isBase64url(){return!!this._def.checks.find(g=>g.kind==="base64url")}get minLength(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxLength(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}vn.create=v=>{var g;return new vn({checks:[],typeName:ut.ZodString,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};function zy(v,g){const b=(v.toString().split(".")[1]||"").length,I=(g.toString().split(".")[1]||"").length,z=b>I?b:I,B=parseInt(v.toFixed(z).replace(".","")),S=parseInt(g.toFixed(z).replace(".",""));return B%S/Math.pow(10,z)}class Da extends wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Xe.number){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.number,received:B.parsedType}),ht}let I;const z=new gr;for(const B of this._def.checks)B.kind==="int"?Dt.isInteger(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:je.invalid_type,expected:"integer",received:"float",message:B.message}),z.dirty()):B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_small,minimum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),z.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_big,maximum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),z.dirty()):B.kind==="multipleOf"?zy(g.data,B.value)!==0&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_multiple_of,multipleOf:B.value,message:B.message}),z.dirty()):B.kind==="finite"?Number.isFinite(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_finite,message:B.message}),z.dirty()):Dt.assertNever(B);return{status:z.value,value:g.data}}gte(g,b){return this.setLimit("min",g,!0,tt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,tt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,tt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,tt.toString(b))}setLimit(g,b,I,z){return new Da({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:tt.toString(z)}]})}_addCheck(g){return new Da({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:tt.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(b)})}finite(g){return this._addCheck({kind:"finite",message:tt.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tt.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tt.toString(g)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&Dt.isInteger(g.value))}get isFinite(){let g=null,b=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(b===null||I.value>b)&&(b=I.value):I.kind==="max"&&(g===null||I.value<g)&&(g=I.value)}return Number.isFinite(b)&&Number.isFinite(g)}}Da.create=v=>new Da({checks:[],typeName:ut.ZodNumber,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class La extends wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Xe.bigint)return this._getInvalidInput(g);let I;const z=new gr;for(const B of this._def.checks)B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_small,type:"bigint",minimum:B.value,inclusive:B.inclusive,message:B.message}),z.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_big,type:"bigint",maximum:B.value,inclusive:B.inclusive,message:B.message}),z.dirty()):B.kind==="multipleOf"?g.data%B.value!==BigInt(0)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_multiple_of,multipleOf:B.value,message:B.message}),z.dirty()):Dt.assertNever(B);return{status:z.value,value:g.data}}_getInvalidInput(g){const b=this._getOrReturnCtx(g);return qe(b,{code:je.invalid_type,expected:Xe.bigint,received:b.parsedType}),ht}gte(g,b){return this.setLimit("min",g,!0,tt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,tt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,tt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,tt.toString(b))}setLimit(g,b,I,z){return new La({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:tt.toString(z)}]})}_addCheck(g){return new La({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(b)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}La.create=v=>{var g;return new La({checks:[],typeName:ut.ZodBigInt,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};class Rl extends wt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Xe.boolean){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.boolean,received:I.parsedType}),ht}return Er(g.data)}}Rl.create=v=>new Rl({typeName:ut.ZodBoolean,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class vs extends wt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Xe.date){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.date,received:B.parsedType}),ht}if(isNaN(g.data.getTime())){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_date}),ht}const I=new gr;let z;for(const B of this._def.checks)B.kind==="min"?g.data.getTime()<B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_small,message:B.message,inclusive:!0,exact:!1,minimum:B.value,type:"date"}),I.dirty()):B.kind==="max"?g.data.getTime()>B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_big,message:B.message,inclusive:!0,exact:!1,maximum:B.value,type:"date"}),I.dirty()):Dt.assertNever(B);return{status:I.value,value:new Date(g.data.getTime())}}_addCheck(g){return new vs({...this._def,checks:[...this._def.checks,g]})}min(g,b){return this._addCheck({kind:"min",value:g.getTime(),message:tt.toString(b)})}max(g,b){return this._addCheck({kind:"max",value:g.getTime(),message:tt.toString(b)})}get minDate(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g!=null?new Date(g):null}}vs.create=v=>new vs({checks:[],coerce:(v==null?void 0:v.coerce)||!1,typeName:ut.ZodDate,...yt(v)});class zu extends wt{_parse(g){if(this._getType(g)!==Xe.symbol){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.symbol,received:I.parsedType}),ht}return Er(g.data)}}zu.create=v=>new zu({typeName:ut.ZodSymbol,...yt(v)});class Dl extends wt{_parse(g){if(this._getType(g)!==Xe.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.undefined,received:I.parsedType}),ht}return Er(g.data)}}Dl.create=v=>new Dl({typeName:ut.ZodUndefined,...yt(v)});class Ll extends wt{_parse(g){if(this._getType(g)!==Xe.null){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.null,received:I.parsedType}),ht}return Er(g.data)}}Ll.create=v=>new Ll({typeName:ut.ZodNull,...yt(v)});class bo extends wt{constructor(){super(...arguments),this._any=!0}_parse(g){return Er(g.data)}}bo.create=v=>new bo({typeName:ut.ZodAny,...yt(v)});class bs extends wt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return Er(g.data)}}bs.create=v=>new bs({typeName:ut.ZodUnknown,...yt(v)});class aa extends wt{_parse(g){const b=this._getOrReturnCtx(g);return qe(b,{code:je.invalid_type,expected:Xe.never,received:b.parsedType}),ht}}aa.create=v=>new aa({typeName:ut.ZodNever,...yt(v)});class Ru extends wt{_parse(g){if(this._getType(g)!==Xe.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.void,received:I.parsedType}),ht}return Er(g.data)}}Ru.create=v=>new Ru({typeName:ut.ZodVoid,...yt(v)});class bn extends wt{_parse(g){const{ctx:b,status:I}=this._processInputParams(g),z=this._def;if(b.parsedType!==Xe.array)return qe(b,{code:je.invalid_type,expected:Xe.array,received:b.parsedType}),ht;if(z.exactLength!==null){const S=b.data.length>z.exactLength.value,o=b.data.length<z.exactLength.value;(S||o)&&(qe(b,{code:S?je.too_big:je.too_small,minimum:o?z.exactLength.value:void 0,maximum:S?z.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:z.exactLength.message}),I.dirty())}if(z.minLength!==null&&b.data.length<z.minLength.value&&(qe(b,{code:je.too_small,minimum:z.minLength.value,type:"array",inclusive:!0,exact:!1,message:z.minLength.message}),I.dirty()),z.maxLength!==null&&b.data.length>z.maxLength.value&&(qe(b,{code:je.too_big,maximum:z.maxLength.value,type:"array",inclusive:!0,exact:!1,message:z.maxLength.message}),I.dirty()),b.common.async)return Promise.all([...b.data].map((S,o)=>z.type._parseAsync(new Un(b,S,b.path,o)))).then(S=>gr.mergeArray(I,S));const B=[...b.data].map((S,o)=>z.type._parseSync(new Un(b,S,b.path,o)));return gr.mergeArray(I,B)}get element(){return this._def.type}min(g,b){return new bn({...this._def,minLength:{value:g,message:tt.toString(b)}})}max(g,b){return new bn({...this._def,maxLength:{value:g,message:tt.toString(b)}})}length(g,b){return new bn({...this._def,exactLength:{value:g,message:tt.toString(b)}})}nonempty(g){return this.min(1,g)}}bn.create=(v,g)=>new bn({type:v,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...yt(g)});function wo(v){if(v instanceof _i){const g={};for(const b in v.shape){const I=v.shape[b];g[b]=Gn.create(wo(I))}return new _i({...v._def,shape:()=>g})}else return v instanceof bn?new bn({...v._def,type:wo(v.element)}):v instanceof Gn?Gn.create(wo(v.unwrap())):v instanceof Fa?Fa.create(wo(v.unwrap())):v instanceof $n?$n.create(v.items.map(g=>wo(g))):v}class _i extends wt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),b=Dt.objectKeys(g);return this._cached={shape:g,keys:b}}_parse(g){if(this._getType(g)!==Xe.object){const me=this._getOrReturnCtx(g);return qe(me,{code:je.invalid_type,expected:Xe.object,received:me.parsedType}),ht}const{status:I,ctx:z}=this._processInputParams(g),{shape:B,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof aa&&this._def.unknownKeys==="strip"))for(const me in z.data)S.includes(me)||o.push(me);const he=[];for(const me of S){const Pe=B[me],Be=z.data[me];he.push({key:{status:"valid",value:me},value:Pe._parse(new Un(z,Be,z.path,me)),alwaysSet:me in z.data})}if(this._def.catchall instanceof aa){const me=this._def.unknownKeys;if(me==="passthrough")for(const Pe of o)he.push({key:{status:"valid",value:Pe},value:{status:"valid",value:z.data[Pe]}});else if(me==="strict")o.length>0&&(qe(z,{code:je.unrecognized_keys,keys:o}),I.dirty());else if(me!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const me=this._def.catchall;for(const Pe of o){const Be=z.data[Pe];he.push({key:{status:"valid",value:Pe},value:me._parse(new Un(z,Be,z.path,Pe)),alwaysSet:Pe in z.data})}}return z.common.async?Promise.resolve().then(async()=>{const me=[];for(const Pe of he){const Be=await Pe.key,Ee=await Pe.value;me.push({key:Be,value:Ee,alwaysSet:Pe.alwaysSet})}return me}).then(me=>gr.mergeObjectSync(I,me)):gr.mergeObjectSync(I,he)}get shape(){return this._def.shape()}strict(g){return tt.errToObj,new _i({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(b,I)=>{var z,B,S,o;const he=(S=(B=(z=this._def).errorMap)===null||B===void 0?void 0:B.call(z,b,I).message)!==null&&S!==void 0?S:I.defaultError;return b.code==="unrecognized_keys"?{message:(o=tt.errToObj(g).message)!==null&&o!==void 0?o:he}:{message:he}}}:{}})}strip(){return new _i({...this._def,unknownKeys:"strip"})}passthrough(){return new _i({...this._def,unknownKeys:"passthrough"})}extend(g){return new _i({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new _i({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ut.ZodObject})}setKey(g,b){return this.augment({[g]:b})}catchall(g){return new _i({...this._def,catchall:g})}pick(g){const b={};return Dt.objectKeys(g).forEach(I=>{g[I]&&this.shape[I]&&(b[I]=this.shape[I])}),new _i({...this._def,shape:()=>b})}omit(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{g[I]||(b[I]=this.shape[I])}),new _i({...this._def,shape:()=>b})}deepPartial(){return wo(this)}partial(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{const z=this.shape[I];g&&!g[I]?b[I]=z:b[I]=z.optional()}),new _i({...this._def,shape:()=>b})}required(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{if(g&&!g[I])b[I]=this.shape[I];else{let B=this.shape[I];for(;B instanceof Gn;)B=B._def.innerType;b[I]=B}}),new _i({...this._def,shape:()=>b})}keyof(){return $f(Dt.objectKeys(this.shape))}}_i.create=(v,g)=>new _i({shape:()=>v,unknownKeys:"strip",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)}),_i.strictCreate=(v,g)=>new _i({shape:()=>v,unknownKeys:"strict",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)}),_i.lazycreate=(v,g)=>new _i({shape:v,unknownKeys:"strip",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)});class Bl extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I=this._def.options;function z(B){for(const o of B)if(o.result.status==="valid")return o.result;for(const o of B)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const S=B.map(o=>new Jr(o.ctx.common.issues));return qe(b,{code:je.invalid_union,unionErrors:S}),ht}if(b.common.async)return Promise.all(I.map(async B=>{const S={...b,common:{...b.common,issues:[]},parent:null};return{result:await B._parseAsync({data:b.data,path:b.path,parent:S}),ctx:S}})).then(z);{let B;const S=[];for(const he of I){const me={...b,common:{...b.common,issues:[]},parent:null},Pe=he._parseSync({data:b.data,path:b.path,parent:me});if(Pe.status==="valid")return Pe;Pe.status==="dirty"&&!B&&(B={result:Pe,ctx:me}),me.common.issues.length&&S.push(me.common.issues)}if(B)return b.common.issues.push(...B.ctx.common.issues),B.result;const o=S.map(he=>new Jr(he));return qe(b,{code:je.invalid_union,unionErrors:o}),ht}}get options(){return this._def.options}}Bl.create=(v,g)=>new Bl({options:v,typeName:ut.ZodUnion,...yt(g)});const sa=v=>v instanceof jl?sa(v.schema):v instanceof wn?sa(v.innerType()):v instanceof Nl?[v.value]:v instanceof Ba?v.options:v instanceof Zl?Dt.objectValues(v.enum):v instanceof Vl?sa(v._def.innerType):v instanceof Dl?[void 0]:v instanceof Ll?[null]:v instanceof Gn?[void 0,...sa(v.unwrap())]:v instanceof Fa?[null,...sa(v.unwrap())]:v instanceof Td||v instanceof Gl?sa(v.unwrap()):v instanceof Ul?sa(v._def.innerType):[];class Du extends wt{_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.object)return qe(b,{code:je.invalid_type,expected:Xe.object,received:b.parsedType}),ht;const I=this.discriminator,z=b.data[I],B=this.optionsMap.get(z);return B?b.common.async?B._parseAsync({data:b.data,path:b.path,parent:b}):B._parseSync({data:b.data,path:b.path,parent:b}):(qe(b,{code:je.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[I]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(g,b,I){const z=new Map;for(const B of b){const S=sa(B.shape[g]);if(!S.length)throw new Error(`A discriminator value for key \`${g}\` could not be extracted from all schema options`);for(const o of S){if(z.has(o))throw new Error(`Discriminator property ${String(g)} has duplicate value ${String(o)}`);z.set(o,B)}}return new Du({typeName:ut.ZodDiscriminatedUnion,discriminator:g,options:b,optionsMap:z,...yt(I)})}}function wd(v,g){const b=na(v),I=na(g);if(v===g)return{valid:!0,data:v};if(b===Xe.object&&I===Xe.object){const z=Dt.objectKeys(g),B=Dt.objectKeys(v).filter(o=>z.indexOf(o)!==-1),S={...v,...g};for(const o of B){const he=wd(v[o],g[o]);if(!he.valid)return{valid:!1};S[o]=he.data}return{valid:!0,data:S}}else if(b===Xe.array&&I===Xe.array){if(v.length!==g.length)return{valid:!1};const z=[];for(let B=0;B<v.length;B++){const S=v[B],o=g[B],he=wd(S,o);if(!he.valid)return{valid:!1};z.push(he.data)}return{valid:!0,data:z}}else return b===Xe.date&&I===Xe.date&&+v==+g?{valid:!0,data:v}:{valid:!1}}class Fl extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g),z=(B,S)=>{if(xd(B)||xd(S))return ht;const o=wd(B.value,S.value);return o.valid?((vd(B)||vd(S))&&b.dirty(),{status:b.value,value:o.data}):(qe(I,{code:je.invalid_intersection_types}),ht)};return I.common.async?Promise.all([this._def.left._parseAsync({data:I.data,path:I.path,parent:I}),this._def.right._parseAsync({data:I.data,path:I.path,parent:I})]).then(([B,S])=>z(B,S)):z(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}Fl.create=(v,g,b)=>new Fl({left:v,right:g,typeName:ut.ZodIntersection,...yt(b)});class $n extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.array)return qe(I,{code:je.invalid_type,expected:Xe.array,received:I.parsedType}),ht;if(I.data.length<this._def.items.length)return qe(I,{code:je.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&I.data.length>this._def.items.length&&(qe(I,{code:je.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const B=[...I.data].map((S,o)=>{const he=this._def.items[o]||this._def.rest;return he?he._parse(new Un(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(B).then(S=>gr.mergeArray(b,S)):gr.mergeArray(b,B)}get items(){return this._def.items}rest(g){return new $n({...this._def,rest:g})}}$n.create=(v,g)=>{if(!Array.isArray(v))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $n({items:v,typeName:ut.ZodTuple,rest:null,...yt(g)})};class Ol extends wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.object)return qe(I,{code:je.invalid_type,expected:Xe.object,received:I.parsedType}),ht;const z=[],B=this._def.keyType,S=this._def.valueType;for(const o in I.data)z.push({key:B._parse(new Un(I,o,I.path,o)),value:S._parse(new Un(I,I.data[o],I.path,o)),alwaysSet:o in I.data});return I.common.async?gr.mergeObjectAsync(b,z):gr.mergeObjectSync(b,z)}get element(){return this._def.valueType}static create(g,b,I){return b instanceof wt?new Ol({keyType:g,valueType:b,typeName:ut.ZodRecord,...yt(I)}):new Ol({keyType:vn.create(),valueType:g,typeName:ut.ZodRecord,...yt(b)})}}class Lu extends wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.map)return qe(I,{code:je.invalid_type,expected:Xe.map,received:I.parsedType}),ht;const z=this._def.keyType,B=this._def.valueType,S=[...I.data.entries()].map(([o,he],me)=>({key:z._parse(new Un(I,o,I.path,[me,"key"])),value:B._parse(new Un(I,he,I.path,[me,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const he of S){const me=await he.key,Pe=await he.value;if(me.status==="aborted"||Pe.status==="aborted")return ht;(me.status==="dirty"||Pe.status==="dirty")&&b.dirty(),o.set(me.value,Pe.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const he of S){const me=he.key,Pe=he.value;if(me.status==="aborted"||Pe.status==="aborted")return ht;(me.status==="dirty"||Pe.status==="dirty")&&b.dirty(),o.set(me.value,Pe.value)}return{status:b.value,value:o}}}}Lu.create=(v,g,b)=>new Lu({valueType:g,keyType:v,typeName:ut.ZodMap,...yt(b)});class ws extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.set)return qe(I,{code:je.invalid_type,expected:Xe.set,received:I.parsedType}),ht;const z=this._def;z.minSize!==null&&I.data.size<z.minSize.value&&(qe(I,{code:je.too_small,minimum:z.minSize.value,type:"set",inclusive:!0,exact:!1,message:z.minSize.message}),b.dirty()),z.maxSize!==null&&I.data.size>z.maxSize.value&&(qe(I,{code:je.too_big,maximum:z.maxSize.value,type:"set",inclusive:!0,exact:!1,message:z.maxSize.message}),b.dirty());const B=this._def.valueType;function S(he){const me=new Set;for(const Pe of he){if(Pe.status==="aborted")return ht;Pe.status==="dirty"&&b.dirty(),me.add(Pe.value)}return{status:b.value,value:me}}const o=[...I.data.values()].map((he,me)=>B._parse(new Un(I,he,I.path,me)));return I.common.async?Promise.all(o).then(he=>S(he)):S(o)}min(g,b){return new ws({...this._def,minSize:{value:g,message:tt.toString(b)}})}max(g,b){return new ws({...this._def,maxSize:{value:g,message:tt.toString(b)}})}size(g,b){return this.min(g,b).max(g,b)}nonempty(g){return this.min(1,g)}}ws.create=(v,g)=>new ws({valueType:v,minSize:null,maxSize:null,typeName:ut.ZodSet,...yt(g)});class To extends wt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.function)return qe(b,{code:je.invalid_type,expected:Xe.function,received:b.parsedType}),ht;function I(o,he){return Au({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),xo].filter(me=>!!me),issueData:{code:je.invalid_arguments,argumentsError:he}})}function z(o,he){return Au({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),xo].filter(me=>!!me),issueData:{code:je.invalid_return_type,returnTypeError:he}})}const B={errorMap:b.common.contextualErrorMap},S=b.data;if(this._def.returns instanceof Mo){const o=this;return Er(async function(...he){const me=new Jr([]),Pe=await o._def.args.parseAsync(he,B).catch(le=>{throw me.addIssue(I(he,le)),me}),Be=await Reflect.apply(S,this,Pe);return await o._def.returns._def.type.parseAsync(Be,B).catch(le=>{throw me.addIssue(z(Be,le)),me})})}else{const o=this;return Er(function(...he){const me=o._def.args.safeParse(he,B);if(!me.success)throw new Jr([I(he,me.error)]);const Pe=Reflect.apply(S,this,me.data),Be=o._def.returns.safeParse(Pe,B);if(!Be.success)throw new Jr([z(Pe,Be.error)]);return Be.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new To({...this._def,args:$n.create(g).rest(bs.create())})}returns(g){return new To({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,b,I){return new To({args:g||$n.create([]).rest(bs.create()),returns:b||bs.create(),typeName:ut.ZodFunction,...yt(I)})}}class jl extends wt{get schema(){return this._def.getter()}_parse(g){const{ctx:b}=this._processInputParams(g);return this._def.getter()._parse({data:b.data,path:b.path,parent:b})}}jl.create=(v,g)=>new jl({getter:v,typeName:ut.ZodLazy,...yt(g)});class Nl extends wt{_parse(g){if(g.data!==this._def.value){const b=this._getOrReturnCtx(g);return qe(b,{received:b.data,code:je.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:g.data}}get value(){return this._def.value}}Nl.create=(v,g)=>new Nl({value:v,typeName:ut.ZodLiteral,...yt(g)});function $f(v,g){return new Ba({values:v,typeName:ut.ZodEnum,...yt(g)})}class Ba extends wt{constructor(){super(...arguments),kl.set(this,void 0)}_parse(g){if(typeof g.data!="string"){const b=this._getOrReturnCtx(g),I=this._def.values;return qe(b,{expected:Dt.joinValues(I),received:b.parsedType,code:je.invalid_type}),ht}if(ku(this,kl)||jf(this,kl,new Set(this._def.values)),!ku(this,kl).has(g.data)){const b=this._getOrReturnCtx(g),I=this._def.values;return qe(b,{received:b.data,code:je.invalid_enum_value,options:I}),ht}return Er(g.data)}get options(){return this._def.values}get enum(){const g={};for(const b of this._def.values)g[b]=b;return g}get Values(){const g={};for(const b of this._def.values)g[b]=b;return g}get Enum(){const g={};for(const b of this._def.values)g[b]=b;return g}extract(g,b=this._def){return Ba.create(g,{...this._def,...b})}exclude(g,b=this._def){return Ba.create(this.options.filter(I=>!g.includes(I)),{...this._def,...b})}}kl=new WeakMap,Ba.create=$f;class Zl extends wt{constructor(){super(...arguments),zl.set(this,void 0)}_parse(g){const b=Dt.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(g);if(I.parsedType!==Xe.string&&I.parsedType!==Xe.number){const z=Dt.objectValues(b);return qe(I,{expected:Dt.joinValues(z),received:I.parsedType,code:je.invalid_type}),ht}if(ku(this,zl)||jf(this,zl,new Set(Dt.getValidEnumValues(this._def.values))),!ku(this,zl).has(g.data)){const z=Dt.objectValues(b);return qe(I,{received:I.data,code:je.invalid_enum_value,options:z}),ht}return Er(g.data)}get enum(){return this._def.values}}zl=new WeakMap,Zl.create=(v,g)=>new Zl({values:v,typeName:ut.ZodNativeEnum,...yt(g)});class Mo extends wt{unwrap(){return this._def.type}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.promise&&b.common.async===!1)return qe(b,{code:je.invalid_type,expected:Xe.promise,received:b.parsedType}),ht;const I=b.parsedType===Xe.promise?b.data:Promise.resolve(b.data);return Er(I.then(z=>this._def.type.parseAsync(z,{path:b.path,errorMap:b.common.contextualErrorMap})))}}Mo.create=(v,g)=>new Mo({type:v,typeName:ut.ZodPromise,...yt(g)});class wn extends wt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:b,ctx:I}=this._processInputParams(g),z=this._def.effect||null,B={addIssue:S=>{qe(I,S),S.fatal?b.abort():b.dirty()},get path(){return I.path}};if(B.addIssue=B.addIssue.bind(B),z.type==="preprocess"){const S=z.transform(I.data,B);if(I.common.async)return Promise.resolve(S).then(async o=>{if(b.value==="aborted")return ht;const he=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return he.status==="aborted"?ht:he.status==="dirty"||b.value==="dirty"?vo(he.value):he});{if(b.value==="aborted")return ht;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?ht:o.status==="dirty"||b.value==="dirty"?vo(o.value):o}}if(z.type==="refinement"){const S=o=>{const he=z.refinement(o,B);if(I.common.async)return Promise.resolve(he);if(he instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(I.common.async===!1){const o=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});return o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value).then(()=>({status:b.value,value:o.value}))))}if(z.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!xs(S))return S;const o=z.transform(S.value,B);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:b.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>xs(S)?Promise.resolve(z.transform(S.value,B)).then(o=>({status:b.value,value:o})):S);Dt.assertNever(z)}}wn.create=(v,g,b)=>new wn({schema:v,typeName:ut.ZodEffects,effect:g,...yt(b)}),wn.createWithPreprocess=(v,g,b)=>new wn({schema:g,effect:{type:"preprocess",transform:v},typeName:ut.ZodEffects,...yt(b)});class Gn extends wt{_parse(g){return this._getType(g)===Xe.undefined?Er(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Gn.create=(v,g)=>new Gn({innerType:v,typeName:ut.ZodOptional,...yt(g)});class Fa extends wt{_parse(g){return this._getType(g)===Xe.null?Er(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Fa.create=(v,g)=>new Fa({innerType:v,typeName:ut.ZodNullable,...yt(g)});class Vl extends wt{_parse(g){const{ctx:b}=this._processInputParams(g);let I=b.data;return b.parsedType===Xe.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Vl.create=(v,g)=>new Vl({innerType:v,typeName:ut.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...yt(g)});class Ul extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I={...b,common:{...b.common,issues:[]}},z=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return Al(z)?z.then(B=>({status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new Jr(I.common.issues)},input:I.data})})):{status:"valid",value:z.status==="valid"?z.value:this._def.catchValue({get error(){return new Jr(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}Ul.create=(v,g)=>new Ul({innerType:v,typeName:ut.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...yt(g)});class Bu extends wt{_parse(g){if(this._getType(g)!==Xe.nan){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.nan,received:I.parsedType}),ht}return{status:"valid",value:g.data}}}Bu.create=v=>new Bu({typeName:ut.ZodNaN,...yt(v)});const Ry=Symbol("zod_brand");class Td extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I=b.data;return this._def.type._parse({data:I,path:b.path,parent:b})}unwrap(){return this._def.type}}class $l extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.common.async)return(async()=>{const B=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return B.status==="aborted"?ht:B.status==="dirty"?(b.dirty(),vo(B.value)):this._def.out._parseAsync({data:B.value,path:I.path,parent:I})})();{const z=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return z.status==="aborted"?ht:z.status==="dirty"?(b.dirty(),{status:"dirty",value:z.value}):this._def.out._parseSync({data:z.value,path:I.path,parent:I})}}static create(g,b){return new $l({in:g,out:b,typeName:ut.ZodPipeline})}}class Gl extends wt{_parse(g){const b=this._def.innerType._parse(g),I=z=>(xs(z)&&(z.value=Object.freeze(z.value)),z);return Al(b)?b.then(z=>I(z)):I(b)}unwrap(){return this._def.innerType}}Gl.create=(v,g)=>new Gl({innerType:v,typeName:ut.ZodReadonly,...yt(g)});function Gf(v,g){const b=typeof v=="function"?v(g):typeof v=="string"?{message:v}:v;return typeof b=="string"?{message:b}:b}function qf(v,g={},b){return v?bo.create().superRefine((I,z)=>{var B,S;const o=v(I);if(o instanceof Promise)return o.then(he=>{var me,Pe;if(!he){const Be=Gf(g,I),Ee=(Pe=(me=Be.fatal)!==null&&me!==void 0?me:b)!==null&&Pe!==void 0?Pe:!0;z.addIssue({code:"custom",...Be,fatal:Ee})}});if(!o){const he=Gf(g,I),me=(S=(B=he.fatal)!==null&&B!==void 0?B:b)!==null&&S!==void 0?S:!0;z.addIssue({code:"custom",...he,fatal:me})}}):bo.create()}const Dy={object:_i.lazycreate};var ut;(function(v){v.ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly"})(ut||(ut={}));const Ly=(v,g={message:`Input not instance of ${v.name}`})=>qf(b=>b instanceof v,g),Hf=vn.create,Wf=Da.create,By=Bu.create,Fy=La.create,Xf=Rl.create,Oy=vs.create,jy=zu.create,Ny=Dl.create,Zy=Ll.create,Vy=bo.create,Uy=bs.create,$y=aa.create,Gy=Ru.create,qy=bn.create,Hy=_i.create,Wy=_i.strictCreate,Xy=Bl.create,Ky=Du.create,Yy=Fl.create,Jy=$n.create,Qy=Ol.create,ex=Lu.create,tx=ws.create,ix=To.create,rx=jl.create,nx=Nl.create,ax=Ba.create,sx=Zl.create,ox=Mo.create,Kf=wn.create,lx=Gn.create,cx=Fa.create,ux=wn.createWithPreprocess,hx=$l.create;var st=Object.freeze({__proto__:null,defaultErrorMap:xo,setErrorMap:uy,getErrorMap:Eu,makeIssue:Au,EMPTY_PATH:hy,addIssueToContext:qe,ParseStatus:gr,INVALID:ht,DIRTY:vo,OK:Er,isAborted:xd,isDirty:vd,isValid:xs,isAsync:Al,get util(){return Dt},get objectUtil(){return yd},ZodParsedType:Xe,getParsedType:na,ZodType:wt,datetimeRegex:Uf,ZodString:vn,ZodNumber:Da,ZodBigInt:La,ZodBoolean:Rl,ZodDate:vs,ZodSymbol:zu,ZodUndefined:Dl,ZodNull:Ll,ZodAny:bo,ZodUnknown:bs,ZodNever:aa,ZodVoid:Ru,ZodArray:bn,ZodObject:_i,ZodUnion:Bl,ZodDiscriminatedUnion:Du,ZodIntersection:Fl,ZodTuple:$n,ZodRecord:Ol,ZodMap:Lu,ZodSet:ws,ZodFunction:To,ZodLazy:jl,ZodLiteral:Nl,ZodEnum:Ba,ZodNativeEnum:Zl,ZodPromise:Mo,ZodEffects:wn,ZodTransformer:wn,ZodOptional:Gn,ZodNullable:Fa,ZodDefault:Vl,ZodCatch:Ul,ZodNaN:Bu,BRAND:Ry,ZodBranded:Td,ZodPipeline:$l,ZodReadonly:Gl,custom:qf,Schema:wt,ZodSchema:wt,late:Dy,get ZodFirstPartyTypeKind(){return ut},coerce:{string:v=>vn.create({...v,coerce:!0}),number:v=>Da.create({...v,coerce:!0}),boolean:v=>Rl.create({...v,coerce:!0}),bigint:v=>La.create({...v,coerce:!0}),date:v=>vs.create({...v,coerce:!0})},any:Vy,array:qy,bigint:Fy,boolean:Xf,date:Oy,discriminatedUnion:Ky,effect:Kf,enum:ax,function:ix,instanceof:Ly,intersection:Yy,lazy:rx,literal:nx,map:ex,nan:By,nativeEnum:sx,never:$y,null:Zy,nullable:cx,number:Wf,object:Hy,oboolean:()=>Xf().optional(),onumber:()=>Wf().optional(),optional:lx,ostring:()=>Hf().optional(),pipeline:hx,preprocess:ux,promise:ox,record:Qy,set:tx,strictObject:Wy,string:Hf,symbol:jy,transformer:Kf,tuple:Jy,undefined:Ny,union:Xy,unknown:Uy,void:Gy,NEVER:ht,ZodIssueCode:je,quotelessJson:cy,ZodError:Jr});const Fu=st.object({lat:st.number(),lng:st.number()}),dx=st.object({center:Fu,zoom:st.number()}),px=st.object({sw:Fu,ne:Fu}),fx=st.object({name:st.literal("dark").or(st.literal("light")),url:st.string().optional(),colors:st.object({primary:st.string().max(64),background:st.string().max(64),text:st.string().max(64)})}),mx=st.object({container:st.string(),position:st.object({center:st.object({lat:st.number(),lng:st.number()}),zoom:st.number()}),restriction:st.object({minZoom:st.number().min(gd).max(El).optional(),maxZoom:st.number().min(gd).max(El).optional(),maxBounds:px.optional()}).optional(),style:fx});st.enum(["idle","move","click","popup_click"]);const gx=st.function().returns(st.void()),_x=st.function().args(dx).returns(st.void()),yx=st.function().args(Fu).returns(st.void()),xx={idle:gx,move:_x,click:yx},Yf=st.object({id:st.string(),rank:st.number(),lat:st.number(),lng:st.number(),width:st.number(),height:st.number()}),vx=st.tuple([st.number(),st.array(st.tuple([st.number(),st.number()]))]),Jf=st.function().args(st.string()).returns(st.promise(st.any())),bx=st.object({data:Yf,state:vx,content:st.object({bodyCallback:Jf,pinCallback:Jf.optional()})}),wx=st.array(bx);st.object({key:st.string(),data:st.array(Yf)});var Tx=od('<div class="container svelte-1l30n6h"><div class="map svelte-1l30n6h"></div> <div class="logo svelte-1l30n6h"><a href="https://arenarium.dev" target="_blank" class="svelte-1l30n6h">@arenarium/maps</a></div></div>');function Qf(v,g){pu(g,!0);let b,I,z,B,S,o=Zi(0),he=Zi(0),me=Zi(!1),Pe=Zi(void 0);Ef(()=>{mx.parse(g.options),Be(),Ee()});function Be(){var Ce,Ye,Ue;z=((Ce=g.options.restriction)==null?void 0:Ce.minZoom)??gd,B=((Ye=g.options.restriction)==null?void 0:Ye.maxZoom)??El,S=(Ue=g.options.restriction)==null?void 0:Ue.maxBounds,b=new _d.Map({style:yr(g.options.style),center:{lat:g.options.position.center.lat,lng:g.options.position.center.lng},zoom:g.options.position.zoom,minZoom:It(z),maxZoom:B,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}function Ee(){b.on("load",le),b.on("move",Fe),b.on("idle",Bt),b.on("click",fi),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function le(){di(me,!0)}function Fe(){const Ce=b.getCenter(),Ye=b.getZoom();Ft("move",{center:Ce,zoom:Ye});const Ue=b.getBounds();di(Pe,{sw:{lat:Ue.getSouthWest().lat,lng:Ue.getSouthWest().lng},ne:{lat:Ue.getNorthEast().lat,lng:Ue.getNorthEast().lng}},!0)}function Bt(){Ft("idle",null);const Ce=b.getBounds();di(Pe,{sw:{lat:Ce.getSouthWest().lat,lng:Ce.getSouthWest().lng},ne:{lat:Ce.getNorthEast().lat,lng:Ce.getNorthEast().lng}},!0)}function fi(Ce){Ft("click",{lat:Ce.lngLat.lat,lng:Ce.lngLat.lng})}const ti=new Map;function yi(Ce,Ye){var Nt;const Ue=xx[Ce];if(!Ue)throw new Error(`No schema defined for event ${Ce}`);if(!Ue.safeParse(Ye).success)throw new Error(`Invalid handler for event ${Ce}`);ti.has(Ce)||ti.set(Ce,new Set),(Nt=ti.get(Ce))==null||Nt.add(Ye)}function Ki(Ce,Ye){const Ue=ti.get(Ce);Ue&&Ue.delete(Ye)&&Ue.size===0&&ti.delete(Ce)}function Ft(Ce,Ye){const Ue=ti.get(Ce);Ue&&Ue.size>0&&[...Ue].forEach(_t=>{try{_t(Ye)}catch(Nt){console.error(Nt)}})}function It(Ce){const Ye=zf,Ue=Math.ceil(Math.log2(ct(o)/Ye));return Math.max(Ce,Ue)}function $t(){const Ce=b.getCenter();return Ce?{lat:Ce.lat,lng:Ce.lng}:{lat:g.options.position.center.lat,lng:g.options.position.center.lng}}function _r(){return b.getZoom()??g.options.position.zoom}function jt(){if(!b)throw new Error("Map not loaded!");const Ce=b.getBounds();return{sw:{lat:Ce.getSouthWest().lat,lng:Ce.getSouthWest().lng},ne:{lat:Ce.getNorthEast().lat,lng:Ce.getNorthEast().lng}}}function Tn(Ce){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setCenter(Ce)}function Mn(Ce){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setZoom(Ce)}function Yi(){if(!b)throw new Error("Map not loaded! Consider using the position option");b.zoomIn()}function ar(){if(!b)throw new Error("Map not loaded! Consider using the position option.");b.zoomOut()}function Ji(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");z=Ce,b.setMinZoom(It(Ce))}function ot(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");B=Ce,b.setMaxZoom(Ce)}function Vi(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");S=Ce,b.setMaxBounds([Ce.sw.lng,Ce.sw.lat,Ce.ne.lng,Ce.ne.lat])}let xi=Zi(gs(g.options.style));go(()=>{ct(me)&&b.setStyle(yr(ct(xi)),{diff:!0})});function yr(Ce){if(Ce.url)return Ce.url;switch(Ce.name){case"light":return ly;case"dark":return oy}}function Et(){return o_(ct(xi))}function Ar(Ce){di(xi,Ce,!0),b.setStyle(yr(ct(xi)),{diff:!0})}class sr{constructor(Ye){qt(this,"id");qt(this,"lat");qt(this,"lng");qt(this,"zoom");qt(this,"element");qt(this,"component");qt(this,"libreMarker");this.id=Ye.data.id,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.element=void 0,this.component=void 0,this.libreMarker=void 0}createLibreMarker(){const Ye=this.element;if(!Ye)throw new Error("Failed to create libre marker");const Ue=new _d.Marker({element:Ye});Ue.setLngLat([this.lng,this.lat]),this.libreMarker=Ue}isCreated(){return this.element!=null}isInBlock(Ye,Ue){return this.zoom<=Ye&&Ue.contains(this.lat,this.lng)}}class cn extends sr{constructor(Ue){super(Ue);qt(this,"pinLoading",!1);qt(this,"pinLoaded",!1);qt(this,"pinContentCallback");this.pinContentCallback=Ue.content.pinCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=cd(iy,{target:this.element}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ue=this.element;if(!Ue)return;const _t=Math.round((El-this.zoom)*Rf);Ue.style.zIndex=_t.toString()}updateMap(Ue){if(this.libreMarker==null)throw new Error("Failed to update circle map");this.libreMarker._map!=Ue&&(Ue?this.libreMarker.addTo(Ue):this.libreMarker.remove())}updateState(Ue){const _t=this.component;if(!_t)throw new Error("Failed to update circle state");if(this.zoom<=Ue)_t.setCollapsed(!0);else{const cr=1-(this.zoom-Ue)/Df*.5;_t.setScale(cr),_t.setCollapsed(!1)}}updatePin(){var _t;if(this.pinContentCallback==null||this.pinLoaded||this.pinLoading)return;const Ue=(_t=this.component)==null?void 0:_t.getPin();Ue!=null&&(this.pinLoading=!0,this.pinContentCallback(this.id).then(Nt=>{Ue.appendChild(Nt),this.pinLoaded=!0,this.pinLoading=!1}))}isPinLoaded(){return this.pinContentCallback==null||this.pinLoaded}}class kr extends sr{constructor(Ue){super(Ue);qt(this,"width");qt(this,"height");qt(this,"angles");qt(this,"bodyLoading",!1);qt(this,"bodyLoaded",!1);qt(this,"bodyContentCallback");this.id=Ue.data.id,this.angles=Ue.state[1],this.width=Ue.data.width,this.height=Ue.data.height,this.bodyContentCallback=Ue.content.bodyCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=cd(ey,{target:this.element,props:{width:this.width,height:this.height}}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ue=this.element;if(!Ue)return;const _t=Math.round((El-this.zoom)*Rf)+1e6;Ue.style.zIndex=_t.toString()}updateMap(Ue){const _t=this.libreMarker,Nt=this.component;if(_t==null||Nt==null)throw new Error("Failed to update marker map");_t._map!=Ue&&(Ue?(_t.addTo(Ue),Nt.setDisplayed(!0)):(_t.remove(),Nt.setDisplayed(!1)))}updateState(Ue){const _t=this.component;if(!_t)throw new Error("Failed to update marker state");this.zoom<=Ue?(_t.setCollapsed(!1),_t.setAngle(this.getAngle(Ue))):_t.setCollapsed(!0)}updateBody(){var _t;if(this.bodyLoaded||this.bodyLoading)return;const Ue=(_t=this.component)==null?void 0:_t.getBody();Ue!=null&&(this.bodyLoading=!0,this.bodyContentCallback(this.id).then(Nt=>{Ue.appendChild(Nt),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(Ue){let _t=this.angles,Nt=_t[0],cr=0;for(;Nt[0]<Ue&&(cr++,cr!=_t.length);)Nt=_t[cr];return Nt[1]}getExpanded(){return this.component?this.component.getExpanded():!1}getCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class la{constructor(Ye){qt(this,"id");qt(this,"rank");qt(this,"lat");qt(this,"lng");qt(this,"zoom");qt(this,"circle");qt(this,"marker");this.id=Ye.data.id,this.rank=Ye.data.rank,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.circle=new cn(Ye),this.marker=new kr(Ye)}}let xr,Ht=new Array,vr=new Map,Qi=zf,Sn=mu(()=>ct(Pe)?new Ff(b,-512,ct(he)+Qi,ct(o)+Qi,-512):void 0),un=mu(()=>ct(Pe)?new Ff(b,0,ct(he),ct(o),0):void 0);Ef(()=>{const Ce=()=>{ca(),xr=window.setTimeout(Ce,25)};return Ce(),()=>clearInterval(xr)});function ca(){if(ct(me)==!1||ct(un)==null||ct(Sn)==null||Ht.length==0)return;const Ce=b.getZoom();if(Ce)for(const Ye of Ht)or(Ye.circle,Ce,ct(un)),lr(Ye.marker,Ce,ct(Sn))}function or(Ce,Ye,Ue){Ce.isInBlock(Ye+Df,Ue)?(Ce.isCreated()==!1&&Ce.createElement(),Ce.updateMap(b),Ce.updateState(Ye),Ce.isPinLoaded()==!1&&Ce.updatePin()):Ce.isCreated()==!0&&Ce.updateMap(null)}function lr(Ce,Ye,Ue){Ce.isInBlock(Ye+Y_,Ue)?(Ce.isCreated()==!1&&Ce.createElement(),Ce.updateMap(b),Ce.updateState(Ye),Ce.getExpanded()&&Ce.isBodyLoaded()==!1&&Ce.updateBody()):Ce.isCreated()==!0&&(Ce.getCollapsed()?Ce.updateMap(null):Ce.updateState(Ye))}async function Ui(Ce){var Nt,cr;const Ye=new Map(Ce.map(mi=>[mi.data.id,new la(mi)])),Ue=new Array,_t=Array.from(Ht);for(const mi of _t)Ye.has(mi.id)==!1&&((Nt=mi.circle.libreMarker)==null||Nt.remove(),(cr=mi.marker.libreMarker)==null||cr.remove(),vr.delete(mi.id),Ht.splice(Ht.indexOf(mi),1));for(const mi of Ce){const zr=vr.get(mi.data.id);if(zr)zr.circle.zoom=mi.state[0],zr.circle.updateZIndex(),zr.marker.zoom=mi.state[0],zr.marker.angles=mi.state[1],zr.marker.updateZIndex();else{const Rr=new la(mi);vr.set(mi.data.id,Rr),Ht.push(Rr),Ue.push(Rr)}}}function Zt(){var Ce,Ye;for(const Ue of Ht)(Ce=Ue.circle.libreMarker)==null||Ce.remove(),(Ye=Ue.marker.libreMarker)==null||Ye.remove();Ht.length=0,vr.clear()}async function Vr(Ce){if(!(await wx.safeParseAsync(Ce)).success)throw new Error("Invalid popups");await Ui(Ce)}function hn(){Zt()}function br(Ce){const Ye=vr.get(Ce);Ye!=null&&b.flyTo({center:{lat:Ye.lat,lng:Ye.lng},zoom:Ye.zoom})}var Pn=Tx();F_("resize",td,()=>b.setMinZoom(It(z)));var Cn=gu(Pn);return yo(Cn,Ce=>I=Ce,()=>I),id(()=>Pu(Pn,`--primary: ${ct(xi).colors.primary??""}; --background: ${ct(xi).colors.background??""}; --text: ${ct(xi).colors.text??""};`)),Cu(Cn,"clientWidth",Ce=>di(o,Ce)),Cu(Cn,"clientHeight",Ce=>di(he,Ce)),ld(v,Pn),fu({on:yi,off:Ki,emit:Ft,getCenter:$t,getZoom:_r,getBounds:jt,setCenter:Tn,setZoom:Mn,zoomIn:Yi,zoomOut:ar,setMinZoom:Ji,setMaxZoom:ot,setMaxBounds:Vi,getStyle:Et,setStyle:Ar,updatePopups:Vr,removePopups:hn,revealPopup:br})}function Mx(v){const g=document.getElementById(v.container);if(!g)throw new Error(`Container not found: ${v.container}`);return cd(Qf,{target:g,props:{options:v}})}function Sx(v){Z_(v)}Ot.Map=Qf,Ot.mountMap=Mx,Ot.unmountMap=Sx,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})});
742
+ ${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:H},W=E.renderingMode?E.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=E.prerender;K&&(f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),K.call(E,A.gl,q),A.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),A.setStencilMode(mt.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,lt.ReadOnly);A.setDepthMode(K),E.render(A.gl,q),A.setDirty(),f.setBaseState(),A.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1,l=[]){this.cache=this.cache||{};const h=!!this.style.map.terrain,f=this.style.projection,_=s?ur.projectionMercator:f.shaderPreludeCode,x=s?ma:f.shaderDefine,T=e+(i?i.cacheKey:"")+`/${s?Mt:f.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(h?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[T]||(this.cache[T]=new Ro(this.context,ur[e],i,rh[e],this._showOverdrawInspector,h,_,x,l)),this.cache[T]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new jt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:i}=this.context.gl;return this.width!==e||this.height!==i}}function Xs(u,e){let i,s=!1,l=null,h=null;const f=()=>{l=null,s&&(u.apply(h,i),l=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,l||f(),l)}class bc{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let s;return i.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(s=l)}),(s&&s[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:s,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const s=i.join("/");let l=s;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${s}`);let h=window.location.hash.replace(l,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let f=window.location.href.replace(/(#.+)?$/,h);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=Xs(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(P+="/"+Math.round(10*x)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const A=this._hashName;let E=!1;const F=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===A?(E=!0,`${H}=${P}`):O}).filter(O=>O);return E||F.push(`${A}=${P}`),`#${F.join("&")}`}return`#${P}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.Q(+e[2],+e[1])}catch{return!1}const i=+e[0],s=+(e[3]||0),l=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&s>=-180&&s<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const mn={linearity:.3,easing:o.cd(0,0,.3,1)},wc=o.e({deceleration:2500,maxSpeed:1400},mn),Ks=o.e({deceleration:20,maxSpeed:1400},mn),Tc=o.e({deceleration:1e3,maxSpeed:360},mn),_h=o.e({deceleration:1e3,maxSpeed:90},mn),yh=o.e({deceleration:1e3,maxSpeed:360},mn);class xh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ee.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ee.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)i.zoom+=h.zoomDelta||0,i.bearing+=h.bearingDelta||0,i.pitch+=h.pitchDelta||0,i.roll+=h.rollDelta||0,h.panDelta&&i.pan._add(h.panDelta),h.around&&(i.around=h.around),h.pinchAround&&(i.pinchAround=h.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(i.pan.mag()){const h=es(i.pan.mag(),s,o.e({},wc,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,Qa(l,h)}if(i.zoom){const h=es(i.zoom,s,Ks);l.zoom=this._map.transform.zoom+h.amount,Qa(l,h)}if(i.bearing){const h=es(i.bearing,s,Tc);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),Qa(l,h)}if(i.pitch){const h=es(i.pitch,s,_h);l.pitch=this._map.transform.pitch+h.amount,Qa(l,h)}if(i.roll){const h=es(i.roll,s,yh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),Qa(l,h)}if(l.zoom||l.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;l.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),o.e(l,{noMoveStart:!0})}}function Qa(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function es(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class Ei extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s,l={}){s=s instanceof MouseEvent?s:new MouseEvent(e,s);const h=le.mousePos(i.getCanvas(),s),f=i.unproject(h);super(e,o.e({point:h,lngLat:f,originalEvent:s},l)),this._defaultPrevented=!1,this.target=i}}class ts extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){const l=e==="touchend"?s.changedTouches:s.touches,h=le.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,P,A)=>x.add(T.div(A.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class Mc extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class vh{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Mc(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new Ei(e.type,this._map,e))}mouseup(e){this._map.fire(new Ei(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new Ei(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ei(e.type,this._map,e))}mouseover(e){this._map.fire(new Ei(e.type,this._map,e))}mouseout(e){this._map.fire(new Ei(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ts(e.type,this._map,e))}touchmove(e){this._map.fire(new ts(e.type,this._map,e))}touchend(e){this._map.fire(new ts(e.type,this._map,e))}touchcancel(e){this._map.fire(new ts(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class bh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ei(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ei("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ei(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class is{constructor(e){this._map=e}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(e){return this.transform.screenPointToLocation(o.P.convert(e),this._map.terrain)}}class Sc{constructor(e,i){this._map=e,this._tr=new is(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(le.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const s=i;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=s,this._box||(this._box=le.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);le.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),le.suppressClick(),s.x!==l.x||s.y!==l.y)return this._map.fire(new o.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(s,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(le.remove(this._box),this._box=null),le.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function il(u,e){if(u.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${e.length}`);const i={};for(let s=0;s<u.length;s++)i[u[s].identifier]=e[s];return i}class wh{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(l){const h=new o.P(0,0);for(const f of l)h._add(f);return h.div(l.length)}(i),this.touches=il(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=il(s,i);for(const h in this.touches){const f=l[h];(!f||f.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(e,i,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class rs{constructor(e){this.singleTap=new wh(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,s){this.singleTap.touchstart(e,i,s)}touchmove(e,i,s){this.singleTap.touchmove(e,i,s)}touchend(e,i,s){const l=this.singleTap.touchend(e,i,s);if(l){const h=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(l)<30;if(h&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class Th{constructor(e){this._tr=new is(e),this._zoomIn=new rs({numTouches:1,numTaps:2}),this._zoomOut=new rs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const l=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(h)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ir{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(i)?i[0]:i;return!this._moved&&l.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(s,l))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&le.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Qr={0:1,2:2};class ns{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=le.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=Qr[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return le.mouseButton(e)===this._eventButton}}class en{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class as{constructor(e=new ns({checkCorrectEvent:()=>!0}),i=new en){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,s){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?s(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const rl=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class qd{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,s){return this._calculateTransform(e,i,s)}touchmove(e,i,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,i,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,s){this._calculateTransform(e,i,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,s){s.length>0&&(this._active=!0);const l=il(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const P=l[T],A=this._touches[T];A&&(h._add(P),f._add(P.sub(A)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const x=f.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pc{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,s){if(!this._firstTwoTouches)return;e.preventDefault();const[l,h]=this._firstTwoTouches,f=nl(s,i,l),_=nl(s,i,h);if(!f||!_)return;const x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=nl(s,i,l),_=nl(s,i,h);f&&_||(this._active&&le.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function nl(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function Cc(u,e){return Math.log(u/e)/Math.LN2}class ss extends Pc{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){const s=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Cc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cc(this._distance,s),pinchAround:i}}}function gn(u,e){return 180*u.angleWith(e)/Math.PI}class $e extends Pc{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i,s){const l=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:gn(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=gn(e,this._startVector);return Math.abs(s)<i}}function al(u){return Math.abs(u.y)>Math.abs(u.x)}class sl extends Pc{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,i,s){super.touchstart(e,i,s),this._currentTouchCount=s.length}_start(e){this._lastPoints=e,al(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,h,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,s){if(this._valid!==void 0)return this._valid;const l=e.mag()>=2,h=i.mag()>=2;if(!l&&!h)return;if(!l||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return al(e)&&al(i)&&f}}const Mh={panStep:100,bearingStep:15,pitchStep:10};class os{constructor(e){this._tr=new is(e);const i=Mh;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ys,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}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 Ys(u){return u*(2-u)}const Ic=4.000244140625;class vt{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new is(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const s=Ee.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%Ic==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){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 i=le.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.Q.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Ic?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),o.ah(T*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,s=this._startZoom,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=Ee.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.B.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cf;if(this._prevEase){const s=this._prevEase,l=(Ee.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=o.cd(f,_,.25,1)}return this._prevEase={start:Ee.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ol{constructor(e,i){this._clickZoom=e,this._tapZoom=i}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 Hd{constructor(e){this._tr=new is(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ec{constructor(){this._tap=new rs({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(e,i,s){if(!this._swipePoint)if(this._tapTime){const l=i[0],h=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(l)<30;h&&f?s.length>0&&(this._swipePoint=l,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,i,s)}touchmove(e,i,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const l=i[0],h=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(e,i,s)}touchend(e,i,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const l=this._tap.touchend(e,i,s);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Sh{constructor(e,i,s){this._el=e,this._mousePan=i,this._touchPan=s}enable(e){this._inertiaOptions=e||{},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 Ph{constructor(e,i,s,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=s,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Ac{constructor(e,i,s,l){this._el=e,this._touchZoom=i,this._touchRotate=s,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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()}}class ll{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=le.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=i,this._container.appendChild(l);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(le.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new o.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Js=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Wd extends o.l{}function cl(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class Xd{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:E,handler:F,allowed:O}of this._handlers){if(!F.isEnabled())continue;let H;if(this._blockedByActive(T,O,E))F.reset();else if(F[h||l.type]){if(o.cg(l,h||l.type)){const q=le.mousePos(this._map.getCanvas(),l);H=F[h||l.type](l,q)}else if(o.ch(l,h||l.type)){const q=this._getMapTouches(l.touches),W=le.touchPos(this._map.getCanvas(),q);H=F[h||l.type](l,W,q)}else o.ci(h||l.type)||(H=F[h||l.type](l));this.mergeHandlerResult(_,x,H,E,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||F.isActive())&&(T[E]=F)}const P={};for(const E in this._previousActiveHandlers)T[E]||(P[E]=f);this._previousActiveHandlers=T,(Object.keys(P).length||cl(_))&&(this._changes.push([_,x,P]),this._triggerRenderFrame()),(Object.keys(T).length||cl(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=_;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xh(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,h,f]of this._listeners)le.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)le.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new vh(i,e));const l=i.boxZoom=new Sc(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new ll(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new Th(i),_=new Hd(i);i.doubleClickZoom=new ol(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new Ec;this._add("tapDragZoom",x);const T=i.touchPitch=new sl(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),A=function({enable:ee,clickTolerance:ie,aroundCenter:se=!0,minPixelCenterThreshold:re=100,rotateDegreesPerPixelMoved:pe=.8},Me){const xe=new ns({checkCorrectEvent:ve=>le.mouseButton(ve)===0&&ve.ctrlKey||le.mouseButton(ve)===2&&!ve.ctrlKey});return new ir({clickTolerance:ie,move:(ve,be)=>{const Ne=Me();if(se&&Math.abs(Ne.y-ve.y)>re)return{bearingDelta:o.ce(new o.P(ve.x,be.y),be,Ne)};let Oe=(be.x-ve.x)*pe;return se&&be.y<Ne.y&&(Oe=-Oe),{bearingDelta:Oe}},moveStateManager:xe,enable:ee,assignEvents:rl})}(e,P),E=function({enable:ee,clickTolerance:ie,pitchDegreesPerPixelMoved:se=-.5}){const re=new ns({checkCorrectEvent:pe=>le.mouseButton(pe)===0&&pe.ctrlKey||le.mouseButton(pe)===2});return new ir({clickTolerance:ie,move:(pe,Me)=>({pitchDelta:(Me.y-pe.y)*se}),moveStateManager:re,enable:ee,assignEvents:rl})}(e),F=function({enable:ee,clickTolerance:ie,rollDegreesPerPixelMoved:se=.3},re){const pe=new ns({checkCorrectEvent:Me=>le.mouseButton(Me)===2&&Me.ctrlKey});return new ir({clickTolerance:ie,move:(Me,xe)=>{const ve=re();let be=(xe.x-Me.x)*se;return xe.y<ve.y&&(be=-be),{rollDelta:be}},moveStateManager:pe,enable:ee,assignEvents:rl})}(e,P);i.dragRotate=new Ph(e,A,E,F),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",E,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:ee,clickTolerance:ie}){const se=new ns({checkCorrectEvent:re=>le.mouseButton(re)===0&&!re.ctrlKey});return new ir({clickTolerance:ie,move:(re,pe)=>({around:pe,panDelta:pe.sub(re)}),activateOnStart:!0,moveStateManager:se,enable:ee,assignEvents:rl})}(e),H=new qd(e,i);i.dragPan=new Sh(s,O,H),this._add("mousePan",O),this._add("touchPan",H,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new $e,W=new ss;i.touchZoomRotate=new Ac(s,W,q,x),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new vt(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const te=i.keyboard=new os(i);this._add("keyboard",te),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new bh(i))}_add(e,i,s){this._handlers.push({handlerName:e,handler:i,allowed:s}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Js(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,s){for(const l in e)if(l!==s&&(!i||i.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const s of e)this._el.contains(s.target)&&i.push(s);return i}mergeHandlerResult(e,i,s,l,h){if(!s)return;o.e(e,s);const f={handlerName:l,originalEvent:s.originalEvent||h};s.zoomDelta!==void 0&&(i.zoom=f),s.panDelta!==void 0&&(i.drag=f),s.rollDelta!==void 0&&(i.roll=f),s.pitchDelta!==void 0&&(i.pitch=f),s.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},s={};for(const[l,h,f]of this._changes)l.panDelta&&(e.panDelta=(e.panDelta||new o.P(0,0))._add(l.panDelta)),l.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(e.rollDelta=(e.rollDelta||0)+l.rollDelta),l.around!==void 0&&(e.around=l.around),l.pinchAround!==void 0&&(e.pinchAround=l.pinchAround),l.noInertia&&(e.noInertia=l.noInertia),o.e(i,h),o.e(s,f);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(e,i,s){const l=this._map,h=l._getTransformForUpdate(),f=l.terrain;if(!(cl(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:P,rollDelta:A,around:E,pinchAround:F}=e;F!==void 0&&(E=F),E=E||l.transform.centerPoint,f&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:A,pitchDelta:P,bearingDelta:T,around:E};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const H=E.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?E.sub(_):E);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,H):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,H))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,H)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Js(this._eventsInProgress),h=Js(e),f={};for(const A in e){const{originalEvent:E}=e[A];this._eventsInProgress[A]||(f[`${A}start`]=E),this._eventsInProgress[A]=e[A]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const A in f)this._fireEvent(A,f[A]);h&&this._fireEvent("move",h.originalEvent);for(const A in e){const{originalEvent:E}=e[A];this._fireEvent(A,E)}const _={};let x;for(const A in this._eventsInProgress){const{handlerName:E,originalEvent:F}=this._eventsInProgress[A];this._handlersById[E].isActive()||(delete this._eventsInProgress[A],x=i[E]||F,_[`${A}end`]=x)}for(const A in _)this._fireEvent(A,_[A]);const T=Js(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const A=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&A.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(A)}if(s&&P){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),E=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!A||!A.essential&&Ee.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),E(this._map.getBearing())&&this._map.resetNorth()):(E(A.bearing||this._map.getBearing())&&(A.bearing=0),A.freezeElevation=!0,this._map.easeTo(A,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Wd("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Kd extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((Ee.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new o.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,s){return e=o.P.convert(e).mult(-1),this.panTo(this.transform.center,o.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(o.e({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,s){return this.easeTo(o.e({zoom:e},i),s)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)).fire(new o.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,s){return this.easeTo(o.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,o.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(o.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=Zt.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new Zt(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.$.fromLngLat(e,i),f=o.$.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,x,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(_,x),E=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),F=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(A/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:E,pitch:O,bearing:F}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,s,l,h){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,s,l);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:s,pitch:l,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=o.e({offset:[0,0],duration:500,easing:o.cf},e)).animate===!1||!e.essential&&Ee.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let E,F;e.around&&(E=o.Q.convert(e.around),F=s.locationToScreenPoint(E));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},H=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:P,around:E,aroundPoint:F,offsetAsPoint:A,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(P),this._zooming=this._zooming||H.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(H.elevationCenter),this._ease(q=>{H.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:P,elevation:A}=l(h);f&&h.setCenter(f),A!==void 0&&h.setElevation(A),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),P!==void 0&&h.setBearing(P),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new o.l("move",e)),this._zooming&&this.fire(new o.l("zoom",e)),this._rotating&&this.fire(new o.l("rotate",e)),this._pitching&&this.fire(new o.l("pitch",e)),this._rolling&&this.fire(new o.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,l=this._rotating,h=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,s&&this.fire(new o.l("zoomend",e)),l&&this.fire(new o.l("rotateend",e)),h&&this.fire(new o.l("pitchend",e)),f&&this.fire(new o.l("rollend",e)),this.fire(new o.l("moveend",e))}flyTo(e,i){if(!e.essential&&Ee.prefersReducedMotion){const be=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(be,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cf},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,P="roll"in e?this._normalizeBearing(e.roll,f):f,A="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let F=s.centerPoint.add(E);const O=s.screenPointToLocation(F),H=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:P,padding:A,locationAtOffset:O,offsetAsPoint:E,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const W=Math.max(s.width,s.height),K=W/H.scaleOfZoom,te=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/te*2));const ee=q*q;function ie(be){const Ne=(K*K-W*W+(be?-1:1)*ee*ee*te*te)/(2*(be?K:W)*ee*te);return Math.log(Math.sqrt(Ne*Ne+1)-Ne)}function se(be){return(Math.exp(be)-Math.exp(-be))/2}function re(be){return(Math.exp(be)+Math.exp(-be))/2}const pe=ie(!1);let Me=function(be){return re(pe)/re(pe+q*be)},xe=function(be){return W*((re(pe)*(se(Ne=pe+q*be)/re(Ne))-se(pe))/ee)/te;var Ne},ve=(ie(!0)-pe)/q;if(Math.abs(te)<2e-6||!isFinite(ve)){if(Math.abs(W-K)<1e-6)return this.easeTo(e,i);const be=K<W?-1:1;ve=Math.abs(Math.log(K/W))/q,xe=()=>0,Me=Ne=>Math.exp(be*q*Ne)}return e.duration="duration"in e?+e.duration:1e3*ve/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(A),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(be=>{const Ne=be*ve,Oe=1/Me(Ne),Re=xe(Ne);this._rotating&&s.setBearing(o.B.number(l,x,be)),this._pitching&&s.setPitch(o.B.number(h,T,be)),this._rolling&&s.setRoll(o.B.number(f,P,be)),this._padding&&(s.interpolatePadding(_,A,be),F=s.centerPoint.add(E)),H.easeFunc(be,Oe,Re,F),this.terrain&&!e.freezeElevation&&this._updateElevation(be),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,i)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,i,s){s.animate===!1||s.duration===0?(e(1),i()):(this._easeStart=Ee.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aL(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(o.Q.convert(e),this.transform.tileZoom):null}}const zn={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Xt{constructor(e=zn){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=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=le.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=le.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=le.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(){le.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(e,i){const s=this._map._getUIString(`AttributionControl.${i}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const i=this._map.style.sourceCaches;for(const l in i){const h=i[l];if(h.used||h.usedForTerrain){const f=h.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(l=>String(l).trim()),e.sort((l,h)=>l.length-h.length),e=e.filter((l,h)=>{for(let f=h+1;f<e.length;f++)if(e[f].indexOf(l)>=0)return!1;return!0});const s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=le.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Qs{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const s=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=le.create("div","maplibregl-ctrl");const i=le.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){le.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class kc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,s=i?this._queue.concat(i):this._queue;for(const l of s)if(l.id===e)return void(l.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const s of i)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ch=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class Ih extends o.E{constructor(e){super(),this._lastTilesetChange=Ee.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const l of oe(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))s[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),o.bQ(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new In(l,this.tileSize),this._lastTilesetChange=Ee.now());for(const l in this._tiles)s[l]||delete this._tiles[l]}freeRtt(e){for(const i in this._tiles){const s=this._tiles[i];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const s of this._renderableTilesKeys){const l=this._tiles[s].tileID,h=e.clone(),f=o.b2();if(l.canonical.equals(e.canonical))o.bQ(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,P,P,0,0,1),o.L(f,f,[-x*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[x*P,T*P,0]),o.M(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=o.b2();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bQ(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[x*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),P=h.canonical.y-(h.canonical.y>>x<<x),A=e.canonical.x-(h.canonical.x>>x),E=e.canonical.y-(h.canonical.y>>x),F=o.Z>>x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[-T*F+A*o.Z,-P*F+E*o.Z,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),P=e.canonical.y-(e.canonical.y>>x<<x),A=(e.canonical.x>>x)-h.canonical.x,E=(e.canonical.y>>x)-h.canonical.y,F=o.Z<<x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[T*o.Z+A*F,P*o.Z+E*F,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[l]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class Eh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new Ih(i),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,s,l=o.Z){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.cj([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],P=Math.floor(T[0]),A=Math.floor(T[1]),E=T[0]-P,F=T[1]-A;return _.get(P,A)*(1-E)*(1-F)+_.get(P+1,A)*E*(1-F)+_.get(P,A+1)*(1-E)*F+_.get(P+1,A+1)*E*F}getElevationForLngLatZoom(e,i){if(!o.ck(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.Z,h%o.Z,o.Z)}getElevation(e,i,s,l=o.Z){return this.getDEMElevation(e,i,s,l)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const l=this.painter.context,h=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new jt(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new jt(l,new o.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.ad([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const l=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new jt(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.cl(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(x,x,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new jt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new jt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,f=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&h,i[f+2]=_>>8<<4|h>>8,i[f+3]=0;const s=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new jt(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],A=P&&this.sourceCache.getTileByID(P);if(!A)return null;const E=this._coordsTextureSize,F=(1<<A.tileID.canonical.z)*E;return new o.$((A.tileID.canonical.x*E+x)/F+A.tileID.wrap,(A.tileID.canonical.y*E+T)/F,this.getElevation(A.tileID,x,T,E))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.cm,T=new o.aK,P=this.meshSize,A=o.Z/P,E=P*P;for(let re=0;re<=P;re++)for(let pe=0;pe<=P;pe++)x.emplaceBack(pe*A,re*A,0);for(let re=0;re<E;re+=P+1)for(let pe=0;pe<P;pe++)T.emplaceBack(pe+re,P+pe+re+1,P+pe+re+2),T.emplaceBack(pe+re,P+pe+re+2,pe+re+1);const F=x.length,O=F+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,te=h?0:1;for(let re=0;re<=P;re++)x.emplaceBack(re*A,q,W);for(let re=0;re<=P;re++)x.emplaceBack(re*A,K,te);for(let re=0;re<P;re++)T.emplaceBack(H+re,O+re,O+re+1),T.emplaceBack(H+re,O+re+1,H+re+1),T.emplaceBack(0+re,F+re+1,F+re),T.emplaceBack(0+re,0+re+1,F+re+1);const ee=x.length,ie=ee+2*(P+1);for(const re of[0,1])for(let pe=0;pe<=P;pe++)for(const Me of[0,1])x.emplaceBack(re*o.Z,pe*A,Me);for(let re=0;re<2*P;re+=2)T.emplaceBack(ee+re,ee+re+1,ee+re+3),T.emplaceBack(ee+re,ee+re+3,ee+re+2),T.emplaceBack(ie+re,ie+re+3,ie+re+1),T.emplaceBack(ie+re,ie+re+2,ie+re+3);const se=new Ua(_.createVertexBuffer(x,Ch.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=se,se}getMeshFrameDelta(e){return 2*Math.PI*o.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var s;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(s=this.getMinMaxElevation(l).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,s={minElevation:null,maxElevation:null};return i&&i.dem&&(s.minElevation=i.dem.min*this.exaggeration,s.maxElevation=i.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(e,i){const s=o.$.fromLngLat(e.wrap()),l=(1<<i)*o.Z,h=s.x*l,f=s.y*l,_=Math.floor(h/o.Z),x=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class Yd{constructor(e,i,s){this._context=e,this._size=i,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new jt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(s.texture),{id:e,fbo:i,texture:s,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>e.id!==i),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const i of this._recentlyUsed)if(!this._objects[i].inUse)return this._objects[i];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const pr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ul{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Yd(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(i)),this._coordsAscending={};for(const s in e.sourceCaches){this._coordsAscending[s]={};const l=e.sourceCaches[s].getVisibleCoordinates(),h=e.sourceCaches[s].getSource(),f=h instanceof Ce?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(pr[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][s.tileID.key];h&&h!==s.rttCoords[l]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(pr[l]&&(this._prevType&&pr[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(pr[this._prevType]||pr[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(Xn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const A=this.pool.getObjectForId(T.rtt[_].id);if(A.stamp===T.rtt[_].stamp){this.pool.useObject(A);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),T.rtt[_]={id:P.id,stamp:P.stamp},h.context.bindFramebuffer.set(P.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let A=0;A<x.length;A++){const E=h.style._layers[x[A]],F=E.source?this._coordsAscending[E.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),h._renderTileClippingMasks(E,F,!0),h.renderLayer(h,h.style.sourceCaches[E.source],E,F,s),E.source&&(T.rttCoords[E.source]=this._coordsAscendingStr[E.source][T.tileID.key])}}return Xn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),pr[l]}return!1}}const Ke={"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":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},rt=he,eo={hash:!1,interactive:!0,bearingSnap:7,attributionControl:zn,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:o.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},zc={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Rc{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,le.mousePos(this.element,h)),le.addEventListener(window,"mousemove",this.mousemove),le.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,le.mousePos(this.element,h))},this.mouseup=h=>{this._rotatePitchHanlder.dragEnd(h),this.offTemp()},this.touchstart=h=>{h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),le.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const l=new as;this._rotatePitchHanlder=new ir({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.ce(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,le.addEventListener(i,"mousedown",this.mousedown),le.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),le.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),le.disableDrag()}move(e,i){const s=this.map,{bearingDelta:l,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};l&&s.setBearing(s.getBearing()+l),h&&s.setPitch(s.getPitch()+h)}off(){const e=this.element;le.removeEventListener(e,"mousedown",this.mousedown),le.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend),le.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){le.enableDrag(),le.removeEventListener(window,"mousemove",this.mousemove),le.removeEventListener(window,"mouseup",this.mouseup),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend)}}let Ti;function Dc(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const h=new o.Q(u.lng-360,u.lat),f=new o.Q(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(f).distSqr(e)<_&&(u=f)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const qr={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 Ah(u,e,i){const s=u.classList;for(const l in qr)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Ma extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,l=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=Dc(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),le.setTransform(this._element,`${qr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),Ee.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=i.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.l("dragstart"))),this.fire(new o.l("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 o.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=o.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=le.create("div");const i=le.createNS("http://www.w3.org/2000/svg","svg"),s=41,l=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${s}px`),i.setAttributeNS(null,"width",`${l}px`),i.setAttributeNS(null,"viewBox",`0 0 ${l} ${s}`);const h=le.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const f=le.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=le.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{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 W of x){const K=le.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",W.rx),K.setAttributeNS(null,"ry",W.ry),_.appendChild(K)}const T=le.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=le.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"),T.appendChild(P);const A=le.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const E=le.createNS("http://www.w3.org/2000/svg","path");E.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"),A.appendChild(E);const F=le.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=le.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=le.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const q=le.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(q),f.appendChild(_),f.appendChild(T),f.appendChild(A),f.appendChild(F),f.appendChild(O),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),Ah(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",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("terrain",this._update),this._map.off("projectiontransition",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),le.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;const l=(i=this._map)===null||i===void 0?void 0:i.terrain,h=this._map.transform.isLocationOccluded(this._lngLat);if(!l||h){const F=h?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==F&&(this._element.style.opacity=F))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),x=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/f.transform.pixelsPerMeter,P=Math.sin(f.getPitch()*Math.PI/180)*T,A=f.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),E=f.transform.lngLatToCameraDepth(this._lngLat,x+P)-A>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&E&&this._popup.remove(),this._element.style.opacity=E?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=o.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const ui={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ii=0,ls=!1;const to={maxWidth:100,unit:"metric"};function io(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const A=3.2808*P;A>5280?Sa(e,T,A/5280,u._getUIString("ScaleControl.Miles")):Sa(e,T,A,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Sa(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Sa(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):Sa(e,T,P,u._getUIString("ScaleControl.Meters"))}function Sa(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const Lc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Bc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function cs(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,u),"top-left":new o.P(e,e),"top-right":new o.P(-e,e),bottom:new o.P(0,-u),"bottom-left":new o.P(e,-e),"bottom-right":new o.P(-e,-e),left:new o.P(u,0),right:new o.P(-u,0)}}if(u instanceof o.P||Array.isArray(u)){const e=o.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:o.P.convert(u.center||[0,0]),top:o.P.convert(u.top||[0,0]),"top-left":o.P.convert(u["top-left"]||[0,0]),"top-right":o.P.convert(u["top-right"]||[0,0]),bottom:o.P.convert(u.bottom||[0,0]),"bottom-left":o.P.convert(u["bottom-left"]||[0,0]),"bottom-right":o.P.convert(u["bottom-right"]||[0,0]),left:o.P.convert(u.left||[0,0]),right:o.P.convert(u.right||[0,0])}}return cs(new o.P(0,0))}const Fc=he;S.AJAXError=o.cq,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cr,S.config=o.a,S.removeProtocol=o.cs,S.AttributionControl=Xt,S.BoxZoomHandler=Sc,S.CanvasSource=Ue,S.CooperativeGesturesHandler=ll,S.DoubleClickZoomHandler=ol,S.DragPanHandler=Sh,S.DragRotateHandler=Ph,S.EdgeInsets=As,S.FullscreenControl=class extends o.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.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(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){le.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=le.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);le.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_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 o.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_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()}},S.GeoJSONSource=Cn,S.GeolocateControl=class extends o.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new o.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),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(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new o.Q(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=Zt.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(e.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 i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&ls)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=le.create("button","maplibregl-ctrl-geolocate",this._container),le.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=le.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ma({element:this._dotElement}),this._circleElement=le.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ma({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new o.l("trackuserlocationend")),this.fire(new o.l("userlocationlostfocus")))})}},this.options=o.e({},ui,u)}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(Ti!==void 0&&!e)return Ti;if(window.navigator.permissions===void 0)return Ti=!!window.navigator.geolocation,Ti;try{Ti=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Ti=!!window.navigator.geolocation}return Ti})}().then(e=>this._finishSetupUI(e)),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(),le.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ii=0,ls=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),i=u.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.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 u=this._map.getBounds(),e=u.getSouthEast(),i=u.getNorthEast(),s=e.distanceTo(i),l=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}trigger(){if(!this._setup)return o.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 o.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ii--,ls=!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 o.l("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 o.l("trackuserlocationstart")),this.fire(new o.l("userlocationfocus"));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 u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ii++,ii>1?(u={maximumAge:6e5,timeout:0},ls=!0):(u=this.options.positionOptions,ls=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}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)}},S.GlobeControl=class{constructor(){this._toggleProjection=()=>{var u;const e=(u=this._map.getProjection())===null||u===void 0?void 0:u.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var u;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((u=this._map.getProjection())===null||u===void 0?void 0:u.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=le.create("button","maplibregl-ctrl-globe",this._container),le.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=bc,S.ImageSource=Ce,S.KeyboardHandler=os,S.LngLatBounds=Zt,S.LogoControl=Qs,S.Map=class extends Kd{constructor(u){var e,i;o.cn.mark(o.co.create);const s=Object.assign(Object.assign(Object.assign({},eo),u),{canvasContextAttributes:Object.assign(Object.assign({},eo.canvasContextAttributes),u.canvasContextAttributes)});if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new Ga,h=new ks;if(s.minZoom!==void 0&&l.setMinZoom(s.minZoom),s.maxZoom!==void 0&&l.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&l.setMinPitch(s.minPitch),s.maxPitch!==void 0&&l.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&l.setRenderWorldCopies(s.renderWorldCopies),super(l,h,{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new kc,this._controls=[],this._mapId=o.a4(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Ke),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Ft.addThrottleControl(()=>this.isMoving()),this._requestManager=new It(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),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 _=!1;const x=Xs(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Xd(this,s),this._hash=s.hash&&new bc(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,roll:s.roll}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,o.e({},s.fitBoundsOptions,{duration:0}))));const f=typeof s.style=="string"||((i=(e=s.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new Xt(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Qs,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(i,s.firstChild):s.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,i,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,s)}resize(u,e=!0){const[i,s]=this._containerDimensions(),l=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,l),this.painter.resize(i,s,l),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,_),this.painter.resize(i,s,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,s]=this._containerDimensions();this.transform.resize(i,s,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,s,u)}_getClampedPixelRatio(u,e){const{0:i,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,f=e*l;return Math.min(h>i?i/h:1,f>s?s/f:1)*l}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(Zt.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.setMinZoom(u),this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.setMaxZoom(u),this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.setMinPitch(u),this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(u>=this.transform.minPitch)return this.transform.setMaxPitch(u),this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.setRenderWorldCopies(u),this._update()}project(u){return this.transform.locationToScreenPoint(o.Q.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new Ei(u,this,h.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(x=>this.getLayer(x));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new Ei(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new Ei(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];f.length&&(l.features=f,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:s}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const s=this._delegatedListeners[u];for(let l=0;l<s.length;l++){const h=s[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(f=>e.includes(f))){for(const f in h.delegates)this.off(f,h.delegates[f]);return void s.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,s,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);for(const h in l.delegates){const f=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const s=u instanceof o.P||Array.isArray(u),l=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),f=o.P.convert(l[1]);i=[h,new o.P(f.x,h.y),f,new o.P(h.x,f.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){var i,s;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new rc(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,l):this.style.loadJSON(u,e,l),this):((s=(i=this.style)===null||i===void 0?void 0:i.projection)===null||s===void 0||s.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new rc(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const i=this._requestManager.transformRequest(u,"Style");o.j(i,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new o.k(s))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){o.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.w("There is no style added to the map.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new o.k(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const s=this.style._layers[i];s.type==="hillshade"&&s.source===u.source&&o.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 Eh(this.painter,e,u),this.painter.renderToTexture=new ul(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var s;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((s=i.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.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.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const i=u[e]._tiles;for(const s in i){const l=i[s];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const s=this.getSource(i);if(!s)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);s.calculateTileZoom=ae(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=ae(Math.max(1,u),Math.max(1,e));return this._update(!0),this}refreshTiles(u,e){const i=this.style.sourceCaches[u];if(!i)throw new Error(`There is no source cache with ID "${u}", cannot refresh tile`);e===void 0?i.reload():i.refreshTiles(e.map(s=>new o.a1(s.z,s.x,s.y)))}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(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:P,height:A,data:E}=e,F=e;return this.style.addImage(u,{data:new o.R({width:P,height:A},new Uint8Array(E)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:P,height:A,data:E}=Ee.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:A},E),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?Ee.getImageData(e):e,{width:l,height:h,data:f}=s;if(l===void 0||h===void 0)return this.fire(new o.k(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(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return Ft.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,e){return this._lazyInitEmptyStyle(),this.style.addLayer(u,e),this._update(!0)}moveLayer(u,e){return this.style.moveLayer(u,e),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,e,i){return this.style.setLayerZoomRange(u,e,i),this._update(!0)}setFilter(u,e,i={}){return this.style.setFilter(u,e,i),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,i,s={}){return this.style.setPaintProperty(u,e,i,s),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,i,s={}){return this.style.setLayoutProperty(u,e,i,s),this._update(!0)}getLayoutProperty(u,e){return this.style.getLayoutProperty(u,e)}setGlyphs(u,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,i,s=>{s||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,e,i=>{i||this._update(!0)}),this}setLight(u,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(u,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,e){return this.style.setFeatureState(u,e),this._update()}removeFeatureState(u,e){return this.style.removeFeatureState(u,e),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,e=0;return this._container&&(u=this._container.clientWidth||400,e=this._container.clientHeight||300),[u,e]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const e=this._canvasContainer=le.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=le.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),s=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],s);const l=this._controlContainer=le.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=le.create("div",`maplibregl-ctrl-${f} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,i){this._canvas.width=Math.floor(i*u),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:u},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,u):this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u),!i){const s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new vc(i,this.transform),Fe.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const A=this.transform.zoom,E=Ee.now();this.style.zoomHistory.update(A,E);const F=new o.C(A,{now:E,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=F.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(F)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||T)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,T),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cn.mark(o.co.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,o.cn.mark(o.co.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Ft.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),le.remove(this._canvasContainer),le.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cn.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ee.frame(this._frameRequest,u=>{o.cn.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cp(e)&&!function(i){return i.message===qo}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return rt}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=Ei,S.MapTouchEvent=ts,S.MapWheelEvent=Mc,S.Marker=Ma,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const s=this._map._getUIString(`NavigationControl.${i}`);e.title=s,e.setAttribute("aria-label",s)},this.options=o.e({},zc,u),this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=le.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Rc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){le.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const i=le.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},S.Popup=class extends o.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&le.remove(this._content),this._container&&(le.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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=le.create("div","maplibregl-popup",this._map.getContainer()),this._tip=le.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),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._lngLat=Dc(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor;const l=cs(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),le.setTransform(this._container,`${qr[s]} translate(${h.x}px,${h.y}px)`),Ah(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Lc),u)}addTo(u){return this._map&&this.remove(),this._map=u,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 o.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.Q.convert(u),this._pos=null,this._flatPos=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._flatPos=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(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=u;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=le.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=le.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Bc);u&&u.focus()}},S.RasterDEMTileSource=Pn,S.RasterTileSource=br,S.ScaleControl=class{constructor(u){this._onMove=()=>{io(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,io(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},to),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){le.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=vt,S.Style=rc,S.TerrainControl=class{constructor(u){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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=le.create("button","maplibregl-ctrl-terrain",this._container),le.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(){le.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=sl,S.TwoFingersTouchRotateHandler=$e,S.TwoFingersTouchZoomHandler=ss,S.TwoFingersTouchZoomRotateHandler=Ac,S.VectorTileSource=hn,S.VideoSource=Ye,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(Nt(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{_t[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=xr;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(cn),xr=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()"))},S.createTileMesh=zs,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return Rr().getRTLTextPluginStatus()},S.getVersion=function(){return Fc},S.getWorkerCount=function(){return kr.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return Sn().broadcast("IS",u)},S.prewarm=function(){vr().acquire(cn)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return Rr().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){kr.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var B=b;return B})}(Iu)),Iu.exports}var sy=ay();const _d=ry(sy);class Ff{constructor(g,b,I,z,B){qt(this,"bounds1");qt(this,"bounds2");qt(this,"getBounds",(g,b,I,z)=>new _d.LngLatBounds([g,b],[I,z]));qt(this,"contains",(g,b)=>this.bounds1.contains([b,g])||this.bounds2.contains([b,g]));const S=g.unproject([b,I]),o=g.unproject([z,B]);if(S.lng<-180){this.bounds1=this.getBounds(-180,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(S.wrap().lng,S.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(S.lng,S.lat,180,o.lat),this.bounds2=this.getBounds(-180,S.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(S.lng,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const oy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(120, 120, 120, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(128, 128, 128, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(56, 56, 56, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(153, 153, 153, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(104, 104, 104, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(56, 56, 56, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(136, 136, 136, 1)","fill-outline-color":"rgba(102, 102, 102, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(50, 50, 50, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(52, 52, 52, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(88, 88, 88, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20],"line-color":"rgba(102, 102, 102, 1)"}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23],"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":2,"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(51, 51, 51, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(51, 51, 51, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(255, 255, 255, 1)","text-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]},ly={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(220, 220, 220, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(228, 228, 228, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(156, 156, 156, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(253, 253, 253, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(204, 204, 204, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(156, 156, 156, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(236, 236, 236, 1)","fill-outline-color":"rgba(202, 202, 202, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(185, 185, 185)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(150, 150, 150, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(152, 152, 152, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(188, 188, 188)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(185, 185, 185)","line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23]}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":2}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(151, 151, 151, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(151, 151, 151, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1.5}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(0, 0, 0, 1)","text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]};var Dt;(function(v){v.assertEqual=z=>z;function g(z){}v.assertIs=g;function b(z){throw new Error}v.assertNever=b,v.arrayToEnum=z=>{const B={};for(const S of z)B[S]=S;return B},v.getValidEnumValues=z=>{const B=v.objectKeys(z).filter(o=>typeof z[z[o]]!="number"),S={};for(const o of B)S[o]=z[o];return v.objectValues(S)},v.objectValues=z=>v.objectKeys(z).map(function(B){return z[B]}),v.objectKeys=typeof Object.keys=="function"?z=>Object.keys(z):z=>{const B=[];for(const S in z)Object.prototype.hasOwnProperty.call(z,S)&&B.push(S);return B},v.find=(z,B)=>{for(const S of z)if(B(S))return S},v.isInteger=typeof Number.isInteger=="function"?z=>Number.isInteger(z):z=>typeof z=="number"&&isFinite(z)&&Math.floor(z)===z;function I(z,B=" | "){return z.map(S=>typeof S=="string"?`'${S}'`:S).join(B)}v.joinValues=I,v.jsonStringifyReplacer=(z,B)=>typeof B=="bigint"?B.toString():B})(Dt||(Dt={}));var yd;(function(v){v.mergeShapes=(g,b)=>({...g,...b})})(yd||(yd={}));const Xe=Dt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),na=v=>{switch(typeof v){case"undefined":return Xe.undefined;case"string":return Xe.string;case"number":return isNaN(v)?Xe.nan:Xe.number;case"boolean":return Xe.boolean;case"function":return Xe.function;case"bigint":return Xe.bigint;case"symbol":return Xe.symbol;case"object":return Array.isArray(v)?Xe.array:v===null?Xe.null:v.then&&typeof v.then=="function"&&v.catch&&typeof v.catch=="function"?Xe.promise:typeof Map<"u"&&v instanceof Map?Xe.map:typeof Set<"u"&&v instanceof Set?Xe.set:typeof Date<"u"&&v instanceof Date?Xe.date:Xe.object;default:return Xe.unknown}},je=Dt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),cy=v=>JSON.stringify(v,null,2).replace(/"([^"]+)":/g,"$1:");class Jr extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const b=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,b):this.__proto__=b,this.name="ZodError",this.issues=g}format(g){const b=g||function(B){return B.message},I={_errors:[]},z=B=>{for(const S of B.issues)if(S.code==="invalid_union")S.unionErrors.map(z);else if(S.code==="invalid_return_type")z(S.returnTypeError);else if(S.code==="invalid_arguments")z(S.argumentsError);else if(S.path.length===0)I._errors.push(b(S));else{let o=I,he=0;for(;he<S.path.length;){const me=S.path[he];he===S.path.length-1?(o[me]=o[me]||{_errors:[]},o[me]._errors.push(b(S))):o[me]=o[me]||{_errors:[]},o=o[me],he++}}};return z(this),I}static assert(g){if(!(g instanceof Jr))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Dt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=b=>b.message){const b={},I=[];for(const z of this.issues)z.path.length>0?(b[z.path[0]]=b[z.path[0]]||[],b[z.path[0]].push(g(z))):I.push(g(z));return{formErrors:I,fieldErrors:b}}get formErrors(){return this.flatten()}}Jr.create=v=>new Jr(v);const xo=(v,g)=>{let b;switch(v.code){case je.invalid_type:v.received===Xe.undefined?b="Required":b=`Expected ${v.expected}, received ${v.received}`;break;case je.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(v.expected,Dt.jsonStringifyReplacer)}`;break;case je.unrecognized_keys:b=`Unrecognized key(s) in object: ${Dt.joinValues(v.keys,", ")}`;break;case je.invalid_union:b="Invalid input";break;case je.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${Dt.joinValues(v.options)}`;break;case je.invalid_enum_value:b=`Invalid enum value. Expected ${Dt.joinValues(v.options)}, received '${v.received}'`;break;case je.invalid_arguments:b="Invalid function arguments";break;case je.invalid_return_type:b="Invalid function return type";break;case je.invalid_date:b="Invalid date";break;case je.invalid_string:typeof v.validation=="object"?"includes"in v.validation?(b=`Invalid input: must include "${v.validation.includes}"`,typeof v.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${v.validation.position}`)):"startsWith"in v.validation?b=`Invalid input: must start with "${v.validation.startsWith}"`:"endsWith"in v.validation?b=`Invalid input: must end with "${v.validation.endsWith}"`:Dt.assertNever(v.validation):v.validation!=="regex"?b=`Invalid ${v.validation}`:b="Invalid";break;case je.too_small:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at least":"more than"} ${v.minimum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at least":"over"} ${v.minimum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${v.minimum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(v.minimum))}`:b="Invalid input";break;case je.too_big:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at most":"less than"} ${v.maximum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at most":"under"} ${v.maximum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="bigint"?b=`BigInt must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly":v.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(v.maximum))}`:b="Invalid input";break;case je.custom:b="Invalid input";break;case je.invalid_intersection_types:b="Intersection results could not be merged";break;case je.not_multiple_of:b=`Number must be a multiple of ${v.multipleOf}`;break;case je.not_finite:b="Number must be finite";break;default:b=g.defaultError,Dt.assertNever(v)}return{message:b}};let Of=xo;function uy(v){Of=v}function Eu(){return Of}const Au=v=>{const{data:g,path:b,errorMaps:I,issueData:z}=v,B=[...b,...z.path||[]],S={...z,path:B};if(z.message!==void 0)return{...z,path:B,message:z.message};let o="";const he=I.filter(me=>!!me).slice().reverse();for(const me of he)o=me(S,{data:g,defaultError:o}).message;return{...z,path:B,message:o}},hy=[];function qe(v,g){const b=Eu(),I=Au({issueData:g,data:v.data,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,b,b===xo?void 0:xo].filter(z=>!!z)});v.common.issues.push(I)}class gr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,b){const I=[];for(const z of b){if(z.status==="aborted")return ht;z.status==="dirty"&&g.dirty(),I.push(z.value)}return{status:g.value,value:I}}static async mergeObjectAsync(g,b){const I=[];for(const z of b){const B=await z.key,S=await z.value;I.push({key:B,value:S})}return gr.mergeObjectSync(g,I)}static mergeObjectSync(g,b){const I={};for(const z of b){const{key:B,value:S}=z;if(B.status==="aborted"||S.status==="aborted")return ht;B.status==="dirty"&&g.dirty(),S.status==="dirty"&&g.dirty(),B.value!=="__proto__"&&(typeof S.value<"u"||z.alwaysSet)&&(I[B.value]=S.value)}return{status:g.value,value:I}}}const ht=Object.freeze({status:"aborted"}),vo=v=>({status:"dirty",value:v}),Er=v=>({status:"valid",value:v}),xd=v=>v.status==="aborted",vd=v=>v.status==="dirty",xs=v=>v.status==="valid",Al=v=>typeof Promise<"u"&&v instanceof Promise;function ku(v,g,b,I){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot read private member from an object whose class did not declare it");return g.get(v)}function jf(v,g,b,I,z){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot write private member to an object whose class did not declare it");return g.set(v,b),b}typeof SuppressedError=="function"&&SuppressedError;var tt;(function(v){v.errToObj=g=>typeof g=="string"?{message:g}:g||{},v.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(tt||(tt={}));var kl,zl;class Un{constructor(g,b,I,z){this._cachedPath=[],this.parent=g,this.data=b,this._path=I,this._key=z}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Nf=(v,g)=>{if(xs(g))return{success:!0,data:g.value};if(!v.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const b=new Jr(v.common.issues);return this._error=b,this._error}}};function yt(v){if(!v)return{};const{errorMap:g,invalid_type_error:b,required_error:I,description:z}=v;if(g&&(b||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:z}:{errorMap:(S,o)=>{var he,me;const{message:Pe}=v;return S.code==="invalid_enum_value"?{message:Pe??o.defaultError}:typeof o.data>"u"?{message:(he=Pe??I)!==null&&he!==void 0?he:o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:(me=Pe??b)!==null&&me!==void 0?me:o.defaultError}},description:z}}class wt{get description(){return this._def.description}_getType(g){return na(g.data)}_getOrReturnCtx(g,b){return b||{common:g.parent.common,data:g.data,parsedType:na(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new gr,ctx:{common:g.parent.common,data:g.data,parsedType:na(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const b=this._parse(g);if(Al(b))throw new Error("Synchronous parse encountered promise.");return b}_parseAsync(g){const b=this._parse(g);return Promise.resolve(b)}parse(g,b){const I=this.safeParse(g,b);if(I.success)return I.data;throw I.error}safeParse(g,b){var I;const z={common:{issues:[],async:(I=b==null?void 0:b.async)!==null&&I!==void 0?I:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)},B=this._parseSync({data:g,path:z.path,parent:z});return Nf(z,B)}"~validate"(g){var b,I;const z={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)};if(!this["~standard"].async)try{const B=this._parseSync({data:g,path:[],parent:z});return xs(B)?{value:B.value}:{issues:z.common.issues}}catch(B){!((I=(b=B==null?void 0:B.message)===null||b===void 0?void 0:b.toLowerCase())===null||I===void 0)&&I.includes("encountered")&&(this["~standard"].async=!0),z.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:z}).then(B=>xs(B)?{value:B.value}:{issues:z.common.issues})}async parseAsync(g,b){const I=await this.safeParseAsync(g,b);if(I.success)return I.data;throw I.error}async safeParseAsync(g,b){const I={common:{issues:[],contextualErrorMap:b==null?void 0:b.errorMap,async:!0},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)},z=this._parse({data:g,path:I.path,parent:I}),B=await(Al(z)?z:Promise.resolve(z));return Nf(I,B)}refine(g,b){const I=z=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(z):b;return this._refinement((z,B)=>{const S=g(z),o=()=>B.addIssue({code:je.custom,...I(z)});return typeof Promise<"u"&&S instanceof Promise?S.then(he=>he?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(g,b){return this._refinement((I,z)=>g(I)?!0:(z.addIssue(typeof b=="function"?b(I,z):b),!1))}_refinement(g){return new wn({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:b=>this["~validate"](b)}}optional(){return Gn.create(this,this._def)}nullable(){return Fa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bn.create(this)}promise(){return Mo.create(this,this._def)}or(g){return Bl.create([this,g],this._def)}and(g){return Fl.create(this,g,this._def)}transform(g){return new wn({...yt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const b=typeof g=="function"?g:()=>g;return new Vl({...yt(this._def),innerType:this,defaultValue:b,typeName:ut.ZodDefault})}brand(){return new Td({typeName:ut.ZodBranded,type:this,...yt(this._def)})}catch(g){const b=typeof g=="function"?g:()=>g;return new Ul({...yt(this._def),innerType:this,catchValue:b,typeName:ut.ZodCatch})}describe(g){const b=this.constructor;return new b({...this._def,description:g})}pipe(g){return $l.create(this,g)}readonly(){return Gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dy=/^c[^\s-]{8,}$/i,py=/^[0-9a-z]+$/,fy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,my=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gy=/^[a-z0-9_-]{21}$/i,_y=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yy=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let bd;const by=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ty=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,My=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Py=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zf="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Cy=new RegExp(`^${Zf}$`);function Vf(v){let g="[0-5]\\d";v.precision?g=`${g}\\.\\d{${v.precision}}`:v.precision==null&&(g=`${g}(\\.\\d+)?`);const b=v.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${b}`}function Iy(v){return new RegExp(`^${Vf(v)}$`)}function Uf(v){let g=`${Zf}T${Vf(v)}`;const b=[];return b.push(v.local?"Z?":"Z"),v.offset&&b.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${b.join("|")})`,new RegExp(`^${g}$`)}function Ey(v,g){return!!((g==="v4"||!g)&&by.test(v)||(g==="v6"||!g)&&Ty.test(v))}function Ay(v,g){if(!_y.test(v))return!1;try{const[b]=v.split("."),I=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),z=JSON.parse(atob(I));return!(typeof z!="object"||z===null||!z.typ||!z.alg||g&&z.alg!==g)}catch{return!1}}function ky(v,g){return!!((g==="v4"||!g)&&wy.test(v)||(g==="v6"||!g)&&My.test(v))}class vn extends wt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Xe.string){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.string,received:B.parsedType}),ht}const I=new gr;let z;for(const B of this._def.checks)if(B.kind==="min")g.data.length<B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="max")g.data.length>B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="length"){const S=g.data.length>B.value,o=g.data.length<B.value;(S||o)&&(z=this._getOrReturnCtx(g,z),S?qe(z,{code:je.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}):o&&qe(z,{code:je.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}),I.dirty())}else if(B.kind==="email")xy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"email",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="emoji")bd||(bd=new RegExp(vy,"u")),bd.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"emoji",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="uuid")my.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"uuid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="nanoid")gy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"nanoid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid")dy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cuid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid2")py.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cuid2",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="ulid")fy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"ulid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="url")try{new URL(g.data)}catch{z=this._getOrReturnCtx(g,z),qe(z,{validation:"url",code:je.invalid_string,message:B.message}),I.dirty()}else B.kind==="regex"?(B.regex.lastIndex=0,B.regex.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"regex",code:je.invalid_string,message:B.message}),I.dirty())):B.kind==="trim"?g.data=g.data.trim():B.kind==="includes"?g.data.includes(B.value,B.position)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{includes:B.value,position:B.position},message:B.message}),I.dirty()):B.kind==="toLowerCase"?g.data=g.data.toLowerCase():B.kind==="toUpperCase"?g.data=g.data.toUpperCase():B.kind==="startsWith"?g.data.startsWith(B.value)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{startsWith:B.value},message:B.message}),I.dirty()):B.kind==="endsWith"?g.data.endsWith(B.value)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{endsWith:B.value},message:B.message}),I.dirty()):B.kind==="datetime"?Uf(B).test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"datetime",message:B.message}),I.dirty()):B.kind==="date"?Cy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"date",message:B.message}),I.dirty()):B.kind==="time"?Iy(B).test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"time",message:B.message}),I.dirty()):B.kind==="duration"?yy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"duration",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="ip"?Ey(g.data,B.version)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"ip",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="jwt"?Ay(g.data,B.alg)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"jwt",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="cidr"?ky(g.data,B.version)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cidr",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="base64"?Sy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"base64",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="base64url"?Py.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"base64url",code:je.invalid_string,message:B.message}),I.dirty()):Dt.assertNever(B);return{status:I.value,value:g.data}}_regex(g,b,I){return this.refinement(z=>g.test(z),{validation:b,code:je.invalid_string,...tt.errToObj(I)})}_addCheck(g){return new vn({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...tt.errToObj(g)})}url(g){return this._addCheck({kind:"url",...tt.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...tt.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...tt.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...tt.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...tt.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...tt.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...tt.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...tt.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...tt.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...tt.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...tt.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...tt.errToObj(g)})}datetime(g){var b,I;return typeof g=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,offset:(b=g==null?void 0:g.offset)!==null&&b!==void 0?b:!1,local:(I=g==null?void 0:g.local)!==null&&I!==void 0?I:!1,...tt.errToObj(g==null?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return typeof g=="string"?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,...tt.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...tt.errToObj(g)})}regex(g,b){return this._addCheck({kind:"regex",regex:g,...tt.errToObj(b)})}includes(g,b){return this._addCheck({kind:"includes",value:g,position:b==null?void 0:b.position,...tt.errToObj(b==null?void 0:b.message)})}startsWith(g,b){return this._addCheck({kind:"startsWith",value:g,...tt.errToObj(b)})}endsWith(g,b){return this._addCheck({kind:"endsWith",value:g,...tt.errToObj(b)})}min(g,b){return this._addCheck({kind:"min",value:g,...tt.errToObj(b)})}max(g,b){return this._addCheck({kind:"max",value:g,...tt.errToObj(b)})}length(g,b){return this._addCheck({kind:"length",value:g,...tt.errToObj(b)})}nonempty(g){return this.min(1,tt.errToObj(g))}trim(){return new vn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new vn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new vn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(g=>g.kind==="datetime")}get isDate(){return!!this._def.checks.find(g=>g.kind==="date")}get isTime(){return!!this._def.checks.find(g=>g.kind==="time")}get isDuration(){return!!this._def.checks.find(g=>g.kind==="duration")}get isEmail(){return!!this._def.checks.find(g=>g.kind==="email")}get isURL(){return!!this._def.checks.find(g=>g.kind==="url")}get isEmoji(){return!!this._def.checks.find(g=>g.kind==="emoji")}get isUUID(){return!!this._def.checks.find(g=>g.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(g=>g.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(g=>g.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(g=>g.kind==="cuid2")}get isULID(){return!!this._def.checks.find(g=>g.kind==="ulid")}get isIP(){return!!this._def.checks.find(g=>g.kind==="ip")}get isCIDR(){return!!this._def.checks.find(g=>g.kind==="cidr")}get isBase64(){return!!this._def.checks.find(g=>g.kind==="base64")}get isBase64url(){return!!this._def.checks.find(g=>g.kind==="base64url")}get minLength(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxLength(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}vn.create=v=>{var g;return new vn({checks:[],typeName:ut.ZodString,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};function zy(v,g){const b=(v.toString().split(".")[1]||"").length,I=(g.toString().split(".")[1]||"").length,z=b>I?b:I,B=parseInt(v.toFixed(z).replace(".","")),S=parseInt(g.toFixed(z).replace(".",""));return B%S/Math.pow(10,z)}class Da extends wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Xe.number){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.number,received:B.parsedType}),ht}let I;const z=new gr;for(const B of this._def.checks)B.kind==="int"?Dt.isInteger(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:je.invalid_type,expected:"integer",received:"float",message:B.message}),z.dirty()):B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_small,minimum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),z.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_big,maximum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),z.dirty()):B.kind==="multipleOf"?zy(g.data,B.value)!==0&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_multiple_of,multipleOf:B.value,message:B.message}),z.dirty()):B.kind==="finite"?Number.isFinite(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_finite,message:B.message}),z.dirty()):Dt.assertNever(B);return{status:z.value,value:g.data}}gte(g,b){return this.setLimit("min",g,!0,tt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,tt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,tt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,tt.toString(b))}setLimit(g,b,I,z){return new Da({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:tt.toString(z)}]})}_addCheck(g){return new Da({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:tt.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(b)})}finite(g){return this._addCheck({kind:"finite",message:tt.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tt.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tt.toString(g)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&Dt.isInteger(g.value))}get isFinite(){let g=null,b=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(b===null||I.value>b)&&(b=I.value):I.kind==="max"&&(g===null||I.value<g)&&(g=I.value)}return Number.isFinite(b)&&Number.isFinite(g)}}Da.create=v=>new Da({checks:[],typeName:ut.ZodNumber,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class La extends wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Xe.bigint)return this._getInvalidInput(g);let I;const z=new gr;for(const B of this._def.checks)B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_small,type:"bigint",minimum:B.value,inclusive:B.inclusive,message:B.message}),z.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_big,type:"bigint",maximum:B.value,inclusive:B.inclusive,message:B.message}),z.dirty()):B.kind==="multipleOf"?g.data%B.value!==BigInt(0)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_multiple_of,multipleOf:B.value,message:B.message}),z.dirty()):Dt.assertNever(B);return{status:z.value,value:g.data}}_getInvalidInput(g){const b=this._getOrReturnCtx(g);return qe(b,{code:je.invalid_type,expected:Xe.bigint,received:b.parsedType}),ht}gte(g,b){return this.setLimit("min",g,!0,tt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,tt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,tt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,tt.toString(b))}setLimit(g,b,I,z){return new La({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:tt.toString(z)}]})}_addCheck(g){return new La({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(b)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}La.create=v=>{var g;return new La({checks:[],typeName:ut.ZodBigInt,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};class Rl extends wt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Xe.boolean){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.boolean,received:I.parsedType}),ht}return Er(g.data)}}Rl.create=v=>new Rl({typeName:ut.ZodBoolean,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class vs extends wt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Xe.date){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.date,received:B.parsedType}),ht}if(isNaN(g.data.getTime())){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_date}),ht}const I=new gr;let z;for(const B of this._def.checks)B.kind==="min"?g.data.getTime()<B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_small,message:B.message,inclusive:!0,exact:!1,minimum:B.value,type:"date"}),I.dirty()):B.kind==="max"?g.data.getTime()>B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_big,message:B.message,inclusive:!0,exact:!1,maximum:B.value,type:"date"}),I.dirty()):Dt.assertNever(B);return{status:I.value,value:new Date(g.data.getTime())}}_addCheck(g){return new vs({...this._def,checks:[...this._def.checks,g]})}min(g,b){return this._addCheck({kind:"min",value:g.getTime(),message:tt.toString(b)})}max(g,b){return this._addCheck({kind:"max",value:g.getTime(),message:tt.toString(b)})}get minDate(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g!=null?new Date(g):null}}vs.create=v=>new vs({checks:[],coerce:(v==null?void 0:v.coerce)||!1,typeName:ut.ZodDate,...yt(v)});class zu extends wt{_parse(g){if(this._getType(g)!==Xe.symbol){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.symbol,received:I.parsedType}),ht}return Er(g.data)}}zu.create=v=>new zu({typeName:ut.ZodSymbol,...yt(v)});class Dl extends wt{_parse(g){if(this._getType(g)!==Xe.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.undefined,received:I.parsedType}),ht}return Er(g.data)}}Dl.create=v=>new Dl({typeName:ut.ZodUndefined,...yt(v)});class Ll extends wt{_parse(g){if(this._getType(g)!==Xe.null){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.null,received:I.parsedType}),ht}return Er(g.data)}}Ll.create=v=>new Ll({typeName:ut.ZodNull,...yt(v)});class bo extends wt{constructor(){super(...arguments),this._any=!0}_parse(g){return Er(g.data)}}bo.create=v=>new bo({typeName:ut.ZodAny,...yt(v)});class bs extends wt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return Er(g.data)}}bs.create=v=>new bs({typeName:ut.ZodUnknown,...yt(v)});class aa extends wt{_parse(g){const b=this._getOrReturnCtx(g);return qe(b,{code:je.invalid_type,expected:Xe.never,received:b.parsedType}),ht}}aa.create=v=>new aa({typeName:ut.ZodNever,...yt(v)});class Ru extends wt{_parse(g){if(this._getType(g)!==Xe.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.void,received:I.parsedType}),ht}return Er(g.data)}}Ru.create=v=>new Ru({typeName:ut.ZodVoid,...yt(v)});class bn extends wt{_parse(g){const{ctx:b,status:I}=this._processInputParams(g),z=this._def;if(b.parsedType!==Xe.array)return qe(b,{code:je.invalid_type,expected:Xe.array,received:b.parsedType}),ht;if(z.exactLength!==null){const S=b.data.length>z.exactLength.value,o=b.data.length<z.exactLength.value;(S||o)&&(qe(b,{code:S?je.too_big:je.too_small,minimum:o?z.exactLength.value:void 0,maximum:S?z.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:z.exactLength.message}),I.dirty())}if(z.minLength!==null&&b.data.length<z.minLength.value&&(qe(b,{code:je.too_small,minimum:z.minLength.value,type:"array",inclusive:!0,exact:!1,message:z.minLength.message}),I.dirty()),z.maxLength!==null&&b.data.length>z.maxLength.value&&(qe(b,{code:je.too_big,maximum:z.maxLength.value,type:"array",inclusive:!0,exact:!1,message:z.maxLength.message}),I.dirty()),b.common.async)return Promise.all([...b.data].map((S,o)=>z.type._parseAsync(new Un(b,S,b.path,o)))).then(S=>gr.mergeArray(I,S));const B=[...b.data].map((S,o)=>z.type._parseSync(new Un(b,S,b.path,o)));return gr.mergeArray(I,B)}get element(){return this._def.type}min(g,b){return new bn({...this._def,minLength:{value:g,message:tt.toString(b)}})}max(g,b){return new bn({...this._def,maxLength:{value:g,message:tt.toString(b)}})}length(g,b){return new bn({...this._def,exactLength:{value:g,message:tt.toString(b)}})}nonempty(g){return this.min(1,g)}}bn.create=(v,g)=>new bn({type:v,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...yt(g)});function wo(v){if(v instanceof _i){const g={};for(const b in v.shape){const I=v.shape[b];g[b]=Gn.create(wo(I))}return new _i({...v._def,shape:()=>g})}else return v instanceof bn?new bn({...v._def,type:wo(v.element)}):v instanceof Gn?Gn.create(wo(v.unwrap())):v instanceof Fa?Fa.create(wo(v.unwrap())):v instanceof $n?$n.create(v.items.map(g=>wo(g))):v}class _i extends wt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),b=Dt.objectKeys(g);return this._cached={shape:g,keys:b}}_parse(g){if(this._getType(g)!==Xe.object){const me=this._getOrReturnCtx(g);return qe(me,{code:je.invalid_type,expected:Xe.object,received:me.parsedType}),ht}const{status:I,ctx:z}=this._processInputParams(g),{shape:B,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof aa&&this._def.unknownKeys==="strip"))for(const me in z.data)S.includes(me)||o.push(me);const he=[];for(const me of S){const Pe=B[me],Be=z.data[me];he.push({key:{status:"valid",value:me},value:Pe._parse(new Un(z,Be,z.path,me)),alwaysSet:me in z.data})}if(this._def.catchall instanceof aa){const me=this._def.unknownKeys;if(me==="passthrough")for(const Pe of o)he.push({key:{status:"valid",value:Pe},value:{status:"valid",value:z.data[Pe]}});else if(me==="strict")o.length>0&&(qe(z,{code:je.unrecognized_keys,keys:o}),I.dirty());else if(me!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const me=this._def.catchall;for(const Pe of o){const Be=z.data[Pe];he.push({key:{status:"valid",value:Pe},value:me._parse(new Un(z,Be,z.path,Pe)),alwaysSet:Pe in z.data})}}return z.common.async?Promise.resolve().then(async()=>{const me=[];for(const Pe of he){const Be=await Pe.key,Ee=await Pe.value;me.push({key:Be,value:Ee,alwaysSet:Pe.alwaysSet})}return me}).then(me=>gr.mergeObjectSync(I,me)):gr.mergeObjectSync(I,he)}get shape(){return this._def.shape()}strict(g){return tt.errToObj,new _i({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(b,I)=>{var z,B,S,o;const he=(S=(B=(z=this._def).errorMap)===null||B===void 0?void 0:B.call(z,b,I).message)!==null&&S!==void 0?S:I.defaultError;return b.code==="unrecognized_keys"?{message:(o=tt.errToObj(g).message)!==null&&o!==void 0?o:he}:{message:he}}}:{}})}strip(){return new _i({...this._def,unknownKeys:"strip"})}passthrough(){return new _i({...this._def,unknownKeys:"passthrough"})}extend(g){return new _i({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new _i({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ut.ZodObject})}setKey(g,b){return this.augment({[g]:b})}catchall(g){return new _i({...this._def,catchall:g})}pick(g){const b={};return Dt.objectKeys(g).forEach(I=>{g[I]&&this.shape[I]&&(b[I]=this.shape[I])}),new _i({...this._def,shape:()=>b})}omit(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{g[I]||(b[I]=this.shape[I])}),new _i({...this._def,shape:()=>b})}deepPartial(){return wo(this)}partial(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{const z=this.shape[I];g&&!g[I]?b[I]=z:b[I]=z.optional()}),new _i({...this._def,shape:()=>b})}required(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{if(g&&!g[I])b[I]=this.shape[I];else{let B=this.shape[I];for(;B instanceof Gn;)B=B._def.innerType;b[I]=B}}),new _i({...this._def,shape:()=>b})}keyof(){return $f(Dt.objectKeys(this.shape))}}_i.create=(v,g)=>new _i({shape:()=>v,unknownKeys:"strip",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)}),_i.strictCreate=(v,g)=>new _i({shape:()=>v,unknownKeys:"strict",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)}),_i.lazycreate=(v,g)=>new _i({shape:v,unknownKeys:"strip",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)});class Bl extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I=this._def.options;function z(B){for(const o of B)if(o.result.status==="valid")return o.result;for(const o of B)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const S=B.map(o=>new Jr(o.ctx.common.issues));return qe(b,{code:je.invalid_union,unionErrors:S}),ht}if(b.common.async)return Promise.all(I.map(async B=>{const S={...b,common:{...b.common,issues:[]},parent:null};return{result:await B._parseAsync({data:b.data,path:b.path,parent:S}),ctx:S}})).then(z);{let B;const S=[];for(const he of I){const me={...b,common:{...b.common,issues:[]},parent:null},Pe=he._parseSync({data:b.data,path:b.path,parent:me});if(Pe.status==="valid")return Pe;Pe.status==="dirty"&&!B&&(B={result:Pe,ctx:me}),me.common.issues.length&&S.push(me.common.issues)}if(B)return b.common.issues.push(...B.ctx.common.issues),B.result;const o=S.map(he=>new Jr(he));return qe(b,{code:je.invalid_union,unionErrors:o}),ht}}get options(){return this._def.options}}Bl.create=(v,g)=>new Bl({options:v,typeName:ut.ZodUnion,...yt(g)});const sa=v=>v instanceof jl?sa(v.schema):v instanceof wn?sa(v.innerType()):v instanceof Nl?[v.value]:v instanceof Ba?v.options:v instanceof Zl?Dt.objectValues(v.enum):v instanceof Vl?sa(v._def.innerType):v instanceof Dl?[void 0]:v instanceof Ll?[null]:v instanceof Gn?[void 0,...sa(v.unwrap())]:v instanceof Fa?[null,...sa(v.unwrap())]:v instanceof Td||v instanceof Gl?sa(v.unwrap()):v instanceof Ul?sa(v._def.innerType):[];class Du extends wt{_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.object)return qe(b,{code:je.invalid_type,expected:Xe.object,received:b.parsedType}),ht;const I=this.discriminator,z=b.data[I],B=this.optionsMap.get(z);return B?b.common.async?B._parseAsync({data:b.data,path:b.path,parent:b}):B._parseSync({data:b.data,path:b.path,parent:b}):(qe(b,{code:je.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[I]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(g,b,I){const z=new Map;for(const B of b){const S=sa(B.shape[g]);if(!S.length)throw new Error(`A discriminator value for key \`${g}\` could not be extracted from all schema options`);for(const o of S){if(z.has(o))throw new Error(`Discriminator property ${String(g)} has duplicate value ${String(o)}`);z.set(o,B)}}return new Du({typeName:ut.ZodDiscriminatedUnion,discriminator:g,options:b,optionsMap:z,...yt(I)})}}function wd(v,g){const b=na(v),I=na(g);if(v===g)return{valid:!0,data:v};if(b===Xe.object&&I===Xe.object){const z=Dt.objectKeys(g),B=Dt.objectKeys(v).filter(o=>z.indexOf(o)!==-1),S={...v,...g};for(const o of B){const he=wd(v[o],g[o]);if(!he.valid)return{valid:!1};S[o]=he.data}return{valid:!0,data:S}}else if(b===Xe.array&&I===Xe.array){if(v.length!==g.length)return{valid:!1};const z=[];for(let B=0;B<v.length;B++){const S=v[B],o=g[B],he=wd(S,o);if(!he.valid)return{valid:!1};z.push(he.data)}return{valid:!0,data:z}}else return b===Xe.date&&I===Xe.date&&+v==+g?{valid:!0,data:v}:{valid:!1}}class Fl extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g),z=(B,S)=>{if(xd(B)||xd(S))return ht;const o=wd(B.value,S.value);return o.valid?((vd(B)||vd(S))&&b.dirty(),{status:b.value,value:o.data}):(qe(I,{code:je.invalid_intersection_types}),ht)};return I.common.async?Promise.all([this._def.left._parseAsync({data:I.data,path:I.path,parent:I}),this._def.right._parseAsync({data:I.data,path:I.path,parent:I})]).then(([B,S])=>z(B,S)):z(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}Fl.create=(v,g,b)=>new Fl({left:v,right:g,typeName:ut.ZodIntersection,...yt(b)});class $n extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.array)return qe(I,{code:je.invalid_type,expected:Xe.array,received:I.parsedType}),ht;if(I.data.length<this._def.items.length)return qe(I,{code:je.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&I.data.length>this._def.items.length&&(qe(I,{code:je.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const B=[...I.data].map((S,o)=>{const he=this._def.items[o]||this._def.rest;return he?he._parse(new Un(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(B).then(S=>gr.mergeArray(b,S)):gr.mergeArray(b,B)}get items(){return this._def.items}rest(g){return new $n({...this._def,rest:g})}}$n.create=(v,g)=>{if(!Array.isArray(v))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $n({items:v,typeName:ut.ZodTuple,rest:null,...yt(g)})};class Ol extends wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.object)return qe(I,{code:je.invalid_type,expected:Xe.object,received:I.parsedType}),ht;const z=[],B=this._def.keyType,S=this._def.valueType;for(const o in I.data)z.push({key:B._parse(new Un(I,o,I.path,o)),value:S._parse(new Un(I,I.data[o],I.path,o)),alwaysSet:o in I.data});return I.common.async?gr.mergeObjectAsync(b,z):gr.mergeObjectSync(b,z)}get element(){return this._def.valueType}static create(g,b,I){return b instanceof wt?new Ol({keyType:g,valueType:b,typeName:ut.ZodRecord,...yt(I)}):new Ol({keyType:vn.create(),valueType:g,typeName:ut.ZodRecord,...yt(b)})}}class Lu extends wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.map)return qe(I,{code:je.invalid_type,expected:Xe.map,received:I.parsedType}),ht;const z=this._def.keyType,B=this._def.valueType,S=[...I.data.entries()].map(([o,he],me)=>({key:z._parse(new Un(I,o,I.path,[me,"key"])),value:B._parse(new Un(I,he,I.path,[me,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const he of S){const me=await he.key,Pe=await he.value;if(me.status==="aborted"||Pe.status==="aborted")return ht;(me.status==="dirty"||Pe.status==="dirty")&&b.dirty(),o.set(me.value,Pe.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const he of S){const me=he.key,Pe=he.value;if(me.status==="aborted"||Pe.status==="aborted")return ht;(me.status==="dirty"||Pe.status==="dirty")&&b.dirty(),o.set(me.value,Pe.value)}return{status:b.value,value:o}}}}Lu.create=(v,g,b)=>new Lu({valueType:g,keyType:v,typeName:ut.ZodMap,...yt(b)});class ws extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.set)return qe(I,{code:je.invalid_type,expected:Xe.set,received:I.parsedType}),ht;const z=this._def;z.minSize!==null&&I.data.size<z.minSize.value&&(qe(I,{code:je.too_small,minimum:z.minSize.value,type:"set",inclusive:!0,exact:!1,message:z.minSize.message}),b.dirty()),z.maxSize!==null&&I.data.size>z.maxSize.value&&(qe(I,{code:je.too_big,maximum:z.maxSize.value,type:"set",inclusive:!0,exact:!1,message:z.maxSize.message}),b.dirty());const B=this._def.valueType;function S(he){const me=new Set;for(const Pe of he){if(Pe.status==="aborted")return ht;Pe.status==="dirty"&&b.dirty(),me.add(Pe.value)}return{status:b.value,value:me}}const o=[...I.data.values()].map((he,me)=>B._parse(new Un(I,he,I.path,me)));return I.common.async?Promise.all(o).then(he=>S(he)):S(o)}min(g,b){return new ws({...this._def,minSize:{value:g,message:tt.toString(b)}})}max(g,b){return new ws({...this._def,maxSize:{value:g,message:tt.toString(b)}})}size(g,b){return this.min(g,b).max(g,b)}nonempty(g){return this.min(1,g)}}ws.create=(v,g)=>new ws({valueType:v,minSize:null,maxSize:null,typeName:ut.ZodSet,...yt(g)});class To extends wt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.function)return qe(b,{code:je.invalid_type,expected:Xe.function,received:b.parsedType}),ht;function I(o,he){return Au({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),xo].filter(me=>!!me),issueData:{code:je.invalid_arguments,argumentsError:he}})}function z(o,he){return Au({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),xo].filter(me=>!!me),issueData:{code:je.invalid_return_type,returnTypeError:he}})}const B={errorMap:b.common.contextualErrorMap},S=b.data;if(this._def.returns instanceof Mo){const o=this;return Er(async function(...he){const me=new Jr([]),Pe=await o._def.args.parseAsync(he,B).catch(le=>{throw me.addIssue(I(he,le)),me}),Be=await Reflect.apply(S,this,Pe);return await o._def.returns._def.type.parseAsync(Be,B).catch(le=>{throw me.addIssue(z(Be,le)),me})})}else{const o=this;return Er(function(...he){const me=o._def.args.safeParse(he,B);if(!me.success)throw new Jr([I(he,me.error)]);const Pe=Reflect.apply(S,this,me.data),Be=o._def.returns.safeParse(Pe,B);if(!Be.success)throw new Jr([z(Pe,Be.error)]);return Be.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new To({...this._def,args:$n.create(g).rest(bs.create())})}returns(g){return new To({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,b,I){return new To({args:g||$n.create([]).rest(bs.create()),returns:b||bs.create(),typeName:ut.ZodFunction,...yt(I)})}}class jl extends wt{get schema(){return this._def.getter()}_parse(g){const{ctx:b}=this._processInputParams(g);return this._def.getter()._parse({data:b.data,path:b.path,parent:b})}}jl.create=(v,g)=>new jl({getter:v,typeName:ut.ZodLazy,...yt(g)});class Nl extends wt{_parse(g){if(g.data!==this._def.value){const b=this._getOrReturnCtx(g);return qe(b,{received:b.data,code:je.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:g.data}}get value(){return this._def.value}}Nl.create=(v,g)=>new Nl({value:v,typeName:ut.ZodLiteral,...yt(g)});function $f(v,g){return new Ba({values:v,typeName:ut.ZodEnum,...yt(g)})}class Ba extends wt{constructor(){super(...arguments),kl.set(this,void 0)}_parse(g){if(typeof g.data!="string"){const b=this._getOrReturnCtx(g),I=this._def.values;return qe(b,{expected:Dt.joinValues(I),received:b.parsedType,code:je.invalid_type}),ht}if(ku(this,kl)||jf(this,kl,new Set(this._def.values)),!ku(this,kl).has(g.data)){const b=this._getOrReturnCtx(g),I=this._def.values;return qe(b,{received:b.data,code:je.invalid_enum_value,options:I}),ht}return Er(g.data)}get options(){return this._def.values}get enum(){const g={};for(const b of this._def.values)g[b]=b;return g}get Values(){const g={};for(const b of this._def.values)g[b]=b;return g}get Enum(){const g={};for(const b of this._def.values)g[b]=b;return g}extract(g,b=this._def){return Ba.create(g,{...this._def,...b})}exclude(g,b=this._def){return Ba.create(this.options.filter(I=>!g.includes(I)),{...this._def,...b})}}kl=new WeakMap,Ba.create=$f;class Zl extends wt{constructor(){super(...arguments),zl.set(this,void 0)}_parse(g){const b=Dt.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(g);if(I.parsedType!==Xe.string&&I.parsedType!==Xe.number){const z=Dt.objectValues(b);return qe(I,{expected:Dt.joinValues(z),received:I.parsedType,code:je.invalid_type}),ht}if(ku(this,zl)||jf(this,zl,new Set(Dt.getValidEnumValues(this._def.values))),!ku(this,zl).has(g.data)){const z=Dt.objectValues(b);return qe(I,{received:I.data,code:je.invalid_enum_value,options:z}),ht}return Er(g.data)}get enum(){return this._def.values}}zl=new WeakMap,Zl.create=(v,g)=>new Zl({values:v,typeName:ut.ZodNativeEnum,...yt(g)});class Mo extends wt{unwrap(){return this._def.type}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.promise&&b.common.async===!1)return qe(b,{code:je.invalid_type,expected:Xe.promise,received:b.parsedType}),ht;const I=b.parsedType===Xe.promise?b.data:Promise.resolve(b.data);return Er(I.then(z=>this._def.type.parseAsync(z,{path:b.path,errorMap:b.common.contextualErrorMap})))}}Mo.create=(v,g)=>new Mo({type:v,typeName:ut.ZodPromise,...yt(g)});class wn extends wt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:b,ctx:I}=this._processInputParams(g),z=this._def.effect||null,B={addIssue:S=>{qe(I,S),S.fatal?b.abort():b.dirty()},get path(){return I.path}};if(B.addIssue=B.addIssue.bind(B),z.type==="preprocess"){const S=z.transform(I.data,B);if(I.common.async)return Promise.resolve(S).then(async o=>{if(b.value==="aborted")return ht;const he=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return he.status==="aborted"?ht:he.status==="dirty"||b.value==="dirty"?vo(he.value):he});{if(b.value==="aborted")return ht;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?ht:o.status==="dirty"||b.value==="dirty"?vo(o.value):o}}if(z.type==="refinement"){const S=o=>{const he=z.refinement(o,B);if(I.common.async)return Promise.resolve(he);if(he instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(I.common.async===!1){const o=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});return o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value).then(()=>({status:b.value,value:o.value}))))}if(z.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!xs(S))return S;const o=z.transform(S.value,B);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:b.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>xs(S)?Promise.resolve(z.transform(S.value,B)).then(o=>({status:b.value,value:o})):S);Dt.assertNever(z)}}wn.create=(v,g,b)=>new wn({schema:v,typeName:ut.ZodEffects,effect:g,...yt(b)}),wn.createWithPreprocess=(v,g,b)=>new wn({schema:g,effect:{type:"preprocess",transform:v},typeName:ut.ZodEffects,...yt(b)});class Gn extends wt{_parse(g){return this._getType(g)===Xe.undefined?Er(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Gn.create=(v,g)=>new Gn({innerType:v,typeName:ut.ZodOptional,...yt(g)});class Fa extends wt{_parse(g){return this._getType(g)===Xe.null?Er(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Fa.create=(v,g)=>new Fa({innerType:v,typeName:ut.ZodNullable,...yt(g)});class Vl extends wt{_parse(g){const{ctx:b}=this._processInputParams(g);let I=b.data;return b.parsedType===Xe.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Vl.create=(v,g)=>new Vl({innerType:v,typeName:ut.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...yt(g)});class Ul extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I={...b,common:{...b.common,issues:[]}},z=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return Al(z)?z.then(B=>({status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new Jr(I.common.issues)},input:I.data})})):{status:"valid",value:z.status==="valid"?z.value:this._def.catchValue({get error(){return new Jr(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}Ul.create=(v,g)=>new Ul({innerType:v,typeName:ut.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...yt(g)});class Bu extends wt{_parse(g){if(this._getType(g)!==Xe.nan){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.nan,received:I.parsedType}),ht}return{status:"valid",value:g.data}}}Bu.create=v=>new Bu({typeName:ut.ZodNaN,...yt(v)});const Ry=Symbol("zod_brand");class Td extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I=b.data;return this._def.type._parse({data:I,path:b.path,parent:b})}unwrap(){return this._def.type}}class $l extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.common.async)return(async()=>{const B=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return B.status==="aborted"?ht:B.status==="dirty"?(b.dirty(),vo(B.value)):this._def.out._parseAsync({data:B.value,path:I.path,parent:I})})();{const z=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return z.status==="aborted"?ht:z.status==="dirty"?(b.dirty(),{status:"dirty",value:z.value}):this._def.out._parseSync({data:z.value,path:I.path,parent:I})}}static create(g,b){return new $l({in:g,out:b,typeName:ut.ZodPipeline})}}class Gl extends wt{_parse(g){const b=this._def.innerType._parse(g),I=z=>(xs(z)&&(z.value=Object.freeze(z.value)),z);return Al(b)?b.then(z=>I(z)):I(b)}unwrap(){return this._def.innerType}}Gl.create=(v,g)=>new Gl({innerType:v,typeName:ut.ZodReadonly,...yt(g)});function Gf(v,g){const b=typeof v=="function"?v(g):typeof v=="string"?{message:v}:v;return typeof b=="string"?{message:b}:b}function qf(v,g={},b){return v?bo.create().superRefine((I,z)=>{var B,S;const o=v(I);if(o instanceof Promise)return o.then(he=>{var me,Pe;if(!he){const Be=Gf(g,I),Ee=(Pe=(me=Be.fatal)!==null&&me!==void 0?me:b)!==null&&Pe!==void 0?Pe:!0;z.addIssue({code:"custom",...Be,fatal:Ee})}});if(!o){const he=Gf(g,I),me=(S=(B=he.fatal)!==null&&B!==void 0?B:b)!==null&&S!==void 0?S:!0;z.addIssue({code:"custom",...he,fatal:me})}}):bo.create()}const Dy={object:_i.lazycreate};var ut;(function(v){v.ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly"})(ut||(ut={}));const Ly=(v,g={message:`Input not instance of ${v.name}`})=>qf(b=>b instanceof v,g),Hf=vn.create,Wf=Da.create,By=Bu.create,Fy=La.create,Xf=Rl.create,Oy=vs.create,jy=zu.create,Ny=Dl.create,Zy=Ll.create,Vy=bo.create,Uy=bs.create,$y=aa.create,Gy=Ru.create,qy=bn.create,Hy=_i.create,Wy=_i.strictCreate,Xy=Bl.create,Ky=Du.create,Yy=Fl.create,Jy=$n.create,Qy=Ol.create,ex=Lu.create,tx=ws.create,ix=To.create,rx=jl.create,nx=Nl.create,ax=Ba.create,sx=Zl.create,ox=Mo.create,Kf=wn.create,lx=Gn.create,cx=Fa.create,ux=wn.createWithPreprocess,hx=$l.create;var st=Object.freeze({__proto__:null,defaultErrorMap:xo,setErrorMap:uy,getErrorMap:Eu,makeIssue:Au,EMPTY_PATH:hy,addIssueToContext:qe,ParseStatus:gr,INVALID:ht,DIRTY:vo,OK:Er,isAborted:xd,isDirty:vd,isValid:xs,isAsync:Al,get util(){return Dt},get objectUtil(){return yd},ZodParsedType:Xe,getParsedType:na,ZodType:wt,datetimeRegex:Uf,ZodString:vn,ZodNumber:Da,ZodBigInt:La,ZodBoolean:Rl,ZodDate:vs,ZodSymbol:zu,ZodUndefined:Dl,ZodNull:Ll,ZodAny:bo,ZodUnknown:bs,ZodNever:aa,ZodVoid:Ru,ZodArray:bn,ZodObject:_i,ZodUnion:Bl,ZodDiscriminatedUnion:Du,ZodIntersection:Fl,ZodTuple:$n,ZodRecord:Ol,ZodMap:Lu,ZodSet:ws,ZodFunction:To,ZodLazy:jl,ZodLiteral:Nl,ZodEnum:Ba,ZodNativeEnum:Zl,ZodPromise:Mo,ZodEffects:wn,ZodTransformer:wn,ZodOptional:Gn,ZodNullable:Fa,ZodDefault:Vl,ZodCatch:Ul,ZodNaN:Bu,BRAND:Ry,ZodBranded:Td,ZodPipeline:$l,ZodReadonly:Gl,custom:qf,Schema:wt,ZodSchema:wt,late:Dy,get ZodFirstPartyTypeKind(){return ut},coerce:{string:v=>vn.create({...v,coerce:!0}),number:v=>Da.create({...v,coerce:!0}),boolean:v=>Rl.create({...v,coerce:!0}),bigint:v=>La.create({...v,coerce:!0}),date:v=>vs.create({...v,coerce:!0})},any:Vy,array:qy,bigint:Fy,boolean:Xf,date:Oy,discriminatedUnion:Ky,effect:Kf,enum:ax,function:ix,instanceof:Ly,intersection:Yy,lazy:rx,literal:nx,map:ex,nan:By,nativeEnum:sx,never:$y,null:Zy,nullable:cx,number:Wf,object:Hy,oboolean:()=>Xf().optional(),onumber:()=>Wf().optional(),optional:lx,ostring:()=>Hf().optional(),pipeline:hx,preprocess:ux,promise:ox,record:Qy,set:tx,strictObject:Wy,string:Hf,symbol:jy,transformer:Kf,tuple:Jy,undefined:Ny,union:Xy,unknown:Uy,void:Gy,NEVER:ht,ZodIssueCode:je,quotelessJson:cy,ZodError:Jr});const Fu=st.object({lat:st.number(),lng:st.number()}),dx=st.object({center:Fu,zoom:st.number()}),px=st.object({sw:Fu,ne:Fu}),fx=st.object({name:st.literal("dark").or(st.literal("light")),url:st.string().optional(),colors:st.object({primary:st.string().max(64),background:st.string().max(64),text:st.string().max(64)})}),mx=st.object({container:st.string(),position:st.object({center:st.object({lat:st.number(),lng:st.number()}),zoom:st.number()}),restriction:st.object({minZoom:st.number().min(gd).max(El).optional(),maxZoom:st.number().min(gd).max(El).optional(),maxBounds:px.optional()}).optional(),style:fx});st.enum(["idle","move","click","popup_click"]);const gx=st.function().returns(st.void()),_x=st.function().args(dx).returns(st.void()),yx=st.function().args(Fu).returns(st.void()),xx={idle:gx,move:_x,click:yx},Yf=st.object({id:st.string(),rank:st.number(),lat:st.number(),lng:st.number(),width:st.number(),height:st.number()}),vx=st.tuple([st.number(),st.array(st.tuple([st.number(),st.number()]))]),Jf=st.function().args(st.string()).returns(st.promise(st.any())),bx=st.object({data:Yf,state:vx,callbacks:st.object({body:Jf,pin:Jf.optional()})}),wx=st.array(bx);st.object({key:st.string(),data:st.array(Yf)});var Tx=od('<div class="container svelte-1l30n6h"><div class="map svelte-1l30n6h"></div> <div class="logo svelte-1l30n6h"><a href="https://arenarium.dev" target="_blank" class="svelte-1l30n6h">@arenarium/maps</a></div></div>');function Qf(v,g){pu(g,!0);let b,I,z,B,S,o=Zi(0),he=Zi(0),me=Zi(!1),Pe=Zi(void 0);Ef(()=>{mx.parse(g.options),Be(),Ee()});function Be(){var Ce,Ye,Ue;z=((Ce=g.options.restriction)==null?void 0:Ce.minZoom)??gd,B=((Ye=g.options.restriction)==null?void 0:Ye.maxZoom)??El,S=(Ue=g.options.restriction)==null?void 0:Ue.maxBounds,b=new _d.Map({style:yr(g.options.style),center:{lat:g.options.position.center.lat,lng:g.options.position.center.lng},zoom:g.options.position.zoom,minZoom:It(z),maxZoom:B,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}function Ee(){b.on("load",le),b.on("move",Fe),b.on("idle",Bt),b.on("click",fi),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function le(){di(me,!0)}function Fe(){const Ce=b.getCenter(),Ye=b.getZoom();Ft("move",{center:Ce,zoom:Ye});const Ue=b.getBounds();di(Pe,{sw:{lat:Ue.getSouthWest().lat,lng:Ue.getSouthWest().lng},ne:{lat:Ue.getNorthEast().lat,lng:Ue.getNorthEast().lng}},!0)}function Bt(){Ft("idle",null);const Ce=b.getBounds();di(Pe,{sw:{lat:Ce.getSouthWest().lat,lng:Ce.getSouthWest().lng},ne:{lat:Ce.getNorthEast().lat,lng:Ce.getNorthEast().lng}},!0)}function fi(Ce){Ft("click",{lat:Ce.lngLat.lat,lng:Ce.lngLat.lng})}const ti=new Map;function yi(Ce,Ye){var Nt;const Ue=xx[Ce];if(!Ue)throw new Error(`No schema defined for event ${Ce}`);if(!Ue.safeParse(Ye).success)throw new Error(`Invalid handler for event ${Ce}`);ti.has(Ce)||ti.set(Ce,new Set),(Nt=ti.get(Ce))==null||Nt.add(Ye)}function Ki(Ce,Ye){const Ue=ti.get(Ce);Ue&&Ue.delete(Ye)&&Ue.size===0&&ti.delete(Ce)}function Ft(Ce,Ye){const Ue=ti.get(Ce);Ue&&Ue.size>0&&[...Ue].forEach(_t=>{try{_t(Ye)}catch(Nt){console.error(Nt)}})}function It(Ce){const Ye=zf,Ue=Math.ceil(Math.log2(ct(o)/Ye));return Math.max(Ce,Ue)}function $t(){const Ce=b.getCenter();return Ce?{lat:Ce.lat,lng:Ce.lng}:{lat:g.options.position.center.lat,lng:g.options.position.center.lng}}function _r(){return b.getZoom()??g.options.position.zoom}function jt(){if(!b)throw new Error("Map not loaded!");const Ce=b.getBounds();return{sw:{lat:Ce.getSouthWest().lat,lng:Ce.getSouthWest().lng},ne:{lat:Ce.getNorthEast().lat,lng:Ce.getNorthEast().lng}}}function Tn(Ce){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setCenter(Ce)}function Mn(Ce){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setZoom(Ce)}function Yi(){if(!b)throw new Error("Map not loaded! Consider using the position option");b.zoomIn()}function ar(){if(!b)throw new Error("Map not loaded! Consider using the position option.");b.zoomOut()}function Ji(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");z=Ce,b.setMinZoom(It(Ce))}function ot(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");B=Ce,b.setMaxZoom(Ce)}function Vi(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");S=Ce,b.setMaxBounds([Ce.sw.lng,Ce.sw.lat,Ce.ne.lng,Ce.ne.lat])}let xi=Zi(gs(g.options.style));go(()=>{ct(me)&&b.setStyle(yr(ct(xi)),{diff:!0})});function yr(Ce){if(Ce.url)return Ce.url;switch(Ce.name){case"light":return ly;case"dark":return oy}}function Et(){return o_(ct(xi))}function Ar(Ce){di(xi,Ce,!0),b.setStyle(yr(ct(xi)),{diff:!0})}class sr{constructor(Ye){qt(this,"id");qt(this,"lat");qt(this,"lng");qt(this,"zoom");qt(this,"element");qt(this,"component");qt(this,"libreMarker");this.id=Ye.data.id,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.element=void 0,this.component=void 0,this.libreMarker=void 0}createLibreMarker(){const Ye=this.element;if(!Ye)throw new Error("Failed to create libre marker");const Ue=new _d.Marker({element:Ye});Ue.setLngLat([this.lng,this.lat]),this.libreMarker=Ue}isCreated(){return this.element!=null}isInBlock(Ye,Ue){return this.zoom<=Ye&&Ue.contains(this.lat,this.lng)}}class cn extends sr{constructor(Ue){super(Ue);qt(this,"pinLoading",!1);qt(this,"pinLoaded",!1);qt(this,"pinContentCallback");this.pinContentCallback=Ue.content.pinCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=cd(iy,{target:this.element}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ue=this.element;if(!Ue)return;const _t=Math.round((El-this.zoom)*Rf);Ue.style.zIndex=_t.toString()}updateMap(Ue){if(this.libreMarker==null)throw new Error("Failed to update circle map");this.libreMarker._map!=Ue&&(Ue?this.libreMarker.addTo(Ue):this.libreMarker.remove())}updateState(Ue){const _t=this.component;if(!_t)throw new Error("Failed to update circle state");if(this.zoom<=Ue)_t.setCollapsed(!0);else{const cr=1-(this.zoom-Ue)/Df*.5;_t.setScale(cr),_t.setCollapsed(!1)}}updatePin(){var _t;if(this.pinContentCallback==null||this.pinLoaded||this.pinLoading)return;const Ue=(_t=this.component)==null?void 0:_t.getPin();Ue!=null&&(this.pinLoading=!0,this.pinContentCallback(this.id).then(Nt=>{Ue.appendChild(Nt),this.pinLoaded=!0,this.pinLoading=!1}))}isPinLoaded(){return this.pinContentCallback==null||this.pinLoaded}}class kr extends sr{constructor(Ue){super(Ue);qt(this,"width");qt(this,"height");qt(this,"angles");qt(this,"bodyLoading",!1);qt(this,"bodyLoaded",!1);qt(this,"bodyContentCallback");this.id=Ue.data.id,this.angles=Ue.state[1],this.width=Ue.data.width,this.height=Ue.data.height,this.bodyContentCallback=Ue.content.bodyCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=cd(ey,{target:this.element,props:{width:this.width,height:this.height}}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ue=this.element;if(!Ue)return;const _t=Math.round((El-this.zoom)*Rf)+1e6;Ue.style.zIndex=_t.toString()}updateMap(Ue){const _t=this.libreMarker,Nt=this.component;if(_t==null||Nt==null)throw new Error("Failed to update marker map");_t._map!=Ue&&(Ue?(_t.addTo(Ue),Nt.setDisplayed(!0)):(_t.remove(),Nt.setDisplayed(!1)))}updateState(Ue){const _t=this.component;if(!_t)throw new Error("Failed to update marker state");this.zoom<=Ue?(_t.setCollapsed(!1),_t.setAngle(this.getAngle(Ue))):_t.setCollapsed(!0)}updateBody(){var _t;if(this.bodyLoaded||this.bodyLoading)return;const Ue=(_t=this.component)==null?void 0:_t.getBody();Ue!=null&&(this.bodyLoading=!0,this.bodyContentCallback(this.id).then(Nt=>{Ue.appendChild(Nt),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(Ue){let _t=this.angles,Nt=_t[0],cr=0;for(;Nt[0]<Ue&&(cr++,cr!=_t.length);)Nt=_t[cr];return Nt[1]}getExpanded(){return this.component?this.component.getExpanded():!1}getCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class la{constructor(Ye){qt(this,"id");qt(this,"rank");qt(this,"lat");qt(this,"lng");qt(this,"zoom");qt(this,"circle");qt(this,"marker");this.id=Ye.data.id,this.rank=Ye.data.rank,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.circle=new cn(Ye),this.marker=new kr(Ye)}}let xr,Ht=new Array,vr=new Map,Qi=zf,Sn=mu(()=>ct(Pe)?new Ff(b,-512,ct(he)+Qi,ct(o)+Qi,-512):void 0),un=mu(()=>ct(Pe)?new Ff(b,0,ct(he),ct(o),0):void 0);Ef(()=>{const Ce=()=>{ca(),xr=window.setTimeout(Ce,25)};return Ce(),()=>clearInterval(xr)});function ca(){if(ct(me)==!1||ct(un)==null||ct(Sn)==null||Ht.length==0)return;const Ce=b.getZoom();if(Ce)for(const Ye of Ht)or(Ye.circle,Ce,ct(un)),lr(Ye.marker,Ce,ct(Sn))}function or(Ce,Ye,Ue){Ce.isInBlock(Ye+Df,Ue)?(Ce.isCreated()==!1&&Ce.createElement(),Ce.updateMap(b),Ce.updateState(Ye),Ce.isPinLoaded()==!1&&Ce.updatePin()):Ce.isCreated()==!0&&Ce.updateMap(null)}function lr(Ce,Ye,Ue){Ce.isInBlock(Ye+Y_,Ue)?(Ce.isCreated()==!1&&Ce.createElement(),Ce.updateMap(b),Ce.updateState(Ye),Ce.getExpanded()&&Ce.isBodyLoaded()==!1&&Ce.updateBody()):Ce.isCreated()==!0&&(Ce.getCollapsed()?Ce.updateMap(null):Ce.updateState(Ye))}async function Ui(Ce){var Nt,cr;const Ye=new Map(Ce.map(mi=>[mi.data.id,new la(mi)])),Ue=new Array,_t=Array.from(Ht);for(const mi of _t)Ye.has(mi.id)==!1&&((Nt=mi.circle.libreMarker)==null||Nt.remove(),(cr=mi.marker.libreMarker)==null||cr.remove(),vr.delete(mi.id),Ht.splice(Ht.indexOf(mi),1));for(const mi of Ce){const zr=vr.get(mi.data.id);if(zr)zr.circle.zoom=mi.state[0],zr.circle.updateZIndex(),zr.marker.zoom=mi.state[0],zr.marker.angles=mi.state[1],zr.marker.updateZIndex();else{const Rr=new la(mi);vr.set(mi.data.id,Rr),Ht.push(Rr),Ue.push(Rr)}}}function Zt(){var Ce,Ye;for(const Ue of Ht)(Ce=Ue.circle.libreMarker)==null||Ce.remove(),(Ye=Ue.marker.libreMarker)==null||Ye.remove();Ht.length=0,vr.clear()}async function Vr(Ce){if(!(await wx.safeParseAsync(Ce)).success)throw new Error("Invalid popups");await Ui(Ce)}function hn(){Zt()}function br(Ce){const Ye=vr.get(Ce);Ye!=null&&b.flyTo({center:{lat:Ye.lat,lng:Ye.lng},zoom:Ye.zoom})}var Pn=Tx();F_("resize",td,()=>b.setMinZoom(It(z)));var Cn=gu(Pn);return yo(Cn,Ce=>I=Ce,()=>I),id(()=>Pu(Pn,`--primary: ${ct(xi).colors.primary??""}; --background: ${ct(xi).colors.background??""}; --text: ${ct(xi).colors.text??""};`)),Cu(Cn,"clientWidth",Ce=>di(o,Ce)),Cu(Cn,"clientHeight",Ce=>di(he,Ce)),ld(v,Pn),fu({on:yi,off:Ki,emit:Ft,getCenter:$t,getZoom:_r,getBounds:jt,setCenter:Tn,setZoom:Mn,zoomIn:Yi,zoomOut:ar,setMinZoom:Ji,setMaxZoom:ot,setMaxBounds:Vi,getStyle:Et,setStyle:Ar,updatePopups:Vr,removePopups:hn,revealPopup:br})}function Mx(v){const g=document.getElementById(v.container);if(!g)throw new Error(`Container not found: ${v.container}`);return cd(Qf,{target:g,props:{options:v}})}function Sx(v){Z_(v)}Ot.Map=Qf,Ot.mountMap=Mx,Ot.unmountMap=Sx,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})});