@opengis/partsmap 0.0.81 → 0.0.83
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/PartsMap.js +4 -3
- package/dist/PartsMap.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/PartsMap.umd.cjs
CHANGED
@@ -577,9 +577,9 @@ uniform ${C} ${E} u_${R};
|
|
577
577
|
#endif
|
578
578
|
`}),staticAttributes:o,staticUniforms:g}}class Gs{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,o,a,h,g,y,b,w){this.context=t;let C=this.boundPaintVertexBuffers.length!==a.length;for(let E=0;!C&&E<a.length;E++)this.boundPaintVertexBuffers[E]!==a[E]&&(C=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==o||C||this.boundIndexBuffer!==h||this.boundVertexOffset!==g||this.boundDynamicVertexBuffer!==y||this.boundDynamicVertexBuffer2!==b||this.boundDynamicVertexBuffer3!==w?this.freshBind(n,o,a,h,g,y,b,w):(t.bindVertexArray.set(this.vao),y&&y.bind(),h&&h.dynamicDraw&&h.bind(),b&&b.bind(),w&&w.bind())}freshBind(t,n,o,a,h,g,y,b){const w=t.numAttributes,C=this.context,E=C.gl;this.vao&&this.destroy(),this.vao=C.createVertexArray(),C.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=o,this.boundIndexBuffer=a,this.boundVertexOffset=h,this.boundDynamicVertexBuffer=g,this.boundDynamicVertexBuffer2=y,this.boundDynamicVertexBuffer3=b,n.enableAttributes(E,t);for(const R of o)R.enableAttributes(E,t);g&&g.enableAttributes(E,t),y&&y.enableAttributes(E,t),b&&b.enableAttributes(E,t),n.bind(),n.setVertexAttribPointers(E,t,h);for(const R of o)R.bind(),R.setVertexAttribPointers(E,t,h);g&&(g.bind(),g.setVertexAttribPointers(E,t,h)),a&&a.bind(),y&&(y.bind(),y.setVertexAttribPointers(E,t,h)),b&&(b.bind(),b.setVertexAttribPointers(E,t,h)),C.currentNumAttributes=w}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Ho=(u,t,n,o,a)=>({u_matrix:u,u_texture:0,u_ele_delta:t,u_fog_matrix:n,u_fog_color:o?o.properties.get("fog-color"):c.aN.white,u_fog_ground_blend:o?o.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?o.calculateFogBlendOpacity(a):0,u_horizon_color:o?o.properties.get("horizon-color"):c.aN.white,u_horizon_fog_blend:o?o.properties.get("horizon-fog-blend"):1});function ps(u){const t=[];for(let n=0;n<u.length;n++){if(u[n]===null)continue;const o=u[n].split(" ");t.push(o.pop())}return t}class Hs{constructor(t,n,o,a,h,g){const y=t.gl;this.program=y.createProgram();const b=ps(n.staticAttributes),w=o?o.getBinderAttributes():[],C=b.concat(w),E=Wr.prelude.staticUniforms?ps(Wr.prelude.staticUniforms):[],R=n.staticUniforms?ps(n.staticUniforms):[],F=o?o.getBinderUniforms():[],$=E.concat(R).concat(F),H=[];for(const ce of $)H.indexOf(ce)<0&&H.push(ce);const q=o?o.defines():[];h&&q.push("#define OVERDRAW_INSPECTOR;"),g&&q.push("#define TERRAIN3D;");const X=q.concat(Wr.prelude.fragmentSource,n.fragmentSource).join(`
|
579
579
|
`),Y=q.concat(Wr.prelude.vertexSource,n.vertexSource).join(`
|
580
|
-
`),U=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(U,X),y.compileShader(U),!y.getShaderParameter(U,y.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${y.getShaderInfoLog(U)}`);y.attachShader(this.program,U);const te=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(te,Y),y.compileShader(te),!y.getShaderParameter(te,y.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${y.getShaderInfoLog(te)}`);y.attachShader(this.program,te),this.attributes={};const se={};this.numAttributes=C.length;for(let ce=0;ce<this.numAttributes;ce++)C[ce]&&(y.bindAttribLocation(this.program,ce,C[ce]),this.attributes[C[ce]]=ce);if(y.linkProgram(this.program),!y.getProgramParameter(this.program,y.LINK_STATUS))throw new Error(`Program failed to link: ${y.getProgramInfoLog(this.program)}`);y.deleteShader(te),y.deleteShader(U);for(let ce=0;ce<H.length;ce++){const ye=H[ce];if(ye&&!se[ye]){const we=y.getUniformLocation(this.program,ye);we&&(se[ye]=we)}}this.fixedUniforms=a(t,se),this.terrainUniforms=((ce,ye)=>({u_depth:new c.aI(ce,ye.u_depth),u_terrain:new c.aI(ce,ye.u_terrain),u_terrain_dim:new c.aJ(ce,ye.u_terrain_dim),u_terrain_matrix:new c.aK(ce,ye.u_terrain_matrix),u_terrain_unpack:new c.aL(ce,ye.u_terrain_unpack),u_terrain_exaggeration:new c.aJ(ce,ye.u_terrain_exaggeration)}))(t,se),this.binderUniforms=o?o.getUniforms(t,se):[]}draw(t,n,o,a,h,g,y,b,w,C,E,R,F,$,H,q,X,Y){const U=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(o),t.setStencilMode(a),t.setColorMode(h),t.setCullFace(g),b){t.activeTexture.set(U.TEXTURE2),U.bindTexture(U.TEXTURE_2D,b.depthTexture),t.activeTexture.set(U.TEXTURE3),U.bindTexture(U.TEXTURE_2D,b.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(b[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(y[se]);H&&H.setUniforms(t,this.binderUniforms,F,{zoom:$});let te=0;switch(n){case U.LINES:te=2;break;case U.TRIANGLES:te=3;break;case U.LINE_STRIP:te=1}for(const se of R.get()){const ce=se.vaos||(se.vaos={});(ce[w]||(ce[w]=new Gs)).bind(t,this,C,H?H.getPaintVertexBuffers():[],E,se.vertexOffset,q,X,Y),U.drawElements(n,se.primitiveLength*te,U.UNSIGNED_SHORT,se.primitiveOffset*te*2)}}}function Ws(u,t,n){const o=1/rt(n,1,t.transform.tileZoom),a=Math.pow(2,n.tileID.overscaledZ),h=n.tileSize*Math.pow(2,t.transform.tileZoom)/a,g=h*(n.tileID.canonical.x+n.tileID.wrap*a),y=h*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[g>>16,y>>16],u_pixel_coord_lower:[65535&g,65535&y]}}const Xs=(u,t,n,o)=>{const a=t.style.light,h=a.properties.get("position"),g=[h.x,h.y,h.z],y=function(){var w=new c.A(9);return c.A!=Float32Array&&(w[1]=0,w[2]=0,w[3]=0,w[5]=0,w[6]=0,w[7]=0),w[0]=1,w[4]=1,w[8]=1,w}();a.properties.get("anchor")==="viewport"&&function(w,C){var E=Math.sin(C),R=Math.cos(C);w[0]=R,w[1]=E,w[2]=0,w[3]=-E,w[4]=R,w[5]=0,w[6]=0,w[7]=0,w[8]=1}(y,-t.transform.angle),function(w,C,E){var R=C[0],F=C[1],$=C[2];w[0]=R*E[0]+F*E[3]+$*E[6],w[1]=R*E[1]+F*E[4]+$*E[7],w[2]=R*E[2]+F*E[5]+$*E[8]}(g,g,y);const b=a.properties.get("color");return{u_matrix:u,u_lightpos:g,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_vertical_gradient:+n,u_opacity:o}},Js=(u,t,n,o,a,h,g)=>c.e(Xs(u,t,n,o),Ws(h,t,g),{u_height_factor:-Math.pow(2,a.overscaledZ)/g.tileSize/8}),fs=u=>({u_matrix:u}),Dn=(u,t,n,o)=>c.e(fs(u),Ws(n,t,o)),$c=(u,t)=>({u_matrix:u,u_world:t}),Uc=(u,t,n,o,a)=>c.e(Dn(u,t,n,o),{u_world:a}),_l=(u,t,n,o)=>{const a=u.transform;let h,g;if(o.paint.get("circle-pitch-alignment")==="map"){const y=rt(n,1,a.zoom);h=!0,g=[y,y]}else h=!1,g=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(o.paint.get("circle-pitch-scale")==="map"),u_matrix:u.translatePosMatrix(t.posMatrix,n,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_pitch_with_map:+h,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:g}},jc=(u,t,n)=>({u_matrix:u,u_inv_matrix:t,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),Xr=(u,t,n=1)=>({u_matrix:u,u_color:t,u_overlay:0,u_overlay_scale:n}),ms=u=>({u_matrix:u}),Ui=(u,t,n,o)=>({u_matrix:u,u_extrude_scale:rt(t,1,n),u_intensity:o});function ji(u,t){const n=Math.pow(2,t.canonical.z),o=t.canonical.y;return[new c.Z(0,o/n).toLngLat().lat,new c.Z(0,(o+1)/n).toLngLat().lat]}const gs=(u,t,n,o)=>{const a=u.transform;return{u_matrix:vl(u,t,n,o),u_ratio:1/rt(t,1,a.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Ks=(u,t,n,o,a)=>c.e(gs(u,t,n,a),{u_image:0,u_image_height:o}),yl=(u,t,n,o,a)=>{const h=u.transform,g=un(t,h);return{u_matrix:vl(u,t,n,a),u_texsize:t.imageAtlasTexture.size,u_ratio:1/rt(t,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[g,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},xl=(u,t,n,o,a,h)=>{const g=u.lineAtlas,y=un(t,u.transform),b=n.layout.get("line-cap")==="round",w=g.getDash(o.from,b),C=g.getDash(o.to,b),E=w.width*a.fromScale,R=C.width*a.toScale;return c.e(gs(u,t,n,h),{u_patternscale_a:[y/E,-w.height/2],u_patternscale_b:[y/R,-C.height/2],u_sdfgamma:g.width/(256*Math.min(E,R)*u.pixelRatio)/2,u_image:0,u_tex_y_a:w.y,u_tex_y_b:C.y,u_mix:a.t})};function un(u,t){return 1/rt(u,1,t.tileZoom)}function vl(u,t,n,o){return u.translatePosMatrix(o?o.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const qc=(u,t,n,o,a)=>{return{u_matrix:u,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:o.mix,u_opacity:o.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(g=a.paint.get("raster-saturation"),g>0?1-1/(1.001-g):-g),u_contrast_factor:(h=a.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:Zc(a.paint.get("raster-hue-rotate"))};var h,g};function Zc(u){u*=Math.PI/180;const t=Math.sin(u),n=Math.cos(u);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const bl=(u,t,n,o,a,h,g,y,b,w,C,E,R,F)=>{const $=g.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:$.cameraToCenterDistance,u_pitch:$.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:$.width/$.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:b,u_coord_matrix:w,u_is_text:+E,u_pitch_with_map:+o,u_is_along_line:a,u_is_variable_anchor:h,u_texsize:R,u_texture:0,u_translation:C,u_pitched_scale:F}},wl=(u,t,n,o,a,h,g,y,b,w,C,E,R,F,$)=>{const H=g.transform;return c.e(bl(u,t,n,o,a,h,g,y,b,w,C,E,R,$),{u_gamma_scale:o?Math.cos(H._pitch)*H.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+F})},Gc=(u,t,n,o,a,h,g,y,b,w,C,E,R,F)=>c.e(wl(u,t,n,o,a,h,g,y,b,w,C,!0,E,!0,F),{u_texsize_icon:R,u_texture_icon:1}),Ys=(u,t,n)=>({u_matrix:u,u_opacity:t,u_color:n}),Wo=(u,t,n,o,a,h)=>c.e(function(g,y,b,w){const C=b.imageManager.getPattern(g.from.toString()),E=b.imageManager.getPattern(g.to.toString()),{width:R,height:F}=b.imageManager.getPixelSize(),$=Math.pow(2,w.tileID.overscaledZ),H=w.tileSize*Math.pow(2,b.transform.tileZoom)/$,q=H*(w.tileID.canonical.x+w.tileID.wrap*$),X=H*w.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:C.tl,u_pattern_br_a:C.br,u_pattern_tl_b:E.tl,u_pattern_br_b:E.br,u_texsize:[R,F],u_mix:y.t,u_pattern_size_a:C.displaySize,u_pattern_size_b:E.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/rt(w,1,b.transform.tileZoom),u_pixel_coord_upper:[q>>16,X>>16],u_pixel_coord_lower:[65535&q,65535&X]}}(o,h,n,a),{u_matrix:u,u_opacity:t}),Qs={fillExtrusion:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_lightpos:new c.aO(u,t.u_lightpos),u_lightintensity:new c.aJ(u,t.u_lightintensity),u_lightcolor:new c.aO(u,t.u_lightcolor),u_vertical_gradient:new c.aJ(u,t.u_vertical_gradient),u_opacity:new c.aJ(u,t.u_opacity)}),fillExtrusionPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_lightpos:new c.aO(u,t.u_lightpos),u_lightintensity:new c.aJ(u,t.u_lightintensity),u_lightcolor:new c.aO(u,t.u_lightcolor),u_vertical_gradient:new c.aJ(u,t.u_vertical_gradient),u_height_factor:new c.aJ(u,t.u_height_factor),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade),u_opacity:new c.aJ(u,t.u_opacity)}),fill:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix)}),fillPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),fillOutline:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world)}),fillOutlinePattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),circle:(u,t)=>({u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_scale_with_map:new c.aI(u,t.u_scale_with_map),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_extrude_scale:new c.aP(u,t.u_extrude_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_matrix:new c.aK(u,t.u_matrix)}),collisionBox:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_pixel_extrude_scale:new c.aP(u,t.u_pixel_extrude_scale)}),collisionCircle:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_inv_matrix:new c.aK(u,t.u_inv_matrix),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_viewport_size:new c.aP(u,t.u_viewport_size)}),debug:(u,t)=>({u_color:new c.aM(u,t.u_color),u_matrix:new c.aK(u,t.u_matrix),u_overlay:new c.aI(u,t.u_overlay),u_overlay_scale:new c.aJ(u,t.u_overlay_scale)}),clippingMask:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix)}),heatmap:(u,t)=>({u_extrude_scale:new c.aJ(u,t.u_extrude_scale),u_intensity:new c.aJ(u,t.u_intensity),u_matrix:new c.aK(u,t.u_matrix)}),heatmapTexture:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world),u_image:new c.aI(u,t.u_image),u_color_ramp:new c.aI(u,t.u_color_ramp),u_opacity:new c.aJ(u,t.u_opacity)}),hillshade:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_latrange:new c.aP(u,t.u_latrange),u_light:new c.aP(u,t.u_light),u_shadow:new c.aM(u,t.u_shadow),u_highlight:new c.aM(u,t.u_highlight),u_accent:new c.aM(u,t.u_accent)}),hillshadePrepare:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_dimension:new c.aP(u,t.u_dimension),u_zoom:new c.aJ(u,t.u_zoom),u_unpack:new c.aL(u,t.u_unpack)}),line:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels)}),lineGradient:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_image:new c.aI(u,t.u_image),u_image_height:new c.aJ(u,t.u_image_height)}),linePattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texsize:new c.aP(u,t.u_texsize),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_image:new c.aI(u,t.u_image),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),lineSDF:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_patternscale_a:new c.aP(u,t.u_patternscale_a),u_patternscale_b:new c.aP(u,t.u_patternscale_b),u_sdfgamma:new c.aJ(u,t.u_sdfgamma),u_image:new c.aI(u,t.u_image),u_tex_y_a:new c.aJ(u,t.u_tex_y_a),u_tex_y_b:new c.aJ(u,t.u_tex_y_b),u_mix:new c.aJ(u,t.u_mix)}),raster:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_tl_parent:new c.aP(u,t.u_tl_parent),u_scale_parent:new c.aJ(u,t.u_scale_parent),u_buffer_scale:new c.aJ(u,t.u_buffer_scale),u_fade_t:new c.aJ(u,t.u_fade_t),u_opacity:new c.aJ(u,t.u_opacity),u_image0:new c.aI(u,t.u_image0),u_image1:new c.aI(u,t.u_image1),u_brightness_low:new c.aJ(u,t.u_brightness_low),u_brightness_high:new c.aJ(u,t.u_brightness_high),u_saturation_factor:new c.aJ(u,t.u_saturation_factor),u_contrast_factor:new c.aJ(u,t.u_contrast_factor),u_spin_weights:new c.aO(u,t.u_spin_weights)}),symbolIcon:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texture:new c.aI(u,t.u_texture),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),symbolSDF:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texture:new c.aI(u,t.u_texture),u_gamma_scale:new c.aJ(u,t.u_gamma_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_is_halo:new c.aI(u,t.u_is_halo),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),symbolTextAndIcon:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texsize_icon:new c.aP(u,t.u_texsize_icon),u_texture:new c.aI(u,t.u_texture),u_texture_icon:new c.aI(u,t.u_texture_icon),u_gamma_scale:new c.aJ(u,t.u_gamma_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_is_halo:new c.aI(u,t.u_is_halo),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),background:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_opacity:new c.aJ(u,t.u_opacity),u_color:new c.aM(u,t.u_color)}),backgroundPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_opacity:new c.aJ(u,t.u_opacity),u_image:new c.aI(u,t.u_image),u_pattern_tl_a:new c.aP(u,t.u_pattern_tl_a),u_pattern_br_a:new c.aP(u,t.u_pattern_br_a),u_pattern_tl_b:new c.aP(u,t.u_pattern_tl_b),u_pattern_br_b:new c.aP(u,t.u_pattern_br_b),u_texsize:new c.aP(u,t.u_texsize),u_mix:new c.aJ(u,t.u_mix),u_pattern_size_a:new c.aP(u,t.u_pattern_size_a),u_pattern_size_b:new c.aP(u,t.u_pattern_size_b),u_scale_a:new c.aJ(u,t.u_scale_a),u_scale_b:new c.aJ(u,t.u_scale_b),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aJ(u,t.u_tile_units_to_pixels)}),terrain:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texture:new c.aI(u,t.u_texture),u_ele_delta:new c.aJ(u,t.u_ele_delta),u_fog_matrix:new c.aK(u,t.u_fog_matrix),u_fog_color:new c.aM(u,t.u_fog_color),u_fog_ground_blend:new c.aJ(u,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.aJ(u,t.u_fog_ground_blend_opacity),u_horizon_color:new c.aM(u,t.u_horizon_color),u_horizon_fog_blend:new c.aJ(u,t.u_horizon_fog_blend)}),terrainDepth:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ele_delta:new c.aJ(u,t.u_ele_delta)}),terrainCoords:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texture:new c.aI(u,t.u_texture),u_terrain_coords_id:new c.aJ(u,t.u_terrain_coords_id),u_ele_delta:new c.aJ(u,t.u_ele_delta)}),sky:(u,t)=>({u_sky_color:new c.aM(u,t.u_sky_color),u_horizon_color:new c.aM(u,t.u_horizon_color),u_horizon:new c.aJ(u,t.u_horizon),u_sky_horizon_blend:new c.aJ(u,t.u_sky_horizon_blend)})};class Xo{constructor(t,n,o){this.context=t;const a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!o,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Jo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class yr{constructor(t,n,o,a){this.length=n.length,this.attributes=o,this.itemSize=n.bytesPerElement,this.dynamicDraw=a,this.context=t;const h=t.gl;this.buffer=h.createBuffer(),t.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let o=0;o<this.attributes.length;o++){const a=n.attributes[this.attributes[o].name];a!==void 0&&t.enableVertexAttribArray(a)}}setVertexAttribPointers(t,n,o){for(let a=0;a<this.attributes.length;a++){const h=this.attributes[a],g=n.attributes[h.name];g!==void 0&&t.vertexAttribPointer(g,h.components,t[Jo[h.type]],!1,this.itemSize,h.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ko=new WeakMap;function Ln(u){var t;if(Ko.has(u))return Ko.get(u);{const n=(t=u.getParameter(u.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Ko.set(u,n),n}}class pt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class _s extends pt{getDefault(){return c.aN.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Hc extends pt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class eo extends pt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Wc extends pt{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Rn extends pt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Xc extends pt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Sl extends pt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Jc extends pt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Tl extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Yo extends pt{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class kl extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Il extends pt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Cl extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class El extends pt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class dn extends pt{getDefault(){return c.aN.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Pl extends pt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Kc extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Yc extends pt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Al extends pt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ys extends pt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Qc extends pt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class to extends pt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class eh extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class th extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ml extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class zl extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Dl extends pt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Qo extends pt{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const o=this.gl;Ln(o)?o.bindVertexArray(t):(n=o.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Ll extends pt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class io extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Dr extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class xs extends pt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class ea extends xs{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class ta extends xs{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Rl extends xs{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class ia{constructor(t,n,o,a,h){this.context=t,this.width=n,this.height=o;const g=t.gl,y=this.framebuffer=g.createFramebuffer();if(this.colorAttachment=new ea(t,y),a)this.depthAttachment=h?new Rl(t,y):new ta(t,y);else if(h)throw new Error("Stencil cannot be set without depth");if(g.checkFramebufferStatus(g.FRAMEBUFFER)!==g.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}t.deleteFramebuffer(this.framebuffer)}}class Et{constructor(t,n,o){this.blendFunction=t,this.blendColor=n,this.mask=o}}Et.Replace=[1,0],Et.disabled=new Et(Et.Replace,c.aN.transparent,[!1,!1,!1,!1]),Et.unblended=new Et(Et.Replace,c.aN.transparent,[!0,!0,!0,!0]),Et.alphaBlended=new Et([1,771],c.aN.transparent,[!0,!0,!0,!0]);class ra{constructor(t){var n,o;if(this.gl=t,this.clearColor=new _s(this),this.clearDepth=new Hc(this),this.clearStencil=new eo(this),this.colorMask=new Wc(this),this.depthMask=new Rn(this),this.stencilMask=new Xc(this),this.stencilFunc=new Sl(this),this.stencilOp=new Jc(this),this.stencilTest=new Tl(this),this.depthRange=new Yo(this),this.depthTest=new kl(this),this.depthFunc=new Il(this),this.blend=new Cl(this),this.blendFunc=new El(this),this.blendColor=new dn(this),this.blendEquation=new Pl(this),this.cullFace=new Kc(this),this.cullFaceSide=new Yc(this),this.frontFace=new Al(this),this.program=new ys(this),this.activeTexture=new Qc(this),this.viewport=new to(this),this.bindFramebuffer=new eh(this),this.bindRenderbuffer=new th(this),this.bindTexture=new Ml(this),this.bindVertexBuffer=new zl(this),this.bindElementBuffer=new Dl(this),this.bindVertexArray=new Qo(this),this.pixelStoreUnpack=new Ll(this),this.pixelStoreUnpackPremultiplyAlpha=new io(this),this.pixelStoreUnpackFlipY=new Dr(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Ln(t)){this.HALF_FLOAT=t.HALF_FLOAT;const a=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:a==null?void 0:a.RGBA16F_EXT,this.RGB16F=(o=t.RGB16F)!==null&&o!==void 0?o:a==null?void 0:a.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const a=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=a==null?void 0:a.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(t,n){return new Xo(this,t,n)}createVertexBuffer(t,n,o){return new yr(this,t,n,o)}createRenderbuffer(t,n,o){const a=this.gl,h=a.createRenderbuffer();return this.bindRenderbuffer.set(h),a.renderbufferStorage(a.RENDERBUFFER,t,n,o),this.bindRenderbuffer.set(null),h}createFramebuffer(t,n,o,a){return new ia(this,t,n,o,a)}clear({color:t,depth:n,stencil:o}){const a=this.gl;let h=0;t&&(h|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(h|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),o!==void 0&&(h|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(o),this.stencilMask.set(255)),a.clear(h)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){c.aF(t.blendFunction,Et.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Ln(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;return Ln(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class ht{constructor(t,n,o){this.func=t,this.mask=n,this.range=o}}ht.ReadOnly=!1,ht.ReadWrite=!0,ht.disabled=new ht(519,ht.ReadOnly,[0,1]);const na=7680;class Vt{constructor(t,n,o,a,h,g){this.test=t,this.ref=n,this.mask=o,this.fail=a,this.depthFail=h,this.pass=g}}Vt.disabled=new Vt({func:519,mask:0},0,0,na,na,na);class Mt{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}let vs;function Bl(u,t,n,o,a){const h=u.context,g=h.gl,y=u.useProgram("collisionBox"),b=[];let w=0,C=0;for(let X=0;X<o.length;X++){const Y=o[X],U=t.getTile(Y).getBucket(n);if(!U)continue;const te=a?U.textCollisionBox:U.iconCollisionBox,se=U.collisionCircleArray;if(se.length>0){const ce=c.H();c.aR(ce,U.placementInvProjMatrix,u.transform.glCoordMatrix),c.aR(ce,ce,U.placementViewportMatrix),b.push({circleArray:se,circleOffset:C,transform:Y.posMatrix,invTransform:ce,coord:Y}),w+=se.length/4,C=w}te&&y.draw(h,g.LINES,ht.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,{u_matrix:Y.posMatrix,u_pixel_extrude_scale:[1/(E=u.transform).width,1/E.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y),n.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,u.transform.zoom,null,null,te.collisionVertexBuffer)}var E;if(!a||!b.length)return;const R=u.useProgram("collisionCircle"),F=new c.aS;F.resize(4*w),F._trim();let $=0;for(const X of b)for(let Y=0;Y<X.circleArray.length/4;Y++){const U=4*Y,te=X.circleArray[U+0],se=X.circleArray[U+1],ce=X.circleArray[U+2],ye=X.circleArray[U+3];F.emplace($++,te,se,ce,ye,0),F.emplace($++,te,se,ce,ye,1),F.emplace($++,te,se,ce,ye,2),F.emplace($++,te,se,ce,ye,3)}(!vs||vs.length<2*w)&&(vs=function(X){const Y=2*X,U=new c.aU;U.resize(Y),U._trim();for(let te=0;te<Y;te++){const se=6*te;U.uint16[se+0]=4*te+0,U.uint16[se+1]=4*te+1,U.uint16[se+2]=4*te+2,U.uint16[se+3]=4*te+2,U.uint16[se+4]=4*te+3,U.uint16[se+5]=4*te+0}return U}(w));const H=h.createIndexBuffer(vs,!0),q=h.createVertexBuffer(F,c.aT.members,!0);for(const X of b){const Y=jc(X.transform,X.invTransform,u.transform);R.draw(h,g.TRIANGLES,ht.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,Y,u.style.map.terrain&&u.style.map.terrain.getTerrainData(X.coord),n.id,q,H,c.a0.simpleSegment(0,2*X.circleOffset,X.circleArray.length,X.circleArray.length/2),null,u.transform.zoom,null,null,null)}q.destroy(),H.destroy()}Mt.disabled=new Mt(!1,1029,2305),Mt.backCCW=new Mt(!0,1029,2305);const sa=c.ao(new Float32Array(16));function ro(u,t,n,o,a,h){const{horizontalAlign:g,verticalAlign:y}=c.av(u);return new c.P((-(g-.5)*t/a+o[0])*h,(-(y-.5)*n/a+o[1])*h)}function no(u,t,n,o,a,h){const g=t.tileAnchorPoint.add(new c.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let y=o.mult(h);return n||(y=y.rotate(-a)),W(g.add(y),t.labelPlaneMatrix,t.getElevation).point}if(n){const y=pe(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(u),b=Math.atan(y.y/y.x)+(y.x<0?Math.PI:0);return u.add(o.rotate(b))}return u.add(o)}function so(u,t,n,o,a,h,g,y,b,w,C,E,R,F){const $=u.text.placedSymbolArray,H=u.text.dynamicLayoutVertexArray,q=u.icon.dynamicLayoutVertexArray,X={};H.clear();for(let Y=0;Y<$.length;Y++){const U=$.get(Y),te=U.hidden||!U.crossTileID||u.allowVerticalPlacement&&!U.placedOrientation?null:o[U.crossTileID];if(te){const se=new c.P(U.anchorX,U.anchorY),ce={getElevation:F,width:a.width,height:a.height,labelPlaneMatrix:h,lineVertexArray:null,pitchWithMap:n,projection:C,projectionCache:null,tileAnchorPoint:se,translation:E,unwrappedTileID:R},ye=n?W(se,g,F):pe(se.x,se.y,ce),we=z(a.cameraToCenterDistance,ye.signedDistanceFromCamera);let De=c.aj(u.textSizeData,b,U)*we/c.aq;n&&(De*=u.tilePixelRatio/y);const{width:Re,height:Se,anchor:Te,textOffset:Ne,textBoxScale:tt}=te,Ce=ro(Te,Re,Se,Ne,tt,De),Ae=C.getPitchedTextCorrection(a,se.add(new c.P(E[0],E[1])),R),Qe=no(ye.point,ce,t,Ce,a.angle,Ae),Dt=u.allowVerticalPlacement&&U.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let ot=0;ot<U.numGlyphs;ot++)c.ak(H,Qe,Dt);w&&U.associatedIconIndex>=0&&(X[U.associatedIconIndex]={shiftedAnchor:Qe,angle:Dt})}else We(U.numGlyphs,H)}if(w){q.clear();const Y=u.icon.placedSymbolArray;for(let U=0;U<Y.length;U++){const te=Y.get(U);if(te.hidden)We(te.numGlyphs,q);else{const se=X[U];if(se)for(let ce=0;ce<te.numGlyphs;ce++)c.ak(q,se.shiftedAnchor,se.angle);else We(te.numGlyphs,q)}}u.icon.dynamicLayoutVertexBuffer.updateData(q)}u.text.dynamicLayoutVertexBuffer.updateData(H)}function oa(u,t,n){return n.iconsInText&&t?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Jr(u,t,n,o,a,h,g,y,b,w,C,E){const R=u.context,F=R.gl,$=u.transform,H=qs(),q=y==="map",X=b==="map",Y=y!=="viewport"&&n.layout.get("symbol-placement")!=="point",U=q&&!X&&!Y,te=!X&&Y,se=!n.layout.get("symbol-sort-key").isConstant();let ce=!1;const ye=u.depthModeForSublayer(0,ht.ReadOnly),we=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),De=[],Re=H.getCircleRadiusCorrection($);for(const Se of o){const Te=t.getTile(Se),Ne=Te.getBucket(n);if(!Ne)continue;const tt=a?Ne.text:Ne.icon;if(!tt||!tt.segments.get().length||!tt.hasVisibleVertices)continue;const Ce=tt.programConfigurations.get(n.id),Ae=a||Ne.sdfIcons,Qe=a?Ne.textSizeData:Ne.iconSizeData,Dt=X||$.pitch!==0,ot=u.useProgram(oa(Ae,a,Ne),Ce),ut=c.ah(Qe,$.zoom),Lt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Se);let di,nr,Rt,Mi,ki=[0,0],pi=null;if(a)nr=Te.glyphAtlasTexture,Rt=F.LINEAR,di=Te.glyphAtlasTexture.size,Ne.iconsInText&&(ki=Te.imageAtlasTexture.size,pi=Te.imageAtlasTexture,Mi=Dt||u.options.rotating||u.options.zooming||Qe.kind==="composite"||Qe.kind==="camera"?F.LINEAR:F.NEAREST);else{const Nt=n.layout.get("icon-size").constantOr(0)!==1||Ne.iconsNeedLinear;nr=Te.imageAtlasTexture,Rt=Ae||u.options.rotating||u.options.zooming||Nt||Dt?F.LINEAR:F.NEAREST,di=Te.imageAtlasTexture.size}const fi=rt(Te,1,u.transform.zoom),sr=te?Se.posMatrix:sa,vn=Gr(sr,X,q,u.transform,fi),bo=_r(sr,X,q,u.transform,fi),qn=_r(Se.posMatrix,X,q,u.transform,fi),bn=H.translatePosition(u.transform,Te,h,g),wo=we&&Ne.hasTextData(),Fa=n.layout.get("icon-text-fit")!=="none"&&wo&&Ne.hasIconData();if(Y){const Nt=u.style.map.terrain?(Oa,ti)=>u.style.map.terrain.getElevation(Se,Oa,ti):null,Gn=n.layout.get("text-rotation-alignment")==="map";V(Ne,Se.posMatrix,u,a,vn,qn,X,w,Gn,H,Se.toUnwrapped(),$.width,$.height,bn,Nt)}const oi=Se.posMatrix,or=a&&we||Fa,Qr=Y||or?sa:vn,Zn=bo,mi=Ae&&n.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let gi;gi=Ae?Ne.iconsInText?Gc(Qe.kind,ut,U,X,Y,or,u,oi,Qr,Zn,bn,di,ki,Re):wl(Qe.kind,ut,U,X,Y,or,u,oi,Qr,Zn,bn,a,di,!0,Re):bl(Qe.kind,ut,U,X,Y,or,u,oi,Qr,Zn,bn,a,di,Re);const ri={program:ot,buffers:tt,uniformValues:gi,atlasTexture:nr,atlasTextureIcon:pi,atlasInterpolation:Rt,atlasInterpolationIcon:Mi,isSDF:Ae,hasHalo:mi};if(se&&Ne.canOverlap){ce=!0;const Nt=tt.segments.get();for(const Gn of Nt)De.push({segments:new c.a0([Gn]),sortKey:Gn.sortKey,state:ri,terrainData:Lt})}else De.push({segments:tt.segments,sortKey:0,state:ri,terrainData:Lt})}ce&&De.sort((Se,Te)=>Se.sortKey-Te.sortKey);for(const Se of De){const Te=Se.state;if(R.activeTexture.set(F.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,F.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(R.activeTexture.set(F.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,F.CLAMP_TO_EDGE)),Te.isSDF){const Ne=Te.uniformValues;Te.hasHalo&&(Ne.u_is_halo=1,pn(Te.buffers,Se.segments,n,u,Te.program,ye,C,E,Ne,Se.terrainData)),Ne.u_is_halo=0}pn(Te.buffers,Se.segments,n,u,Te.program,ye,C,E,Te.uniformValues,Se.terrainData)}}function pn(u,t,n,o,a,h,g,y,b,w){const C=o.context;a.draw(C,C.gl.TRIANGLES,h,g,y,Mt.disabled,b,w,n.id,u.layoutVertexBuffer,u.indexBuffer,t,n.paint,o.transform.zoom,u.programConfigurations.get(n.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function qi(u,t,n,o,a){if(!n||!o||!o.imageAtlas)return;const h=o.imageAtlas.patternPositions;let g=h[n.to.toString()],y=h[n.from.toString()];if(!g&&y&&(g=y),!y&&g&&(y=g),!g||!y){const b=a.getPaintProperty(t);g=h[b],y=h[b]}g&&y&&u.setConstantPatternPositions(g,y)}function aa(u,t,n,o,a,h,g){const y=u.context.gl,b="fill-pattern",w=n.paint.get(b),C=w&&w.constantOr(1),E=n.getCrossfadeParameters();let R,F,$,H,q;g?(F=C&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",R=y.LINES):(F=C?"fillPattern":"fill",R=y.TRIANGLES);const X=w.constantOr(null);for(const Y of o){const U=t.getTile(Y);if(C&&!U.patternsLoaded())continue;const te=U.getBucket(n);if(!te)continue;const se=te.programConfigurations.get(n.id),ce=u.useProgram(F,se),ye=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y);C&&(u.context.activeTexture.set(y.TEXTURE0),U.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),se.updatePaintBuffers(E)),qi(se,b,X,U,n);const we=ye?Y:null,De=u.translatePosMatrix(we?we.posMatrix:Y.posMatrix,U,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(g){H=te.indexBuffer2,q=te.segments2;const Re=[y.drawingBufferWidth,y.drawingBufferHeight];$=F==="fillOutlinePattern"&&C?Uc(De,u,E,U,Re):$c(De,Re)}else H=te.indexBuffer,q=te.segments,$=C?Dn(De,u,E,U):fs(De);ce.draw(u.context,R,a,u.stencilModeForClipping(Y),h,Mt.disabled,$,ye,n.id,te.layoutVertexBuffer,H,q,n.paint,u.transform.zoom,se)}}function oo(u,t,n,o,a,h,g){const y=u.context,b=y.gl,w="fill-extrusion-pattern",C=n.paint.get(w),E=C.constantOr(1),R=n.getCrossfadeParameters(),F=n.paint.get("fill-extrusion-opacity"),$=C.constantOr(null);for(const H of o){const q=t.getTile(H),X=q.getBucket(n);if(!X)continue;const Y=u.style.map.terrain&&u.style.map.terrain.getTerrainData(H),U=X.programConfigurations.get(n.id),te=u.useProgram(E?"fillExtrusionPattern":"fillExtrusion",U);E&&(u.context.activeTexture.set(b.TEXTURE0),q.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),U.updatePaintBuffers(R)),qi(U,w,$,q,n);const se=u.translatePosMatrix(H.posMatrix,q,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ce=n.paint.get("fill-extrusion-vertical-gradient"),ye=E?Js(se,u,ce,F,H,R,q):Xs(se,u,ce,F);te.draw(y,y.gl.TRIANGLES,a,h,g,Mt.backCCW,ye,Y,n.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,n.paint,u.transform.zoom,U,u.style.map.terrain&&X.centroidVertexBuffer)}}function la(u,t,n,o,a,h,g){const y=u.context,b=y.gl,w=n.fbo;if(!w)return;const C=u.useProgram("hillshade"),E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);y.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,w.colorAttachment.get()),C.draw(y,b.TRIANGLES,a,h,g,Mt.disabled,((R,F,$,H)=>{const q=$.paint.get("hillshade-shadow-color"),X=$.paint.get("hillshade-highlight-color"),Y=$.paint.get("hillshade-accent-color");let U=$.paint.get("hillshade-illumination-direction")*(Math.PI/180);$.paint.get("hillshade-illumination-anchor")==="viewport"&&(U-=R.transform.angle);const te=!R.options.moving;return{u_matrix:H?H.posMatrix:R.transform.calculatePosMatrix(F.tileID.toUnwrapped(),te),u_image:0,u_latrange:ji(0,F.tileID),u_light:[$.paint.get("hillshade-exaggeration"),U],u_shadow:q,u_highlight:X,u_accent:Y}})(u,n,o,E?t:null),E,o.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}function fn(u,t,n,o,a,h){const g=u.context,y=g.gl,b=t.dem;if(b&&b.data){const w=b.dim,C=b.stride,E=b.getPixels();if(g.activeTexture.set(y.TEXTURE1),g.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||u.getTileTexture(C),t.demTexture){const F=t.demTexture;F.update(E,{premultiply:!1}),F.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new St(g,E,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);g.activeTexture.set(y.TEXTURE0);let R=t.fbo;if(!R){const F=new St(g,{width:w,height:w,data:null},y.RGBA);F.bind(y.LINEAR,y.CLAMP_TO_EDGE),R=t.fbo=g.createFramebuffer(w,w,!0,!1),R.colorAttachment.set(F.texture)}g.bindFramebuffer.set(R.framebuffer),g.viewport.set([0,0,w,w]),u.useProgram("hillshadePrepare").draw(g,y.TRIANGLES,o,a,h,Mt.disabled,((F,$)=>{const H=$.stride,q=c.H();return c.aQ(q,0,c.X,-c.X,0,0,1),c.J(q,q,[0,-c.X,0]),{u_matrix:q,u_image:1,u_dimension:[H,H],u_zoom:F.overscaledZ,u_unpack:$.getUnpackVector()}})(t.tileID,b),null,n.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function ao(u,t,n,o,a,h){const g=o.paint.get("raster-fade-duration");if(!h&&g>0){const y=ae.now(),b=(y-u.timeAdded)/g,w=t?(y-t.timeAdded)/g:-1,C=n.getSource(),E=a.coveringZoomLevel({tileSize:C.tileSize,roundZoom:C.roundZoom}),R=!t||Math.abs(t.tileID.overscaledZ-E)>Math.abs(u.tileID.overscaledZ-E),F=R&&u.refreshedUponExpiration?1:c.ad(R?b:1-w,0,1);return u.refreshedUponExpiration&&b>=1&&(u.refreshedUponExpiration=!1),t?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const lo=new c.aN(1,0,0,1),bs=new c.aN(0,1,0,1),co=new c.aN(0,0,1,1),Fl=new c.aN(1,0,1,1),Bn=new c.aN(0,1,1,1);function mn(u,t,n,o){Fn(u,0,t+n/2,u.transform.width,n,o)}function ca(u,t,n,o){Fn(u,t-n/2,0,n,u.transform.height,o)}function Fn(u,t,n,o,a,h){const g=u.context,y=g.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*u.pixelRatio,n*u.pixelRatio,o*u.pixelRatio,a*u.pixelRatio),g.clear({color:h}),y.disable(y.SCISSOR_TEST)}function gt(u,t,n){const o=u.context,a=o.gl,h=n.posMatrix,g=u.useProgram("debug"),y=ht.disabled,b=Vt.disabled,w=u.colorModeForRenderPass(),C="$debug",E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(n);o.activeTexture.set(a.TEXTURE0);const R=t.getTileByID(n.key).latestRawTileData,F=Math.floor((R&&R.byteLength||0)/1024),$=t.getTile(n).tileSize,H=512/Math.min($,512)*(n.overscaledZ/u.transform.zoom)*.5;let q=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(q+=` => ${n.overscaledZ}`),function(X,Y){X.initDebugOverlayCanvas();const U=X.debugOverlayCanvas,te=X.context.gl,se=X.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,U.width,U.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(Y,5,5),se.strokeText(Y,5,5),X.debugOverlayTexture.update(U),X.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${q} ${F}kB`),g.draw(o,a.TRIANGLES,y,b,Et.alphaBlended,Mt.disabled,Xr(h,c.aN.transparent,H),null,C,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),g.draw(o,a.LINE_STRIP,y,b,w,Mt.disabled,Xr(h,c.aN.red),E,C,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function ws(u,t,n){const o=u.context,a=o.gl,h=u.colorModeForRenderPass(),g=new ht(a.LEQUAL,ht.ReadWrite,u.depthRangeFor3D),y=u.useProgram("terrain"),b=t.getTerrainMesh();o.bindFramebuffer.set(null),o.viewport.set([0,0,u.width,u.height]);for(const w of n){const C=u.renderToTexture.getTexture(w),E=t.getTerrainData(w.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,C.texture);const R=u.transform.calculatePosMatrix(w.tileID.toUnwrapped()),F=t.getMeshFrameDelta(u.transform.zoom),$=u.transform.calculateFogMatrix(w.tileID.toUnwrapped()),H=Ho(R,F,$,u.style.sky,u.transform.pitch);y.draw(o,a.TRIANGLES,g,Vt.disabled,h,Mt.backCCW,H,E,"terrain",b.vertexBuffer,b.indexBuffer,b.segments)}}class Ol{constructor(t,n,o){this.vertexBuffer=t,this.indexBuffer=n,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Vl{constructor(t,n){this.context=new ra(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ye.maxUnderzooming+Ye.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xi}resize(t,n,o){if(this.width=Math.floor(t*o),this.height=Math.floor(n*o),this.pixelRatio=o,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const a of this.style._order)this.style._layers[a].resize()}setup(){const t=this.context,n=new c.aX;n.emplaceBack(0,0),n.emplaceBack(c.X,0),n.emplaceBack(0,c.X),n.emplaceBack(c.X,c.X),this.tileExtentBuffer=t.createVertexBuffer(n,ds.members),this.tileExtentSegments=c.a0.simpleSegment(0,0,4,2);const o=new c.aX;o.emplaceBack(0,0),o.emplaceBack(c.X,0),o.emplaceBack(0,c.X),o.emplaceBack(c.X,c.X),this.debugBuffer=t.createVertexBuffer(o,ds.members),this.debugSegments=c.a0.simpleSegment(0,0,4,5);const a=new c.$;a.emplaceBack(0,0,0,0),a.emplaceBack(c.X,0,c.X,0),a.emplaceBack(0,c.X,0,c.X),a.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=t.createVertexBuffer(a,qr.members),this.rasterBoundsSegments=c.a0.simpleSegment(0,0,4,2);const h=new c.aX;h.emplaceBack(0,0),h.emplaceBack(1,0),h.emplaceBack(0,1),h.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(h,ds.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const g=new c.aZ;g.emplaceBack(0),g.emplaceBack(1),g.emplaceBack(3),g.emplaceBack(2),g.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(g);const y=new c.aY;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const b=this.context.gl;this.stencilClearMode=new Vt({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const o=c.H();c.aQ(o,0,this.width,this.height,0,0,1),c.K(o,o,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,ht.disabled,this.stencilClearMode,Et.disabled,Mt.disabled,ms(o),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const o=this.context,a=o.gl;this.nextStencilID+n.length>256&&this.clearStencil(),o.setColorMode(Et.disabled),o.setDepthMode(ht.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const g of n){const y=this._tileClippingMaskIDs[g.key]=this.nextStencilID++,b=this.style.map.terrain&&this.style.map.terrain.getTerrainData(g);h.draw(o,a.TRIANGLES,ht.disabled,new Vt({func:a.ALWAYS,mask:0},y,255,a.KEEP,a.KEEP,a.REPLACE),Et.disabled,Mt.disabled,ms(g.posMatrix),b,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Vt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Vt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,o=t.sort((g,y)=>y.overscaledZ-g.overscaledZ),a=o[o.length-1].overscaledZ,h=o[0].overscaledZ-a+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const g={};for(let y=0;y<h;y++)g[y+a]=new Vt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=h,[g,o]}return[{[a]:Vt.disabled},o]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Et([t.CONSTANT_COLOR,t.ONE],new c.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Et.unblended:Et.alphaBlended}depthModeForSublayer(t,n,o){if(!this.opaquePassEnabledForLayer())return ht.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ht(o||this.context.gl.LEQUAL,n,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var o;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(ae.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,g={},y={},b={};for(const w in h){const C=h[w];C.used&&C.prepare(this.context),g[w]=C.getVisibleCoordinates(),y[w]=g[w].slice().reverse(),b[w]=C.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let w=0;w<a.length;w++)if(this.style._layers[a[w]].is3D()){this.opaquePassCutoff=w;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const w of a){const C=this.style._layers[w];if(!C.hasOffscreenPass()||C.isHidden(this.transform.zoom))continue;const E=y[C.source];(C.type==="custom"||E.length)&&this.renderLayer(this,h[C.source],C,E)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?c.aN.black:c.aN.transparent,depth:1}),this.clearStencil(),!((o=this.style.stylesheet)===null||o===void 0)&&o.sky&&function(w,C){const E=w.context,R=E.gl,F=((Y,U,te)=>({u_sky_color:Y.properties.get("sky-color"),u_horizon_color:Y.properties.get("horizon-color"),u_horizon:(U.height/2+U.getHorizon())*te,u_sky_horizon_blend:Y.properties.get("sky-horizon-blend")*U.height/2*te}))(C,w.style.map.transform,w.pixelRatio),$=new ht(R.LEQUAL,ht.ReadWrite,[0,1]),H=Vt.disabled,q=w.colorModeForRenderPass(),X=w.useProgram("sky");if(!C.mesh){const Y=new c.aX;Y.emplaceBack(-1,-1),Y.emplaceBack(1,-1),Y.emplaceBack(1,1),Y.emplaceBack(-1,1);const U=new c.aY;U.emplaceBack(0,1,2),U.emplaceBack(0,2,3),C.mesh=new Ol(E.createVertexBuffer(Y,ds.members),E.createIndexBuffer(U),c.a0.simpleSegment(0,0,Y.length,U.length))}X.draw(E,R.TRIANGLES,$,H,q,Mt.disabled,F,void 0,"sky",C.mesh.vertexBuffer,C.mesh.indexBuffer,C.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const w=this.style._layers[a[this.currentLayer]],C=h[w.source],E=g[w.source];this._renderTileClippingMasks(w,E),this.renderLayer(this,C,w,E)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const w=this.style._layers[a[this.currentLayer]],C=h[w.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(w))continue;const E=(w.type==="symbol"?b:y)[w.source];this._renderTileClippingMasks(w,g[w.source]),this.renderLayer(this,C,w,E)}if(this.options.showTileBoundaries){const w=function(C,E){let R=null;const F=Object.values(C._layers).flatMap(X=>X.source&&!X.isHidden(E)?[C.sourceCaches[X.source]]:[]),$=F.filter(X=>X.getSource().type==="vector"),H=F.filter(X=>X.getSource().type!=="vector"),q=X=>{(!R||R.getSource().maxzoom<X.getSource().maxzoom)&&(R=X)};return $.forEach(X=>q(X)),R||H.forEach(X=>q(X)),R}(this.style,this.transform.zoom);w&&function(C,E,R){for(let F=0;F<R.length;F++)gt(C,E,R[F])}(this,w,w.getVisibleCoordinates())}this.options.showPadding&&function(w){const C=w.transform.padding;mn(w,w.transform.height-(C.top||0),3,lo),mn(w,C.bottom||0,3,bs),ca(w,C.left||0,3,co),ca(w,w.transform.width-(C.right||0),3,Fl);const E=w.transform.centerPoint;(function(R,F,$,H){Fn(R,F-1,$-10,2,20,H),Fn(R,F-10,$-1,20,2,H)})(w,E.x,w.transform.height-E.y,Bn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let a=this.terrainFacilitator.dirty;a||(a=t?!c.a_(n,o):!c.a$(n,o)),a||(a=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),a&&(c.b0(n,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,g){const y=h.context,b=y.gl,w=Et.unblended,C=new ht(b.LEQUAL,ht.ReadWrite,[0,1]),E=g.getTerrainMesh(),R=g.sourceCache.getRenderableTiles(),F=h.useProgram("terrainDepth");y.bindFramebuffer.set(g.getFramebuffer("depth").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1});for(const $ of R){const H=g.getTerrainData($.tileID),q={u_matrix:h.transform.calculatePosMatrix($.tileID.toUnwrapped()),u_ele_delta:g.getMeshFrameDelta(h.transform.zoom)};F.draw(y,b.TRIANGLES,C,Vt.disabled,w,Mt.backCCW,q,H,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,g){const y=h.context,b=y.gl,w=Et.unblended,C=new ht(b.LEQUAL,ht.ReadWrite,[0,1]),E=g.getTerrainMesh(),R=g.getCoordsTexture(),F=g.sourceCache.getRenderableTiles(),$=h.useProgram("terrainCoords");y.bindFramebuffer.set(g.getFramebuffer("coords").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1}),g.coordsIndex=[];for(const H of F){const q=g.getTerrainData(H.tileID);y.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,R.texture);const X={u_matrix:h.transform.calculatePosMatrix(H.tileID.toUnwrapped()),u_terrain_coords_id:(255-g.coordsIndex.length)/255,u_texture:0,u_ele_delta:g.getMeshFrameDelta(h.transform.zoom)};$.draw(y,b.TRIANGLES,C,Vt.disabled,w,Mt.backCCW,X,q,"terrain",E.vertexBuffer,E.indexBuffer,E.segments),g.coordsIndex.push(H.tileID.key)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(t,n,o,a){if(!o.isHidden(this.transform.zoom)&&(o.type==="background"||o.type==="custom"||(a||[]).length))switch(this.id=o.id,o.type){case"symbol":(function(h,g,y,b,w){if(h.renderPass!=="translucent")return;const C=Vt.disabled,E=h.colorModeForRenderPass();(y._unevaluatedLayout.hasValue("text-variable-anchor")||y._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(R,F,$,H,q,X,Y,U,te){const se=F.transform,ce=qs(),ye=q==="map",we=X==="map";for(const De of R){const Re=H.getTile(De),Se=Re.getBucket($);if(!Se||!Se.text||!Se.text.segments.get().length)continue;const Te=c.ah(Se.textSizeData,se.zoom),Ne=rt(Re,1,F.transform.zoom),tt=Gr(De.posMatrix,we,ye,F.transform,Ne),Ce=$.layout.get("icon-text-fit")!=="none"&&Se.hasIconData();if(Te){const Ae=Math.pow(2,se.zoom-Re.tileID.overscaledZ),Qe=F.style.map.terrain?(ot,ut)=>F.style.map.terrain.getElevation(De,ot,ut):null,Dt=ce.translatePosition(se,Re,Y,U);so(Se,ye,we,te,se,tt,De.posMatrix,Ae,Te,Ce,ce,Dt,De.toUnwrapped(),Qe)}}}(b,h,y,g,y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),w),y.paint.get("icon-opacity").constantOr(1)!==0&&Jr(h,g,y,b,!1,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),y.layout.get("icon-rotation-alignment"),y.layout.get("icon-pitch-alignment"),y.layout.get("icon-keep-upright"),C,E),y.paint.get("text-opacity").constantOr(1)!==0&&Jr(h,g,y,b,!0,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.layout.get("text-keep-upright"),C,E),g.map.showCollisionBoxes&&(Bl(h,g,y,b,!0),Bl(h,g,y,b,!1))})(t,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(h,g,y,b){if(h.renderPass!=="translucent")return;const w=y.paint.get("circle-opacity"),C=y.paint.get("circle-stroke-width"),E=y.paint.get("circle-stroke-opacity"),R=!y.layout.get("circle-sort-key").isConstant();if(w.constantOr(1)===0&&(C.constantOr(1)===0||E.constantOr(1)===0))return;const F=h.context,$=F.gl,H=h.depthModeForSublayer(0,ht.ReadOnly),q=Vt.disabled,X=h.colorModeForRenderPass(),Y=[];for(let U=0;U<b.length;U++){const te=b[U],se=g.getTile(te),ce=se.getBucket(y);if(!ce)continue;const ye=ce.programConfigurations.get(y.id),we=h.useProgram("circle",ye),De=ce.layoutVertexBuffer,Re=ce.indexBuffer,Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(te),Te={programConfiguration:ye,program:we,layoutVertexBuffer:De,indexBuffer:Re,uniformValues:_l(h,te,se,y),terrainData:Se};if(R){const Ne=ce.segments.get();for(const tt of Ne)Y.push({segments:new c.a0([tt]),sortKey:tt.sortKey,state:Te})}else Y.push({segments:ce.segments,sortKey:0,state:Te})}R&&Y.sort((U,te)=>U.sortKey-te.sortKey);for(const U of Y){const{programConfiguration:te,program:se,layoutVertexBuffer:ce,indexBuffer:ye,uniformValues:we,terrainData:De}=U.state;se.draw(F,$.TRIANGLES,H,q,X,Mt.disabled,we,De,y.id,ce,ye,U.segments,y.paint,h.transform.zoom,te)}})(t,n,o,a);break;case"heatmap":(function(h,g,y,b){if(y.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const w=h.context,C=w.gl,E=Vt.disabled,R=new Et([C.ONE,C.ONE],c.aN.transparent,[!0,!0,!0,!0]);(function(F,$,H){const q=F.gl;F.activeTexture.set(q.TEXTURE1),F.viewport.set([0,0,$.width/4,$.height/4]);let X=H.heatmapFbo;if(X)q.bindTexture(q.TEXTURE_2D,X.colorAttachment.get()),F.bindFramebuffer.set(X.framebuffer);else{const Y=q.createTexture();q.bindTexture(q.TEXTURE_2D,Y),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_WRAP_S,q.CLAMP_TO_EDGE),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_WRAP_T,q.CLAMP_TO_EDGE),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_MIN_FILTER,q.LINEAR),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_MAG_FILTER,q.LINEAR),X=H.heatmapFbo=F.createFramebuffer($.width/4,$.height/4,!1,!1),function(U,te,se,ce){var ye,we;const De=U.gl,Re=(ye=U.HALF_FLOAT)!==null&&ye!==void 0?ye:De.UNSIGNED_BYTE,Se=(we=U.RGBA16F)!==null&&we!==void 0?we:De.RGBA;De.texImage2D(De.TEXTURE_2D,0,Se,te.width/4,te.height/4,0,De.RGBA,Re,null),ce.colorAttachment.set(se)}(F,$,Y,X)}})(w,h,y),w.clear({color:c.aN.transparent});for(let F=0;F<b.length;F++){const $=b[F];if(g.hasRenderableParent($))continue;const H=g.getTile($),q=H.getBucket(y);if(!q)continue;const X=q.programConfigurations.get(y.id),Y=h.useProgram("heatmap",X),{zoom:U}=h.transform;Y.draw(w,C.TRIANGLES,ht.disabled,E,R,Mt.disabled,Ui($.posMatrix,H,U,y.paint.get("heatmap-intensity")),null,y.id,q.layoutVertexBuffer,q.indexBuffer,q.segments,y.paint,h.transform.zoom,X)}w.viewport.set([0,0,h.width,h.height])}else h.renderPass==="translucent"&&(h.context.setColorMode(h.colorModeForRenderPass()),function(w,C){const E=w.context,R=E.gl,F=C.heatmapFbo;if(!F)return;E.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_2D,F.colorAttachment.get()),E.activeTexture.set(R.TEXTURE1);let $=C.colorRampTexture;$||($=C.colorRampTexture=new St(E,C.colorRamp,R.RGBA)),$.bind(R.LINEAR,R.CLAMP_TO_EDGE),w.useProgram("heatmapTexture").draw(E,R.TRIANGLES,ht.disabled,Vt.disabled,w.colorModeForRenderPass(),Mt.disabled,((H,q,X,Y)=>{const U=c.H();c.aQ(U,0,H.width,H.height,0,0,1);const te=H.context.gl;return{u_matrix:U,u_world:[te.drawingBufferWidth,te.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:q.paint.get("heatmap-opacity")}})(w,C),null,C.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments,C.paint,w.transform.zoom)}(h,y))})(t,n,o,a);break;case"line":(function(h,g,y,b){if(h.renderPass!=="translucent")return;const w=y.paint.get("line-opacity"),C=y.paint.get("line-width");if(w.constantOr(1)===0||C.constantOr(1)===0)return;const E=h.depthModeForSublayer(0,ht.ReadOnly),R=h.colorModeForRenderPass(),F=y.paint.get("line-dasharray"),$=y.paint.get("line-pattern"),H=$.constantOr(1),q=y.paint.get("line-gradient"),X=y.getCrossfadeParameters(),Y=H?"linePattern":F?"lineSDF":q?"lineGradient":"line",U=h.context,te=U.gl;let se=!0;for(const ce of b){const ye=g.getTile(ce);if(H&&!ye.patternsLoaded())continue;const we=ye.getBucket(y);if(!we)continue;const De=we.programConfigurations.get(y.id),Re=h.context.program.get(),Se=h.useProgram(Y,De),Te=se||Se.program!==Re,Ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ce),tt=$.constantOr(null);if(tt&&ye.imageAtlas){const Qe=ye.imageAtlas,Dt=Qe.patternPositions[tt.to.toString()],ot=Qe.patternPositions[tt.from.toString()];Dt&&ot&&De.setConstantPatternPositions(Dt,ot)}const Ce=Ne?ce:null,Ae=H?yl(h,ye,y,X,Ce):F?xl(h,ye,y,F,X,Ce):q?Ks(h,ye,y,we.lineClipsArray.length,Ce):gs(h,ye,y,Ce);if(H)U.activeTexture.set(te.TEXTURE0),ye.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),De.updatePaintBuffers(X);else if(F&&(Te||h.lineAtlas.dirty))U.activeTexture.set(te.TEXTURE0),h.lineAtlas.bind(U);else if(q){const Qe=we.gradients[y.id];let Dt=Qe.texture;if(y.gradientVersion!==Qe.version){let ot=256;if(y.stepInterpolant){const ut=g.getSource().maxzoom,Lt=ce.canonical.z===ut?Math.ceil(1<<h.transform.maxZoom-ce.canonical.z):1;ot=c.ad(c.aV(we.maxLineLength/c.X*1024*Lt),256,U.maxTextureSize)}Qe.gradient=c.aW({expression:y.gradientExpression(),evaluationKey:"lineProgress",resolution:ot,image:Qe.gradient||void 0,clips:we.lineClipsArray}),Qe.texture?Qe.texture.update(Qe.gradient):Qe.texture=new St(U,Qe.gradient,te.RGBA),Qe.version=y.gradientVersion,Dt=Qe.texture}U.activeTexture.set(te.TEXTURE0),Dt.bind(y.stepInterpolant?te.NEAREST:te.LINEAR,te.CLAMP_TO_EDGE)}Se.draw(U,te.TRIANGLES,E,h.stencilModeForClipping(ce),R,Mt.disabled,Ae,Ne,y.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,y.paint,h.transform.zoom,De,we.layoutVertexBuffer2),se=!1}})(t,n,o,a);break;case"fill":(function(h,g,y,b){const w=y.paint.get("fill-color"),C=y.paint.get("fill-opacity");if(C.constantOr(1)===0)return;const E=h.colorModeForRenderPass(),R=y.paint.get("fill-pattern"),F=h.opaquePassEnabledForLayer()&&!R.constantOr(1)&&w.constantOr(c.aN.transparent).a===1&&C.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===F){const $=h.depthModeForSublayer(1,h.renderPass==="opaque"?ht.ReadWrite:ht.ReadOnly);aa(h,g,y,b,$,E,!1)}if(h.renderPass==="translucent"&&y.paint.get("fill-antialias")){const $=h.depthModeForSublayer(y.getPaintProperty("fill-outline-color")?2:0,ht.ReadOnly);aa(h,g,y,b,$,E,!0)}})(t,n,o,a);break;case"fill-extrusion":(function(h,g,y,b){const w=y.paint.get("fill-extrusion-opacity");if(w!==0&&h.renderPass==="translucent"){const C=new ht(h.context.gl.LEQUAL,ht.ReadWrite,h.depthRangeFor3D);if(w!==1||y.paint.get("fill-extrusion-pattern").constantOr(1))oo(h,g,y,b,C,Vt.disabled,Et.disabled),oo(h,g,y,b,C,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const E=h.colorModeForRenderPass();oo(h,g,y,b,C,Vt.disabled,E)}}})(t,n,o,a);break;case"hillshade":(function(h,g,y,b){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const w=h.context,C=h.depthModeForSublayer(0,ht.ReadOnly),E=h.colorModeForRenderPass(),[R,F]=h.renderPass==="translucent"?h.stencilConfigForOverlap(b):[{},b];for(const $ of F){const H=g.getTile($);H.needsHillshadePrepare!==void 0&&H.needsHillshadePrepare&&h.renderPass==="offscreen"?fn(h,H,y,C,Vt.disabled,E):h.renderPass==="translucent"&&la(h,$,H,y,C,R[$.overscaledZ],E)}w.viewport.set([0,0,h.width,h.height])})(t,n,o,a);break;case"raster":(function(h,g,y,b){if(h.renderPass!=="translucent"||y.paint.get("raster-opacity")===0||!b.length)return;const w=h.context,C=w.gl,E=g.getSource(),R=h.useProgram("raster"),F=h.colorModeForRenderPass(),[$,H]=E instanceof Ar?[{},b]:h.stencilConfigForOverlap(b),q=H[H.length-1].overscaledZ,X=!h.options.moving;for(const Y of H){const U=h.depthModeForSublayer(Y.overscaledZ-q,y.paint.get("raster-opacity")===1?ht.ReadWrite:ht.ReadOnly,C.LESS),te=g.getTile(Y);te.registerFadeDuration(y.paint.get("raster-fade-duration"));const se=g.findLoadedParent(Y,0),ce=g.findLoadedSibling(Y),ye=ao(te,se||ce||null,g,y,h.transform,h.style.map.terrain);let we,De;const Re=y.paint.get("raster-resampling")==="nearest"?C.NEAREST:C.LINEAR;w.activeTexture.set(C.TEXTURE0),te.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),w.activeTexture.set(C.TEXTURE1),se?(se.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),we=Math.pow(2,se.tileID.overscaledZ-te.tileID.overscaledZ),De=[te.tileID.canonical.x*we%1,te.tileID.canonical.y*we%1]):te.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),te.texture.useMipmap&&w.extTextureFilterAnisotropic&&h.transform.pitch>20&&C.texParameterf(C.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);const Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(Y),Te=Se?Y:null,Ne=Te?Te.posMatrix:h.transform.calculatePosMatrix(Y.toUnwrapped(),X),tt=qc(Ne,De||[0,0],we||1,ye,y);E instanceof Ar?R.draw(w,C.TRIANGLES,U,Vt.disabled,F,Mt.disabled,tt,Se,y.id,E.boundsBuffer,h.quadTriangleIndexBuffer,E.boundsSegments):R.draw(w,C.TRIANGLES,U,$[Y.overscaledZ],F,Mt.disabled,tt,Se,y.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,n,o,a);break;case"background":(function(h,g,y,b){const w=y.paint.get("background-color"),C=y.paint.get("background-opacity");if(C===0)return;const E=h.context,R=E.gl,F=h.transform,$=F.tileSize,H=y.paint.get("background-pattern");if(h.isPatternMissing(H))return;const q=!H&&w.a===1&&C===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==q)return;const X=Vt.disabled,Y=h.depthModeForSublayer(0,q==="opaque"?ht.ReadWrite:ht.ReadOnly),U=h.colorModeForRenderPass(),te=h.useProgram(H?"backgroundPattern":"background"),se=b||F.coveringTiles({tileSize:$,terrain:h.style.map.terrain});H&&(E.activeTexture.set(R.TEXTURE0),h.imageManager.bind(h.context));const ce=y.getCrossfadeParameters();for(const ye of se){const we=b?ye.posMatrix:h.transform.calculatePosMatrix(ye.toUnwrapped()),De=H?Wo(we,C,h,H,{tileID:ye,tileSize:$},ce):Ys(we,C,w),Re=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ye);te.draw(E,R.TRIANGLES,Y,X,U,Mt.disabled,De,Re,y.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(h,g,y){const b=h.context,w=y.implementation;if(h.renderPass==="offscreen"){const C=w.prerender;C&&(h.setCustomLayerDefaults(),b.setColorMode(h.colorModeForRenderPass()),C.call(w,b.gl,h.transform.customLayerMatrix()),b.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),b.setColorMode(h.colorModeForRenderPass()),b.setStencilMode(Vt.disabled);const C=w.renderingMode==="3d"?new ht(h.context.gl.LEQUAL,ht.ReadWrite,h.depthRangeFor3D):h.depthModeForSublayer(0,ht.ReadOnly);b.setDepthMode(C),w.render(b.gl,h.transform.customLayerMatrix(),{farZ:h.transform.farZ,nearZ:h.transform.nearZ,fov:h.transform._fov,modelViewProjectionMatrix:h.transform.modelViewProjectionMatrix,projectionMatrix:h.transform.projectionMatrix}),b.setDirty(),h.setBaseState(),b.bindFramebuffer.set(null)}})(t,0,o)}}translatePosMatrix(t,n,o,a,h){if(!o[0]&&!o[1])return t;const g=h?a==="map"?this.transform.angle:0:a==="viewport"?-this.transform.angle:0;if(g){const w=Math.sin(g),C=Math.cos(g);o=[o[0]*C-o[1]*w,o[0]*w+o[1]*C]}const y=[h?o[0]:rt(n,o[0],this.transform.zoom),h?o[1]:rt(n,o[1],this.transform.zoom),0],b=new Float32Array(16);return c.J(b,t,y),b}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),o=this.imageManager.getPattern(t.to.toString());return!n||!o}useProgram(t,n){this.cache=this.cache||{};const o=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[o]||(this.cache[o]=new Hs(this.context,Wr[t],n,Qs[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new St(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class gn{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,o){const a=Math.pow(2,o),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(y=>{const b=1/(y=c.ag([],y,t))[3]/n*a;return c.b1(y,y,[b,b,1/y[3],b])}),g=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const b=function(R,F){var $=F[0],H=F[1],q=F[2],X=$*$+H*H+q*q;return X>0&&(X=1/Math.sqrt(X)),R[0]=F[0]*X,R[1]=F[1]*X,R[2]=F[2]*X,R}([],function(R,F,$){var H=F[0],q=F[1],X=F[2],Y=$[0],U=$[1],te=$[2];return R[0]=q*te-X*U,R[1]=X*Y-H*te,R[2]=H*U-q*Y,R}([],$t([],h[y[0]],h[y[1]]),$t([],h[y[2]],h[y[1]]))),w=-((C=b)[0]*(E=h[y[1]])[0]+C[1]*E[1]+C[2]*E[2]);var C,E;return b.concat(w)});return new gn(h,g)}}class ho{constructor(t,n){this.min=t,this.max=n,this.center=function(o,a,h){return o[0]=.5*a[0],o[1]=.5*a[1],o[2]=.5*a[2],o}([],function(o,a,h){return o[0]=a[0]+h[0],o[1]=a[1]+h[1],o[2]=a[2]+h[2],o}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],o=wt(this.min),a=wt(this.max);for(let h=0;h<n.length;h++)o[h]=n[h]?this.min[h]:this.center[h],a[h]=n[h]?this.center[h]:this.max[h];return a[2]=this.max[2],new ho(o,a)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let o=!0;for(let a=0;a<t.planes.length;a++){const h=t.planes[a];let g=0;for(let y=0;y<n.length;y++)c.b2(h,n[y])>=0&&g++;if(g===0)return 0;g!==n.length&&(o=!1)}if(o)return 2;for(let a=0;a<3;a++){let h=Number.MAX_VALUE,g=-Number.MAX_VALUE;for(let y=0;y<t.points.length;y++){const b=t.points[y][a]-this.min[a];h=Math.min(h,b),g=Math.max(g,b)}if(g<0||h>this.max[a]-this.min[a])return 0}return 1}}class uo{constructor(t=0,n=0,o=0,a=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(o)||o<0||isNaN(a)||a<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=o,this.right=a}interpolate(t,n,o){return n.top!=null&&t.top!=null&&(this.top=c.z.number(t.top,n.top,o)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.z.number(t.bottom,n.bottom,o)),n.left!=null&&t.left!=null&&(this.left=c.z.number(t.left,n.left,o)),n.right!=null&&t.right!=null&&(this.right=c.z.number(t.right,n.right,o)),this}getCenter(t,n){const o=c.ad((this.left+t-this.right)/2,0,t),a=c.ad((this.top+n-this.bottom)/2,0,n);return new c.P(o,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new uo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const ha=85.051129;class ua{constructor(t,n,o,a,h){this.tileSize=512,this._renderWorldCopies=h===void 0||!!h,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=o??0,this._maxPitch=a??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new uo,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new ua(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-c.b3(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var o=new c.A(4);return c.A!=Float32Array&&(o[1]=0,o[2]=0),o[0]=1,o[3]=1,o}(),function(o,a,h){var g=a[0],y=a[1],b=a[2],w=a[3],C=Math.sin(h),E=Math.cos(h);o[0]=g*E+b*C,o[1]=y*E+w*C,o[2]=g*-C+b*E,o[3]=y*-C+w*E}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=c.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,o){this._unmodified=!1,this._edgeInsets.interpolate(t,n,o),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new c.b4(0,t)];if(this._renderWorldCopies){const o=this.pointCoordinate(new c.P(0,0)),a=this.pointCoordinate(new c.P(this.width,0)),h=this.pointCoordinate(new c.P(this.width,this.height)),g=this.pointCoordinate(new c.P(0,this.height)),y=Math.floor(Math.min(o.x,a.x,h.x,g.x)),b=Math.floor(Math.max(o.x,a.x,h.x,g.x)),w=1;for(let C=y-w;C<=b+w;C++)C!==0&&n.push(new c.b4(C,t))}return n}coveringTiles(t){var n,o;let a=this.coveringZoomLevel(t);const h=a;if(t.minzoom!==void 0&&a<t.minzoom)return[];t.maxzoom!==void 0&&a>t.maxzoom&&(a=t.maxzoom);const g=this.pointCoordinate(this.getCameraPoint()),y=c.Z.fromLngLat(this.center),b=Math.pow(2,a),w=[b*g.x,b*g.y,0],C=[b*y.x,b*y.y,0],E=gn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,a);let R=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(R=a);const F=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,$=U=>({aabb:new ho([U*b,0,0],[(U+1)*b,b,0]),zoom:0,x:0,y:0,wrap:U,fullyVisible:!1}),H=[],q=[],X=a,Y=t.reparseOverscaled?h:a;if(this._renderWorldCopies)for(let U=1;U<=3;U++)H.push($(-U)),H.push($(U));for(H.push($(0));H.length>0;){const U=H.pop(),te=U.x,se=U.y;let ce=U.fullyVisible;if(!ce){const Se=U.aabb.intersects(E);if(Se===0)continue;ce=Se===2}const ye=t.terrain?w:C,we=U.aabb.distanceX(ye),De=U.aabb.distanceY(ye),Re=Math.max(Math.abs(we),Math.abs(De));if(U.zoom===X||Re>F+(1<<X-U.zoom)-2&&U.zoom>=R){const Se=X-U.zoom,Te=w[0]-.5-(te<<Se),Ne=w[1]-.5-(se<<Se);q.push({tileID:new c.S(U.zoom===X?Y:U.zoom,U.wrap,U.zoom,te,se),distanceSq:Vr([C[0]-.5-te,C[1]-.5-se]),tileDistanceToCamera:Math.sqrt(Te*Te+Ne*Ne)})}else for(let Se=0;Se<4;Se++){const Te=(te<<1)+Se%2,Ne=(se<<1)+(Se>>1),tt=U.zoom+1;let Ce=U.aabb.quadrant(Se);if(t.terrain){const Ae=new c.S(tt,U.wrap,tt,Te,Ne),Qe=t.terrain.getMinMaxElevation(Ae),Dt=(n=Qe.minElevation)!==null&&n!==void 0?n:this.elevation,ot=(o=Qe.maxElevation)!==null&&o!==void 0?o:this.elevation;Ce=new ho([Ce.min[0],Ce.min[1],Dt],[Ce.max[0],Ce.max[1],ot])}H.push({aabb:Ce,zoom:tt,x:Te,y:Ne,wrap:U.wrap,fullyVisible:ce})}}return q.sort((U,te)=>U.distanceSq-te.distanceSq).map(U=>U.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=c.ad(t.lat,-85.051129,ha);return new c.P(c.O(t.lng)*this.worldSize,c.Q(n)*this.worldSize)}unproject(t){return new c.Z(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.elevation,o=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,a=this.pointLocation(this.centerPoint,t),h=t.getElevationForLngLatZoom(a,this.tileZoom);if(!(this.elevation-h))return;const g=o+n-h,y=Math.cos(this._pitch)*this.cameraToCenterDistance/g/c.b5(1,a.lat),b=this.scaleZoom(y/this.tileSize);this._elevation=h,this._center=a,this.zoom=b}setLocationAtPoint(t,n){const o=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),h=this.locationCoordinate(t),g=new c.Z(h.x-(o.x-a.x),h.y-(o.y-a.y));this.center=this.coordinateLocation(g),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),n.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return c.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const R=n.pointCoordinate(t);if(R!=null)return R}const o=[t.x,t.y,0,1],a=[t.x,t.y,1,1];c.ag(o,o,this.pixelMatrixInverse),c.ag(a,a,this.pixelMatrixInverse);const h=o[3],g=a[3],y=o[1]/h,b=a[1]/g,w=o[2]/h,C=a[2]/g,E=w===C?0:(0-w)/(C-w);return new c.Z(c.z.number(o[0]/h,a[0]/g,E)/this.worldSize,c.z.number(y,b,E)/this.worldSize)}coordinatePoint(t,n=0,o=this.pixelMatrix){const a=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.ag(a,a,o),new c.P(a[0]/a[3],a[1]/a[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new ue().extend(this.pointLocation(new c.P(0,t))).extend(this.pointLocation(new c.P(this.width,t))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ue([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,ha])}calculateTileMatrix(t){const n=t.canonical,o=this.worldSize/this.zoomScale(n.z),a=n.x+Math.pow(2,n.z)*t.wrap,h=c.ao(new Float64Array(16));return c.J(h,h,[a*o,n.y*o,0]),c.K(h,h,[o/c.X,o/c.X,1]),h}calculatePosMatrix(t,n=!1){const o=t.key,a=n?this._alignedPosMatrixCache:this._posMatrixCache;if(a[o])return a[o];const h=this.calculateTileMatrix(t);return c.L(h,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,h),a[o]=new Float32Array(h),a[o]}calculateFogMatrix(t){const n=t.key,o=this._fogMatrixCache;if(o[n])return o[n];const a=this.calculateTileMatrix(t);return c.L(a,this.fogMatrix,a),o[n]=new Float32Array(a),o[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,n){n=c.ad(+n,this.minZoom,this.maxZoom);const o={center:new c.N(t.lng,t.lat),zoom:n};let a=this.lngRange;if(!this._renderWorldCopies&&a===null){const U=179.9999999999;a=[-U,U]}const h=this.tileSize*this.zoomScale(o.zoom);let g=0,y=h,b=0,w=h,C=0,E=0;const{x:R,y:F}=this.size;if(this.latRange){const U=this.latRange;g=c.Q(U[1])*h,y=c.Q(U[0])*h,y-g<F&&(C=F/(y-g))}a&&(b=c.b3(c.O(a[0])*h,0,h),w=c.b3(c.O(a[1])*h,0,h),w<b&&(w+=h),w-b<R&&(E=R/(w-b)));const{x:$,y:H}=this.project.call({worldSize:h},t);let q,X;const Y=Math.max(E||0,C||0);if(Y){const U=new c.P(E?(w+b)/2:$,C?(y+g)/2:H);return o.center=this.unproject.call({worldSize:h},U).wrap(),o.zoom+=this.scaleZoom(Y),o}if(this.latRange){const U=F/2;H-U<g&&(X=g+U),H+U>y&&(X=y-U)}if(a){const U=(b+w)/2;let te=$;this._renderWorldCopies&&(te=c.b3($,U-h/2,U+h/2));const se=R/2;te-se<b&&(q=b+se),te+se>w&&(q=w-se)}if(q!==void 0||X!==void 0){const U=new c.P(q??$,X??H);o.center=this.unproject.call({worldSize:h},U).wrap()}return o}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:o}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=o,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,o=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b5(1,this.center.lat)*this.worldSize;let a=c.ao(new Float64Array(16));c.K(a,a,[this.width/2,-this.height/2,1]),c.J(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=c.ao(new Float64Array(16)),c.K(a,a,[1,-1,1]),c.J(a,a,[-1,-1,0]),c.K(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a;const h=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),g=Math.min(this.elevation,this.minElevationForCurrentTile),y=h-g*this._pixelPerMeter/Math.cos(this._pitch),b=g<0?y:h,w=Math.PI/2+this._pitch,C=this._fov*(.5+t.y/this.height),E=Math.sin(C)*b/Math.sin(c.ad(Math.PI-w-C,.01,Math.PI-.01)),R=this.getHorizon(),F=2*Math.atan(R/this.cameraToCenterDistance)*(.5+t.y/(2*R)),$=Math.sin(F)*b/Math.sin(c.ad(Math.PI-w-F,.01,Math.PI-.01)),H=Math.min(E,$);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*H+b),this.nearZ=this.height/50,a=new Float64Array(16),c.b6(a,this._fov,this.width/this.height,this.nearZ,this.farZ),a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height,this.projectionMatrix=c.af(a),c.K(a,a,[1,-1,1]),c.J(a,a,[0,0,-this.cameraToCenterDistance]),c.b7(a,a,this._pitch),c.ae(a,a,this.angle),c.J(a,a,[-n,-o,0]),this.mercatorMatrix=c.K([],a,[this.worldSize,this.worldSize,this.worldSize]),c.K(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.L(new Float64Array(16),this.labelPlaneMatrix,a),c.J(a,a,[0,0,-this.elevation]),this.modelViewProjectionMatrix=a,this.invModelViewProjectionMatrix=c.at([],a),this.fogMatrix=new Float64Array(16),c.b6(this.fogMatrix,this._fov,this.width/this.height,h,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,c.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),c.b7(this.fogMatrix,this.fogMatrix,this._pitch),c.ae(this.fogMatrix,this.fogMatrix,this.angle),c.J(this.fogMatrix,this.fogMatrix,[-n,-o,0]),c.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=c.L(new Float64Array(16),this.labelPlaneMatrix,a);const q=this.width%2/2,X=this.height%2/2,Y=Math.cos(this.angle),U=Math.sin(this.angle),te=n-Math.round(n)+Y*q+U*X,se=o-Math.round(o)+Y*X+U*q,ce=new Float64Array(a);if(c.J(ce,ce,[te>.5?te-1:te,se>.5?se-1:se,0]),this.alignedModelViewProjectionMatrix=ce,a=c.at(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let o=n.x,a=n.y,h=n.x,g=n.y;for(const y of t)o=Math.min(o,y.x),a=Math.min(a,y.y),h=Math.max(h,y.x),g=Math.max(g,y.y);return[new c.P(o,a),new c.P(h,a),new c.P(h,g),new c.P(o,g),new c.P(o,a)]}}lngLatToCameraDepth(t,n){const o=this.locationCoordinate(t),a=[o.x*this.worldSize,o.y*this.worldSize,n,1];return c.ag(a,a,this.modelViewProjectionMatrix),a[2]/a[3]}}function po(u,t){let n,o=!1,a=null,h=null;const g=()=>{a=null,o&&(u.apply(h,n),a=setTimeout(g,t),o=!1)};return(...y)=>(o=!0,h=this,n=y,a||g(),a)}class Ss{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let o;return n.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(o=a)}),(o&&o[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(o=>isNaN(o))){const o=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:o,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const o=n.join("/");let a=o;a.split("&").length>0&&(a=a.split("&")[0]),this._hashName&&(a=`${this._hashName}=${o}`);let h=window.location.hash.replace(a,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let g=window.location.href.replace(/(#.+)?$/,h);g=g.replace("&&","&"),window.history.replaceState(window.history.state,null,g)},this._updateHash=po(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,a=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,a),g=Math.round(n.lng*h)/h,y=Math.round(n.lat*h)/h,b=this._map.getBearing(),w=this._map.getPitch();let C="";if(C+=t?`/${g}/${y}/${o}`:`${o}/${y}/${g}`,(b||w)&&(C+="/"+Math.round(10*b)/10),w&&(C+=`/${Math.round(w)}`),this._hashName){const E=this._hashName;let R=!1;const F=window.location.hash.slice(1).split("&").map($=>{const H=$.split("=")[0];return H===E?(R=!0,`${H}=${C}`):$}).filter($=>$);return R||F.push(`${E}=${C}`),`#${F.join("&")}`}return`#${C}`}}const _n={linearity:.3,easing:c.b8(0,0,.3,1)},da=c.e({deceleration:2500,maxSpeed:1400},_n),pa=c.e({deceleration:20,maxSpeed:1400},_n),Nl=c.e({deceleration:1e3,maxSpeed:360},_n),fo=c.e({deceleration:1e3,maxSpeed:90},_n);class mo{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ae.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=ae.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)n.zoom+=h.zoomDelta||0,n.bearing+=h.bearingDelta||0,n.pitch+=h.pitchDelta||0,h.panDelta&&n.pan._add(h.panDelta),h.around&&(n.around=h.around),h.pinchAround&&(n.pinchAround=h.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const h=go(n.pan.mag(),o,c.e({},da,t||{}));a.offset=n.pan.mult(h.amount/n.pan.mag()),a.center=this._map.transform.center,On(a,h)}if(n.zoom){const h=go(n.zoom,o,pa);a.zoom=this._map.transform.zoom+h.amount,On(a,h)}if(n.bearing){const h=go(n.bearing,o,Nl);a.bearing=this._map.transform.bearing+c.ad(h.amount,-179,179),On(a,h)}if(n.pitch){const h=go(n.pitch,o,fo);a.pitch=this._map.transform.pitch+h.amount,On(a,h)}if(a.zoom||a.bearing){const h=n.pinchAround===void 0?n.around:n.pinchAround;a.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),c.e(a,{noMoveStart:!0})}}function On(u,t){(!u.duration||u.duration<t.duration)&&(u.duration=t.duration,u.easing=t.easing)}function go(u,t,n){const{maxSpeed:o,linearity:a,deceleration:h}=n,g=c.ad(u*a/(t/1e3),-o,o),y=Math.abs(g)/(h*a);return{easing:n.easing,duration:1e3*y,amount:g*(y/2)}}class Ti extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o,a={}){const h=le.mousePos(n.getCanvas(),o),g=n.unproject(h);super(t,c.e({point:h,lngLat:g,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}}class Ts extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){const a=t==="touchend"?o.changedTouches:o.touches,h=le.touchPos(n.getCanvasContainer(),a),g=h.map(b=>n.unproject(b)),y=h.reduce((b,w,C,E)=>b.add(w.div(E.length)),new c.P(0,0));super(t,{points:h,point:y,lngLats:g,lngLat:n.unproject(y),originalEvent:o}),this._defaultPrevented=!1}}class fa extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class _o{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new fa(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ti(t.type,this._map,t))}mouseup(t){this._map.fire(new Ti(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ti(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ti(t.type,this._map,t))}mouseover(t){this._map.fire(new Ti(t.type,this._map,t))}mouseout(t){this._map.fire(new Ti(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ts(t.type,this._map,t))}touchmove(t){this._map.fire(new Ts(t.type,this._map,t))}touchend(t){this._map.fire(new Ts(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ts(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ma{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ti(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ti("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ti(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vn{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(c.P.convert(t),this._map.terrain)}}class ga{constructor(t,n){this._map=t,this._tr=new Vn(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(le.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const o=n;if(this._lastPos.equals(o)||!this._box&&o.dist(this._startPos)<this._clickTolerance)return;const a=this._startPos;this._lastPos=o,this._box||(this._box=le.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const h=Math.min(a.x,o.x),g=Math.max(a.x,o.x),y=Math.min(a.y,o.y),b=Math.max(a.y,o.y);le.setTransform(this._box,`translate(${h}px,${y}px)`),this._box.style.width=g-h+"px",this._box.style.height=b-y+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const o=this._startPos,a=n;if(this.reset(),le.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new c.k("boxzoomend",{originalEvent:t})),{cameraAnimation:h=>h.fitScreenCoordinates(o,a,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(le.remove(this._box),this._box=null),le.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.k(t,{originalEvent:n}))}}function Nn(u,t){if(u.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${t.length}`);const n={};for(let o=0;o<u.length;o++)n[u[o].identifier]=t[o];return n}class _a{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),o.length===this.numTouches&&(this.centroid=function(a){const h=new c.P(0,0);for(const g of a)h._add(g);return h.div(a.length)}(n),this.touches=Nn(o,n)))}touchmove(t,n,o){if(this.aborted||!this.centroid)return;const a=Nn(o,n);for(const h in this.touches){const g=a[h];(!g||g.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(t,n,o){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),o.length===0){const a=!this.aborted&&this.centroid;if(this.reset(),a)return a}}}class ya{constructor(t){this.singleTap=new _a(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,o){this.singleTap.touchstart(t,n,o)}touchmove(t,n,o){this.singleTap.touchmove(t,n,o)}touchend(t,n,o){const a=this.singleTap.touchend(t,n,o);if(a){const h=t.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(a)<30;if(h&&g||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class $l{constructor(t){this._tr=new Vn(t),this._zoomIn=new ya({numTouches:1,numTaps:2}),this._zoomOut=new ya({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,o){this._zoomIn.touchstart(t,n,o),this._zoomOut.touchstart(t,n,o)}touchmove(t,n,o){this._zoomIn.touchmove(t,n,o),this._zoomOut.touchmove(t,n,o)}touchend(t,n,o){const a=this._zoomIn.touchend(t,n,o),h=this._zoomOut.touchend(t,n,o),g=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom+1,around:g.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom-1,around:g.unproject(h)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class zt{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const o=this._lastPoint;if(!o)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const a=n.length?n[0]:n;return!this._moved&&a.dist(o)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=a,this._move(o,a))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&le.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const yn={0:1,2:2};class Ai{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=le.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,o){const a=yn[o];return n.buttons===void 0||(n.buttons&a)!==a}(t,this._eventButton)}isValidEndEvent(t){return le.mouseButton(t)===this._eventButton}}class yo{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const ks=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=t=>{t.preventDefault()}},xa=({enable:u,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const o=new Ai({checkCorrectEvent:a=>le.mouseButton(a)===0&&a.ctrlKey||le.mouseButton(a)===2});return new zt({clickTolerance:t,move:(a,h)=>({bearingDelta:(h.x-a.x)*n}),moveStateManager:o,enable:u,assignEvents:ks})},xn=({enable:u,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const o=new Ai({checkCorrectEvent:a=>le.mouseButton(a)===0&&a.ctrlKey||le.mouseButton(a)===2});return new zt({clickTolerance:t,move:(a,h)=>({pitchDelta:(h.y-a.y)*n}),moveStateManager:o,enable:u,assignEvents:ks})};class Is{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,o){return this._calculateTransform(t,n,o)}touchmove(t,n,o){if(this._active){if(!this._shouldBePrevented(o.length))return t.preventDefault(),this._calculateTransform(t,n,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,o){this._calculateTransform(t,n,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,o){o.length>0&&(this._active=!0);const a=Nn(o,n),h=new c.P(0,0),g=new c.P(0,0);let y=0;for(const w in a){const C=a[w],E=this._touches[w];E&&(h._add(C),g._add(C.sub(E)),y++,a[w]=C)}if(this._touches=a,this._shouldBePrevented(y)||!g.mag())return;const b=g.div(y);return this._sum._add(b),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(y),panDelta:b}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Cs{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,o){if(!this._firstTwoTouches)return;t.preventDefault();const[a,h]=this._firstTwoTouches,g=Es(o,n,a),y=Es(o,n,h);if(!g||!y)return;const b=this._aroundCenter?null:g.add(y).div(2);return this._move([g,y],b,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,g=Es(o,n,a),y=Es(o,n,h);g&&y||(this._active&&le.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Es(u,t,n){for(let o=0;o<u.length;o++)if(u[o].identifier===n)return t[o]}function va(u,t){return Math.log(u/t)/Math.LN2}class ba extends Cs{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const o=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(va(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:va(this._distance,o),pinchAround:n}}}function wa(u,t){return 180*u.angleWith(t)/Math.PI}class Sa extends Cs{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n,o){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:wa(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,o=wa(t,this._startVector);return Math.abs(o)<n}}function Lr(u){return Math.abs(u.y)>Math.abs(u.x)}class Ta extends Cs{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,o){super.touchstart(t,n,o),this._currentTouchCount=o.length}_start(t){this._lastPoints=t,Lr(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,o){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const a=t[0].sub(this._lastPoints[0]),h=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,h,o.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(a.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,o){if(this._valid!==void 0)return this._valid;const a=t.mag()>=2,h=n.mag()>=2;if(!a&&!h)return;if(!a||!h)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;const g=t.y>0==n.y>0;return Lr(t)&&Lr(n)&&g}}const Ul={panStep:100,bearingStep:15,pitchStep:10};class ka{constructor(t){this._tr=new Vn(t);const n=Ul;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,o=0,a=0,h=0,g=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?o=-1:(t.preventDefault(),h=-1);break;case 39:t.shiftKey?o=1:(t.preventDefault(),h=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),g=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(o=0,a=0),{cameraAnimation:y=>{const b=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:jl,zoom:n?Math.round(b.zoom)+n*(t.shiftKey?2:1):b.zoom,bearing:b.bearing+o*this._bearingStep,pitch:b.pitch+a*this._pitchStep,offset:[-h*this._panStep,-g*this._panStep],center:b.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function jl(u){return u*(2-u)}const Ia=4.000244140625;class Ca{constructor(t,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=t,this._tr=new Vn(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const o=ae.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%Ia==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(a*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=le.mousePos(this._map.getCanvas(),t),o=this._tr;this._around=n.y>o.transform.height/2-o.transform.getHorizon()?c.N.convert(this._aroundCenter?o.center:o.unproject(n)):c.N.convert(o.center),this._aroundPoint=o.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const b=this._type==="wheel"&&Math.abs(this._delta)>Ia?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*b)));this._delta<0&&w!==0&&(w=1/w);const C=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(C*w))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,o=this._startZoom,a=this._easing;let h,g=!1;const y=ae.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&y){const b=Math.min(y/200,1),w=a(b);h=c.z.number(o,n,w),b<1?this._frameId||(this._frameId=!0):g=!0}else h=n,g=!0;return this._active=!0,g&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!g,zoomDelta:h-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.b9;if(this._prevEase){const o=this._prevEase,a=(ae.now()-o.start)/o.duration,h=o.easing(a+.01)-o.easing(a),g=.27/Math.sqrt(h*h+1e-4)*.01,y=Math.sqrt(.0729-g*g);n=c.b8(g,y,.25,1)}return this._prevEase={start:ae.now(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ea{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 Ps{constructor(t){this._tr=new Vn(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:o=>{o.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ql{constructor(){this._tap=new ya({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,o){if(!this._swipePoint)if(this._tapTime){const a=n[0],h=t.timeStamp-this._tapTime<500,g=this._tapPoint.dist(a)<30;h&&g?o.length>0&&(this._swipePoint=a,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(t,n,o)}touchmove(t,n,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;const a=n[0],h=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(t,n,o)}touchend(t,n,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{const a=this._tap.touchend(t,n,o);a&&(this._tapTime=t.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ji{constructor(t,n,o){this._el=t,this._mousePan=n,this._touchPan=o}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ir{constructor(t,n,o){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=o}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Pa{constructor(t,n,o,a){this._el=t,this._touchZoom=n,this._touchRotate=o,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class rr{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=le.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=n,this._container.appendChild(a);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=o,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(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Rr=u=>u.zoom||u.drag||u.pitch||u.rotate;class ih extends c.k{}function Aa(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class rh{constructor(t,n){this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,h)=>{if(a.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const g=a.type==="renderFrame"?void 0:a,y={needsRenderFrame:!1},b={},w={},C=a.touches,E=C?this._getMapTouches(C):void 0,R=E?le.touchPos(this._map.getCanvas(),E):le.mousePos(this._map.getCanvas(),a);for(const{handlerName:H,handler:q,allowed:X}of this._handlers){if(!q.isEnabled())continue;let Y;this._blockedByActive(w,X,H)?q.reset():q[h||a.type]&&(Y=q[h||a.type](a,R,E),this.mergeHandlerResult(y,b,Y,H,g),Y&&Y.needsRenderFrame&&this._triggerRenderFrame()),(Y||q.isActive())&&(w[H]=q)}const F={};for(const H in this._previousActiveHandlers)w[H]||(F[H]=g);this._previousActiveHandlers=w,(Object.keys(F).length||Aa(y))&&(this._changes.push([y,b,F]),this._triggerRenderFrame()),(Object.keys(w).length||Aa(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:$}=y;$&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],$(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new mo(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[window,"blur",void 0]];for(const[a,h,g]of this._listeners)le.addEventListener(a,h,a===document?this.handleWindowEvent:this.handleEvent,g)}destroy(){for(const[t,n,o]of this._listeners)le.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(t){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new _o(n,t));const a=n.boxZoom=new ga(n,t);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();const h=n.cooperativeGestures=new rr(n,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const g=new $l(n),y=new Ps(n);n.doubleClickZoom=new Ea(y,g),this._add("tapZoom",g),this._add("clickZoom",y),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const b=new ql;this._add("tapDragZoom",b);const w=n.touchPitch=new Ta(n);this._add("touchPitch",w),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const C=xa(t),E=xn(t);n.dragRotate=new ir(t,C,E),this._add("mouseRotate",C,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const R=(({enable:Y,clickTolerance:U})=>{const te=new Ai({checkCorrectEvent:se=>le.mouseButton(se)===0&&!se.ctrlKey});return new zt({clickTolerance:U,move:(se,ce)=>({around:ce,panDelta:ce.sub(se)}),activateOnStart:!0,moveStateManager:te,enable:Y,assignEvents:ks})})(t),F=new Is(t,n);n.dragPan=new Ji(o,R,F),this._add("mousePan",R),this._add("touchPan",F,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const $=new Sa,H=new ba;n.touchZoomRotate=new Pa(o,H,$,b),this._add("touchRotate",$,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const q=n.scrollZoom=new Ca(n,()=>this._triggerRenderFrame());this._add("scrollZoom",q,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const X=n.keyboard=new ka(n);this._add("keyboard",X),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new ma(n))}_add(t,n,o){this._handlers.push({handlerName:t,handler:n,allowed:o}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Rr(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,o){for(const a in t)if(a!==o&&(!n||n.indexOf(a)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const o of t)this._el.contains(o.target)&&n.push(o);return n}mergeHandlerResult(t,n,o,a,h){if(!o)return;c.e(t,o);const g={handlerName:a,originalEvent:o.originalEvent||h};o.zoomDelta!==void 0&&(n.zoom=g),o.panDelta!==void 0&&(n.drag=g),o.pitchDelta!==void 0&&(n.pitch=g),o.bearingDelta!==void 0&&(n.rotate=g)}_applyChanges(){const t={},n={},o={};for(const[a,h,g]of this._changes)a.panDelta&&(t.panDelta=(t.panDelta||new c.P(0,0))._add(a.panDelta)),a.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+a.pitchDelta),a.around!==void 0&&(t.around=a.around),a.pinchAround!==void 0&&(t.pinchAround=a.pinchAround),a.noInertia&&(t.noInertia=a.noInertia),c.e(n,h),c.e(o,g);this._updateMapTransform(t,n,o),this._changes=[]}_updateMapTransform(t,n,o){const a=this._map,h=a._getTransformForUpdate(),g=a.terrain;if(!(Aa(t)||g&&this._terrainMovement))return this._fireEvents(n,o,!0);let{panDelta:y,zoomDelta:b,bearingDelta:w,pitchDelta:C,around:E,pinchAround:R}=t;R!==void 0&&(E=R),a._stop(!0),E=E||a.transform.centerPoint;const F=h.pointLocation(y?E.sub(y):E);w&&(h.bearing+=w),C&&(h.pitch+=C),b&&(h.zoom+=b),g?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(y)):h.setLocationAtPoint(F,E):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(F,E)):h.setLocationAtPoint(F,E),a._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,o,!0)}_fireEvents(t,n,o){const a=Rr(this._eventsInProgress),h=Rr(t),g={};for(const E in t){const{originalEvent:R}=t[E];this._eventsInProgress[E]||(g[`${E}start`]=R),this._eventsInProgress[E]=t[E]}!a&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in g)this._fireEvent(E,g[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in t){const{originalEvent:R}=t[E];this._fireEvent(E,R)}const y={};let b;for(const E in this._eventsInProgress){const{handlerName:R,originalEvent:F}=this._eventsInProgress[E];this._handlersById[R].isActive()||(delete this._eventsInProgress[E],b=n[R]||F,y[`${E}end`]=b)}for(const E in y)this._fireEvent(E,y[E]);const w=Rr(this._eventsInProgress),C=(a||h)&&!w;if(C&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();E.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(E)}if(o&&C){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),R=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!E||!E.essential&&ae.prefersReducedMotion?(this._map.fire(new c.k("moveend",{originalEvent:b})),R(this._map.getBearing())&&this._map.resetNorth()):(R(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:b})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new c.k(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new ih("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class nh extends c.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const o=Math.min((ae.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,o){return t=c.P.convert(t).mult(-1),this.panTo(this.transform.center,c.e({offset:t},n),o)}panTo(t,n,o){return this.easeTo(c.e({center:t},n),o)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,o){return this.easeTo(c.e({zoom:t},n),o)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,o){return this.easeTo(c.e({bearing:t},n),o)}resetNorth(t,n){return this.rotateTo(0,c.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=ue.convert(t);const o=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),o,n)}_cameraForBoxAndBearing(t,n,o,a){const h={top:0,bottom:0,right:0,left:0};if(typeof(a=c.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){const Se=a.padding;a.padding={top:Se,bottom:Se,right:Se,left:Se}}a.padding=c.e(h,a.padding);const g=this.transform,y=g.padding,b=new ue(t,n),w=g.project(b.getNorthWest()),C=g.project(b.getNorthEast()),E=g.project(b.getSouthEast()),R=g.project(b.getSouthWest()),F=c.ba(-o),$=w.rotate(F),H=C.rotate(F),q=E.rotate(F),X=R.rotate(F),Y=new c.P(Math.max($.x,H.x,X.x,q.x),Math.max($.y,H.y,X.y,q.y)),U=new c.P(Math.min($.x,H.x,X.x,q.x),Math.min($.y,H.y,X.y,q.y)),te=Y.sub(U),se=(g.width-(y.left+y.right+a.padding.left+a.padding.right))/te.x,ce=(g.height-(y.top+y.bottom+a.padding.top+a.padding.bottom))/te.y;if(ce<0||se<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ye=Math.min(g.scaleZoom(g.scale*Math.min(se,ce)),a.maxZoom),we=c.P.convert(a.offset),De=new c.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(c.ba(o)),Re=we.add(De).mult(g.scale/g.zoomScale(ye));return{center:g.unproject(w.add(E).div(2).sub(Re)),zoom:ye,bearing:o}}fitBounds(t,n,o){return this._fitInternal(this.cameraForBounds(t,n),n,o)}fitScreenCoordinates(t,n,o,a,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.P.convert(t)),this.transform.pointLocation(c.P.convert(n)),o,a),a,h)}_fitInternal(t,n,o){return t?(delete(n=c.e(t,n)).padding,n.linear?this.easeTo(n,o):this.flyTo(n,o)):this}jumpTo(t,n){this.stop();const o=this._getTransformForUpdate();let a=!1,h=!1,g=!1;return"zoom"in t&&o.zoom!==+t.zoom&&(a=!0,o.zoom=+t.zoom),t.center!==void 0&&(o.center=c.N.convert(t.center)),"bearing"in t&&o.bearing!==+t.bearing&&(h=!0,o.bearing=+t.bearing),"pitch"in t&&o.pitch!==+t.pitch&&(g=!0,o.pitch=+t.pitch),t.padding==null||o.isPaddingEqual(t.padding)||(o.padding=t.padding),this._applyUpdatedTransform(o),this.fire(new c.k("movestart",n)).fire(new c.k("move",n)),a&&this.fire(new c.k("zoomstart",n)).fire(new c.k("zoom",n)).fire(new c.k("zoomend",n)),h&&this.fire(new c.k("rotatestart",n)).fire(new c.k("rotate",n)).fire(new c.k("rotateend",n)),g&&this.fire(new c.k("pitchstart",n)).fire(new c.k("pitch",n)).fire(new c.k("pitchend",n)),this.fire(new c.k("moveend",n))}calculateCameraOptionsFromTo(t,n,o,a=0){const h=c.Z.fromLngLat(t,n),g=c.Z.fromLngLat(o,a),y=g.x-h.x,b=g.y-h.y,w=g.z-h.z,C=Math.hypot(y,b,w);if(C===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(y,b),R=this.transform.scaleZoom(this.transform.cameraToCenterDistance/C/this.transform.tileSize),F=180*Math.atan2(y,-b)/Math.PI;let $=180*Math.acos(E/C)/Math.PI;return $=w<0?90-$:90+$,{center:g.toLngLat(),zoom:R,pitch:$,bearing:F}}easeTo(t,n){var o;this._stop(!1,t.easeId),((t=c.e({offset:[0,0],duration:500,easing:c.b9},t)).animate===!1||!t.essential&&ae.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),h=a.zoom,g=a.bearing,y=a.pitch,b=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,g):g,C="pitch"in t?+t.pitch:y,E="padding"in t?t.padding:a.padding,R=c.P.convert(t.offset);let F=a.centerPoint.add(R);const $=a.pointLocation(F),{center:H,zoom:q}=a.getConstrained(c.N.convert(t.center||$),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(H,a);const X=a.project($),Y=a.project(H).sub(X),U=a.zoomScale(q-h);let te,se;t.around&&(te=c.N.convert(t.around),se=a.locationPoint(te));const ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||q!==h,this._rotating=this._rotating||g!==w,this._pitching=this._pitching||C!==y,this._padding=!a.isPaddingEqual(E),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ce),this.terrain&&this._prepareElevation(H),this._ease(ye=>{if(this._zooming&&(a.zoom=c.z.number(h,q,ye)),this._rotating&&(a.bearing=c.z.number(g,w,ye)),this._pitching&&(a.pitch=c.z.number(y,C,ye)),this._padding&&(a.interpolatePadding(b,E,ye),F=a.centerPoint.add(R)),this.terrain&&!t.freezeElevation&&this._updateElevation(ye),te)a.setLocationAtPoint(te,se);else{const we=a.zoomScale(a.zoom-h),De=q>h?Math.min(2,U):Math.max(.5,U),Re=Math.pow(De,1-ye),Se=a.unproject(X.add(Y.mult(ye*Re)).mult(we));a.setLocationAtPoint(a.renderWorldCopies?Se.wrap():Se,F)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},ye=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,ye)},t),this}_prepareEase(t,n,o={}){this._moving=!0,n||o.moving||this.fire(new c.k("movestart",t)),this._zooming&&!o.zooming&&this.fire(new c.k("zoomstart",t)),this._rotating&&!o.rotating&&this.fire(new c.k("rotatestart",t)),this._pitching&&!o.pitching&&this.fire(new c.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const o=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(o-(n-(o*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=c.z.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){const n=t.getCameraPosition(),o=this.terrain.getElevationForLngLatZoom(n.lngLat,t.zoom);if(n.altitude<o){const a=this.calculateCameraOptionsFromTo(n.lngLat,o,t.center,t.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(this.terrain&&n.push(a=>this._elevateCameraIfInsideTerrain(a)),this.transformCameraUpdate&&n.push(a=>this.transformCameraUpdate(a)),!n.length)return;const o=t.clone();for(const a of n){const h=o.clone(),{center:g,zoom:y,pitch:b,bearing:w,elevation:C}=a(h);g&&(h.center=g),y!==void 0&&(h.zoom=y),b!==void 0&&(h.pitch=b),w!==void 0&&(h.bearing=w),C!==void 0&&(h.elevation=C),o.apply(h)}this.transform.apply(o)}_fireMoveEvents(t){this.fire(new c.k("move",t)),this._zooming&&this.fire(new c.k("zoom",t)),this._rotating&&this.fire(new c.k("rotate",t)),this._pitching&&this.fire(new c.k("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,a=this._rotating,h=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new c.k("zoomend",t)),a&&this.fire(new c.k("rotateend",t)),h&&this.fire(new c.k("pitchend",t)),this.fire(new c.k("moveend",t))}flyTo(t,n){var o;if(!t.essential&&ae.prefersReducedMotion){const Ae=c.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ae,n)}this.stop(),t=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b9},t);const a=this._getTransformForUpdate(),h=a.zoom,g=a.bearing,y=a.pitch,b=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,g):g,C="pitch"in t?+t.pitch:y,E="padding"in t?t.padding:a.padding,R=c.P.convert(t.offset);let F=a.centerPoint.add(R);const $=a.pointLocation(F),{center:H,zoom:q}=a.getConstrained(c.N.convert(t.center||$),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(H,a);const X=a.zoomScale(q-h),Y=a.project($),U=a.project(H).sub(Y);let te=t.curve;const se=Math.max(a.width,a.height),ce=se/X,ye=U.mag();if("minZoom"in t){const Ae=c.ad(Math.min(t.minZoom,h,q),a.minZoom,a.maxZoom),Qe=se/a.zoomScale(Ae-h);te=Math.sqrt(Qe/ye*2)}const we=te*te;function De(Ae){const Qe=(ce*ce-se*se+(Ae?-1:1)*we*we*ye*ye)/(2*(Ae?ce:se)*we*ye);return Math.log(Math.sqrt(Qe*Qe+1)-Qe)}function Re(Ae){return(Math.exp(Ae)-Math.exp(-Ae))/2}function Se(Ae){return(Math.exp(Ae)+Math.exp(-Ae))/2}const Te=De(!1);let Ne=function(Ae){return Se(Te)/Se(Te+te*Ae)},tt=function(Ae){return se*((Se(Te)*(Re(Qe=Te+te*Ae)/Se(Qe))-Re(Te))/we)/ye;var Qe},Ce=(De(!0)-Te)/te;if(Math.abs(ye)<1e-6||!isFinite(Ce)){if(Math.abs(se-ce)<1e-6)return this.easeTo(t,n);const Ae=ce<se?-1:1;Ce=Math.abs(Math.log(ce/se))/te,tt=()=>0,Ne=Qe=>Math.exp(Ae*te*Qe)}return t.duration="duration"in t?+t.duration:1e3*Ce/("screenSpeed"in t?+t.screenSpeed/te:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=g!==w,this._pitching=C!==y,this._padding=!a.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(H),this._ease(Ae=>{const Qe=Ae*Ce,Dt=1/Ne(Qe);a.zoom=Ae===1?q:h+a.scaleZoom(Dt),this._rotating&&(a.bearing=c.z.number(g,w,Ae)),this._pitching&&(a.pitch=c.z.number(y,C,Ae)),this._padding&&(a.interpolatePadding(b,E,Ae),F=a.centerPoint.add(R)),this.terrain&&!t.freezeElevation&&this._updateElevation(Ae);const ot=Ae===1?H:a.unproject(Y.add(U.mult(tt(Qe))).mult(Dt));a.setLocationAtPoint(a.renderWorldCopies?ot.wrap():ot,F),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}return t||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(t,n,o){o.animate===!1||o.duration===0?(t(1),n()):(this._easeStart=ae.now(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=c.b3(t,-180,180);const o=Math.abs(t-n);return Math.abs(t-360-n)<o&&(t-=360),Math.abs(t+360-n)<o&&(t+=360),t}_normalizeCenter(t,n){if(!n.renderWorldCopies||n.lngRange)return;const o=t.lng-n.center.lng;t.lng+=o>180?-360:o<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const Ma={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class $n{constructor(t=Ma){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=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.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(t,n){const o=this._map._getUIString(`AttributionControl.${n}`);t.title=o,t.setAttribute("aria-label",o)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(a=>typeof a!="string"?"":a)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const a=this._map.style.stylesheet;this.styleOwner=a.owner,this.styleId=a.id}const n=this._map.style.sourceCaches;for(const a in n){const h=n[a];if(h.used||h.usedForTerrain){const g=h.getSource();g.attribution&&t.indexOf(g.attribution)<0&&t.push(g.attribution)}}t=t.filter(a=>String(a).trim()),t.sort((a,h)=>a.length-h.length),t=t.filter((a,h)=>{for(let g=h+1;g<t.length;g++)if(t[g].indexOf(a)>=0)return!1;return!0});const o=t.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class xr{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const o=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact"):o.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=le.create("div","maplibregl-ctrl");const n=le.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),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 Fe{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,o=n?this._queue.concat(n):this._queue;for(const a of o)if(a.id===t)return void(a.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const o of n)if(!o.cancelled&&(o.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Zl=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class za extends c.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const o={};for(const a of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))o[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),c.aQ(a.posMatrix,0,c.X,0,c.X,0,1),this._tiles[a.key]=new Zr(a,this.tileSize));for(const a in this._tiles)o[a]||delete this._tiles[a]}freeRtt(t){for(const n in this._tiles){const o=this._tiles[n];(!t||o.tileID.equals(t)||o.tileID.isChildOf(t)||t.isChildOf(o.tileID))&&(o.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const o of this._renderableTilesKeys){const a=this._tiles[o].tileID;if(a.canonical.equals(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16),c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),n[o]=h}else if(a.canonical.isChildOf(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const g=a.canonical.z-t.canonical.z,y=a.canonical.x-(a.canonical.x>>g<<g),b=a.canonical.y-(a.canonical.y>>g<<g),w=c.X>>g;c.aQ(h.posMatrix,0,w,0,w,0,1),c.J(h.posMatrix,h.posMatrix,[-y*w,-b*w,0]),n[o]=h}else if(t.canonical.isChildOf(a.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const g=t.canonical.z-a.canonical.z,y=t.canonical.x-(t.canonical.x>>g<<g),b=t.canonical.y-(t.canonical.y>>g<<g),w=c.X>>g;c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),c.J(h.posMatrix,h.posMatrix,[y*w,b*w,0]),c.K(h.posMatrix,h.posMatrix,[1/2**g,1/2**g,0]),n[o]=h}}return n}getSourceTile(t,n){const o=this.sourceCache._source;let a=t.overscaledZ-this.deltaZoom;if(a>o.maxzoom&&(a=o.maxzoom),a<o.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(a).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!h||!h.dem)&&n)for(;a>=o.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(t.scaledTo(a--).key);return h}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class Gl{constructor(t,n,o){this.painter=t,this.sourceCache=new za(n),this.options=o,this.exaggeration=typeof o.exaggeration=="number"?o.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,o,a=c.X){var h;if(!(n>=0&&n<a&&o>=0&&o<a))return 0;const g=this.getTerrainData(t),y=(h=g.tile)===null||h===void 0?void 0:h.dem;if(!y)return 0;const b=function($,H,q){var X=H[0],Y=H[1];return $[0]=q[0]*X+q[4]*Y+q[12],$[1]=q[1]*X+q[5]*Y+q[13],$}([],[n/a*c.X,o/a*c.X],g.u_terrain_matrix),w=[b[0]*y.dim,b[1]*y.dim],C=Math.floor(w[0]),E=Math.floor(w[1]),R=w[0]-C,F=w[1]-E;return y.get(C,E)*(1-R)*(1-F)+y.get(C+1,E)*R*(1-F)+y.get(C,E+1)*(1-R)*F+y.get(C+1,E+1)*R*F}getElevationForLngLatZoom(t,n){const{tileID:o,mercatorX:a,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(o,a%c.X,h%c.X,c.X)}getElevation(t,n,o,a=c.X){return this.getDEMElevation(t,n,o,a)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const a=this.painter.context,h=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new St(a,h,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new St(a,new c.R({width:1,height:1}),a.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.ao([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const a=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new St(a,n.dem.getPixels(),a.gl.RGBA,{premultiply:!1}),n.demTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const o=n&&n+n.tileID.key+t.key;if(o&&!this._demMatrixCache[o]){const a=this.sourceCache.sourceCache._source.maxzoom;let h=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=a?h=t.canonical.z-a:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const g=t.canonical.x-(t.canonical.x>>h<<h),y=t.canonical.y-(t.canonical.y>>h<<h),b=c.bb(new Float64Array(16),[1/(c.X<<h),1/(c.X<<h),0]);c.J(b,b,[g*c.X,y*c.X,0]),this._demMatrixCache[t.key]={matrix:b,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:o?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,o=n.width/devicePixelRatio,a=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===o&&this._fbo.height===a||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new St(n.context,{width:o,height:a,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new St(n.context,{width:o,height:a,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(o,a,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,o,a))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,g=0;h<this._coordsTextureSize;h++)for(let y=0;y<this._coordsTextureSize;y++,g+=4)n[g+0]=255&y,n[g+1]=255&h,n[g+2]=y>>8<<4|h>>8,n[g+3]=0;const o=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new St(t,o,t.gl.RGBA,{premultiply:!1});return a.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),o=this.painter.context,a=o.gl,h=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),g=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),y=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,y-g-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const b=n[0]+(n[2]>>4<<8),w=n[1]+((15&n[2])<<8),C=this.coordsIndex[255-n[3]],E=C&&this.sourceCache.getTileByID(C);if(!E)return null;const R=this._coordsTextureSize,F=(1<<E.tileID.canonical.z)*R;return new c.Z((E.tileID.canonical.x*R+b)/F+E.tileID.wrap,(E.tileID.canonical.y*R+w)/F,this.getElevation(E.tileID,b,w,R))}depthAtPoint(t){const n=new Uint8Array(4),o=this.painter.context,a=o.gl;return o.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),a.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new c.bc,o=new c.aY,a=this.meshSize,h=c.X/a,g=a*a;for(let E=0;E<=a;E++)for(let R=0;R<=a;R++)n.emplaceBack(R*h,E*h,0);for(let E=0;E<g;E+=a+1)for(let R=0;R<a;R++)o.emplaceBack(R+E,a+R+E+1,a+R+E+2),o.emplaceBack(R+E,a+R+E+2,R+E+1);const y=n.length,b=y+2*(a+1);for(const E of[0,1])for(let R=0;R<=a;R++)for(const F of[0,1])n.emplaceBack(R*h,E*c.X,F);for(let E=0;E<2*a;E+=2)o.emplaceBack(b+E,b+E+1,b+E+3),o.emplaceBack(b+E,b+E+3,b+E+2),o.emplaceBack(y+E,y+E+3,y+E+1),o.emplaceBack(y+E,y+E+2,y+E+3);const w=n.length,C=w+2*(a+1);for(const E of[0,1])for(let R=0;R<=a;R++)for(const F of[0,1])n.emplaceBack(E*c.X,R*h,F);for(let E=0;E<2*a;E+=2)o.emplaceBack(w+E,w+E+1,w+E+3),o.emplaceBack(w+E,w+E+3,w+E+2),o.emplaceBack(C+E,C+E+3,C+E+1),o.emplaceBack(C+E,C+E+2,C+E+3);return this._mesh=new Ol(t.createVertexBuffer(n,Zl.members),t.createIndexBuffer(o),c.a0.simpleSegment(0,0,n.length,o.length)),this._mesh}getMeshFrameDelta(t){return 2*Math.PI*c.bd/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,n){var o;const{tileID:a}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(o=this.getMinMaxElevation(a).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,o={minElevation:null,maxElevation:null};return n&&n.dem&&(o.minElevation=n.dem.min*this.exaggeration,o.maxElevation=n.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(t,n){const o=c.Z.fromLngLat(t.wrap()),a=(1<<n)*c.X,h=o.x*a,g=o.y*a,y=Math.floor(h/c.X),b=Math.floor(g/c.X);return{tileID:new c.S(n,0,n,y,b),mercatorX:h,mercatorY:g}}}class As{constructor(t,n,o){this._context=t,this._size=n,this._tileSize=o,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),o=new St(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(o.texture),{id:t,fbo:n,texture:o,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(t=>!t.inUse)===!1}}const vr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Hl{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new As(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(o=>!t._layers[o].isHidden(n)),this._coordsDescendingInv={};for(const o in t.sourceCaches){this._coordsDescendingInv[o]={};const a=t.sourceCaches[o].getVisibleCoordinates();for(const h of a){const g=this.terrain.sourceCache.getTerrainCoords(h);for(const y in g)this._coordsDescendingInv[o][y]||(this._coordsDescendingInv[o][y]=[]),this._coordsDescendingInv[o][y].push(g[y])}}this._coordsDescendingInvStr={};for(const o of t._order){const a=t._layers[o],h=a.source;if(vr[a.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const g in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][g]=this._coordsDescendingInv[h][g].map(y=>y.key).sort().join()}}for(const o of this._renderableTiles)for(const a in this._coordsDescendingInvStr){const h=this._coordsDescendingInvStr[a][o.tileID.key];h&&h!==o.rttCoords[a]&&(o.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(vr[n]&&(this._prevType&&vr[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(vr[this._prevType]||vr[n]&&a){this._prevType=n;const h=this._stacks.length-1,g=this._stacks[h]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(ws(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[h]){const w=this.pool.getObjectForId(y.rtt[h].id);if(w.stamp===y.rtt[h].stamp){this.pool.useObject(w);continue}}const b=this.pool.getOrCreateFreeObject();this.pool.useObject(b),this.pool.stampObject(b),y.rtt[h]={id:b.id,stamp:b.stamp},o.context.bindFramebuffer.set(b.fbo.framebuffer),o.context.clear({color:c.aN.transparent,stencil:0}),o.currentStencilSource=void 0;for(let w=0;w<g.length;w++){const C=o.style._layers[g[w]],E=C.source?this._coordsDescendingInv[C.source][y.tileID.key]:[y.tileID];o.context.viewport.set([0,0,b.fbo.width,b.fbo.height]),o._renderTileClippingMasks(C,E),o.renderLayer(o,o.style.sourceCaches[C.source],C,E),C.source&&(y.rttCoords[C.source]=this._coordsDescendingInvStr[C.source][y.tileID.key])}}return ws(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),vr[n]}return!1}}const ze={"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","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"},Da=fe,sh={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ma,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!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],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:c.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},Wl=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},La={showCompass:!0,showZoom:!0,visualizePitch:!1};class Xl{constructor(t,n,o=!1){this.mousedown=g=>{this.startMouse(c.e({},g,{ctrlKey:!0,preventDefault:()=>g.preventDefault()}),le.mousePos(this.element,g)),le.addEventListener(window,"mousemove",this.mousemove),le.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=g=>{this.moveMouse(g,le.mousePos(this.element,g))},this.mouseup=g=>{this.mouseRotate.dragEnd(g),this.mousePitch&&this.mousePitch.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=le.touchPos(this.element,g.targetTouches)[0],this.startTouch(g,this._startPos),le.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.addEventListener(window,"touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=le.touchPos(this.element,g.targetTouches)[0],this.moveTouch(g,this._lastPos))},this.touchend=g=>{g.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.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const a=t.dragRotate._mouseRotate.getClickTolerance(),h=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=xa({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:g,clickTolerance:y,bearingDegreesPerPixelMoved:b=.8})=>{const w=new yo;return new zt({clickTolerance:y,move:(C,E)=>({bearingDelta:(E.x-C.x)*b}),moveStateManager:w,enable:g,assignEvents:Wl})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=xn({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:g,clickTolerance:y,pitchDegreesPerPixelMoved:b=-.5})=>{const w=new yo;return new zt({clickTolerance:y,move:(C,E)=>({pitchDelta:(E.y-C.y)*b}),moveStateManager:w,enable:g,assignEvents:Wl})})({clickTolerance:h,enable:!0})),le.addEventListener(n,"mousedown",this.mousedown),le.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),le.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),le.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),le.disableDrag()}moveMouse(t,n){const o=this.map,{bearingDelta:a}=this.mouseRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.mousePitch){const{pitchDelta:h}=this.mousePitch.dragMove(t,n)||{};h&&o.setPitch(o.getPitch()+h)}}moveTouch(t,n){const o=this.map,{bearingDelta:a}=this.touchRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.touchPitch){const{pitchDelta:h}=this.touchPitch.dragMove(t,n)||{};h&&o.setPitch(o.getPitch()+h)}}off(){const t=this.element;le.removeEventListener(t,"mousedown",this.mousedown),le.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend),le.removeEventListener(t,"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 Kr;function Jl(u,t,n){const o=new c.N(u.lng,u.lat);if(u=new c.N(u.lng,u.lat),t){const a=new c.N(u.lng-360,u.lat),h=new c.N(u.lng+360,u.lat),g=n.locationPoint(u).distSqr(t);n.locationPoint(a).distSqr(t)<g?u=a:n.locationPoint(h).distSqr(t)<g&&(u=h)}for(;Math.abs(u.lng-n.center.lng)>180;){const a=n.locationPoint(u);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;u.lng>n.center.lng?u.lng-=360:u.lng+=360}return u.lng!==o.lng&&n.locationPoint(u).y>n.height/2-n.getHorizon()?u:o}const Ra={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 Yr(u,t,n){const o=u.classList;for(const a in Ra)o.remove(`maplibregl-${n}-anchor-${a}`);o.add(`maplibregl-${n}-anchor-${t}`)}class Pt extends c.E{constructor(t){if(super(),this._onKeyPress=n=>{const o=n.code,a=n.charCode||n.keyCode;o!=="Space"&&o!=="Enter"&&a!==32&&a!==13||this.togglePopup()},this._onMapClick=n=>{const o=n.originalEvent.target,a=this._element;this._popup&&(o===a||a.contains(o))&&this.togglePopup()},this._update=n=>{var o;if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Jl(this._lngLat,this._flatPos,this._map.transform):(o=this._lngLat)===null||o===void 0?void 0:o.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let g="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?g="rotateX(0deg)":this._pitchAlignment==="map"&&(g=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),le.setTransform(this._element,`${Ra[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${g} ${h}`),ae.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}this._isDragging&&(this._pos=n.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 c.k("dragstart"))),this.fire(new c.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.k("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=c.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=le.create("div");const n=le.createNS("http://www.w3.org/2000/svg","svg"),o=41,a=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${a}px`),n.setAttributeNS(null,"viewBox",`0 0 ${a} ${o}`);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 g=le.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"fill-rule","nonzero");const y=le.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const b=[{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 X of b){const Y=le.createNS("http://www.w3.org/2000/svg","ellipse");Y.setAttributeNS(null,"opacity","0.04"),Y.setAttributeNS(null,"cx","10.5"),Y.setAttributeNS(null,"cy","5.80029008"),Y.setAttributeNS(null,"rx",X.rx),Y.setAttributeNS(null,"ry",X.ry),y.appendChild(Y)}const w=le.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill",this._color);const C=le.createNS("http://www.w3.org/2000/svg","path");C.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"),w.appendChild(C);const E=le.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const R=le.createNS("http://www.w3.org/2000/svg","path");R.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"),E.appendChild(R);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 $=le.createNS("http://www.w3.org/2000/svg","g");$.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"),$.appendChild(H),$.appendChild(q),g.appendChild(y),g.appendChild(w),g.appendChild(E),g.appendChild(F),g.appendChild($),n.appendChild(g),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(n),this._offset=c.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),Yr(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",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(t){return this._lngLat=c.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const a=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[a,-1*(38.1-13.5+a)],"bottom-right":[-a,-1*(38.1-13.5+a)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,o;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const a=this._map,h=a.terrain.depthAtPoint(this._pos),g=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,g)-h<.006)return void(this._element.style.opacity=this._opacity);const y=-this._offset.y/a.transform._pixelPerMeter,b=Math.sin(a.getPitch()*Math.PI/180)*y,w=a.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),C=a.transform.lngLatToCameraDepth(this._lngLat,g+b)-w>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&C&&this._popup.remove(),this._element.style.opacity=C?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=c.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return t===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const xo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Un=0,jn=!1;const Kl={maxWidth:100,unit:"metric"};function Ba(u,t,n){const o=n&&n.maxWidth||100,a=u._container.clientHeight/2,h=u.unproject([0,a]),g=u.unproject([o,a]),y=h.distanceTo(g);if(n&&n.unit==="imperial"){const b=3.2808*y;b>5280?Ms(t,o,b/5280,u._getUIString("ScaleControl.Miles")):Ms(t,o,b,u._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Ms(t,o,y/1852,u._getUIString("ScaleControl.NauticalMiles")):y>=1e3?Ms(t,o,y/1e3,u._getUIString("ScaleControl.Kilometers")):Ms(t,o,y,u._getUIString("ScaleControl.Meters"))}function Ms(u,t,n,o){const a=function(h){const g=Math.pow(10,`${Math.floor(h)}`.length-1);let y=h/g;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(b){const w=Math.pow(10,Math.ceil(-Math.log(b)/Math.LN10));return Math.round(b*w)/w}(y),g*y}(n);u.style.width=t*(a/n)+"px",u.innerHTML=`${a} ${o}`}const br={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},vo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function qe(u){if(u){if(typeof u=="number"){const t=Math.round(Math.abs(u)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,u),"top-left":new c.P(t,t),"top-right":new c.P(-t,t),bottom:new c.P(0,-u),"bottom-left":new c.P(t,-t),"bottom-right":new c.P(-t,-t),left:new c.P(u,0),right:new c.P(-u,0)}}if(u instanceof c.P||Array.isArray(u)){const t=c.P.convert(u);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:c.P.convert(u.center||[0,0]),top:c.P.convert(u.top||[0,0]),"top-left":c.P.convert(u["top-left"]||[0,0]),"top-right":c.P.convert(u["top-right"]||[0,0]),bottom:c.P.convert(u.bottom||[0,0]),"bottom-left":c.P.convert(u["bottom-left"]||[0,0]),"bottom-right":c.P.convert(u["bottom-right"]||[0,0]),left:c.P.convert(u.left||[0,0]),right:c.P.convert(u.right||[0,0])}}return qe(new c.P(0,0))}const Je=fe;S.AJAXError=c.bg,S.Evented=c.E,S.LngLat=c.N,S.MercatorCoordinate=c.Z,S.Point=c.P,S.addProtocol=c.bh,S.config=c.a,S.removeProtocol=c.bi,S.AttributionControl=$n,S.BoxZoomHandler=ga,S.CanvasSource=Wi,S.CooperativeGesturesHandler=rr,S.DoubleClickZoomHandler=Ea,S.DragPanHandler=Ji,S.DragRotateHandler=ir,S.EdgeInsets=uo,S.FullscreenControl=class extends c.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var t;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=n==null?void 0:n.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===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:c.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 c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("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=os,S.GeolocateControl=class extends c.E{constructor(u){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new c.N(t.coords.longitude,t.coords.latitude),o=t.coords.accuracy,a=this._map.getBearing(),h=c.e({bearing:a},this.options.fitBoundsOptions),g=ue.fromLngLat(n,o);this._map.fitBounds(g,h,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new c.N(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&jn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.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=t=>{if(this._map){if(t===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}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 Pt({element:this._dotElement}),this._circleElement=le.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Pt({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",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.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 c.k("trackuserlocationend")),this.fire(new c.k("userlocationlostfocus")))})}},this.options=c.e({},xo,u)}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(t=!1){if(Kr!==void 0&&!t)return Kr;if(window.navigator.permissions===void 0)return Kr=!!window.navigator.geolocation,Kr;try{Kr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Kr=!!window.navigator.geolocation}return Kr})}().then(t=>this._finishSetupUI(t)),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,Un=0,jn=!1}_isOutOfMapMaxBounds(u){const t=this._map.getMaxBounds(),n=u.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.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(),t=u.getSouthEast(),n=u.getNorthEast(),o=t.distanceTo(n),a=Math.ceil(this._accuracy/(o/this._map._container.clientHeight)*2);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}trigger(){if(!this._setup)return c.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 c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Un--,jn=!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 c.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.k("trackuserlocationstart")),this.fire(new c.k("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"),Un++,Un>1?(u={maximumAge:6e5,timeout:0},jn=!0):(u=this.options.positionOptions,jn=!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.Hash=Ss,S.ImageSource=Ar,S.KeyboardHandler=ka,S.LngLatBounds=ue,S.LogoControl=xr,S.Map=class extends nh{constructor(u){c.be.mark(c.bf.create);const t=Object.assign(Object.assign({},sh),u);if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ua(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Fe,this._controls=[],this._mapId=c.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=t.preserveDrawingBuffer===!0,this._antialias=t.antialias===!0,this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ze),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=He.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ft(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;const o=po(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{n?o(a):n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new rh(this,t),this._hash=t.hash&&new Ss(typeof t.hash=="string"&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,c.e({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new $n(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new xr,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new c.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new c.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new c.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(u,t){if(t===void 0&&(t=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=u.onAdd(this);this._controls.push(u);const o=this._controlPositions[t];return t.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(u);return t>-1&&this._controls.splice(t,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,t,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,t,n,o)}resize(u){var t;const n=this._containerDimensions(),o=n[0],a=n[1],h=this._getClampedPixelRatio(o,a);if(this._resizeCanvas(o,a,h),this.painter.resize(o,a,h),this.painter.overLimit()){const y=this.painter.context.gl;this._maxCanvasSize=[y.drawingBufferWidth,y.drawingBufferHeight];const b=this._getClampedPixelRatio(o,a);this._resizeCanvas(o,a,b),this.painter.resize(o,a,b)}this.transform.resize(o,a),(t=this._requestedCameraState)===null||t===void 0||t.resize(o,a);const g=!this._moving;return g&&(this.stop(),this.fire(new c.k("movestart",u)).fire(new c.k("move",u))),this.fire(new c.k("resize",u)),g&&this.fire(new c.k("moveend",u)),this}_getClampedPixelRatio(u,t){const{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),h=u*a,g=t*a;return Math.min(h>n?n/h:1,g>o?o/g:1)*a}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(ue.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.minZoom=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.maxZoom=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.minPitch=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)>85)throw new Error("maxPitch must be less than or equal to 85");if(u>=this.transform.minPitch)return this.transform.maxPitch=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.renderWorldCopies=u,this._update()}project(u){return this.transform.locationPoint(c.N.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.pointLocation(c.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,t,n){if(u==="mouseenter"||u==="mouseover"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:h=>{const g=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];g.length?o||(o=!0,n.call(this,new Ti(u,this,h.originalEvent,{features:g}))):o=!1},mouseout:()=>{o=!1}}}}if(u==="mouseleave"||u==="mouseout"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:g=>{(this.getLayer(t)?this.queryRenderedFeatures(g.point,{layers:[t]}):[]).length?o=!0:o&&(o=!1,n.call(this,new Ti(u,this,g.originalEvent)))},mouseout:g=>{o&&(o=!1,n.call(this,new Ti(u,this,g.originalEvent)))}}}}{const o=a=>{const h=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];h.length&&(a.features=h,n.call(this,a),delete a.features)};return{layer:t,listener:n,delegates:{[u]:o}}}}on(u,t,n){if(n===void 0)return super.on(u,t);const o=this._createDelegatedListener(u,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(o);for(const a in o.delegates)this.on(a,o.delegates[a]);return this}once(u,t,n){if(n===void 0)return super.once(u,t);const o=this._createDelegatedListener(u,t,n);for(const a in o.delegates)this.once(a,o.delegates[a]);return this}off(u,t,n){return n===void 0?super.off(u,t):(this._delegatedListeners&&this._delegatedListeners[u]&&(o=>{const a=this._delegatedListeners[u];for(let h=0;h<a.length;h++){const g=a[h];if(g.layer===t&&g.listener===n){for(const y in g.delegates)this.off(y,g.delegates[y]);return a.splice(h,1),this}}})(),this)}queryRenderedFeatures(u,t){if(!this.style)return[];let n;const o=u instanceof c.P||Array.isArray(u),a=o?u:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(o?{}:u)||{},a instanceof c.P||typeof a[0]=="number")n=[c.P.convert(a)];else{const h=c.P.convert(a[0]),g=c.P.convert(a[1]);n=[h,new c.P(g.x,h.y),g,new c.P(h.x,g.y),h]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(u,t){return this.style.querySourceFeatures(u,t)}setStyle(u,t){return(t=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(u,t))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const t=this._locale[u];if(t==null)throw new Error(`Missing UI string '${u}'`);return t}_updateStyle(u,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new Go(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,t,n):this.style.loadJSON(u,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Go(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,t){if(typeof u=="string"){const n=this._requestManager.transformRequest(u,"Style");c.h(n,new AbortController).then(o=>{this._updateDiff(o.data,t)}).catch(o=>{o&&this.fire(new c.j(o))})}else typeof u=="object"&&this._updateDiff(u,t)}_updateDiff(u,t){try{this.style.setState(u,t)&&this._update(!0)}catch(n){c.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(u,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(u,t){return this._lazyInitEmptyStyle(),this.style.addSource(u,t),this._update(!0)}isSourceLoaded(u){const t=this.style&&this.style.sourceCaches[u];if(t!==void 0)return t.loaded();this.fire(new c.j(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 t=this.style.sourceCaches[u.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const o=this.style._layers[n];o.type==="hillshade"&&o.source===u.source&&c.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 Gl(this.painter,t,u),this.painter.renderToTexture=new Hl(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==u.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.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.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:u})),this}getTerrain(){var u,t;return(t=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const t in u){const n=u[t]._tiles;for(const o in n){const a=n[o];if(a.state!=="loaded"&&a.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}addImage(u,t,n={}){const{pixelRatio:o=1,sdf:a=!1,stretchX:h,stretchY:g,content:y,textFitWidth:b,textFitHeight:w}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||c.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:C,height:E,data:R}=t,F=t;return this.style.addImage(u,{data:new c.R({width:C,height:E},new Uint8Array(R)),pixelRatio:o,stretchX:h,stretchY:g,content:y,textFitWidth:b,textFitHeight:w,sdf:a,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:C,height:E,data:R}=ae.getImageData(t);this.style.addImage(u,{data:new c.R({width:C,height:E},R),pixelRatio:o,stretchX:h,stretchY:g,content:y,textFitWidth:b,textFitHeight:w,sdf:a,version:0})}}updateImage(u,t){const n=this.style.getImage(u);if(!n)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=t instanceof HTMLImageElement||c.b(t)?ae.getImageData(t):t,{width:a,height:h,data:g}=o;if(a===void 0||h===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==n.data.width||h!==n.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||c.b(t));return n.data.replace(g,y),this.style.updateImage(u,n),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return He.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,t){return this._lazyInitEmptyStyle(),this.style.addLayer(u,t),this._update(!0)}moveLayer(u,t){return this.style.moveLayer(u,t),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,t,n){return this.style.setLayerZoomRange(u,t,n),this._update(!0)}setFilter(u,t,n={}){return this.style.setFilter(u,t,n),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,t,n,o={}){return this.style.setPaintProperty(u,t,n,o),this._update(!0)}getPaintProperty(u,t){return this.style.getPaintProperty(u,t)}setLayoutProperty(u,t,n,o={}){return this.style.setLayoutProperty(u,t,n,o),this._update(!0)}getLayoutProperty(u,t){return this.style.getLayoutProperty(u,t)}setGlyphs(u,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,t,n,o=>{o||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,t,n=>{n||this._update(!0)}),this}setLight(u,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(u){return this._lazyInitEmptyStyle(),this.style.setSky(u),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,t){return this.style.setFeatureState(u,t),this._update()}removeFeatureState(u,t){return this.style.removeFeatureState(u,t),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,t=0;return this._container&&(u=this._container.clientWidth||400,t=this._container.clientHeight||300),[u,t]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const t=this._canvasContainer=le.create("div","maplibregl-canvas-container",u);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=le.create("canvas","maplibregl-canvas",t),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 n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);const a=this._controlContainer=le.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(g=>{h[g]=le.create("div",`maplibregl-ctrl-${g} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,t,n){this._canvas.width=Math.floor(n*u),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const u={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{t={requestedAttributes:u},o&&(t.statusMessage=o.statusMessage,t.type=o.type)},{once:!0});const n=this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u);if(!n){const o="Failed to initialize WebGL";throw t?(t.message=o,new Error(JSON.stringify(t))):new Error(o)}this.painter=new Vl(n,this.transform),dt.testSupport(n)}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){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const a=this.transform.zoom,h=ae.now();this.style.zoomHistory.update(a,h);const g=new c.a9(a,{now:h,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=g.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),this.style.update(g)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.be.mark(c.bf.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||o||(this._fullyLoaded=!0,c.be.mark(c.bf.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 n of this._controls)n.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),He.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.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.classList.remove("maplibregl-map"),c.be.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ae.frameAsync(this._frameRequest).then(u=>{c.be.frame(u),this._frameRequest=null,this._render(u)}).catch(()=>{}))}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 Da}getCameraTargetElevation(){return this.transform.elevation}},S.MapMouseEvent=Ti,S.MapTouchEvent=Ts,S.MapWheelEvent=fa,S.Marker=Pt,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),o=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,n)=>{const o=this._map._getUIString(`NavigationControl.${n}`);t.title=o,t.setAttribute("aria-label",o)},this.options=c.e({},La,u),this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),le.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),le.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Xl(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._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,t){const n=le.create("button",u,this._container);return n.type="button",n.addEventListener("click",t),n}},S.Popup=class extends c.E{constructor(u){super(),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 c.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var n;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 y of this.options.className.split(" "))this._container.classList.add(y);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=this._map.transform.renderWorldCopies&&!this._trackPointer?Jl(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!t)return;const o=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let a=this.options.anchor;const h=qe(this.options.offset);if(!a){const y=this._container.offsetWidth,b=this._container.offsetHeight;let w;w=o.y+h.bottom.y<b?["top"]:o.y>this._map.transform.height-b?["bottom"]:[],o.x<y/2?w.push("left"):o.x>this._map.transform.width-y/2&&w.push("right"),a=w.length===0?"bottom":w.join("-")}let g=o.add(h[a]);this.options.subpixelPositioning||(g=g.round()),le.setTransform(this._container,`${Ra[a]} translate(${g.x}px,${g.y}px)`),Yr(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(br),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 c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=c.N.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 t=document.createDocumentFragment(),n=document.createElement("body");let o;for(n.innerHTML=u;o=n.firstChild,o;)t.appendChild(o);return this.setDOMContent(t)}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="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(vo);u&&u.focus()}},S.RasterDEMTileSource=Ut,S.RasterTileSource=yt,S.ScaleControl=class{constructor(u){this._onMove=()=>{Ba(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Ba(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Kl),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=Ca,S.Style=Go,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=Ta,S.TwoFingersTouchRotateHandler=Sa,S.TwoFingersTouchZoomHandler=ba,S.TwoFingersTouchZoomRotateHandler=Pa,S.VectorTileSource=ss,S.VideoSource=zn,S.addSourceType=(u,t)=>c._(void 0,void 0,void 0,function*(){if(ls(u))throw new Error(`A source type called "${u}" already exists.`);((n,o)=>{as[n]=o})(u,t)}),S.clearPrewarmedResources=function(){const u=Oi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release($r),Oi=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.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return mr().getRTLTextPluginStatus()},S.getVersion=function(){return Je},S.getWorkerCount=function(){return pr.workerCount},S.getWorkerUrl=function(){return c.a.WORKER_URL},S.importScriptInWorkers=function(u){return ns().broadcast("IS",u)},S.prewarm=function(){an().acquire($r)},S.setMaxParallelImageRequests=function(u){c.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,t){return mr().setRTLTextPlugin(u,t)},S.setWorkerCount=function(u){pr.workerCount=u},S.setWorkerUrl=function(u){c.a.WORKER_URL=u}});var j=k;return j})})(Jh);var Dp=Jh.exports;const In=zp(Dp);function Lp(f){const x=[{type:"fill",minzoom:f.pointZoom||0,paint:{"fill-color":f.color||"#ccc","fill-outline-color":f.stroke||"#blue","fill-opacity":f.opacity||1}}];return f.pointZoom&&x.push({type:"circle",maxzoom:f.pointZoom,paint:{"circle-color":f.color||"#ccc","circle-stroke-color":f.stroke||"#ccc","circle-stroke-width":f.width||1,"circle-opacity":f.opacity||1}}),f.label&&x.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),x}function Rp(f){const x=[{type:"line",paint:{"line-color":f.color||"#ccc","line-opacity":f.opacity||1}}];return f.label&&x.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"symbol-placement":"line-center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),x}function Bp(f){const x=[{type:"circle",maxzoom:f.icon&&+f.iconZoom||22,paint:{"circle-radius":f.radius||6,"circle-stroke-color":f.stroke||"#ccc","circle-stroke-width":f.width||1,"circle-color":f.color||"blue","circle-opacity":f.opacity||1}}];return f!=null&&f.clusterZoom&&(x.push({type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}}),x.push({type:"symbol",filter:["has","point_count"],layout:{"text-field":["get","point_count"],"text-font":["Open Sans Regular"],"text-size":12}})),f.icon&&x.push({type:"symbol",minzoom:+f.iconZoom||16,layout:{"icon-image":f.icon,"icon-allow-overlap":!0}}),f.label&&x.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"top"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),x}function Fp(f){if(!f)return null;const x=f.type||"point";return x==="polygon"?Lp(f):x==="line"?Rp(f):Bp(f)}const Kh=["#69D2E7","yellow","#FE4365","#125B9A","#41B3A2","#D7C3F1","#F1D3CE"],Op=["ma-star","ma-water","ma-swimming","fa-home","fa-search","fa-trash","fa-check"],Yh={};async function Qh(f,x,k="api"){const P=await fetch(`${k}/gis-layer/${f}/${x}`),{rows:D}=await P.json();return D}async function wc(f,x,k,P){if(!f)return null;const D=JSON.parse(JSON.stringify(f)),j=D.colorAttr?await Qh(x,D.colorAttr,P):null;j==null||j.forEach((c,fe)=>{var me,ve;c.color=c.color||((me=D.colorSet)==null?void 0:me[c.id])||((ve=D.colorSet)==null?void 0:ve[fe])||Kh[fe%Kh.length],c.icon=D.icon?D.icon.split("+")[0]+"+"+c.color.replace("#","")+".png":null});const S=D.iconAttr?await Qh(x,D.iconAttr,P):null;if(S==null||S.forEach((c,fe)=>{var dt,Ue,Ke,Oe;const me=c.icon||((dt=D.iconSet)==null?void 0:dt[c.id])||((Ue=D.iconPattern)==null?void 0:Ue.replace("{id}",c.id))||((Ke=D.iconSet)==null?void 0:Ke[fe])||(D.iconPrefix?null:Op[fe]);if(!me)return;const ve=c.color||((Oe=D.color)==null?void 0:Oe.replace("#",""))||"red",[ae="pin6",le="m"]=D.icon?D.icon.split("-"):[];c.icon=D.iconPrefix||me!=null&&me.includes("/")?(D.iconPrefix||"")+me:`${ae}-${le}-${me}+${ve}.png`}),D.colorAttr&&j){const c=["match",["get",D.colorAttr]];j.filter(fe=>fe.id).forEach(fe=>{c.push(fe.id),c.push(fe.color)}),c.push(D.color||"gray"),D.color=c}if(D.icon&&D.iconAttr&&S){const c=["match",["get",D.iconAttr]];S.filter(fe=>fe.icon).forEach(({id:fe,icon:me})=>{if(D.colorAttr&&j){c.push(fe);const ve=["match",["get",D.colorAttr]];j.forEach(ae=>{ve.push(ae.id);const le=me.split("+")[0]+"+"+ae.color.replace("#","")+".png";ve.push(le),Vs(le,k,P)}),ve.push(D.icon),c.push(ve)}else c.push(fe),c.push(me),Vs(me,k,P)}),c.push((D.iconPrefix||"")+D.icon),Vs((D.iconPrefix||"")+D.icon,k,P),D.icon=c}else if(D.icon&&D.colorAttr&&j){const c=["match",["get",D.colorAttr]];j.forEach(fe=>{c.push(fe.id),c.push(fe.icon),Vs(fe.icon,k,P)}),c.push(D.icon),Vs(D.icon,k,P),D.icon=c}else D.icon&&await Vs(D.icon,k,P);return Vp({style:f,colors:j,icons:S,map:k,id:x}),Fp(D)}async function Vs(f="pin4-sm-mi-plumber+f45942.png",x=null,k){if(Yh[f])return null;Yh[f]=!0;const P=await(x==null?void 0:x.loadImage(f!=null&&f.startsWith("/")||f!=null&&f.includes("//")?f:`${k}/marker_icon/${f.replace(".png","")}.png`));x==null||x.addImage(f,P.data)}function Vp({style:f,colors:x,icons:k,map:P,id:D}){P.legend||Object.assign(P,{legend:{}}),window.map||(window.map=P),Object.assign(P.legend,{[D]:{icon:f.icon,colors:x,icons:k,color:f.color||"blue",type:f.type||"point"}})}const Oo={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(f=>f==null?void 0:f.interactive).map(f=>f.id)}},methods:{moveLayer(f,x=this.map){x.getStyle().layers.forEach(k=>{k.id.match(f)&&x.moveLayer(k.id)})},async setVisible(f,x=!0,k=this.map){if(!f)return;const P=(f==null?void 0:f.id)||f,D=this.layerList.find(S=>S.id===f)||f;if(!(D!=null&&D.id))throw new Error("MixinError: Layer has no id");k.getStyle().layers.filter(S=>S.id.match(P)).forEach(S=>{k.setLayoutProperty(S.id,"visibility",x?"visible":"none")}),x&&await this.addLayer(D)},async addLayer(f,x=this==null?void 0:this.map){var D,j;const k=this.layerList.find(S=>S.id===f)||f;!this.map.getStyle()||this.map.getStyle().layers.find(S=>S.id===k.id)||(this.layerList.find(S=>S.id===k.id)||this.layerList.push(k),(k.service==="vtile"||k.service==="vector"||(D=k.url)!=null&&D.includes(".vmt"))&&this.addVtileLayer(k,x),k.service==="geojson"&&this.addGeoJsonLayer(k,x),((j=k.url)!=null&&j.includes(".png")||["tms","raster"].includes(k.service))&&await this.addRasterLayer(k,x))},async addRasterLayer(f,x=this==null?void 0:this.map){x.getSource(f.id)||(typeof f.bounds=="string"&&Object.assign(f,{bounds:f.bounds.split(",")}),await x.addSource(f.id,{type:"raster",tiles:[`${this.prefix?f==null?void 0:f.url.replace(/(\/api[^\/]*)/,this.prefix):f==null?void 0:f.url}${f!=null&&f.url.includes("?")?"&":"?"}dt=${new Date().toISOString().split("T")[0]}`],tileSize:256,...f.bounds?{bounds:f.bounds.map(k=>k-0)}:{},...f!=null&&f.scheme?{scheme:f==null?void 0:f.scheme}:{}}),await x.addLayer({id:f.id,type:"raster",source:f.id,minzoom:0,maxzoom:(f==null?void 0:f.maxzoom)||22}))},async updateStyle(f,x=this==null?void 0:this.map){const k=f.id;x.getStyle().layers.forEach(async D=>{D.source===k&&x.getLayer(D.id)&&await x.removeLayer(D.id)}),(await wc(f.style,f.source||f.id,x,this.prefix)||f.layers||[]).forEach((D,j)=>{const S={...D,id:`${f.id}-${j}`,source:f.id,"source-layer":D["source-layer"]||f.source||f.id,maxzoom:+D.maxzoom||24,minzoom:+D.minzoom||0};x.addLayer(S)})},async addVtileLayer(f,x=this==null?void 0:this.map){var j;const k=["props","pointZoom","clusterZoom"].filter(S=>f[S]).map(S=>`&${S}=${f[S]}`),P={type:"vector",tiles:[`${(j=f==null?void 0:f.url)!=null&&j.startsWith("http")?"":window.location.origin}${f==null?void 0:f.url}${k}`],minzoom:f.minzoom||5,maxzoom:f.maxzoom||24};x.addSource(f.id,P),(f.layers||await wc(f.style,f.source||f.id,x,this.prefix)||[]).forEach((S,c)=>{const fe={...S,id:`${f.id}-${c}`,source:f.id,"source-layer":S["source-layer"]||f.source||f.id,maxzoom:+S.maxzoom||24,minzoom:+S.minzoom||0};x.addLayer(fe)})},async addGeoJsonLayer(f,x=this.map){var D;const k=f.data||((D=f==null?void 0:f.url)!=null&&D.startsWith("http")?"":window.location.origin)+f.url;x.addSource(f.id,{type:"geojson",data:k}),(await wc(f.style,k.source||k.id,x,this.prefix)||f.layers||[]).forEach(j=>{const S={...j,source:f.id,id:j.id||f.id,maxzoom:+j.maxzoom||24,minzoom:+j.minzoom||0,type:j.type||"circle"};x.addLayer(S)})},setLayerData(f,x){this.layerList=this.layerList.map(k=>k.id===f?{...k,...x}:k)},async removeLayer(f,x=this.map){x.getSource(f)&&(await x.getStyle().layers.forEach(async k=>{k.source===f&&await x.removeLayer(k.id)}),x.getSource(f)&&await x.removeSource(f))},async setFilter(f,x){const k=this.layerList.find(D=>D.id===f);await(await this.map.getSource(f)).setTiles([`${window.location.origin}${k.url}${k.url.includes("?")?"&":"?"}filter=${x}${k.props?`&props=${k.props}`:""}`])},async changeBaseLayer(f){f!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.setVisible(this.activeLayer,!1),await this.setVisible(f,!0),this.map.getStyle().layers.forEach(x=>{x.source!==f&&x.type!=="background"&&this.map.moveLayer(x.id)}),this.activeLayer=f)},async refreshLayer(f,x=this.map){await x.getStyle().layers.forEach(k=>{k.source===f&&x.removeLayer(k.id)}),x.getSource(f)&&await x.removeSource(f),this.setVisible(f)}}},Fi=(f,x)=>{const k=f.__vccOpts||f;for(const[P,D]of x)k[P]=D;return k},Np={},$p={class:"w-48 mx-auto mb-4",width:"178",height:"90",viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Up=[N.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter2)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter2" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)];function jp(f,x){return N.openBlock(),N.createElementBlock("svg",$p,Up)}const qp=Fi(Np,[["render",jp]]);function eu(f,x){return function(){return f.apply(x,arguments)}}const{toString:Zp}=Object.prototype,{getPrototypeOf:Sc}=Object,ol=(f=>x=>{const k=Zp.call(x);return f[k]||(f[k]=k.slice(8,-1).toLowerCase())})(Object.create(null)),kr=f=>(f=f.toLowerCase(),x=>ol(x)===f),al=f=>x=>typeof x===f,{isArray:Ns}=Array,Vo=al("undefined");function Gp(f){return f!==null&&!Vo(f)&&f.constructor!==null&&!Vo(f.constructor)&&Yi(f.constructor.isBuffer)&&f.constructor.isBuffer(f)}const tu=kr("ArrayBuffer");function Hp(f){let x;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?x=ArrayBuffer.isView(f):x=f&&f.buffer&&tu(f.buffer),x}const Wp=al("string"),Yi=al("function"),iu=al("number"),ll=f=>f!==null&&typeof f=="object",Xp=f=>f===!0||f===!1,cl=f=>{if(ol(f)!=="object")return!1;const x=Sc(f);return(x===null||x===Object.prototype||Object.getPrototypeOf(x)===null)&&!(Symbol.toStringTag in f)&&!(Symbol.iterator in f)},Jp=kr("Date"),Kp=kr("File"),Yp=kr("Blob"),Qp=kr("FileList"),ef=f=>ll(f)&&Yi(f.pipe),tf=f=>{let x;return f&&(typeof FormData=="function"&&f instanceof FormData||Yi(f.append)&&((x=ol(f))==="formdata"||x==="object"&&Yi(f.toString)&&f.toString()==="[object FormData]"))},rf=kr("URLSearchParams"),[nf,sf,of,af]=["ReadableStream","Request","Response","Headers"].map(kr),lf=f=>f.trim?f.trim():f.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function No(f,x,{allOwnKeys:k=!1}={}){if(f===null||typeof f>"u")return;let P,D;if(typeof f!="object"&&(f=[f]),Ns(f))for(P=0,D=f.length;P<D;P++)x.call(null,f[P],P,f);else{const j=k?Object.getOwnPropertyNames(f):Object.keys(f),S=j.length;let c;for(P=0;P<S;P++)c=j[P],x.call(null,f[c],c,f)}}function ru(f,x){x=x.toLowerCase();const k=Object.keys(f);let P=k.length,D;for(;P-- >0;)if(D=k[P],x===D.toLowerCase())return D;return null}const ts=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nu=f=>!Vo(f)&&f!==ts;function Tc(){const{caseless:f}=nu(this)&&this||{},x={},k=(P,D)=>{const j=f&&ru(x,D)||D;cl(x[j])&&cl(P)?x[j]=Tc(x[j],P):cl(P)?x[j]=Tc({},P):Ns(P)?x[j]=P.slice():x[j]=P};for(let P=0,D=arguments.length;P<D;P++)arguments[P]&&No(arguments[P],k);return x}const cf=(f,x,k,{allOwnKeys:P}={})=>(No(x,(D,j)=>{k&&Yi(D)?f[j]=eu(D,k):f[j]=D},{allOwnKeys:P}),f),hf=f=>(f.charCodeAt(0)===65279&&(f=f.slice(1)),f),uf=(f,x,k,P)=>{f.prototype=Object.create(x.prototype,P),f.prototype.constructor=f,Object.defineProperty(f,"super",{value:x.prototype}),k&&Object.assign(f.prototype,k)},df=(f,x,k,P)=>{let D,j,S;const c={};if(x=x||{},f==null)return x;do{for(D=Object.getOwnPropertyNames(f),j=D.length;j-- >0;)S=D[j],(!P||P(S,f,x))&&!c[S]&&(x[S]=f[S],c[S]=!0);f=k!==!1&&Sc(f)}while(f&&(!k||k(f,x))&&f!==Object.prototype);return x},pf=(f,x,k)=>{f=String(f),(k===void 0||k>f.length)&&(k=f.length),k-=x.length;const P=f.indexOf(x,k);return P!==-1&&P===k},ff=f=>{if(!f)return null;if(Ns(f))return f;let x=f.length;if(!iu(x))return null;const k=new Array(x);for(;x-- >0;)k[x]=f[x];return k},mf=(f=>x=>f&&x instanceof f)(typeof Uint8Array<"u"&&Sc(Uint8Array)),gf=(f,x)=>{const P=(f&&f[Symbol.iterator]).call(f);let D;for(;(D=P.next())&&!D.done;){const j=D.value;x.call(f,j[0],j[1])}},_f=(f,x)=>{let k;const P=[];for(;(k=f.exec(x))!==null;)P.push(k);return P},yf=kr("HTMLFormElement"),xf=f=>f.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(k,P,D){return P.toUpperCase()+D}),su=(({hasOwnProperty:f})=>(x,k)=>f.call(x,k))(Object.prototype),vf=kr("RegExp"),ou=(f,x)=>{const k=Object.getOwnPropertyDescriptors(f),P={};No(k,(D,j)=>{let S;(S=x(D,j,f))!==!1&&(P[j]=S||D)}),Object.defineProperties(f,P)},bf=f=>{ou(f,(x,k)=>{if(Yi(f)&&["arguments","caller","callee"].indexOf(k)!==-1)return!1;const P=f[k];if(Yi(P)){if(x.enumerable=!1,"writable"in x){x.writable=!1;return}x.set||(x.set=()=>{throw Error("Can not rewrite read-only method '"+k+"'")})}})},wf=(f,x)=>{const k={},P=D=>{D.forEach(j=>{k[j]=!0})};return Ns(f)?P(f):P(String(f).split(x)),k},Sf=()=>{},Tf=(f,x)=>f!=null&&Number.isFinite(f=+f)?f:x,kc="abcdefghijklmnopqrstuvwxyz",au="0123456789",lu={DIGIT:au,ALPHA:kc,ALPHA_DIGIT:kc+kc.toUpperCase()+au},kf=(f=16,x=lu.ALPHA_DIGIT)=>{let k="";const{length:P}=x;for(;f--;)k+=x[Math.random()*P|0];return k};function If(f){return!!(f&&Yi(f.append)&&f[Symbol.toStringTag]==="FormData"&&f[Symbol.iterator])}const Cf=f=>{const x=new Array(10),k=(P,D)=>{if(ll(P)){if(x.indexOf(P)>=0)return;if(!("toJSON"in P)){x[D]=P;const j=Ns(P)?[]:{};return No(P,(S,c)=>{const fe=k(S,D+1);!Vo(fe)&&(j[c]=fe)}),x[D]=void 0,j}}return P};return k(f,0)},Ef=kr("AsyncFunction"),Pf=f=>f&&(ll(f)||Yi(f))&&Yi(f.then)&&Yi(f.catch),cu=((f,x)=>f?setImmediate:x?((k,P)=>(ts.addEventListener("message",({source:D,data:j})=>{D===ts&&j===k&&P.length&&P.shift()()},!1),D=>{P.push(D),ts.postMessage(k,"*")}))(`axios@${Math.random()}`,[]):k=>setTimeout(k))(typeof setImmediate=="function",Yi(ts.postMessage)),Af=typeof queueMicrotask<"u"?queueMicrotask.bind(ts):typeof process<"u"&&process.nextTick||cu,ge={isArray:Ns,isArrayBuffer:tu,isBuffer:Gp,isFormData:tf,isArrayBufferView:Hp,isString:Wp,isNumber:iu,isBoolean:Xp,isObject:ll,isPlainObject:cl,isReadableStream:nf,isRequest:sf,isResponse:of,isHeaders:af,isUndefined:Vo,isDate:Jp,isFile:Kp,isBlob:Yp,isRegExp:vf,isFunction:Yi,isStream:ef,isURLSearchParams:rf,isTypedArray:mf,isFileList:Qp,forEach:No,merge:Tc,extend:cf,trim:lf,stripBOM:hf,inherits:uf,toFlatObject:df,kindOf:ol,kindOfTest:kr,endsWith:pf,toArray:ff,forEachEntry:gf,matchAll:_f,isHTMLForm:yf,hasOwnProperty:su,hasOwnProp:su,reduceDescriptors:ou,freezeMethods:bf,toObjectSet:wf,toCamelCase:xf,noop:Sf,toFiniteNumber:Tf,findKey:ru,global:ts,isContextDefined:nu,ALPHABET:lu,generateString:kf,isSpecCompliantForm:If,toJSONObject:Cf,isAsyncFn:Ef,isThenable:Pf,setImmediate:cu,asap:Af};function ct(f,x,k,P,D){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=f,this.name="AxiosError",x&&(this.code=x),k&&(this.config=k),P&&(this.request=P),D&&(this.response=D)}ge.inherits(ct,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ge.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const hu=ct.prototype,uu={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(f=>{uu[f]={value:f}}),Object.defineProperties(ct,uu),Object.defineProperty(hu,"isAxiosError",{value:!0}),ct.from=(f,x,k,P,D,j)=>{const S=Object.create(hu);return ge.toFlatObject(f,S,function(fe){return fe!==Error.prototype},c=>c!=="isAxiosError"),ct.call(S,f.message,x,k,P,D),S.cause=f,S.name=f.name,j&&Object.assign(S,j),S};const Mf=null;function Ic(f){return ge.isPlainObject(f)||ge.isArray(f)}function du(f){return ge.endsWith(f,"[]")?f.slice(0,-2):f}function pu(f,x,k){return f?f.concat(x).map(function(D,j){return D=du(D),!k&&j?"["+D+"]":D}).join(k?".":""):x}function zf(f){return ge.isArray(f)&&!f.some(Ic)}const Df=ge.toFlatObject(ge,{},null,function(x){return/^is[A-Z]/.test(x)});function hl(f,x,k){if(!ge.isObject(f))throw new TypeError("target must be an object");x=x||new FormData,k=ge.toFlatObject(k,{metaTokens:!0,dots:!1,indexes:!1},!1,function(Ke,Oe){return!ge.isUndefined(Oe[Ke])});const P=k.metaTokens,D=k.visitor||ve,j=k.dots,S=k.indexes,fe=(k.Blob||typeof Blob<"u"&&Blob)&&ge.isSpecCompliantForm(x);if(!ge.isFunction(D))throw new TypeError("visitor must be a function");function me(Ue){if(Ue===null)return"";if(ge.isDate(Ue))return Ue.toISOString();if(!fe&&ge.isBlob(Ue))throw new ct("Blob is not supported. Use a Buffer instead.");return ge.isArrayBuffer(Ue)||ge.isTypedArray(Ue)?fe&&typeof Blob=="function"?new Blob([Ue]):Buffer.from(Ue):Ue}function ve(Ue,Ke,Oe){let ft=Ue;if(Ue&&!Oe&&typeof Ue=="object"){if(ge.endsWith(Ke,"{}"))Ke=P?Ke:Ke.slice(0,-2),Ue=JSON.stringify(Ue);else if(ge.isArray(Ue)&&zf(Ue)||(ge.isFileList(Ue)||ge.endsWith(Ke,"[]"))&&(ft=ge.toArray(Ue)))return Ke=du(Ke),ft.forEach(function(He,Ft){!(ge.isUndefined(He)||He===null)&&x.append(S===!0?pu([Ke],Ft,j):S===null?Ke:Ke+"[]",me(He))}),!1}return Ic(Ue)?!0:(x.append(pu(Oe,Ke,j),me(Ue)),!1)}const ae=[],le=Object.assign(Df,{defaultVisitor:ve,convertValue:me,isVisitable:Ic});function dt(Ue,Ke){if(!ge.isUndefined(Ue)){if(ae.indexOf(Ue)!==-1)throw Error("Circular reference detected in "+Ke.join("."));ae.push(Ue),ge.forEach(Ue,function(ft,st){(!(ge.isUndefined(ft)||ft===null)&&D.call(x,ft,ge.isString(st)?st.trim():st,Ke,le))===!0&&dt(ft,Ke?Ke.concat(st):[st])}),ae.pop()}}if(!ge.isObject(f))throw new TypeError("data must be an object");return dt(f),x}function fu(f){const x={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(f).replace(/[!'()~]|%20|%00/g,function(P){return x[P]})}function Cc(f,x){this._pairs=[],f&&hl(f,this,x)}const mu=Cc.prototype;mu.append=function(x,k){this._pairs.push([x,k])},mu.toString=function(x){const k=x?function(P){return x.call(this,P,fu)}:fu;return this._pairs.map(function(D){return k(D[0])+"="+k(D[1])},"").join("&")};function Lf(f){return encodeURIComponent(f).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function gu(f,x,k){if(!x)return f;const P=k&&k.encode||Lf,D=k&&k.serialize;let j;if(D?j=D(x,k):j=ge.isURLSearchParams(x)?x.toString():new Cc(x,k).toString(P),j){const S=f.indexOf("#");S!==-1&&(f=f.slice(0,S)),f+=(f.indexOf("?")===-1?"?":"&")+j}return f}class _u{constructor(){this.handlers=[]}use(x,k,P){return this.handlers.push({fulfilled:x,rejected:k,synchronous:P?P.synchronous:!1,runWhen:P?P.runWhen:null}),this.handlers.length-1}eject(x){this.handlers[x]&&(this.handlers[x]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(x){ge.forEach(this.handlers,function(P){P!==null&&x(P)})}}const yu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Rf={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Cc,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ec=typeof window<"u"&&typeof document<"u",Bf=(f=>Ec&&["ReactNative","NativeScript","NS"].indexOf(f)<0)(typeof navigator<"u"&&navigator.product),Ff=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Of=Ec&&window.location.href||"http://localhost",Ir={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ec,hasStandardBrowserEnv:Bf,hasStandardBrowserWebWorkerEnv:Ff,origin:Of},Symbol.toStringTag,{value:"Module"})),...Rf};function Vf(f,x){return hl(f,new Ir.classes.URLSearchParams,Object.assign({visitor:function(k,P,D,j){return Ir.isNode&&ge.isBuffer(k)?(this.append(P,k.toString("base64")),!1):j.defaultVisitor.apply(this,arguments)}},x))}function Nf(f){return ge.matchAll(/\w+|\[(\w*)]/g,f).map(x=>x[0]==="[]"?"":x[1]||x[0])}function $f(f){const x={},k=Object.keys(f);let P;const D=k.length;let j;for(P=0;P<D;P++)j=k[P],x[j]=f[j];return x}function xu(f){function x(k,P,D,j){let S=k[j++];if(S==="__proto__")return!0;const c=Number.isFinite(+S),fe=j>=k.length;return S=!S&&ge.isArray(D)?D.length:S,fe?(ge.hasOwnProp(D,S)?D[S]=[D[S],P]:D[S]=P,!c):((!D[S]||!ge.isObject(D[S]))&&(D[S]=[]),x(k,P,D[S],j)&&ge.isArray(D[S])&&(D[S]=$f(D[S])),!c)}if(ge.isFormData(f)&&ge.isFunction(f.entries)){const k={};return ge.forEachEntry(f,(P,D)=>{x(Nf(P),D,k,0)}),k}return null}function Uf(f,x,k){if(ge.isString(f))try{return(x||JSON.parse)(f),ge.trim(f)}catch(P){if(P.name!=="SyntaxError")throw P}return(k||JSON.stringify)(f)}const $o={transitional:yu,adapter:["xhr","http","fetch"],transformRequest:[function(x,k){const P=k.getContentType()||"",D=P.indexOf("application/json")>-1,j=ge.isObject(x);if(j&&ge.isHTMLForm(x)&&(x=new FormData(x)),ge.isFormData(x))return D?JSON.stringify(xu(x)):x;if(ge.isArrayBuffer(x)||ge.isBuffer(x)||ge.isStream(x)||ge.isFile(x)||ge.isBlob(x)||ge.isReadableStream(x))return x;if(ge.isArrayBufferView(x))return x.buffer;if(ge.isURLSearchParams(x))return k.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),x.toString();let c;if(j){if(P.indexOf("application/x-www-form-urlencoded")>-1)return Vf(x,this.formSerializer).toString();if((c=ge.isFileList(x))||P.indexOf("multipart/form-data")>-1){const fe=this.env&&this.env.FormData;return hl(c?{"files[]":x}:x,fe&&new fe,this.formSerializer)}}return j||D?(k.setContentType("application/json",!1),Uf(x)):x}],transformResponse:[function(x){const k=this.transitional||$o.transitional,P=k&&k.forcedJSONParsing,D=this.responseType==="json";if(ge.isResponse(x)||ge.isReadableStream(x))return x;if(x&&ge.isString(x)&&(P&&!this.responseType||D)){const S=!(k&&k.silentJSONParsing)&&D;try{return JSON.parse(x)}catch(c){if(S)throw c.name==="SyntaxError"?ct.from(c,ct.ERR_BAD_RESPONSE,this,null,this.response):c}}return x}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ir.classes.FormData,Blob:Ir.classes.Blob},validateStatus:function(x){return x>=200&&x<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ge.forEach(["delete","get","head","post","put","patch"],f=>{$o.headers[f]={}});const jf=ge.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),qf=f=>{const x={};let k,P,D;return f&&f.split(`
|
580
|
+
`),U=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(U,X),y.compileShader(U),!y.getShaderParameter(U,y.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${y.getShaderInfoLog(U)}`);y.attachShader(this.program,U);const te=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(te,Y),y.compileShader(te),!y.getShaderParameter(te,y.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${y.getShaderInfoLog(te)}`);y.attachShader(this.program,te),this.attributes={};const se={};this.numAttributes=C.length;for(let ce=0;ce<this.numAttributes;ce++)C[ce]&&(y.bindAttribLocation(this.program,ce,C[ce]),this.attributes[C[ce]]=ce);if(y.linkProgram(this.program),!y.getProgramParameter(this.program,y.LINK_STATUS))throw new Error(`Program failed to link: ${y.getProgramInfoLog(this.program)}`);y.deleteShader(te),y.deleteShader(U);for(let ce=0;ce<H.length;ce++){const ye=H[ce];if(ye&&!se[ye]){const we=y.getUniformLocation(this.program,ye);we&&(se[ye]=we)}}this.fixedUniforms=a(t,se),this.terrainUniforms=((ce,ye)=>({u_depth:new c.aI(ce,ye.u_depth),u_terrain:new c.aI(ce,ye.u_terrain),u_terrain_dim:new c.aJ(ce,ye.u_terrain_dim),u_terrain_matrix:new c.aK(ce,ye.u_terrain_matrix),u_terrain_unpack:new c.aL(ce,ye.u_terrain_unpack),u_terrain_exaggeration:new c.aJ(ce,ye.u_terrain_exaggeration)}))(t,se),this.binderUniforms=o?o.getUniforms(t,se):[]}draw(t,n,o,a,h,g,y,b,w,C,E,R,F,$,H,q,X,Y){const U=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(o),t.setStencilMode(a),t.setColorMode(h),t.setCullFace(g),b){t.activeTexture.set(U.TEXTURE2),U.bindTexture(U.TEXTURE_2D,b.depthTexture),t.activeTexture.set(U.TEXTURE3),U.bindTexture(U.TEXTURE_2D,b.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(b[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(y[se]);H&&H.setUniforms(t,this.binderUniforms,F,{zoom:$});let te=0;switch(n){case U.LINES:te=2;break;case U.TRIANGLES:te=3;break;case U.LINE_STRIP:te=1}for(const se of R.get()){const ce=se.vaos||(se.vaos={});(ce[w]||(ce[w]=new Gs)).bind(t,this,C,H?H.getPaintVertexBuffers():[],E,se.vertexOffset,q,X,Y),U.drawElements(n,se.primitiveLength*te,U.UNSIGNED_SHORT,se.primitiveOffset*te*2)}}}function Ws(u,t,n){const o=1/rt(n,1,t.transform.tileZoom),a=Math.pow(2,n.tileID.overscaledZ),h=n.tileSize*Math.pow(2,t.transform.tileZoom)/a,g=h*(n.tileID.canonical.x+n.tileID.wrap*a),y=h*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[g>>16,y>>16],u_pixel_coord_lower:[65535&g,65535&y]}}const Xs=(u,t,n,o)=>{const a=t.style.light,h=a.properties.get("position"),g=[h.x,h.y,h.z],y=function(){var w=new c.A(9);return c.A!=Float32Array&&(w[1]=0,w[2]=0,w[3]=0,w[5]=0,w[6]=0,w[7]=0),w[0]=1,w[4]=1,w[8]=1,w}();a.properties.get("anchor")==="viewport"&&function(w,C){var E=Math.sin(C),R=Math.cos(C);w[0]=R,w[1]=E,w[2]=0,w[3]=-E,w[4]=R,w[5]=0,w[6]=0,w[7]=0,w[8]=1}(y,-t.transform.angle),function(w,C,E){var R=C[0],F=C[1],$=C[2];w[0]=R*E[0]+F*E[3]+$*E[6],w[1]=R*E[1]+F*E[4]+$*E[7],w[2]=R*E[2]+F*E[5]+$*E[8]}(g,g,y);const b=a.properties.get("color");return{u_matrix:u,u_lightpos:g,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_vertical_gradient:+n,u_opacity:o}},Js=(u,t,n,o,a,h,g)=>c.e(Xs(u,t,n,o),Ws(h,t,g),{u_height_factor:-Math.pow(2,a.overscaledZ)/g.tileSize/8}),fs=u=>({u_matrix:u}),Dn=(u,t,n,o)=>c.e(fs(u),Ws(n,t,o)),$c=(u,t)=>({u_matrix:u,u_world:t}),Uc=(u,t,n,o,a)=>c.e(Dn(u,t,n,o),{u_world:a}),_l=(u,t,n,o)=>{const a=u.transform;let h,g;if(o.paint.get("circle-pitch-alignment")==="map"){const y=rt(n,1,a.zoom);h=!0,g=[y,y]}else h=!1,g=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(o.paint.get("circle-pitch-scale")==="map"),u_matrix:u.translatePosMatrix(t.posMatrix,n,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_pitch_with_map:+h,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:g}},jc=(u,t,n)=>({u_matrix:u,u_inv_matrix:t,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),Xr=(u,t,n=1)=>({u_matrix:u,u_color:t,u_overlay:0,u_overlay_scale:n}),ms=u=>({u_matrix:u}),Ui=(u,t,n,o)=>({u_matrix:u,u_extrude_scale:rt(t,1,n),u_intensity:o});function ji(u,t){const n=Math.pow(2,t.canonical.z),o=t.canonical.y;return[new c.Z(0,o/n).toLngLat().lat,new c.Z(0,(o+1)/n).toLngLat().lat]}const gs=(u,t,n,o)=>{const a=u.transform;return{u_matrix:vl(u,t,n,o),u_ratio:1/rt(t,1,a.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Ks=(u,t,n,o,a)=>c.e(gs(u,t,n,a),{u_image:0,u_image_height:o}),yl=(u,t,n,o,a)=>{const h=u.transform,g=un(t,h);return{u_matrix:vl(u,t,n,a),u_texsize:t.imageAtlasTexture.size,u_ratio:1/rt(t,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[g,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},xl=(u,t,n,o,a,h)=>{const g=u.lineAtlas,y=un(t,u.transform),b=n.layout.get("line-cap")==="round",w=g.getDash(o.from,b),C=g.getDash(o.to,b),E=w.width*a.fromScale,R=C.width*a.toScale;return c.e(gs(u,t,n,h),{u_patternscale_a:[y/E,-w.height/2],u_patternscale_b:[y/R,-C.height/2],u_sdfgamma:g.width/(256*Math.min(E,R)*u.pixelRatio)/2,u_image:0,u_tex_y_a:w.y,u_tex_y_b:C.y,u_mix:a.t})};function un(u,t){return 1/rt(u,1,t.tileZoom)}function vl(u,t,n,o){return u.translatePosMatrix(o?o.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const qc=(u,t,n,o,a)=>{return{u_matrix:u,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:o.mix,u_opacity:o.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(g=a.paint.get("raster-saturation"),g>0?1-1/(1.001-g):-g),u_contrast_factor:(h=a.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:Zc(a.paint.get("raster-hue-rotate"))};var h,g};function Zc(u){u*=Math.PI/180;const t=Math.sin(u),n=Math.cos(u);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const bl=(u,t,n,o,a,h,g,y,b,w,C,E,R,F)=>{const $=g.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:$.cameraToCenterDistance,u_pitch:$.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:$.width/$.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:b,u_coord_matrix:w,u_is_text:+E,u_pitch_with_map:+o,u_is_along_line:a,u_is_variable_anchor:h,u_texsize:R,u_texture:0,u_translation:C,u_pitched_scale:F}},wl=(u,t,n,o,a,h,g,y,b,w,C,E,R,F,$)=>{const H=g.transform;return c.e(bl(u,t,n,o,a,h,g,y,b,w,C,E,R,$),{u_gamma_scale:o?Math.cos(H._pitch)*H.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+F})},Gc=(u,t,n,o,a,h,g,y,b,w,C,E,R,F)=>c.e(wl(u,t,n,o,a,h,g,y,b,w,C,!0,E,!0,F),{u_texsize_icon:R,u_texture_icon:1}),Ys=(u,t,n)=>({u_matrix:u,u_opacity:t,u_color:n}),Wo=(u,t,n,o,a,h)=>c.e(function(g,y,b,w){const C=b.imageManager.getPattern(g.from.toString()),E=b.imageManager.getPattern(g.to.toString()),{width:R,height:F}=b.imageManager.getPixelSize(),$=Math.pow(2,w.tileID.overscaledZ),H=w.tileSize*Math.pow(2,b.transform.tileZoom)/$,q=H*(w.tileID.canonical.x+w.tileID.wrap*$),X=H*w.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:C.tl,u_pattern_br_a:C.br,u_pattern_tl_b:E.tl,u_pattern_br_b:E.br,u_texsize:[R,F],u_mix:y.t,u_pattern_size_a:C.displaySize,u_pattern_size_b:E.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/rt(w,1,b.transform.tileZoom),u_pixel_coord_upper:[q>>16,X>>16],u_pixel_coord_lower:[65535&q,65535&X]}}(o,h,n,a),{u_matrix:u,u_opacity:t}),Qs={fillExtrusion:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_lightpos:new c.aO(u,t.u_lightpos),u_lightintensity:new c.aJ(u,t.u_lightintensity),u_lightcolor:new c.aO(u,t.u_lightcolor),u_vertical_gradient:new c.aJ(u,t.u_vertical_gradient),u_opacity:new c.aJ(u,t.u_opacity)}),fillExtrusionPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_lightpos:new c.aO(u,t.u_lightpos),u_lightintensity:new c.aJ(u,t.u_lightintensity),u_lightcolor:new c.aO(u,t.u_lightcolor),u_vertical_gradient:new c.aJ(u,t.u_vertical_gradient),u_height_factor:new c.aJ(u,t.u_height_factor),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade),u_opacity:new c.aJ(u,t.u_opacity)}),fill:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix)}),fillPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),fillOutline:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world)}),fillOutlinePattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),circle:(u,t)=>({u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_scale_with_map:new c.aI(u,t.u_scale_with_map),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_extrude_scale:new c.aP(u,t.u_extrude_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_matrix:new c.aK(u,t.u_matrix)}),collisionBox:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_pixel_extrude_scale:new c.aP(u,t.u_pixel_extrude_scale)}),collisionCircle:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_inv_matrix:new c.aK(u,t.u_inv_matrix),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_viewport_size:new c.aP(u,t.u_viewport_size)}),debug:(u,t)=>({u_color:new c.aM(u,t.u_color),u_matrix:new c.aK(u,t.u_matrix),u_overlay:new c.aI(u,t.u_overlay),u_overlay_scale:new c.aJ(u,t.u_overlay_scale)}),clippingMask:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix)}),heatmap:(u,t)=>({u_extrude_scale:new c.aJ(u,t.u_extrude_scale),u_intensity:new c.aJ(u,t.u_intensity),u_matrix:new c.aK(u,t.u_matrix)}),heatmapTexture:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world),u_image:new c.aI(u,t.u_image),u_color_ramp:new c.aI(u,t.u_color_ramp),u_opacity:new c.aJ(u,t.u_opacity)}),hillshade:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_latrange:new c.aP(u,t.u_latrange),u_light:new c.aP(u,t.u_light),u_shadow:new c.aM(u,t.u_shadow),u_highlight:new c.aM(u,t.u_highlight),u_accent:new c.aM(u,t.u_accent)}),hillshadePrepare:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_dimension:new c.aP(u,t.u_dimension),u_zoom:new c.aJ(u,t.u_zoom),u_unpack:new c.aL(u,t.u_unpack)}),line:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels)}),lineGradient:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_image:new c.aI(u,t.u_image),u_image_height:new c.aJ(u,t.u_image_height)}),linePattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texsize:new c.aP(u,t.u_texsize),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_image:new c.aI(u,t.u_image),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),lineSDF:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_patternscale_a:new c.aP(u,t.u_patternscale_a),u_patternscale_b:new c.aP(u,t.u_patternscale_b),u_sdfgamma:new c.aJ(u,t.u_sdfgamma),u_image:new c.aI(u,t.u_image),u_tex_y_a:new c.aJ(u,t.u_tex_y_a),u_tex_y_b:new c.aJ(u,t.u_tex_y_b),u_mix:new c.aJ(u,t.u_mix)}),raster:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_tl_parent:new c.aP(u,t.u_tl_parent),u_scale_parent:new c.aJ(u,t.u_scale_parent),u_buffer_scale:new c.aJ(u,t.u_buffer_scale),u_fade_t:new c.aJ(u,t.u_fade_t),u_opacity:new c.aJ(u,t.u_opacity),u_image0:new c.aI(u,t.u_image0),u_image1:new c.aI(u,t.u_image1),u_brightness_low:new c.aJ(u,t.u_brightness_low),u_brightness_high:new c.aJ(u,t.u_brightness_high),u_saturation_factor:new c.aJ(u,t.u_saturation_factor),u_contrast_factor:new c.aJ(u,t.u_contrast_factor),u_spin_weights:new c.aO(u,t.u_spin_weights)}),symbolIcon:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texture:new c.aI(u,t.u_texture),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),symbolSDF:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texture:new c.aI(u,t.u_texture),u_gamma_scale:new c.aJ(u,t.u_gamma_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_is_halo:new c.aI(u,t.u_is_halo),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),symbolTextAndIcon:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texsize_icon:new c.aP(u,t.u_texsize_icon),u_texture:new c.aI(u,t.u_texture),u_texture_icon:new c.aI(u,t.u_texture_icon),u_gamma_scale:new c.aJ(u,t.u_gamma_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_is_halo:new c.aI(u,t.u_is_halo),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),background:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_opacity:new c.aJ(u,t.u_opacity),u_color:new c.aM(u,t.u_color)}),backgroundPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_opacity:new c.aJ(u,t.u_opacity),u_image:new c.aI(u,t.u_image),u_pattern_tl_a:new c.aP(u,t.u_pattern_tl_a),u_pattern_br_a:new c.aP(u,t.u_pattern_br_a),u_pattern_tl_b:new c.aP(u,t.u_pattern_tl_b),u_pattern_br_b:new c.aP(u,t.u_pattern_br_b),u_texsize:new c.aP(u,t.u_texsize),u_mix:new c.aJ(u,t.u_mix),u_pattern_size_a:new c.aP(u,t.u_pattern_size_a),u_pattern_size_b:new c.aP(u,t.u_pattern_size_b),u_scale_a:new c.aJ(u,t.u_scale_a),u_scale_b:new c.aJ(u,t.u_scale_b),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aJ(u,t.u_tile_units_to_pixels)}),terrain:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texture:new c.aI(u,t.u_texture),u_ele_delta:new c.aJ(u,t.u_ele_delta),u_fog_matrix:new c.aK(u,t.u_fog_matrix),u_fog_color:new c.aM(u,t.u_fog_color),u_fog_ground_blend:new c.aJ(u,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.aJ(u,t.u_fog_ground_blend_opacity),u_horizon_color:new c.aM(u,t.u_horizon_color),u_horizon_fog_blend:new c.aJ(u,t.u_horizon_fog_blend)}),terrainDepth:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ele_delta:new c.aJ(u,t.u_ele_delta)}),terrainCoords:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texture:new c.aI(u,t.u_texture),u_terrain_coords_id:new c.aJ(u,t.u_terrain_coords_id),u_ele_delta:new c.aJ(u,t.u_ele_delta)}),sky:(u,t)=>({u_sky_color:new c.aM(u,t.u_sky_color),u_horizon_color:new c.aM(u,t.u_horizon_color),u_horizon:new c.aJ(u,t.u_horizon),u_sky_horizon_blend:new c.aJ(u,t.u_sky_horizon_blend)})};class Xo{constructor(t,n,o){this.context=t;const a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!o,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Jo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class yr{constructor(t,n,o,a){this.length=n.length,this.attributes=o,this.itemSize=n.bytesPerElement,this.dynamicDraw=a,this.context=t;const h=t.gl;this.buffer=h.createBuffer(),t.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let o=0;o<this.attributes.length;o++){const a=n.attributes[this.attributes[o].name];a!==void 0&&t.enableVertexAttribArray(a)}}setVertexAttribPointers(t,n,o){for(let a=0;a<this.attributes.length;a++){const h=this.attributes[a],g=n.attributes[h.name];g!==void 0&&t.vertexAttribPointer(g,h.components,t[Jo[h.type]],!1,this.itemSize,h.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ko=new WeakMap;function Ln(u){var t;if(Ko.has(u))return Ko.get(u);{const n=(t=u.getParameter(u.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Ko.set(u,n),n}}class pt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class _s extends pt{getDefault(){return c.aN.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Hc extends pt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class eo extends pt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Wc extends pt{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Rn extends pt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Xc extends pt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Sl extends pt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Jc extends pt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Tl extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Yo extends pt{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class kl extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Il extends pt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Cl extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class El extends pt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class dn extends pt{getDefault(){return c.aN.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Pl extends pt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Kc extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Yc extends pt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Al extends pt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ys extends pt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Qc extends pt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class to extends pt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class eh extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class th extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ml extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class zl extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Dl extends pt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Qo extends pt{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const o=this.gl;Ln(o)?o.bindVertexArray(t):(n=o.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Ll extends pt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class io extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Dr extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class xs extends pt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class ea extends xs{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class ta extends xs{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Rl extends xs{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class ia{constructor(t,n,o,a,h){this.context=t,this.width=n,this.height=o;const g=t.gl,y=this.framebuffer=g.createFramebuffer();if(this.colorAttachment=new ea(t,y),a)this.depthAttachment=h?new Rl(t,y):new ta(t,y);else if(h)throw new Error("Stencil cannot be set without depth");if(g.checkFramebufferStatus(g.FRAMEBUFFER)!==g.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}t.deleteFramebuffer(this.framebuffer)}}class Et{constructor(t,n,o){this.blendFunction=t,this.blendColor=n,this.mask=o}}Et.Replace=[1,0],Et.disabled=new Et(Et.Replace,c.aN.transparent,[!1,!1,!1,!1]),Et.unblended=new Et(Et.Replace,c.aN.transparent,[!0,!0,!0,!0]),Et.alphaBlended=new Et([1,771],c.aN.transparent,[!0,!0,!0,!0]);class ra{constructor(t){var n,o;if(this.gl=t,this.clearColor=new _s(this),this.clearDepth=new Hc(this),this.clearStencil=new eo(this),this.colorMask=new Wc(this),this.depthMask=new Rn(this),this.stencilMask=new Xc(this),this.stencilFunc=new Sl(this),this.stencilOp=new Jc(this),this.stencilTest=new Tl(this),this.depthRange=new Yo(this),this.depthTest=new kl(this),this.depthFunc=new Il(this),this.blend=new Cl(this),this.blendFunc=new El(this),this.blendColor=new dn(this),this.blendEquation=new Pl(this),this.cullFace=new Kc(this),this.cullFaceSide=new Yc(this),this.frontFace=new Al(this),this.program=new ys(this),this.activeTexture=new Qc(this),this.viewport=new to(this),this.bindFramebuffer=new eh(this),this.bindRenderbuffer=new th(this),this.bindTexture=new Ml(this),this.bindVertexBuffer=new zl(this),this.bindElementBuffer=new Dl(this),this.bindVertexArray=new Qo(this),this.pixelStoreUnpack=new Ll(this),this.pixelStoreUnpackPremultiplyAlpha=new io(this),this.pixelStoreUnpackFlipY=new Dr(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Ln(t)){this.HALF_FLOAT=t.HALF_FLOAT;const a=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:a==null?void 0:a.RGBA16F_EXT,this.RGB16F=(o=t.RGB16F)!==null&&o!==void 0?o:a==null?void 0:a.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const a=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=a==null?void 0:a.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(t,n){return new Xo(this,t,n)}createVertexBuffer(t,n,o){return new yr(this,t,n,o)}createRenderbuffer(t,n,o){const a=this.gl,h=a.createRenderbuffer();return this.bindRenderbuffer.set(h),a.renderbufferStorage(a.RENDERBUFFER,t,n,o),this.bindRenderbuffer.set(null),h}createFramebuffer(t,n,o,a){return new ia(this,t,n,o,a)}clear({color:t,depth:n,stencil:o}){const a=this.gl;let h=0;t&&(h|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(h|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),o!==void 0&&(h|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(o),this.stencilMask.set(255)),a.clear(h)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){c.aF(t.blendFunction,Et.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Ln(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;return Ln(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class ht{constructor(t,n,o){this.func=t,this.mask=n,this.range=o}}ht.ReadOnly=!1,ht.ReadWrite=!0,ht.disabled=new ht(519,ht.ReadOnly,[0,1]);const na=7680;class Vt{constructor(t,n,o,a,h,g){this.test=t,this.ref=n,this.mask=o,this.fail=a,this.depthFail=h,this.pass=g}}Vt.disabled=new Vt({func:519,mask:0},0,0,na,na,na);class Mt{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}let vs;function Bl(u,t,n,o,a){const h=u.context,g=h.gl,y=u.useProgram("collisionBox"),b=[];let w=0,C=0;for(let X=0;X<o.length;X++){const Y=o[X],U=t.getTile(Y).getBucket(n);if(!U)continue;const te=a?U.textCollisionBox:U.iconCollisionBox,se=U.collisionCircleArray;if(se.length>0){const ce=c.H();c.aR(ce,U.placementInvProjMatrix,u.transform.glCoordMatrix),c.aR(ce,ce,U.placementViewportMatrix),b.push({circleArray:se,circleOffset:C,transform:Y.posMatrix,invTransform:ce,coord:Y}),w+=se.length/4,C=w}te&&y.draw(h,g.LINES,ht.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,{u_matrix:Y.posMatrix,u_pixel_extrude_scale:[1/(E=u.transform).width,1/E.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y),n.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,u.transform.zoom,null,null,te.collisionVertexBuffer)}var E;if(!a||!b.length)return;const R=u.useProgram("collisionCircle"),F=new c.aS;F.resize(4*w),F._trim();let $=0;for(const X of b)for(let Y=0;Y<X.circleArray.length/4;Y++){const U=4*Y,te=X.circleArray[U+0],se=X.circleArray[U+1],ce=X.circleArray[U+2],ye=X.circleArray[U+3];F.emplace($++,te,se,ce,ye,0),F.emplace($++,te,se,ce,ye,1),F.emplace($++,te,se,ce,ye,2),F.emplace($++,te,se,ce,ye,3)}(!vs||vs.length<2*w)&&(vs=function(X){const Y=2*X,U=new c.aU;U.resize(Y),U._trim();for(let te=0;te<Y;te++){const se=6*te;U.uint16[se+0]=4*te+0,U.uint16[se+1]=4*te+1,U.uint16[se+2]=4*te+2,U.uint16[se+3]=4*te+2,U.uint16[se+4]=4*te+3,U.uint16[se+5]=4*te+0}return U}(w));const H=h.createIndexBuffer(vs,!0),q=h.createVertexBuffer(F,c.aT.members,!0);for(const X of b){const Y=jc(X.transform,X.invTransform,u.transform);R.draw(h,g.TRIANGLES,ht.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,Y,u.style.map.terrain&&u.style.map.terrain.getTerrainData(X.coord),n.id,q,H,c.a0.simpleSegment(0,2*X.circleOffset,X.circleArray.length,X.circleArray.length/2),null,u.transform.zoom,null,null,null)}q.destroy(),H.destroy()}Mt.disabled=new Mt(!1,1029,2305),Mt.backCCW=new Mt(!0,1029,2305);const sa=c.ao(new Float32Array(16));function ro(u,t,n,o,a,h){const{horizontalAlign:g,verticalAlign:y}=c.av(u);return new c.P((-(g-.5)*t/a+o[0])*h,(-(y-.5)*n/a+o[1])*h)}function no(u,t,n,o,a,h){const g=t.tileAnchorPoint.add(new c.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let y=o.mult(h);return n||(y=y.rotate(-a)),W(g.add(y),t.labelPlaneMatrix,t.getElevation).point}if(n){const y=pe(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(u),b=Math.atan(y.y/y.x)+(y.x<0?Math.PI:0);return u.add(o.rotate(b))}return u.add(o)}function so(u,t,n,o,a,h,g,y,b,w,C,E,R,F){const $=u.text.placedSymbolArray,H=u.text.dynamicLayoutVertexArray,q=u.icon.dynamicLayoutVertexArray,X={};H.clear();for(let Y=0;Y<$.length;Y++){const U=$.get(Y),te=U.hidden||!U.crossTileID||u.allowVerticalPlacement&&!U.placedOrientation?null:o[U.crossTileID];if(te){const se=new c.P(U.anchorX,U.anchorY),ce={getElevation:F,width:a.width,height:a.height,labelPlaneMatrix:h,lineVertexArray:null,pitchWithMap:n,projection:C,projectionCache:null,tileAnchorPoint:se,translation:E,unwrappedTileID:R},ye=n?W(se,g,F):pe(se.x,se.y,ce),we=z(a.cameraToCenterDistance,ye.signedDistanceFromCamera);let De=c.aj(u.textSizeData,b,U)*we/c.aq;n&&(De*=u.tilePixelRatio/y);const{width:Re,height:Se,anchor:Te,textOffset:Ne,textBoxScale:tt}=te,Ce=ro(Te,Re,Se,Ne,tt,De),Ae=C.getPitchedTextCorrection(a,se.add(new c.P(E[0],E[1])),R),Qe=no(ye.point,ce,t,Ce,a.angle,Ae),Dt=u.allowVerticalPlacement&&U.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let ot=0;ot<U.numGlyphs;ot++)c.ak(H,Qe,Dt);w&&U.associatedIconIndex>=0&&(X[U.associatedIconIndex]={shiftedAnchor:Qe,angle:Dt})}else We(U.numGlyphs,H)}if(w){q.clear();const Y=u.icon.placedSymbolArray;for(let U=0;U<Y.length;U++){const te=Y.get(U);if(te.hidden)We(te.numGlyphs,q);else{const se=X[U];if(se)for(let ce=0;ce<te.numGlyphs;ce++)c.ak(q,se.shiftedAnchor,se.angle);else We(te.numGlyphs,q)}}u.icon.dynamicLayoutVertexBuffer.updateData(q)}u.text.dynamicLayoutVertexBuffer.updateData(H)}function oa(u,t,n){return n.iconsInText&&t?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Jr(u,t,n,o,a,h,g,y,b,w,C,E){const R=u.context,F=R.gl,$=u.transform,H=qs(),q=y==="map",X=b==="map",Y=y!=="viewport"&&n.layout.get("symbol-placement")!=="point",U=q&&!X&&!Y,te=!X&&Y,se=!n.layout.get("symbol-sort-key").isConstant();let ce=!1;const ye=u.depthModeForSublayer(0,ht.ReadOnly),we=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),De=[],Re=H.getCircleRadiusCorrection($);for(const Se of o){const Te=t.getTile(Se),Ne=Te.getBucket(n);if(!Ne)continue;const tt=a?Ne.text:Ne.icon;if(!tt||!tt.segments.get().length||!tt.hasVisibleVertices)continue;const Ce=tt.programConfigurations.get(n.id),Ae=a||Ne.sdfIcons,Qe=a?Ne.textSizeData:Ne.iconSizeData,Dt=X||$.pitch!==0,ot=u.useProgram(oa(Ae,a,Ne),Ce),ut=c.ah(Qe,$.zoom),Lt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Se);let di,nr,Rt,Mi,ki=[0,0],pi=null;if(a)nr=Te.glyphAtlasTexture,Rt=F.LINEAR,di=Te.glyphAtlasTexture.size,Ne.iconsInText&&(ki=Te.imageAtlasTexture.size,pi=Te.imageAtlasTexture,Mi=Dt||u.options.rotating||u.options.zooming||Qe.kind==="composite"||Qe.kind==="camera"?F.LINEAR:F.NEAREST);else{const Nt=n.layout.get("icon-size").constantOr(0)!==1||Ne.iconsNeedLinear;nr=Te.imageAtlasTexture,Rt=Ae||u.options.rotating||u.options.zooming||Nt||Dt?F.LINEAR:F.NEAREST,di=Te.imageAtlasTexture.size}const fi=rt(Te,1,u.transform.zoom),sr=te?Se.posMatrix:sa,vn=Gr(sr,X,q,u.transform,fi),bo=_r(sr,X,q,u.transform,fi),qn=_r(Se.posMatrix,X,q,u.transform,fi),bn=H.translatePosition(u.transform,Te,h,g),wo=we&&Ne.hasTextData(),Fa=n.layout.get("icon-text-fit")!=="none"&&wo&&Ne.hasIconData();if(Y){const Nt=u.style.map.terrain?(Oa,ti)=>u.style.map.terrain.getElevation(Se,Oa,ti):null,Gn=n.layout.get("text-rotation-alignment")==="map";V(Ne,Se.posMatrix,u,a,vn,qn,X,w,Gn,H,Se.toUnwrapped(),$.width,$.height,bn,Nt)}const oi=Se.posMatrix,or=a&&we||Fa,Qr=Y||or?sa:vn,Zn=bo,mi=Ae&&n.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let gi;gi=Ae?Ne.iconsInText?Gc(Qe.kind,ut,U,X,Y,or,u,oi,Qr,Zn,bn,di,ki,Re):wl(Qe.kind,ut,U,X,Y,or,u,oi,Qr,Zn,bn,a,di,!0,Re):bl(Qe.kind,ut,U,X,Y,or,u,oi,Qr,Zn,bn,a,di,Re);const ri={program:ot,buffers:tt,uniformValues:gi,atlasTexture:nr,atlasTextureIcon:pi,atlasInterpolation:Rt,atlasInterpolationIcon:Mi,isSDF:Ae,hasHalo:mi};if(se&&Ne.canOverlap){ce=!0;const Nt=tt.segments.get();for(const Gn of Nt)De.push({segments:new c.a0([Gn]),sortKey:Gn.sortKey,state:ri,terrainData:Lt})}else De.push({segments:tt.segments,sortKey:0,state:ri,terrainData:Lt})}ce&&De.sort((Se,Te)=>Se.sortKey-Te.sortKey);for(const Se of De){const Te=Se.state;if(R.activeTexture.set(F.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,F.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(R.activeTexture.set(F.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,F.CLAMP_TO_EDGE)),Te.isSDF){const Ne=Te.uniformValues;Te.hasHalo&&(Ne.u_is_halo=1,pn(Te.buffers,Se.segments,n,u,Te.program,ye,C,E,Ne,Se.terrainData)),Ne.u_is_halo=0}pn(Te.buffers,Se.segments,n,u,Te.program,ye,C,E,Te.uniformValues,Se.terrainData)}}function pn(u,t,n,o,a,h,g,y,b,w){const C=o.context;a.draw(C,C.gl.TRIANGLES,h,g,y,Mt.disabled,b,w,n.id,u.layoutVertexBuffer,u.indexBuffer,t,n.paint,o.transform.zoom,u.programConfigurations.get(n.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function qi(u,t,n,o,a){if(!n||!o||!o.imageAtlas)return;const h=o.imageAtlas.patternPositions;let g=h[n.to.toString()],y=h[n.from.toString()];if(!g&&y&&(g=y),!y&&g&&(y=g),!g||!y){const b=a.getPaintProperty(t);g=h[b],y=h[b]}g&&y&&u.setConstantPatternPositions(g,y)}function aa(u,t,n,o,a,h,g){const y=u.context.gl,b="fill-pattern",w=n.paint.get(b),C=w&&w.constantOr(1),E=n.getCrossfadeParameters();let R,F,$,H,q;g?(F=C&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",R=y.LINES):(F=C?"fillPattern":"fill",R=y.TRIANGLES);const X=w.constantOr(null);for(const Y of o){const U=t.getTile(Y);if(C&&!U.patternsLoaded())continue;const te=U.getBucket(n);if(!te)continue;const se=te.programConfigurations.get(n.id),ce=u.useProgram(F,se),ye=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y);C&&(u.context.activeTexture.set(y.TEXTURE0),U.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),se.updatePaintBuffers(E)),qi(se,b,X,U,n);const we=ye?Y:null,De=u.translatePosMatrix(we?we.posMatrix:Y.posMatrix,U,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(g){H=te.indexBuffer2,q=te.segments2;const Re=[y.drawingBufferWidth,y.drawingBufferHeight];$=F==="fillOutlinePattern"&&C?Uc(De,u,E,U,Re):$c(De,Re)}else H=te.indexBuffer,q=te.segments,$=C?Dn(De,u,E,U):fs(De);ce.draw(u.context,R,a,u.stencilModeForClipping(Y),h,Mt.disabled,$,ye,n.id,te.layoutVertexBuffer,H,q,n.paint,u.transform.zoom,se)}}function oo(u,t,n,o,a,h,g){const y=u.context,b=y.gl,w="fill-extrusion-pattern",C=n.paint.get(w),E=C.constantOr(1),R=n.getCrossfadeParameters(),F=n.paint.get("fill-extrusion-opacity"),$=C.constantOr(null);for(const H of o){const q=t.getTile(H),X=q.getBucket(n);if(!X)continue;const Y=u.style.map.terrain&&u.style.map.terrain.getTerrainData(H),U=X.programConfigurations.get(n.id),te=u.useProgram(E?"fillExtrusionPattern":"fillExtrusion",U);E&&(u.context.activeTexture.set(b.TEXTURE0),q.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),U.updatePaintBuffers(R)),qi(U,w,$,q,n);const se=u.translatePosMatrix(H.posMatrix,q,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ce=n.paint.get("fill-extrusion-vertical-gradient"),ye=E?Js(se,u,ce,F,H,R,q):Xs(se,u,ce,F);te.draw(y,y.gl.TRIANGLES,a,h,g,Mt.backCCW,ye,Y,n.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,n.paint,u.transform.zoom,U,u.style.map.terrain&&X.centroidVertexBuffer)}}function la(u,t,n,o,a,h,g){const y=u.context,b=y.gl,w=n.fbo;if(!w)return;const C=u.useProgram("hillshade"),E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);y.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,w.colorAttachment.get()),C.draw(y,b.TRIANGLES,a,h,g,Mt.disabled,((R,F,$,H)=>{const q=$.paint.get("hillshade-shadow-color"),X=$.paint.get("hillshade-highlight-color"),Y=$.paint.get("hillshade-accent-color");let U=$.paint.get("hillshade-illumination-direction")*(Math.PI/180);$.paint.get("hillshade-illumination-anchor")==="viewport"&&(U-=R.transform.angle);const te=!R.options.moving;return{u_matrix:H?H.posMatrix:R.transform.calculatePosMatrix(F.tileID.toUnwrapped(),te),u_image:0,u_latrange:ji(0,F.tileID),u_light:[$.paint.get("hillshade-exaggeration"),U],u_shadow:q,u_highlight:X,u_accent:Y}})(u,n,o,E?t:null),E,o.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}function fn(u,t,n,o,a,h){const g=u.context,y=g.gl,b=t.dem;if(b&&b.data){const w=b.dim,C=b.stride,E=b.getPixels();if(g.activeTexture.set(y.TEXTURE1),g.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||u.getTileTexture(C),t.demTexture){const F=t.demTexture;F.update(E,{premultiply:!1}),F.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new St(g,E,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);g.activeTexture.set(y.TEXTURE0);let R=t.fbo;if(!R){const F=new St(g,{width:w,height:w,data:null},y.RGBA);F.bind(y.LINEAR,y.CLAMP_TO_EDGE),R=t.fbo=g.createFramebuffer(w,w,!0,!1),R.colorAttachment.set(F.texture)}g.bindFramebuffer.set(R.framebuffer),g.viewport.set([0,0,w,w]),u.useProgram("hillshadePrepare").draw(g,y.TRIANGLES,o,a,h,Mt.disabled,((F,$)=>{const H=$.stride,q=c.H();return c.aQ(q,0,c.X,-c.X,0,0,1),c.J(q,q,[0,-c.X,0]),{u_matrix:q,u_image:1,u_dimension:[H,H],u_zoom:F.overscaledZ,u_unpack:$.getUnpackVector()}})(t.tileID,b),null,n.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function ao(u,t,n,o,a,h){const g=o.paint.get("raster-fade-duration");if(!h&&g>0){const y=ae.now(),b=(y-u.timeAdded)/g,w=t?(y-t.timeAdded)/g:-1,C=n.getSource(),E=a.coveringZoomLevel({tileSize:C.tileSize,roundZoom:C.roundZoom}),R=!t||Math.abs(t.tileID.overscaledZ-E)>Math.abs(u.tileID.overscaledZ-E),F=R&&u.refreshedUponExpiration?1:c.ad(R?b:1-w,0,1);return u.refreshedUponExpiration&&b>=1&&(u.refreshedUponExpiration=!1),t?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const lo=new c.aN(1,0,0,1),bs=new c.aN(0,1,0,1),co=new c.aN(0,0,1,1),Fl=new c.aN(1,0,1,1),Bn=new c.aN(0,1,1,1);function mn(u,t,n,o){Fn(u,0,t+n/2,u.transform.width,n,o)}function ca(u,t,n,o){Fn(u,t-n/2,0,n,u.transform.height,o)}function Fn(u,t,n,o,a,h){const g=u.context,y=g.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*u.pixelRatio,n*u.pixelRatio,o*u.pixelRatio,a*u.pixelRatio),g.clear({color:h}),y.disable(y.SCISSOR_TEST)}function gt(u,t,n){const o=u.context,a=o.gl,h=n.posMatrix,g=u.useProgram("debug"),y=ht.disabled,b=Vt.disabled,w=u.colorModeForRenderPass(),C="$debug",E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(n);o.activeTexture.set(a.TEXTURE0);const R=t.getTileByID(n.key).latestRawTileData,F=Math.floor((R&&R.byteLength||0)/1024),$=t.getTile(n).tileSize,H=512/Math.min($,512)*(n.overscaledZ/u.transform.zoom)*.5;let q=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(q+=` => ${n.overscaledZ}`),function(X,Y){X.initDebugOverlayCanvas();const U=X.debugOverlayCanvas,te=X.context.gl,se=X.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,U.width,U.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(Y,5,5),se.strokeText(Y,5,5),X.debugOverlayTexture.update(U),X.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${q} ${F}kB`),g.draw(o,a.TRIANGLES,y,b,Et.alphaBlended,Mt.disabled,Xr(h,c.aN.transparent,H),null,C,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),g.draw(o,a.LINE_STRIP,y,b,w,Mt.disabled,Xr(h,c.aN.red),E,C,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function ws(u,t,n){const o=u.context,a=o.gl,h=u.colorModeForRenderPass(),g=new ht(a.LEQUAL,ht.ReadWrite,u.depthRangeFor3D),y=u.useProgram("terrain"),b=t.getTerrainMesh();o.bindFramebuffer.set(null),o.viewport.set([0,0,u.width,u.height]);for(const w of n){const C=u.renderToTexture.getTexture(w),E=t.getTerrainData(w.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,C.texture);const R=u.transform.calculatePosMatrix(w.tileID.toUnwrapped()),F=t.getMeshFrameDelta(u.transform.zoom),$=u.transform.calculateFogMatrix(w.tileID.toUnwrapped()),H=Ho(R,F,$,u.style.sky,u.transform.pitch);y.draw(o,a.TRIANGLES,g,Vt.disabled,h,Mt.backCCW,H,E,"terrain",b.vertexBuffer,b.indexBuffer,b.segments)}}class Ol{constructor(t,n,o){this.vertexBuffer=t,this.indexBuffer=n,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Vl{constructor(t,n){this.context=new ra(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ye.maxUnderzooming+Ye.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xi}resize(t,n,o){if(this.width=Math.floor(t*o),this.height=Math.floor(n*o),this.pixelRatio=o,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const a of this.style._order)this.style._layers[a].resize()}setup(){const t=this.context,n=new c.aX;n.emplaceBack(0,0),n.emplaceBack(c.X,0),n.emplaceBack(0,c.X),n.emplaceBack(c.X,c.X),this.tileExtentBuffer=t.createVertexBuffer(n,ds.members),this.tileExtentSegments=c.a0.simpleSegment(0,0,4,2);const o=new c.aX;o.emplaceBack(0,0),o.emplaceBack(c.X,0),o.emplaceBack(0,c.X),o.emplaceBack(c.X,c.X),this.debugBuffer=t.createVertexBuffer(o,ds.members),this.debugSegments=c.a0.simpleSegment(0,0,4,5);const a=new c.$;a.emplaceBack(0,0,0,0),a.emplaceBack(c.X,0,c.X,0),a.emplaceBack(0,c.X,0,c.X),a.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=t.createVertexBuffer(a,qr.members),this.rasterBoundsSegments=c.a0.simpleSegment(0,0,4,2);const h=new c.aX;h.emplaceBack(0,0),h.emplaceBack(1,0),h.emplaceBack(0,1),h.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(h,ds.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const g=new c.aZ;g.emplaceBack(0),g.emplaceBack(1),g.emplaceBack(3),g.emplaceBack(2),g.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(g);const y=new c.aY;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const b=this.context.gl;this.stencilClearMode=new Vt({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const o=c.H();c.aQ(o,0,this.width,this.height,0,0,1),c.K(o,o,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,ht.disabled,this.stencilClearMode,Et.disabled,Mt.disabled,ms(o),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const o=this.context,a=o.gl;this.nextStencilID+n.length>256&&this.clearStencil(),o.setColorMode(Et.disabled),o.setDepthMode(ht.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const g of n){const y=this._tileClippingMaskIDs[g.key]=this.nextStencilID++,b=this.style.map.terrain&&this.style.map.terrain.getTerrainData(g);h.draw(o,a.TRIANGLES,ht.disabled,new Vt({func:a.ALWAYS,mask:0},y,255,a.KEEP,a.KEEP,a.REPLACE),Et.disabled,Mt.disabled,ms(g.posMatrix),b,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Vt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Vt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,o=t.sort((g,y)=>y.overscaledZ-g.overscaledZ),a=o[o.length-1].overscaledZ,h=o[0].overscaledZ-a+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const g={};for(let y=0;y<h;y++)g[y+a]=new Vt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=h,[g,o]}return[{[a]:Vt.disabled},o]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Et([t.CONSTANT_COLOR,t.ONE],new c.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Et.unblended:Et.alphaBlended}depthModeForSublayer(t,n,o){if(!this.opaquePassEnabledForLayer())return ht.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ht(o||this.context.gl.LEQUAL,n,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var o;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(ae.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,g={},y={},b={};for(const w in h){const C=h[w];C.used&&C.prepare(this.context),g[w]=C.getVisibleCoordinates(),y[w]=g[w].slice().reverse(),b[w]=C.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let w=0;w<a.length;w++)if(this.style._layers[a[w]].is3D()){this.opaquePassCutoff=w;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const w of a){const C=this.style._layers[w];if(!C.hasOffscreenPass()||C.isHidden(this.transform.zoom))continue;const E=y[C.source];(C.type==="custom"||E.length)&&this.renderLayer(this,h[C.source],C,E)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?c.aN.black:c.aN.transparent,depth:1}),this.clearStencil(),!((o=this.style.stylesheet)===null||o===void 0)&&o.sky&&function(w,C){const E=w.context,R=E.gl,F=((Y,U,te)=>({u_sky_color:Y.properties.get("sky-color"),u_horizon_color:Y.properties.get("horizon-color"),u_horizon:(U.height/2+U.getHorizon())*te,u_sky_horizon_blend:Y.properties.get("sky-horizon-blend")*U.height/2*te}))(C,w.style.map.transform,w.pixelRatio),$=new ht(R.LEQUAL,ht.ReadWrite,[0,1]),H=Vt.disabled,q=w.colorModeForRenderPass(),X=w.useProgram("sky");if(!C.mesh){const Y=new c.aX;Y.emplaceBack(-1,-1),Y.emplaceBack(1,-1),Y.emplaceBack(1,1),Y.emplaceBack(-1,1);const U=new c.aY;U.emplaceBack(0,1,2),U.emplaceBack(0,2,3),C.mesh=new Ol(E.createVertexBuffer(Y,ds.members),E.createIndexBuffer(U),c.a0.simpleSegment(0,0,Y.length,U.length))}X.draw(E,R.TRIANGLES,$,H,q,Mt.disabled,F,void 0,"sky",C.mesh.vertexBuffer,C.mesh.indexBuffer,C.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const w=this.style._layers[a[this.currentLayer]],C=h[w.source],E=g[w.source];this._renderTileClippingMasks(w,E),this.renderLayer(this,C,w,E)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const w=this.style._layers[a[this.currentLayer]],C=h[w.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(w))continue;const E=(w.type==="symbol"?b:y)[w.source];this._renderTileClippingMasks(w,g[w.source]),this.renderLayer(this,C,w,E)}if(this.options.showTileBoundaries){const w=function(C,E){let R=null;const F=Object.values(C._layers).flatMap(X=>X.source&&!X.isHidden(E)?[C.sourceCaches[X.source]]:[]),$=F.filter(X=>X.getSource().type==="vector"),H=F.filter(X=>X.getSource().type!=="vector"),q=X=>{(!R||R.getSource().maxzoom<X.getSource().maxzoom)&&(R=X)};return $.forEach(X=>q(X)),R||H.forEach(X=>q(X)),R}(this.style,this.transform.zoom);w&&function(C,E,R){for(let F=0;F<R.length;F++)gt(C,E,R[F])}(this,w,w.getVisibleCoordinates())}this.options.showPadding&&function(w){const C=w.transform.padding;mn(w,w.transform.height-(C.top||0),3,lo),mn(w,C.bottom||0,3,bs),ca(w,C.left||0,3,co),ca(w,w.transform.width-(C.right||0),3,Fl);const E=w.transform.centerPoint;(function(R,F,$,H){Fn(R,F-1,$-10,2,20,H),Fn(R,F-10,$-1,20,2,H)})(w,E.x,w.transform.height-E.y,Bn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let a=this.terrainFacilitator.dirty;a||(a=t?!c.a_(n,o):!c.a$(n,o)),a||(a=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),a&&(c.b0(n,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,g){const y=h.context,b=y.gl,w=Et.unblended,C=new ht(b.LEQUAL,ht.ReadWrite,[0,1]),E=g.getTerrainMesh(),R=g.sourceCache.getRenderableTiles(),F=h.useProgram("terrainDepth");y.bindFramebuffer.set(g.getFramebuffer("depth").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1});for(const $ of R){const H=g.getTerrainData($.tileID),q={u_matrix:h.transform.calculatePosMatrix($.tileID.toUnwrapped()),u_ele_delta:g.getMeshFrameDelta(h.transform.zoom)};F.draw(y,b.TRIANGLES,C,Vt.disabled,w,Mt.backCCW,q,H,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,g){const y=h.context,b=y.gl,w=Et.unblended,C=new ht(b.LEQUAL,ht.ReadWrite,[0,1]),E=g.getTerrainMesh(),R=g.getCoordsTexture(),F=g.sourceCache.getRenderableTiles(),$=h.useProgram("terrainCoords");y.bindFramebuffer.set(g.getFramebuffer("coords").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1}),g.coordsIndex=[];for(const H of F){const q=g.getTerrainData(H.tileID);y.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,R.texture);const X={u_matrix:h.transform.calculatePosMatrix(H.tileID.toUnwrapped()),u_terrain_coords_id:(255-g.coordsIndex.length)/255,u_texture:0,u_ele_delta:g.getMeshFrameDelta(h.transform.zoom)};$.draw(y,b.TRIANGLES,C,Vt.disabled,w,Mt.backCCW,X,q,"terrain",E.vertexBuffer,E.indexBuffer,E.segments),g.coordsIndex.push(H.tileID.key)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(t,n,o,a){if(!o.isHidden(this.transform.zoom)&&(o.type==="background"||o.type==="custom"||(a||[]).length))switch(this.id=o.id,o.type){case"symbol":(function(h,g,y,b,w){if(h.renderPass!=="translucent")return;const C=Vt.disabled,E=h.colorModeForRenderPass();(y._unevaluatedLayout.hasValue("text-variable-anchor")||y._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(R,F,$,H,q,X,Y,U,te){const se=F.transform,ce=qs(),ye=q==="map",we=X==="map";for(const De of R){const Re=H.getTile(De),Se=Re.getBucket($);if(!Se||!Se.text||!Se.text.segments.get().length)continue;const Te=c.ah(Se.textSizeData,se.zoom),Ne=rt(Re,1,F.transform.zoom),tt=Gr(De.posMatrix,we,ye,F.transform,Ne),Ce=$.layout.get("icon-text-fit")!=="none"&&Se.hasIconData();if(Te){const Ae=Math.pow(2,se.zoom-Re.tileID.overscaledZ),Qe=F.style.map.terrain?(ot,ut)=>F.style.map.terrain.getElevation(De,ot,ut):null,Dt=ce.translatePosition(se,Re,Y,U);so(Se,ye,we,te,se,tt,De.posMatrix,Ae,Te,Ce,ce,Dt,De.toUnwrapped(),Qe)}}}(b,h,y,g,y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),w),y.paint.get("icon-opacity").constantOr(1)!==0&&Jr(h,g,y,b,!1,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),y.layout.get("icon-rotation-alignment"),y.layout.get("icon-pitch-alignment"),y.layout.get("icon-keep-upright"),C,E),y.paint.get("text-opacity").constantOr(1)!==0&&Jr(h,g,y,b,!0,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.layout.get("text-keep-upright"),C,E),g.map.showCollisionBoxes&&(Bl(h,g,y,b,!0),Bl(h,g,y,b,!1))})(t,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(h,g,y,b){if(h.renderPass!=="translucent")return;const w=y.paint.get("circle-opacity"),C=y.paint.get("circle-stroke-width"),E=y.paint.get("circle-stroke-opacity"),R=!y.layout.get("circle-sort-key").isConstant();if(w.constantOr(1)===0&&(C.constantOr(1)===0||E.constantOr(1)===0))return;const F=h.context,$=F.gl,H=h.depthModeForSublayer(0,ht.ReadOnly),q=Vt.disabled,X=h.colorModeForRenderPass(),Y=[];for(let U=0;U<b.length;U++){const te=b[U],se=g.getTile(te),ce=se.getBucket(y);if(!ce)continue;const ye=ce.programConfigurations.get(y.id),we=h.useProgram("circle",ye),De=ce.layoutVertexBuffer,Re=ce.indexBuffer,Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(te),Te={programConfiguration:ye,program:we,layoutVertexBuffer:De,indexBuffer:Re,uniformValues:_l(h,te,se,y),terrainData:Se};if(R){const Ne=ce.segments.get();for(const tt of Ne)Y.push({segments:new c.a0([tt]),sortKey:tt.sortKey,state:Te})}else Y.push({segments:ce.segments,sortKey:0,state:Te})}R&&Y.sort((U,te)=>U.sortKey-te.sortKey);for(const U of Y){const{programConfiguration:te,program:se,layoutVertexBuffer:ce,indexBuffer:ye,uniformValues:we,terrainData:De}=U.state;se.draw(F,$.TRIANGLES,H,q,X,Mt.disabled,we,De,y.id,ce,ye,U.segments,y.paint,h.transform.zoom,te)}})(t,n,o,a);break;case"heatmap":(function(h,g,y,b){if(y.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const w=h.context,C=w.gl,E=Vt.disabled,R=new Et([C.ONE,C.ONE],c.aN.transparent,[!0,!0,!0,!0]);(function(F,$,H){const q=F.gl;F.activeTexture.set(q.TEXTURE1),F.viewport.set([0,0,$.width/4,$.height/4]);let X=H.heatmapFbo;if(X)q.bindTexture(q.TEXTURE_2D,X.colorAttachment.get()),F.bindFramebuffer.set(X.framebuffer);else{const Y=q.createTexture();q.bindTexture(q.TEXTURE_2D,Y),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_WRAP_S,q.CLAMP_TO_EDGE),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_WRAP_T,q.CLAMP_TO_EDGE),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_MIN_FILTER,q.LINEAR),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_MAG_FILTER,q.LINEAR),X=H.heatmapFbo=F.createFramebuffer($.width/4,$.height/4,!1,!1),function(U,te,se,ce){var ye,we;const De=U.gl,Re=(ye=U.HALF_FLOAT)!==null&&ye!==void 0?ye:De.UNSIGNED_BYTE,Se=(we=U.RGBA16F)!==null&&we!==void 0?we:De.RGBA;De.texImage2D(De.TEXTURE_2D,0,Se,te.width/4,te.height/4,0,De.RGBA,Re,null),ce.colorAttachment.set(se)}(F,$,Y,X)}})(w,h,y),w.clear({color:c.aN.transparent});for(let F=0;F<b.length;F++){const $=b[F];if(g.hasRenderableParent($))continue;const H=g.getTile($),q=H.getBucket(y);if(!q)continue;const X=q.programConfigurations.get(y.id),Y=h.useProgram("heatmap",X),{zoom:U}=h.transform;Y.draw(w,C.TRIANGLES,ht.disabled,E,R,Mt.disabled,Ui($.posMatrix,H,U,y.paint.get("heatmap-intensity")),null,y.id,q.layoutVertexBuffer,q.indexBuffer,q.segments,y.paint,h.transform.zoom,X)}w.viewport.set([0,0,h.width,h.height])}else h.renderPass==="translucent"&&(h.context.setColorMode(h.colorModeForRenderPass()),function(w,C){const E=w.context,R=E.gl,F=C.heatmapFbo;if(!F)return;E.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_2D,F.colorAttachment.get()),E.activeTexture.set(R.TEXTURE1);let $=C.colorRampTexture;$||($=C.colorRampTexture=new St(E,C.colorRamp,R.RGBA)),$.bind(R.LINEAR,R.CLAMP_TO_EDGE),w.useProgram("heatmapTexture").draw(E,R.TRIANGLES,ht.disabled,Vt.disabled,w.colorModeForRenderPass(),Mt.disabled,((H,q,X,Y)=>{const U=c.H();c.aQ(U,0,H.width,H.height,0,0,1);const te=H.context.gl;return{u_matrix:U,u_world:[te.drawingBufferWidth,te.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:q.paint.get("heatmap-opacity")}})(w,C),null,C.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments,C.paint,w.transform.zoom)}(h,y))})(t,n,o,a);break;case"line":(function(h,g,y,b){if(h.renderPass!=="translucent")return;const w=y.paint.get("line-opacity"),C=y.paint.get("line-width");if(w.constantOr(1)===0||C.constantOr(1)===0)return;const E=h.depthModeForSublayer(0,ht.ReadOnly),R=h.colorModeForRenderPass(),F=y.paint.get("line-dasharray"),$=y.paint.get("line-pattern"),H=$.constantOr(1),q=y.paint.get("line-gradient"),X=y.getCrossfadeParameters(),Y=H?"linePattern":F?"lineSDF":q?"lineGradient":"line",U=h.context,te=U.gl;let se=!0;for(const ce of b){const ye=g.getTile(ce);if(H&&!ye.patternsLoaded())continue;const we=ye.getBucket(y);if(!we)continue;const De=we.programConfigurations.get(y.id),Re=h.context.program.get(),Se=h.useProgram(Y,De),Te=se||Se.program!==Re,Ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ce),tt=$.constantOr(null);if(tt&&ye.imageAtlas){const Qe=ye.imageAtlas,Dt=Qe.patternPositions[tt.to.toString()],ot=Qe.patternPositions[tt.from.toString()];Dt&&ot&&De.setConstantPatternPositions(Dt,ot)}const Ce=Ne?ce:null,Ae=H?yl(h,ye,y,X,Ce):F?xl(h,ye,y,F,X,Ce):q?Ks(h,ye,y,we.lineClipsArray.length,Ce):gs(h,ye,y,Ce);if(H)U.activeTexture.set(te.TEXTURE0),ye.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),De.updatePaintBuffers(X);else if(F&&(Te||h.lineAtlas.dirty))U.activeTexture.set(te.TEXTURE0),h.lineAtlas.bind(U);else if(q){const Qe=we.gradients[y.id];let Dt=Qe.texture;if(y.gradientVersion!==Qe.version){let ot=256;if(y.stepInterpolant){const ut=g.getSource().maxzoom,Lt=ce.canonical.z===ut?Math.ceil(1<<h.transform.maxZoom-ce.canonical.z):1;ot=c.ad(c.aV(we.maxLineLength/c.X*1024*Lt),256,U.maxTextureSize)}Qe.gradient=c.aW({expression:y.gradientExpression(),evaluationKey:"lineProgress",resolution:ot,image:Qe.gradient||void 0,clips:we.lineClipsArray}),Qe.texture?Qe.texture.update(Qe.gradient):Qe.texture=new St(U,Qe.gradient,te.RGBA),Qe.version=y.gradientVersion,Dt=Qe.texture}U.activeTexture.set(te.TEXTURE0),Dt.bind(y.stepInterpolant?te.NEAREST:te.LINEAR,te.CLAMP_TO_EDGE)}Se.draw(U,te.TRIANGLES,E,h.stencilModeForClipping(ce),R,Mt.disabled,Ae,Ne,y.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,y.paint,h.transform.zoom,De,we.layoutVertexBuffer2),se=!1}})(t,n,o,a);break;case"fill":(function(h,g,y,b){const w=y.paint.get("fill-color"),C=y.paint.get("fill-opacity");if(C.constantOr(1)===0)return;const E=h.colorModeForRenderPass(),R=y.paint.get("fill-pattern"),F=h.opaquePassEnabledForLayer()&&!R.constantOr(1)&&w.constantOr(c.aN.transparent).a===1&&C.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===F){const $=h.depthModeForSublayer(1,h.renderPass==="opaque"?ht.ReadWrite:ht.ReadOnly);aa(h,g,y,b,$,E,!1)}if(h.renderPass==="translucent"&&y.paint.get("fill-antialias")){const $=h.depthModeForSublayer(y.getPaintProperty("fill-outline-color")?2:0,ht.ReadOnly);aa(h,g,y,b,$,E,!0)}})(t,n,o,a);break;case"fill-extrusion":(function(h,g,y,b){const w=y.paint.get("fill-extrusion-opacity");if(w!==0&&h.renderPass==="translucent"){const C=new ht(h.context.gl.LEQUAL,ht.ReadWrite,h.depthRangeFor3D);if(w!==1||y.paint.get("fill-extrusion-pattern").constantOr(1))oo(h,g,y,b,C,Vt.disabled,Et.disabled),oo(h,g,y,b,C,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const E=h.colorModeForRenderPass();oo(h,g,y,b,C,Vt.disabled,E)}}})(t,n,o,a);break;case"hillshade":(function(h,g,y,b){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const w=h.context,C=h.depthModeForSublayer(0,ht.ReadOnly),E=h.colorModeForRenderPass(),[R,F]=h.renderPass==="translucent"?h.stencilConfigForOverlap(b):[{},b];for(const $ of F){const H=g.getTile($);H.needsHillshadePrepare!==void 0&&H.needsHillshadePrepare&&h.renderPass==="offscreen"?fn(h,H,y,C,Vt.disabled,E):h.renderPass==="translucent"&&la(h,$,H,y,C,R[$.overscaledZ],E)}w.viewport.set([0,0,h.width,h.height])})(t,n,o,a);break;case"raster":(function(h,g,y,b){if(h.renderPass!=="translucent"||y.paint.get("raster-opacity")===0||!b.length)return;const w=h.context,C=w.gl,E=g.getSource(),R=h.useProgram("raster"),F=h.colorModeForRenderPass(),[$,H]=E instanceof Ar?[{},b]:h.stencilConfigForOverlap(b),q=H[H.length-1].overscaledZ,X=!h.options.moving;for(const Y of H){const U=h.depthModeForSublayer(Y.overscaledZ-q,y.paint.get("raster-opacity")===1?ht.ReadWrite:ht.ReadOnly,C.LESS),te=g.getTile(Y);te.registerFadeDuration(y.paint.get("raster-fade-duration"));const se=g.findLoadedParent(Y,0),ce=g.findLoadedSibling(Y),ye=ao(te,se||ce||null,g,y,h.transform,h.style.map.terrain);let we,De;const Re=y.paint.get("raster-resampling")==="nearest"?C.NEAREST:C.LINEAR;w.activeTexture.set(C.TEXTURE0),te.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),w.activeTexture.set(C.TEXTURE1),se?(se.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),we=Math.pow(2,se.tileID.overscaledZ-te.tileID.overscaledZ),De=[te.tileID.canonical.x*we%1,te.tileID.canonical.y*we%1]):te.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),te.texture.useMipmap&&w.extTextureFilterAnisotropic&&h.transform.pitch>20&&C.texParameterf(C.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);const Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(Y),Te=Se?Y:null,Ne=Te?Te.posMatrix:h.transform.calculatePosMatrix(Y.toUnwrapped(),X),tt=qc(Ne,De||[0,0],we||1,ye,y);E instanceof Ar?R.draw(w,C.TRIANGLES,U,Vt.disabled,F,Mt.disabled,tt,Se,y.id,E.boundsBuffer,h.quadTriangleIndexBuffer,E.boundsSegments):R.draw(w,C.TRIANGLES,U,$[Y.overscaledZ],F,Mt.disabled,tt,Se,y.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,n,o,a);break;case"background":(function(h,g,y,b){const w=y.paint.get("background-color"),C=y.paint.get("background-opacity");if(C===0)return;const E=h.context,R=E.gl,F=h.transform,$=F.tileSize,H=y.paint.get("background-pattern");if(h.isPatternMissing(H))return;const q=!H&&w.a===1&&C===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==q)return;const X=Vt.disabled,Y=h.depthModeForSublayer(0,q==="opaque"?ht.ReadWrite:ht.ReadOnly),U=h.colorModeForRenderPass(),te=h.useProgram(H?"backgroundPattern":"background"),se=b||F.coveringTiles({tileSize:$,terrain:h.style.map.terrain});H&&(E.activeTexture.set(R.TEXTURE0),h.imageManager.bind(h.context));const ce=y.getCrossfadeParameters();for(const ye of se){const we=b?ye.posMatrix:h.transform.calculatePosMatrix(ye.toUnwrapped()),De=H?Wo(we,C,h,H,{tileID:ye,tileSize:$},ce):Ys(we,C,w),Re=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ye);te.draw(E,R.TRIANGLES,Y,X,U,Mt.disabled,De,Re,y.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(h,g,y){const b=h.context,w=y.implementation;if(h.renderPass==="offscreen"){const C=w.prerender;C&&(h.setCustomLayerDefaults(),b.setColorMode(h.colorModeForRenderPass()),C.call(w,b.gl,h.transform.customLayerMatrix()),b.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),b.setColorMode(h.colorModeForRenderPass()),b.setStencilMode(Vt.disabled);const C=w.renderingMode==="3d"?new ht(h.context.gl.LEQUAL,ht.ReadWrite,h.depthRangeFor3D):h.depthModeForSublayer(0,ht.ReadOnly);b.setDepthMode(C),w.render(b.gl,h.transform.customLayerMatrix(),{farZ:h.transform.farZ,nearZ:h.transform.nearZ,fov:h.transform._fov,modelViewProjectionMatrix:h.transform.modelViewProjectionMatrix,projectionMatrix:h.transform.projectionMatrix}),b.setDirty(),h.setBaseState(),b.bindFramebuffer.set(null)}})(t,0,o)}}translatePosMatrix(t,n,o,a,h){if(!o[0]&&!o[1])return t;const g=h?a==="map"?this.transform.angle:0:a==="viewport"?-this.transform.angle:0;if(g){const w=Math.sin(g),C=Math.cos(g);o=[o[0]*C-o[1]*w,o[0]*w+o[1]*C]}const y=[h?o[0]:rt(n,o[0],this.transform.zoom),h?o[1]:rt(n,o[1],this.transform.zoom),0],b=new Float32Array(16);return c.J(b,t,y),b}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),o=this.imageManager.getPattern(t.to.toString());return!n||!o}useProgram(t,n){this.cache=this.cache||{};const o=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[o]||(this.cache[o]=new Hs(this.context,Wr[t],n,Qs[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new St(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class gn{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,o){const a=Math.pow(2,o),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(y=>{const b=1/(y=c.ag([],y,t))[3]/n*a;return c.b1(y,y,[b,b,1/y[3],b])}),g=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const b=function(R,F){var $=F[0],H=F[1],q=F[2],X=$*$+H*H+q*q;return X>0&&(X=1/Math.sqrt(X)),R[0]=F[0]*X,R[1]=F[1]*X,R[2]=F[2]*X,R}([],function(R,F,$){var H=F[0],q=F[1],X=F[2],Y=$[0],U=$[1],te=$[2];return R[0]=q*te-X*U,R[1]=X*Y-H*te,R[2]=H*U-q*Y,R}([],$t([],h[y[0]],h[y[1]]),$t([],h[y[2]],h[y[1]]))),w=-((C=b)[0]*(E=h[y[1]])[0]+C[1]*E[1]+C[2]*E[2]);var C,E;return b.concat(w)});return new gn(h,g)}}class ho{constructor(t,n){this.min=t,this.max=n,this.center=function(o,a,h){return o[0]=.5*a[0],o[1]=.5*a[1],o[2]=.5*a[2],o}([],function(o,a,h){return o[0]=a[0]+h[0],o[1]=a[1]+h[1],o[2]=a[2]+h[2],o}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],o=wt(this.min),a=wt(this.max);for(let h=0;h<n.length;h++)o[h]=n[h]?this.min[h]:this.center[h],a[h]=n[h]?this.center[h]:this.max[h];return a[2]=this.max[2],new ho(o,a)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let o=!0;for(let a=0;a<t.planes.length;a++){const h=t.planes[a];let g=0;for(let y=0;y<n.length;y++)c.b2(h,n[y])>=0&&g++;if(g===0)return 0;g!==n.length&&(o=!1)}if(o)return 2;for(let a=0;a<3;a++){let h=Number.MAX_VALUE,g=-Number.MAX_VALUE;for(let y=0;y<t.points.length;y++){const b=t.points[y][a]-this.min[a];h=Math.min(h,b),g=Math.max(g,b)}if(g<0||h>this.max[a]-this.min[a])return 0}return 1}}class uo{constructor(t=0,n=0,o=0,a=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(o)||o<0||isNaN(a)||a<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=o,this.right=a}interpolate(t,n,o){return n.top!=null&&t.top!=null&&(this.top=c.z.number(t.top,n.top,o)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.z.number(t.bottom,n.bottom,o)),n.left!=null&&t.left!=null&&(this.left=c.z.number(t.left,n.left,o)),n.right!=null&&t.right!=null&&(this.right=c.z.number(t.right,n.right,o)),this}getCenter(t,n){const o=c.ad((this.left+t-this.right)/2,0,t),a=c.ad((this.top+n-this.bottom)/2,0,n);return new c.P(o,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new uo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const ha=85.051129;class ua{constructor(t,n,o,a,h){this.tileSize=512,this._renderWorldCopies=h===void 0||!!h,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=o??0,this._maxPitch=a??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new uo,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new ua(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-c.b3(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var o=new c.A(4);return c.A!=Float32Array&&(o[1]=0,o[2]=0),o[0]=1,o[3]=1,o}(),function(o,a,h){var g=a[0],y=a[1],b=a[2],w=a[3],C=Math.sin(h),E=Math.cos(h);o[0]=g*E+b*C,o[1]=y*E+w*C,o[2]=g*-C+b*E,o[3]=y*-C+w*E}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=c.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,o){this._unmodified=!1,this._edgeInsets.interpolate(t,n,o),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new c.b4(0,t)];if(this._renderWorldCopies){const o=this.pointCoordinate(new c.P(0,0)),a=this.pointCoordinate(new c.P(this.width,0)),h=this.pointCoordinate(new c.P(this.width,this.height)),g=this.pointCoordinate(new c.P(0,this.height)),y=Math.floor(Math.min(o.x,a.x,h.x,g.x)),b=Math.floor(Math.max(o.x,a.x,h.x,g.x)),w=1;for(let C=y-w;C<=b+w;C++)C!==0&&n.push(new c.b4(C,t))}return n}coveringTiles(t){var n,o;let a=this.coveringZoomLevel(t);const h=a;if(t.minzoom!==void 0&&a<t.minzoom)return[];t.maxzoom!==void 0&&a>t.maxzoom&&(a=t.maxzoom);const g=this.pointCoordinate(this.getCameraPoint()),y=c.Z.fromLngLat(this.center),b=Math.pow(2,a),w=[b*g.x,b*g.y,0],C=[b*y.x,b*y.y,0],E=gn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,a);let R=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(R=a);const F=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,$=U=>({aabb:new ho([U*b,0,0],[(U+1)*b,b,0]),zoom:0,x:0,y:0,wrap:U,fullyVisible:!1}),H=[],q=[],X=a,Y=t.reparseOverscaled?h:a;if(this._renderWorldCopies)for(let U=1;U<=3;U++)H.push($(-U)),H.push($(U));for(H.push($(0));H.length>0;){const U=H.pop(),te=U.x,se=U.y;let ce=U.fullyVisible;if(!ce){const Se=U.aabb.intersects(E);if(Se===0)continue;ce=Se===2}const ye=t.terrain?w:C,we=U.aabb.distanceX(ye),De=U.aabb.distanceY(ye),Re=Math.max(Math.abs(we),Math.abs(De));if(U.zoom===X||Re>F+(1<<X-U.zoom)-2&&U.zoom>=R){const Se=X-U.zoom,Te=w[0]-.5-(te<<Se),Ne=w[1]-.5-(se<<Se);q.push({tileID:new c.S(U.zoom===X?Y:U.zoom,U.wrap,U.zoom,te,se),distanceSq:Vr([C[0]-.5-te,C[1]-.5-se]),tileDistanceToCamera:Math.sqrt(Te*Te+Ne*Ne)})}else for(let Se=0;Se<4;Se++){const Te=(te<<1)+Se%2,Ne=(se<<1)+(Se>>1),tt=U.zoom+1;let Ce=U.aabb.quadrant(Se);if(t.terrain){const Ae=new c.S(tt,U.wrap,tt,Te,Ne),Qe=t.terrain.getMinMaxElevation(Ae),Dt=(n=Qe.minElevation)!==null&&n!==void 0?n:this.elevation,ot=(o=Qe.maxElevation)!==null&&o!==void 0?o:this.elevation;Ce=new ho([Ce.min[0],Ce.min[1],Dt],[Ce.max[0],Ce.max[1],ot])}H.push({aabb:Ce,zoom:tt,x:Te,y:Ne,wrap:U.wrap,fullyVisible:ce})}}return q.sort((U,te)=>U.distanceSq-te.distanceSq).map(U=>U.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=c.ad(t.lat,-85.051129,ha);return new c.P(c.O(t.lng)*this.worldSize,c.Q(n)*this.worldSize)}unproject(t){return new c.Z(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.elevation,o=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,a=this.pointLocation(this.centerPoint,t),h=t.getElevationForLngLatZoom(a,this.tileZoom);if(!(this.elevation-h))return;const g=o+n-h,y=Math.cos(this._pitch)*this.cameraToCenterDistance/g/c.b5(1,a.lat),b=this.scaleZoom(y/this.tileSize);this._elevation=h,this._center=a,this.zoom=b}setLocationAtPoint(t,n){const o=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),h=this.locationCoordinate(t),g=new c.Z(h.x-(o.x-a.x),h.y-(o.y-a.y));this.center=this.coordinateLocation(g),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),n.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return c.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const R=n.pointCoordinate(t);if(R!=null)return R}const o=[t.x,t.y,0,1],a=[t.x,t.y,1,1];c.ag(o,o,this.pixelMatrixInverse),c.ag(a,a,this.pixelMatrixInverse);const h=o[3],g=a[3],y=o[1]/h,b=a[1]/g,w=o[2]/h,C=a[2]/g,E=w===C?0:(0-w)/(C-w);return new c.Z(c.z.number(o[0]/h,a[0]/g,E)/this.worldSize,c.z.number(y,b,E)/this.worldSize)}coordinatePoint(t,n=0,o=this.pixelMatrix){const a=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.ag(a,a,o),new c.P(a[0]/a[3],a[1]/a[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new ue().extend(this.pointLocation(new c.P(0,t))).extend(this.pointLocation(new c.P(this.width,t))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ue([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,ha])}calculateTileMatrix(t){const n=t.canonical,o=this.worldSize/this.zoomScale(n.z),a=n.x+Math.pow(2,n.z)*t.wrap,h=c.ao(new Float64Array(16));return c.J(h,h,[a*o,n.y*o,0]),c.K(h,h,[o/c.X,o/c.X,1]),h}calculatePosMatrix(t,n=!1){const o=t.key,a=n?this._alignedPosMatrixCache:this._posMatrixCache;if(a[o])return a[o];const h=this.calculateTileMatrix(t);return c.L(h,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,h),a[o]=new Float32Array(h),a[o]}calculateFogMatrix(t){const n=t.key,o=this._fogMatrixCache;if(o[n])return o[n];const a=this.calculateTileMatrix(t);return c.L(a,this.fogMatrix,a),o[n]=new Float32Array(a),o[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,n){n=c.ad(+n,this.minZoom,this.maxZoom);const o={center:new c.N(t.lng,t.lat),zoom:n};let a=this.lngRange;if(!this._renderWorldCopies&&a===null){const U=179.9999999999;a=[-U,U]}const h=this.tileSize*this.zoomScale(o.zoom);let g=0,y=h,b=0,w=h,C=0,E=0;const{x:R,y:F}=this.size;if(this.latRange){const U=this.latRange;g=c.Q(U[1])*h,y=c.Q(U[0])*h,y-g<F&&(C=F/(y-g))}a&&(b=c.b3(c.O(a[0])*h,0,h),w=c.b3(c.O(a[1])*h,0,h),w<b&&(w+=h),w-b<R&&(E=R/(w-b)));const{x:$,y:H}=this.project.call({worldSize:h},t);let q,X;const Y=Math.max(E||0,C||0);if(Y){const U=new c.P(E?(w+b)/2:$,C?(y+g)/2:H);return o.center=this.unproject.call({worldSize:h},U).wrap(),o.zoom+=this.scaleZoom(Y),o}if(this.latRange){const U=F/2;H-U<g&&(X=g+U),H+U>y&&(X=y-U)}if(a){const U=(b+w)/2;let te=$;this._renderWorldCopies&&(te=c.b3($,U-h/2,U+h/2));const se=R/2;te-se<b&&(q=b+se),te+se>w&&(q=w-se)}if(q!==void 0||X!==void 0){const U=new c.P(q??$,X??H);o.center=this.unproject.call({worldSize:h},U).wrap()}return o}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:o}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=o,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,o=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b5(1,this.center.lat)*this.worldSize;let a=c.ao(new Float64Array(16));c.K(a,a,[this.width/2,-this.height/2,1]),c.J(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=c.ao(new Float64Array(16)),c.K(a,a,[1,-1,1]),c.J(a,a,[-1,-1,0]),c.K(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a;const h=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),g=Math.min(this.elevation,this.minElevationForCurrentTile),y=h-g*this._pixelPerMeter/Math.cos(this._pitch),b=g<0?y:h,w=Math.PI/2+this._pitch,C=this._fov*(.5+t.y/this.height),E=Math.sin(C)*b/Math.sin(c.ad(Math.PI-w-C,.01,Math.PI-.01)),R=this.getHorizon(),F=2*Math.atan(R/this.cameraToCenterDistance)*(.5+t.y/(2*R)),$=Math.sin(F)*b/Math.sin(c.ad(Math.PI-w-F,.01,Math.PI-.01)),H=Math.min(E,$);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*H+b),this.nearZ=this.height/50,a=new Float64Array(16),c.b6(a,this._fov,this.width/this.height,this.nearZ,this.farZ),a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height,this.projectionMatrix=c.af(a),c.K(a,a,[1,-1,1]),c.J(a,a,[0,0,-this.cameraToCenterDistance]),c.b7(a,a,this._pitch),c.ae(a,a,this.angle),c.J(a,a,[-n,-o,0]),this.mercatorMatrix=c.K([],a,[this.worldSize,this.worldSize,this.worldSize]),c.K(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.L(new Float64Array(16),this.labelPlaneMatrix,a),c.J(a,a,[0,0,-this.elevation]),this.modelViewProjectionMatrix=a,this.invModelViewProjectionMatrix=c.at([],a),this.fogMatrix=new Float64Array(16),c.b6(this.fogMatrix,this._fov,this.width/this.height,h,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,c.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),c.b7(this.fogMatrix,this.fogMatrix,this._pitch),c.ae(this.fogMatrix,this.fogMatrix,this.angle),c.J(this.fogMatrix,this.fogMatrix,[-n,-o,0]),c.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=c.L(new Float64Array(16),this.labelPlaneMatrix,a);const q=this.width%2/2,X=this.height%2/2,Y=Math.cos(this.angle),U=Math.sin(this.angle),te=n-Math.round(n)+Y*q+U*X,se=o-Math.round(o)+Y*X+U*q,ce=new Float64Array(a);if(c.J(ce,ce,[te>.5?te-1:te,se>.5?se-1:se,0]),this.alignedModelViewProjectionMatrix=ce,a=c.at(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let o=n.x,a=n.y,h=n.x,g=n.y;for(const y of t)o=Math.min(o,y.x),a=Math.min(a,y.y),h=Math.max(h,y.x),g=Math.max(g,y.y);return[new c.P(o,a),new c.P(h,a),new c.P(h,g),new c.P(o,g),new c.P(o,a)]}}lngLatToCameraDepth(t,n){const o=this.locationCoordinate(t),a=[o.x*this.worldSize,o.y*this.worldSize,n,1];return c.ag(a,a,this.modelViewProjectionMatrix),a[2]/a[3]}}function po(u,t){let n,o=!1,a=null,h=null;const g=()=>{a=null,o&&(u.apply(h,n),a=setTimeout(g,t),o=!1)};return(...y)=>(o=!0,h=this,n=y,a||g(),a)}class Ss{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let o;return n.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(o=a)}),(o&&o[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(o=>isNaN(o))){const o=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:o,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const o=n.join("/");let a=o;a.split("&").length>0&&(a=a.split("&")[0]),this._hashName&&(a=`${this._hashName}=${o}`);let h=window.location.hash.replace(a,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let g=window.location.href.replace(/(#.+)?$/,h);g=g.replace("&&","&"),window.history.replaceState(window.history.state,null,g)},this._updateHash=po(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,a=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,a),g=Math.round(n.lng*h)/h,y=Math.round(n.lat*h)/h,b=this._map.getBearing(),w=this._map.getPitch();let C="";if(C+=t?`/${g}/${y}/${o}`:`${o}/${y}/${g}`,(b||w)&&(C+="/"+Math.round(10*b)/10),w&&(C+=`/${Math.round(w)}`),this._hashName){const E=this._hashName;let R=!1;const F=window.location.hash.slice(1).split("&").map($=>{const H=$.split("=")[0];return H===E?(R=!0,`${H}=${C}`):$}).filter($=>$);return R||F.push(`${E}=${C}`),`#${F.join("&")}`}return`#${C}`}}const _n={linearity:.3,easing:c.b8(0,0,.3,1)},da=c.e({deceleration:2500,maxSpeed:1400},_n),pa=c.e({deceleration:20,maxSpeed:1400},_n),Nl=c.e({deceleration:1e3,maxSpeed:360},_n),fo=c.e({deceleration:1e3,maxSpeed:90},_n);class mo{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ae.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=ae.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)n.zoom+=h.zoomDelta||0,n.bearing+=h.bearingDelta||0,n.pitch+=h.pitchDelta||0,h.panDelta&&n.pan._add(h.panDelta),h.around&&(n.around=h.around),h.pinchAround&&(n.pinchAround=h.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const h=go(n.pan.mag(),o,c.e({},da,t||{}));a.offset=n.pan.mult(h.amount/n.pan.mag()),a.center=this._map.transform.center,On(a,h)}if(n.zoom){const h=go(n.zoom,o,pa);a.zoom=this._map.transform.zoom+h.amount,On(a,h)}if(n.bearing){const h=go(n.bearing,o,Nl);a.bearing=this._map.transform.bearing+c.ad(h.amount,-179,179),On(a,h)}if(n.pitch){const h=go(n.pitch,o,fo);a.pitch=this._map.transform.pitch+h.amount,On(a,h)}if(a.zoom||a.bearing){const h=n.pinchAround===void 0?n.around:n.pinchAround;a.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),c.e(a,{noMoveStart:!0})}}function On(u,t){(!u.duration||u.duration<t.duration)&&(u.duration=t.duration,u.easing=t.easing)}function go(u,t,n){const{maxSpeed:o,linearity:a,deceleration:h}=n,g=c.ad(u*a/(t/1e3),-o,o),y=Math.abs(g)/(h*a);return{easing:n.easing,duration:1e3*y,amount:g*(y/2)}}class Ti extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o,a={}){const h=le.mousePos(n.getCanvas(),o),g=n.unproject(h);super(t,c.e({point:h,lngLat:g,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}}class Ts extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){const a=t==="touchend"?o.changedTouches:o.touches,h=le.touchPos(n.getCanvasContainer(),a),g=h.map(b=>n.unproject(b)),y=h.reduce((b,w,C,E)=>b.add(w.div(E.length)),new c.P(0,0));super(t,{points:h,point:y,lngLats:g,lngLat:n.unproject(y),originalEvent:o}),this._defaultPrevented=!1}}class fa extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class _o{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new fa(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ti(t.type,this._map,t))}mouseup(t){this._map.fire(new Ti(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ti(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ti(t.type,this._map,t))}mouseover(t){this._map.fire(new Ti(t.type,this._map,t))}mouseout(t){this._map.fire(new Ti(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ts(t.type,this._map,t))}touchmove(t){this._map.fire(new Ts(t.type,this._map,t))}touchend(t){this._map.fire(new Ts(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ts(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ma{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ti(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ti("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ti(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vn{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(c.P.convert(t),this._map.terrain)}}class ga{constructor(t,n){this._map=t,this._tr=new Vn(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(le.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const o=n;if(this._lastPos.equals(o)||!this._box&&o.dist(this._startPos)<this._clickTolerance)return;const a=this._startPos;this._lastPos=o,this._box||(this._box=le.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const h=Math.min(a.x,o.x),g=Math.max(a.x,o.x),y=Math.min(a.y,o.y),b=Math.max(a.y,o.y);le.setTransform(this._box,`translate(${h}px,${y}px)`),this._box.style.width=g-h+"px",this._box.style.height=b-y+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const o=this._startPos,a=n;if(this.reset(),le.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new c.k("boxzoomend",{originalEvent:t})),{cameraAnimation:h=>h.fitScreenCoordinates(o,a,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(le.remove(this._box),this._box=null),le.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.k(t,{originalEvent:n}))}}function Nn(u,t){if(u.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${t.length}`);const n={};for(let o=0;o<u.length;o++)n[u[o].identifier]=t[o];return n}class _a{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),o.length===this.numTouches&&(this.centroid=function(a){const h=new c.P(0,0);for(const g of a)h._add(g);return h.div(a.length)}(n),this.touches=Nn(o,n)))}touchmove(t,n,o){if(this.aborted||!this.centroid)return;const a=Nn(o,n);for(const h in this.touches){const g=a[h];(!g||g.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(t,n,o){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),o.length===0){const a=!this.aborted&&this.centroid;if(this.reset(),a)return a}}}class ya{constructor(t){this.singleTap=new _a(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,o){this.singleTap.touchstart(t,n,o)}touchmove(t,n,o){this.singleTap.touchmove(t,n,o)}touchend(t,n,o){const a=this.singleTap.touchend(t,n,o);if(a){const h=t.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(a)<30;if(h&&g||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class $l{constructor(t){this._tr=new Vn(t),this._zoomIn=new ya({numTouches:1,numTaps:2}),this._zoomOut=new ya({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,o){this._zoomIn.touchstart(t,n,o),this._zoomOut.touchstart(t,n,o)}touchmove(t,n,o){this._zoomIn.touchmove(t,n,o),this._zoomOut.touchmove(t,n,o)}touchend(t,n,o){const a=this._zoomIn.touchend(t,n,o),h=this._zoomOut.touchend(t,n,o),g=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom+1,around:g.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom-1,around:g.unproject(h)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class zt{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const o=this._lastPoint;if(!o)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const a=n.length?n[0]:n;return!this._moved&&a.dist(o)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=a,this._move(o,a))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&le.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const yn={0:1,2:2};class Ai{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=le.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,o){const a=yn[o];return n.buttons===void 0||(n.buttons&a)!==a}(t,this._eventButton)}isValidEndEvent(t){return le.mouseButton(t)===this._eventButton}}class yo{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const ks=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=t=>{t.preventDefault()}},xa=({enable:u,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const o=new Ai({checkCorrectEvent:a=>le.mouseButton(a)===0&&a.ctrlKey||le.mouseButton(a)===2});return new zt({clickTolerance:t,move:(a,h)=>({bearingDelta:(h.x-a.x)*n}),moveStateManager:o,enable:u,assignEvents:ks})},xn=({enable:u,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const o=new Ai({checkCorrectEvent:a=>le.mouseButton(a)===0&&a.ctrlKey||le.mouseButton(a)===2});return new zt({clickTolerance:t,move:(a,h)=>({pitchDelta:(h.y-a.y)*n}),moveStateManager:o,enable:u,assignEvents:ks})};class Is{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,o){return this._calculateTransform(t,n,o)}touchmove(t,n,o){if(this._active){if(!this._shouldBePrevented(o.length))return t.preventDefault(),this._calculateTransform(t,n,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,o){this._calculateTransform(t,n,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,o){o.length>0&&(this._active=!0);const a=Nn(o,n),h=new c.P(0,0),g=new c.P(0,0);let y=0;for(const w in a){const C=a[w],E=this._touches[w];E&&(h._add(C),g._add(C.sub(E)),y++,a[w]=C)}if(this._touches=a,this._shouldBePrevented(y)||!g.mag())return;const b=g.div(y);return this._sum._add(b),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(y),panDelta:b}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Cs{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,o){if(!this._firstTwoTouches)return;t.preventDefault();const[a,h]=this._firstTwoTouches,g=Es(o,n,a),y=Es(o,n,h);if(!g||!y)return;const b=this._aroundCenter?null:g.add(y).div(2);return this._move([g,y],b,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,g=Es(o,n,a),y=Es(o,n,h);g&&y||(this._active&&le.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Es(u,t,n){for(let o=0;o<u.length;o++)if(u[o].identifier===n)return t[o]}function va(u,t){return Math.log(u/t)/Math.LN2}class ba extends Cs{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const o=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(va(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:va(this._distance,o),pinchAround:n}}}function wa(u,t){return 180*u.angleWith(t)/Math.PI}class Sa extends Cs{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n,o){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:wa(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,o=wa(t,this._startVector);return Math.abs(o)<n}}function Lr(u){return Math.abs(u.y)>Math.abs(u.x)}class Ta extends Cs{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,o){super.touchstart(t,n,o),this._currentTouchCount=o.length}_start(t){this._lastPoints=t,Lr(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,o){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const a=t[0].sub(this._lastPoints[0]),h=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,h,o.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(a.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,o){if(this._valid!==void 0)return this._valid;const a=t.mag()>=2,h=n.mag()>=2;if(!a&&!h)return;if(!a||!h)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;const g=t.y>0==n.y>0;return Lr(t)&&Lr(n)&&g}}const Ul={panStep:100,bearingStep:15,pitchStep:10};class ka{constructor(t){this._tr=new Vn(t);const n=Ul;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,o=0,a=0,h=0,g=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?o=-1:(t.preventDefault(),h=-1);break;case 39:t.shiftKey?o=1:(t.preventDefault(),h=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),g=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(o=0,a=0),{cameraAnimation:y=>{const b=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:jl,zoom:n?Math.round(b.zoom)+n*(t.shiftKey?2:1):b.zoom,bearing:b.bearing+o*this._bearingStep,pitch:b.pitch+a*this._pitchStep,offset:[-h*this._panStep,-g*this._panStep],center:b.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function jl(u){return u*(2-u)}const Ia=4.000244140625;class Ca{constructor(t,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=t,this._tr=new Vn(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const o=ae.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%Ia==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(a*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=le.mousePos(this._map.getCanvas(),t),o=this._tr;this._around=n.y>o.transform.height/2-o.transform.getHorizon()?c.N.convert(this._aroundCenter?o.center:o.unproject(n)):c.N.convert(o.center),this._aroundPoint=o.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const b=this._type==="wheel"&&Math.abs(this._delta)>Ia?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*b)));this._delta<0&&w!==0&&(w=1/w);const C=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(C*w))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,o=this._startZoom,a=this._easing;let h,g=!1;const y=ae.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&y){const b=Math.min(y/200,1),w=a(b);h=c.z.number(o,n,w),b<1?this._frameId||(this._frameId=!0):g=!0}else h=n,g=!0;return this._active=!0,g&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!g,zoomDelta:h-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.b9;if(this._prevEase){const o=this._prevEase,a=(ae.now()-o.start)/o.duration,h=o.easing(a+.01)-o.easing(a),g=.27/Math.sqrt(h*h+1e-4)*.01,y=Math.sqrt(.0729-g*g);n=c.b8(g,y,.25,1)}return this._prevEase={start:ae.now(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ea{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 Ps{constructor(t){this._tr=new Vn(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:o=>{o.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ql{constructor(){this._tap=new ya({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,o){if(!this._swipePoint)if(this._tapTime){const a=n[0],h=t.timeStamp-this._tapTime<500,g=this._tapPoint.dist(a)<30;h&&g?o.length>0&&(this._swipePoint=a,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(t,n,o)}touchmove(t,n,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;const a=n[0],h=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(t,n,o)}touchend(t,n,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{const a=this._tap.touchend(t,n,o);a&&(this._tapTime=t.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ji{constructor(t,n,o){this._el=t,this._mousePan=n,this._touchPan=o}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ir{constructor(t,n,o){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=o}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Pa{constructor(t,n,o,a){this._el=t,this._touchZoom=n,this._touchRotate=o,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class rr{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=le.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=n,this._container.appendChild(a);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=o,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(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Rr=u=>u.zoom||u.drag||u.pitch||u.rotate;class ih extends c.k{}function Aa(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class rh{constructor(t,n){this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,h)=>{if(a.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const g=a.type==="renderFrame"?void 0:a,y={needsRenderFrame:!1},b={},w={},C=a.touches,E=C?this._getMapTouches(C):void 0,R=E?le.touchPos(this._map.getCanvas(),E):le.mousePos(this._map.getCanvas(),a);for(const{handlerName:H,handler:q,allowed:X}of this._handlers){if(!q.isEnabled())continue;let Y;this._blockedByActive(w,X,H)?q.reset():q[h||a.type]&&(Y=q[h||a.type](a,R,E),this.mergeHandlerResult(y,b,Y,H,g),Y&&Y.needsRenderFrame&&this._triggerRenderFrame()),(Y||q.isActive())&&(w[H]=q)}const F={};for(const H in this._previousActiveHandlers)w[H]||(F[H]=g);this._previousActiveHandlers=w,(Object.keys(F).length||Aa(y))&&(this._changes.push([y,b,F]),this._triggerRenderFrame()),(Object.keys(w).length||Aa(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:$}=y;$&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],$(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new mo(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[window,"blur",void 0]];for(const[a,h,g]of this._listeners)le.addEventListener(a,h,a===document?this.handleWindowEvent:this.handleEvent,g)}destroy(){for(const[t,n,o]of this._listeners)le.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(t){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new _o(n,t));const a=n.boxZoom=new ga(n,t);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();const h=n.cooperativeGestures=new rr(n,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const g=new $l(n),y=new Ps(n);n.doubleClickZoom=new Ea(y,g),this._add("tapZoom",g),this._add("clickZoom",y),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const b=new ql;this._add("tapDragZoom",b);const w=n.touchPitch=new Ta(n);this._add("touchPitch",w),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const C=xa(t),E=xn(t);n.dragRotate=new ir(t,C,E),this._add("mouseRotate",C,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const R=(({enable:Y,clickTolerance:U})=>{const te=new Ai({checkCorrectEvent:se=>le.mouseButton(se)===0&&!se.ctrlKey});return new zt({clickTolerance:U,move:(se,ce)=>({around:ce,panDelta:ce.sub(se)}),activateOnStart:!0,moveStateManager:te,enable:Y,assignEvents:ks})})(t),F=new Is(t,n);n.dragPan=new Ji(o,R,F),this._add("mousePan",R),this._add("touchPan",F,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const $=new Sa,H=new ba;n.touchZoomRotate=new Pa(o,H,$,b),this._add("touchRotate",$,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const q=n.scrollZoom=new Ca(n,()=>this._triggerRenderFrame());this._add("scrollZoom",q,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const X=n.keyboard=new ka(n);this._add("keyboard",X),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new ma(n))}_add(t,n,o){this._handlers.push({handlerName:t,handler:n,allowed:o}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Rr(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,o){for(const a in t)if(a!==o&&(!n||n.indexOf(a)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const o of t)this._el.contains(o.target)&&n.push(o);return n}mergeHandlerResult(t,n,o,a,h){if(!o)return;c.e(t,o);const g={handlerName:a,originalEvent:o.originalEvent||h};o.zoomDelta!==void 0&&(n.zoom=g),o.panDelta!==void 0&&(n.drag=g),o.pitchDelta!==void 0&&(n.pitch=g),o.bearingDelta!==void 0&&(n.rotate=g)}_applyChanges(){const t={},n={},o={};for(const[a,h,g]of this._changes)a.panDelta&&(t.panDelta=(t.panDelta||new c.P(0,0))._add(a.panDelta)),a.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+a.pitchDelta),a.around!==void 0&&(t.around=a.around),a.pinchAround!==void 0&&(t.pinchAround=a.pinchAround),a.noInertia&&(t.noInertia=a.noInertia),c.e(n,h),c.e(o,g);this._updateMapTransform(t,n,o),this._changes=[]}_updateMapTransform(t,n,o){const a=this._map,h=a._getTransformForUpdate(),g=a.terrain;if(!(Aa(t)||g&&this._terrainMovement))return this._fireEvents(n,o,!0);let{panDelta:y,zoomDelta:b,bearingDelta:w,pitchDelta:C,around:E,pinchAround:R}=t;R!==void 0&&(E=R),a._stop(!0),E=E||a.transform.centerPoint;const F=h.pointLocation(y?E.sub(y):E);w&&(h.bearing+=w),C&&(h.pitch+=C),b&&(h.zoom+=b),g?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(y)):h.setLocationAtPoint(F,E):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(F,E)):h.setLocationAtPoint(F,E),a._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,o,!0)}_fireEvents(t,n,o){const a=Rr(this._eventsInProgress),h=Rr(t),g={};for(const E in t){const{originalEvent:R}=t[E];this._eventsInProgress[E]||(g[`${E}start`]=R),this._eventsInProgress[E]=t[E]}!a&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in g)this._fireEvent(E,g[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in t){const{originalEvent:R}=t[E];this._fireEvent(E,R)}const y={};let b;for(const E in this._eventsInProgress){const{handlerName:R,originalEvent:F}=this._eventsInProgress[E];this._handlersById[R].isActive()||(delete this._eventsInProgress[E],b=n[R]||F,y[`${E}end`]=b)}for(const E in y)this._fireEvent(E,y[E]);const w=Rr(this._eventsInProgress),C=(a||h)&&!w;if(C&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();E.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(E)}if(o&&C){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),R=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!E||!E.essential&&ae.prefersReducedMotion?(this._map.fire(new c.k("moveend",{originalEvent:b})),R(this._map.getBearing())&&this._map.resetNorth()):(R(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:b})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new c.k(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new ih("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class nh extends c.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const o=Math.min((ae.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,o){return t=c.P.convert(t).mult(-1),this.panTo(this.transform.center,c.e({offset:t},n),o)}panTo(t,n,o){return this.easeTo(c.e({center:t},n),o)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,o){return this.easeTo(c.e({zoom:t},n),o)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,o){return this.easeTo(c.e({bearing:t},n),o)}resetNorth(t,n){return this.rotateTo(0,c.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=ue.convert(t);const o=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),o,n)}_cameraForBoxAndBearing(t,n,o,a){const h={top:0,bottom:0,right:0,left:0};if(typeof(a=c.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){const Se=a.padding;a.padding={top:Se,bottom:Se,right:Se,left:Se}}a.padding=c.e(h,a.padding);const g=this.transform,y=g.padding,b=new ue(t,n),w=g.project(b.getNorthWest()),C=g.project(b.getNorthEast()),E=g.project(b.getSouthEast()),R=g.project(b.getSouthWest()),F=c.ba(-o),$=w.rotate(F),H=C.rotate(F),q=E.rotate(F),X=R.rotate(F),Y=new c.P(Math.max($.x,H.x,X.x,q.x),Math.max($.y,H.y,X.y,q.y)),U=new c.P(Math.min($.x,H.x,X.x,q.x),Math.min($.y,H.y,X.y,q.y)),te=Y.sub(U),se=(g.width-(y.left+y.right+a.padding.left+a.padding.right))/te.x,ce=(g.height-(y.top+y.bottom+a.padding.top+a.padding.bottom))/te.y;if(ce<0||se<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ye=Math.min(g.scaleZoom(g.scale*Math.min(se,ce)),a.maxZoom),we=c.P.convert(a.offset),De=new c.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(c.ba(o)),Re=we.add(De).mult(g.scale/g.zoomScale(ye));return{center:g.unproject(w.add(E).div(2).sub(Re)),zoom:ye,bearing:o}}fitBounds(t,n,o){return this._fitInternal(this.cameraForBounds(t,n),n,o)}fitScreenCoordinates(t,n,o,a,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.P.convert(t)),this.transform.pointLocation(c.P.convert(n)),o,a),a,h)}_fitInternal(t,n,o){return t?(delete(n=c.e(t,n)).padding,n.linear?this.easeTo(n,o):this.flyTo(n,o)):this}jumpTo(t,n){this.stop();const o=this._getTransformForUpdate();let a=!1,h=!1,g=!1;return"zoom"in t&&o.zoom!==+t.zoom&&(a=!0,o.zoom=+t.zoom),t.center!==void 0&&(o.center=c.N.convert(t.center)),"bearing"in t&&o.bearing!==+t.bearing&&(h=!0,o.bearing=+t.bearing),"pitch"in t&&o.pitch!==+t.pitch&&(g=!0,o.pitch=+t.pitch),t.padding==null||o.isPaddingEqual(t.padding)||(o.padding=t.padding),this._applyUpdatedTransform(o),this.fire(new c.k("movestart",n)).fire(new c.k("move",n)),a&&this.fire(new c.k("zoomstart",n)).fire(new c.k("zoom",n)).fire(new c.k("zoomend",n)),h&&this.fire(new c.k("rotatestart",n)).fire(new c.k("rotate",n)).fire(new c.k("rotateend",n)),g&&this.fire(new c.k("pitchstart",n)).fire(new c.k("pitch",n)).fire(new c.k("pitchend",n)),this.fire(new c.k("moveend",n))}calculateCameraOptionsFromTo(t,n,o,a=0){const h=c.Z.fromLngLat(t,n),g=c.Z.fromLngLat(o,a),y=g.x-h.x,b=g.y-h.y,w=g.z-h.z,C=Math.hypot(y,b,w);if(C===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(y,b),R=this.transform.scaleZoom(this.transform.cameraToCenterDistance/C/this.transform.tileSize),F=180*Math.atan2(y,-b)/Math.PI;let $=180*Math.acos(E/C)/Math.PI;return $=w<0?90-$:90+$,{center:g.toLngLat(),zoom:R,pitch:$,bearing:F}}easeTo(t,n){var o;this._stop(!1,t.easeId),((t=c.e({offset:[0,0],duration:500,easing:c.b9},t)).animate===!1||!t.essential&&ae.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),h=a.zoom,g=a.bearing,y=a.pitch,b=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,g):g,C="pitch"in t?+t.pitch:y,E="padding"in t?t.padding:a.padding,R=c.P.convert(t.offset);let F=a.centerPoint.add(R);const $=a.pointLocation(F),{center:H,zoom:q}=a.getConstrained(c.N.convert(t.center||$),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(H,a);const X=a.project($),Y=a.project(H).sub(X),U=a.zoomScale(q-h);let te,se;t.around&&(te=c.N.convert(t.around),se=a.locationPoint(te));const ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||q!==h,this._rotating=this._rotating||g!==w,this._pitching=this._pitching||C!==y,this._padding=!a.isPaddingEqual(E),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ce),this.terrain&&this._prepareElevation(H),this._ease(ye=>{if(this._zooming&&(a.zoom=c.z.number(h,q,ye)),this._rotating&&(a.bearing=c.z.number(g,w,ye)),this._pitching&&(a.pitch=c.z.number(y,C,ye)),this._padding&&(a.interpolatePadding(b,E,ye),F=a.centerPoint.add(R)),this.terrain&&!t.freezeElevation&&this._updateElevation(ye),te)a.setLocationAtPoint(te,se);else{const we=a.zoomScale(a.zoom-h),De=q>h?Math.min(2,U):Math.max(.5,U),Re=Math.pow(De,1-ye),Se=a.unproject(X.add(Y.mult(ye*Re)).mult(we));a.setLocationAtPoint(a.renderWorldCopies?Se.wrap():Se,F)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},ye=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,ye)},t),this}_prepareEase(t,n,o={}){this._moving=!0,n||o.moving||this.fire(new c.k("movestart",t)),this._zooming&&!o.zooming&&this.fire(new c.k("zoomstart",t)),this._rotating&&!o.rotating&&this.fire(new c.k("rotatestart",t)),this._pitching&&!o.pitching&&this.fire(new c.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const o=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(o-(n-(o*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=c.z.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){const n=t.getCameraPosition(),o=this.terrain.getElevationForLngLatZoom(n.lngLat,t.zoom);if(n.altitude<o){const a=this.calculateCameraOptionsFromTo(n.lngLat,o,t.center,t.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(this.terrain&&n.push(a=>this._elevateCameraIfInsideTerrain(a)),this.transformCameraUpdate&&n.push(a=>this.transformCameraUpdate(a)),!n.length)return;const o=t.clone();for(const a of n){const h=o.clone(),{center:g,zoom:y,pitch:b,bearing:w,elevation:C}=a(h);g&&(h.center=g),y!==void 0&&(h.zoom=y),b!==void 0&&(h.pitch=b),w!==void 0&&(h.bearing=w),C!==void 0&&(h.elevation=C),o.apply(h)}this.transform.apply(o)}_fireMoveEvents(t){this.fire(new c.k("move",t)),this._zooming&&this.fire(new c.k("zoom",t)),this._rotating&&this.fire(new c.k("rotate",t)),this._pitching&&this.fire(new c.k("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,a=this._rotating,h=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new c.k("zoomend",t)),a&&this.fire(new c.k("rotateend",t)),h&&this.fire(new c.k("pitchend",t)),this.fire(new c.k("moveend",t))}flyTo(t,n){var o;if(!t.essential&&ae.prefersReducedMotion){const Ae=c.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ae,n)}this.stop(),t=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b9},t);const a=this._getTransformForUpdate(),h=a.zoom,g=a.bearing,y=a.pitch,b=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,g):g,C="pitch"in t?+t.pitch:y,E="padding"in t?t.padding:a.padding,R=c.P.convert(t.offset);let F=a.centerPoint.add(R);const $=a.pointLocation(F),{center:H,zoom:q}=a.getConstrained(c.N.convert(t.center||$),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(H,a);const X=a.zoomScale(q-h),Y=a.project($),U=a.project(H).sub(Y);let te=t.curve;const se=Math.max(a.width,a.height),ce=se/X,ye=U.mag();if("minZoom"in t){const Ae=c.ad(Math.min(t.minZoom,h,q),a.minZoom,a.maxZoom),Qe=se/a.zoomScale(Ae-h);te=Math.sqrt(Qe/ye*2)}const we=te*te;function De(Ae){const Qe=(ce*ce-se*se+(Ae?-1:1)*we*we*ye*ye)/(2*(Ae?ce:se)*we*ye);return Math.log(Math.sqrt(Qe*Qe+1)-Qe)}function Re(Ae){return(Math.exp(Ae)-Math.exp(-Ae))/2}function Se(Ae){return(Math.exp(Ae)+Math.exp(-Ae))/2}const Te=De(!1);let Ne=function(Ae){return Se(Te)/Se(Te+te*Ae)},tt=function(Ae){return se*((Se(Te)*(Re(Qe=Te+te*Ae)/Se(Qe))-Re(Te))/we)/ye;var Qe},Ce=(De(!0)-Te)/te;if(Math.abs(ye)<1e-6||!isFinite(Ce)){if(Math.abs(se-ce)<1e-6)return this.easeTo(t,n);const Ae=ce<se?-1:1;Ce=Math.abs(Math.log(ce/se))/te,tt=()=>0,Ne=Qe=>Math.exp(Ae*te*Qe)}return t.duration="duration"in t?+t.duration:1e3*Ce/("screenSpeed"in t?+t.screenSpeed/te:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=g!==w,this._pitching=C!==y,this._padding=!a.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(H),this._ease(Ae=>{const Qe=Ae*Ce,Dt=1/Ne(Qe);a.zoom=Ae===1?q:h+a.scaleZoom(Dt),this._rotating&&(a.bearing=c.z.number(g,w,Ae)),this._pitching&&(a.pitch=c.z.number(y,C,Ae)),this._padding&&(a.interpolatePadding(b,E,Ae),F=a.centerPoint.add(R)),this.terrain&&!t.freezeElevation&&this._updateElevation(Ae);const ot=Ae===1?H:a.unproject(Y.add(U.mult(tt(Qe))).mult(Dt));a.setLocationAtPoint(a.renderWorldCopies?ot.wrap():ot,F),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}return t||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(t,n,o){o.animate===!1||o.duration===0?(t(1),n()):(this._easeStart=ae.now(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=c.b3(t,-180,180);const o=Math.abs(t-n);return Math.abs(t-360-n)<o&&(t-=360),Math.abs(t+360-n)<o&&(t+=360),t}_normalizeCenter(t,n){if(!n.renderWorldCopies||n.lngRange)return;const o=t.lng-n.center.lng;t.lng+=o>180?-360:o<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const Ma={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class $n{constructor(t=Ma){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=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.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(t,n){const o=this._map._getUIString(`AttributionControl.${n}`);t.title=o,t.setAttribute("aria-label",o)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(a=>typeof a!="string"?"":a)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const a=this._map.style.stylesheet;this.styleOwner=a.owner,this.styleId=a.id}const n=this._map.style.sourceCaches;for(const a in n){const h=n[a];if(h.used||h.usedForTerrain){const g=h.getSource();g.attribution&&t.indexOf(g.attribution)<0&&t.push(g.attribution)}}t=t.filter(a=>String(a).trim()),t.sort((a,h)=>a.length-h.length),t=t.filter((a,h)=>{for(let g=h+1;g<t.length;g++)if(t[g].indexOf(a)>=0)return!1;return!0});const o=t.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class xr{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const o=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact"):o.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=le.create("div","maplibregl-ctrl");const n=le.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),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 Fe{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,o=n?this._queue.concat(n):this._queue;for(const a of o)if(a.id===t)return void(a.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const o of n)if(!o.cancelled&&(o.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Zl=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class za extends c.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const o={};for(const a of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))o[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),c.aQ(a.posMatrix,0,c.X,0,c.X,0,1),this._tiles[a.key]=new Zr(a,this.tileSize));for(const a in this._tiles)o[a]||delete this._tiles[a]}freeRtt(t){for(const n in this._tiles){const o=this._tiles[n];(!t||o.tileID.equals(t)||o.tileID.isChildOf(t)||t.isChildOf(o.tileID))&&(o.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const o of this._renderableTilesKeys){const a=this._tiles[o].tileID;if(a.canonical.equals(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16),c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),n[o]=h}else if(a.canonical.isChildOf(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const g=a.canonical.z-t.canonical.z,y=a.canonical.x-(a.canonical.x>>g<<g),b=a.canonical.y-(a.canonical.y>>g<<g),w=c.X>>g;c.aQ(h.posMatrix,0,w,0,w,0,1),c.J(h.posMatrix,h.posMatrix,[-y*w,-b*w,0]),n[o]=h}else if(t.canonical.isChildOf(a.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const g=t.canonical.z-a.canonical.z,y=t.canonical.x-(t.canonical.x>>g<<g),b=t.canonical.y-(t.canonical.y>>g<<g),w=c.X>>g;c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),c.J(h.posMatrix,h.posMatrix,[y*w,b*w,0]),c.K(h.posMatrix,h.posMatrix,[1/2**g,1/2**g,0]),n[o]=h}}return n}getSourceTile(t,n){const o=this.sourceCache._source;let a=t.overscaledZ-this.deltaZoom;if(a>o.maxzoom&&(a=o.maxzoom),a<o.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(a).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!h||!h.dem)&&n)for(;a>=o.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(t.scaledTo(a--).key);return h}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class Gl{constructor(t,n,o){this.painter=t,this.sourceCache=new za(n),this.options=o,this.exaggeration=typeof o.exaggeration=="number"?o.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,o,a=c.X){var h;if(!(n>=0&&n<a&&o>=0&&o<a))return 0;const g=this.getTerrainData(t),y=(h=g.tile)===null||h===void 0?void 0:h.dem;if(!y)return 0;const b=function($,H,q){var X=H[0],Y=H[1];return $[0]=q[0]*X+q[4]*Y+q[12],$[1]=q[1]*X+q[5]*Y+q[13],$}([],[n/a*c.X,o/a*c.X],g.u_terrain_matrix),w=[b[0]*y.dim,b[1]*y.dim],C=Math.floor(w[0]),E=Math.floor(w[1]),R=w[0]-C,F=w[1]-E;return y.get(C,E)*(1-R)*(1-F)+y.get(C+1,E)*R*(1-F)+y.get(C,E+1)*(1-R)*F+y.get(C+1,E+1)*R*F}getElevationForLngLatZoom(t,n){const{tileID:o,mercatorX:a,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(o,a%c.X,h%c.X,c.X)}getElevation(t,n,o,a=c.X){return this.getDEMElevation(t,n,o,a)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const a=this.painter.context,h=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new St(a,h,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new St(a,new c.R({width:1,height:1}),a.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.ao([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const a=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new St(a,n.dem.getPixels(),a.gl.RGBA,{premultiply:!1}),n.demTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const o=n&&n+n.tileID.key+t.key;if(o&&!this._demMatrixCache[o]){const a=this.sourceCache.sourceCache._source.maxzoom;let h=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=a?h=t.canonical.z-a:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const g=t.canonical.x-(t.canonical.x>>h<<h),y=t.canonical.y-(t.canonical.y>>h<<h),b=c.bb(new Float64Array(16),[1/(c.X<<h),1/(c.X<<h),0]);c.J(b,b,[g*c.X,y*c.X,0]),this._demMatrixCache[t.key]={matrix:b,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:o?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,o=n.width/devicePixelRatio,a=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===o&&this._fbo.height===a||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new St(n.context,{width:o,height:a,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new St(n.context,{width:o,height:a,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(o,a,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,o,a))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,g=0;h<this._coordsTextureSize;h++)for(let y=0;y<this._coordsTextureSize;y++,g+=4)n[g+0]=255&y,n[g+1]=255&h,n[g+2]=y>>8<<4|h>>8,n[g+3]=0;const o=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new St(t,o,t.gl.RGBA,{premultiply:!1});return a.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),o=this.painter.context,a=o.gl,h=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),g=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),y=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,y-g-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const b=n[0]+(n[2]>>4<<8),w=n[1]+((15&n[2])<<8),C=this.coordsIndex[255-n[3]],E=C&&this.sourceCache.getTileByID(C);if(!E)return null;const R=this._coordsTextureSize,F=(1<<E.tileID.canonical.z)*R;return new c.Z((E.tileID.canonical.x*R+b)/F+E.tileID.wrap,(E.tileID.canonical.y*R+w)/F,this.getElevation(E.tileID,b,w,R))}depthAtPoint(t){const n=new Uint8Array(4),o=this.painter.context,a=o.gl;return o.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),a.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new c.bc,o=new c.aY,a=this.meshSize,h=c.X/a,g=a*a;for(let E=0;E<=a;E++)for(let R=0;R<=a;R++)n.emplaceBack(R*h,E*h,0);for(let E=0;E<g;E+=a+1)for(let R=0;R<a;R++)o.emplaceBack(R+E,a+R+E+1,a+R+E+2),o.emplaceBack(R+E,a+R+E+2,R+E+1);const y=n.length,b=y+2*(a+1);for(const E of[0,1])for(let R=0;R<=a;R++)for(const F of[0,1])n.emplaceBack(R*h,E*c.X,F);for(let E=0;E<2*a;E+=2)o.emplaceBack(b+E,b+E+1,b+E+3),o.emplaceBack(b+E,b+E+3,b+E+2),o.emplaceBack(y+E,y+E+3,y+E+1),o.emplaceBack(y+E,y+E+2,y+E+3);const w=n.length,C=w+2*(a+1);for(const E of[0,1])for(let R=0;R<=a;R++)for(const F of[0,1])n.emplaceBack(E*c.X,R*h,F);for(let E=0;E<2*a;E+=2)o.emplaceBack(w+E,w+E+1,w+E+3),o.emplaceBack(w+E,w+E+3,w+E+2),o.emplaceBack(C+E,C+E+3,C+E+1),o.emplaceBack(C+E,C+E+2,C+E+3);return this._mesh=new Ol(t.createVertexBuffer(n,Zl.members),t.createIndexBuffer(o),c.a0.simpleSegment(0,0,n.length,o.length)),this._mesh}getMeshFrameDelta(t){return 2*Math.PI*c.bd/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,n){var o;const{tileID:a}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(o=this.getMinMaxElevation(a).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,o={minElevation:null,maxElevation:null};return n&&n.dem&&(o.minElevation=n.dem.min*this.exaggeration,o.maxElevation=n.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(t,n){const o=c.Z.fromLngLat(t.wrap()),a=(1<<n)*c.X,h=o.x*a,g=o.y*a,y=Math.floor(h/c.X),b=Math.floor(g/c.X);return{tileID:new c.S(n,0,n,y,b),mercatorX:h,mercatorY:g}}}class As{constructor(t,n,o){this._context=t,this._size=n,this._tileSize=o,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),o=new St(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(o.texture),{id:t,fbo:n,texture:o,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(t=>!t.inUse)===!1}}const vr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Hl{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new As(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(o=>!t._layers[o].isHidden(n)),this._coordsDescendingInv={};for(const o in t.sourceCaches){this._coordsDescendingInv[o]={};const a=t.sourceCaches[o].getVisibleCoordinates();for(const h of a){const g=this.terrain.sourceCache.getTerrainCoords(h);for(const y in g)this._coordsDescendingInv[o][y]||(this._coordsDescendingInv[o][y]=[]),this._coordsDescendingInv[o][y].push(g[y])}}this._coordsDescendingInvStr={};for(const o of t._order){const a=t._layers[o],h=a.source;if(vr[a.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const g in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][g]=this._coordsDescendingInv[h][g].map(y=>y.key).sort().join()}}for(const o of this._renderableTiles)for(const a in this._coordsDescendingInvStr){const h=this._coordsDescendingInvStr[a][o.tileID.key];h&&h!==o.rttCoords[a]&&(o.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(vr[n]&&(this._prevType&&vr[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(vr[this._prevType]||vr[n]&&a){this._prevType=n;const h=this._stacks.length-1,g=this._stacks[h]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(ws(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[h]){const w=this.pool.getObjectForId(y.rtt[h].id);if(w.stamp===y.rtt[h].stamp){this.pool.useObject(w);continue}}const b=this.pool.getOrCreateFreeObject();this.pool.useObject(b),this.pool.stampObject(b),y.rtt[h]={id:b.id,stamp:b.stamp},o.context.bindFramebuffer.set(b.fbo.framebuffer),o.context.clear({color:c.aN.transparent,stencil:0}),o.currentStencilSource=void 0;for(let w=0;w<g.length;w++){const C=o.style._layers[g[w]],E=C.source?this._coordsDescendingInv[C.source][y.tileID.key]:[y.tileID];o.context.viewport.set([0,0,b.fbo.width,b.fbo.height]),o._renderTileClippingMasks(C,E),o.renderLayer(o,o.style.sourceCaches[C.source],C,E),C.source&&(y.rttCoords[C.source]=this._coordsDescendingInvStr[C.source][y.tileID.key])}}return ws(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),vr[n]}return!1}}const ze={"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","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"},Da=fe,sh={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ma,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!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],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:c.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},Wl=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},La={showCompass:!0,showZoom:!0,visualizePitch:!1};class Xl{constructor(t,n,o=!1){this.mousedown=g=>{this.startMouse(c.e({},g,{ctrlKey:!0,preventDefault:()=>g.preventDefault()}),le.mousePos(this.element,g)),le.addEventListener(window,"mousemove",this.mousemove),le.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=g=>{this.moveMouse(g,le.mousePos(this.element,g))},this.mouseup=g=>{this.mouseRotate.dragEnd(g),this.mousePitch&&this.mousePitch.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=le.touchPos(this.element,g.targetTouches)[0],this.startTouch(g,this._startPos),le.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.addEventListener(window,"touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=le.touchPos(this.element,g.targetTouches)[0],this.moveTouch(g,this._lastPos))},this.touchend=g=>{g.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.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const a=t.dragRotate._mouseRotate.getClickTolerance(),h=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=xa({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:g,clickTolerance:y,bearingDegreesPerPixelMoved:b=.8})=>{const w=new yo;return new zt({clickTolerance:y,move:(C,E)=>({bearingDelta:(E.x-C.x)*b}),moveStateManager:w,enable:g,assignEvents:Wl})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=xn({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:g,clickTolerance:y,pitchDegreesPerPixelMoved:b=-.5})=>{const w=new yo;return new zt({clickTolerance:y,move:(C,E)=>({pitchDelta:(E.y-C.y)*b}),moveStateManager:w,enable:g,assignEvents:Wl})})({clickTolerance:h,enable:!0})),le.addEventListener(n,"mousedown",this.mousedown),le.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),le.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),le.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),le.disableDrag()}moveMouse(t,n){const o=this.map,{bearingDelta:a}=this.mouseRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.mousePitch){const{pitchDelta:h}=this.mousePitch.dragMove(t,n)||{};h&&o.setPitch(o.getPitch()+h)}}moveTouch(t,n){const o=this.map,{bearingDelta:a}=this.touchRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.touchPitch){const{pitchDelta:h}=this.touchPitch.dragMove(t,n)||{};h&&o.setPitch(o.getPitch()+h)}}off(){const t=this.element;le.removeEventListener(t,"mousedown",this.mousedown),le.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend),le.removeEventListener(t,"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 Kr;function Jl(u,t,n){const o=new c.N(u.lng,u.lat);if(u=new c.N(u.lng,u.lat),t){const a=new c.N(u.lng-360,u.lat),h=new c.N(u.lng+360,u.lat),g=n.locationPoint(u).distSqr(t);n.locationPoint(a).distSqr(t)<g?u=a:n.locationPoint(h).distSqr(t)<g&&(u=h)}for(;Math.abs(u.lng-n.center.lng)>180;){const a=n.locationPoint(u);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;u.lng>n.center.lng?u.lng-=360:u.lng+=360}return u.lng!==o.lng&&n.locationPoint(u).y>n.height/2-n.getHorizon()?u:o}const Ra={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 Yr(u,t,n){const o=u.classList;for(const a in Ra)o.remove(`maplibregl-${n}-anchor-${a}`);o.add(`maplibregl-${n}-anchor-${t}`)}class Pt extends c.E{constructor(t){if(super(),this._onKeyPress=n=>{const o=n.code,a=n.charCode||n.keyCode;o!=="Space"&&o!=="Enter"&&a!==32&&a!==13||this.togglePopup()},this._onMapClick=n=>{const o=n.originalEvent.target,a=this._element;this._popup&&(o===a||a.contains(o))&&this.togglePopup()},this._update=n=>{var o;if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Jl(this._lngLat,this._flatPos,this._map.transform):(o=this._lngLat)===null||o===void 0?void 0:o.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let g="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?g="rotateX(0deg)":this._pitchAlignment==="map"&&(g=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),le.setTransform(this._element,`${Ra[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${g} ${h}`),ae.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}this._isDragging&&(this._pos=n.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 c.k("dragstart"))),this.fire(new c.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.k("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=c.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=le.create("div");const n=le.createNS("http://www.w3.org/2000/svg","svg"),o=41,a=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${a}px`),n.setAttributeNS(null,"viewBox",`0 0 ${a} ${o}`);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 g=le.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"fill-rule","nonzero");const y=le.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const b=[{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 X of b){const Y=le.createNS("http://www.w3.org/2000/svg","ellipse");Y.setAttributeNS(null,"opacity","0.04"),Y.setAttributeNS(null,"cx","10.5"),Y.setAttributeNS(null,"cy","5.80029008"),Y.setAttributeNS(null,"rx",X.rx),Y.setAttributeNS(null,"ry",X.ry),y.appendChild(Y)}const w=le.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill",this._color);const C=le.createNS("http://www.w3.org/2000/svg","path");C.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"),w.appendChild(C);const E=le.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const R=le.createNS("http://www.w3.org/2000/svg","path");R.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"),E.appendChild(R);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 $=le.createNS("http://www.w3.org/2000/svg","g");$.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"),$.appendChild(H),$.appendChild(q),g.appendChild(y),g.appendChild(w),g.appendChild(E),g.appendChild(F),g.appendChild($),n.appendChild(g),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(n),this._offset=c.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),Yr(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",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(t){return this._lngLat=c.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const a=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[a,-1*(38.1-13.5+a)],"bottom-right":[-a,-1*(38.1-13.5+a)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,o;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const a=this._map,h=a.terrain.depthAtPoint(this._pos),g=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,g)-h<.006)return void(this._element.style.opacity=this._opacity);const y=-this._offset.y/a.transform._pixelPerMeter,b=Math.sin(a.getPitch()*Math.PI/180)*y,w=a.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),C=a.transform.lngLatToCameraDepth(this._lngLat,g+b)-w>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&C&&this._popup.remove(),this._element.style.opacity=C?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=c.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return t===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const xo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Un=0,jn=!1;const Kl={maxWidth:100,unit:"metric"};function Ba(u,t,n){const o=n&&n.maxWidth||100,a=u._container.clientHeight/2,h=u.unproject([0,a]),g=u.unproject([o,a]),y=h.distanceTo(g);if(n&&n.unit==="imperial"){const b=3.2808*y;b>5280?Ms(t,o,b/5280,u._getUIString("ScaleControl.Miles")):Ms(t,o,b,u._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Ms(t,o,y/1852,u._getUIString("ScaleControl.NauticalMiles")):y>=1e3?Ms(t,o,y/1e3,u._getUIString("ScaleControl.Kilometers")):Ms(t,o,y,u._getUIString("ScaleControl.Meters"))}function Ms(u,t,n,o){const a=function(h){const g=Math.pow(10,`${Math.floor(h)}`.length-1);let y=h/g;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(b){const w=Math.pow(10,Math.ceil(-Math.log(b)/Math.LN10));return Math.round(b*w)/w}(y),g*y}(n);u.style.width=t*(a/n)+"px",u.innerHTML=`${a} ${o}`}const br={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},vo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function qe(u){if(u){if(typeof u=="number"){const t=Math.round(Math.abs(u)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,u),"top-left":new c.P(t,t),"top-right":new c.P(-t,t),bottom:new c.P(0,-u),"bottom-left":new c.P(t,-t),"bottom-right":new c.P(-t,-t),left:new c.P(u,0),right:new c.P(-u,0)}}if(u instanceof c.P||Array.isArray(u)){const t=c.P.convert(u);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:c.P.convert(u.center||[0,0]),top:c.P.convert(u.top||[0,0]),"top-left":c.P.convert(u["top-left"]||[0,0]),"top-right":c.P.convert(u["top-right"]||[0,0]),bottom:c.P.convert(u.bottom||[0,0]),"bottom-left":c.P.convert(u["bottom-left"]||[0,0]),"bottom-right":c.P.convert(u["bottom-right"]||[0,0]),left:c.P.convert(u.left||[0,0]),right:c.P.convert(u.right||[0,0])}}return qe(new c.P(0,0))}const Je=fe;S.AJAXError=c.bg,S.Evented=c.E,S.LngLat=c.N,S.MercatorCoordinate=c.Z,S.Point=c.P,S.addProtocol=c.bh,S.config=c.a,S.removeProtocol=c.bi,S.AttributionControl=$n,S.BoxZoomHandler=ga,S.CanvasSource=Wi,S.CooperativeGesturesHandler=rr,S.DoubleClickZoomHandler=Ea,S.DragPanHandler=Ji,S.DragRotateHandler=ir,S.EdgeInsets=uo,S.FullscreenControl=class extends c.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var t;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=n==null?void 0:n.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===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:c.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 c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("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=os,S.GeolocateControl=class extends c.E{constructor(u){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new c.N(t.coords.longitude,t.coords.latitude),o=t.coords.accuracy,a=this._map.getBearing(),h=c.e({bearing:a},this.options.fitBoundsOptions),g=ue.fromLngLat(n,o);this._map.fitBounds(g,h,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new c.N(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&jn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.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=t=>{if(this._map){if(t===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}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 Pt({element:this._dotElement}),this._circleElement=le.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Pt({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",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.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 c.k("trackuserlocationend")),this.fire(new c.k("userlocationlostfocus")))})}},this.options=c.e({},xo,u)}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(t=!1){if(Kr!==void 0&&!t)return Kr;if(window.navigator.permissions===void 0)return Kr=!!window.navigator.geolocation,Kr;try{Kr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Kr=!!window.navigator.geolocation}return Kr})}().then(t=>this._finishSetupUI(t)),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,Un=0,jn=!1}_isOutOfMapMaxBounds(u){const t=this._map.getMaxBounds(),n=u.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.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(),t=u.getSouthEast(),n=u.getNorthEast(),o=t.distanceTo(n),a=Math.ceil(this._accuracy/(o/this._map._container.clientHeight)*2);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}trigger(){if(!this._setup)return c.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 c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Un--,jn=!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 c.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.k("trackuserlocationstart")),this.fire(new c.k("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"),Un++,Un>1?(u={maximumAge:6e5,timeout:0},jn=!0):(u=this.options.positionOptions,jn=!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.Hash=Ss,S.ImageSource=Ar,S.KeyboardHandler=ka,S.LngLatBounds=ue,S.LogoControl=xr,S.Map=class extends nh{constructor(u){c.be.mark(c.bf.create);const t=Object.assign(Object.assign({},sh),u);if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ua(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Fe,this._controls=[],this._mapId=c.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=t.preserveDrawingBuffer===!0,this._antialias=t.antialias===!0,this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ze),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=He.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ft(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;const o=po(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{n?o(a):n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new rh(this,t),this._hash=t.hash&&new Ss(typeof t.hash=="string"&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,c.e({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new $n(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new xr,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new c.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new c.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new c.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(u,t){if(t===void 0&&(t=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=u.onAdd(this);this._controls.push(u);const o=this._controlPositions[t];return t.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(u);return t>-1&&this._controls.splice(t,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,t,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,t,n,o)}resize(u){var t;const n=this._containerDimensions(),o=n[0],a=n[1],h=this._getClampedPixelRatio(o,a);if(this._resizeCanvas(o,a,h),this.painter.resize(o,a,h),this.painter.overLimit()){const y=this.painter.context.gl;this._maxCanvasSize=[y.drawingBufferWidth,y.drawingBufferHeight];const b=this._getClampedPixelRatio(o,a);this._resizeCanvas(o,a,b),this.painter.resize(o,a,b)}this.transform.resize(o,a),(t=this._requestedCameraState)===null||t===void 0||t.resize(o,a);const g=!this._moving;return g&&(this.stop(),this.fire(new c.k("movestart",u)).fire(new c.k("move",u))),this.fire(new c.k("resize",u)),g&&this.fire(new c.k("moveend",u)),this}_getClampedPixelRatio(u,t){const{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),h=u*a,g=t*a;return Math.min(h>n?n/h:1,g>o?o/g:1)*a}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(ue.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.minZoom=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.maxZoom=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.minPitch=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)>85)throw new Error("maxPitch must be less than or equal to 85");if(u>=this.transform.minPitch)return this.transform.maxPitch=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.renderWorldCopies=u,this._update()}project(u){return this.transform.locationPoint(c.N.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.pointLocation(c.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,t,n){if(u==="mouseenter"||u==="mouseover"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:h=>{const g=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];g.length?o||(o=!0,n.call(this,new Ti(u,this,h.originalEvent,{features:g}))):o=!1},mouseout:()=>{o=!1}}}}if(u==="mouseleave"||u==="mouseout"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:g=>{(this.getLayer(t)?this.queryRenderedFeatures(g.point,{layers:[t]}):[]).length?o=!0:o&&(o=!1,n.call(this,new Ti(u,this,g.originalEvent)))},mouseout:g=>{o&&(o=!1,n.call(this,new Ti(u,this,g.originalEvent)))}}}}{const o=a=>{const h=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];h.length&&(a.features=h,n.call(this,a),delete a.features)};return{layer:t,listener:n,delegates:{[u]:o}}}}on(u,t,n){if(n===void 0)return super.on(u,t);const o=this._createDelegatedListener(u,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(o);for(const a in o.delegates)this.on(a,o.delegates[a]);return this}once(u,t,n){if(n===void 0)return super.once(u,t);const o=this._createDelegatedListener(u,t,n);for(const a in o.delegates)this.once(a,o.delegates[a]);return this}off(u,t,n){return n===void 0?super.off(u,t):(this._delegatedListeners&&this._delegatedListeners[u]&&(o=>{const a=this._delegatedListeners[u];for(let h=0;h<a.length;h++){const g=a[h];if(g.layer===t&&g.listener===n){for(const y in g.delegates)this.off(y,g.delegates[y]);return a.splice(h,1),this}}})(),this)}queryRenderedFeatures(u,t){if(!this.style)return[];let n;const o=u instanceof c.P||Array.isArray(u),a=o?u:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(o?{}:u)||{},a instanceof c.P||typeof a[0]=="number")n=[c.P.convert(a)];else{const h=c.P.convert(a[0]),g=c.P.convert(a[1]);n=[h,new c.P(g.x,h.y),g,new c.P(h.x,g.y),h]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(u,t){return this.style.querySourceFeatures(u,t)}setStyle(u,t){return(t=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(u,t))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const t=this._locale[u];if(t==null)throw new Error(`Missing UI string '${u}'`);return t}_updateStyle(u,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new Go(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,t,n):this.style.loadJSON(u,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Go(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,t){if(typeof u=="string"){const n=this._requestManager.transformRequest(u,"Style");c.h(n,new AbortController).then(o=>{this._updateDiff(o.data,t)}).catch(o=>{o&&this.fire(new c.j(o))})}else typeof u=="object"&&this._updateDiff(u,t)}_updateDiff(u,t){try{this.style.setState(u,t)&&this._update(!0)}catch(n){c.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(u,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(u,t){return this._lazyInitEmptyStyle(),this.style.addSource(u,t),this._update(!0)}isSourceLoaded(u){const t=this.style&&this.style.sourceCaches[u];if(t!==void 0)return t.loaded();this.fire(new c.j(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 t=this.style.sourceCaches[u.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const o=this.style._layers[n];o.type==="hillshade"&&o.source===u.source&&c.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 Gl(this.painter,t,u),this.painter.renderToTexture=new Hl(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==u.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.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.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:u})),this}getTerrain(){var u,t;return(t=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const t in u){const n=u[t]._tiles;for(const o in n){const a=n[o];if(a.state!=="loaded"&&a.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}addImage(u,t,n={}){const{pixelRatio:o=1,sdf:a=!1,stretchX:h,stretchY:g,content:y,textFitWidth:b,textFitHeight:w}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||c.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:C,height:E,data:R}=t,F=t;return this.style.addImage(u,{data:new c.R({width:C,height:E},new Uint8Array(R)),pixelRatio:o,stretchX:h,stretchY:g,content:y,textFitWidth:b,textFitHeight:w,sdf:a,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:C,height:E,data:R}=ae.getImageData(t);this.style.addImage(u,{data:new c.R({width:C,height:E},R),pixelRatio:o,stretchX:h,stretchY:g,content:y,textFitWidth:b,textFitHeight:w,sdf:a,version:0})}}updateImage(u,t){const n=this.style.getImage(u);if(!n)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=t instanceof HTMLImageElement||c.b(t)?ae.getImageData(t):t,{width:a,height:h,data:g}=o;if(a===void 0||h===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==n.data.width||h!==n.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||c.b(t));return n.data.replace(g,y),this.style.updateImage(u,n),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return He.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,t){return this._lazyInitEmptyStyle(),this.style.addLayer(u,t),this._update(!0)}moveLayer(u,t){return this.style.moveLayer(u,t),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,t,n){return this.style.setLayerZoomRange(u,t,n),this._update(!0)}setFilter(u,t,n={}){return this.style.setFilter(u,t,n),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,t,n,o={}){return this.style.setPaintProperty(u,t,n,o),this._update(!0)}getPaintProperty(u,t){return this.style.getPaintProperty(u,t)}setLayoutProperty(u,t,n,o={}){return this.style.setLayoutProperty(u,t,n,o),this._update(!0)}getLayoutProperty(u,t){return this.style.getLayoutProperty(u,t)}setGlyphs(u,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,t,n,o=>{o||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,t,n=>{n||this._update(!0)}),this}setLight(u,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(u){return this._lazyInitEmptyStyle(),this.style.setSky(u),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,t){return this.style.setFeatureState(u,t),this._update()}removeFeatureState(u,t){return this.style.removeFeatureState(u,t),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,t=0;return this._container&&(u=this._container.clientWidth||400,t=this._container.clientHeight||300),[u,t]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const t=this._canvasContainer=le.create("div","maplibregl-canvas-container",u);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=le.create("canvas","maplibregl-canvas",t),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 n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);const a=this._controlContainer=le.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(g=>{h[g]=le.create("div",`maplibregl-ctrl-${g} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,t,n){this._canvas.width=Math.floor(n*u),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const u={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{t={requestedAttributes:u},o&&(t.statusMessage=o.statusMessage,t.type=o.type)},{once:!0});const n=this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u);if(!n){const o="Failed to initialize WebGL";throw t?(t.message=o,new Error(JSON.stringify(t))):new Error(o)}this.painter=new Vl(n,this.transform),dt.testSupport(n)}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){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const a=this.transform.zoom,h=ae.now();this.style.zoomHistory.update(a,h);const g=new c.a9(a,{now:h,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=g.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),this.style.update(g)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.be.mark(c.bf.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||o||(this._fullyLoaded=!0,c.be.mark(c.bf.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 n of this._controls)n.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),He.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.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.classList.remove("maplibregl-map"),c.be.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ae.frameAsync(this._frameRequest).then(u=>{c.be.frame(u),this._frameRequest=null,this._render(u)}).catch(()=>{}))}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 Da}getCameraTargetElevation(){return this.transform.elevation}},S.MapMouseEvent=Ti,S.MapTouchEvent=Ts,S.MapWheelEvent=fa,S.Marker=Pt,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),o=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,n)=>{const o=this._map._getUIString(`NavigationControl.${n}`);t.title=o,t.setAttribute("aria-label",o)},this.options=c.e({},La,u),this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),le.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),le.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Xl(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._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,t){const n=le.create("button",u,this._container);return n.type="button",n.addEventListener("click",t),n}},S.Popup=class extends c.E{constructor(u){super(),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 c.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var n;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 y of this.options.className.split(" "))this._container.classList.add(y);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=this._map.transform.renderWorldCopies&&!this._trackPointer?Jl(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!t)return;const o=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let a=this.options.anchor;const h=qe(this.options.offset);if(!a){const y=this._container.offsetWidth,b=this._container.offsetHeight;let w;w=o.y+h.bottom.y<b?["top"]:o.y>this._map.transform.height-b?["bottom"]:[],o.x<y/2?w.push("left"):o.x>this._map.transform.width-y/2&&w.push("right"),a=w.length===0?"bottom":w.join("-")}let g=o.add(h[a]);this.options.subpixelPositioning||(g=g.round()),le.setTransform(this._container,`${Ra[a]} translate(${g.x}px,${g.y}px)`),Yr(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(br),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 c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=c.N.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 t=document.createDocumentFragment(),n=document.createElement("body");let o;for(n.innerHTML=u;o=n.firstChild,o;)t.appendChild(o);return this.setDOMContent(t)}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="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(vo);u&&u.focus()}},S.RasterDEMTileSource=Ut,S.RasterTileSource=yt,S.ScaleControl=class{constructor(u){this._onMove=()=>{Ba(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Ba(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Kl),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=Ca,S.Style=Go,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=Ta,S.TwoFingersTouchRotateHandler=Sa,S.TwoFingersTouchZoomHandler=ba,S.TwoFingersTouchZoomRotateHandler=Pa,S.VectorTileSource=ss,S.VideoSource=zn,S.addSourceType=(u,t)=>c._(void 0,void 0,void 0,function*(){if(ls(u))throw new Error(`A source type called "${u}" already exists.`);((n,o)=>{as[n]=o})(u,t)}),S.clearPrewarmedResources=function(){const u=Oi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release($r),Oi=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.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return mr().getRTLTextPluginStatus()},S.getVersion=function(){return Je},S.getWorkerCount=function(){return pr.workerCount},S.getWorkerUrl=function(){return c.a.WORKER_URL},S.importScriptInWorkers=function(u){return ns().broadcast("IS",u)},S.prewarm=function(){an().acquire($r)},S.setMaxParallelImageRequests=function(u){c.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,t){return mr().setRTLTextPlugin(u,t)},S.setWorkerCount=function(u){pr.workerCount=u},S.setWorkerUrl=function(u){c.a.WORKER_URL=u}});var j=k;return j})})(Jh);var Dp=Jh.exports;const In=zp(Dp);function Lp(f){const x=[{type:"fill",minzoom:f.pointZoom||0,paint:{"fill-color":f.color||"#ccc","fill-outline-color":f.stroke||"#blue","fill-opacity":f.opacity||1}}];return f.pointZoom&&x.push({type:"circle",maxzoom:f.pointZoom,paint:{"circle-color":f.color||"#ccc","circle-stroke-color":f.stroke||"#ccc","circle-stroke-width":f.width||1,"circle-opacity":f.opacity||1}}),f.label&&x.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),x}function Rp(f){const x=[{type:"line",paint:{"line-color":f.color||"#ccc","line-opacity":f.opacity||1}}];return f.label&&x.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"symbol-placement":"line-center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),x}function Bp(f){const x=[{type:"circle",maxzoom:f.icon&&+f.iconZoom||22,paint:{"circle-radius":f.radius||6,"circle-stroke-color":f.stroke||"#ccc","circle-stroke-width":f.width||1,"circle-color":f.color||"blue","circle-opacity":f.opacity||1}}];return f!=null&&f.clusterZoom&&(x.push({type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}}),x.push({type:"symbol",filter:["has","point_count"],layout:{"text-field":["get","point_count"],"text-font":["Open Sans Regular"],"text-size":12}})),f.icon&&x.push({type:"symbol",minzoom:+f.iconZoom||16,layout:{"icon-image":f.icon,"icon-allow-overlap":!0}}),f.label&&x.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"top"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),x}function Fp(f){if(!f)return null;const x=f.type||"point";return x==="polygon"?Lp(f):x==="line"?Rp(f):Bp(f)}const Kh=["#69D2E7","yellow","#FE4365","#125B9A","#41B3A2","#D7C3F1","#F1D3CE"],Op=["ma-star","ma-water","ma-swimming","fa-home","fa-search","fa-trash","fa-check"],Yh={};async function Qh(f,x,k="api"){const P=await fetch(`${k}/gis-layer/${f}/${x}`),{rows:D}=await P.json();return D}async function wc(f,x,k,P){if(!f)return null;const D=JSON.parse(JSON.stringify(f)),j=D.colorAttr?await Qh(x,D.colorAttr,P):null;j==null||j.forEach((c,fe)=>{var me,ve;c.color=c.color||((me=D.colorSet)==null?void 0:me[c.id])||((ve=D.colorSet)==null?void 0:ve[fe])||Kh[fe%Kh.length],c.icon=D.icon?D.icon.split("+")[0]+"+"+c.color.replace("#","")+".png":null});const S=D.iconAttr?await Qh(x,D.iconAttr,P):null;if(S==null||S.forEach((c,fe)=>{var dt,Ue,Ke,Oe;const me=c.icon||((dt=D.iconSet)==null?void 0:dt[c.id])||((Ue=D.iconPattern)==null?void 0:Ue.replace("{id}",c.id))||((Ke=D.iconSet)==null?void 0:Ke[fe])||(D.iconPrefix?null:Op[fe]);if(!me)return;const ve=c.color||((Oe=D.color)==null?void 0:Oe.replace("#",""))||"red",[ae="pin6",le="m"]=D.icon?D.icon.split("-"):[];c.icon=D.iconPrefix||me!=null&&me.includes("/")?(D.iconPrefix||"")+me:`${ae}-${le}-${me}+${ve}.png`}),D.colorAttr&&j){const c=["match",["get",D.colorAttr]];j.filter(fe=>fe.id).forEach(fe=>{c.push(fe.id),c.push(fe.color)}),c.push(D.color||"gray"),D.color=c}if(D.icon&&D.iconAttr&&S){const c=["match",["get",D.iconAttr]];S.filter(fe=>fe.icon).forEach(({id:fe,icon:me})=>{if(D.colorAttr&&j){c.push(fe);const ve=["match",["get",D.colorAttr]];j.forEach(ae=>{ve.push(ae.id);const le=me.split("+")[0]+"+"+ae.color.replace("#","")+".png";ve.push(le),Vs(le,k,P)}),ve.push(D.icon),c.push(ve)}else c.push(fe),c.push(me),Vs(me,k,P)}),c.push((D.iconPrefix||"")+D.icon),Vs((D.iconPrefix||"")+D.icon,k,P),D.icon=c}else if(D.icon&&D.colorAttr&&j){const c=["match",["get",D.colorAttr]];j.forEach(fe=>{c.push(fe.id),c.push(fe.icon),Vs(fe.icon,k,P)}),c.push(D.icon),Vs(D.icon,k,P),D.icon=c}else D.icon&&await Vs(D.icon,k,P);return Vp({style:f,colors:j,icons:S,map:k,id:x}),Fp(D)}async function Vs(f="pin4-sm-mi-plumber+f45942.png",x=null,k){if(Yh[f])return null;Yh[f]=!0;const P=await(x==null?void 0:x.loadImage(f!=null&&f.startsWith("/")||f!=null&&f.includes("//")?f:`${k}/marker_icon/${f.replace(".png","")}.png`));x==null||x.addImage(f,P.data)}function Vp({style:f,colors:x,icons:k,map:P,id:D}){P.legend||Object.assign(P,{legend:{}}),window.map||(window.map=P),Object.assign(P.legend,{[D]:{icon:f.icon,colors:x,icons:k,color:f.color||"blue",type:f.type||"point"}})}const Oo={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(f=>f==null?void 0:f.interactive).map(f=>f.id)}},methods:{moveLayer(f,x=this.map){x.getStyle().layers.forEach(k=>{k.id.match(f)&&x.moveLayer(k.id)})},async setVisible(f,x=!0,k=this.map){if(!f)return;const P=(f==null?void 0:f.id)||f,D=this.layerList.find(S=>S.id===f)||f;if(!(D!=null&&D.id))throw new Error("MixinError: Layer has no id");k.getStyle().layers.filter(S=>S.id.match(P)).forEach(S=>{k.setLayoutProperty(S.id,"visibility",x?"visible":"none")}),x&&await this.addLayer(D)},async addLayer(f,x=this==null?void 0:this.map){var D,j;const k=this.layerList.find(S=>S.id===f)||f;!this.map.getStyle()||this.map.getStyle().layers.find(S=>S.id===k.id)||(this.layerList.find(S=>S.id===k.id)||this.layerList.push(k),(k.service==="vtile"||k.service==="vector"||(D=k.url)!=null&&D.includes(".vmt"))&&this.addVtileLayer(k,x),k.service==="geojson"&&this.addGeoJsonLayer(k,x),((j=k.url)!=null&&j.includes(".png")||["tms","raster"].includes(k.service))&&await this.addRasterLayer(k,x))},async addRasterLayer(f,x=this==null?void 0:this.map){var k;x.getSource(f.id)||(typeof f.bounds=="string"&&Object.assign(f,{bounds:f.bounds.split(",")}),await x.addSource(f.id,{type:"raster",tiles:[(k=f==null?void 0:f.url)!=null&&k.startsWith("http")?f==null?void 0:f.url:`${this.prefix?f==null?void 0:f.url.replace(/(\/api[^\/]*)/,this.prefix):f==null?void 0:f.url}${f!=null&&f.url.includes("?")?"&":"?"}dt=${new Date().toISOString().split("T")[0]}`],tileSize:256,...Array.isArray(f.bounds)&&f.bounds.length===4?{bounds:f.bounds}:{},...f!=null&&f.scheme?{scheme:f==null?void 0:f.scheme}:{}}),await x.addLayer({id:f.id,type:"raster",source:f.id,minzoom:0,maxzoom:(f==null?void 0:f.maxzoom)||22}))},async updateStyle(f,x=this==null?void 0:this.map){const k=f.id;x.getStyle().layers.forEach(async D=>{D.source===k&&x.getLayer(D.id)&&await x.removeLayer(D.id)}),(await wc(f.style,f.source||f.id,x,this.prefix)||f.layers||[]).forEach((D,j)=>{const S={...D,id:`${f.id}-${j}`,source:f.id,"source-layer":D["source-layer"]||f.source||f.id,maxzoom:+D.maxzoom||24,minzoom:+D.minzoom||0};x.addLayer(S)})},async addVtileLayer(f,x=this==null?void 0:this.map){var j;const k=["props","pointZoom","clusterZoom"].filter(S=>f[S]).map(S=>`&${S}=${f[S]}`),P={type:"vector",tiles:[`${(j=f==null?void 0:f.url)!=null&&j.startsWith("http")?"":window.location.origin}${f==null?void 0:f.url}${k}`],minzoom:f.minzoom||5,maxzoom:f.maxzoom||24};x.addSource(f.id,P),(f.layers||await wc(f.style,f.source||f.id,x,this.prefix)||[]).forEach((S,c)=>{const fe={...S,id:`${f.id}-${c}`,source:f.id,"source-layer":S["source-layer"]||f.source||f.id,maxzoom:+S.maxzoom||24,minzoom:+S.minzoom||0};x.addLayer(fe)})},async addGeoJsonLayer(f,x=this.map){var D;const k=f.data||((D=f==null?void 0:f.url)!=null&&D.startsWith("http")?"":window.location.origin)+f.url;x.addSource(f.id,{type:"geojson",data:k}),(await wc(f.style,k.source||k.id,x,this.prefix)||f.layers||[]).forEach(j=>{const S={...j,source:f.id,id:j.id||f.id,maxzoom:+j.maxzoom||24,minzoom:+j.minzoom||0,type:j.type||"circle"};x.addLayer(S)})},setLayerData(f,x){this.layerList=this.layerList.map(k=>k.id===f?{...k,...x}:k)},async removeLayer(f,x=this.map){x.getSource(f)&&(await x.getStyle().layers.forEach(async k=>{k.source===f&&await x.removeLayer(k.id)}),x.getSource(f)&&await x.removeSource(f))},async setFilter(f,x){const k=this.layerList.find(D=>D.id===f);await(await this.map.getSource(f)).setTiles([`${window.location.origin}${k.url}${k.url.includes("?")?"&":"?"}filter=${x}${k.props?`&props=${k.props}`:""}`])},async changeBaseLayer(f){f!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.setVisible(this.activeLayer,!1),await this.setVisible(f,!0),this.map.getStyle().layers.forEach(x=>{x.source!==f&&x.type!=="background"&&this.map.moveLayer(x.id)}),this.activeLayer=f)},async refreshLayer(f,x=this.map){await x.getStyle().layers.forEach(k=>{k.source===f&&x.removeLayer(k.id)}),x.getSource(f)&&await x.removeSource(f),this.setVisible(f)}}},Fi=(f,x)=>{const k=f.__vccOpts||f;for(const[P,D]of x)k[P]=D;return k},Np={},$p={class:"w-48 mx-auto mb-4",width:"178",height:"90",viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Up=[N.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter2)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter2" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)];function jp(f,x){return N.openBlock(),N.createElementBlock("svg",$p,Up)}const qp=Fi(Np,[["render",jp]]);function eu(f,x){return function(){return f.apply(x,arguments)}}const{toString:Zp}=Object.prototype,{getPrototypeOf:Sc}=Object,ol=(f=>x=>{const k=Zp.call(x);return f[k]||(f[k]=k.slice(8,-1).toLowerCase())})(Object.create(null)),kr=f=>(f=f.toLowerCase(),x=>ol(x)===f),al=f=>x=>typeof x===f,{isArray:Ns}=Array,Vo=al("undefined");function Gp(f){return f!==null&&!Vo(f)&&f.constructor!==null&&!Vo(f.constructor)&&Yi(f.constructor.isBuffer)&&f.constructor.isBuffer(f)}const tu=kr("ArrayBuffer");function Hp(f){let x;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?x=ArrayBuffer.isView(f):x=f&&f.buffer&&tu(f.buffer),x}const Wp=al("string"),Yi=al("function"),iu=al("number"),ll=f=>f!==null&&typeof f=="object",Xp=f=>f===!0||f===!1,cl=f=>{if(ol(f)!=="object")return!1;const x=Sc(f);return(x===null||x===Object.prototype||Object.getPrototypeOf(x)===null)&&!(Symbol.toStringTag in f)&&!(Symbol.iterator in f)},Jp=kr("Date"),Kp=kr("File"),Yp=kr("Blob"),Qp=kr("FileList"),ef=f=>ll(f)&&Yi(f.pipe),tf=f=>{let x;return f&&(typeof FormData=="function"&&f instanceof FormData||Yi(f.append)&&((x=ol(f))==="formdata"||x==="object"&&Yi(f.toString)&&f.toString()==="[object FormData]"))},rf=kr("URLSearchParams"),[nf,sf,of,af]=["ReadableStream","Request","Response","Headers"].map(kr),lf=f=>f.trim?f.trim():f.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function No(f,x,{allOwnKeys:k=!1}={}){if(f===null||typeof f>"u")return;let P,D;if(typeof f!="object"&&(f=[f]),Ns(f))for(P=0,D=f.length;P<D;P++)x.call(null,f[P],P,f);else{const j=k?Object.getOwnPropertyNames(f):Object.keys(f),S=j.length;let c;for(P=0;P<S;P++)c=j[P],x.call(null,f[c],c,f)}}function ru(f,x){x=x.toLowerCase();const k=Object.keys(f);let P=k.length,D;for(;P-- >0;)if(D=k[P],x===D.toLowerCase())return D;return null}const ts=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nu=f=>!Vo(f)&&f!==ts;function Tc(){const{caseless:f}=nu(this)&&this||{},x={},k=(P,D)=>{const j=f&&ru(x,D)||D;cl(x[j])&&cl(P)?x[j]=Tc(x[j],P):cl(P)?x[j]=Tc({},P):Ns(P)?x[j]=P.slice():x[j]=P};for(let P=0,D=arguments.length;P<D;P++)arguments[P]&&No(arguments[P],k);return x}const cf=(f,x,k,{allOwnKeys:P}={})=>(No(x,(D,j)=>{k&&Yi(D)?f[j]=eu(D,k):f[j]=D},{allOwnKeys:P}),f),hf=f=>(f.charCodeAt(0)===65279&&(f=f.slice(1)),f),uf=(f,x,k,P)=>{f.prototype=Object.create(x.prototype,P),f.prototype.constructor=f,Object.defineProperty(f,"super",{value:x.prototype}),k&&Object.assign(f.prototype,k)},df=(f,x,k,P)=>{let D,j,S;const c={};if(x=x||{},f==null)return x;do{for(D=Object.getOwnPropertyNames(f),j=D.length;j-- >0;)S=D[j],(!P||P(S,f,x))&&!c[S]&&(x[S]=f[S],c[S]=!0);f=k!==!1&&Sc(f)}while(f&&(!k||k(f,x))&&f!==Object.prototype);return x},pf=(f,x,k)=>{f=String(f),(k===void 0||k>f.length)&&(k=f.length),k-=x.length;const P=f.indexOf(x,k);return P!==-1&&P===k},ff=f=>{if(!f)return null;if(Ns(f))return f;let x=f.length;if(!iu(x))return null;const k=new Array(x);for(;x-- >0;)k[x]=f[x];return k},mf=(f=>x=>f&&x instanceof f)(typeof Uint8Array<"u"&&Sc(Uint8Array)),gf=(f,x)=>{const P=(f&&f[Symbol.iterator]).call(f);let D;for(;(D=P.next())&&!D.done;){const j=D.value;x.call(f,j[0],j[1])}},_f=(f,x)=>{let k;const P=[];for(;(k=f.exec(x))!==null;)P.push(k);return P},yf=kr("HTMLFormElement"),xf=f=>f.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(k,P,D){return P.toUpperCase()+D}),su=(({hasOwnProperty:f})=>(x,k)=>f.call(x,k))(Object.prototype),vf=kr("RegExp"),ou=(f,x)=>{const k=Object.getOwnPropertyDescriptors(f),P={};No(k,(D,j)=>{let S;(S=x(D,j,f))!==!1&&(P[j]=S||D)}),Object.defineProperties(f,P)},bf=f=>{ou(f,(x,k)=>{if(Yi(f)&&["arguments","caller","callee"].indexOf(k)!==-1)return!1;const P=f[k];if(Yi(P)){if(x.enumerable=!1,"writable"in x){x.writable=!1;return}x.set||(x.set=()=>{throw Error("Can not rewrite read-only method '"+k+"'")})}})},wf=(f,x)=>{const k={},P=D=>{D.forEach(j=>{k[j]=!0})};return Ns(f)?P(f):P(String(f).split(x)),k},Sf=()=>{},Tf=(f,x)=>f!=null&&Number.isFinite(f=+f)?f:x,kc="abcdefghijklmnopqrstuvwxyz",au="0123456789",lu={DIGIT:au,ALPHA:kc,ALPHA_DIGIT:kc+kc.toUpperCase()+au},kf=(f=16,x=lu.ALPHA_DIGIT)=>{let k="";const{length:P}=x;for(;f--;)k+=x[Math.random()*P|0];return k};function If(f){return!!(f&&Yi(f.append)&&f[Symbol.toStringTag]==="FormData"&&f[Symbol.iterator])}const Cf=f=>{const x=new Array(10),k=(P,D)=>{if(ll(P)){if(x.indexOf(P)>=0)return;if(!("toJSON"in P)){x[D]=P;const j=Ns(P)?[]:{};return No(P,(S,c)=>{const fe=k(S,D+1);!Vo(fe)&&(j[c]=fe)}),x[D]=void 0,j}}return P};return k(f,0)},Ef=kr("AsyncFunction"),Pf=f=>f&&(ll(f)||Yi(f))&&Yi(f.then)&&Yi(f.catch),cu=((f,x)=>f?setImmediate:x?((k,P)=>(ts.addEventListener("message",({source:D,data:j})=>{D===ts&&j===k&&P.length&&P.shift()()},!1),D=>{P.push(D),ts.postMessage(k,"*")}))(`axios@${Math.random()}`,[]):k=>setTimeout(k))(typeof setImmediate=="function",Yi(ts.postMessage)),Af=typeof queueMicrotask<"u"?queueMicrotask.bind(ts):typeof process<"u"&&process.nextTick||cu,ge={isArray:Ns,isArrayBuffer:tu,isBuffer:Gp,isFormData:tf,isArrayBufferView:Hp,isString:Wp,isNumber:iu,isBoolean:Xp,isObject:ll,isPlainObject:cl,isReadableStream:nf,isRequest:sf,isResponse:of,isHeaders:af,isUndefined:Vo,isDate:Jp,isFile:Kp,isBlob:Yp,isRegExp:vf,isFunction:Yi,isStream:ef,isURLSearchParams:rf,isTypedArray:mf,isFileList:Qp,forEach:No,merge:Tc,extend:cf,trim:lf,stripBOM:hf,inherits:uf,toFlatObject:df,kindOf:ol,kindOfTest:kr,endsWith:pf,toArray:ff,forEachEntry:gf,matchAll:_f,isHTMLForm:yf,hasOwnProperty:su,hasOwnProp:su,reduceDescriptors:ou,freezeMethods:bf,toObjectSet:wf,toCamelCase:xf,noop:Sf,toFiniteNumber:Tf,findKey:ru,global:ts,isContextDefined:nu,ALPHABET:lu,generateString:kf,isSpecCompliantForm:If,toJSONObject:Cf,isAsyncFn:Ef,isThenable:Pf,setImmediate:cu,asap:Af};function ct(f,x,k,P,D){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=f,this.name="AxiosError",x&&(this.code=x),k&&(this.config=k),P&&(this.request=P),D&&(this.response=D)}ge.inherits(ct,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ge.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const hu=ct.prototype,uu={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(f=>{uu[f]={value:f}}),Object.defineProperties(ct,uu),Object.defineProperty(hu,"isAxiosError",{value:!0}),ct.from=(f,x,k,P,D,j)=>{const S=Object.create(hu);return ge.toFlatObject(f,S,function(fe){return fe!==Error.prototype},c=>c!=="isAxiosError"),ct.call(S,f.message,x,k,P,D),S.cause=f,S.name=f.name,j&&Object.assign(S,j),S};const Mf=null;function Ic(f){return ge.isPlainObject(f)||ge.isArray(f)}function du(f){return ge.endsWith(f,"[]")?f.slice(0,-2):f}function pu(f,x,k){return f?f.concat(x).map(function(D,j){return D=du(D),!k&&j?"["+D+"]":D}).join(k?".":""):x}function zf(f){return ge.isArray(f)&&!f.some(Ic)}const Df=ge.toFlatObject(ge,{},null,function(x){return/^is[A-Z]/.test(x)});function hl(f,x,k){if(!ge.isObject(f))throw new TypeError("target must be an object");x=x||new FormData,k=ge.toFlatObject(k,{metaTokens:!0,dots:!1,indexes:!1},!1,function(Ke,Oe){return!ge.isUndefined(Oe[Ke])});const P=k.metaTokens,D=k.visitor||ve,j=k.dots,S=k.indexes,fe=(k.Blob||typeof Blob<"u"&&Blob)&&ge.isSpecCompliantForm(x);if(!ge.isFunction(D))throw new TypeError("visitor must be a function");function me(Ue){if(Ue===null)return"";if(ge.isDate(Ue))return Ue.toISOString();if(!fe&&ge.isBlob(Ue))throw new ct("Blob is not supported. Use a Buffer instead.");return ge.isArrayBuffer(Ue)||ge.isTypedArray(Ue)?fe&&typeof Blob=="function"?new Blob([Ue]):Buffer.from(Ue):Ue}function ve(Ue,Ke,Oe){let ft=Ue;if(Ue&&!Oe&&typeof Ue=="object"){if(ge.endsWith(Ke,"{}"))Ke=P?Ke:Ke.slice(0,-2),Ue=JSON.stringify(Ue);else if(ge.isArray(Ue)&&zf(Ue)||(ge.isFileList(Ue)||ge.endsWith(Ke,"[]"))&&(ft=ge.toArray(Ue)))return Ke=du(Ke),ft.forEach(function(He,Ft){!(ge.isUndefined(He)||He===null)&&x.append(S===!0?pu([Ke],Ft,j):S===null?Ke:Ke+"[]",me(He))}),!1}return Ic(Ue)?!0:(x.append(pu(Oe,Ke,j),me(Ue)),!1)}const ae=[],le=Object.assign(Df,{defaultVisitor:ve,convertValue:me,isVisitable:Ic});function dt(Ue,Ke){if(!ge.isUndefined(Ue)){if(ae.indexOf(Ue)!==-1)throw Error("Circular reference detected in "+Ke.join("."));ae.push(Ue),ge.forEach(Ue,function(ft,st){(!(ge.isUndefined(ft)||ft===null)&&D.call(x,ft,ge.isString(st)?st.trim():st,Ke,le))===!0&&dt(ft,Ke?Ke.concat(st):[st])}),ae.pop()}}if(!ge.isObject(f))throw new TypeError("data must be an object");return dt(f),x}function fu(f){const x={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(f).replace(/[!'()~]|%20|%00/g,function(P){return x[P]})}function Cc(f,x){this._pairs=[],f&&hl(f,this,x)}const mu=Cc.prototype;mu.append=function(x,k){this._pairs.push([x,k])},mu.toString=function(x){const k=x?function(P){return x.call(this,P,fu)}:fu;return this._pairs.map(function(D){return k(D[0])+"="+k(D[1])},"").join("&")};function Lf(f){return encodeURIComponent(f).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function gu(f,x,k){if(!x)return f;const P=k&&k.encode||Lf,D=k&&k.serialize;let j;if(D?j=D(x,k):j=ge.isURLSearchParams(x)?x.toString():new Cc(x,k).toString(P),j){const S=f.indexOf("#");S!==-1&&(f=f.slice(0,S)),f+=(f.indexOf("?")===-1?"?":"&")+j}return f}class _u{constructor(){this.handlers=[]}use(x,k,P){return this.handlers.push({fulfilled:x,rejected:k,synchronous:P?P.synchronous:!1,runWhen:P?P.runWhen:null}),this.handlers.length-1}eject(x){this.handlers[x]&&(this.handlers[x]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(x){ge.forEach(this.handlers,function(P){P!==null&&x(P)})}}const yu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Rf={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Cc,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ec=typeof window<"u"&&typeof document<"u",Bf=(f=>Ec&&["ReactNative","NativeScript","NS"].indexOf(f)<0)(typeof navigator<"u"&&navigator.product),Ff=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Of=Ec&&window.location.href||"http://localhost",Ir={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ec,hasStandardBrowserEnv:Bf,hasStandardBrowserWebWorkerEnv:Ff,origin:Of},Symbol.toStringTag,{value:"Module"})),...Rf};function Vf(f,x){return hl(f,new Ir.classes.URLSearchParams,Object.assign({visitor:function(k,P,D,j){return Ir.isNode&&ge.isBuffer(k)?(this.append(P,k.toString("base64")),!1):j.defaultVisitor.apply(this,arguments)}},x))}function Nf(f){return ge.matchAll(/\w+|\[(\w*)]/g,f).map(x=>x[0]==="[]"?"":x[1]||x[0])}function $f(f){const x={},k=Object.keys(f);let P;const D=k.length;let j;for(P=0;P<D;P++)j=k[P],x[j]=f[j];return x}function xu(f){function x(k,P,D,j){let S=k[j++];if(S==="__proto__")return!0;const c=Number.isFinite(+S),fe=j>=k.length;return S=!S&&ge.isArray(D)?D.length:S,fe?(ge.hasOwnProp(D,S)?D[S]=[D[S],P]:D[S]=P,!c):((!D[S]||!ge.isObject(D[S]))&&(D[S]=[]),x(k,P,D[S],j)&&ge.isArray(D[S])&&(D[S]=$f(D[S])),!c)}if(ge.isFormData(f)&&ge.isFunction(f.entries)){const k={};return ge.forEachEntry(f,(P,D)=>{x(Nf(P),D,k,0)}),k}return null}function Uf(f,x,k){if(ge.isString(f))try{return(x||JSON.parse)(f),ge.trim(f)}catch(P){if(P.name!=="SyntaxError")throw P}return(k||JSON.stringify)(f)}const $o={transitional:yu,adapter:["xhr","http","fetch"],transformRequest:[function(x,k){const P=k.getContentType()||"",D=P.indexOf("application/json")>-1,j=ge.isObject(x);if(j&&ge.isHTMLForm(x)&&(x=new FormData(x)),ge.isFormData(x))return D?JSON.stringify(xu(x)):x;if(ge.isArrayBuffer(x)||ge.isBuffer(x)||ge.isStream(x)||ge.isFile(x)||ge.isBlob(x)||ge.isReadableStream(x))return x;if(ge.isArrayBufferView(x))return x.buffer;if(ge.isURLSearchParams(x))return k.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),x.toString();let c;if(j){if(P.indexOf("application/x-www-form-urlencoded")>-1)return Vf(x,this.formSerializer).toString();if((c=ge.isFileList(x))||P.indexOf("multipart/form-data")>-1){const fe=this.env&&this.env.FormData;return hl(c?{"files[]":x}:x,fe&&new fe,this.formSerializer)}}return j||D?(k.setContentType("application/json",!1),Uf(x)):x}],transformResponse:[function(x){const k=this.transitional||$o.transitional,P=k&&k.forcedJSONParsing,D=this.responseType==="json";if(ge.isResponse(x)||ge.isReadableStream(x))return x;if(x&&ge.isString(x)&&(P&&!this.responseType||D)){const S=!(k&&k.silentJSONParsing)&&D;try{return JSON.parse(x)}catch(c){if(S)throw c.name==="SyntaxError"?ct.from(c,ct.ERR_BAD_RESPONSE,this,null,this.response):c}}return x}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ir.classes.FormData,Blob:Ir.classes.Blob},validateStatus:function(x){return x>=200&&x<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ge.forEach(["delete","get","head","post","put","patch"],f=>{$o.headers[f]={}});const jf=ge.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),qf=f=>{const x={};let k,P,D;return f&&f.split(`
|
581
581
|
`).forEach(function(S){D=S.indexOf(":"),k=S.substring(0,D).trim().toLowerCase(),P=S.substring(D+1).trim(),!(!k||x[k]&&jf[k])&&(k==="set-cookie"?x[k]?x[k].push(P):x[k]=[P]:x[k]=x[k]?x[k]+", "+P:P)}),x},vu=Symbol("internals");function Uo(f){return f&&String(f).trim().toLowerCase()}function ul(f){return f===!1||f==null?f:ge.isArray(f)?f.map(ul):String(f)}function Zf(f){const x=Object.create(null),k=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let P;for(;P=k.exec(f);)x[P[1]]=P[2];return x}const Gf=f=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(f.trim());function Pc(f,x,k,P,D){if(ge.isFunction(P))return P.call(this,x,k);if(D&&(x=k),!!ge.isString(x)){if(ge.isString(P))return x.indexOf(P)!==-1;if(ge.isRegExp(P))return P.test(x)}}function Hf(f){return f.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(x,k,P)=>k.toUpperCase()+P)}function Wf(f,x){const k=ge.toCamelCase(" "+x);["get","set","has"].forEach(P=>{Object.defineProperty(f,P+k,{value:function(D,j,S){return this[P].call(this,x,D,j,S)},configurable:!0})})}class Hi{constructor(x){x&&this.set(x)}set(x,k,P){const D=this;function j(c,fe,me){const ve=Uo(fe);if(!ve)throw new Error("header name must be a non-empty string");const ae=ge.findKey(D,ve);(!ae||D[ae]===void 0||me===!0||me===void 0&&D[ae]!==!1)&&(D[ae||fe]=ul(c))}const S=(c,fe)=>ge.forEach(c,(me,ve)=>j(me,ve,fe));if(ge.isPlainObject(x)||x instanceof this.constructor)S(x,k);else if(ge.isString(x)&&(x=x.trim())&&!Gf(x))S(qf(x),k);else if(ge.isHeaders(x))for(const[c,fe]of x.entries())j(fe,c,P);else x!=null&&j(k,x,P);return this}get(x,k){if(x=Uo(x),x){const P=ge.findKey(this,x);if(P){const D=this[P];if(!k)return D;if(k===!0)return Zf(D);if(ge.isFunction(k))return k.call(this,D,P);if(ge.isRegExp(k))return k.exec(D);throw new TypeError("parser must be boolean|regexp|function")}}}has(x,k){if(x=Uo(x),x){const P=ge.findKey(this,x);return!!(P&&this[P]!==void 0&&(!k||Pc(this,this[P],P,k)))}return!1}delete(x,k){const P=this;let D=!1;function j(S){if(S=Uo(S),S){const c=ge.findKey(P,S);c&&(!k||Pc(P,P[c],c,k))&&(delete P[c],D=!0)}}return ge.isArray(x)?x.forEach(j):j(x),D}clear(x){const k=Object.keys(this);let P=k.length,D=!1;for(;P--;){const j=k[P];(!x||Pc(this,this[j],j,x,!0))&&(delete this[j],D=!0)}return D}normalize(x){const k=this,P={};return ge.forEach(this,(D,j)=>{const S=ge.findKey(P,j);if(S){k[S]=ul(D),delete k[j];return}const c=x?Hf(j):String(j).trim();c!==j&&delete k[j],k[c]=ul(D),P[c]=!0}),this}concat(...x){return this.constructor.concat(this,...x)}toJSON(x){const k=Object.create(null);return ge.forEach(this,(P,D)=>{P!=null&&P!==!1&&(k[D]=x&&ge.isArray(P)?P.join(", "):P)}),k}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([x,k])=>x+": "+k).join(`
|
582
582
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(x){return x instanceof this?x:new this(x)}static concat(x,...k){const P=new this(x);return k.forEach(D=>P.set(D)),P}static accessor(x){const P=(this[vu]=this[vu]={accessors:{}}).accessors,D=this.prototype;function j(S){const c=Uo(S);P[c]||(Wf(D,S),P[c]=!0)}return ge.isArray(x)?x.forEach(j):j(x),this}}Hi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ge.reduceDescriptors(Hi.prototype,({value:f},x)=>{let k=x[0].toUpperCase()+x.slice(1);return{get:()=>f,set(P){this[k]=P}}}),ge.freezeMethods(Hi);function Ac(f,x){const k=this||$o,P=x||k,D=Hi.from(P.headers);let j=P.data;return ge.forEach(f,function(c){j=c.call(k,j,D.normalize(),x?x.status:void 0)}),D.normalize(),j}function bu(f){return!!(f&&f.__CANCEL__)}function $s(f,x,k){ct.call(this,f??"canceled",ct.ERR_CANCELED,x,k),this.name="CanceledError"}ge.inherits($s,ct,{__CANCEL__:!0});function wu(f,x,k){const P=k.config.validateStatus;!k.status||!P||P(k.status)?f(k):x(new ct("Request failed with status code "+k.status,[ct.ERR_BAD_REQUEST,ct.ERR_BAD_RESPONSE][Math.floor(k.status/100)-4],k.config,k.request,k))}function Xf(f){const x=/^([-+\w]{1,25})(:?\/\/|:)/.exec(f);return x&&x[1]||""}function Jf(f,x){f=f||10;const k=new Array(f),P=new Array(f);let D=0,j=0,S;return x=x!==void 0?x:1e3,function(fe){const me=Date.now(),ve=P[j];S||(S=me),k[D]=fe,P[D]=me;let ae=j,le=0;for(;ae!==D;)le+=k[ae++],ae=ae%f;if(D=(D+1)%f,D===j&&(j=(j+1)%f),me-S<x)return;const dt=ve&&me-ve;return dt?Math.round(le*1e3/dt):void 0}}function Kf(f,x){let k=0,P=1e3/x,D,j;const S=(me,ve=Date.now())=>{k=ve,D=null,j&&(clearTimeout(j),j=null),f.apply(null,me)};return[(...me)=>{const ve=Date.now(),ae=ve-k;ae>=P?S(me,ve):(D=me,j||(j=setTimeout(()=>{j=null,S(D)},P-ae)))},()=>D&&S(D)]}const dl=(f,x,k=3)=>{let P=0;const D=Jf(50,250);return Kf(j=>{const S=j.loaded,c=j.lengthComputable?j.total:void 0,fe=S-P,me=D(fe),ve=S<=c;P=S;const ae={loaded:S,total:c,progress:c?S/c:void 0,bytes:fe,rate:me||void 0,estimated:me&&c&&ve?(c-S)/me:void 0,event:j,lengthComputable:c!=null,[x?"download":"upload"]:!0};f(ae)},k)},Su=(f,x)=>{const k=f!=null;return[P=>x[0]({lengthComputable:k,total:f,loaded:P}),x[1]]},Tu=f=>(...x)=>ge.asap(()=>f(...x)),Yf=Ir.hasStandardBrowserEnv?function(){const x=/(msie|trident)/i.test(navigator.userAgent),k=document.createElement("a");let P;function D(j){let S=j;return x&&(k.setAttribute("href",S),S=k.href),k.setAttribute("href",S),{href:k.href,protocol:k.protocol?k.protocol.replace(/:$/,""):"",host:k.host,search:k.search?k.search.replace(/^\?/,""):"",hash:k.hash?k.hash.replace(/^#/,""):"",hostname:k.hostname,port:k.port,pathname:k.pathname.charAt(0)==="/"?k.pathname:"/"+k.pathname}}return P=D(window.location.href),function(S){const c=ge.isString(S)?D(S):S;return c.protocol===P.protocol&&c.host===P.host}}():function(){return function(){return!0}}(),Qf=Ir.hasStandardBrowserEnv?{write(f,x,k,P,D,j){const S=[f+"="+encodeURIComponent(x)];ge.isNumber(k)&&S.push("expires="+new Date(k).toGMTString()),ge.isString(P)&&S.push("path="+P),ge.isString(D)&&S.push("domain="+D),j===!0&&S.push("secure"),document.cookie=S.join("; ")},read(f){const x=document.cookie.match(new RegExp("(^|;\\s*)("+f+")=([^;]*)"));return x?decodeURIComponent(x[3]):null},remove(f){this.write(f,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function em(f){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(f)}function tm(f,x){return x?f.replace(/\/?\/$/,"")+"/"+x.replace(/^\/+/,""):f}function ku(f,x){return f&&!em(x)?tm(f,x):x}const Iu=f=>f instanceof Hi?{...f}:f;function is(f,x){x=x||{};const k={};function P(me,ve,ae){return ge.isPlainObject(me)&&ge.isPlainObject(ve)?ge.merge.call({caseless:ae},me,ve):ge.isPlainObject(ve)?ge.merge({},ve):ge.isArray(ve)?ve.slice():ve}function D(me,ve,ae){if(ge.isUndefined(ve)){if(!ge.isUndefined(me))return P(void 0,me,ae)}else return P(me,ve,ae)}function j(me,ve){if(!ge.isUndefined(ve))return P(void 0,ve)}function S(me,ve){if(ge.isUndefined(ve)){if(!ge.isUndefined(me))return P(void 0,me)}else return P(void 0,ve)}function c(me,ve,ae){if(ae in x)return P(me,ve);if(ae in f)return P(void 0,me)}const fe={url:j,method:j,data:j,baseURL:S,transformRequest:S,transformResponse:S,paramsSerializer:S,timeout:S,timeoutMessage:S,withCredentials:S,withXSRFToken:S,adapter:S,responseType:S,xsrfCookieName:S,xsrfHeaderName:S,onUploadProgress:S,onDownloadProgress:S,decompress:S,maxContentLength:S,maxBodyLength:S,beforeRedirect:S,transport:S,httpAgent:S,httpsAgent:S,cancelToken:S,socketPath:S,responseEncoding:S,validateStatus:c,headers:(me,ve)=>D(Iu(me),Iu(ve),!0)};return ge.forEach(Object.keys(Object.assign({},f,x)),function(ve){const ae=fe[ve]||D,le=ae(f[ve],x[ve],ve);ge.isUndefined(le)&&ae!==c||(k[ve]=le)}),k}const Cu=f=>{const x=is({},f);let{data:k,withXSRFToken:P,xsrfHeaderName:D,xsrfCookieName:j,headers:S,auth:c}=x;x.headers=S=Hi.from(S),x.url=gu(ku(x.baseURL,x.url),f.params,f.paramsSerializer),c&&S.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let fe;if(ge.isFormData(k)){if(Ir.hasStandardBrowserEnv||Ir.hasStandardBrowserWebWorkerEnv)S.setContentType(void 0);else if((fe=S.getContentType())!==!1){const[me,...ve]=fe?fe.split(";").map(ae=>ae.trim()).filter(Boolean):[];S.setContentType([me||"multipart/form-data",...ve].join("; "))}}if(Ir.hasStandardBrowserEnv&&(P&&ge.isFunction(P)&&(P=P(x)),P||P!==!1&&Yf(x.url))){const me=D&&j&&Qf.read(j);me&&S.set(D,me)}return x},im=typeof XMLHttpRequest<"u"&&function(f){return new Promise(function(k,P){const D=Cu(f);let j=D.data;const S=Hi.from(D.headers).normalize();let{responseType:c,onUploadProgress:fe,onDownloadProgress:me}=D,ve,ae,le,dt,Ue;function Ke(){dt&&dt(),Ue&&Ue(),D.cancelToken&&D.cancelToken.unsubscribe(ve),D.signal&&D.signal.removeEventListener("abort",ve)}let Oe=new XMLHttpRequest;Oe.open(D.method.toUpperCase(),D.url,!0),Oe.timeout=D.timeout;function ft(){if(!Oe)return;const He=Hi.from("getAllResponseHeaders"in Oe&&Oe.getAllResponseHeaders()),wt={data:!c||c==="text"||c==="json"?Oe.responseText:Oe.response,status:Oe.status,statusText:Oe.statusText,headers:He,config:f,request:Oe};wu(function($t){k($t),Ke()},function($t){P($t),Ke()},wt),Oe=null}"onloadend"in Oe?Oe.onloadend=ft:Oe.onreadystatechange=function(){!Oe||Oe.readyState!==4||Oe.status===0&&!(Oe.responseURL&&Oe.responseURL.indexOf("file:")===0)||setTimeout(ft)},Oe.onabort=function(){Oe&&(P(new ct("Request aborted",ct.ECONNABORTED,f,Oe)),Oe=null)},Oe.onerror=function(){P(new ct("Network Error",ct.ERR_NETWORK,f,Oe)),Oe=null},Oe.ontimeout=function(){let Ft=D.timeout?"timeout of "+D.timeout+"ms exceeded":"timeout exceeded";const wt=D.transitional||yu;D.timeoutErrorMessage&&(Ft=D.timeoutErrorMessage),P(new ct(Ft,wt.clarifyTimeoutError?ct.ETIMEDOUT:ct.ECONNABORTED,f,Oe)),Oe=null},j===void 0&&S.setContentType(null),"setRequestHeader"in Oe&&ge.forEach(S.toJSON(),function(Ft,wt){Oe.setRequestHeader(wt,Ft)}),ge.isUndefined(D.withCredentials)||(Oe.withCredentials=!!D.withCredentials),c&&c!=="json"&&(Oe.responseType=D.responseType),me&&([le,Ue]=dl(me,!0),Oe.addEventListener("progress",le)),fe&&Oe.upload&&([ae,dt]=dl(fe),Oe.upload.addEventListener("progress",ae),Oe.upload.addEventListener("loadend",dt)),(D.cancelToken||D.signal)&&(ve=He=>{Oe&&(P(!He||He.type?new $s(null,f,Oe):He),Oe.abort(),Oe=null)},D.cancelToken&&D.cancelToken.subscribe(ve),D.signal&&(D.signal.aborted?ve():D.signal.addEventListener("abort",ve)));const st=Xf(D.url);if(st&&Ir.protocols.indexOf(st)===-1){P(new ct("Unsupported protocol "+st+":",ct.ERR_BAD_REQUEST,f));return}Oe.send(j||null)})},rm=(f,x)=>{let k=new AbortController,P;const D=function(fe){if(!P){P=!0,S();const me=fe instanceof Error?fe:this.reason;k.abort(me instanceof ct?me:new $s(me instanceof Error?me.message:me))}};let j=x&&setTimeout(()=>{D(new ct(`timeout ${x} of ms exceeded`,ct.ETIMEDOUT))},x);const S=()=>{f&&(j&&clearTimeout(j),j=null,f.forEach(fe=>{fe&&(fe.removeEventListener?fe.removeEventListener("abort",D):fe.unsubscribe(D))}),f=null)};f.forEach(fe=>fe&&fe.addEventListener&&fe.addEventListener("abort",D));const{signal:c}=k;return c.unsubscribe=S,[c,()=>{j&&clearTimeout(j),j=null}]},nm=function*(f,x){let k=f.byteLength;if(!x||k<x){yield f;return}let P=0,D;for(;P<k;)D=P+x,yield f.slice(P,D),P=D},sm=async function*(f,x,k){for await(const P of f)yield*nm(ArrayBuffer.isView(P)?P:await k(String(P)),x)},Eu=(f,x,k,P,D)=>{const j=sm(f,x,D);let S=0,c,fe=me=>{c||(c=!0,P&&P(me))};return new ReadableStream({async pull(me){try{const{done:ve,value:ae}=await j.next();if(ve){fe(),me.close();return}let le=ae.byteLength;if(k){let dt=S+=le;k(dt)}me.enqueue(new Uint8Array(ae))}catch(ve){throw fe(ve),ve}},cancel(me){return fe(me),j.return()}},{highWaterMark:2})},pl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Pu=pl&&typeof ReadableStream=="function",Mc=pl&&(typeof TextEncoder=="function"?(f=>x=>f.encode(x))(new TextEncoder):async f=>new Uint8Array(await new Response(f).arrayBuffer())),Au=(f,...x)=>{try{return!!f(...x)}catch{return!1}},om=Pu&&Au(()=>{let f=!1;const x=new Request(Ir.origin,{body:new ReadableStream,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!x}),Mu=64*1024,zc=Pu&&Au(()=>ge.isReadableStream(new Response("").body)),fl={stream:zc&&(f=>f.body)};pl&&(f=>{["text","arrayBuffer","blob","formData","stream"].forEach(x=>{!fl[x]&&(fl[x]=ge.isFunction(f[x])?k=>k[x]():(k,P)=>{throw new ct(`Response type '${x}' is not supported`,ct.ERR_NOT_SUPPORT,P)})})})(new Response);const am=async f=>{if(f==null)return 0;if(ge.isBlob(f))return f.size;if(ge.isSpecCompliantForm(f))return(await new Request(f).arrayBuffer()).byteLength;if(ge.isArrayBufferView(f)||ge.isArrayBuffer(f))return f.byteLength;if(ge.isURLSearchParams(f)&&(f=f+""),ge.isString(f))return(await Mc(f)).byteLength},lm=async(f,x)=>{const k=ge.toFiniteNumber(f.getContentLength());return k??am(x)},Dc={http:Mf,xhr:im,fetch:pl&&(async f=>{let{url:x,method:k,data:P,signal:D,cancelToken:j,timeout:S,onDownloadProgress:c,onUploadProgress:fe,responseType:me,headers:ve,withCredentials:ae="same-origin",fetchOptions:le}=Cu(f);me=me?(me+"").toLowerCase():"text";let[dt,Ue]=D||j||S?rm([D,j],S):[],Ke,Oe;const ft=()=>{!Ke&&setTimeout(()=>{dt&&dt.unsubscribe()}),Ke=!0};let st;try{if(fe&&om&&k!=="get"&&k!=="head"&&(st=await lm(ve,P))!==0){let Wt=new Request(x,{method:"POST",body:P,duplex:"half"}),$t;if(ge.isFormData(P)&&($t=Wt.headers.get("content-type"))&&ve.setContentType($t),Wt.body){const[Vr,bi]=Su(st,dl(Tu(fe)));P=Eu(Wt.body,Mu,Vr,bi,Mc)}}ge.isString(ae)||(ae=ae?"include":"omit"),Oe=new Request(x,{...le,signal:dt,method:k.toUpperCase(),headers:ve.normalize().toJSON(),body:P,duplex:"half",credentials:ae});let He=await fetch(Oe);const Ft=zc&&(me==="stream"||me==="response");if(zc&&(c||Ft)){const Wt={};["status","statusText","headers"].forEach(Nr=>{Wt[Nr]=He[Nr]});const $t=ge.toFiniteNumber(He.headers.get("content-length")),[Vr,bi]=c&&Su($t,dl(Tu(c),!0))||[];He=new Response(Eu(He.body,Mu,Vr,()=>{bi&&bi(),Ft&&ft()},Mc),Wt)}me=me||"text";let wt=await fl[ge.findKey(fl,me)||"text"](He,f);return!Ft&&ft(),Ue&&Ue(),await new Promise((Wt,$t)=>{wu(Wt,$t,{data:wt,headers:Hi.from(He.headers),status:He.status,statusText:He.statusText,config:f,request:Oe})})}catch(He){throw ft(),He&&He.name==="TypeError"&&/fetch/i.test(He.message)?Object.assign(new ct("Network Error",ct.ERR_NETWORK,f,Oe),{cause:He.cause||He}):ct.from(He,He&&He.code,f,Oe)}})};ge.forEach(Dc,(f,x)=>{if(f){try{Object.defineProperty(f,"name",{value:x})}catch{}Object.defineProperty(f,"adapterName",{value:x})}});const zu=f=>`- ${f}`,cm=f=>ge.isFunction(f)||f===null||f===!1,Du={getAdapter:f=>{f=ge.isArray(f)?f:[f];const{length:x}=f;let k,P;const D={};for(let j=0;j<x;j++){k=f[j];let S;if(P=k,!cm(k)&&(P=Dc[(S=String(k)).toLowerCase()],P===void 0))throw new ct(`Unknown adapter '${S}'`);if(P)break;D[S||"#"+j]=P}if(!P){const j=Object.entries(D).map(([c,fe])=>`adapter ${c} `+(fe===!1?"is not supported by the environment":"is not available in the build"));let S=x?j.length>1?`since :
|
583
583
|
`+j.map(zu).join(`
|
584
584
|
`):" "+zu(j[0]):"as no adapter specified";throw new ct("There is no suitable adapter to dispatch the request "+S,"ERR_NOT_SUPPORT")}return P},adapters:Dc};function Lc(f){if(f.cancelToken&&f.cancelToken.throwIfRequested(),f.signal&&f.signal.aborted)throw new $s(null,f)}function Lu(f){return Lc(f),f.headers=Hi.from(f.headers),f.data=Ac.call(f,f.transformRequest),["post","put","patch"].indexOf(f.method)!==-1&&f.headers.setContentType("application/x-www-form-urlencoded",!1),Du.getAdapter(f.adapter||$o.adapter)(f).then(function(P){return Lc(f),P.data=Ac.call(f,f.transformResponse,P),P.headers=Hi.from(P.headers),P},function(P){return bu(P)||(Lc(f),P&&P.response&&(P.response.data=Ac.call(f,f.transformResponse,P.response),P.response.headers=Hi.from(P.response.headers))),Promise.reject(P)})}const Ru="1.7.4",Rc={};["object","boolean","number","function","string","symbol"].forEach((f,x)=>{Rc[f]=function(P){return typeof P===f||"a"+(x<1?"n ":" ")+f}});const Bu={};Rc.transitional=function(x,k,P){function D(j,S){return"[Axios v"+Ru+"] Transitional option '"+j+"'"+S+(P?". "+P:"")}return(j,S,c)=>{if(x===!1)throw new ct(D(S," has been removed"+(k?" in "+k:"")),ct.ERR_DEPRECATED);return k&&!Bu[S]&&(Bu[S]=!0,console.warn(D(S," has been deprecated since v"+k+" and will be removed in the near future"))),x?x(j,S,c):!0}};function hm(f,x,k){if(typeof f!="object")throw new ct("options must be an object",ct.ERR_BAD_OPTION_VALUE);const P=Object.keys(f);let D=P.length;for(;D-- >0;){const j=P[D],S=x[j];if(S){const c=f[j],fe=c===void 0||S(c,j,f);if(fe!==!0)throw new ct("option "+j+" must be "+fe,ct.ERR_BAD_OPTION_VALUE);continue}if(k!==!0)throw new ct("Unknown option "+j,ct.ERR_BAD_OPTION)}}const Bc={assertOptions:hm,validators:Rc},Cn=Bc.validators;class rs{constructor(x){this.defaults=x,this.interceptors={request:new _u,response:new _u}}async request(x,k){try{return await this._request(x,k)}catch(P){if(P instanceof Error){let D;Error.captureStackTrace?Error.captureStackTrace(D={}):D=new Error;const j=D.stack?D.stack.replace(/^.+\n/,""):"";try{P.stack?j&&!String(P.stack).endsWith(j.replace(/^.+\n.+\n/,""))&&(P.stack+=`
|
585
|
-
`+j):P.stack=j}catch{}}throw P}}_request(x,k){typeof x=="string"?(k=k||{},k.url=x):k=x||{},k=is(this.defaults,k);const{transitional:P,paramsSerializer:D,headers:j}=k;P!==void 0&&Bc.assertOptions(P,{silentJSONParsing:Cn.transitional(Cn.boolean),forcedJSONParsing:Cn.transitional(Cn.boolean),clarifyTimeoutError:Cn.transitional(Cn.boolean)},!1),D!=null&&(ge.isFunction(D)?k.paramsSerializer={serialize:D}:Bc.assertOptions(D,{encode:Cn.function,serialize:Cn.function},!0)),k.method=(k.method||this.defaults.method||"get").toLowerCase();let S=j&&ge.merge(j.common,j[k.method]);j&&ge.forEach(["delete","get","head","post","put","patch","common"],Ue=>{delete j[Ue]}),k.headers=Hi.concat(S,j);const c=[];let fe=!0;this.interceptors.request.forEach(function(Ke){typeof Ke.runWhen=="function"&&Ke.runWhen(k)===!1||(fe=fe&&Ke.synchronous,c.unshift(Ke.fulfilled,Ke.rejected))});const me=[];this.interceptors.response.forEach(function(Ke){me.push(Ke.fulfilled,Ke.rejected)});let ve,ae=0,le;if(!fe){const Ue=[Lu.bind(this),void 0];for(Ue.unshift.apply(Ue,c),Ue.push.apply(Ue,me),le=Ue.length,ve=Promise.resolve(k);ae<le;)ve=ve.then(Ue[ae++],Ue[ae++]);return ve}le=c.length;let dt=k;for(ae=0;ae<le;){const Ue=c[ae++],Ke=c[ae++];try{dt=Ue(dt)}catch(Oe){Ke.call(this,Oe);break}}try{ve=Lu.call(this,dt)}catch(Ue){return Promise.reject(Ue)}for(ae=0,le=me.length;ae<le;)ve=ve.then(me[ae++],me[ae++]);return ve}getUri(x){x=is(this.defaults,x);const k=ku(x.baseURL,x.url);return gu(k,x.params,x.paramsSerializer)}}ge.forEach(["delete","get","head","options"],function(x){rs.prototype[x]=function(k,P){return this.request(is(P||{},{method:x,url:k,data:(P||{}).data}))}}),ge.forEach(["post","put","patch"],function(x){function k(P){return function(j,S,c){return this.request(is(c||{},{method:x,headers:P?{"Content-Type":"multipart/form-data"}:{},url:j,data:S}))}}rs.prototype[x]=k(),rs.prototype[x+"Form"]=k(!0)});class Fc{constructor(x){if(typeof x!="function")throw new TypeError("executor must be a function.");let k;this.promise=new Promise(function(j){k=j});const P=this;this.promise.then(D=>{if(!P._listeners)return;let j=P._listeners.length;for(;j-- >0;)P._listeners[j](D);P._listeners=null}),this.promise.then=D=>{let j;const S=new Promise(c=>{P.subscribe(c),j=c}).then(D);return S.cancel=function(){P.unsubscribe(j)},S},x(function(j,S,c){P.reason||(P.reason=new $s(j,S,c),k(P.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(x){if(this.reason){x(this.reason);return}this._listeners?this._listeners.push(x):this._listeners=[x]}unsubscribe(x){if(!this._listeners)return;const k=this._listeners.indexOf(x);k!==-1&&this._listeners.splice(k,1)}static source(){let x;return{token:new Fc(function(D){x=D}),cancel:x}}}function um(f){return function(k){return f.apply(null,k)}}function dm(f){return ge.isObject(f)&&f.isAxiosError===!0}const Oc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Oc).forEach(([f,x])=>{Oc[x]=f});function Fu(f){const x=new rs(f),k=eu(rs.prototype.request,x);return ge.extend(k,rs.prototype,x,{allOwnKeys:!0}),ge.extend(k,x,null,{allOwnKeys:!0}),k.create=function(D){return Fu(is(f,D))},k}const Zt=Fu($o);Zt.Axios=rs,Zt.CanceledError=$s,Zt.CancelToken=Fc,Zt.isCancel=bu,Zt.VERSION=Ru,Zt.toFormData=hl,Zt.AxiosError=ct,Zt.Cancel=Zt.CanceledError,Zt.all=function(x){return Promise.all(x)},Zt.spread=um,Zt.isAxiosError=dm,Zt.mergeConfig=is,Zt.AxiosHeaders=Hi,Zt.formToJSON=f=>xu(ge.isHTMLForm(f)?new FormData(f):f),Zt.getAdapter=Du.getAdapter,Zt.HttpStatusCode=Oc,Zt.default=Zt;const pm=(f,x=300)=>{let k;return function(...D){clearTimeout(k),k=setTimeout(()=>{f.apply(this,D)},x)}};function ml(f,x,k={}){const P={type:"Feature"};return(k.id===0||k.id)&&(P.id=k.id),k.bbox&&(P.bbox=k.bbox),P.properties=x||{},P.geometry=f,P}function Ou(f,x,k={}){if(!f)throw new Error("coordinates is required");if(!Array.isArray(f))throw new Error("coordinates must be an Array");if(f.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Uu(f[0])||!Uu(f[1]))throw new Error("coordinates must contain numbers");return ml({type:"Point",coordinates:f},x,k)}function Vu(f,x,k={}){for(const D of f){if(D.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(D[D.length-1].length!==D[0].length)throw new Error("First and last Position are not equivalent.");for(let j=0;j<D[D.length-1].length;j++)if(D[D.length-1][j]!==D[0][j])throw new Error("First and last Position are not equivalent.")}return ml({type:"Polygon",coordinates:f},x,k)}function Nu(f,x,k={}){return ml({type:"MultiPoint",coordinates:f},x,k)}function $u(f,x,k={}){return ml({type:"MultiPolygon",coordinates:f},x,k)}function Uu(f){return!isNaN(f)&&f!==null&&!Array.isArray(f)}function Vc(f,x,k){if(f!==null)for(var P,D,j,S,c,fe,me,ve=0,ae=0,le,dt=f.type,Ue=dt==="FeatureCollection",Ke=dt==="Feature",Oe=Ue?f.features.length:1,ft=0;ft<Oe;ft++){me=Ue?f.features[ft].geometry:Ke?f.geometry:f,le=me?me.type==="GeometryCollection":!1,c=le?me.geometries.length:1;for(var st=0;st<c;st++){var He=0,Ft=0;if(S=le?me.geometries[st]:me,S!==null){fe=S.coordinates;var wt=S.type;switch(ve=k&&(wt==="Polygon"||wt==="MultiPolygon")?1:0,wt){case null:break;case"Point":if(x(fe,ae,ft,He,Ft)===!1)return!1;ae++,He++;break;case"LineString":case"MultiPoint":for(P=0;P<fe.length;P++){if(x(fe[P],ae,ft,He,Ft)===!1)return!1;ae++,wt==="MultiPoint"&&He++}wt==="LineString"&&He++;break;case"Polygon":case"MultiLineString":for(P=0;P<fe.length;P++){for(D=0;D<fe[P].length-ve;D++){if(x(fe[P][D],ae,ft,He,Ft)===!1)return!1;ae++}wt==="MultiLineString"&&He++,wt==="Polygon"&&Ft++}wt==="Polygon"&&He++;break;case"MultiPolygon":for(P=0;P<fe.length;P++){for(Ft=0,D=0;D<fe[P].length;D++){for(j=0;j<fe[P][D].length-ve;j++){if(x(fe[P][D][j],ae,ft,He,Ft)===!1)return!1;ae++}Ft++}He++}break;case"GeometryCollection":for(P=0;P<S.geometries.length;P++)if(Vc(S.geometries[P],x,k)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function jo(f,x={}){if(f.bbox!=null&&x.recompute!==!0)return f.bbox;const k=[1/0,1/0,-1/0,-1/0];return Vc(f,P=>{k[0]>P[0]&&(k[0]=P[0]),k[1]>P[1]&&(k[1]=P[1]),k[2]<P[0]&&(k[2]=P[0]),k[3]<P[1]&&(k[3]=P[1])}),k}function fm(f,x={}){const k=jo(f),P=(k[0]+k[2])/2,D=(k[1]+k[3])/2;return Ou([P,D],x.properties,x)}function mm(f,x={}){let k=0,P=0,D=0;return Vc(f,function(j){k+=j[0],P+=j[1],D++},!0),Ou([k/D,P/D],x.properties)}const gm={mixins:[Oo],props:{map:{type:Object},baseLayers:{type:Array,default:[{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS",category:"Національна інфраструктура геопросторових даних",scale:1e4,year:2020,bounds:"ua",maxzoom:18,owner:"НДІГК (Інститут геодезії та картографії)",image:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png",basemap:!0},{id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0},{id:"darkmap_carto",name:"Темна карта України",image:"https://basemaps.cartocdn.com/dark_all/13/4791/2762.png?ver=2023-04-14",url:"https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",active:!1}]},selectedLayer:{type:String,required:!0}},watch:{map(f){f&&f.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){var f;this.baseLayers.forEach(x=>{this.layerList.push(x)}),this.toggleLayerVisibility((f=this.baseLayers[0])==null?void 0:f.id)},toggleLayerVisibility(f){this.$emit("update:selectedLayer",f),this.changeBaseLayer(f)}}},_m={class:"vs-map-slot-layers z-10 select-none"},ym=["onClick"],xm=["src"];function vm(f,x,k,P,D,j){return N.openBlock(),N.createElementBlock("div",_m,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.baseLayers,(S,c)=>(N.openBlock(),N.createElementBlock("div",{key:S.id,class:N.normalizeClass(["vs-map-slot-layers__layer relative",{focused:S.id==k.selectedLayer}]),onClick:fe=>j.toggleLayerVisibility(S.id)},[N.createElementVNode("img",{src:S.image,class:"vs-map-slot-layers__image"},null,8,xm),N.createElementVNode("div",{class:N.normalizeClass(["absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] text-nowrap p-2 hidden whitespace-nowrap",[c===0?"left-[-10px]":"left-[50%] translate-x-[-50%]"]])},N.toDisplayString(S==null?void 0:S.name),3)],10,ym))),128))])}const bm=Fi(gm,[["render",vm],["__scopeId","data-v-8959e540"]]),wm={},Sm={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Tm=[N.createElementVNode("path",{d:"M18 6 6 18"},null,-1),N.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function km(f,x){return N.openBlock(),N.createElementBlock("svg",Sm,Tm)}const gl=Fi(wm,[["render",km]]),Im={},Cm={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Em=[N.createElementVNode("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 17L12 22L22 17",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12L12 17L22 12",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function Pm(f,x){return N.openBlock(),N.createElementBlock("svg",Cm,Em)}const Am={components:{closeIcon:gl,layersIcon:Fi(Im,[["render",Pm]])},mixins:[Oo],props:{layers:{type:Array,default:()=>[]},map:{type:Object,default:null},basemapIds:{type:Array,default:()=>[]}},data(){return{isOpen:!1,selectedLayers:[],mounted:!1}},mounted(){this.mounted=!0},methods:{async handleLayerChange(f,x){await this.setVisible(f,x),x&&this.map.getStyle().layers.filter(D=>!this.basemapIds.includes(D.id)&&D.id!==f.id).map(D=>D.id).forEach(D=>{this.map.getLayer(D)&&this.map.moveLayer(D)})}}},Mm=f=>(N.pushScopeId("data-v-4c33eaa0"),f=f(),N.popScopeId(),f),zm={class:"p-[10px]"},Dm={class:"select-none absolute left-[20px] top-[10px] border bg-white max-w-[250px] p-[10px] rounded-lg z-10"},Lm={class:"flex justify-between items-center border-b pb-[8px] text-[16px]"},Rm=Mm(()=>N.createElementVNode("span",null,"Додаткові шари",-1)),Bm={class:"mt-2 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Fm=["id","value","onChange"],Om=["for"];function Vm(f,x,k,P,D,j){const S=N.resolveComponent("layersIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("closeIcon");return N.openBlock(),N.createElementBlock(N.Fragment,null,[!D.isOpen&&D.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"right",class:"select-none flex absolute left-[20px] top-[10px] border bg-white max-w-[250px] rounded-lg cursor-pointer z-10",onClick:x[0]||(x[0]=me=>D.isOpen=!D.isOpen)},{reference:N.withCtx(()=>[N.createElementVNode("div",zm,[N.createVNode(S,{class:"h-5 w-5"})])]),default:N.withCtx(()=>[N.createTextVNode(" Додаткові шари ")]),_:1})):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",Dm,[N.createElementVNode("div",Lm,[Rm,D.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"bottom",class:"flex"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:x[1]||(x[1]=me=>D.isOpen=!D.isOpen)},[N.createVNode(fe)])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)]),N.withDirectives(N.createElementVNode("div",Bm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.layers,me=>(N.openBlock(),N.createElementBlock("div",{key:me.id,class:"flex items-center gap-2 text-sm"},[N.createElementVNode("input",{type:"checkbox",id:`layer-${me.id}`,value:me.id,class:"cursor-pointer",onChange:ve=>j.handleLayerChange(me,ve.target.checked)},null,40,Fm),N.createElementVNode("label",{for:`layer-${me.id}`,class:"cursor-pointer"},N.toDisplayString(me.name),9,Om)]))),128))],512),[[N.vShow,D.isOpen]])],512),[[N.vShow,D.isOpen]])],64)}const Nm=Fi(Am,[["render",Vm],["__scopeId","data-v-4c33eaa0"]]),$m={mixins:[Oo],components:{closeIcon:gl},props:{map:{type:Object,required:!0},compareLayers:{type:Array,default:()=>[]},table:{type:String,default:""},collapsed:{type:Boolean,default:!1}},data(){return{mounted:!1,currentLayer:null}},mounted(){var f,x;this.currentLayer=((x=(f=this.compareLayers)==null?void 0:f[0])==null?void 0:x.id)||null,this.mounted=!0},watch:{async currentLayer(f,x){const k=this.compareLayers.find(D=>D.id===x),P=this.compareLayers.find(D=>D.id===f);k&&await this.setVisible(k,!1,this.map),P&&await this.setVisible(P,!0,this.map),this.map.getStyle().layers.forEach(D=>{D.source===this.table&&this.map.getLayer(D.id)&&this.map.moveLayer(D.id)})}}},Um={class:"absolute w-full top-[10px] right-[50px] shadow-sm bg-white max-w-[250px] p-[10px] rounded-lg z-10 select-none border"},jm={class:"flex items-start justify-between pb-1 border-b"},qm=N.createElementVNode("div",{class:"text-[16px] max-w-[180px]"}," Базові шари порівняльної карти ",-1),Zm={class:"flex gap-2"},Gm=N.createElementVNode("button",{type:"button",class:"size-6 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"}," - ",-1),Hm={class:"pt-1 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Wm=["id","name","value"],Xm=["for"];function Jm(f,x,k,P,D,j){const S=N.resolveComponent("VsPopover"),c=N.resolveComponent("closeIcon");return N.withDirectives((N.openBlock(),N.createElementBlock("div",Um,[N.createElementVNode("div",jm,[qm,N.createElementVNode("div",Zm,[D.mounted?(N.openBlock(),N.createBlock(S,{key:0,trigger:"hover",placement:"bottom",teleport:"body",onClick:x[0]||(x[0]=fe=>f.$emit("update:collapsed",!0))},{reference:N.withCtx(()=>[Gm]),default:N.withCtx(()=>[N.createTextVNode(" Згорнути панель ")]),_:1})):N.createCommentVNode("",!0),D.mounted?(N.openBlock(),N.createBlock(S,{key:1,trigger:"hover",placement:"bottom",teleport:"body"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:x[1]||(x[1]=fe=>f.$emit("close"))},[N.createVNode(c,{class:"cursor-pointer"})])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)])]),N.createElementVNode("div",Hm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.compareLayers,fe=>(N.openBlock(),N.createElementBlock("div",{key:fe.id,class:"flex items-center py-1"},[N.withDirectives(N.createElementVNode("input",{type:"radio",id:fe.id,name:fe.id,value:fe.id,"onUpdate:modelValue":x[2]||(x[2]=me=>D.currentLayer=me),class:"shrink-0 border-gray-200 rounded-full text-blue-600 focus:ring-blue-500 checked:border-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800"},null,8,Wm),[[N.vModelRadio,D.currentLayer]]),N.createElementVNode("label",{for:fe.id,class:"text-[14px] ml-2 cursor-pointer"},N.toDisplayString(fe.name),9,Xm)]))),128))])],512)),[[N.vShow,!k.collapsed]])}const Km=Fi($m,[["render",Jm]]),Ym={},Qm={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},eg=[N.createElementVNode("path",{d:"M18 8L22 12L18 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M6 8L2 12L6 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12H22",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function tg(f,x,k,P,D,j){return N.openBlock(),N.createElementBlock("svg",Qm,eg)}const ig={components:{closeIcon:gl,compareIcon:Fi(Ym,[["render",tg]]),CompareBaseLayers:Km},props:{map:{type:Object},compareLayers:{type:Array},table:{type:String}},data(){return{isOpen:!1,mounted:!1,afterMap:null,compare:null,isOpen:!1,afterMapLoaded:!1,collapsed:!1}},mounted(){this.mounted=!0,window.maplibregl=In,this.loadScripts()},computed:{modalButtonClasses(){return{"!bg-[#F2F2F2]":this.isOpen,"bg-white":!this.isOpen}}},watch:{isOpen(f){this.$emit("isCompareOpen",f)}},methods:{loadScripts(){const f=document.createElement("link");f.setAttribute("rel","stylesheet"),f.setAttribute("href","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.css"),document.head.appendChild(f);const x=document.createElement("script");x.setAttribute("src","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.js"),document.head.appendChild(x)},initCompare(){const f=this.map,x={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},k=new In.Map({container:"after",style:x,center:f.getCenter(),zoom:f.getZoom(),minZoom:f.getMinZoom()});if(k.addControl(new In.NavigationControl({visualizePitch:!0})),k.on("load",()=>{this.afterMapLoaded=!0,this.syncLayers()}),this.afterMap=k,window.maplibregl&&window.maplibregl.Compare){const P="#comparison-container";this.compare=new window.maplibregl.Compare(f,k,P,{mousemove:!1})}else console.error("Compare is not available on window.maplibregl")},destroyCompare(){this.compare&&(this.compare.remove(),this.compare=null),this.afterMap&&(this.afterMap.remove(),this.afterMap=null),this.isOpen=!1,this.afterMapLoaded=!1},toggleCompare(){if(this.collapsed){this.collapsed=!1;return}this.isOpen=!this.isOpen,this.isOpen?this.$nextTick(()=>{this.initCompare(),this.resizeMaps()}):this.destroyCompare()},resizeMaps(){this.map.resize(),this.afterMap&&this.afterMap.resize()},syncLayers(){if(!this.map||!this.afterMap)return;const f=this.map,x=this.afterMap;f.getSource(this.table)&&(x.getSource(this.table)||x.addSource(this.table,f.getStyle().sources[this.table]));const P=f.getStyle().layers.filter(D=>D.source===this.table);P.length&&P.forEach(D=>{x.getLayer(D.id)||x.addLayer(D)})}}},rg={class:"w-[29px] h-[29px] flex items-center justify-center"},ng={key:2,id:"comparison-container",class:"absolute top-0 right-0 w-full h-full"},sg=[N.createElementVNode("div",{id:"after",class:"map-compare"},null,-1)];function og(f,x,k,P,D,j){const S=N.resolveComponent("compareIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("CompareBaseLayers");return N.openBlock(),N.createElementBlock(N.Fragment,null,[D.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"left",class:N.normalizeClass(["flex absolute right-[10px] top-[120px] bg-white max-w-[250px] rounded-lg cursor-pointer z-10",j.modalButtonClasses]),onClick:j.toggleCompare,style:{"box-shadow":"0 0 0 2px rgba(0, 0, 0, 0.2)"}},{reference:N.withCtx(()=>[N.createElementVNode("div",rg,[N.createVNode(S,{class:"w-4 h-4"})])]),default:N.withCtx(()=>[N.createTextVNode(" Порівняти шари ")]),_:1},8,["class","onClick"])):N.createCommentVNode("",!0),D.isOpen&&D.afterMapLoaded?(N.openBlock(),N.createBlock(fe,{key:1,table:k.table,map:D.afterMap,compareLayers:k.compareLayers,onClose:j.destroyCompare,collapsed:D.collapsed,"onUpdate:collapsed":x[0]||(x[0]=me=>D.collapsed=me)},null,8,["table","map","compareLayers","onClose","collapsed"])):N.createCommentVNode("",!0),D.isOpen?(N.openBlock(),N.createElementBlock("div",ng,sg)):N.createCommentVNode("",!0)],64)}const ag=Fi(ig,[["render",og]]),lg={props:["colors","strokes","title"],methods:{capitalizeFirstLetter(f){return f?f.charAt(0).toUpperCase()+f.slice(1):""}}},cg={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg z-10 border"},hg={key:0,class:"mb-[10px] text-[1rem]"},ug={key:1},dg={class:"legend-item flex items-center gap-2"},pg={class:"ml-1 text-[0.875rem]"},fg={class:"legend-item"},mg={key:0,class:"flex justify-start items-center gap-2"},gg={class:"ml-1 text-[0.875rem]"};function _g(f,x,k,P,D,j){var S;return N.openBlock(),N.createElementBlock("div",cg,[k.title?(N.openBlock(),N.createElementBlock("div",hg,N.toDisplayString(k.title),1)):N.createCommentVNode("",!0),(S=k.strokes)!=null&&S.length?(N.openBlock(),N.createElementBlock("div",ug,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.strokes,c=>(N.openBlock(),N.createElementBlock("div",dg,[N.createElementVNode("div",{class:"w-[15px] h-[4px]",style:N.normalizeStyle({background:`repeating-linear-gradient(to right, ${c.color}, ${c.color} 5px, transparent 5px, transparent 8px)`})},null,4),N.createElementVNode("div",pg,N.toDisplayString(j.capitalizeFirstLetter(c.text)),1)]))),256))])):N.createCommentVNode("",!0),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.colors,c=>(N.openBlock(),N.createElementBlock("div",fg,[c.id>0?(N.openBlock(),N.createElementBlock("div",mg,[N.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:N.normalizeStyle({backgroundColor:c.color})},null,4),N.createElementVNode("div",gg,N.toDisplayString(j.capitalizeFirstLetter(c.text)),1)])):N.createCommentVNode("",!0)]))),256))])}const yg={components:{MapSlotLayers:bm,MapLegend:Fi(lg,[["render",_g]]),AdditionalLayers:Nm,MapCompare:ag},props:{polygonOpacity:{type:Number,default:()=>0},polygonStrokeWidth:{type:Number,default:()=>4},dashedLine:{type:Boolean,default:()=>!1},colorAttr:null,strokeAttr:null,zoom:{type:Array,default:()=>8},defaultColor:{type:String,default:"blue"},selectedBaseLayer:{type:String,required:!0},legendname:{type:String,default:()=>""},height:{type:String,default:()=>"100vh"},width:{type:String,default:"100vw"},center:{type:Array,default:[32,49]},maxBounds:{type:Array,default:[[22,44],[40,52]]},table:{type:String,default:""},zoom:{type:[String,Number],default:13},minZoom:{type:[String,Number],default:1},basemap:Array,additionalLayers:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}},pointZoom:{type:String,default:"12"},legend:{type:Boolean,default:()=>!0},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var f,x,k,P;try{if(await this.createMap(),(f=this.row)!=null&&f.geom){const{type:D,coordinates:j}=this.row.geom;let S;switch(D){case"Polygon":S=Vu(j);break;case"MultiPolygon":S=$u(j);break;case"MultiPoint":S=Nu(j);break;default:(x=this.map)==null||x.fitBounds([j,j],{maxZoom:this.zoom,padding:30,duration:0}),this.isSelectObj=!0;return}const c=fm(S).geometry.coordinates;(k=this.map)==null||k.fitBounds([c,c],{maxZoom:this.zoom,padding:30,duration:0})}(P=this.map)==null||P.fitBounds(this.center,{duration:0})}catch{}},watch:{filtersParam(f){this.setFilter(this.table,f)},selectedBaseLayer(f){this.$emit("update:selectedBaseLayer",f)},row:{handler(f){f!=null&&f.geom&&this.fitToBounds(f.geom),this.map&&this.map.getStyle()&&this.map.getStyle().layers.filter(P=>P.source===this.table&&P.type==="line").forEach(P=>{var D;this.map.setPaintProperty(P.id,"line-width",((D=this.row)==null?void 0:D.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5)})},immediate:!0}},computed:{basemapIds(){return this.basemap.map(f=>f==null?void 0:f.id)},allLayers(){return[...this.basemap||[],...this.additionalLayers||[],...this.compareLayers||[]]}},methods:{async getColorStyle(){var f=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return this.defaultColor;try{const{data:{rows:x}}=await Zt.get(`/api/data/${this.table}/${this.colorAttr}`),k=x.reduce((P,D,j)=>D!=null&&D.id?[...P,D.id.toString(),D.color||f[0][j%5]]:P,["match",["get",this.colorAttr]]);return this.colors=[...x],k.push("gray"),k}catch(x){console.log(x)}},async getStrokeStyle(){if(!this.strokeAttr)return"transparent";try{const{data:{rows:f}}=await Zt.get(`/api/data/${this.table}/${this.strokeAttr}`),x=f.reduce((k,P,D)=>P!=null&&P.id?[...k,{id:P.id.toString(),color:P.color||"#000000",dash:P.dash||[2,2],text:P.text||P.id.toString()}]:k,[]);return this.strokes=[...x],["match",["get",this.strokeAttr],...x.flatMap(({id:k,color:P})=>[k,P]),"transparent"]}catch(f){return console.log(f),"transparent"}},async handleMapLoad(){var P,D,j,S;(P=this.row)!=null&&P.geom&&this.fitToBounds(this.row.geom),this.$emit("map",this.map);const f=await this.getStrokeStyle(),x=await this.getColorStyle(),k=((j=(D=location.search.split("&").find(c=>c.includes("filter=")))==null?void 0:D.split("filter="))==null?void 0:j[1])||"";await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=${this.pointZoom}&dt=${new Date().toISOString()}${k?`&filter=${k}`:""}`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":x,"fill-opacity":this.polygonOpacity??.1,"fill-outline-color":["case",["==",["feature-state","hover"],!0],"red","#000000"]},filter:["all",["==",["geometry-type"],"Polygon"]]},{type:"circle","source-layer":this.table,filter:["all",["==",["geometry-type"],"Point"]],paint:{"circle-radius":{base:1.75,stops:[[10,5],[12,6],[18,12]]},"circle-stroke-color":["case",["==",["feature-state","hover"],!0],"red","#ccc"],"circle-stroke-width":["case",["==",["feature-state","hover"],!0],2,1],"circle-color":x}},{type:"line",paint:{"line-color":this.dashedLine?f:x,"line-width":((S=this.row)==null?void 0:S.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5,...this.dashedLine&&{"line-dasharray":[2,2]}}}]})},async createMap(){const f={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new In.Map({container:"maplibre-map",style:f,zoom:this.zoom,center:this.center,minZoom:this.minZoom}),this.$parent.map=this.map,this.map.addControl(new In.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)},fitToBounds(f){if(!this.map)return;const{type:x,coordinates:k}=f;let P,D;switch(x){case"Polygon":P=Vu(k),D=jo(P),this.map.fitBounds(D,{padding:30,maxZoom:15,duration:0});break;case"MultiPolygon":P=$u(k),D=jo(P),this.map.fitBounds(D,{padding:30,maxZoom:15,duration:0});break;case"MultiPoint":P=Nu(k),D=jo(P),this.map.fitBounds(D,{padding:30,maxZoom:15,duration:0});break;case"Point":this.map.flyTo({center:k,zoom:15,essential:!0});break;default:console.warn("Невідомий тип геометрії:",x)}}}},xg={class:"vs-map-portal relative z-1 mt-2",id:"mapwrapper"};function vg(f,x,k,P,D,j){var ve;const S=N.resolveComponent("MapLegend"),c=N.resolveComponent("MapSlotLayers"),fe=N.resolveComponent("MapCompare"),me=N.resolveComponent("AdditionalLayers");return N.openBlock(),N.createElementBlock("div",xg,[N.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",class:"w-full compare_main_map",style:N.normalizeStyle({height:k.height})},null,4),N.withDirectives(N.createVNode(S,{colors:D.colors,title:k.legendname},null,8,["colors","title"]),[[N.vShow,k.legend]]),N.createVNode(c,{map:D.map,baseLayers:k.basemap,selectedLayer:k.selectedBaseLayer,"onUpdate:selectedLayer":x[0]||(x[0]=ae=>f.$emit("update:selectedBaseLayer",ae))},null,8,["map","baseLayers","selectedLayer"]),N.createVNode(fe,{map:D.map,compareLayers:j.allLayers,table:k.table,onIsCompareOpen:x[1]||(x[1]=ae=>f.$emit("isCompareOpen",ae))},null,8,["map","compareLayers","table"]),(ve=k.additionalLayers)!=null&&ve.length?(N.openBlock(),N.createBlock(me,{key:0,map:D.map,layers:k.additionalLayers,basemapIds:j.basemapIds},null,8,["map","layers","basemapIds"])):N.createCommentVNode("",!0)])}const bg=Fi(yg,[["render",vg]]),wg={},Sg={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Tg=[N.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)];function kg(f,x){return N.openBlock(),N.createElementBlock("svg",Sg,Tg)}const Ig=Fi(wg,[["render",kg]]),Cg={},Eg={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-collapse"},Pg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function Ag(f,x){return N.openBlock(),N.createElementBlock("svg",Eg,Pg)}const Mg=Fi(Cg,[["render",Ag]]),zg={},Dg={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-expand"},Lg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function Rg(f,x){return N.openBlock(),N.createElementBlock("svg",Dg,Lg)}const Bg=Fi(zg,[["render",Rg]]),Fg={props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""}},emits:["update:visible","onClose"],name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){var f;return!!((f=this.$slots)!=null&&f.footer)},checkSize(){return this.size==="small"?"w-5/12":this.size==="medium"?"w-6/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:f}){f==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")}}},ju=f=>(N.pushScopeId("data-v-37405773"),f=f(),N.popScopeId(),f),Og={class:"vsTailwind ui-dialog__wrapper"},Vg={class:"w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},Ng={class:"py-2.5 px-4 flex justify-between items-center border-b"},$g={class:"font-medium text-gray-800"},Ug=[ju(()=>N.createElementVNode("span",{class:"sr-only"},"Close",-1)),ju(()=>N.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("path",{d:"M18 6 6 18"}),N.createElementVNode("path",{d:"m6 6 12 12"})],-1))],jg={class:"ui-dialog__content p-4"},qg={key:0,class:"flex justify-end gap-x-2"};function Zg(f,x,k,P,D,j){return N.openBlock(),N.createBlock(N.Teleport,{to:"#modal"},[N.createVNode(N.Transition,{name:"fade"},{default:N.withCtx(()=>[N.withDirectives(N.createElementVNode("div",Og,[N.createElementVNode("div",Vg,[N.createVNode(N.Transition,{name:"content",appear:""},{default:N.withCtx(()=>[N.createElementVNode("div",{class:N.normalizeClass(["ui-dialog__modal opacity-1 transition-all flex flex-col bg-white border pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[j.checkSize]])},[N.createElementVNode("div",Ng,[N.createElementVNode("h3",$g,N.toDisplayString(k.title),1),N.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:x[0]||(x[0]=(...S)=>j.handleClose&&j.handleClose(...S))},Ug)]),N.createElementVNode("div",jg,[N.renderSlot(f.$slots,"default",{},void 0,!0)]),j.hasSlot?(N.openBlock(),N.createElementBlock("div",qg,[N.renderSlot(f.$slots,"footer",{},void 0,!0)])):N.createCommentVNode("",!0)],2)]),_:3})])],512),[[N.vShow,k.visible]])]),_:3})])}const Gg=Fi(Fg,[["render",Zg],["__scopeId","data-v-37405773"]]),Hg=N.defineComponent({props:{title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:Object,default:()=>null},initTotal:{type:[Number,String],default:()=>""},colorAttr:{type:String,default:()=>""},strokeAttr:{type:String,default:()=>""},legendname:{type:String,default:()=>""},center:{type:Array},maxBounds:{type:Array,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},isAutocomplete:{type:Boolean,default:()=>!1},isAddressAutocomplete:{type:Boolean,default:()=>!1},zoom:{type:[Number,String],default:()=>"13"},minZoom:{type:[Number,String],default:()=>"1"},maskForSearch:{type:String,default:()=>null},searchShow:{type:Boolean,default:()=>!0},basemap:{type:Array},additionalLayers:{type:Array},pointZoom:{type:String,default:()=>"12"},legend:{type:Boolean,default:()=>!0},defaultColor:{type:String,default:()=>"blue"},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],components:{MapPortal:bg,NoData:qp,FilterIcon:Ig,VisibleMapIcon:Mg,HiddenMapIcon:Bg,CloseIcon:gl,VsDialog:Gg},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchAddress:"",map:null,selectedBaseLayer:"",marker:null,selectedRow:null,activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,regionOptionGeneral:null,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,legendName:null,total:null,filtered:null,filterValues:"",activeFiltersCount:"",visibleTrue:!0,regionSelectValue:null,addressSelectValue:null,currentBbox:null,mountedFilter:{},isCompareOpen:!1,optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:pm(f=>{this.handleSearchValue(f)},300)}},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick),this.$emit("update:map",this.map)},activeFiltersCount(){var f,x;return(x=(f=this.$refs)==null?void 0:f.filter)==null?void 0:x.filteredActiveFiltersLength},activeFilters(){var f,x;return this.isSelectObj&&this.moveToDefaultPage(),(x=(f=this.$refs)==null?void 0:f.filter)==null?void 0:x.activeFilters},isFilterVisible(f){f||this.getData()},async regionSelectValue(f,x){var D,j;if(!this.regionSelectValue){this.map.removeSource("region-search-id");return}f&&this.selectedId&&this.closeObjCard(),this.polyline=this.regionSelectValue.encoded_geom,this.getData();const k=((D=this.regionSelectValue)==null?void 0:D.geom)||Tr.toGeoJSON(this.regionSelectValue.encoded_geom),P=this.map.getSource("region-search-id");if(this.currentBbox=jo(k),P)P.setData({type:"Feature",geometry:k});else{this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:k}});const S={id:"region-search-id",type:"line",source:"region-search-id",paint:{"line-color":"blue","line-opacity":1}};await this.map.addLayer(S)}this.moveLayer("site.prc.parcel_object.table"),(j=this.map)==null||j.fitBounds(this.currentBbox,{zoom:this.setAtuZoom,padding:20,duration:0}),this.getData()},async addressSelectValue(f,x){this.addressSelectValue&&(f&&this.selectedId&&this.closeObjCard(),this.getData())}},created(){this.legendName,this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){this.rows||this.getData();const x=new URLSearchParams(window.location.search).get("filter"),k=x==null?void 0:x.split("|");k==null||k.forEach(D=>{const[j,S]=D.split("=");S!=null&&S.includes(",")?this.mountedFilter[j]=S==null?void 0:S.split(","):this.mountedFilter[j]=S});const P=new URLSearchParams(window.location.search);this.currentPage=P.get("page")||1,this.getFilter()},updated(){this.checkFilterLength()},computed:{setAtuZoom(){var f,x,k;return((f=this.regionSelectValue)==null?void 0:f.id)==="UA80000000000093317"||((x=this.regionSelectValue)==null?void 0:x.id)==="UA85000000000065278"?10:((k=this.regionSelectValue)==null?void 0:k.region)===""?7.5:11}},methods:{async getData(){try{const f={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};f.filter=this.filtersParam;const{data:x}=await Zt.get(`/api/data/${this.table}`,{params:f});this.tableData=x==null?void 0:x.rows,this.total=x.filtered,this.filtered=x.filtered}catch(f){console.error(f.message)}},moveToDefaultPage(){var P;const f=new URLSearchParams(window.location.search);f.delete("id");const k=`${window.location.pathname}?${f.toString()}`;(P=this.map)==null||P.fitBounds(this.maxBounds,{duration:0}),window.history.pushState({},"",k),this.isSelectObj=!1},regionFullName(f){return f.region?`${f.text} / ${f.region}`:f.text},getLabelById(f){const x=this.filters.find(k=>k.id===f);return x?x.label:f},getOptionsLabelById(f,x){if(Array.isArray(x)){const k=this.filters.find(P=>P.id===f);return k!=null&&k.options?k==null?void 0:k.options.filter(P=>x.includes(P.id)).map(P=>P.text).join(", "):x==null?void 0:x.length}else return x},async clearFilter(f){var x,k,P;await((k=(x=this.$refs)==null?void 0:x.filter)==null?void 0:k.clearFilter(f)),this.filterUrl=(P=this.$refs)==null?void 0:P.filter.filterUrl,await this.updateTableAndMap(),await this.getData()},handlePageChange(f){this.currentPage=f;const x=new URL(window.location.href),k=new URLSearchParams(window.location.search);k.set("page",f),x.search=decodeURI(k.toString()),window.history.pushState({},"",x),this.getData()},async getFilter(){var f;try{const{data:x}=await Zt.get(`/api/filter/${this.table}`);this.filters=(f=x==null?void 0:x.list)==null?void 0:f.map(k=>({...k,label:(k==null?void 0:k.label)||(k==null?void 0:k.ua),id:(k==null?void 0:k.id)||(k==null?void 0:k.name)}))}catch(x){console.error(x.message)}},async handleSearchValue(f){this.search=f,await this.getData()},closeObjCard(){var P;const f=new URLSearchParams(window.location.search);f.delete("id"),this.deletePulsePoint(),this.deleteHighlighPolygon();const k=`${window.location.pathname}?${f.toString()}`;(this.currentBbox||this.center)&&((P=this.map)==null||P.fitBounds(this.currentBbox||[this.center,this.center],{maxZoom:this.zoom,duration:0})),window.history.pushState({},"",k),this.isSelectObj=!1,this.selectedRow=null,this.getData()},async handleSearchRegionValue(f){var k;const x=this.map.getLayer("region-search-id");this.searchRegion=f,f===""&&x?((k=this.map)==null||k.fitBounds(this.maxBounds,{duration:0}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("region-search-id"),this.getData()):f===""&&this.getData()},async handleSearchAddressValue(f){var k;const x=this.map.getLayer("address-search-id");this.searchAddress=f,f===""&&x?((k=this.map)==null||k.fitBounds(this.maxBounds,{duration:0}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("address-search-id"),this.getData()):f===""&&this.getData()},handleFilterChange(f){this.$emit("update:filterState",f),this.currentPage=f.state.page||1,this.filterUrl=f.url==="no-url"?null:f.url.split("|").filter(x=>!x.includes("page=")).join("|")},async updateTableAndMap(){var f,x;this.selectedRow||(this.filtersParam=this.filterUrl,this.activeFilters=(x=(f=this.$refs)==null?void 0:f.filter)==null?void 0:x.activeFilters,this.isFilterVisible=!1,this.getData())},handleFilterSubmit(){var f;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(f=this.map)==null||f.fitBounds(this.maxBounds,{duration:0}),this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(f=!0){const x=new URLSearchParams(window.location.search);x.has("id")?(this.isSelectObj=!0,this.isMapVisible=f,this.selectedId=x.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(f){this.limit=f,this.currentPage=1,this.getData()},filterModalClose(){this.isFilterVisible=!1},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.isFilterVisible=!1,this.filtersParam="",this.polyline=null,this.regionSelectValue=null,this.addressSelectValue=null,this.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1,this.handleSearchRegionValue(""),this.handleSearchAddressValue(""))},checkFilterLength(){var x,k;const f=(k=(x=this.$refs)==null?void 0:x.filter)==null?void 0:k.filteredActiveFiltersLength;f!==this.previousLength&&(this.previousLength=f,this.activeFiltersCount=f)},async handleMapClick(f){var j,S,c,fe,me,ve,ae,le;const x=this.map.queryRenderedFeatures(f.point);if((x==null?void 0:x.length)<1)return;const k=window.location.pathname,P=new URLSearchParams(window.location.search);P.set("id",`${(j=x[0])==null?void 0:j.properties.id}`),this.getObjectData((c=(S=x[0])==null?void 0:S.properties)==null?void 0:c.id);const D=`${k}?${P.toString()}`;window.history.pushState({},"",D),this.isSelectObj=!0,f.lngLat&&((le=this.map)==null||le.fitBounds([[(fe=f.lngLat)==null?void 0:fe.lng,(me=f.lngLat)==null?void 0:me.lat],[(ve=f.lngLat)==null?void 0:ve.lng,(ae=f.lngLat)==null?void 0:ae.lat]],{padding:30,duration:0})),this.checkUrl()},async getObjectData(f){var x,k;try{const{data:P}=await Zt.get(`/api/data/${this.table}/${f}`);this.selectRow((x=P==null?void 0:P.rows)==null?void 0:x[0]),((k=P==null?void 0:P.rows)==null?void 0:k.lenght)<1&&this.deletePulsePoint()}catch(P){console.error(P.message)}},async selectRow(f,x=!0){var c;this.isMapVisible=x;const P=await(await fetch(`/api/data/${this.table}/${f.id}`)).json();this.selectedRow=((c=P==null?void 0:P.rows)==null?void 0:c[0])||f;const D=window.location.pathname,j=new URLSearchParams(window.location.search);j.set("id",`${f.id}`);const S=`${D}?${j.toString()}`;window.history.pushState({},"",S),this.checkUrl(x),this.isSelectObj=!0},deletePulsePoint(){this.marker&&this.marker.remove()},addPulsePoint(f){this.deletePulsePoint();const x=document.createElement("div");x.className="gps-marker",x.style.width="10px",x.style.height="10px",x.style.position="relative";const k=document.createElement("div");k.className="gps-wave",x.appendChild(k),this.marker=new In.Marker({element:x,anchor:"center"}).setLngLat(f).addTo(this.map)},deleteHighlighPolygon(){var f,x,k;(f=this.map)!=null&&f.getLayer("highlighted-polygon")&&((x=this.map)==null||x.removeLayer("highlighted-polygon"),(k=this.map)==null||k.removeSource("highlighted-polygon"))},highlightPolygon(f){var x,k,P,D,j,S;this.deletePulsePoint(),this.deleteHighlighPolygon(),(D=this.map)==null||D.addSource("highlighted-polygon",{type:"geojson",data:{geometry:{type:(x=f==null?void 0:f.geom)==null?void 0:x.type,coordinates:(k=f==null?void 0:f.geom)==null?void 0:k.coordinates},type:"Feature",properties:{id:f==null?void 0:f.id,name:f==null?void 0:f.name,category:f==null?void 0:f.id},id:f==null?void 0:f.id,layer:{id:"site.rest_zone.table-0",type:"fill",source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",filter:["all",["==",["geometry-type"],(P=f==null?void 0:f.geom)==null?void 0:P.type]],paint:{"fill-color":"orange","fill-opacity":.5},layout:{}},source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",state:{hover:!0},table:"site.rest_zone.table"}}),(j=this.map)==null||j.addLayer({id:"highlighted-polygon",type:"fill",source:"highlighted-polygon",layout:{},minzoom:12,maxzoom:0,paint:{"fill-color":"orange","fill-opacity":.6}}),(S=this.map)==null||S.moveLayer("highlighted-polygon")},async handleMapHover(f){var S,c,fe;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new In.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const x=this.map.queryRenderedFeatures(f.point);if(this.map.getCanvas().style.cursor="pointer",!(x!=null&&x.length)||((S=x==null?void 0:x[0])==null?void 0:S.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const k=["route-line"];if(!x.filter(me=>!k.some(ve=>{var ae;return(ae=me.layer)==null?void 0:ae.source.includes(ve)})).length)return;const D=x[0].geometry.coordinates.slice();x[0].source==="highlighted-polygon"&&x[1]?this.hoverData=(c=x[1])==null?void 0:c.properties:this.hoverData=(fe=x[0])==null?void 0:fe.properties;const j={source:x[0].source,sourceLayer:x[0].sourceLayer,id:x[0].id};if(j.source!=="region-search-id"){for(this.map.setFeatureState(j,{hover:!0}),this.hoverObject=j;Math.abs(f.lngLat.lng-D[0])>180;)D[0]+=f.lngLat.lng>D[0]?360:-360;this.popup.setLngLat(f.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}},removeSelectedBaseLayer(){this.selectedBaseLayer=""},addGeomMarker(f){if(!this.map||!f)return;this.marker&&this.marker.remove();let x;(f==null?void 0:f.type)==="Point"?x=f.coordinates:x=mm(f).geometry.coordinates,this.marker=new In.Marker({color:"green"}).setLngLat(x).addTo(this.map)}}}),Wg={class:"ml-3 pt-[20px]"},Xg={class:"w-full gap-5 flex justify-between mb-[6px] pr-3"},Jg={class:"flex items-center gap-2 max-h-[38px] pt-[4px]"},Kg={class:"custom-filter-list"},Yg={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},Qg=["title"],e_=N.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),t_={class:"flex"},i_={class:"py-[15px] pb-[24px] pl-2"},r_={class:"font-bold text-2xl mr-[10px]"},n_={class:"text-sm text-stone-500 font-medium"},s_=N.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),o_={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},a_={key:0,class:"flex gap-x-2 flex-wrap"},l_={class:"font-medium"},c_=N.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),h_={class:"text-gray-500"},u_=["onClick"],d_={key:0,class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full"},p_=N.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),f_={key:2,class:"text-center py-28"},m_=N.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),g_=N.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),__={key:0},y_={key:1,class:"my-5 pr-2"},x_={class:"flex justify-between"},v_={class:"w-2/4"},b_={class:"map-section relative"},w_={ref:"popup",style:{display:"none"}};function S_(f,x,k,P,D,j){var Oe,ft;const S=N.resolveComponent("VsTextMask"),c=N.resolveComponent("vs-text"),fe=N.resolveComponent("FilterIcon"),me=N.resolveComponent("VsFilterList"),ve=N.resolveComponent("VisibleMapIcon"),ae=N.resolveComponent("HiddenMapIcon"),le=N.resolveComponent("CloseIcon"),dt=N.resolveComponent("NoData"),Ue=N.resolveComponent("VsPagination"),Ke=N.resolveComponent("MapPortal");return N.openBlock(),N.createElementBlock("section",Wg,[N.createElementVNode("div",null,[N.createElementVNode("div",Xg,[N.createElementVNode("div",Jg,[f.maskForSearch?(N.openBlock(),N.createBlock(S,{key:0,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"w-full table-interface-search",placeholder:"Пошук",mask:f.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue","mask"])):f.searchShow?(N.openBlock(),N.createBlock(c,{key:1,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"[&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:w-[220px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"])):N.createCommentVNode("",!0),N.createElementVNode("div",Kg,[f.filters?(N.openBlock(),N.createBlock(me,{key:0,ref:"filter",modelValue:f.mountedFilter,"onUpdate:modelValue":x[0]||(x[0]=st=>f.mountedFilter=st),scheme:f.filters,isDialog:(Oe=f.filters)==null?void 0:Oe.some(st=>!(st!=null&&st.inline)),"apply-vue-router":"",history:"",view:"plain",clearable:!1,name:"filter",onFilterChange:x[1]||(x[1]=async st=>{await f.handleFilterChange(st),await f.updateTableAndMap()})},{button:N.withCtx(({visible:st})=>[N.createElementVNode("button",{type:"button",class:N.normalizeClass(["py-2 px-2.5 h-[40px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-50",[st?"border border-blue-600 border-2":"border border-gray-200"]])},[N.createVNode(fe),N.createTextVNode(" Фільтри "),f.activeFiltersCount>=1?(N.openBlock(),N.createElementBlock("span",Yg,N.toDisplayString(f.activeFiltersCount),1)):N.createCommentVNode("",!0)],2)]),_:1},8,["modelValue","scheme","isDialog"])):N.createCommentVNode("",!0)])]),N.createElementVNode("button",{type:"button",class:"py-2 px-2 inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100",title:f.isMapVisible?"Приховати карту":"Показати карту",onClick:x[2]||(x[2]=(...st)=>f.toggleMapVisible&&f.toggleMapVisible(...st))},[f.isMapVisible?(N.openBlock(),N.createBlock(ve,{key:0})):(N.openBlock(),N.createBlock(ae,{key:1})),e_],8,Qg)]),N.createElementVNode("div",t_,[N.createElementVNode("div",{class:N.normalizeClass(["relative overflow-hidden",f.isMapVisible?"w-2/4 mr-0":"w-full mr-3",f.isSelectObj?"hidden":""])},[N.createElementVNode("h1",i_,[N.createElementVNode("span",r_,N.toDisplayString(f.title),1),N.createElementVNode("span",n_,N.toDisplayString(f.total),1),s_]),N.createElementVNode("div",o_,[f.activeFilters?(N.openBlock(),N.createElementBlock("div",a_,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(f.activeFilters,(st,He,Ft)=>(N.openBlock(),N.createElementBlock("span",{class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full",key:Ft},[N.createElementVNode("span",l_,N.toDisplayString(f.getLabelById(He)),1),c_,N.createElementVNode("span",h_,N.toDisplayString(f.getOptionsLabelById(He,st)),1),N.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:wt=>f.clearFilter(He)},[N.createVNode(le)],8,u_)]))),128)),((ft=Object.keys(f.activeFilters))==null?void 0:ft.length)>=2?(N.openBlock(),N.createElementBlock("span",d_,[p_,N.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:x[3]||(x[3]=st=>f.mountedFilter={})},[N.createVNode(le)])])):N.createCommentVNode("",!0)])):N.createCommentVNode("",!0),f.total>=1?N.renderSlot(f.$slots,"table",{key:1,rows:f.tableData,map:f.map,marker:f.marker,selectRow:f.selectRow,getData:f.getData,addGeomMarker:f.addGeomMarker,isMapVisible:f.isMapVisible}):(N.openBlock(),N.createElementBlock("div",f_,[N.createVNode(dt),m_,g_,N.createElementVNode("button",{type:"button",class:"mt-[10px] py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs rounded-lg border border-stone-200 bg-white text-stone-800 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",onClick:x[4]||(x[4]=(...st)=>f.resetFilters&&f.resetFilters(...st))}," Очистити дані пошуку ")]))]),f.total>=1?(N.openBlock(),N.createElementBlock("hr",__)):N.createCommentVNode("",!0),f.total>=1?(N.openBlock(),N.createElementBlock("div",y_,[N.createElementVNode("div",x_,[N.createVNode(Ue,{total:f.total,maxPages:7,defaultPage:f.currentPage,pageSize:f.limit,goTo:!1,size:"medium",onPageChange:f.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:!0,pageSizes:[10,20,30],onPageSizeChange:f.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):N.createCommentVNode("",!0)],2),f.isSelectObj?(N.openBlock(),N.createElementBlock("div",{key:0,class:N.normalizeClass(f.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[N.renderSlot(f.$slots,"details",{table:f.table,selectedId:f.selectedId,selectedRow:f.selectedRow,map:f.map,closeObjCard:f.closeObjCard,isMapVisible:f.isMapVisible})],2)):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",v_,[N.createElementVNode("section",b_,[N.renderSlot(f.$slots,"default",{map:f.map,removeSelectedBaseLayer:f.removeSelectedBaseLayer,selectedBaseLayer:f.selectedBaseLayer,isCompareOpen:f.isCompareOpen,selectedRow:f.selectedRow}),N.createVNode(Ke,{height:"calc(100vh - 152px)",width:"w-2/4",table:f.table,filtersParam:f.filtersParam,row:f.selectedRow,legendname:f.legendname,legend:f.legend,compareLayers:f.compareLayers,colorAttr:f.colorAttr,strokeAttr:f.strokeAttr,maxBounds:f.maxBounds,center:f.center,zoom:f.zoom,minZoom:f.minZoom,basemap:f.basemap,additionalLayers:f.additionalLayers,pointZoom:f.pointZoom,defaultColor:f.defaultColor,onMap:x[5]||(x[5]=st=>f.map=st),selectedBaseLayer:f.selectedBaseLayer,"onUpdate:selectedBaseLayer":x[6]||(x[6]=st=>f.selectedBaseLayer=st),onIsCompareOpen:x[7]||(x[7]=st=>f.isCompareOpen=st)},null,8,["table","filtersParam","row","legendname","legend","compareLayers","colorAttr","strokeAttr","maxBounds","center","zoom","minZoom","basemap","additionalLayers","pointZoom","defaultColor","selectedBaseLayer"])])],512),[[N.vShow,f.isMapVisible]])]),N.createElementVNode("div",w_,[N.renderSlot(f.$slots,"popup",{data:f.hoverData})],512)])])}const qu=Fi(Hg,[["render",S_]]),Zu={install:f=>{f.component("VsPartsMap",qu)},components:{VsPartsMap:qu}};return typeof window<"u"&&(window.PartsMap=Zu),Zu});
|
585
|
+
`+j):P.stack=j}catch{}}throw P}}_request(x,k){typeof x=="string"?(k=k||{},k.url=x):k=x||{},k=is(this.defaults,k);const{transitional:P,paramsSerializer:D,headers:j}=k;P!==void 0&&Bc.assertOptions(P,{silentJSONParsing:Cn.transitional(Cn.boolean),forcedJSONParsing:Cn.transitional(Cn.boolean),clarifyTimeoutError:Cn.transitional(Cn.boolean)},!1),D!=null&&(ge.isFunction(D)?k.paramsSerializer={serialize:D}:Bc.assertOptions(D,{encode:Cn.function,serialize:Cn.function},!0)),k.method=(k.method||this.defaults.method||"get").toLowerCase();let S=j&&ge.merge(j.common,j[k.method]);j&&ge.forEach(["delete","get","head","post","put","patch","common"],Ue=>{delete j[Ue]}),k.headers=Hi.concat(S,j);const c=[];let fe=!0;this.interceptors.request.forEach(function(Ke){typeof Ke.runWhen=="function"&&Ke.runWhen(k)===!1||(fe=fe&&Ke.synchronous,c.unshift(Ke.fulfilled,Ke.rejected))});const me=[];this.interceptors.response.forEach(function(Ke){me.push(Ke.fulfilled,Ke.rejected)});let ve,ae=0,le;if(!fe){const Ue=[Lu.bind(this),void 0];for(Ue.unshift.apply(Ue,c),Ue.push.apply(Ue,me),le=Ue.length,ve=Promise.resolve(k);ae<le;)ve=ve.then(Ue[ae++],Ue[ae++]);return ve}le=c.length;let dt=k;for(ae=0;ae<le;){const Ue=c[ae++],Ke=c[ae++];try{dt=Ue(dt)}catch(Oe){Ke.call(this,Oe);break}}try{ve=Lu.call(this,dt)}catch(Ue){return Promise.reject(Ue)}for(ae=0,le=me.length;ae<le;)ve=ve.then(me[ae++],me[ae++]);return ve}getUri(x){x=is(this.defaults,x);const k=ku(x.baseURL,x.url);return gu(k,x.params,x.paramsSerializer)}}ge.forEach(["delete","get","head","options"],function(x){rs.prototype[x]=function(k,P){return this.request(is(P||{},{method:x,url:k,data:(P||{}).data}))}}),ge.forEach(["post","put","patch"],function(x){function k(P){return function(j,S,c){return this.request(is(c||{},{method:x,headers:P?{"Content-Type":"multipart/form-data"}:{},url:j,data:S}))}}rs.prototype[x]=k(),rs.prototype[x+"Form"]=k(!0)});class Fc{constructor(x){if(typeof x!="function")throw new TypeError("executor must be a function.");let k;this.promise=new Promise(function(j){k=j});const P=this;this.promise.then(D=>{if(!P._listeners)return;let j=P._listeners.length;for(;j-- >0;)P._listeners[j](D);P._listeners=null}),this.promise.then=D=>{let j;const S=new Promise(c=>{P.subscribe(c),j=c}).then(D);return S.cancel=function(){P.unsubscribe(j)},S},x(function(j,S,c){P.reason||(P.reason=new $s(j,S,c),k(P.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(x){if(this.reason){x(this.reason);return}this._listeners?this._listeners.push(x):this._listeners=[x]}unsubscribe(x){if(!this._listeners)return;const k=this._listeners.indexOf(x);k!==-1&&this._listeners.splice(k,1)}static source(){let x;return{token:new Fc(function(D){x=D}),cancel:x}}}function um(f){return function(k){return f.apply(null,k)}}function dm(f){return ge.isObject(f)&&f.isAxiosError===!0}const Oc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Oc).forEach(([f,x])=>{Oc[x]=f});function Fu(f){const x=new rs(f),k=eu(rs.prototype.request,x);return ge.extend(k,rs.prototype,x,{allOwnKeys:!0}),ge.extend(k,x,null,{allOwnKeys:!0}),k.create=function(D){return Fu(is(f,D))},k}const Zt=Fu($o);Zt.Axios=rs,Zt.CanceledError=$s,Zt.CancelToken=Fc,Zt.isCancel=bu,Zt.VERSION=Ru,Zt.toFormData=hl,Zt.AxiosError=ct,Zt.Cancel=Zt.CanceledError,Zt.all=function(x){return Promise.all(x)},Zt.spread=um,Zt.isAxiosError=dm,Zt.mergeConfig=is,Zt.AxiosHeaders=Hi,Zt.formToJSON=f=>xu(ge.isHTMLForm(f)?new FormData(f):f),Zt.getAdapter=Du.getAdapter,Zt.HttpStatusCode=Oc,Zt.default=Zt;const pm=(f,x=300)=>{let k;return function(...D){clearTimeout(k),k=setTimeout(()=>{f.apply(this,D)},x)}};function ml(f,x,k={}){const P={type:"Feature"};return(k.id===0||k.id)&&(P.id=k.id),k.bbox&&(P.bbox=k.bbox),P.properties=x||{},P.geometry=f,P}function Ou(f,x,k={}){if(!f)throw new Error("coordinates is required");if(!Array.isArray(f))throw new Error("coordinates must be an Array");if(f.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Uu(f[0])||!Uu(f[1]))throw new Error("coordinates must contain numbers");return ml({type:"Point",coordinates:f},x,k)}function Vu(f,x,k={}){for(const D of f){if(D.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(D[D.length-1].length!==D[0].length)throw new Error("First and last Position are not equivalent.");for(let j=0;j<D[D.length-1].length;j++)if(D[D.length-1][j]!==D[0][j])throw new Error("First and last Position are not equivalent.")}return ml({type:"Polygon",coordinates:f},x,k)}function Nu(f,x,k={}){return ml({type:"MultiPoint",coordinates:f},x,k)}function $u(f,x,k={}){return ml({type:"MultiPolygon",coordinates:f},x,k)}function Uu(f){return!isNaN(f)&&f!==null&&!Array.isArray(f)}function Vc(f,x,k){if(f!==null)for(var P,D,j,S,c,fe,me,ve=0,ae=0,le,dt=f.type,Ue=dt==="FeatureCollection",Ke=dt==="Feature",Oe=Ue?f.features.length:1,ft=0;ft<Oe;ft++){me=Ue?f.features[ft].geometry:Ke?f.geometry:f,le=me?me.type==="GeometryCollection":!1,c=le?me.geometries.length:1;for(var st=0;st<c;st++){var He=0,Ft=0;if(S=le?me.geometries[st]:me,S!==null){fe=S.coordinates;var wt=S.type;switch(ve=k&&(wt==="Polygon"||wt==="MultiPolygon")?1:0,wt){case null:break;case"Point":if(x(fe,ae,ft,He,Ft)===!1)return!1;ae++,He++;break;case"LineString":case"MultiPoint":for(P=0;P<fe.length;P++){if(x(fe[P],ae,ft,He,Ft)===!1)return!1;ae++,wt==="MultiPoint"&&He++}wt==="LineString"&&He++;break;case"Polygon":case"MultiLineString":for(P=0;P<fe.length;P++){for(D=0;D<fe[P].length-ve;D++){if(x(fe[P][D],ae,ft,He,Ft)===!1)return!1;ae++}wt==="MultiLineString"&&He++,wt==="Polygon"&&Ft++}wt==="Polygon"&&He++;break;case"MultiPolygon":for(P=0;P<fe.length;P++){for(Ft=0,D=0;D<fe[P].length;D++){for(j=0;j<fe[P][D].length-ve;j++){if(x(fe[P][D][j],ae,ft,He,Ft)===!1)return!1;ae++}Ft++}He++}break;case"GeometryCollection":for(P=0;P<S.geometries.length;P++)if(Vc(S.geometries[P],x,k)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function jo(f,x={}){if(f.bbox!=null&&x.recompute!==!0)return f.bbox;const k=[1/0,1/0,-1/0,-1/0];return Vc(f,P=>{k[0]>P[0]&&(k[0]=P[0]),k[1]>P[1]&&(k[1]=P[1]),k[2]<P[0]&&(k[2]=P[0]),k[3]<P[1]&&(k[3]=P[1])}),k}function fm(f,x={}){const k=jo(f),P=(k[0]+k[2])/2,D=(k[1]+k[3])/2;return Ou([P,D],x.properties,x)}function mm(f,x={}){let k=0,P=0,D=0;return Vc(f,function(j){k+=j[0],P+=j[1],D++},!0),Ou([k/D,P/D],x.properties)}const gm={mixins:[Oo],props:{map:{type:Object},baseLayers:{type:Array,default:[{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS",category:"Національна інфраструктура геопросторових даних",scale:1e4,year:2020,bounds:"ua",maxzoom:18,owner:"НДІГК (Інститут геодезії та картографії)",image:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png",basemap:!0},{id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0},{id:"darkmap_carto",name:"Темна карта України",image:"https://basemaps.cartocdn.com/dark_all/13/4791/2762.png?ver=2023-04-14",url:"https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",active:!1}]},selectedLayer:{type:String,required:!0}},watch:{map(f){f&&f.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){var f;this.baseLayers.forEach(x=>{this.layerList.push(x)}),this.toggleLayerVisibility((f=this.baseLayers[0])==null?void 0:f.id)},toggleLayerVisibility(f){this.$emit("update:selectedLayer",f),this.changeBaseLayer(f)}}},_m={class:"vs-map-slot-layers z-10 select-none"},ym=["onClick"],xm=["src"];function vm(f,x,k,P,D,j){return N.openBlock(),N.createElementBlock("div",_m,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.baseLayers,(S,c)=>(N.openBlock(),N.createElementBlock("div",{key:S.id,class:N.normalizeClass(["vs-map-slot-layers__layer relative",{focused:S.id==k.selectedLayer}]),onClick:fe=>j.toggleLayerVisibility(S.id)},[N.createElementVNode("img",{src:S.image,class:"vs-map-slot-layers__image"},null,8,xm),N.createElementVNode("div",{class:N.normalizeClass(["absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] text-nowrap p-2 hidden whitespace-nowrap",[c===0?"left-[-10px]":"left-[50%] translate-x-[-50%]"]])},N.toDisplayString(S==null?void 0:S.name),3)],10,ym))),128))])}const bm=Fi(gm,[["render",vm],["__scopeId","data-v-8959e540"]]),wm={},Sm={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Tm=[N.createElementVNode("path",{d:"M18 6 6 18"},null,-1),N.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function km(f,x){return N.openBlock(),N.createElementBlock("svg",Sm,Tm)}const gl=Fi(wm,[["render",km]]),Im={},Cm={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Em=[N.createElementVNode("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 17L12 22L22 17",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12L12 17L22 12",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function Pm(f,x){return N.openBlock(),N.createElementBlock("svg",Cm,Em)}const Am={components:{closeIcon:gl,layersIcon:Fi(Im,[["render",Pm]])},mixins:[Oo],props:{layers:{type:Array,default:()=>[]},map:{type:Object,default:null},basemapIds:{type:Array,default:()=>[]}},data(){return{isOpen:!1,selectedLayers:[],mounted:!1}},mounted(){this.mounted=!0},methods:{async handleLayerChange(f,x){await this.setVisible(f,x),x&&this.map.getStyle().layers.filter(D=>!this.basemapIds.includes(D.id)&&D.id!==f.id).map(D=>D.id).forEach(D=>{this.map.getLayer(D)&&this.map.moveLayer(D)})}}},Mm=f=>(N.pushScopeId("data-v-4c33eaa0"),f=f(),N.popScopeId(),f),zm={class:"p-[10px]"},Dm={class:"select-none absolute left-[20px] top-[10px] border bg-white max-w-[250px] p-[10px] rounded-lg z-10"},Lm={class:"flex justify-between items-center border-b pb-[8px] text-[16px]"},Rm=Mm(()=>N.createElementVNode("span",null,"Додаткові шари",-1)),Bm={class:"mt-2 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Fm=["id","value","onChange"],Om=["for"];function Vm(f,x,k,P,D,j){const S=N.resolveComponent("layersIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("closeIcon");return N.openBlock(),N.createElementBlock(N.Fragment,null,[!D.isOpen&&D.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"right",class:"select-none flex absolute left-[20px] top-[10px] border bg-white max-w-[250px] rounded-lg cursor-pointer z-10",onClick:x[0]||(x[0]=me=>D.isOpen=!D.isOpen)},{reference:N.withCtx(()=>[N.createElementVNode("div",zm,[N.createVNode(S,{class:"h-5 w-5"})])]),default:N.withCtx(()=>[N.createTextVNode(" Додаткові шари ")]),_:1})):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",Dm,[N.createElementVNode("div",Lm,[Rm,D.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"bottom",class:"flex"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:x[1]||(x[1]=me=>D.isOpen=!D.isOpen)},[N.createVNode(fe)])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)]),N.withDirectives(N.createElementVNode("div",Bm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.layers,me=>(N.openBlock(),N.createElementBlock("div",{key:me.id,class:"flex items-center gap-2 text-sm"},[N.createElementVNode("input",{type:"checkbox",id:`layer-${me.id}`,value:me.id,class:"cursor-pointer",onChange:ve=>j.handleLayerChange(me,ve.target.checked)},null,40,Fm),N.createElementVNode("label",{for:`layer-${me.id}`,class:"cursor-pointer"},N.toDisplayString(me.name),9,Om)]))),128))],512),[[N.vShow,D.isOpen]])],512),[[N.vShow,D.isOpen]])],64)}const Nm=Fi(Am,[["render",Vm],["__scopeId","data-v-4c33eaa0"]]),$m={mixins:[Oo],components:{closeIcon:gl},props:{map:{type:Object,required:!0},compareLayers:{type:Array,default:()=>[]},table:{type:String,default:""},collapsed:{type:Boolean,default:!1}},data(){return{mounted:!1,currentLayer:null}},mounted(){var f,x;this.currentLayer=((x=(f=this.compareLayers)==null?void 0:f[0])==null?void 0:x.id)||null,this.mounted=!0},watch:{async currentLayer(f,x){const k=this.compareLayers.find(D=>D.id===x),P=this.compareLayers.find(D=>D.id===f);k&&await this.setVisible(k,!1,this.map),P&&await this.setVisible(P,!0,this.map),this.map.getStyle().layers.forEach(D=>{D.source===this.table&&this.map.getLayer(D.id)&&this.map.moveLayer(D.id)})}}},Um={class:"absolute w-full top-[10px] right-[50px] shadow-sm bg-white max-w-[250px] p-[10px] rounded-lg z-10 select-none border"},jm={class:"flex items-start justify-between pb-1 border-b"},qm=N.createElementVNode("div",{class:"text-[16px] max-w-[180px]"}," Базові шари порівняльної карти ",-1),Zm={class:"flex gap-2"},Gm=N.createElementVNode("button",{type:"button",class:"size-6 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"}," - ",-1),Hm={class:"pt-1 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Wm=["id","name","value"],Xm=["for"];function Jm(f,x,k,P,D,j){const S=N.resolveComponent("VsPopover"),c=N.resolveComponent("closeIcon");return N.withDirectives((N.openBlock(),N.createElementBlock("div",Um,[N.createElementVNode("div",jm,[qm,N.createElementVNode("div",Zm,[D.mounted?(N.openBlock(),N.createBlock(S,{key:0,trigger:"hover",placement:"bottom",teleport:"body",onClick:x[0]||(x[0]=fe=>f.$emit("update:collapsed",!0))},{reference:N.withCtx(()=>[Gm]),default:N.withCtx(()=>[N.createTextVNode(" Згорнути панель ")]),_:1})):N.createCommentVNode("",!0),D.mounted?(N.openBlock(),N.createBlock(S,{key:1,trigger:"hover",placement:"bottom",teleport:"body"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:x[1]||(x[1]=fe=>f.$emit("close"))},[N.createVNode(c,{class:"cursor-pointer"})])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)])]),N.createElementVNode("div",Hm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.compareLayers,fe=>(N.openBlock(),N.createElementBlock("div",{key:fe.id,class:"flex items-center py-1"},[N.withDirectives(N.createElementVNode("input",{type:"radio",id:fe.id,name:fe.id,value:fe.id,"onUpdate:modelValue":x[2]||(x[2]=me=>D.currentLayer=me),class:"shrink-0 border-gray-200 rounded-full text-blue-600 focus:ring-blue-500 checked:border-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800"},null,8,Wm),[[N.vModelRadio,D.currentLayer]]),N.createElementVNode("label",{for:fe.id,class:"text-[14px] ml-2 cursor-pointer"},N.toDisplayString(fe.name),9,Xm)]))),128))])],512)),[[N.vShow,!k.collapsed]])}const Km=Fi($m,[["render",Jm]]),Ym={},Qm={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},eg=[N.createElementVNode("path",{d:"M18 8L22 12L18 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M6 8L2 12L6 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12H22",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function tg(f,x,k,P,D,j){return N.openBlock(),N.createElementBlock("svg",Qm,eg)}const ig={components:{closeIcon:gl,compareIcon:Fi(Ym,[["render",tg]]),CompareBaseLayers:Km},props:{map:{type:Object},compareLayers:{type:Array},table:{type:String}},data(){return{isOpen:!1,mounted:!1,afterMap:null,compare:null,isOpen:!1,afterMapLoaded:!1,collapsed:!1}},mounted(){this.mounted=!0,window.maplibregl=In,this.loadScripts()},computed:{modalButtonClasses(){return{"!bg-[#F2F2F2]":this.isOpen,"bg-white":!this.isOpen}}},watch:{isOpen(f){this.$emit("isCompareOpen",f)}},methods:{loadScripts(){const f=document.createElement("link");f.setAttribute("rel","stylesheet"),f.setAttribute("href","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.css"),document.head.appendChild(f);const x=document.createElement("script");x.setAttribute("src","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.js"),document.head.appendChild(x)},initCompare(){const f=this.map,x={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},k=new In.Map({container:"after",style:x,center:f.getCenter(),zoom:f.getZoom(),minZoom:f.getMinZoom()});if(k.addControl(new In.NavigationControl({visualizePitch:!0})),k.on("load",()=>{this.afterMapLoaded=!0,this.syncLayers()}),this.afterMap=k,window.maplibregl&&window.maplibregl.Compare){const P="#comparison-container";this.compare=new window.maplibregl.Compare(f,k,P,{mousemove:!1})}else console.error("Compare is not available on window.maplibregl")},destroyCompare(){this.compare&&(this.compare.remove(),this.compare=null),this.afterMap&&(this.afterMap.remove(),this.afterMap=null),this.isOpen=!1,this.afterMapLoaded=!1},toggleCompare(){if(this.collapsed){this.collapsed=!1;return}this.isOpen=!this.isOpen,this.isOpen?this.$nextTick(()=>{this.initCompare(),this.resizeMaps()}):this.destroyCompare()},resizeMaps(){this.map.resize(),this.afterMap&&this.afterMap.resize()},syncLayers(){if(!this.map||!this.afterMap)return;const f=this.map,x=this.afterMap;f.getSource(this.table)&&(x.getSource(this.table)||x.addSource(this.table,f.getStyle().sources[this.table]));const P=f.getStyle().layers.filter(D=>D.source===this.table);P.length&&P.forEach(D=>{x.getLayer(D.id)||x.addLayer(D)})}}},rg={class:"w-[29px] h-[29px] flex items-center justify-center"},ng={key:2,id:"comparison-container",class:"absolute top-0 right-0 w-full h-full"},sg=[N.createElementVNode("div",{id:"after",class:"map-compare"},null,-1)];function og(f,x,k,P,D,j){const S=N.resolveComponent("compareIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("CompareBaseLayers");return N.openBlock(),N.createElementBlock(N.Fragment,null,[D.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"left",class:N.normalizeClass(["flex absolute right-[10px] top-[120px] bg-white max-w-[250px] rounded-lg cursor-pointer z-10",j.modalButtonClasses]),onClick:j.toggleCompare,style:{"box-shadow":"0 0 0 2px rgba(0, 0, 0, 0.2)"}},{reference:N.withCtx(()=>[N.createElementVNode("div",rg,[N.createVNode(S,{class:"w-4 h-4"})])]),default:N.withCtx(()=>[N.createTextVNode(" Порівняти шари ")]),_:1},8,["class","onClick"])):N.createCommentVNode("",!0),D.isOpen&&D.afterMapLoaded?(N.openBlock(),N.createBlock(fe,{key:1,table:k.table,map:D.afterMap,compareLayers:k.compareLayers,onClose:j.destroyCompare,collapsed:D.collapsed,"onUpdate:collapsed":x[0]||(x[0]=me=>D.collapsed=me)},null,8,["table","map","compareLayers","onClose","collapsed"])):N.createCommentVNode("",!0),D.isOpen?(N.openBlock(),N.createElementBlock("div",ng,sg)):N.createCommentVNode("",!0)],64)}const ag=Fi(ig,[["render",og]]),lg={props:["colors","strokes","title"],methods:{capitalizeFirstLetter(f){return f?f.charAt(0).toUpperCase()+f.slice(1):""}}},cg={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg z-10 border"},hg={key:0,class:"mb-[10px] text-[1rem]"},ug={key:1},dg={class:"legend-item flex items-center gap-2"},pg={class:"ml-1 text-[0.875rem]"},fg={class:"legend-item"},mg={key:0,class:"flex justify-start items-center gap-2"},gg={class:"ml-1 text-[0.875rem]"};function _g(f,x,k,P,D,j){var S;return N.openBlock(),N.createElementBlock("div",cg,[k.title?(N.openBlock(),N.createElementBlock("div",hg,N.toDisplayString(k.title),1)):N.createCommentVNode("",!0),(S=k.strokes)!=null&&S.length?(N.openBlock(),N.createElementBlock("div",ug,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.strokes,c=>(N.openBlock(),N.createElementBlock("div",dg,[N.createElementVNode("div",{class:"w-[15px] h-[4px]",style:N.normalizeStyle({background:`repeating-linear-gradient(to right, ${c.color}, ${c.color} 5px, transparent 5px, transparent 8px)`})},null,4),N.createElementVNode("div",pg,N.toDisplayString(j.capitalizeFirstLetter(c.text)),1)]))),256))])):N.createCommentVNode("",!0),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.colors,c=>(N.openBlock(),N.createElementBlock("div",fg,[c.id>0?(N.openBlock(),N.createElementBlock("div",mg,[N.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:N.normalizeStyle({backgroundColor:c.color})},null,4),N.createElementVNode("div",gg,N.toDisplayString(j.capitalizeFirstLetter(c.text)),1)])):N.createCommentVNode("",!0)]))),256))])}const yg={components:{MapSlotLayers:bm,MapLegend:Fi(lg,[["render",_g]]),AdditionalLayers:Nm,MapCompare:ag},props:{polygonOpacity:{type:Number,default:()=>0},polygonStrokeWidth:{type:Number,default:()=>4},dashedLine:{type:Boolean,default:()=>!1},colorAttr:null,strokeAttr:null,zoom:{type:Array,default:()=>8},defaultColor:{type:String,default:"blue"},selectedBaseLayer:{type:String,required:!0},legendname:{type:String,default:()=>""},height:{type:String,default:()=>"100vh"},width:{type:String,default:"100vw"},center:{type:Array,default:[32,49]},maxBounds:{type:Array,default:[[22,44],[40,52]]},table:{type:String,default:""},zoom:{type:[String,Number],default:13},minZoom:{type:[String,Number],default:1},basemap:Array,additionalLayers:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}},pointZoom:{type:String,default:"12"},legend:{type:Boolean,default:()=>!0},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var f,x,k,P;try{if(await this.createMap(),(f=this.row)!=null&&f.geom){const{type:D,coordinates:j}=this.row.geom;let S;switch(D){case"Polygon":S=Vu(j);break;case"MultiPolygon":S=$u(j);break;case"MultiPoint":S=Nu(j);break;default:(x=this.map)==null||x.fitBounds([j,j],{maxZoom:this.zoom,padding:30,duration:0}),this.isSelectObj=!0;return}const c=fm(S).geometry.coordinates;(k=this.map)==null||k.fitBounds([c,c],{maxZoom:this.zoom,padding:30,duration:0})}(P=this.map)==null||P.fitBounds(this.center,{duration:0})}catch{}},watch:{filtersParam(f){this.setFilter(this.table,f)},selectedBaseLayer(f){this.$emit("update:selectedBaseLayer",f)},row:{handler(f){f!=null&&f.geom&&this.fitToBounds(f.geom),this.map&&this.map.getStyle()&&this.map.getStyle().layers.filter(P=>P.source===this.table&&P.type==="line").forEach(P=>{var D;this.map.setPaintProperty(P.id,"line-width",((D=this.row)==null?void 0:D.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5)})},immediate:!0}},computed:{basemapIds(){return this.basemap.map(f=>f==null?void 0:f.id)},allLayers(){return[...this.basemap||[],...this.additionalLayers||[],...this.compareLayers||[]]}},methods:{async getColorStyle(){var f=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return this.defaultColor;try{const{data:{rows:x}}=await Zt.get(`/api/data/${this.table}/${this.colorAttr}`),k=x.reduce((P,D,j)=>D!=null&&D.id?[...P,D.id.toString(),D.color||f[0][j%5]]:P,["match",["get",this.colorAttr]]);return this.colors=[...x],k.push("gray"),k}catch(x){console.log(x)}},async getStrokeStyle(){if(!this.strokeAttr)return"transparent";try{const{data:{rows:f}}=await Zt.get(`/api/data/${this.table}/${this.strokeAttr}`),x=f.reduce((k,P,D)=>P!=null&&P.id?[...k,{id:P.id.toString(),color:P.color||"#000000",dash:P.dash||[2,2],text:P.text||P.id.toString()}]:k,[]);return this.strokes=[...x],["match",["get",this.strokeAttr],...x.flatMap(({id:k,color:P})=>[k,P]),"transparent"]}catch(f){return console.log(f),"transparent"}},async handleMapLoad(){var P,D,j,S;(P=this.row)!=null&&P.geom&&this.fitToBounds(this.row.geom),this.$emit("map",this.map);const f=await this.getStrokeStyle(),x=await this.getColorStyle(),k=((j=(D=location.search.split("&").find(c=>c.includes("filter=")))==null?void 0:D.split("filter="))==null?void 0:j[1])||"";await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=${this.pointZoom}&dt=${new Date().toISOString()}${k?`&filter=${k}`:""}`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":x,"fill-opacity":this.polygonOpacity??.1,"fill-outline-color":["case",["==",["feature-state","hover"],!0],"red","#000000"]},filter:["all",["==",["geometry-type"],"Polygon"]]},{type:"circle","source-layer":this.table,filter:["all",["==",["geometry-type"],"Point"]],paint:{"circle-radius":{base:1.75,stops:[[10,5],[12,6],[18,12]]},"circle-stroke-color":["case",["==",["feature-state","hover"],!0],"red","#ccc"],"circle-stroke-width":["case",["==",["feature-state","hover"],!0],2,1],"circle-color":x}},{type:"line",paint:{"line-color":this.dashedLine?f:x,"line-width":((S=this.row)==null?void 0:S.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5,...this.dashedLine&&{"line-dasharray":[2,2]}}}]})},async createMap(){const f={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new In.Map({container:"maplibre-map",style:f,zoom:this.zoom,center:this.center,minZoom:this.minZoom}),this.$parent.map=this.map,this.map.addControl(new In.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)},fitToBounds(f){if(!this.map)return;const{type:x,coordinates:k}=f;let P,D;switch(x){case"Polygon":P=Vu(k),D=jo(P),this.map.fitBounds(D,{padding:30,maxZoom:15,duration:0});break;case"MultiPolygon":P=$u(k),D=jo(P),this.map.fitBounds(D,{padding:30,maxZoom:15,duration:0});break;case"MultiPoint":P=Nu(k),D=jo(P),this.map.fitBounds(D,{padding:30,maxZoom:15,duration:0});break;case"Point":this.map.flyTo({center:k,zoom:15,essential:!0});break;default:console.warn("Невідомий тип геометрії:",x)}}}},xg={class:"vs-map-portal relative z-1 mt-2",id:"mapwrapper"};function vg(f,x,k,P,D,j){var ve;const S=N.resolveComponent("MapLegend"),c=N.resolveComponent("MapSlotLayers"),fe=N.resolveComponent("MapCompare"),me=N.resolveComponent("AdditionalLayers");return N.openBlock(),N.createElementBlock("div",xg,[N.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",class:"w-full compare_main_map",style:N.normalizeStyle({height:k.height})},null,4),N.withDirectives(N.createVNode(S,{colors:D.colors,title:k.legendname},null,8,["colors","title"]),[[N.vShow,k.legend]]),N.createVNode(c,{map:D.map,baseLayers:k.basemap,selectedLayer:k.selectedBaseLayer,"onUpdate:selectedLayer":x[0]||(x[0]=ae=>f.$emit("update:selectedBaseLayer",ae))},null,8,["map","baseLayers","selectedLayer"]),N.createVNode(fe,{map:D.map,compareLayers:j.allLayers,table:k.table,onIsCompareOpen:x[1]||(x[1]=ae=>f.$emit("isCompareOpen",ae))},null,8,["map","compareLayers","table"]),(ve=k.additionalLayers)!=null&&ve.length?(N.openBlock(),N.createBlock(me,{key:0,map:D.map,layers:k.additionalLayers,basemapIds:j.basemapIds},null,8,["map","layers","basemapIds"])):N.createCommentVNode("",!0)])}const bg=Fi(yg,[["render",vg]]),wg={},Sg={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Tg=[N.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)];function kg(f,x){return N.openBlock(),N.createElementBlock("svg",Sg,Tg)}const Ig=Fi(wg,[["render",kg]]),Cg={},Eg={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-collapse"},Pg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function Ag(f,x){return N.openBlock(),N.createElementBlock("svg",Eg,Pg)}const Mg=Fi(Cg,[["render",Ag]]),zg={},Dg={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-expand"},Lg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function Rg(f,x){return N.openBlock(),N.createElementBlock("svg",Dg,Lg)}const Bg=Fi(zg,[["render",Rg]]),Fg={props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""}},emits:["update:visible","onClose"],name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){var f;return!!((f=this.$slots)!=null&&f.footer)},checkSize(){return this.size==="small"?"w-5/12":this.size==="medium"?"w-6/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:f}){f==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")}}},ju=f=>(N.pushScopeId("data-v-37405773"),f=f(),N.popScopeId(),f),Og={class:"vsTailwind ui-dialog__wrapper"},Vg={class:"w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},Ng={class:"py-2.5 px-4 flex justify-between items-center border-b"},$g={class:"font-medium text-gray-800"},Ug=[ju(()=>N.createElementVNode("span",{class:"sr-only"},"Close",-1)),ju(()=>N.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("path",{d:"M18 6 6 18"}),N.createElementVNode("path",{d:"m6 6 12 12"})],-1))],jg={class:"ui-dialog__content p-4"},qg={key:0,class:"flex justify-end gap-x-2"};function Zg(f,x,k,P,D,j){return N.openBlock(),N.createBlock(N.Teleport,{to:"#modal"},[N.createVNode(N.Transition,{name:"fade"},{default:N.withCtx(()=>[N.withDirectives(N.createElementVNode("div",Og,[N.createElementVNode("div",Vg,[N.createVNode(N.Transition,{name:"content",appear:""},{default:N.withCtx(()=>[N.createElementVNode("div",{class:N.normalizeClass(["ui-dialog__modal opacity-1 transition-all flex flex-col bg-white border pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[j.checkSize]])},[N.createElementVNode("div",Ng,[N.createElementVNode("h3",$g,N.toDisplayString(k.title),1),N.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:x[0]||(x[0]=(...S)=>j.handleClose&&j.handleClose(...S))},Ug)]),N.createElementVNode("div",jg,[N.renderSlot(f.$slots,"default",{},void 0,!0)]),j.hasSlot?(N.openBlock(),N.createElementBlock("div",qg,[N.renderSlot(f.$slots,"footer",{},void 0,!0)])):N.createCommentVNode("",!0)],2)]),_:3})])],512),[[N.vShow,k.visible]])]),_:3})])}const Gg=Fi(Fg,[["render",Zg],["__scopeId","data-v-37405773"]]),Hg=N.defineComponent({props:{title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:Object,default:()=>null},initTotal:{type:[Number,String],default:()=>""},colorAttr:{type:String,default:()=>""},strokeAttr:{type:String,default:()=>""},legendname:{type:String,default:()=>""},center:{type:Array},maxBounds:{type:Array,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},isAutocomplete:{type:Boolean,default:()=>!1},isAddressAutocomplete:{type:Boolean,default:()=>!1},zoom:{type:[Number,String],default:()=>"13"},minZoom:{type:[Number,String],default:()=>"1"},maskForSearch:{type:String,default:()=>null},searchShow:{type:Boolean,default:()=>!0},basemap:{type:Array},additionalLayers:{type:Array},pointZoom:{type:String,default:()=>"12"},legend:{type:Boolean,default:()=>!0},defaultColor:{type:String,default:()=>"blue"},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],components:{MapPortal:bg,NoData:qp,FilterIcon:Ig,VisibleMapIcon:Mg,HiddenMapIcon:Bg,CloseIcon:gl,VsDialog:Gg},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchAddress:"",map:null,selectedBaseLayer:"",marker:null,selectedRow:null,activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,regionOptionGeneral:null,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,legendName:null,total:null,filtered:null,filterValues:"",activeFiltersCount:"",visibleTrue:!0,regionSelectValue:null,addressSelectValue:null,currentBbox:null,mountedFilter:{},isCompareOpen:!1,optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:pm(f=>{this.handleSearchValue(f)},300)}},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick),this.$emit("update:map",this.map)},activeFiltersCount(){var f,x;return(x=(f=this.$refs)==null?void 0:f.filter)==null?void 0:x.filteredActiveFiltersLength},activeFilters(){var f,x;return this.isSelectObj&&this.moveToDefaultPage(),(x=(f=this.$refs)==null?void 0:f.filter)==null?void 0:x.activeFilters},isFilterVisible(f){f||this.getData()},async regionSelectValue(f,x){var D,j;if(!this.regionSelectValue){this.map.removeSource("region-search-id");return}f&&this.selectedId&&this.closeObjCard(),this.polyline=this.regionSelectValue.encoded_geom,this.getData();const k=((D=this.regionSelectValue)==null?void 0:D.geom)||Tr.toGeoJSON(this.regionSelectValue.encoded_geom),P=this.map.getSource("region-search-id");if(this.currentBbox=jo(k),P)P.setData({type:"Feature",geometry:k});else{this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:k}});const S={id:"region-search-id",type:"line",source:"region-search-id",paint:{"line-color":"blue","line-opacity":1}};await this.map.addLayer(S)}this.moveLayer("site.prc.parcel_object.table"),(j=this.map)==null||j.fitBounds(this.currentBbox,{zoom:this.setAtuZoom,padding:20,duration:0}),this.getData()},async addressSelectValue(f,x){this.addressSelectValue&&(f&&this.selectedId&&this.closeObjCard(),this.getData())}},created(){this.legendName,this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){this.rows||this.getData();const x=new URLSearchParams(window.location.search).get("filter"),k=x==null?void 0:x.split("|");k==null||k.forEach(D=>{const[j,S]=D.split("=");S!=null&&S.includes(",")?this.mountedFilter[j]=S==null?void 0:S.split(","):this.mountedFilter[j]=S});const P=new URLSearchParams(window.location.search);this.currentPage=P.get("page")||1,this.getFilter()},updated(){this.checkFilterLength()},computed:{setAtuZoom(){var f,x,k;return((f=this.regionSelectValue)==null?void 0:f.id)==="UA80000000000093317"||((x=this.regionSelectValue)==null?void 0:x.id)==="UA85000000000065278"?10:((k=this.regionSelectValue)==null?void 0:k.region)===""?7.5:11}},methods:{async getData(){try{const f={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};f.filter=this.filtersParam;const{data:x}=await Zt.get(`/api/data/${this.table}`,{params:f});this.tableData=x==null?void 0:x.rows,this.total=x.filtered,this.filtered=x.filtered}catch(f){console.error(f.message)}},moveToDefaultPage(){var P;const f=new URLSearchParams(window.location.search);f.delete("id");const k=`${window.location.pathname}?${f.toString()}`;(P=this.map)==null||P.fitBounds(this.maxBounds,{duration:0}),window.history.pushState({},"",k),this.isSelectObj=!1},regionFullName(f){return f.region?`${f.text} / ${f.region}`:f.text},getLabelById(f){const x=this.filters.find(k=>k.id===f);return x?x.label:f},getOptionsLabelById(f,x){if(Array.isArray(x)){const k=this.filters.find(P=>P.id===f);return k!=null&&k.options?k==null?void 0:k.options.filter(P=>x.includes(P.id)).map(P=>P.text).join(", "):x==null?void 0:x.length}else return x},async clearFilter(f){var x,k,P;await((k=(x=this.$refs)==null?void 0:x.filter)==null?void 0:k.clearFilter(f)),this.filterUrl=(P=this.$refs)==null?void 0:P.filter.filterUrl,console.log(f),f==="region_katottg"&&this.$emit("update:filterState",{}),await this.updateTableAndMap(),await this.getData()},handlePageChange(f){this.currentPage=f;const x=new URL(window.location.href),k=new URLSearchParams(window.location.search);k.set("page",f),x.search=decodeURI(k.toString()),window.history.pushState({},"",x),this.getData()},async getFilter(){var f;try{const{data:x}=await Zt.get(`/api/filter/${this.table}`);this.filters=(f=x==null?void 0:x.list)==null?void 0:f.map(k=>({...k,label:(k==null?void 0:k.label)||(k==null?void 0:k.ua),id:(k==null?void 0:k.id)||(k==null?void 0:k.name)}))}catch(x){console.error(x.message)}},async handleSearchValue(f){this.search=f,await this.getData()},closeObjCard(){var P;const f=new URLSearchParams(window.location.search);f.delete("id"),this.deletePulsePoint(),this.deleteHighlighPolygon();const k=`${window.location.pathname}?${f.toString()}`;(this.currentBbox||this.center)&&((P=this.map)==null||P.fitBounds(this.currentBbox||[this.center,this.center],{maxZoom:this.zoom,duration:0})),window.history.pushState({},"",k),this.isSelectObj=!1,this.selectedRow=null,this.getData()},async handleSearchRegionValue(f){var k;const x=this.map.getLayer("region-search-id");this.searchRegion=f,f===""&&x?((k=this.map)==null||k.fitBounds(this.maxBounds,{duration:0}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("region-search-id"),this.getData()):f===""&&this.getData()},async handleSearchAddressValue(f){var k;const x=this.map.getLayer("address-search-id");this.searchAddress=f,f===""&&x?((k=this.map)==null||k.fitBounds(this.maxBounds,{duration:0}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("address-search-id"),this.getData()):f===""&&this.getData()},handleFilterChange(f){this.$emit("update:filterState",f),this.currentPage=f.state.page||1,this.filterUrl=f.url==="no-url"?null:f.url.split("|").filter(x=>!x.includes("page=")).join("|")},async updateTableAndMap(){var f,x;this.selectedRow||(this.filtersParam=this.filterUrl,this.activeFilters=(x=(f=this.$refs)==null?void 0:f.filter)==null?void 0:x.activeFilters,this.isFilterVisible=!1,this.getData())},handleFilterSubmit(){var f;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(f=this.map)==null||f.fitBounds(this.maxBounds,{duration:0}),this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(f=!0){const x=new URLSearchParams(window.location.search);x.has("id")?(this.isSelectObj=!0,this.isMapVisible=f,this.selectedId=x.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(f){this.limit=f,this.currentPage=1,this.getData()},filterModalClose(){this.isFilterVisible=!1},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.isFilterVisible=!1,this.filtersParam="",this.polyline=null,this.regionSelectValue=null,this.addressSelectValue=null,this.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1,this.handleSearchRegionValue(""),this.handleSearchAddressValue(""))},checkFilterLength(){var x,k;const f=(k=(x=this.$refs)==null?void 0:x.filter)==null?void 0:k.filteredActiveFiltersLength;f!==this.previousLength&&(this.previousLength=f,this.activeFiltersCount=f)},async handleMapClick(f){var j,S,c,fe,me,ve,ae,le;const x=this.map.queryRenderedFeatures(f.point);if((x==null?void 0:x.length)<1)return;const k=window.location.pathname,P=new URLSearchParams(window.location.search);P.set("id",`${(j=x[0])==null?void 0:j.properties.id}`),this.getObjectData((c=(S=x[0])==null?void 0:S.properties)==null?void 0:c.id);const D=`${k}?${P.toString()}`;window.history.pushState({},"",D),this.isSelectObj=!0,f.lngLat&&((le=this.map)==null||le.fitBounds([[(fe=f.lngLat)==null?void 0:fe.lng,(me=f.lngLat)==null?void 0:me.lat],[(ve=f.lngLat)==null?void 0:ve.lng,(ae=f.lngLat)==null?void 0:ae.lat]],{padding:30,duration:0})),this.checkUrl()},async getObjectData(f){var x,k;try{const{data:P}=await Zt.get(`/api/data/${this.table}/${f}`);this.selectRow((x=P==null?void 0:P.rows)==null?void 0:x[0]),((k=P==null?void 0:P.rows)==null?void 0:k.lenght)<1&&this.deletePulsePoint()}catch(P){console.error(P.message)}},async selectRow(f,x=!0){var c;this.isMapVisible=x;const P=await(await fetch(`/api/data/${this.table}/${f.id}`)).json();this.selectedRow=((c=P==null?void 0:P.rows)==null?void 0:c[0])||f;const D=window.location.pathname,j=new URLSearchParams(window.location.search);j.set("id",`${f.id}`);const S=`${D}?${j.toString()}`;window.history.pushState({},"",S),this.checkUrl(x),this.isSelectObj=!0},deletePulsePoint(){this.marker&&this.marker.remove()},addPulsePoint(f){this.deletePulsePoint();const x=document.createElement("div");x.className="gps-marker",x.style.width="10px",x.style.height="10px",x.style.position="relative";const k=document.createElement("div");k.className="gps-wave",x.appendChild(k),this.marker=new In.Marker({element:x,anchor:"center"}).setLngLat(f).addTo(this.map)},deleteHighlighPolygon(){var f,x,k;(f=this.map)!=null&&f.getLayer("highlighted-polygon")&&((x=this.map)==null||x.removeLayer("highlighted-polygon"),(k=this.map)==null||k.removeSource("highlighted-polygon"))},highlightPolygon(f){var x,k,P,D,j,S;this.deletePulsePoint(),this.deleteHighlighPolygon(),(D=this.map)==null||D.addSource("highlighted-polygon",{type:"geojson",data:{geometry:{type:(x=f==null?void 0:f.geom)==null?void 0:x.type,coordinates:(k=f==null?void 0:f.geom)==null?void 0:k.coordinates},type:"Feature",properties:{id:f==null?void 0:f.id,name:f==null?void 0:f.name,category:f==null?void 0:f.id},id:f==null?void 0:f.id,layer:{id:"site.rest_zone.table-0",type:"fill",source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",filter:["all",["==",["geometry-type"],(P=f==null?void 0:f.geom)==null?void 0:P.type]],paint:{"fill-color":"orange","fill-opacity":.5},layout:{}},source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",state:{hover:!0},table:"site.rest_zone.table"}}),(j=this.map)==null||j.addLayer({id:"highlighted-polygon",type:"fill",source:"highlighted-polygon",layout:{},minzoom:12,maxzoom:0,paint:{"fill-color":"orange","fill-opacity":.6}}),(S=this.map)==null||S.moveLayer("highlighted-polygon")},async handleMapHover(f){var S,c,fe;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new In.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const x=this.map.queryRenderedFeatures(f.point);if(this.map.getCanvas().style.cursor="pointer",!(x!=null&&x.length)||((S=x==null?void 0:x[0])==null?void 0:S.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const k=["route-line"];if(!x.filter(me=>!k.some(ve=>{var ae;return(ae=me.layer)==null?void 0:ae.source.includes(ve)})).length)return;const D=x[0].geometry.coordinates.slice();x[0].source==="highlighted-polygon"&&x[1]?this.hoverData=(c=x[1])==null?void 0:c.properties:this.hoverData=(fe=x[0])==null?void 0:fe.properties;const j={source:x[0].source,sourceLayer:x[0].sourceLayer,id:x[0].id};if(j.source!=="region-search-id"){for(this.map.setFeatureState(j,{hover:!0}),this.hoverObject=j;Math.abs(f.lngLat.lng-D[0])>180;)D[0]+=f.lngLat.lng>D[0]?360:-360;this.popup.setLngLat(f.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}},removeSelectedBaseLayer(){this.selectedBaseLayer=""},addGeomMarker(f){if(!this.map||!f)return;this.marker&&this.marker.remove();let x;(f==null?void 0:f.type)==="Point"?x=f.coordinates:x=mm(f).geometry.coordinates,this.marker=new In.Marker({color:"green"}).setLngLat(x).addTo(this.map)}}}),Wg={class:"ml-3 pt-[20px]"},Xg={class:"w-full gap-5 flex justify-between mb-[6px] pr-3"},Jg={class:"flex items-center gap-2 max-h-[38px] pt-[4px]"},Kg={class:"custom-filter-list"},Yg={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},Qg=["title"],e_=N.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),t_={class:"flex"},i_={class:"py-[15px] pb-[24px] pl-2"},r_={class:"font-bold text-2xl mr-[10px]"},n_={class:"text-sm text-stone-500 font-medium"},s_=N.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),o_={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},a_={key:0,class:"flex gap-x-2 flex-wrap"},l_={class:"font-medium"},c_=N.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),h_={class:"text-gray-500"},u_=["onClick"],d_={key:0,class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full"},p_=N.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),f_={key:2,class:"text-center py-28"},m_=N.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),g_=N.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),__={key:0},y_={key:1,class:"my-5 pr-2"},x_={class:"flex justify-between"},v_={class:"w-2/4"},b_={class:"map-section relative"},w_={ref:"popup",style:{display:"none"}};function S_(f,x,k,P,D,j){var Oe,ft;const S=N.resolveComponent("VsTextMask"),c=N.resolveComponent("vs-text"),fe=N.resolveComponent("FilterIcon"),me=N.resolveComponent("VsFilterList"),ve=N.resolveComponent("VisibleMapIcon"),ae=N.resolveComponent("HiddenMapIcon"),le=N.resolveComponent("CloseIcon"),dt=N.resolveComponent("NoData"),Ue=N.resolveComponent("VsPagination"),Ke=N.resolveComponent("MapPortal");return N.openBlock(),N.createElementBlock("section",Wg,[N.createElementVNode("div",null,[N.createElementVNode("div",Xg,[N.createElementVNode("div",Jg,[f.maskForSearch?(N.openBlock(),N.createBlock(S,{key:0,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"w-full table-interface-search",placeholder:"Пошук",mask:f.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue","mask"])):f.searchShow?(N.openBlock(),N.createBlock(c,{key:1,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"[&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:w-[220px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"])):N.createCommentVNode("",!0),N.createElementVNode("div",Kg,[f.filters?(N.openBlock(),N.createBlock(me,{key:0,ref:"filter",modelValue:f.mountedFilter,"onUpdate:modelValue":x[0]||(x[0]=st=>f.mountedFilter=st),scheme:f.filters,isDialog:(Oe=f.filters)==null?void 0:Oe.some(st=>!(st!=null&&st.inline)),"apply-vue-router":"",history:"",view:"plain",clearable:!1,name:"filter",onFilterChange:x[1]||(x[1]=async st=>{await f.handleFilterChange(st),await f.updateTableAndMap()})},{button:N.withCtx(({visible:st})=>[N.createElementVNode("button",{type:"button",class:N.normalizeClass(["py-2 px-2.5 h-[40px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-50",[st?"border border-blue-600 border-2":"border border-gray-200"]])},[N.createVNode(fe),N.createTextVNode(" Фільтри "),f.activeFiltersCount>=1?(N.openBlock(),N.createElementBlock("span",Yg,N.toDisplayString(f.activeFiltersCount),1)):N.createCommentVNode("",!0)],2)]),_:1},8,["modelValue","scheme","isDialog"])):N.createCommentVNode("",!0)])]),N.createElementVNode("button",{type:"button",class:"py-2 px-2 inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100",title:f.isMapVisible?"Приховати карту":"Показати карту",onClick:x[2]||(x[2]=(...st)=>f.toggleMapVisible&&f.toggleMapVisible(...st))},[f.isMapVisible?(N.openBlock(),N.createBlock(ve,{key:0})):(N.openBlock(),N.createBlock(ae,{key:1})),e_],8,Qg)]),N.createElementVNode("div",t_,[N.createElementVNode("div",{class:N.normalizeClass(["relative overflow-hidden",f.isMapVisible?"w-2/4 mr-0":"w-full mr-3",f.isSelectObj?"hidden":""])},[N.createElementVNode("h1",i_,[N.createElementVNode("span",r_,N.toDisplayString(f.title),1),N.createElementVNode("span",n_,N.toDisplayString(f.total),1),s_]),N.createElementVNode("div",o_,[f.activeFilters?(N.openBlock(),N.createElementBlock("div",a_,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(f.activeFilters,(st,He,Ft)=>(N.openBlock(),N.createElementBlock("span",{class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full",key:Ft},[N.createElementVNode("span",l_,N.toDisplayString(f.getLabelById(He)),1),c_,N.createElementVNode("span",h_,N.toDisplayString(f.getOptionsLabelById(He,st)),1),N.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:wt=>f.clearFilter(He)},[N.createVNode(le)],8,u_)]))),128)),((ft=Object.keys(f.activeFilters))==null?void 0:ft.length)>=2?(N.openBlock(),N.createElementBlock("span",d_,[p_,N.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:x[3]||(x[3]=st=>f.mountedFilter={})},[N.createVNode(le)])])):N.createCommentVNode("",!0)])):N.createCommentVNode("",!0),f.total>=1?N.renderSlot(f.$slots,"table",{key:1,rows:f.tableData,map:f.map,marker:f.marker,selectRow:f.selectRow,getData:f.getData,addGeomMarker:f.addGeomMarker,isMapVisible:f.isMapVisible}):(N.openBlock(),N.createElementBlock("div",f_,[N.createVNode(dt),m_,g_,N.createElementVNode("button",{type:"button",class:"mt-[10px] py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs rounded-lg border border-stone-200 bg-white text-stone-800 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",onClick:x[4]||(x[4]=(...st)=>f.resetFilters&&f.resetFilters(...st))}," Очистити дані пошуку ")]))]),f.total>=1?(N.openBlock(),N.createElementBlock("hr",__)):N.createCommentVNode("",!0),f.total>=1?(N.openBlock(),N.createElementBlock("div",y_,[N.createElementVNode("div",x_,[N.createVNode(Ue,{total:f.total,maxPages:7,defaultPage:f.currentPage,pageSize:f.limit,goTo:!1,size:"medium",onPageChange:f.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:!0,pageSizes:[10,20,30],onPageSizeChange:f.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):N.createCommentVNode("",!0)],2),f.isSelectObj?(N.openBlock(),N.createElementBlock("div",{key:0,class:N.normalizeClass(f.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[N.renderSlot(f.$slots,"details",{table:f.table,selectedId:f.selectedId,selectedRow:f.selectedRow,map:f.map,closeObjCard:f.closeObjCard,isMapVisible:f.isMapVisible})],2)):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",v_,[N.createElementVNode("section",b_,[N.renderSlot(f.$slots,"default",{map:f.map,removeSelectedBaseLayer:f.removeSelectedBaseLayer,selectedBaseLayer:f.selectedBaseLayer,isCompareOpen:f.isCompareOpen,selectedRow:f.selectedRow}),N.createVNode(Ke,{height:"calc(100vh - 152px)",width:"w-2/4",table:f.table,filtersParam:f.filtersParam,row:f.selectedRow,legendname:f.legendname,legend:f.legend,compareLayers:f.compareLayers,colorAttr:f.colorAttr,strokeAttr:f.strokeAttr,maxBounds:f.maxBounds,center:f.center,zoom:f.zoom,minZoom:f.minZoom,basemap:f.basemap,additionalLayers:f.additionalLayers,pointZoom:f.pointZoom,defaultColor:f.defaultColor,onMap:x[5]||(x[5]=st=>f.map=st),selectedBaseLayer:f.selectedBaseLayer,"onUpdate:selectedBaseLayer":x[6]||(x[6]=st=>f.selectedBaseLayer=st),onIsCompareOpen:x[7]||(x[7]=st=>f.isCompareOpen=st)},null,8,["table","filtersParam","row","legendname","legend","compareLayers","colorAttr","strokeAttr","maxBounds","center","zoom","minZoom","basemap","additionalLayers","pointZoom","defaultColor","selectedBaseLayer"])])],512),[[N.vShow,f.isMapVisible]])]),N.createElementVNode("div",w_,[N.renderSlot(f.$slots,"popup",{data:f.hoverData})],512)])])}const qu=Fi(Hg,[["render",S_]]),Zu={install:f=>{f.component("VsPartsMap",qu)},components:{VsPartsMap:qu}};return typeof window<"u"&&(window.PartsMap=Zu),Zu});
|