openms-insight 0.1.6__py3-none-any.whl → 0.1.7__py3-none-any.whl

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.
@@ -4210,7 +4210,7 @@ uniform ${Re} ${je} u_${tt};
4210
4210
  #endif
4211
4211
  `}),staticAttributes:z,staticUniforms:ie}}class Yr{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(d,g,z,j,$,ie,de,xe,Ae){this.context=d;let Re=this.boundPaintVertexBuffers.length!==j.length;for(let je=0;!Re&&je<j.length;je++)this.boundPaintVertexBuffers[je]!==j[je]&&(Re=!0);!this.vao||this.boundProgram!==g||this.boundLayoutVertexBuffer!==z||Re||this.boundIndexBuffer!==$||this.boundVertexOffset!==ie||this.boundDynamicVertexBuffer!==de||this.boundDynamicVertexBuffer2!==xe||this.boundDynamicVertexBuffer3!==Ae?this.freshBind(g,z,j,$,ie,de,xe,Ae):(d.bindVertexArray.set(this.vao),de&&de.bind(),$&&$.dynamicDraw&&$.bind(),xe&&xe.bind(),Ae&&Ae.bind())}freshBind(d,g,z,j,$,ie,de,xe){const Ae=d.numAttributes,Re=this.context,je=Re.gl;this.vao&&this.destroy(),this.vao=Re.createVertexArray(),Re.bindVertexArray.set(this.vao),this.boundProgram=d,this.boundLayoutVertexBuffer=g,this.boundPaintVertexBuffers=z,this.boundIndexBuffer=j,this.boundVertexOffset=$,this.boundDynamicVertexBuffer=ie,this.boundDynamicVertexBuffer2=de,this.boundDynamicVertexBuffer3=xe,g.enableAttributes(je,d);for(const tt of z)tt.enableAttributes(je,d);ie&&ie.enableAttributes(je,d),de&&de.enableAttributes(je,d),xe&&xe.enableAttributes(je,d),g.bind(),g.setVertexAttribPointers(je,d,$);for(const tt of z)tt.bind(),tt.setVertexAttribPointers(je,d,$);ie&&(ie.bind(),ie.setVertexAttribPointers(je,d,$)),j&&j.bind(),de&&(de.bind(),de.setVertexAttribPointers(je,d,$)),xe&&(xe.bind(),xe.setVertexAttribPointers(je,d,$)),Re.currentNumAttributes=Ae}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const _n=(V,d,g,z,j)=>({u_matrix:V,u_texture:0,u_ele_delta:d,u_fog_matrix:g,u_fog_color:z?z.properties.get("fog-color"):i.aN.white,u_fog_ground_blend:z?z.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:z?z.calculateFogBlendOpacity(j):0,u_horizon_color:z?z.properties.get("horizon-color"):i.aN.white,u_horizon_fog_blend:z?z.properties.get("horizon-fog-blend"):1});function Sn(V){const d=[];for(let g=0;g<V.length;g++){if(V[g]===null)continue;const z=V[g].split(" ");d.push(z.pop())}return d}class or{constructor(d,g,z,j,$,ie){const de=d.gl;this.program=de.createProgram();const xe=Sn(g.staticAttributes),Ae=z?z.getBinderAttributes():[],Re=xe.concat(Ae),je=Ir.prelude.staticUniforms?Sn(Ir.prelude.staticUniforms):[],tt=g.staticUniforms?Sn(g.staticUniforms):[],lt=z?z.getBinderUniforms():[],ft=je.concat(tt).concat(lt),yt=[];for(const Yt of ft)yt.indexOf(Yt)<0&&yt.push(Yt);const Ct=z?z.defines():[];$&&Ct.push("#define OVERDRAW_INSPECTOR;"),ie&&Ct.push("#define TERRAIN3D;");const kt=Ct.concat(Ir.prelude.fragmentSource,g.fragmentSource).join(`
4212
4212
  `),Bt=Ct.concat(Ir.prelude.vertexSource,g.vertexSource).join(`
4213
- `),At=de.createShader(de.FRAGMENT_SHADER);if(de.isContextLost())return void(this.failedToCreate=!0);if(de.shaderSource(At,kt),de.compileShader(At),!de.getShaderParameter(At,de.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${de.getShaderInfoLog(At)}`);de.attachShader(this.program,At);const $t=de.createShader(de.VERTEX_SHADER);if(de.isContextLost())return void(this.failedToCreate=!0);if(de.shaderSource($t,Bt),de.compileShader($t),!de.getShaderParameter($t,de.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${de.getShaderInfoLog($t)}`);de.attachShader(this.program,$t),this.attributes={};const Kt={};this.numAttributes=Re.length;for(let Yt=0;Yt<this.numAttributes;Yt++)Re[Yt]&&(de.bindAttribLocation(this.program,Yt,Re[Yt]),this.attributes[Re[Yt]]=Yt);if(de.linkProgram(this.program),!de.getProgramParameter(this.program,de.LINK_STATUS))throw new Error(`Program failed to link: ${de.getProgramInfoLog(this.program)}`);de.deleteShader($t),de.deleteShader(At);for(let Yt=0;Yt<yt.length;Yt++){const pn=yt[Yt];if(pn&&!Kt[pn]){const Tn=de.getUniformLocation(this.program,pn);Tn&&(Kt[pn]=Tn)}}this.fixedUniforms=j(d,Kt),this.terrainUniforms=((Yt,pn)=>({u_depth:new i.aI(Yt,pn.u_depth),u_terrain:new i.aI(Yt,pn.u_terrain),u_terrain_dim:new i.aJ(Yt,pn.u_terrain_dim),u_terrain_matrix:new i.aK(Yt,pn.u_terrain_matrix),u_terrain_unpack:new i.aL(Yt,pn.u_terrain_unpack),u_terrain_exaggeration:new i.aJ(Yt,pn.u_terrain_exaggeration)}))(d,Kt),this.binderUniforms=z?z.getUniforms(d,Kt):[]}draw(d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft,yt,Ct,kt,Bt){const At=d.gl;if(this.failedToCreate)return;if(d.program.set(this.program),d.setDepthMode(z),d.setStencilMode(j),d.setColorMode($),d.setCullFace(ie),xe){d.activeTexture.set(At.TEXTURE2),At.bindTexture(At.TEXTURE_2D,xe.depthTexture),d.activeTexture.set(At.TEXTURE3),At.bindTexture(At.TEXTURE_2D,xe.texture);for(const Kt in this.terrainUniforms)this.terrainUniforms[Kt].set(xe[Kt])}for(const Kt in this.fixedUniforms)this.fixedUniforms[Kt].set(de[Kt]);yt&&yt.setUniforms(d,this.binderUniforms,lt,{zoom:ft});let $t=0;switch(g){case At.LINES:$t=2;break;case At.TRIANGLES:$t=3;break;case At.LINE_STRIP:$t=1}for(const Kt of tt.get()){const Yt=Kt.vaos||(Kt.vaos={});(Yt[Ae]||(Yt[Ae]=new Yr)).bind(d,this,Re,yt?yt.getPaintVertexBuffers():[],je,Kt.vertexOffset,Ct,kt,Bt),At.drawElements(g,Kt.primitiveLength*$t,At.UNSIGNED_SHORT,Kt.primitiveOffset*$t*2)}}}function Wn(V,d,g){const z=1/Tt(g,1,d.transform.tileZoom),j=Math.pow(2,g.tileID.overscaledZ),$=g.tileSize*Math.pow(2,d.transform.tileZoom)/j,ie=$*(g.tileID.canonical.x+g.tileID.wrap*j),de=$*g.tileID.canonical.y;return{u_image:0,u_texsize:g.imageAtlasTexture.size,u_scale:[z,V.fromScale,V.toScale],u_fade:V.t,u_pixel_coord_upper:[ie>>16,de>>16],u_pixel_coord_lower:[65535&ie,65535&de]}}const sr=(V,d,g,z)=>{const j=d.style.light,$=j.properties.get("position"),ie=[$.x,$.y,$.z],de=function(){var Ae=new i.A(9);return i.A!=Float32Array&&(Ae[1]=0,Ae[2]=0,Ae[3]=0,Ae[5]=0,Ae[6]=0,Ae[7]=0),Ae[0]=1,Ae[4]=1,Ae[8]=1,Ae}();j.properties.get("anchor")==="viewport"&&function(Ae,Re){var je=Math.sin(Re),tt=Math.cos(Re);Ae[0]=tt,Ae[1]=je,Ae[2]=0,Ae[3]=-je,Ae[4]=tt,Ae[5]=0,Ae[6]=0,Ae[7]=0,Ae[8]=1}(de,-d.transform.angle),function(Ae,Re,je){var tt=Re[0],lt=Re[1],ft=Re[2];Ae[0]=tt*je[0]+lt*je[3]+ft*je[6],Ae[1]=tt*je[1]+lt*je[4]+ft*je[7],Ae[2]=tt*je[2]+lt*je[5]+ft*je[8]}(ie,ie,de);const xe=j.properties.get("color");return{u_matrix:V,u_lightpos:ie,u_lightintensity:j.properties.get("intensity"),u_lightcolor:[xe.r,xe.g,xe.b],u_vertical_gradient:+g,u_opacity:z}},Sr=(V,d,g,z,j,$,ie)=>i.e(sr(V,d,g,z),Wn($,d,ie),{u_height_factor:-Math.pow(2,j.overscaledZ)/ie.tileSize/8}),wr=V=>({u_matrix:V}),Ur=(V,d,g,z)=>i.e(wr(V),Wn(g,d,z)),ti=(V,d)=>({u_matrix:V,u_world:d}),vn=(V,d,g,z,j)=>i.e(Ur(V,d,g,z),{u_world:j}),Gn=(V,d,g,z)=>{const j=V.transform;let $,ie;if(z.paint.get("circle-pitch-alignment")==="map"){const de=Tt(g,1,j.zoom);$=!0,ie=[de,de]}else $=!1,ie=j.pixelsToGLUnits;return{u_camera_to_center_distance:j.cameraToCenterDistance,u_scale_with_map:+(z.paint.get("circle-pitch-scale")==="map"),u_matrix:V.translatePosMatrix(d.posMatrix,g,z.paint.get("circle-translate"),z.paint.get("circle-translate-anchor")),u_pitch_with_map:+$,u_device_pixel_ratio:V.pixelRatio,u_extrude_scale:ie}},nn=(V,d)=>({u_matrix:d,u_pixel_extrude_scale:[1/V.width,1/V.height]}),ln=(V,d,g)=>({u_matrix:V,u_inv_matrix:d,u_camera_to_center_distance:g.cameraToCenterDistance,u_viewport_size:[g.width,g.height]}),bn=(V,d,g=1)=>({u_matrix:V,u_color:d,u_overlay:0,u_overlay_scale:g}),Fn=V=>({u_matrix:V}),Bn=(V,d,g,z)=>({u_matrix:V,u_extrude_scale:Tt(d,1,g),u_intensity:z}),Kn=(V,d,g,z)=>{const j=i.H();i.aQ(j,0,V.width,V.height,0,0,1);const $=V.context.gl;return{u_matrix:j,u_world:[$.drawingBufferWidth,$.drawingBufferHeight],u_image:g,u_color_ramp:z,u_opacity:d.paint.get("heatmap-opacity")}},Hn=(V,d,g,z)=>{const j=g.paint.get("hillshade-shadow-color"),$=g.paint.get("hillshade-highlight-color"),ie=g.paint.get("hillshade-accent-color");let de=g.paint.get("hillshade-illumination-direction")*(Math.PI/180);g.paint.get("hillshade-illumination-anchor")==="viewport"&&(de-=V.transform.angle);const xe=!V.options.moving;return{u_matrix:z?z.posMatrix:V.transform.calculatePosMatrix(d.tileID.toUnwrapped(),xe),u_image:0,u_latrange:hn(0,d.tileID),u_light:[g.paint.get("hillshade-exaggeration"),de],u_shadow:j,u_highlight:$,u_accent:ie}},Dn=(V,d)=>{const g=d.stride,z=i.H();return i.aQ(z,0,i.X,-i.X,0,0,1),i.J(z,z,[0,-i.X,0]),{u_matrix:z,u_image:1,u_dimension:[g,g],u_zoom:V.overscaledZ,u_unpack:d.getUnpackVector()}};function hn(V,d){const g=Math.pow(2,d.canonical.z),z=d.canonical.y;return[new i.Z(0,z/g).toLngLat().lat,new i.Z(0,(z+1)/g).toLngLat().lat]}const cn=(V,d,g,z)=>{const j=V.transform;return{u_matrix:yr(V,d,g,z),u_ratio:1/Tt(d,1,j.zoom),u_device_pixel_ratio:V.pixelRatio,u_units_to_pixels:[1/j.pixelsToGLUnits[0],1/j.pixelsToGLUnits[1]]}},En=(V,d,g,z,j)=>i.e(cn(V,d,g,j),{u_image:0,u_image_height:z}),tr=(V,d,g,z,j)=>{const $=V.transform,ie=fr(d,$);return{u_matrix:yr(V,d,g,j),u_texsize:d.imageAtlasTexture.size,u_ratio:1/Tt(d,1,$.zoom),u_device_pixel_ratio:V.pixelRatio,u_image:0,u_scale:[ie,z.fromScale,z.toScale],u_fade:z.t,u_units_to_pixels:[1/$.pixelsToGLUnits[0],1/$.pixelsToGLUnits[1]]}},dr=(V,d,g,z,j,$)=>{const ie=V.transform,de=V.lineAtlas,xe=fr(d,ie),Ae=g.layout.get("line-cap")==="round",Re=de.getDash(z.from,Ae),je=de.getDash(z.to,Ae),tt=Re.width*j.fromScale,lt=je.width*j.toScale;return i.e(cn(V,d,g,$),{u_patternscale_a:[xe/tt,-Re.height/2],u_patternscale_b:[xe/lt,-je.height/2],u_sdfgamma:de.width/(256*Math.min(tt,lt)*V.pixelRatio)/2,u_image:0,u_tex_y_a:Re.y,u_tex_y_b:je.y,u_mix:j.t})};function fr(V,d){return 1/Tt(V,1,d.tileZoom)}function yr(V,d,g,z){return V.translatePosMatrix(z?z.posMatrix:d.tileID.posMatrix,d,g.paint.get("line-translate"),g.paint.get("line-translate-anchor"))}const Or=(V,d,g,z,j)=>{return{u_matrix:V,u_tl_parent:d,u_scale_parent:g,u_buffer_scale:1,u_fade_t:z.mix,u_opacity:z.opacity*j.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:j.paint.get("raster-brightness-min"),u_brightness_high:j.paint.get("raster-brightness-max"),u_saturation_factor:(ie=j.paint.get("raster-saturation"),ie>0?1-1/(1.001-ie):-ie),u_contrast_factor:($=j.paint.get("raster-contrast"),$>0?1/(1-$):1+$),u_spin_weights:Er(j.paint.get("raster-hue-rotate"))};var $,ie};function Er(V){V*=Math.PI/180;const d=Math.sin(V),g=Math.cos(V);return[(2*g+1)/3,(-Math.sqrt(3)*d-g+1)/3,(Math.sqrt(3)*d-g+1)/3]}const Br=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt)=>{const ft=ie.transform;return{u_is_size_zoom_constant:+(V==="constant"||V==="source"),u_is_size_feature_constant:+(V==="constant"||V==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:ft.cameraToCenterDistance,u_pitch:ft.pitch/360*2*Math.PI,u_rotate_symbol:+g,u_aspect_ratio:ft.width/ft.height,u_fade_change:ie.options.fadeDuration?ie.symbolFadeChange:1,u_matrix:de,u_label_plane_matrix:xe,u_coord_matrix:Ae,u_is_text:+je,u_pitch_with_map:+z,u_is_along_line:j,u_is_variable_anchor:$,u_texsize:tt,u_texture:0,u_translation:Re,u_pitched_scale:lt}},Cr=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft)=>{const yt=ie.transform;return i.e(Br(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,ft),{u_gamma_scale:z?Math.cos(yt._pitch)*yt.cameraToCenterDistance:1,u_device_pixel_ratio:ie.pixelRatio,u_is_halo:1})},Dr=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt)=>i.e(Cr(V,d,g,z,j,$,ie,de,xe,Ae,Re,!0,je,!0,lt),{u_texsize_icon:tt,u_texture_icon:1}),$r=(V,d,g)=>({u_matrix:V,u_opacity:d,u_color:g}),fi=(V,d,g,z,j,$)=>i.e(function(ie,de,xe,Ae){const Re=xe.imageManager.getPattern(ie.from.toString()),je=xe.imageManager.getPattern(ie.to.toString()),{width:tt,height:lt}=xe.imageManager.getPixelSize(),ft=Math.pow(2,Ae.tileID.overscaledZ),yt=Ae.tileSize*Math.pow(2,xe.transform.tileZoom)/ft,Ct=yt*(Ae.tileID.canonical.x+Ae.tileID.wrap*ft),kt=yt*Ae.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:Re.tl,u_pattern_br_a:Re.br,u_pattern_tl_b:je.tl,u_pattern_br_b:je.br,u_texsize:[tt,lt],u_mix:de.t,u_pattern_size_a:Re.displaySize,u_pattern_size_b:je.displaySize,u_scale_a:de.fromScale,u_scale_b:de.toScale,u_tile_units_to_pixels:1/Tt(Ae,1,xe.transform.tileZoom),u_pixel_coord_upper:[Ct>>16,kt>>16],u_pixel_coord_lower:[65535&Ct,65535&kt]}}(z,$,g,j),{u_matrix:V,u_opacity:d}),Qr={fillExtrusion:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_lightpos:new i.aO(V,d.u_lightpos),u_lightintensity:new i.aJ(V,d.u_lightintensity),u_lightcolor:new i.aO(V,d.u_lightcolor),u_vertical_gradient:new i.aJ(V,d.u_vertical_gradient),u_opacity:new i.aJ(V,d.u_opacity)}),fillExtrusionPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_lightpos:new i.aO(V,d.u_lightpos),u_lightintensity:new i.aJ(V,d.u_lightintensity),u_lightcolor:new i.aO(V,d.u_lightcolor),u_vertical_gradient:new i.aJ(V,d.u_vertical_gradient),u_height_factor:new i.aJ(V,d.u_height_factor),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade),u_opacity:new i.aJ(V,d.u_opacity)}),fill:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix)}),fillPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),fillOutline:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world)}),fillOutlinePattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),circle:(V,d)=>({u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_scale_with_map:new i.aI(V,d.u_scale_with_map),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_extrude_scale:new i.aP(V,d.u_extrude_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_matrix:new i.aK(V,d.u_matrix)}),collisionBox:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_pixel_extrude_scale:new i.aP(V,d.u_pixel_extrude_scale)}),collisionCircle:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_inv_matrix:new i.aK(V,d.u_inv_matrix),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_viewport_size:new i.aP(V,d.u_viewport_size)}),debug:(V,d)=>({u_color:new i.aM(V,d.u_color),u_matrix:new i.aK(V,d.u_matrix),u_overlay:new i.aI(V,d.u_overlay),u_overlay_scale:new i.aJ(V,d.u_overlay_scale)}),clippingMask:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix)}),heatmap:(V,d)=>({u_extrude_scale:new i.aJ(V,d.u_extrude_scale),u_intensity:new i.aJ(V,d.u_intensity),u_matrix:new i.aK(V,d.u_matrix)}),heatmapTexture:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world),u_image:new i.aI(V,d.u_image),u_color_ramp:new i.aI(V,d.u_color_ramp),u_opacity:new i.aJ(V,d.u_opacity)}),hillshade:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_latrange:new i.aP(V,d.u_latrange),u_light:new i.aP(V,d.u_light),u_shadow:new i.aM(V,d.u_shadow),u_highlight:new i.aM(V,d.u_highlight),u_accent:new i.aM(V,d.u_accent)}),hillshadePrepare:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_dimension:new i.aP(V,d.u_dimension),u_zoom:new i.aJ(V,d.u_zoom),u_unpack:new i.aL(V,d.u_unpack)}),line:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels)}),lineGradient:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_image:new i.aI(V,d.u_image),u_image_height:new i.aJ(V,d.u_image_height)}),linePattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texsize:new i.aP(V,d.u_texsize),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_image:new i.aI(V,d.u_image),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),lineSDF:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_patternscale_a:new i.aP(V,d.u_patternscale_a),u_patternscale_b:new i.aP(V,d.u_patternscale_b),u_sdfgamma:new i.aJ(V,d.u_sdfgamma),u_image:new i.aI(V,d.u_image),u_tex_y_a:new i.aJ(V,d.u_tex_y_a),u_tex_y_b:new i.aJ(V,d.u_tex_y_b),u_mix:new i.aJ(V,d.u_mix)}),raster:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_tl_parent:new i.aP(V,d.u_tl_parent),u_scale_parent:new i.aJ(V,d.u_scale_parent),u_buffer_scale:new i.aJ(V,d.u_buffer_scale),u_fade_t:new i.aJ(V,d.u_fade_t),u_opacity:new i.aJ(V,d.u_opacity),u_image0:new i.aI(V,d.u_image0),u_image1:new i.aI(V,d.u_image1),u_brightness_low:new i.aJ(V,d.u_brightness_low),u_brightness_high:new i.aJ(V,d.u_brightness_high),u_saturation_factor:new i.aJ(V,d.u_saturation_factor),u_contrast_factor:new i.aJ(V,d.u_contrast_factor),u_spin_weights:new i.aO(V,d.u_spin_weights)}),symbolIcon:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texture:new i.aI(V,d.u_texture),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),symbolSDF:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texture:new i.aI(V,d.u_texture),u_gamma_scale:new i.aJ(V,d.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_is_halo:new i.aI(V,d.u_is_halo),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),symbolTextAndIcon:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texsize_icon:new i.aP(V,d.u_texsize_icon),u_texture:new i.aI(V,d.u_texture),u_texture_icon:new i.aI(V,d.u_texture_icon),u_gamma_scale:new i.aJ(V,d.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_is_halo:new i.aI(V,d.u_is_halo),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),background:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_opacity:new i.aJ(V,d.u_opacity),u_color:new i.aM(V,d.u_color)}),backgroundPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_opacity:new i.aJ(V,d.u_opacity),u_image:new i.aI(V,d.u_image),u_pattern_tl_a:new i.aP(V,d.u_pattern_tl_a),u_pattern_br_a:new i.aP(V,d.u_pattern_br_a),u_pattern_tl_b:new i.aP(V,d.u_pattern_tl_b),u_pattern_br_b:new i.aP(V,d.u_pattern_br_b),u_texsize:new i.aP(V,d.u_texsize),u_mix:new i.aJ(V,d.u_mix),u_pattern_size_a:new i.aP(V,d.u_pattern_size_a),u_pattern_size_b:new i.aP(V,d.u_pattern_size_b),u_scale_a:new i.aJ(V,d.u_scale_a),u_scale_b:new i.aJ(V,d.u_scale_b),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_tile_units_to_pixels:new i.aJ(V,d.u_tile_units_to_pixels)}),terrain:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texture:new i.aI(V,d.u_texture),u_ele_delta:new i.aJ(V,d.u_ele_delta),u_fog_matrix:new i.aK(V,d.u_fog_matrix),u_fog_color:new i.aM(V,d.u_fog_color),u_fog_ground_blend:new i.aJ(V,d.u_fog_ground_blend),u_fog_ground_blend_opacity:new i.aJ(V,d.u_fog_ground_blend_opacity),u_horizon_color:new i.aM(V,d.u_horizon_color),u_horizon_fog_blend:new i.aJ(V,d.u_horizon_fog_blend)}),terrainDepth:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ele_delta:new i.aJ(V,d.u_ele_delta)}),terrainCoords:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texture:new i.aI(V,d.u_texture),u_terrain_coords_id:new i.aJ(V,d.u_terrain_coords_id),u_ele_delta:new i.aJ(V,d.u_ele_delta)}),sky:(V,d)=>({u_sky_color:new i.aM(V,d.u_sky_color),u_horizon_color:new i.aM(V,d.u_horizon_color),u_horizon:new i.aJ(V,d.u_horizon),u_sky_horizon_blend:new i.aJ(V,d.u_sky_horizon_blend)})};class Hr{constructor(d,g,z){this.context=d;const j=d.gl;this.buffer=j.createBuffer(),this.dynamicDraw=!!z,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,g.arrayBuffer,this.dynamicDraw?j.DYNAMIC_DRAW:j.STATIC_DRAW),this.dynamicDraw||delete g.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){const g=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),g.bufferSubData(g.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)}destroy(){const d=this.context.gl;this.buffer&&(d.deleteBuffer(this.buffer),delete this.buffer)}}const oi={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Mi{constructor(d,g,z,j){this.length=g.length,this.attributes=z,this.itemSize=g.bytesPerElement,this.dynamicDraw=j,this.context=d;const $=d.gl;this.buffer=$.createBuffer(),d.bindVertexBuffer.set(this.buffer),$.bufferData($.ARRAY_BUFFER,g.arrayBuffer,this.dynamicDraw?$.DYNAMIC_DRAW:$.STATIC_DRAW),this.dynamicDraw||delete g.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){if(d.length!==this.length)throw new Error(`Length of new data is ${d.length}, which doesn't match current length of ${this.length}`);const g=this.context.gl;this.bind(),g.bufferSubData(g.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,g){for(let z=0;z<this.attributes.length;z++){const j=this.attributes[z],$=g.attributes[j.name];$!==void 0&&d.enableVertexAttribArray($)}}setVertexAttribPointers(d,g,z){for(let j=0;j<this.attributes.length;j++){const $=this.attributes[j],ie=g.attributes[$.name];ie!==void 0&&d.vertexAttribPointer(ie,$.components,d[oi[$.type]],!1,this.itemSize,$.offset+this.itemSize*(z||0))}}destroy(){const d=this.context.gl;this.buffer&&(d.deleteBuffer(this.buffer),delete this.buffer)}}const Bi=new WeakMap;function Ya(V){var d;if(Bi.has(V))return Bi.get(V);{const g=(d=V.getParameter(V.VERSION))===null||d===void 0?void 0:d.startsWith("WebGL 2.0");return Bi.set(V,g),g}}class Vi{constructor(d){this.gl=d.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(d){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ns extends Vi{getDefault(){return i.aN.transparent}set(d){const g=this.current;(d.r!==g.r||d.g!==g.g||d.b!==g.b||d.a!==g.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class no extends Vi{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class ko extends Vi{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class el extends Vi{getDefault(){return[!0,!0,!0,!0]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||d[3]!==g[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Ui extends Vi{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class Wo extends Vi{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class Bl extends Vi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const g=this.current;(d.func!==g.func||d.ref!==g.ref||d.mask!==g.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class jo extends Vi{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class Wu extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.STENCIL_TEST):g.disable(g.STENCIL_TEST),this.current=d,this.dirty=!1}}class Sl extends Vi{getDefault(){return[0,1]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class Is extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST),this.current=d,this.dirty=!1}}class qu extends Vi{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class Gu extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.BLEND):g.disable(g.BLEND),this.current=d,this.dirty=!1}}class dc extends Vi{getDefault(){const d=this.gl;return[d.ONE,d.ZERO]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||this.dirty)&&(this.gl.blendFunc(d[0],d[1]),this.current=d,this.dirty=!1)}}class tl extends Vi{getDefault(){return i.aN.transparent}set(d){const g=this.current;(d.r!==g.r||d.g!==g.g||d.b!==g.b||d.a!==g.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class Su extends Vi{getDefault(){return this.gl.FUNC_ADD}set(d){(d!==this.current||this.dirty)&&(this.gl.blendEquation(d),this.current=d,this.dirty=!1)}}class Al extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.CULL_FACE):g.disable(g.CULL_FACE),this.current=d,this.dirty=!1}}class ro extends Vi{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class rs extends Vi{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}class $u extends Vi{getDefault(){return null}set(d){(d!==this.current||this.dirty)&&(this.gl.useProgram(d),this.current=d,this.dirty=!1)}}class Au extends Vi{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class fu extends Vi{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||d[3]!==g[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Yu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindFramebuffer(g.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class du extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindRenderbuffer(g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Zu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindTexture(g.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class Xu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindBuffer(g.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Cu extends Vi{getDefault(){return null}set(d){const g=this.gl;g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Ls extends Vi{getDefault(){return null}set(d){var g;if(d===this.current&&!this.dirty)return;const z=this.gl;Ya(z)?z.bindVertexArray(d):(g=z.getExtension("OES_vertex_array_object"))===null||g===void 0||g.bindVertexArrayOES(d),this.current=d,this.dirty=!1}}class Ph extends Vi{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class dh extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class pc extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class Dh extends Vi{constructor(d,g){super(d),this.context=d,this.parent=g}getDefault(){return null}}class Qh extends Dh{setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class Nl extends Dh{set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class ef extends Dh{set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class ld{constructor(d,g,z,j,$){this.context=d,this.width=g,this.height=z;const ie=d.gl,de=this.framebuffer=ie.createFramebuffer();if(this.colorAttachment=new Qh(d,de),j)this.depthAttachment=$?new ef(d,de):new Nl(d,de);else if($)throw new Error("Stencil cannot be set without depth");if(ie.checkFramebufferStatus(ie.FRAMEBUFFER)!==ie.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const d=this.context.gl,g=this.colorAttachment.get();if(g&&d.deleteTexture(g),this.depthAttachment){const z=this.depthAttachment.get();z&&d.deleteRenderbuffer(z)}d.deleteFramebuffer(this.framebuffer)}}class qo{constructor(d,g,z){this.blendFunction=d,this.blendColor=g,this.mask=z}}qo.Replace=[1,0],qo.disabled=new qo(qo.Replace,i.aN.transparent,[!1,!1,!1,!1]),qo.unblended=new qo(qo.Replace,i.aN.transparent,[!0,!0,!0,!0]),qo.alphaBlended=new qo([1,771],i.aN.transparent,[!0,!0,!0,!0]);class Zc{constructor(d){var g,z;if(this.gl=d,this.clearColor=new ns(this),this.clearDepth=new no(this),this.clearStencil=new ko(this),this.colorMask=new el(this),this.depthMask=new Ui(this),this.stencilMask=new Wo(this),this.stencilFunc=new Bl(this),this.stencilOp=new jo(this),this.stencilTest=new Wu(this),this.depthRange=new Sl(this),this.depthTest=new Is(this),this.depthFunc=new qu(this),this.blend=new Gu(this),this.blendFunc=new dc(this),this.blendColor=new tl(this),this.blendEquation=new Su(this),this.cullFace=new Al(this),this.cullFaceSide=new ro(this),this.frontFace=new rs(this),this.program=new $u(this),this.activeTexture=new Au(this),this.viewport=new fu(this),this.bindFramebuffer=new Yu(this),this.bindRenderbuffer=new du(this),this.bindTexture=new Zu(this),this.bindVertexBuffer=new Xu(this),this.bindElementBuffer=new Cu(this),this.bindVertexArray=new Ls(this),this.pixelStoreUnpack=new Ph(this),this.pixelStoreUnpackPremultiplyAlpha=new dh(this),this.pixelStoreUnpackFlipY=new pc(this),this.extTextureFilterAnisotropic=d.getExtension("EXT_texture_filter_anisotropic")||d.getExtension("MOZ_EXT_texture_filter_anisotropic")||d.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=d.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),Ya(d)){this.HALF_FLOAT=d.HALF_FLOAT;const j=d.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(g=d.RGBA16F)!==null&&g!==void 0?g:j==null?void 0:j.RGBA16F_EXT,this.RGB16F=(z=d.RGB16F)!==null&&z!==void 0?z:j==null?void 0:j.RGB16F_EXT,d.getExtension("EXT_color_buffer_float")}else{d.getExtension("EXT_color_buffer_half_float"),d.getExtension("OES_texture_half_float_linear");const j=d.getExtension("OES_texture_half_float");this.HALF_FLOAT=j==null?void 0:j.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(d,g){return new Hr(this,d,g)}createVertexBuffer(d,g,z){return new Mi(this,d,g,z)}createRenderbuffer(d,g,z){const j=this.gl,$=j.createRenderbuffer();return this.bindRenderbuffer.set($),j.renderbufferStorage(j.RENDERBUFFER,d,g,z),this.bindRenderbuffer.set(null),$}createFramebuffer(d,g,z,j){return new ld(this,d,g,z,j)}clear({color:d,depth:g,stencil:z}){const j=this.gl;let $=0;d&&($|=j.COLOR_BUFFER_BIT,this.clearColor.set(d),this.colorMask.set([!0,!0,!0,!0])),g!==void 0&&($|=j.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(g),this.depthMask.set(!0)),z!==void 0&&($|=j.STENCIL_BUFFER_BIT,this.clearStencil.set(z),this.stencilMask.set(255)),j.clear($)}setCullFace(d){d.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(d.mode),this.frontFace.set(d.frontFace))}setDepthMode(d){d.func!==this.gl.ALWAYS||d.mask?(this.depthTest.set(!0),this.depthFunc.set(d.func),this.depthMask.set(d.mask),this.depthRange.set(d.range)):this.depthTest.set(!1)}setStencilMode(d){d.test.func!==this.gl.ALWAYS||d.mask?(this.stencilTest.set(!0),this.stencilMask.set(d.mask),this.stencilOp.set([d.fail,d.depthFail,d.pass]),this.stencilFunc.set({func:d.test.func,ref:d.ref,mask:d.test.mask})):this.stencilTest.set(!1)}setColorMode(d){i.aF(d.blendFunction,qo.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(d.blendFunction),this.blendColor.set(d.blendColor)),this.colorMask.set(d.mask)}createVertexArray(){var d;return Ya(this.gl)?this.gl.createVertexArray():(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.createVertexArrayOES()}deleteVertexArray(d){var g;return Ya(this.gl)?this.gl.deleteVertexArray(d):(g=this.gl.getExtension("OES_vertex_array_object"))===null||g===void 0?void 0:g.deleteVertexArrayOES(d)}unbindVAO(){this.bindVertexArray.set(null)}}class Qi{constructor(d,g,z){this.func=d,this.mask=g,this.range=z}}Qi.ReadOnly=!1,Qi.ReadWrite=!0,Qi.disabled=new Qi(519,Qi.ReadOnly,[0,1]);const mc=7680;class Za{constructor(d,g,z,j,$,ie){this.test=d,this.ref=g,this.mask=z,this.fail=j,this.depthFail=$,this.pass=ie}}Za.disabled=new Za({func:519,mask:0},0,0,mc,mc,mc);class Xa{constructor(d,g,z){this.enable=d,this.mode=g,this.frontFace=z}}let Vl;function dl(V,d,g,z,j){const $=V.context,ie=$.gl,de=V.useProgram("collisionBox"),xe=[];let Ae=0,Re=0;for(let Ct=0;Ct<z.length;Ct++){const kt=z[Ct],Bt=d.getTile(kt).getBucket(g);if(!Bt)continue;const At=j?Bt.textCollisionBox:Bt.iconCollisionBox,$t=Bt.collisionCircleArray;if($t.length>0){const Kt=i.H();i.aR(Kt,Bt.placementInvProjMatrix,V.transform.glCoordMatrix),i.aR(Kt,Kt,Bt.placementViewportMatrix),xe.push({circleArray:$t,circleOffset:Re,transform:kt.posMatrix,invTransform:Kt,coord:kt}),Ae+=$t.length/4,Re=Ae}At&&de.draw($,ie.LINES,Qi.disabled,Za.disabled,V.colorModeForRenderPass(),Xa.disabled,nn(V.transform,kt.posMatrix),V.style.map.terrain&&V.style.map.terrain.getTerrainData(kt),g.id,At.layoutVertexBuffer,At.indexBuffer,At.segments,null,V.transform.zoom,null,null,At.collisionVertexBuffer)}if(!j||!xe.length)return;const je=V.useProgram("collisionCircle"),tt=new i.aS;tt.resize(4*Ae),tt._trim();let lt=0;for(const Ct of xe)for(let kt=0;kt<Ct.circleArray.length/4;kt++){const Bt=4*kt,At=Ct.circleArray[Bt+0],$t=Ct.circleArray[Bt+1],Kt=Ct.circleArray[Bt+2],Yt=Ct.circleArray[Bt+3];tt.emplace(lt++,At,$t,Kt,Yt,0),tt.emplace(lt++,At,$t,Kt,Yt,1),tt.emplace(lt++,At,$t,Kt,Yt,2),tt.emplace(lt++,At,$t,Kt,Yt,3)}(!Vl||Vl.length<2*Ae)&&(Vl=function(Ct){const kt=2*Ct,Bt=new i.aU;Bt.resize(kt),Bt._trim();for(let At=0;At<kt;At++){const $t=6*At;Bt.uint16[$t+0]=4*At+0,Bt.uint16[$t+1]=4*At+1,Bt.uint16[$t+2]=4*At+2,Bt.uint16[$t+3]=4*At+2,Bt.uint16[$t+4]=4*At+3,Bt.uint16[$t+5]=4*At+0}return Bt}(Ae));const ft=$.createIndexBuffer(Vl,!0),yt=$.createVertexBuffer(tt,i.aT.members,!0);for(const Ct of xe){const kt=ln(Ct.transform,Ct.invTransform,V.transform);je.draw($,ie.TRIANGLES,Qi.disabled,Za.disabled,V.colorModeForRenderPass(),Xa.disabled,kt,V.style.map.terrain&&V.style.map.terrain.getTerrainData(Ct.coord),g.id,yt,ft,i.a0.simpleSegment(0,2*Ct.circleOffset,Ct.circleArray.length,Ct.circleArray.length/2),null,V.transform.zoom,null,null,null)}yt.destroy(),ft.destroy()}Xa.disabled=new Xa(!1,1029,2305),Xa.backCCW=new Xa(!0,1029,2305);const Xc=i.ao(new Float32Array(16));function Ku(V,d,g,z,j){if(V.renderPass!=="translucent")return;const $=Za.disabled,ie=V.colorModeForRenderPass();(g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(de,xe,Ae,Re,je,tt,lt,ft,yt){const Ct=xe.transform,kt=Rn(),Bt=je==="map",At=tt==="map";for(const $t of de){const Kt=Re.getTile($t),Yt=Kt.getBucket(Ae);if(!Yt||!Yt.text||!Yt.text.segments.get().length)continue;const pn=Yt.textSizeData,Tn=i.ah(pn,Ct.zoom),Vn=Tt(Kt,1,xe.transform.zoom),jn=Nt($t.posMatrix,At,Bt,xe.transform,Vn),$n=Ae.layout.get("icon-text-fit")!=="none"&&Yt.hasIconData();if(Tn){const er=Math.pow(2,Ct.zoom-Kt.tileID.overscaledZ),Tr=xe.style.map.terrain?(Ar,ur)=>xe.style.map.terrain.getElevation($t,Ar,ur):null,rr=kt.translatePosition(Ct,Kt,lt,ft);vs(Yt,Bt,At,yt,Ct,jn,$t.posMatrix,er,Tn,$n,kt,rr,$t.toUnwrapped(),Tr)}}}(z,V,g,d,g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),j),g.paint.get("icon-opacity").constantOr(1)!==0&&Pc(V,d,g,z,!1,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),g.layout.get("icon-rotation-alignment"),g.layout.get("icon-pitch-alignment"),g.layout.get("icon-keep-upright"),$,ie),g.paint.get("text-opacity").constantOr(1)!==0&&Pc(V,d,g,z,!0,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.layout.get("text-keep-upright"),$,ie),d.map.showCollisionBoxes&&(dl(V,d,g,z,!0),dl(V,d,g,z,!1))}function pl(V,d,g,z,j,$){const{horizontalAlign:ie,verticalAlign:de}=i.av(V),xe=-(ie-.5)*d,Ae=-(de-.5)*g;return new i.P((xe/j+z[0])*$,(Ae/j+z[1])*$)}function Cl(V,d,g,z,j,$){const ie=d.tileAnchorPoint.add(new i.P(d.translation[0],d.translation[1]));if(d.pitchWithMap){let de=z.mult($);return g||(de=de.rotate(-j)),Ut(ie.add(de),d.labelPlaneMatrix,d.getElevation).point}if(g){const de=$e(d.tileAnchorPoint.x+1,d.tileAnchorPoint.y,d).point.sub(V),xe=Math.atan(de.y/de.x)+(de.x<0?Math.PI:0);return V.add(z.rotate(xe))}return V.add(z)}function vs(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt){const ft=V.text.placedSymbolArray,yt=V.text.dynamicLayoutVertexArray,Ct=V.icon.dynamicLayoutVertexArray,kt={};yt.clear();for(let Bt=0;Bt<ft.length;Bt++){const At=ft.get(Bt),$t=V.allowVerticalPlacement&&!At.placedOrientation,Kt=At.hidden||!At.crossTileID||$t?null:z[At.crossTileID];if(Kt){const Yt=new i.P(At.anchorX,At.anchorY),pn={getElevation:lt,width:j.width,height:j.height,labelPlaneMatrix:$,pitchWithMap:g,projection:Re,tileAnchorPoint:Yt,translation:je,unwrappedTileID:tt},Tn=g?Ut(Yt,ie,lt):$e(Yt.x,Yt.y,pn),Vn=at(j.cameraToCenterDistance,Tn.signedDistanceFromCamera);let jn=i.aj(V.textSizeData,xe,At)*Vn/i.aq;g&&(jn*=V.tilePixelRatio/de);const{width:$n,height:er,anchor:Tr,textOffset:rr,textBoxScale:Ar}=Kt,ur=pl(Tr,$n,er,rr,Ar,jn),Pr=Re.getPitchedTextCorrection(j,Yt.add(new i.P(je[0],je[1])),tt),br=Cl(Tn.point,pn,d,ur,j.angle,Pr),Nr=V.allowVerticalPlacement&&At.placedOrientation===i.ai.vertical?Math.PI/2:0;for(let li=0;li<At.numGlyphs;li++)i.ak(yt,br,Nr);Ae&&At.associatedIconIndex>=0&&(kt[At.associatedIconIndex]={shiftedAnchor:br,angle:Nr})}else Ft(At.numGlyphs,yt)}if(Ae){Ct.clear();const Bt=V.icon.placedSymbolArray;for(let At=0;At<Bt.length;At++){const $t=Bt.get(At);if($t.hidden)Ft($t.numGlyphs,Ct);else{const Kt=kt[At];if(Kt)for(let Yt=0;Yt<$t.numGlyphs;Yt++)i.ak(Ct,Kt.shiftedAnchor,Kt.angle);else Ft($t.numGlyphs,Ct)}}V.icon.dynamicLayoutVertexBuffer.updateData(Ct)}V.text.dynamicLayoutVertexBuffer.updateData(yt)}function fa(V,d,g){return g.iconsInText&&d?"symbolTextAndIcon":V?"symbolSDF":"symbolIcon"}function Pc(V,d,g,z,j,$,ie,de,xe,Ae,Re,je){const tt=V.context,lt=tt.gl,ft=V.transform,yt=Rn(),Ct=de==="map",kt=xe==="map",Bt=de!=="viewport"&&g.layout.get("symbol-placement")!=="point",At=Ct&&!kt&&!Bt,$t=!kt&&Bt,Kt=!g.layout.get("symbol-sort-key").isConstant();let Yt=!1;const pn=V.depthModeForSublayer(0,Qi.ReadOnly),Tn=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Vn=[],jn=yt.getCircleRadiusCorrection(ft);for(const $n of z){const er=d.getTile($n),Tr=er.getBucket(g);if(!Tr)continue;const rr=j?Tr.text:Tr.icon;if(!rr||!rr.segments.get().length||!rr.hasVisibleVertices)continue;const Ar=rr.programConfigurations.get(g.id),ur=j||Tr.sdfIcons,Pr=j?Tr.textSizeData:Tr.iconSizeData,br=kt||ft.pitch!==0,Nr=V.useProgram(fa(ur,j,Tr),Ar),li=i.ah(Pr,ft.zoom),Fr=V.style.map.terrain&&V.style.map.terrain.getTerrainData($n);let ri,vi,Wi,Di,Yi=[0,0],Gi=null;if(j){if(vi=er.glyphAtlasTexture,Wi=lt.LINEAR,ri=er.glyphAtlasTexture.size,Tr.iconsInText){Yi=er.imageAtlasTexture.size,Gi=er.imageAtlasTexture;const qi=Pr.kind==="composite"||Pr.kind==="camera";Di=br||V.options.rotating||V.options.zooming||qi?lt.LINEAR:lt.NEAREST}}else{const qi=g.layout.get("icon-size").constantOr(0)!==1||Tr.iconsNeedLinear;vi=er.imageAtlasTexture,Wi=ur||V.options.rotating||V.options.zooming||qi||br?lt.LINEAR:lt.NEAREST,ri=er.imageAtlasTexture.size}const ea=Tt(er,1,V.transform.zoom),_a=$t?$n.posMatrix:Xc,So=Nt(_a,kt,Ct,V.transform,ea),go=jt(_a,kt,Ct,V.transform,ea),Zo=jt($n.posMatrix,kt,Ct,V.transform,ea),Aa=yt.translatePosition(V.transform,er,$,ie),ra=Tn&&Tr.hasTextData(),oo=g.layout.get("icon-text-fit")!=="none"&&ra&&Tr.hasIconData();if(Bt){const qi=V.style.map.terrain?(Uo,Il)=>V.style.map.terrain.getElevation($n,Uo,Il):null,_s=g.layout.get("text-rotation-alignment")==="map";ct(Tr,$n.posMatrix,V,j,So,Zo,kt,Ae,_s,yt,$n.toUnwrapped(),ft.width,ft.height,Aa,qi)}const Pa=$n.posMatrix,va=j&&Tn||oo,Ca=Bt||va?Xc:So,qa=go,aa=ur&&g.paint.get(j?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Kl;Kl=ur?Tr.iconsInText?Dr(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,qa,Aa,ri,Yi,jn):Cr(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,qa,Aa,j,ri,!0,jn):Br(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,qa,Aa,j,ri,jn);const Lo={program:Nr,buffers:rr,uniformValues:Kl,atlasTexture:vi,atlasTextureIcon:Gi,atlasInterpolation:Wi,atlasInterpolationIcon:Di,isSDF:ur,hasHalo:aa};if(Kt&&Tr.canOverlap){Yt=!0;const qi=rr.segments.get();for(const _s of qi)Vn.push({segments:new i.a0([_s]),sortKey:_s.sortKey,state:Lo,terrainData:Fr})}else Vn.push({segments:rr.segments,sortKey:0,state:Lo,terrainData:Fr})}Yt&&Vn.sort(($n,er)=>$n.sortKey-er.sortKey);for(const $n of Vn){const er=$n.state;if(tt.activeTexture.set(lt.TEXTURE0),er.atlasTexture.bind(er.atlasInterpolation,lt.CLAMP_TO_EDGE),er.atlasTextureIcon&&(tt.activeTexture.set(lt.TEXTURE1),er.atlasTextureIcon&&er.atlasTextureIcon.bind(er.atlasInterpolationIcon,lt.CLAMP_TO_EDGE)),er.isSDF){const Tr=er.uniformValues;er.hasHalo&&(Tr.u_is_halo=1,tf(er.buffers,$n.segments,g,V,er.program,pn,Re,je,Tr,$n.terrainData)),Tr.u_is_halo=0}tf(er.buffers,$n.segments,g,V,er.program,pn,Re,je,er.uniformValues,$n.terrainData)}}function tf(V,d,g,z,j,$,ie,de,xe,Ae){const Re=z.context,je=Re.gl;j.draw(Re,je.TRIANGLES,$,ie,de,Xa.disabled,xe,Ae,g.id,V.layoutVertexBuffer,V.indexBuffer,d,g.paint,z.transform.zoom,V.programConfigurations.get(g.id),V.dynamicLayoutVertexBuffer,V.opacityVertexBuffer)}function Ju(V,d,g,z){if(g.paint.get("heatmap-opacity")!==0)if(V.renderPass==="offscreen"){const j=V.context,$=j.gl,ie=Za.disabled,de=new qo([$.ONE,$.ONE],i.aN.transparent,[!0,!0,!0,!0]);(function(xe,Ae,Re){const je=xe.gl;xe.activeTexture.set(je.TEXTURE1),xe.viewport.set([0,0,Ae.width/4,Ae.height/4]);let tt=Re.heatmapFbo;if(tt)je.bindTexture(je.TEXTURE_2D,tt.colorAttachment.get()),xe.bindFramebuffer.set(tt.framebuffer);else{const lt=je.createTexture();je.bindTexture(je.TEXTURE_2D,lt),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_WRAP_S,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_WRAP_T,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_MIN_FILTER,je.LINEAR),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_MAG_FILTER,je.LINEAR),tt=Re.heatmapFbo=xe.createFramebuffer(Ae.width/4,Ae.height/4,!1,!1),function(ft,yt,Ct,kt){var Bt,At;const $t=ft.gl,Kt=(Bt=ft.HALF_FLOAT)!==null&&Bt!==void 0?Bt:$t.UNSIGNED_BYTE,Yt=(At=ft.RGBA16F)!==null&&At!==void 0?At:$t.RGBA;$t.texImage2D($t.TEXTURE_2D,0,Yt,yt.width/4,yt.height/4,0,$t.RGBA,Kt,null),kt.colorAttachment.set(Ct)}(xe,Ae,lt,tt)}})(j,V,g),j.clear({color:i.aN.transparent});for(let xe=0;xe<z.length;xe++){const Ae=z[xe];if(d.hasRenderableParent(Ae))continue;const Re=d.getTile(Ae),je=Re.getBucket(g);if(!je)continue;const tt=je.programConfigurations.get(g.id),lt=V.useProgram("heatmap",tt),{zoom:ft}=V.transform;lt.draw(j,$.TRIANGLES,Qi.disabled,ie,de,Xa.disabled,Bn(Ae.posMatrix,Re,ft,g.paint.get("heatmap-intensity")),null,g.id,je.layoutVertexBuffer,je.indexBuffer,je.segments,g.paint,V.transform.zoom,tt)}j.viewport.set([0,0,V.width,V.height])}else V.renderPass==="translucent"&&(V.context.setColorMode(V.colorModeForRenderPass()),function(j,$){const ie=j.context,de=ie.gl,xe=$.heatmapFbo;if(!xe)return;ie.activeTexture.set(de.TEXTURE0),de.bindTexture(de.TEXTURE_2D,xe.colorAttachment.get()),ie.activeTexture.set(de.TEXTURE1);let Ae=$.colorRampTexture;Ae||(Ae=$.colorRampTexture=new D(ie,$.colorRamp,de.RGBA)),Ae.bind(de.LINEAR,de.CLAMP_TO_EDGE),j.useProgram("heatmapTexture").draw(ie,de.TRIANGLES,Qi.disabled,Za.disabled,j.colorModeForRenderPass(),Xa.disabled,Kn(j,$,0,1),null,$.id,j.viewportBuffer,j.quadTriangleIndexBuffer,j.viewportSegments,$.paint,j.transform.zoom)}(V,g))}function Qu(V,d,g,z,j){if(!g||!z||!z.imageAtlas)return;const $=z.imageAtlas.patternPositions;let ie=$[g.to.toString()],de=$[g.from.toString()];if(!ie&&de&&(ie=de),!de&&ie&&(de=ie),!ie||!de){const xe=j.getPaintProperty(d);ie=$[xe],de=$[xe]}ie&&de&&V.setConstantPatternPositions(ie,de)}function ph(V,d,g,z,j,$,ie){const de=V.context.gl,xe="fill-pattern",Ae=g.paint.get(xe),Re=Ae&&Ae.constantOr(1),je=g.getCrossfadeParameters();let tt,lt,ft,yt,Ct;ie?(lt=Re&&!g.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",tt=de.LINES):(lt=Re?"fillPattern":"fill",tt=de.TRIANGLES);const kt=Ae.constantOr(null);for(const Bt of z){const At=d.getTile(Bt);if(Re&&!At.patternsLoaded())continue;const $t=At.getBucket(g);if(!$t)continue;const Kt=$t.programConfigurations.get(g.id),Yt=V.useProgram(lt,Kt),pn=V.style.map.terrain&&V.style.map.terrain.getTerrainData(Bt);Re&&(V.context.activeTexture.set(de.TEXTURE0),At.imageAtlasTexture.bind(de.LINEAR,de.CLAMP_TO_EDGE),Kt.updatePaintBuffers(je)),Qu(Kt,xe,kt,At,g);const Tn=pn?Bt:null,Vn=Tn?Tn.posMatrix:Bt.posMatrix,jn=V.translatePosMatrix(Vn,At,g.paint.get("fill-translate"),g.paint.get("fill-translate-anchor"));if(ie){yt=$t.indexBuffer2,Ct=$t.segments2;const $n=[de.drawingBufferWidth,de.drawingBufferHeight];ft=lt==="fillOutlinePattern"&&Re?vn(jn,V,je,At,$n):ti(jn,$n)}else yt=$t.indexBuffer,Ct=$t.segments,ft=Re?Ur(jn,V,je,At):wr(jn);Yt.draw(V.context,tt,j,V.stencilModeForClipping(Bt),$,Xa.disabled,ft,pn,g.id,$t.layoutVertexBuffer,yt,Ct,g.paint,V.transform.zoom,Kt)}}function Kc(V,d,g,z,j,$,ie){const de=V.context,xe=de.gl,Ae="fill-extrusion-pattern",Re=g.paint.get(Ae),je=Re.constantOr(1),tt=g.getCrossfadeParameters(),lt=g.paint.get("fill-extrusion-opacity"),ft=Re.constantOr(null);for(const yt of z){const Ct=d.getTile(yt),kt=Ct.getBucket(g);if(!kt)continue;const Bt=V.style.map.terrain&&V.style.map.terrain.getTerrainData(yt),At=kt.programConfigurations.get(g.id),$t=V.useProgram(je?"fillExtrusionPattern":"fillExtrusion",At);je&&(V.context.activeTexture.set(xe.TEXTURE0),Ct.imageAtlasTexture.bind(xe.LINEAR,xe.CLAMP_TO_EDGE),At.updatePaintBuffers(tt)),Qu(At,Ae,ft,Ct,g);const Kt=V.translatePosMatrix(yt.posMatrix,Ct,g.paint.get("fill-extrusion-translate"),g.paint.get("fill-extrusion-translate-anchor")),Yt=g.paint.get("fill-extrusion-vertical-gradient"),pn=je?Sr(Kt,V,Yt,lt,yt,tt,Ct):sr(Kt,V,Yt,lt);$t.draw(de,de.gl.TRIANGLES,j,$,ie,Xa.backCCW,pn,Bt,g.id,kt.layoutVertexBuffer,kt.indexBuffer,kt.segments,g.paint,V.transform.zoom,At,V.style.map.terrain&&kt.centroidVertexBuffer)}}function Jc(V,d,g,z,j,$,ie){const de=V.context,xe=de.gl,Ae=g.fbo;if(!Ae)return;const Re=V.useProgram("hillshade"),je=V.style.map.terrain&&V.style.map.terrain.getTerrainData(d);de.activeTexture.set(xe.TEXTURE0),xe.bindTexture(xe.TEXTURE_2D,Ae.colorAttachment.get());const tt=je?d:null;Re.draw(de,xe.TRIANGLES,j,$,ie,Xa.disabled,Hn(V,g,z,tt),je,z.id,V.rasterBoundsBuffer,V.quadTriangleIndexBuffer,V.rasterBoundsSegments)}function bf(V,d,g,z,j,$){const ie=V.context,de=ie.gl,xe=d.dem;if(xe&&xe.data){const Ae=xe.dim,Re=xe.stride,je=xe.getPixels();if(ie.activeTexture.set(de.TEXTURE1),ie.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||V.getTileTexture(Re),d.demTexture){const lt=d.demTexture;lt.update(je,{premultiply:!1}),lt.bind(de.NEAREST,de.CLAMP_TO_EDGE)}else d.demTexture=new D(ie,je,de.RGBA,{premultiply:!1}),d.demTexture.bind(de.NEAREST,de.CLAMP_TO_EDGE);ie.activeTexture.set(de.TEXTURE0);let tt=d.fbo;if(!tt){const lt=new D(ie,{width:Ae,height:Ae,data:null},de.RGBA);lt.bind(de.LINEAR,de.CLAMP_TO_EDGE),tt=d.fbo=ie.createFramebuffer(Ae,Ae,!0,!1),tt.colorAttachment.set(lt.texture)}ie.bindFramebuffer.set(tt.framebuffer),ie.viewport.set([0,0,Ae,Ae]),V.useProgram("hillshadePrepare").draw(ie,de.TRIANGLES,z,j,$,Xa.disabled,Dn(d.tileID,xe),null,g.id,V.rasterBoundsBuffer,V.quadTriangleIndexBuffer,V.rasterBoundsSegments),d.needsHillshadePrepare=!1}}function jl(V,d,g,z,j,$){const ie=z.paint.get("raster-fade-duration");if(!$&&ie>0){const de=v.now(),xe=(de-V.timeAdded)/ie,Ae=d?(de-d.timeAdded)/ie:-1,Re=g.getSource(),je=j.coveringZoomLevel({tileSize:Re.tileSize,roundZoom:Re.roundZoom}),tt=!d||Math.abs(d.tileID.overscaledZ-je)>Math.abs(V.tileID.overscaledZ-je),lt=tt&&V.refreshedUponExpiration?1:i.ad(tt?xe:1-Ae,0,1);return V.refreshedUponExpiration&&xe>=1&&(V.refreshedUponExpiration=!1),d?{opacity:1,mix:1-lt}:{opacity:lt,mix:0}}return{opacity:1,mix:0}}const pu=new i.aN(1,0,0,1),ec=new i.aN(0,1,0,1),Ul=new i.aN(0,0,1,1),ga=new i.aN(1,0,1,1),Rh=new i.aN(0,1,1,1);function Oh(V){const d=V.transform.padding;mh(V,V.transform.height-(d.top||0),3,pu),mh(V,d.bottom||0,3,ec),Ps(V,d.left||0,3,Ul),Ps(V,V.transform.width-(d.right||0),3,ga);const g=V.transform.centerPoint;(function(z,j,$,ie){Qc(z,j-1,$-10,2,20,ie),Qc(z,j-10,$-1,20,2,ie)})(V,g.x,V.transform.height-g.y,Rh)}function mh(V,d,g,z){Qc(V,0,d+g/2,V.transform.width,g,z)}function Ps(V,d,g,z){Qc(V,d-g/2,0,g,V.transform.height,z)}function Qc(V,d,g,z,j,$){const ie=V.context,de=ie.gl;de.enable(de.SCISSOR_TEST),de.scissor(d*V.pixelRatio,g*V.pixelRatio,z*V.pixelRatio,j*V.pixelRatio),ie.clear({color:$}),de.disable(de.SCISSOR_TEST)}function Hf(V,d,g){const z=V.context,j=z.gl,$=g.posMatrix,ie=V.useProgram("debug"),de=Qi.disabled,xe=Za.disabled,Ae=V.colorModeForRenderPass(),Re="$debug",je=V.style.map.terrain&&V.style.map.terrain.getTerrainData(g);z.activeTexture.set(j.TEXTURE0);const tt=d.getTileByID(g.key).latestRawTileData,lt=tt&&tt.byteLength||0,ft=Math.floor(lt/1024),yt=d.getTile(g).tileSize,Ct=512/Math.min(yt,512)*(g.overscaledZ/V.transform.zoom)*.5;let kt=g.canonical.toString();g.overscaledZ!==g.canonical.z&&(kt+=` => ${g.overscaledZ}`),function(Bt,At){Bt.initDebugOverlayCanvas();const $t=Bt.debugOverlayCanvas,Kt=Bt.context.gl,Yt=Bt.debugOverlayCanvas.getContext("2d");Yt.clearRect(0,0,$t.width,$t.height),Yt.shadowColor="white",Yt.shadowBlur=2,Yt.lineWidth=1.5,Yt.strokeStyle="white",Yt.textBaseline="top",Yt.font="bold 36px Open Sans, sans-serif",Yt.fillText(At,5,5),Yt.strokeText(At,5,5),Bt.debugOverlayTexture.update($t),Bt.debugOverlayTexture.bind(Kt.LINEAR,Kt.CLAMP_TO_EDGE)}(V,`${kt} ${ft}kB`),ie.draw(z,j.TRIANGLES,de,xe,qo.alphaBlended,Xa.disabled,bn($,i.aN.transparent,Ct),null,Re,V.debugBuffer,V.quadTriangleIndexBuffer,V.debugSegments),ie.draw(z,j.LINE_STRIP,de,xe,Ae,Xa.disabled,bn($,i.aN.red),je,Re,V.debugBuffer,V.tileBorderIndexBuffer,V.debugSegments)}function Dc(V,d,g){const z=V.context,j=z.gl,$=V.colorModeForRenderPass(),ie=new Qi(j.LEQUAL,Qi.ReadWrite,V.depthRangeFor3D),de=V.useProgram("terrain"),xe=d.getTerrainMesh();z.bindFramebuffer.set(null),z.viewport.set([0,0,V.width,V.height]);for(const Ae of g){const Re=V.renderToTexture.getTexture(Ae),je=d.getTerrainData(Ae.tileID);z.activeTexture.set(j.TEXTURE0),j.bindTexture(j.TEXTURE_2D,Re.texture);const tt=V.transform.calculatePosMatrix(Ae.tileID.toUnwrapped()),lt=d.getMeshFrameDelta(V.transform.zoom),ft=V.transform.calculateFogMatrix(Ae.tileID.toUnwrapped()),yt=_n(tt,lt,ft,V.style.sky,V.transform.pitch);de.draw(z,j.TRIANGLES,ie,Za.disabled,$,Xa.backCCW,yt,je,"terrain",xe.vertexBuffer,xe.indexBuffer,xe.segments)}}class Rc{constructor(d,g,z){this.vertexBuffer=d,this.indexBuffer=g,this.segments=z}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Oc{constructor(d,g){this.context=new Zc(d),this.transform=g,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:i.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=We.maxUnderzooming+We.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ar}resize(d,g,z){if(this.width=Math.floor(d*z),this.height=Math.floor(g*z),this.pixelRatio=z,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const j of this.style._order)this.style._layers[j].resize()}setup(){const d=this.context,g=new i.aX;g.emplaceBack(0,0),g.emplaceBack(i.X,0),g.emplaceBack(0,i.X),g.emplaceBack(i.X,i.X),this.tileExtentBuffer=d.createVertexBuffer(g,gr.members),this.tileExtentSegments=i.a0.simpleSegment(0,0,4,2);const z=new i.aX;z.emplaceBack(0,0),z.emplaceBack(i.X,0),z.emplaceBack(0,i.X),z.emplaceBack(i.X,i.X),this.debugBuffer=d.createVertexBuffer(z,gr.members),this.debugSegments=i.a0.simpleSegment(0,0,4,5);const j=new i.$;j.emplaceBack(0,0,0,0),j.emplaceBack(i.X,0,i.X,0),j.emplaceBack(0,i.X,0,i.X),j.emplaceBack(i.X,i.X,i.X,i.X),this.rasterBoundsBuffer=d.createVertexBuffer(j,Fe.members),this.rasterBoundsSegments=i.a0.simpleSegment(0,0,4,2);const $=new i.aX;$.emplaceBack(0,0),$.emplaceBack(1,0),$.emplaceBack(0,1),$.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer($,gr.members),this.viewportSegments=i.a0.simpleSegment(0,0,4,2);const ie=new i.aZ;ie.emplaceBack(0),ie.emplaceBack(1),ie.emplaceBack(3),ie.emplaceBack(2),ie.emplaceBack(0),this.tileBorderIndexBuffer=d.createIndexBuffer(ie);const de=new i.aY;de.emplaceBack(0,1,2),de.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(de);const xe=this.context.gl;this.stencilClearMode=new Za({func:xe.ALWAYS,mask:0},0,255,xe.ZERO,xe.ZERO,xe.ZERO)}clearStencil(){const d=this.context,g=d.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const z=i.H();i.aQ(z,0,this.width,this.height,0,0,1),i.K(z,z,[g.drawingBufferWidth,g.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(d,g.TRIANGLES,Qi.disabled,this.stencilClearMode,qo.disabled,Xa.disabled,Fn(z),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(d,g){if(this.currentStencilSource===d.source||!d.isTileClipped()||!g||!g.length)return;this.currentStencilSource=d.source;const z=this.context,j=z.gl;this.nextStencilID+g.length>256&&this.clearStencil(),z.setColorMode(qo.disabled),z.setDepthMode(Qi.disabled);const $=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const ie of g){const de=this._tileClippingMaskIDs[ie.key]=this.nextStencilID++,xe=this.style.map.terrain&&this.style.map.terrain.getTerrainData(ie);$.draw(z,j.TRIANGLES,Qi.disabled,new Za({func:j.ALWAYS,mask:0},de,255,j.KEEP,j.KEEP,j.REPLACE),qo.disabled,Xa.disabled,Fn(ie.posMatrix),xe,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,g=this.context.gl;return new Za({func:g.NOTEQUAL,mask:255},d,255,g.KEEP,g.KEEP,g.REPLACE)}stencilModeForClipping(d){const g=this.context.gl;return new Za({func:g.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,g.KEEP,g.KEEP,g.REPLACE)}stencilConfigForOverlap(d){const g=this.context.gl,z=d.sort((ie,de)=>de.overscaledZ-ie.overscaledZ),j=z[z.length-1].overscaledZ,$=z[0].overscaledZ-j+1;if($>1){this.currentStencilSource=void 0,this.nextStencilID+$>256&&this.clearStencil();const ie={};for(let de=0;de<$;de++)ie[de+j]=new Za({func:g.GEQUAL,mask:255},de+this.nextStencilID,255,g.KEEP,g.KEEP,g.REPLACE);return this.nextStencilID+=$,[ie,z]}return[{[j]:Za.disabled},z]}colorModeForRenderPass(){const d=this.context.gl;return this._showOverdrawInspector?new qo([d.CONSTANT_COLOR,d.ONE],new i.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?qo.unblended:qo.alphaBlended}depthModeForSublayer(d,g,z){if(!this.opaquePassEnabledForLayer())return Qi.disabled;const j=1-((1+this.currentLayer)*this.numSublayers+d)*this.depthEpsilon;return new Qi(z||this.context.gl.LEQUAL,g,[j,j])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(d,g){var z;this.style=d,this.options=g,this.lineAtlas=d.lineAtlas,this.imageManager=d.imageManager,this.glyphManager=d.glyphManager,this.symbolFadeChange=d.placement.symbolFadeChange(v.now()),this.imageManager.beginFrame();const j=this.style._order,$=this.style.sourceCaches,ie={},de={},xe={};for(const Ae in $){const Re=$[Ae];Re.used&&Re.prepare(this.context),ie[Ae]=Re.getVisibleCoordinates(),de[Ae]=ie[Ae].slice().reverse(),xe[Ae]=Re.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let Ae=0;Ae<j.length;Ae++){const Re=j[Ae];if(this.style._layers[Re].is3D()){this.opaquePassCutoff=Ae;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const Ae of j){const Re=this.style._layers[Ae];if(!Re.hasOffscreenPass()||Re.isHidden(this.transform.zoom))continue;const je=de[Re.source];(Re.type==="custom"||je.length)&&this.renderLayer(this,$[Re.source],Re,je)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:g.showOverdrawInspector?i.aN.black:i.aN.transparent,depth:1}),this.clearStencil(),!((z=this.style.stylesheet)===null||z===void 0)&&z.sky&&function(Ae,Re){const je=Ae.context,tt=je.gl,lt=((Bt,At,$t)=>({u_sky_color:Bt.properties.get("sky-color"),u_horizon_color:Bt.properties.get("horizon-color"),u_horizon:(At.height/2+At.getHorizon())*$t,u_sky_horizon_blend:Bt.properties.get("sky-horizon-blend")*At.height/2*$t}))(Re,Ae.style.map.transform,Ae.pixelRatio),ft=new Qi(tt.LEQUAL,Qi.ReadWrite,[0,1]),yt=Za.disabled,Ct=Ae.colorModeForRenderPass(),kt=Ae.useProgram("sky");if(!Re.mesh){const Bt=new i.aX;Bt.emplaceBack(-1,-1),Bt.emplaceBack(1,-1),Bt.emplaceBack(1,1),Bt.emplaceBack(-1,1);const At=new i.aY;At.emplaceBack(0,1,2),At.emplaceBack(0,2,3),Re.mesh=new Rc(je.createVertexBuffer(Bt,gr.members),je.createIndexBuffer(At),i.a0.simpleSegment(0,0,Bt.length,At.length))}kt.draw(je,tt.TRIANGLES,ft,yt,Ct,Xa.disabled,lt,void 0,"sky",Re.mesh.vertexBuffer,Re.mesh.indexBuffer,Re.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=g.showOverdrawInspector,this.depthRangeFor3D=[0,1-(d._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=j.length-1;this.currentLayer>=0;this.currentLayer--){const Ae=this.style._layers[j[this.currentLayer]],Re=$[Ae.source],je=ie[Ae.source];this._renderTileClippingMasks(Ae,je),this.renderLayer(this,Re,Ae,je)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<j.length;this.currentLayer++){const Ae=this.style._layers[j[this.currentLayer]],Re=$[Ae.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(Ae))continue;const je=(Ae.type==="symbol"?xe:de)[Ae.source];this._renderTileClippingMasks(Ae,ie[Ae.source]),this.renderLayer(this,Re,Ae,je)}if(this.options.showTileBoundaries){const Ae=function(Re,je){let tt=null;const lt=Object.values(Re._layers).flatMap(kt=>kt.source&&!kt.isHidden(je)?[Re.sourceCaches[kt.source]]:[]),ft=lt.filter(kt=>kt.getSource().type==="vector"),yt=lt.filter(kt=>kt.getSource().type!=="vector"),Ct=kt=>{(!tt||tt.getSource().maxzoom<kt.getSource().maxzoom)&&(tt=kt)};return ft.forEach(kt=>Ct(kt)),tt||yt.forEach(kt=>Ct(kt)),tt}(this.style,this.transform.zoom);Ae&&function(Re,je,tt){for(let lt=0;lt<tt.length;lt++)Hf(Re,je,tt[lt])}(this,Ae,Ae.getVisibleCoordinates())}this.options.showPadding&&Oh(this),this.context.setDefault()}maybeDrawDepthAndCoords(d){if(!this.style||!this.style.map||!this.style.map.terrain)return;const g=this.terrainFacilitator.matrix,z=this.transform.modelViewProjectionMatrix;let j=this.terrainFacilitator.dirty;j||(j=d?!i.a_(g,z):!i.a$(g,z)),j||(j=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),j&&(i.b0(g,z),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function($,ie){const de=$.context,xe=de.gl,Ae=qo.unblended,Re=new Qi(xe.LEQUAL,Qi.ReadWrite,[0,1]),je=ie.getTerrainMesh(),tt=ie.sourceCache.getRenderableTiles(),lt=$.useProgram("terrainDepth");de.bindFramebuffer.set(ie.getFramebuffer("depth").framebuffer),de.viewport.set([0,0,$.width/devicePixelRatio,$.height/devicePixelRatio]),de.clear({color:i.aN.transparent,depth:1});for(const ft of tt){const yt=ie.getTerrainData(ft.tileID),Ct={u_matrix:$.transform.calculatePosMatrix(ft.tileID.toUnwrapped()),u_ele_delta:ie.getMeshFrameDelta($.transform.zoom)};lt.draw(de,xe.TRIANGLES,Re,Za.disabled,Ae,Xa.backCCW,Ct,yt,"terrain",je.vertexBuffer,je.indexBuffer,je.segments)}de.bindFramebuffer.set(null),de.viewport.set([0,0,$.width,$.height])}(this,this.style.map.terrain),function($,ie){const de=$.context,xe=de.gl,Ae=qo.unblended,Re=new Qi(xe.LEQUAL,Qi.ReadWrite,[0,1]),je=ie.getTerrainMesh(),tt=ie.getCoordsTexture(),lt=ie.sourceCache.getRenderableTiles(),ft=$.useProgram("terrainCoords");de.bindFramebuffer.set(ie.getFramebuffer("coords").framebuffer),de.viewport.set([0,0,$.width/devicePixelRatio,$.height/devicePixelRatio]),de.clear({color:i.aN.transparent,depth:1}),ie.coordsIndex=[];for(const yt of lt){const Ct=ie.getTerrainData(yt.tileID);de.activeTexture.set(xe.TEXTURE0),xe.bindTexture(xe.TEXTURE_2D,tt.texture);const kt={u_matrix:$.transform.calculatePosMatrix(yt.tileID.toUnwrapped()),u_terrain_coords_id:(255-ie.coordsIndex.length)/255,u_texture:0,u_ele_delta:ie.getMeshFrameDelta($.transform.zoom)};ft.draw(de,xe.TRIANGLES,Re,Za.disabled,Ae,Xa.backCCW,kt,Ct,"terrain",je.vertexBuffer,je.indexBuffer,je.segments),ie.coordsIndex.push(yt.tileID.key)}de.bindFramebuffer.set(null),de.viewport.set([0,0,$.width,$.height])}(this,this.style.map.terrain))}renderLayer(d,g,z,j){if(!z.isHidden(this.transform.zoom)&&(z.type==="background"||z.type==="custom"||(j||[]).length))switch(this.id=z.id,z.type){case"symbol":Ku(d,g,z,j,this.style.placement.variableOffsets);break;case"circle":(function($,ie,de,xe){if($.renderPass!=="translucent")return;const Ae=de.paint.get("circle-opacity"),Re=de.paint.get("circle-stroke-width"),je=de.paint.get("circle-stroke-opacity"),tt=!de.layout.get("circle-sort-key").isConstant();if(Ae.constantOr(1)===0&&(Re.constantOr(1)===0||je.constantOr(1)===0))return;const lt=$.context,ft=lt.gl,yt=$.depthModeForSublayer(0,Qi.ReadOnly),Ct=Za.disabled,kt=$.colorModeForRenderPass(),Bt=[];for(let At=0;At<xe.length;At++){const $t=xe[At],Kt=ie.getTile($t),Yt=Kt.getBucket(de);if(!Yt)continue;const pn=Yt.programConfigurations.get(de.id),Tn=$.useProgram("circle",pn),Vn=Yt.layoutVertexBuffer,jn=Yt.indexBuffer,$n=$.style.map.terrain&&$.style.map.terrain.getTerrainData($t),er={programConfiguration:pn,program:Tn,layoutVertexBuffer:Vn,indexBuffer:jn,uniformValues:Gn($,$t,Kt,de),terrainData:$n};if(tt){const Tr=Yt.segments.get();for(const rr of Tr)Bt.push({segments:new i.a0([rr]),sortKey:rr.sortKey,state:er})}else Bt.push({segments:Yt.segments,sortKey:0,state:er})}tt&&Bt.sort((At,$t)=>At.sortKey-$t.sortKey);for(const At of Bt){const{programConfiguration:$t,program:Kt,layoutVertexBuffer:Yt,indexBuffer:pn,uniformValues:Tn,terrainData:Vn}=At.state,jn=At.segments;Kt.draw(lt,ft.TRIANGLES,yt,Ct,kt,Xa.disabled,Tn,Vn,de.id,Yt,pn,jn,de.paint,$.transform.zoom,$t)}})(d,g,z,j);break;case"heatmap":Ju(d,g,z,j);break;case"line":(function($,ie,de,xe){if($.renderPass!=="translucent")return;const Ae=de.paint.get("line-opacity"),Re=de.paint.get("line-width");if(Ae.constantOr(1)===0||Re.constantOr(1)===0)return;const je=$.depthModeForSublayer(0,Qi.ReadOnly),tt=$.colorModeForRenderPass(),lt=de.paint.get("line-dasharray"),ft=de.paint.get("line-pattern"),yt=ft.constantOr(1),Ct=de.paint.get("line-gradient"),kt=de.getCrossfadeParameters(),Bt=yt?"linePattern":lt?"lineSDF":Ct?"lineGradient":"line",At=$.context,$t=At.gl;let Kt=!0;for(const Yt of xe){const pn=ie.getTile(Yt);if(yt&&!pn.patternsLoaded())continue;const Tn=pn.getBucket(de);if(!Tn)continue;const Vn=Tn.programConfigurations.get(de.id),jn=$.context.program.get(),$n=$.useProgram(Bt,Vn),er=Kt||$n.program!==jn,Tr=$.style.map.terrain&&$.style.map.terrain.getTerrainData(Yt),rr=ft.constantOr(null);if(rr&&pn.imageAtlas){const Pr=pn.imageAtlas,br=Pr.patternPositions[rr.to.toString()],Nr=Pr.patternPositions[rr.from.toString()];br&&Nr&&Vn.setConstantPatternPositions(br,Nr)}const Ar=Tr?Yt:null,ur=yt?tr($,pn,de,kt,Ar):lt?dr($,pn,de,lt,kt,Ar):Ct?En($,pn,de,Tn.lineClipsArray.length,Ar):cn($,pn,de,Ar);if(yt)At.activeTexture.set($t.TEXTURE0),pn.imageAtlasTexture.bind($t.LINEAR,$t.CLAMP_TO_EDGE),Vn.updatePaintBuffers(kt);else if(lt&&(er||$.lineAtlas.dirty))At.activeTexture.set($t.TEXTURE0),$.lineAtlas.bind(At);else if(Ct){const Pr=Tn.gradients[de.id];let br=Pr.texture;if(de.gradientVersion!==Pr.version){let Nr=256;if(de.stepInterpolant){const li=ie.getSource().maxzoom,Fr=Yt.canonical.z===li?Math.ceil(1<<$.transform.maxZoom-Yt.canonical.z):1,ri=Tn.maxLineLength/i.X*1024*Fr;Nr=i.ad(i.aV(ri),256,At.maxTextureSize)}Pr.gradient=i.aW({expression:de.gradientExpression(),evaluationKey:"lineProgress",resolution:Nr,image:Pr.gradient||void 0,clips:Tn.lineClipsArray}),Pr.texture?Pr.texture.update(Pr.gradient):Pr.texture=new D(At,Pr.gradient,$t.RGBA),Pr.version=de.gradientVersion,br=Pr.texture}At.activeTexture.set($t.TEXTURE0),br.bind(de.stepInterpolant?$t.NEAREST:$t.LINEAR,$t.CLAMP_TO_EDGE)}$n.draw(At,$t.TRIANGLES,je,$.stencilModeForClipping(Yt),tt,Xa.disabled,ur,Tr,de.id,Tn.layoutVertexBuffer,Tn.indexBuffer,Tn.segments,de.paint,$.transform.zoom,Vn,Tn.layoutVertexBuffer2),Kt=!1}})(d,g,z,j);break;case"fill":(function($,ie,de,xe){const Ae=de.paint.get("fill-color"),Re=de.paint.get("fill-opacity");if(Re.constantOr(1)===0)return;const je=$.colorModeForRenderPass(),tt=de.paint.get("fill-pattern"),lt=$.opaquePassEnabledForLayer()&&!tt.constantOr(1)&&Ae.constantOr(i.aN.transparent).a===1&&Re.constantOr(0)===1?"opaque":"translucent";if($.renderPass===lt){const ft=$.depthModeForSublayer(1,$.renderPass==="opaque"?Qi.ReadWrite:Qi.ReadOnly);ph($,ie,de,xe,ft,je,!1)}if($.renderPass==="translucent"&&de.paint.get("fill-antialias")){const ft=$.depthModeForSublayer(de.getPaintProperty("fill-outline-color")?2:0,Qi.ReadOnly);ph($,ie,de,xe,ft,je,!0)}})(d,g,z,j);break;case"fill-extrusion":(function($,ie,de,xe){const Ae=de.paint.get("fill-extrusion-opacity");if(Ae!==0&&$.renderPass==="translucent"){const Re=new Qi($.context.gl.LEQUAL,Qi.ReadWrite,$.depthRangeFor3D);if(Ae!==1||de.paint.get("fill-extrusion-pattern").constantOr(1))Kc($,ie,de,xe,Re,Za.disabled,qo.disabled),Kc($,ie,de,xe,Re,$.stencilModeFor3D(),$.colorModeForRenderPass());else{const je=$.colorModeForRenderPass();Kc($,ie,de,xe,Re,Za.disabled,je)}}})(d,g,z,j);break;case"hillshade":(function($,ie,de,xe){if($.renderPass!=="offscreen"&&$.renderPass!=="translucent")return;const Ae=$.context,Re=$.depthModeForSublayer(0,Qi.ReadOnly),je=$.colorModeForRenderPass(),[tt,lt]=$.renderPass==="translucent"?$.stencilConfigForOverlap(xe):[{},xe];for(const ft of lt){const yt=ie.getTile(ft);yt.needsHillshadePrepare!==void 0&&yt.needsHillshadePrepare&&$.renderPass==="offscreen"?bf($,yt,de,Re,Za.disabled,je):$.renderPass==="translucent"&&Jc($,ft,yt,de,Re,tt[ft.overscaledZ],je)}Ae.viewport.set([0,0,$.width,$.height])})(d,g,z,j);break;case"raster":(function($,ie,de,xe){if($.renderPass!=="translucent"||de.paint.get("raster-opacity")===0||!xe.length)return;const Ae=$.context,Re=Ae.gl,je=ie.getSource(),tt=$.useProgram("raster"),lt=$.colorModeForRenderPass(),[ft,yt]=je instanceof Le?[{},xe]:$.stencilConfigForOverlap(xe),Ct=yt[yt.length-1].overscaledZ,kt=!$.options.moving;for(const Bt of yt){const At=$.depthModeForSublayer(Bt.overscaledZ-Ct,de.paint.get("raster-opacity")===1?Qi.ReadWrite:Qi.ReadOnly,Re.LESS),$t=ie.getTile(Bt);$t.registerFadeDuration(de.paint.get("raster-fade-duration"));const Kt=ie.findLoadedParent(Bt,0),Yt=ie.findLoadedSibling(Bt),pn=jl($t,Kt||Yt||null,ie,de,$.transform,$.style.map.terrain);let Tn,Vn;const jn=de.paint.get("raster-resampling")==="nearest"?Re.NEAREST:Re.LINEAR;Ae.activeTexture.set(Re.TEXTURE0),$t.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),Ae.activeTexture.set(Re.TEXTURE1),Kt?(Kt.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),Tn=Math.pow(2,Kt.tileID.overscaledZ-$t.tileID.overscaledZ),Vn=[$t.tileID.canonical.x*Tn%1,$t.tileID.canonical.y*Tn%1]):$t.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),$t.texture.useMipmap&&Ae.extTextureFilterAnisotropic&&$.transform.pitch>20&&Re.texParameterf(Re.TEXTURE_2D,Ae.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Ae.extTextureFilterAnisotropicMax);const $n=$.style.map.terrain&&$.style.map.terrain.getTerrainData(Bt),er=$n?Bt:null,Tr=er?er.posMatrix:$.transform.calculatePosMatrix(Bt.toUnwrapped(),kt),rr=Or(Tr,Vn||[0,0],Tn||1,pn,de);je instanceof Le?tt.draw(Ae,Re.TRIANGLES,At,Za.disabled,lt,Xa.disabled,rr,$n,de.id,je.boundsBuffer,$.quadTriangleIndexBuffer,je.boundsSegments):tt.draw(Ae,Re.TRIANGLES,At,ft[Bt.overscaledZ],lt,Xa.disabled,rr,$n,de.id,$.rasterBoundsBuffer,$.quadTriangleIndexBuffer,$.rasterBoundsSegments)}})(d,g,z,j);break;case"background":(function($,ie,de,xe){const Ae=de.paint.get("background-color"),Re=de.paint.get("background-opacity");if(Re===0)return;const je=$.context,tt=je.gl,lt=$.transform,ft=lt.tileSize,yt=de.paint.get("background-pattern");if($.isPatternMissing(yt))return;const Ct=!yt&&Ae.a===1&&Re===1&&$.opaquePassEnabledForLayer()?"opaque":"translucent";if($.renderPass!==Ct)return;const kt=Za.disabled,Bt=$.depthModeForSublayer(0,Ct==="opaque"?Qi.ReadWrite:Qi.ReadOnly),At=$.colorModeForRenderPass(),$t=$.useProgram(yt?"backgroundPattern":"background"),Kt=xe||lt.coveringTiles({tileSize:ft,terrain:$.style.map.terrain});yt&&(je.activeTexture.set(tt.TEXTURE0),$.imageManager.bind($.context));const Yt=de.getCrossfadeParameters();for(const pn of Kt){const Tn=xe?pn.posMatrix:$.transform.calculatePosMatrix(pn.toUnwrapped()),Vn=yt?fi(Tn,Re,$,yt,{tileID:pn,tileSize:ft},Yt):$r(Tn,Re,Ae),jn=$.style.map.terrain&&$.style.map.terrain.getTerrainData(pn);$t.draw(je,tt.TRIANGLES,Bt,kt,At,Xa.disabled,Vn,jn,de.id,$.tileExtentBuffer,$.quadTriangleIndexBuffer,$.tileExtentSegments)}})(d,0,z,j);break;case"custom":(function($,ie,de){const xe=$.context,Ae=de.implementation;if($.renderPass==="offscreen"){const Re=Ae.prerender;Re&&($.setCustomLayerDefaults(),xe.setColorMode($.colorModeForRenderPass()),Re.call(Ae,xe.gl,$.transform.customLayerMatrix()),xe.setDirty(),$.setBaseState())}else if($.renderPass==="translucent"){$.setCustomLayerDefaults(),xe.setColorMode($.colorModeForRenderPass()),xe.setStencilMode(Za.disabled);const Re=Ae.renderingMode==="3d"?new Qi($.context.gl.LEQUAL,Qi.ReadWrite,$.depthRangeFor3D):$.depthModeForSublayer(0,Qi.ReadOnly);xe.setDepthMode(Re),Ae.render(xe.gl,$.transform.customLayerMatrix(),{farZ:$.transform.farZ,nearZ:$.transform.nearZ,fov:$.transform._fov,modelViewProjectionMatrix:$.transform.modelViewProjectionMatrix,projectionMatrix:$.transform.projectionMatrix}),xe.setDirty(),$.setBaseState(),xe.bindFramebuffer.set(null)}})(d,0,z)}}translatePosMatrix(d,g,z,j,$){if(!z[0]&&!z[1])return d;const ie=$?j==="map"?this.transform.angle:0:j==="viewport"?-this.transform.angle:0;if(ie){const Ae=Math.sin(ie),Re=Math.cos(ie);z=[z[0]*Re-z[1]*Ae,z[0]*Ae+z[1]*Re]}const de=[$?z[0]:Tt(g,z[0],this.transform.zoom),$?z[1]:Tt(g,z[1],this.transform.zoom),0],xe=new Float32Array(16);return i.J(xe,d,de),xe}saveTileTexture(d){const g=this._tileTextures[d.size[0]];g?g.push(d):this._tileTextures[d.size[0]]=[d]}getTileTexture(d){const g=this._tileTextures[d];return g&&g.length>0?g.pop():null}isPatternMissing(d){if(!d)return!1;if(!d.from||!d.to)return!0;const g=this.imageManager.getPattern(d.from.toString()),z=this.imageManager.getPattern(d.to.toString());return!g||!z}useProgram(d,g){this.cache=this.cache||{};const z=d+(g?g.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[z]||(this.cache[z]=new or(this.context,Ir[d],g,Qr[d],this._showOverdrawInspector,this.style.map.terrain)),this.cache[z]}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 d=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(d.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;const d=this.context.gl;this.debugOverlayTexture=new D(this.context,this.debugOverlayCanvas,d.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:d,drawingBufferHeight:g}=this.context.gl;return this.width!==d||this.height!==g}}class mu{constructor(d,g){this.points=d,this.planes=g}static fromInvProjectionMatrix(d,g,z){const j=Math.pow(2,z),$=[[-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(de=>{const xe=1/(de=i.ag([],de,d))[3]/g*j;return i.b1(de,de,[xe,xe,1/de[3],xe])}),ie=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(de=>{const xe=function(tt,lt){var ft=lt[0],yt=lt[1],Ct=lt[2],kt=ft*ft+yt*yt+Ct*Ct;return kt>0&&(kt=1/Math.sqrt(kt)),tt[0]=lt[0]*kt,tt[1]=lt[1]*kt,tt[2]=lt[2]*kt,tt}([],function(tt,lt,ft){var yt=lt[0],Ct=lt[1],kt=lt[2],Bt=ft[0],At=ft[1],$t=ft[2];return tt[0]=Ct*$t-kt*At,tt[1]=kt*Bt-yt*$t,tt[2]=yt*At-Ct*Bt,tt}([],P([],$[de[0]],$[de[1]]),P([],$[de[2]],$[de[1]]))),Ae=(Re=xe,je=$[de[1]],-(Re[0]*je[0]+Re[1]*je[1]+Re[2]*je[2]));var Re,je;return xe.concat(Ae)});return new mu($,ie)}}class Hl{constructor(d,g){this.min=d,this.max=g,this.center=function(z,j,$){return z[0]=j[0]*$,z[1]=j[1]*$,z[2]=j[2]*$,z}([],function(z,j,$){return z[0]=j[0]+$[0],z[1]=j[1]+$[1],z[2]=j[2]+$[2],z}([],this.min,this.max),.5)}quadrant(d){const g=[d%2==0,d<2],z=A(this.min),j=A(this.max);for(let $=0;$<g.length;$++)z[$]=g[$]?this.min[$]:this.center[$],j[$]=g[$]?this.center[$]:this.max[$];return j[2]=this.max[2],new Hl(z,j)}distanceX(d){return Math.max(Math.min(this.max[0],d[0]),this.min[0])-d[0]}distanceY(d){return Math.max(Math.min(this.max[1],d[1]),this.min[1])-d[1]}intersects(d){const g=[[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 z=!0;for(let j=0;j<d.planes.length;j++){const $=d.planes[j];let ie=0;for(let de=0;de<g.length;de++)i.b2($,g[de])>=0&&ie++;if(ie===0)return 0;ie!==g.length&&(z=!1)}if(z)return 2;for(let j=0;j<3;j++){let $=Number.MAX_VALUE,ie=-Number.MAX_VALUE;for(let de=0;de<d.points.length;de++){const xe=d.points[de][j]-this.min[j];$=Math.min($,xe),ie=Math.max(ie,xe)}if(ie<0||$>this.max[j]-this.min[j])return 0}return 1}}class tc{constructor(d=0,g=0,z=0,j=0){if(isNaN(d)||d<0||isNaN(g)||g<0||isNaN(z)||z<0||isNaN(j)||j<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=g,this.left=z,this.right=j}interpolate(d,g,z){return g.top!=null&&d.top!=null&&(this.top=i.z.number(d.top,g.top,z)),g.bottom!=null&&d.bottom!=null&&(this.bottom=i.z.number(d.bottom,g.bottom,z)),g.left!=null&&d.left!=null&&(this.left=i.z.number(d.left,g.left,z)),g.right!=null&&d.right!=null&&(this.right=i.z.number(d.right,g.right,z)),this}getCenter(d,g){const z=i.ad((this.left+d-this.right)/2,0,d),j=i.ad((this.top+g-this.bottom)/2,0,g);return new i.P(z,j)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new tc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const eh=85.051129;class Ia{constructor(d,g,z,j,$){this.tileSize=512,this._renderWorldCopies=$===void 0||!!$,this._minZoom=d||0,this._maxZoom=g||22,this._minPitch=z??0,this._maxPitch=j??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new tc,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const d=new Ia(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return d.apply(this),d}apply(d){this.tileSize=d.tileSize,this.latRange=d.latRange,this.width=d.width,this.height=d.height,this._center=d._center,this._elevation=d._elevation,this.minElevationForCurrentTile=d.minElevationForCurrentTile,this.zoom=d.zoom,this.angle=d.angle,this._fov=d._fov,this._pitch=d._pitch,this._unmodified=d._unmodified,this._edgeInsets=d._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(d){this._minZoom!==d&&(this._minZoom=d,this.zoom=Math.max(this.zoom,d))}get maxZoom(){return this._maxZoom}set maxZoom(d){this._maxZoom!==d&&(this._maxZoom=d,this.zoom=Math.min(this.zoom,d))}get minPitch(){return this._minPitch}set minPitch(d){this._minPitch!==d&&(this._minPitch=d,this.pitch=Math.max(this.pitch,d))}get maxPitch(){return this._maxPitch}set maxPitch(d){this._maxPitch!==d&&(this._maxPitch=d,this.pitch=Math.min(this.pitch,d))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(d){d===void 0?d=!0:d===null&&(d=!1),this._renderWorldCopies=d}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(d){const g=-i.b3(d,-180,180)*Math.PI/180;this.angle!==g&&(this._unmodified=!1,this.angle=g,this._calcMatrices(),this.rotationMatrix=function(){var z=new i.A(4);return i.A!=Float32Array&&(z[1]=0,z[2]=0),z[0]=1,z[3]=1,z}(),function(z,j,$){var ie=j[0],de=j[1],xe=j[2],Ae=j[3],Re=Math.sin($),je=Math.cos($);z[0]=ie*je+xe*Re,z[1]=de*je+Ae*Re,z[2]=ie*-Re+xe*je,z[3]=de*-Re+Ae*je}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(d){const g=i.ad(d,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==g&&(this._unmodified=!1,this._pitch=g,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(d){d=Math.max(.01,Math.min(60,d)),this._fov!==d&&(this._unmodified=!1,this._fov=d/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(d){const g=Math.min(Math.max(d,this.minZoom),this.maxZoom);this._zoom!==g&&(this._unmodified=!1,this._zoom=g,this.tileZoom=Math.max(0,Math.floor(g)),this.scale=this.zoomScale(g),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(d){d.lat===this._center.lat&&d.lng===this._center.lng||(this._unmodified=!1,this._center=d,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(d){d!==this._elevation&&(this._elevation=d,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(d){this._edgeInsets.equals(d)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,d,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(d){return this._edgeInsets.equals(d)}interpolatePadding(d,g,z){this._unmodified=!1,this._edgeInsets.interpolate(d,g,z),this._constrain(),this._calcMatrices()}coveringZoomLevel(d){const g=(d.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/d.tileSize));return Math.max(0,g)}getVisibleUnwrappedCoordinates(d){const g=[new i.b4(0,d)];if(this._renderWorldCopies){const z=this.pointCoordinate(new i.P(0,0)),j=this.pointCoordinate(new i.P(this.width,0)),$=this.pointCoordinate(new i.P(this.width,this.height)),ie=this.pointCoordinate(new i.P(0,this.height)),de=Math.floor(Math.min(z.x,j.x,$.x,ie.x)),xe=Math.floor(Math.max(z.x,j.x,$.x,ie.x)),Ae=1;for(let Re=de-Ae;Re<=xe+Ae;Re++)Re!==0&&g.push(new i.b4(Re,d))}return g}coveringTiles(d){var g,z;let j=this.coveringZoomLevel(d);const $=j;if(d.minzoom!==void 0&&j<d.minzoom)return[];d.maxzoom!==void 0&&j>d.maxzoom&&(j=d.maxzoom);const ie=this.pointCoordinate(this.getCameraPoint()),de=i.Z.fromLngLat(this.center),xe=Math.pow(2,j),Ae=[xe*ie.x,xe*ie.y,0],Re=[xe*de.x,xe*de.y,0],je=mu.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,j);let tt=d.minzoom||0;!d.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(tt=j);const lt=d.terrain?2/Math.min(this.tileSize,d.tileSize)*this.tileSize:3,ft=At=>({aabb:new Hl([At*xe,0,0],[(At+1)*xe,xe,0]),zoom:0,x:0,y:0,wrap:At,fullyVisible:!1}),yt=[],Ct=[],kt=j,Bt=d.reparseOverscaled?$:j;if(this._renderWorldCopies)for(let At=1;At<=3;At++)yt.push(ft(-At)),yt.push(ft(At));for(yt.push(ft(0));yt.length>0;){const At=yt.pop(),$t=At.x,Kt=At.y;let Yt=At.fullyVisible;if(!Yt){const er=At.aabb.intersects(je);if(er===0)continue;Yt=er===2}const pn=d.terrain?Ae:Re,Tn=At.aabb.distanceX(pn),Vn=At.aabb.distanceY(pn),jn=Math.max(Math.abs(Tn),Math.abs(Vn)),$n=lt+(1<<kt-At.zoom)-2;if(At.zoom===kt||jn>$n&&At.zoom>=tt){const er=kt-At.zoom,Tr=Ae[0]-.5-($t<<er),rr=Ae[1]-.5-(Kt<<er);Ct.push({tileID:new i.S(At.zoom===kt?Bt:At.zoom,At.wrap,At.zoom,$t,Kt),distanceSq:M([Re[0]-.5-$t,Re[1]-.5-Kt]),tileDistanceToCamera:Math.sqrt(Tr*Tr+rr*rr)})}else for(let er=0;er<4;er++){const Tr=($t<<1)+er%2,rr=(Kt<<1)+(er>>1),Ar=At.zoom+1;let ur=At.aabb.quadrant(er);if(d.terrain){const Pr=new i.S(Ar,At.wrap,Ar,Tr,rr),br=d.terrain.getMinMaxElevation(Pr),Nr=(g=br.minElevation)!==null&&g!==void 0?g:this.elevation,li=(z=br.maxElevation)!==null&&z!==void 0?z:this.elevation;ur=new Hl([ur.min[0],ur.min[1],Nr],[ur.max[0],ur.max[1],li])}yt.push({aabb:ur,zoom:Ar,x:Tr,y:rr,wrap:At.wrap,fullyVisible:Yt})}}return Ct.sort((At,$t)=>At.distanceSq-$t.distanceSq).map(At=>At.tileID)}resize(d,g){this.width=d,this.height=g,this.pixelsToGLUnits=[2/d,-2/g],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(d){return Math.pow(2,d)}scaleZoom(d){return Math.log(d)/Math.LN2}project(d){const g=i.ad(d.lat,-85.051129,eh);return new i.P(i.O(d.lng)*this.worldSize,i.Q(g)*this.worldSize)}unproject(d){return new i.Z(d.x/this.worldSize,d.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(d){const g=this.elevation,z=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,j=this.pointLocation(this.centerPoint,d),$=d.getElevationForLngLatZoom(j,this.tileZoom);if(!(this.elevation-$))return;const ie=z+g-$,de=Math.cos(this._pitch)*this.cameraToCenterDistance/ie/i.b5(1,j.lat)/this.tileSize,xe=this.scaleZoom(de);this._elevation=$,this._center=j,this.zoom=xe}setLocationAtPoint(d,g){const z=this.pointCoordinate(g),j=this.pointCoordinate(this.centerPoint),$=this.locationCoordinate(d),ie=new i.Z($.x-(z.x-j.x),$.y-(z.y-j.y));this.center=this.coordinateLocation(ie),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(d,g){return g?this.coordinatePoint(this.locationCoordinate(d),g.getElevationForLngLatZoom(d,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(d))}pointLocation(d,g){return this.coordinateLocation(this.pointCoordinate(d,g))}locationCoordinate(d){return i.Z.fromLngLat(d)}coordinateLocation(d){return d&&d.toLngLat()}pointCoordinate(d,g){if(g){const ft=g.pointCoordinate(d);if(ft!=null)return ft}const z=[d.x,d.y,0,1],j=[d.x,d.y,1,1];i.ag(z,z,this.pixelMatrixInverse),i.ag(j,j,this.pixelMatrixInverse);const $=z[3],ie=j[3],de=z[0]/$,xe=j[0]/ie,Ae=z[1]/$,Re=j[1]/ie,je=z[2]/$,tt=j[2]/ie,lt=je===tt?0:(0-je)/(tt-je);return new i.Z(i.z.number(de,xe,lt)/this.worldSize,i.z.number(Ae,Re,lt)/this.worldSize)}coordinatePoint(d,g=0,z=this.pixelMatrix){const j=[d.x*this.worldSize,d.y*this.worldSize,g,1];return i.ag(j,j,z),new i.P(j[0]/j[3],j[1]/j[3])}getBounds(){const d=Math.max(0,this.height/2-this.getHorizon());return new Se().extend(this.pointLocation(new i.P(0,d))).extend(this.pointLocation(new i.P(this.width,d))).extend(this.pointLocation(new i.P(this.width,this.height))).extend(this.pointLocation(new i.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Se([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(d){d?(this.lngRange=[d.getWest(),d.getEast()],this.latRange=[d.getSouth(),d.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,eh])}calculateTileMatrix(d){const g=d.canonical,z=this.worldSize/this.zoomScale(g.z),j=g.x+Math.pow(2,g.z)*d.wrap,$=i.ao(new Float64Array(16));return i.J($,$,[j*z,g.y*z,0]),i.K($,$,[z/i.X,z/i.X,1]),$}calculatePosMatrix(d,g=!1){const z=d.key,j=g?this._alignedPosMatrixCache:this._posMatrixCache;if(j[z])return j[z];const $=this.calculateTileMatrix(d);return i.L($,g?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,$),j[z]=new Float32Array($),j[z]}calculateFogMatrix(d){const g=d.key,z=this._fogMatrixCache;if(z[g])return z[g];const j=this.calculateTileMatrix(d);return i.L(j,this.fogMatrix,j),z[g]=new Float32Array(j),z[g]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(d,g){g=i.ad(+g,this.minZoom,this.maxZoom);const z={center:new i.N(d.lng,d.lat),zoom:g};let j=this.lngRange;if(!this._renderWorldCopies&&j===null){const At=179.9999999999;j=[-At,At]}const $=this.tileSize*this.zoomScale(z.zoom);let ie=0,de=$,xe=0,Ae=$,Re=0,je=0;const{x:tt,y:lt}=this.size;if(this.latRange){const At=this.latRange;ie=i.Q(At[1])*$,de=i.Q(At[0])*$,de-ie<lt&&(Re=lt/(de-ie))}j&&(xe=i.b3(i.O(j[0])*$,0,$),Ae=i.b3(i.O(j[1])*$,0,$),Ae<xe&&(Ae+=$),Ae-xe<tt&&(je=tt/(Ae-xe)));const{x:ft,y:yt}=this.project.call({worldSize:$},d);let Ct,kt;const Bt=Math.max(je||0,Re||0);if(Bt){const At=new i.P(je?(Ae+xe)/2:ft,Re?(de+ie)/2:yt);return z.center=this.unproject.call({worldSize:$},At).wrap(),z.zoom+=this.scaleZoom(Bt),z}if(this.latRange){const At=lt/2;yt-At<ie&&(kt=ie+At),yt+At>de&&(kt=de-At)}if(j){const At=(xe+Ae)/2;let $t=ft;this._renderWorldCopies&&($t=i.b3(ft,At-$/2,At+$/2));const Kt=tt/2;$t-Kt<xe&&(Ct=xe+Kt),$t+Kt>Ae&&(Ct=Ae-Kt)}if(Ct!==void 0||kt!==void 0){const At=new i.P(Ct??ft,kt??yt);z.center=this.unproject.call({worldSize:$},At).wrap()}return z}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const d=this._unmodified,{center:g,zoom:z}=this.getConstrained(this.center,this.zoom);this.center=g,this.zoom=z,this._unmodified=d,this._constraining=!1}_calcMatrices(){if(!this.height)return;const d=this._fov/2,g=this.centerOffset,z=this.point.x,j=this.point.y;this.cameraToCenterDistance=.5/Math.tan(d)*this.height,this._pixelPerMeter=i.b5(1,this.center.lat)*this.worldSize;let $=i.ao(new Float64Array(16));i.K($,$,[this.width/2,-this.height/2,1]),i.J($,$,[1,-1,0]),this.labelPlaneMatrix=$,$=i.ao(new Float64Array(16)),i.K($,$,[1,-1,1]),i.J($,$,[-1,-1,0]),i.K($,$,[2/this.width,2/this.height,1]),this.glCoordMatrix=$;const ie=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),de=Math.min(this.elevation,this.minElevationForCurrentTile),xe=ie-de*this._pixelPerMeter/Math.cos(this._pitch),Ae=de<0?xe:ie,Re=Math.PI/2+this._pitch,je=this._fov*(.5+g.y/this.height),tt=Math.sin(je)*Ae/Math.sin(i.ad(Math.PI-Re-je,.01,Math.PI-.01)),lt=this.getHorizon(),ft=2*Math.atan(lt/this.cameraToCenterDistance)*(.5+g.y/(2*lt)),yt=Math.sin(ft)*Ae/Math.sin(i.ad(Math.PI-Re-ft,.01,Math.PI-.01)),Ct=Math.min(tt,yt);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*Ct+Ae),this.nearZ=this.height/50,$=new Float64Array(16),i.b6($,this._fov,this.width/this.height,this.nearZ,this.farZ),$[8]=2*-g.x/this.width,$[9]=2*g.y/this.height,this.projectionMatrix=i.af($),i.K($,$,[1,-1,1]),i.J($,$,[0,0,-this.cameraToCenterDistance]),i.b7($,$,this._pitch),i.ae($,$,this.angle),i.J($,$,[-z,-j,0]),this.mercatorMatrix=i.K([],$,[this.worldSize,this.worldSize,this.worldSize]),i.K($,$,[1,1,this._pixelPerMeter]),this.pixelMatrix=i.L(new Float64Array(16),this.labelPlaneMatrix,$),i.J($,$,[0,0,-this.elevation]),this.modelViewProjectionMatrix=$,this.invModelViewProjectionMatrix=i.at([],$),this.fogMatrix=new Float64Array(16),i.b6(this.fogMatrix,this._fov,this.width/this.height,ie,this.farZ),this.fogMatrix[8]=2*-g.x/this.width,this.fogMatrix[9]=2*g.y/this.height,i.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),i.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),i.b7(this.fogMatrix,this.fogMatrix,this._pitch),i.ae(this.fogMatrix,this.fogMatrix,this.angle),i.J(this.fogMatrix,this.fogMatrix,[-z,-j,0]),i.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),i.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=i.L(new Float64Array(16),this.labelPlaneMatrix,$);const kt=this.width%2/2,Bt=this.height%2/2,At=Math.cos(this.angle),$t=Math.sin(this.angle),Kt=z-Math.round(z)+At*kt+$t*Bt,Yt=j-Math.round(j)+At*Bt+$t*kt,pn=new Float64Array($);if(i.J(pn,pn,[Kt>.5?Kt-1:Kt,Yt>.5?Yt-1:Yt,0]),this.alignedModelViewProjectionMatrix=pn,$=i.at(new Float64Array(16),this.pixelMatrix),!$)throw new Error("failed to invert matrix");this.pixelMatrixInverse=$,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const d=this.pointCoordinate(new i.P(0,0)),g=[d.x*this.worldSize,d.y*this.worldSize,0,1];return i.ag(g,g,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const d=this._pitch,g=Math.tan(d)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,g))}getCameraQueryGeometry(d){const g=this.getCameraPoint();if(d.length===1)return[d[0],g];{let z=g.x,j=g.y,$=g.x,ie=g.y;for(const de of d)z=Math.min(z,de.x),j=Math.min(j,de.y),$=Math.max($,de.x),ie=Math.max(ie,de.y);return[new i.P(z,j),new i.P($,j),new i.P($,ie),new i.P(z,ie),new i.P(z,j)]}}lngLatToCameraDepth(d,g){const z=this.locationCoordinate(d),j=[z.x*this.worldSize,z.y*this.worldSize,g,1];return i.ag(j,j,this.modelViewProjectionMatrix),j[2]/j[3]}}function gu(V,d){let g,z=!1,j=null,$=null;const ie=()=>{j=null,z&&(V.apply($,g),j=setTimeout(ie,d),z=!1)};return(...de)=>(z=!0,$=this,g=de,j||ie(),j)}class Go{constructor(d){this._getCurrentHash=()=>{const g=window.location.hash.replace("#","");if(this._hashName){let z;return g.split("&").map(j=>j.split("=")).forEach(j=>{j[0]===this._hashName&&(z=j)}),(z&&z[1]||"").split("/")}return g.split("/")},this._onHashChange=()=>{const g=this._getCurrentHash();if(g.length>=3&&!g.some(z=>isNaN(z))){const z=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(g[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+g[2],+g[1]],zoom:+g[0],bearing:z,pitch:+(g[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const g=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,g)},this._removeHash=()=>{const g=this._getCurrentHash();if(g.length===0)return;const z=g.join("/");let j=z;j.split("&").length>0&&(j=j.split("&")[0]),this._hashName&&(j=`${this._hashName}=${z}`);let $=window.location.hash.replace(j,"");$.startsWith("#&")?$=$.slice(0,1)+$.slice(2):$==="#"&&($="");let ie=window.location.href.replace(/(#.+)?$/,$);ie=ie.replace("&&","&"),window.history.replaceState(window.history.state,null,ie)},this._updateHash=gu(this._updateHashUnthrottled,300),this._hashName=d&&encodeURIComponent(d)}addTo(d){return this._map=d,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(d){const g=this._map.getCenter(),z=Math.round(100*this._map.getZoom())/100,j=Math.ceil((z*Math.LN2+Math.log(512/360/.5))/Math.LN10),$=Math.pow(10,j),ie=Math.round(g.lng*$)/$,de=Math.round(g.lat*$)/$,xe=this._map.getBearing(),Ae=this._map.getPitch();let Re="";if(Re+=d?`/${ie}/${de}/${z}`:`${z}/${de}/${ie}`,(xe||Ae)&&(Re+="/"+Math.round(10*xe)/10),Ae&&(Re+=`/${Math.round(Ae)}`),this._hashName){const je=this._hashName;let tt=!1;const lt=window.location.hash.slice(1).split("&").map(ft=>{const yt=ft.split("=")[0];return yt===je?(tt=!0,`${yt}=${Re}`):ft}).filter(ft=>ft);return tt||lt.push(`${je}=${Re}`),`#${lt.join("&")}`}return`#${Re}`}}const nl={linearity:.3,easing:i.b8(0,0,.3,1)},Sa=i.e({deceleration:2500,maxSpeed:1400},nl),La=i.e({deceleration:20,maxSpeed:1400},nl),Wl=i.e({deceleration:1e3,maxSpeed:360},nl),th=i.e({deceleration:1e3,maxSpeed:90},nl);class zc{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:v.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,g=v.now();for(;d.length>0&&g-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const g={zoom:0,bearing:0,pitch:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:$}of this._inertiaBuffer)g.zoom+=$.zoomDelta||0,g.bearing+=$.bearingDelta||0,g.pitch+=$.pitchDelta||0,$.panDelta&&g.pan._add($.panDelta),$.around&&(g.around=$.around),$.pinchAround&&(g.pinchAround=$.pinchAround);const z=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,j={};if(g.pan.mag()){const $=vc(g.pan.mag(),z,i.e({},Sa,d||{}));j.offset=g.pan.mult($.amount/g.pan.mag()),j.center=this._map.transform.center,gc(j,$)}if(g.zoom){const $=vc(g.zoom,z,La);j.zoom=this._map.transform.zoom+$.amount,gc(j,$)}if(g.bearing){const $=vc(g.bearing,z,Wl);j.bearing=this._map.transform.bearing+i.ad($.amount,-179,179),gc(j,$)}if(g.pitch){const $=vc(g.pitch,z,th);j.pitch=this._map.transform.pitch+$.amount,gc(j,$)}if(j.zoom||j.bearing){const $=g.pinchAround===void 0?g.around:g.pinchAround;j.around=$?this._map.unproject($):this._map.getCenter()}return this.clear(),i.e(j,{noMoveStart:!0})}}function gc(V,d){(!V.duration||V.duration<d.duration)&&(V.duration=d.duration,V.easing=d.easing)}function vc(V,d,g){const{maxSpeed:z,linearity:j,deceleration:$}=g,ie=i.ad(V*j/(d/1e3),-z,z),de=Math.abs(ie)/($*j);return{easing:g.easing,duration:1e3*de,amount:ie*(de/2)}}class Ds extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z,j={}){const $=o.mousePos(g.getCanvas(),z),ie=g.unproject($);super(d,i.e({point:$,lngLat:ie,originalEvent:z},j)),this._defaultPrevented=!1,this.target=g}}class ys extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z){const j=d==="touchend"?z.changedTouches:z.touches,$=o.touchPos(g.getCanvasContainer(),j),ie=$.map(xe=>g.unproject(xe)),de=$.reduce((xe,Ae,Re,je)=>xe.add(Ae.div(je.length)),new i.P(0,0));super(d,{points:$,point:de,lngLats:ie,lngLat:g.unproject(de),originalEvent:z}),this._defaultPrevented=!1}}class Mu extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z){super(d,{originalEvent:z}),this._defaultPrevented=!1}}class Fc{constructor(d,g){this._map=d,this._clickTolerance=g.clickTolerance}reset(){delete this._mousedownPos}wheel(d){return this._firePreventable(new Mu(d.type,this._map,d))}mousedown(d,g){return this._mousedownPos=g,this._firePreventable(new Ds(d.type,this._map,d))}mouseup(d){this._map.fire(new Ds(d.type,this._map,d))}click(d,g){this._mousedownPos&&this._mousedownPos.dist(g)>=this._clickTolerance||this._map.fire(new Ds(d.type,this._map,d))}dblclick(d){return this._firePreventable(new Ds(d.type,this._map,d))}mouseover(d){this._map.fire(new Ds(d.type,this._map,d))}mouseout(d){this._map.fire(new Ds(d.type,this._map,d))}touchstart(d){return this._firePreventable(new ys(d.type,this._map,d))}touchmove(d){this._map.fire(new ys(d.type,this._map,d))}touchend(d){this._map.fire(new ys(d.type,this._map,d))}touchcancel(d){this._map.fire(new ys(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(d){this._map.fire(new Ds(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ds("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._ignoreContextMenu||this._map.fire(new Ds(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class io{constructor(d){this._map=d}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(d){return this.transform.pointLocation(i.P.convert(d),this._map.terrain)}}class bs{constructor(d,g){this._map=d,this._tr=new io(d),this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=g.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,g){this.isEnabled()&&d.shiftKey&&d.button===0&&(o.disableDrag(),this._startPos=this._lastPos=g,this._active=!0)}mousemoveWindow(d,g){if(!this._active)return;const z=g;if(this._lastPos.equals(z)||!this._box&&z.dist(this._startPos)<this._clickTolerance)return;const j=this._startPos;this._lastPos=z,this._box||(this._box=o.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",d));const $=Math.min(j.x,z.x),ie=Math.max(j.x,z.x),de=Math.min(j.y,z.y),xe=Math.max(j.y,z.y);o.setTransform(this._box,`translate(${$}px,${de}px)`),this._box.style.width=ie-$+"px",this._box.style.height=xe-de+"px"}mouseupWindow(d,g){if(!this._active||d.button!==0)return;const z=this._startPos,j=g;if(this.reset(),o.suppressClick(),z.x!==j.x||z.y!==j.y)return this._map.fire(new i.k("boxzoomend",{originalEvent:d})),{cameraAnimation:$=>$.fitScreenCoordinates(z,j,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",d)}keydown(d){this._active&&d.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",d))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(o.remove(this._box),this._box=null),o.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(d,g){return this._map.fire(new i.k(d,{originalEvent:g}))}}function Ba(V,d){if(V.length!==d.length)throw new Error(`The number of touches and points are not equal - touches ${V.length}, points ${d.length}`);const g={};for(let z=0;z<V.length;z++)g[V[z].identifier]=d[z];return g}class $o{constructor(d){this.reset(),this.numTouches=d.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(d,g,z){(this.centroid||z.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=d.timeStamp),z.length===this.numTouches&&(this.centroid=function(j){const $=new i.P(0,0);for(const ie of j)$._add(ie);return $.div(j.length)}(g),this.touches=Ba(z,g)))}touchmove(d,g,z){if(this.aborted||!this.centroid)return;const j=Ba(z,g);for(const $ in this.touches){const ie=this.touches[$],de=j[$];(!de||de.dist(ie)>30)&&(this.aborted=!0)}}touchend(d,g,z){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),z.length===0){const j=!this.aborted&&this.centroid;if(this.reset(),j)return j}}}class Na{constructor(d){this.singleTap=new $o(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(d,g,z){this.singleTap.touchstart(d,g,z)}touchmove(d,g,z){this.singleTap.touchmove(d,g,z)}touchend(d,g,z){const j=this.singleTap.touchend(d,g,z);if(j){const $=d.timeStamp-this.lastTime<500,ie=!this.lastTap||this.lastTap.dist(j)<30;if($&&ie||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=j,this.count===this.numTaps)return this.reset(),j}}}class is{constructor(d){this._tr=new io(d),this._zoomIn=new Na({numTouches:1,numTaps:2}),this._zoomOut=new Na({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,g,z){this._zoomIn.touchstart(d,g,z),this._zoomOut.touchstart(d,g,z)}touchmove(d,g,z){this._zoomIn.touchmove(d,g,z),this._zoomOut.touchmove(d,g,z)}touchend(d,g,z){const j=this._zoomIn.touchend(d,g,z),$=this._zoomOut.touchend(d,g,z),ie=this._tr;return j?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom+1,around:ie.unproject(j)},{originalEvent:d})}):$?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom-1,around:ie.unproject($)},{originalEvent:d})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xs{constructor(d){this._enabled=!!d.enable,this._moveStateManager=d.moveStateManager,this._clickTolerance=d.clickTolerance||1,this._moveFunction=d.move,this._activateOnStart=!!d.activateOnStart,d.assignEvents(this),this.reset()}reset(d){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(d)}_move(...d){const g=this._moveFunction(...d);if(g.bearingDelta||g.pitchDelta||g.around||g.panDelta)return this._active=!0,g}dragStart(d,g){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(d)&&(this._moveStateManager.startMove(d),this._lastPoint=g.length?g[0]:g,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(d,g){if(!this.isEnabled())return;const z=this._lastPoint;if(!z)return;if(d.preventDefault(),!this._moveStateManager.isValidMoveEvent(d))return void this.reset(d);const j=g.length?g[0]:g;return!this._moved&&j.dist(z)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=j,this._move(z,j))}dragEnd(d){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(d)&&(this._moved&&o.suppressClick(),this.reset(d))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Eu={0:1,2:2};class ml{constructor(d){this._correctEvent=d.checkCorrectEvent}startMove(d){const g=o.mouseButton(d);this._eventButton=g}endMove(d){delete this._eventButton}isValidStartEvent(d){return this._correctEvent(d)}isValidMoveEvent(d){return!function(g,z){const j=Eu[z];return g.buttons===void 0||(g.buttons&j)!==j}(d,this._eventButton)}isValidEndEvent(d){return o.mouseButton(d)===this._eventButton}}class nc{constructor(){this._firstTouch=void 0}_isOneFingerTouch(d){return d.targetTouches.length===1}_isSameTouchEvent(d){return d.targetTouches[0].identifier===this._firstTouch}startMove(d){const g=d.targetTouches[0].identifier;this._firstTouch=g}endMove(d){delete this._firstTouch}isValidStartEvent(d){return this._isOneFingerTouch(d)}isValidMoveEvent(d){return this._isOneFingerTouch(d)&&this._isSameTouchEvent(d)}isValidEndEvent(d){return this._isOneFingerTouch(d)&&this._isSameTouchEvent(d)}}const Rs=V=>{V.mousedown=V.dragStart,V.mousemoveWindow=V.dragMove,V.mouseup=V.dragEnd,V.contextmenu=d=>{d.preventDefault()}},yc=({enable:V,clickTolerance:d,bearingDegreesPerPixelMoved:g=.8})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:d,move:(j,$)=>({bearingDelta:($.x-j.x)*g}),moveStateManager:z,enable:V,assignEvents:Rs})},Iu=({enable:V,clickTolerance:d,pitchDegreesPerPixelMoved:g=-.5})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:d,move:(j,$)=>({pitchDelta:($.y-j.y)*g}),moveStateManager:z,enable:V,assignEvents:Rs})};class ql{constructor(d,g){this._clickTolerance=d.clickTolerance||1,this._map=g,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new i.P(0,0)}_shouldBePrevented(d){return d<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(d,g,z){return this._calculateTransform(d,g,z)}touchmove(d,g,z){if(this._active){if(!this._shouldBePrevented(z.length))return d.preventDefault(),this._calculateTransform(d,g,z);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",d)}}touchend(d,g,z){this._calculateTransform(d,g,z),this._active&&this._shouldBePrevented(z.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(d,g,z){z.length>0&&(this._active=!0);const j=Ba(z,g),$=new i.P(0,0),ie=new i.P(0,0);let de=0;for(const Ae in j){const Re=j[Ae],je=this._touches[Ae];je&&($._add(Re),ie._add(Re.sub(je)),de++,j[Ae]=Re)}if(this._touches=j,this._shouldBePrevented(de)||!ie.mag())return;const xe=ie.div(de);return this._sum._add(xe),this._sum.mag()<this._clickTolerance?void 0:{around:$.div(de),panDelta:xe}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class as{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(d,g,z){this._firstTwoTouches||z.length<2||(this._firstTwoTouches=[z[0].identifier,z[1].identifier],this._start([g[0],g[1]]))}touchmove(d,g,z){if(!this._firstTwoTouches)return;d.preventDefault();const[j,$]=this._firstTwoTouches,ie=Wa(z,g,j),de=Wa(z,g,$);if(!ie||!de)return;const xe=this._aroundCenter?null:ie.add(de).div(2);return this._move([ie,de],xe,d)}touchend(d,g,z){if(!this._firstTwoTouches)return;const[j,$]=this._firstTwoTouches,ie=Wa(z,g,j),de=Wa(z,g,$);ie&&de||(this._active&&o.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(d){this._enabled=!0,this._aroundCenter=!!d&&d.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Wa(V,d,g){for(let z=0;z<V.length;z++)if(V[z].identifier===g)return d[z]}function Gl(V,d){return Math.log(V/d)/Math.LN2}class ki extends as{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(d){this._startDistance=this._distance=d[0].dist(d[1])}_move(d,g){const z=this._distance;if(this._distance=d[0].dist(d[1]),this._active||!(Math.abs(Gl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Gl(this._distance,z),pinchAround:g}}}function nh(V,d){return 180*V.angleWith(d)/Math.PI}class zh extends as{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(d){this._startVector=this._vector=d[0].sub(d[1]),this._minDiameter=d[0].dist(d[1])}_move(d,g,z){const j=this._vector;if(this._vector=d[0].sub(d[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:nh(this._vector,j),pinchAround:g}}_isBelowThreshold(d){this._minDiameter=Math.min(this._minDiameter,d.mag());const g=25/(Math.PI*this._minDiameter)*360,z=nh(d,this._startVector);return Math.abs(z)<g}}function Lu(V){return Math.abs(V.y)>Math.abs(V.x)}class rc extends as{constructor(d){super(),this._currentTouchCount=0,this._map=d}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(d,g,z){super.touchstart(d,g,z),this._currentTouchCount=z.length}_start(d){this._lastPoints=d,Lu(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,g,z){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const j=d[0].sub(this._lastPoints[0]),$=d[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(j,$,z.timeStamp),this._valid?(this._lastPoints=d,this._active=!0,{pitchDelta:(j.y+$.y)/2*-.5}):void 0}gestureBeginsVertically(d,g,z){if(this._valid!==void 0)return this._valid;const j=d.mag()>=2,$=g.mag()>=2;if(!j&&!$)return;if(!j||!$)return this._firstMove===void 0&&(this._firstMove=z),z-this._firstMove<100&&void 0;const ie=d.y>0==g.y>0;return Lu(d)&&Lu(g)&&ie}}const ic={panStep:100,bearingStep:15,pitchStep:10};class Bc{constructor(d){this._tr=new io(d);const g=ic;this._panStep=g.panStep,this._bearingStep=g.bearingStep,this._pitchStep=g.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(d){if(d.altKey||d.ctrlKey||d.metaKey)return;let g=0,z=0,j=0,$=0,ie=0;switch(d.keyCode){case 61:case 107:case 171:case 187:g=1;break;case 189:case 109:case 173:g=-1;break;case 37:d.shiftKey?z=-1:(d.preventDefault(),$=-1);break;case 39:d.shiftKey?z=1:(d.preventDefault(),$=1);break;case 38:d.shiftKey?j=1:(d.preventDefault(),ie=-1);break;case 40:d.shiftKey?j=-1:(d.preventDefault(),ie=1);break;default:return}return this._rotationDisabled&&(z=0,j=0),{cameraAnimation:de=>{const xe=this._tr;de.easeTo({duration:300,easeId:"keyboardHandler",easing:si,zoom:g?Math.round(xe.zoom)+g*(d.shiftKey?2:1):xe.zoom,bearing:xe.bearing+z*this._bearingStep,pitch:xe.pitch+j*this._pitchStep,offset:[-$*this._panStep,-ie*this._panStep],center:xe.center},{originalEvent:d})}}}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 si(V){return V*(2-V)}const vl=4.000244140625;class Pu{constructor(d,g){this._onTimeout=z=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(z)},this._map=d,this._tr=new io(d),this._triggerRenderFrame=g,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(d){this._defaultZoomRate=d}setWheelZoomRate(d){this._wheelZoomRate=d}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(d){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!d&&d.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(d){return!!this._map.cooperativeGestures.isEnabled()&&!(d.ctrlKey||this._map.cooperativeGestures.isBypassed(d))}wheel(d){if(!this.isEnabled())return;if(this._shouldBePrevented(d))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",d);let g=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const z=v.now(),j=z-(this._lastWheelEventTime||0);this._lastWheelEventTime=z,g!==0&&g%vl==0?this._type="wheel":g!==0&&Math.abs(g)<4?this._type="trackpad":j>400?(this._type=null,this._lastValue=g,this._timeout=setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(j*g)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,g+=this._lastValue)),d.shiftKey&&g&&(g/=4),this._type&&(this._lastWheelEvent=d,this._delta-=g,this._active||this._start(d)),d.preventDefault()}_start(d){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 g=o.mousePos(this._map.getCanvas(),d),z=this._tr;g.y>z.transform.height/2-z.transform.getHorizon()?this._around=i.N.convert(this._aroundCenter?z.center:z.unproject(g)):this._around=i.N.convert(z.center),this._aroundPoint=z.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const d=this._tr.transform;if(this._delta!==0){const xe=this._type==="wheel"&&Math.abs(this._delta)>vl?this._wheelZoomRate:this._defaultZoomRate;let Ae=2/(1+Math.exp(-Math.abs(this._delta*xe)));this._delta<0&&Ae!==0&&(Ae=1/Ae);const Re=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):d.scale;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(Re*Ae))),this._type==="wheel"&&(this._startZoom=d.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const g=typeof this._targetZoom=="number"?this._targetZoom:d.zoom,z=this._startZoom,j=this._easing;let $,ie=!1;const de=v.now()-this._lastWheelEventTime;if(this._type==="wheel"&&z&&j&&de){const xe=Math.min(de/200,1),Ae=j(xe);$=i.z.number(z,g,Ae),xe<1?this._frameId||(this._frameId=!0):ie=!0}else $=g,ie=!0;return this._active=!0,ie&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!ie,zoomDelta:$-d.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let g=i.b9;if(this._prevEase){const z=this._prevEase,j=(v.now()-z.start)/z.duration,$=z.easing(j+.01)-z.easing(j),ie=.27/Math.sqrt($*$+1e-4)*.01,de=Math.sqrt(.0729-ie*ie);g=i.b8(ie,de,.25,1)}return this._prevEase={start:v.now(),duration:d,easing:g},g}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ao{constructor(d,g){this._clickZoom=d,this._tapZoom=g}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class rl{constructor(d){this._tr=new io(d),this.reset()}reset(){this._active=!1}dblclick(d,g){return d.preventDefault(),{cameraAnimation:z=>{z.easeTo({duration:300,zoom:this._tr.zoom+(d.shiftKey?-1:1),around:this._tr.unproject(g)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Du{constructor(){this._tap=new Na({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(d,g,z){if(!this._swipePoint)if(this._tapTime){const j=g[0],$=d.timeStamp-this._tapTime<500,ie=this._tapPoint.dist(j)<30;$&&ie?z.length>0&&(this._swipePoint=j,this._swipeTouch=z[0].identifier):this.reset()}else this._tap.touchstart(d,g,z)}touchmove(d,g,z){if(this._tapTime){if(this._swipePoint){if(z[0].identifier!==this._swipeTouch)return;const j=g[0],$=j.y-this._swipePoint.y;return this._swipePoint=j,d.preventDefault(),this._active=!0,{zoomDelta:$/128}}}else this._tap.touchmove(d,g,z)}touchend(d,g,z){if(this._tapTime)this._swipePoint&&z.length===0&&this.reset();else{const j=this._tap.touchend(d,g,z);j&&(this._tapTime=d.timeStamp,this._tapPoint=j)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $l{constructor(d,g,z){this._el=d,this._mousePan=g,this._touchPan=z}enable(d){this._inertiaOptions=d||{},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 js{constructor(d,g,z){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=g,this._mousePitch=z}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 Ru{constructor(d,g,z,j){this._el=d,this._touchZoom=g,this._touchRotate=z,this._tapDragZoom=j,this._rotationDisabled=!1,this._enabled=!0}enable(d){this._touchZoom.enable(d),this._rotationDisabled||this._touchRotate.enable(d),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 Ml{constructor(d,g){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=d,this._options=g,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const d=this._map.getCanvasContainer();d.classList.add("maplibregl-cooperative-gestures"),this._container=o.create("div","maplibregl-cooperative-gesture-screen",d);let g=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(g=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const z=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),j=document.createElement("div");j.className="maplibregl-desktop-message",j.textContent=g,this._container.appendChild(j);const $=document.createElement("div");$.className="maplibregl-mobile-message",$.textContent=z,this._container.appendChild($),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(o.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(d){return d[this._bypassKey]}notifyGestureBlocked(d,g){this._enabled&&(this._map.fire(new i.k("cooperativegestureprevented",{gestureType:d,originalEvent:g})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const il=V=>V.zoom||V.drag||V.pitch||V.rotate;class Yl extends i.k{}function bi(V){return V.panDelta&&V.panDelta.mag()||V.zoomDelta||V.bearingDelta||V.pitchDelta}class ba{constructor(d,g){this.handleWindowEvent=j=>{this.handleEvent(j,`${j.type}Window`)},this.handleEvent=(j,$)=>{if(j.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const ie=j.type==="renderFrame"?void 0:j,de={needsRenderFrame:!1},xe={},Ae={},Re=j.touches,je=Re?this._getMapTouches(Re):void 0,tt=je?o.touchPos(this._map.getCanvas(),je):o.mousePos(this._map.getCanvas(),j);for(const{handlerName:yt,handler:Ct,allowed:kt}of this._handlers){if(!Ct.isEnabled())continue;let Bt;this._blockedByActive(Ae,kt,yt)?Ct.reset():Ct[$||j.type]&&(Bt=Ct[$||j.type](j,tt,je),this.mergeHandlerResult(de,xe,Bt,yt,ie),Bt&&Bt.needsRenderFrame&&this._triggerRenderFrame()),(Bt||Ct.isActive())&&(Ae[yt]=Ct)}const lt={};for(const yt in this._previousActiveHandlers)Ae[yt]||(lt[yt]=ie);this._previousActiveHandlers=Ae,(Object.keys(lt).length||bi(de))&&(this._changes.push([de,xe,lt]),this._triggerRenderFrame()),(Object.keys(Ae).length||bi(de))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ft}=de;ft&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ft(this._map))},this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zc(d),this._bearingSnap=g.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(g);const z=this._el;this._listeners=[[z,"touchstart",{passive:!0}],[z,"touchmove",{passive:!1}],[z,"touchend",void 0],[z,"touchcancel",void 0],[z,"mousedown",void 0],[z,"mousemove",void 0],[z,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[z,"mouseover",void 0],[z,"mouseout",void 0],[z,"dblclick",void 0],[z,"click",void 0],[z,"keydown",{capture:!1}],[z,"keyup",void 0],[z,"wheel",{passive:!1}],[z,"contextmenu",void 0],[window,"blur",void 0]];for(const[j,$,ie]of this._listeners)o.addEventListener(j,$,j===document?this.handleWindowEvent:this.handleEvent,ie)}destroy(){for(const[d,g,z]of this._listeners)o.removeEventListener(d,g,d===document?this.handleWindowEvent:this.handleEvent,z)}_addDefaultHandlers(d){const g=this._map,z=g.getCanvasContainer();this._add("mapEvent",new Fc(g,d));const j=g.boxZoom=new bs(g,d);this._add("boxZoom",j),d.interactive&&d.boxZoom&&j.enable();const $=g.cooperativeGestures=new Ml(g,d.cooperativeGestures);this._add("cooperativeGestures",$),d.cooperativeGestures&&$.enable();const ie=new is(g),de=new rl(g);g.doubleClickZoom=new ao(de,ie),this._add("tapZoom",ie),this._add("clickZoom",de),d.interactive&&d.doubleClickZoom&&g.doubleClickZoom.enable();const xe=new Du;this._add("tapDragZoom",xe);const Ae=g.touchPitch=new rc(g);this._add("touchPitch",Ae),d.interactive&&d.touchPitch&&g.touchPitch.enable(d.touchPitch);const Re=yc(d),je=Iu(d);g.dragRotate=new js(d,Re,je),this._add("mouseRotate",Re,["mousePitch"]),this._add("mousePitch",je,["mouseRotate"]),d.interactive&&d.dragRotate&&g.dragRotate.enable();const tt=(({enable:Bt,clickTolerance:At})=>{const $t=new ml({checkCorrectEvent:Kt=>o.mouseButton(Kt)===0&&!Kt.ctrlKey});return new xs({clickTolerance:At,move:(Kt,Yt)=>({around:Yt,panDelta:Yt.sub(Kt)}),activateOnStart:!0,moveStateManager:$t,enable:Bt,assignEvents:Rs})})(d),lt=new ql(d,g);g.dragPan=new $l(z,tt,lt),this._add("mousePan",tt),this._add("touchPan",lt,["touchZoom","touchRotate"]),d.interactive&&d.dragPan&&g.dragPan.enable(d.dragPan);const ft=new zh,yt=new ki;g.touchZoomRotate=new Ru(z,yt,ft,xe),this._add("touchRotate",ft,["touchPan","touchZoom"]),this._add("touchZoom",yt,["touchPan","touchRotate"]),d.interactive&&d.touchZoomRotate&&g.touchZoomRotate.enable(d.touchZoomRotate);const Ct=g.scrollZoom=new Pu(g,()=>this._triggerRenderFrame());this._add("scrollZoom",Ct,["mousePan"]),d.interactive&&d.scrollZoom&&g.scrollZoom.enable(d.scrollZoom);const kt=g.keyboard=new Bc(g);this._add("keyboard",kt),d.interactive&&d.keyboard&&g.keyboard.enable(),this._add("blockableMapEvent",new Vs(g))}_add(d,g,z){this._handlers.push({handlerName:d,handler:g,allowed:z}),this._handlersById[d]=g}stop(d){if(!this._updatingCamera){for(const{handler:g}of this._handlers)g.reset();this._inertia.clear(),this._fireEvents({},{},d),this._changes=[]}}isActive(){for(const{handler:d}of this._handlers)if(d.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!il(this._eventsInProgress)||this.isZooming()}_blockedByActive(d,g,z){for(const j in d)if(j!==z&&(!g||g.indexOf(j)<0))return!0;return!1}_getMapTouches(d){const g=[];for(const z of d){const j=z.target;this._el.contains(j)&&g.push(z)}return g}mergeHandlerResult(d,g,z,j,$){if(!z)return;i.e(d,z);const ie={handlerName:j,originalEvent:z.originalEvent||$};z.zoomDelta!==void 0&&(g.zoom=ie),z.panDelta!==void 0&&(g.drag=ie),z.pitchDelta!==void 0&&(g.pitch=ie),z.bearingDelta!==void 0&&(g.rotate=ie)}_applyChanges(){const d={},g={},z={};for(const[j,$,ie]of this._changes)j.panDelta&&(d.panDelta=(d.panDelta||new i.P(0,0))._add(j.panDelta)),j.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+j.zoomDelta),j.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+j.bearingDelta),j.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+j.pitchDelta),j.around!==void 0&&(d.around=j.around),j.pinchAround!==void 0&&(d.pinchAround=j.pinchAround),j.noInertia&&(d.noInertia=j.noInertia),i.e(g,$),i.e(z,ie);this._updateMapTransform(d,g,z),this._changes=[]}_updateMapTransform(d,g,z){const j=this._map,$=j._getTransformForUpdate(),ie=j.terrain;if(!(bi(d)||ie&&this._terrainMovement))return this._fireEvents(g,z,!0);let{panDelta:de,zoomDelta:xe,bearingDelta:Ae,pitchDelta:Re,around:je,pinchAround:tt}=d;tt!==void 0&&(je=tt),j._stop(!0),je=je||j.transform.centerPoint;const lt=$.pointLocation(de?je.sub(de):je);Ae&&($.bearing+=Ae),Re&&($.pitch+=Re),xe&&($.zoom+=xe),ie?this._terrainMovement||!g.drag&&!g.zoom?g.drag&&this._terrainMovement?$.center=$.pointLocation($.centerPoint.sub(de)):$.setLocationAtPoint(lt,je):(this._terrainMovement=!0,this._map._elevationFreeze=!0,$.setLocationAtPoint(lt,je)):$.setLocationAtPoint(lt,je),j._applyUpdatedTransform($),this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(g,z,!0)}_fireEvents(d,g,z){const j=il(this._eventsInProgress),$=il(d),ie={};for(const je in d){const{originalEvent:tt}=d[je];this._eventsInProgress[je]||(ie[`${je}start`]=tt),this._eventsInProgress[je]=d[je]}!j&&$&&this._fireEvent("movestart",$.originalEvent);for(const je in ie)this._fireEvent(je,ie[je]);$&&this._fireEvent("move",$.originalEvent);for(const je in d){const{originalEvent:tt}=d[je];this._fireEvent(je,tt)}const de={};let xe;for(const je in this._eventsInProgress){const{handlerName:tt,originalEvent:lt}=this._eventsInProgress[je];this._handlersById[tt].isActive()||(delete this._eventsInProgress[je],xe=g[tt]||lt,de[`${je}end`]=xe)}for(const je in de)this._fireEvent(je,de[je]);const Ae=il(this._eventsInProgress),Re=(j||$)&&!Ae;if(Re&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const je=this._map._getTransformForUpdate();je.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(je)}if(z&&Re){this._updatingCamera=!0;const je=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),tt=lt=>lt!==0&&-this._bearingSnap<lt&&lt<this._bearingSnap;!je||!je.essential&&v.prefersReducedMotion?(this._map.fire(new i.k("moveend",{originalEvent:xe})),tt(this._map.getBearing())&&this._map.resetNorth()):(tt(je.bearing||this._map.getBearing())&&(je.bearing=0),je.freezeElevation=!0,this._map.easeTo(je,{originalEvent:xe})),this._updatingCamera=!1}}_fireEvent(d,g){this._map.fire(new i.k(d,g?{originalEvent:g}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(d=>{delete this._frameId,this.handleEvent(new Yl("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Yo extends i.E{constructor(d,g){super(),this._renderFrameCallback=()=>{const z=Math.min((v.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(z)),z<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=g.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new i.N(this.transform.center.lng,this.transform.center.lat)}setCenter(d,g){return this.jumpTo({center:d},g)}panBy(d,g,z){return d=i.P.convert(d).mult(-1),this.panTo(this.transform.center,i.e({offset:d},g),z)}panTo(d,g,z){return this.easeTo(i.e({center:d},g),z)}getZoom(){return this.transform.zoom}setZoom(d,g){return this.jumpTo({zoom:d},g),this}zoomTo(d,g,z){return this.easeTo(i.e({zoom:d},g),z)}zoomIn(d,g){return this.zoomTo(this.getZoom()+1,d,g),this}zoomOut(d,g){return this.zoomTo(this.getZoom()-1,d,g),this}getBearing(){return this.transform.bearing}setBearing(d,g){return this.jumpTo({bearing:d},g),this}getPadding(){return this.transform.padding}setPadding(d,g){return this.jumpTo({padding:d},g),this}rotateTo(d,g,z){return this.easeTo(i.e({bearing:d},g),z)}resetNorth(d,g){return this.rotateTo(0,i.e({duration:1e3},d),g),this}resetNorthPitch(d,g){return this.easeTo(i.e({bearing:0,pitch:0,duration:1e3},d),g),this}snapToNorth(d,g){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(d,g):this}getPitch(){return this.transform.pitch}setPitch(d,g){return this.jumpTo({pitch:d},g),this}cameraForBounds(d,g){d=Se.convert(d);const z=g&&g.bearing||0;return this._cameraForBoxAndBearing(d.getNorthWest(),d.getSouthEast(),z,g)}_cameraForBoxAndBearing(d,g,z,j){const $={top:0,bottom:0,right:0,left:0};if(typeof(j=i.e({padding:$,offset:[0,0],maxZoom:this.transform.maxZoom},j)).padding=="number"){const Tr=j.padding;j.padding={top:Tr,bottom:Tr,right:Tr,left:Tr}}j.padding=i.e($,j.padding);const ie=this.transform,de=ie.padding,xe=new Se(d,g),Ae=ie.project(xe.getNorthWest()),Re=ie.project(xe.getNorthEast()),je=ie.project(xe.getSouthEast()),tt=ie.project(xe.getSouthWest()),lt=i.ba(-z),ft=Ae.rotate(lt),yt=Re.rotate(lt),Ct=je.rotate(lt),kt=tt.rotate(lt),Bt=new i.P(Math.max(ft.x,yt.x,kt.x,Ct.x),Math.max(ft.y,yt.y,kt.y,Ct.y)),At=new i.P(Math.min(ft.x,yt.x,kt.x,Ct.x),Math.min(ft.y,yt.y,kt.y,Ct.y)),$t=Bt.sub(At),Kt=(ie.width-(de.left+de.right+j.padding.left+j.padding.right))/$t.x,Yt=(ie.height-(de.top+de.bottom+j.padding.top+j.padding.bottom))/$t.y;if(Yt<0||Kt<0)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const pn=Math.min(ie.scaleZoom(ie.scale*Math.min(Kt,Yt)),j.maxZoom),Tn=i.P.convert(j.offset),Vn=(j.padding.left-j.padding.right)/2,jn=(j.padding.top-j.padding.bottom)/2,$n=new i.P(Vn,jn).rotate(i.ba(z)),er=Tn.add($n).mult(ie.scale/ie.zoomScale(pn));return{center:ie.unproject(Ae.add(je).div(2).sub(er)),zoom:pn,bearing:z}}fitBounds(d,g,z){return this._fitInternal(this.cameraForBounds(d,g),g,z)}fitScreenCoordinates(d,g,z,j,$){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(i.P.convert(d)),this.transform.pointLocation(i.P.convert(g)),z,j),j,$)}_fitInternal(d,g,z){return d?(delete(g=i.e(d,g)).padding,g.linear?this.easeTo(g,z):this.flyTo(g,z)):this}jumpTo(d,g){this.stop();const z=this._getTransformForUpdate();let j=!1,$=!1,ie=!1;return"zoom"in d&&z.zoom!==+d.zoom&&(j=!0,z.zoom=+d.zoom),d.center!==void 0&&(z.center=i.N.convert(d.center)),"bearing"in d&&z.bearing!==+d.bearing&&($=!0,z.bearing=+d.bearing),"pitch"in d&&z.pitch!==+d.pitch&&(ie=!0,z.pitch=+d.pitch),d.padding==null||z.isPaddingEqual(d.padding)||(z.padding=d.padding),this._applyUpdatedTransform(z),this.fire(new i.k("movestart",g)).fire(new i.k("move",g)),j&&this.fire(new i.k("zoomstart",g)).fire(new i.k("zoom",g)).fire(new i.k("zoomend",g)),$&&this.fire(new i.k("rotatestart",g)).fire(new i.k("rotate",g)).fire(new i.k("rotateend",g)),ie&&this.fire(new i.k("pitchstart",g)).fire(new i.k("pitch",g)).fire(new i.k("pitchend",g)),this.fire(new i.k("moveend",g))}calculateCameraOptionsFromTo(d,g,z,j=0){const $=i.Z.fromLngLat(d,g),ie=i.Z.fromLngLat(z,j),de=ie.x-$.x,xe=ie.y-$.y,Ae=ie.z-$.z,Re=Math.hypot(de,xe,Ae);if(Re===0)throw new Error("Can't calculate camera options with same From and To");const je=Math.hypot(de,xe),tt=this.transform.scaleZoom(this.transform.cameraToCenterDistance/Re/this.transform.tileSize),lt=180*Math.atan2(de,-xe)/Math.PI;let ft=180*Math.acos(je/Re)/Math.PI;return ft=Ae<0?90-ft:90+ft,{center:ie.toLngLat(),zoom:tt,pitch:ft,bearing:lt}}easeTo(d,g){var z;this._stop(!1,d.easeId),((d=i.e({offset:[0,0],duration:500,easing:i.b9},d)).animate===!1||!d.essential&&v.prefersReducedMotion)&&(d.duration=0);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in d?this._normalizeBearing(d.bearing,ie):ie,Re="pitch"in d?+d.pitch:de,je="padding"in d?d.padding:j.padding,tt=i.P.convert(d.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(d.center||ft),(z=d.zoom)!==null&&z!==void 0?z:$);this._normalizeCenter(yt,j);const kt=j.project(ft),Bt=j.project(yt).sub(kt),At=j.zoomScale(Ct-$);let $t,Kt;d.around&&($t=i.N.convert(d.around),Kt=j.locationPoint($t));const Yt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||Ct!==$,this._rotating=this._rotating||ie!==Ae,this._pitching=this._pitching||Re!==de,this._padding=!j.isPaddingEqual(je),this._easeId=d.easeId,this._prepareEase(g,d.noMoveStart,Yt),this.terrain&&this._prepareElevation(yt),this._ease(pn=>{if(this._zooming&&(j.zoom=i.z.number($,Ct,pn)),this._rotating&&(j.bearing=i.z.number(ie,Ae,pn)),this._pitching&&(j.pitch=i.z.number(de,Re,pn)),this._padding&&(j.interpolatePadding(xe,je,pn),lt=j.centerPoint.add(tt)),this.terrain&&!d.freezeElevation&&this._updateElevation(pn),$t)j.setLocationAtPoint($t,Kt);else{const Tn=j.zoomScale(j.zoom-$),Vn=Ct>$?Math.min(2,At):Math.max(.5,At),jn=Math.pow(Vn,1-pn),$n=j.unproject(kt.add(Bt.mult(pn*jn)).mult(Tn));j.setLocationAtPoint(j.renderWorldCopies?$n.wrap():$n,lt)}this._applyUpdatedTransform(j),this._fireMoveEvents(g)},pn=>{this.terrain&&d.freezeElevation&&this._finalizeElevation(),this._afterEase(g,pn)},d),this}_prepareEase(d,g,z={}){this._moving=!0,g||z.moving||this.fire(new i.k("movestart",d)),this._zooming&&!z.zooming&&this.fire(new i.k("zoomstart",d)),this._rotating&&!z.rotating&&this.fire(new i.k("rotatestart",d)),this._pitching&&!z.pitching&&this.fire(new i.k("pitchstart",d))}_prepareElevation(d){this._elevationCenter=d,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(d){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const g=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(d<1&&g!==this._elevationTarget){const z=this._elevationTarget-this._elevationStart,j=(g-(z*d+this._elevationStart))/(1-d);this._elevationStart+=d*(z-j),this._elevationTarget=g}this.transform.elevation=i.z.number(this._elevationStart,this._elevationTarget,d)}_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(d){const g=d.getCameraPosition(),z=this.terrain.getElevationForLngLatZoom(g.lngLat,d.zoom);if(g.altitude<z){const j=this.calculateCameraOptionsFromTo(g.lngLat,z,d.center,d.elevation);return{pitch:j.pitch,zoom:j.zoom}}return{}}_applyUpdatedTransform(d){const g=[];if(this.terrain&&g.push(j=>this._elevateCameraIfInsideTerrain(j)),this.transformCameraUpdate&&g.push(j=>this.transformCameraUpdate(j)),!g.length)return;const z=d.clone();for(const j of g){const $=z.clone(),{center:ie,zoom:de,pitch:xe,bearing:Ae,elevation:Re}=j($);ie&&($.center=ie),de!==void 0&&($.zoom=de),xe!==void 0&&($.pitch=xe),Ae!==void 0&&($.bearing=Ae),Re!==void 0&&($.elevation=Re),z.apply($)}this.transform.apply(z)}_fireMoveEvents(d){this.fire(new i.k("move",d)),this._zooming&&this.fire(new i.k("zoom",d)),this._rotating&&this.fire(new i.k("rotate",d)),this._pitching&&this.fire(new i.k("pitch",d))}_afterEase(d,g){if(this._easeId&&g&&this._easeId===g)return;delete this._easeId;const z=this._zooming,j=this._rotating,$=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,z&&this.fire(new i.k("zoomend",d)),j&&this.fire(new i.k("rotateend",d)),$&&this.fire(new i.k("pitchend",d)),this.fire(new i.k("moveend",d))}flyTo(d,g){var z;if(!d.essential&&v.prefersReducedMotion){const ur=i.M(d,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ur,g)}this.stop(),d=i.e({offset:[0,0],speed:1.2,curve:1.42,easing:i.b9},d);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in d?this._normalizeBearing(d.bearing,ie):ie,Re="pitch"in d?+d.pitch:de,je="padding"in d?d.padding:j.padding,tt=i.P.convert(d.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(d.center||ft),(z=d.zoom)!==null&&z!==void 0?z:$);this._normalizeCenter(yt,j);const kt=j.zoomScale(Ct-$),Bt=j.project(ft),At=j.project(yt).sub(Bt);let $t=d.curve;const Kt=Math.max(j.width,j.height),Yt=Kt/kt,pn=At.mag();if("minZoom"in d){const ur=i.ad(Math.min(d.minZoom,$,Ct),j.minZoom,j.maxZoom),Pr=Kt/j.zoomScale(ur-$);$t=Math.sqrt(Pr/pn*2)}const Tn=$t*$t;function Vn(ur){const Pr=(Yt*Yt-Kt*Kt+(ur?-1:1)*Tn*Tn*pn*pn)/(2*(ur?Yt:Kt)*Tn*pn);return Math.log(Math.sqrt(Pr*Pr+1)-Pr)}function jn(ur){return(Math.exp(ur)-Math.exp(-ur))/2}function $n(ur){return(Math.exp(ur)+Math.exp(-ur))/2}const er=Vn(!1);let Tr=function(ur){return $n(er)/$n(er+$t*ur)},rr=function(ur){return Kt*(($n(er)*(jn(Pr=er+$t*ur)/$n(Pr))-jn(er))/Tn)/pn;var Pr},Ar=(Vn(!0)-er)/$t;if(Math.abs(pn)<1e-6||!isFinite(Ar)){if(Math.abs(Kt-Yt)<1e-6)return this.easeTo(d,g);const ur=Yt<Kt?-1:1;Ar=Math.abs(Math.log(Yt/Kt))/$t,rr=()=>0,Tr=Pr=>Math.exp(ur*$t*Pr)}if("duration"in d)d.duration=+d.duration;else{const ur="screenSpeed"in d?+d.screenSpeed/$t:+d.speed;d.duration=1e3*Ar/ur}return d.maxDuration&&d.duration>d.maxDuration&&(d.duration=0),this._zooming=!0,this._rotating=ie!==Ae,this._pitching=Re!==de,this._padding=!j.isPaddingEqual(je),this._prepareEase(g,!1),this.terrain&&this._prepareElevation(yt),this._ease(ur=>{const Pr=ur*Ar,br=1/Tr(Pr);j.zoom=ur===1?Ct:$+j.scaleZoom(br),this._rotating&&(j.bearing=i.z.number(ie,Ae,ur)),this._pitching&&(j.pitch=i.z.number(de,Re,ur)),this._padding&&(j.interpolatePadding(xe,je,ur),lt=j.centerPoint.add(tt)),this.terrain&&!d.freezeElevation&&this._updateElevation(ur);const Nr=ur===1?yt:j.unproject(Bt.add(At.mult(rr(Pr))).mult(br));j.setLocationAtPoint(j.renderWorldCopies?Nr.wrap():Nr,lt),this._applyUpdatedTransform(j),this._fireMoveEvents(g)},()=>{this.terrain&&d.freezeElevation&&this._finalizeElevation(),this._afterEase(g)},d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(d,g){var z;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const j=this._onEaseEnd;delete this._onEaseEnd,j.call(this,g)}return d||(z=this.handlers)===null||z===void 0||z.stop(!1),this}_ease(d,g,z){z.animate===!1||z.duration===0?(d(1),g()):(this._easeStart=v.now(),this._easeOptions=z,this._onEaseFrame=d,this._onEaseEnd=g,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(d,g){d=i.b3(d,-180,180);const z=Math.abs(d-g);return Math.abs(d-360-g)<z&&(d-=360),Math.abs(d+360-g)<z&&(d+=360),d}_normalizeCenter(d,g){if(!g.renderWorldCopies||g.lngRange)return;const z=d.lng-g.center.lng;d.lng+=z>180?-360:z<-180?360:0}queryTerrainElevation(d){return this.terrain?this.terrain.getElevationForLngLatZoom(i.N.convert(d),this.transform.tileZoom)-this.transform.elevation:null}}const Us={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class yl{constructor(d=Us){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=g=>{!g||g.sourceDataType!=="metadata"&&g.sourceDataType!=="visibility"&&g.dataType!=="style"&&g.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=d}getDefaultPosition(){return"bottom-right"}onAdd(d){return this._map=d,this._compact=this.options.compact,this._container=o.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=o.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o.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(){o.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(d,g){const z=this._map._getUIString(`AttributionControl.${g}`);d.title=z,d.setAttribute("aria-label",z)}_updateAttributions(){if(!this._map.style)return;let d=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=d.concat(this.options.customAttribution.map(j=>typeof j!="string"?"":j)):typeof this.options.customAttribution=="string"&&d.push(this.options.customAttribution)),this._map.style.stylesheet){const j=this._map.style.stylesheet;this.styleOwner=j.owner,this.styleId=j.id}const g=this._map.style.sourceCaches;for(const j in g){const $=g[j];if($.used||$.usedForTerrain){const ie=$.getSource();ie.attribution&&d.indexOf(ie.attribution)<0&&d.push(ie.attribution)}}d=d.filter(j=>String(j).trim()),d.sort((j,$)=>j.length-$.length),d=d.filter((j,$)=>{for(let ie=$+1;ie<d.length;ie++)if(d[ie].indexOf(j)>=0)return!1;return!0});const z=d.join(" | ");z!==this._attribHTML&&(this._attribHTML=z,d.length?(this._innerContainer.innerHTML=z,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class os{constructor(d={}){this._updateCompact=()=>{const g=this._container.children;if(g.length){const z=g[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&z.classList.add("maplibregl-compact"):z.classList.remove("maplibregl-compact")}},this.options=d}getDefaultPosition(){return"bottom-left"}onAdd(d){this._map=d,this._compact=this.options&&this.options.compact,this._container=o.create("div","maplibregl-ctrl");const g=o.create("a","maplibregl-ctrl-logo");return g.target="_blank",g.rel="noopener nofollow",g.href="https://maplibre.org/",g.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),g.setAttribute("rel","noopener nofollow"),this._container.appendChild(g),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){o.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class rh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(d){const g=++this._id;return this._queue.push({callback:d,id:g,cancelled:!1}),g}remove(d){const g=this._currentlyRunning,z=g?this._queue.concat(g):this._queue;for(const j of z)if(j.id===d)return void(j.cancelled=!0)}run(d=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const g=this._currentlyRunning=this._queue;this._queue=[];for(const z of g)if(!z.cancelled&&(z.callback(d),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var mi=i.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Hs extends i.E{constructor(d){super(),this.sourceCache=d,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,d.usedForTerrain=!0,d.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(d,g){this.sourceCache.update(d,g),this._renderableTilesKeys=[];const z={};for(const j of d.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:g}))z[j.key]=!0,this._renderableTilesKeys.push(j.key),this._tiles[j.key]||(j.posMatrix=new Float64Array(16),i.aQ(j.posMatrix,0,i.X,0,i.X,0,1),this._tiles[j.key]=new we(j,this.tileSize));for(const j in this._tiles)z[j]||delete this._tiles[j]}freeRtt(d){for(const g in this._tiles){const z=this._tiles[g];(!d||z.tileID.equals(d)||z.tileID.isChildOf(d)||d.isChildOf(z.tileID))&&(z.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(d=>this.getTileByID(d))}getTileByID(d){return this._tiles[d]}getTerrainCoords(d){const g={};for(const z of this._renderableTilesKeys){const j=this._tiles[z].tileID;if(j.canonical.equals(d.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16),i.aQ($.posMatrix,0,i.X,0,i.X,0,1),g[z]=$}else if(j.canonical.isChildOf(d.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16);const ie=j.canonical.z-d.canonical.z,de=j.canonical.x-(j.canonical.x>>ie<<ie),xe=j.canonical.y-(j.canonical.y>>ie<<ie),Ae=i.X>>ie;i.aQ($.posMatrix,0,Ae,0,Ae,0,1),i.J($.posMatrix,$.posMatrix,[-de*Ae,-xe*Ae,0]),g[z]=$}else if(d.canonical.isChildOf(j.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16);const ie=d.canonical.z-j.canonical.z,de=d.canonical.x-(d.canonical.x>>ie<<ie),xe=d.canonical.y-(d.canonical.y>>ie<<ie),Ae=i.X>>ie;i.aQ($.posMatrix,0,i.X,0,i.X,0,1),i.J($.posMatrix,$.posMatrix,[de*Ae,xe*Ae,0]),i.K($.posMatrix,$.posMatrix,[1/2**ie,1/2**ie,0]),g[z]=$}}return g}getSourceTile(d,g){const z=this.sourceCache._source;let j=d.overscaledZ-this.deltaZoom;if(j>z.maxzoom&&(j=z.maxzoom),j<z.minzoom)return null;this._sourceTileCache[d.key]||(this._sourceTileCache[d.key]=d.scaledTo(j).key);let $=this.sourceCache.getTileByID(this._sourceTileCache[d.key]);if((!$||!$.dem)&&g)for(;j>=z.minzoom&&(!$||!$.dem);)$=this.sourceCache.getTileByID(d.scaledTo(j--).key);return $}tilesAfterTime(d=Date.now()){return Object.values(this._tiles).filter(g=>g.timeAdded>=d)}}class xa{constructor(d,g,z){this.painter=d,this.sourceCache=new Hs(g),this.options=z,this.exaggeration=typeof z.exaggeration=="number"?z.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(d,g,z,j=i.X){var $;if(!(g>=0&&g<j&&z>=0&&z<j))return 0;const ie=this.getTerrainData(d),de=($=ie.tile)===null||$===void 0?void 0:$.dem;if(!de)return 0;const xe=function(ft,yt,Ct){var kt=yt[0],Bt=yt[1];return ft[0]=Ct[0]*kt+Ct[4]*Bt+Ct[12],ft[1]=Ct[1]*kt+Ct[5]*Bt+Ct[13],ft}([],[g/j*i.X,z/j*i.X],ie.u_terrain_matrix),Ae=[xe[0]*de.dim,xe[1]*de.dim],Re=Math.floor(Ae[0]),je=Math.floor(Ae[1]),tt=Ae[0]-Re,lt=Ae[1]-je;return de.get(Re,je)*(1-tt)*(1-lt)+de.get(Re+1,je)*tt*(1-lt)+de.get(Re,je+1)*(1-tt)*lt+de.get(Re+1,je+1)*tt*lt}getElevationForLngLatZoom(d,g){const{tileID:z,mercatorX:j,mercatorY:$}=this._getOverscaledTileIDFromLngLatZoom(d,g);return this.getElevation(z,j%i.X,$%i.X,i.X)}getElevation(d,g,z,j=i.X){return this.getDEMElevation(d,g,z,j)*this.exaggeration}getTerrainData(d){if(!this._emptyDemTexture){const j=this.painter.context,$=new i.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new D(j,$,j.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new D(j,new i.R({width:1,height:1}),j.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(j.gl.NEAREST,j.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=i.ao([])}const g=this.sourceCache.getSourceTile(d,!0);if(g&&g.dem&&(!g.demTexture||g.needsTerrainPrepare)){const j=this.painter.context;g.demTexture=this.painter.getTileTexture(g.dem.stride),g.demTexture?g.demTexture.update(g.dem.getPixels(),{premultiply:!1}):g.demTexture=new D(j,g.dem.getPixels(),j.gl.RGBA,{premultiply:!1}),g.demTexture.bind(j.gl.NEAREST,j.gl.CLAMP_TO_EDGE),g.needsTerrainPrepare=!1}const z=g&&g+g.tileID.key+d.key;if(z&&!this._demMatrixCache[z]){const j=this.sourceCache.sourceCache._source.maxzoom;let $=d.canonical.z-g.tileID.canonical.z;d.overscaledZ>d.canonical.z&&(d.canonical.z>=j?$=d.canonical.z-j:i.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const ie=d.canonical.x-(d.canonical.x>>$<<$),de=d.canonical.y-(d.canonical.y>>$<<$),xe=i.bb(new Float64Array(16),[1/(i.X<<$),1/(i.X<<$),0]);i.J(xe,xe,[ie*i.X,de*i.X,0]),this._demMatrixCache[d.key]={matrix:xe,coord:d}}return{u_depth:2,u_terrain:3,u_terrain_dim:g&&g.dem&&g.dem.dim||1,u_terrain_matrix:z?this._demMatrixCache[d.key].matrix:this._emptyDemMatrix,u_terrain_unpack:g&&g.dem&&g.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(g&&g.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:g}}getFramebuffer(d){const g=this.painter,z=g.width/devicePixelRatio,j=g.height/devicePixelRatio;return!this._fbo||this._fbo.width===z&&this._fbo.height===j||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new D(g.context,{width:z,height:j,data:null},g.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(g.context.gl.NEAREST,g.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new D(g.context,{width:z,height:j,data:null},g.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(g.context.gl.NEAREST,g.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=g.context.createFramebuffer(z,j,!0,!1),this._fbo.depthAttachment.set(g.context.createRenderbuffer(g.context.gl.DEPTH_COMPONENT16,z,j))),this._fbo.colorAttachment.set(d==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const d=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const g=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let $=0,ie=0;$<this._coordsTextureSize;$++)for(let de=0;de<this._coordsTextureSize;de++,ie+=4)g[ie+0]=255&de,g[ie+1]=255&$,g[ie+2]=de>>8<<4|$>>8,g[ie+3]=0;const z=new i.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(g.buffer)),j=new D(d,z,d.gl.RGBA,{premultiply:!1});return j.bind(d.gl.NEAREST,d.gl.CLAMP_TO_EDGE),this._coordsTexture=j,j}pointCoordinate(d){this.painter.maybeDrawDepthAndCoords(!0);const g=new Uint8Array(4),z=this.painter.context,j=z.gl,$=Math.round(d.x*this.painter.pixelRatio/devicePixelRatio),ie=Math.round(d.y*this.painter.pixelRatio/devicePixelRatio),de=Math.round(this.painter.height/devicePixelRatio);z.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),j.readPixels($,de-ie-1,1,1,j.RGBA,j.UNSIGNED_BYTE,g),z.bindFramebuffer.set(null);const xe=g[0]+(g[2]>>4<<8),Ae=g[1]+((15&g[2])<<8),Re=this.coordsIndex[255-g[3]],je=Re&&this.sourceCache.getTileByID(Re);if(!je)return null;const tt=this._coordsTextureSize,lt=(1<<je.tileID.canonical.z)*tt;return new i.Z((je.tileID.canonical.x*tt+xe)/lt+je.tileID.wrap,(je.tileID.canonical.y*tt+Ae)/lt,this.getElevation(je.tileID,xe,Ae,tt))}depthAtPoint(d){const g=new Uint8Array(4),z=this.painter.context,j=z.gl;return z.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),j.readPixels(d.x,this.painter.height/devicePixelRatio-d.y-1,1,1,j.RGBA,j.UNSIGNED_BYTE,g),z.bindFramebuffer.set(null),(g[0]/16777216+g[1]/65536+g[2]/256+g[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const d=this.painter.context,g=new i.bc,z=new i.aY,j=this.meshSize,$=i.X/j,ie=j*j;for(let je=0;je<=j;je++)for(let tt=0;tt<=j;tt++)g.emplaceBack(tt*$,je*$,0);for(let je=0;je<ie;je+=j+1)for(let tt=0;tt<j;tt++)z.emplaceBack(tt+je,j+tt+je+1,j+tt+je+2),z.emplaceBack(tt+je,j+tt+je+2,tt+je+1);const de=g.length,xe=de+2*(j+1);for(const je of[0,1])for(let tt=0;tt<=j;tt++)for(const lt of[0,1])g.emplaceBack(tt*$,je*i.X,lt);for(let je=0;je<2*j;je+=2)z.emplaceBack(xe+je,xe+je+1,xe+je+3),z.emplaceBack(xe+je,xe+je+3,xe+je+2),z.emplaceBack(de+je,de+je+3,de+je+1),z.emplaceBack(de+je,de+je+2,de+je+3);const Ae=g.length,Re=Ae+2*(j+1);for(const je of[0,1])for(let tt=0;tt<=j;tt++)for(const lt of[0,1])g.emplaceBack(je*i.X,tt*$,lt);for(let je=0;je<2*j;je+=2)z.emplaceBack(Ae+je,Ae+je+1,Ae+je+3),z.emplaceBack(Ae+je,Ae+je+3,Ae+je+2),z.emplaceBack(Re+je,Re+je+3,Re+je+1),z.emplaceBack(Re+je,Re+je+2,Re+je+3);return this._mesh=new Rc(d.createVertexBuffer(g,mi.members),d.createIndexBuffer(z),i.a0.simpleSegment(0,0,g.length,z.length)),this._mesh}getMeshFrameDelta(d){return 2*Math.PI*i.bd/Math.pow(2,d)/5}getMinTileElevationForLngLatZoom(d,g){var z;const{tileID:j}=this._getOverscaledTileIDFromLngLatZoom(d,g);return(z=this.getMinMaxElevation(j).minElevation)!==null&&z!==void 0?z:0}getMinMaxElevation(d){const g=this.getTerrainData(d).tile,z={minElevation:null,maxElevation:null};return g&&g.dem&&(z.minElevation=g.dem.min*this.exaggeration,z.maxElevation=g.dem.max*this.exaggeration),z}_getOverscaledTileIDFromLngLatZoom(d,g){const z=i.Z.fromLngLat(d.wrap()),j=(1<<g)*i.X,$=z.x*j,ie=z.y*j,de=Math.floor($/i.X),xe=Math.floor(ie/i.X);return{tileID:new i.S(g,0,g,de,xe),mercatorX:$,mercatorY:ie}}}class ac{constructor(d,g,z){this._context=d,this._size=g,this._tileSize=z,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const d of this._objects)d.texture.destroy(),d.fbo.destroy()}_createObject(d){const g=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),z=new D(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return z.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),g.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),g.colorAttachment.set(z.texture),{id:d,fbo:g,texture:z,stamp:-1,inUse:!1}}getObjectForId(d){return this._objects[d]}useObject(d){d.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(g=>d.id!==g),this._recentlyUsed.push(d.id)}stampObject(d){d.stamp=++this._stamp}getOrCreateFreeObject(){for(const g of this._recentlyUsed)if(!this._objects[g].inUse)return this._objects[g];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const d=this._createObject(this._objects.length);return this._objects.push(d),d}freeObject(d){d.inUse=!1}freeAllObjects(){for(const d of this._objects)this.freeObject(d)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(d=>!d.inUse)===!1}}const El={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class vu{constructor(d,g){this.painter=d,this.terrain=g,this.pool=new ac(d.context,30,g.sourceCache.tileSize*g.qualityFactor)}destruct(){this.pool.destruct()}getTexture(d){return this.pool.getObjectForId(d.rtt[this._stacks.length-1].id).texture}prepareForRender(d,g){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=d._order.filter(z=>!d._layers[z].isHidden(g)),this._coordsDescendingInv={};for(const z in d.sourceCaches){this._coordsDescendingInv[z]={};const j=d.sourceCaches[z].getVisibleCoordinates();for(const $ of j){const ie=this.terrain.sourceCache.getTerrainCoords($);for(const de in ie)this._coordsDescendingInv[z][de]||(this._coordsDescendingInv[z][de]=[]),this._coordsDescendingInv[z][de].push(ie[de])}}this._coordsDescendingInvStr={};for(const z of d._order){const j=d._layers[z],$=j.source;if(El[j.type]&&!this._coordsDescendingInvStr[$]){this._coordsDescendingInvStr[$]={};for(const ie in this._coordsDescendingInv[$])this._coordsDescendingInvStr[$][ie]=this._coordsDescendingInv[$][ie].map(de=>de.key).sort().join()}}for(const z of this._renderableTiles)for(const j in this._coordsDescendingInvStr){const $=this._coordsDescendingInvStr[j][z.tileID.key];$&&$!==z.rttCoords[j]&&(z.rtt=[])}}renderLayer(d){if(d.isHidden(this.painter.transform.zoom))return!1;const g=d.type,z=this.painter,j=this._renderableLayerIds[this._renderableLayerIds.length-1]===d.id;if(El[g]&&(this._prevType&&El[this._prevType]||this._stacks.push([]),this._prevType=g,this._stacks[this._stacks.length-1].push(d.id),!j))return!0;if(El[this._prevType]||El[g]&&j){this._prevType=g;const $=this._stacks.length-1,ie=this._stacks[$]||[];for(const de of this._renderableTiles){if(this.pool.isFull()&&(Dc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(de),de.rtt[$]){const Ae=this.pool.getObjectForId(de.rtt[$].id);if(Ae.stamp===de.rtt[$].stamp){this.pool.useObject(Ae);continue}}const xe=this.pool.getOrCreateFreeObject();this.pool.useObject(xe),this.pool.stampObject(xe),de.rtt[$]={id:xe.id,stamp:xe.stamp},z.context.bindFramebuffer.set(xe.fbo.framebuffer),z.context.clear({color:i.aN.transparent,stencil:0}),z.currentStencilSource=void 0;for(let Ae=0;Ae<ie.length;Ae++){const Re=z.style._layers[ie[Ae]],je=Re.source?this._coordsDescendingInv[Re.source][de.tileID.key]:[de.tileID];z.context.viewport.set([0,0,xe.fbo.width,xe.fbo.height]),z._renderTileClippingMasks(Re,je),z.renderLayer(z,z.style.sourceCaches[Re.source],Re,je),Re.source&&(de.rttCoords[Re.source]=this._coordsDescendingInvStr[Re.source][de.tileID.key])}}return Dc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),El[g]}return!1}}const gh={"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"},ih=_,Ou={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Us,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:i.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},co=V=>{V.touchstart=V.dragStart,V.touchmoveWindow=V.dragMove,V.touchend=V.dragEnd},Zl={showCompass:!0,showZoom:!0,visualizePitch:!1};class ui{constructor(d,g,z=!1){this.mousedown=ie=>{this.startMouse(i.e({},ie,{ctrlKey:!0,preventDefault:()=>ie.preventDefault()}),o.mousePos(this.element,ie)),o.addEventListener(window,"mousemove",this.mousemove),o.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=ie=>{this.moveMouse(ie,o.mousePos(this.element,ie))},this.mouseup=ie=>{this.mouseRotate.dragEnd(ie),this.mousePitch&&this.mousePitch.dragEnd(ie),this.offTemp()},this.touchstart=ie=>{ie.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=o.touchPos(this.element,ie.targetTouches)[0],this.startTouch(ie,this._startPos),o.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.addEventListener(window,"touchend",this.touchend))},this.touchmove=ie=>{ie.targetTouches.length!==1?this.reset():(this._lastPos=o.touchPos(this.element,ie.targetTouches)[0],this.moveTouch(ie,this._lastPos))},this.touchend=ie=>{ie.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 j=d.dragRotate._mouseRotate.getClickTolerance(),$=d.dragRotate._mousePitch.getClickTolerance();this.element=g,this.mouseRotate=yc({clickTolerance:j,enable:!0}),this.touchRotate=(({enable:ie,clickTolerance:de,bearingDegreesPerPixelMoved:xe=.8})=>{const Ae=new nc;return new xs({clickTolerance:de,move:(Re,je)=>({bearingDelta:(je.x-Re.x)*xe}),moveStateManager:Ae,enable:ie,assignEvents:co})})({clickTolerance:j,enable:!0}),this.map=d,z&&(this.mousePitch=Iu({clickTolerance:$,enable:!0}),this.touchPitch=(({enable:ie,clickTolerance:de,pitchDegreesPerPixelMoved:xe=-.5})=>{const Ae=new nc;return new xs({clickTolerance:de,move:(Re,je)=>({pitchDelta:(je.y-Re.y)*xe}),moveStateManager:Ae,enable:ie,assignEvents:co})})({clickTolerance:$,enable:!0})),o.addEventListener(g,"mousedown",this.mousedown),o.addEventListener(g,"touchstart",this.touchstart,{passive:!1}),o.addEventListener(g,"touchcancel",this.reset)}startMouse(d,g){this.mouseRotate.dragStart(d,g),this.mousePitch&&this.mousePitch.dragStart(d,g),o.disableDrag()}startTouch(d,g){this.touchRotate.dragStart(d,g),this.touchPitch&&this.touchPitch.dragStart(d,g),o.disableDrag()}moveMouse(d,g){const z=this.map,{bearingDelta:j}=this.mouseRotate.dragMove(d,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.mousePitch){const{pitchDelta:$}=this.mousePitch.dragMove(d,g)||{};$&&z.setPitch(z.getPitch()+$)}}moveTouch(d,g){const z=this.map,{bearingDelta:j}=this.touchRotate.dragMove(d,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.touchPitch){const{pitchDelta:$}=this.touchPitch.dragMove(d,g)||{};$&&z.setPitch(z.getPitch()+$)}}off(){const d=this.element;o.removeEventListener(d,"mousedown",this.mousedown),o.removeEventListener(d,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend),o.removeEventListener(d,"touchcancel",this.reset),this.offTemp()}offTemp(){o.enableDrag(),o.removeEventListener(window,"mousemove",this.mousemove),o.removeEventListener(window,"mouseup",this.mouseup),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend)}}let Pi;function al(V,d,g){const z=new i.N(V.lng,V.lat);if(V=new i.N(V.lng,V.lat),d){const j=new i.N(V.lng-360,V.lat),$=new i.N(V.lng+360,V.lat),ie=g.locationPoint(V).distSqr(d);g.locationPoint(j).distSqr(d)<ie?V=j:g.locationPoint($).distSqr(d)<ie&&(V=$)}for(;Math.abs(V.lng-g.center.lng)>180;){const j=g.locationPoint(V);if(j.x>=0&&j.y>=0&&j.x<=g.width&&j.y<=g.height)break;V.lng>g.center.lng?V.lng-=360:V.lng+=360}return V.lng!==z.lng&&g.locationPoint(V).y>g.height/2-g.getHorizon()?V:z}const Xl={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 zu(V,d,g){const z=V.classList;for(const j in Xl)z.remove(`maplibregl-${g}-anchor-${j}`);z.add(`maplibregl-${g}-anchor-${d}`)}class bo extends i.E{constructor(d){if(super(),this._onKeyPress=g=>{const z=g.code,j=g.charCode||g.keyCode;z!=="Space"&&z!=="Enter"&&j!==32&&j!==13||this.togglePopup()},this._onMapClick=g=>{const z=g.originalEvent.target,j=this._element;this._popup&&(z===j||j.contains(z))&&this.togglePopup()},this._update=g=>{var z;if(!this._map)return;const j=this._map.loaded()&&!this._map.isMoving();((g==null?void 0:g.type)==="terrain"||(g==null?void 0:g.type)==="render"&&!j)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies?this._lngLat=al(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(z=this._lngLat)===null||z===void 0?void 0:z.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 $="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?$=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&($=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let ie="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?ie="rotateX(0deg)":this._pitchAlignment==="map"&&(ie=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||g&&g.type!=="moveend"||(this._pos=this._pos.round()),o.setTransform(this._element,`${Xl[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${ie} ${$}`),v.frameAsync(new AbortController).then(()=>{this._updateOpacity(g&&g.type==="moveend")}).catch(()=>{})},this._onMove=g=>{if(!this._isDragging){const z=this._clickTolerance||this._map._clickTolerance;this._isDragging=g.point.dist(this._pointerdownPos)>=z}this._isDragging&&(this._pos=g.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 i.k("dragstart"))),this.fire(new i.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 i.k("dragend")),this._state="inactive"},this._addDragHandler=g=>{this._element.contains(g.originalEvent.target)&&(g.preventDefault(),this._positionDelta=g.point.sub(this._pos).add(this._offset),this._pointerdownPos=g.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=d&&d.anchor||"center",this._color=d&&d.color||"#3FB1CE",this._scale=d&&d.scale||1,this._draggable=d&&d.draggable||!1,this._clickTolerance=d&&d.clickTolerance||0,this._subpixelPositioning=d&&d.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=d&&d.rotation||0,this._rotationAlignment=d&&d.rotationAlignment||"auto",this._pitchAlignment=d&&d.pitchAlignment&&d.pitchAlignment!=="auto"?d.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(d==null?void 0:d.opacity,d==null?void 0:d.opacityWhenCovered),d&&d.element)this._element=d.element,this._offset=i.P.convert(d&&d.offset||[0,0]);else{this._defaultMarker=!0,this._element=o.create("div");const g=o.createNS("http://www.w3.org/2000/svg","svg"),z=41,j=27;g.setAttributeNS(null,"display","block"),g.setAttributeNS(null,"height",`${z}px`),g.setAttributeNS(null,"width",`${j}px`),g.setAttributeNS(null,"viewBox",`0 0 ${j} ${z}`);const $=o.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"stroke","none"),$.setAttributeNS(null,"stroke-width","1"),$.setAttributeNS(null,"fill","none"),$.setAttributeNS(null,"fill-rule","evenodd");const ie=o.createNS("http://www.w3.org/2000/svg","g");ie.setAttributeNS(null,"fill-rule","nonzero");const de=o.createNS("http://www.w3.org/2000/svg","g");de.setAttributeNS(null,"transform","translate(3.0, 29.0)"),de.setAttributeNS(null,"fill","#000000");const xe=[{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 kt of xe){const Bt=o.createNS("http://www.w3.org/2000/svg","ellipse");Bt.setAttributeNS(null,"opacity","0.04"),Bt.setAttributeNS(null,"cx","10.5"),Bt.setAttributeNS(null,"cy","5.80029008"),Bt.setAttributeNS(null,"rx",kt.rx),Bt.setAttributeNS(null,"ry",kt.ry),de.appendChild(Bt)}const Ae=o.createNS("http://www.w3.org/2000/svg","g");Ae.setAttributeNS(null,"fill",this._color);const Re=o.createNS("http://www.w3.org/2000/svg","path");Re.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"),Ae.appendChild(Re);const je=o.createNS("http://www.w3.org/2000/svg","g");je.setAttributeNS(null,"opacity","0.25"),je.setAttributeNS(null,"fill","#000000");const tt=o.createNS("http://www.w3.org/2000/svg","path");tt.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"),je.appendChild(tt);const lt=o.createNS("http://www.w3.org/2000/svg","g");lt.setAttributeNS(null,"transform","translate(6.0, 7.0)"),lt.setAttributeNS(null,"fill","#FFFFFF");const ft=o.createNS("http://www.w3.org/2000/svg","g");ft.setAttributeNS(null,"transform","translate(8.0, 8.0)");const yt=o.createNS("http://www.w3.org/2000/svg","circle");yt.setAttributeNS(null,"fill","#000000"),yt.setAttributeNS(null,"opacity","0.25"),yt.setAttributeNS(null,"cx","5.5"),yt.setAttributeNS(null,"cy","5.5"),yt.setAttributeNS(null,"r","5.4999962");const Ct=o.createNS("http://www.w3.org/2000/svg","circle");Ct.setAttributeNS(null,"fill","#FFFFFF"),Ct.setAttributeNS(null,"cx","5.5"),Ct.setAttributeNS(null,"cy","5.5"),Ct.setAttributeNS(null,"r","5.4999962"),ft.appendChild(yt),ft.appendChild(Ct),ie.appendChild(de),ie.appendChild(Ae),ie.appendChild(je),ie.appendChild(lt),ie.appendChild(ft),g.appendChild(ie),g.setAttributeNS(null,"height",z*this._scale+"px"),g.setAttributeNS(null,"width",j*this._scale+"px"),this._element.appendChild(g),this._offset=i.P.convert(d&&d.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",g=>{g.preventDefault()}),this._element.addEventListener("mousedown",g=>{g.preventDefault()}),zu(this._element,this._anchor,"marker"),d&&d.className)for(const g of d.className.split(" "))this._element.classList.add(g);this._popup=null}addTo(d){return this.remove(),this._map=d,this._element.setAttribute("aria-label",d._getUIString("Marker.Title")),d.getCanvasContainer().appendChild(this._element),d.on("move",this._update),d.on("moveend",this._update),d.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),o.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=i.N.convert(d),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(d){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),d){if(!("offset"in d.options)){const j=Math.abs(13.5)/Math.SQRT2;d.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[j,-1*(24.6+j)],"bottom-right":[-j,-1*(24.6+j)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=d,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(d){return this._subpixelPositioning=d,this}getPopup(){return this._popup}togglePopup(){const d=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:d?(d.isOpen()?d.remove():(d.setLngLat(this._lngLat),d.addTo(this._map)),this):this}_updateOpacity(d=!1){var g,z;if(!(!((g=this._map)===null||g===void 0)&&g.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(d)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const j=this._map,$=j.terrain.depthAtPoint(this._pos),ie=j.terrain.getElevationForLngLatZoom(this._lngLat,j.transform.tileZoom);if(j.transform.lngLatToCameraDepth(this._lngLat,ie)-$<.006)return void(this._element.style.opacity=this._opacity);const de=-this._offset.y/j.transform._pixelPerMeter,xe=Math.sin(j.getPitch()*Math.PI/180)*de,Ae=j.terrain.depthAtPoint(new i.P(this._pos.x,this._pos.y-this._offset.y)),Re=j.transform.lngLatToCameraDepth(this._lngLat,ie+xe)-Ae>.006;!((z=this._popup)===null||z===void 0)&&z.isOpen()&&Re&&this._popup.remove(),this._element.style.opacity=Re?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(d){return this._offset=i.P.convert(d),this._update(),this}addClassName(d){this._element.classList.add(d)}removeClassName(d){this._element.classList.remove(d)}toggleClassName(d){return this._element.classList.toggle(d)}setDraggable(d){return this._draggable=!!d,this._map&&(d?(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(d){return this._rotation=d||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(d){return this._rotationAlignment=d||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(d){return this._pitchAlignment=d&&d!=="auto"?d:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(d,g){return d===void 0&&g===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),d!==void 0&&(this._opacity=d),g!==void 0&&(this._opacityWhenCovered=g),this._map&&this._updateOpacity(!0),this}}const oc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let na=0,bc=!1;class _i extends i.E{constructor(d){super(),this._onSuccess=g=>{if(this._map){if(this._isOutOfMapMaxBounds(g))return this._setErrorState(),this.fire(new i.k("outofmaxbounds",g)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=g,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(g),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(g),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new i.k("geolocate",g)),this._finish()}},this._updateCamera=g=>{const z=new i.N(g.coords.longitude,g.coords.latitude),j=g.coords.accuracy,$=this._map.getBearing(),ie=i.e({bearing:$},this.options.fitBoundsOptions),de=Se.fromLngLat(z,j);this._map.fitBounds(de,ie,{geolocateSource:!0})},this._updateMarker=g=>{if(g){const z=new i.N(g.coords.longitude,g.coords.latitude);this._accuracyCircleMarker.setLngLat(z).addTo(this._map),this._userLocationDotMarker.setLngLat(z).addTo(this._map),this._accuracy=g.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=g=>{if(this._map){if(this.options.trackUserLocation)if(g.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 z=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(g.code===3&&bc)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new i.k("error",g)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",g=>g.preventDefault()),this._geolocateButton=o.create("button","maplibregl-ctrl-geolocate",this._container),o.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=g=>{if(this._map){if(g===!1){i.w("Geolocation support is not available so the GeolocateControl will be disabled.");const z=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z)}else{const z=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new bo({element:this._dotElement}),this._circleElement=o.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new bo({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",z=>{const j=z.originalEvent&&z.originalEvent.type==="resize";z.geolocateSource||this._watchState!=="ACTIVE_LOCK"||j||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new i.k("trackuserlocationend")),this.fire(new i.k("userlocationlostfocus")))})}},this.options=i.e({},oc,d)}onAdd(d){return this._map=d,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return i._(this,arguments,void 0,function*(g=!1){if(Pi!==void 0&&!g)return Pi;if(window.navigator.permissions===void 0)return Pi=!!window.navigator.geolocation,Pi;try{Pi=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Pi=!!window.navigator.geolocation}return Pi})}().then(g=>this._finishSetupUI(g)),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(),o.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,na=0,bc=!1}_isOutOfMapMaxBounds(d){const g=this._map.getMaxBounds(),z=d.coords;return g&&(z.longitude<g.getWest()||z.longitude>g.getEast()||z.latitude<g.getSouth()||z.latitude>g.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 d=this._map.getBounds(),g=d.getSouthEast(),z=d.getNorthEast(),j=g.distanceTo(z),$=this._map._container.clientHeight,ie=Math.ceil(this._accuracy/(j/$)*2);this._circleElement.style.width=`${ie}px`,this._circleElement.style.height=`${ie}px`}trigger(){if(!this._setup)return i.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 i.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":na--,bc=!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 i.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 i.k("trackuserlocationstart")),this.fire(new i.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 d;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),na++,na>1?(d={maximumAge:6e5,timeout:0},bc=!0):(d=this.options.positionOptions,bc=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,d)}}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)}}const gi={maxWidth:100,unit:"metric"};function Ka(V,d,g){const z=g&&g.maxWidth||100,j=V._container.clientHeight/2,$=V.unproject([0,j]),ie=V.unproject([z,j]),de=$.distanceTo(ie);if(g&&g.unit==="imperial"){const xe=3.2808*de;xe>5280?ss(d,z,xe/5280,V._getUIString("ScaleControl.Miles")):ss(d,z,xe,V._getUIString("ScaleControl.Feet"))}else g&&g.unit==="nautical"?ss(d,z,de/1852,V._getUIString("ScaleControl.NauticalMiles")):de>=1e3?ss(d,z,de/1e3,V._getUIString("ScaleControl.Kilometers")):ss(d,z,de,V._getUIString("ScaleControl.Meters"))}function ss(V,d,g,z){const j=function(ie){const de=Math.pow(10,`${Math.floor(ie)}`.length-1);let xe=ie/de;return xe=xe>=10?10:xe>=5?5:xe>=3?3:xe>=2?2:xe>=1?1:function(Ae){const Re=Math.pow(10,Math.ceil(-Math.log(Ae)/Math.LN10));return Math.round(Ae*Re)/Re}(xe),de*xe}(g),$=j/g;V.style.width=d*$+"px",V.innerHTML=`${j}&nbsp;${z}`}class sc extends i.E{constructor(d={}){super(),this._onFullscreenChange=()=>{var g;let z=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((g=z==null?void 0:z.shadowRoot)===null||g===void 0)&&g.fullscreenElement;)z=z.shadowRoot.fullscreenElement;z===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,d&&d.container&&(d.container instanceof HTMLElement?this._container=d.container:i.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(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){o.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const d=this._fullscreenButton=o.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);o.create("span","maplibregl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.title=d}_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 i.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new i.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()}}const ol={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},gt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");class xt extends i.E{constructor(d){super(),this.remove=()=>(this._content&&o.remove(this._content),this._container&&(o.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 i.k("close"))),this),this._onMouseUp=g=>{this._update(g.point)},this._onMouseMove=g=>{this._update(g.point)},this._onDrag=g=>{this._update(g.point)},this._update=g=>{var z;const j=this._lngLat||this._trackPointer;if(!this._map||!j||!this._content)return;if(!this._container){if(this._container=o.create("div","maplibregl-popup",this._map.getContainer()),this._tip=o.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const Ae of this.options.className.split(" "))this._container.classList.add(Ae);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._map.transform.renderWorldCopies&&!this._trackPointer?this._lngLat=al(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(z=this._lngLat)===null||z===void 0?void 0:z.wrap(),this._trackPointer&&!g)return;const $=this._flatPos=this._pos=this._trackPointer&&g?g:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&g?g:this._map.transform.locationPoint(this._lngLat));let ie=this.options.anchor;const de=Pt(this.options.offset);if(!ie){const Ae=this._container.offsetWidth,Re=this._container.offsetHeight;let je;je=$.y+de.bottom.y<Re?["top"]:$.y>this._map.transform.height-Re?["bottom"]:[],$.x<Ae/2?je.push("left"):$.x>this._map.transform.width-Ae/2&&je.push("right"),ie=je.length===0?"bottom":je.join("-")}let xe=$.add(de[ie]);this.options.subpixelPositioning||(xe=xe.round()),o.setTransform(this._container,`${Xl[ie]} translate(${xe.x}px,${xe.y}px)`),zu(this._container,ie,"popup")},this._onClose=()=>{this.remove()},this.options=i.e(Object.create(ol),d)}addTo(d){return this._map&&this.remove(),this._map=d,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 i.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=i.N.convert(d),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(d){return this.setDOMContent(document.createTextNode(d))}setHTML(d){const g=document.createDocumentFragment(),z=document.createElement("body");let j;for(z.innerHTML=d;j=z.firstChild,j;)g.appendChild(j);return this.setDOMContent(g)}getMaxWidth(){var d;return(d=this._container)===null||d===void 0?void 0:d.style.maxWidth}setMaxWidth(d){return this.options.maxWidth=d,this._update(),this}setDOMContent(d){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=o.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(d),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(d){return this._container&&this._container.classList.add(d),this}removeClassName(d){return this._container&&this._container.classList.remove(d),this}setOffset(d){return this.options.offset=d,this._update(),this}toggleClassName(d){if(this._container)return this._container.classList.toggle(d)}setSubpixelPositioning(d){this.options.subpixelPositioning=d}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const d=this._container.querySelector(gt);d&&d.focus()}}function Pt(V){if(V){if(typeof V=="number"){const d=Math.round(Math.abs(V)/Math.SQRT2);return{center:new i.P(0,0),top:new i.P(0,V),"top-left":new i.P(d,d),"top-right":new i.P(-d,d),bottom:new i.P(0,-V),"bottom-left":new i.P(d,-d),"bottom-right":new i.P(-d,-d),left:new i.P(V,0),right:new i.P(-V,0)}}if(V instanceof i.P||Array.isArray(V)){const d=i.P.convert(V);return{center:d,top:d,"top-left":d,"top-right":d,bottom:d,"bottom-left":d,"bottom-right":d,left:d,right:d}}return{center:i.P.convert(V.center||[0,0]),top:i.P.convert(V.top||[0,0]),"top-left":i.P.convert(V["top-left"]||[0,0]),"top-right":i.P.convert(V["top-right"]||[0,0]),bottom:i.P.convert(V.bottom||[0,0]),"bottom-left":i.P.convert(V["bottom-left"]||[0,0]),"bottom-right":i.P.convert(V["bottom-right"]||[0,0]),left:i.P.convert(V.left||[0,0]),right:i.P.convert(V.right||[0,0])}}return Pt(new i.P(0,0))}const te=_;u.AJAXError=i.bg,u.Evented=i.E,u.LngLat=i.N,u.MercatorCoordinate=i.Z,u.Point=i.P,u.addProtocol=i.bh,u.config=i.a,u.removeProtocol=i.bi,u.AttributionControl=yl,u.BoxZoomHandler=bs,u.CanvasSource=Me,u.CooperativeGesturesHandler=Ml,u.DoubleClickZoomHandler=ao,u.DragPanHandler=$l,u.DragRotateHandler=js,u.EdgeInsets=tc,u.FullscreenControl=sc,u.GeoJSONSource=Ee,u.GeolocateControl=_i,u.Hash=Go,u.ImageSource=Le,u.KeyboardHandler=Bc,u.LngLatBounds=Se,u.LogoControl=os,u.Map=class extends Yo{constructor(V){i.be.mark(i.bf.create);const d=Object.assign(Object.assign({},Ou),V);if(d.minZoom!=null&&d.maxZoom!=null&&d.minZoom>d.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(d.minPitch!=null&&d.maxPitch!=null&&d.minPitch>d.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(d.minPitch!=null&&d.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(d.maxPitch!=null&&d.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ia(d.minZoom,d.maxZoom,d.minPitch,d.maxPitch,d.renderWorldCopies),{bearingSnap:d.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new rh,this._controls=[],this._mapId=i.a4(),this._contextLost=z=>{z.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new i.k("webglcontextlost",{originalEvent:z}))},this._contextRestored=z=>{this._setupPainter(),this.resize(),this._update(),this.fire(new i.k("webglcontextrestored",{originalEvent:z}))},this._onMapScroll=z=>{if(z.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=d.interactive,this._maxTileCacheSize=d.maxTileCacheSize,this._maxTileCacheZoomLevels=d.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=d.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=d.preserveDrawingBuffer===!0,this._antialias=d.antialias===!0,this._trackResize=d.trackResize===!0,this._bearingSnap=d.bearingSnap,this._refreshExpiredTiles=d.refreshExpiredTiles===!0,this._fadeDuration=d.fadeDuration,this._crossSourceCollisions=d.crossSourceCollisions===!0,this._collectResourceTiming=d.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},gh),d.locale),this._clickTolerance=d.clickTolerance,this._overridePixelRatio=d.pixelRatio,this._maxCanvasSize=d.maxCanvasSize,this.transformCameraUpdate=d.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=d.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=S.addThrottleControl(()=>this.isMoving()),this._requestManager=new C(d.transformRequest),typeof d.container=="string"){if(this._container=document.getElementById(d.container),!this._container)throw new Error(`Container '${d.container}' not found.`)}else{if(!(d.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=d.container}if(d.maxBounds&&this.setMaxBounds(d.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 z=!1;const j=gu($=>{this._trackResize&&!this._removed&&this.resize($)._update()},50);this._resizeObserver=new ResizeObserver($=>{z?j($):z=!0}),this._resizeObserver.observe(this._container)}this.handlers=new ba(this,d);const g=typeof d.hash=="string"&&d.hash||void 0;this._hash=d.hash&&new Go(g).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch}),d.bounds&&(this.resize(),this.fitBounds(d.bounds,i.e({},d.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=d.localIdeographFontFamily,this._validateStyle=d.validateStyle,d.style&&this.setStyle(d.style,{localIdeographFontFamily:d.localIdeographFontFamily}),d.attributionControl&&this.addControl(new yl(typeof d.attributionControl=="boolean"?void 0:d.attributionControl)),d.maplibreLogo&&this.addControl(new os,d.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",z=>{this._update(z.dataType==="style"),this.fire(new i.k(`${z.dataType}data`,z))}),this.on("dataloading",z=>{this.fire(new i.k(`${z.dataType}dataloading`,z))}),this.on("dataabort",z=>{this.fire(new i.k("sourcedataabort",z))})}_getMapId(){return this._mapId}addControl(V,d){if(d===void 0&&(d=V.getDefaultPosition?V.getDefaultPosition():"top-right"),!V||!V.onAdd)return this.fire(new i.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const g=V.onAdd(this);this._controls.push(V);const z=this._controlPositions[d];return d.indexOf("bottom")!==-1?z.insertBefore(g,z.firstChild):z.appendChild(g),this}removeControl(V){if(!V||!V.onRemove)return this.fire(new i.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const d=this._controls.indexOf(V);return d>-1&&this._controls.splice(d,1),V.onRemove(this),this}hasControl(V){return this._controls.indexOf(V)>-1}calculateCameraOptionsFromTo(V,d,g,z){return z==null&&this.terrain&&(z=this.terrain.getElevationForLngLatZoom(g,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(V,d,g,z)}resize(V){var d;const g=this._containerDimensions(),z=g[0],j=g[1],$=this._getClampedPixelRatio(z,j);if(this._resizeCanvas(z,j,$),this.painter.resize(z,j,$),this.painter.overLimit()){const de=this.painter.context.gl;this._maxCanvasSize=[de.drawingBufferWidth,de.drawingBufferHeight];const xe=this._getClampedPixelRatio(z,j);this._resizeCanvas(z,j,xe),this.painter.resize(z,j,xe)}this.transform.resize(z,j),(d=this._requestedCameraState)===null||d===void 0||d.resize(z,j);const ie=!this._moving;return ie&&(this.stop(),this.fire(new i.k("movestart",V)).fire(new i.k("move",V))),this.fire(new i.k("resize",V)),ie&&this.fire(new i.k("moveend",V)),this}_getClampedPixelRatio(V,d){const{0:g,1:z}=this._maxCanvasSize,j=this.getPixelRatio(),$=V*j,ie=d*j,de=$>g?g/$:1,xe=ie>z?z/ie:1;return Math.min(de,xe)*j}getPixelRatio(){var V;return(V=this._overridePixelRatio)!==null&&V!==void 0?V:devicePixelRatio}setPixelRatio(V){this._overridePixelRatio=V,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(V){return this.transform.setMaxBounds(Se.convert(V)),this._update()}setMinZoom(V){if((V=V??-2)>=-2&&V<=this.transform.maxZoom)return this.transform.minZoom=V,this._update(),this.getZoom()<V&&this.setZoom(V),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(V){if((V=V??22)>=this.transform.minZoom)return this.transform.maxZoom=V,this._update(),this.getZoom()>V&&this.setZoom(V),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(V){if((V=V??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(V>=0&&V<=this.transform.maxPitch)return this.transform.minPitch=V,this._update(),this.getPitch()<V&&this.setPitch(V),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(V){if((V=V??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(V>=this.transform.minPitch)return this.transform.maxPitch=V,this._update(),this.getPitch()>V&&this.setPitch(V),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(V){return this.transform.renderWorldCopies=V,this._update()}project(V){return this.transform.locationPoint(i.N.convert(V),this.style&&this.terrain)}unproject(V){return this.transform.pointLocation(i.P.convert(V),this.terrain)}isMoving(){var V;return this._moving||((V=this.handlers)===null||V===void 0?void 0:V.isMoving())}isZooming(){var V;return this._zooming||((V=this.handlers)===null||V===void 0?void 0:V.isZooming())}isRotating(){var V;return this._rotating||((V=this.handlers)===null||V===void 0?void 0:V.isRotating())}_createDelegatedListener(V,d,g){if(V==="mouseenter"||V==="mouseover"){let z=!1;return{layer:d,listener:g,delegates:{mousemove:$=>{const ie=this.getLayer(d)?this.queryRenderedFeatures($.point,{layers:[d]}):[];ie.length?z||(z=!0,g.call(this,new Ds(V,this,$.originalEvent,{features:ie}))):z=!1},mouseout:()=>{z=!1}}}}if(V==="mouseleave"||V==="mouseout"){let z=!1;return{layer:d,listener:g,delegates:{mousemove:ie=>{(this.getLayer(d)?this.queryRenderedFeatures(ie.point,{layers:[d]}):[]).length?z=!0:z&&(z=!1,g.call(this,new Ds(V,this,ie.originalEvent)))},mouseout:ie=>{z&&(z=!1,g.call(this,new Ds(V,this,ie.originalEvent)))}}}}{const z=j=>{const $=this.getLayer(d)?this.queryRenderedFeatures(j.point,{layers:[d]}):[];$.length&&(j.features=$,g.call(this,j),delete j.features)};return{layer:d,listener:g,delegates:{[V]:z}}}}on(V,d,g){if(g===void 0)return super.on(V,d);const z=this._createDelegatedListener(V,d,g);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[V]=this._delegatedListeners[V]||[],this._delegatedListeners[V].push(z);for(const j in z.delegates)this.on(j,z.delegates[j]);return this}once(V,d,g){if(g===void 0)return super.once(V,d);const z=this._createDelegatedListener(V,d,g);for(const j in z.delegates)this.once(j,z.delegates[j]);return this}off(V,d,g){return g===void 0?super.off(V,d):(this._delegatedListeners&&this._delegatedListeners[V]&&(z=>{const j=z[V];for(let $=0;$<j.length;$++){const ie=j[$];if(ie.layer===d&&ie.listener===g){for(const de in ie.delegates)this.off(de,ie.delegates[de]);return j.splice($,1),this}}})(this._delegatedListeners),this)}queryRenderedFeatures(V,d){if(!this.style)return[];let g;const z=V instanceof i.P||Array.isArray(V),j=z?V:[[0,0],[this.transform.width,this.transform.height]];if(d=d||(z?{}:V)||{},j instanceof i.P||typeof j[0]=="number")g=[i.P.convert(j)];else{const $=i.P.convert(j[0]),ie=i.P.convert(j[1]);g=[$,new i.P(ie.x,$.y),ie,new i.P($.x,ie.y),$]}return this.style.queryRenderedFeatures(g,d,this.transform)}querySourceFeatures(V,d){return this.style.querySourceFeatures(V,d)}setStyle(V,d){return(d=i.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},d)).diff!==!1&&d.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&V?(this._diffStyle(V,d),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._updateStyle(V,d))}setTransformRequest(V){return this._requestManager.setTransformRequest(V),this}_getUIString(V){const d=this._locale[V];if(d==null)throw new Error(`Missing UI string '${V}'`);return d}_updateStyle(V,d){if(d.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(V,d));const g=this.style&&d.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!V)),V?(this.style=new Jr(this,d||{}),this.style.setEventedParent(this,{style:this.style}),typeof V=="string"?this.style.loadURL(V,d,g):this.style.loadJSON(V,d,g),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Jr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(V,d){if(typeof V=="string"){const g=V,z=this._requestManager.transformRequest(g,"Style");i.h(z,new AbortController).then(j=>{this._updateDiff(j.data,d)}).catch(j=>{j&&this.fire(new i.j(j))})}else typeof V=="object"&&this._updateDiff(V,d)}_updateDiff(V,d){try{this.style.setState(V,d)&&this._update(!0)}catch(g){i.w(`Unable to perform style diff: ${g.message||g.error||g}. Rebuilding the style from scratch.`),this._updateStyle(V,d)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():i.w("There is no style added to the map.")}addSource(V,d){return this._lazyInitEmptyStyle(),this.style.addSource(V,d),this._update(!0)}isSourceLoaded(V){const d=this.style&&this.style.sourceCaches[V];if(d!==void 0)return d.loaded();this.fire(new i.j(new Error(`There is no source with ID '${V}'`)))}setTerrain(V){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),V){const d=this.style.sourceCaches[V.source];if(!d)throw new Error(`cannot load terrain, because there exists no source with ID: ${V.source}`);this.terrain===null&&d.reload();for(const g in this.style._layers){const z=this.style._layers[g];z.type==="hillshade"&&z.source===V.source&&i.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 xa(this.painter,d,V),this.painter.renderToTexture=new vu(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=g=>{g.dataType==="style"?this.terrain.sourceCache.freeRtt():g.dataType==="source"&&g.tile&&(g.sourceId!==V.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(g.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 i.k("terrain",{terrain:V})),this}getTerrain(){var V,d;return(d=(V=this.terrain)===null||V===void 0?void 0:V.options)!==null&&d!==void 0?d:null}areTilesLoaded(){const V=this.style&&this.style.sourceCaches;for(const d in V){const g=V[d]._tiles;for(const z in g){const j=g[z];if(j.state!=="loaded"&&j.state!=="errored")return!1}}return!0}removeSource(V){return this.style.removeSource(V),this._update(!0)}getSource(V){return this.style.getSource(V)}addImage(V,d,g={}){const{pixelRatio:z=1,sdf:j=!1,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae}=g;if(this._lazyInitEmptyStyle(),!(d instanceof HTMLImageElement||i.b(d))){if(d.width===void 0||d.height===void 0)return this.fire(new i.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:Re,height:je,data:tt}=d,lt=d;return this.style.addImage(V,{data:new i.R({width:Re,height:je},new Uint8Array(tt)),pixelRatio:z,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae,sdf:j,version:0,userImage:lt}),lt.onAdd&&lt.onAdd(this,V),this}}{const{width:Re,height:je,data:tt}=v.getImageData(d);this.style.addImage(V,{data:new i.R({width:Re,height:je},tt),pixelRatio:z,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae,sdf:j,version:0})}}updateImage(V,d){const g=this.style.getImage(V);if(!g)return this.fire(new i.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const z=d instanceof HTMLImageElement||i.b(d)?v.getImageData(d):d,{width:j,height:$,data:ie}=z;if(j===void 0||$===void 0)return this.fire(new i.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(j!==g.data.width||$!==g.data.height)return this.fire(new i.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const de=!(d instanceof HTMLImageElement||i.b(d));return g.data.replace(ie,de),this.style.updateImage(V,g),this}getImage(V){return this.style.getImage(V)}hasImage(V){return V?!!this.style.getImage(V):(this.fire(new i.j(new Error("Missing required image id"))),!1)}removeImage(V){this.style.removeImage(V)}loadImage(V){return S.getImage(this._requestManager.transformRequest(V,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(V,d){return this._lazyInitEmptyStyle(),this.style.addLayer(V,d),this._update(!0)}moveLayer(V,d){return this.style.moveLayer(V,d),this._update(!0)}removeLayer(V){return this.style.removeLayer(V),this._update(!0)}getLayer(V){return this.style.getLayer(V)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(V,d,g){return this.style.setLayerZoomRange(V,d,g),this._update(!0)}setFilter(V,d,g={}){return this.style.setFilter(V,d,g),this._update(!0)}getFilter(V){return this.style.getFilter(V)}setPaintProperty(V,d,g,z={}){return this.style.setPaintProperty(V,d,g,z),this._update(!0)}getPaintProperty(V,d){return this.style.getPaintProperty(V,d)}setLayoutProperty(V,d,g,z={}){return this.style.setLayoutProperty(V,d,g,z),this._update(!0)}getLayoutProperty(V,d){return this.style.getLayoutProperty(V,d)}setGlyphs(V,d={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(V,d),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(V,d,g={}){return this._lazyInitEmptyStyle(),this.style.addSprite(V,d,g,z=>{z||this._update(!0)}),this}removeSprite(V){return this._lazyInitEmptyStyle(),this.style.removeSprite(V),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(V,d={}){return this._lazyInitEmptyStyle(),this.style.setSprite(V,d,g=>{g||this._update(!0)}),this}setLight(V,d={}){return this._lazyInitEmptyStyle(),this.style.setLight(V,d),this._update(!0)}getLight(){return this.style.getLight()}setSky(V){return this._lazyInitEmptyStyle(),this.style.setSky(V),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(V,d){return this.style.setFeatureState(V,d),this._update()}removeFeatureState(V,d){return this.style.removeFeatureState(V,d),this._update()}getFeatureState(V){return this.style.getFeatureState(V)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let V=0,d=0;return this._container&&(V=this._container.clientWidth||400,d=this._container.clientHeight||300),[V,d]}_setupContainer(){const V=this._container;V.classList.add("maplibregl-map");const d=this._canvasContainer=o.create("div","maplibregl-canvas-container",V);this._interactive&&d.classList.add("maplibregl-interactive"),this._canvas=o.create("canvas","maplibregl-canvas",d),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 g=this._containerDimensions(),z=this._getClampedPixelRatio(g[0],g[1]);this._resizeCanvas(g[0],g[1],z);const j=this._controlContainer=o.create("div","maplibregl-control-container",V),$=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(ie=>{$[ie]=o.create("div",`maplibregl-ctrl-${ie} `,j)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(V,d,g){this._canvas.width=Math.floor(g*V),this._canvas.height=Math.floor(g*d),this._canvas.style.width=`${V}px`,this._canvas.style.height=`${d}px`}_setupPainter(){const V={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let d=null;this._canvas.addEventListener("webglcontextcreationerror",z=>{d={requestedAttributes:V},z&&(d.statusMessage=z.statusMessage,d.type=z.type)},{once:!0});const g=this._canvas.getContext("webgl2",V)||this._canvas.getContext("webgl",V);if(!g){const z="Failed to initialize WebGL";throw d?(d.message=z,new Error(JSON.stringify(d))):new Error(z)}this.painter=new Oc(g,this.transform),a.testSupport(g)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(V){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||V,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(V){return this._update(),this._renderTaskQueue.add(V)}_cancelRenderFrame(V){this._renderTaskQueue.remove(V)}_render(V){const d=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(V),this._removed)return;let g=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const j=this.transform.zoom,$=v.now();this.style.zoomHistory.update(j,$);const ie=new i.a9(j,{now:$,fadeDuration:d,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),de=ie.crossFadingFactor();de===1&&de===this._crossFadingFactor||(g=!0,this._crossFadingFactor=de),this.style.update(ie)}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,d,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:d,showPadding:this.showPadding}),this.fire(new i.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,i.be.mark(i.bf.load),this.fire(new i.k("load"))),this.style&&(this.style.hasTransitions()||g)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const z=this._sourcesDirty||this._styleDirty||this._placementDirty;return z||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new i.k("idle")),!this._loaded||this._fullyLoaded||z||(this._fullyLoaded=!0,i.be.mark(i.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var V;this._hash&&this._hash.remove();for(const g of this._controls)g.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),S.removeThrottleControl(this._imageQueueHandle),(V=this._resizeObserver)===null||V===void 0||V.disconnect();const d=this.painter.context.gl.getExtension("WEBGL_lose_context");d!=null&&d.loseContext&&d.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),o.remove(this._canvasContainer),o.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),i.be.clearMetrics(),this._removed=!0,this.fire(new i.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,v.frameAsync(this._frameRequest).then(V=>{i.be.frame(V),this._frameRequest=null,this._render(V)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(V){this._showTileBoundaries!==V&&(this._showTileBoundaries=V,this._update())}get showPadding(){return!!this._showPadding}set showPadding(V){this._showPadding!==V&&(this._showPadding=V,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(V){this._showCollisionBoxes!==V&&(this._showCollisionBoxes=V,V?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(V){this._showOverdrawInspector!==V&&(this._showOverdrawInspector=V,this._update())}get repaint(){return!!this._repaint}set repaint(V){this._repaint!==V&&(this._repaint=V,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(V){this._vertices=V,this._update()}get version(){return ih}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Ds,u.MapTouchEvent=ys,u.MapWheelEvent=Mu,u.Marker=bo,u.NavigationControl=class{constructor(V){this._updateZoomButtons=()=>{const d=this._map.getZoom(),g=d===this._map.getMaxZoom(),z=d===this._map.getMinZoom();this._zoomInButton.disabled=g,this._zoomOutButton.disabled=z,this._zoomInButton.setAttribute("aria-disabled",g.toString()),this._zoomOutButton.setAttribute("aria-disabled",z.toString())},this._rotateCompassArrow=()=>{const d=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=d},this._setButtonTitle=(d,g)=>{const z=this._map._getUIString(`NavigationControl.${g}`);d.title=z,d.setAttribute("aria-label",z)},this.options=i.e({},Zl,V),this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",d=>d.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",d=>this._map.zoomIn({},{originalEvent:d})),o.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",d=>this._map.zoomOut({},{originalEvent:d})),o.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",d=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:d}):this._map.resetNorth({},{originalEvent:d})}),this._compassIcon=o.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(V){return this._map=V,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 ui(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){o.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(V,d){const g=o.create("button",V,this._container);return g.type="button",g.addEventListener("click",d),g}},u.Popup=xt,u.RasterDEMTileSource=He,u.RasterTileSource=Pe,u.ScaleControl=class{constructor(V){this._onMove=()=>{Ka(this._map,this._container,this.options)},this.setUnit=d=>{this.options.unit=d,Ka(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},gi),V)}getDefaultPosition(){return"bottom-left"}onAdd(V){return this._map=V,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-scale",V.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){o.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},u.ScrollZoomHandler=Pu,u.Style=Jr,u.TerrainControl=class{constructor(V){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=V}onAdd(V){return this._map=V,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=o.create("button","maplibregl-ctrl-terrain",this._container),o.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(){o.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},u.TwoFingersTouchPitchHandler=rc,u.TwoFingersTouchRotateHandler=zh,u.TwoFingersTouchZoomHandler=ki,u.TwoFingersTouchZoomRotateHandler=Ru,u.VectorTileSource=Ie,u.VideoSource=ve,u.addSourceType=(V,d)=>i._(void 0,void 0,void 0,function*(){if(Ue(V))throw new Error(`A source type called "${V}" already exists.`);((g,z)=>{ke[g]=z})(V,d)}),u.clearPrewarmedResources=function(){const V=fe;V&&(V.isPreloaded()&&V.numActive()===1?(V.release(ce),fe=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()"))},u.getMaxParallelImageRequests=function(){return i.a.MAX_PARALLEL_IMAGE_REQUESTS},u.getRTLTextPluginStatus=function(){return Xe().getRTLTextPluginStatus()},u.getVersion=function(){return te},u.getWorkerCount=function(){return he.workerCount},u.getWorkerUrl=function(){return i.a.WORKER_URL},u.importScriptInWorkers=function(V){return pe().broadcast("IS",V)},u.prewarm=function(){oe().acquire(ce)},u.setMaxParallelImageRequests=function(V){i.a.MAX_PARALLEL_IMAGE_REQUESTS=V},u.setRTLTextPlugin=function(V,d){return Xe().setRTLTextPlugin(V,d)},u.setWorkerCount=function(V){he.workerCount=V},u.setWorkerUrl=function(V){i.a.WORKER_URL=V}}),f}()},88640:function(p,f,n){function s(be,_e,Se){be.prototype=_e.prototype=Se,Se.constructor=be}function u(be,_e){var Se=Object.create(be.prototype);for(var Ce in _e)Se[Ce]=_e[Ce];return Se}function i(){}n.d(f,{GW:function(){return me},Dj:function(){return he}});var _=.7,b=1/_,w="\\s*([+-]?\\d+)\\s*",v="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",o="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",a=/^#([0-9a-f]{3,8})$/,h=new RegExp("^rgb\\(".concat(w,",").concat(w,",").concat(w,"\\)$")),l=new RegExp("^rgb\\(".concat(o,",").concat(o,",").concat(o,"\\)$")),m=new RegExp("^rgba\\(".concat(w,",").concat(w,",").concat(w,",").concat(v,"\\)$")),y=new RegExp("^rgba\\(".concat(o,",").concat(o,",").concat(o,",").concat(v,"\\)$")),x=new RegExp("^hsl\\(".concat(v,",").concat(o,",").concat(o,"\\)$")),S=new RegExp("^hsla\\(".concat(v,",").concat(o,",").concat(o,",").concat(v,"\\)$")),C={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function A(){return this.rgb().formatHex()}function E(){return this.rgb().formatRgb()}function P(be){var _e,Se;return be=(be+"").trim().toLowerCase(),(_e=a.exec(be))?(Se=_e[1].length,_e=parseInt(_e[1],16),Se===6?M(_e):Se===3?new T(_e>>8&15|_e>>4&240,_e>>4&15|240&_e,(15&_e)<<4|15&_e,1):Se===8?L(_e>>24&255,_e>>16&255,_e>>8&255,(255&_e)/255):Se===4?L(_e>>12&15|_e>>8&240,_e>>8&15|_e>>4&240,_e>>4&15|240&_e,((15&_e)<<4|15&_e)/255):null):(_e=h.exec(be))?new T(_e[1],_e[2],_e[3],1):(_e=l.exec(be))?new T(255*_e[1]/100,255*_e[2]/100,255*_e[3]/100,1):(_e=m.exec(be))?L(_e[1],_e[2],_e[3],_e[4]):(_e=y.exec(be))?L(255*_e[1]/100,255*_e[2]/100,255*_e[3]/100,_e[4]):(_e=x.exec(be))?U(_e[1],_e[2]/100,_e[3]/100,1):(_e=S.exec(be))?U(_e[1],_e[2]/100,_e[3]/100,_e[4]):C.hasOwnProperty(be)?M(C[be]):be==="transparent"?new T(NaN,NaN,NaN,0):null}function M(be){return new T(be>>16&255,be>>8&255,255&be,1)}function L(be,_e,Se,Ce){return Ce<=0&&(be=_e=Se=NaN),new T(be,_e,Se,Ce)}function I(be,_e,Se,Ce){return arguments.length===1?((Ie=be)instanceof i||(Ie=P(Ie)),Ie?new T((Ie=Ie.rgb()).r,Ie.g,Ie.b,Ie.opacity):new T):new T(be,_e,Se,Ce??1);var Ie}function T(be,_e,Se,Ce){this.r=+be,this.g=+_e,this.b=+Se,this.opacity=+Ce}function D(){return"#".concat(N(this.r)).concat(N(this.g)).concat(N(this.b))}function k(){var be=O(this.opacity);return"".concat(be===1?"rgb(":"rgba(").concat(F(this.r),", ").concat(F(this.g),", ").concat(F(this.b)).concat(be===1?")":", ".concat(be,")"))}function O(be){return isNaN(be)?1:Math.max(0,Math.min(1,be))}function F(be){return Math.max(0,Math.min(255,Math.round(be)||0))}function N(be){return((be=F(be))<16?"0":"")+be.toString(16)}function U(be,_e,Se,Ce){return Ce<=0?be=_e=Se=NaN:Se<=0||Se>=1?be=_e=NaN:_e<=0&&(be=NaN),new H(be,_e,Se,Ce)}function W(be){if(be instanceof H)return new H(be.h,be.s,be.l,be.opacity);if(be instanceof i||(be=P(be)),!be)return new H;if(be instanceof H)return be;var _e=(be=be.rgb()).r/255,Se=be.g/255,Ce=be.b/255,Ie=Math.min(_e,Se,Ce),Pe=Math.max(_e,Se,Ce),He=NaN,Ee=Pe-Ie,Fe=(Pe+Ie)/2;return Ee?(He=_e===Pe?(Se-Ce)/Ee+6*(Se<Ce):Se===Pe?(Ce-_e)/Ee+2:(_e-Se)/Ee+4,Ee/=Fe<.5?Pe+Ie:2-Pe-Ie,He*=60):Ee=Fe>0&&Fe<1?0:He,new H(He,Ee,Fe,be.opacity)}function H(be,_e,Se,Ce){this.h=+be,this.s=+_e,this.l=+Se,this.opacity=+Ce}function Z(be){return(be=(be||0)%360)<0?be+360:be}function ee(be){return Math.max(0,Math.min(1,be||0))}function G(be,_e,Se){return 255*(be<60?_e+(Se-_e)*be/60:be<180?Se:be<240?_e+(Se-_e)*(240-be)/60:_e)}s(i,P,{copy:function(be){return Object.assign(new this.constructor,this,be)},displayable:function(){return this.rgb().displayable()},hex:A,formatHex:A,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return W(this).formatHsl()},formatRgb:E,toString:E}),s(T,I,u(i,{brighter:function(be){return be=be==null?b:Math.pow(b,be),new T(this.r*be,this.g*be,this.b*be,this.opacity)},darker:function(be){return be=be==null?_:Math.pow(_,be),new T(this.r*be,this.g*be,this.b*be,this.opacity)},rgb:function(){return this},clamp:function(){return new T(F(this.r),F(this.g),F(this.b),O(this.opacity))},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:D,formatHex:D,formatHex8:function(){return"#".concat(N(this.r)).concat(N(this.g)).concat(N(this.b)).concat(N(255*(isNaN(this.opacity)?1:this.opacity)))},formatRgb:k,toString:k})),s(H,function(be,_e,Se,Ce){return arguments.length===1?W(be):new H(be,_e,Se,Ce??1)},u(i,{brighter:function(be){return be=be==null?b:Math.pow(b,be),new H(this.h,this.s,this.l*be,this.opacity)},darker:function(be){return be=be==null?_:Math.pow(_,be),new H(this.h,this.s,this.l*be,this.opacity)},rgb:function(){var be=this.h%360+360*(this.h<0),_e=isNaN(be)||isNaN(this.s)?0:this.s,Se=this.l,Ce=Se+(Se<.5?Se:1-Se)*_e,Ie=2*Se-Ce;return new T(G(be>=240?be-240:be+120,Ie,Ce),G(be,Ie,Ce),G(be<120?be+240:be-120,Ie,Ce),this.opacity)},clamp:function(){return new H(Z(this.h),ee(this.s),ee(this.l),O(this.opacity))},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var be=O(this.opacity);return"".concat(be===1?"hsl(":"hsla(").concat(Z(this.h),", ").concat(100*ee(this.s),"%, ").concat(100*ee(this.l),"%").concat(be===1?")":", ".concat(be,")"))}}));var ne=function(be){return function(){return be}};function K(be,_e){var Se=_e-be;return Se?function(Ce,Ie){return function(Pe){return Ce+Pe*Ie}}(be,Se):ne(isNaN(be)?_e:be)}var X=function be(_e){var Se=function(Ie){return(Ie=+Ie)==1?K:function(Pe,He){return He-Pe?function(Ee,Fe,Le){return Ee=Math.pow(Ee,Le),Fe=Math.pow(Fe,Le)-Ee,Le=1/Le,function(ve){return Math.pow(Ee+ve*Fe,Le)}}(Pe,He,Ie):ne(isNaN(Pe)?He:Pe)}}(_e);function Ce(Ie,Pe){var He=Se((Ie=I(Ie)).r,(Pe=I(Pe)).r),Ee=Se(Ie.g,Pe.g),Fe=Se(Ie.b,Pe.b),Le=K(Ie.opacity,Pe.opacity);return function(ve){return Ie.r=He(ve),Ie.g=Ee(ve),Ie.b=Fe(ve),Ie.opacity=Le(ve),Ie+""}}return Ce.gamma=be,Ce}(1);function Q(be,_e){var Se,Ce=_e?_e.length:0,Ie=be?Math.min(Ce,be.length):0,Pe=new Array(Ie),He=new Array(Ce);for(Se=0;Se<Ie;++Se)Pe[Se]=me(be[Se],_e[Se]);for(;Se<Ce;++Se)He[Se]=_e[Se];return function(Ee){for(Se=0;Se<Ie;++Se)He[Se]=Pe[Se](Ee);return He}}function ce(be,_e){var Se=new Date;return be=+be,_e=+_e,function(Ce){return Se.setTime(be*(1-Ce)+_e*Ce),Se}}function he(be,_e){return be=+be,_e=+_e,function(Se){return be*(1-Se)+_e*Se}}function se(be){return se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_e){return typeof _e}:function(_e){return _e&&typeof Symbol=="function"&&_e.constructor===Symbol&&_e!==Symbol.prototype?"symbol":typeof _e},se(be)}function fe(be,_e){var Se,Ce={},Ie={};for(Se in be!==null&&se(be)==="object"||(be={}),_e!==null&&se(_e)==="object"||(_e={}),_e)Se in be?Ce[Se]=me(be[Se],_e[Se]):Ie[Se]=_e[Se];return function(Pe){for(Se in Ce)Ie[Se]=Ce[Se](Pe);return Ie}}var re=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,oe=new RegExp(re.source,"g");function le(be,_e){var Se,Ce,Ie,Pe=re.lastIndex=oe.lastIndex=0,He=-1,Ee=[],Fe=[];for(be+="",_e+="";(Se=re.exec(be))&&(Ce=oe.exec(_e));)(Ie=Ce.index)>Pe&&(Ie=_e.slice(Pe,Ie),Ee[He]?Ee[He]+=Ie:Ee[++He]=Ie),(Se=Se[0])===(Ce=Ce[0])?Ee[He]?Ee[He]+=Ce:Ee[++He]=Ce:(Ee[++He]=null,Fe.push({i:He,x:he(Se,Ce)})),Pe=oe.lastIndex;return Pe<_e.length&&(Ie=_e.slice(Pe),Ee[He]?Ee[He]+=Ie:Ee[++He]=Ie),Ee.length<2?Fe[0]?function(Le){return function(ve){return Le(ve)+""}}(Fe[0].x):function(Le){return function(){return Le}}(_e):(_e=Fe.length,function(Le){for(var ve,Me=0;Me<_e;++Me)Ee[(ve=Fe[Me]).i]=ve.x(Le);return Ee.join("")})}function pe(be,_e){_e||(_e=[]);var Se,Ce=be?Math.min(_e.length,be.length):0,Ie=_e.slice();return function(Pe){for(Se=0;Se<Ce;++Se)Ie[Se]=be[Se]*(1-Pe)+_e[Se]*Pe;return Ie}}function ge(be){return ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_e){return typeof _e}:function(_e){return _e&&typeof Symbol=="function"&&_e.constructor===Symbol&&_e!==Symbol.prototype?"symbol":typeof _e},ge(be)}function me(be,_e){var Se,Ce,Ie=ge(_e);return _e==null||Ie==="boolean"?ne(_e):(Ie==="number"?he:Ie==="string"?(Se=P(_e))?(_e=Se,X):le:_e instanceof P?X:_e instanceof Date?ce:(Ce=_e,!ArrayBuffer.isView(Ce)||Ce instanceof DataView?Array.isArray(_e)?Q:typeof _e.valueOf!="function"&&typeof _e.toString!="function"||isNaN(_e)?fe:he:pe))(be,_e)}},23648:function(p){p.exports=JSON.parse('["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]')},2362:function(p){p.exports=JSON.parse('["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]')},87486:function(p){p.exports=JSON.parse('["normal","italic","oblique"]')},99803:function(p){p.exports=JSON.parse('["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]')},54324:function(p){p.exports=JSON.parse('["inherit","initial","unset"]')},94316:function(p){p.exports=JSON.parse('["caption","icon","menu","message-box","small-caption","status-bar"]')},37071:function(p){p.exports=JSON.parse(`{"version":8,"name":"orto","metadata":{"maputnik:renderer":"mlgljs"},"center":[1.537786,41.837539],"zoom":12,"bearing":0,"pitch":0,"light":{"anchor":"viewport","color":"white","intensity":0.4,"position":[1.15,45,30]},"sources":{"ortoEsri":{"type":"raster","tiles":["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],"tileSize":256,"maxzoom":18,"attribution":"ESRI &copy; <a href='http://www.esri.com'>ESRI</a>"},"ortoInstaMaps":{"type":"raster","tiles":["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],"tileSize":256,"maxzoom":13},"ortoICGC":{"type":"raster","tiles":["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],"tileSize":256,"minzoom":13.1,"maxzoom":20},"openmaptiles":{"type":"vector","url":"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},"sprite":"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1","glyphs":"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","paint":{"background-color":"#F4F9F4"}},{"id":"ortoEsri","type":"raster","source":"ortoEsri","maxzoom":16,"layout":{"visibility":"visible"}},{"id":"ortoICGC","type":"raster","source":"ortoICGC","minzoom":13.1,"maxzoom":19,"layout":{"visibility":"visible"}},{"id":"ortoInstaMaps","type":"raster","source":"ortoInstaMaps","maxzoom":13,"layout":{"visibility":"visible"}},{"id":"waterway_tunnel","type":"line","source":"openmaptiles","source-layer":"waterway","minzoom":14,"filter":["all",["in","class","river","stream","canal"],["==","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,6]]},"line-dasharray":[2,4]}},{"id":"waterway-other","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["!in","class","canal","river","stream"],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,2]]}}},{"id":"waterway-stream-canal","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["all",["in","class","canal","stream"],["!=","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,6]]}}},{"id":"waterway-river","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["all",["==","class","river"],["!=","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.2,"stops":[[10,0.8],[20,4]]},"line-opacity":0.5}},{"id":"water-offset","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","maxzoom":8,"filter":["==","$type","Polygon"],"layout":{"visibility":"visible"},"paint":{"fill-opacity":0,"fill-color":"#a0c8f0","fill-translate":{"base":1,"stops":[[6,[2,0]],[8,[0,0]]]}}},{"id":"water","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","layout":{"visibility":"visible"},"paint":{"fill-color":"hsl(210, 67%, 85%)","fill-opacity":0}},{"id":"water-pattern","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","layout":{"visibility":"visible"},"paint":{"fill-translate":[0,2.5],"fill-pattern":"wave","fill-opacity":1}},{"id":"landcover-ice-shelf","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"landcover","filter":["==","subclass","ice_shelf"],"layout":{"visibility":"visible"},"paint":{"fill-color":"#fff","fill-opacity":{"base":1,"stops":[[0,0.9],[10,0.3]]}}},{"id":"tunnel-service-track-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","service","track"]],"layout":{"line-join":"round"},"paint":{"line-color":"#cfcdca","line-dasharray":[0.5,0.25],"line-width":{"base":1.2,"stops":[[15,1],[16,4],[20,11]]}}},{"id":"tunnel-minor-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","minor"]],"layout":{"line-join":"round"},"paint":{"line-color":"#cfcdca","line-opacity":{"stops":[[12,0],[12.5,1]]},"line-width":{"base":1.2,"stops":[[12,0.5],[13,1],[14,4],[20,15]]}}},{"id":"tunnel-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[8,1.5],[20,17]]}}},{"id":"tunnel-trunk-primary-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.7}},{"id":"tunnel-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","motorway"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-dasharray":[0.5,0.25],"line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.5}},{"id":"tunnel-path","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","tunnel"],["==","class","path"]]],"paint":{"line-color":"#cba","line-dasharray":[1.5,0.75],"line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]}}},{"id":"tunnel-service-track","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","service","track"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff","line-width":{"base":1.2,"stops":[[15.5,0],[16,2],[20,7.5]]}}},{"id":"tunnel-minor","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","minor_road"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff","line-opacity":1,"line-width":{"base":1.2,"stops":[[13.5,0],[14,2.5],[20,11.5]]}}},{"id":"tunnel-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff4c6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,10]]}}},{"id":"tunnel-trunk-primary","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff4c6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"tunnel-motorway","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","motorway"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"#ffdaa6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"tunnel-railway","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]},"line-dasharray":[2,2]}},{"id":"ferry","type":"line","source":"openmaptiles","source-layer":"transportation","filter":["all",["in","class","ferry"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(108, 159, 182, 1)","line-width":1.1,"line-dasharray":[2,2]}},{"id":"aeroway-taxiway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":12,"filter":["all",["in","class","taxiway"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(153, 153, 153, 1)","line-width":{"base":1.5,"stops":[[11,2],[17,12]]},"line-opacity":1}},{"id":"aeroway-runway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":12,"filter":["all",["in","class","runway"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(153, 153, 153, 1)","line-width":{"base":1.5,"stops":[[11,5],[17,55]]},"line-opacity":1}},{"id":"aeroway-taxiway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":4,"filter":["all",["in","class","taxiway"],["==","$type","LineString"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(255, 255, 255, 1)","line-width":{"base":1.5,"stops":[[11,1],[17,10]]},"line-opacity":{"base":1,"stops":[[11,0],[12,1]]}}},{"id":"aeroway-runway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":4,"filter":["all",["in","class","runway"],["==","$type","LineString"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(255, 255, 255, 1)","line-width":{"base":1.5,"stops":[[11,4],[17,50]]},"line-opacity":{"base":1,"stops":[[11,0],[12,1]]}}},{"id":"highway-motorway-link-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":12,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"highway-link-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"highway-minor-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!=","brunnel","tunnel"],["in","class","minor","service","track"]]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#cfcdca","line-opacity":{"stops":[[12,0],[12.5,0]]},"line-width":{"base":1.2,"stops":[[12,0.5],[13,1],[14,4],[20,15]]}}},{"id":"highway-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":0.5,"line-width":{"base":1.2,"stops":[[8,1.5],[20,17]]}}},{"id":"highway-primary-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":{"stops":[[7,0],[8,0.6]]},"line-width":{"base":1.2,"stops":[[7,0],[8,0.6],[9,1.5],[20,22]]}}},{"id":"highway-trunk-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","trunk"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":{"stops":[[5,0],[6,0.5]]},"line-width":{"base":1.2,"stops":[[5,0],[6,0.6],[7,1.5],[20,22]]}}},{"id":"highway-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":4,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[4,0],[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":{"stops":[[4,0],[5,0.5]]}}},{"id":"highway-path","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["==","class","path"]]],"paint":{"line-color":"#cba","line-dasharray":[1.5,0.75],"line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]}}},{"id":"highway-motorway-link","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":12,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"highway-link","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"highway-minor","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!=","brunnel","tunnel"],["in","class","minor","service","track"]]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#fff","line-opacity":0.5,"line-width":{"base":1.2,"stops":[[13.5,0],[14,2.5],[20,11.5]]}}},{"id":"highway-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[8,0.5],[20,13]]},"line-opacity":0.5}},{"id":"highway-primary","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["in","class","primary"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[8.5,0],[9,0.5],[20,18]]},"line-opacity":0}},{"id":"highway-trunk","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["in","class","trunk"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"highway-motorway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"railway-transit","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","transit"],["!in","brunnel","tunnel"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.77)","line-width":{"base":1.4,"stops":[[14,0.4],[20,1]]}}},{"id":"railway-transit-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","transit"],["!in","brunnel","tunnel"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.68)","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,2],[20,6]]}}},{"id":"railway-service","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","rail"],["has","service"]]],"paint":{"line-color":"hsla(0, 0%, 73%, 0.77)","line-width":{"base":1.4,"stops":[[14,0.4],[20,1]]}}},{"id":"railway-service-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","rail"],["has","service"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.68)","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,2],[20,6]]}}},{"id":"railway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!has","service"],["!in","brunnel","bridge","tunnel"],["==","class","rail"]]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]}}},{"id":"railway-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!has","service"],["!in","brunnel","bridge","tunnel"],["==","class","rail"]]],"paint":{"line-color":"#bbb","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,3],[20,8]]}}},{"id":"bridge-motorway-link-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"bridge-link-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"bridge-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[8,1.5],[20,28]]}}},{"id":"bridge-trunk-primary-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"hsl(28, 76%, 67%)","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,26]]}}},{"id":"bridge-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.5}},{"id":"bridge-path-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","path"]]],"paint":{"line-color":"#f8f4f0","line-width":{"base":1.2,"stops":[[15,1.2],[20,18]]}}},{"id":"bridge-path","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","path"]]],"paint":{"line-color":"#cba","line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]},"line-dasharray":[1.5,0.75]}},{"id":"bridge-motorway-link","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"bridge-link","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"bridge-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,20]]}}},{"id":"bridge-trunk-primary","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]}}},{"id":"bridge-motorway","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"bridge-railway","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]}}},{"id":"bridge-railway-hatching","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,3],[20,8]]}}},{"id":"cablecar","type":"line","source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["==","class","cable_car"],"layout":{"visibility":"visible","line-cap":"round"},"paint":{"line-color":"hsl(0, 0%, 70%)","line-width":{"base":1,"stops":[[11,1],[19,2.5]]}}},{"id":"cablecar-dash","type":"line","source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["==","class","cable_car"],"layout":{"visibility":"visible","line-cap":"round"},"paint":{"line-color":"hsl(0, 0%, 70%)","line-width":{"base":1,"stops":[[11,3],[19,5.5]]},"line-dasharray":[2,3]}},{"id":"boundary-land-level-4","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",[">=","admin_level",4],["<=","admin_level",8],["!=","maritime",1]],"layout":{"line-join":"round"},"paint":{"line-color":"#9e9cab","line-dasharray":[3,1,1,1],"line-width":{"base":1.4,"stops":[[4,0.4],[5,1],[12,3]]},"line-opacity":0.6}},{"id":"boundary-land-level-2","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["==","admin_level",2],["!=","maritime",1],["!=","disputed",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"hsl(248, 7%, 66%)","line-width":{"base":1,"stops":[[0,0.6],[4,1.4],[5,2],[12,2]]}}},{"id":"boundary-land-disputed","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["!=","maritime",1],["==","disputed",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"hsl(248, 7%, 70%)","line-dasharray":[1,3],"line-width":{"base":1,"stops":[[0,0.6],[4,1.4],[5,2],[12,8]]}}},{"id":"boundary-water","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["in","admin_level",2,4],["==","maritime",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"rgba(154, 189, 214, 1)","line-width":{"base":1,"stops":[[0,0.6],[4,1],[5,1],[12,1]]},"line-opacity":{"stops":[[6,0],[10,0]]}}},{"id":"waterway-name","type":"symbol","source":"openmaptiles","source-layer":"waterway","minzoom":13,"filter":["all",["==","$type","LineString"],["has","name"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin} {name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","text-letter-spacing":0.2,"symbol-spacing":350},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-lakeline","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["==","$type","LineString"],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","symbol-spacing":350,"text-letter-spacing":0.2},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-ocean","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["all",["==","$type","Point"],["==","class","ocean"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":0.2},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-other","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["all",["==","$type","Point"],["!in","class","ocean"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":{"stops":[[0,10],[6,14]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":0.2,"visibility":"visible"},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"poi-level-3","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":16,"filter":["all",["==","$type","Point"],[">=","rank",25]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"poi-level-2","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":15,"filter":["all",["==","$type","Point"],["<=","rank",24],[">=","rank",15]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"poi-level-1","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":14,"filter":["all",["==","$type","Point"],["<=","rank",14],["has","name"]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":11,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"rgba(191, 228, 172, 1)","text-halo-width":1,"text-halo-color":"rgba(30, 29, 29, 1)"}},{"id":"poi-railway","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":13,"filter":["all",["==","$type","Point"],["has","name"],["==","class","railway"],["==","subclass","station"]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9,"icon-optional":false,"icon-ignore-placement":false,"icon-allow-overlap":false,"text-ignore-placement":false,"text-allow-overlap":false,"text-optional":true},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"road_oneway","type":"symbol","source":"openmaptiles","source-layer":"transportation","minzoom":15,"filter":["all",["==","oneway",1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],"layout":{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":90,"icon-size":{"stops":[[15,0.5],[19,1]]}},"paint":{"icon-opacity":0.5}},{"id":"road_oneway_opposite","type":"symbol","source":"openmaptiles","source-layer":"transportation","minzoom":15,"filter":["all",["==","oneway",-1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],"layout":{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":-90,"icon-size":{"stops":[[15,0.5],[19,1]]}},"paint":{"icon-opacity":0.5}},{"id":"highway-name-path","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":15.5,"filter":["==","class","path"],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-color":"#f8f4f0","text-color":"hsl(30, 23%, 62%)","text-halo-width":0.5}},{"id":"highway-name-minor","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":15,"filter":["all",["==","$type","LineString"],["in","class","minor","service","track"]],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-blur":0.5,"text-color":"#765","text-halo-width":1}},{"id":"highway-name-major","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":12.2,"filter":["in","class","primary","secondary","tertiary","trunk"],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-blur":0.5,"text-color":"#765","text-halo-width":1}},{"id":"highway-shield","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":8,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["!in","network","us-interstate","us-highway","us-state"]],"layout":{"text-size":10,"icon-image":"road_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-opacity":1,"text-color":"rgba(20, 19, 19, 1)","text-halo-color":"rgba(230, 221, 221, 0)","text-halo-width":2,"icon-color":"rgba(183, 18, 18, 1)","icon-opacity":0.3,"icon-halo-color":"rgba(183, 55, 55, 0)"}},{"id":"highway-shield-us-interstate","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":7,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-interstate"]],"layout":{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[7,"point"],[7,"line"],[8,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-color":"rgba(0, 0, 0, 1)"}},{"id":"highway-shield-us-other","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":9,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-highway","us-state"]],"layout":{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-color":"rgba(0, 0, 0, 1)"}},{"id":"place-other","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","minzoom":12,"filter":["!in","class","city","town","village","country","continent"],"layout":{"text-letter-spacing":0.1,"text-size":{"base":1.2,"stops":[[12,10],[15,14]]},"text-font":["Noto Sans Bold"],"text-field":"{name:latin}\\n{name:nonlatin}","text-transform":"uppercase","text-max-width":9,"visibility":"visible"},"paint":{"text-color":"rgba(255,255,255,1)","text-halo-width":1.2,"text-halo-color":"rgba(57, 28, 28, 1)"}},{"id":"place-village","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","minzoom":10,"filter":["==","class","village"],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[10,12],[15,16]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(10, 9, 9, 0.8)"}},{"id":"place-town","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["==","class","town"],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[10,14],[15,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(22, 22, 22, 0.8)"}},{"id":"place-city","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["!=","capital",2],["==","class","city"]],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[7,14],[11,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(0, 0, 0, 1)","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-city-capital","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","capital",2],["==","class","city"]],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[7,14],[11,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"icon-image":"star_11","text-offset":[0.4,0],"icon-size":0.8,"text-anchor":"left","visibility":"visible"},"paint":{"text-color":"#333","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-other","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],[">=","rank",3],["!has","iso_a2"]],"layout":{"text-font":["Noto Sans Italic"],"text-field":"{name:latin}","text-size":{"stops":[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-3","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],[">=","rank",3],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-2","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],["==","rank",2],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[2,11],[5,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-1","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],["==","rank",1],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[1,11],[4,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-continent","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","maxzoom":1,"filter":["==","class","continent"],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":14,"text-max-width":6.25,"text-transform":"uppercase","visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}}],"id":"qebnlkra6"}`)},51962:function(p){p.exports=JSON.parse(`{"version":8,"name":"orto","metadata":{},"center":[1.537786,41.837539],"zoom":12,"bearing":0,"pitch":0,"light":{"anchor":"viewport","color":"white","intensity":0.4,"position":[1.15,45,30]},"sources":{"ortoEsri":{"type":"raster","tiles":["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],"tileSize":256,"maxzoom":18,"attribution":"ESRI &copy; <a href='http://www.esri.com'>ESRI</a>"},"ortoInstaMaps":{"type":"raster","tiles":["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],"tileSize":256,"maxzoom":13},"ortoICGC":{"type":"raster","tiles":["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],"tileSize":256,"minzoom":13.1,"maxzoom":20},"openmaptiles":{"type":"vector","url":"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},"sprite":"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1","glyphs":"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","paint":{"background-color":"#F4F9F4"}},{"id":"ortoEsri","type":"raster","source":"ortoEsri","maxzoom":16,"layout":{"visibility":"visible"}},{"id":"ortoICGC","type":"raster","source":"ortoICGC","minzoom":13.1,"maxzoom":19,"layout":{"visibility":"visible"}},{"id":"ortoInstaMaps","type":"raster","source":"ortoInstaMaps","maxzoom":13,"layout":{"visibility":"visible"}}]}`)}},c={};function R(p){var f=c[p];if(f!==void 0)return f.exports;var n=c[p]={id:p,exports:{}};return r[p].call(n.exports,n,n.exports,R),n.exports}return R.m=r,R.n=function(p){var f=p&&p.__esModule?function(){return p.default}:function(){return p};return R.d(f,{a:f}),f},R.d=function(p,f){for(var n in f)R.o(f,n)&&!R.o(p,n)&&Object.defineProperty(p,n,{enumerable:!0,get:f[n]})},R.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),R.o=function(p,f){return Object.prototype.hasOwnProperty.call(p,f)},R.r=function(p){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})},R.b=document.baseURI||self.location.href,R.nc=void 0,R(20260)}()})})(m9);var jq=m9.exports;const nd=f8(jq),Uq={highlightColor:"#E4572E",selectedColor:"#F3A712",unhighlightedColor:"lightblue",highlightHiddenColor:"#1f77b4",annotationBackground:"#f8f8f8"},Hq={xPosScalingFactor:80,xPosScalingThreshold:500,minAnnotationWidth:40},Wq=wg({name:"PlotlyLineplot",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Cg(),e=zy();return{streamlitDataStore:t,selectionStore:e}},data(){return{isInitialized:!1,manualXRange:void 0,lastAutoZoomedPeakIndex:void 0,textMeasureCanvas:null}},computed:{id(){return`plot-${this.index}`},theme(){return this.streamlitDataStore.theme},styling(){return{...Uq,...this.args.styling}},config(){return{...Hq,...this.args.config}},actualPlotWidth(){const t=document.getElementById(this.id);if(t){const e=t.getBoundingClientRect();if(e.width>0)return e.width}return 800},plotConfig(){var t;return(t=this.streamlitDataStore.allDataForDrawing)==null?void 0:t._plotConfig},plotData(){var n;const t=(n=this.streamlitDataStore.allDataForDrawing)==null?void 0:n.plotData;if(!t)return;const e=this.plotConfig,r=(e==null?void 0:e.xColumn)||this.args.xColumn||"x",c=(e==null?void 0:e.yColumn)||this.args.yColumn||"y",R={x_values:t[r]||[],y_values:t[c]||[]},p=(e==null?void 0:e.highlightColumn)||this.args.highlightColumn;p&&t[p]&&(R.highlight_mask=t[p]);const f=(e==null?void 0:e.annotationColumn)||this.args.annotationColumn;if(f&&t[f]&&(R.annotations=t[f]),this.args.interactivity)for(const[s,u]of Object.entries(this.args.interactivity)){const i=u;t[i]&&(R[`interactivity_${i}`]=t[i])}return R},interactivity(){return this.args.interactivity||{}},selectedPeakIndex(){if(!(!this.isDataReady||!this.plotData))for(const[t,e]of Object.entries(this.interactivity)){const r=this.selectionStore.$state[t];if(r==null)continue;const c=`interactivity_${e}`,R=this.plotData[c];if(R&&Array.isArray(R)){for(let p=0;p<R.length;p++)if(R[p]===r)return p}else if(e===this.args.xColumn){const p=this.plotData.x_values;for(let f=0;f<p.length;f++)if(p[f]===r)return f}}},isDataReady(){return this.plotData?Array.isArray(this.plotData.x_values)&&Array.isArray(this.plotData.y_values)&&this.plotData.x_values.length>0:!1},xValuesStick(){if(!this.isDataReady||!this.plotData)return[];const t=[];for(const e of this.plotData.x_values)t.push(e,e,e);return t},yValuesStick(){if(!this.isDataReady||!this.plotData)return[];const t=[],e=-1e7;for(const r of this.plotData.y_values)t.push(e,r,e);return t},xRange(){if(this.manualXRange)return this.manualXRange;if(!this.isDataReady||!this.plotData)return[0,1];const t=this.plotData.x_values,e=Math.min(...t),r=Math.max(...t),c=(r-e)*.02;return[e-c,r+c]},yRange(){if(!this.isDataReady||!this.plotData)return[0,1];const{x_values:t,y_values:e}=this.plotData,r=this.xRange;let c=0;for(let R=0;R<t.length;R++){const p=t[R],f=e[R];p>=r[0]&&p<=r[1]&&f>c&&(c=f)}return c===0?[0,1]:[0,c*1.8]},xPosScalingFactor(){const t=this.xRange,e=t[1]-t[0];return 1200/this.actualPlotWidth*e/this.config.xPosScalingFactor},annotatedPeaks(){if(!this.isDataReady||!this.plotData)return[];const{x_values:t,y_values:e,annotations:r,highlight_mask:c}=this.plotData;if(!r)return[];const R=[];for(let p=0;p<r.length;p++){const f=r[p];!f||f.length===0||c&&!c[p]||R.push({x:t[p],y:e[p],label:f,index:p})}return R},annotationBoxData(){const t=this.annotatedPeaks;if(t.length===0)return[];const e=this.yRange,r=this.xRange;if(e[1]<=0||r[1]<=r[0])return[];const c=e[1]/1.8,R=c*1.18,p=c*1.32,f=p-R,n=16,s=[];for(const b of t){const w=b.x>=r[0]&&b.x<=r[1],v=this.measureTextWidth(b.label),o=this.pixelWidthToDataUnits(v+n);s.push({x:b.x,y:(R+p)/2,width:o,height:f,label:b.label,visible:!1,inVisibleRange:w,index:b.index,peakY:b.y})}const u=s.filter(b=>b.inVisibleRange).sort((b,w)=>w.peakY!==b.peakY?w.peakY-b.peakY:b.x-w.x),i=this.pixelWidthToDataUnits(4),_=[];for(const b of u){const w=b.x-b.width/2-i,v=b.x+b.width/2+i;let o=!1;for(const a of _){const h=a.x-a.width/2,l=a.x+a.width/2;if(!(v<h||w>l)){o=!0;break}}o||(b.visible=!0,_.push(b))}return s},annotationShapes(){const t=this.annotationBoxData,e=[],r=this.yRange;if(r[1]<=0)return e;const c=r[1]/1.8,R=c*1.18,p=c*1.32,f=this.selectedPeakIndex;for(const n of t){if(!n.visible)continue;const u=n.index===f?this.styling.selectedColor:this.styling.highlightColor;e.push({type:"rect",x0:n.x-n.width/2,y0:R,x1:n.x+n.width/2,y1:p,fillcolor:u,line:{width:0}})}return e},peakAnnotations(){const t=this.annotationBoxData,e=[],r=this.yRange;if(r[1]<=0)return e;const R=r[1]/1.8*1.25;for(const p of t)p.visible&&e.push({x:p.x,y:R,xref:"x",yref:"y",text:p.label,showarrow:!1,font:{size:14,color:"white"}});return e},selectedAnnotationHidden(){const t=this.selectedPeakIndex;if(t===void 0)return!1;const r=this.annotationBoxData.find(c=>c.index===t);return r?!r.visible:!1},traces(){if(!this.isDataReady||!this.plotData)return this.getFallbackData();const t=[],{highlight_mask:e}=this.plotData,r=this.selectedPeakIndex,c=-1e7,R=[],p=[],f=[],n=[],s=[],u=[],i=this.plotData.x_values.length;for(let _=0;_<i;_++){const b=this.plotData.x_values[_],w=this.plotData.y_values[_],v=e?e[_]:!1;r!==void 0&&_===r?(s.push(b,b,b),u.push(c,w,c)):v?(f.push(b,b,b),n.push(c,w,c)):(R.push(b,b,b),p.push(c,w,c))}return R.length>0&&t.push({x:R,y:p,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.unhighlightedColor},hoverinfo:"x+y"}),f.length>0&&t.push({x:f,y:n,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.highlightColor},hoverinfo:"x+y"}),s.length>0&&t.push({x:s,y:u,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.selectedColor},line:{width:3},hoverinfo:"x+y"}),t.length===0&&t.push({x:this.xValuesStick,y:this.yValuesStick,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.highlightHiddenColor},hoverinfo:"x+y"}),t},layout(){var t,e,r,c,R;return{title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:!1,height:this.args.height||400,xaxis:{title:this.args.xLabel?{text:this.args.xLabel}:void 0,showgrid:!1,showline:!0,linecolor:"grey",linewidth:1,range:this.xRange},yaxis:{title:this.args.yLabel?{text:this.args.yLabel}:void 0,showgrid:!0,gridcolor:((t=this.theme)==null?void 0:t.secondaryBackgroundColor)||"#f0f0f0",rangemode:"nonnegative",fixedrange:!1,showline:!0,linecolor:"grey",linewidth:1,range:this.yRange},paper_bgcolor:((e=this.theme)==null?void 0:e.backgroundColor)||"white",plot_bgcolor:((r=this.theme)==null?void 0:r.backgroundColor)||"white",font:{color:((c=this.theme)==null?void 0:c.textColor)||"black",family:((R=this.theme)==null?void 0:R.font)||"Arial"},margin:{l:60,r:20,t:this.args.title?50:20,b:50},shapes:this.annotationShapes,annotations:this.peakAnnotations}},cssCustomProperties(){return{"--highlight-color":this.styling.highlightColor,"--selected-color":this.styling.selectedColor,"--unhighlighted-color":this.styling.unhighlightedColor}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.plotData":{handler(t,e){var r,c,R,p;console.log("[LinePlot] plotData changed",{newLength:(r=t==null?void 0:t.x_values)==null?void 0:r.length,oldLength:(c=e==null?void 0:e.x_values)==null?void 0:c.length,newFirstX:(R=t==null?void 0:t.x_values)==null?void 0:R[0],oldFirstX:(p=e==null?void 0:e.x_values)==null?void 0:p[0]}),this.isInitialized&&(this.manualXRange=void 0,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot())},deep:!0},"streamlitDataStore.allDataForDrawing._plotConfig":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},"selectionStore.$state":{handler(t){console.log("[LinePlot] selection changed",t),this.isDataReady&&this.isInitialized&&(this.autoZoomToSelectedAnnotation(),this.renderPlot())},deep:!0}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot()})},methods:{measureTextWidth(t){this.textMeasureCanvas||(this.textMeasureCanvas=document.createElement("canvas"));const e=this.textMeasureCanvas.getContext("2d");return e?(e.font="14px Arial",e.measureText(t).width):t.length*8},pixelWidthToDataUnits(t){const e=this.xRange,r=e[1]-e[0],c=this.actualPlotWidth;return t/(c/r)},async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyLineplot: DOM element with id '${this.id}' not found`);return}const e=[{title:"Download as SVG",name:"toImageSvg",icon:{width:1792,height:1792,path:"M1152 1376v-160q0-14-9-23t-23-9h-96v-512q0-14-9-23t-23-9h-320q-14 0-23 9t-9 23v160q0 14 9 23t23 9h96v320h-96q-14 0-23 9t-9 23v160q0 14 9 23t23 9h320q14 0 23-9t9-23zm-128-896v-160q0-14-9-23t-23-9h-192q-14 0-23 9t-9 23v160q0 14 9 23t23 9h192q14 0 23-9t9-23zm640 416q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"},click:()=>{const c=document.getElementById(this.id);c&&nd.downloadImage(c,{filename:this.args.title||"plot",height:400,width:1200,format:"svg"})}}];await nd.newPlot(this.id,this.traces,this.layout,{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:e,scrollZoom:!0,responsive:!0}),this.$nextTick(()=>{this.args.height?Hc.setFrameHeight(this.args.height):Hc.setFrameHeight()});const r=document.getElementById(this.id);r&&(r.on("plotly_click",c=>{this.onPlotClick(c)}),r.on("plotly_relayout",c=>{this.onRelayout(c)}))}catch(t){console.error("PlotlyLineplot: Error rendering plot:",t),this.renderFallback()}},onRelayout(t){if(t["xaxis.range[0]"]!==void 0&&t["xaxis.range[1]"]!==void 0){const e=[t["xaxis.range[0]"],t["xaxis.range[1]"]];e[0]<0&&(e[0]=0),this.manualXRange=e,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot()}else t["xaxis.autorange"]===!0&&(this.manualXRange=void 0,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot())},autoZoomToSelectedAnnotation(){const t=this.selectedPeakIndex;if(t===void 0){this.lastAutoZoomedPeakIndex=void 0;return}if(t===this.lastAutoZoomedPeakIndex||!this.selectedAnnotationHidden)return;const e=this.calculateZoomForSelectedAnnotation();e&&(this.manualXRange=e,this.lastAutoZoomedPeakIndex=t)},calculateZoomForSelectedAnnotation(){const t=this.selectedPeakIndex;if(t===void 0||!this.plotData)return;const e=this.annotatedPeaks,r=e.find(b=>b.index===t);if(!r)return;let c=1/0,R=1/0;for(const b of e){if(b.index===t)continue;const w=b.x-r.x;w<0&&-w<c?c=-w:w>0&&w<R&&(R=w)}const p=Math.min(c,R);this.actualPlotWidth,this.config.xPosScalingFactor;let f;if(p<1/0)f=p*2;else{const b=this.plotData.x_values;f=(Math.max(...b)-Math.min(...b))*.2}const n=this.plotData.x_values,s=Math.min(...n),u=Math.max(...n);let i=r.x-f/2,_=r.x+f/2;return i<s&&(i=s,_=Math.min(s+f,u)),_>u&&(_=u,i=Math.max(u-f,s)),[i,_]},onPlotClick(t){if(!(!this.interactivity||Object.keys(this.interactivity).length===0)&&t.points&&t.points.length>0){const r=t.points[0].x;if(!this.plotData)return;const c=this.plotData.x_values;let R=0,p=1/0;for(let f=0;f<c.length;f++){const n=Math.abs(c[f]-r);n<p&&(p=n,R=f)}for(const[f,n]of Object.entries(this.interactivity)){const s=`interactivity_${n}`,u=this.plotData[s];u&&Array.isArray(u)&&R<u.length?this.selectionStore.updateSelection(f,u[R]):n===this.args.xColumn&&this.selectionStore.updateSelection(f,c[R])}}},getFallbackData(){return[{x:[0,1],y:[0,0],mode:"lines",type:"scatter",marker:{color:this.styling.unhighlightedColor},name:"No Data"}]},async renderFallback(){var t,e,r,c;try{const R={title:{text:"<b>No Data Available</b>"},showlegend:!1,height:400,xaxis:{title:{text:"X"},showgrid:!1},yaxis:{title:{text:"Y"},showgrid:!0,rangemode:"nonnegative"},paper_bgcolor:((t=this.theme)==null?void 0:t.backgroundColor)||"white",plot_bgcolor:((e=this.theme)==null?void 0:e.backgroundColor)||"white",font:{color:((r=this.theme)==null?void 0:r.textColor)||"black",family:((c=this.theme)==null?void 0:c.font)||"Arial"}};await nd.newPlot(this.id,this.getFallbackData(),R,{staticPlot:!0})}catch(R){console.error("PlotlyLineplot: Failed to render fallback:",R)}}}}),qq=["id"];function Gq(t,e,r,c,R,p){return Va(),vo("div",{id:t.id,class:"plot-container",style:ii(t.cssCustomProperties)},null,12,qq)}const h6=Vv(Wq,[["render",Gq],["__scopeId","data-v-322c72ba"]]);function v9(t){const{id:e,interactivity:r,getData:c,title:R,narrowThreshold:p=600}=t,f=Cg(),n=zy(),s=qr(800),u=qr(null),i=rn(()=>s.value<p),_=rn(()=>f.theme),b=rn(()=>{var l,m,y,x;return{paper_bgcolor:((l=_.value)==null?void 0:l.backgroundColor)||"white",plot_bgcolor:((m=_.value)==null?void 0:m.secondaryBackgroundColor)||"#f5f5f5",font:{color:((y=_.value)==null?void 0:y.textColor)||"black",family:((x=_.value)==null?void 0:x.font)||"Arial"}}});function w(){const l=document.getElementById(e.value);l&&window.ResizeObserver&&(u.value=new ResizeObserver(m=>{for(const y of m){const x=y.contentRect.width;Math.abs(x-s.value)>10&&(s.value=x)}}),u.value.observe(l))}function v(){u.value&&(u.value.disconnect(),u.value=null)}function o(l){const m=[{title:"Download as SVG",name:"toImageSvg",icon:nd.Icons.camera,click:y=>{nd.downloadImage(y,{filename:(R==null?void 0:R.value)||"plot",height:400,width:1200,format:"svg"})}},...l||[]];return{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:m,scrollZoom:!0,responsive:!0}}function a(){const l=document.getElementById(e.value);l&&l.on("plotly_click",m=>{const y=r.value;if(!(!y||Object.keys(y).length===0)&&m.points&&m.points.length>0){const x=m.points[0].pointIndex,C=c()[x];if(C)for(const[A,E]of Object.entries(y)){const P=C[E];P!==void 0&&n.updateSelection(A,P)}}})}function h(){Hc.setFrameHeight()}return{plotWidth:s,isNarrowPlot:i,theme:_,themeLayout:b,setupResizeObserver:w,cleanupResizeObserver:v,getPlotConfig:o,setupClickHandler:a,updateFrameHeight:h,selectionStore:n}}const $q=wg({name:"PlotlyHeatmap",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(t){const e=Cg(),r=v9({id:rn(()=>`heatmap-${t.index}`),interactivity:rn(()=>t.args.interactivity||{}),getData:()=>{var R;return((R=e.allDataForDrawing)==null?void 0:R.heatmapData)||[]},title:rn(()=>t.args.title)});return{streamlitDataStore:e,...r}},data(){return{isInitialized:!1,zoomRange:void 0,colorbarVisible:!0,userOverrideColorbar:!1,heatmapResizeObserver:null,zoomDebounceTimer:null,pendingZoomRange:void 0,zoomThrottleTimer:null,lastZoomUpdateTime:0,plotInitialized:!1}},computed:{id(){return`heatmap-${this.index}`},effectiveColorbarVisible(){return this.userOverrideColorbar?this.colorbarVisible:this.isNarrowPlot?!1:this.colorbarVisible},heatmapData(){var e;return((e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e.heatmapData)||[]},interactivity(){return this.args.interactivity||{}},isDataReady(){return Array.isArray(this.heatmapData)&&this.heatmapData.length>0},xValues(){if(!this.isDataReady)return[];const t=this.args.xColumn;return this.heatmapData.map(e=>e[t])},yValues(){if(!this.isDataReady)return[];const t=this.args.yColumn;return this.heatmapData.map(e=>e[t])},intensityValues(){if(!this.isDataReady)return[];const t=this.args.intensityColumn;return this.heatmapData.map(e=>e[t])},logIntensityValues(){return this.intensityValues.map(t=>t>0?Math.log10(t):0)},isLogScale(){return this.args.logScale!==!1},effectiveColorValues(){return this.isLogScale?this.logIntensityValues:this.intensityValues},colorbarLabel(){return this.args.intensityLabel||"Intensity"},isCategoricalMode(){return!!this.args.categoryColumn},categoryValues(){return!this.isDataReady||!this.args.categoryColumn?[]:this.heatmapData.map(t=>t[this.args.categoryColumn])},uniqueCategories(){if(!this.isCategoricalMode)return[];const t=new Set,e=[];for(const r of this.categoryValues)t.has(r)||(t.add(r),e.push(r));return e},defaultCategoryColors(){return["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"]},getCategoryColor(){const t=this.args.categoryColors||{},e=this.defaultCategoryColors;return r=>{const c=String(r);if(t[c])return t[c];const R=this.uniqueCategories.indexOf(r);return e[R%e.length]}},xRange(){const t=this.zoomRange;if(t&&!(t.xRange[0]<0&&t.xRange[1]<0))return t.xRange},yRange(){const t=this.zoomRange;if(t&&!(t.yRange[0]<0&&t.yRange[1]<0))return t.yRange},colorbarTicks(){if(!this.isLogScale)return null;const t=this.intensityValues.filter(f=>f>0);if(t.length===0)return{tickvals:[0],ticktext:["0"]};const e=Math.min(...t),r=Math.max(...t),c=Math.floor(Math.log10(e)),R=Math.ceil(Math.log10(r)),p=Array.from({length:R-c+1},(f,n)=>Math.pow(10,c+n));return{tickvals:p.map(f=>Math.log10(f)),ticktext:p.map(f=>f.toExponential(0))}},data(){if(!this.isDataReady)return this.getFallbackData();if(this.isCategoricalMode)return this.buildCategoricalTraces();const t=this.colorbarTicks,e={title:{text:this.colorbarLabel}};return t&&(e.tickvals=t.tickvals,e.ticktext=t.ticktext,e.tickmode="array"),[{type:"scattergl",name:"points",x:this.xValues,y:this.yValues,mode:"markers",marker:{color:this.effectiveColorValues,colorscale:this.args.colorscale||"Portland",reversescale:this.args.reversescale??!1,showscale:this.effectiveColorbarVisible,colorbar:e},hovertext:this.intensityValues.map(r=>r.toExponential(2)),hoverinfo:"x+y+text"}]},layout(){const t=this.isCategoricalMode,e=this.isCategoricalMode||this.effectiveColorbarVisible;return{...this.themeLayout,title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:t,legend:t?{x:1.02,y:1,xanchor:"left",yanchor:"top",bgcolor:"rgba(255, 255, 255, 0.8)",bordercolor:"#ccc",borderwidth:1}:void 0,height:this.args.height||400,xaxis:{title:this.args.xLabel?{text:this.args.xLabel}:void 0,range:this.xRange},yaxis:{title:this.args.yLabel?{text:this.args.yLabel}:void 0,range:this.yRange},margin:{l:60,r:e?120:20,t:this.args.title?60:20,b:60}}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.heatmapData":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},zoomRange:{handler(){if(this.zoomRange===void 0)return;const t=this.args.zoomIdentifier||"heatmap_zoom";this.selectionStore.updateSelection(t,this.zoomRange)},deep:!0}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot(),this.setupHeatmapResizeObserver()})},beforeUnmount(){this.zoomDebounceTimer&&(clearTimeout(this.zoomDebounceTimer),this.zoomDebounceTimer=null),this.zoomThrottleTimer&&(clearTimeout(this.zoomThrottleTimer),this.zoomThrottleTimer=null),this.plotInitialized=!1,this.cleanupHeatmapResizeObserver()},methods:{buildCategoricalTraces(){const t=this.getCategoryColor,e=[];for(const r of this.uniqueCategories){const c=[];for(let n=0;n<this.categoryValues.length;n++)this.categoryValues[n]===r&&c.push(n);const R=c.map(n=>this.xValues[n]),p=c.map(n=>this.yValues[n]),f=c.map(n=>this.intensityValues[n].toExponential(2));e.push({type:"scattergl",name:String(r),x:R,y:p,mode:"markers",marker:{color:t(r),size:6},hovertext:f,hoverinfo:"x+y+text"})}return e},async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyHeatmap: DOM element with id '${this.id}' not found`);return}this.plotInitialized?(console.debug("[PlotlyHeatmap] renderPlot: using Plotly.react() (update)"),await nd.react(this.id,this.data,this.layout,this.getHeatmapPlotConfig())):(console.debug("[PlotlyHeatmap] renderPlot: using Plotly.newPlot() (first render)"),await nd.newPlot(this.id,this.data,this.layout,this.getHeatmapPlotConfig()),this.setupPlotEventHandlers(),this.plotInitialized=!0),this.$nextTick(()=>{this.updateFrameHeight()})}catch(t){console.error("PlotlyHeatmap: Error rendering plot:",t),this.plotInitialized=!1,this.renderFallback()}},getHeatmapPlotConfig(){const t={title:"Toggle Colorbar",name:"toggleColorbar",icon:{width:1792,height:1792,path:"M1408 768v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V768q0-40 28-68t68-28h832q40 0 68 28t28 68zm0-384v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V384q0-40 28-68t68-28h832q40 0 68 28t28 68zm0-384v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V0q0-40 28-68t68-28h832q40 0 68 28t28 68z",transform:"matrix(1 0 0 -1 0 1792)"},click:()=>{this.toggleColorbar()}};return this.getPlotConfig([t])},setupPlotEventHandlers(){const t=document.getElementById(this.id);t&&(t.on("plotly_relayout",e=>{let r;e["xaxis.autorange"]?r={xRange:[-1,-1],yRange:[-1,-1]}:e["xaxis.range[0]"]!==void 0&&e["xaxis.range[1]"]!==void 0&&e["yaxis.range[0]"]!==void 0&&e["yaxis.range[1]"]!==void 0&&(r={xRange:[e["xaxis.range[0]"],e["xaxis.range[1]"]],yRange:[e["yaxis.range[0]"],e["yaxis.range[1]"]]}),r&&!this.zoomRangesEqual(r,this.zoomRange)&&(this.pendingZoomRange=r,this.debouncedUpdateZoom())}),this.setupClickHandler())},debouncedUpdateZoom(){this.zoomDebounceTimer&&(clearTimeout(this.zoomDebounceTimer),console.debug("[PlotlyHeatmap] Zoom debounced (timer reset)")),this.zoomThrottleTimer&&(clearTimeout(this.zoomThrottleTimer),this.zoomThrottleTimer=null,console.debug("[PlotlyHeatmap] Throttle timer cancelled (user still interacting)")),this.zoomDebounceTimer=setTimeout(()=>{this.zoomDebounceTimer=null;const c=Date.now()-this.lastZoomUpdateTime;if(c>=500)this.applyZoomUpdate();else{this.zoomThrottleTimer&&clearTimeout(this.zoomThrottleTimer);const R=500-c;console.debug(`[PlotlyHeatmap] Throttling zoom update, waiting ${R}ms`),this.zoomThrottleTimer=setTimeout(()=>{this.zoomThrottleTimer=null,this.applyZoomUpdate()},R)}},150)},applyZoomUpdate(){this.pendingZoomRange&&(console.debug("[PlotlyHeatmap] Applying zoom update:",this.pendingZoomRange),this.lastZoomUpdateTime=Date.now(),this.zoomRange=this.pendingZoomRange,this.pendingZoomRange=void 0)},zoomRangesEqual(t,e){return t===e?!0:!t||!e?!1:t.xRange[0]===e.xRange[0]&&t.xRange[1]===e.xRange[1]&&t.yRange[0]===e.yRange[0]&&t.yRange[1]===e.yRange[1]},async toggleColorbar(){this.colorbarVisible=!this.colorbarVisible,this.userOverrideColorbar=!0,await this.updatePlot()},async updatePlot(){const t=document.getElementById(this.id);if(t)try{await nd.restyle(t,{"marker.showscale":this.effectiveColorbarVisible},[0]),await nd.relayout(t,{margin:{r:this.effectiveColorbarVisible?120:20}})}catch{}},setupHeatmapResizeObserver(){const t=document.getElementById(this.id);t&&window.ResizeObserver&&(this.heatmapResizeObserver=new ResizeObserver(e=>{for(const r of e){const c=r.contentRect.width;if(Math.abs(c-this.plotWidth)>10){const R=this.isNarrowPlot;this.plotWidth=c;const p=this.isNarrowPlot;R!==p&&!this.userOverrideColorbar&&(this.colorbarVisible=!p,this.updatePlot())}}}),this.heatmapResizeObserver.observe(t))},cleanupHeatmapResizeObserver(){this.heatmapResizeObserver&&(this.heatmapResizeObserver.disconnect(),this.heatmapResizeObserver=null)},getFallbackData(){return[{type:"scattergl",x:[0],y:[0],mode:"markers",marker:{color:"grey"},name:"No Data"}]},async renderFallback(){try{const t={...this.themeLayout,title:{text:"<b>No Data Available</b>"},showlegend:!1,xaxis:{title:{text:"X"}},yaxis:{title:{text:"Y"}}};await nd.newPlot(this.id,this.getFallbackData(),t,{staticPlot:!0})}catch(t){console.error("PlotlyHeatmap: Failed to render fallback:",t)}}}}),Yq=["id"];function Zq(t,e,r,c,R,p){return Va(),vo("div",{id:t.id,class:"heatmap-container"},null,8,Yq)}const f6=Vv($q,[["render",Zq],["__scopeId","data-v-ba3d5702"]]);function d6(t,e,r,c){return e>=c?"ns":t>=r?"up":t<=-r?"down":"ns"}const Xq=wg({name:"PlotlyVolcano",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(t){const e=Cg(),r=v9({id:rn(()=>`volcano-${t.index}`),interactivity:rn(()=>t.args.interactivity||{}),getData:()=>{var R;return((R=e.allDataForDrawing)==null?void 0:R.volcanoData)||[]},title:rn(()=>t.args.title)});return{streamlitDataStore:e,...r}},data(){return{isInitialized:!1}},computed:{id(){return`volcano-${this.index}`},volcanoData(){var e;return((e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e.volcanoData)||[]},isDataReady(){return Array.isArray(this.volcanoData)&&this.volcanoData.length>0},fcThreshold(){return this.args.fcThreshold??1},pThreshold(){return this.args.pThreshold??.05},neglog10PThreshold(){return this.pThreshold>0?-Math.log10(this.pThreshold):0},categorizedData(){const t={x:[],y:[],text:[],indices:[]},e={x:[],y:[],text:[],indices:[]},r={x:[],y:[],text:[],indices:[]},c=this.args.log2fcColumn,R=this.args.neglog10pColumn,p=this.args.pvalueColumn,f=this.args.labelColumn;return this.volcanoData.forEach((n,s)=>{const u=Number(n[c])||0,i=Number(n[R])||0,_=Number(n[p])||1,b=f?String(n[f]||""):"",w=f?`${b}<br>log2FC: ${u.toFixed(3)}<br>p-value: ${_.toExponential(2)}`:`log2FC: ${u.toFixed(3)}<br>p-value: ${_.toExponential(2)}`,v=d6(u,_,this.fcThreshold,this.pThreshold);v==="up"?(t.x.push(u),t.y.push(i),t.text.push(w),t.indices.push(s)):v==="down"?(e.x.push(u),e.y.push(i),e.text.push(w),e.indices.push(s)):(r.x.push(u),r.y.push(i),r.text.push(w),r.indices.push(s))}),{up:t,down:e,ns:r}},plotData(){if(!this.isDataReady)return this.getFallbackData();const{up:t,down:e,ns:r}=this.categorizedData,c=[];return r.x.length>0&&c.push({type:"scattergl",name:"Not significant",x:r.x,y:r.y,mode:"markers",marker:{color:this.args.nsColor||"#95A5A6",size:6,opacity:.6},text:r.text,hoverinfo:"text",customdata:r.indices}),e.x.length>0&&c.push({type:"scattergl",name:"Down-regulated",x:e.x,y:e.y,mode:"markers",marker:{color:this.args.downColor||"#3498DB",size:8},text:e.text,hoverinfo:"text",customdata:e.indices}),t.x.length>0&&c.push({type:"scattergl",name:"Up-regulated",x:t.x,y:t.y,mode:"markers",marker:{color:this.args.upColor||"#E74C3C",size:8},text:t.text,hoverinfo:"text",customdata:t.indices}),c},thresholdShapes(){if(!this.args.showThresholdLines)return[];const t=this.args.thresholdLineStyle||"dash",e=[];return e.push({type:"line",xref:"paper",yref:"y",x0:0,x1:1,y0:this.neglog10PThreshold,y1:this.neglog10PThreshold,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e.push({type:"line",xref:"x",yref:"paper",x0:this.fcThreshold,x1:this.fcThreshold,y0:0,y1:1,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e.push({type:"line",xref:"x",yref:"paper",x0:-this.fcThreshold,x1:-this.fcThreshold,y0:0,y1:1,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e},pointAnnotations(){if(!this.args.labelColumn)return[];const t=this.args.maxLabels??10;if(t<=0)return[];const e=this.args.labelColumn,r=this.args.log2fcColumn,c=this.args.neglog10pColumn,R=this.args.pvalueColumn,p=[];return this.volcanoData.forEach(n=>{const s=Number(n[r])||0,u=Number(n[R])||1,i=Number(n[c])||0,_=String(n[e]||"");d6(s,u,this.fcThreshold,this.pThreshold)!=="ns"&&_&&p.push({label:_,log2fc:s,neglog10p:i})}),p.sort((n,s)=>s.neglog10p-n.neglog10p),p.slice(0,t).map(n=>{var s;return{x:n.log2fc,y:n.neglog10p,text:n.label,showarrow:!0,arrowhead:0,arrowsize:.5,arrowwidth:1,arrowcolor:"rgba(100, 100, 100, 0.5)",ax:0,ay:-25,font:{size:10,color:((s=this.theme)==null?void 0:s.textColor)||"black"},bgcolor:"rgba(255, 255, 255, 0.8)",borderpad:2}})},layout(){return{...this.themeLayout,title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:!0,legend:{orientation:"h",yanchor:"bottom",y:1.02,xanchor:"right",x:1},height:this.args.height||400,xaxis:{title:{text:this.args.xLabel||"log2 Fold Change"},zeroline:!0,zerolinecolor:"rgba(150, 150, 150, 0.3)",zerolinewidth:1},yaxis:{title:{text:this.args.yLabel||"-log10(p-value)"},rangemode:"tozero"},shapes:this.thresholdShapes,annotations:this.pointAnnotations,margin:{l:60,r:20,t:this.args.title?80:40,b:60}}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.volcanoData":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},fcThreshold(){this.isInitialized&&this.isDataReady&&this.renderPlot()},pThreshold(){this.isInitialized&&this.isDataReady&&this.renderPlot()}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot(),this.setupResizeObserver()})},beforeUnmount(){this.cleanupResizeObserver()},methods:{async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyVolcano: DOM element with id '${this.id}' not found`);return}await nd.newPlot(this.id,this.plotData,this.layout,this.getPlotConfig()),this.setupClickHandler(),this.$nextTick(()=>{this.updateFrameHeight()})}catch(t){console.error("PlotlyVolcano: Error rendering plot:",t),this.renderFallback()}},getFallbackData(){return[{type:"scattergl",x:[0],y:[0],mode:"markers",marker:{color:"grey"},name:"No Data"}]},async renderFallback(){try{const t={...this.themeLayout,title:{text:"<b>No Data Available</b>"},showlegend:!1,xaxis:{title:{text:"log2 Fold Change"}},yaxis:{title:{text:"-log10(p-value)"}}};await nd.newPlot(this.id,this.getFallbackData(),t,{staticPlot:!0})}catch(t){console.error("PlotlyVolcano: Failed to render fallback:",t)}}}}),Kq=["id"];function Jq(t,e,r,c,R,p){return Va(),vo("div",{id:t.id,class:"volcano-container"},null,8,Kq)}const p6=Vv(Xq,[["render",Jq],["__scopeId","data-v-1837a4fb"]]),Qq=wg({name:"AminoAcidCell",props:{sequenceObject:{type:Object,required:!0},index:{type:Number,required:!0},sequenceLength:{type:Number,required:!0},fixedModification:{type:Boolean,default:!1},showFragments:{type:Boolean,default:!0},fontSize:{type:Number,default:12},isHighlighted:{type:Boolean,default:!1},modification:{type:Number,default:null}},emits:["selected"],setup(){return{streamlitData:Cg()}},computed:{id(){return`aa-${this.aminoAcid}-${this.index}`},theme(){return this.streamlitData.theme},aminoAcid(){return this.sequenceObject.aminoAcid},prefix(){return this.index+1},suffix(){return this.sequenceLength-this.index},hasExtraFragTypes(){return this.sequenceObject.extraTypes.length>0},hasMatchingFragments(){return this.sequenceObject.aIon||this.sequenceObject.bIon||this.sequenceObject.cIon||this.sequenceObject.xIon||this.sequenceObject.yIon||this.sequenceObject.zIon},aminoAcidCellClass(){return{"sequence-amino-acid":!this.fixedModification,"sequence-amino-acid-highlighted":this.fixedModification}},cellStyles(){var e,r,c,R,p;const t=((e=this.theme)==null?void 0:e.base)==="dark";return{"--amino-acid-cell-color":((r=this.theme)==null?void 0:r.textColor)??"#000","--amino-acid-cell-bg-color":((c=this.theme)==null?void 0:c.secondaryBackgroundColor)??"#f0f0f0","--amino-acid-cell-hover-color":((R=this.theme)==null?void 0:R.textColor)??"#000","--amino-acid-cell-hover-bg-color":((p=this.theme)==null?void 0:p.backgroundColor)??"#fff","--amino-acid-font-size":`${this.fontSize}px`,"--mod-mass-bg-color":t?"#e0e0e0":"#fff","--mod-mass-text-color":"#000","--mod-mass-border-color":t?"#666":"#a79c91","--mod-marker-dot-color":t?"rgba(150, 150, 220, 0.8)":"#676a9c","--mod-marker-bg-color":t?"rgba(180, 180, 220, 0.3)":"#e5e5f7","--extra-frag-stroke":t?"rgba(255, 255, 255, 0.5)":"black",position:"relative"}},modificationDisplay(){if(this.modification===null)return"";const t=this.modification;return t>=0?`+${t.toFixed(2)}`:t.toFixed(2)}},methods:{selectCell(){this.hasMatchingFragments&&this.$emit("selected",this.index)}}}),eG=["id"],tG={key:0,class:"frag-marker-container frag-marker-a"},nG={key:1,class:"frag-marker-container frag-marker-b"},rG={key:2,class:"frag-marker-container frag-marker-c"},iG={key:3,class:"frag-marker-container frag-marker-x"},aG={key:4,class:"frag-marker-container frag-marker-y"},oG={key:5,class:"frag-marker-container frag-marker-z"},sG={key:6,class:"rounded-lg mod-marker mod-start"},lG={key:7,class:"rounded-lg mod-marker mod-end"},uG={key:8,class:"rounded-lg mod-mass"},cG={key:9,class:"rounded-lg mod-mass-a"},hG={key:10,class:"rounded-lg mod-mass-b"},fG={key:11,class:"rounded-lg mod-mass-c"},dG={key:12,class:"frag-marker-extra-type"},pG={class:"aa-text"},mG={key:0},gG={key:1},vG={key:2};function yG(t,e,r,c,R,p){const f=iu("v-tooltip");return Va(),vo("div",{id:t.id,class:jr(["d-flex justify-center align-center rounded-lg",[t.aminoAcidCellClass,{highlighted:t.isHighlighted},{"fixed-mod":t.fixedModification}]]),style:ii(t.cellStyles),onClick:e[0]||(e[0]=(...n)=>t.selectCell&&t.selectCell(...n))},[t.showFragments&&t.sequenceObject.aIon?(Va(),vo("div",tG,[...e[1]||(e[1]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"green",d:"M7, 1 L9, 3 L9, 7 L9, 3 L7, 1 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.bIon?(Va(),vo("div",nG,[...e[2]||(e[2]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"blue",d:"M10, 0 V5 M10, 0 H5 z","stroke-width":"3"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.cIon?(Va(),vo("div",rG,[...e[3]||(e[3]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"red",d:"M4, 1 L9, 3 L9, 7 L9, 3 L4, 1 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.xIon?(Va(),vo("div",iG,[...e[4]||(e[4]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"green",d:"M1, 3 L1, 7 L3, 9 L1, 7 L1, 3 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.yIon?(Va(),vo("div",aG,[...e[5]||(e[5]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"blue",d:"M0, 10 V5 M0, 10 H5 z","stroke-width":"3"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.zIon?(Va(),vo("div",oG,[...e[6]||(e[6]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"red",d:"M1, 3 L1, 7 L6, 9 L1, 7 L1, 3 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.modification!==null?(Va(),vo("div",sG)):wl("",!0),t.modification!==null?(Va(),vo("div",lG)):wl("",!0),t.modification!==null?(Va(),vo("div",uG,[Fs(Bs(t.modificationDisplay)+" ",1),Qt(f,{activator:"parent",class:"foreground"},{default:ds(()=>[Fs(" Modification Mass: "+Bs(t.modificationDisplay)+" Da ",1)]),_:1})])):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.aIon&&!t.sequenceObject.bIon?(Va(),vo("div",cG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.bIon?(Va(),vo("div",hG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.cIon&&!t.sequenceObject.bIon?(Va(),vo("div",fG,Bs(t.modificationDisplay),1)):wl("",!0),t.hasExtraFragTypes?(Va(),vo("div",dG,[...e[7]||(e[7]=[en("svg",{viewBox:"0 0 10 10"},[en("circle",{cx:"5",cy:"5",r:"0.5",class:"extra-frag-circle","stroke-width":"0.3",fill:"gold"})],-1)])])):wl("",!0),en("div",pG,Bs(t.aminoAcid),1),Qt(f,{activator:"parent"},{default:ds(()=>[en("div",null,"Position: "+Bs(t.index+1),1),t.prefix!==void 0?(Va(),vo("div",mG,"Prefix: "+Bs(t.prefix),1)):wl("",!0),t.suffix!==void 0?(Va(),vo("div",gG,"Suffix: "+Bs(t.suffix),1)):wl("",!0),t.hasExtraFragTypes?(Va(),vo("div",vG,Bs(t.sequenceObject.extraTypes.join(", ")),1)):wl("",!0)]),_:1})],14,eG)}const bG=Vv(Qq,[["render",yG],["__scopeId","data-v-3401e0d8"]]),xG={default:[{typeName:"",typeMass:0}],"water loss":[{typeName:"-H2O",typeMass:-18.0105646863}],"ammonium loss":[{typeName:"-NH3",typeMass:-17.0265491015}],"proton loss/addition":[{typeName:"-H",typeMass:-1.0078250319},{typeName:"+H",typeMass:1.0078250319}]},_G=1.007276,wG={0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function TG(t){return String(t).split("").map(e=>wG[e]||e).join("")}const kG=wg({name:"SequenceView",components:{AminoAcidCell:bG},props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Cg(),e=zy();return{streamlitDataStore:t,selectionStore:e}},data(){return{rowWidth:35,fontSize:12,autoZoomApplied:!1,showFragments:!0,ionTypes:[{text:"a",selected:!1},{text:"b",selected:!0},{text:"c",selected:!1},{text:"x",selected:!1},{text:"y",selected:!0},{text:"z",selected:!1}],ionTypesExtra:{"water loss":!1,"ammonium loss":!1,"proton loss/addition":!1},fragmentMassTolerance:10,toleranceIsPpm:!0,useExternalAnnotations:!0,sequenceObjects:[],fragmentTableData:[],selectedAAIndex:void 0,selectedFragmentRowIndex:void 0,copySnackbar:!1,copySnackbarText:""}},computed:{containerStyle(){return{height:`${this.args.height||400}px`,overflowY:"auto"}},theme(){return this.streamlitDataStore.theme},sequenceData(){return this.streamlitDataStore.allDataForDrawing.sequenceData},observedMasses(){return this.streamlitDataStore.allDataForDrawing.observedMasses??[]},peakIds(){return this.streamlitDataStore.allDataForDrawing.peakIds},precursorMass(){return this.streamlitDataStore.allDataForDrawing.precursorMass??0},interactivity(){return this.args.interactivity??{}},deconvolved(){return this.args.deconvolved??!0},maxCharge(){var t;return((t=this.streamlitDataStore.allDataForDrawing)==null?void 0:t.precursorCharge)??1},sequence(){var t;return((t=this.sequenceData)==null?void 0:t.sequence)??[]},modifications(){var t;return((t=this.sequenceData)==null?void 0:t.modifications)??[]},theoreticalMass(){var t;return((t=this.sequenceData)==null?void 0:t.theoretical_mass)??0},fixedModificationSites(){var t;return((t=this.sequenceData)==null?void 0:t.fixed_modifications)??[]},externalAnnotations(){var t;return((t=this.sequenceData)==null?void 0:t.external_annotations)??[]},hasExternalAnnotations(){return this.externalAnnotations.length>0},defaultTolerance(){var t;return((t=this.sequenceData)==null?void 0:t.fragment_tolerance)??10},defaultToleranceIsPpm(){var t;return((t=this.sequenceData)==null?void 0:t.fragment_tolerance_ppm)??!0},gridClasses(){return{"sequence-grid":!0,[`grid-width-${this.rowWidth}`]:!0}},residueCleavagePercentage(){if(this.sequenceObjects.length<=1)return 0;let t=0;for(let e=0;e<this.sequenceObjects.length-1;e++){const r=this.sequenceObjects[e],c=this.sequenceObjects[e+1];(r.aIon||r.bIon||r.cIon||c.xIon||c.yIon||c.zIon)&&t++}return t/(this.sequence.length-1)*100},fragmentTableHeaders(){const t=[{title:"Name",key:"Name",sortable:!0},{title:"Ion Type",key:"IonType",sortable:!0},{title:"Ion #",key:"IonNumber",sortable:!0}];return this.deconvolved||t.push({title:"z",key:"Charge",sortable:!0}),t.push({title:this.deconvolved?"Theo. Mass":"Theo. m/z",key:"TheoreticalMass",sortable:!0},{title:this.deconvolved?"Obs. Mass":"Obs. m/z",key:"ObservedMass",sortable:!0},{title:"Δ Da",key:"MassDiffDa",sortable:!0},{title:"Δ ppm",key:"MassDiffPpm",sortable:!0}),t}},watch:{sequenceData:{handler(t,e){var R,p,f,n,s,u;const r=((R=t==null?void 0:t.sequence)==null?void 0:R.join(""))??"",c=((p=e==null?void 0:e.sequence)==null?void 0:p.join(""))??"";r!==c&&(this.autoZoomApplied=!1),this.initializeSequenceObjects(),this.applyAutoZoom(),((f=this.sequenceData)==null?void 0:f.fragment_tolerance)!==void 0&&(this.fragmentMassTolerance=this.sequenceData.fragment_tolerance),((n=this.sequenceData)==null?void 0:n.fragment_tolerance_ppm)!==void 0&&(this.toleranceIsPpm=this.sequenceData.fragment_tolerance_ppm),((s=this.sequenceData)==null?void 0:s.neutral_losses)!==void 0&&(this.ionTypesExtra["water loss"]=this.sequenceData.neutral_losses,this.ionTypesExtra["ammonium loss"]=this.sequenceData.neutral_losses),((u=this.sequenceData)==null?void 0:u.proton_loss_addition)!==void 0&&(this.ionTypesExtra["proton loss/addition"]=this.sequenceData.proton_loss_addition),this.matchFragments()},immediate:!0,deep:!0},observedMasses:{handler(){this.matchFragments()},deep:!0},ionTypes:{handler(){this.resetFragmentMarkers(),this.matchFragments()},deep:!0},ionTypesExtra:{handler(){this.resetFragmentMarkers(),this.matchFragments()},deep:!0},fragmentMassTolerance(){this.resetFragmentMarkers(),this.matchFragments()},toleranceIsPpm(){this.resetFragmentMarkers(),this.matchFragments()},useExternalAnnotations(){this.resetFragmentMarkers(),this.matchFragments()}},methods:{initializeSequenceObjects(){this.sequenceObjects=[];for(const t of this.sequence)this.sequenceObjects.push({aminoAcid:t,aIon:!1,bIon:!1,cIon:!1,xIon:!1,yIon:!1,zIon:!1,extraTypes:[]})},applyAutoZoom(){if(this.autoZoomApplied)return;const t=20,e=16;this.sequence.length>0&&this.sequence.length<=t&&(this.rowWidth=t,this.fontSize=e),this.autoZoomApplied=!0},resetFragmentMarkers(){for(const t of this.sequenceObjects)t.aIon=!1,t.bIon=!1,t.cIon=!1,t.xIon=!1,t.yIon=!1,t.zIon=!1,t.extraTypes=[]},getFragmentMasses(t){if(!this.sequenceData)return[];const e=`fragment_masses_${t}`;return this.sequenceData[e]??[]},isWithinTolerance(t,e){return this.toleranceIsPpm?Math.abs(t/e*1e6)<=this.fragmentMassTolerance:Math.abs(t)<=this.fragmentMassTolerance},markAminoAcidPosition(t,e,r){const c=this.sequence.length,p=["a","b","c"].includes(t)?e-1:c-e;if(p>=0&&p<this.sequenceObjects.length){const f=this.sequenceObjects[p],n=`${t}Ion`;f[n]=!0,r&&f.extraTypes.push(`${t}${r}`)}},matchFragmentsExternal(){const t=[];for(const e of this.externalAnnotations){let r=null,c=-1,R=1/0;for(let i=0;i<this.observedMasses.length;i++){const _=this.observedMasses[i],b=Math.abs(_-e.mz);b<R&&(R=b,r=_,c=i)}if(r===null)continue;const p=r-e.mz,f=p/e.mz*1e6;if(!this.isWithinTolerance(p,e.mz))continue;let n=0;const s=e.annotation.match(/[a-z](\d+)/i);s&&(n=parseInt(s[1],10));const u={Name:e.annotation,IonType:e.ion_type,IonNumber:n,TheoreticalMass:e.mz.toFixed(3),ObservedMass:r,MassDiffDa:p.toFixed(3),MassDiffPpm:f.toFixed(3)};e.charge>1&&(u.Charge=e.charge),this.peakIds&&c>=0&&this.peakIds[c]!==void 0&&(u.PeakId=this.peakIds[c]),t.push(u),n>0&&e.ion_type!=="unknown"&&this.markAminoAcidPosition(e.ion_type,n,"")}return t},matchFragmentsTheoretical(){const t=[];this.sequence.length;const e=Object.entries(xG).filter(([c])=>this.ionTypesExtra[c]||c==="default").map(([c,R])=>R).flat(),r=this.deconvolved?[1]:Array.from({length:this.maxCharge},(c,R)=>R+1);for(const c of this.ionTypes.filter(R=>R.selected)){const R=this.getFragmentMasses(c.text);for(let p=0;p<R.length;p++)for(const f of R[p])for(const{typeName:n,typeMass:s}of e){const u=f+s;for(const i of r){const _=this.deconvolved?u:(u+i*_G)/i;for(let b=0;b<this.observedMasses.length;b++){const w=this.observedMasses[b],v=w-_;if(this.isWithinTolerance(v,_)){const o=v/_*1e6,a=`${c.text}${p+1}${n}`,l={Name:this.deconvolved?a:`${a}${TG(i)}⁺`,IonType:`${c.text}${n}`,IonNumber:p+1,TheoreticalMass:_.toFixed(3),ObservedMass:w,MassDiffDa:v.toFixed(3),MassDiffPpm:o.toFixed(3)};this.deconvolved||(l.Charge=i),this.peakIds&&this.peakIds[b]!==void 0&&(l.PeakId=this.peakIds[b]),t.push(l),this.markAminoAcidPosition(c.text,p+1,n)}}}}}return t},matchFragments(){if(this.sequence.length===0||this.observedMasses.length===0){this.fragmentTableData=[],this.streamlitDataStore.setAnnotations(null);return}this.useExternalAnnotations&&this.hasExternalAnnotations?this.fragmentTableData=this.matchFragmentsExternal():this.fragmentTableData=this.matchFragmentsTheoretical();const t=[],e=[],r=[];for(const f of this.fragmentTableData)if(f.PeakId!==void 0){t.push(f.PeakId);const n=f.IonType.charAt(0).toLowerCase(),s=["a","b","c"].includes(n)?"#E4572E":"#1f77b4";e.push(s),r.push(f.Name)}const c=this.streamlitDataStore.annotations,R=(c==null?void 0:c.peak_id)??[],p=t.length!==R.length||t.some((f,n)=>f!==R[n]);t.length>0?this.streamlitDataStore.setAnnotations({peak_id:t,highlight_color:e,annotation:r}):this.streamlitDataStore.setAnnotations(null),p&&this.selectionStore.$patch({counter:(this.selectionStore.$state.counter||0)+1})},isFixedModification(t){return this.fixedModificationSites.includes(t)},onAminoAcidSelected(t){this.selectedAAIndex=t;const e=this.sequenceObjects[t];let r="";if(e.bIon?r=`b${t+1}`:e.aIon?r=`a${t+1}`:e.cIon?r=`c${t+1}`:e.yIon?r=`y${this.sequence.length-t}`:e.xIon?r=`x${this.sequence.length-t}`:e.zIon&&(r=`z${this.sequence.length-t}`),r){const c=this.fragmentTableData.findIndex(R=>R.Name===r);c>=0&&(this.selectedFragmentRowIndex=c)}},onFragmentTableRowClick(t,{item:e}){const r=e.IonType.charAt(0),c=e.IonNumber,p=["a","b","c"].includes(r)?c-1:this.sequence.length-c;if(p>=0&&p<this.sequenceObjects.length&&(this.selectedAAIndex=p),e.PeakId!==void 0&&Object.keys(this.interactivity).length>0)for(const[f,n]of Object.entries(this.interactivity))this.selectionStore.updateSelection(f,e.PeakId)},getRowProps({index:t}){return{class:t===this.selectedFragmentRowIndex?"bg-amber-lighten-4":""}},async copySequence(){try{const t=this.sequence.join("");await navigator.clipboard.writeText(t),this.copySnackbarText="Sequence copied to clipboard!",this.copySnackbar=!0}catch(t){this.copySnackbarText="Failed to copy sequence",this.copySnackbar=!0,console.error("Copy failed:",t)}}}}),SG={class:"d-flex justify-end px-4 mb-4"},AG={class:"d-flex justify-space-evenly"},CG={class:"d-flex justify-space-evenly"},MG={class:"d-flex align-center ga-2"},EG={key:0,class:"d-flex justify-center align-center row-number"},IG={key:1,class:"d-flex justify-center align-center terminal-cell"},LG={key:2,class:"d-flex justify-center align-center row-number"},PG={key:3,class:"d-flex justify-center align-center terminal-cell"},DG={key:0,class:"mt-4"},RG={class:"d-flex justify-space-between align-center mb-2"},OG={class:"text-caption"};function zG(t,e,r,c,R,p){var A;const f=iu("v-icon"),n=iu("v-tooltip"),s=iu("v-btn"),u=iu("v-list-item-title"),i=iu("v-slider"),_=iu("v-list-item"),b=iu("v-checkbox"),w=iu("v-text-field"),v=iu("v-btn-toggle"),o=iu("v-list-item-subtitle"),a=iu("v-list"),h=iu("v-card"),l=iu("v-menu"),m=iu("AminoAcidCell"),y=iu("v-divider"),x=iu("v-data-table"),S=iu("v-sheet"),C=iu("v-snackbar");return Va(),vo("div",{class:"sequence-view-container",style:ii(t.containerStyle)},[Qt(S,{class:"pa-4 rounded-lg",theme:((A=t.theme)==null?void 0:A.base)??"light",border:""},{default:ds(()=>[e[18]||(e[18]=en("div",{class:"d-flex justify-center mb-2"},[en("h4",null,"Sequence View")],-1)),en("div",SG,[Qt(s,{variant:"text",icon:"",size:"small",disabled:t.sequence.length===0,onClick:t.copySequence},{default:ds(()=>[Qt(f,null,{default:ds(()=>[...e[7]||(e[7]=[Fs("mdi-content-copy",-1)])]),_:1}),Qt(n,{activator:"parent",location:"bottom"},{default:ds(()=>[...e[8]||(e[8]=[Fs("Copy sequence to clipboard",-1)])]),_:1})]),_:1},8,["disabled","onClick"]),Qt(s,{id:"settings-btn",variant:"text",icon:"",size:"small"},{default:ds(()=>[Qt(f,null,{default:ds(()=>[...e[9]||(e[9]=[Fs("mdi-cog",-1)])]),_:1})]),_:1}),Qt(l,{"close-on-content-click":!1,activator:"#settings-btn",location:"bottom"},{default:ds(()=>[Qt(h,{"min-width":"300"},{default:ds(()=>[Qt(a,null,{default:ds(()=>[Qt(_,null,{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[10]||(e[10]=[Fs("# amino acids per row",-1)])]),_:1}),Qt(i,{modelValue:t.rowWidth,"onUpdate:modelValue":e[0]||(e[0]=E=>t.rowWidth=E),ticks:{20:"20",25:"25",30:"30",35:"35",40:"40"},min:20,max:40,step:"5","show-ticks":"always","tick-size":"4"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[11]||(e[11]=[Fs("Font Size",-1)])]),_:1}),Qt(i,{modelValue:t.fontSize,"onUpdate:modelValue":e[1]||(e[1]=E=>t.fontSize=E),ticks:{8:"8",10:"10",12:"12",14:"14",16:"16"},min:8,max:16,step:"2","show-ticks":"always","tick-size":"4"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[12]||(e[12]=[Fs("Show Fragments",-1)])]),_:1}),Qt(b,{modelValue:t.showFragments,"onUpdate:modelValue":e[2]||(e[2]=E=>t.showFragments=E),"hide-details":"",density:"comfortable"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[13]||(e[13]=[Fs("Fragment ion types",-1)])]),_:1}),en("div",AG,[(Va(!0),vo(yi,null,z_(t.ionTypes,E=>(Va(),ty(b,{key:E.text,modelValue:E.selected,"onUpdate:modelValue":P=>E.selected=P,label:E.text,disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","onUpdate:modelValue","label","disabled"]))),128))]),en("div",CG,[(Va(!0),vo(yi,null,z_(t.ionTypesExtra,(E,P)=>(Va(),ty(b,{key:P,modelValue:t.ionTypesExtra[P],"onUpdate:modelValue":M=>t.ionTypesExtra[P]=M,label:P,disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","onUpdate:modelValue","label","disabled"]))),128))])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[14]||(e[14]=[Fs("Fragment mass tolerance",-1)])]),_:1}),en("div",MG,[Qt(w,{modelValue:t.fragmentMassTolerance,"onUpdate:modelValue":e[3]||(e[3]=E=>t.fragmentMassTolerance=E),modelModifiers:{number:!0},type:"number","hide-details":"auto",disabled:!t.showFragments,density:"compact",style:{"max-width":"100px"}},null,8,["modelValue","disabled"]),Qt(v,{modelValue:t.toleranceIsPpm,"onUpdate:modelValue":e[4]||(e[4]=E=>t.toleranceIsPpm=E),mandatory:"",density:"compact",disabled:!t.showFragments},{default:ds(()=>[Qt(s,{value:!0,size:"small"},{default:ds(()=>[...e[15]||(e[15]=[Fs("ppm",-1)])]),_:1}),Qt(s,{value:!1,size:"small"},{default:ds(()=>[...e[16]||(e[16]=[Fs("Da",-1)])]),_:1})]),_:1},8,["modelValue","disabled"])])]),_:1}),t.hasExternalAnnotations?(Va(),ty(_,{key:0},{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[17]||(e[17]=[Fs("Use search engine annotations",-1)])]),_:1}),Qt(b,{modelValue:t.useExternalAnnotations,"onUpdate:modelValue":e[5]||(e[5]=E=>t.useExternalAnnotations=E),disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","disabled"]),Qt(o,{class:"text-caption"},{default:ds(()=>[Fs(Bs(t.externalAnnotations.length)+" annotations from idXML ",1)]),_:1})]),_:1})):wl("",!0)]),_:1})]),_:1})]),_:1})]),en("div",{class:jr(["px-2 pb-4",t.gridClasses]),style:{width:"100%","max-width":"100%"}},[(Va(!0),vo(yi,null,z_(t.sequenceObjects,(E,P)=>(Va(),vo(yi,{key:P},[P!==0&&P%t.rowWidth===0?(Va(),vo("div",EG,Bs(P+1),1)):wl("",!0),P===0?(Va(),vo("div",IG,"N")):wl("",!0),Qt(m,{"sequence-object":E,index:P,"sequence-length":t.sequence.length,"fixed-modification":t.isFixedModification(E.aminoAcid),"show-fragments":t.showFragments,"font-size":t.fontSize,"is-highlighted":t.selectedAAIndex===P,modification:t.modifications[P]??null,onSelected:t.onAminoAcidSelected},null,8,["sequence-object","index","sequence-length","fixed-modification","show-fragments","font-size","is-highlighted","modification","onSelected"]),P%t.rowWidth===t.rowWidth-1&&P!==t.sequence.length-1?(Va(),vo("div",LG,Bs(P+1),1)):wl("",!0),P===t.sequence.length-1?(Va(),vo("div",PG," C ")):wl("",!0)],64))),128))],2),t.showFragments&&t.fragmentTableData.length>0?(Va(),vo("div",DG,[Qt(y,{class:"mb-4"}),en("div",RG,[en("h5",null,"Matching Fragments ("+Bs(t.fragmentTableData.length)+")",1),en("span",OG,"Residue cleavage: "+Bs(t.residueCleavagePercentage.toFixed(1))+"%",1)]),Qt(x,{headers:t.fragmentTableHeaders,items:t.fragmentTableData,"items-per-page":10,density:"compact",class:"elevation-1","row-props":t.getRowProps,"onClick:row":t.onFragmentTableRowClick},null,8,["headers","items","row-props","onClick:row"])])):wl("",!0)]),_:1},8,["theme"]),Qt(C,{modelValue:t.copySnackbar,"onUpdate:modelValue":e[6]||(e[6]=E=>t.copySnackbar=E),timeout:2e3,location:"bottom"},{default:ds(()=>[Fs(Bs(t.copySnackbarText),1)]),_:1},8,["modelValue"])],4)}const m6=Vv(kG,[["render",zG],["__scopeId","data-v-3b89d373"]]),FG=wg({name:"App",components:{TabulatorTable:c6,PlotlyLineplot:h6,PlotlyHeatmap:f6,PlotlyVolcano:p6,SequenceView:m6},setup(){const t=Cg(),e=zy();let r,c,R;const p=()=>{const f=e.$state.counter,n=t.hash||null,s=t.annotations,u=s?JSON.stringify(s.peak_id):void 0;if(f===r&&n===c&&u===R)return;r=f,c=n??void 0,R=u;const i=JSON.parse(JSON.stringify(e.$state));i._vueDataHash=n,s&&(i._annotations=JSON.parse(JSON.stringify(s))),t.requestData&&(i._requestData=!0,t.clearRequestData()),console.log("[Vue] sendStateToStreamlit",{counter:f,hash:n==null?void 0:n.substring(0,8),hasAnnotations:!!s,requestData:i._requestData}),Hc.setComponentValue(i)};return ei(()=>e.$state.counter,p,{immediate:!0}),ei(()=>t.hash,p),ei(()=>t.annotations,p,{deep:!0}),ei(()=>t.requestData,f=>{f&&p()}),ei(()=>{var f;return(f=t.allDataForDrawing)==null?void 0:f.height},f=>{f&&typeof f=="number"&&Hc.setFrameHeight(f)},{immediate:!0}),{streamlitDataStore:t,selectionStore:e}},data(){return{resizeObserver:void 0}},computed:{componentArgs(){var e;const t=(e=this.streamlitDataStore.args)==null?void 0:e.components;if(t&&t.length>0&&t[0].length>0)return t[0][0].componentArgs},currentComponent(){var e;const t=(e=this.componentArgs)==null?void 0:e.componentType;switch(t){case"TabulatorTable":return c6;case"PlotlyLineplotUnified":case"PlotlyLineplot":return h6;case"PlotlyHeatmap":return f6;case"PlotlyVolcano":return p6;case"SequenceView":return m6;default:return console.warn(`Unknown component type: ${t}`),null}}},created(){Hc.setComponentReady(),Hc.setFrameHeight(400),Hc.events.addEventListener(Hc.RENDER_EVENT,this.updateStreamlitData)},mounted(){this.resizeObserver=new ResizeObserver(()=>{Hc.setFrameHeight()}),this.resizeObserver.observe(this.$el)},unmounted(){Hc.events.removeEventListener(Hc.RENDER_EVENT,this.updateStreamlitData),this.resizeObserver&&this.resizeObserver.disconnect()},methods:{async updateStreamlitData(t){this.streamlitDataStore.updateRenderData(t.detail)}}}),BG={key:0},NG={key:1,class:"d-flex w-100",style:{height:"200px"}};function VG(t,e,r,c,R,p){const f=iu("v-progress-linear"),n=iu("v-alert");return t.componentArgs!==void 0?(Va(),vo("div",BG,[(Va(),ty(ME(t.currentComponent),{args:t.componentArgs,index:0},null,8,["args"]))])):(Va(),vo("div",NG,[Qt(n,{class:"h-50 ma-8",icon:"mdi-application-variable-outline",title:"Loading...",type:"info",density:"compact"},{default:ds(()=>[Qt(f,{indeterminate:""})]),_:1})]))}const jG=Vv(FG,[["render",VG]]);function y9(t,e){e=Array.isArray(e)?e.slice(0,-1).map(r=>`'${r}'`).join(", ")+` or '${e.at(-1)}'`:`'${e}'`}const Ro=typeof window<"u",q4=Ro&&"IntersectionObserver"in window,UG=Ro&&("ontouchstart"in window||window.navigator.maxTouchPoints>0),g6=Ro&&"EyeDropper"in window,G4=Ro&&"matchMedia"in window&&typeof window.matchMedia=="function",mp=()=>G4&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function v6(t,e,r){HG(t,e),e.set(t,r)}function HG(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function y6(t,e,r){return t.set(b9(t,e),r),r}function Op(t,e){return t.get(b9(t,e))}function b9(t,e,r){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:r;throw new TypeError("Private element is not present on this object")}function x9(t,e,r){const c=e.length-1;if(c<0)return t===void 0?r:t;for(let R=0;R<c;R++){if(t==null)return r;t=t[e[R]]}return t==null||t[e[c]]===void 0?r:t[e[c]]}function Lv(t,e,r){return t==null||!e||typeof e!="string"?r:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),x9(t,e.split("."),r))}function au(t,e,r){if(e===!0)return t===void 0?r:t;if(e==null||typeof e=="boolean")return r;if(t!==Object(t)){if(typeof e!="function")return r;const R=e(t,r);return typeof R>"u"?r:R}if(typeof e=="string")return Lv(t,e,r);if(Array.isArray(e))return x9(t,e,r);if(typeof e!="function")return r;const c=e(t,r);return typeof c>"u"?r:c}function If(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Array.from({length:t},(r,c)=>e+c)}function ai(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"px";if(t==null||t==="")return;const r=Number(t);return isNaN(r)?String(t):isFinite(r)?`${r}${e}`:void 0}function pg(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function UT(t){let e;return t!==null&&typeof t=="object"&&((e=Object.getPrototypeOf(t))===Object.prototype||e===null)}function $4(t){if(t&&"$el"in t){const e=t.$el;return(e==null?void 0:e.nodeType)===Node.TEXT_NODE?e.nextElementSibling:e}return t}const HT=Object.freeze({enter:"Enter",tab:"Tab",delete:"Delete",esc:"Escape",space:"Space",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",end:"End",home:"Home",del:"Delete",backspace:"Backspace",insert:"Insert",pageup:"PageUp",pagedown:"PageDown",shift:"Shift"});function _9(t){return Object.keys(t)}function mv(t,e){return e.every(r=>t.hasOwnProperty(r))}function Jh(t,e){const r={};for(const c of e)Object.prototype.hasOwnProperty.call(t,c)&&(r[c]=t[c]);return r}function WT(t,e,r){const c=Object.create(null),R=Object.create(null);for(const p in t)e.some(f=>f instanceof RegExp?f.test(p):f===p)?c[p]=t[p]:R[p]=t[p];return[c,R]}function Ga(t,e){const r={...t};return e.forEach(c=>delete r[c]),r}const w9=/^on[^a-z]/,Y4=t=>w9.test(t),WG=["onAfterscriptexecute","onAnimationcancel","onAnimationend","onAnimationiteration","onAnimationstart","onAuxclick","onBeforeinput","onBeforescriptexecute","onChange","onClick","onCompositionend","onCompositionstart","onCompositionupdate","onContextmenu","onCopy","onCut","onDblclick","onFocusin","onFocusout","onFullscreenchange","onFullscreenerror","onGesturechange","onGestureend","onGesturestart","onGotpointercapture","onInput","onKeydown","onKeypress","onKeyup","onLostpointercapture","onMousedown","onMousemove","onMouseout","onMouseover","onMouseup","onMousewheel","onPaste","onPointercancel","onPointerdown","onPointerenter","onPointerleave","onPointermove","onPointerout","onPointerover","onPointerup","onReset","onSelect","onSubmit","onTouchcancel","onTouchend","onTouchmove","onTouchstart","onTransitioncancel","onTransitionend","onTransitionrun","onTransitionstart","onWheel"],qG=["ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Enter","Escape","Tab"," "];function GG(t){return t.isComposing&&qG.includes(t.key)}function Mg(t){const[e,r]=WT(t,[w9]),c=Ga(e,WG),[R,p]=WT(r,["class","style","id",/^data-/]);return Object.assign(R,e),Object.assign(p,c),[R,p]}function Ss(t){return t==null?[]:Array.isArray(t)?t:[t]}function T9(t,e){let r=0;const c=function(){for(var R=arguments.length,p=new Array(R),f=0;f<R;f++)p[f]=arguments[f];clearTimeout(r),r=setTimeout(()=>t(...p),$h(e))};return c.clear=()=>{clearTimeout(r)},c.immediate=t,c}function Vo(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;return Math.max(e,Math.min(r,t))}function b6(t){const e=t.toString().trim();return e.includes(".")?e.length-e.indexOf(".")-1:0}function x6(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0";return t+r.repeat(Math.max(0,e-t.length))}function _6(t,e){return(arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0").repeat(Math.max(0,e-t.length))+t}function $G(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const r=[];let c=0;for(;c<t.length;)r.push(t.substr(c,e)),c+=e;return r}function w6(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e3;if(t<e)return`${t} B`;const r=e===1024?["Ki","Mi","Gi"]:["k","M","G"];let c=-1;for(;Math.abs(t)>=e&&c<r.length-1;)t/=e,++c;return`${t.toFixed(1)} ${r[c]}B`}function oh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;const c={};for(const R in t)c[R]=t[R];for(const R in e){const p=t[R],f=e[R];if(UT(p)&&UT(f)){c[R]=oh(p,f,r);continue}if(r&&Array.isArray(p)&&Array.isArray(f)){c[R]=r(p,f);continue}c[R]=f}return c}function k9(t){return t.map(e=>e.type===yi?k9(e.children):e).flat()}function _v(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(_v.cache.has(t))return _v.cache.get(t);const e=t.replace(/[^a-z]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase();return _v.cache.set(t,e),e}_v.cache=new Map;function G0(t,e){if(!e||typeof e!="object")return[];if(Array.isArray(e))return e.map(r=>G0(t,r)).flat(1);if(e.suspense)return G0(t,e.ssContent);if(Array.isArray(e.children))return e.children.map(r=>G0(t,r)).flat(1);if(e.component){if(Object.getOwnPropertyDescriptor(e.component.provides,t))return[e.component];if(e.component.subTree)return G0(t,e.component.subTree).flat(1)}return[]}var M0=new WeakMap,iv=new WeakMap;class S9{constructor(e){v6(this,M0,[]),v6(this,iv,0),this.size=e}get isFull(){return Op(M0,this).length===this.size}push(e){Op(M0,this)[Op(iv,this)]=e,y6(iv,this,(Op(iv,this)+1)%this.size)}values(){return Op(M0,this).slice(Op(iv,this)).concat(Op(M0,this).slice(0,Op(iv,this)))}clear(){Op(M0,this).length=0,y6(iv,this,0)}}function YG(t){return"touches"in t?{clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:{clientX:t.clientX,clientY:t.clientY}}function Z4(t){const e=cc({});fl(()=>{const c=t();for(const R in c)e[R]=c[R]},{flush:"sync"});const r={};for(const c in e)r[c]=Nn(()=>e[c]);return r}function V2(t,e){return t.includes(e)}function A9(t){return t[2].toLowerCase()+t.slice(3)}const qc=()=>[Function,Array];function T6(t,e){return e="on"+bp(e),!!(t[e]||t[`${e}Once`]||t[`${e}Capture`]||t[`${e}OnceCapture`]||t[`${e}CaptureOnce`])}function lx(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),c=1;c<e;c++)r[c-1]=arguments[c];if(Array.isArray(t))for(const R of t)R(...r);else typeof t=="function"&&t(...r)}function wv(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const r=["button","[href]",'input:not([type="hidden"])',"select","textarea","details:not(:has(> summary))","details > summary","[tabindex]",'[contenteditable]:not([contenteditable="false"])',"audio[controls]","video[controls]"].map(R=>`${R}${e?':not([tabindex="-1"])':""}:not([disabled], [inert])`).join(", ");let c;try{c=[...t.querySelectorAll(r)]}catch{return[]}return c.filter(R=>!R.closest("[inert]")).filter(R=>!!R.offsetParent||R.getClientRects().length>0).filter(R=>{var p,f;return!((p=R.parentElement)!=null&&p.closest("details:not([open])"))||R.tagName==="SUMMARY"&&((f=R.parentElement)==null?void 0:f.tagName)==="DETAILS"})}function C9(t,e,r){let c,R=t.indexOf(document.activeElement);const p=e==="next"?1:-1;do R+=p,c=t[R];while((!c||c.offsetParent==null||!((r==null?void 0:r(c))??!0))&&R<t.length&&R>=0);return c}function Tv(t,e){var c,R,p,f;const r=wv(t);if(e==null)(t===document.activeElement||!t.contains(document.activeElement))&&((c=r[0])==null||c.focus());else if(e==="first")(R=r[0])==null||R.focus();else if(e==="last")(p=r.at(-1))==null||p.focus();else if(typeof e=="number")(f=r[e])==null||f.focus();else{const n=C9(r,e);n?n.focus():Tv(t,e==="next"?"first":"last")}}function C_(t){return t==null||typeof t=="string"&&t.trim()===""}function Pw(){}function wy(t,e){if(!(Ro&&typeof CSS<"u"&&typeof CSS.supports<"u"&&CSS.supports(`selector(${e})`)))return null;try{return!!t&&t.matches(e)}catch{return null}}function Dw(t){return t.some(e=>yb(e)?e.type===Ch?!1:e.type!==yi||Dw(e.children):!0)?t:null}function M_(t,e,r){return(t==null?void 0:t(e))??(r==null?void 0:r(e))}function ZG(t,e){if(!Ro||t===0)return e(),()=>{};const r=window.setTimeout(e,t);return()=>window.clearTimeout(r)}function XG(t,e){const r=t.clientX,c=t.clientY,R=e.getBoundingClientRect(),p=R.left,f=R.top,n=R.right,s=R.bottom;return r>=p&&r<=n&&c>=f&&c<=s}function j2(){const t=ni(),e=r=>{t.value=r};return Object.defineProperty(e,"value",{enumerable:!0,get:()=>t.value,set:r=>t.value=r}),Object.defineProperty(e,"el",{enumerable:!0,get:()=>$4(t.value)}),e}function Ty(t){const e=t.key.length===1,r=!t.ctrlKey&&!t.metaKey&&!t.altKey;return e&&r}function mg(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"}function U2(t){return"\\^$*+?.()|{}[]".includes(t)?`\\${t}`:t}function KG(t,e,r){const c=new RegExp(`[\\d\\-${U2(r)}]`),R=t.split("").filter(f=>c.test(f)).filter((f,n,s)=>n===0&&/[-]/.test(f)||f===r&&n===s.indexOf(f)||/\d/.test(f)).join("");if(e===0)return R.split(r)[0];const p=new RegExp(`${U2(r)}\\d`);if(e!==null&&p.test(R)){const f=R.split(r);return[f[0],f[1].substring(0,e)].join(r)}return R}function JG(t){const e={};for(const r in t)e[Kh(r)]=t[r];return e}function QG(t){const e=["checked","disabled"];return Object.fromEntries(Object.entries(t).filter(r=>{let[c,R]=r;return e.includes(c)?!!R:R!==void 0}))}function k6(t){const e=r=>Array.isArray(r)?r.map(c=>e(c)):Xs(r)||lp(r)||Yb(r)?e(Zi(r)):UT(r)?Object.keys(r).reduce((c,R)=>(c[R]=e(r[R]),c),{}):r;return e(t)}const M9=["top","bottom"],e$=["start","end","left","right"];function qT(t,e){let[r,c]=t.split(" ");return c||(c=V2(M9,r)?"start":V2(e$,r)?"top":"center"),{side:GT(r,e),align:GT(c,e)}}function GT(t,e){return t==="start"?e?"right":"left":t==="end"?e?"left":"right":t}function y5(t){return{side:{center:"center",top:"bottom",bottom:"top",left:"right",right:"left"}[t.side],align:t.align}}function b5(t){return{side:t.side,align:{center:"center",top:"bottom",bottom:"top",left:"right",right:"left"}[t.align]}}function S6(t){return{side:t.align,align:t.side}}function A6(t){return V2(M9,t.side)?"y":"x"}class rd{constructor(e){const r=document.body.currentCSSZoom??1,c=e instanceof Element,R=c?1+(1-r)/r:1,{x:p,y:f,width:n,height:s}=c?e.getBoundingClientRect():e;this.x=p*R,this.y=f*R,this.width=n*R,this.height=s*R}get top(){return this.y}get bottom(){return this.y+this.height}get left(){return this.x}get right(){return this.x+this.width}}function C6(t,e){return{x:{before:Math.max(0,e.left-t.left),after:Math.max(0,t.right-e.right)},y:{before:Math.max(0,e.top-t.top),after:Math.max(0,t.bottom-e.bottom)}}}function E9(t){if(Array.isArray(t)){const e=document.body.currentCSSZoom??1,r=1+(1-e)/e;return new rd({x:t[0]*r,y:t[1]*r,width:0*r,height:0*r})}else return new rd(t)}function t$(t){if(t===document.documentElement)if(visualViewport){const e=document.body.currentCSSZoom??1;return new rd({x:visualViewport.scale>1?0:visualViewport.offsetLeft,y:visualViewport.scale>1?0:visualViewport.offsetTop,width:visualViewport.width*visualViewport.scale/e,height:visualViewport.height*visualViewport.scale/e})}else return new rd({x:0,y:0,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight});else return new rd(t)}function X4(t){const e=new rd(t),r=getComputedStyle(t),c=r.transform;if(c){let R,p,f,n,s;if(c.startsWith("matrix3d("))R=c.slice(9,-1).split(/, /),p=Number(R[0]),f=Number(R[5]),n=Number(R[12]),s=Number(R[13]);else if(c.startsWith("matrix("))R=c.slice(7,-1).split(/, /),p=Number(R[0]),f=Number(R[3]),n=Number(R[4]),s=Number(R[5]);else return new rd(e);const u=r.transformOrigin,i=e.x-n-(1-p)*parseFloat(u),_=e.y-s-(1-f)*parseFloat(u.slice(u.indexOf(" ")+1)),b=p?e.width/p:t.offsetWidth+1,w=f?e.height/f:t.offsetHeight+1;return new rd({x:i,y:_,width:b,height:w})}else return new rd(e)}function qp(t,e,r){if(typeof t.animate>"u")return{finished:Promise.resolve()};let c;try{c=t.animate(e,r)}catch{return{finished:Promise.resolve()}}return typeof c.finished>"u"&&(c.finished=new Promise(R=>{c.onfinish=()=>{R(c)}})),c}const Z_=new WeakMap;function n$(t,e){Object.keys(e).forEach(r=>{if(Y4(r)){const c=A9(r),R=Z_.get(t);if(e[r]==null)R==null||R.forEach(p=>{const[f,n]=p;f===c&&(t.removeEventListener(c,n),R.delete(p))});else if(!R||![...R].some(p=>p[0]===c&&p[1]===e[r])){t.addEventListener(c,e[r]);const p=R||new Set;p.add([c,e[r]]),Z_.has(t)||Z_.set(t,p)}}else e[r]==null?t.removeAttribute(r):t.setAttribute(r,e[r])})}function r$(t,e){Object.keys(e).forEach(r=>{if(Y4(r)){const c=A9(r),R=Z_.get(t);R==null||R.forEach(p=>{const[f,n]=p;f===c&&(t.removeEventListener(c,n),R.delete(p))})}else t.removeAttribute(r)})}const E0=2.4,M6=.2126729,E6=.7151522,I6=.072175,i$=.55,a$=.58,o$=.57,s$=.62,E_=.03,L6=1.45,l$=5e-4,u$=1.25,c$=1.25,P6=.078,D6=12.82051282051282,I_=.06,R6=.001;function O6(t,e){const r=(t.r/255)**E0,c=(t.g/255)**E0,R=(t.b/255)**E0,p=(e.r/255)**E0,f=(e.g/255)**E0,n=(e.b/255)**E0;let s=r*M6+c*E6+R*I6,u=p*M6+f*E6+n*I6;if(s<=E_&&(s+=(E_-s)**L6),u<=E_&&(u+=(E_-u)**L6),Math.abs(u-s)<l$)return 0;let i;if(u>s){const _=(u**i$-s**a$)*u$;i=_<R6?0:_<P6?_-_*D6*I_:_-I_}else{const _=(u**s$-s**o$)*c$;i=_>-R6?0:_>-P6?_-_*D6*I_:_+I_}return i*100}const H2=.20689655172413793,h$=t=>t>H2**3?Math.cbrt(t):t/(3*H2**2)+4/29,f$=t=>t>H2?t**3:3*H2**2*(t-4/29);function I9(t){const e=h$,r=e(t[1]);return[116*r-16,500*(e(t[0]/.95047)-r),200*(r-e(t[2]/1.08883))]}function L9(t){const e=f$,r=(t[0]+16)/116;return[e(r+t[1]/500)*.95047,e(r),e(r-t[2]/200)*1.08883]}const d$=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]],p$=t=>t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055,m$=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],g$=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4;function P9(t){const e=Array(3),r=p$,c=d$;for(let R=0;R<3;++R)e[R]=Math.round(Vo(r(c[R][0]*t[0]+c[R][1]*t[1]+c[R][2]*t[2]))*255);return{r:e[0],g:e[1],b:e[2]}}function K4(t){let{r:e,g:r,b:c}=t;const R=[0,0,0],p=g$,f=m$;e=p(e/255),r=p(r/255),c=p(c/255);for(let n=0;n<3;++n)R[n]=f[n][0]*e+f[n][1]*r+f[n][2]*c;return R}function $T(t){return!!t&&/^(#|var\(--|(rgb|hsl)a?\()/.test(t)}function v$(t){return $T(t)&&!/^((rgb|hsl)a?\()?var\(--/.test(t)}const z6=/^(?<fn>(?:rgb|hsl)a?)\((?<values>.+)\)/,y$={rgb:(t,e,r,c)=>({r:t,g:e,b:r,a:c}),rgba:(t,e,r,c)=>({r:t,g:e,b:r,a:c}),hsl:(t,e,r,c)=>F6({h:t,s:e,l:r,a:c}),hsla:(t,e,r,c)=>F6({h:t,s:e,l:r,a:c}),hsv:(t,e,r,c)=>gp({h:t,s:e,v:r,a:c}),hsva:(t,e,r,c)=>gp({h:t,s:e,v:r,a:c})};function Lf(t){if(typeof t=="number")return{r:(t&16711680)>>16,g:(t&65280)>>8,b:t&255};if(typeof t=="string"&&z6.test(t)){const{groups:e}=t.match(z6),{fn:r,values:c}=e,R=c.split(/,\s*|\s*\/\s*|\s+/).map((p,f)=>p.endsWith("%")||f>0&&f<3&&["hsl","hsla","hsv","hsva"].includes(r)?parseFloat(p)/100:parseFloat(p));return y$[r](...R)}else if(typeof t=="string"){let e=t.startsWith("#")?t.slice(1):t;return[3,4].includes(e.length)?e=e.split("").map(r=>r+r).join(""):[6,8].includes(e.length),z9(e)}else if(typeof t=="object"){if(mv(t,["r","g","b"]))return t;if(mv(t,["h","s","l"]))return gp(J4(t));if(mv(t,["h","s","v"]))return gp(t)}throw new TypeError(`Invalid color: ${t==null?t:String(t)||t.constructor.name}
4213
+ `),At=de.createShader(de.FRAGMENT_SHADER);if(de.isContextLost())return void(this.failedToCreate=!0);if(de.shaderSource(At,kt),de.compileShader(At),!de.getShaderParameter(At,de.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${de.getShaderInfoLog(At)}`);de.attachShader(this.program,At);const $t=de.createShader(de.VERTEX_SHADER);if(de.isContextLost())return void(this.failedToCreate=!0);if(de.shaderSource($t,Bt),de.compileShader($t),!de.getShaderParameter($t,de.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${de.getShaderInfoLog($t)}`);de.attachShader(this.program,$t),this.attributes={};const Kt={};this.numAttributes=Re.length;for(let Yt=0;Yt<this.numAttributes;Yt++)Re[Yt]&&(de.bindAttribLocation(this.program,Yt,Re[Yt]),this.attributes[Re[Yt]]=Yt);if(de.linkProgram(this.program),!de.getProgramParameter(this.program,de.LINK_STATUS))throw new Error(`Program failed to link: ${de.getProgramInfoLog(this.program)}`);de.deleteShader($t),de.deleteShader(At);for(let Yt=0;Yt<yt.length;Yt++){const pn=yt[Yt];if(pn&&!Kt[pn]){const Tn=de.getUniformLocation(this.program,pn);Tn&&(Kt[pn]=Tn)}}this.fixedUniforms=j(d,Kt),this.terrainUniforms=((Yt,pn)=>({u_depth:new i.aI(Yt,pn.u_depth),u_terrain:new i.aI(Yt,pn.u_terrain),u_terrain_dim:new i.aJ(Yt,pn.u_terrain_dim),u_terrain_matrix:new i.aK(Yt,pn.u_terrain_matrix),u_terrain_unpack:new i.aL(Yt,pn.u_terrain_unpack),u_terrain_exaggeration:new i.aJ(Yt,pn.u_terrain_exaggeration)}))(d,Kt),this.binderUniforms=z?z.getUniforms(d,Kt):[]}draw(d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft,yt,Ct,kt,Bt){const At=d.gl;if(this.failedToCreate)return;if(d.program.set(this.program),d.setDepthMode(z),d.setStencilMode(j),d.setColorMode($),d.setCullFace(ie),xe){d.activeTexture.set(At.TEXTURE2),At.bindTexture(At.TEXTURE_2D,xe.depthTexture),d.activeTexture.set(At.TEXTURE3),At.bindTexture(At.TEXTURE_2D,xe.texture);for(const Kt in this.terrainUniforms)this.terrainUniforms[Kt].set(xe[Kt])}for(const Kt in this.fixedUniforms)this.fixedUniforms[Kt].set(de[Kt]);yt&&yt.setUniforms(d,this.binderUniforms,lt,{zoom:ft});let $t=0;switch(g){case At.LINES:$t=2;break;case At.TRIANGLES:$t=3;break;case At.LINE_STRIP:$t=1}for(const Kt of tt.get()){const Yt=Kt.vaos||(Kt.vaos={});(Yt[Ae]||(Yt[Ae]=new Yr)).bind(d,this,Re,yt?yt.getPaintVertexBuffers():[],je,Kt.vertexOffset,Ct,kt,Bt),At.drawElements(g,Kt.primitiveLength*$t,At.UNSIGNED_SHORT,Kt.primitiveOffset*$t*2)}}}function Wn(V,d,g){const z=1/Tt(g,1,d.transform.tileZoom),j=Math.pow(2,g.tileID.overscaledZ),$=g.tileSize*Math.pow(2,d.transform.tileZoom)/j,ie=$*(g.tileID.canonical.x+g.tileID.wrap*j),de=$*g.tileID.canonical.y;return{u_image:0,u_texsize:g.imageAtlasTexture.size,u_scale:[z,V.fromScale,V.toScale],u_fade:V.t,u_pixel_coord_upper:[ie>>16,de>>16],u_pixel_coord_lower:[65535&ie,65535&de]}}const sr=(V,d,g,z)=>{const j=d.style.light,$=j.properties.get("position"),ie=[$.x,$.y,$.z],de=function(){var Ae=new i.A(9);return i.A!=Float32Array&&(Ae[1]=0,Ae[2]=0,Ae[3]=0,Ae[5]=0,Ae[6]=0,Ae[7]=0),Ae[0]=1,Ae[4]=1,Ae[8]=1,Ae}();j.properties.get("anchor")==="viewport"&&function(Ae,Re){var je=Math.sin(Re),tt=Math.cos(Re);Ae[0]=tt,Ae[1]=je,Ae[2]=0,Ae[3]=-je,Ae[4]=tt,Ae[5]=0,Ae[6]=0,Ae[7]=0,Ae[8]=1}(de,-d.transform.angle),function(Ae,Re,je){var tt=Re[0],lt=Re[1],ft=Re[2];Ae[0]=tt*je[0]+lt*je[3]+ft*je[6],Ae[1]=tt*je[1]+lt*je[4]+ft*je[7],Ae[2]=tt*je[2]+lt*je[5]+ft*je[8]}(ie,ie,de);const xe=j.properties.get("color");return{u_matrix:V,u_lightpos:ie,u_lightintensity:j.properties.get("intensity"),u_lightcolor:[xe.r,xe.g,xe.b],u_vertical_gradient:+g,u_opacity:z}},Sr=(V,d,g,z,j,$,ie)=>i.e(sr(V,d,g,z),Wn($,d,ie),{u_height_factor:-Math.pow(2,j.overscaledZ)/ie.tileSize/8}),wr=V=>({u_matrix:V}),Ur=(V,d,g,z)=>i.e(wr(V),Wn(g,d,z)),ti=(V,d)=>({u_matrix:V,u_world:d}),vn=(V,d,g,z,j)=>i.e(Ur(V,d,g,z),{u_world:j}),Gn=(V,d,g,z)=>{const j=V.transform;let $,ie;if(z.paint.get("circle-pitch-alignment")==="map"){const de=Tt(g,1,j.zoom);$=!0,ie=[de,de]}else $=!1,ie=j.pixelsToGLUnits;return{u_camera_to_center_distance:j.cameraToCenterDistance,u_scale_with_map:+(z.paint.get("circle-pitch-scale")==="map"),u_matrix:V.translatePosMatrix(d.posMatrix,g,z.paint.get("circle-translate"),z.paint.get("circle-translate-anchor")),u_pitch_with_map:+$,u_device_pixel_ratio:V.pixelRatio,u_extrude_scale:ie}},nn=(V,d)=>({u_matrix:d,u_pixel_extrude_scale:[1/V.width,1/V.height]}),ln=(V,d,g)=>({u_matrix:V,u_inv_matrix:d,u_camera_to_center_distance:g.cameraToCenterDistance,u_viewport_size:[g.width,g.height]}),bn=(V,d,g=1)=>({u_matrix:V,u_color:d,u_overlay:0,u_overlay_scale:g}),Fn=V=>({u_matrix:V}),Bn=(V,d,g,z)=>({u_matrix:V,u_extrude_scale:Tt(d,1,g),u_intensity:z}),Kn=(V,d,g,z)=>{const j=i.H();i.aQ(j,0,V.width,V.height,0,0,1);const $=V.context.gl;return{u_matrix:j,u_world:[$.drawingBufferWidth,$.drawingBufferHeight],u_image:g,u_color_ramp:z,u_opacity:d.paint.get("heatmap-opacity")}},Hn=(V,d,g,z)=>{const j=g.paint.get("hillshade-shadow-color"),$=g.paint.get("hillshade-highlight-color"),ie=g.paint.get("hillshade-accent-color");let de=g.paint.get("hillshade-illumination-direction")*(Math.PI/180);g.paint.get("hillshade-illumination-anchor")==="viewport"&&(de-=V.transform.angle);const xe=!V.options.moving;return{u_matrix:z?z.posMatrix:V.transform.calculatePosMatrix(d.tileID.toUnwrapped(),xe),u_image:0,u_latrange:hn(0,d.tileID),u_light:[g.paint.get("hillshade-exaggeration"),de],u_shadow:j,u_highlight:$,u_accent:ie}},Dn=(V,d)=>{const g=d.stride,z=i.H();return i.aQ(z,0,i.X,-i.X,0,0,1),i.J(z,z,[0,-i.X,0]),{u_matrix:z,u_image:1,u_dimension:[g,g],u_zoom:V.overscaledZ,u_unpack:d.getUnpackVector()}};function hn(V,d){const g=Math.pow(2,d.canonical.z),z=d.canonical.y;return[new i.Z(0,z/g).toLngLat().lat,new i.Z(0,(z+1)/g).toLngLat().lat]}const cn=(V,d,g,z)=>{const j=V.transform;return{u_matrix:yr(V,d,g,z),u_ratio:1/Tt(d,1,j.zoom),u_device_pixel_ratio:V.pixelRatio,u_units_to_pixels:[1/j.pixelsToGLUnits[0],1/j.pixelsToGLUnits[1]]}},En=(V,d,g,z,j)=>i.e(cn(V,d,g,j),{u_image:0,u_image_height:z}),tr=(V,d,g,z,j)=>{const $=V.transform,ie=fr(d,$);return{u_matrix:yr(V,d,g,j),u_texsize:d.imageAtlasTexture.size,u_ratio:1/Tt(d,1,$.zoom),u_device_pixel_ratio:V.pixelRatio,u_image:0,u_scale:[ie,z.fromScale,z.toScale],u_fade:z.t,u_units_to_pixels:[1/$.pixelsToGLUnits[0],1/$.pixelsToGLUnits[1]]}},dr=(V,d,g,z,j,$)=>{const ie=V.transform,de=V.lineAtlas,xe=fr(d,ie),Ae=g.layout.get("line-cap")==="round",Re=de.getDash(z.from,Ae),je=de.getDash(z.to,Ae),tt=Re.width*j.fromScale,lt=je.width*j.toScale;return i.e(cn(V,d,g,$),{u_patternscale_a:[xe/tt,-Re.height/2],u_patternscale_b:[xe/lt,-je.height/2],u_sdfgamma:de.width/(256*Math.min(tt,lt)*V.pixelRatio)/2,u_image:0,u_tex_y_a:Re.y,u_tex_y_b:je.y,u_mix:j.t})};function fr(V,d){return 1/Tt(V,1,d.tileZoom)}function yr(V,d,g,z){return V.translatePosMatrix(z?z.posMatrix:d.tileID.posMatrix,d,g.paint.get("line-translate"),g.paint.get("line-translate-anchor"))}const Or=(V,d,g,z,j)=>{return{u_matrix:V,u_tl_parent:d,u_scale_parent:g,u_buffer_scale:1,u_fade_t:z.mix,u_opacity:z.opacity*j.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:j.paint.get("raster-brightness-min"),u_brightness_high:j.paint.get("raster-brightness-max"),u_saturation_factor:(ie=j.paint.get("raster-saturation"),ie>0?1-1/(1.001-ie):-ie),u_contrast_factor:($=j.paint.get("raster-contrast"),$>0?1/(1-$):1+$),u_spin_weights:Er(j.paint.get("raster-hue-rotate"))};var $,ie};function Er(V){V*=Math.PI/180;const d=Math.sin(V),g=Math.cos(V);return[(2*g+1)/3,(-Math.sqrt(3)*d-g+1)/3,(Math.sqrt(3)*d-g+1)/3]}const Br=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt)=>{const ft=ie.transform;return{u_is_size_zoom_constant:+(V==="constant"||V==="source"),u_is_size_feature_constant:+(V==="constant"||V==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:ft.cameraToCenterDistance,u_pitch:ft.pitch/360*2*Math.PI,u_rotate_symbol:+g,u_aspect_ratio:ft.width/ft.height,u_fade_change:ie.options.fadeDuration?ie.symbolFadeChange:1,u_matrix:de,u_label_plane_matrix:xe,u_coord_matrix:Ae,u_is_text:+je,u_pitch_with_map:+z,u_is_along_line:j,u_is_variable_anchor:$,u_texsize:tt,u_texture:0,u_translation:Re,u_pitched_scale:lt}},Cr=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft)=>{const yt=ie.transform;return i.e(Br(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,ft),{u_gamma_scale:z?Math.cos(yt._pitch)*yt.cameraToCenterDistance:1,u_device_pixel_ratio:ie.pixelRatio,u_is_halo:1})},Dr=(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt)=>i.e(Cr(V,d,g,z,j,$,ie,de,xe,Ae,Re,!0,je,!0,lt),{u_texsize_icon:tt,u_texture_icon:1}),$r=(V,d,g)=>({u_matrix:V,u_opacity:d,u_color:g}),fi=(V,d,g,z,j,$)=>i.e(function(ie,de,xe,Ae){const Re=xe.imageManager.getPattern(ie.from.toString()),je=xe.imageManager.getPattern(ie.to.toString()),{width:tt,height:lt}=xe.imageManager.getPixelSize(),ft=Math.pow(2,Ae.tileID.overscaledZ),yt=Ae.tileSize*Math.pow(2,xe.transform.tileZoom)/ft,Ct=yt*(Ae.tileID.canonical.x+Ae.tileID.wrap*ft),kt=yt*Ae.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:Re.tl,u_pattern_br_a:Re.br,u_pattern_tl_b:je.tl,u_pattern_br_b:je.br,u_texsize:[tt,lt],u_mix:de.t,u_pattern_size_a:Re.displaySize,u_pattern_size_b:je.displaySize,u_scale_a:de.fromScale,u_scale_b:de.toScale,u_tile_units_to_pixels:1/Tt(Ae,1,xe.transform.tileZoom),u_pixel_coord_upper:[Ct>>16,kt>>16],u_pixel_coord_lower:[65535&Ct,65535&kt]}}(z,$,g,j),{u_matrix:V,u_opacity:d}),Qr={fillExtrusion:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_lightpos:new i.aO(V,d.u_lightpos),u_lightintensity:new i.aJ(V,d.u_lightintensity),u_lightcolor:new i.aO(V,d.u_lightcolor),u_vertical_gradient:new i.aJ(V,d.u_vertical_gradient),u_opacity:new i.aJ(V,d.u_opacity)}),fillExtrusionPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_lightpos:new i.aO(V,d.u_lightpos),u_lightintensity:new i.aJ(V,d.u_lightintensity),u_lightcolor:new i.aO(V,d.u_lightcolor),u_vertical_gradient:new i.aJ(V,d.u_vertical_gradient),u_height_factor:new i.aJ(V,d.u_height_factor),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade),u_opacity:new i.aJ(V,d.u_opacity)}),fill:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix)}),fillPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),fillOutline:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world)}),fillOutlinePattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world),u_image:new i.aI(V,d.u_image),u_texsize:new i.aP(V,d.u_texsize),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),circle:(V,d)=>({u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_scale_with_map:new i.aI(V,d.u_scale_with_map),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_extrude_scale:new i.aP(V,d.u_extrude_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_matrix:new i.aK(V,d.u_matrix)}),collisionBox:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_pixel_extrude_scale:new i.aP(V,d.u_pixel_extrude_scale)}),collisionCircle:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_inv_matrix:new i.aK(V,d.u_inv_matrix),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_viewport_size:new i.aP(V,d.u_viewport_size)}),debug:(V,d)=>({u_color:new i.aM(V,d.u_color),u_matrix:new i.aK(V,d.u_matrix),u_overlay:new i.aI(V,d.u_overlay),u_overlay_scale:new i.aJ(V,d.u_overlay_scale)}),clippingMask:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix)}),heatmap:(V,d)=>({u_extrude_scale:new i.aJ(V,d.u_extrude_scale),u_intensity:new i.aJ(V,d.u_intensity),u_matrix:new i.aK(V,d.u_matrix)}),heatmapTexture:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_world:new i.aP(V,d.u_world),u_image:new i.aI(V,d.u_image),u_color_ramp:new i.aI(V,d.u_color_ramp),u_opacity:new i.aJ(V,d.u_opacity)}),hillshade:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_latrange:new i.aP(V,d.u_latrange),u_light:new i.aP(V,d.u_light),u_shadow:new i.aM(V,d.u_shadow),u_highlight:new i.aM(V,d.u_highlight),u_accent:new i.aM(V,d.u_accent)}),hillshadePrepare:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_image:new i.aI(V,d.u_image),u_dimension:new i.aP(V,d.u_dimension),u_zoom:new i.aJ(V,d.u_zoom),u_unpack:new i.aL(V,d.u_unpack)}),line:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels)}),lineGradient:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_image:new i.aI(V,d.u_image),u_image_height:new i.aJ(V,d.u_image_height)}),linePattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texsize:new i.aP(V,d.u_texsize),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_image:new i.aI(V,d.u_image),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_scale:new i.aO(V,d.u_scale),u_fade:new i.aJ(V,d.u_fade)}),lineSDF:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ratio:new i.aJ(V,d.u_ratio),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,d.u_units_to_pixels),u_patternscale_a:new i.aP(V,d.u_patternscale_a),u_patternscale_b:new i.aP(V,d.u_patternscale_b),u_sdfgamma:new i.aJ(V,d.u_sdfgamma),u_image:new i.aI(V,d.u_image),u_tex_y_a:new i.aJ(V,d.u_tex_y_a),u_tex_y_b:new i.aJ(V,d.u_tex_y_b),u_mix:new i.aJ(V,d.u_mix)}),raster:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_tl_parent:new i.aP(V,d.u_tl_parent),u_scale_parent:new i.aJ(V,d.u_scale_parent),u_buffer_scale:new i.aJ(V,d.u_buffer_scale),u_fade_t:new i.aJ(V,d.u_fade_t),u_opacity:new i.aJ(V,d.u_opacity),u_image0:new i.aI(V,d.u_image0),u_image1:new i.aI(V,d.u_image1),u_brightness_low:new i.aJ(V,d.u_brightness_low),u_brightness_high:new i.aJ(V,d.u_brightness_high),u_saturation_factor:new i.aJ(V,d.u_saturation_factor),u_contrast_factor:new i.aJ(V,d.u_contrast_factor),u_spin_weights:new i.aO(V,d.u_spin_weights)}),symbolIcon:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texture:new i.aI(V,d.u_texture),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),symbolSDF:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texture:new i.aI(V,d.u_texture),u_gamma_scale:new i.aJ(V,d.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_is_halo:new i.aI(V,d.u_is_halo),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),symbolTextAndIcon:(V,d)=>({u_is_size_zoom_constant:new i.aI(V,d.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,d.u_is_size_feature_constant),u_size_t:new i.aJ(V,d.u_size_t),u_size:new i.aJ(V,d.u_size),u_camera_to_center_distance:new i.aJ(V,d.u_camera_to_center_distance),u_pitch:new i.aJ(V,d.u_pitch),u_rotate_symbol:new i.aI(V,d.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,d.u_aspect_ratio),u_fade_change:new i.aJ(V,d.u_fade_change),u_matrix:new i.aK(V,d.u_matrix),u_label_plane_matrix:new i.aK(V,d.u_label_plane_matrix),u_coord_matrix:new i.aK(V,d.u_coord_matrix),u_is_text:new i.aI(V,d.u_is_text),u_pitch_with_map:new i.aI(V,d.u_pitch_with_map),u_is_along_line:new i.aI(V,d.u_is_along_line),u_is_variable_anchor:new i.aI(V,d.u_is_variable_anchor),u_texsize:new i.aP(V,d.u_texsize),u_texsize_icon:new i.aP(V,d.u_texsize_icon),u_texture:new i.aI(V,d.u_texture),u_texture_icon:new i.aI(V,d.u_texture_icon),u_gamma_scale:new i.aJ(V,d.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,d.u_device_pixel_ratio),u_is_halo:new i.aI(V,d.u_is_halo),u_translation:new i.aP(V,d.u_translation),u_pitched_scale:new i.aJ(V,d.u_pitched_scale)}),background:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_opacity:new i.aJ(V,d.u_opacity),u_color:new i.aM(V,d.u_color)}),backgroundPattern:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_opacity:new i.aJ(V,d.u_opacity),u_image:new i.aI(V,d.u_image),u_pattern_tl_a:new i.aP(V,d.u_pattern_tl_a),u_pattern_br_a:new i.aP(V,d.u_pattern_br_a),u_pattern_tl_b:new i.aP(V,d.u_pattern_tl_b),u_pattern_br_b:new i.aP(V,d.u_pattern_br_b),u_texsize:new i.aP(V,d.u_texsize),u_mix:new i.aJ(V,d.u_mix),u_pattern_size_a:new i.aP(V,d.u_pattern_size_a),u_pattern_size_b:new i.aP(V,d.u_pattern_size_b),u_scale_a:new i.aJ(V,d.u_scale_a),u_scale_b:new i.aJ(V,d.u_scale_b),u_pixel_coord_upper:new i.aP(V,d.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,d.u_pixel_coord_lower),u_tile_units_to_pixels:new i.aJ(V,d.u_tile_units_to_pixels)}),terrain:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texture:new i.aI(V,d.u_texture),u_ele_delta:new i.aJ(V,d.u_ele_delta),u_fog_matrix:new i.aK(V,d.u_fog_matrix),u_fog_color:new i.aM(V,d.u_fog_color),u_fog_ground_blend:new i.aJ(V,d.u_fog_ground_blend),u_fog_ground_blend_opacity:new i.aJ(V,d.u_fog_ground_blend_opacity),u_horizon_color:new i.aM(V,d.u_horizon_color),u_horizon_fog_blend:new i.aJ(V,d.u_horizon_fog_blend)}),terrainDepth:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_ele_delta:new i.aJ(V,d.u_ele_delta)}),terrainCoords:(V,d)=>({u_matrix:new i.aK(V,d.u_matrix),u_texture:new i.aI(V,d.u_texture),u_terrain_coords_id:new i.aJ(V,d.u_terrain_coords_id),u_ele_delta:new i.aJ(V,d.u_ele_delta)}),sky:(V,d)=>({u_sky_color:new i.aM(V,d.u_sky_color),u_horizon_color:new i.aM(V,d.u_horizon_color),u_horizon:new i.aJ(V,d.u_horizon),u_sky_horizon_blend:new i.aJ(V,d.u_sky_horizon_blend)})};class Hr{constructor(d,g,z){this.context=d;const j=d.gl;this.buffer=j.createBuffer(),this.dynamicDraw=!!z,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,g.arrayBuffer,this.dynamicDraw?j.DYNAMIC_DRAW:j.STATIC_DRAW),this.dynamicDraw||delete g.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){const g=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),g.bufferSubData(g.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)}destroy(){const d=this.context.gl;this.buffer&&(d.deleteBuffer(this.buffer),delete this.buffer)}}const oi={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Mi{constructor(d,g,z,j){this.length=g.length,this.attributes=z,this.itemSize=g.bytesPerElement,this.dynamicDraw=j,this.context=d;const $=d.gl;this.buffer=$.createBuffer(),d.bindVertexBuffer.set(this.buffer),$.bufferData($.ARRAY_BUFFER,g.arrayBuffer,this.dynamicDraw?$.DYNAMIC_DRAW:$.STATIC_DRAW),this.dynamicDraw||delete g.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){if(d.length!==this.length)throw new Error(`Length of new data is ${d.length}, which doesn't match current length of ${this.length}`);const g=this.context.gl;this.bind(),g.bufferSubData(g.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,g){for(let z=0;z<this.attributes.length;z++){const j=this.attributes[z],$=g.attributes[j.name];$!==void 0&&d.enableVertexAttribArray($)}}setVertexAttribPointers(d,g,z){for(let j=0;j<this.attributes.length;j++){const $=this.attributes[j],ie=g.attributes[$.name];ie!==void 0&&d.vertexAttribPointer(ie,$.components,d[oi[$.type]],!1,this.itemSize,$.offset+this.itemSize*(z||0))}}destroy(){const d=this.context.gl;this.buffer&&(d.deleteBuffer(this.buffer),delete this.buffer)}}const Bi=new WeakMap;function Ya(V){var d;if(Bi.has(V))return Bi.get(V);{const g=(d=V.getParameter(V.VERSION))===null||d===void 0?void 0:d.startsWith("WebGL 2.0");return Bi.set(V,g),g}}class Vi{constructor(d){this.gl=d.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(d){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ns extends Vi{getDefault(){return i.aN.transparent}set(d){const g=this.current;(d.r!==g.r||d.g!==g.g||d.b!==g.b||d.a!==g.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class no extends Vi{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class ko extends Vi{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class el extends Vi{getDefault(){return[!0,!0,!0,!0]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||d[3]!==g[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Ui extends Vi{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class Wo extends Vi{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class Bl extends Vi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const g=this.current;(d.func!==g.func||d.ref!==g.ref||d.mask!==g.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class jo extends Vi{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class Wu extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.STENCIL_TEST):g.disable(g.STENCIL_TEST),this.current=d,this.dirty=!1}}class Sl extends Vi{getDefault(){return[0,1]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class Is extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST),this.current=d,this.dirty=!1}}class qu extends Vi{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class Gu extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.BLEND):g.disable(g.BLEND),this.current=d,this.dirty=!1}}class dc extends Vi{getDefault(){const d=this.gl;return[d.ONE,d.ZERO]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||this.dirty)&&(this.gl.blendFunc(d[0],d[1]),this.current=d,this.dirty=!1)}}class tl extends Vi{getDefault(){return i.aN.transparent}set(d){const g=this.current;(d.r!==g.r||d.g!==g.g||d.b!==g.b||d.a!==g.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class Su extends Vi{getDefault(){return this.gl.FUNC_ADD}set(d){(d!==this.current||this.dirty)&&(this.gl.blendEquation(d),this.current=d,this.dirty=!1)}}class Al extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;d?g.enable(g.CULL_FACE):g.disable(g.CULL_FACE),this.current=d,this.dirty=!1}}class ro extends Vi{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class rs extends Vi{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}class $u extends Vi{getDefault(){return null}set(d){(d!==this.current||this.dirty)&&(this.gl.useProgram(d),this.current=d,this.dirty=!1)}}class Au extends Vi{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class fu extends Vi{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const g=this.current;(d[0]!==g[0]||d[1]!==g[1]||d[2]!==g[2]||d[3]!==g[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Yu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindFramebuffer(g.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class du extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindRenderbuffer(g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Zu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindTexture(g.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class Xu extends Vi{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.bindBuffer(g.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Cu extends Vi{getDefault(){return null}set(d){const g=this.gl;g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Ls extends Vi{getDefault(){return null}set(d){var g;if(d===this.current&&!this.dirty)return;const z=this.gl;Ya(z)?z.bindVertexArray(d):(g=z.getExtension("OES_vertex_array_object"))===null||g===void 0||g.bindVertexArrayOES(d),this.current=d,this.dirty=!1}}class Ph extends Vi{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class dh extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class pc extends Vi{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class Dh extends Vi{constructor(d,g){super(d),this.context=d,this.parent=g}getDefault(){return null}}class Qh extends Dh{setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class Nl extends Dh{set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class ef extends Dh{set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class ld{constructor(d,g,z,j,$){this.context=d,this.width=g,this.height=z;const ie=d.gl,de=this.framebuffer=ie.createFramebuffer();if(this.colorAttachment=new Qh(d,de),j)this.depthAttachment=$?new ef(d,de):new Nl(d,de);else if($)throw new Error("Stencil cannot be set without depth");if(ie.checkFramebufferStatus(ie.FRAMEBUFFER)!==ie.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const d=this.context.gl,g=this.colorAttachment.get();if(g&&d.deleteTexture(g),this.depthAttachment){const z=this.depthAttachment.get();z&&d.deleteRenderbuffer(z)}d.deleteFramebuffer(this.framebuffer)}}class qo{constructor(d,g,z){this.blendFunction=d,this.blendColor=g,this.mask=z}}qo.Replace=[1,0],qo.disabled=new qo(qo.Replace,i.aN.transparent,[!1,!1,!1,!1]),qo.unblended=new qo(qo.Replace,i.aN.transparent,[!0,!0,!0,!0]),qo.alphaBlended=new qo([1,771],i.aN.transparent,[!0,!0,!0,!0]);class Zc{constructor(d){var g,z;if(this.gl=d,this.clearColor=new ns(this),this.clearDepth=new no(this),this.clearStencil=new ko(this),this.colorMask=new el(this),this.depthMask=new Ui(this),this.stencilMask=new Wo(this),this.stencilFunc=new Bl(this),this.stencilOp=new jo(this),this.stencilTest=new Wu(this),this.depthRange=new Sl(this),this.depthTest=new Is(this),this.depthFunc=new qu(this),this.blend=new Gu(this),this.blendFunc=new dc(this),this.blendColor=new tl(this),this.blendEquation=new Su(this),this.cullFace=new Al(this),this.cullFaceSide=new ro(this),this.frontFace=new rs(this),this.program=new $u(this),this.activeTexture=new Au(this),this.viewport=new fu(this),this.bindFramebuffer=new Yu(this),this.bindRenderbuffer=new du(this),this.bindTexture=new Zu(this),this.bindVertexBuffer=new Xu(this),this.bindElementBuffer=new Cu(this),this.bindVertexArray=new Ls(this),this.pixelStoreUnpack=new Ph(this),this.pixelStoreUnpackPremultiplyAlpha=new dh(this),this.pixelStoreUnpackFlipY=new pc(this),this.extTextureFilterAnisotropic=d.getExtension("EXT_texture_filter_anisotropic")||d.getExtension("MOZ_EXT_texture_filter_anisotropic")||d.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=d.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),Ya(d)){this.HALF_FLOAT=d.HALF_FLOAT;const j=d.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(g=d.RGBA16F)!==null&&g!==void 0?g:j==null?void 0:j.RGBA16F_EXT,this.RGB16F=(z=d.RGB16F)!==null&&z!==void 0?z:j==null?void 0:j.RGB16F_EXT,d.getExtension("EXT_color_buffer_float")}else{d.getExtension("EXT_color_buffer_half_float"),d.getExtension("OES_texture_half_float_linear");const j=d.getExtension("OES_texture_half_float");this.HALF_FLOAT=j==null?void 0:j.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(d,g){return new Hr(this,d,g)}createVertexBuffer(d,g,z){return new Mi(this,d,g,z)}createRenderbuffer(d,g,z){const j=this.gl,$=j.createRenderbuffer();return this.bindRenderbuffer.set($),j.renderbufferStorage(j.RENDERBUFFER,d,g,z),this.bindRenderbuffer.set(null),$}createFramebuffer(d,g,z,j){return new ld(this,d,g,z,j)}clear({color:d,depth:g,stencil:z}){const j=this.gl;let $=0;d&&($|=j.COLOR_BUFFER_BIT,this.clearColor.set(d),this.colorMask.set([!0,!0,!0,!0])),g!==void 0&&($|=j.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(g),this.depthMask.set(!0)),z!==void 0&&($|=j.STENCIL_BUFFER_BIT,this.clearStencil.set(z),this.stencilMask.set(255)),j.clear($)}setCullFace(d){d.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(d.mode),this.frontFace.set(d.frontFace))}setDepthMode(d){d.func!==this.gl.ALWAYS||d.mask?(this.depthTest.set(!0),this.depthFunc.set(d.func),this.depthMask.set(d.mask),this.depthRange.set(d.range)):this.depthTest.set(!1)}setStencilMode(d){d.test.func!==this.gl.ALWAYS||d.mask?(this.stencilTest.set(!0),this.stencilMask.set(d.mask),this.stencilOp.set([d.fail,d.depthFail,d.pass]),this.stencilFunc.set({func:d.test.func,ref:d.ref,mask:d.test.mask})):this.stencilTest.set(!1)}setColorMode(d){i.aF(d.blendFunction,qo.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(d.blendFunction),this.blendColor.set(d.blendColor)),this.colorMask.set(d.mask)}createVertexArray(){var d;return Ya(this.gl)?this.gl.createVertexArray():(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.createVertexArrayOES()}deleteVertexArray(d){var g;return Ya(this.gl)?this.gl.deleteVertexArray(d):(g=this.gl.getExtension("OES_vertex_array_object"))===null||g===void 0?void 0:g.deleteVertexArrayOES(d)}unbindVAO(){this.bindVertexArray.set(null)}}class Qi{constructor(d,g,z){this.func=d,this.mask=g,this.range=z}}Qi.ReadOnly=!1,Qi.ReadWrite=!0,Qi.disabled=new Qi(519,Qi.ReadOnly,[0,1]);const mc=7680;class Za{constructor(d,g,z,j,$,ie){this.test=d,this.ref=g,this.mask=z,this.fail=j,this.depthFail=$,this.pass=ie}}Za.disabled=new Za({func:519,mask:0},0,0,mc,mc,mc);class Xa{constructor(d,g,z){this.enable=d,this.mode=g,this.frontFace=z}}let Vl;function dl(V,d,g,z,j){const $=V.context,ie=$.gl,de=V.useProgram("collisionBox"),xe=[];let Ae=0,Re=0;for(let Ct=0;Ct<z.length;Ct++){const kt=z[Ct],Bt=d.getTile(kt).getBucket(g);if(!Bt)continue;const At=j?Bt.textCollisionBox:Bt.iconCollisionBox,$t=Bt.collisionCircleArray;if($t.length>0){const Kt=i.H();i.aR(Kt,Bt.placementInvProjMatrix,V.transform.glCoordMatrix),i.aR(Kt,Kt,Bt.placementViewportMatrix),xe.push({circleArray:$t,circleOffset:Re,transform:kt.posMatrix,invTransform:Kt,coord:kt}),Ae+=$t.length/4,Re=Ae}At&&de.draw($,ie.LINES,Qi.disabled,Za.disabled,V.colorModeForRenderPass(),Xa.disabled,nn(V.transform,kt.posMatrix),V.style.map.terrain&&V.style.map.terrain.getTerrainData(kt),g.id,At.layoutVertexBuffer,At.indexBuffer,At.segments,null,V.transform.zoom,null,null,At.collisionVertexBuffer)}if(!j||!xe.length)return;const je=V.useProgram("collisionCircle"),tt=new i.aS;tt.resize(4*Ae),tt._trim();let lt=0;for(const Ct of xe)for(let kt=0;kt<Ct.circleArray.length/4;kt++){const Bt=4*kt,At=Ct.circleArray[Bt+0],$t=Ct.circleArray[Bt+1],Kt=Ct.circleArray[Bt+2],Yt=Ct.circleArray[Bt+3];tt.emplace(lt++,At,$t,Kt,Yt,0),tt.emplace(lt++,At,$t,Kt,Yt,1),tt.emplace(lt++,At,$t,Kt,Yt,2),tt.emplace(lt++,At,$t,Kt,Yt,3)}(!Vl||Vl.length<2*Ae)&&(Vl=function(Ct){const kt=2*Ct,Bt=new i.aU;Bt.resize(kt),Bt._trim();for(let At=0;At<kt;At++){const $t=6*At;Bt.uint16[$t+0]=4*At+0,Bt.uint16[$t+1]=4*At+1,Bt.uint16[$t+2]=4*At+2,Bt.uint16[$t+3]=4*At+2,Bt.uint16[$t+4]=4*At+3,Bt.uint16[$t+5]=4*At+0}return Bt}(Ae));const ft=$.createIndexBuffer(Vl,!0),yt=$.createVertexBuffer(tt,i.aT.members,!0);for(const Ct of xe){const kt=ln(Ct.transform,Ct.invTransform,V.transform);je.draw($,ie.TRIANGLES,Qi.disabled,Za.disabled,V.colorModeForRenderPass(),Xa.disabled,kt,V.style.map.terrain&&V.style.map.terrain.getTerrainData(Ct.coord),g.id,yt,ft,i.a0.simpleSegment(0,2*Ct.circleOffset,Ct.circleArray.length,Ct.circleArray.length/2),null,V.transform.zoom,null,null,null)}yt.destroy(),ft.destroy()}Xa.disabled=new Xa(!1,1029,2305),Xa.backCCW=new Xa(!0,1029,2305);const Xc=i.ao(new Float32Array(16));function Ku(V,d,g,z,j){if(V.renderPass!=="translucent")return;const $=Za.disabled,ie=V.colorModeForRenderPass();(g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(de,xe,Ae,Re,je,tt,lt,ft,yt){const Ct=xe.transform,kt=Rn(),Bt=je==="map",At=tt==="map";for(const $t of de){const Kt=Re.getTile($t),Yt=Kt.getBucket(Ae);if(!Yt||!Yt.text||!Yt.text.segments.get().length)continue;const pn=Yt.textSizeData,Tn=i.ah(pn,Ct.zoom),Vn=Tt(Kt,1,xe.transform.zoom),jn=Nt($t.posMatrix,At,Bt,xe.transform,Vn),$n=Ae.layout.get("icon-text-fit")!=="none"&&Yt.hasIconData();if(Tn){const er=Math.pow(2,Ct.zoom-Kt.tileID.overscaledZ),Tr=xe.style.map.terrain?(Ar,ur)=>xe.style.map.terrain.getElevation($t,Ar,ur):null,rr=kt.translatePosition(Ct,Kt,lt,ft);vs(Yt,Bt,At,yt,Ct,jn,$t.posMatrix,er,Tn,$n,kt,rr,$t.toUnwrapped(),Tr)}}}(z,V,g,d,g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),j),g.paint.get("icon-opacity").constantOr(1)!==0&&Pc(V,d,g,z,!1,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),g.layout.get("icon-rotation-alignment"),g.layout.get("icon-pitch-alignment"),g.layout.get("icon-keep-upright"),$,ie),g.paint.get("text-opacity").constantOr(1)!==0&&Pc(V,d,g,z,!0,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.layout.get("text-keep-upright"),$,ie),d.map.showCollisionBoxes&&(dl(V,d,g,z,!0),dl(V,d,g,z,!1))}function pl(V,d,g,z,j,$){const{horizontalAlign:ie,verticalAlign:de}=i.av(V),xe=-(ie-.5)*d,Ae=-(de-.5)*g;return new i.P((xe/j+z[0])*$,(Ae/j+z[1])*$)}function Cl(V,d,g,z,j,$){const ie=d.tileAnchorPoint.add(new i.P(d.translation[0],d.translation[1]));if(d.pitchWithMap){let de=z.mult($);return g||(de=de.rotate(-j)),Ut(ie.add(de),d.labelPlaneMatrix,d.getElevation).point}if(g){const de=$e(d.tileAnchorPoint.x+1,d.tileAnchorPoint.y,d).point.sub(V),xe=Math.atan(de.y/de.x)+(de.x<0?Math.PI:0);return V.add(z.rotate(xe))}return V.add(z)}function vs(V,d,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt){const ft=V.text.placedSymbolArray,yt=V.text.dynamicLayoutVertexArray,Ct=V.icon.dynamicLayoutVertexArray,kt={};yt.clear();for(let Bt=0;Bt<ft.length;Bt++){const At=ft.get(Bt),$t=V.allowVerticalPlacement&&!At.placedOrientation,Kt=At.hidden||!At.crossTileID||$t?null:z[At.crossTileID];if(Kt){const Yt=new i.P(At.anchorX,At.anchorY),pn={getElevation:lt,width:j.width,height:j.height,labelPlaneMatrix:$,pitchWithMap:g,projection:Re,tileAnchorPoint:Yt,translation:je,unwrappedTileID:tt},Tn=g?Ut(Yt,ie,lt):$e(Yt.x,Yt.y,pn),Vn=at(j.cameraToCenterDistance,Tn.signedDistanceFromCamera);let jn=i.aj(V.textSizeData,xe,At)*Vn/i.aq;g&&(jn*=V.tilePixelRatio/de);const{width:$n,height:er,anchor:Tr,textOffset:rr,textBoxScale:Ar}=Kt,ur=pl(Tr,$n,er,rr,Ar,jn),Pr=Re.getPitchedTextCorrection(j,Yt.add(new i.P(je[0],je[1])),tt),br=Cl(Tn.point,pn,d,ur,j.angle,Pr),Nr=V.allowVerticalPlacement&&At.placedOrientation===i.ai.vertical?Math.PI/2:0;for(let li=0;li<At.numGlyphs;li++)i.ak(yt,br,Nr);Ae&&At.associatedIconIndex>=0&&(kt[At.associatedIconIndex]={shiftedAnchor:br,angle:Nr})}else Ft(At.numGlyphs,yt)}if(Ae){Ct.clear();const Bt=V.icon.placedSymbolArray;for(let At=0;At<Bt.length;At++){const $t=Bt.get(At);if($t.hidden)Ft($t.numGlyphs,Ct);else{const Kt=kt[At];if(Kt)for(let Yt=0;Yt<$t.numGlyphs;Yt++)i.ak(Ct,Kt.shiftedAnchor,Kt.angle);else Ft($t.numGlyphs,Ct)}}V.icon.dynamicLayoutVertexBuffer.updateData(Ct)}V.text.dynamicLayoutVertexBuffer.updateData(yt)}function fa(V,d,g){return g.iconsInText&&d?"symbolTextAndIcon":V?"symbolSDF":"symbolIcon"}function Pc(V,d,g,z,j,$,ie,de,xe,Ae,Re,je){const tt=V.context,lt=tt.gl,ft=V.transform,yt=Rn(),Ct=de==="map",kt=xe==="map",Bt=de!=="viewport"&&g.layout.get("symbol-placement")!=="point",At=Ct&&!kt&&!Bt,$t=!kt&&Bt,Kt=!g.layout.get("symbol-sort-key").isConstant();let Yt=!1;const pn=V.depthModeForSublayer(0,Qi.ReadOnly),Tn=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Vn=[],jn=yt.getCircleRadiusCorrection(ft);for(const $n of z){const er=d.getTile($n),Tr=er.getBucket(g);if(!Tr)continue;const rr=j?Tr.text:Tr.icon;if(!rr||!rr.segments.get().length||!rr.hasVisibleVertices)continue;const Ar=rr.programConfigurations.get(g.id),ur=j||Tr.sdfIcons,Pr=j?Tr.textSizeData:Tr.iconSizeData,br=kt||ft.pitch!==0,Nr=V.useProgram(fa(ur,j,Tr),Ar),li=i.ah(Pr,ft.zoom),Fr=V.style.map.terrain&&V.style.map.terrain.getTerrainData($n);let ri,vi,Wi,Di,Yi=[0,0],Gi=null;if(j){if(vi=er.glyphAtlasTexture,Wi=lt.LINEAR,ri=er.glyphAtlasTexture.size,Tr.iconsInText){Yi=er.imageAtlasTexture.size,Gi=er.imageAtlasTexture;const qi=Pr.kind==="composite"||Pr.kind==="camera";Di=br||V.options.rotating||V.options.zooming||qi?lt.LINEAR:lt.NEAREST}}else{const qi=g.layout.get("icon-size").constantOr(0)!==1||Tr.iconsNeedLinear;vi=er.imageAtlasTexture,Wi=ur||V.options.rotating||V.options.zooming||qi||br?lt.LINEAR:lt.NEAREST,ri=er.imageAtlasTexture.size}const ea=Tt(er,1,V.transform.zoom),_a=$t?$n.posMatrix:Xc,So=Nt(_a,kt,Ct,V.transform,ea),go=jt(_a,kt,Ct,V.transform,ea),Zo=jt($n.posMatrix,kt,Ct,V.transform,ea),Aa=yt.translatePosition(V.transform,er,$,ie),ra=Tn&&Tr.hasTextData(),oo=g.layout.get("icon-text-fit")!=="none"&&ra&&Tr.hasIconData();if(Bt){const qi=V.style.map.terrain?(Uo,Il)=>V.style.map.terrain.getElevation($n,Uo,Il):null,_s=g.layout.get("text-rotation-alignment")==="map";ct(Tr,$n.posMatrix,V,j,So,Zo,kt,Ae,_s,yt,$n.toUnwrapped(),ft.width,ft.height,Aa,qi)}const Pa=$n.posMatrix,va=j&&Tn||oo,Ca=Bt||va?Xc:So,qa=go,aa=ur&&g.paint.get(j?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Kl;Kl=ur?Tr.iconsInText?Dr(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,qa,Aa,ri,Yi,jn):Cr(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,qa,Aa,j,ri,!0,jn):Br(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,qa,Aa,j,ri,jn);const Lo={program:Nr,buffers:rr,uniformValues:Kl,atlasTexture:vi,atlasTextureIcon:Gi,atlasInterpolation:Wi,atlasInterpolationIcon:Di,isSDF:ur,hasHalo:aa};if(Kt&&Tr.canOverlap){Yt=!0;const qi=rr.segments.get();for(const _s of qi)Vn.push({segments:new i.a0([_s]),sortKey:_s.sortKey,state:Lo,terrainData:Fr})}else Vn.push({segments:rr.segments,sortKey:0,state:Lo,terrainData:Fr})}Yt&&Vn.sort(($n,er)=>$n.sortKey-er.sortKey);for(const $n of Vn){const er=$n.state;if(tt.activeTexture.set(lt.TEXTURE0),er.atlasTexture.bind(er.atlasInterpolation,lt.CLAMP_TO_EDGE),er.atlasTextureIcon&&(tt.activeTexture.set(lt.TEXTURE1),er.atlasTextureIcon&&er.atlasTextureIcon.bind(er.atlasInterpolationIcon,lt.CLAMP_TO_EDGE)),er.isSDF){const Tr=er.uniformValues;er.hasHalo&&(Tr.u_is_halo=1,tf(er.buffers,$n.segments,g,V,er.program,pn,Re,je,Tr,$n.terrainData)),Tr.u_is_halo=0}tf(er.buffers,$n.segments,g,V,er.program,pn,Re,je,er.uniformValues,$n.terrainData)}}function tf(V,d,g,z,j,$,ie,de,xe,Ae){const Re=z.context,je=Re.gl;j.draw(Re,je.TRIANGLES,$,ie,de,Xa.disabled,xe,Ae,g.id,V.layoutVertexBuffer,V.indexBuffer,d,g.paint,z.transform.zoom,V.programConfigurations.get(g.id),V.dynamicLayoutVertexBuffer,V.opacityVertexBuffer)}function Ju(V,d,g,z){if(g.paint.get("heatmap-opacity")!==0)if(V.renderPass==="offscreen"){const j=V.context,$=j.gl,ie=Za.disabled,de=new qo([$.ONE,$.ONE],i.aN.transparent,[!0,!0,!0,!0]);(function(xe,Ae,Re){const je=xe.gl;xe.activeTexture.set(je.TEXTURE1),xe.viewport.set([0,0,Ae.width/4,Ae.height/4]);let tt=Re.heatmapFbo;if(tt)je.bindTexture(je.TEXTURE_2D,tt.colorAttachment.get()),xe.bindFramebuffer.set(tt.framebuffer);else{const lt=je.createTexture();je.bindTexture(je.TEXTURE_2D,lt),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_WRAP_S,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_WRAP_T,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_MIN_FILTER,je.LINEAR),je.texParameteri(je.TEXTURE_2D,je.TEXTURE_MAG_FILTER,je.LINEAR),tt=Re.heatmapFbo=xe.createFramebuffer(Ae.width/4,Ae.height/4,!1,!1),function(ft,yt,Ct,kt){var Bt,At;const $t=ft.gl,Kt=(Bt=ft.HALF_FLOAT)!==null&&Bt!==void 0?Bt:$t.UNSIGNED_BYTE,Yt=(At=ft.RGBA16F)!==null&&At!==void 0?At:$t.RGBA;$t.texImage2D($t.TEXTURE_2D,0,Yt,yt.width/4,yt.height/4,0,$t.RGBA,Kt,null),kt.colorAttachment.set(Ct)}(xe,Ae,lt,tt)}})(j,V,g),j.clear({color:i.aN.transparent});for(let xe=0;xe<z.length;xe++){const Ae=z[xe];if(d.hasRenderableParent(Ae))continue;const Re=d.getTile(Ae),je=Re.getBucket(g);if(!je)continue;const tt=je.programConfigurations.get(g.id),lt=V.useProgram("heatmap",tt),{zoom:ft}=V.transform;lt.draw(j,$.TRIANGLES,Qi.disabled,ie,de,Xa.disabled,Bn(Ae.posMatrix,Re,ft,g.paint.get("heatmap-intensity")),null,g.id,je.layoutVertexBuffer,je.indexBuffer,je.segments,g.paint,V.transform.zoom,tt)}j.viewport.set([0,0,V.width,V.height])}else V.renderPass==="translucent"&&(V.context.setColorMode(V.colorModeForRenderPass()),function(j,$){const ie=j.context,de=ie.gl,xe=$.heatmapFbo;if(!xe)return;ie.activeTexture.set(de.TEXTURE0),de.bindTexture(de.TEXTURE_2D,xe.colorAttachment.get()),ie.activeTexture.set(de.TEXTURE1);let Ae=$.colorRampTexture;Ae||(Ae=$.colorRampTexture=new D(ie,$.colorRamp,de.RGBA)),Ae.bind(de.LINEAR,de.CLAMP_TO_EDGE),j.useProgram("heatmapTexture").draw(ie,de.TRIANGLES,Qi.disabled,Za.disabled,j.colorModeForRenderPass(),Xa.disabled,Kn(j,$,0,1),null,$.id,j.viewportBuffer,j.quadTriangleIndexBuffer,j.viewportSegments,$.paint,j.transform.zoom)}(V,g))}function Qu(V,d,g,z,j){if(!g||!z||!z.imageAtlas)return;const $=z.imageAtlas.patternPositions;let ie=$[g.to.toString()],de=$[g.from.toString()];if(!ie&&de&&(ie=de),!de&&ie&&(de=ie),!ie||!de){const xe=j.getPaintProperty(d);ie=$[xe],de=$[xe]}ie&&de&&V.setConstantPatternPositions(ie,de)}function ph(V,d,g,z,j,$,ie){const de=V.context.gl,xe="fill-pattern",Ae=g.paint.get(xe),Re=Ae&&Ae.constantOr(1),je=g.getCrossfadeParameters();let tt,lt,ft,yt,Ct;ie?(lt=Re&&!g.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",tt=de.LINES):(lt=Re?"fillPattern":"fill",tt=de.TRIANGLES);const kt=Ae.constantOr(null);for(const Bt of z){const At=d.getTile(Bt);if(Re&&!At.patternsLoaded())continue;const $t=At.getBucket(g);if(!$t)continue;const Kt=$t.programConfigurations.get(g.id),Yt=V.useProgram(lt,Kt),pn=V.style.map.terrain&&V.style.map.terrain.getTerrainData(Bt);Re&&(V.context.activeTexture.set(de.TEXTURE0),At.imageAtlasTexture.bind(de.LINEAR,de.CLAMP_TO_EDGE),Kt.updatePaintBuffers(je)),Qu(Kt,xe,kt,At,g);const Tn=pn?Bt:null,Vn=Tn?Tn.posMatrix:Bt.posMatrix,jn=V.translatePosMatrix(Vn,At,g.paint.get("fill-translate"),g.paint.get("fill-translate-anchor"));if(ie){yt=$t.indexBuffer2,Ct=$t.segments2;const $n=[de.drawingBufferWidth,de.drawingBufferHeight];ft=lt==="fillOutlinePattern"&&Re?vn(jn,V,je,At,$n):ti(jn,$n)}else yt=$t.indexBuffer,Ct=$t.segments,ft=Re?Ur(jn,V,je,At):wr(jn);Yt.draw(V.context,tt,j,V.stencilModeForClipping(Bt),$,Xa.disabled,ft,pn,g.id,$t.layoutVertexBuffer,yt,Ct,g.paint,V.transform.zoom,Kt)}}function Kc(V,d,g,z,j,$,ie){const de=V.context,xe=de.gl,Ae="fill-extrusion-pattern",Re=g.paint.get(Ae),je=Re.constantOr(1),tt=g.getCrossfadeParameters(),lt=g.paint.get("fill-extrusion-opacity"),ft=Re.constantOr(null);for(const yt of z){const Ct=d.getTile(yt),kt=Ct.getBucket(g);if(!kt)continue;const Bt=V.style.map.terrain&&V.style.map.terrain.getTerrainData(yt),At=kt.programConfigurations.get(g.id),$t=V.useProgram(je?"fillExtrusionPattern":"fillExtrusion",At);je&&(V.context.activeTexture.set(xe.TEXTURE0),Ct.imageAtlasTexture.bind(xe.LINEAR,xe.CLAMP_TO_EDGE),At.updatePaintBuffers(tt)),Qu(At,Ae,ft,Ct,g);const Kt=V.translatePosMatrix(yt.posMatrix,Ct,g.paint.get("fill-extrusion-translate"),g.paint.get("fill-extrusion-translate-anchor")),Yt=g.paint.get("fill-extrusion-vertical-gradient"),pn=je?Sr(Kt,V,Yt,lt,yt,tt,Ct):sr(Kt,V,Yt,lt);$t.draw(de,de.gl.TRIANGLES,j,$,ie,Xa.backCCW,pn,Bt,g.id,kt.layoutVertexBuffer,kt.indexBuffer,kt.segments,g.paint,V.transform.zoom,At,V.style.map.terrain&&kt.centroidVertexBuffer)}}function Jc(V,d,g,z,j,$,ie){const de=V.context,xe=de.gl,Ae=g.fbo;if(!Ae)return;const Re=V.useProgram("hillshade"),je=V.style.map.terrain&&V.style.map.terrain.getTerrainData(d);de.activeTexture.set(xe.TEXTURE0),xe.bindTexture(xe.TEXTURE_2D,Ae.colorAttachment.get());const tt=je?d:null;Re.draw(de,xe.TRIANGLES,j,$,ie,Xa.disabled,Hn(V,g,z,tt),je,z.id,V.rasterBoundsBuffer,V.quadTriangleIndexBuffer,V.rasterBoundsSegments)}function bf(V,d,g,z,j,$){const ie=V.context,de=ie.gl,xe=d.dem;if(xe&&xe.data){const Ae=xe.dim,Re=xe.stride,je=xe.getPixels();if(ie.activeTexture.set(de.TEXTURE1),ie.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||V.getTileTexture(Re),d.demTexture){const lt=d.demTexture;lt.update(je,{premultiply:!1}),lt.bind(de.NEAREST,de.CLAMP_TO_EDGE)}else d.demTexture=new D(ie,je,de.RGBA,{premultiply:!1}),d.demTexture.bind(de.NEAREST,de.CLAMP_TO_EDGE);ie.activeTexture.set(de.TEXTURE0);let tt=d.fbo;if(!tt){const lt=new D(ie,{width:Ae,height:Ae,data:null},de.RGBA);lt.bind(de.LINEAR,de.CLAMP_TO_EDGE),tt=d.fbo=ie.createFramebuffer(Ae,Ae,!0,!1),tt.colorAttachment.set(lt.texture)}ie.bindFramebuffer.set(tt.framebuffer),ie.viewport.set([0,0,Ae,Ae]),V.useProgram("hillshadePrepare").draw(ie,de.TRIANGLES,z,j,$,Xa.disabled,Dn(d.tileID,xe),null,g.id,V.rasterBoundsBuffer,V.quadTriangleIndexBuffer,V.rasterBoundsSegments),d.needsHillshadePrepare=!1}}function jl(V,d,g,z,j,$){const ie=z.paint.get("raster-fade-duration");if(!$&&ie>0){const de=v.now(),xe=(de-V.timeAdded)/ie,Ae=d?(de-d.timeAdded)/ie:-1,Re=g.getSource(),je=j.coveringZoomLevel({tileSize:Re.tileSize,roundZoom:Re.roundZoom}),tt=!d||Math.abs(d.tileID.overscaledZ-je)>Math.abs(V.tileID.overscaledZ-je),lt=tt&&V.refreshedUponExpiration?1:i.ad(tt?xe:1-Ae,0,1);return V.refreshedUponExpiration&&xe>=1&&(V.refreshedUponExpiration=!1),d?{opacity:1,mix:1-lt}:{opacity:lt,mix:0}}return{opacity:1,mix:0}}const pu=new i.aN(1,0,0,1),ec=new i.aN(0,1,0,1),Ul=new i.aN(0,0,1,1),ga=new i.aN(1,0,1,1),Rh=new i.aN(0,1,1,1);function Oh(V){const d=V.transform.padding;mh(V,V.transform.height-(d.top||0),3,pu),mh(V,d.bottom||0,3,ec),Ps(V,d.left||0,3,Ul),Ps(V,V.transform.width-(d.right||0),3,ga);const g=V.transform.centerPoint;(function(z,j,$,ie){Qc(z,j-1,$-10,2,20,ie),Qc(z,j-10,$-1,20,2,ie)})(V,g.x,V.transform.height-g.y,Rh)}function mh(V,d,g,z){Qc(V,0,d+g/2,V.transform.width,g,z)}function Ps(V,d,g,z){Qc(V,d-g/2,0,g,V.transform.height,z)}function Qc(V,d,g,z,j,$){const ie=V.context,de=ie.gl;de.enable(de.SCISSOR_TEST),de.scissor(d*V.pixelRatio,g*V.pixelRatio,z*V.pixelRatio,j*V.pixelRatio),ie.clear({color:$}),de.disable(de.SCISSOR_TEST)}function Hf(V,d,g){const z=V.context,j=z.gl,$=g.posMatrix,ie=V.useProgram("debug"),de=Qi.disabled,xe=Za.disabled,Ae=V.colorModeForRenderPass(),Re="$debug",je=V.style.map.terrain&&V.style.map.terrain.getTerrainData(g);z.activeTexture.set(j.TEXTURE0);const tt=d.getTileByID(g.key).latestRawTileData,lt=tt&&tt.byteLength||0,ft=Math.floor(lt/1024),yt=d.getTile(g).tileSize,Ct=512/Math.min(yt,512)*(g.overscaledZ/V.transform.zoom)*.5;let kt=g.canonical.toString();g.overscaledZ!==g.canonical.z&&(kt+=` => ${g.overscaledZ}`),function(Bt,At){Bt.initDebugOverlayCanvas();const $t=Bt.debugOverlayCanvas,Kt=Bt.context.gl,Yt=Bt.debugOverlayCanvas.getContext("2d");Yt.clearRect(0,0,$t.width,$t.height),Yt.shadowColor="white",Yt.shadowBlur=2,Yt.lineWidth=1.5,Yt.strokeStyle="white",Yt.textBaseline="top",Yt.font="bold 36px Open Sans, sans-serif",Yt.fillText(At,5,5),Yt.strokeText(At,5,5),Bt.debugOverlayTexture.update($t),Bt.debugOverlayTexture.bind(Kt.LINEAR,Kt.CLAMP_TO_EDGE)}(V,`${kt} ${ft}kB`),ie.draw(z,j.TRIANGLES,de,xe,qo.alphaBlended,Xa.disabled,bn($,i.aN.transparent,Ct),null,Re,V.debugBuffer,V.quadTriangleIndexBuffer,V.debugSegments),ie.draw(z,j.LINE_STRIP,de,xe,Ae,Xa.disabled,bn($,i.aN.red),je,Re,V.debugBuffer,V.tileBorderIndexBuffer,V.debugSegments)}function Dc(V,d,g){const z=V.context,j=z.gl,$=V.colorModeForRenderPass(),ie=new Qi(j.LEQUAL,Qi.ReadWrite,V.depthRangeFor3D),de=V.useProgram("terrain"),xe=d.getTerrainMesh();z.bindFramebuffer.set(null),z.viewport.set([0,0,V.width,V.height]);for(const Ae of g){const Re=V.renderToTexture.getTexture(Ae),je=d.getTerrainData(Ae.tileID);z.activeTexture.set(j.TEXTURE0),j.bindTexture(j.TEXTURE_2D,Re.texture);const tt=V.transform.calculatePosMatrix(Ae.tileID.toUnwrapped()),lt=d.getMeshFrameDelta(V.transform.zoom),ft=V.transform.calculateFogMatrix(Ae.tileID.toUnwrapped()),yt=_n(tt,lt,ft,V.style.sky,V.transform.pitch);de.draw(z,j.TRIANGLES,ie,Za.disabled,$,Xa.backCCW,yt,je,"terrain",xe.vertexBuffer,xe.indexBuffer,xe.segments)}}class Rc{constructor(d,g,z){this.vertexBuffer=d,this.indexBuffer=g,this.segments=z}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Oc{constructor(d,g){this.context=new Zc(d),this.transform=g,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:i.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=We.maxUnderzooming+We.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ar}resize(d,g,z){if(this.width=Math.floor(d*z),this.height=Math.floor(g*z),this.pixelRatio=z,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const j of this.style._order)this.style._layers[j].resize()}setup(){const d=this.context,g=new i.aX;g.emplaceBack(0,0),g.emplaceBack(i.X,0),g.emplaceBack(0,i.X),g.emplaceBack(i.X,i.X),this.tileExtentBuffer=d.createVertexBuffer(g,gr.members),this.tileExtentSegments=i.a0.simpleSegment(0,0,4,2);const z=new i.aX;z.emplaceBack(0,0),z.emplaceBack(i.X,0),z.emplaceBack(0,i.X),z.emplaceBack(i.X,i.X),this.debugBuffer=d.createVertexBuffer(z,gr.members),this.debugSegments=i.a0.simpleSegment(0,0,4,5);const j=new i.$;j.emplaceBack(0,0,0,0),j.emplaceBack(i.X,0,i.X,0),j.emplaceBack(0,i.X,0,i.X),j.emplaceBack(i.X,i.X,i.X,i.X),this.rasterBoundsBuffer=d.createVertexBuffer(j,Fe.members),this.rasterBoundsSegments=i.a0.simpleSegment(0,0,4,2);const $=new i.aX;$.emplaceBack(0,0),$.emplaceBack(1,0),$.emplaceBack(0,1),$.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer($,gr.members),this.viewportSegments=i.a0.simpleSegment(0,0,4,2);const ie=new i.aZ;ie.emplaceBack(0),ie.emplaceBack(1),ie.emplaceBack(3),ie.emplaceBack(2),ie.emplaceBack(0),this.tileBorderIndexBuffer=d.createIndexBuffer(ie);const de=new i.aY;de.emplaceBack(0,1,2),de.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(de);const xe=this.context.gl;this.stencilClearMode=new Za({func:xe.ALWAYS,mask:0},0,255,xe.ZERO,xe.ZERO,xe.ZERO)}clearStencil(){const d=this.context,g=d.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const z=i.H();i.aQ(z,0,this.width,this.height,0,0,1),i.K(z,z,[g.drawingBufferWidth,g.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(d,g.TRIANGLES,Qi.disabled,this.stencilClearMode,qo.disabled,Xa.disabled,Fn(z),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(d,g){if(this.currentStencilSource===d.source||!d.isTileClipped()||!g||!g.length)return;this.currentStencilSource=d.source;const z=this.context,j=z.gl;this.nextStencilID+g.length>256&&this.clearStencil(),z.setColorMode(qo.disabled),z.setDepthMode(Qi.disabled);const $=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const ie of g){const de=this._tileClippingMaskIDs[ie.key]=this.nextStencilID++,xe=this.style.map.terrain&&this.style.map.terrain.getTerrainData(ie);$.draw(z,j.TRIANGLES,Qi.disabled,new Za({func:j.ALWAYS,mask:0},de,255,j.KEEP,j.KEEP,j.REPLACE),qo.disabled,Xa.disabled,Fn(ie.posMatrix),xe,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,g=this.context.gl;return new Za({func:g.NOTEQUAL,mask:255},d,255,g.KEEP,g.KEEP,g.REPLACE)}stencilModeForClipping(d){const g=this.context.gl;return new Za({func:g.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,g.KEEP,g.KEEP,g.REPLACE)}stencilConfigForOverlap(d){const g=this.context.gl,z=d.sort((ie,de)=>de.overscaledZ-ie.overscaledZ),j=z[z.length-1].overscaledZ,$=z[0].overscaledZ-j+1;if($>1){this.currentStencilSource=void 0,this.nextStencilID+$>256&&this.clearStencil();const ie={};for(let de=0;de<$;de++)ie[de+j]=new Za({func:g.GEQUAL,mask:255},de+this.nextStencilID,255,g.KEEP,g.KEEP,g.REPLACE);return this.nextStencilID+=$,[ie,z]}return[{[j]:Za.disabled},z]}colorModeForRenderPass(){const d=this.context.gl;return this._showOverdrawInspector?new qo([d.CONSTANT_COLOR,d.ONE],new i.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?qo.unblended:qo.alphaBlended}depthModeForSublayer(d,g,z){if(!this.opaquePassEnabledForLayer())return Qi.disabled;const j=1-((1+this.currentLayer)*this.numSublayers+d)*this.depthEpsilon;return new Qi(z||this.context.gl.LEQUAL,g,[j,j])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(d,g){var z;this.style=d,this.options=g,this.lineAtlas=d.lineAtlas,this.imageManager=d.imageManager,this.glyphManager=d.glyphManager,this.symbolFadeChange=d.placement.symbolFadeChange(v.now()),this.imageManager.beginFrame();const j=this.style._order,$=this.style.sourceCaches,ie={},de={},xe={};for(const Ae in $){const Re=$[Ae];Re.used&&Re.prepare(this.context),ie[Ae]=Re.getVisibleCoordinates(),de[Ae]=ie[Ae].slice().reverse(),xe[Ae]=Re.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let Ae=0;Ae<j.length;Ae++){const Re=j[Ae];if(this.style._layers[Re].is3D()){this.opaquePassCutoff=Ae;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const Ae of j){const Re=this.style._layers[Ae];if(!Re.hasOffscreenPass()||Re.isHidden(this.transform.zoom))continue;const je=de[Re.source];(Re.type==="custom"||je.length)&&this.renderLayer(this,$[Re.source],Re,je)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:g.showOverdrawInspector?i.aN.black:i.aN.transparent,depth:1}),this.clearStencil(),!((z=this.style.stylesheet)===null||z===void 0)&&z.sky&&function(Ae,Re){const je=Ae.context,tt=je.gl,lt=((Bt,At,$t)=>({u_sky_color:Bt.properties.get("sky-color"),u_horizon_color:Bt.properties.get("horizon-color"),u_horizon:(At.height/2+At.getHorizon())*$t,u_sky_horizon_blend:Bt.properties.get("sky-horizon-blend")*At.height/2*$t}))(Re,Ae.style.map.transform,Ae.pixelRatio),ft=new Qi(tt.LEQUAL,Qi.ReadWrite,[0,1]),yt=Za.disabled,Ct=Ae.colorModeForRenderPass(),kt=Ae.useProgram("sky");if(!Re.mesh){const Bt=new i.aX;Bt.emplaceBack(-1,-1),Bt.emplaceBack(1,-1),Bt.emplaceBack(1,1),Bt.emplaceBack(-1,1);const At=new i.aY;At.emplaceBack(0,1,2),At.emplaceBack(0,2,3),Re.mesh=new Rc(je.createVertexBuffer(Bt,gr.members),je.createIndexBuffer(At),i.a0.simpleSegment(0,0,Bt.length,At.length))}kt.draw(je,tt.TRIANGLES,ft,yt,Ct,Xa.disabled,lt,void 0,"sky",Re.mesh.vertexBuffer,Re.mesh.indexBuffer,Re.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=g.showOverdrawInspector,this.depthRangeFor3D=[0,1-(d._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=j.length-1;this.currentLayer>=0;this.currentLayer--){const Ae=this.style._layers[j[this.currentLayer]],Re=$[Ae.source],je=ie[Ae.source];this._renderTileClippingMasks(Ae,je),this.renderLayer(this,Re,Ae,je)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<j.length;this.currentLayer++){const Ae=this.style._layers[j[this.currentLayer]],Re=$[Ae.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(Ae))continue;const je=(Ae.type==="symbol"?xe:de)[Ae.source];this._renderTileClippingMasks(Ae,ie[Ae.source]),this.renderLayer(this,Re,Ae,je)}if(this.options.showTileBoundaries){const Ae=function(Re,je){let tt=null;const lt=Object.values(Re._layers).flatMap(kt=>kt.source&&!kt.isHidden(je)?[Re.sourceCaches[kt.source]]:[]),ft=lt.filter(kt=>kt.getSource().type==="vector"),yt=lt.filter(kt=>kt.getSource().type!=="vector"),Ct=kt=>{(!tt||tt.getSource().maxzoom<kt.getSource().maxzoom)&&(tt=kt)};return ft.forEach(kt=>Ct(kt)),tt||yt.forEach(kt=>Ct(kt)),tt}(this.style,this.transform.zoom);Ae&&function(Re,je,tt){for(let lt=0;lt<tt.length;lt++)Hf(Re,je,tt[lt])}(this,Ae,Ae.getVisibleCoordinates())}this.options.showPadding&&Oh(this),this.context.setDefault()}maybeDrawDepthAndCoords(d){if(!this.style||!this.style.map||!this.style.map.terrain)return;const g=this.terrainFacilitator.matrix,z=this.transform.modelViewProjectionMatrix;let j=this.terrainFacilitator.dirty;j||(j=d?!i.a_(g,z):!i.a$(g,z)),j||(j=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),j&&(i.b0(g,z),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function($,ie){const de=$.context,xe=de.gl,Ae=qo.unblended,Re=new Qi(xe.LEQUAL,Qi.ReadWrite,[0,1]),je=ie.getTerrainMesh(),tt=ie.sourceCache.getRenderableTiles(),lt=$.useProgram("terrainDepth");de.bindFramebuffer.set(ie.getFramebuffer("depth").framebuffer),de.viewport.set([0,0,$.width/devicePixelRatio,$.height/devicePixelRatio]),de.clear({color:i.aN.transparent,depth:1});for(const ft of tt){const yt=ie.getTerrainData(ft.tileID),Ct={u_matrix:$.transform.calculatePosMatrix(ft.tileID.toUnwrapped()),u_ele_delta:ie.getMeshFrameDelta($.transform.zoom)};lt.draw(de,xe.TRIANGLES,Re,Za.disabled,Ae,Xa.backCCW,Ct,yt,"terrain",je.vertexBuffer,je.indexBuffer,je.segments)}de.bindFramebuffer.set(null),de.viewport.set([0,0,$.width,$.height])}(this,this.style.map.terrain),function($,ie){const de=$.context,xe=de.gl,Ae=qo.unblended,Re=new Qi(xe.LEQUAL,Qi.ReadWrite,[0,1]),je=ie.getTerrainMesh(),tt=ie.getCoordsTexture(),lt=ie.sourceCache.getRenderableTiles(),ft=$.useProgram("terrainCoords");de.bindFramebuffer.set(ie.getFramebuffer("coords").framebuffer),de.viewport.set([0,0,$.width/devicePixelRatio,$.height/devicePixelRatio]),de.clear({color:i.aN.transparent,depth:1}),ie.coordsIndex=[];for(const yt of lt){const Ct=ie.getTerrainData(yt.tileID);de.activeTexture.set(xe.TEXTURE0),xe.bindTexture(xe.TEXTURE_2D,tt.texture);const kt={u_matrix:$.transform.calculatePosMatrix(yt.tileID.toUnwrapped()),u_terrain_coords_id:(255-ie.coordsIndex.length)/255,u_texture:0,u_ele_delta:ie.getMeshFrameDelta($.transform.zoom)};ft.draw(de,xe.TRIANGLES,Re,Za.disabled,Ae,Xa.backCCW,kt,Ct,"terrain",je.vertexBuffer,je.indexBuffer,je.segments),ie.coordsIndex.push(yt.tileID.key)}de.bindFramebuffer.set(null),de.viewport.set([0,0,$.width,$.height])}(this,this.style.map.terrain))}renderLayer(d,g,z,j){if(!z.isHidden(this.transform.zoom)&&(z.type==="background"||z.type==="custom"||(j||[]).length))switch(this.id=z.id,z.type){case"symbol":Ku(d,g,z,j,this.style.placement.variableOffsets);break;case"circle":(function($,ie,de,xe){if($.renderPass!=="translucent")return;const Ae=de.paint.get("circle-opacity"),Re=de.paint.get("circle-stroke-width"),je=de.paint.get("circle-stroke-opacity"),tt=!de.layout.get("circle-sort-key").isConstant();if(Ae.constantOr(1)===0&&(Re.constantOr(1)===0||je.constantOr(1)===0))return;const lt=$.context,ft=lt.gl,yt=$.depthModeForSublayer(0,Qi.ReadOnly),Ct=Za.disabled,kt=$.colorModeForRenderPass(),Bt=[];for(let At=0;At<xe.length;At++){const $t=xe[At],Kt=ie.getTile($t),Yt=Kt.getBucket(de);if(!Yt)continue;const pn=Yt.programConfigurations.get(de.id),Tn=$.useProgram("circle",pn),Vn=Yt.layoutVertexBuffer,jn=Yt.indexBuffer,$n=$.style.map.terrain&&$.style.map.terrain.getTerrainData($t),er={programConfiguration:pn,program:Tn,layoutVertexBuffer:Vn,indexBuffer:jn,uniformValues:Gn($,$t,Kt,de),terrainData:$n};if(tt){const Tr=Yt.segments.get();for(const rr of Tr)Bt.push({segments:new i.a0([rr]),sortKey:rr.sortKey,state:er})}else Bt.push({segments:Yt.segments,sortKey:0,state:er})}tt&&Bt.sort((At,$t)=>At.sortKey-$t.sortKey);for(const At of Bt){const{programConfiguration:$t,program:Kt,layoutVertexBuffer:Yt,indexBuffer:pn,uniformValues:Tn,terrainData:Vn}=At.state,jn=At.segments;Kt.draw(lt,ft.TRIANGLES,yt,Ct,kt,Xa.disabled,Tn,Vn,de.id,Yt,pn,jn,de.paint,$.transform.zoom,$t)}})(d,g,z,j);break;case"heatmap":Ju(d,g,z,j);break;case"line":(function($,ie,de,xe){if($.renderPass!=="translucent")return;const Ae=de.paint.get("line-opacity"),Re=de.paint.get("line-width");if(Ae.constantOr(1)===0||Re.constantOr(1)===0)return;const je=$.depthModeForSublayer(0,Qi.ReadOnly),tt=$.colorModeForRenderPass(),lt=de.paint.get("line-dasharray"),ft=de.paint.get("line-pattern"),yt=ft.constantOr(1),Ct=de.paint.get("line-gradient"),kt=de.getCrossfadeParameters(),Bt=yt?"linePattern":lt?"lineSDF":Ct?"lineGradient":"line",At=$.context,$t=At.gl;let Kt=!0;for(const Yt of xe){const pn=ie.getTile(Yt);if(yt&&!pn.patternsLoaded())continue;const Tn=pn.getBucket(de);if(!Tn)continue;const Vn=Tn.programConfigurations.get(de.id),jn=$.context.program.get(),$n=$.useProgram(Bt,Vn),er=Kt||$n.program!==jn,Tr=$.style.map.terrain&&$.style.map.terrain.getTerrainData(Yt),rr=ft.constantOr(null);if(rr&&pn.imageAtlas){const Pr=pn.imageAtlas,br=Pr.patternPositions[rr.to.toString()],Nr=Pr.patternPositions[rr.from.toString()];br&&Nr&&Vn.setConstantPatternPositions(br,Nr)}const Ar=Tr?Yt:null,ur=yt?tr($,pn,de,kt,Ar):lt?dr($,pn,de,lt,kt,Ar):Ct?En($,pn,de,Tn.lineClipsArray.length,Ar):cn($,pn,de,Ar);if(yt)At.activeTexture.set($t.TEXTURE0),pn.imageAtlasTexture.bind($t.LINEAR,$t.CLAMP_TO_EDGE),Vn.updatePaintBuffers(kt);else if(lt&&(er||$.lineAtlas.dirty))At.activeTexture.set($t.TEXTURE0),$.lineAtlas.bind(At);else if(Ct){const Pr=Tn.gradients[de.id];let br=Pr.texture;if(de.gradientVersion!==Pr.version){let Nr=256;if(de.stepInterpolant){const li=ie.getSource().maxzoom,Fr=Yt.canonical.z===li?Math.ceil(1<<$.transform.maxZoom-Yt.canonical.z):1,ri=Tn.maxLineLength/i.X*1024*Fr;Nr=i.ad(i.aV(ri),256,At.maxTextureSize)}Pr.gradient=i.aW({expression:de.gradientExpression(),evaluationKey:"lineProgress",resolution:Nr,image:Pr.gradient||void 0,clips:Tn.lineClipsArray}),Pr.texture?Pr.texture.update(Pr.gradient):Pr.texture=new D(At,Pr.gradient,$t.RGBA),Pr.version=de.gradientVersion,br=Pr.texture}At.activeTexture.set($t.TEXTURE0),br.bind(de.stepInterpolant?$t.NEAREST:$t.LINEAR,$t.CLAMP_TO_EDGE)}$n.draw(At,$t.TRIANGLES,je,$.stencilModeForClipping(Yt),tt,Xa.disabled,ur,Tr,de.id,Tn.layoutVertexBuffer,Tn.indexBuffer,Tn.segments,de.paint,$.transform.zoom,Vn,Tn.layoutVertexBuffer2),Kt=!1}})(d,g,z,j);break;case"fill":(function($,ie,de,xe){const Ae=de.paint.get("fill-color"),Re=de.paint.get("fill-opacity");if(Re.constantOr(1)===0)return;const je=$.colorModeForRenderPass(),tt=de.paint.get("fill-pattern"),lt=$.opaquePassEnabledForLayer()&&!tt.constantOr(1)&&Ae.constantOr(i.aN.transparent).a===1&&Re.constantOr(0)===1?"opaque":"translucent";if($.renderPass===lt){const ft=$.depthModeForSublayer(1,$.renderPass==="opaque"?Qi.ReadWrite:Qi.ReadOnly);ph($,ie,de,xe,ft,je,!1)}if($.renderPass==="translucent"&&de.paint.get("fill-antialias")){const ft=$.depthModeForSublayer(de.getPaintProperty("fill-outline-color")?2:0,Qi.ReadOnly);ph($,ie,de,xe,ft,je,!0)}})(d,g,z,j);break;case"fill-extrusion":(function($,ie,de,xe){const Ae=de.paint.get("fill-extrusion-opacity");if(Ae!==0&&$.renderPass==="translucent"){const Re=new Qi($.context.gl.LEQUAL,Qi.ReadWrite,$.depthRangeFor3D);if(Ae!==1||de.paint.get("fill-extrusion-pattern").constantOr(1))Kc($,ie,de,xe,Re,Za.disabled,qo.disabled),Kc($,ie,de,xe,Re,$.stencilModeFor3D(),$.colorModeForRenderPass());else{const je=$.colorModeForRenderPass();Kc($,ie,de,xe,Re,Za.disabled,je)}}})(d,g,z,j);break;case"hillshade":(function($,ie,de,xe){if($.renderPass!=="offscreen"&&$.renderPass!=="translucent")return;const Ae=$.context,Re=$.depthModeForSublayer(0,Qi.ReadOnly),je=$.colorModeForRenderPass(),[tt,lt]=$.renderPass==="translucent"?$.stencilConfigForOverlap(xe):[{},xe];for(const ft of lt){const yt=ie.getTile(ft);yt.needsHillshadePrepare!==void 0&&yt.needsHillshadePrepare&&$.renderPass==="offscreen"?bf($,yt,de,Re,Za.disabled,je):$.renderPass==="translucent"&&Jc($,ft,yt,de,Re,tt[ft.overscaledZ],je)}Ae.viewport.set([0,0,$.width,$.height])})(d,g,z,j);break;case"raster":(function($,ie,de,xe){if($.renderPass!=="translucent"||de.paint.get("raster-opacity")===0||!xe.length)return;const Ae=$.context,Re=Ae.gl,je=ie.getSource(),tt=$.useProgram("raster"),lt=$.colorModeForRenderPass(),[ft,yt]=je instanceof Le?[{},xe]:$.stencilConfigForOverlap(xe),Ct=yt[yt.length-1].overscaledZ,kt=!$.options.moving;for(const Bt of yt){const At=$.depthModeForSublayer(Bt.overscaledZ-Ct,de.paint.get("raster-opacity")===1?Qi.ReadWrite:Qi.ReadOnly,Re.LESS),$t=ie.getTile(Bt);$t.registerFadeDuration(de.paint.get("raster-fade-duration"));const Kt=ie.findLoadedParent(Bt,0),Yt=ie.findLoadedSibling(Bt),pn=jl($t,Kt||Yt||null,ie,de,$.transform,$.style.map.terrain);let Tn,Vn;const jn=de.paint.get("raster-resampling")==="nearest"?Re.NEAREST:Re.LINEAR;Ae.activeTexture.set(Re.TEXTURE0),$t.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),Ae.activeTexture.set(Re.TEXTURE1),Kt?(Kt.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),Tn=Math.pow(2,Kt.tileID.overscaledZ-$t.tileID.overscaledZ),Vn=[$t.tileID.canonical.x*Tn%1,$t.tileID.canonical.y*Tn%1]):$t.texture.bind(jn,Re.CLAMP_TO_EDGE,Re.LINEAR_MIPMAP_NEAREST),$t.texture.useMipmap&&Ae.extTextureFilterAnisotropic&&$.transform.pitch>20&&Re.texParameterf(Re.TEXTURE_2D,Ae.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Ae.extTextureFilterAnisotropicMax);const $n=$.style.map.terrain&&$.style.map.terrain.getTerrainData(Bt),er=$n?Bt:null,Tr=er?er.posMatrix:$.transform.calculatePosMatrix(Bt.toUnwrapped(),kt),rr=Or(Tr,Vn||[0,0],Tn||1,pn,de);je instanceof Le?tt.draw(Ae,Re.TRIANGLES,At,Za.disabled,lt,Xa.disabled,rr,$n,de.id,je.boundsBuffer,$.quadTriangleIndexBuffer,je.boundsSegments):tt.draw(Ae,Re.TRIANGLES,At,ft[Bt.overscaledZ],lt,Xa.disabled,rr,$n,de.id,$.rasterBoundsBuffer,$.quadTriangleIndexBuffer,$.rasterBoundsSegments)}})(d,g,z,j);break;case"background":(function($,ie,de,xe){const Ae=de.paint.get("background-color"),Re=de.paint.get("background-opacity");if(Re===0)return;const je=$.context,tt=je.gl,lt=$.transform,ft=lt.tileSize,yt=de.paint.get("background-pattern");if($.isPatternMissing(yt))return;const Ct=!yt&&Ae.a===1&&Re===1&&$.opaquePassEnabledForLayer()?"opaque":"translucent";if($.renderPass!==Ct)return;const kt=Za.disabled,Bt=$.depthModeForSublayer(0,Ct==="opaque"?Qi.ReadWrite:Qi.ReadOnly),At=$.colorModeForRenderPass(),$t=$.useProgram(yt?"backgroundPattern":"background"),Kt=xe||lt.coveringTiles({tileSize:ft,terrain:$.style.map.terrain});yt&&(je.activeTexture.set(tt.TEXTURE0),$.imageManager.bind($.context));const Yt=de.getCrossfadeParameters();for(const pn of Kt){const Tn=xe?pn.posMatrix:$.transform.calculatePosMatrix(pn.toUnwrapped()),Vn=yt?fi(Tn,Re,$,yt,{tileID:pn,tileSize:ft},Yt):$r(Tn,Re,Ae),jn=$.style.map.terrain&&$.style.map.terrain.getTerrainData(pn);$t.draw(je,tt.TRIANGLES,Bt,kt,At,Xa.disabled,Vn,jn,de.id,$.tileExtentBuffer,$.quadTriangleIndexBuffer,$.tileExtentSegments)}})(d,0,z,j);break;case"custom":(function($,ie,de){const xe=$.context,Ae=de.implementation;if($.renderPass==="offscreen"){const Re=Ae.prerender;Re&&($.setCustomLayerDefaults(),xe.setColorMode($.colorModeForRenderPass()),Re.call(Ae,xe.gl,$.transform.customLayerMatrix()),xe.setDirty(),$.setBaseState())}else if($.renderPass==="translucent"){$.setCustomLayerDefaults(),xe.setColorMode($.colorModeForRenderPass()),xe.setStencilMode(Za.disabled);const Re=Ae.renderingMode==="3d"?new Qi($.context.gl.LEQUAL,Qi.ReadWrite,$.depthRangeFor3D):$.depthModeForSublayer(0,Qi.ReadOnly);xe.setDepthMode(Re),Ae.render(xe.gl,$.transform.customLayerMatrix(),{farZ:$.transform.farZ,nearZ:$.transform.nearZ,fov:$.transform._fov,modelViewProjectionMatrix:$.transform.modelViewProjectionMatrix,projectionMatrix:$.transform.projectionMatrix}),xe.setDirty(),$.setBaseState(),xe.bindFramebuffer.set(null)}})(d,0,z)}}translatePosMatrix(d,g,z,j,$){if(!z[0]&&!z[1])return d;const ie=$?j==="map"?this.transform.angle:0:j==="viewport"?-this.transform.angle:0;if(ie){const Ae=Math.sin(ie),Re=Math.cos(ie);z=[z[0]*Re-z[1]*Ae,z[0]*Ae+z[1]*Re]}const de=[$?z[0]:Tt(g,z[0],this.transform.zoom),$?z[1]:Tt(g,z[1],this.transform.zoom),0],xe=new Float32Array(16);return i.J(xe,d,de),xe}saveTileTexture(d){const g=this._tileTextures[d.size[0]];g?g.push(d):this._tileTextures[d.size[0]]=[d]}getTileTexture(d){const g=this._tileTextures[d];return g&&g.length>0?g.pop():null}isPatternMissing(d){if(!d)return!1;if(!d.from||!d.to)return!0;const g=this.imageManager.getPattern(d.from.toString()),z=this.imageManager.getPattern(d.to.toString());return!g||!z}useProgram(d,g){this.cache=this.cache||{};const z=d+(g?g.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[z]||(this.cache[z]=new or(this.context,Ir[d],g,Qr[d],this._showOverdrawInspector,this.style.map.terrain)),this.cache[z]}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 d=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(d.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;const d=this.context.gl;this.debugOverlayTexture=new D(this.context,this.debugOverlayCanvas,d.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:d,drawingBufferHeight:g}=this.context.gl;return this.width!==d||this.height!==g}}class mu{constructor(d,g){this.points=d,this.planes=g}static fromInvProjectionMatrix(d,g,z){const j=Math.pow(2,z),$=[[-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(de=>{const xe=1/(de=i.ag([],de,d))[3]/g*j;return i.b1(de,de,[xe,xe,1/de[3],xe])}),ie=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(de=>{const xe=function(tt,lt){var ft=lt[0],yt=lt[1],Ct=lt[2],kt=ft*ft+yt*yt+Ct*Ct;return kt>0&&(kt=1/Math.sqrt(kt)),tt[0]=lt[0]*kt,tt[1]=lt[1]*kt,tt[2]=lt[2]*kt,tt}([],function(tt,lt,ft){var yt=lt[0],Ct=lt[1],kt=lt[2],Bt=ft[0],At=ft[1],$t=ft[2];return tt[0]=Ct*$t-kt*At,tt[1]=kt*Bt-yt*$t,tt[2]=yt*At-Ct*Bt,tt}([],P([],$[de[0]],$[de[1]]),P([],$[de[2]],$[de[1]]))),Ae=(Re=xe,je=$[de[1]],-(Re[0]*je[0]+Re[1]*je[1]+Re[2]*je[2]));var Re,je;return xe.concat(Ae)});return new mu($,ie)}}class Hl{constructor(d,g){this.min=d,this.max=g,this.center=function(z,j,$){return z[0]=j[0]*$,z[1]=j[1]*$,z[2]=j[2]*$,z}([],function(z,j,$){return z[0]=j[0]+$[0],z[1]=j[1]+$[1],z[2]=j[2]+$[2],z}([],this.min,this.max),.5)}quadrant(d){const g=[d%2==0,d<2],z=A(this.min),j=A(this.max);for(let $=0;$<g.length;$++)z[$]=g[$]?this.min[$]:this.center[$],j[$]=g[$]?this.center[$]:this.max[$];return j[2]=this.max[2],new Hl(z,j)}distanceX(d){return Math.max(Math.min(this.max[0],d[0]),this.min[0])-d[0]}distanceY(d){return Math.max(Math.min(this.max[1],d[1]),this.min[1])-d[1]}intersects(d){const g=[[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 z=!0;for(let j=0;j<d.planes.length;j++){const $=d.planes[j];let ie=0;for(let de=0;de<g.length;de++)i.b2($,g[de])>=0&&ie++;if(ie===0)return 0;ie!==g.length&&(z=!1)}if(z)return 2;for(let j=0;j<3;j++){let $=Number.MAX_VALUE,ie=-Number.MAX_VALUE;for(let de=0;de<d.points.length;de++){const xe=d.points[de][j]-this.min[j];$=Math.min($,xe),ie=Math.max(ie,xe)}if(ie<0||$>this.max[j]-this.min[j])return 0}return 1}}class tc{constructor(d=0,g=0,z=0,j=0){if(isNaN(d)||d<0||isNaN(g)||g<0||isNaN(z)||z<0||isNaN(j)||j<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=g,this.left=z,this.right=j}interpolate(d,g,z){return g.top!=null&&d.top!=null&&(this.top=i.z.number(d.top,g.top,z)),g.bottom!=null&&d.bottom!=null&&(this.bottom=i.z.number(d.bottom,g.bottom,z)),g.left!=null&&d.left!=null&&(this.left=i.z.number(d.left,g.left,z)),g.right!=null&&d.right!=null&&(this.right=i.z.number(d.right,g.right,z)),this}getCenter(d,g){const z=i.ad((this.left+d-this.right)/2,0,d),j=i.ad((this.top+g-this.bottom)/2,0,g);return new i.P(z,j)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new tc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const eh=85.051129;class Ia{constructor(d,g,z,j,$){this.tileSize=512,this._renderWorldCopies=$===void 0||!!$,this._minZoom=d||0,this._maxZoom=g||22,this._minPitch=z??0,this._maxPitch=j??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new tc,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const d=new Ia(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return d.apply(this),d}apply(d){this.tileSize=d.tileSize,this.latRange=d.latRange,this.width=d.width,this.height=d.height,this._center=d._center,this._elevation=d._elevation,this.minElevationForCurrentTile=d.minElevationForCurrentTile,this.zoom=d.zoom,this.angle=d.angle,this._fov=d._fov,this._pitch=d._pitch,this._unmodified=d._unmodified,this._edgeInsets=d._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(d){this._minZoom!==d&&(this._minZoom=d,this.zoom=Math.max(this.zoom,d))}get maxZoom(){return this._maxZoom}set maxZoom(d){this._maxZoom!==d&&(this._maxZoom=d,this.zoom=Math.min(this.zoom,d))}get minPitch(){return this._minPitch}set minPitch(d){this._minPitch!==d&&(this._minPitch=d,this.pitch=Math.max(this.pitch,d))}get maxPitch(){return this._maxPitch}set maxPitch(d){this._maxPitch!==d&&(this._maxPitch=d,this.pitch=Math.min(this.pitch,d))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(d){d===void 0?d=!0:d===null&&(d=!1),this._renderWorldCopies=d}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(d){const g=-i.b3(d,-180,180)*Math.PI/180;this.angle!==g&&(this._unmodified=!1,this.angle=g,this._calcMatrices(),this.rotationMatrix=function(){var z=new i.A(4);return i.A!=Float32Array&&(z[1]=0,z[2]=0),z[0]=1,z[3]=1,z}(),function(z,j,$){var ie=j[0],de=j[1],xe=j[2],Ae=j[3],Re=Math.sin($),je=Math.cos($);z[0]=ie*je+xe*Re,z[1]=de*je+Ae*Re,z[2]=ie*-Re+xe*je,z[3]=de*-Re+Ae*je}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(d){const g=i.ad(d,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==g&&(this._unmodified=!1,this._pitch=g,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(d){d=Math.max(.01,Math.min(60,d)),this._fov!==d&&(this._unmodified=!1,this._fov=d/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(d){const g=Math.min(Math.max(d,this.minZoom),this.maxZoom);this._zoom!==g&&(this._unmodified=!1,this._zoom=g,this.tileZoom=Math.max(0,Math.floor(g)),this.scale=this.zoomScale(g),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(d){d.lat===this._center.lat&&d.lng===this._center.lng||(this._unmodified=!1,this._center=d,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(d){d!==this._elevation&&(this._elevation=d,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(d){this._edgeInsets.equals(d)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,d,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(d){return this._edgeInsets.equals(d)}interpolatePadding(d,g,z){this._unmodified=!1,this._edgeInsets.interpolate(d,g,z),this._constrain(),this._calcMatrices()}coveringZoomLevel(d){const g=(d.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/d.tileSize));return Math.max(0,g)}getVisibleUnwrappedCoordinates(d){const g=[new i.b4(0,d)];if(this._renderWorldCopies){const z=this.pointCoordinate(new i.P(0,0)),j=this.pointCoordinate(new i.P(this.width,0)),$=this.pointCoordinate(new i.P(this.width,this.height)),ie=this.pointCoordinate(new i.P(0,this.height)),de=Math.floor(Math.min(z.x,j.x,$.x,ie.x)),xe=Math.floor(Math.max(z.x,j.x,$.x,ie.x)),Ae=1;for(let Re=de-Ae;Re<=xe+Ae;Re++)Re!==0&&g.push(new i.b4(Re,d))}return g}coveringTiles(d){var g,z;let j=this.coveringZoomLevel(d);const $=j;if(d.minzoom!==void 0&&j<d.minzoom)return[];d.maxzoom!==void 0&&j>d.maxzoom&&(j=d.maxzoom);const ie=this.pointCoordinate(this.getCameraPoint()),de=i.Z.fromLngLat(this.center),xe=Math.pow(2,j),Ae=[xe*ie.x,xe*ie.y,0],Re=[xe*de.x,xe*de.y,0],je=mu.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,j);let tt=d.minzoom||0;!d.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(tt=j);const lt=d.terrain?2/Math.min(this.tileSize,d.tileSize)*this.tileSize:3,ft=At=>({aabb:new Hl([At*xe,0,0],[(At+1)*xe,xe,0]),zoom:0,x:0,y:0,wrap:At,fullyVisible:!1}),yt=[],Ct=[],kt=j,Bt=d.reparseOverscaled?$:j;if(this._renderWorldCopies)for(let At=1;At<=3;At++)yt.push(ft(-At)),yt.push(ft(At));for(yt.push(ft(0));yt.length>0;){const At=yt.pop(),$t=At.x,Kt=At.y;let Yt=At.fullyVisible;if(!Yt){const er=At.aabb.intersects(je);if(er===0)continue;Yt=er===2}const pn=d.terrain?Ae:Re,Tn=At.aabb.distanceX(pn),Vn=At.aabb.distanceY(pn),jn=Math.max(Math.abs(Tn),Math.abs(Vn)),$n=lt+(1<<kt-At.zoom)-2;if(At.zoom===kt||jn>$n&&At.zoom>=tt){const er=kt-At.zoom,Tr=Ae[0]-.5-($t<<er),rr=Ae[1]-.5-(Kt<<er);Ct.push({tileID:new i.S(At.zoom===kt?Bt:At.zoom,At.wrap,At.zoom,$t,Kt),distanceSq:M([Re[0]-.5-$t,Re[1]-.5-Kt]),tileDistanceToCamera:Math.sqrt(Tr*Tr+rr*rr)})}else for(let er=0;er<4;er++){const Tr=($t<<1)+er%2,rr=(Kt<<1)+(er>>1),Ar=At.zoom+1;let ur=At.aabb.quadrant(er);if(d.terrain){const Pr=new i.S(Ar,At.wrap,Ar,Tr,rr),br=d.terrain.getMinMaxElevation(Pr),Nr=(g=br.minElevation)!==null&&g!==void 0?g:this.elevation,li=(z=br.maxElevation)!==null&&z!==void 0?z:this.elevation;ur=new Hl([ur.min[0],ur.min[1],Nr],[ur.max[0],ur.max[1],li])}yt.push({aabb:ur,zoom:Ar,x:Tr,y:rr,wrap:At.wrap,fullyVisible:Yt})}}return Ct.sort((At,$t)=>At.distanceSq-$t.distanceSq).map(At=>At.tileID)}resize(d,g){this.width=d,this.height=g,this.pixelsToGLUnits=[2/d,-2/g],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(d){return Math.pow(2,d)}scaleZoom(d){return Math.log(d)/Math.LN2}project(d){const g=i.ad(d.lat,-85.051129,eh);return new i.P(i.O(d.lng)*this.worldSize,i.Q(g)*this.worldSize)}unproject(d){return new i.Z(d.x/this.worldSize,d.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(d){const g=this.elevation,z=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,j=this.pointLocation(this.centerPoint,d),$=d.getElevationForLngLatZoom(j,this.tileZoom);if(!(this.elevation-$))return;const ie=z+g-$,de=Math.cos(this._pitch)*this.cameraToCenterDistance/ie/i.b5(1,j.lat)/this.tileSize,xe=this.scaleZoom(de);this._elevation=$,this._center=j,this.zoom=xe}setLocationAtPoint(d,g){const z=this.pointCoordinate(g),j=this.pointCoordinate(this.centerPoint),$=this.locationCoordinate(d),ie=new i.Z($.x-(z.x-j.x),$.y-(z.y-j.y));this.center=this.coordinateLocation(ie),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(d,g){return g?this.coordinatePoint(this.locationCoordinate(d),g.getElevationForLngLatZoom(d,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(d))}pointLocation(d,g){return this.coordinateLocation(this.pointCoordinate(d,g))}locationCoordinate(d){return i.Z.fromLngLat(d)}coordinateLocation(d){return d&&d.toLngLat()}pointCoordinate(d,g){if(g){const ft=g.pointCoordinate(d);if(ft!=null)return ft}const z=[d.x,d.y,0,1],j=[d.x,d.y,1,1];i.ag(z,z,this.pixelMatrixInverse),i.ag(j,j,this.pixelMatrixInverse);const $=z[3],ie=j[3],de=z[0]/$,xe=j[0]/ie,Ae=z[1]/$,Re=j[1]/ie,je=z[2]/$,tt=j[2]/ie,lt=je===tt?0:(0-je)/(tt-je);return new i.Z(i.z.number(de,xe,lt)/this.worldSize,i.z.number(Ae,Re,lt)/this.worldSize)}coordinatePoint(d,g=0,z=this.pixelMatrix){const j=[d.x*this.worldSize,d.y*this.worldSize,g,1];return i.ag(j,j,z),new i.P(j[0]/j[3],j[1]/j[3])}getBounds(){const d=Math.max(0,this.height/2-this.getHorizon());return new Se().extend(this.pointLocation(new i.P(0,d))).extend(this.pointLocation(new i.P(this.width,d))).extend(this.pointLocation(new i.P(this.width,this.height))).extend(this.pointLocation(new i.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Se([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(d){d?(this.lngRange=[d.getWest(),d.getEast()],this.latRange=[d.getSouth(),d.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,eh])}calculateTileMatrix(d){const g=d.canonical,z=this.worldSize/this.zoomScale(g.z),j=g.x+Math.pow(2,g.z)*d.wrap,$=i.ao(new Float64Array(16));return i.J($,$,[j*z,g.y*z,0]),i.K($,$,[z/i.X,z/i.X,1]),$}calculatePosMatrix(d,g=!1){const z=d.key,j=g?this._alignedPosMatrixCache:this._posMatrixCache;if(j[z])return j[z];const $=this.calculateTileMatrix(d);return i.L($,g?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,$),j[z]=new Float32Array($),j[z]}calculateFogMatrix(d){const g=d.key,z=this._fogMatrixCache;if(z[g])return z[g];const j=this.calculateTileMatrix(d);return i.L(j,this.fogMatrix,j),z[g]=new Float32Array(j),z[g]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(d,g){g=i.ad(+g,this.minZoom,this.maxZoom);const z={center:new i.N(d.lng,d.lat),zoom:g};let j=this.lngRange;if(!this._renderWorldCopies&&j===null){const At=179.9999999999;j=[-At,At]}const $=this.tileSize*this.zoomScale(z.zoom);let ie=0,de=$,xe=0,Ae=$,Re=0,je=0;const{x:tt,y:lt}=this.size;if(this.latRange){const At=this.latRange;ie=i.Q(At[1])*$,de=i.Q(At[0])*$,de-ie<lt&&(Re=lt/(de-ie))}j&&(xe=i.b3(i.O(j[0])*$,0,$),Ae=i.b3(i.O(j[1])*$,0,$),Ae<xe&&(Ae+=$),Ae-xe<tt&&(je=tt/(Ae-xe)));const{x:ft,y:yt}=this.project.call({worldSize:$},d);let Ct,kt;const Bt=Math.max(je||0,Re||0);if(Bt){const At=new i.P(je?(Ae+xe)/2:ft,Re?(de+ie)/2:yt);return z.center=this.unproject.call({worldSize:$},At).wrap(),z.zoom+=this.scaleZoom(Bt),z}if(this.latRange){const At=lt/2;yt-At<ie&&(kt=ie+At),yt+At>de&&(kt=de-At)}if(j){const At=(xe+Ae)/2;let $t=ft;this._renderWorldCopies&&($t=i.b3(ft,At-$/2,At+$/2));const Kt=tt/2;$t-Kt<xe&&(Ct=xe+Kt),$t+Kt>Ae&&(Ct=Ae-Kt)}if(Ct!==void 0||kt!==void 0){const At=new i.P(Ct??ft,kt??yt);z.center=this.unproject.call({worldSize:$},At).wrap()}return z}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const d=this._unmodified,{center:g,zoom:z}=this.getConstrained(this.center,this.zoom);this.center=g,this.zoom=z,this._unmodified=d,this._constraining=!1}_calcMatrices(){if(!this.height)return;const d=this._fov/2,g=this.centerOffset,z=this.point.x,j=this.point.y;this.cameraToCenterDistance=.5/Math.tan(d)*this.height,this._pixelPerMeter=i.b5(1,this.center.lat)*this.worldSize;let $=i.ao(new Float64Array(16));i.K($,$,[this.width/2,-this.height/2,1]),i.J($,$,[1,-1,0]),this.labelPlaneMatrix=$,$=i.ao(new Float64Array(16)),i.K($,$,[1,-1,1]),i.J($,$,[-1,-1,0]),i.K($,$,[2/this.width,2/this.height,1]),this.glCoordMatrix=$;const ie=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),de=Math.min(this.elevation,this.minElevationForCurrentTile),xe=ie-de*this._pixelPerMeter/Math.cos(this._pitch),Ae=de<0?xe:ie,Re=Math.PI/2+this._pitch,je=this._fov*(.5+g.y/this.height),tt=Math.sin(je)*Ae/Math.sin(i.ad(Math.PI-Re-je,.01,Math.PI-.01)),lt=this.getHorizon(),ft=2*Math.atan(lt/this.cameraToCenterDistance)*(.5+g.y/(2*lt)),yt=Math.sin(ft)*Ae/Math.sin(i.ad(Math.PI-Re-ft,.01,Math.PI-.01)),Ct=Math.min(tt,yt);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*Ct+Ae),this.nearZ=this.height/50,$=new Float64Array(16),i.b6($,this._fov,this.width/this.height,this.nearZ,this.farZ),$[8]=2*-g.x/this.width,$[9]=2*g.y/this.height,this.projectionMatrix=i.af($),i.K($,$,[1,-1,1]),i.J($,$,[0,0,-this.cameraToCenterDistance]),i.b7($,$,this._pitch),i.ae($,$,this.angle),i.J($,$,[-z,-j,0]),this.mercatorMatrix=i.K([],$,[this.worldSize,this.worldSize,this.worldSize]),i.K($,$,[1,1,this._pixelPerMeter]),this.pixelMatrix=i.L(new Float64Array(16),this.labelPlaneMatrix,$),i.J($,$,[0,0,-this.elevation]),this.modelViewProjectionMatrix=$,this.invModelViewProjectionMatrix=i.at([],$),this.fogMatrix=new Float64Array(16),i.b6(this.fogMatrix,this._fov,this.width/this.height,ie,this.farZ),this.fogMatrix[8]=2*-g.x/this.width,this.fogMatrix[9]=2*g.y/this.height,i.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),i.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),i.b7(this.fogMatrix,this.fogMatrix,this._pitch),i.ae(this.fogMatrix,this.fogMatrix,this.angle),i.J(this.fogMatrix,this.fogMatrix,[-z,-j,0]),i.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),i.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=i.L(new Float64Array(16),this.labelPlaneMatrix,$);const kt=this.width%2/2,Bt=this.height%2/2,At=Math.cos(this.angle),$t=Math.sin(this.angle),Kt=z-Math.round(z)+At*kt+$t*Bt,Yt=j-Math.round(j)+At*Bt+$t*kt,pn=new Float64Array($);if(i.J(pn,pn,[Kt>.5?Kt-1:Kt,Yt>.5?Yt-1:Yt,0]),this.alignedModelViewProjectionMatrix=pn,$=i.at(new Float64Array(16),this.pixelMatrix),!$)throw new Error("failed to invert matrix");this.pixelMatrixInverse=$,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const d=this.pointCoordinate(new i.P(0,0)),g=[d.x*this.worldSize,d.y*this.worldSize,0,1];return i.ag(g,g,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const d=this._pitch,g=Math.tan(d)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,g))}getCameraQueryGeometry(d){const g=this.getCameraPoint();if(d.length===1)return[d[0],g];{let z=g.x,j=g.y,$=g.x,ie=g.y;for(const de of d)z=Math.min(z,de.x),j=Math.min(j,de.y),$=Math.max($,de.x),ie=Math.max(ie,de.y);return[new i.P(z,j),new i.P($,j),new i.P($,ie),new i.P(z,ie),new i.P(z,j)]}}lngLatToCameraDepth(d,g){const z=this.locationCoordinate(d),j=[z.x*this.worldSize,z.y*this.worldSize,g,1];return i.ag(j,j,this.modelViewProjectionMatrix),j[2]/j[3]}}function gu(V,d){let g,z=!1,j=null,$=null;const ie=()=>{j=null,z&&(V.apply($,g),j=setTimeout(ie,d),z=!1)};return(...de)=>(z=!0,$=this,g=de,j||ie(),j)}class Go{constructor(d){this._getCurrentHash=()=>{const g=window.location.hash.replace("#","");if(this._hashName){let z;return g.split("&").map(j=>j.split("=")).forEach(j=>{j[0]===this._hashName&&(z=j)}),(z&&z[1]||"").split("/")}return g.split("/")},this._onHashChange=()=>{const g=this._getCurrentHash();if(g.length>=3&&!g.some(z=>isNaN(z))){const z=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(g[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+g[2],+g[1]],zoom:+g[0],bearing:z,pitch:+(g[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const g=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,g)},this._removeHash=()=>{const g=this._getCurrentHash();if(g.length===0)return;const z=g.join("/");let j=z;j.split("&").length>0&&(j=j.split("&")[0]),this._hashName&&(j=`${this._hashName}=${z}`);let $=window.location.hash.replace(j,"");$.startsWith("#&")?$=$.slice(0,1)+$.slice(2):$==="#"&&($="");let ie=window.location.href.replace(/(#.+)?$/,$);ie=ie.replace("&&","&"),window.history.replaceState(window.history.state,null,ie)},this._updateHash=gu(this._updateHashUnthrottled,300),this._hashName=d&&encodeURIComponent(d)}addTo(d){return this._map=d,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(d){const g=this._map.getCenter(),z=Math.round(100*this._map.getZoom())/100,j=Math.ceil((z*Math.LN2+Math.log(512/360/.5))/Math.LN10),$=Math.pow(10,j),ie=Math.round(g.lng*$)/$,de=Math.round(g.lat*$)/$,xe=this._map.getBearing(),Ae=this._map.getPitch();let Re="";if(Re+=d?`/${ie}/${de}/${z}`:`${z}/${de}/${ie}`,(xe||Ae)&&(Re+="/"+Math.round(10*xe)/10),Ae&&(Re+=`/${Math.round(Ae)}`),this._hashName){const je=this._hashName;let tt=!1;const lt=window.location.hash.slice(1).split("&").map(ft=>{const yt=ft.split("=")[0];return yt===je?(tt=!0,`${yt}=${Re}`):ft}).filter(ft=>ft);return tt||lt.push(`${je}=${Re}`),`#${lt.join("&")}`}return`#${Re}`}}const nl={linearity:.3,easing:i.b8(0,0,.3,1)},Sa=i.e({deceleration:2500,maxSpeed:1400},nl),La=i.e({deceleration:20,maxSpeed:1400},nl),Wl=i.e({deceleration:1e3,maxSpeed:360},nl),th=i.e({deceleration:1e3,maxSpeed:90},nl);class zc{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:v.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,g=v.now();for(;d.length>0&&g-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const g={zoom:0,bearing:0,pitch:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:$}of this._inertiaBuffer)g.zoom+=$.zoomDelta||0,g.bearing+=$.bearingDelta||0,g.pitch+=$.pitchDelta||0,$.panDelta&&g.pan._add($.panDelta),$.around&&(g.around=$.around),$.pinchAround&&(g.pinchAround=$.pinchAround);const z=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,j={};if(g.pan.mag()){const $=vc(g.pan.mag(),z,i.e({},Sa,d||{}));j.offset=g.pan.mult($.amount/g.pan.mag()),j.center=this._map.transform.center,gc(j,$)}if(g.zoom){const $=vc(g.zoom,z,La);j.zoom=this._map.transform.zoom+$.amount,gc(j,$)}if(g.bearing){const $=vc(g.bearing,z,Wl);j.bearing=this._map.transform.bearing+i.ad($.amount,-179,179),gc(j,$)}if(g.pitch){const $=vc(g.pitch,z,th);j.pitch=this._map.transform.pitch+$.amount,gc(j,$)}if(j.zoom||j.bearing){const $=g.pinchAround===void 0?g.around:g.pinchAround;j.around=$?this._map.unproject($):this._map.getCenter()}return this.clear(),i.e(j,{noMoveStart:!0})}}function gc(V,d){(!V.duration||V.duration<d.duration)&&(V.duration=d.duration,V.easing=d.easing)}function vc(V,d,g){const{maxSpeed:z,linearity:j,deceleration:$}=g,ie=i.ad(V*j/(d/1e3),-z,z),de=Math.abs(ie)/($*j);return{easing:g.easing,duration:1e3*de,amount:ie*(de/2)}}class Ds extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z,j={}){const $=o.mousePos(g.getCanvas(),z),ie=g.unproject($);super(d,i.e({point:$,lngLat:ie,originalEvent:z},j)),this._defaultPrevented=!1,this.target=g}}class ys extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z){const j=d==="touchend"?z.changedTouches:z.touches,$=o.touchPos(g.getCanvasContainer(),j),ie=$.map(xe=>g.unproject(xe)),de=$.reduce((xe,Ae,Re,je)=>xe.add(Ae.div(je.length)),new i.P(0,0));super(d,{points:$,point:de,lngLats:ie,lngLat:g.unproject(de),originalEvent:z}),this._defaultPrevented=!1}}class Mu extends i.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,g,z){super(d,{originalEvent:z}),this._defaultPrevented=!1}}class Fc{constructor(d,g){this._map=d,this._clickTolerance=g.clickTolerance}reset(){delete this._mousedownPos}wheel(d){return this._firePreventable(new Mu(d.type,this._map,d))}mousedown(d,g){return this._mousedownPos=g,this._firePreventable(new Ds(d.type,this._map,d))}mouseup(d){this._map.fire(new Ds(d.type,this._map,d))}click(d,g){this._mousedownPos&&this._mousedownPos.dist(g)>=this._clickTolerance||this._map.fire(new Ds(d.type,this._map,d))}dblclick(d){return this._firePreventable(new Ds(d.type,this._map,d))}mouseover(d){this._map.fire(new Ds(d.type,this._map,d))}mouseout(d){this._map.fire(new Ds(d.type,this._map,d))}touchstart(d){return this._firePreventable(new ys(d.type,this._map,d))}touchmove(d){this._map.fire(new ys(d.type,this._map,d))}touchend(d){this._map.fire(new ys(d.type,this._map,d))}touchcancel(d){this._map.fire(new ys(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(d){this._map.fire(new Ds(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ds("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._ignoreContextMenu||this._map.fire(new Ds(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class io{constructor(d){this._map=d}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(d){return this.transform.pointLocation(i.P.convert(d),this._map.terrain)}}class bs{constructor(d,g){this._map=d,this._tr=new io(d),this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=g.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,g){this.isEnabled()&&d.shiftKey&&d.button===0&&(o.disableDrag(),this._startPos=this._lastPos=g,this._active=!0)}mousemoveWindow(d,g){if(!this._active)return;const z=g;if(this._lastPos.equals(z)||!this._box&&z.dist(this._startPos)<this._clickTolerance)return;const j=this._startPos;this._lastPos=z,this._box||(this._box=o.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",d));const $=Math.min(j.x,z.x),ie=Math.max(j.x,z.x),de=Math.min(j.y,z.y),xe=Math.max(j.y,z.y);o.setTransform(this._box,`translate(${$}px,${de}px)`),this._box.style.width=ie-$+"px",this._box.style.height=xe-de+"px"}mouseupWindow(d,g){if(!this._active||d.button!==0)return;const z=this._startPos,j=g;if(this.reset(),o.suppressClick(),z.x!==j.x||z.y!==j.y)return this._map.fire(new i.k("boxzoomend",{originalEvent:d})),{cameraAnimation:$=>$.fitScreenCoordinates(z,j,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",d)}keydown(d){this._active&&d.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",d))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(o.remove(this._box),this._box=null),o.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(d,g){return this._map.fire(new i.k(d,{originalEvent:g}))}}function Ba(V,d){if(V.length!==d.length)throw new Error(`The number of touches and points are not equal - touches ${V.length}, points ${d.length}`);const g={};for(let z=0;z<V.length;z++)g[V[z].identifier]=d[z];return g}class $o{constructor(d){this.reset(),this.numTouches=d.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(d,g,z){(this.centroid||z.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=d.timeStamp),z.length===this.numTouches&&(this.centroid=function(j){const $=new i.P(0,0);for(const ie of j)$._add(ie);return $.div(j.length)}(g),this.touches=Ba(z,g)))}touchmove(d,g,z){if(this.aborted||!this.centroid)return;const j=Ba(z,g);for(const $ in this.touches){const ie=this.touches[$],de=j[$];(!de||de.dist(ie)>30)&&(this.aborted=!0)}}touchend(d,g,z){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),z.length===0){const j=!this.aborted&&this.centroid;if(this.reset(),j)return j}}}class Na{constructor(d){this.singleTap=new $o(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(d,g,z){this.singleTap.touchstart(d,g,z)}touchmove(d,g,z){this.singleTap.touchmove(d,g,z)}touchend(d,g,z){const j=this.singleTap.touchend(d,g,z);if(j){const $=d.timeStamp-this.lastTime<500,ie=!this.lastTap||this.lastTap.dist(j)<30;if($&&ie||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=j,this.count===this.numTaps)return this.reset(),j}}}class is{constructor(d){this._tr=new io(d),this._zoomIn=new Na({numTouches:1,numTaps:2}),this._zoomOut=new Na({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,g,z){this._zoomIn.touchstart(d,g,z),this._zoomOut.touchstart(d,g,z)}touchmove(d,g,z){this._zoomIn.touchmove(d,g,z),this._zoomOut.touchmove(d,g,z)}touchend(d,g,z){const j=this._zoomIn.touchend(d,g,z),$=this._zoomOut.touchend(d,g,z),ie=this._tr;return j?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom+1,around:ie.unproject(j)},{originalEvent:d})}):$?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom-1,around:ie.unproject($)},{originalEvent:d})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xs{constructor(d){this._enabled=!!d.enable,this._moveStateManager=d.moveStateManager,this._clickTolerance=d.clickTolerance||1,this._moveFunction=d.move,this._activateOnStart=!!d.activateOnStart,d.assignEvents(this),this.reset()}reset(d){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(d)}_move(...d){const g=this._moveFunction(...d);if(g.bearingDelta||g.pitchDelta||g.around||g.panDelta)return this._active=!0,g}dragStart(d,g){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(d)&&(this._moveStateManager.startMove(d),this._lastPoint=g.length?g[0]:g,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(d,g){if(!this.isEnabled())return;const z=this._lastPoint;if(!z)return;if(d.preventDefault(),!this._moveStateManager.isValidMoveEvent(d))return void this.reset(d);const j=g.length?g[0]:g;return!this._moved&&j.dist(z)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=j,this._move(z,j))}dragEnd(d){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(d)&&(this._moved&&o.suppressClick(),this.reset(d))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Eu={0:1,2:2};class ml{constructor(d){this._correctEvent=d.checkCorrectEvent}startMove(d){const g=o.mouseButton(d);this._eventButton=g}endMove(d){delete this._eventButton}isValidStartEvent(d){return this._correctEvent(d)}isValidMoveEvent(d){return!function(g,z){const j=Eu[z];return g.buttons===void 0||(g.buttons&j)!==j}(d,this._eventButton)}isValidEndEvent(d){return o.mouseButton(d)===this._eventButton}}class nc{constructor(){this._firstTouch=void 0}_isOneFingerTouch(d){return d.targetTouches.length===1}_isSameTouchEvent(d){return d.targetTouches[0].identifier===this._firstTouch}startMove(d){const g=d.targetTouches[0].identifier;this._firstTouch=g}endMove(d){delete this._firstTouch}isValidStartEvent(d){return this._isOneFingerTouch(d)}isValidMoveEvent(d){return this._isOneFingerTouch(d)&&this._isSameTouchEvent(d)}isValidEndEvent(d){return this._isOneFingerTouch(d)&&this._isSameTouchEvent(d)}}const Rs=V=>{V.mousedown=V.dragStart,V.mousemoveWindow=V.dragMove,V.mouseup=V.dragEnd,V.contextmenu=d=>{d.preventDefault()}},yc=({enable:V,clickTolerance:d,bearingDegreesPerPixelMoved:g=.8})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:d,move:(j,$)=>({bearingDelta:($.x-j.x)*g}),moveStateManager:z,enable:V,assignEvents:Rs})},Iu=({enable:V,clickTolerance:d,pitchDegreesPerPixelMoved:g=-.5})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:d,move:(j,$)=>({pitchDelta:($.y-j.y)*g}),moveStateManager:z,enable:V,assignEvents:Rs})};class ql{constructor(d,g){this._clickTolerance=d.clickTolerance||1,this._map=g,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new i.P(0,0)}_shouldBePrevented(d){return d<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(d,g,z){return this._calculateTransform(d,g,z)}touchmove(d,g,z){if(this._active){if(!this._shouldBePrevented(z.length))return d.preventDefault(),this._calculateTransform(d,g,z);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",d)}}touchend(d,g,z){this._calculateTransform(d,g,z),this._active&&this._shouldBePrevented(z.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(d,g,z){z.length>0&&(this._active=!0);const j=Ba(z,g),$=new i.P(0,0),ie=new i.P(0,0);let de=0;for(const Ae in j){const Re=j[Ae],je=this._touches[Ae];je&&($._add(Re),ie._add(Re.sub(je)),de++,j[Ae]=Re)}if(this._touches=j,this._shouldBePrevented(de)||!ie.mag())return;const xe=ie.div(de);return this._sum._add(xe),this._sum.mag()<this._clickTolerance?void 0:{around:$.div(de),panDelta:xe}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class as{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(d,g,z){this._firstTwoTouches||z.length<2||(this._firstTwoTouches=[z[0].identifier,z[1].identifier],this._start([g[0],g[1]]))}touchmove(d,g,z){if(!this._firstTwoTouches)return;d.preventDefault();const[j,$]=this._firstTwoTouches,ie=Wa(z,g,j),de=Wa(z,g,$);if(!ie||!de)return;const xe=this._aroundCenter?null:ie.add(de).div(2);return this._move([ie,de],xe,d)}touchend(d,g,z){if(!this._firstTwoTouches)return;const[j,$]=this._firstTwoTouches,ie=Wa(z,g,j),de=Wa(z,g,$);ie&&de||(this._active&&o.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(d){this._enabled=!0,this._aroundCenter=!!d&&d.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Wa(V,d,g){for(let z=0;z<V.length;z++)if(V[z].identifier===g)return d[z]}function Gl(V,d){return Math.log(V/d)/Math.LN2}class ki extends as{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(d){this._startDistance=this._distance=d[0].dist(d[1])}_move(d,g){const z=this._distance;if(this._distance=d[0].dist(d[1]),this._active||!(Math.abs(Gl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Gl(this._distance,z),pinchAround:g}}}function nh(V,d){return 180*V.angleWith(d)/Math.PI}class zh extends as{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(d){this._startVector=this._vector=d[0].sub(d[1]),this._minDiameter=d[0].dist(d[1])}_move(d,g,z){const j=this._vector;if(this._vector=d[0].sub(d[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:nh(this._vector,j),pinchAround:g}}_isBelowThreshold(d){this._minDiameter=Math.min(this._minDiameter,d.mag());const g=25/(Math.PI*this._minDiameter)*360,z=nh(d,this._startVector);return Math.abs(z)<g}}function Lu(V){return Math.abs(V.y)>Math.abs(V.x)}class rc extends as{constructor(d){super(),this._currentTouchCount=0,this._map=d}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(d,g,z){super.touchstart(d,g,z),this._currentTouchCount=z.length}_start(d){this._lastPoints=d,Lu(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,g,z){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const j=d[0].sub(this._lastPoints[0]),$=d[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(j,$,z.timeStamp),this._valid?(this._lastPoints=d,this._active=!0,{pitchDelta:(j.y+$.y)/2*-.5}):void 0}gestureBeginsVertically(d,g,z){if(this._valid!==void 0)return this._valid;const j=d.mag()>=2,$=g.mag()>=2;if(!j&&!$)return;if(!j||!$)return this._firstMove===void 0&&(this._firstMove=z),z-this._firstMove<100&&void 0;const ie=d.y>0==g.y>0;return Lu(d)&&Lu(g)&&ie}}const ic={panStep:100,bearingStep:15,pitchStep:10};class Bc{constructor(d){this._tr=new io(d);const g=ic;this._panStep=g.panStep,this._bearingStep=g.bearingStep,this._pitchStep=g.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(d){if(d.altKey||d.ctrlKey||d.metaKey)return;let g=0,z=0,j=0,$=0,ie=0;switch(d.keyCode){case 61:case 107:case 171:case 187:g=1;break;case 189:case 109:case 173:g=-1;break;case 37:d.shiftKey?z=-1:(d.preventDefault(),$=-1);break;case 39:d.shiftKey?z=1:(d.preventDefault(),$=1);break;case 38:d.shiftKey?j=1:(d.preventDefault(),ie=-1);break;case 40:d.shiftKey?j=-1:(d.preventDefault(),ie=1);break;default:return}return this._rotationDisabled&&(z=0,j=0),{cameraAnimation:de=>{const xe=this._tr;de.easeTo({duration:300,easeId:"keyboardHandler",easing:si,zoom:g?Math.round(xe.zoom)+g*(d.shiftKey?2:1):xe.zoom,bearing:xe.bearing+z*this._bearingStep,pitch:xe.pitch+j*this._pitchStep,offset:[-$*this._panStep,-ie*this._panStep],center:xe.center},{originalEvent:d})}}}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 si(V){return V*(2-V)}const vl=4.000244140625;class Pu{constructor(d,g){this._onTimeout=z=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(z)},this._map=d,this._tr=new io(d),this._triggerRenderFrame=g,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(d){this._defaultZoomRate=d}setWheelZoomRate(d){this._wheelZoomRate=d}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(d){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!d&&d.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(d){return!!this._map.cooperativeGestures.isEnabled()&&!(d.ctrlKey||this._map.cooperativeGestures.isBypassed(d))}wheel(d){if(!this.isEnabled())return;if(this._shouldBePrevented(d))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",d);let g=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const z=v.now(),j=z-(this._lastWheelEventTime||0);this._lastWheelEventTime=z,g!==0&&g%vl==0?this._type="wheel":g!==0&&Math.abs(g)<4?this._type="trackpad":j>400?(this._type=null,this._lastValue=g,this._timeout=setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(j*g)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,g+=this._lastValue)),d.shiftKey&&g&&(g/=4),this._type&&(this._lastWheelEvent=d,this._delta-=g,this._active||this._start(d)),d.preventDefault()}_start(d){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 g=o.mousePos(this._map.getCanvas(),d),z=this._tr;g.y>z.transform.height/2-z.transform.getHorizon()?this._around=i.N.convert(this._aroundCenter?z.center:z.unproject(g)):this._around=i.N.convert(z.center),this._aroundPoint=z.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const d=this._tr.transform;if(this._delta!==0){const xe=this._type==="wheel"&&Math.abs(this._delta)>vl?this._wheelZoomRate:this._defaultZoomRate;let Ae=2/(1+Math.exp(-Math.abs(this._delta*xe)));this._delta<0&&Ae!==0&&(Ae=1/Ae);const Re=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):d.scale;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(Re*Ae))),this._type==="wheel"&&(this._startZoom=d.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const g=typeof this._targetZoom=="number"?this._targetZoom:d.zoom,z=this._startZoom,j=this._easing;let $,ie=!1;const de=v.now()-this._lastWheelEventTime;if(this._type==="wheel"&&z&&j&&de){const xe=Math.min(de/200,1),Ae=j(xe);$=i.z.number(z,g,Ae),xe<1?this._frameId||(this._frameId=!0):ie=!0}else $=g,ie=!0;return this._active=!0,ie&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!ie,zoomDelta:$-d.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let g=i.b9;if(this._prevEase){const z=this._prevEase,j=(v.now()-z.start)/z.duration,$=z.easing(j+.01)-z.easing(j),ie=.27/Math.sqrt($*$+1e-4)*.01,de=Math.sqrt(.0729-ie*ie);g=i.b8(ie,de,.25,1)}return this._prevEase={start:v.now(),duration:d,easing:g},g}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ao{constructor(d,g){this._clickZoom=d,this._tapZoom=g}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class rl{constructor(d){this._tr=new io(d),this.reset()}reset(){this._active=!1}dblclick(d,g){return d.preventDefault(),{cameraAnimation:z=>{z.easeTo({duration:300,zoom:this._tr.zoom+(d.shiftKey?-1:1),around:this._tr.unproject(g)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Du{constructor(){this._tap=new Na({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(d,g,z){if(!this._swipePoint)if(this._tapTime){const j=g[0],$=d.timeStamp-this._tapTime<500,ie=this._tapPoint.dist(j)<30;$&&ie?z.length>0&&(this._swipePoint=j,this._swipeTouch=z[0].identifier):this.reset()}else this._tap.touchstart(d,g,z)}touchmove(d,g,z){if(this._tapTime){if(this._swipePoint){if(z[0].identifier!==this._swipeTouch)return;const j=g[0],$=j.y-this._swipePoint.y;return this._swipePoint=j,d.preventDefault(),this._active=!0,{zoomDelta:$/128}}}else this._tap.touchmove(d,g,z)}touchend(d,g,z){if(this._tapTime)this._swipePoint&&z.length===0&&this.reset();else{const j=this._tap.touchend(d,g,z);j&&(this._tapTime=d.timeStamp,this._tapPoint=j)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $l{constructor(d,g,z){this._el=d,this._mousePan=g,this._touchPan=z}enable(d){this._inertiaOptions=d||{},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 js{constructor(d,g,z){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=g,this._mousePitch=z}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 Ru{constructor(d,g,z,j){this._el=d,this._touchZoom=g,this._touchRotate=z,this._tapDragZoom=j,this._rotationDisabled=!1,this._enabled=!0}enable(d){this._touchZoom.enable(d),this._rotationDisabled||this._touchRotate.enable(d),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 Ml{constructor(d,g){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=d,this._options=g,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const d=this._map.getCanvasContainer();d.classList.add("maplibregl-cooperative-gestures"),this._container=o.create("div","maplibregl-cooperative-gesture-screen",d);let g=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(g=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const z=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),j=document.createElement("div");j.className="maplibregl-desktop-message",j.textContent=g,this._container.appendChild(j);const $=document.createElement("div");$.className="maplibregl-mobile-message",$.textContent=z,this._container.appendChild($),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(o.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(d){return d[this._bypassKey]}notifyGestureBlocked(d,g){this._enabled&&(this._map.fire(new i.k("cooperativegestureprevented",{gestureType:d,originalEvent:g})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const il=V=>V.zoom||V.drag||V.pitch||V.rotate;class Yl extends i.k{}function bi(V){return V.panDelta&&V.panDelta.mag()||V.zoomDelta||V.bearingDelta||V.pitchDelta}class ba{constructor(d,g){this.handleWindowEvent=j=>{this.handleEvent(j,`${j.type}Window`)},this.handleEvent=(j,$)=>{if(j.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const ie=j.type==="renderFrame"?void 0:j,de={needsRenderFrame:!1},xe={},Ae={},Re=j.touches,je=Re?this._getMapTouches(Re):void 0,tt=je?o.touchPos(this._map.getCanvas(),je):o.mousePos(this._map.getCanvas(),j);for(const{handlerName:yt,handler:Ct,allowed:kt}of this._handlers){if(!Ct.isEnabled())continue;let Bt;this._blockedByActive(Ae,kt,yt)?Ct.reset():Ct[$||j.type]&&(Bt=Ct[$||j.type](j,tt,je),this.mergeHandlerResult(de,xe,Bt,yt,ie),Bt&&Bt.needsRenderFrame&&this._triggerRenderFrame()),(Bt||Ct.isActive())&&(Ae[yt]=Ct)}const lt={};for(const yt in this._previousActiveHandlers)Ae[yt]||(lt[yt]=ie);this._previousActiveHandlers=Ae,(Object.keys(lt).length||bi(de))&&(this._changes.push([de,xe,lt]),this._triggerRenderFrame()),(Object.keys(Ae).length||bi(de))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ft}=de;ft&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ft(this._map))},this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zc(d),this._bearingSnap=g.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(g);const z=this._el;this._listeners=[[z,"touchstart",{passive:!0}],[z,"touchmove",{passive:!1}],[z,"touchend",void 0],[z,"touchcancel",void 0],[z,"mousedown",void 0],[z,"mousemove",void 0],[z,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[z,"mouseover",void 0],[z,"mouseout",void 0],[z,"dblclick",void 0],[z,"click",void 0],[z,"keydown",{capture:!1}],[z,"keyup",void 0],[z,"wheel",{passive:!1}],[z,"contextmenu",void 0],[window,"blur",void 0]];for(const[j,$,ie]of this._listeners)o.addEventListener(j,$,j===document?this.handleWindowEvent:this.handleEvent,ie)}destroy(){for(const[d,g,z]of this._listeners)o.removeEventListener(d,g,d===document?this.handleWindowEvent:this.handleEvent,z)}_addDefaultHandlers(d){const g=this._map,z=g.getCanvasContainer();this._add("mapEvent",new Fc(g,d));const j=g.boxZoom=new bs(g,d);this._add("boxZoom",j),d.interactive&&d.boxZoom&&j.enable();const $=g.cooperativeGestures=new Ml(g,d.cooperativeGestures);this._add("cooperativeGestures",$),d.cooperativeGestures&&$.enable();const ie=new is(g),de=new rl(g);g.doubleClickZoom=new ao(de,ie),this._add("tapZoom",ie),this._add("clickZoom",de),d.interactive&&d.doubleClickZoom&&g.doubleClickZoom.enable();const xe=new Du;this._add("tapDragZoom",xe);const Ae=g.touchPitch=new rc(g);this._add("touchPitch",Ae),d.interactive&&d.touchPitch&&g.touchPitch.enable(d.touchPitch);const Re=yc(d),je=Iu(d);g.dragRotate=new js(d,Re,je),this._add("mouseRotate",Re,["mousePitch"]),this._add("mousePitch",je,["mouseRotate"]),d.interactive&&d.dragRotate&&g.dragRotate.enable();const tt=(({enable:Bt,clickTolerance:At})=>{const $t=new ml({checkCorrectEvent:Kt=>o.mouseButton(Kt)===0&&!Kt.ctrlKey});return new xs({clickTolerance:At,move:(Kt,Yt)=>({around:Yt,panDelta:Yt.sub(Kt)}),activateOnStart:!0,moveStateManager:$t,enable:Bt,assignEvents:Rs})})(d),lt=new ql(d,g);g.dragPan=new $l(z,tt,lt),this._add("mousePan",tt),this._add("touchPan",lt,["touchZoom","touchRotate"]),d.interactive&&d.dragPan&&g.dragPan.enable(d.dragPan);const ft=new zh,yt=new ki;g.touchZoomRotate=new Ru(z,yt,ft,xe),this._add("touchRotate",ft,["touchPan","touchZoom"]),this._add("touchZoom",yt,["touchPan","touchRotate"]),d.interactive&&d.touchZoomRotate&&g.touchZoomRotate.enable(d.touchZoomRotate);const Ct=g.scrollZoom=new Pu(g,()=>this._triggerRenderFrame());this._add("scrollZoom",Ct,["mousePan"]),d.interactive&&d.scrollZoom&&g.scrollZoom.enable(d.scrollZoom);const kt=g.keyboard=new Bc(g);this._add("keyboard",kt),d.interactive&&d.keyboard&&g.keyboard.enable(),this._add("blockableMapEvent",new Vs(g))}_add(d,g,z){this._handlers.push({handlerName:d,handler:g,allowed:z}),this._handlersById[d]=g}stop(d){if(!this._updatingCamera){for(const{handler:g}of this._handlers)g.reset();this._inertia.clear(),this._fireEvents({},{},d),this._changes=[]}}isActive(){for(const{handler:d}of this._handlers)if(d.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!il(this._eventsInProgress)||this.isZooming()}_blockedByActive(d,g,z){for(const j in d)if(j!==z&&(!g||g.indexOf(j)<0))return!0;return!1}_getMapTouches(d){const g=[];for(const z of d){const j=z.target;this._el.contains(j)&&g.push(z)}return g}mergeHandlerResult(d,g,z,j,$){if(!z)return;i.e(d,z);const ie={handlerName:j,originalEvent:z.originalEvent||$};z.zoomDelta!==void 0&&(g.zoom=ie),z.panDelta!==void 0&&(g.drag=ie),z.pitchDelta!==void 0&&(g.pitch=ie),z.bearingDelta!==void 0&&(g.rotate=ie)}_applyChanges(){const d={},g={},z={};for(const[j,$,ie]of this._changes)j.panDelta&&(d.panDelta=(d.panDelta||new i.P(0,0))._add(j.panDelta)),j.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+j.zoomDelta),j.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+j.bearingDelta),j.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+j.pitchDelta),j.around!==void 0&&(d.around=j.around),j.pinchAround!==void 0&&(d.pinchAround=j.pinchAround),j.noInertia&&(d.noInertia=j.noInertia),i.e(g,$),i.e(z,ie);this._updateMapTransform(d,g,z),this._changes=[]}_updateMapTransform(d,g,z){const j=this._map,$=j._getTransformForUpdate(),ie=j.terrain;if(!(bi(d)||ie&&this._terrainMovement))return this._fireEvents(g,z,!0);let{panDelta:de,zoomDelta:xe,bearingDelta:Ae,pitchDelta:Re,around:je,pinchAround:tt}=d;tt!==void 0&&(je=tt),j._stop(!0),je=je||j.transform.centerPoint;const lt=$.pointLocation(de?je.sub(de):je);Ae&&($.bearing+=Ae),Re&&($.pitch+=Re),xe&&($.zoom+=xe),ie?this._terrainMovement||!g.drag&&!g.zoom?g.drag&&this._terrainMovement?$.center=$.pointLocation($.centerPoint.sub(de)):$.setLocationAtPoint(lt,je):(this._terrainMovement=!0,this._map._elevationFreeze=!0,$.setLocationAtPoint(lt,je)):$.setLocationAtPoint(lt,je),j._applyUpdatedTransform($),this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(g,z,!0)}_fireEvents(d,g,z){const j=il(this._eventsInProgress),$=il(d),ie={};for(const je in d){const{originalEvent:tt}=d[je];this._eventsInProgress[je]||(ie[`${je}start`]=tt),this._eventsInProgress[je]=d[je]}!j&&$&&this._fireEvent("movestart",$.originalEvent);for(const je in ie)this._fireEvent(je,ie[je]);$&&this._fireEvent("move",$.originalEvent);for(const je in d){const{originalEvent:tt}=d[je];this._fireEvent(je,tt)}const de={};let xe;for(const je in this._eventsInProgress){const{handlerName:tt,originalEvent:lt}=this._eventsInProgress[je];this._handlersById[tt].isActive()||(delete this._eventsInProgress[je],xe=g[tt]||lt,de[`${je}end`]=xe)}for(const je in de)this._fireEvent(je,de[je]);const Ae=il(this._eventsInProgress),Re=(j||$)&&!Ae;if(Re&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const je=this._map._getTransformForUpdate();je.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(je)}if(z&&Re){this._updatingCamera=!0;const je=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),tt=lt=>lt!==0&&-this._bearingSnap<lt&&lt<this._bearingSnap;!je||!je.essential&&v.prefersReducedMotion?(this._map.fire(new i.k("moveend",{originalEvent:xe})),tt(this._map.getBearing())&&this._map.resetNorth()):(tt(je.bearing||this._map.getBearing())&&(je.bearing=0),je.freezeElevation=!0,this._map.easeTo(je,{originalEvent:xe})),this._updatingCamera=!1}}_fireEvent(d,g){this._map.fire(new i.k(d,g?{originalEvent:g}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(d=>{delete this._frameId,this.handleEvent(new Yl("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Yo extends i.E{constructor(d,g){super(),this._renderFrameCallback=()=>{const z=Math.min((v.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(z)),z<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=g.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new i.N(this.transform.center.lng,this.transform.center.lat)}setCenter(d,g){return this.jumpTo({center:d},g)}panBy(d,g,z){return d=i.P.convert(d).mult(-1),this.panTo(this.transform.center,i.e({offset:d},g),z)}panTo(d,g,z){return this.easeTo(i.e({center:d},g),z)}getZoom(){return this.transform.zoom}setZoom(d,g){return this.jumpTo({zoom:d},g),this}zoomTo(d,g,z){return this.easeTo(i.e({zoom:d},g),z)}zoomIn(d,g){return this.zoomTo(this.getZoom()+1,d,g),this}zoomOut(d,g){return this.zoomTo(this.getZoom()-1,d,g),this}getBearing(){return this.transform.bearing}setBearing(d,g){return this.jumpTo({bearing:d},g),this}getPadding(){return this.transform.padding}setPadding(d,g){return this.jumpTo({padding:d},g),this}rotateTo(d,g,z){return this.easeTo(i.e({bearing:d},g),z)}resetNorth(d,g){return this.rotateTo(0,i.e({duration:1e3},d),g),this}resetNorthPitch(d,g){return this.easeTo(i.e({bearing:0,pitch:0,duration:1e3},d),g),this}snapToNorth(d,g){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(d,g):this}getPitch(){return this.transform.pitch}setPitch(d,g){return this.jumpTo({pitch:d},g),this}cameraForBounds(d,g){d=Se.convert(d);const z=g&&g.bearing||0;return this._cameraForBoxAndBearing(d.getNorthWest(),d.getSouthEast(),z,g)}_cameraForBoxAndBearing(d,g,z,j){const $={top:0,bottom:0,right:0,left:0};if(typeof(j=i.e({padding:$,offset:[0,0],maxZoom:this.transform.maxZoom},j)).padding=="number"){const Tr=j.padding;j.padding={top:Tr,bottom:Tr,right:Tr,left:Tr}}j.padding=i.e($,j.padding);const ie=this.transform,de=ie.padding,xe=new Se(d,g),Ae=ie.project(xe.getNorthWest()),Re=ie.project(xe.getNorthEast()),je=ie.project(xe.getSouthEast()),tt=ie.project(xe.getSouthWest()),lt=i.ba(-z),ft=Ae.rotate(lt),yt=Re.rotate(lt),Ct=je.rotate(lt),kt=tt.rotate(lt),Bt=new i.P(Math.max(ft.x,yt.x,kt.x,Ct.x),Math.max(ft.y,yt.y,kt.y,Ct.y)),At=new i.P(Math.min(ft.x,yt.x,kt.x,Ct.x),Math.min(ft.y,yt.y,kt.y,Ct.y)),$t=Bt.sub(At),Kt=(ie.width-(de.left+de.right+j.padding.left+j.padding.right))/$t.x,Yt=(ie.height-(de.top+de.bottom+j.padding.top+j.padding.bottom))/$t.y;if(Yt<0||Kt<0)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const pn=Math.min(ie.scaleZoom(ie.scale*Math.min(Kt,Yt)),j.maxZoom),Tn=i.P.convert(j.offset),Vn=(j.padding.left-j.padding.right)/2,jn=(j.padding.top-j.padding.bottom)/2,$n=new i.P(Vn,jn).rotate(i.ba(z)),er=Tn.add($n).mult(ie.scale/ie.zoomScale(pn));return{center:ie.unproject(Ae.add(je).div(2).sub(er)),zoom:pn,bearing:z}}fitBounds(d,g,z){return this._fitInternal(this.cameraForBounds(d,g),g,z)}fitScreenCoordinates(d,g,z,j,$){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(i.P.convert(d)),this.transform.pointLocation(i.P.convert(g)),z,j),j,$)}_fitInternal(d,g,z){return d?(delete(g=i.e(d,g)).padding,g.linear?this.easeTo(g,z):this.flyTo(g,z)):this}jumpTo(d,g){this.stop();const z=this._getTransformForUpdate();let j=!1,$=!1,ie=!1;return"zoom"in d&&z.zoom!==+d.zoom&&(j=!0,z.zoom=+d.zoom),d.center!==void 0&&(z.center=i.N.convert(d.center)),"bearing"in d&&z.bearing!==+d.bearing&&($=!0,z.bearing=+d.bearing),"pitch"in d&&z.pitch!==+d.pitch&&(ie=!0,z.pitch=+d.pitch),d.padding==null||z.isPaddingEqual(d.padding)||(z.padding=d.padding),this._applyUpdatedTransform(z),this.fire(new i.k("movestart",g)).fire(new i.k("move",g)),j&&this.fire(new i.k("zoomstart",g)).fire(new i.k("zoom",g)).fire(new i.k("zoomend",g)),$&&this.fire(new i.k("rotatestart",g)).fire(new i.k("rotate",g)).fire(new i.k("rotateend",g)),ie&&this.fire(new i.k("pitchstart",g)).fire(new i.k("pitch",g)).fire(new i.k("pitchend",g)),this.fire(new i.k("moveend",g))}calculateCameraOptionsFromTo(d,g,z,j=0){const $=i.Z.fromLngLat(d,g),ie=i.Z.fromLngLat(z,j),de=ie.x-$.x,xe=ie.y-$.y,Ae=ie.z-$.z,Re=Math.hypot(de,xe,Ae);if(Re===0)throw new Error("Can't calculate camera options with same From and To");const je=Math.hypot(de,xe),tt=this.transform.scaleZoom(this.transform.cameraToCenterDistance/Re/this.transform.tileSize),lt=180*Math.atan2(de,-xe)/Math.PI;let ft=180*Math.acos(je/Re)/Math.PI;return ft=Ae<0?90-ft:90+ft,{center:ie.toLngLat(),zoom:tt,pitch:ft,bearing:lt}}easeTo(d,g){var z;this._stop(!1,d.easeId),((d=i.e({offset:[0,0],duration:500,easing:i.b9},d)).animate===!1||!d.essential&&v.prefersReducedMotion)&&(d.duration=0);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in d?this._normalizeBearing(d.bearing,ie):ie,Re="pitch"in d?+d.pitch:de,je="padding"in d?d.padding:j.padding,tt=i.P.convert(d.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(d.center||ft),(z=d.zoom)!==null&&z!==void 0?z:$);this._normalizeCenter(yt,j);const kt=j.project(ft),Bt=j.project(yt).sub(kt),At=j.zoomScale(Ct-$);let $t,Kt;d.around&&($t=i.N.convert(d.around),Kt=j.locationPoint($t));const Yt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||Ct!==$,this._rotating=this._rotating||ie!==Ae,this._pitching=this._pitching||Re!==de,this._padding=!j.isPaddingEqual(je),this._easeId=d.easeId,this._prepareEase(g,d.noMoveStart,Yt),this.terrain&&this._prepareElevation(yt),this._ease(pn=>{if(this._zooming&&(j.zoom=i.z.number($,Ct,pn)),this._rotating&&(j.bearing=i.z.number(ie,Ae,pn)),this._pitching&&(j.pitch=i.z.number(de,Re,pn)),this._padding&&(j.interpolatePadding(xe,je,pn),lt=j.centerPoint.add(tt)),this.terrain&&!d.freezeElevation&&this._updateElevation(pn),$t)j.setLocationAtPoint($t,Kt);else{const Tn=j.zoomScale(j.zoom-$),Vn=Ct>$?Math.min(2,At):Math.max(.5,At),jn=Math.pow(Vn,1-pn),$n=j.unproject(kt.add(Bt.mult(pn*jn)).mult(Tn));j.setLocationAtPoint(j.renderWorldCopies?$n.wrap():$n,lt)}this._applyUpdatedTransform(j),this._fireMoveEvents(g)},pn=>{this.terrain&&d.freezeElevation&&this._finalizeElevation(),this._afterEase(g,pn)},d),this}_prepareEase(d,g,z={}){this._moving=!0,g||z.moving||this.fire(new i.k("movestart",d)),this._zooming&&!z.zooming&&this.fire(new i.k("zoomstart",d)),this._rotating&&!z.rotating&&this.fire(new i.k("rotatestart",d)),this._pitching&&!z.pitching&&this.fire(new i.k("pitchstart",d))}_prepareElevation(d){this._elevationCenter=d,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(d){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const g=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(d<1&&g!==this._elevationTarget){const z=this._elevationTarget-this._elevationStart,j=(g-(z*d+this._elevationStart))/(1-d);this._elevationStart+=d*(z-j),this._elevationTarget=g}this.transform.elevation=i.z.number(this._elevationStart,this._elevationTarget,d)}_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(d){const g=d.getCameraPosition(),z=this.terrain.getElevationForLngLatZoom(g.lngLat,d.zoom);if(g.altitude<z){const j=this.calculateCameraOptionsFromTo(g.lngLat,z,d.center,d.elevation);return{pitch:j.pitch,zoom:j.zoom}}return{}}_applyUpdatedTransform(d){const g=[];if(this.terrain&&g.push(j=>this._elevateCameraIfInsideTerrain(j)),this.transformCameraUpdate&&g.push(j=>this.transformCameraUpdate(j)),!g.length)return;const z=d.clone();for(const j of g){const $=z.clone(),{center:ie,zoom:de,pitch:xe,bearing:Ae,elevation:Re}=j($);ie&&($.center=ie),de!==void 0&&($.zoom=de),xe!==void 0&&($.pitch=xe),Ae!==void 0&&($.bearing=Ae),Re!==void 0&&($.elevation=Re),z.apply($)}this.transform.apply(z)}_fireMoveEvents(d){this.fire(new i.k("move",d)),this._zooming&&this.fire(new i.k("zoom",d)),this._rotating&&this.fire(new i.k("rotate",d)),this._pitching&&this.fire(new i.k("pitch",d))}_afterEase(d,g){if(this._easeId&&g&&this._easeId===g)return;delete this._easeId;const z=this._zooming,j=this._rotating,$=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,z&&this.fire(new i.k("zoomend",d)),j&&this.fire(new i.k("rotateend",d)),$&&this.fire(new i.k("pitchend",d)),this.fire(new i.k("moveend",d))}flyTo(d,g){var z;if(!d.essential&&v.prefersReducedMotion){const ur=i.M(d,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ur,g)}this.stop(),d=i.e({offset:[0,0],speed:1.2,curve:1.42,easing:i.b9},d);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in d?this._normalizeBearing(d.bearing,ie):ie,Re="pitch"in d?+d.pitch:de,je="padding"in d?d.padding:j.padding,tt=i.P.convert(d.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(d.center||ft),(z=d.zoom)!==null&&z!==void 0?z:$);this._normalizeCenter(yt,j);const kt=j.zoomScale(Ct-$),Bt=j.project(ft),At=j.project(yt).sub(Bt);let $t=d.curve;const Kt=Math.max(j.width,j.height),Yt=Kt/kt,pn=At.mag();if("minZoom"in d){const ur=i.ad(Math.min(d.minZoom,$,Ct),j.minZoom,j.maxZoom),Pr=Kt/j.zoomScale(ur-$);$t=Math.sqrt(Pr/pn*2)}const Tn=$t*$t;function Vn(ur){const Pr=(Yt*Yt-Kt*Kt+(ur?-1:1)*Tn*Tn*pn*pn)/(2*(ur?Yt:Kt)*Tn*pn);return Math.log(Math.sqrt(Pr*Pr+1)-Pr)}function jn(ur){return(Math.exp(ur)-Math.exp(-ur))/2}function $n(ur){return(Math.exp(ur)+Math.exp(-ur))/2}const er=Vn(!1);let Tr=function(ur){return $n(er)/$n(er+$t*ur)},rr=function(ur){return Kt*(($n(er)*(jn(Pr=er+$t*ur)/$n(Pr))-jn(er))/Tn)/pn;var Pr},Ar=(Vn(!0)-er)/$t;if(Math.abs(pn)<1e-6||!isFinite(Ar)){if(Math.abs(Kt-Yt)<1e-6)return this.easeTo(d,g);const ur=Yt<Kt?-1:1;Ar=Math.abs(Math.log(Yt/Kt))/$t,rr=()=>0,Tr=Pr=>Math.exp(ur*$t*Pr)}if("duration"in d)d.duration=+d.duration;else{const ur="screenSpeed"in d?+d.screenSpeed/$t:+d.speed;d.duration=1e3*Ar/ur}return d.maxDuration&&d.duration>d.maxDuration&&(d.duration=0),this._zooming=!0,this._rotating=ie!==Ae,this._pitching=Re!==de,this._padding=!j.isPaddingEqual(je),this._prepareEase(g,!1),this.terrain&&this._prepareElevation(yt),this._ease(ur=>{const Pr=ur*Ar,br=1/Tr(Pr);j.zoom=ur===1?Ct:$+j.scaleZoom(br),this._rotating&&(j.bearing=i.z.number(ie,Ae,ur)),this._pitching&&(j.pitch=i.z.number(de,Re,ur)),this._padding&&(j.interpolatePadding(xe,je,ur),lt=j.centerPoint.add(tt)),this.terrain&&!d.freezeElevation&&this._updateElevation(ur);const Nr=ur===1?yt:j.unproject(Bt.add(At.mult(rr(Pr))).mult(br));j.setLocationAtPoint(j.renderWorldCopies?Nr.wrap():Nr,lt),this._applyUpdatedTransform(j),this._fireMoveEvents(g)},()=>{this.terrain&&d.freezeElevation&&this._finalizeElevation(),this._afterEase(g)},d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(d,g){var z;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const j=this._onEaseEnd;delete this._onEaseEnd,j.call(this,g)}return d||(z=this.handlers)===null||z===void 0||z.stop(!1),this}_ease(d,g,z){z.animate===!1||z.duration===0?(d(1),g()):(this._easeStart=v.now(),this._easeOptions=z,this._onEaseFrame=d,this._onEaseEnd=g,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(d,g){d=i.b3(d,-180,180);const z=Math.abs(d-g);return Math.abs(d-360-g)<z&&(d-=360),Math.abs(d+360-g)<z&&(d+=360),d}_normalizeCenter(d,g){if(!g.renderWorldCopies||g.lngRange)return;const z=d.lng-g.center.lng;d.lng+=z>180?-360:z<-180?360:0}queryTerrainElevation(d){return this.terrain?this.terrain.getElevationForLngLatZoom(i.N.convert(d),this.transform.tileZoom)-this.transform.elevation:null}}const Us={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class yl{constructor(d=Us){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=g=>{!g||g.sourceDataType!=="metadata"&&g.sourceDataType!=="visibility"&&g.dataType!=="style"&&g.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=d}getDefaultPosition(){return"bottom-right"}onAdd(d){return this._map=d,this._compact=this.options.compact,this._container=o.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=o.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o.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(){o.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(d,g){const z=this._map._getUIString(`AttributionControl.${g}`);d.title=z,d.setAttribute("aria-label",z)}_updateAttributions(){if(!this._map.style)return;let d=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=d.concat(this.options.customAttribution.map(j=>typeof j!="string"?"":j)):typeof this.options.customAttribution=="string"&&d.push(this.options.customAttribution)),this._map.style.stylesheet){const j=this._map.style.stylesheet;this.styleOwner=j.owner,this.styleId=j.id}const g=this._map.style.sourceCaches;for(const j in g){const $=g[j];if($.used||$.usedForTerrain){const ie=$.getSource();ie.attribution&&d.indexOf(ie.attribution)<0&&d.push(ie.attribution)}}d=d.filter(j=>String(j).trim()),d.sort((j,$)=>j.length-$.length),d=d.filter((j,$)=>{for(let ie=$+1;ie<d.length;ie++)if(d[ie].indexOf(j)>=0)return!1;return!0});const z=d.join(" | ");z!==this._attribHTML&&(this._attribHTML=z,d.length?(this._innerContainer.innerHTML=z,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class os{constructor(d={}){this._updateCompact=()=>{const g=this._container.children;if(g.length){const z=g[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&z.classList.add("maplibregl-compact"):z.classList.remove("maplibregl-compact")}},this.options=d}getDefaultPosition(){return"bottom-left"}onAdd(d){this._map=d,this._compact=this.options&&this.options.compact,this._container=o.create("div","maplibregl-ctrl");const g=o.create("a","maplibregl-ctrl-logo");return g.target="_blank",g.rel="noopener nofollow",g.href="https://maplibre.org/",g.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),g.setAttribute("rel","noopener nofollow"),this._container.appendChild(g),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){o.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class rh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(d){const g=++this._id;return this._queue.push({callback:d,id:g,cancelled:!1}),g}remove(d){const g=this._currentlyRunning,z=g?this._queue.concat(g):this._queue;for(const j of z)if(j.id===d)return void(j.cancelled=!0)}run(d=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const g=this._currentlyRunning=this._queue;this._queue=[];for(const z of g)if(!z.cancelled&&(z.callback(d),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var mi=i.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Hs extends i.E{constructor(d){super(),this.sourceCache=d,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,d.usedForTerrain=!0,d.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(d,g){this.sourceCache.update(d,g),this._renderableTilesKeys=[];const z={};for(const j of d.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:g}))z[j.key]=!0,this._renderableTilesKeys.push(j.key),this._tiles[j.key]||(j.posMatrix=new Float64Array(16),i.aQ(j.posMatrix,0,i.X,0,i.X,0,1),this._tiles[j.key]=new we(j,this.tileSize));for(const j in this._tiles)z[j]||delete this._tiles[j]}freeRtt(d){for(const g in this._tiles){const z=this._tiles[g];(!d||z.tileID.equals(d)||z.tileID.isChildOf(d)||d.isChildOf(z.tileID))&&(z.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(d=>this.getTileByID(d))}getTileByID(d){return this._tiles[d]}getTerrainCoords(d){const g={};for(const z of this._renderableTilesKeys){const j=this._tiles[z].tileID;if(j.canonical.equals(d.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16),i.aQ($.posMatrix,0,i.X,0,i.X,0,1),g[z]=$}else if(j.canonical.isChildOf(d.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16);const ie=j.canonical.z-d.canonical.z,de=j.canonical.x-(j.canonical.x>>ie<<ie),xe=j.canonical.y-(j.canonical.y>>ie<<ie),Ae=i.X>>ie;i.aQ($.posMatrix,0,Ae,0,Ae,0,1),i.J($.posMatrix,$.posMatrix,[-de*Ae,-xe*Ae,0]),g[z]=$}else if(d.canonical.isChildOf(j.canonical)){const $=d.clone();$.posMatrix=new Float64Array(16);const ie=d.canonical.z-j.canonical.z,de=d.canonical.x-(d.canonical.x>>ie<<ie),xe=d.canonical.y-(d.canonical.y>>ie<<ie),Ae=i.X>>ie;i.aQ($.posMatrix,0,i.X,0,i.X,0,1),i.J($.posMatrix,$.posMatrix,[de*Ae,xe*Ae,0]),i.K($.posMatrix,$.posMatrix,[1/2**ie,1/2**ie,0]),g[z]=$}}return g}getSourceTile(d,g){const z=this.sourceCache._source;let j=d.overscaledZ-this.deltaZoom;if(j>z.maxzoom&&(j=z.maxzoom),j<z.minzoom)return null;this._sourceTileCache[d.key]||(this._sourceTileCache[d.key]=d.scaledTo(j).key);let $=this.sourceCache.getTileByID(this._sourceTileCache[d.key]);if((!$||!$.dem)&&g)for(;j>=z.minzoom&&(!$||!$.dem);)$=this.sourceCache.getTileByID(d.scaledTo(j--).key);return $}tilesAfterTime(d=Date.now()){return Object.values(this._tiles).filter(g=>g.timeAdded>=d)}}class xa{constructor(d,g,z){this.painter=d,this.sourceCache=new Hs(g),this.options=z,this.exaggeration=typeof z.exaggeration=="number"?z.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(d,g,z,j=i.X){var $;if(!(g>=0&&g<j&&z>=0&&z<j))return 0;const ie=this.getTerrainData(d),de=($=ie.tile)===null||$===void 0?void 0:$.dem;if(!de)return 0;const xe=function(ft,yt,Ct){var kt=yt[0],Bt=yt[1];return ft[0]=Ct[0]*kt+Ct[4]*Bt+Ct[12],ft[1]=Ct[1]*kt+Ct[5]*Bt+Ct[13],ft}([],[g/j*i.X,z/j*i.X],ie.u_terrain_matrix),Ae=[xe[0]*de.dim,xe[1]*de.dim],Re=Math.floor(Ae[0]),je=Math.floor(Ae[1]),tt=Ae[0]-Re,lt=Ae[1]-je;return de.get(Re,je)*(1-tt)*(1-lt)+de.get(Re+1,je)*tt*(1-lt)+de.get(Re,je+1)*(1-tt)*lt+de.get(Re+1,je+1)*tt*lt}getElevationForLngLatZoom(d,g){const{tileID:z,mercatorX:j,mercatorY:$}=this._getOverscaledTileIDFromLngLatZoom(d,g);return this.getElevation(z,j%i.X,$%i.X,i.X)}getElevation(d,g,z,j=i.X){return this.getDEMElevation(d,g,z,j)*this.exaggeration}getTerrainData(d){if(!this._emptyDemTexture){const j=this.painter.context,$=new i.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new D(j,$,j.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new D(j,new i.R({width:1,height:1}),j.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(j.gl.NEAREST,j.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=i.ao([])}const g=this.sourceCache.getSourceTile(d,!0);if(g&&g.dem&&(!g.demTexture||g.needsTerrainPrepare)){const j=this.painter.context;g.demTexture=this.painter.getTileTexture(g.dem.stride),g.demTexture?g.demTexture.update(g.dem.getPixels(),{premultiply:!1}):g.demTexture=new D(j,g.dem.getPixels(),j.gl.RGBA,{premultiply:!1}),g.demTexture.bind(j.gl.NEAREST,j.gl.CLAMP_TO_EDGE),g.needsTerrainPrepare=!1}const z=g&&g+g.tileID.key+d.key;if(z&&!this._demMatrixCache[z]){const j=this.sourceCache.sourceCache._source.maxzoom;let $=d.canonical.z-g.tileID.canonical.z;d.overscaledZ>d.canonical.z&&(d.canonical.z>=j?$=d.canonical.z-j:i.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const ie=d.canonical.x-(d.canonical.x>>$<<$),de=d.canonical.y-(d.canonical.y>>$<<$),xe=i.bb(new Float64Array(16),[1/(i.X<<$),1/(i.X<<$),0]);i.J(xe,xe,[ie*i.X,de*i.X,0]),this._demMatrixCache[d.key]={matrix:xe,coord:d}}return{u_depth:2,u_terrain:3,u_terrain_dim:g&&g.dem&&g.dem.dim||1,u_terrain_matrix:z?this._demMatrixCache[d.key].matrix:this._emptyDemMatrix,u_terrain_unpack:g&&g.dem&&g.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(g&&g.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:g}}getFramebuffer(d){const g=this.painter,z=g.width/devicePixelRatio,j=g.height/devicePixelRatio;return!this._fbo||this._fbo.width===z&&this._fbo.height===j||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new D(g.context,{width:z,height:j,data:null},g.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(g.context.gl.NEAREST,g.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new D(g.context,{width:z,height:j,data:null},g.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(g.context.gl.NEAREST,g.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=g.context.createFramebuffer(z,j,!0,!1),this._fbo.depthAttachment.set(g.context.createRenderbuffer(g.context.gl.DEPTH_COMPONENT16,z,j))),this._fbo.colorAttachment.set(d==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const d=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const g=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let $=0,ie=0;$<this._coordsTextureSize;$++)for(let de=0;de<this._coordsTextureSize;de++,ie+=4)g[ie+0]=255&de,g[ie+1]=255&$,g[ie+2]=de>>8<<4|$>>8,g[ie+3]=0;const z=new i.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(g.buffer)),j=new D(d,z,d.gl.RGBA,{premultiply:!1});return j.bind(d.gl.NEAREST,d.gl.CLAMP_TO_EDGE),this._coordsTexture=j,j}pointCoordinate(d){this.painter.maybeDrawDepthAndCoords(!0);const g=new Uint8Array(4),z=this.painter.context,j=z.gl,$=Math.round(d.x*this.painter.pixelRatio/devicePixelRatio),ie=Math.round(d.y*this.painter.pixelRatio/devicePixelRatio),de=Math.round(this.painter.height/devicePixelRatio);z.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),j.readPixels($,de-ie-1,1,1,j.RGBA,j.UNSIGNED_BYTE,g),z.bindFramebuffer.set(null);const xe=g[0]+(g[2]>>4<<8),Ae=g[1]+((15&g[2])<<8),Re=this.coordsIndex[255-g[3]],je=Re&&this.sourceCache.getTileByID(Re);if(!je)return null;const tt=this._coordsTextureSize,lt=(1<<je.tileID.canonical.z)*tt;return new i.Z((je.tileID.canonical.x*tt+xe)/lt+je.tileID.wrap,(je.tileID.canonical.y*tt+Ae)/lt,this.getElevation(je.tileID,xe,Ae,tt))}depthAtPoint(d){const g=new Uint8Array(4),z=this.painter.context,j=z.gl;return z.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),j.readPixels(d.x,this.painter.height/devicePixelRatio-d.y-1,1,1,j.RGBA,j.UNSIGNED_BYTE,g),z.bindFramebuffer.set(null),(g[0]/16777216+g[1]/65536+g[2]/256+g[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const d=this.painter.context,g=new i.bc,z=new i.aY,j=this.meshSize,$=i.X/j,ie=j*j;for(let je=0;je<=j;je++)for(let tt=0;tt<=j;tt++)g.emplaceBack(tt*$,je*$,0);for(let je=0;je<ie;je+=j+1)for(let tt=0;tt<j;tt++)z.emplaceBack(tt+je,j+tt+je+1,j+tt+je+2),z.emplaceBack(tt+je,j+tt+je+2,tt+je+1);const de=g.length,xe=de+2*(j+1);for(const je of[0,1])for(let tt=0;tt<=j;tt++)for(const lt of[0,1])g.emplaceBack(tt*$,je*i.X,lt);for(let je=0;je<2*j;je+=2)z.emplaceBack(xe+je,xe+je+1,xe+je+3),z.emplaceBack(xe+je,xe+je+3,xe+je+2),z.emplaceBack(de+je,de+je+3,de+je+1),z.emplaceBack(de+je,de+je+2,de+je+3);const Ae=g.length,Re=Ae+2*(j+1);for(const je of[0,1])for(let tt=0;tt<=j;tt++)for(const lt of[0,1])g.emplaceBack(je*i.X,tt*$,lt);for(let je=0;je<2*j;je+=2)z.emplaceBack(Ae+je,Ae+je+1,Ae+je+3),z.emplaceBack(Ae+je,Ae+je+3,Ae+je+2),z.emplaceBack(Re+je,Re+je+3,Re+je+1),z.emplaceBack(Re+je,Re+je+2,Re+je+3);return this._mesh=new Rc(d.createVertexBuffer(g,mi.members),d.createIndexBuffer(z),i.a0.simpleSegment(0,0,g.length,z.length)),this._mesh}getMeshFrameDelta(d){return 2*Math.PI*i.bd/Math.pow(2,d)/5}getMinTileElevationForLngLatZoom(d,g){var z;const{tileID:j}=this._getOverscaledTileIDFromLngLatZoom(d,g);return(z=this.getMinMaxElevation(j).minElevation)!==null&&z!==void 0?z:0}getMinMaxElevation(d){const g=this.getTerrainData(d).tile,z={minElevation:null,maxElevation:null};return g&&g.dem&&(z.minElevation=g.dem.min*this.exaggeration,z.maxElevation=g.dem.max*this.exaggeration),z}_getOverscaledTileIDFromLngLatZoom(d,g){const z=i.Z.fromLngLat(d.wrap()),j=(1<<g)*i.X,$=z.x*j,ie=z.y*j,de=Math.floor($/i.X),xe=Math.floor(ie/i.X);return{tileID:new i.S(g,0,g,de,xe),mercatorX:$,mercatorY:ie}}}class ac{constructor(d,g,z){this._context=d,this._size=g,this._tileSize=z,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const d of this._objects)d.texture.destroy(),d.fbo.destroy()}_createObject(d){const g=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),z=new D(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return z.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),g.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),g.colorAttachment.set(z.texture),{id:d,fbo:g,texture:z,stamp:-1,inUse:!1}}getObjectForId(d){return this._objects[d]}useObject(d){d.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(g=>d.id!==g),this._recentlyUsed.push(d.id)}stampObject(d){d.stamp=++this._stamp}getOrCreateFreeObject(){for(const g of this._recentlyUsed)if(!this._objects[g].inUse)return this._objects[g];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const d=this._createObject(this._objects.length);return this._objects.push(d),d}freeObject(d){d.inUse=!1}freeAllObjects(){for(const d of this._objects)this.freeObject(d)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(d=>!d.inUse)===!1}}const El={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class vu{constructor(d,g){this.painter=d,this.terrain=g,this.pool=new ac(d.context,30,g.sourceCache.tileSize*g.qualityFactor)}destruct(){this.pool.destruct()}getTexture(d){return this.pool.getObjectForId(d.rtt[this._stacks.length-1].id).texture}prepareForRender(d,g){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=d._order.filter(z=>!d._layers[z].isHidden(g)),this._coordsDescendingInv={};for(const z in d.sourceCaches){this._coordsDescendingInv[z]={};const j=d.sourceCaches[z].getVisibleCoordinates();for(const $ of j){const ie=this.terrain.sourceCache.getTerrainCoords($);for(const de in ie)this._coordsDescendingInv[z][de]||(this._coordsDescendingInv[z][de]=[]),this._coordsDescendingInv[z][de].push(ie[de])}}this._coordsDescendingInvStr={};for(const z of d._order){const j=d._layers[z],$=j.source;if(El[j.type]&&!this._coordsDescendingInvStr[$]){this._coordsDescendingInvStr[$]={};for(const ie in this._coordsDescendingInv[$])this._coordsDescendingInvStr[$][ie]=this._coordsDescendingInv[$][ie].map(de=>de.key).sort().join()}}for(const z of this._renderableTiles)for(const j in this._coordsDescendingInvStr){const $=this._coordsDescendingInvStr[j][z.tileID.key];$&&$!==z.rttCoords[j]&&(z.rtt=[])}}renderLayer(d){if(d.isHidden(this.painter.transform.zoom))return!1;const g=d.type,z=this.painter,j=this._renderableLayerIds[this._renderableLayerIds.length-1]===d.id;if(El[g]&&(this._prevType&&El[this._prevType]||this._stacks.push([]),this._prevType=g,this._stacks[this._stacks.length-1].push(d.id),!j))return!0;if(El[this._prevType]||El[g]&&j){this._prevType=g;const $=this._stacks.length-1,ie=this._stacks[$]||[];for(const de of this._renderableTiles){if(this.pool.isFull()&&(Dc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(de),de.rtt[$]){const Ae=this.pool.getObjectForId(de.rtt[$].id);if(Ae.stamp===de.rtt[$].stamp){this.pool.useObject(Ae);continue}}const xe=this.pool.getOrCreateFreeObject();this.pool.useObject(xe),this.pool.stampObject(xe),de.rtt[$]={id:xe.id,stamp:xe.stamp},z.context.bindFramebuffer.set(xe.fbo.framebuffer),z.context.clear({color:i.aN.transparent,stencil:0}),z.currentStencilSource=void 0;for(let Ae=0;Ae<ie.length;Ae++){const Re=z.style._layers[ie[Ae]],je=Re.source?this._coordsDescendingInv[Re.source][de.tileID.key]:[de.tileID];z.context.viewport.set([0,0,xe.fbo.width,xe.fbo.height]),z._renderTileClippingMasks(Re,je),z.renderLayer(z,z.style.sourceCaches[Re.source],Re,je),Re.source&&(de.rttCoords[Re.source]=this._coordsDescendingInvStr[Re.source][de.tileID.key])}}return Dc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),El[g]}return!1}}const gh={"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"},ih=_,Ou={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Us,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:i.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},co=V=>{V.touchstart=V.dragStart,V.touchmoveWindow=V.dragMove,V.touchend=V.dragEnd},Zl={showCompass:!0,showZoom:!0,visualizePitch:!1};class ui{constructor(d,g,z=!1){this.mousedown=ie=>{this.startMouse(i.e({},ie,{ctrlKey:!0,preventDefault:()=>ie.preventDefault()}),o.mousePos(this.element,ie)),o.addEventListener(window,"mousemove",this.mousemove),o.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=ie=>{this.moveMouse(ie,o.mousePos(this.element,ie))},this.mouseup=ie=>{this.mouseRotate.dragEnd(ie),this.mousePitch&&this.mousePitch.dragEnd(ie),this.offTemp()},this.touchstart=ie=>{ie.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=o.touchPos(this.element,ie.targetTouches)[0],this.startTouch(ie,this._startPos),o.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.addEventListener(window,"touchend",this.touchend))},this.touchmove=ie=>{ie.targetTouches.length!==1?this.reset():(this._lastPos=o.touchPos(this.element,ie.targetTouches)[0],this.moveTouch(ie,this._lastPos))},this.touchend=ie=>{ie.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 j=d.dragRotate._mouseRotate.getClickTolerance(),$=d.dragRotate._mousePitch.getClickTolerance();this.element=g,this.mouseRotate=yc({clickTolerance:j,enable:!0}),this.touchRotate=(({enable:ie,clickTolerance:de,bearingDegreesPerPixelMoved:xe=.8})=>{const Ae=new nc;return new xs({clickTolerance:de,move:(Re,je)=>({bearingDelta:(je.x-Re.x)*xe}),moveStateManager:Ae,enable:ie,assignEvents:co})})({clickTolerance:j,enable:!0}),this.map=d,z&&(this.mousePitch=Iu({clickTolerance:$,enable:!0}),this.touchPitch=(({enable:ie,clickTolerance:de,pitchDegreesPerPixelMoved:xe=-.5})=>{const Ae=new nc;return new xs({clickTolerance:de,move:(Re,je)=>({pitchDelta:(je.y-Re.y)*xe}),moveStateManager:Ae,enable:ie,assignEvents:co})})({clickTolerance:$,enable:!0})),o.addEventListener(g,"mousedown",this.mousedown),o.addEventListener(g,"touchstart",this.touchstart,{passive:!1}),o.addEventListener(g,"touchcancel",this.reset)}startMouse(d,g){this.mouseRotate.dragStart(d,g),this.mousePitch&&this.mousePitch.dragStart(d,g),o.disableDrag()}startTouch(d,g){this.touchRotate.dragStart(d,g),this.touchPitch&&this.touchPitch.dragStart(d,g),o.disableDrag()}moveMouse(d,g){const z=this.map,{bearingDelta:j}=this.mouseRotate.dragMove(d,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.mousePitch){const{pitchDelta:$}=this.mousePitch.dragMove(d,g)||{};$&&z.setPitch(z.getPitch()+$)}}moveTouch(d,g){const z=this.map,{bearingDelta:j}=this.touchRotate.dragMove(d,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.touchPitch){const{pitchDelta:$}=this.touchPitch.dragMove(d,g)||{};$&&z.setPitch(z.getPitch()+$)}}off(){const d=this.element;o.removeEventListener(d,"mousedown",this.mousedown),o.removeEventListener(d,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend),o.removeEventListener(d,"touchcancel",this.reset),this.offTemp()}offTemp(){o.enableDrag(),o.removeEventListener(window,"mousemove",this.mousemove),o.removeEventListener(window,"mouseup",this.mouseup),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend)}}let Pi;function al(V,d,g){const z=new i.N(V.lng,V.lat);if(V=new i.N(V.lng,V.lat),d){const j=new i.N(V.lng-360,V.lat),$=new i.N(V.lng+360,V.lat),ie=g.locationPoint(V).distSqr(d);g.locationPoint(j).distSqr(d)<ie?V=j:g.locationPoint($).distSqr(d)<ie&&(V=$)}for(;Math.abs(V.lng-g.center.lng)>180;){const j=g.locationPoint(V);if(j.x>=0&&j.y>=0&&j.x<=g.width&&j.y<=g.height)break;V.lng>g.center.lng?V.lng-=360:V.lng+=360}return V.lng!==z.lng&&g.locationPoint(V).y>g.height/2-g.getHorizon()?V:z}const Xl={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 zu(V,d,g){const z=V.classList;for(const j in Xl)z.remove(`maplibregl-${g}-anchor-${j}`);z.add(`maplibregl-${g}-anchor-${d}`)}class bo extends i.E{constructor(d){if(super(),this._onKeyPress=g=>{const z=g.code,j=g.charCode||g.keyCode;z!=="Space"&&z!=="Enter"&&j!==32&&j!==13||this.togglePopup()},this._onMapClick=g=>{const z=g.originalEvent.target,j=this._element;this._popup&&(z===j||j.contains(z))&&this.togglePopup()},this._update=g=>{var z;if(!this._map)return;const j=this._map.loaded()&&!this._map.isMoving();((g==null?void 0:g.type)==="terrain"||(g==null?void 0:g.type)==="render"&&!j)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies?this._lngLat=al(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(z=this._lngLat)===null||z===void 0?void 0:z.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 $="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?$=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&($=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let ie="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?ie="rotateX(0deg)":this._pitchAlignment==="map"&&(ie=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||g&&g.type!=="moveend"||(this._pos=this._pos.round()),o.setTransform(this._element,`${Xl[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${ie} ${$}`),v.frameAsync(new AbortController).then(()=>{this._updateOpacity(g&&g.type==="moveend")}).catch(()=>{})},this._onMove=g=>{if(!this._isDragging){const z=this._clickTolerance||this._map._clickTolerance;this._isDragging=g.point.dist(this._pointerdownPos)>=z}this._isDragging&&(this._pos=g.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 i.k("dragstart"))),this.fire(new i.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 i.k("dragend")),this._state="inactive"},this._addDragHandler=g=>{this._element.contains(g.originalEvent.target)&&(g.preventDefault(),this._positionDelta=g.point.sub(this._pos).add(this._offset),this._pointerdownPos=g.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=d&&d.anchor||"center",this._color=d&&d.color||"#3FB1CE",this._scale=d&&d.scale||1,this._draggable=d&&d.draggable||!1,this._clickTolerance=d&&d.clickTolerance||0,this._subpixelPositioning=d&&d.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=d&&d.rotation||0,this._rotationAlignment=d&&d.rotationAlignment||"auto",this._pitchAlignment=d&&d.pitchAlignment&&d.pitchAlignment!=="auto"?d.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(d==null?void 0:d.opacity,d==null?void 0:d.opacityWhenCovered),d&&d.element)this._element=d.element,this._offset=i.P.convert(d&&d.offset||[0,0]);else{this._defaultMarker=!0,this._element=o.create("div");const g=o.createNS("http://www.w3.org/2000/svg","svg"),z=41,j=27;g.setAttributeNS(null,"display","block"),g.setAttributeNS(null,"height",`${z}px`),g.setAttributeNS(null,"width",`${j}px`),g.setAttributeNS(null,"viewBox",`0 0 ${j} ${z}`);const $=o.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"stroke","none"),$.setAttributeNS(null,"stroke-width","1"),$.setAttributeNS(null,"fill","none"),$.setAttributeNS(null,"fill-rule","evenodd");const ie=o.createNS("http://www.w3.org/2000/svg","g");ie.setAttributeNS(null,"fill-rule","nonzero");const de=o.createNS("http://www.w3.org/2000/svg","g");de.setAttributeNS(null,"transform","translate(3.0, 29.0)"),de.setAttributeNS(null,"fill","#000000");const xe=[{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 kt of xe){const Bt=o.createNS("http://www.w3.org/2000/svg","ellipse");Bt.setAttributeNS(null,"opacity","0.04"),Bt.setAttributeNS(null,"cx","10.5"),Bt.setAttributeNS(null,"cy","5.80029008"),Bt.setAttributeNS(null,"rx",kt.rx),Bt.setAttributeNS(null,"ry",kt.ry),de.appendChild(Bt)}const Ae=o.createNS("http://www.w3.org/2000/svg","g");Ae.setAttributeNS(null,"fill",this._color);const Re=o.createNS("http://www.w3.org/2000/svg","path");Re.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"),Ae.appendChild(Re);const je=o.createNS("http://www.w3.org/2000/svg","g");je.setAttributeNS(null,"opacity","0.25"),je.setAttributeNS(null,"fill","#000000");const tt=o.createNS("http://www.w3.org/2000/svg","path");tt.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"),je.appendChild(tt);const lt=o.createNS("http://www.w3.org/2000/svg","g");lt.setAttributeNS(null,"transform","translate(6.0, 7.0)"),lt.setAttributeNS(null,"fill","#FFFFFF");const ft=o.createNS("http://www.w3.org/2000/svg","g");ft.setAttributeNS(null,"transform","translate(8.0, 8.0)");const yt=o.createNS("http://www.w3.org/2000/svg","circle");yt.setAttributeNS(null,"fill","#000000"),yt.setAttributeNS(null,"opacity","0.25"),yt.setAttributeNS(null,"cx","5.5"),yt.setAttributeNS(null,"cy","5.5"),yt.setAttributeNS(null,"r","5.4999962");const Ct=o.createNS("http://www.w3.org/2000/svg","circle");Ct.setAttributeNS(null,"fill","#FFFFFF"),Ct.setAttributeNS(null,"cx","5.5"),Ct.setAttributeNS(null,"cy","5.5"),Ct.setAttributeNS(null,"r","5.4999962"),ft.appendChild(yt),ft.appendChild(Ct),ie.appendChild(de),ie.appendChild(Ae),ie.appendChild(je),ie.appendChild(lt),ie.appendChild(ft),g.appendChild(ie),g.setAttributeNS(null,"height",z*this._scale+"px"),g.setAttributeNS(null,"width",j*this._scale+"px"),this._element.appendChild(g),this._offset=i.P.convert(d&&d.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",g=>{g.preventDefault()}),this._element.addEventListener("mousedown",g=>{g.preventDefault()}),zu(this._element,this._anchor,"marker"),d&&d.className)for(const g of d.className.split(" "))this._element.classList.add(g);this._popup=null}addTo(d){return this.remove(),this._map=d,this._element.setAttribute("aria-label",d._getUIString("Marker.Title")),d.getCanvasContainer().appendChild(this._element),d.on("move",this._update),d.on("moveend",this._update),d.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),o.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=i.N.convert(d),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(d){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),d){if(!("offset"in d.options)){const j=Math.abs(13.5)/Math.SQRT2;d.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[j,-1*(24.6+j)],"bottom-right":[-j,-1*(24.6+j)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=d,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(d){return this._subpixelPositioning=d,this}getPopup(){return this._popup}togglePopup(){const d=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:d?(d.isOpen()?d.remove():(d.setLngLat(this._lngLat),d.addTo(this._map)),this):this}_updateOpacity(d=!1){var g,z;if(!(!((g=this._map)===null||g===void 0)&&g.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(d)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const j=this._map,$=j.terrain.depthAtPoint(this._pos),ie=j.terrain.getElevationForLngLatZoom(this._lngLat,j.transform.tileZoom);if(j.transform.lngLatToCameraDepth(this._lngLat,ie)-$<.006)return void(this._element.style.opacity=this._opacity);const de=-this._offset.y/j.transform._pixelPerMeter,xe=Math.sin(j.getPitch()*Math.PI/180)*de,Ae=j.terrain.depthAtPoint(new i.P(this._pos.x,this._pos.y-this._offset.y)),Re=j.transform.lngLatToCameraDepth(this._lngLat,ie+xe)-Ae>.006;!((z=this._popup)===null||z===void 0)&&z.isOpen()&&Re&&this._popup.remove(),this._element.style.opacity=Re?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(d){return this._offset=i.P.convert(d),this._update(),this}addClassName(d){this._element.classList.add(d)}removeClassName(d){this._element.classList.remove(d)}toggleClassName(d){return this._element.classList.toggle(d)}setDraggable(d){return this._draggable=!!d,this._map&&(d?(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(d){return this._rotation=d||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(d){return this._rotationAlignment=d||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(d){return this._pitchAlignment=d&&d!=="auto"?d:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(d,g){return d===void 0&&g===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),d!==void 0&&(this._opacity=d),g!==void 0&&(this._opacityWhenCovered=g),this._map&&this._updateOpacity(!0),this}}const oc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let na=0,bc=!1;class _i extends i.E{constructor(d){super(),this._onSuccess=g=>{if(this._map){if(this._isOutOfMapMaxBounds(g))return this._setErrorState(),this.fire(new i.k("outofmaxbounds",g)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=g,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(g),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(g),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new i.k("geolocate",g)),this._finish()}},this._updateCamera=g=>{const z=new i.N(g.coords.longitude,g.coords.latitude),j=g.coords.accuracy,$=this._map.getBearing(),ie=i.e({bearing:$},this.options.fitBoundsOptions),de=Se.fromLngLat(z,j);this._map.fitBounds(de,ie,{geolocateSource:!0})},this._updateMarker=g=>{if(g){const z=new i.N(g.coords.longitude,g.coords.latitude);this._accuracyCircleMarker.setLngLat(z).addTo(this._map),this._userLocationDotMarker.setLngLat(z).addTo(this._map),this._accuracy=g.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=g=>{if(this._map){if(this.options.trackUserLocation)if(g.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 z=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(g.code===3&&bc)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new i.k("error",g)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",g=>g.preventDefault()),this._geolocateButton=o.create("button","maplibregl-ctrl-geolocate",this._container),o.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=g=>{if(this._map){if(g===!1){i.w("Geolocation support is not available so the GeolocateControl will be disabled.");const z=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z)}else{const z=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=z,this._geolocateButton.setAttribute("aria-label",z)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new bo({element:this._dotElement}),this._circleElement=o.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new bo({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",z=>{const j=z.originalEvent&&z.originalEvent.type==="resize";z.geolocateSource||this._watchState!=="ACTIVE_LOCK"||j||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new i.k("trackuserlocationend")),this.fire(new i.k("userlocationlostfocus")))})}},this.options=i.e({},oc,d)}onAdd(d){return this._map=d,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return i._(this,arguments,void 0,function*(g=!1){if(Pi!==void 0&&!g)return Pi;if(window.navigator.permissions===void 0)return Pi=!!window.navigator.geolocation,Pi;try{Pi=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Pi=!!window.navigator.geolocation}return Pi})}().then(g=>this._finishSetupUI(g)),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(),o.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,na=0,bc=!1}_isOutOfMapMaxBounds(d){const g=this._map.getMaxBounds(),z=d.coords;return g&&(z.longitude<g.getWest()||z.longitude>g.getEast()||z.latitude<g.getSouth()||z.latitude>g.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 d=this._map.getBounds(),g=d.getSouthEast(),z=d.getNorthEast(),j=g.distanceTo(z),$=this._map._container.clientHeight,ie=Math.ceil(this._accuracy/(j/$)*2);this._circleElement.style.width=`${ie}px`,this._circleElement.style.height=`${ie}px`}trigger(){if(!this._setup)return i.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 i.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":na--,bc=!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 i.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 i.k("trackuserlocationstart")),this.fire(new i.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 d;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),na++,na>1?(d={maximumAge:6e5,timeout:0},bc=!0):(d=this.options.positionOptions,bc=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,d)}}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)}}const gi={maxWidth:100,unit:"metric"};function Ka(V,d,g){const z=g&&g.maxWidth||100,j=V._container.clientHeight/2,$=V.unproject([0,j]),ie=V.unproject([z,j]),de=$.distanceTo(ie);if(g&&g.unit==="imperial"){const xe=3.2808*de;xe>5280?ss(d,z,xe/5280,V._getUIString("ScaleControl.Miles")):ss(d,z,xe,V._getUIString("ScaleControl.Feet"))}else g&&g.unit==="nautical"?ss(d,z,de/1852,V._getUIString("ScaleControl.NauticalMiles")):de>=1e3?ss(d,z,de/1e3,V._getUIString("ScaleControl.Kilometers")):ss(d,z,de,V._getUIString("ScaleControl.Meters"))}function ss(V,d,g,z){const j=function(ie){const de=Math.pow(10,`${Math.floor(ie)}`.length-1);let xe=ie/de;return xe=xe>=10?10:xe>=5?5:xe>=3?3:xe>=2?2:xe>=1?1:function(Ae){const Re=Math.pow(10,Math.ceil(-Math.log(Ae)/Math.LN10));return Math.round(Ae*Re)/Re}(xe),de*xe}(g),$=j/g;V.style.width=d*$+"px",V.innerHTML=`${j}&nbsp;${z}`}class sc extends i.E{constructor(d={}){super(),this._onFullscreenChange=()=>{var g;let z=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((g=z==null?void 0:z.shadowRoot)===null||g===void 0)&&g.fullscreenElement;)z=z.shadowRoot.fullscreenElement;z===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,d&&d.container&&(d.container instanceof HTMLElement?this._container=d.container:i.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(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){o.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const d=this._fullscreenButton=o.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);o.create("span","maplibregl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.title=d}_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 i.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new i.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()}}const ol={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},gt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");class xt extends i.E{constructor(d){super(),this.remove=()=>(this._content&&o.remove(this._content),this._container&&(o.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 i.k("close"))),this),this._onMouseUp=g=>{this._update(g.point)},this._onMouseMove=g=>{this._update(g.point)},this._onDrag=g=>{this._update(g.point)},this._update=g=>{var z;const j=this._lngLat||this._trackPointer;if(!this._map||!j||!this._content)return;if(!this._container){if(this._container=o.create("div","maplibregl-popup",this._map.getContainer()),this._tip=o.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const Ae of this.options.className.split(" "))this._container.classList.add(Ae);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._map.transform.renderWorldCopies&&!this._trackPointer?this._lngLat=al(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(z=this._lngLat)===null||z===void 0?void 0:z.wrap(),this._trackPointer&&!g)return;const $=this._flatPos=this._pos=this._trackPointer&&g?g:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&g?g:this._map.transform.locationPoint(this._lngLat));let ie=this.options.anchor;const de=Pt(this.options.offset);if(!ie){const Ae=this._container.offsetWidth,Re=this._container.offsetHeight;let je;je=$.y+de.bottom.y<Re?["top"]:$.y>this._map.transform.height-Re?["bottom"]:[],$.x<Ae/2?je.push("left"):$.x>this._map.transform.width-Ae/2&&je.push("right"),ie=je.length===0?"bottom":je.join("-")}let xe=$.add(de[ie]);this.options.subpixelPositioning||(xe=xe.round()),o.setTransform(this._container,`${Xl[ie]} translate(${xe.x}px,${xe.y}px)`),zu(this._container,ie,"popup")},this._onClose=()=>{this.remove()},this.options=i.e(Object.create(ol),d)}addTo(d){return this._map&&this.remove(),this._map=d,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 i.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=i.N.convert(d),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(d){return this.setDOMContent(document.createTextNode(d))}setHTML(d){const g=document.createDocumentFragment(),z=document.createElement("body");let j;for(z.innerHTML=d;j=z.firstChild,j;)g.appendChild(j);return this.setDOMContent(g)}getMaxWidth(){var d;return(d=this._container)===null||d===void 0?void 0:d.style.maxWidth}setMaxWidth(d){return this.options.maxWidth=d,this._update(),this}setDOMContent(d){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=o.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(d),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(d){return this._container&&this._container.classList.add(d),this}removeClassName(d){return this._container&&this._container.classList.remove(d),this}setOffset(d){return this.options.offset=d,this._update(),this}toggleClassName(d){if(this._container)return this._container.classList.toggle(d)}setSubpixelPositioning(d){this.options.subpixelPositioning=d}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const d=this._container.querySelector(gt);d&&d.focus()}}function Pt(V){if(V){if(typeof V=="number"){const d=Math.round(Math.abs(V)/Math.SQRT2);return{center:new i.P(0,0),top:new i.P(0,V),"top-left":new i.P(d,d),"top-right":new i.P(-d,d),bottom:new i.P(0,-V),"bottom-left":new i.P(d,-d),"bottom-right":new i.P(-d,-d),left:new i.P(V,0),right:new i.P(-V,0)}}if(V instanceof i.P||Array.isArray(V)){const d=i.P.convert(V);return{center:d,top:d,"top-left":d,"top-right":d,bottom:d,"bottom-left":d,"bottom-right":d,left:d,right:d}}return{center:i.P.convert(V.center||[0,0]),top:i.P.convert(V.top||[0,0]),"top-left":i.P.convert(V["top-left"]||[0,0]),"top-right":i.P.convert(V["top-right"]||[0,0]),bottom:i.P.convert(V.bottom||[0,0]),"bottom-left":i.P.convert(V["bottom-left"]||[0,0]),"bottom-right":i.P.convert(V["bottom-right"]||[0,0]),left:i.P.convert(V.left||[0,0]),right:i.P.convert(V.right||[0,0])}}return Pt(new i.P(0,0))}const te=_;u.AJAXError=i.bg,u.Evented=i.E,u.LngLat=i.N,u.MercatorCoordinate=i.Z,u.Point=i.P,u.addProtocol=i.bh,u.config=i.a,u.removeProtocol=i.bi,u.AttributionControl=yl,u.BoxZoomHandler=bs,u.CanvasSource=Me,u.CooperativeGesturesHandler=Ml,u.DoubleClickZoomHandler=ao,u.DragPanHandler=$l,u.DragRotateHandler=js,u.EdgeInsets=tc,u.FullscreenControl=sc,u.GeoJSONSource=Ee,u.GeolocateControl=_i,u.Hash=Go,u.ImageSource=Le,u.KeyboardHandler=Bc,u.LngLatBounds=Se,u.LogoControl=os,u.Map=class extends Yo{constructor(V){i.be.mark(i.bf.create);const d=Object.assign(Object.assign({},Ou),V);if(d.minZoom!=null&&d.maxZoom!=null&&d.minZoom>d.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(d.minPitch!=null&&d.maxPitch!=null&&d.minPitch>d.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(d.minPitch!=null&&d.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(d.maxPitch!=null&&d.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ia(d.minZoom,d.maxZoom,d.minPitch,d.maxPitch,d.renderWorldCopies),{bearingSnap:d.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new rh,this._controls=[],this._mapId=i.a4(),this._contextLost=z=>{z.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new i.k("webglcontextlost",{originalEvent:z}))},this._contextRestored=z=>{this._setupPainter(),this.resize(),this._update(),this.fire(new i.k("webglcontextrestored",{originalEvent:z}))},this._onMapScroll=z=>{if(z.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=d.interactive,this._maxTileCacheSize=d.maxTileCacheSize,this._maxTileCacheZoomLevels=d.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=d.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=d.preserveDrawingBuffer===!0,this._antialias=d.antialias===!0,this._trackResize=d.trackResize===!0,this._bearingSnap=d.bearingSnap,this._refreshExpiredTiles=d.refreshExpiredTiles===!0,this._fadeDuration=d.fadeDuration,this._crossSourceCollisions=d.crossSourceCollisions===!0,this._collectResourceTiming=d.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},gh),d.locale),this._clickTolerance=d.clickTolerance,this._overridePixelRatio=d.pixelRatio,this._maxCanvasSize=d.maxCanvasSize,this.transformCameraUpdate=d.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=d.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=S.addThrottleControl(()=>this.isMoving()),this._requestManager=new C(d.transformRequest),typeof d.container=="string"){if(this._container=document.getElementById(d.container),!this._container)throw new Error(`Container '${d.container}' not found.`)}else{if(!(d.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=d.container}if(d.maxBounds&&this.setMaxBounds(d.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 z=!1;const j=gu($=>{this._trackResize&&!this._removed&&this.resize($)._update()},50);this._resizeObserver=new ResizeObserver($=>{z?j($):z=!0}),this._resizeObserver.observe(this._container)}this.handlers=new ba(this,d);const g=typeof d.hash=="string"&&d.hash||void 0;this._hash=d.hash&&new Go(g).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch}),d.bounds&&(this.resize(),this.fitBounds(d.bounds,i.e({},d.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=d.localIdeographFontFamily,this._validateStyle=d.validateStyle,d.style&&this.setStyle(d.style,{localIdeographFontFamily:d.localIdeographFontFamily}),d.attributionControl&&this.addControl(new yl(typeof d.attributionControl=="boolean"?void 0:d.attributionControl)),d.maplibreLogo&&this.addControl(new os,d.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",z=>{this._update(z.dataType==="style"),this.fire(new i.k(`${z.dataType}data`,z))}),this.on("dataloading",z=>{this.fire(new i.k(`${z.dataType}dataloading`,z))}),this.on("dataabort",z=>{this.fire(new i.k("sourcedataabort",z))})}_getMapId(){return this._mapId}addControl(V,d){if(d===void 0&&(d=V.getDefaultPosition?V.getDefaultPosition():"top-right"),!V||!V.onAdd)return this.fire(new i.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const g=V.onAdd(this);this._controls.push(V);const z=this._controlPositions[d];return d.indexOf("bottom")!==-1?z.insertBefore(g,z.firstChild):z.appendChild(g),this}removeControl(V){if(!V||!V.onRemove)return this.fire(new i.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const d=this._controls.indexOf(V);return d>-1&&this._controls.splice(d,1),V.onRemove(this),this}hasControl(V){return this._controls.indexOf(V)>-1}calculateCameraOptionsFromTo(V,d,g,z){return z==null&&this.terrain&&(z=this.terrain.getElevationForLngLatZoom(g,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(V,d,g,z)}resize(V){var d;const g=this._containerDimensions(),z=g[0],j=g[1],$=this._getClampedPixelRatio(z,j);if(this._resizeCanvas(z,j,$),this.painter.resize(z,j,$),this.painter.overLimit()){const de=this.painter.context.gl;this._maxCanvasSize=[de.drawingBufferWidth,de.drawingBufferHeight];const xe=this._getClampedPixelRatio(z,j);this._resizeCanvas(z,j,xe),this.painter.resize(z,j,xe)}this.transform.resize(z,j),(d=this._requestedCameraState)===null||d===void 0||d.resize(z,j);const ie=!this._moving;return ie&&(this.stop(),this.fire(new i.k("movestart",V)).fire(new i.k("move",V))),this.fire(new i.k("resize",V)),ie&&this.fire(new i.k("moveend",V)),this}_getClampedPixelRatio(V,d){const{0:g,1:z}=this._maxCanvasSize,j=this.getPixelRatio(),$=V*j,ie=d*j,de=$>g?g/$:1,xe=ie>z?z/ie:1;return Math.min(de,xe)*j}getPixelRatio(){var V;return(V=this._overridePixelRatio)!==null&&V!==void 0?V:devicePixelRatio}setPixelRatio(V){this._overridePixelRatio=V,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(V){return this.transform.setMaxBounds(Se.convert(V)),this._update()}setMinZoom(V){if((V=V??-2)>=-2&&V<=this.transform.maxZoom)return this.transform.minZoom=V,this._update(),this.getZoom()<V&&this.setZoom(V),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(V){if((V=V??22)>=this.transform.minZoom)return this.transform.maxZoom=V,this._update(),this.getZoom()>V&&this.setZoom(V),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(V){if((V=V??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(V>=0&&V<=this.transform.maxPitch)return this.transform.minPitch=V,this._update(),this.getPitch()<V&&this.setPitch(V),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(V){if((V=V??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(V>=this.transform.minPitch)return this.transform.maxPitch=V,this._update(),this.getPitch()>V&&this.setPitch(V),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(V){return this.transform.renderWorldCopies=V,this._update()}project(V){return this.transform.locationPoint(i.N.convert(V),this.style&&this.terrain)}unproject(V){return this.transform.pointLocation(i.P.convert(V),this.terrain)}isMoving(){var V;return this._moving||((V=this.handlers)===null||V===void 0?void 0:V.isMoving())}isZooming(){var V;return this._zooming||((V=this.handlers)===null||V===void 0?void 0:V.isZooming())}isRotating(){var V;return this._rotating||((V=this.handlers)===null||V===void 0?void 0:V.isRotating())}_createDelegatedListener(V,d,g){if(V==="mouseenter"||V==="mouseover"){let z=!1;return{layer:d,listener:g,delegates:{mousemove:$=>{const ie=this.getLayer(d)?this.queryRenderedFeatures($.point,{layers:[d]}):[];ie.length?z||(z=!0,g.call(this,new Ds(V,this,$.originalEvent,{features:ie}))):z=!1},mouseout:()=>{z=!1}}}}if(V==="mouseleave"||V==="mouseout"){let z=!1;return{layer:d,listener:g,delegates:{mousemove:ie=>{(this.getLayer(d)?this.queryRenderedFeatures(ie.point,{layers:[d]}):[]).length?z=!0:z&&(z=!1,g.call(this,new Ds(V,this,ie.originalEvent)))},mouseout:ie=>{z&&(z=!1,g.call(this,new Ds(V,this,ie.originalEvent)))}}}}{const z=j=>{const $=this.getLayer(d)?this.queryRenderedFeatures(j.point,{layers:[d]}):[];$.length&&(j.features=$,g.call(this,j),delete j.features)};return{layer:d,listener:g,delegates:{[V]:z}}}}on(V,d,g){if(g===void 0)return super.on(V,d);const z=this._createDelegatedListener(V,d,g);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[V]=this._delegatedListeners[V]||[],this._delegatedListeners[V].push(z);for(const j in z.delegates)this.on(j,z.delegates[j]);return this}once(V,d,g){if(g===void 0)return super.once(V,d);const z=this._createDelegatedListener(V,d,g);for(const j in z.delegates)this.once(j,z.delegates[j]);return this}off(V,d,g){return g===void 0?super.off(V,d):(this._delegatedListeners&&this._delegatedListeners[V]&&(z=>{const j=z[V];for(let $=0;$<j.length;$++){const ie=j[$];if(ie.layer===d&&ie.listener===g){for(const de in ie.delegates)this.off(de,ie.delegates[de]);return j.splice($,1),this}}})(this._delegatedListeners),this)}queryRenderedFeatures(V,d){if(!this.style)return[];let g;const z=V instanceof i.P||Array.isArray(V),j=z?V:[[0,0],[this.transform.width,this.transform.height]];if(d=d||(z?{}:V)||{},j instanceof i.P||typeof j[0]=="number")g=[i.P.convert(j)];else{const $=i.P.convert(j[0]),ie=i.P.convert(j[1]);g=[$,new i.P(ie.x,$.y),ie,new i.P($.x,ie.y),$]}return this.style.queryRenderedFeatures(g,d,this.transform)}querySourceFeatures(V,d){return this.style.querySourceFeatures(V,d)}setStyle(V,d){return(d=i.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},d)).diff!==!1&&d.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&V?(this._diffStyle(V,d),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._updateStyle(V,d))}setTransformRequest(V){return this._requestManager.setTransformRequest(V),this}_getUIString(V){const d=this._locale[V];if(d==null)throw new Error(`Missing UI string '${V}'`);return d}_updateStyle(V,d){if(d.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(V,d));const g=this.style&&d.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!V)),V?(this.style=new Jr(this,d||{}),this.style.setEventedParent(this,{style:this.style}),typeof V=="string"?this.style.loadURL(V,d,g):this.style.loadJSON(V,d,g),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Jr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(V,d){if(typeof V=="string"){const g=V,z=this._requestManager.transformRequest(g,"Style");i.h(z,new AbortController).then(j=>{this._updateDiff(j.data,d)}).catch(j=>{j&&this.fire(new i.j(j))})}else typeof V=="object"&&this._updateDiff(V,d)}_updateDiff(V,d){try{this.style.setState(V,d)&&this._update(!0)}catch(g){i.w(`Unable to perform style diff: ${g.message||g.error||g}. Rebuilding the style from scratch.`),this._updateStyle(V,d)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():i.w("There is no style added to the map.")}addSource(V,d){return this._lazyInitEmptyStyle(),this.style.addSource(V,d),this._update(!0)}isSourceLoaded(V){const d=this.style&&this.style.sourceCaches[V];if(d!==void 0)return d.loaded();this.fire(new i.j(new Error(`There is no source with ID '${V}'`)))}setTerrain(V){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),V){const d=this.style.sourceCaches[V.source];if(!d)throw new Error(`cannot load terrain, because there exists no source with ID: ${V.source}`);this.terrain===null&&d.reload();for(const g in this.style._layers){const z=this.style._layers[g];z.type==="hillshade"&&z.source===V.source&&i.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 xa(this.painter,d,V),this.painter.renderToTexture=new vu(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=g=>{g.dataType==="style"?this.terrain.sourceCache.freeRtt():g.dataType==="source"&&g.tile&&(g.sourceId!==V.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(g.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 i.k("terrain",{terrain:V})),this}getTerrain(){var V,d;return(d=(V=this.terrain)===null||V===void 0?void 0:V.options)!==null&&d!==void 0?d:null}areTilesLoaded(){const V=this.style&&this.style.sourceCaches;for(const d in V){const g=V[d]._tiles;for(const z in g){const j=g[z];if(j.state!=="loaded"&&j.state!=="errored")return!1}}return!0}removeSource(V){return this.style.removeSource(V),this._update(!0)}getSource(V){return this.style.getSource(V)}addImage(V,d,g={}){const{pixelRatio:z=1,sdf:j=!1,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae}=g;if(this._lazyInitEmptyStyle(),!(d instanceof HTMLImageElement||i.b(d))){if(d.width===void 0||d.height===void 0)return this.fire(new i.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:Re,height:je,data:tt}=d,lt=d;return this.style.addImage(V,{data:new i.R({width:Re,height:je},new Uint8Array(tt)),pixelRatio:z,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae,sdf:j,version:0,userImage:lt}),lt.onAdd&&lt.onAdd(this,V),this}}{const{width:Re,height:je,data:tt}=v.getImageData(d);this.style.addImage(V,{data:new i.R({width:Re,height:je},tt),pixelRatio:z,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae,sdf:j,version:0})}}updateImage(V,d){const g=this.style.getImage(V);if(!g)return this.fire(new i.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const z=d instanceof HTMLImageElement||i.b(d)?v.getImageData(d):d,{width:j,height:$,data:ie}=z;if(j===void 0||$===void 0)return this.fire(new i.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(j!==g.data.width||$!==g.data.height)return this.fire(new i.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const de=!(d instanceof HTMLImageElement||i.b(d));return g.data.replace(ie,de),this.style.updateImage(V,g),this}getImage(V){return this.style.getImage(V)}hasImage(V){return V?!!this.style.getImage(V):(this.fire(new i.j(new Error("Missing required image id"))),!1)}removeImage(V){this.style.removeImage(V)}loadImage(V){return S.getImage(this._requestManager.transformRequest(V,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(V,d){return this._lazyInitEmptyStyle(),this.style.addLayer(V,d),this._update(!0)}moveLayer(V,d){return this.style.moveLayer(V,d),this._update(!0)}removeLayer(V){return this.style.removeLayer(V),this._update(!0)}getLayer(V){return this.style.getLayer(V)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(V,d,g){return this.style.setLayerZoomRange(V,d,g),this._update(!0)}setFilter(V,d,g={}){return this.style.setFilter(V,d,g),this._update(!0)}getFilter(V){return this.style.getFilter(V)}setPaintProperty(V,d,g,z={}){return this.style.setPaintProperty(V,d,g,z),this._update(!0)}getPaintProperty(V,d){return this.style.getPaintProperty(V,d)}setLayoutProperty(V,d,g,z={}){return this.style.setLayoutProperty(V,d,g,z),this._update(!0)}getLayoutProperty(V,d){return this.style.getLayoutProperty(V,d)}setGlyphs(V,d={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(V,d),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(V,d,g={}){return this._lazyInitEmptyStyle(),this.style.addSprite(V,d,g,z=>{z||this._update(!0)}),this}removeSprite(V){return this._lazyInitEmptyStyle(),this.style.removeSprite(V),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(V,d={}){return this._lazyInitEmptyStyle(),this.style.setSprite(V,d,g=>{g||this._update(!0)}),this}setLight(V,d={}){return this._lazyInitEmptyStyle(),this.style.setLight(V,d),this._update(!0)}getLight(){return this.style.getLight()}setSky(V){return this._lazyInitEmptyStyle(),this.style.setSky(V),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(V,d){return this.style.setFeatureState(V,d),this._update()}removeFeatureState(V,d){return this.style.removeFeatureState(V,d),this._update()}getFeatureState(V){return this.style.getFeatureState(V)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let V=0,d=0;return this._container&&(V=this._container.clientWidth||400,d=this._container.clientHeight||300),[V,d]}_setupContainer(){const V=this._container;V.classList.add("maplibregl-map");const d=this._canvasContainer=o.create("div","maplibregl-canvas-container",V);this._interactive&&d.classList.add("maplibregl-interactive"),this._canvas=o.create("canvas","maplibregl-canvas",d),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 g=this._containerDimensions(),z=this._getClampedPixelRatio(g[0],g[1]);this._resizeCanvas(g[0],g[1],z);const j=this._controlContainer=o.create("div","maplibregl-control-container",V),$=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(ie=>{$[ie]=o.create("div",`maplibregl-ctrl-${ie} `,j)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(V,d,g){this._canvas.width=Math.floor(g*V),this._canvas.height=Math.floor(g*d),this._canvas.style.width=`${V}px`,this._canvas.style.height=`${d}px`}_setupPainter(){const V={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let d=null;this._canvas.addEventListener("webglcontextcreationerror",z=>{d={requestedAttributes:V},z&&(d.statusMessage=z.statusMessage,d.type=z.type)},{once:!0});const g=this._canvas.getContext("webgl2",V)||this._canvas.getContext("webgl",V);if(!g){const z="Failed to initialize WebGL";throw d?(d.message=z,new Error(JSON.stringify(d))):new Error(z)}this.painter=new Oc(g,this.transform),a.testSupport(g)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(V){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||V,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(V){return this._update(),this._renderTaskQueue.add(V)}_cancelRenderFrame(V){this._renderTaskQueue.remove(V)}_render(V){const d=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(V),this._removed)return;let g=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const j=this.transform.zoom,$=v.now();this.style.zoomHistory.update(j,$);const ie=new i.a9(j,{now:$,fadeDuration:d,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),de=ie.crossFadingFactor();de===1&&de===this._crossFadingFactor||(g=!0,this._crossFadingFactor=de),this.style.update(ie)}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,d,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:d,showPadding:this.showPadding}),this.fire(new i.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,i.be.mark(i.bf.load),this.fire(new i.k("load"))),this.style&&(this.style.hasTransitions()||g)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const z=this._sourcesDirty||this._styleDirty||this._placementDirty;return z||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new i.k("idle")),!this._loaded||this._fullyLoaded||z||(this._fullyLoaded=!0,i.be.mark(i.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var V;this._hash&&this._hash.remove();for(const g of this._controls)g.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),S.removeThrottleControl(this._imageQueueHandle),(V=this._resizeObserver)===null||V===void 0||V.disconnect();const d=this.painter.context.gl.getExtension("WEBGL_lose_context");d!=null&&d.loseContext&&d.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),o.remove(this._canvasContainer),o.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),i.be.clearMetrics(),this._removed=!0,this.fire(new i.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,v.frameAsync(this._frameRequest).then(V=>{i.be.frame(V),this._frameRequest=null,this._render(V)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(V){this._showTileBoundaries!==V&&(this._showTileBoundaries=V,this._update())}get showPadding(){return!!this._showPadding}set showPadding(V){this._showPadding!==V&&(this._showPadding=V,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(V){this._showCollisionBoxes!==V&&(this._showCollisionBoxes=V,V?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(V){this._showOverdrawInspector!==V&&(this._showOverdrawInspector=V,this._update())}get repaint(){return!!this._repaint}set repaint(V){this._repaint!==V&&(this._repaint=V,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(V){this._vertices=V,this._update()}get version(){return ih}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Ds,u.MapTouchEvent=ys,u.MapWheelEvent=Mu,u.Marker=bo,u.NavigationControl=class{constructor(V){this._updateZoomButtons=()=>{const d=this._map.getZoom(),g=d===this._map.getMaxZoom(),z=d===this._map.getMinZoom();this._zoomInButton.disabled=g,this._zoomOutButton.disabled=z,this._zoomInButton.setAttribute("aria-disabled",g.toString()),this._zoomOutButton.setAttribute("aria-disabled",z.toString())},this._rotateCompassArrow=()=>{const d=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=d},this._setButtonTitle=(d,g)=>{const z=this._map._getUIString(`NavigationControl.${g}`);d.title=z,d.setAttribute("aria-label",z)},this.options=i.e({},Zl,V),this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",d=>d.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",d=>this._map.zoomIn({},{originalEvent:d})),o.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",d=>this._map.zoomOut({},{originalEvent:d})),o.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",d=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:d}):this._map.resetNorth({},{originalEvent:d})}),this._compassIcon=o.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(V){return this._map=V,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 ui(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){o.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(V,d){const g=o.create("button",V,this._container);return g.type="button",g.addEventListener("click",d),g}},u.Popup=xt,u.RasterDEMTileSource=He,u.RasterTileSource=Pe,u.ScaleControl=class{constructor(V){this._onMove=()=>{Ka(this._map,this._container,this.options)},this.setUnit=d=>{this.options.unit=d,Ka(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},gi),V)}getDefaultPosition(){return"bottom-left"}onAdd(V){return this._map=V,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-scale",V.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){o.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},u.ScrollZoomHandler=Pu,u.Style=Jr,u.TerrainControl=class{constructor(V){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=V}onAdd(V){return this._map=V,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=o.create("button","maplibregl-ctrl-terrain",this._container),o.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(){o.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},u.TwoFingersTouchPitchHandler=rc,u.TwoFingersTouchRotateHandler=zh,u.TwoFingersTouchZoomHandler=ki,u.TwoFingersTouchZoomRotateHandler=Ru,u.VectorTileSource=Ie,u.VideoSource=ve,u.addSourceType=(V,d)=>i._(void 0,void 0,void 0,function*(){if(Ue(V))throw new Error(`A source type called "${V}" already exists.`);((g,z)=>{ke[g]=z})(V,d)}),u.clearPrewarmedResources=function(){const V=fe;V&&(V.isPreloaded()&&V.numActive()===1?(V.release(ce),fe=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()"))},u.getMaxParallelImageRequests=function(){return i.a.MAX_PARALLEL_IMAGE_REQUESTS},u.getRTLTextPluginStatus=function(){return Xe().getRTLTextPluginStatus()},u.getVersion=function(){return te},u.getWorkerCount=function(){return he.workerCount},u.getWorkerUrl=function(){return i.a.WORKER_URL},u.importScriptInWorkers=function(V){return pe().broadcast("IS",V)},u.prewarm=function(){oe().acquire(ce)},u.setMaxParallelImageRequests=function(V){i.a.MAX_PARALLEL_IMAGE_REQUESTS=V},u.setRTLTextPlugin=function(V,d){return Xe().setRTLTextPlugin(V,d)},u.setWorkerCount=function(V){he.workerCount=V},u.setWorkerUrl=function(V){i.a.WORKER_URL=V}}),f}()},88640:function(p,f,n){function s(be,_e,Se){be.prototype=_e.prototype=Se,Se.constructor=be}function u(be,_e){var Se=Object.create(be.prototype);for(var Ce in _e)Se[Ce]=_e[Ce];return Se}function i(){}n.d(f,{GW:function(){return me},Dj:function(){return he}});var _=.7,b=1/_,w="\\s*([+-]?\\d+)\\s*",v="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",o="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",a=/^#([0-9a-f]{3,8})$/,h=new RegExp("^rgb\\(".concat(w,",").concat(w,",").concat(w,"\\)$")),l=new RegExp("^rgb\\(".concat(o,",").concat(o,",").concat(o,"\\)$")),m=new RegExp("^rgba\\(".concat(w,",").concat(w,",").concat(w,",").concat(v,"\\)$")),y=new RegExp("^rgba\\(".concat(o,",").concat(o,",").concat(o,",").concat(v,"\\)$")),x=new RegExp("^hsl\\(".concat(v,",").concat(o,",").concat(o,"\\)$")),S=new RegExp("^hsla\\(".concat(v,",").concat(o,",").concat(o,",").concat(v,"\\)$")),C={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function A(){return this.rgb().formatHex()}function E(){return this.rgb().formatRgb()}function P(be){var _e,Se;return be=(be+"").trim().toLowerCase(),(_e=a.exec(be))?(Se=_e[1].length,_e=parseInt(_e[1],16),Se===6?M(_e):Se===3?new T(_e>>8&15|_e>>4&240,_e>>4&15|240&_e,(15&_e)<<4|15&_e,1):Se===8?L(_e>>24&255,_e>>16&255,_e>>8&255,(255&_e)/255):Se===4?L(_e>>12&15|_e>>8&240,_e>>8&15|_e>>4&240,_e>>4&15|240&_e,((15&_e)<<4|15&_e)/255):null):(_e=h.exec(be))?new T(_e[1],_e[2],_e[3],1):(_e=l.exec(be))?new T(255*_e[1]/100,255*_e[2]/100,255*_e[3]/100,1):(_e=m.exec(be))?L(_e[1],_e[2],_e[3],_e[4]):(_e=y.exec(be))?L(255*_e[1]/100,255*_e[2]/100,255*_e[3]/100,_e[4]):(_e=x.exec(be))?U(_e[1],_e[2]/100,_e[3]/100,1):(_e=S.exec(be))?U(_e[1],_e[2]/100,_e[3]/100,_e[4]):C.hasOwnProperty(be)?M(C[be]):be==="transparent"?new T(NaN,NaN,NaN,0):null}function M(be){return new T(be>>16&255,be>>8&255,255&be,1)}function L(be,_e,Se,Ce){return Ce<=0&&(be=_e=Se=NaN),new T(be,_e,Se,Ce)}function I(be,_e,Se,Ce){return arguments.length===1?((Ie=be)instanceof i||(Ie=P(Ie)),Ie?new T((Ie=Ie.rgb()).r,Ie.g,Ie.b,Ie.opacity):new T):new T(be,_e,Se,Ce??1);var Ie}function T(be,_e,Se,Ce){this.r=+be,this.g=+_e,this.b=+Se,this.opacity=+Ce}function D(){return"#".concat(N(this.r)).concat(N(this.g)).concat(N(this.b))}function k(){var be=O(this.opacity);return"".concat(be===1?"rgb(":"rgba(").concat(F(this.r),", ").concat(F(this.g),", ").concat(F(this.b)).concat(be===1?")":", ".concat(be,")"))}function O(be){return isNaN(be)?1:Math.max(0,Math.min(1,be))}function F(be){return Math.max(0,Math.min(255,Math.round(be)||0))}function N(be){return((be=F(be))<16?"0":"")+be.toString(16)}function U(be,_e,Se,Ce){return Ce<=0?be=_e=Se=NaN:Se<=0||Se>=1?be=_e=NaN:_e<=0&&(be=NaN),new H(be,_e,Se,Ce)}function W(be){if(be instanceof H)return new H(be.h,be.s,be.l,be.opacity);if(be instanceof i||(be=P(be)),!be)return new H;if(be instanceof H)return be;var _e=(be=be.rgb()).r/255,Se=be.g/255,Ce=be.b/255,Ie=Math.min(_e,Se,Ce),Pe=Math.max(_e,Se,Ce),He=NaN,Ee=Pe-Ie,Fe=(Pe+Ie)/2;return Ee?(He=_e===Pe?(Se-Ce)/Ee+6*(Se<Ce):Se===Pe?(Ce-_e)/Ee+2:(_e-Se)/Ee+4,Ee/=Fe<.5?Pe+Ie:2-Pe-Ie,He*=60):Ee=Fe>0&&Fe<1?0:He,new H(He,Ee,Fe,be.opacity)}function H(be,_e,Se,Ce){this.h=+be,this.s=+_e,this.l=+Se,this.opacity=+Ce}function Z(be){return(be=(be||0)%360)<0?be+360:be}function ee(be){return Math.max(0,Math.min(1,be||0))}function G(be,_e,Se){return 255*(be<60?_e+(Se-_e)*be/60:be<180?Se:be<240?_e+(Se-_e)*(240-be)/60:_e)}s(i,P,{copy:function(be){return Object.assign(new this.constructor,this,be)},displayable:function(){return this.rgb().displayable()},hex:A,formatHex:A,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return W(this).formatHsl()},formatRgb:E,toString:E}),s(T,I,u(i,{brighter:function(be){return be=be==null?b:Math.pow(b,be),new T(this.r*be,this.g*be,this.b*be,this.opacity)},darker:function(be){return be=be==null?_:Math.pow(_,be),new T(this.r*be,this.g*be,this.b*be,this.opacity)},rgb:function(){return this},clamp:function(){return new T(F(this.r),F(this.g),F(this.b),O(this.opacity))},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:D,formatHex:D,formatHex8:function(){return"#".concat(N(this.r)).concat(N(this.g)).concat(N(this.b)).concat(N(255*(isNaN(this.opacity)?1:this.opacity)))},formatRgb:k,toString:k})),s(H,function(be,_e,Se,Ce){return arguments.length===1?W(be):new H(be,_e,Se,Ce??1)},u(i,{brighter:function(be){return be=be==null?b:Math.pow(b,be),new H(this.h,this.s,this.l*be,this.opacity)},darker:function(be){return be=be==null?_:Math.pow(_,be),new H(this.h,this.s,this.l*be,this.opacity)},rgb:function(){var be=this.h%360+360*(this.h<0),_e=isNaN(be)||isNaN(this.s)?0:this.s,Se=this.l,Ce=Se+(Se<.5?Se:1-Se)*_e,Ie=2*Se-Ce;return new T(G(be>=240?be-240:be+120,Ie,Ce),G(be,Ie,Ce),G(be<120?be+240:be-120,Ie,Ce),this.opacity)},clamp:function(){return new H(Z(this.h),ee(this.s),ee(this.l),O(this.opacity))},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var be=O(this.opacity);return"".concat(be===1?"hsl(":"hsla(").concat(Z(this.h),", ").concat(100*ee(this.s),"%, ").concat(100*ee(this.l),"%").concat(be===1?")":", ".concat(be,")"))}}));var ne=function(be){return function(){return be}};function K(be,_e){var Se=_e-be;return Se?function(Ce,Ie){return function(Pe){return Ce+Pe*Ie}}(be,Se):ne(isNaN(be)?_e:be)}var X=function be(_e){var Se=function(Ie){return(Ie=+Ie)==1?K:function(Pe,He){return He-Pe?function(Ee,Fe,Le){return Ee=Math.pow(Ee,Le),Fe=Math.pow(Fe,Le)-Ee,Le=1/Le,function(ve){return Math.pow(Ee+ve*Fe,Le)}}(Pe,He,Ie):ne(isNaN(Pe)?He:Pe)}}(_e);function Ce(Ie,Pe){var He=Se((Ie=I(Ie)).r,(Pe=I(Pe)).r),Ee=Se(Ie.g,Pe.g),Fe=Se(Ie.b,Pe.b),Le=K(Ie.opacity,Pe.opacity);return function(ve){return Ie.r=He(ve),Ie.g=Ee(ve),Ie.b=Fe(ve),Ie.opacity=Le(ve),Ie+""}}return Ce.gamma=be,Ce}(1);function Q(be,_e){var Se,Ce=_e?_e.length:0,Ie=be?Math.min(Ce,be.length):0,Pe=new Array(Ie),He=new Array(Ce);for(Se=0;Se<Ie;++Se)Pe[Se]=me(be[Se],_e[Se]);for(;Se<Ce;++Se)He[Se]=_e[Se];return function(Ee){for(Se=0;Se<Ie;++Se)He[Se]=Pe[Se](Ee);return He}}function ce(be,_e){var Se=new Date;return be=+be,_e=+_e,function(Ce){return Se.setTime(be*(1-Ce)+_e*Ce),Se}}function he(be,_e){return be=+be,_e=+_e,function(Se){return be*(1-Se)+_e*Se}}function se(be){return se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_e){return typeof _e}:function(_e){return _e&&typeof Symbol=="function"&&_e.constructor===Symbol&&_e!==Symbol.prototype?"symbol":typeof _e},se(be)}function fe(be,_e){var Se,Ce={},Ie={};for(Se in be!==null&&se(be)==="object"||(be={}),_e!==null&&se(_e)==="object"||(_e={}),_e)Se in be?Ce[Se]=me(be[Se],_e[Se]):Ie[Se]=_e[Se];return function(Pe){for(Se in Ce)Ie[Se]=Ce[Se](Pe);return Ie}}var re=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,oe=new RegExp(re.source,"g");function le(be,_e){var Se,Ce,Ie,Pe=re.lastIndex=oe.lastIndex=0,He=-1,Ee=[],Fe=[];for(be+="",_e+="";(Se=re.exec(be))&&(Ce=oe.exec(_e));)(Ie=Ce.index)>Pe&&(Ie=_e.slice(Pe,Ie),Ee[He]?Ee[He]+=Ie:Ee[++He]=Ie),(Se=Se[0])===(Ce=Ce[0])?Ee[He]?Ee[He]+=Ce:Ee[++He]=Ce:(Ee[++He]=null,Fe.push({i:He,x:he(Se,Ce)})),Pe=oe.lastIndex;return Pe<_e.length&&(Ie=_e.slice(Pe),Ee[He]?Ee[He]+=Ie:Ee[++He]=Ie),Ee.length<2?Fe[0]?function(Le){return function(ve){return Le(ve)+""}}(Fe[0].x):function(Le){return function(){return Le}}(_e):(_e=Fe.length,function(Le){for(var ve,Me=0;Me<_e;++Me)Ee[(ve=Fe[Me]).i]=ve.x(Le);return Ee.join("")})}function pe(be,_e){_e||(_e=[]);var Se,Ce=be?Math.min(_e.length,be.length):0,Ie=_e.slice();return function(Pe){for(Se=0;Se<Ce;++Se)Ie[Se]=be[Se]*(1-Pe)+_e[Se]*Pe;return Ie}}function ge(be){return ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_e){return typeof _e}:function(_e){return _e&&typeof Symbol=="function"&&_e.constructor===Symbol&&_e!==Symbol.prototype?"symbol":typeof _e},ge(be)}function me(be,_e){var Se,Ce,Ie=ge(_e);return _e==null||Ie==="boolean"?ne(_e):(Ie==="number"?he:Ie==="string"?(Se=P(_e))?(_e=Se,X):le:_e instanceof P?X:_e instanceof Date?ce:(Ce=_e,!ArrayBuffer.isView(Ce)||Ce instanceof DataView?Array.isArray(_e)?Q:typeof _e.valueOf!="function"&&typeof _e.toString!="function"||isNaN(_e)?fe:he:pe))(be,_e)}},23648:function(p){p.exports=JSON.parse('["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]')},2362:function(p){p.exports=JSON.parse('["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]')},87486:function(p){p.exports=JSON.parse('["normal","italic","oblique"]')},99803:function(p){p.exports=JSON.parse('["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]')},54324:function(p){p.exports=JSON.parse('["inherit","initial","unset"]')},94316:function(p){p.exports=JSON.parse('["caption","icon","menu","message-box","small-caption","status-bar"]')},37071:function(p){p.exports=JSON.parse(`{"version":8,"name":"orto","metadata":{"maputnik:renderer":"mlgljs"},"center":[1.537786,41.837539],"zoom":12,"bearing":0,"pitch":0,"light":{"anchor":"viewport","color":"white","intensity":0.4,"position":[1.15,45,30]},"sources":{"ortoEsri":{"type":"raster","tiles":["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],"tileSize":256,"maxzoom":18,"attribution":"ESRI &copy; <a href='http://www.esri.com'>ESRI</a>"},"ortoInstaMaps":{"type":"raster","tiles":["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],"tileSize":256,"maxzoom":13},"ortoICGC":{"type":"raster","tiles":["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],"tileSize":256,"minzoom":13.1,"maxzoom":20},"openmaptiles":{"type":"vector","url":"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},"sprite":"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1","glyphs":"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","paint":{"background-color":"#F4F9F4"}},{"id":"ortoEsri","type":"raster","source":"ortoEsri","maxzoom":16,"layout":{"visibility":"visible"}},{"id":"ortoICGC","type":"raster","source":"ortoICGC","minzoom":13.1,"maxzoom":19,"layout":{"visibility":"visible"}},{"id":"ortoInstaMaps","type":"raster","source":"ortoInstaMaps","maxzoom":13,"layout":{"visibility":"visible"}},{"id":"waterway_tunnel","type":"line","source":"openmaptiles","source-layer":"waterway","minzoom":14,"filter":["all",["in","class","river","stream","canal"],["==","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,6]]},"line-dasharray":[2,4]}},{"id":"waterway-other","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["!in","class","canal","river","stream"],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,2]]}}},{"id":"waterway-stream-canal","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["all",["in","class","canal","stream"],["!=","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.3,"stops":[[13,0.5],[20,6]]}}},{"id":"waterway-river","type":"line","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"waterway","filter":["all",["==","class","river"],["!=","brunnel","tunnel"]],"layout":{"line-cap":"round"},"paint":{"line-color":"#a0c8f0","line-width":{"base":1.2,"stops":[[10,0.8],[20,4]]},"line-opacity":0.5}},{"id":"water-offset","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","maxzoom":8,"filter":["==","$type","Polygon"],"layout":{"visibility":"visible"},"paint":{"fill-opacity":0,"fill-color":"#a0c8f0","fill-translate":{"base":1,"stops":[[6,[2,0]],[8,[0,0]]]}}},{"id":"water","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","layout":{"visibility":"visible"},"paint":{"fill-color":"hsl(210, 67%, 85%)","fill-opacity":0}},{"id":"water-pattern","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"water","layout":{"visibility":"visible"},"paint":{"fill-translate":[0,2.5],"fill-pattern":"wave","fill-opacity":1}},{"id":"landcover-ice-shelf","type":"fill","metadata":{"mapbox:group":"1444849382550.77"},"source":"openmaptiles","source-layer":"landcover","filter":["==","subclass","ice_shelf"],"layout":{"visibility":"visible"},"paint":{"fill-color":"#fff","fill-opacity":{"base":1,"stops":[[0,0.9],[10,0.3]]}}},{"id":"tunnel-service-track-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","service","track"]],"layout":{"line-join":"round"},"paint":{"line-color":"#cfcdca","line-dasharray":[0.5,0.25],"line-width":{"base":1.2,"stops":[[15,1],[16,4],[20,11]]}}},{"id":"tunnel-minor-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","minor"]],"layout":{"line-join":"round"},"paint":{"line-color":"#cfcdca","line-opacity":{"stops":[[12,0],[12.5,1]]},"line-width":{"base":1.2,"stops":[[12,0.5],[13,1],[14,4],[20,15]]}}},{"id":"tunnel-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[8,1.5],[20,17]]}}},{"id":"tunnel-trunk-primary-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.7}},{"id":"tunnel-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","motorway"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-dasharray":[0.5,0.25],"line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.5}},{"id":"tunnel-path","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","tunnel"],["==","class","path"]]],"paint":{"line-color":"#cba","line-dasharray":[1.5,0.75],"line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]}}},{"id":"tunnel-service-track","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","service","track"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff","line-width":{"base":1.2,"stops":[[15.5,0],[16,2],[20,7.5]]}}},{"id":"tunnel-minor","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","minor_road"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff","line-opacity":1,"line-width":{"base":1.2,"stops":[[13.5,0],[14,2.5],[20,11.5]]}}},{"id":"tunnel-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff4c6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,10]]}}},{"id":"tunnel-trunk-primary","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fff4c6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"tunnel-motorway","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","motorway"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"#ffdaa6","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"tunnel-railway","type":"line","metadata":{"mapbox:group":"1444849354174.1904"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","tunnel"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]},"line-dasharray":[2,2]}},{"id":"ferry","type":"line","source":"openmaptiles","source-layer":"transportation","filter":["all",["in","class","ferry"]],"layout":{"line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(108, 159, 182, 1)","line-width":1.1,"line-dasharray":[2,2]}},{"id":"aeroway-taxiway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":12,"filter":["all",["in","class","taxiway"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(153, 153, 153, 1)","line-width":{"base":1.5,"stops":[[11,2],[17,12]]},"line-opacity":1}},{"id":"aeroway-runway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":12,"filter":["all",["in","class","runway"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(153, 153, 153, 1)","line-width":{"base":1.5,"stops":[[11,5],[17,55]]},"line-opacity":1}},{"id":"aeroway-taxiway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":4,"filter":["all",["in","class","taxiway"],["==","$type","LineString"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(255, 255, 255, 1)","line-width":{"base":1.5,"stops":[[11,1],[17,10]]},"line-opacity":{"base":1,"stops":[[11,0],[12,1]]}}},{"id":"aeroway-runway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"aeroway","minzoom":4,"filter":["all",["in","class","runway"],["==","$type","LineString"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"rgba(255, 255, 255, 1)","line-width":{"base":1.5,"stops":[[11,4],[17,50]]},"line-opacity":{"base":1,"stops":[[11,0],[12,1]]}}},{"id":"highway-motorway-link-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":12,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"highway-link-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"highway-minor-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!=","brunnel","tunnel"],["in","class","minor","service","track"]]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#cfcdca","line-opacity":{"stops":[[12,0],[12.5,0]]},"line-width":{"base":1.2,"stops":[[12,0.5],[13,1],[14,4],[20,15]]}}},{"id":"highway-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":0.5,"line-width":{"base":1.2,"stops":[[8,1.5],[20,17]]}}},{"id":"highway-primary-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":{"stops":[[7,0],[8,0.6]]},"line-width":{"base":1.2,"stops":[[7,0],[8,0.6],[9,1.5],[20,22]]}}},{"id":"highway-trunk-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","trunk"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-opacity":{"stops":[[5,0],[6,0.5]]},"line-width":{"base":1.2,"stops":[[5,0],[6,0.6],[7,1.5],[20,22]]}}},{"id":"highway-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":4,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway"]],"layout":{"line-cap":"butt","line-join":"round","visibility":"visible"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[4,0],[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":{"stops":[[4,0],[5,0.5]]}}},{"id":"highway-path","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["==","class","path"]]],"paint":{"line-color":"#cba","line-dasharray":[1.5,0.75],"line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]}}},{"id":"highway-motorway-link","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":12,"filter":["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"highway-link","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"highway-minor","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!=","brunnel","tunnel"],["in","class","minor","service","track"]]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"#fff","line-opacity":0.5,"line-width":{"base":1.2,"stops":[[13.5,0],[14,2.5],[20,11.5]]}}},{"id":"highway-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["!in","brunnel","bridge","tunnel"],["in","class","secondary","tertiary"]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[8,0.5],[20,13]]},"line-opacity":0.5}},{"id":"highway-primary","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["in","class","primary"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[8.5,0],[9,0.5],[20,18]]},"line-opacity":0}},{"id":"highway-trunk","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["in","class","trunk"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"highway-motorway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","minzoom":5,"filter":["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway"]]],"layout":{"line-cap":"round","line-join":"round","visibility":"visible"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"railway-transit","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","transit"],["!in","brunnel","tunnel"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.77)","line-width":{"base":1.4,"stops":[[14,0.4],[20,1]]}}},{"id":"railway-transit-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","transit"],["!in","brunnel","tunnel"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.68)","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,2],[20,6]]}}},{"id":"railway-service","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","rail"],["has","service"]]],"paint":{"line-color":"hsla(0, 0%, 73%, 0.77)","line-width":{"base":1.4,"stops":[[14,0.4],[20,1]]}}},{"id":"railway-service-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","class","rail"],["has","service"]]],"layout":{"visibility":"visible"},"paint":{"line-color":"hsla(0, 0%, 73%, 0.68)","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,2],[20,6]]}}},{"id":"railway","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!has","service"],["!in","brunnel","bridge","tunnel"],["==","class","rail"]]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]}}},{"id":"railway-hatching","type":"line","metadata":{"mapbox:group":"1444849345966.4436"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["!has","service"],["!in","brunnel","bridge","tunnel"],["==","class","rail"]]],"paint":{"line-color":"#bbb","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,3],[20,8]]}}},{"id":"bridge-motorway-link-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"bridge-link-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[12,1],[13,3],[14,4],[20,15]]}}},{"id":"bridge-secondary-tertiary-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-opacity":1,"line-width":{"base":1.2,"stops":[[8,1.5],[20,28]]}}},{"id":"bridge-trunk-primary-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"hsl(28, 76%, 67%)","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,26]]}}},{"id":"bridge-motorway-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway"]],"layout":{"line-join":"round"},"paint":{"line-color":"#e9ac77","line-width":{"base":1.2,"stops":[[5,0.4],[6,0.6],[7,1.5],[20,22]]},"line-opacity":0.5}},{"id":"bridge-path-casing","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","path"]]],"paint":{"line-color":"#f8f4f0","line-width":{"base":1.2,"stops":[[15,1.2],[20,18]]}}},{"id":"bridge-path","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","path"]]],"paint":{"line-color":"#cba","line-width":{"base":1.2,"stops":[[15,1.2],[20,4]]},"line-dasharray":[1.5,0.75]}},{"id":"bridge-motorway-link","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"bridge-link","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{"id":"bridge-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","secondary","tertiary"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,20]]}}},{"id":"bridge-trunk-primary","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["in","class","primary","trunk"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fea","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]}}},{"id":"bridge-motorway","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","motorway"]],"layout":{"line-join":"round"},"paint":{"line-color":"#fc8","line-width":{"base":1.2,"stops":[[6.5,0],[7,0.5],[20,18]]},"line-opacity":0.5}},{"id":"bridge-railway","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-width":{"base":1.4,"stops":[[14,0.4],[15,0.75],[20,2]]}}},{"id":"bridge-railway-hatching","type":"line","metadata":{"mapbox:group":"1444849334699.1902"},"source":"openmaptiles","source-layer":"transportation","filter":["all",["==","brunnel","bridge"],["==","class","rail"]],"paint":{"line-color":"#bbb","line-dasharray":[0.2,8],"line-width":{"base":1.4,"stops":[[14.5,0],[15,3],[20,8]]}}},{"id":"cablecar","type":"line","source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["==","class","cable_car"],"layout":{"visibility":"visible","line-cap":"round"},"paint":{"line-color":"hsl(0, 0%, 70%)","line-width":{"base":1,"stops":[[11,1],[19,2.5]]}}},{"id":"cablecar-dash","type":"line","source":"openmaptiles","source-layer":"transportation","minzoom":13,"filter":["==","class","cable_car"],"layout":{"visibility":"visible","line-cap":"round"},"paint":{"line-color":"hsl(0, 0%, 70%)","line-width":{"base":1,"stops":[[11,3],[19,5.5]]},"line-dasharray":[2,3]}},{"id":"boundary-land-level-4","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",[">=","admin_level",4],["<=","admin_level",8],["!=","maritime",1]],"layout":{"line-join":"round"},"paint":{"line-color":"#9e9cab","line-dasharray":[3,1,1,1],"line-width":{"base":1.4,"stops":[[4,0.4],[5,1],[12,3]]},"line-opacity":0.6}},{"id":"boundary-land-level-2","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["==","admin_level",2],["!=","maritime",1],["!=","disputed",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"hsl(248, 7%, 66%)","line-width":{"base":1,"stops":[[0,0.6],[4,1.4],[5,2],[12,2]]}}},{"id":"boundary-land-disputed","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["!=","maritime",1],["==","disputed",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"hsl(248, 7%, 70%)","line-dasharray":[1,3],"line-width":{"base":1,"stops":[[0,0.6],[4,1.4],[5,2],[12,8]]}}},{"id":"boundary-water","type":"line","source":"openmaptiles","source-layer":"boundary","filter":["all",["in","admin_level",2,4],["==","maritime",1]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-color":"rgba(154, 189, 214, 1)","line-width":{"base":1,"stops":[[0,0.6],[4,1],[5,1],[12,1]]},"line-opacity":{"stops":[[6,0],[10,0]]}}},{"id":"waterway-name","type":"symbol","source":"openmaptiles","source-layer":"waterway","minzoom":13,"filter":["all",["==","$type","LineString"],["has","name"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin} {name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","text-letter-spacing":0.2,"symbol-spacing":350},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-lakeline","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["==","$type","LineString"],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","symbol-spacing":350,"text-letter-spacing":0.2},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-ocean","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["all",["==","$type","Point"],["==","class","ocean"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":0.2},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"water-name-other","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["all",["==","$type","Point"],["!in","class","ocean"]],"layout":{"text-font":["Noto Sans Italic"],"text-size":{"stops":[[0,10],[6,14]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":0.2,"visibility":"visible"},"paint":{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{"id":"poi-level-3","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":16,"filter":["all",["==","$type","Point"],[">=","rank",25]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"poi-level-2","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":15,"filter":["all",["==","$type","Point"],["<=","rank",24],[">=","rank",15]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"poi-level-1","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":14,"filter":["all",["==","$type","Point"],["<=","rank",14],["has","name"]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":11,"text-max-width":9},"paint":{"text-halo-blur":0.5,"text-color":"rgba(191, 228, 172, 1)","text-halo-width":1,"text-halo-color":"rgba(30, 29, 29, 1)"}},{"id":"poi-railway","type":"symbol","source":"openmaptiles","source-layer":"poi","minzoom":13,"filter":["all",["==","$type","Point"],["has","name"],["==","class","railway"],["==","subclass","station"]],"layout":{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":"{name:latin}\\n{name:nonlatin}","text-offset":[0,0.6],"text-size":12,"text-max-width":9,"icon-optional":false,"icon-ignore-placement":false,"icon-allow-overlap":false,"text-ignore-placement":false,"text-allow-overlap":false,"text-optional":true},"paint":{"text-halo-blur":0.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{"id":"road_oneway","type":"symbol","source":"openmaptiles","source-layer":"transportation","minzoom":15,"filter":["all",["==","oneway",1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],"layout":{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":90,"icon-size":{"stops":[[15,0.5],[19,1]]}},"paint":{"icon-opacity":0.5}},{"id":"road_oneway_opposite","type":"symbol","source":"openmaptiles","source-layer":"transportation","minzoom":15,"filter":["all",["==","oneway",-1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],"layout":{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":-90,"icon-size":{"stops":[[15,0.5],[19,1]]}},"paint":{"icon-opacity":0.5}},{"id":"highway-name-path","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":15.5,"filter":["==","class","path"],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-color":"#f8f4f0","text-color":"hsl(30, 23%, 62%)","text-halo-width":0.5}},{"id":"highway-name-minor","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":15,"filter":["all",["==","$type","LineString"],["in","class","minor","service","track"]],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-blur":0.5,"text-color":"#765","text-halo-width":1}},{"id":"highway-name-major","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":12.2,"filter":["in","class","primary","secondary","tertiary","trunk"],"layout":{"text-size":{"base":1,"stops":[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},"paint":{"text-halo-blur":0.5,"text-color":"#765","text-halo-width":1}},{"id":"highway-shield","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":8,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["!in","network","us-interstate","us-highway","us-state"]],"layout":{"text-size":10,"icon-image":"road_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-opacity":1,"text-color":"rgba(20, 19, 19, 1)","text-halo-color":"rgba(230, 221, 221, 0)","text-halo-width":2,"icon-color":"rgba(183, 18, 18, 1)","icon-opacity":0.3,"icon-halo-color":"rgba(183, 55, 55, 0)"}},{"id":"highway-shield-us-interstate","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":7,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-interstate"]],"layout":{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[7,"point"],[7,"line"],[8,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-color":"rgba(0, 0, 0, 1)"}},{"id":"highway-shield-us-other","type":"symbol","source":"openmaptiles","source-layer":"transportation_name","minzoom":9,"filter":["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-highway","us-state"]],"layout":{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{"base":1,"stops":[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},"paint":{"text-color":"rgba(0, 0, 0, 1)"}},{"id":"place-other","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","minzoom":12,"filter":["!in","class","city","town","village","country","continent"],"layout":{"text-letter-spacing":0.1,"text-size":{"base":1.2,"stops":[[12,10],[15,14]]},"text-font":["Noto Sans Bold"],"text-field":"{name:latin}\\n{name:nonlatin}","text-transform":"uppercase","text-max-width":9,"visibility":"visible"},"paint":{"text-color":"rgba(255,255,255,1)","text-halo-width":1.2,"text-halo-color":"rgba(57, 28, 28, 1)"}},{"id":"place-village","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","minzoom":10,"filter":["==","class","village"],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[10,12],[15,16]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(10, 9, 9, 0.8)"}},{"id":"place-town","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["==","class","town"],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[10,14],[15,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(22, 22, 22, 0.8)"}},{"id":"place-city","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["!=","capital",2],["==","class","city"]],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[7,14],[11,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"visibility":"visible"},"paint":{"text-color":"rgba(0, 0, 0, 1)","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-city-capital","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","capital",2],["==","class","city"]],"layout":{"text-font":["Noto Sans Regular"],"text-size":{"base":1.2,"stops":[[7,14],[11,24]]},"text-field":"{name:latin}\\n{name:nonlatin}","text-max-width":8,"icon-image":"star_11","text-offset":[0.4,0],"icon-size":0.8,"text-anchor":"left","visibility":"visible"},"paint":{"text-color":"#333","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-other","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],[">=","rank",3],["!has","iso_a2"]],"layout":{"text-font":["Noto Sans Italic"],"text-field":"{name:latin}","text-size":{"stops":[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-3","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],[">=","rank",3],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-2","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],["==","rank",2],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[2,11],[5,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-country-1","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","filter":["all",["==","class","country"],["==","rank",1],["has","iso_a2"]],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{"stops":[[1,11],[4,17]]},"text-transform":"uppercase","text-max-width":6.25,"visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{"id":"place-continent","type":"symbol","metadata":{"mapbox:group":"1444849242106.713"},"source":"openmaptiles","source-layer":"place","maxzoom":1,"filter":["==","class","continent"],"layout":{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":14,"text-max-width":6.25,"text-transform":"uppercase","visibility":"visible"},"paint":{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}}],"id":"qebnlkra6"}`)},51962:function(p){p.exports=JSON.parse(`{"version":8,"name":"orto","metadata":{},"center":[1.537786,41.837539],"zoom":12,"bearing":0,"pitch":0,"light":{"anchor":"viewport","color":"white","intensity":0.4,"position":[1.15,45,30]},"sources":{"ortoEsri":{"type":"raster","tiles":["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],"tileSize":256,"maxzoom":18,"attribution":"ESRI &copy; <a href='http://www.esri.com'>ESRI</a>"},"ortoInstaMaps":{"type":"raster","tiles":["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],"tileSize":256,"maxzoom":13},"ortoICGC":{"type":"raster","tiles":["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],"tileSize":256,"minzoom":13.1,"maxzoom":20},"openmaptiles":{"type":"vector","url":"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},"sprite":"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1","glyphs":"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","paint":{"background-color":"#F4F9F4"}},{"id":"ortoEsri","type":"raster","source":"ortoEsri","maxzoom":16,"layout":{"visibility":"visible"}},{"id":"ortoICGC","type":"raster","source":"ortoICGC","minzoom":13.1,"maxzoom":19,"layout":{"visibility":"visible"}},{"id":"ortoInstaMaps","type":"raster","source":"ortoInstaMaps","maxzoom":13,"layout":{"visibility":"visible"}}]}`)}},c={};function R(p){var f=c[p];if(f!==void 0)return f.exports;var n=c[p]={id:p,exports:{}};return r[p].call(n.exports,n,n.exports,R),n.exports}return R.m=r,R.n=function(p){var f=p&&p.__esModule?function(){return p.default}:function(){return p};return R.d(f,{a:f}),f},R.d=function(p,f){for(var n in f)R.o(f,n)&&!R.o(p,n)&&Object.defineProperty(p,n,{enumerable:!0,get:f[n]})},R.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),R.o=function(p,f){return Object.prototype.hasOwnProperty.call(p,f)},R.r=function(p){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})},R.b=document.baseURI||self.location.href,R.nc=void 0,R(20260)}()})})(m9);var jq=m9.exports;const nd=f8(jq),Uq={highlightColor:"#E4572E",selectedColor:"#F3A712",unhighlightedColor:"lightblue",highlightHiddenColor:"#1f77b4",annotationBackground:"#f8f8f8"},Hq={xPosScalingFactor:80,xPosScalingThreshold:500,minAnnotationWidth:40},Wq=wg({name:"PlotlyLineplot",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Cg(),e=zy();return{streamlitDataStore:t,selectionStore:e}},data(){return{isInitialized:!1,manualXRange:void 0,lastAutoZoomedPeakIndex:void 0,textMeasureCanvas:null}},computed:{id(){return`plot-${this.index}`},theme(){return this.streamlitDataStore.theme},styling(){return{...Uq,...this.args.styling}},config(){return{...Hq,...this.args.config}},actualPlotWidth(){const t=document.getElementById(this.id);if(t){const e=t.getBoundingClientRect();if(e.width>0)return e.width}return 800},plotConfig(){var t;return(t=this.streamlitDataStore.allDataForDrawing)==null?void 0:t._plotConfig},plotData(){var n;const t=(n=this.streamlitDataStore.allDataForDrawing)==null?void 0:n.plotData;if(!t)return;const e=this.plotConfig,r=(e==null?void 0:e.xColumn)||this.args.xColumn||"x",c=(e==null?void 0:e.yColumn)||this.args.yColumn||"y",R={x_values:t[r]||[],y_values:t[c]||[]},p=(e==null?void 0:e.highlightColumn)||this.args.highlightColumn;p&&t[p]&&(R.highlight_mask=t[p]);const f=(e==null?void 0:e.annotationColumn)||this.args.annotationColumn;if(f&&t[f]&&(R.annotations=t[f]),this.args.interactivity)for(const[s,u]of Object.entries(this.args.interactivity)){const i=u;t[i]&&(R[`interactivity_${i}`]=t[i])}return R},interactivity(){return this.args.interactivity||{}},selectedPeakIndex(){if(!(!this.isDataReady||!this.plotData))for(const[t,e]of Object.entries(this.interactivity)){const r=this.selectionStore.$state[t];if(r==null)continue;const c=`interactivity_${e}`,R=this.plotData[c];if(R&&Array.isArray(R)){for(let p=0;p<R.length;p++)if(R[p]===r)return p}else if(e===this.args.xColumn){const p=this.plotData.x_values;for(let f=0;f<p.length;f++)if(p[f]===r)return f}}},isDataReady(){return this.plotData?Array.isArray(this.plotData.x_values)&&Array.isArray(this.plotData.y_values)&&this.plotData.x_values.length>0:!1},xValuesStick(){if(!this.isDataReady||!this.plotData)return[];const t=[];for(const e of this.plotData.x_values)t.push(e,e,e);return t},yValuesStick(){if(!this.isDataReady||!this.plotData)return[];const t=[],e=-1e7;for(const r of this.plotData.y_values)t.push(e,r,e);return t},xRange(){if(this.manualXRange)return this.manualXRange;if(!this.isDataReady||!this.plotData)return[0,1];const t=this.plotData.x_values,e=Math.min(...t),r=Math.max(...t),c=(r-e)*.02;return[e-c,r+c]},yRange(){if(!this.isDataReady||!this.plotData)return[0,1];const{x_values:t,y_values:e}=this.plotData,r=this.xRange;let c=0;for(let R=0;R<t.length;R++){const p=t[R],f=e[R];p>=r[0]&&p<=r[1]&&f>c&&(c=f)}return c===0?[0,1]:[0,c*1.8]},xPosScalingFactor(){const t=this.xRange,e=t[1]-t[0];return 1200/this.actualPlotWidth*e/this.config.xPosScalingFactor},annotatedPeaks(){if(!this.isDataReady||!this.plotData)return[];const{x_values:t,y_values:e,annotations:r,highlight_mask:c}=this.plotData;if(!r)return[];const R=[];for(let p=0;p<r.length;p++){const f=r[p];!f||f.length===0||c&&!c[p]||R.push({x:t[p],y:e[p],label:f,index:p})}return R},annotationBoxData(){const t=this.annotatedPeaks;if(t.length===0)return[];const e=this.yRange,r=this.xRange;if(e[1]<=0||r[1]<=r[0])return[];const c=e[1]/1.8,R=c*1.18,p=c*1.32,f=p-R,n=16,s=[];for(const b of t){const w=b.x>=r[0]&&b.x<=r[1],v=this.measureTextWidth(b.label),o=this.pixelWidthToDataUnits(v+n);s.push({x:b.x,y:(R+p)/2,width:o,height:f,label:b.label,visible:!1,inVisibleRange:w,index:b.index,peakY:b.y})}const u=s.filter(b=>b.inVisibleRange).sort((b,w)=>w.peakY!==b.peakY?w.peakY-b.peakY:b.x-w.x),i=this.pixelWidthToDataUnits(4),_=[];for(const b of u){const w=b.x-b.width/2-i,v=b.x+b.width/2+i;let o=!1;for(const a of _){const h=a.x-a.width/2,l=a.x+a.width/2;if(!(v<h||w>l)){o=!0;break}}o||(b.visible=!0,_.push(b))}return s},annotationShapes(){const t=this.annotationBoxData,e=[],r=this.yRange;if(r[1]<=0)return e;const c=r[1]/1.8,R=c*1.18,p=c*1.32,f=this.selectedPeakIndex;for(const n of t){if(!n.visible)continue;const u=n.index===f?this.styling.selectedColor:this.styling.highlightColor;e.push({type:"rect",x0:n.x-n.width/2,y0:R,x1:n.x+n.width/2,y1:p,fillcolor:u,line:{width:0}})}return e},peakAnnotations(){const t=this.annotationBoxData,e=[],r=this.yRange;if(r[1]<=0)return e;const R=r[1]/1.8*1.25;for(const p of t)p.visible&&e.push({x:p.x,y:R,xref:"x",yref:"y",text:p.label,showarrow:!1,font:{size:14,color:"white"}});return e},selectedAnnotationHidden(){const t=this.selectedPeakIndex;if(t===void 0)return!1;const r=this.annotationBoxData.find(c=>c.index===t);return r?!r.visible:!1},traces(){if(!this.isDataReady||!this.plotData)return this.getFallbackData();const t=[],{highlight_mask:e}=this.plotData,r=this.selectedPeakIndex,c=-1e7,R=[],p=[],f=[],n=[],s=[],u=[],i=this.plotData.x_values.length;for(let _=0;_<i;_++){const b=this.plotData.x_values[_],w=this.plotData.y_values[_],v=e?e[_]:!1;r!==void 0&&_===r?(s.push(b,b,b),u.push(c,w,c)):v?(f.push(b,b,b),n.push(c,w,c)):(R.push(b,b,b),p.push(c,w,c))}return R.length>0&&t.push({x:R,y:p,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.unhighlightedColor},hoverinfo:"x+y"}),f.length>0&&t.push({x:f,y:n,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.highlightColor},hoverinfo:"x+y"}),s.length>0&&t.push({x:s,y:u,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.selectedColor},line:{width:3},hoverinfo:"x+y"}),t.length===0&&t.push({x:this.xValuesStick,y:this.yValuesStick,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.highlightHiddenColor},hoverinfo:"x+y"}),t},layout(){var t,e,r,c,R;return{title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:!1,height:this.args.height||400,xaxis:{title:this.args.xLabel?{text:this.args.xLabel}:void 0,showgrid:!1,showline:!0,linecolor:"grey",linewidth:1,range:this.xRange},yaxis:{title:this.args.yLabel?{text:this.args.yLabel}:void 0,showgrid:!0,gridcolor:((t=this.theme)==null?void 0:t.secondaryBackgroundColor)||"#f0f0f0",rangemode:"nonnegative",fixedrange:!1,showline:!0,linecolor:"grey",linewidth:1,range:this.yRange},paper_bgcolor:((e=this.theme)==null?void 0:e.backgroundColor)||"white",plot_bgcolor:((r=this.theme)==null?void 0:r.backgroundColor)||"white",font:{color:((c=this.theme)==null?void 0:c.textColor)||"black",family:((R=this.theme)==null?void 0:R.font)||"Arial"},margin:{l:60,r:20,t:this.args.title?50:20,b:50},shapes:this.annotationShapes,annotations:this.peakAnnotations}},cssCustomProperties(){return{"--highlight-color":this.styling.highlightColor,"--selected-color":this.styling.selectedColor,"--unhighlighted-color":this.styling.unhighlightedColor}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.plotData":{handler(t,e){var r,c,R,p;console.log("[LinePlot] plotData changed",{newLength:(r=t==null?void 0:t.x_values)==null?void 0:r.length,oldLength:(c=e==null?void 0:e.x_values)==null?void 0:c.length,newFirstX:(R=t==null?void 0:t.x_values)==null?void 0:R[0],oldFirstX:(p=e==null?void 0:e.x_values)==null?void 0:p[0]}),this.isInitialized&&(this.manualXRange=void 0,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot())},deep:!0},"streamlitDataStore.allDataForDrawing._plotConfig":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},"selectionStore.$state":{handler(t){console.log("[LinePlot] selection changed",t),this.isDataReady&&this.isInitialized&&(this.autoZoomToSelectedAnnotation(),this.renderPlot())},deep:!0}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot()})},methods:{measureTextWidth(t){this.textMeasureCanvas||(this.textMeasureCanvas=document.createElement("canvas"));const e=this.textMeasureCanvas.getContext("2d");return e?(e.font="14px Arial",e.measureText(t).width):t.length*8},pixelWidthToDataUnits(t){const e=this.xRange,r=e[1]-e[0],c=this.actualPlotWidth;return t/(c/r)},async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyLineplot: DOM element with id '${this.id}' not found`);return}const e=[{title:"Download as SVG",name:"toImageSvg",icon:{width:1792,height:1792,path:"M1152 1376v-160q0-14-9-23t-23-9h-96v-512q0-14-9-23t-23-9h-320q-14 0-23 9t-9 23v160q0 14 9 23t23 9h96v320h-96q-14 0-23 9t-9 23v160q0 14 9 23t23 9h320q14 0 23-9t9-23zm-128-896v-160q0-14-9-23t-23-9h-192q-14 0-23 9t-9 23v160q0 14 9 23t23 9h192q14 0 23-9t9-23zm640 416q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"},click:()=>{const c=document.getElementById(this.id);c&&nd.downloadImage(c,{filename:this.args.title||"plot",height:400,width:1200,format:"svg"})}}];await nd.newPlot(this.id,this.traces,this.layout,{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:e,scrollZoom:!0,responsive:!0}),this.$nextTick(()=>{this.args.height?Hc.setFrameHeight(this.args.height):Hc.setFrameHeight()});const r=document.getElementById(this.id);r&&(r.on("plotly_click",c=>{this.onPlotClick(c)}),r.on("plotly_relayout",c=>{this.onRelayout(c)}))}catch(t){console.error("PlotlyLineplot: Error rendering plot:",t),this.renderFallback()}},onRelayout(t){if(t["xaxis.range[0]"]!==void 0&&t["xaxis.range[1]"]!==void 0){const e=[t["xaxis.range[0]"],t["xaxis.range[1]"]];e[0]<0&&(e[0]=0),this.manualXRange=e,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot()}else t["xaxis.autorange"]===!0&&(this.manualXRange=void 0,this.lastAutoZoomedPeakIndex=void 0,this.renderPlot())},autoZoomToSelectedAnnotation(){const t=this.selectedPeakIndex;if(t===void 0){this.lastAutoZoomedPeakIndex=void 0;return}if(t===this.lastAutoZoomedPeakIndex||!this.selectedAnnotationHidden)return;const e=this.calculateZoomForSelectedAnnotation();e&&(this.manualXRange=e,this.lastAutoZoomedPeakIndex=t)},calculateZoomForSelectedAnnotation(){const t=this.selectedPeakIndex;if(t===void 0||!this.plotData)return;const e=this.annotatedPeaks,r=e.find(b=>b.index===t);if(!r)return;let c=1/0,R=1/0;for(const b of e){if(b.index===t)continue;const w=b.x-r.x;w<0&&-w<c?c=-w:w>0&&w<R&&(R=w)}const p=Math.min(c,R);this.actualPlotWidth,this.config.xPosScalingFactor;let f;if(p<1/0)f=p*2;else{const b=this.plotData.x_values;f=(Math.max(...b)-Math.min(...b))*.2}const n=this.plotData.x_values,s=Math.min(...n),u=Math.max(...n);let i=r.x-f/2,_=r.x+f/2;return i<s&&(i=s,_=Math.min(s+f,u)),_>u&&(_=u,i=Math.max(u-f,s)),[i,_]},onPlotClick(t){if(!(!this.interactivity||Object.keys(this.interactivity).length===0)&&t.points&&t.points.length>0){const r=t.points[0].x;if(!this.plotData)return;const c=this.plotData.x_values;let R=0,p=1/0;for(let f=0;f<c.length;f++){const n=Math.abs(c[f]-r);n<p&&(p=n,R=f)}for(const[f,n]of Object.entries(this.interactivity)){const s=`interactivity_${n}`,u=this.plotData[s];u&&Array.isArray(u)&&R<u.length?this.selectionStore.updateSelection(f,u[R]):n===this.args.xColumn&&this.selectionStore.updateSelection(f,c[R])}}},getFallbackData(){return[{x:[0,1],y:[0,0],mode:"lines",type:"scatter",marker:{color:this.styling.unhighlightedColor},name:"No Data"}]},async renderFallback(){var t,e,r,c;try{const R={title:{text:"<b>No Data Available</b>"},showlegend:!1,height:400,xaxis:{title:{text:"X"},showgrid:!1},yaxis:{title:{text:"Y"},showgrid:!0,rangemode:"nonnegative"},paper_bgcolor:((t=this.theme)==null?void 0:t.backgroundColor)||"white",plot_bgcolor:((e=this.theme)==null?void 0:e.backgroundColor)||"white",font:{color:((r=this.theme)==null?void 0:r.textColor)||"black",family:((c=this.theme)==null?void 0:c.font)||"Arial"}};await nd.newPlot(this.id,this.getFallbackData(),R,{staticPlot:!0})}catch(R){console.error("PlotlyLineplot: Failed to render fallback:",R)}}}}),qq=["id"];function Gq(t,e,r,c,R,p){return Va(),vo("div",{id:t.id,class:"plot-container",style:ii(t.cssCustomProperties)},null,12,qq)}const h6=Vv(Wq,[["render",Gq],["__scopeId","data-v-322c72ba"]]);function v9(t){const{id:e,interactivity:r,getData:c,title:R,narrowThreshold:p=600}=t,f=Cg(),n=zy(),s=qr(800),u=qr(null),i=rn(()=>s.value<p),_=rn(()=>f.theme),b=rn(()=>{var l,m,y,x;return{paper_bgcolor:((l=_.value)==null?void 0:l.backgroundColor)||"white",plot_bgcolor:((m=_.value)==null?void 0:m.secondaryBackgroundColor)||"#f5f5f5",font:{color:((y=_.value)==null?void 0:y.textColor)||"black",family:((x=_.value)==null?void 0:x.font)||"Arial"}}});function w(){const l=document.getElementById(e.value);l&&window.ResizeObserver&&(u.value=new ResizeObserver(m=>{for(const y of m){const x=y.contentRect.width;Math.abs(x-s.value)>10&&(s.value=x)}}),u.value.observe(l))}function v(){u.value&&(u.value.disconnect(),u.value=null)}function o(l){const m=[{title:"Download as SVG",name:"toImageSvg",icon:nd.Icons.camera,click:y=>{nd.downloadImage(y,{filename:(R==null?void 0:R.value)||"plot",height:400,width:1200,format:"svg"})}},...l||[]];return{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:m,scrollZoom:!0,responsive:!0}}function a(){const l=document.getElementById(e.value);l&&l.on("plotly_click",m=>{const y=r.value;if(!(!y||Object.keys(y).length===0)&&m.points&&m.points.length>0){const x=m.points[0].pointIndex,C=c()[x];if(C)for(const[A,E]of Object.entries(y)){const P=C[E];P!==void 0&&n.updateSelection(A,P)}}})}function h(){Hc.setFrameHeight()}return{plotWidth:s,isNarrowPlot:i,theme:_,themeLayout:b,setupResizeObserver:w,cleanupResizeObserver:v,getPlotConfig:o,setupClickHandler:a,updateFrameHeight:h,selectionStore:n}}const $q=wg({name:"PlotlyHeatmap",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(t){const e=Cg(),r=v9({id:rn(()=>`heatmap-${t.index}`),interactivity:rn(()=>t.args.interactivity||{}),getData:()=>{var R;return((R=e.allDataForDrawing)==null?void 0:R.heatmapData)||[]},title:rn(()=>t.args.title)});return{streamlitDataStore:e,...r}},data(){return{isInitialized:!1,zoomRange:void 0,colorbarVisible:!0,userOverrideColorbar:!1,heatmapResizeObserver:null,zoomDebounceTimer:null,pendingZoomRange:void 0,zoomThrottleTimer:null,lastZoomUpdateTime:0,plotInitialized:!1}},computed:{id(){return`heatmap-${this.index}`},effectiveColorbarVisible(){return this.userOverrideColorbar?this.colorbarVisible:this.isNarrowPlot?!1:this.colorbarVisible},heatmapData(){var e;return((e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e.heatmapData)||[]},interactivity(){return this.args.interactivity||{}},isDataReady(){return Array.isArray(this.heatmapData)&&this.heatmapData.length>0},xValues(){if(!this.isDataReady)return[];const t=this.args.xColumn;return this.heatmapData.map(e=>e[t])},yValues(){if(!this.isDataReady)return[];const t=this.args.yColumn;return this.heatmapData.map(e=>e[t])},intensityValues(){if(!this.isDataReady)return[];const t=this.args.intensityColumn;return this.heatmapData.map(e=>e[t])},logIntensityValues(){return this.intensityValues.map(t=>t>0?Math.log10(t):0)},isLogScale(){return this.args.logScale!==!1},effectiveColorValues(){return this.isLogScale?this.logIntensityValues:this.intensityValues},colorbarLabel(){return this.args.intensityLabel||"Intensity"},isCategoricalMode(){return!!this.args.categoryColumn},categoryValues(){return!this.isDataReady||!this.args.categoryColumn?[]:this.heatmapData.map(t=>t[this.args.categoryColumn])},uniqueCategories(){if(!this.isCategoricalMode)return[];const t=new Set,e=[];for(const r of this.categoryValues)t.has(r)||(t.add(r),e.push(r));return e},defaultCategoryColors(){return["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"]},getCategoryColor(){const t=this.args.categoryColors||{},e=this.defaultCategoryColors;return r=>{const c=String(r);if(t[c])return t[c];const R=this.uniqueCategories.indexOf(r);return e[R%e.length]}},xRange(){const t=this.zoomRange;if(t&&!(t.xRange[0]<0&&t.xRange[1]<0))return t.xRange},yRange(){const t=this.zoomRange;if(t&&!(t.yRange[0]<0&&t.yRange[1]<0))return t.yRange},colorbarTicks(){if(!this.isLogScale)return null;const t=this.intensityValues.filter(f=>f>0);if(t.length===0)return{tickvals:[0],ticktext:["0"]};const e=Math.min(...t),r=Math.max(...t),c=Math.floor(Math.log10(e)),R=Math.ceil(Math.log10(r)),p=Array.from({length:R-c+1},(f,n)=>Math.pow(10,c+n));return{tickvals:p.map(f=>Math.log10(f)),ticktext:p.map(f=>f.toExponential(0))}},data(){if(!this.isDataReady)return this.getFallbackData();if(this.isCategoricalMode)return this.buildCategoricalTraces();const t=this.colorbarTicks,e={title:{text:this.colorbarLabel}};return t&&(e.tickvals=t.tickvals,e.ticktext=t.ticktext,e.tickmode="array"),[{type:"scattergl",name:"points",x:this.xValues,y:this.yValues,mode:"markers",marker:{color:this.effectiveColorValues,colorscale:this.args.colorscale||"Portland",reversescale:this.args.reversescale??!1,showscale:this.effectiveColorbarVisible,colorbar:e},hovertext:this.intensityValues.map(r=>r.toExponential(2)),hoverinfo:"x+y+text"}]},layout(){const t=this.isCategoricalMode,e=this.isCategoricalMode||this.effectiveColorbarVisible;return{...this.themeLayout,title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:t,legend:t?{x:1.02,y:1,xanchor:"left",yanchor:"top",bgcolor:"rgba(255, 255, 255, 0.8)",bordercolor:"#ccc",borderwidth:1}:void 0,height:this.args.height||400,xaxis:{title:this.args.xLabel?{text:this.args.xLabel}:void 0,range:this.xRange},yaxis:{title:this.args.yLabel?{text:this.args.yLabel}:void 0,range:this.yRange},margin:{l:60,r:e?120:20,t:this.args.title?60:20,b:60}}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.heatmapData":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},zoomRange:{handler(){if(this.zoomRange===void 0)return;const t=this.args.zoomIdentifier||"heatmap_zoom";this.selectionStore.updateSelection(t,this.zoomRange)},deep:!0}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot(),this.setupHeatmapResizeObserver()})},beforeUnmount(){this.zoomDebounceTimer&&(clearTimeout(this.zoomDebounceTimer),this.zoomDebounceTimer=null),this.zoomThrottleTimer&&(clearTimeout(this.zoomThrottleTimer),this.zoomThrottleTimer=null),this.plotInitialized=!1,this.cleanupHeatmapResizeObserver()},methods:{buildCategoricalTraces(){const t=this.getCategoryColor,e=[];for(const r of this.uniqueCategories){const c=[];for(let n=0;n<this.categoryValues.length;n++)this.categoryValues[n]===r&&c.push(n);const R=c.map(n=>this.xValues[n]),p=c.map(n=>this.yValues[n]),f=c.map(n=>this.intensityValues[n].toExponential(2));e.push({type:"scattergl",name:String(r),x:R,y:p,mode:"markers",marker:{color:t(r),size:6},hovertext:f,hoverinfo:"x+y+text"})}return e},async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyHeatmap: DOM element with id '${this.id}' not found`);return}this.plotInitialized?(console.debug("[PlotlyHeatmap] renderPlot: using Plotly.react() (update)"),await nd.react(this.id,this.data,this.layout,this.getHeatmapPlotConfig())):(console.debug("[PlotlyHeatmap] renderPlot: using Plotly.newPlot() (first render)"),await nd.newPlot(this.id,this.data,this.layout,this.getHeatmapPlotConfig()),this.setupPlotEventHandlers(),this.plotInitialized=!0),this.$nextTick(()=>{this.updateFrameHeight()})}catch(t){console.error("PlotlyHeatmap: Error rendering plot:",t),this.plotInitialized=!1,this.renderFallback()}},getHeatmapPlotConfig(){const t={title:"Toggle Colorbar",name:"toggleColorbar",icon:{width:1792,height:1792,path:"M1408 768v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V768q0-40 28-68t68-28h832q40 0 68 28t28 68zm0-384v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V384q0-40 28-68t68-28h832q40 0 68 28t28 68zm0-384v192q0 40-28 68t-68 28H480q-40 0-68-28t-28-68V0q0-40 28-68t68-28h832q40 0 68 28t28 68z",transform:"matrix(1 0 0 -1 0 1792)"},click:()=>{this.toggleColorbar()}};return this.getPlotConfig([t])},setupPlotEventHandlers(){const t=document.getElementById(this.id);t&&(t.on("plotly_relayout",e=>{let r;e["xaxis.autorange"]?r={xRange:[-1,-1],yRange:[-1,-1]}:e["xaxis.range[0]"]!==void 0&&e["xaxis.range[1]"]!==void 0&&e["yaxis.range[0]"]!==void 0&&e["yaxis.range[1]"]!==void 0&&(r={xRange:[e["xaxis.range[0]"],e["xaxis.range[1]"]],yRange:[e["yaxis.range[0]"],e["yaxis.range[1]"]]}),r&&!this.zoomRangesEqual(r,this.zoomRange)&&(this.pendingZoomRange=r,this.debouncedUpdateZoom())}),this.setupClickHandler())},debouncedUpdateZoom(){this.zoomDebounceTimer&&(clearTimeout(this.zoomDebounceTimer),console.debug("[PlotlyHeatmap] Zoom debounced (timer reset)")),this.zoomThrottleTimer&&(clearTimeout(this.zoomThrottleTimer),this.zoomThrottleTimer=null,console.debug("[PlotlyHeatmap] Throttle timer cancelled (user still interacting)")),this.zoomDebounceTimer=setTimeout(()=>{this.zoomDebounceTimer=null;const c=Date.now()-this.lastZoomUpdateTime;if(c>=500)this.applyZoomUpdate();else{this.zoomThrottleTimer&&clearTimeout(this.zoomThrottleTimer);const R=500-c;console.debug(`[PlotlyHeatmap] Throttling zoom update, waiting ${R}ms`),this.zoomThrottleTimer=setTimeout(()=>{this.zoomThrottleTimer=null,this.applyZoomUpdate()},R)}},150)},applyZoomUpdate(){this.pendingZoomRange&&(console.debug("[PlotlyHeatmap] Applying zoom update:",this.pendingZoomRange),this.lastZoomUpdateTime=Date.now(),this.zoomRange=this.pendingZoomRange,this.pendingZoomRange=void 0)},zoomRangesEqual(t,e){return t===e?!0:!t||!e?!1:t.xRange[0]===e.xRange[0]&&t.xRange[1]===e.xRange[1]&&t.yRange[0]===e.yRange[0]&&t.yRange[1]===e.yRange[1]},async toggleColorbar(){this.colorbarVisible=!this.colorbarVisible,this.userOverrideColorbar=!0,await this.updatePlot()},async updatePlot(){const t=document.getElementById(this.id);if(t)try{await nd.restyle(t,{"marker.showscale":this.effectiveColorbarVisible},[0]),await nd.relayout(t,{margin:{r:this.effectiveColorbarVisible?120:20}})}catch{}},setupHeatmapResizeObserver(){const t=document.getElementById(this.id);t&&window.ResizeObserver&&(this.heatmapResizeObserver=new ResizeObserver(e=>{for(const r of e){const c=r.contentRect.width;if(Math.abs(c-this.plotWidth)>10){const R=this.isNarrowPlot;this.plotWidth=c;const p=this.isNarrowPlot;R!==p&&!this.userOverrideColorbar&&(this.colorbarVisible=!p,this.updatePlot())}}}),this.heatmapResizeObserver.observe(t))},cleanupHeatmapResizeObserver(){this.heatmapResizeObserver&&(this.heatmapResizeObserver.disconnect(),this.heatmapResizeObserver=null)},getFallbackData(){return[{type:"scattergl",x:[0],y:[0],mode:"markers",marker:{color:"grey"},name:"No Data"}]},async renderFallback(){try{const t={...this.themeLayout,title:{text:"<b>No Data Available</b>"},showlegend:!1,xaxis:{title:{text:"X"}},yaxis:{title:{text:"Y"}}};await nd.newPlot(this.id,this.getFallbackData(),t,{staticPlot:!0})}catch(t){console.error("PlotlyHeatmap: Failed to render fallback:",t)}}}}),Yq=["id"];function Zq(t,e,r,c,R,p){return Va(),vo("div",{id:t.id,class:"heatmap-container"},null,8,Yq)}const f6=Vv($q,[["render",Zq],["__scopeId","data-v-ba3d5702"]]);function d6(t,e,r,c){return e>=c?"ns":t>=r?"up":t<=-r?"down":"ns"}const Xq=wg({name:"PlotlyVolcano",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(t){const e=Cg(),r=v9({id:rn(()=>`volcano-${t.index}`),interactivity:rn(()=>t.args.interactivity||{}),getData:()=>{var R;return((R=e.allDataForDrawing)==null?void 0:R.volcanoData)||[]},title:rn(()=>t.args.title)});return{streamlitDataStore:e,...r}},data(){return{isInitialized:!1}},computed:{id(){return`volcano-${this.index}`},volcanoData(){var e;return((e=this.streamlitDataStore.allDataForDrawing)==null?void 0:e.volcanoData)||[]},isDataReady(){return Array.isArray(this.volcanoData)&&this.volcanoData.length>0},fcThreshold(){return this.args.fcThreshold??1},pThreshold(){return this.args.pThreshold??.05},neglog10PThreshold(){return this.pThreshold>0?-Math.log10(this.pThreshold):0},categorizedData(){const t={x:[],y:[],text:[],indices:[]},e={x:[],y:[],text:[],indices:[]},r={x:[],y:[],text:[],indices:[]},c=this.args.log2fcColumn,R=this.args.neglog10pColumn,p=this.args.pvalueColumn,f=this.args.labelColumn;return this.volcanoData.forEach((n,s)=>{const u=Number(n[c])||0,i=Number(n[R])||0,_=Number(n[p])||1,b=f?String(n[f]||""):"",w=f?`${b}<br>log2FC: ${u.toFixed(3)}<br>p-value: ${_.toExponential(2)}`:`log2FC: ${u.toFixed(3)}<br>p-value: ${_.toExponential(2)}`,v=d6(u,_,this.fcThreshold,this.pThreshold);v==="up"?(t.x.push(u),t.y.push(i),t.text.push(w),t.indices.push(s)):v==="down"?(e.x.push(u),e.y.push(i),e.text.push(w),e.indices.push(s)):(r.x.push(u),r.y.push(i),r.text.push(w),r.indices.push(s))}),{up:t,down:e,ns:r}},plotData(){if(!this.isDataReady)return this.getFallbackData();const{up:t,down:e,ns:r}=this.categorizedData,c=[];return r.x.length>0&&c.push({type:"scattergl",name:"Not significant",x:r.x,y:r.y,mode:"markers",marker:{color:this.args.nsColor||"#95A5A6",size:6,opacity:.6},text:r.text,hoverinfo:"text",customdata:r.indices}),e.x.length>0&&c.push({type:"scattergl",name:"Down-regulated",x:e.x,y:e.y,mode:"markers",marker:{color:this.args.downColor||"#3498DB",size:8},text:e.text,hoverinfo:"text",customdata:e.indices}),t.x.length>0&&c.push({type:"scattergl",name:"Up-regulated",x:t.x,y:t.y,mode:"markers",marker:{color:this.args.upColor||"#E74C3C",size:8},text:t.text,hoverinfo:"text",customdata:t.indices}),c},thresholdShapes(){if(!this.args.showThresholdLines)return[];const t=this.args.thresholdLineStyle||"dash",e=[];return e.push({type:"line",xref:"paper",yref:"y",x0:0,x1:1,y0:this.neglog10PThreshold,y1:this.neglog10PThreshold,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e.push({type:"line",xref:"x",yref:"paper",x0:this.fcThreshold,x1:this.fcThreshold,y0:0,y1:1,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e.push({type:"line",xref:"x",yref:"paper",x0:-this.fcThreshold,x1:-this.fcThreshold,y0:0,y1:1,line:{color:"rgba(100, 100, 100, 0.5)",width:1.5,dash:t}}),e},pointAnnotations(){if(!this.args.labelColumn)return[];const t=this.args.maxLabels??10;if(t<=0)return[];const e=this.args.labelColumn,r=this.args.log2fcColumn,c=this.args.neglog10pColumn,R=this.args.pvalueColumn,p=[];return this.volcanoData.forEach(n=>{const s=Number(n[r])||0,u=Number(n[R])||1,i=Number(n[c])||0,_=String(n[e]||"");d6(s,u,this.fcThreshold,this.pThreshold)!=="ns"&&_&&p.push({label:_,log2fc:s,neglog10p:i})}),p.sort((n,s)=>s.neglog10p-n.neglog10p),p.slice(0,t).map(n=>{var s;return{x:n.log2fc,y:n.neglog10p,text:n.label,showarrow:!0,arrowhead:0,arrowsize:.5,arrowwidth:1,arrowcolor:"rgba(100, 100, 100, 0.5)",ax:0,ay:-25,font:{size:10,color:((s=this.theme)==null?void 0:s.textColor)||"black"},bgcolor:"rgba(255, 255, 255, 0.8)",borderpad:2}})},layout(){return{...this.themeLayout,title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:!0,legend:{orientation:"h",yanchor:"bottom",y:1.02,xanchor:"right",x:1},height:this.args.height||400,xaxis:{title:{text:this.args.xLabel||"log2 Fold Change"},zeroline:!0,zerolinecolor:"rgba(150, 150, 150, 0.3)",zerolinewidth:1},yaxis:{title:{text:this.args.yLabel||"-log10(p-value)"},rangemode:"tozero"},shapes:this.thresholdShapes,annotations:this.pointAnnotations,margin:{l:60,r:20,t:this.args.title?80:40,b:60}}}},watch:{isDataReady:{handler(t){t&&this.isInitialized&&this.renderPlot()},immediate:!0},"streamlitDataStore.allDataForDrawing.volcanoData":{handler(){this.isInitialized&&this.renderPlot()},deep:!0},fcThreshold(){this.isInitialized&&this.isDataReady&&this.renderPlot()},pThreshold(){this.isInitialized&&this.isDataReady&&this.renderPlot()}},mounted(){this.isInitialized=!0,this.$nextTick(()=>{this.isDataReady&&this.renderPlot(),this.setupResizeObserver()})},beforeUnmount(){this.cleanupResizeObserver()},methods:{async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyVolcano: DOM element with id '${this.id}' not found`);return}await nd.newPlot(this.id,this.plotData,this.layout,this.getPlotConfig()),this.setupClickHandler(),this.$nextTick(()=>{this.updateFrameHeight()})}catch(t){console.error("PlotlyVolcano: Error rendering plot:",t),this.renderFallback()}},getFallbackData(){return[{type:"scattergl",x:[0],y:[0],mode:"markers",marker:{color:"grey"},name:"No Data"}]},async renderFallback(){try{const t={...this.themeLayout,title:{text:"<b>No Data Available</b>"},showlegend:!1,xaxis:{title:{text:"log2 Fold Change"}},yaxis:{title:{text:"-log10(p-value)"}}};await nd.newPlot(this.id,this.getFallbackData(),t,{staticPlot:!0})}catch(t){console.error("PlotlyVolcano: Failed to render fallback:",t)}}}}),Kq=["id"];function Jq(t,e,r,c,R,p){return Va(),vo("div",{id:t.id,class:"volcano-container"},null,8,Kq)}const p6=Vv(Xq,[["render",Jq],["__scopeId","data-v-1837a4fb"]]),Qq=wg({name:"AminoAcidCell",props:{sequenceObject:{type:Object,required:!0},index:{type:Number,required:!0},sequenceLength:{type:Number,required:!0},fixedModification:{type:Boolean,default:!1},showFragments:{type:Boolean,default:!0},fontSize:{type:Number,default:12},isHighlighted:{type:Boolean,default:!1},modification:{type:Number,default:null}},emits:["selected"],setup(){return{streamlitData:Cg()}},computed:{id(){return`aa-${this.aminoAcid}-${this.index}`},theme(){return this.streamlitData.theme},aminoAcid(){return this.sequenceObject.aminoAcid},prefix(){return this.index+1},suffix(){return this.sequenceLength-this.index},hasExtraFragTypes(){return this.sequenceObject.extraTypes.length>0},hasMatchingFragments(){return this.sequenceObject.aIon||this.sequenceObject.bIon||this.sequenceObject.cIon||this.sequenceObject.xIon||this.sequenceObject.yIon||this.sequenceObject.zIon},aminoAcidCellClass(){return{"sequence-amino-acid":!this.fixedModification,"sequence-amino-acid-highlighted":this.fixedModification}},cellStyles(){var e,r,c,R,p;const t=((e=this.theme)==null?void 0:e.base)==="dark";return{"--amino-acid-cell-color":((r=this.theme)==null?void 0:r.textColor)??"#000","--amino-acid-cell-bg-color":((c=this.theme)==null?void 0:c.secondaryBackgroundColor)??"#f0f0f0","--amino-acid-cell-hover-color":((R=this.theme)==null?void 0:R.textColor)??"#000","--amino-acid-cell-hover-bg-color":((p=this.theme)==null?void 0:p.backgroundColor)??"#fff","--amino-acid-font-size":`${this.fontSize}px`,"--mod-mass-bg-color":t?"#e0e0e0":"#fff","--mod-mass-text-color":"#000","--mod-mass-border-color":t?"#666":"#a79c91","--mod-marker-dot-color":t?"rgba(150, 150, 220, 0.8)":"#676a9c","--mod-marker-bg-color":t?"rgba(180, 180, 220, 0.3)":"#e5e5f7","--extra-frag-stroke":t?"rgba(255, 255, 255, 0.5)":"black",position:"relative"}},modificationDisplay(){if(this.modification===null)return"";const t=this.modification;return t>=0?`+${t.toFixed(2)}`:t.toFixed(2)}},methods:{selectCell(){this.hasMatchingFragments&&this.$emit("selected",this.index)}}}),eG=["id"],tG={key:0,class:"frag-marker-container frag-marker-a"},nG={key:1,class:"frag-marker-container frag-marker-b"},rG={key:2,class:"frag-marker-container frag-marker-c"},iG={key:3,class:"frag-marker-container frag-marker-x"},aG={key:4,class:"frag-marker-container frag-marker-y"},oG={key:5,class:"frag-marker-container frag-marker-z"},sG={key:6,class:"rounded-lg mod-marker mod-start"},lG={key:7,class:"rounded-lg mod-marker mod-end"},uG={key:8,class:"rounded-lg mod-mass"},cG={key:9,class:"rounded-lg mod-mass-a"},hG={key:10,class:"rounded-lg mod-mass-b"},fG={key:11,class:"rounded-lg mod-mass-c"},dG={key:12,class:"frag-marker-extra-type"},pG={class:"aa-text"},mG={key:0},gG={key:1},vG={key:2};function yG(t,e,r,c,R,p){const f=iu("v-tooltip");return Va(),vo("div",{id:t.id,class:jr(["d-flex justify-center align-center rounded-lg",[t.aminoAcidCellClass,{highlighted:t.isHighlighted},{"fixed-mod":t.fixedModification}]]),style:ii(t.cellStyles),onClick:e[0]||(e[0]=(...n)=>t.selectCell&&t.selectCell(...n))},[t.showFragments&&t.sequenceObject.aIon?(Va(),vo("div",tG,[...e[1]||(e[1]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"green",d:"M7, 1 L9, 3 L9, 7 L9, 3 L7, 1 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.bIon?(Va(),vo("div",nG,[...e[2]||(e[2]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"blue",d:"M10, 0 V5 M10, 0 H5 z","stroke-width":"3"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.cIon?(Va(),vo("div",rG,[...e[3]||(e[3]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"red",d:"M4, 1 L9, 3 L9, 7 L9, 3 L4, 1 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.xIon?(Va(),vo("div",iG,[...e[4]||(e[4]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"green",d:"M1, 3 L1, 7 L3, 9 L1, 7 L1, 3 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.yIon?(Va(),vo("div",aG,[...e[5]||(e[5]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"blue",d:"M0, 10 V5 M0, 10 H5 z","stroke-width":"3"})],-1)])])):wl("",!0),t.showFragments&&t.sequenceObject.zIon?(Va(),vo("div",oG,[...e[6]||(e[6]=[en("svg",{viewBox:"0 0 10 10"},[en("path",{stroke:"red",d:"M1, 3 L1, 7 L6, 9 L1, 7 L1, 3 z","stroke-width":"1.5"})],-1)])])):wl("",!0),t.modification!==null?(Va(),vo("div",sG)):wl("",!0),t.modification!==null?(Va(),vo("div",lG)):wl("",!0),t.modification!==null?(Va(),vo("div",uG,[Fs(Bs(t.modificationDisplay)+" ",1),Qt(f,{activator:"parent",class:"foreground"},{default:ds(()=>[Fs(" Modification Mass: "+Bs(t.modificationDisplay)+" Da ",1)]),_:1})])):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.aIon&&!t.sequenceObject.bIon?(Va(),vo("div",cG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.bIon?(Va(),vo("div",hG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.cIon&&!t.sequenceObject.bIon?(Va(),vo("div",fG,Bs(t.modificationDisplay),1)):wl("",!0),t.hasExtraFragTypes?(Va(),vo("div",dG,[...e[7]||(e[7]=[en("svg",{viewBox:"0 0 10 10"},[en("circle",{cx:"5",cy:"5",r:"0.5",class:"extra-frag-circle","stroke-width":"0.3",fill:"gold"})],-1)])])):wl("",!0),en("div",pG,Bs(t.aminoAcid),1),Qt(f,{activator:"parent"},{default:ds(()=>[en("div",null,"Position: "+Bs(t.index+1),1),t.prefix!==void 0?(Va(),vo("div",mG,"Prefix: "+Bs(t.prefix),1)):wl("",!0),t.suffix!==void 0?(Va(),vo("div",gG,"Suffix: "+Bs(t.suffix),1)):wl("",!0),t.hasExtraFragTypes?(Va(),vo("div",vG,Bs(t.sequenceObject.extraTypes.join(", ")),1)):wl("",!0)]),_:1})],14,eG)}const bG=Vv(Qq,[["render",yG],["__scopeId","data-v-3401e0d8"]]),xG={default:[{typeName:"",typeMass:0}],"water loss":[{typeName:"-H2O",typeMass:-18.0105646863}],"ammonium loss":[{typeName:"-NH3",typeMass:-17.0265491015}],"proton loss/addition":[{typeName:"-H",typeMass:-1.0078250319},{typeName:"+H",typeMass:1.0078250319}]},_G=1.007276,wG={0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function TG(t){return String(t).split("").map(e=>wG[e]||e).join("")}const kG=wg({name:"SequenceView",components:{AminoAcidCell:bG},props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Cg(),e=zy();return{streamlitDataStore:t,selectionStore:e}},data(){return{rowWidth:35,fontSize:12,autoZoomApplied:!1,showFragments:!0,ionTypes:[{text:"a",selected:!1},{text:"b",selected:!0},{text:"c",selected:!1},{text:"x",selected:!1},{text:"y",selected:!0},{text:"z",selected:!1}],ionTypesExtra:{"water loss":!1,"ammonium loss":!1,"proton loss/addition":!1},fragmentMassTolerance:10,toleranceIsPpm:!0,useExternalAnnotations:!0,sequenceObjects:[],fragmentTableData:[],selectedAAIndex:void 0,selectedFragmentRowIndex:void 0,copySnackbar:!1,copySnackbarText:""}},computed:{containerStyle(){return{height:`${this.args.height||400}px`,overflowY:"auto"}},theme(){return this.streamlitDataStore.theme},sequenceData(){return this.streamlitDataStore.allDataForDrawing.sequenceData},observedMasses(){return this.streamlitDataStore.allDataForDrawing.observedMasses??[]},peakIds(){return this.streamlitDataStore.allDataForDrawing.peakIds},precursorMass(){return this.streamlitDataStore.allDataForDrawing.precursorMass??0},interactivity(){return this.args.interactivity??{}},deconvolved(){return this.args.deconvolved??!0},maxCharge(){var t;return((t=this.streamlitDataStore.allDataForDrawing)==null?void 0:t.precursorCharge)??1},sequence(){var t;return((t=this.sequenceData)==null?void 0:t.sequence)??[]},modifications(){var t;return((t=this.sequenceData)==null?void 0:t.modifications)??[]},theoreticalMass(){var t;return((t=this.sequenceData)==null?void 0:t.theoretical_mass)??0},fixedModificationSites(){var t;return((t=this.sequenceData)==null?void 0:t.fixed_modifications)??[]},externalAnnotations(){var t;return((t=this.sequenceData)==null?void 0:t.external_annotations)??[]},hasExternalAnnotations(){return this.externalAnnotations.length>0},defaultTolerance(){var t;return((t=this.sequenceData)==null?void 0:t.fragment_tolerance)??10},defaultToleranceIsPpm(){var t;return((t=this.sequenceData)==null?void 0:t.fragment_tolerance_ppm)??!0},gridClasses(){return{"sequence-grid":!0,[`grid-width-${this.rowWidth}`]:!0}},residueCleavagePercentage(){if(this.sequenceObjects.length<=1)return 0;let t=0;for(let e=0;e<this.sequenceObjects.length-1;e++){const r=this.sequenceObjects[e],c=this.sequenceObjects[e+1];(r.aIon||r.bIon||r.cIon||c.xIon||c.yIon||c.zIon)&&t++}return t/(this.sequence.length-1)*100},fragmentTableHeaders(){const t=[{title:"Name",key:"Name",sortable:!0},{title:"Ion Type",key:"IonType",sortable:!0},{title:"Ion #",key:"IonNumber",sortable:!0}];return this.deconvolved||t.push({title:"z",key:"Charge",sortable:!0}),t.push({title:this.deconvolved?"Theo. Mass":"Theo. m/z",key:"TheoreticalMass",sortable:!0},{title:this.deconvolved?"Obs. Mass":"Obs. m/z",key:"ObservedMass",sortable:!0},{title:"Δ Da",key:"MassDiffDa",sortable:!0},{title:"Δ ppm",key:"MassDiffPpm",sortable:!0}),t}},watch:{sequenceData:{handler(t,e){var R,p,f,n,s,u;const r=((R=t==null?void 0:t.sequence)==null?void 0:R.join(""))??"",c=((p=e==null?void 0:e.sequence)==null?void 0:p.join(""))??"";r!==c&&(this.autoZoomApplied=!1),this.initializeSequenceObjects(),this.applyAutoZoom(),((f=this.sequenceData)==null?void 0:f.fragment_tolerance)!==void 0&&(this.fragmentMassTolerance=this.sequenceData.fragment_tolerance),((n=this.sequenceData)==null?void 0:n.fragment_tolerance_ppm)!==void 0&&(this.toleranceIsPpm=this.sequenceData.fragment_tolerance_ppm),((s=this.sequenceData)==null?void 0:s.neutral_losses)!==void 0&&(this.ionTypesExtra["water loss"]=this.sequenceData.neutral_losses,this.ionTypesExtra["ammonium loss"]=this.sequenceData.neutral_losses),((u=this.sequenceData)==null?void 0:u.proton_loss_addition)!==void 0&&(this.ionTypesExtra["proton loss/addition"]=this.sequenceData.proton_loss_addition),this.matchFragments()},immediate:!0,deep:!0},observedMasses:{handler(){this.matchFragments()},deep:!0},ionTypes:{handler(){this.resetFragmentMarkers(),this.matchFragments()},deep:!0},ionTypesExtra:{handler(){this.resetFragmentMarkers(),this.matchFragments()},deep:!0},fragmentMassTolerance(){this.resetFragmentMarkers(),this.matchFragments()},toleranceIsPpm(){this.resetFragmentMarkers(),this.matchFragments()},useExternalAnnotations(){this.resetFragmentMarkers(),this.matchFragments()}},methods:{initializeSequenceObjects(){this.sequenceObjects=[];for(const t of this.sequence)this.sequenceObjects.push({aminoAcid:t,aIon:!1,bIon:!1,cIon:!1,xIon:!1,yIon:!1,zIon:!1,extraTypes:[]})},applyAutoZoom(){if(this.autoZoomApplied)return;const t=20,e=16;this.sequence.length>0&&this.sequence.length<=t&&(this.rowWidth=t,this.fontSize=e),this.autoZoomApplied=!0},resetFragmentMarkers(){for(const t of this.sequenceObjects)t.aIon=!1,t.bIon=!1,t.cIon=!1,t.xIon=!1,t.yIon=!1,t.zIon=!1,t.extraTypes=[]},getFragmentMasses(t){if(!this.sequenceData)return[];const e=`fragment_masses_${t}`;return this.sequenceData[e]??[]},isWithinTolerance(t,e){return this.toleranceIsPpm?Math.abs(t/e*1e6)<=this.fragmentMassTolerance:Math.abs(t)<=this.fragmentMassTolerance},markAminoAcidPosition(t,e,r){const c=this.sequence.length,p=["a","b","c"].includes(t)?e-1:c-e;if(p>=0&&p<this.sequenceObjects.length){const f=this.sequenceObjects[p],n=`${t}Ion`;f[n]=!0,r&&f.extraTypes.push(`${t}${r}`)}},matchFragmentsExternal(){const t=[];for(const e of this.externalAnnotations){let r=null,c=-1,R=1/0;for(let i=0;i<this.observedMasses.length;i++){const _=this.observedMasses[i],b=Math.abs(_-e.mz);b<R&&(R=b,r=_,c=i)}if(r===null)continue;const p=r-e.mz,f=p/e.mz*1e6;if(!this.isWithinTolerance(p,e.mz))continue;let n=0;const s=e.annotation.match(/[a-z](\d+)/i);s&&(n=parseInt(s[1],10));const u={Name:e.annotation,IonType:e.ion_type,IonNumber:n,TheoreticalMass:e.mz.toFixed(3),ObservedMass:r,MassDiffDa:p.toFixed(3),MassDiffPpm:f.toFixed(3)};e.charge>1&&(u.Charge=e.charge),this.peakIds&&c>=0&&this.peakIds[c]!==void 0&&(u.PeakId=this.peakIds[c]),t.push(u),n>0&&e.ion_type!=="unknown"&&this.markAminoAcidPosition(e.ion_type,n,"")}return t},matchFragmentsTheoretical(){const t=[];this.sequence.length;const e=Object.entries(xG).filter(([c])=>this.ionTypesExtra[c]||c==="default").map(([c,R])=>R).flat(),r=this.deconvolved?[1]:Array.from({length:this.maxCharge},(c,R)=>R+1);for(const c of this.ionTypes.filter(R=>R.selected)){const R=this.getFragmentMasses(c.text);for(let p=0;p<R.length;p++)for(const f of R[p])for(const{typeName:n,typeMass:s}of e){const u=f+s;for(const i of r){const _=this.deconvolved?u:(u+i*_G)/i;for(let b=0;b<this.observedMasses.length;b++){const w=this.observedMasses[b],v=w-_;if(this.isWithinTolerance(v,_)){const o=v/_*1e6,a=`${c.text}${p+1}${n}`,l={Name:this.deconvolved?a:`${a}${TG(i)}⁺`,IonType:`${c.text}${n}`,IonNumber:p+1,TheoreticalMass:_.toFixed(3),ObservedMass:w,MassDiffDa:v.toFixed(3),MassDiffPpm:o.toFixed(3)};this.deconvolved||(l.Charge=i),this.peakIds&&this.peakIds[b]!==void 0&&(l.PeakId=this.peakIds[b]),t.push(l),this.markAminoAcidPosition(c.text,p+1,n)}}}}}return t},matchFragments(){if(this.sequence.length===0||this.observedMasses.length===0){this.fragmentTableData=[],this.streamlitDataStore.setAnnotations(null);return}this.useExternalAnnotations&&this.hasExternalAnnotations?this.fragmentTableData=this.matchFragmentsExternal():this.fragmentTableData=this.matchFragmentsTheoretical();const t=[],e=[],r=[];for(const f of this.fragmentTableData)if(f.PeakId!==void 0){t.push(f.PeakId);const n=f.IonType.charAt(0).toLowerCase(),s=["a","b","c"].includes(n)?"#E4572E":"#1f77b4";e.push(s),r.push(f.Name)}const c=this.streamlitDataStore.annotations,R=(c==null?void 0:c.peak_id)??[],p=t.length!==R.length||t.some((f,n)=>f!==R[n]);t.length>0?this.streamlitDataStore.setAnnotations({peak_id:t,highlight_color:e,annotation:r}):this.streamlitDataStore.setAnnotations(null),p&&this.selectionStore.$patch({counter:(this.selectionStore.$state.counter||0)+1})},isFixedModification(t){return this.fixedModificationSites.includes(t)},onAminoAcidSelected(t){this.selectedAAIndex=t;const e=this.sequenceObjects[t];let r="";if(e.bIon?r=`b${t+1}`:e.aIon?r=`a${t+1}`:e.cIon?r=`c${t+1}`:e.yIon?r=`y${this.sequence.length-t}`:e.xIon?r=`x${this.sequence.length-t}`:e.zIon&&(r=`z${this.sequence.length-t}`),r){const c=this.fragmentTableData.findIndex(R=>R.Name===r);c>=0&&(this.selectedFragmentRowIndex=c)}},onFragmentTableRowClick(t,{item:e}){const r=e.IonType.charAt(0),c=e.IonNumber,p=["a","b","c"].includes(r)?c-1:this.sequence.length-c;if(p>=0&&p<this.sequenceObjects.length&&(this.selectedAAIndex=p),e.PeakId!==void 0&&Object.keys(this.interactivity).length>0)for(const[f,n]of Object.entries(this.interactivity))this.selectionStore.updateSelection(f,e.PeakId)},getRowProps({index:t}){return{class:t===this.selectedFragmentRowIndex?"bg-amber-lighten-4":""}},async copySequence(){try{const t=this.sequence.join("");await navigator.clipboard.writeText(t),this.copySnackbarText="Sequence copied to clipboard!",this.copySnackbar=!0}catch(t){this.copySnackbarText="Failed to copy sequence",this.copySnackbar=!0,console.error("Copy failed:",t)}}}}),SG={class:"d-flex justify-end px-4 mb-4"},AG={class:"d-flex justify-space-evenly"},CG={class:"d-flex justify-space-evenly"},MG={class:"d-flex align-center ga-2"},EG={key:0,class:"d-flex justify-center align-center row-number"},IG={key:1,class:"d-flex justify-center align-center terminal-cell"},LG={key:2,class:"d-flex justify-center align-center row-number"},PG={key:3,class:"d-flex justify-center align-center terminal-cell"},DG={key:0,class:"mt-4"},RG={class:"d-flex justify-space-between align-center mb-2"},OG={class:"text-caption"};function zG(t,e,r,c,R,p){var A;const f=iu("v-icon"),n=iu("v-tooltip"),s=iu("v-btn"),u=iu("v-list-item-title"),i=iu("v-slider"),_=iu("v-list-item"),b=iu("v-checkbox"),w=iu("v-text-field"),v=iu("v-btn-toggle"),o=iu("v-list-item-subtitle"),a=iu("v-list"),h=iu("v-card"),l=iu("v-menu"),m=iu("AminoAcidCell"),y=iu("v-divider"),x=iu("v-data-table"),S=iu("v-sheet"),C=iu("v-snackbar");return Va(),vo("div",{class:"sequence-view-container",style:ii(t.containerStyle)},[Qt(S,{class:"pa-4 rounded-lg",theme:((A=t.theme)==null?void 0:A.base)??"light",border:""},{default:ds(()=>[e[18]||(e[18]=en("div",{class:"d-flex justify-center mb-2"},[en("h4",null,"Sequence View")],-1)),en("div",SG,[Qt(s,{variant:"text",icon:"",size:"small",disabled:t.sequence.length===0,onClick:t.copySequence},{default:ds(()=>[Qt(f,null,{default:ds(()=>[...e[7]||(e[7]=[Fs("mdi-content-copy",-1)])]),_:1}),Qt(n,{activator:"parent",location:"bottom"},{default:ds(()=>[...e[8]||(e[8]=[Fs("Copy sequence to clipboard",-1)])]),_:1})]),_:1},8,["disabled","onClick"]),Qt(s,{id:"settings-btn",variant:"text",icon:"",size:"small"},{default:ds(()=>[Qt(f,null,{default:ds(()=>[...e[9]||(e[9]=[Fs("mdi-cog",-1)])]),_:1})]),_:1}),Qt(l,{"close-on-content-click":!1,activator:"#settings-btn",location:"bottom"},{default:ds(()=>[Qt(h,{"min-width":"300"},{default:ds(()=>[Qt(a,null,{default:ds(()=>[Qt(_,null,{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[10]||(e[10]=[Fs("# amino acids per row",-1)])]),_:1}),Qt(i,{modelValue:t.rowWidth,"onUpdate:modelValue":e[0]||(e[0]=E=>t.rowWidth=E),ticks:{20:"20",25:"25",30:"30",35:"35",40:"40"},min:20,max:40,step:"5","show-ticks":"always","tick-size":"4"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[11]||(e[11]=[Fs("Font Size",-1)])]),_:1}),Qt(i,{modelValue:t.fontSize,"onUpdate:modelValue":e[1]||(e[1]=E=>t.fontSize=E),ticks:{8:"8",10:"10",12:"12",14:"14",16:"16"},min:8,max:16,step:"2","show-ticks":"always","tick-size":"4"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[12]||(e[12]=[Fs("Show Fragments",-1)])]),_:1}),Qt(b,{modelValue:t.showFragments,"onUpdate:modelValue":e[2]||(e[2]=E=>t.showFragments=E),"hide-details":"",density:"comfortable"},null,8,["modelValue"])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[13]||(e[13]=[Fs("Fragment ion types",-1)])]),_:1}),en("div",AG,[(Va(!0),vo(yi,null,z_(t.ionTypes,E=>(Va(),ty(b,{key:E.text,modelValue:E.selected,"onUpdate:modelValue":P=>E.selected=P,label:E.text,disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","onUpdate:modelValue","label","disabled"]))),128))]),en("div",CG,[(Va(!0),vo(yi,null,z_(t.ionTypesExtra,(E,P)=>(Va(),ty(b,{key:P,modelValue:t.ionTypesExtra[P],"onUpdate:modelValue":M=>t.ionTypesExtra[P]=M,label:P,disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","onUpdate:modelValue","label","disabled"]))),128))])]),_:1}),Qt(_,null,{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[14]||(e[14]=[Fs("Fragment mass tolerance",-1)])]),_:1}),en("div",MG,[Qt(w,{modelValue:t.fragmentMassTolerance,"onUpdate:modelValue":e[3]||(e[3]=E=>t.fragmentMassTolerance=E),modelModifiers:{number:!0},type:"number","hide-details":"auto",disabled:!t.showFragments,density:"compact",style:{"max-width":"100px"}},null,8,["modelValue","disabled"]),Qt(v,{modelValue:t.toleranceIsPpm,"onUpdate:modelValue":e[4]||(e[4]=E=>t.toleranceIsPpm=E),mandatory:"",density:"compact",disabled:!t.showFragments},{default:ds(()=>[Qt(s,{value:!0,size:"small"},{default:ds(()=>[...e[15]||(e[15]=[Fs("ppm",-1)])]),_:1}),Qt(s,{value:!1,size:"small"},{default:ds(()=>[...e[16]||(e[16]=[Fs("Da",-1)])]),_:1})]),_:1},8,["modelValue","disabled"])])]),_:1}),t.hasExternalAnnotations?(Va(),ty(_,{key:0},{default:ds(()=>[Qt(u,null,{default:ds(()=>[...e[17]||(e[17]=[Fs("Use search engine annotations",-1)])]),_:1}),Qt(b,{modelValue:t.useExternalAnnotations,"onUpdate:modelValue":e[5]||(e[5]=E=>t.useExternalAnnotations=E),disabled:!t.showFragments,"hide-details":"",density:"comfortable"},null,8,["modelValue","disabled"]),Qt(o,{class:"text-caption"},{default:ds(()=>[Fs(Bs(t.externalAnnotations.length)+" annotations from idXML ",1)]),_:1})]),_:1})):wl("",!0)]),_:1})]),_:1})]),_:1})]),en("div",{class:jr(["px-2 pb-4",t.gridClasses]),style:{width:"100%","max-width":"100%"}},[(Va(!0),vo(yi,null,z_(t.sequenceObjects,(E,P)=>(Va(),vo(yi,{key:P},[P!==0&&P%t.rowWidth===0?(Va(),vo("div",EG,Bs(P+1),1)):wl("",!0),P===0?(Va(),vo("div",IG,"N")):wl("",!0),Qt(m,{"sequence-object":E,index:P,"sequence-length":t.sequence.length,"fixed-modification":t.isFixedModification(E.aminoAcid),"show-fragments":t.showFragments,"font-size":t.fontSize,"is-highlighted":t.selectedAAIndex===P,modification:t.modifications[P]??null,onSelected:t.onAminoAcidSelected},null,8,["sequence-object","index","sequence-length","fixed-modification","show-fragments","font-size","is-highlighted","modification","onSelected"]),P%t.rowWidth===t.rowWidth-1&&P!==t.sequence.length-1?(Va(),vo("div",LG,Bs(P+1),1)):wl("",!0),P===t.sequence.length-1?(Va(),vo("div",PG," C ")):wl("",!0)],64))),128))],2),t.showFragments&&t.fragmentTableData.length>0?(Va(),vo("div",DG,[Qt(y,{class:"mb-4"}),en("div",RG,[en("h5",null,"Matching Fragments ("+Bs(t.fragmentTableData.length)+")",1),en("span",OG,"Residue cleavage: "+Bs(t.residueCleavagePercentage.toFixed(1))+"%",1)]),Qt(x,{headers:t.fragmentTableHeaders,items:t.fragmentTableData,"items-per-page":10,density:"compact",class:"elevation-1","row-props":t.getRowProps,"onClick:row":t.onFragmentTableRowClick},null,8,["headers","items","row-props","onClick:row"])])):wl("",!0)]),_:1},8,["theme"]),Qt(C,{modelValue:t.copySnackbar,"onUpdate:modelValue":e[6]||(e[6]=E=>t.copySnackbar=E),timeout:2e3,location:"bottom"},{default:ds(()=>[Fs(Bs(t.copySnackbarText),1)]),_:1},8,["modelValue"])],4)}const m6=Vv(kG,[["render",zG],["__scopeId","data-v-3b89d373"]]),FG=wg({name:"App",components:{TabulatorTable:c6,PlotlyLineplot:h6,PlotlyHeatmap:f6,PlotlyVolcano:p6,SequenceView:m6},setup(){const t=Cg(),e=zy();let r,c,R,p=null;const f=100,n=()=>{const i=e.$state.counter,_=t.hash||null,b=t.annotations,w=b?JSON.stringify(b.peak_id):void 0;if(i===r&&_===c&&w===R)return;r=i,c=_??void 0,R=w;const v=JSON.parse(JSON.stringify(e.$state));v._vueDataHash=_,b&&(v._annotations=JSON.parse(JSON.stringify(b))),t.requestData&&(v._requestData=!0,t.clearRequestData()),console.log("[Vue] sendStateToStreamlit",{counter:i,hash:_==null?void 0:_.substring(0,8),hasAnnotations:!!b,requestData:v._requestData}),Hc.setComponentValue(v)},s=()=>{p&&clearTimeout(p),p=setTimeout(()=>{n(),p=null},f)},u=()=>{p&&(clearTimeout(p),p=null)};return ei(()=>e.$state.counter,(i,_)=>{_===void 0?n():s()},{immediate:!0}),ei(()=>t.hash,n),ei(()=>t.annotations,n,{deep:!0}),ei(()=>t.requestData,i=>{i&&(u(),n())}),ei(()=>{var i;return(i=t.allDataForDrawing)==null?void 0:i.height},i=>{i&&typeof i=="number"&&Hc.setFrameHeight(i)},{immediate:!0}),{streamlitDataStore:t,selectionStore:e}},data(){return{resizeObserver:void 0}},computed:{componentArgs(){var e;const t=(e=this.streamlitDataStore.args)==null?void 0:e.components;if(t&&t.length>0&&t[0].length>0)return t[0][0].componentArgs},currentComponent(){var e;const t=(e=this.componentArgs)==null?void 0:e.componentType;switch(t){case"TabulatorTable":return c6;case"PlotlyLineplotUnified":case"PlotlyLineplot":return h6;case"PlotlyHeatmap":return f6;case"PlotlyVolcano":return p6;case"SequenceView":return m6;default:return console.warn(`Unknown component type: ${t}`),null}}},created(){Hc.setComponentReady(),Hc.setFrameHeight(400),Hc.events.addEventListener(Hc.RENDER_EVENT,this.updateStreamlitData)},mounted(){this.resizeObserver=new ResizeObserver(()=>{Hc.setFrameHeight()}),this.resizeObserver.observe(this.$el)},unmounted(){Hc.events.removeEventListener(Hc.RENDER_EVENT,this.updateStreamlitData),this.resizeObserver&&this.resizeObserver.disconnect()},methods:{async updateStreamlitData(t){this.streamlitDataStore.updateRenderData(t.detail)}}}),BG={key:0},NG={key:1,class:"d-flex w-100",style:{height:"200px"}};function VG(t,e,r,c,R,p){const f=iu("v-progress-linear"),n=iu("v-alert");return t.componentArgs!==void 0?(Va(),vo("div",BG,[(Va(),ty(ME(t.currentComponent),{args:t.componentArgs,index:0},null,8,["args"]))])):(Va(),vo("div",NG,[Qt(n,{class:"h-50 ma-8",icon:"mdi-application-variable-outline",title:"Loading...",type:"info",density:"compact"},{default:ds(()=>[Qt(f,{indeterminate:""})]),_:1})]))}const jG=Vv(FG,[["render",VG]]);function y9(t,e){e=Array.isArray(e)?e.slice(0,-1).map(r=>`'${r}'`).join(", ")+` or '${e.at(-1)}'`:`'${e}'`}const Ro=typeof window<"u",q4=Ro&&"IntersectionObserver"in window,UG=Ro&&("ontouchstart"in window||window.navigator.maxTouchPoints>0),g6=Ro&&"EyeDropper"in window,G4=Ro&&"matchMedia"in window&&typeof window.matchMedia=="function",mp=()=>G4&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function v6(t,e,r){HG(t,e),e.set(t,r)}function HG(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function y6(t,e,r){return t.set(b9(t,e),r),r}function Op(t,e){return t.get(b9(t,e))}function b9(t,e,r){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:r;throw new TypeError("Private element is not present on this object")}function x9(t,e,r){const c=e.length-1;if(c<0)return t===void 0?r:t;for(let R=0;R<c;R++){if(t==null)return r;t=t[e[R]]}return t==null||t[e[c]]===void 0?r:t[e[c]]}function Lv(t,e,r){return t==null||!e||typeof e!="string"?r:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),x9(t,e.split("."),r))}function au(t,e,r){if(e===!0)return t===void 0?r:t;if(e==null||typeof e=="boolean")return r;if(t!==Object(t)){if(typeof e!="function")return r;const R=e(t,r);return typeof R>"u"?r:R}if(typeof e=="string")return Lv(t,e,r);if(Array.isArray(e))return x9(t,e,r);if(typeof e!="function")return r;const c=e(t,r);return typeof c>"u"?r:c}function If(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Array.from({length:t},(r,c)=>e+c)}function ai(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"px";if(t==null||t==="")return;const r=Number(t);return isNaN(r)?String(t):isFinite(r)?`${r}${e}`:void 0}function pg(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function UT(t){let e;return t!==null&&typeof t=="object"&&((e=Object.getPrototypeOf(t))===Object.prototype||e===null)}function $4(t){if(t&&"$el"in t){const e=t.$el;return(e==null?void 0:e.nodeType)===Node.TEXT_NODE?e.nextElementSibling:e}return t}const HT=Object.freeze({enter:"Enter",tab:"Tab",delete:"Delete",esc:"Escape",space:"Space",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",end:"End",home:"Home",del:"Delete",backspace:"Backspace",insert:"Insert",pageup:"PageUp",pagedown:"PageDown",shift:"Shift"});function _9(t){return Object.keys(t)}function mv(t,e){return e.every(r=>t.hasOwnProperty(r))}function Jh(t,e){const r={};for(const c of e)Object.prototype.hasOwnProperty.call(t,c)&&(r[c]=t[c]);return r}function WT(t,e,r){const c=Object.create(null),R=Object.create(null);for(const p in t)e.some(f=>f instanceof RegExp?f.test(p):f===p)?c[p]=t[p]:R[p]=t[p];return[c,R]}function Ga(t,e){const r={...t};return e.forEach(c=>delete r[c]),r}const w9=/^on[^a-z]/,Y4=t=>w9.test(t),WG=["onAfterscriptexecute","onAnimationcancel","onAnimationend","onAnimationiteration","onAnimationstart","onAuxclick","onBeforeinput","onBeforescriptexecute","onChange","onClick","onCompositionend","onCompositionstart","onCompositionupdate","onContextmenu","onCopy","onCut","onDblclick","onFocusin","onFocusout","onFullscreenchange","onFullscreenerror","onGesturechange","onGestureend","onGesturestart","onGotpointercapture","onInput","onKeydown","onKeypress","onKeyup","onLostpointercapture","onMousedown","onMousemove","onMouseout","onMouseover","onMouseup","onMousewheel","onPaste","onPointercancel","onPointerdown","onPointerenter","onPointerleave","onPointermove","onPointerout","onPointerover","onPointerup","onReset","onSelect","onSubmit","onTouchcancel","onTouchend","onTouchmove","onTouchstart","onTransitioncancel","onTransitionend","onTransitionrun","onTransitionstart","onWheel"],qG=["ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Enter","Escape","Tab"," "];function GG(t){return t.isComposing&&qG.includes(t.key)}function Mg(t){const[e,r]=WT(t,[w9]),c=Ga(e,WG),[R,p]=WT(r,["class","style","id",/^data-/]);return Object.assign(R,e),Object.assign(p,c),[R,p]}function Ss(t){return t==null?[]:Array.isArray(t)?t:[t]}function T9(t,e){let r=0;const c=function(){for(var R=arguments.length,p=new Array(R),f=0;f<R;f++)p[f]=arguments[f];clearTimeout(r),r=setTimeout(()=>t(...p),$h(e))};return c.clear=()=>{clearTimeout(r)},c.immediate=t,c}function Vo(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;return Math.max(e,Math.min(r,t))}function b6(t){const e=t.toString().trim();return e.includes(".")?e.length-e.indexOf(".")-1:0}function x6(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0";return t+r.repeat(Math.max(0,e-t.length))}function _6(t,e){return(arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0").repeat(Math.max(0,e-t.length))+t}function $G(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const r=[];let c=0;for(;c<t.length;)r.push(t.substr(c,e)),c+=e;return r}function w6(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e3;if(t<e)return`${t} B`;const r=e===1024?["Ki","Mi","Gi"]:["k","M","G"];let c=-1;for(;Math.abs(t)>=e&&c<r.length-1;)t/=e,++c;return`${t.toFixed(1)} ${r[c]}B`}function oh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;const c={};for(const R in t)c[R]=t[R];for(const R in e){const p=t[R],f=e[R];if(UT(p)&&UT(f)){c[R]=oh(p,f,r);continue}if(r&&Array.isArray(p)&&Array.isArray(f)){c[R]=r(p,f);continue}c[R]=f}return c}function k9(t){return t.map(e=>e.type===yi?k9(e.children):e).flat()}function _v(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(_v.cache.has(t))return _v.cache.get(t);const e=t.replace(/[^a-z]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase();return _v.cache.set(t,e),e}_v.cache=new Map;function G0(t,e){if(!e||typeof e!="object")return[];if(Array.isArray(e))return e.map(r=>G0(t,r)).flat(1);if(e.suspense)return G0(t,e.ssContent);if(Array.isArray(e.children))return e.children.map(r=>G0(t,r)).flat(1);if(e.component){if(Object.getOwnPropertyDescriptor(e.component.provides,t))return[e.component];if(e.component.subTree)return G0(t,e.component.subTree).flat(1)}return[]}var M0=new WeakMap,iv=new WeakMap;class S9{constructor(e){v6(this,M0,[]),v6(this,iv,0),this.size=e}get isFull(){return Op(M0,this).length===this.size}push(e){Op(M0,this)[Op(iv,this)]=e,y6(iv,this,(Op(iv,this)+1)%this.size)}values(){return Op(M0,this).slice(Op(iv,this)).concat(Op(M0,this).slice(0,Op(iv,this)))}clear(){Op(M0,this).length=0,y6(iv,this,0)}}function YG(t){return"touches"in t?{clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:{clientX:t.clientX,clientY:t.clientY}}function Z4(t){const e=cc({});fl(()=>{const c=t();for(const R in c)e[R]=c[R]},{flush:"sync"});const r={};for(const c in e)r[c]=Nn(()=>e[c]);return r}function V2(t,e){return t.includes(e)}function A9(t){return t[2].toLowerCase()+t.slice(3)}const qc=()=>[Function,Array];function T6(t,e){return e="on"+bp(e),!!(t[e]||t[`${e}Once`]||t[`${e}Capture`]||t[`${e}OnceCapture`]||t[`${e}CaptureOnce`])}function lx(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),c=1;c<e;c++)r[c-1]=arguments[c];if(Array.isArray(t))for(const R of t)R(...r);else typeof t=="function"&&t(...r)}function wv(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const r=["button","[href]",'input:not([type="hidden"])',"select","textarea","details:not(:has(> summary))","details > summary","[tabindex]",'[contenteditable]:not([contenteditable="false"])',"audio[controls]","video[controls]"].map(R=>`${R}${e?':not([tabindex="-1"])':""}:not([disabled], [inert])`).join(", ");let c;try{c=[...t.querySelectorAll(r)]}catch{return[]}return c.filter(R=>!R.closest("[inert]")).filter(R=>!!R.offsetParent||R.getClientRects().length>0).filter(R=>{var p,f;return!((p=R.parentElement)!=null&&p.closest("details:not([open])"))||R.tagName==="SUMMARY"&&((f=R.parentElement)==null?void 0:f.tagName)==="DETAILS"})}function C9(t,e,r){let c,R=t.indexOf(document.activeElement);const p=e==="next"?1:-1;do R+=p,c=t[R];while((!c||c.offsetParent==null||!((r==null?void 0:r(c))??!0))&&R<t.length&&R>=0);return c}function Tv(t,e){var c,R,p,f;const r=wv(t);if(e==null)(t===document.activeElement||!t.contains(document.activeElement))&&((c=r[0])==null||c.focus());else if(e==="first")(R=r[0])==null||R.focus();else if(e==="last")(p=r.at(-1))==null||p.focus();else if(typeof e=="number")(f=r[e])==null||f.focus();else{const n=C9(r,e);n?n.focus():Tv(t,e==="next"?"first":"last")}}function C_(t){return t==null||typeof t=="string"&&t.trim()===""}function Pw(){}function wy(t,e){if(!(Ro&&typeof CSS<"u"&&typeof CSS.supports<"u"&&CSS.supports(`selector(${e})`)))return null;try{return!!t&&t.matches(e)}catch{return null}}function Dw(t){return t.some(e=>yb(e)?e.type===Ch?!1:e.type!==yi||Dw(e.children):!0)?t:null}function M_(t,e,r){return(t==null?void 0:t(e))??(r==null?void 0:r(e))}function ZG(t,e){if(!Ro||t===0)return e(),()=>{};const r=window.setTimeout(e,t);return()=>window.clearTimeout(r)}function XG(t,e){const r=t.clientX,c=t.clientY,R=e.getBoundingClientRect(),p=R.left,f=R.top,n=R.right,s=R.bottom;return r>=p&&r<=n&&c>=f&&c<=s}function j2(){const t=ni(),e=r=>{t.value=r};return Object.defineProperty(e,"value",{enumerable:!0,get:()=>t.value,set:r=>t.value=r}),Object.defineProperty(e,"el",{enumerable:!0,get:()=>$4(t.value)}),e}function Ty(t){const e=t.key.length===1,r=!t.ctrlKey&&!t.metaKey&&!t.altKey;return e&&r}function mg(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"}function U2(t){return"\\^$*+?.()|{}[]".includes(t)?`\\${t}`:t}function KG(t,e,r){const c=new RegExp(`[\\d\\-${U2(r)}]`),R=t.split("").filter(f=>c.test(f)).filter((f,n,s)=>n===0&&/[-]/.test(f)||f===r&&n===s.indexOf(f)||/\d/.test(f)).join("");if(e===0)return R.split(r)[0];const p=new RegExp(`${U2(r)}\\d`);if(e!==null&&p.test(R)){const f=R.split(r);return[f[0],f[1].substring(0,e)].join(r)}return R}function JG(t){const e={};for(const r in t)e[Kh(r)]=t[r];return e}function QG(t){const e=["checked","disabled"];return Object.fromEntries(Object.entries(t).filter(r=>{let[c,R]=r;return e.includes(c)?!!R:R!==void 0}))}function k6(t){const e=r=>Array.isArray(r)?r.map(c=>e(c)):Xs(r)||lp(r)||Yb(r)?e(Zi(r)):UT(r)?Object.keys(r).reduce((c,R)=>(c[R]=e(r[R]),c),{}):r;return e(t)}const M9=["top","bottom"],e$=["start","end","left","right"];function qT(t,e){let[r,c]=t.split(" ");return c||(c=V2(M9,r)?"start":V2(e$,r)?"top":"center"),{side:GT(r,e),align:GT(c,e)}}function GT(t,e){return t==="start"?e?"right":"left":t==="end"?e?"left":"right":t}function y5(t){return{side:{center:"center",top:"bottom",bottom:"top",left:"right",right:"left"}[t.side],align:t.align}}function b5(t){return{side:t.side,align:{center:"center",top:"bottom",bottom:"top",left:"right",right:"left"}[t.align]}}function S6(t){return{side:t.align,align:t.side}}function A6(t){return V2(M9,t.side)?"y":"x"}class rd{constructor(e){const r=document.body.currentCSSZoom??1,c=e instanceof Element,R=c?1+(1-r)/r:1,{x:p,y:f,width:n,height:s}=c?e.getBoundingClientRect():e;this.x=p*R,this.y=f*R,this.width=n*R,this.height=s*R}get top(){return this.y}get bottom(){return this.y+this.height}get left(){return this.x}get right(){return this.x+this.width}}function C6(t,e){return{x:{before:Math.max(0,e.left-t.left),after:Math.max(0,t.right-e.right)},y:{before:Math.max(0,e.top-t.top),after:Math.max(0,t.bottom-e.bottom)}}}function E9(t){if(Array.isArray(t)){const e=document.body.currentCSSZoom??1,r=1+(1-e)/e;return new rd({x:t[0]*r,y:t[1]*r,width:0*r,height:0*r})}else return new rd(t)}function t$(t){if(t===document.documentElement)if(visualViewport){const e=document.body.currentCSSZoom??1;return new rd({x:visualViewport.scale>1?0:visualViewport.offsetLeft,y:visualViewport.scale>1?0:visualViewport.offsetTop,width:visualViewport.width*visualViewport.scale/e,height:visualViewport.height*visualViewport.scale/e})}else return new rd({x:0,y:0,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight});else return new rd(t)}function X4(t){const e=new rd(t),r=getComputedStyle(t),c=r.transform;if(c){let R,p,f,n,s;if(c.startsWith("matrix3d("))R=c.slice(9,-1).split(/, /),p=Number(R[0]),f=Number(R[5]),n=Number(R[12]),s=Number(R[13]);else if(c.startsWith("matrix("))R=c.slice(7,-1).split(/, /),p=Number(R[0]),f=Number(R[3]),n=Number(R[4]),s=Number(R[5]);else return new rd(e);const u=r.transformOrigin,i=e.x-n-(1-p)*parseFloat(u),_=e.y-s-(1-f)*parseFloat(u.slice(u.indexOf(" ")+1)),b=p?e.width/p:t.offsetWidth+1,w=f?e.height/f:t.offsetHeight+1;return new rd({x:i,y:_,width:b,height:w})}else return new rd(e)}function qp(t,e,r){if(typeof t.animate>"u")return{finished:Promise.resolve()};let c;try{c=t.animate(e,r)}catch{return{finished:Promise.resolve()}}return typeof c.finished>"u"&&(c.finished=new Promise(R=>{c.onfinish=()=>{R(c)}})),c}const Z_=new WeakMap;function n$(t,e){Object.keys(e).forEach(r=>{if(Y4(r)){const c=A9(r),R=Z_.get(t);if(e[r]==null)R==null||R.forEach(p=>{const[f,n]=p;f===c&&(t.removeEventListener(c,n),R.delete(p))});else if(!R||![...R].some(p=>p[0]===c&&p[1]===e[r])){t.addEventListener(c,e[r]);const p=R||new Set;p.add([c,e[r]]),Z_.has(t)||Z_.set(t,p)}}else e[r]==null?t.removeAttribute(r):t.setAttribute(r,e[r])})}function r$(t,e){Object.keys(e).forEach(r=>{if(Y4(r)){const c=A9(r),R=Z_.get(t);R==null||R.forEach(p=>{const[f,n]=p;f===c&&(t.removeEventListener(c,n),R.delete(p))})}else t.removeAttribute(r)})}const E0=2.4,M6=.2126729,E6=.7151522,I6=.072175,i$=.55,a$=.58,o$=.57,s$=.62,E_=.03,L6=1.45,l$=5e-4,u$=1.25,c$=1.25,P6=.078,D6=12.82051282051282,I_=.06,R6=.001;function O6(t,e){const r=(t.r/255)**E0,c=(t.g/255)**E0,R=(t.b/255)**E0,p=(e.r/255)**E0,f=(e.g/255)**E0,n=(e.b/255)**E0;let s=r*M6+c*E6+R*I6,u=p*M6+f*E6+n*I6;if(s<=E_&&(s+=(E_-s)**L6),u<=E_&&(u+=(E_-u)**L6),Math.abs(u-s)<l$)return 0;let i;if(u>s){const _=(u**i$-s**a$)*u$;i=_<R6?0:_<P6?_-_*D6*I_:_-I_}else{const _=(u**s$-s**o$)*c$;i=_>-R6?0:_>-P6?_-_*D6*I_:_+I_}return i*100}const H2=.20689655172413793,h$=t=>t>H2**3?Math.cbrt(t):t/(3*H2**2)+4/29,f$=t=>t>H2?t**3:3*H2**2*(t-4/29);function I9(t){const e=h$,r=e(t[1]);return[116*r-16,500*(e(t[0]/.95047)-r),200*(r-e(t[2]/1.08883))]}function L9(t){const e=f$,r=(t[0]+16)/116;return[e(r+t[1]/500)*.95047,e(r),e(r-t[2]/200)*1.08883]}const d$=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]],p$=t=>t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055,m$=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],g$=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4;function P9(t){const e=Array(3),r=p$,c=d$;for(let R=0;R<3;++R)e[R]=Math.round(Vo(r(c[R][0]*t[0]+c[R][1]*t[1]+c[R][2]*t[2]))*255);return{r:e[0],g:e[1],b:e[2]}}function K4(t){let{r:e,g:r,b:c}=t;const R=[0,0,0],p=g$,f=m$;e=p(e/255),r=p(r/255),c=p(c/255);for(let n=0;n<3;++n)R[n]=f[n][0]*e+f[n][1]*r+f[n][2]*c;return R}function $T(t){return!!t&&/^(#|var\(--|(rgb|hsl)a?\()/.test(t)}function v$(t){return $T(t)&&!/^((rgb|hsl)a?\()?var\(--/.test(t)}const z6=/^(?<fn>(?:rgb|hsl)a?)\((?<values>.+)\)/,y$={rgb:(t,e,r,c)=>({r:t,g:e,b:r,a:c}),rgba:(t,e,r,c)=>({r:t,g:e,b:r,a:c}),hsl:(t,e,r,c)=>F6({h:t,s:e,l:r,a:c}),hsla:(t,e,r,c)=>F6({h:t,s:e,l:r,a:c}),hsv:(t,e,r,c)=>gp({h:t,s:e,v:r,a:c}),hsva:(t,e,r,c)=>gp({h:t,s:e,v:r,a:c})};function Lf(t){if(typeof t=="number")return{r:(t&16711680)>>16,g:(t&65280)>>8,b:t&255};if(typeof t=="string"&&z6.test(t)){const{groups:e}=t.match(z6),{fn:r,values:c}=e,R=c.split(/,\s*|\s*\/\s*|\s+/).map((p,f)=>p.endsWith("%")||f>0&&f<3&&["hsl","hsla","hsv","hsva"].includes(r)?parseFloat(p)/100:parseFloat(p));return y$[r](...R)}else if(typeof t=="string"){let e=t.startsWith("#")?t.slice(1):t;return[3,4].includes(e.length)?e=e.split("").map(r=>r+r).join(""):[6,8].includes(e.length),z9(e)}else if(typeof t=="object"){if(mv(t,["r","g","b"]))return t;if(mv(t,["h","s","l"]))return gp(J4(t));if(mv(t,["h","s","v"]))return gp(t)}throw new TypeError(`Invalid color: ${t==null?t:String(t)||t.constructor.name}
4214
4214
  Expected #hex, #hexa, rgb(), rgba(), hsl(), hsla(), object or number`)}function gp(t){const{h:e,s:r,v:c,a:R}=t,p=n=>{const s=(n+e/60)%6;return c-c*r*Math.max(Math.min(s,4-s,1),0)},f=[p(5),p(3),p(1)].map(n=>Math.round(n*255));return{r:f[0],g:f[1],b:f[2],a:R}}function F6(t){return gp(J4(t))}function ux(t){if(!t)return{h:0,s:1,v:1,a:1};const e=t.r/255,r=t.g/255,c=t.b/255,R=Math.max(e,r,c),p=Math.min(e,r,c);let f=0;R!==p&&(R===e?f=60*(0+(r-c)/(R-p)):R===r?f=60*(2+(c-e)/(R-p)):R===c&&(f=60*(4+(e-r)/(R-p)))),f<0&&(f=f+360);const n=R===0?0:(R-p)/R,s=[f,n,R];return{h:s[0],s:s[1],v:s[2],a:t.a}}function YT(t){const{h:e,s:r,v:c,a:R}=t,p=c-c*r/2,f=p===1||p===0?0:(c-p)/Math.min(p,1-p);return{h:e,s:f,l:p,a:R}}function J4(t){const{h:e,s:r,l:c,a:R}=t,p=c+r*Math.min(c,1-c),f=p===0?0:2-2*c/p;return{h:e,s:f,v:p,a:R}}function D9(t){let{r:e,g:r,b:c,a:R}=t;return R===void 0?`rgb(${e}, ${r}, ${c})`:`rgba(${e}, ${r}, ${c}, ${R})`}function R9(t){return D9(gp(t))}function L_(t){const e=Math.round(t).toString(16);return("00".substr(0,2-e.length)+e).toUpperCase()}function O9(t){let{r:e,g:r,b:c,a:R}=t;return`#${[L_(e),L_(r),L_(c),R!==void 0?L_(Math.round(R*255)):""].join("")}`}function z9(t){t=x$(t);let[e,r,c,R]=$G(t,2).map(p=>parseInt(p,16));return R=R===void 0?R:R/255,{r:e,g:r,b:c,a:R}}function b$(t){const e=z9(t);return ux(e)}function F9(t){return O9(gp(t))}function x$(t){return t.startsWith("#")&&(t=t.slice(1)),t=t.replace(/([^0-9a-f])/gi,"F"),(t.length===3||t.length===4)&&(t=t.split("").map(e=>e+e).join("")),t.length!==6&&(t=x6(x6(t,6),8,"F")),t}function _$(t,e){const r=I9(K4(t));return r[0]=r[0]+e*10,P9(L9(r))}function w$(t,e){const r=I9(K4(t));return r[0]=r[0]-e*10,P9(L9(r))}function ZT(t){const e=Lf(t);return K4(e)[1]}function T$(t,e){const r=ZT(t),c=ZT(e),R=Math.max(r,c),p=Math.min(r,c);return(R+.05)/(p+.05)}function B9(t){const e=Math.abs(O6(Lf(0),Lf(t)));return Math.abs(O6(Lf(16777215),Lf(t)))>Math.min(e,50)?"#fff":"#000"}function ir(t,e){return r=>Object.keys(t).reduce((c,R)=>{const f=typeof t[R]=="object"&&t[R]!=null&&!Array.isArray(t[R])?t[R]:{type:t[R]};return r&&R in r?c[R]={...f,default:r[R]}:c[R]=f,e&&!c[R].source&&(c[R].source=e),c},{})}const Ti=ir({class:[String,Array,Object],style:{type:[String,Array,Object],default:null}},"component");function lu(t,e){const r=Ly();if(!r)throw new Error(`[Vuetify] ${t} must be called from inside a setup function`);return r}function xp(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"composables";const e=lu(t).type;return _v((e==null?void 0:e.aliasName)||(e==null?void 0:e.name))}function k$(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:lu("injectSelf");const{provides:r}=e;if(r&&t in r)return r[t]}const ky=Symbol.for("vuetify:defaults");function S$(t){return qr(t)}function Q4(){const t=Ea(ky);if(!t)throw new Error("[Vuetify] Could not find defaults instance");return t}function kl(t,e){const r=Q4(),c=qr(t),R=rn(()=>{if($h(e==null?void 0:e.disabled))return r.value;const f=$h(e==null?void 0:e.scoped),n=$h(e==null?void 0:e.reset),s=$h(e==null?void 0:e.root);if(c.value==null&&!(f||n||s))return r.value;let u=oh(c.value,{prev:r.value});if(f)return u;if(n||s){const i=Number(n||1/0);for(let _=0;_<=i&&!(!u||!("prev"in u));_++)u=u.prev;return u&&typeof s=="string"&&s in u&&(u=oh(oh(u,{prev:u}),u[s])),u}return u.prev?oh(u.prev,u):u});return Ns(ky,R),R}function A$(t,e){return t.props&&(typeof t.props[e]<"u"||typeof t.props[_v(e)]<"u")}function C$(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Q4();const c=lu("useDefaults");if(e=e??c.type.name??c.type.__name,!e)throw new Error("[Vuetify] Could not determine component name");const R=rn(()=>{var s;return(s=r.value)==null?void 0:s[t._as??e]}),p=new Proxy(t,{get(s,u){var w,v,o,a;const i=Reflect.get(s,u);if(u==="class"||u==="style")return[(w=R.value)==null?void 0:w[u],i].filter(h=>h!=null);if(A$(c.vnode,u))return i;const _=(v=R.value)==null?void 0:v[u];if(_!==void 0)return _;const b=(a=(o=r.value)==null?void 0:o.global)==null?void 0:a[u];return b!==void 0?b:i}}),f=ni();fl(()=>{if(R.value){const s=Object.entries(R.value).filter(u=>{let[i]=u;return i.startsWith(i[0].toUpperCase())});f.value=s.length?Object.fromEntries(s):void 0}else f.value=void 0});function n(){const s=k$(ky,c);Ns(ky,rn(()=>f.value?oh((s==null?void 0:s.value)??{},f.value):s==null?void 0:s.value))}return{props:p,provideSubDefaults:n}}function Ih(t){if(t._setup=t._setup??t.setup,!t.name)return t;if(t._setup){t.props=ir(t.props??{},t.name)();const e=Object.keys(t.props).filter(r=>r!=="class"&&r!=="style");t.filterProps=function(c){return Jh(c,e)},t.props._as=String,t.setup=function(c,R){const p=Q4();if(!p.value)return t._setup(c,R);const{props:f,provideSubDefaults:n}=C$(c,c._as??t.name,p),s=t._setup(f,R);return n(),s}}return t}function zr(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return e=>(t?Ih:wg)(e)}function M$(t,e){return e.props=t,e}function dm(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"div",r=arguments.length>2?arguments[2]:void 0;return zr()({name:r??bp(Kh(t.replace(/__/g,"-"))),props:{tag:{type:String,default:e},...Ti()},setup(c,R){let{slots:p}=R;return()=>{var f;return lm(c.tag,{class:[t,c.class],style:c.style},(f=p.default)==null?void 0:f.call(p))}}})}function E$(t,e,r,c){if(!r||mg(t)||mg(e))return;const R=r.get(t);if(R)R.set(e,c);else{const p=new WeakMap;p.set(e,c),r.set(t,p)}}function I$(t,e,r){var p,f;if(!r||mg(t)||mg(e))return null;const c=(p=r.get(t))==null?void 0:p.get(e);if(typeof c=="boolean")return c;const R=(f=r.get(e))==null?void 0:f.get(t);return typeof R=="boolean"?R:null}function Ec(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new WeakMap;if(t===e)return!0;if(t instanceof Date&&e instanceof Date&&t.getTime()!==e.getTime()||t!==Object(t)||e!==Object(e))return!1;const c=Object.keys(t);if(c.length!==Object.keys(e).length)return!1;const R=I$(t,e,r);return R||(E$(t,e,r,!0),c.every(p=>Ec(t[p],e[p],r)))}function N9(t){if(typeof t.getRootNode!="function"){for(;t.parentNode;)t=t.parentNode;return t!==document?null:document}const e=t.getRootNode();return e!==document&&e.getRootNode({composed:!0})!==document?null:e}const Lb="cubic-bezier(0.4, 0, 0.2, 1)",B6="cubic-bezier(0.0, 0, 0.2, 1)",N6="cubic-bezier(0.4, 0, 1, 1)",L$={linear:t=>t,easeInQuad:t=>t**2,easeOutQuad:t=>t*(2-t),easeInOutQuad:t=>t<.5?2*t**2:-1+(4-2*t)*t,easeInCubic:t=>t**3,easeOutCubic:t=>--t**3+1,easeInOutCubic:t=>t<.5?4*t**3:(t-1)*(2*t-2)*(2*t-2)+1,easeInQuart:t=>t**4,easeOutQuart:t=>1- --t**4,easeInOutQuart:t=>t<.5?8*t**4:1-8*--t**4,easeInQuint:t=>t**5,easeOutQuint:t=>1+--t**5,easeInOutQuint:t=>t<.5?16*t**5:1+16*--t**5,instant:t=>1};function Pf(t,e,r){return Object.keys(t).filter(c=>Y4(c)&&c.endsWith(e)).reduce((c,R)=>(c[R.slice(0,-e.length)]=p=>lx(t[R],p,r(p)),c),{})}function Rw(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;for(;t;){if(e?P$(t):eS(t))return t;t=t.parentElement}return document.scrollingElement}function W2(t,e){const r=[];if(e&&t&&!e.contains(t))return r;for(;t&&(eS(t)&&r.push(t),t!==e);)t=t.parentElement;return r}function eS(t){if(!t||t.nodeType!==Node.ELEMENT_NODE)return!1;const e=window.getComputedStyle(t),r=e.overflowY==="scroll"||e.overflowY==="auto"&&t.scrollHeight>t.clientHeight,c=e.overflowX==="scroll"||e.overflowX==="auto"&&t.scrollWidth>t.clientWidth;return r||c}function P$(t){if(!t||t.nodeType!==Node.ELEMENT_NODE)return!1;const e=window.getComputedStyle(t);return["scroll","auto"].includes(e.overflowY)}function D$(t){let{depth:e,isLast:r,isLastGroup:c,leafLinks:R,separateRoots:p,parentIndentLines:f,variant:n}=t;const s=r&&(!c||p||e>1);return!f||!e?{leaf:void 0,node:void 0,children:f,footer:f&&(!s||n==="simple")?[...f,p?"none":"line"]:["none"]}:n==="simple"?{leaf:[...f,"line"],node:[...f,"line"],children:[...f,"line"],footer:[...f,"line","line"]}:{leaf:[...f,s?"last-leaf":"leaf",...R?["leaf-link"]:[]],node:[...f,s?"last-leaf":"leaf"],children:[...f,s?"none":"line"],footer:[...f,s?"none":"line"]}}function R$(t){for(;t;){if(window.getComputedStyle(t).position==="fixed")return!0;t=t.offsetParent}return!1}function Gr(t){const e=lu("useRender");e.render=t}function O$(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{leading:!0,trailing:!0},c=0,R=0,p=!1,f=0;function n(){clearTimeout(c),p=!1,f=0}const s=function(){for(var u=arguments.length,i=new Array(u),_=0;_<u;_++)i[_]=arguments[_];clearTimeout(c);const b=Date.now();f||(f=b);const w=b-Math.max(f,R);function v(){R=Date.now(),c=setTimeout(n,e),t(...i)}p?w>=e?v():r.trailing&&(c=setTimeout(v,e-w)):(p=!0,r.leading&&v())};return s.clear=n,s.immediate=t,s}const Fi=[String,Function,Object,Array],XT=Symbol.for("vuetify:icons"),Ow=ir({icon:{type:Fi},tag:{type:[String,Object,Function],required:!0}},"icon"),KT=zr()({name:"VComponentIcon",props:Ow(),setup(t,e){let{slots:r}=e;return()=>{const c=t.icon;return Qt(t.tag,null,{default:()=>{var R;return[t.icon?Qt(c,null,null):(R=r.default)==null?void 0:R.call(r)]}})}}}),tS=Ih({name:"VSvgIcon",inheritAttrs:!1,props:Ow(),setup(t,e){let{attrs:r}=e;return()=>Qt(t.tag,kr(r,{style:null}),{default:()=>[en("svg",{class:"v-icon__svg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"img","aria-hidden":"true"},[Array.isArray(t.icon)?t.icon.map(c=>Array.isArray(c)?en("path",{d:c[0],"fill-opacity":c[1]},null):en("path",{d:c},null)):en("path",{d:t.icon},null)])]})}}),z$=Ih({name:"VLigatureIcon",props:Ow(),setup(t){return()=>Qt(t.tag,null,{default:()=>[t.icon]})}}),nS=Ih({name:"VClassIcon",props:Ow(),setup(t){return()=>Qt(t.tag,{class:jr(t.icon)},null)}}),F$=t=>{const e=Ea(XT);if(!e)throw new Error("Missing Vuetify Icons provide!");return{iconData:rn(()=>{var s;const c=Mc(t);if(!c)return{component:KT};let R=c;if(typeof R=="string"&&(R=R.trim(),R.startsWith("$")&&(R=(s=e.aliases)==null?void 0:s[R.slice(1)])),Array.isArray(R))return{component:tS,icon:R};if(typeof R!="string")return{component:KT,icon:R};const p=Object.keys(e.sets).find(u=>typeof R=="string"&&R.startsWith(`${u}:`)),f=p?R.slice(p.length+1):R;return{component:e.sets[p??e.defaultSet].component,icon:f}})}},B$={collapse:"mdi-chevron-up",complete:"mdi-check",cancel:"mdi-close-circle",close:"mdi-close",delete:"mdi-close-circle",clear:"mdi-close-circle",success:"mdi-check-circle",info:"mdi-information",warning:"mdi-alert-circle",error:"mdi-close-circle",prev:"mdi-chevron-left",next:"mdi-chevron-right",checkboxOn:"mdi-checkbox-marked",checkboxOff:"mdi-checkbox-blank-outline",checkboxIndeterminate:"mdi-minus-box",delimiter:"mdi-circle",sortAsc:"mdi-arrow-up",sortDesc:"mdi-arrow-down",expand:"mdi-chevron-down",menu:"mdi-menu",subgroup:"mdi-menu-down",dropdown:"mdi-menu-down",radioOn:"mdi-radiobox-marked",radioOff:"mdi-radiobox-blank",edit:"mdi-pencil",ratingEmpty:"mdi-star-outline",ratingFull:"mdi-star",ratingHalf:"mdi-star-half-full",loading:"mdi-cached",first:"mdi-page-first",last:"mdi-page-last",unfold:"mdi-unfold-more-horizontal",file:"mdi-paperclip",plus:"mdi-plus",minus:"mdi-minus",calendar:"mdi-calendar",treeviewCollapse:"mdi-menu-down",treeviewExpand:"mdi-menu-right",tableGroupCollapse:"mdi-chevron-down",tableGroupExpand:"mdi-chevron-right",eyeDropper:"mdi-eyedropper",upload:"mdi-cloud-upload",color:"mdi-palette",command:"mdi-apple-keyboard-command",ctrl:"mdi-apple-keyboard-control",space:"mdi-keyboard-space",shift:"mdi-apple-keyboard-shift",alt:"mdi-apple-keyboard-option",enter:"mdi-keyboard-return",arrowup:"mdi-arrow-up",arrowdown:"mdi-arrow-down",arrowleft:"mdi-arrow-left",arrowright:"mdi-arrow-right",backspace:"mdi-backspace",play:"mdi-play",pause:"mdi-pause",fullscreen:"mdi-fullscreen",fullscreenExit:"mdi-fullscreen-exit",volumeHigh:"mdi-volume-high",volumeMedium:"mdi-volume-medium",volumeLow:"mdi-volume-low",volumeOff:"mdi-volume-variant-off"},N$={component:t=>lm(nS,{...t,class:"mdi"})};function V$(){return{svg:{component:tS},class:{component:nS}}}function j$(t){const e=V$(),r=(t==null?void 0:t.defaultSet)??"mdi";return r==="mdi"&&!e.mdi&&(e.mdi=N$),oh({defaultSet:r,sets:e,aliases:{...B$,vuetify:["M8.2241 14.2009L12 21L22 3H14.4459L8.2241 14.2009Z",["M7.26303 12.4733L7.00113 12L2 3H12.5261C12.5261 3 12.5261 3 12.5261 3L7.26303 12.4733Z",.6]],"vuetify-outline":"svg:M7.26 12.47 12.53 3H2L7.26 12.47ZM14.45 3 8.22 14.2 12 21 22 3H14.45ZM18.6 5 12 16.88 10.51 14.2 15.62 5ZM7.26 8.35 5.4 5H9.13L7.26 8.35Z","vuetify-play":["m6.376 13.184-4.11-7.192C1.505 4.66 2.467 3 4.003 3h8.532l-.953 1.576-.006.01-.396.677c-.429.732-.214 1.507.194 2.015.404.503 1.092.878 1.869.806a3.72 3.72 0 0 1 1.005.022c.276.053.434.143.523.237.138.146.38.635-.25 2.09-.893 1.63-1.553 1.722-1.847 1.677-.213-.033-.468-.158-.756-.406a4.95 4.95 0 0 1-.8-.927c-.39-.564-1.04-.84-1.66-.846-.625-.006-1.316.27-1.693.921l-.478.826-.911 1.506Z",["M9.093 11.552c.046-.079.144-.15.32-.148a.53.53 0 0 1 .43.207c.285.414.636.847 1.046 1.2.405.35.914.662 1.516.754 1.334.205 2.502-.698 3.48-2.495l.014-.028.013-.03c.687-1.574.774-2.852-.005-3.675-.37-.391-.861-.586-1.333-.676a5.243 5.243 0 0 0-1.447-.044c-.173.016-.393-.073-.54-.257-.145-.18-.127-.316-.082-.392l.393-.672L14.287 3h5.71c1.536 0 2.499 1.659 1.737 2.992l-7.997 13.996c-.768 1.344-2.706 1.344-3.473 0l-3.037-5.314 1.377-2.278.004-.006.004-.007.481-.831Z",.6]]}},t)}function sh(t,e){let r;function c(){r=ag(),r.run(()=>e.length?e(()=>{r==null||r.stop(),c()}):e())}ei(t,R=>{R&&!r?c():R||(r==null||r.stop(),r=void 0)},{immediate:!0}),ju(()=>{r==null||r.stop()})}function Ri(t,e,r){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:_=>_,R=arguments.length>4&&arguments[4]!==void 0?arguments[4]:_=>_;const p=lu("useProxiedModel"),f=qr(t[e]!==void 0?t[e]:r),n=_v(e),u=rn(n!==e?()=>{var _,b,w,v;return t[e],!!(((_=p.vnode.props)!=null&&_.hasOwnProperty(e)||(b=p.vnode.props)!=null&&b.hasOwnProperty(n))&&((w=p.vnode.props)!=null&&w.hasOwnProperty(`onUpdate:${e}`)||(v=p.vnode.props)!=null&&v.hasOwnProperty(`onUpdate:${n}`)))}:()=>{var _,b;return t[e],!!((_=p.vnode.props)!=null&&_.hasOwnProperty(e)&&((b=p.vnode.props)!=null&&b.hasOwnProperty(`onUpdate:${e}`)))});sh(()=>!u.value,()=>{ei(()=>t[e],_=>{f.value=_})});const i=rn({get(){const _=t[e];return c(u.value?_:f.value)},set(_){const b=R(_),w=Zi(u.value?t[e]:f.value);w===b||c(w)===_||(f.value=b,p==null||p.emit(`update:${e}`,b))}});return Object.defineProperty(i,"externalValue",{get:()=>u.value?t[e]:f.value}),i}const U$={badge:"Badge",open:"Open",close:"Close",dismiss:"Dismiss",confirmEdit:{ok:"OK",cancel:"Cancel"},dataIterator:{noResultsText:"No matching records found",loadingText:"Loading items..."},dataTable:{itemsPerPageText:"Rows per page:",ariaLabel:{sortDescending:"Sorted descending.",sortAscending:"Sorted ascending.",sortNone:"Not sorted.",activateNone:"Activate to remove sorting.",activateDescending:"Activate to sort descending.",activateAscending:"Activate to sort ascending."},sortBy:"Sort by"},dataFooter:{itemsPerPageText:"Items per page:",itemsPerPageAll:"All",nextPage:"Next page",prevPage:"Previous page",firstPage:"First page",lastPage:"Last page",pageText:"{0}-{1} of {2}"},dateRangeInput:{divider:"to"},datePicker:{itemsSelected:"{0} selected",range:{title:"Select dates",header:"Enter dates"},title:"Select date",header:"Enter date",input:{placeholder:"Enter date"},ariaLabel:{previousMonth:"Previous month",nextMonth:"Next month",selectYear:"Select year",previousYear:"Previous year",nextYear:"Next year",selectMonth:"Select month",selectDate:"{0}",currentDate:"Today, {0}"}},noDataText:"No data available",carousel:{prev:"Previous visual",next:"Next visual",ariaLabel:{delimiter:"Carousel slide {0} of {1}"}},calendar:{moreEvents:"{0} more",today:"Today"},input:{clear:"Clear {0}",prependAction:"{0} prepended action",appendAction:"{0} appended action",otp:"Please enter OTP character {0}"},fileInput:{counter:"{0} files",counterSize:"{0} files ({1} in total)"},fileUpload:{title:"Drag and drop files here",divider:"or",browse:"Browse Files"},timePicker:{am:"AM",pm:"PM",title:"Select Time",hour:"Hour",minute:"Minute",second:"Second"},pagination:{ariaLabel:{root:"Pagination Navigation",next:"Next page",previous:"Previous page",page:"Go to page {0}",currentPage:"Page {0}, Current page",first:"First page",last:"Last page"}},stepper:{next:"Next",prev:"Previous"},rating:{ariaLabel:{item:"Rating {0} of {1}"}},loading:"Loading...",infiniteScroll:{loadMore:"Load more",empty:"No more"},rules:{required:"This field is required",email:"Please enter a valid email",number:"This field can only contain numbers",integer:"This field can only contain integer values",capital:"This field can only contain uppercase letters",maxLength:"You must enter a maximum of {0} characters",minLength:"You must enter a minimum of {0} characters",strictLength:"The length of the entered field is invalid",exclude:"The {0} character is not allowed",notEmpty:"Please choose at least one value",pattern:"Invalid format"},hotkey:{then:"then",ctrl:"Ctrl",command:"Command",space:"Space",shift:"Shift",alt:"Alt",enter:"Enter",escape:"Escape",upArrow:"Up Arrow",downArrow:"Down Arrow",leftArrow:"Left Arrow",rightArrow:"Right Arrow",backspace:"Backspace",option:"Option",plus:"plus",shortcut:"Keyboard shortcut: {0}",or:"or"},video:{play:"Play",pause:"Pause",seek:"Seek",volume:"Volume",showVolume:"Show volume control",mute:"Mute",unmute:"Unmute",enterFullscreen:"Full screen",exitFullscreen:"Exit full screen"},colorPicker:{ariaLabel:{eyedropper:"Select color with eyedropper",hueSlider:"Hue",alphaSlider:"Alpha",redInput:"Red value",greenInput:"Green value",blueInput:"Blue value",alphaInput:"Alpha value",hueInput:"Hue value",saturationInput:"Saturation value",lightnessInput:"Lightness value",hexInput:"HEX value",hexaInput:"HEX with alpha value",changeFormat:"Change color format"}}},V6="$vuetify.",j6=(t,e)=>t.replace(/\{(\d+)\}/g,(r,c)=>String(e[Number(c)])),V9=(t,e,r)=>function(c){for(var R=arguments.length,p=new Array(R>1?R-1:0),f=1;f<R;f++)p[f-1]=arguments[f];if(!c.startsWith(V6))return j6(c,p);const n=c.replace(V6,""),s=t.value&&r.value[t.value],u=e.value&&r.value[e.value];let i=Lv(s,n,null);return i||(`${c}${t.value}`,i=Lv(u,n,null)),i||(i=c),typeof i!="string"&&(i=c),j6(i,p)};function rS(t,e){return(r,c)=>new Intl.NumberFormat([t.value,e.value],c).format(r)}function j9(t,e){return rS(t,e)(.1).includes(",")?",":"."}function x5(t,e,r){const c=Ri(t,e,t[e]??r.value);return c.value=t[e]??r.value,ei(r,R=>{t[e]==null&&(c.value=r.value)}),c}function U9(t){return e=>{const r=x5(e,"locale",t.current),c=x5(e,"fallback",t.fallback),R=x5(e,"messages",t.messages);return{name:"vuetify",current:r,fallback:c,messages:R,decimalSeparator:Nn(()=>j9(r,c)),t:V9(r,c,R),n:rS(r,c),provide:U9({current:r,fallback:c,messages:R})}}}function H$(t){const e=ni((t==null?void 0:t.locale)??"en"),r=ni((t==null?void 0:t.fallback)??"en"),c=qr({en:U$,...t==null?void 0:t.messages});return{name:"vuetify",current:e,fallback:r,messages:c,decimalSeparator:Nn(()=>(t==null?void 0:t.decimalSeparator)??j9(e,r)),t:V9(e,r,c),n:rS(e,r),provide:U9({current:e,fallback:r,messages:c})}}const Sy=Symbol.for("vuetify:locale");function W$(t){return t.name!=null}function q$(t){const e=t!=null&&t.adapter&&W$(t==null?void 0:t.adapter)?t==null?void 0:t.adapter:H$(t),r=$$(e,t);return{...e,...r}}function Fo(){const t=Ea(Sy);if(!t)throw new Error("[Vuetify] Could not find injected locale instance");return t}function H9(t){const e=Ea(Sy);if(!e)throw new Error("[Vuetify] Could not find injected locale instance");const r=e.provide(t),c=Y$(r,e.rtl,t),R={...r,...c};return Ns(Sy,R),R}function G$(){return{af:!1,ar:!0,bg:!1,ca:!1,ckb:!1,cs:!1,de:!1,el:!1,en:!1,es:!1,et:!1,fa:!0,fi:!1,fr:!1,hr:!1,hu:!1,he:!0,id:!1,it:!1,ja:!1,km:!1,ko:!1,lv:!1,lt:!1,nl:!1,no:!1,pl:!1,pt:!1,ro:!1,ru:!1,sk:!1,sl:!1,srCyrl:!1,srLatn:!1,sv:!1,th:!1,tr:!1,az:!1,uk:!1,vi:!1,zhHans:!1,zhHant:!1}}function $$(t,e){const r=qr((e==null?void 0:e.rtl)??G$()),c=rn(()=>r.value[t.current.value]??!1);return{isRtl:c,rtl:r,rtlClasses:Nn(()=>`v-locale--is-${c.value?"rtl":"ltr"}`)}}function Y$(t,e,r){const c=rn(()=>r.rtl??e.value[t.current.value]??!1);return{isRtl:c,rtl:e,rtlClasses:Nn(()=>`v-locale--is-${c.value?"rtl":"ltr"}`)}}function ku(){const t=Ea(Sy);if(!t)throw new Error("[Vuetify] Could not find injected rtl instance");return{isRtl:t.isRtl,rtlClasses:t.rtlClasses}}function cx(t){const e=t.slice(-2).toUpperCase();switch(!0){case t==="GB-alt-variant":return{firstDay:0,firstWeekSize:4};case t==="001":return{firstDay:1,firstWeekSize:1};case`AG AS BD BR BS BT BW BZ CA CO DM DO ET GT GU HK HN ID IL IN JM JP KE
4215
4215
  KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PY SA SG SV TH TT TW UM US
4216
4216
  VE VI WS YE ZA ZW`.includes(e):return{firstDay:0,firstWeekSize:1};case`AI AL AM AR AU AZ BA BM BN BY CL CM CN CR CY EC GE HR KG KZ LB LK LV