openms-insight 0.1.0__py3-none-any.whl → 0.1.1__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.
- openms_insight/components/heatmap.py +64 -36
- openms_insight/components/lineplot.py +16 -3
- openms_insight/components/table.py +16 -3
- openms_insight/core/base.py +43 -23
- openms_insight/core/subprocess_preprocess.py +96 -0
- openms_insight/js-component/dist/assets/index.css +1 -1
- openms_insight/js-component/dist/assets/index.js +1 -1
- openms_insight/preprocessing/filtering.py +8 -15
- openms_insight/rendering/bridge.py +88 -27
- {openms_insight-0.1.0.dist-info → openms_insight-0.1.1.dist-info}/METADATA +12 -12
- {openms_insight-0.1.0.dist-info → openms_insight-0.1.1.dist-info}/RECORD +13 -12
- {openms_insight-0.1.0.dist-info → openms_insight-0.1.1.dist-info}/WHEEL +0 -0
- {openms_insight-0.1.0.dist-info → openms_insight-0.1.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -4201,7 +4201,7 @@ uniform ${Re} ${je} u_${tt};
|
|
|
4201
4201
|
#endif
|
|
4202
4202
|
`}),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(f,g,z,j,$,ie,de,xe,Ae){this.context=f;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):(f.bindVertexArray.set(this.vao),de&&de.bind(),$&&$.dynamicDraw&&$.bind(),xe&&xe.bind(),Ae&&Ae.bind())}freshBind(f,g,z,j,$,ie,de,xe){const Ae=f.numAttributes,Re=this.context,je=Re.gl;this.vao&&this.destroy(),this.vao=Re.createVertexArray(),Re.bindVertexArray.set(this.vao),this.boundProgram=f,this.boundLayoutVertexBuffer=g,this.boundPaintVertexBuffers=z,this.boundIndexBuffer=j,this.boundVertexOffset=$,this.boundDynamicVertexBuffer=ie,this.boundDynamicVertexBuffer2=de,this.boundDynamicVertexBuffer3=xe,g.enableAttributes(je,f);for(const tt of z)tt.enableAttributes(je,f);ie&&ie.enableAttributes(je,f),de&&de.enableAttributes(je,f),xe&&xe.enableAttributes(je,f),g.bind(),g.setVertexAttribPointers(je,f,$);for(const tt of z)tt.bind(),tt.setVertexAttribPointers(je,f,$);ie&&(ie.bind(),ie.setVertexAttribPointers(je,f,$)),j&&j.bind(),de&&(de.bind(),de.setVertexAttribPointers(je,f,$)),xe&&(xe.bind(),xe.setVertexAttribPointers(je,f,$)),Re.currentNumAttributes=Ae}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const _n=(V,f,g,z,j)=>({u_matrix:V,u_texture:0,u_ele_delta:f,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 f=[];for(let g=0;g<V.length;g++){if(V[g]===null)continue;const z=V[g].split(" ");f.push(z.pop())}return f}class or{constructor(f,g,z,j,$,ie){const de=f.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(`
|
|
4203
4203
|
`),Bt=Ct.concat(Ir.prelude.vertexSource,g.vertexSource).join(`
|
|
4204
|
-
`),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(f,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)}))(f,Kt),this.binderUniforms=z?z.getUniforms(f,Kt):[]}draw(f,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft,yt,Ct,kt,Bt){const At=f.gl;if(this.failedToCreate)return;if(f.program.set(this.program),f.setDepthMode(z),f.setStencilMode(j),f.setColorMode($),f.setCullFace(ie),xe){f.activeTexture.set(At.TEXTURE2),At.bindTexture(At.TEXTURE_2D,xe.depthTexture),f.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(f,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(f,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,f,g){const z=1/Tt(g,1,f.transform.tileZoom),j=Math.pow(2,g.tileID.overscaledZ),$=g.tileSize*Math.pow(2,f.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,f,g,z)=>{const j=f.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,-f.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,f,g,z,j,$,ie)=>i.e(sr(V,f,g,z),Wn($,f,ie),{u_height_factor:-Math.pow(2,j.overscaledZ)/ie.tileSize/8}),wr=V=>({u_matrix:V}),Ur=(V,f,g,z)=>i.e(wr(V),Wn(g,f,z)),ei=(V,f)=>({u_matrix:V,u_world:f}),vn=(V,f,g,z,j)=>i.e(Ur(V,f,g,z),{u_world:j}),qn=(V,f,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(f.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,f)=>({u_matrix:f,u_pixel_extrude_scale:[1/V.width,1/V.height]}),ln=(V,f,g)=>({u_matrix:V,u_inv_matrix:f,u_camera_to_center_distance:g.cameraToCenterDistance,u_viewport_size:[g.width,g.height]}),bn=(V,f,g=1)=>({u_matrix:V,u_color:f,u_overlay:0,u_overlay_scale:g}),Fn=V=>({u_matrix:V}),Bn=(V,f,g,z)=>({u_matrix:V,u_extrude_scale:Tt(f,1,g),u_intensity:z}),Kn=(V,f,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:f.paint.get("heatmap-opacity")}},Hn=(V,f,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(f.tileID.toUnwrapped(),xe),u_image:0,u_latrange:hn(0,f.tileID),u_light:[g.paint.get("hillshade-exaggeration"),de],u_shadow:j,u_highlight:$,u_accent:ie}},Dn=(V,f)=>{const g=f.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:f.getUnpackVector()}};function hn(V,f){const g=Math.pow(2,f.canonical.z),z=f.canonical.y;return[new i.Z(0,z/g).toLngLat().lat,new i.Z(0,(z+1)/g).toLngLat().lat]}const cn=(V,f,g,z)=>{const j=V.transform;return{u_matrix:yr(V,f,g,z),u_ratio:1/Tt(f,1,j.zoom),u_device_pixel_ratio:V.pixelRatio,u_units_to_pixels:[1/j.pixelsToGLUnits[0],1/j.pixelsToGLUnits[1]]}},En=(V,f,g,z,j)=>i.e(cn(V,f,g,j),{u_image:0,u_image_height:z}),tr=(V,f,g,z,j)=>{const $=V.transform,ie=fr(f,$);return{u_matrix:yr(V,f,g,j),u_texsize:f.imageAtlasTexture.size,u_ratio:1/Tt(f,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,f,g,z,j,$)=>{const ie=V.transform,de=V.lineAtlas,xe=fr(f,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,f,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,f){return 1/Tt(V,1,f.tileZoom)}function yr(V,f,g,z){return V.translatePosMatrix(z?z.posMatrix:f.tileID.posMatrix,f,g.paint.get("line-translate"),g.paint.get("line-translate-anchor"))}const Or=(V,f,g,z,j)=>{return{u_matrix:V,u_tl_parent:f,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 f=Math.sin(V),g=Math.cos(V);return[(2*g+1)/3,(-Math.sqrt(3)*f-g+1)/3,(Math.sqrt(3)*f-g+1)/3]}const Br=(V,f,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:f?f.uSizeT:0,u_size:f?f.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,f,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft)=>{const yt=ie.transform;return i.e(Br(V,f,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,f,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt)=>i.e(Cr(V,f,g,z,j,$,ie,de,xe,Ae,Re,!0,je,!0,lt),{u_texsize_icon:tt,u_texture_icon:1}),$r=(V,f,g)=>({u_matrix:V,u_opacity:f,u_color:g}),fi=(V,f,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:f}),Qr={fillExtrusion:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_lightpos:new i.aO(V,f.u_lightpos),u_lightintensity:new i.aJ(V,f.u_lightintensity),u_lightcolor:new i.aO(V,f.u_lightcolor),u_vertical_gradient:new i.aJ(V,f.u_vertical_gradient),u_opacity:new i.aJ(V,f.u_opacity)}),fillExtrusionPattern:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_lightpos:new i.aO(V,f.u_lightpos),u_lightintensity:new i.aJ(V,f.u_lightintensity),u_lightcolor:new i.aO(V,f.u_lightcolor),u_vertical_gradient:new i.aJ(V,f.u_vertical_gradient),u_height_factor:new i.aJ(V,f.u_height_factor),u_image:new i.aI(V,f.u_image),u_texsize:new i.aP(V,f.u_texsize),u_pixel_coord_upper:new i.aP(V,f.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,f.u_pixel_coord_lower),u_scale:new i.aO(V,f.u_scale),u_fade:new i.aJ(V,f.u_fade),u_opacity:new i.aJ(V,f.u_opacity)}),fill:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix)}),fillPattern:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_image:new i.aI(V,f.u_image),u_texsize:new i.aP(V,f.u_texsize),u_pixel_coord_upper:new i.aP(V,f.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,f.u_pixel_coord_lower),u_scale:new i.aO(V,f.u_scale),u_fade:new i.aJ(V,f.u_fade)}),fillOutline:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_world:new i.aP(V,f.u_world)}),fillOutlinePattern:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_world:new i.aP(V,f.u_world),u_image:new i.aI(V,f.u_image),u_texsize:new i.aP(V,f.u_texsize),u_pixel_coord_upper:new i.aP(V,f.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,f.u_pixel_coord_lower),u_scale:new i.aO(V,f.u_scale),u_fade:new i.aJ(V,f.u_fade)}),circle:(V,f)=>({u_camera_to_center_distance:new i.aJ(V,f.u_camera_to_center_distance),u_scale_with_map:new i.aI(V,f.u_scale_with_map),u_pitch_with_map:new i.aI(V,f.u_pitch_with_map),u_extrude_scale:new i.aP(V,f.u_extrude_scale),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_matrix:new i.aK(V,f.u_matrix)}),collisionBox:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_pixel_extrude_scale:new i.aP(V,f.u_pixel_extrude_scale)}),collisionCircle:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_inv_matrix:new i.aK(V,f.u_inv_matrix),u_camera_to_center_distance:new i.aJ(V,f.u_camera_to_center_distance),u_viewport_size:new i.aP(V,f.u_viewport_size)}),debug:(V,f)=>({u_color:new i.aM(V,f.u_color),u_matrix:new i.aK(V,f.u_matrix),u_overlay:new i.aI(V,f.u_overlay),u_overlay_scale:new i.aJ(V,f.u_overlay_scale)}),clippingMask:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix)}),heatmap:(V,f)=>({u_extrude_scale:new i.aJ(V,f.u_extrude_scale),u_intensity:new i.aJ(V,f.u_intensity),u_matrix:new i.aK(V,f.u_matrix)}),heatmapTexture:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_world:new i.aP(V,f.u_world),u_image:new i.aI(V,f.u_image),u_color_ramp:new i.aI(V,f.u_color_ramp),u_opacity:new i.aJ(V,f.u_opacity)}),hillshade:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_image:new i.aI(V,f.u_image),u_latrange:new i.aP(V,f.u_latrange),u_light:new i.aP(V,f.u_light),u_shadow:new i.aM(V,f.u_shadow),u_highlight:new i.aM(V,f.u_highlight),u_accent:new i.aM(V,f.u_accent)}),hillshadePrepare:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_image:new i.aI(V,f.u_image),u_dimension:new i.aP(V,f.u_dimension),u_zoom:new i.aJ(V,f.u_zoom),u_unpack:new i.aL(V,f.u_unpack)}),line:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_ratio:new i.aJ(V,f.u_ratio),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,f.u_units_to_pixels)}),lineGradient:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_ratio:new i.aJ(V,f.u_ratio),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,f.u_units_to_pixels),u_image:new i.aI(V,f.u_image),u_image_height:new i.aJ(V,f.u_image_height)}),linePattern:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_texsize:new i.aP(V,f.u_texsize),u_ratio:new i.aJ(V,f.u_ratio),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_image:new i.aI(V,f.u_image),u_units_to_pixels:new i.aP(V,f.u_units_to_pixels),u_scale:new i.aO(V,f.u_scale),u_fade:new i.aJ(V,f.u_fade)}),lineSDF:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_ratio:new i.aJ(V,f.u_ratio),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,f.u_units_to_pixels),u_patternscale_a:new i.aP(V,f.u_patternscale_a),u_patternscale_b:new i.aP(V,f.u_patternscale_b),u_sdfgamma:new i.aJ(V,f.u_sdfgamma),u_image:new i.aI(V,f.u_image),u_tex_y_a:new i.aJ(V,f.u_tex_y_a),u_tex_y_b:new i.aJ(V,f.u_tex_y_b),u_mix:new i.aJ(V,f.u_mix)}),raster:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_tl_parent:new i.aP(V,f.u_tl_parent),u_scale_parent:new i.aJ(V,f.u_scale_parent),u_buffer_scale:new i.aJ(V,f.u_buffer_scale),u_fade_t:new i.aJ(V,f.u_fade_t),u_opacity:new i.aJ(V,f.u_opacity),u_image0:new i.aI(V,f.u_image0),u_image1:new i.aI(V,f.u_image1),u_brightness_low:new i.aJ(V,f.u_brightness_low),u_brightness_high:new i.aJ(V,f.u_brightness_high),u_saturation_factor:new i.aJ(V,f.u_saturation_factor),u_contrast_factor:new i.aJ(V,f.u_contrast_factor),u_spin_weights:new i.aO(V,f.u_spin_weights)}),symbolIcon:(V,f)=>({u_is_size_zoom_constant:new i.aI(V,f.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,f.u_is_size_feature_constant),u_size_t:new i.aJ(V,f.u_size_t),u_size:new i.aJ(V,f.u_size),u_camera_to_center_distance:new i.aJ(V,f.u_camera_to_center_distance),u_pitch:new i.aJ(V,f.u_pitch),u_rotate_symbol:new i.aI(V,f.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,f.u_aspect_ratio),u_fade_change:new i.aJ(V,f.u_fade_change),u_matrix:new i.aK(V,f.u_matrix),u_label_plane_matrix:new i.aK(V,f.u_label_plane_matrix),u_coord_matrix:new i.aK(V,f.u_coord_matrix),u_is_text:new i.aI(V,f.u_is_text),u_pitch_with_map:new i.aI(V,f.u_pitch_with_map),u_is_along_line:new i.aI(V,f.u_is_along_line),u_is_variable_anchor:new i.aI(V,f.u_is_variable_anchor),u_texsize:new i.aP(V,f.u_texsize),u_texture:new i.aI(V,f.u_texture),u_translation:new i.aP(V,f.u_translation),u_pitched_scale:new i.aJ(V,f.u_pitched_scale)}),symbolSDF:(V,f)=>({u_is_size_zoom_constant:new i.aI(V,f.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,f.u_is_size_feature_constant),u_size_t:new i.aJ(V,f.u_size_t),u_size:new i.aJ(V,f.u_size),u_camera_to_center_distance:new i.aJ(V,f.u_camera_to_center_distance),u_pitch:new i.aJ(V,f.u_pitch),u_rotate_symbol:new i.aI(V,f.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,f.u_aspect_ratio),u_fade_change:new i.aJ(V,f.u_fade_change),u_matrix:new i.aK(V,f.u_matrix),u_label_plane_matrix:new i.aK(V,f.u_label_plane_matrix),u_coord_matrix:new i.aK(V,f.u_coord_matrix),u_is_text:new i.aI(V,f.u_is_text),u_pitch_with_map:new i.aI(V,f.u_pitch_with_map),u_is_along_line:new i.aI(V,f.u_is_along_line),u_is_variable_anchor:new i.aI(V,f.u_is_variable_anchor),u_texsize:new i.aP(V,f.u_texsize),u_texture:new i.aI(V,f.u_texture),u_gamma_scale:new i.aJ(V,f.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_is_halo:new i.aI(V,f.u_is_halo),u_translation:new i.aP(V,f.u_translation),u_pitched_scale:new i.aJ(V,f.u_pitched_scale)}),symbolTextAndIcon:(V,f)=>({u_is_size_zoom_constant:new i.aI(V,f.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,f.u_is_size_feature_constant),u_size_t:new i.aJ(V,f.u_size_t),u_size:new i.aJ(V,f.u_size),u_camera_to_center_distance:new i.aJ(V,f.u_camera_to_center_distance),u_pitch:new i.aJ(V,f.u_pitch),u_rotate_symbol:new i.aI(V,f.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,f.u_aspect_ratio),u_fade_change:new i.aJ(V,f.u_fade_change),u_matrix:new i.aK(V,f.u_matrix),u_label_plane_matrix:new i.aK(V,f.u_label_plane_matrix),u_coord_matrix:new i.aK(V,f.u_coord_matrix),u_is_text:new i.aI(V,f.u_is_text),u_pitch_with_map:new i.aI(V,f.u_pitch_with_map),u_is_along_line:new i.aI(V,f.u_is_along_line),u_is_variable_anchor:new i.aI(V,f.u_is_variable_anchor),u_texsize:new i.aP(V,f.u_texsize),u_texsize_icon:new i.aP(V,f.u_texsize_icon),u_texture:new i.aI(V,f.u_texture),u_texture_icon:new i.aI(V,f.u_texture_icon),u_gamma_scale:new i.aJ(V,f.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_is_halo:new i.aI(V,f.u_is_halo),u_translation:new i.aP(V,f.u_translation),u_pitched_scale:new i.aJ(V,f.u_pitched_scale)}),background:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_opacity:new i.aJ(V,f.u_opacity),u_color:new i.aM(V,f.u_color)}),backgroundPattern:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_opacity:new i.aJ(V,f.u_opacity),u_image:new i.aI(V,f.u_image),u_pattern_tl_a:new i.aP(V,f.u_pattern_tl_a),u_pattern_br_a:new i.aP(V,f.u_pattern_br_a),u_pattern_tl_b:new i.aP(V,f.u_pattern_tl_b),u_pattern_br_b:new i.aP(V,f.u_pattern_br_b),u_texsize:new i.aP(V,f.u_texsize),u_mix:new i.aJ(V,f.u_mix),u_pattern_size_a:new i.aP(V,f.u_pattern_size_a),u_pattern_size_b:new i.aP(V,f.u_pattern_size_b),u_scale_a:new i.aJ(V,f.u_scale_a),u_scale_b:new i.aJ(V,f.u_scale_b),u_pixel_coord_upper:new i.aP(V,f.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,f.u_pixel_coord_lower),u_tile_units_to_pixels:new i.aJ(V,f.u_tile_units_to_pixels)}),terrain:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_texture:new i.aI(V,f.u_texture),u_ele_delta:new i.aJ(V,f.u_ele_delta),u_fog_matrix:new i.aK(V,f.u_fog_matrix),u_fog_color:new i.aM(V,f.u_fog_color),u_fog_ground_blend:new i.aJ(V,f.u_fog_ground_blend),u_fog_ground_blend_opacity:new i.aJ(V,f.u_fog_ground_blend_opacity),u_horizon_color:new i.aM(V,f.u_horizon_color),u_horizon_fog_blend:new i.aJ(V,f.u_horizon_fog_blend)}),terrainDepth:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_ele_delta:new i.aJ(V,f.u_ele_delta)}),terrainCoords:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_texture:new i.aI(V,f.u_texture),u_terrain_coords_id:new i.aJ(V,f.u_terrain_coords_id),u_ele_delta:new i.aJ(V,f.u_ele_delta)}),sky:(V,f)=>({u_sky_color:new i.aM(V,f.u_sky_color),u_horizon_color:new i.aM(V,f.u_horizon_color),u_horizon:new i.aJ(V,f.u_horizon),u_sky_horizon_blend:new i.aJ(V,f.u_sky_horizon_blend)})};class Hr{constructor(f,g,z){this.context=f;const j=f.gl;this.buffer=j.createBuffer(),this.dynamicDraw=!!z,this.context.unbindVAO(),f.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(f){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,f.arrayBuffer)}destroy(){const f=this.context.gl;this.buffer&&(f.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(f,g,z,j){this.length=g.length,this.attributes=z,this.itemSize=g.bytesPerElement,this.dynamicDraw=j,this.context=f;const $=f.gl;this.buffer=$.createBuffer(),f.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(f){if(f.length!==this.length)throw new Error(`Length of new data is ${f.length}, which doesn't match current length of ${this.length}`);const g=this.context.gl;this.bind(),g.bufferSubData(g.ARRAY_BUFFER,0,f.arrayBuffer)}enableAttributes(f,g){for(let z=0;z<this.attributes.length;z++){const j=this.attributes[z],$=g.attributes[j.name];$!==void 0&&f.enableVertexAttribArray($)}}setVertexAttribPointers(f,g,z){for(let j=0;j<this.attributes.length;j++){const $=this.attributes[j],ie=g.attributes[$.name];ie!==void 0&&f.vertexAttribPointer(ie,$.components,f[oi[$.type]],!1,this.itemSize,$.offset+this.itemSize*(z||0))}}destroy(){const f=this.context.gl;this.buffer&&(f.deleteBuffer(this.buffer),delete this.buffer)}}const Bi=new WeakMap;function Ya(V){var f;if(Bi.has(V))return Bi.get(V);{const g=(f=V.getParameter(V.VERSION))===null||f===void 0?void 0:f.startsWith("WebGL 2.0");return Bi.set(V,g),g}}class Vi{constructor(f){this.gl=f.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(f){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ns extends Vi{getDefault(){return i.aN.transparent}set(f){const g=this.current;(f.r!==g.r||f.g!==g.g||f.b!==g.b||f.a!==g.a||this.dirty)&&(this.gl.clearColor(f.r,f.g,f.b,f.a),this.current=f,this.dirty=!1)}}class no extends Vi{getDefault(){return 1}set(f){(f!==this.current||this.dirty)&&(this.gl.clearDepth(f),this.current=f,this.dirty=!1)}}class ko extends Vi{getDefault(){return 0}set(f){(f!==this.current||this.dirty)&&(this.gl.clearStencil(f),this.current=f,this.dirty=!1)}}class el extends Vi{getDefault(){return[!0,!0,!0,!0]}set(f){const g=this.current;(f[0]!==g[0]||f[1]!==g[1]||f[2]!==g[2]||f[3]!==g[3]||this.dirty)&&(this.gl.colorMask(f[0],f[1],f[2],f[3]),this.current=f,this.dirty=!1)}}class Ui extends Vi{getDefault(){return!0}set(f){(f!==this.current||this.dirty)&&(this.gl.depthMask(f),this.current=f,this.dirty=!1)}}class Wo extends Vi{getDefault(){return 255}set(f){(f!==this.current||this.dirty)&&(this.gl.stencilMask(f),this.current=f,this.dirty=!1)}}class Bl extends Vi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(f){const g=this.current;(f.func!==g.func||f.ref!==g.ref||f.mask!==g.mask||this.dirty)&&(this.gl.stencilFunc(f.func,f.ref,f.mask),this.current=f,this.dirty=!1)}}class jo extends Vi{getDefault(){const f=this.gl;return[f.KEEP,f.KEEP,f.KEEP]}set(f){const g=this.current;(f[0]!==g[0]||f[1]!==g[1]||f[2]!==g[2]||this.dirty)&&(this.gl.stencilOp(f[0],f[1],f[2]),this.current=f,this.dirty=!1)}}class Wu extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;f?g.enable(g.STENCIL_TEST):g.disable(g.STENCIL_TEST),this.current=f,this.dirty=!1}}class Sl extends Vi{getDefault(){return[0,1]}set(f){const g=this.current;(f[0]!==g[0]||f[1]!==g[1]||this.dirty)&&(this.gl.depthRange(f[0],f[1]),this.current=f,this.dirty=!1)}}class Is extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;f?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST),this.current=f,this.dirty=!1}}class Gu extends Vi{getDefault(){return this.gl.LESS}set(f){(f!==this.current||this.dirty)&&(this.gl.depthFunc(f),this.current=f,this.dirty=!1)}}class qu extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;f?g.enable(g.BLEND):g.disable(g.BLEND),this.current=f,this.dirty=!1}}class dc extends Vi{getDefault(){const f=this.gl;return[f.ONE,f.ZERO]}set(f){const g=this.current;(f[0]!==g[0]||f[1]!==g[1]||this.dirty)&&(this.gl.blendFunc(f[0],f[1]),this.current=f,this.dirty=!1)}}class tl extends Vi{getDefault(){return i.aN.transparent}set(f){const g=this.current;(f.r!==g.r||f.g!==g.g||f.b!==g.b||f.a!==g.a||this.dirty)&&(this.gl.blendColor(f.r,f.g,f.b,f.a),this.current=f,this.dirty=!1)}}class Su extends Vi{getDefault(){return this.gl.FUNC_ADD}set(f){(f!==this.current||this.dirty)&&(this.gl.blendEquation(f),this.current=f,this.dirty=!1)}}class Al extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;f?g.enable(g.CULL_FACE):g.disable(g.CULL_FACE),this.current=f,this.dirty=!1}}class ro extends Vi{getDefault(){return this.gl.BACK}set(f){(f!==this.current||this.dirty)&&(this.gl.cullFace(f),this.current=f,this.dirty=!1)}}class rs extends Vi{getDefault(){return this.gl.CCW}set(f){(f!==this.current||this.dirty)&&(this.gl.frontFace(f),this.current=f,this.dirty=!1)}}class $u extends Vi{getDefault(){return null}set(f){(f!==this.current||this.dirty)&&(this.gl.useProgram(f),this.current=f,this.dirty=!1)}}class Au extends Vi{getDefault(){return this.gl.TEXTURE0}set(f){(f!==this.current||this.dirty)&&(this.gl.activeTexture(f),this.current=f,this.dirty=!1)}}class fu extends Vi{getDefault(){const f=this.gl;return[0,0,f.drawingBufferWidth,f.drawingBufferHeight]}set(f){const g=this.current;(f[0]!==g[0]||f[1]!==g[1]||f[2]!==g[2]||f[3]!==g[3]||this.dirty)&&(this.gl.viewport(f[0],f[1],f[2],f[3]),this.current=f,this.dirty=!1)}}class Yu extends Vi{getDefault(){return null}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.bindFramebuffer(g.FRAMEBUFFER,f),this.current=f,this.dirty=!1}}class du extends Vi{getDefault(){return null}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.bindRenderbuffer(g.RENDERBUFFER,f),this.current=f,this.dirty=!1}}class Zu extends Vi{getDefault(){return null}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.bindTexture(g.TEXTURE_2D,f),this.current=f,this.dirty=!1}}class Xu extends Vi{getDefault(){return null}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.bindBuffer(g.ARRAY_BUFFER,f),this.current=f,this.dirty=!1}}class Cu extends Vi{getDefault(){return null}set(f){const g=this.gl;g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,f),this.current=f,this.dirty=!1}}class Ls extends Vi{getDefault(){return null}set(f){var g;if(f===this.current&&!this.dirty)return;const z=this.gl;Ya(z)?z.bindVertexArray(f):(g=z.getExtension("OES_vertex_array_object"))===null||g===void 0||g.bindVertexArrayOES(f),this.current=f,this.dirty=!1}}class Lh extends Vi{getDefault(){return 4}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_ALIGNMENT,f),this.current=f,this.dirty=!1}}class fh extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f),this.current=f,this.dirty=!1}}class pc extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,f),this.current=f,this.dirty=!1}}class Ph extends Vi{constructor(f,g){super(f),this.context=f,this.parent=g}getDefault(){return null}}class Jh extends Ph{setDirty(){this.dirty=!0}set(f){if(f===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,f,0),this.current=f,this.dirty=!1}}class Nl extends Ph{set(f){if(f===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,f),this.current=f,this.dirty=!1}}class Qh extends Ph{set(f){if(f===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,f),this.current=f,this.dirty=!1}}class sd{constructor(f,g,z,j,$){this.context=f,this.width=g,this.height=z;const ie=f.gl,de=this.framebuffer=ie.createFramebuffer();if(this.colorAttachment=new Jh(f,de),j)this.depthAttachment=$?new Qh(f,de):new Nl(f,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 f=this.context.gl,g=this.colorAttachment.get();if(g&&f.deleteTexture(g),this.depthAttachment){const z=this.depthAttachment.get();z&&f.deleteRenderbuffer(z)}f.deleteFramebuffer(this.framebuffer)}}class Go{constructor(f,g,z){this.blendFunction=f,this.blendColor=g,this.mask=z}}Go.Replace=[1,0],Go.disabled=new Go(Go.Replace,i.aN.transparent,[!1,!1,!1,!1]),Go.unblended=new Go(Go.Replace,i.aN.transparent,[!0,!0,!0,!0]),Go.alphaBlended=new Go([1,771],i.aN.transparent,[!0,!0,!0,!0]);class Yc{constructor(f){var g,z;if(this.gl=f,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 Gu(this),this.blend=new qu(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 Lh(this),this.pixelStoreUnpackPremultiplyAlpha=new fh(this),this.pixelStoreUnpackFlipY=new pc(this),this.extTextureFilterAnisotropic=f.getExtension("EXT_texture_filter_anisotropic")||f.getExtension("MOZ_EXT_texture_filter_anisotropic")||f.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=f.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=f.getParameter(f.MAX_TEXTURE_SIZE),Ya(f)){this.HALF_FLOAT=f.HALF_FLOAT;const j=f.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(g=f.RGBA16F)!==null&&g!==void 0?g:j==null?void 0:j.RGBA16F_EXT,this.RGB16F=(z=f.RGB16F)!==null&&z!==void 0?z:j==null?void 0:j.RGB16F_EXT,f.getExtension("EXT_color_buffer_float")}else{f.getExtension("EXT_color_buffer_half_float"),f.getExtension("OES_texture_half_float_linear");const j=f.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(f,g){return new Hr(this,f,g)}createVertexBuffer(f,g,z){return new Mi(this,f,g,z)}createRenderbuffer(f,g,z){const j=this.gl,$=j.createRenderbuffer();return this.bindRenderbuffer.set($),j.renderbufferStorage(j.RENDERBUFFER,f,g,z),this.bindRenderbuffer.set(null),$}createFramebuffer(f,g,z,j){return new sd(this,f,g,z,j)}clear({color:f,depth:g,stencil:z}){const j=this.gl;let $=0;f&&($|=j.COLOR_BUFFER_BIT,this.clearColor.set(f),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(f){f.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(f.mode),this.frontFace.set(f.frontFace))}setDepthMode(f){f.func!==this.gl.ALWAYS||f.mask?(this.depthTest.set(!0),this.depthFunc.set(f.func),this.depthMask.set(f.mask),this.depthRange.set(f.range)):this.depthTest.set(!1)}setStencilMode(f){f.test.func!==this.gl.ALWAYS||f.mask?(this.stencilTest.set(!0),this.stencilMask.set(f.mask),this.stencilOp.set([f.fail,f.depthFail,f.pass]),this.stencilFunc.set({func:f.test.func,ref:f.ref,mask:f.test.mask})):this.stencilTest.set(!1)}setColorMode(f){i.aF(f.blendFunction,Go.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(f.blendFunction),this.blendColor.set(f.blendColor)),this.colorMask.set(f.mask)}createVertexArray(){var f;return Ya(this.gl)?this.gl.createVertexArray():(f=this.gl.getExtension("OES_vertex_array_object"))===null||f===void 0?void 0:f.createVertexArrayOES()}deleteVertexArray(f){var g;return Ya(this.gl)?this.gl.deleteVertexArray(f):(g=this.gl.getExtension("OES_vertex_array_object"))===null||g===void 0?void 0:g.deleteVertexArrayOES(f)}unbindVAO(){this.bindVertexArray.set(null)}}class Qi{constructor(f,g,z){this.func=f,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(f,g,z,j,$,ie){this.test=f,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(f,g,z){this.enable=f,this.mode=g,this.frontFace=z}}let Vl;function dl(V,f,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=f.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 Zc=i.ao(new Float32Array(16));function Ku(V,f,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,f,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,f,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,f,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),f.map.showCollisionBoxes&&(dl(V,f,g,z,!0),dl(V,f,g,z,!1))}function pl(V,f,g,z,j,$){const{horizontalAlign:ie,verticalAlign:de}=i.av(V),xe=-(ie-.5)*f,Ae=-(de-.5)*g;return new i.P((xe/j+z[0])*$,(Ae/j+z[1])*$)}function Cl(V,f,g,z,j,$){const ie=f.tileAnchorPoint.add(new i.P(f.translation[0],f.translation[1]));if(f.pitchWithMap){let de=z.mult($);return g||(de=de.rotate(-j)),Ut(ie.add(de),f.labelPlaneMatrix,f.getElevation).point}if(g){const de=$e(f.tileAnchorPoint.x+1,f.tileAnchorPoint.y,f).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,f,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,f,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,f,g){return g.iconsInText&&f?"symbolTextAndIcon":V?"symbolSDF":"symbolIcon"}function Pc(V,f,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=f.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],qi=null;if(j){if(vi=er.glyphAtlasTexture,Wi=lt.LINEAR,ri=er.glyphAtlasTexture.size,Tr.iconsInText){Yi=er.imageAtlasTexture.size,qi=er.imageAtlasTexture;const Gi=Pr.kind==="composite"||Pr.kind==="camera";Di=br||V.options.rotating||V.options.zooming||Gi?lt.LINEAR:lt.NEAREST}}else{const Gi=g.layout.get("icon-size").constantOr(0)!==1||Tr.iconsNeedLinear;vi=er.imageAtlasTexture,Wi=ur||V.options.rotating||V.options.zooming||Gi||br?lt.LINEAR:lt.NEAREST,ri=er.imageAtlasTexture.size}const ea=Tt(er,1,V.transform.zoom),_a=$t?$n.posMatrix:Zc,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 Gi=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,Gi)}const Pa=$n.posMatrix,va=j&&Tn||oo,Ca=Bt||va?Zc:So,Wa=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,Wa,Aa,ri,Yi,jn):Cr(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,Wa,Aa,j,ri,!0,jn):Br(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,Wa,Aa,j,ri,jn);const Lo={program:Nr,buffers:rr,uniformValues:Kl,atlasTexture:vi,atlasTextureIcon:qi,atlasInterpolation:Wi,atlasInterpolationIcon:Di,isSDF:ur,hasHalo:aa};if(Kt&&Tr.canOverlap){Yt=!0;const Gi=rr.segments.get();for(const _s of Gi)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,ef(er.buffers,$n.segments,g,V,er.program,pn,Re,je,Tr,$n.terrainData)),Tr.u_is_halo=0}ef(er.buffers,$n.segments,g,V,er.program,pn,Re,je,er.uniformValues,$n.terrainData)}}function ef(V,f,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,f,g.paint,z.transform.zoom,V.programConfigurations.get(g.id),V.dynamicLayoutVertexBuffer,V.opacityVertexBuffer)}function Ju(V,f,g,z){if(g.paint.get("heatmap-opacity")!==0)if(V.renderPass==="offscreen"){const j=V.context,$=j.gl,ie=Za.disabled,de=new Go([$.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(f.hasRenderableParent(Ae))continue;const Re=f.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,f,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(f);ie=$[xe],de=$[xe]}ie&&de&&V.setConstantPatternPositions(ie,de)}function dh(V,f,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=f.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):ei(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 Xc(V,f,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=f.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 Kc(V,f,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(f);de.activeTexture.set(xe.TEXTURE0),xe.bindTexture(xe.TEXTURE_2D,Ae.colorAttachment.get());const tt=je?f: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,f,g,z,j,$){const ie=V.context,de=ie.gl,xe=f.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),f.demTexture=f.demTexture||V.getTileTexture(Re),f.demTexture){const lt=f.demTexture;lt.update(je,{premultiply:!1}),lt.bind(de.NEAREST,de.CLAMP_TO_EDGE)}else f.demTexture=new D(ie,je,de.RGBA,{premultiply:!1}),f.demTexture.bind(de.NEAREST,de.CLAMP_TO_EDGE);ie.activeTexture.set(de.TEXTURE0);let tt=f.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=f.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(f.tileID,xe),null,g.id,V.rasterBoundsBuffer,V.quadTriangleIndexBuffer,V.rasterBoundsSegments),f.needsHillshadePrepare=!1}}function jl(V,f,g,z,j,$){const ie=z.paint.get("raster-fade-duration");if(!$&&ie>0){const de=v.now(),xe=(de-V.timeAdded)/ie,Ae=f?(de-f.timeAdded)/ie:-1,Re=g.getSource(),je=j.coveringZoomLevel({tileSize:Re.tileSize,roundZoom:Re.roundZoom}),tt=!f||Math.abs(f.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),f?{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),Dh=new i.aN(0,1,1,1);function Rh(V){const f=V.transform.padding;ph(V,V.transform.height-(f.top||0),3,pu),ph(V,f.bottom||0,3,ec),Ps(V,f.left||0,3,Ul),Ps(V,V.transform.width-(f.right||0),3,ga);const g=V.transform.centerPoint;(function(z,j,$,ie){Jc(z,j-1,$-10,2,20,ie),Jc(z,j-10,$-1,20,2,ie)})(V,g.x,V.transform.height-g.y,Dh)}function ph(V,f,g,z){Jc(V,0,f+g/2,V.transform.width,g,z)}function Ps(V,f,g,z){Jc(V,f-g/2,0,g,V.transform.height,z)}function Jc(V,f,g,z,j,$){const ie=V.context,de=ie.gl;de.enable(de.SCISSOR_TEST),de.scissor(f*V.pixelRatio,g*V.pixelRatio,z*V.pixelRatio,j*V.pixelRatio),ie.clear({color:$}),de.disable(de.SCISSOR_TEST)}function Hf(V,f,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=f.getTileByID(g.key).latestRawTileData,lt=tt&&tt.byteLength||0,ft=Math.floor(lt/1024),yt=f.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,Go.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,f,g){const z=V.context,j=z.gl,$=V.colorModeForRenderPass(),ie=new Qi(j.LEQUAL,Qi.ReadWrite,V.depthRangeFor3D),de=V.useProgram("terrain"),xe=f.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=f.getTerrainData(Ae.tileID);z.activeTexture.set(j.TEXTURE0),j.bindTexture(j.TEXTURE_2D,Re.texture);const tt=V.transform.calculatePosMatrix(Ae.tileID.toUnwrapped()),lt=f.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(f,g,z){this.vertexBuffer=f,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(f,g){this.context=new Yc(f),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(f,g,z){if(this.width=Math.floor(f*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 f=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=f.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=f.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=f.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=f.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=f.createIndexBuffer(ie);const de=new i.aY;de.emplaceBack(0,1,2),de.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=f.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 f=this.context,g=f.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(f,g.TRIANGLES,Qi.disabled,this.stencilClearMode,Go.disabled,Xa.disabled,Fn(z),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(f,g){if(this.currentStencilSource===f.source||!f.isTileClipped()||!g||!g.length)return;this.currentStencilSource=f.source;const z=this.context,j=z.gl;this.nextStencilID+g.length>256&&this.clearStencil(),z.setColorMode(Go.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),Go.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 f=this.nextStencilID++,g=this.context.gl;return new Za({func:g.NOTEQUAL,mask:255},f,255,g.KEEP,g.KEEP,g.REPLACE)}stencilModeForClipping(f){const g=this.context.gl;return new Za({func:g.EQUAL,mask:255},this._tileClippingMaskIDs[f.key],0,g.KEEP,g.KEEP,g.REPLACE)}stencilConfigForOverlap(f){const g=this.context.gl,z=f.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 f=this.context.gl;return this._showOverdrawInspector?new Go([f.CONSTANT_COLOR,f.ONE],new i.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Go.unblended:Go.alphaBlended}depthModeForSublayer(f,g,z){if(!this.opaquePassEnabledForLayer())return Qi.disabled;const j=1-((1+this.currentLayer)*this.numSublayers+f)*this.depthEpsilon;return new Qi(z||this.context.gl.LEQUAL,g,[j,j])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(f,g){var z;this.style=f,this.options=g,this.lineAtlas=f.lineAtlas,this.imageManager=f.imageManager,this.glyphManager=f.glyphManager,this.symbolFadeChange=f.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-(f._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&&Rh(this),this.context.setDefault()}maybeDrawDepthAndCoords(f){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=f?!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=Go.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=Go.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(f,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(f,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:qn($,$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)}})(f,g,z,j);break;case"heatmap":Ju(f,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}})(f,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);dh($,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);dh($,ie,de,xe,ft,je,!0)}})(f,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))Xc($,ie,de,xe,Re,Za.disabled,Go.disabled),Xc($,ie,de,xe,Re,$.stencilModeFor3D(),$.colorModeForRenderPass());else{const je=$.colorModeForRenderPass();Xc($,ie,de,xe,Re,Za.disabled,je)}}})(f,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"&&Kc($,ft,yt,de,Re,tt[ft.overscaledZ],je)}Ae.viewport.set([0,0,$.width,$.height])})(f,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)}})(f,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)}})(f,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)}})(f,0,z)}}translatePosMatrix(f,g,z,j,$){if(!z[0]&&!z[1])return f;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,f,de),xe}saveTileTexture(f){const g=this._tileTextures[f.size[0]];g?g.push(f):this._tileTextures[f.size[0]]=[f]}getTileTexture(f){const g=this._tileTextures[f];return g&&g.length>0?g.pop():null}isPatternMissing(f){if(!f)return!1;if(!f.from||!f.to)return!0;const g=this.imageManager.getPattern(f.from.toString()),z=this.imageManager.getPattern(f.to.toString());return!g||!z}useProgram(f,g){this.cache=this.cache||{};const z=f+(g?g.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[z]||(this.cache[z]=new or(this.context,Ir[f],g,Qr[f],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 f=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(f.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;const f=this.context.gl;this.debugOverlayTexture=new D(this.context,this.debugOverlayCanvas,f.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:f,drawingBufferHeight:g}=this.context.gl;return this.width!==f||this.height!==g}}class mu{constructor(f,g){this.points=f,this.planes=g}static fromInvProjectionMatrix(f,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,f))[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(f,g){this.min=f,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(f){const g=[f%2==0,f<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(f){return Math.max(Math.min(this.max[0],f[0]),this.min[0])-f[0]}distanceY(f){return Math.max(Math.min(this.max[1],f[1]),this.min[1])-f[1]}intersects(f){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<f.planes.length;j++){const $=f.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<f.points.length;de++){const xe=f.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(f=0,g=0,z=0,j=0){if(isNaN(f)||f<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=f,this.bottom=g,this.left=z,this.right=j}interpolate(f,g,z){return g.top!=null&&f.top!=null&&(this.top=i.z.number(f.top,g.top,z)),g.bottom!=null&&f.bottom!=null&&(this.bottom=i.z.number(f.bottom,g.bottom,z)),g.left!=null&&f.left!=null&&(this.left=i.z.number(f.left,g.left,z)),g.right!=null&&f.right!=null&&(this.right=i.z.number(f.right,g.right,z)),this}getCenter(f,g){const z=i.ad((this.left+f-this.right)/2,0,f),j=i.ad((this.top+g-this.bottom)/2,0,g);return new i.P(z,j)}equals(f){return this.top===f.top&&this.bottom===f.bottom&&this.left===f.left&&this.right===f.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 Qc=85.051129;class Ia{constructor(f,g,z,j,$){this.tileSize=512,this._renderWorldCopies=$===void 0||!!$,this._minZoom=f||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 f=new Ia(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return f.apply(this),f}apply(f){this.tileSize=f.tileSize,this.latRange=f.latRange,this.width=f.width,this.height=f.height,this._center=f._center,this._elevation=f._elevation,this.minElevationForCurrentTile=f.minElevationForCurrentTile,this.zoom=f.zoom,this.angle=f.angle,this._fov=f._fov,this._pitch=f._pitch,this._unmodified=f._unmodified,this._edgeInsets=f._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(f){this._minZoom!==f&&(this._minZoom=f,this.zoom=Math.max(this.zoom,f))}get maxZoom(){return this._maxZoom}set maxZoom(f){this._maxZoom!==f&&(this._maxZoom=f,this.zoom=Math.min(this.zoom,f))}get minPitch(){return this._minPitch}set minPitch(f){this._minPitch!==f&&(this._minPitch=f,this.pitch=Math.max(this.pitch,f))}get maxPitch(){return this._maxPitch}set maxPitch(f){this._maxPitch!==f&&(this._maxPitch=f,this.pitch=Math.min(this.pitch,f))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(f){f===void 0?f=!0:f===null&&(f=!1),this._renderWorldCopies=f}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(f){const g=-i.b3(f,-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(f){const g=i.ad(f,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(f){f=Math.max(.01,Math.min(60,f)),this._fov!==f&&(this._unmodified=!1,this._fov=f/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(f){const g=Math.min(Math.max(f,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(f){f.lat===this._center.lat&&f.lng===this._center.lng||(this._unmodified=!1,this._center=f,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(f){f!==this._elevation&&(this._elevation=f,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(f){this._edgeInsets.equals(f)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,f,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(f){return this._edgeInsets.equals(f)}interpolatePadding(f,g,z){this._unmodified=!1,this._edgeInsets.interpolate(f,g,z),this._constrain(),this._calcMatrices()}coveringZoomLevel(f){const g=(f.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/f.tileSize));return Math.max(0,g)}getVisibleUnwrappedCoordinates(f){const g=[new i.b4(0,f)];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,f))}return g}coveringTiles(f){var g,z;let j=this.coveringZoomLevel(f);const $=j;if(f.minzoom!==void 0&&j<f.minzoom)return[];f.maxzoom!==void 0&&j>f.maxzoom&&(j=f.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=f.minzoom||0;!f.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(tt=j);const lt=f.terrain?2/Math.min(this.tileSize,f.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=f.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=f.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(f.terrain){const Pr=new i.S(Ar,At.wrap,Ar,Tr,rr),br=f.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(f,g){this.width=f,this.height=g,this.pixelsToGLUnits=[2/f,-2/g],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(f){return Math.pow(2,f)}scaleZoom(f){return Math.log(f)/Math.LN2}project(f){const g=i.ad(f.lat,-85.051129,Qc);return new i.P(i.O(f.lng)*this.worldSize,i.Q(g)*this.worldSize)}unproject(f){return new i.Z(f.x/this.worldSize,f.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(f){const g=this.elevation,z=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,j=this.pointLocation(this.centerPoint,f),$=f.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(f,g){const z=this.pointCoordinate(g),j=this.pointCoordinate(this.centerPoint),$=this.locationCoordinate(f),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(f,g){return g?this.coordinatePoint(this.locationCoordinate(f),g.getElevationForLngLatZoom(f,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(f))}pointLocation(f,g){return this.coordinateLocation(this.pointCoordinate(f,g))}locationCoordinate(f){return i.Z.fromLngLat(f)}coordinateLocation(f){return f&&f.toLngLat()}pointCoordinate(f,g){if(g){const ft=g.pointCoordinate(f);if(ft!=null)return ft}const z=[f.x,f.y,0,1],j=[f.x,f.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(f,g=0,z=this.pixelMatrix){const j=[f.x*this.worldSize,f.y*this.worldSize,g,1];return i.ag(j,j,z),new i.P(j[0]/j[3],j[1]/j[3])}getBounds(){const f=Math.max(0,this.height/2-this.getHorizon());return new Se().extend(this.pointLocation(new i.P(0,f))).extend(this.pointLocation(new i.P(this.width,f))).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(f){f?(this.lngRange=[f.getWest(),f.getEast()],this.latRange=[f.getSouth(),f.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Qc])}calculateTileMatrix(f){const g=f.canonical,z=this.worldSize/this.zoomScale(g.z),j=g.x+Math.pow(2,g.z)*f.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(f,g=!1){const z=f.key,j=g?this._alignedPosMatrixCache:this._posMatrixCache;if(j[z])return j[z];const $=this.calculateTileMatrix(f);return i.L($,g?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,$),j[z]=new Float32Array($),j[z]}calculateFogMatrix(f){const g=f.key,z=this._fogMatrixCache;if(z[g])return z[g];const j=this.calculateTileMatrix(f);return i.L(j,this.fogMatrix,j),z[g]=new Float32Array(j),z[g]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(f,g){g=i.ad(+g,this.minZoom,this.maxZoom);const z={center:new i.N(f.lng,f.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:$},f);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 f=this._unmodified,{center:g,zoom:z}=this.getConstrained(this.center,this.zoom);this.center=g,this.zoom=z,this._unmodified=f,this._constraining=!1}_calcMatrices(){if(!this.height)return;const f=this._fov/2,g=this.centerOffset,z=this.point.x,j=this.point.y;this.cameraToCenterDistance=.5/Math.tan(f)*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 f=this.pointCoordinate(new i.P(0,0)),g=[f.x*this.worldSize,f.y*this.worldSize,0,1];return i.ag(g,g,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const f=this._pitch,g=Math.tan(f)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,g))}getCameraQueryGeometry(f){const g=this.getCameraPoint();if(f.length===1)return[f[0],g];{let z=g.x,j=g.y,$=g.x,ie=g.y;for(const de of f)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(f,g){const z=this.locationCoordinate(f),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,f){let g,z=!1,j=null,$=null;const ie=()=>{j=null,z&&(V.apply($,g),j=setTimeout(ie,f),z=!1)};return(...de)=>(z=!0,$=this,g=de,j||ie(),j)}class qo{constructor(f){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=f&&encodeURIComponent(f)}addTo(f){return this._map=f,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(f){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+=f?`/${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),eh=i.e({deceleration:1e3,maxSpeed:90},nl);class zc{constructor(f){this._map=f,this.clear()}clear(){this._inertiaBuffer=[]}record(f){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:v.now(),settings:f})}_drainInertiaBuffer(){const f=this._inertiaBuffer,g=v.now();for(;f.length>0&&g-f[0].time>160;)f.shift()}_onMoveEnd(f){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,f||{}));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,eh);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,f){(!V.duration||V.duration<f.duration)&&(V.duration=f.duration,V.easing=f.easing)}function vc(V,f,g){const{maxSpeed:z,linearity:j,deceleration:$}=g,ie=i.ad(V*j/(f/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(f,g,z,j={}){const $=o.mousePos(g.getCanvas(),z),ie=g.unproject($);super(f,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(f,g,z){const j=f==="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(f,{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(f,g,z){super(f,{originalEvent:z}),this._defaultPrevented=!1}}class Fc{constructor(f,g){this._map=f,this._clickTolerance=g.clickTolerance}reset(){delete this._mousedownPos}wheel(f){return this._firePreventable(new Mu(f.type,this._map,f))}mousedown(f,g){return this._mousedownPos=g,this._firePreventable(new Ds(f.type,this._map,f))}mouseup(f){this._map.fire(new Ds(f.type,this._map,f))}click(f,g){this._mousedownPos&&this._mousedownPos.dist(g)>=this._clickTolerance||this._map.fire(new Ds(f.type,this._map,f))}dblclick(f){return this._firePreventable(new Ds(f.type,this._map,f))}mouseover(f){this._map.fire(new Ds(f.type,this._map,f))}mouseout(f){this._map.fire(new Ds(f.type,this._map,f))}touchstart(f){return this._firePreventable(new ys(f.type,this._map,f))}touchmove(f){this._map.fire(new ys(f.type,this._map,f))}touchend(f){this._map.fire(new ys(f.type,this._map,f))}touchcancel(f){this._map.fire(new ys(f.type,this._map,f))}_firePreventable(f){if(this._map.fire(f),f.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(f){this._map=f}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(f){this._map.fire(new Ds(f.type,this._map,f))}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(f){this._delayContextMenu?this._contextMenuEvent=f:this._ignoreContextMenu||this._map.fire(new Ds(f.type,this._map,f)),this._map.listens("contextmenu")&&f.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class io{constructor(f){this._map=f}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(f){return this.transform.pointLocation(i.P.convert(f),this._map.terrain)}}class bs{constructor(f,g){this._map=f,this._tr=new io(f),this._el=f.getCanvasContainer(),this._container=f.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(f,g){this.isEnabled()&&f.shiftKey&&f.button===0&&(o.disableDrag(),this._startPos=this._lastPos=g,this._active=!0)}mousemoveWindow(f,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",f));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(f,g){if(!this._active||f.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:f})),{cameraAnimation:$=>$.fitScreenCoordinates(z,j,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",f)}keydown(f){this._active&&f.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",f))}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(f,g){return this._map.fire(new i.k(f,{originalEvent:g}))}}function Ba(V,f){if(V.length!==f.length)throw new Error(`The number of touches and points are not equal - touches ${V.length}, points ${f.length}`);const g={};for(let z=0;z<V.length;z++)g[V[z].identifier]=f[z];return g}class $o{constructor(f){this.reset(),this.numTouches=f.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(f,g,z){(this.centroid||z.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=f.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(f,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(f,g,z){if((!this.centroid||f.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(f){this.singleTap=new $o(f),this.numTaps=f.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(f,g,z){this.singleTap.touchstart(f,g,z)}touchmove(f,g,z){this.singleTap.touchmove(f,g,z)}touchend(f,g,z){const j=this.singleTap.touchend(f,g,z);if(j){const $=f.timeStamp-this.lastTime<500,ie=!this.lastTap||this.lastTap.dist(j)<30;if($&&ie||this.reset(),this.count++,this.lastTime=f.timeStamp,this.lastTap=j,this.count===this.numTaps)return this.reset(),j}}}class is{constructor(f){this._tr=new io(f),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(f,g,z){this._zoomIn.touchstart(f,g,z),this._zoomOut.touchstart(f,g,z)}touchmove(f,g,z){this._zoomIn.touchmove(f,g,z),this._zoomOut.touchmove(f,g,z)}touchend(f,g,z){const j=this._zoomIn.touchend(f,g,z),$=this._zoomOut.touchend(f,g,z),ie=this._tr;return j?(this._active=!0,f.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom+1,around:ie.unproject(j)},{originalEvent:f})}):$?(this._active=!0,f.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom-1,around:ie.unproject($)},{originalEvent:f})}):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(f){this._enabled=!!f.enable,this._moveStateManager=f.moveStateManager,this._clickTolerance=f.clickTolerance||1,this._moveFunction=f.move,this._activateOnStart=!!f.activateOnStart,f.assignEvents(this),this.reset()}reset(f){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(f)}_move(...f){const g=this._moveFunction(...f);if(g.bearingDelta||g.pitchDelta||g.around||g.panDelta)return this._active=!0,g}dragStart(f,g){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(f)&&(this._moveStateManager.startMove(f),this._lastPoint=g.length?g[0]:g,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(f,g){if(!this.isEnabled())return;const z=this._lastPoint;if(!z)return;if(f.preventDefault(),!this._moveStateManager.isValidMoveEvent(f))return void this.reset(f);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(f){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(f)&&(this._moved&&o.suppressClick(),this.reset(f))}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(f){this._correctEvent=f.checkCorrectEvent}startMove(f){const g=o.mouseButton(f);this._eventButton=g}endMove(f){delete this._eventButton}isValidStartEvent(f){return this._correctEvent(f)}isValidMoveEvent(f){return!function(g,z){const j=Eu[z];return g.buttons===void 0||(g.buttons&j)!==j}(f,this._eventButton)}isValidEndEvent(f){return o.mouseButton(f)===this._eventButton}}class nc{constructor(){this._firstTouch=void 0}_isOneFingerTouch(f){return f.targetTouches.length===1}_isSameTouchEvent(f){return f.targetTouches[0].identifier===this._firstTouch}startMove(f){const g=f.targetTouches[0].identifier;this._firstTouch=g}endMove(f){delete this._firstTouch}isValidStartEvent(f){return this._isOneFingerTouch(f)}isValidMoveEvent(f){return this._isOneFingerTouch(f)&&this._isSameTouchEvent(f)}isValidEndEvent(f){return this._isOneFingerTouch(f)&&this._isSameTouchEvent(f)}}const Rs=V=>{V.mousedown=V.dragStart,V.mousemoveWindow=V.dragMove,V.mouseup=V.dragEnd,V.contextmenu=f=>{f.preventDefault()}},yc=({enable:V,clickTolerance:f,bearingDegreesPerPixelMoved:g=.8})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:f,move:(j,$)=>({bearingDelta:($.x-j.x)*g}),moveStateManager:z,enable:V,assignEvents:Rs})},Iu=({enable:V,clickTolerance:f,pitchDegreesPerPixelMoved:g=-.5})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:f,move:(j,$)=>({pitchDelta:($.y-j.y)*g}),moveStateManager:z,enable:V,assignEvents:Rs})};class Gl{constructor(f,g){this._clickTolerance=f.clickTolerance||1,this._map=g,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new i.P(0,0)}_shouldBePrevented(f){return f<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(f,g,z){return this._calculateTransform(f,g,z)}touchmove(f,g,z){if(this._active){if(!this._shouldBePrevented(z.length))return f.preventDefault(),this._calculateTransform(f,g,z);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",f)}}touchend(f,g,z){this._calculateTransform(f,g,z),this._active&&this._shouldBePrevented(z.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(f,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(f,g,z){this._firstTwoTouches||z.length<2||(this._firstTwoTouches=[z[0].identifier,z[1].identifier],this._start([g[0],g[1]]))}touchmove(f,g,z){if(!this._firstTwoTouches)return;f.preventDefault();const[j,$]=this._firstTwoTouches,ie=Ha(z,g,j),de=Ha(z,g,$);if(!ie||!de)return;const xe=this._aroundCenter?null:ie.add(de).div(2);return this._move([ie,de],xe,f)}touchend(f,g,z){if(!this._firstTwoTouches)return;const[j,$]=this._firstTwoTouches,ie=Ha(z,g,j),de=Ha(z,g,$);ie&&de||(this._active&&o.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(f){this._enabled=!0,this._aroundCenter=!!f&&f.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Ha(V,f,g){for(let z=0;z<V.length;z++)if(V[z].identifier===g)return f[z]}function ql(V,f){return Math.log(V/f)/Math.LN2}class ki extends as{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(f){this._startDistance=this._distance=f[0].dist(f[1])}_move(f,g){const z=this._distance;if(this._distance=f[0].dist(f[1]),this._active||!(Math.abs(ql(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ql(this._distance,z),pinchAround:g}}}function th(V,f){return 180*V.angleWith(f)/Math.PI}class Oh extends as{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(f){this._startVector=this._vector=f[0].sub(f[1]),this._minDiameter=f[0].dist(f[1])}_move(f,g,z){const j=this._vector;if(this._vector=f[0].sub(f[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:th(this._vector,j),pinchAround:g}}_isBelowThreshold(f){this._minDiameter=Math.min(this._minDiameter,f.mag());const g=25/(Math.PI*this._minDiameter)*360,z=th(f,this._startVector);return Math.abs(z)<g}}function Lu(V){return Math.abs(V.y)>Math.abs(V.x)}class rc extends as{constructor(f){super(),this._currentTouchCount=0,this._map=f}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(f,g,z){super.touchstart(f,g,z),this._currentTouchCount=z.length}_start(f){this._lastPoints=f,Lu(f[0].sub(f[1]))&&(this._valid=!1)}_move(f,g,z){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const j=f[0].sub(this._lastPoints[0]),$=f[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(j,$,z.timeStamp),this._valid?(this._lastPoints=f,this._active=!0,{pitchDelta:(j.y+$.y)/2*-.5}):void 0}gestureBeginsVertically(f,g,z){if(this._valid!==void 0)return this._valid;const j=f.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=f.y>0==g.y>0;return Lu(f)&&Lu(g)&&ie}}const ic={panStep:100,bearingStep:15,pitchStep:10};class Bc{constructor(f){this._tr=new io(f);const g=ic;this._panStep=g.panStep,this._bearingStep=g.bearingStep,this._pitchStep=g.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(f){if(f.altKey||f.ctrlKey||f.metaKey)return;let g=0,z=0,j=0,$=0,ie=0;switch(f.keyCode){case 61:case 107:case 171:case 187:g=1;break;case 189:case 109:case 173:g=-1;break;case 37:f.shiftKey?z=-1:(f.preventDefault(),$=-1);break;case 39:f.shiftKey?z=1:(f.preventDefault(),$=1);break;case 38:f.shiftKey?j=1:(f.preventDefault(),ie=-1);break;case 40:f.shiftKey?j=-1:(f.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*(f.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:f})}}}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(f,g){this._onTimeout=z=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(z)},this._map=f,this._tr=new io(f),this._triggerRenderFrame=g,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(f){this._defaultZoomRate=f}setWheelZoomRate(f){this._wheelZoomRate=f}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(f){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!f&&f.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(f){return!!this._map.cooperativeGestures.isEnabled()&&!(f.ctrlKey||this._map.cooperativeGestures.isBypassed(f))}wheel(f){if(!this.isEnabled())return;if(this._shouldBePrevented(f))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",f);let g=f.deltaMode===WheelEvent.DOM_DELTA_LINE?40*f.deltaY:f.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,f)):this._type||(this._type=Math.abs(j*g)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,g+=this._lastValue)),f.shiftKey&&g&&(g/=4),this._type&&(this._lastWheelEvent=f,this._delta-=g,this._active||this._start(f)),f.preventDefault()}_start(f){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(),f),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 f=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"?f.zoomScale(this._targetZoom):f.scale;this._targetZoom=Math.min(f.maxZoom,Math.max(f.minZoom,f.scaleZoom(Re*Ae))),this._type==="wheel"&&(this._startZoom=f.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const g=typeof this._targetZoom=="number"?this._targetZoom:f.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:$-f.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(f){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:f,easing:g},g}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ao{constructor(f,g){this._clickZoom=f,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(f){this._tr=new io(f),this.reset()}reset(){this._active=!1}dblclick(f,g){return f.preventDefault(),{cameraAnimation:z=>{z.easeTo({duration:300,zoom:this._tr.zoom+(f.shiftKey?-1:1),around:this._tr.unproject(g)},{originalEvent:f})}}}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(f,g,z){if(!this._swipePoint)if(this._tapTime){const j=g[0],$=f.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(f,g,z)}touchmove(f,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,f.preventDefault(),this._active=!0,{zoomDelta:$/128}}}else this._tap.touchmove(f,g,z)}touchend(f,g,z){if(this._tapTime)this._swipePoint&&z.length===0&&this.reset();else{const j=this._tap.touchend(f,g,z);j&&(this._tapTime=f.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(f,g,z){this._el=f,this._mousePan=g,this._touchPan=z}enable(f){this._inertiaOptions=f||{},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(f,g,z){this._pitchWithRotate=f.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(f,g,z,j){this._el=f,this._touchZoom=g,this._touchRotate=z,this._tapDragZoom=j,this._rotationDisabled=!1,this._enabled=!0}enable(f){this._touchZoom.enable(f),this._rotationDisabled||this._touchRotate.enable(f),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(f,g){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=f,this._options=g,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const f=this._map.getCanvasContainer();f.classList.add("maplibregl-cooperative-gestures"),this._container=o.create("div","maplibregl-cooperative-gesture-screen",f);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(f){return f[this._bypassKey]}notifyGestureBlocked(f,g){this._enabled&&(this._map.fire(new i.k("cooperativegestureprevented",{gestureType:f,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(f,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=f,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zc(f),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[f,g,z]of this._listeners)o.removeEventListener(f,g,f===document?this.handleWindowEvent:this.handleEvent,z)}_addDefaultHandlers(f){const g=this._map,z=g.getCanvasContainer();this._add("mapEvent",new Fc(g,f));const j=g.boxZoom=new bs(g,f);this._add("boxZoom",j),f.interactive&&f.boxZoom&&j.enable();const $=g.cooperativeGestures=new Ml(g,f.cooperativeGestures);this._add("cooperativeGestures",$),f.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),f.interactive&&f.doubleClickZoom&&g.doubleClickZoom.enable();const xe=new Du;this._add("tapDragZoom",xe);const Ae=g.touchPitch=new rc(g);this._add("touchPitch",Ae),f.interactive&&f.touchPitch&&g.touchPitch.enable(f.touchPitch);const Re=yc(f),je=Iu(f);g.dragRotate=new js(f,Re,je),this._add("mouseRotate",Re,["mousePitch"]),this._add("mousePitch",je,["mouseRotate"]),f.interactive&&f.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})})(f),lt=new Gl(f,g);g.dragPan=new $l(z,tt,lt),this._add("mousePan",tt),this._add("touchPan",lt,["touchZoom","touchRotate"]),f.interactive&&f.dragPan&&g.dragPan.enable(f.dragPan);const ft=new Oh,yt=new ki;g.touchZoomRotate=new Ru(z,yt,ft,xe),this._add("touchRotate",ft,["touchPan","touchZoom"]),this._add("touchZoom",yt,["touchPan","touchRotate"]),f.interactive&&f.touchZoomRotate&&g.touchZoomRotate.enable(f.touchZoomRotate);const Ct=g.scrollZoom=new Pu(g,()=>this._triggerRenderFrame());this._add("scrollZoom",Ct,["mousePan"]),f.interactive&&f.scrollZoom&&g.scrollZoom.enable(f.scrollZoom);const kt=g.keyboard=new Bc(g);this._add("keyboard",kt),f.interactive&&f.keyboard&&g.keyboard.enable(),this._add("blockableMapEvent",new Vs(g))}_add(f,g,z){this._handlers.push({handlerName:f,handler:g,allowed:z}),this._handlersById[f]=g}stop(f){if(!this._updatingCamera){for(const{handler:g}of this._handlers)g.reset();this._inertia.clear(),this._fireEvents({},{},f),this._changes=[]}}isActive(){for(const{handler:f}of this._handlers)if(f.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(f,g,z){for(const j in f)if(j!==z&&(!g||g.indexOf(j)<0))return!0;return!1}_getMapTouches(f){const g=[];for(const z of f){const j=z.target;this._el.contains(j)&&g.push(z)}return g}mergeHandlerResult(f,g,z,j,$){if(!z)return;i.e(f,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 f={},g={},z={};for(const[j,$,ie]of this._changes)j.panDelta&&(f.panDelta=(f.panDelta||new i.P(0,0))._add(j.panDelta)),j.zoomDelta&&(f.zoomDelta=(f.zoomDelta||0)+j.zoomDelta),j.bearingDelta&&(f.bearingDelta=(f.bearingDelta||0)+j.bearingDelta),j.pitchDelta&&(f.pitchDelta=(f.pitchDelta||0)+j.pitchDelta),j.around!==void 0&&(f.around=j.around),j.pinchAround!==void 0&&(f.pinchAround=j.pinchAround),j.noInertia&&(f.noInertia=j.noInertia),i.e(g,$),i.e(z,ie);this._updateMapTransform(f,g,z),this._changes=[]}_updateMapTransform(f,g,z){const j=this._map,$=j._getTransformForUpdate(),ie=j.terrain;if(!(bi(f)||ie&&this._terrainMovement))return this._fireEvents(g,z,!0);let{panDelta:de,zoomDelta:xe,bearingDelta:Ae,pitchDelta:Re,around:je,pinchAround:tt}=f;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(),f.noInertia||this._inertia.record(f),this._fireEvents(g,z,!0)}_fireEvents(f,g,z){const j=il(this._eventsInProgress),$=il(f),ie={};for(const je in f){const{originalEvent:tt}=f[je];this._eventsInProgress[je]||(ie[`${je}start`]=tt),this._eventsInProgress[je]=f[je]}!j&&$&&this._fireEvent("movestart",$.originalEvent);for(const je in ie)this._fireEvent(je,ie[je]);$&&this._fireEvent("move",$.originalEvent);for(const je in f){const{originalEvent:tt}=f[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&<<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(f,g){this._map.fire(new i.k(f,g?{originalEvent:g}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(f=>{delete this._frameId,this.handleEvent(new Yl("renderFrame",{timeStamp:f})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Yo extends i.E{constructor(f,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=f,this._bearingSnap=g.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new i.N(this.transform.center.lng,this.transform.center.lat)}setCenter(f,g){return this.jumpTo({center:f},g)}panBy(f,g,z){return f=i.P.convert(f).mult(-1),this.panTo(this.transform.center,i.e({offset:f},g),z)}panTo(f,g,z){return this.easeTo(i.e({center:f},g),z)}getZoom(){return this.transform.zoom}setZoom(f,g){return this.jumpTo({zoom:f},g),this}zoomTo(f,g,z){return this.easeTo(i.e({zoom:f},g),z)}zoomIn(f,g){return this.zoomTo(this.getZoom()+1,f,g),this}zoomOut(f,g){return this.zoomTo(this.getZoom()-1,f,g),this}getBearing(){return this.transform.bearing}setBearing(f,g){return this.jumpTo({bearing:f},g),this}getPadding(){return this.transform.padding}setPadding(f,g){return this.jumpTo({padding:f},g),this}rotateTo(f,g,z){return this.easeTo(i.e({bearing:f},g),z)}resetNorth(f,g){return this.rotateTo(0,i.e({duration:1e3},f),g),this}resetNorthPitch(f,g){return this.easeTo(i.e({bearing:0,pitch:0,duration:1e3},f),g),this}snapToNorth(f,g){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(f,g):this}getPitch(){return this.transform.pitch}setPitch(f,g){return this.jumpTo({pitch:f},g),this}cameraForBounds(f,g){f=Se.convert(f);const z=g&&g.bearing||0;return this._cameraForBoxAndBearing(f.getNorthWest(),f.getSouthEast(),z,g)}_cameraForBoxAndBearing(f,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(f,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(f,g,z){return this._fitInternal(this.cameraForBounds(f,g),g,z)}fitScreenCoordinates(f,g,z,j,$){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(i.P.convert(f)),this.transform.pointLocation(i.P.convert(g)),z,j),j,$)}_fitInternal(f,g,z){return f?(delete(g=i.e(f,g)).padding,g.linear?this.easeTo(g,z):this.flyTo(g,z)):this}jumpTo(f,g){this.stop();const z=this._getTransformForUpdate();let j=!1,$=!1,ie=!1;return"zoom"in f&&z.zoom!==+f.zoom&&(j=!0,z.zoom=+f.zoom),f.center!==void 0&&(z.center=i.N.convert(f.center)),"bearing"in f&&z.bearing!==+f.bearing&&($=!0,z.bearing=+f.bearing),"pitch"in f&&z.pitch!==+f.pitch&&(ie=!0,z.pitch=+f.pitch),f.padding==null||z.isPaddingEqual(f.padding)||(z.padding=f.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(f,g,z,j=0){const $=i.Z.fromLngLat(f,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(f,g){var z;this._stop(!1,f.easeId),((f=i.e({offset:[0,0],duration:500,easing:i.b9},f)).animate===!1||!f.essential&&v.prefersReducedMotion)&&(f.duration=0);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in f?this._normalizeBearing(f.bearing,ie):ie,Re="pitch"in f?+f.pitch:de,je="padding"in f?f.padding:j.padding,tt=i.P.convert(f.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(f.center||ft),(z=f.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;f.around&&($t=i.N.convert(f.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=f.easeId,this._prepareEase(g,f.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&&!f.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&&f.freezeElevation&&this._finalizeElevation(),this._afterEase(g,pn)},f),this}_prepareEase(f,g,z={}){this._moving=!0,g||z.moving||this.fire(new i.k("movestart",f)),this._zooming&&!z.zooming&&this.fire(new i.k("zoomstart",f)),this._rotating&&!z.rotating&&this.fire(new i.k("rotatestart",f)),this._pitching&&!z.pitching&&this.fire(new i.k("pitchstart",f))}_prepareElevation(f){this._elevationCenter=f,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(f){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const g=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(f<1&&g!==this._elevationTarget){const z=this._elevationTarget-this._elevationStart,j=(g-(z*f+this._elevationStart))/(1-f);this._elevationStart+=f*(z-j),this._elevationTarget=g}this.transform.elevation=i.z.number(this._elevationStart,this._elevationTarget,f)}_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(f){const g=f.getCameraPosition(),z=this.terrain.getElevationForLngLatZoom(g.lngLat,f.zoom);if(g.altitude<z){const j=this.calculateCameraOptionsFromTo(g.lngLat,z,f.center,f.elevation);return{pitch:j.pitch,zoom:j.zoom}}return{}}_applyUpdatedTransform(f){const g=[];if(this.terrain&&g.push(j=>this._elevateCameraIfInsideTerrain(j)),this.transformCameraUpdate&&g.push(j=>this.transformCameraUpdate(j)),!g.length)return;const z=f.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(f){this.fire(new i.k("move",f)),this._zooming&&this.fire(new i.k("zoom",f)),this._rotating&&this.fire(new i.k("rotate",f)),this._pitching&&this.fire(new i.k("pitch",f))}_afterEase(f,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",f)),j&&this.fire(new i.k("rotateend",f)),$&&this.fire(new i.k("pitchend",f)),this.fire(new i.k("moveend",f))}flyTo(f,g){var z;if(!f.essential&&v.prefersReducedMotion){const ur=i.M(f,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ur,g)}this.stop(),f=i.e({offset:[0,0],speed:1.2,curve:1.42,easing:i.b9},f);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in f?this._normalizeBearing(f.bearing,ie):ie,Re="pitch"in f?+f.pitch:de,je="padding"in f?f.padding:j.padding,tt=i.P.convert(f.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(f.center||ft),(z=f.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=f.curve;const Kt=Math.max(j.width,j.height),Yt=Kt/kt,pn=At.mag();if("minZoom"in f){const ur=i.ad(Math.min(f.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(f,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 f)f.duration=+f.duration;else{const ur="screenSpeed"in f?+f.screenSpeed/$t:+f.speed;f.duration=1e3*Ar/ur}return f.maxDuration&&f.duration>f.maxDuration&&(f.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&&!f.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&&f.freezeElevation&&this._finalizeElevation(),this._afterEase(g)},f),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(f,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 f||(z=this.handlers)===null||z===void 0||z.stop(!1),this}_ease(f,g,z){z.animate===!1||z.duration===0?(f(1),g()):(this._easeStart=v.now(),this._easeOptions=z,this._onEaseFrame=f,this._onEaseEnd=g,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(f,g){f=i.b3(f,-180,180);const z=Math.abs(f-g);return Math.abs(f-360-g)<z&&(f-=360),Math.abs(f+360-g)<z&&(f+=360),f}_normalizeCenter(f,g){if(!g.renderWorldCopies||g.lngRange)return;const z=f.lng-g.center.lng;f.lng+=z>180?-360:z<-180?360:0}queryTerrainElevation(f){return this.terrain?this.terrain.getElevationForLngLatZoom(i.N.convert(f),this.transform.tileZoom)-this.transform.elevation:null}}const Us={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class yl{constructor(f=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=f}getDefaultPosition(){return"bottom-right"}onAdd(f){return this._map=f,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(f,g){const z=this._map._getUIString(`AttributionControl.${g}`);f.title=z,f.setAttribute("aria-label",z)}_updateAttributions(){if(!this._map.style)return;let f=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?f=f.concat(this.options.customAttribution.map(j=>typeof j!="string"?"":j)):typeof this.options.customAttribution=="string"&&f.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&&f.indexOf(ie.attribution)<0&&f.push(ie.attribution)}}f=f.filter(j=>String(j).trim()),f.sort((j,$)=>j.length-$.length),f=f.filter((j,$)=>{for(let ie=$+1;ie<f.length;ie++)if(f[ie].indexOf(j)>=0)return!1;return!0});const z=f.join(" | ");z!==this._attribHTML&&(this._attribHTML=z,f.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(f={}){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=f}getDefaultPosition(){return"bottom-left"}onAdd(f){this._map=f,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 nh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(f){const g=++this._id;return this._queue.push({callback:f,id:g,cancelled:!1}),g}remove(f){const g=this._currentlyRunning,z=g?this._queue.concat(g):this._queue;for(const j of z)if(j.id===f)return void(j.cancelled=!0)}run(f=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(f),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(f){super(),this.sourceCache=f,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,f.usedForTerrain=!0,f.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(f,g){this.sourceCache.update(f,g),this._renderableTilesKeys=[];const z={};for(const j of f.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(f){for(const g in this._tiles){const z=this._tiles[g];(!f||z.tileID.equals(f)||z.tileID.isChildOf(f)||f.isChildOf(z.tileID))&&(z.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(f=>this.getTileByID(f))}getTileByID(f){return this._tiles[f]}getTerrainCoords(f){const g={};for(const z of this._renderableTilesKeys){const j=this._tiles[z].tileID;if(j.canonical.equals(f.canonical)){const $=f.clone();$.posMatrix=new Float64Array(16),i.aQ($.posMatrix,0,i.X,0,i.X,0,1),g[z]=$}else if(j.canonical.isChildOf(f.canonical)){const $=f.clone();$.posMatrix=new Float64Array(16);const ie=j.canonical.z-f.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(f.canonical.isChildOf(j.canonical)){const $=f.clone();$.posMatrix=new Float64Array(16);const ie=f.canonical.z-j.canonical.z,de=f.canonical.x-(f.canonical.x>>ie<<ie),xe=f.canonical.y-(f.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(f,g){const z=this.sourceCache._source;let j=f.overscaledZ-this.deltaZoom;if(j>z.maxzoom&&(j=z.maxzoom),j<z.minzoom)return null;this._sourceTileCache[f.key]||(this._sourceTileCache[f.key]=f.scaledTo(j).key);let $=this.sourceCache.getTileByID(this._sourceTileCache[f.key]);if((!$||!$.dem)&&g)for(;j>=z.minzoom&&(!$||!$.dem);)$=this.sourceCache.getTileByID(f.scaledTo(j--).key);return $}tilesAfterTime(f=Date.now()){return Object.values(this._tiles).filter(g=>g.timeAdded>=f)}}class xa{constructor(f,g,z){this.painter=f,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(f,g,z,j=i.X){var $;if(!(g>=0&&g<j&&z>=0&&z<j))return 0;const ie=this.getTerrainData(f),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(f,g){const{tileID:z,mercatorX:j,mercatorY:$}=this._getOverscaledTileIDFromLngLatZoom(f,g);return this.getElevation(z,j%i.X,$%i.X,i.X)}getElevation(f,g,z,j=i.X){return this.getDEMElevation(f,g,z,j)*this.exaggeration}getTerrainData(f){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(f,!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+f.key;if(z&&!this._demMatrixCache[z]){const j=this.sourceCache.sourceCache._source.maxzoom;let $=f.canonical.z-g.tileID.canonical.z;f.overscaledZ>f.canonical.z&&(f.canonical.z>=j?$=f.canonical.z-j:i.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const ie=f.canonical.x-(f.canonical.x>>$<<$),de=f.canonical.y-(f.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[f.key]={matrix:xe,coord:f}}return{u_depth:2,u_terrain:3,u_terrain_dim:g&&g.dem&&g.dem.dim||1,u_terrain_matrix:z?this._demMatrixCache[f.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(f){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(f==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const f=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(f,z,f.gl.RGBA,{premultiply:!1});return j.bind(f.gl.NEAREST,f.gl.CLAMP_TO_EDGE),this._coordsTexture=j,j}pointCoordinate(f){this.painter.maybeDrawDepthAndCoords(!0);const g=new Uint8Array(4),z=this.painter.context,j=z.gl,$=Math.round(f.x*this.painter.pixelRatio/devicePixelRatio),ie=Math.round(f.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(f){const g=new Uint8Array(4),z=this.painter.context,j=z.gl;return z.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),j.readPixels(f.x,this.painter.height/devicePixelRatio-f.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 f=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(f.createVertexBuffer(g,mi.members),f.createIndexBuffer(z),i.a0.simpleSegment(0,0,g.length,z.length)),this._mesh}getMeshFrameDelta(f){return 2*Math.PI*i.bd/Math.pow(2,f)/5}getMinTileElevationForLngLatZoom(f,g){var z;const{tileID:j}=this._getOverscaledTileIDFromLngLatZoom(f,g);return(z=this.getMinMaxElevation(j).minElevation)!==null&&z!==void 0?z:0}getMinMaxElevation(f){const g=this.getTerrainData(f).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(f,g){const z=i.Z.fromLngLat(f.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(f,g,z){this._context=f,this._size=g,this._tileSize=z,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const f of this._objects)f.texture.destroy(),f.fbo.destroy()}_createObject(f){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:f,fbo:g,texture:z,stamp:-1,inUse:!1}}getObjectForId(f){return this._objects[f]}useObject(f){f.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(g=>f.id!==g),this._recentlyUsed.push(f.id)}stampObject(f){f.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 f=this._createObject(this._objects.length);return this._objects.push(f),f}freeObject(f){f.inUse=!1}freeAllObjects(){for(const f of this._objects)this.freeObject(f)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(f=>!f.inUse)===!1}}const El={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class vu{constructor(f,g){this.painter=f,this.terrain=g,this.pool=new ac(f.context,30,g.sourceCache.tileSize*g.qualityFactor)}destruct(){this.pool.destruct()}getTexture(f){return this.pool.getObjectForId(f.rtt[this._stacks.length-1].id).texture}prepareForRender(f,g){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=f._order.filter(z=>!f._layers[z].isHidden(g)),this._coordsDescendingInv={};for(const z in f.sourceCaches){this._coordsDescendingInv[z]={};const j=f.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 f._order){const j=f._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(f){if(f.isHidden(this.painter.transform.zoom))return!1;const g=f.type,z=this.painter,j=this._renderableLayerIds[this._renderableLayerIds.length-1]===f.id;if(El[g]&&(this._prevType&&El[this._prevType]||this._stacks.push([]),this._prevType=g,this._stacks[this._stacks.length-1].push(f.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 mh={"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"},rh=_,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(f,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=f.dragRotate._mouseRotate.getClickTolerance(),$=f.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=f,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(f,g){this.mouseRotate.dragStart(f,g),this.mousePitch&&this.mousePitch.dragStart(f,g),o.disableDrag()}startTouch(f,g){this.touchRotate.dragStart(f,g),this.touchPitch&&this.touchPitch.dragStart(f,g),o.disableDrag()}moveMouse(f,g){const z=this.map,{bearingDelta:j}=this.mouseRotate.dragMove(f,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.mousePitch){const{pitchDelta:$}=this.mousePitch.dragMove(f,g)||{};$&&z.setPitch(z.getPitch()+$)}}moveTouch(f,g){const z=this.map,{bearingDelta:j}=this.touchRotate.dragMove(f,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.touchPitch){const{pitchDelta:$}=this.touchPitch.dragMove(f,g)||{};$&&z.setPitch(z.getPitch()+$)}}off(){const f=this.element;o.removeEventListener(f,"mousedown",this.mousedown),o.removeEventListener(f,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend),o.removeEventListener(f,"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,f,g){const z=new i.N(V.lng,V.lat);if(V=new i.N(V.lng,V.lat),f){const j=new i.N(V.lng-360,V.lat),$=new i.N(V.lng+360,V.lat),ie=g.locationPoint(V).distSqr(f);g.locationPoint(j).distSqr(f)<ie?V=j:g.locationPoint($).distSqr(f)<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,f,g){const z=V.classList;for(const j in Xl)z.remove(`maplibregl-${g}-anchor-${j}`);z.add(`maplibregl-${g}-anchor-${f}`)}class yo extends i.E{constructor(f){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=f&&f.anchor||"center",this._color=f&&f.color||"#3FB1CE",this._scale=f&&f.scale||1,this._draggable=f&&f.draggable||!1,this._clickTolerance=f&&f.clickTolerance||0,this._subpixelPositioning=f&&f.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=f&&f.rotation||0,this._rotationAlignment=f&&f.rotationAlignment||"auto",this._pitchAlignment=f&&f.pitchAlignment&&f.pitchAlignment!=="auto"?f.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(f==null?void 0:f.opacity,f==null?void 0:f.opacityWhenCovered),f&&f.element)this._element=f.element,this._offset=i.P.convert(f&&f.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(f&&f.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"),f&&f.className)for(const g of f.className.split(" "))this._element.classList.add(g);this._popup=null}addTo(f){return this.remove(),this._map=f,this._element.setAttribute("aria-label",f._getUIString("Marker.Title")),f.getCanvasContainer().appendChild(this._element),f.on("move",this._update),f.on("moveend",this._update),f.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(f){return this._lngLat=i.N.convert(f),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(f){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),f){if(!("offset"in f.options)){const j=Math.abs(13.5)/Math.SQRT2;f.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=f,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(f){return this._subpixelPositioning=f,this}getPopup(){return this._popup}togglePopup(){const f=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:f?(f.isOpen()?f.remove():(f.setLngLat(this._lngLat),f.addTo(this._map)),this):this}_updateOpacity(f=!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(f)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(f){return this._offset=i.P.convert(f),this._update(),this}addClassName(f){this._element.classList.add(f)}removeClassName(f){this._element.classList.remove(f)}toggleClassName(f){return this._element.classList.toggle(f)}setDraggable(f){return this._draggable=!!f,this._map&&(f?(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(f){return this._rotation=f||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(f){return this._rotationAlignment=f||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(f){return this._pitchAlignment=f&&f!=="auto"?f:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(f,g){return f===void 0&&g===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),f!==void 0&&(this._opacity=f),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(f){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 yo({element:this._dotElement}),this._circleElement=o.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new yo({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),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,f)}onAdd(f){return this._map=f,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(f){const g=this._map.getMaxBounds(),z=f.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 f=this._map.getBounds(),g=f.getSouthEast(),z=f.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 f;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),na++,na>1?(f={maximumAge:6e5,timeout:0},bc=!0):(f=this.options.positionOptions,bc=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,f)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}}const gi={maxWidth:100,unit:"metric"};function Ka(V,f,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(f,z,xe/5280,V._getUIString("ScaleControl.Miles")):ss(f,z,xe,V._getUIString("ScaleControl.Feet"))}else g&&g.unit==="nautical"?ss(f,z,de/1852,V._getUIString("ScaleControl.NauticalMiles")):de>=1e3?ss(f,z,de/1e3,V._getUIString("ScaleControl.Kilometers")):ss(f,z,de,V._getUIString("ScaleControl.Meters"))}function ss(V,f,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=f*$+"px",V.innerHTML=`${j} ${z}`}class sc extends i.E{constructor(f={}){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,f&&f.container&&(f.container instanceof HTMLElement?this._container=f.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(f){return this._map=f,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 f=this._fullscreenButton=o.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);o.create("span","maplibregl-ctrl-icon",f).setAttribute("aria-hidden","true"),f.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const f=this._getTitle();this._fullscreenButton.setAttribute("aria-label",f),this._fullscreenButton.title=f}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new 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(f){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),f)}addTo(f){return this._map&&this.remove(),this._map=f,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new i.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(f){return this._lngLat=i.N.convert(f),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(f){return this.setDOMContent(document.createTextNode(f))}setHTML(f){const g=document.createDocumentFragment(),z=document.createElement("body");let j;for(z.innerHTML=f;j=z.firstChild,j;)g.appendChild(j);return this.setDOMContent(g)}getMaxWidth(){var f;return(f=this._container)===null||f===void 0?void 0:f.style.maxWidth}setMaxWidth(f){return this.options.maxWidth=f,this._update(),this}setDOMContent(f){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=o.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(f),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(f){return this._container&&this._container.classList.add(f),this}removeClassName(f){return this._container&&this._container.classList.remove(f),this}setOffset(f){return this.options.offset=f,this._update(),this}toggleClassName(f){if(this._container)return this._container.classList.toggle(f)}setSubpixelPositioning(f){this.options.subpixelPositioning=f}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const f=this._container.querySelector(gt);f&&f.focus()}}function Pt(V){if(V){if(typeof V=="number"){const f=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(f,f),"top-right":new i.P(-f,f),bottom:new i.P(0,-V),"bottom-left":new i.P(f,-f),"bottom-right":new i.P(-f,-f),left:new i.P(V,0),right:new i.P(-V,0)}}if(V instanceof i.P||Array.isArray(V)){const f=i.P.convert(V);return{center:f,top:f,"top-left":f,"top-right":f,bottom:f,"bottom-left":f,"bottom-right":f,left:f,right:f}}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=qo,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 f=Object.assign(Object.assign({},Ou),V);if(f.minZoom!=null&&f.maxZoom!=null&&f.minZoom>f.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(f.minPitch!=null&&f.maxPitch!=null&&f.minPitch>f.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(f.minPitch!=null&&f.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(f.maxPitch!=null&&f.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ia(f.minZoom,f.maxZoom,f.minPitch,f.maxPitch,f.renderWorldCopies),{bearingSnap:f.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new nh,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=f.interactive,this._maxTileCacheSize=f.maxTileCacheSize,this._maxTileCacheZoomLevels=f.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=f.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=f.preserveDrawingBuffer===!0,this._antialias=f.antialias===!0,this._trackResize=f.trackResize===!0,this._bearingSnap=f.bearingSnap,this._refreshExpiredTiles=f.refreshExpiredTiles===!0,this._fadeDuration=f.fadeDuration,this._crossSourceCollisions=f.crossSourceCollisions===!0,this._collectResourceTiming=f.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},mh),f.locale),this._clickTolerance=f.clickTolerance,this._overridePixelRatio=f.pixelRatio,this._maxCanvasSize=f.maxCanvasSize,this.transformCameraUpdate=f.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=f.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=S.addThrottleControl(()=>this.isMoving()),this._requestManager=new C(f.transformRequest),typeof f.container=="string"){if(this._container=document.getElementById(f.container),!this._container)throw new Error(`Container '${f.container}' not found.`)}else{if(!(f.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=f.container}if(f.maxBounds&&this.setMaxBounds(f.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).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,f);const g=typeof f.hash=="string"&&f.hash||void 0;this._hash=f.hash&&new qo(g).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:f.center,zoom:f.zoom,bearing:f.bearing,pitch:f.pitch}),f.bounds&&(this.resize(),this.fitBounds(f.bounds,i.e({},f.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=f.localIdeographFontFamily,this._validateStyle=f.validateStyle,f.style&&this.setStyle(f.style,{localIdeographFontFamily:f.localIdeographFontFamily}),f.attributionControl&&this.addControl(new yl(typeof f.attributionControl=="boolean"?void 0:f.attributionControl)),f.maplibreLogo&&this.addControl(new os,f.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,f){if(f===void 0&&(f=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[f];return f.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 f=this._controls.indexOf(V);return f>-1&&this._controls.splice(f,1),V.onRemove(this),this}hasControl(V){return this._controls.indexOf(V)>-1}calculateCameraOptionsFromTo(V,f,g,z){return z==null&&this.terrain&&(z=this.terrain.getElevationForLngLatZoom(g,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(V,f,g,z)}resize(V){var f;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),(f=this._requestedCameraState)===null||f===void 0||f.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,f){const{0:g,1:z}=this._maxCanvasSize,j=this.getPixelRatio(),$=V*j,ie=f*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,f,g){if(V==="mouseenter"||V==="mouseover"){let z=!1;return{layer:f,listener:g,delegates:{mousemove:$=>{const ie=this.getLayer(f)?this.queryRenderedFeatures($.point,{layers:[f]}):[];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:f,listener:g,delegates:{mousemove:ie=>{(this.getLayer(f)?this.queryRenderedFeatures(ie.point,{layers:[f]}):[]).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(f)?this.queryRenderedFeatures(j.point,{layers:[f]}):[];$.length&&(j.features=$,g.call(this,j),delete j.features)};return{layer:f,listener:g,delegates:{[V]:z}}}}on(V,f,g){if(g===void 0)return super.on(V,f);const z=this._createDelegatedListener(V,f,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,f,g){if(g===void 0)return super.once(V,f);const z=this._createDelegatedListener(V,f,g);for(const j in z.delegates)this.once(j,z.delegates[j]);return this}off(V,f,g){return g===void 0?super.off(V,f):(this._delegatedListeners&&this._delegatedListeners[V]&&(z=>{const j=z[V];for(let $=0;$<j.length;$++){const ie=j[$];if(ie.layer===f&&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,f){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(f=f||(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,f,this.transform)}querySourceFeatures(V,f){return this.style.querySourceFeatures(V,f)}setStyle(V,f){return(f=i.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},f)).diff!==!1&&f.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&V?(this._diffStyle(V,f),this):(this._localIdeographFontFamily=f.localIdeographFontFamily,this._updateStyle(V,f))}setTransformRequest(V){return this._requestManager.setTransformRequest(V),this}_getUIString(V){const f=this._locale[V];if(f==null)throw new Error(`Missing UI string '${V}'`);return f}_updateStyle(V,f){if(f.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(V,f));const g=this.style&&f.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!V)),V?(this.style=new Jr(this,f||{}),this.style.setEventedParent(this,{style:this.style}),typeof V=="string"?this.style.loadURL(V,f,g):this.style.loadJSON(V,f,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,f){if(typeof V=="string"){const g=V,z=this._requestManager.transformRequest(g,"Style");i.h(z,new AbortController).then(j=>{this._updateDiff(j.data,f)}).catch(j=>{j&&this.fire(new i.j(j))})}else typeof V=="object"&&this._updateDiff(V,f)}_updateDiff(V,f){try{this.style.setState(V,f)&&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,f)}}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,f){return this._lazyInitEmptyStyle(),this.style.addSource(V,f),this._update(!0)}isSourceLoaded(V){const f=this.style&&this.style.sourceCaches[V];if(f!==void 0)return f.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 f=this.style.sourceCaches[V.source];if(!f)throw new Error(`cannot load terrain, because there exists no source with ID: ${V.source}`);this.terrain===null&&f.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,f,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,f;return(f=(V=this.terrain)===null||V===void 0?void 0:V.options)!==null&&f!==void 0?f:null}areTilesLoaded(){const V=this.style&&this.style.sourceCaches;for(const f in V){const g=V[f]._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,f,g={}){const{pixelRatio:z=1,sdf:j=!1,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae}=g;if(this._lazyInitEmptyStyle(),!(f instanceof HTMLImageElement||i.b(f))){if(f.width===void 0||f.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}=f,lt=f;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&<.onAdd(this,V),this}}{const{width:Re,height:je,data:tt}=v.getImageData(f);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,f){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=f instanceof HTMLImageElement||i.b(f)?v.getImageData(f):f,{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=!(f instanceof HTMLImageElement||i.b(f));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,f){return this._lazyInitEmptyStyle(),this.style.addLayer(V,f),this._update(!0)}moveLayer(V,f){return this.style.moveLayer(V,f),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,f,g){return this.style.setLayerZoomRange(V,f,g),this._update(!0)}setFilter(V,f,g={}){return this.style.setFilter(V,f,g),this._update(!0)}getFilter(V){return this.style.getFilter(V)}setPaintProperty(V,f,g,z={}){return this.style.setPaintProperty(V,f,g,z),this._update(!0)}getPaintProperty(V,f){return this.style.getPaintProperty(V,f)}setLayoutProperty(V,f,g,z={}){return this.style.setLayoutProperty(V,f,g,z),this._update(!0)}getLayoutProperty(V,f){return this.style.getLayoutProperty(V,f)}setGlyphs(V,f={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(V,f),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(V,f,g={}){return this._lazyInitEmptyStyle(),this.style.addSprite(V,f,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,f={}){return this._lazyInitEmptyStyle(),this.style.setSprite(V,f,g=>{g||this._update(!0)}),this}setLight(V,f={}){return this._lazyInitEmptyStyle(),this.style.setLight(V,f),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,f){return this.style.setFeatureState(V,f),this._update()}removeFeatureState(V,f){return this.style.removeFeatureState(V,f),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,f=0;return this._container&&(V=this._container.clientWidth||400,f=this._container.clientHeight||300),[V,f]}_setupContainer(){const V=this._container;V.classList.add("maplibregl-map");const f=this._canvasContainer=o.create("div","maplibregl-canvas-container",V);this._interactive&&f.classList.add("maplibregl-interactive"),this._canvas=o.create("canvas","maplibregl-canvas",f),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,f,g){this._canvas.width=Math.floor(g*V),this._canvas.height=Math.floor(g*f),this._canvas.style.width=`${V}px`,this._canvas.style.height=`${f}px`}_setupPainter(){const V={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let f=null;this._canvas.addEventListener("webglcontextcreationerror",z=>{f={requestedAttributes:V},z&&(f.statusMessage=z.statusMessage,f.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 f?(f.message=z,new Error(JSON.stringify(f))):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 f=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:f,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,f,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new 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 f=this.painter.context.gl.getExtension("WEBGL_lose_context");f!=null&&f.loseContext&&f.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 rh}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Ds,u.MapTouchEvent=ys,u.MapWheelEvent=Mu,u.Marker=yo,u.NavigationControl=class{constructor(V){this._updateZoomButtons=()=>{const f=this._map.getZoom(),g=f===this._map.getMaxZoom(),z=f===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 f=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=f},this._setButtonTitle=(f,g)=>{const z=this._map._getUIString(`NavigationControl.${g}`);f.title=z,f.setAttribute("aria-label",z)},this.options=i.e({},Zl,V),this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",f=>f.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",f=>this._map.zoomIn({},{originalEvent:f})),o.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",f=>this._map.zoomOut({},{originalEvent:f})),o.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",f=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:f}):this._map.resetNorth({},{originalEvent:f})}),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,f){const g=o.create("button",V,this._container);return g.type="button",g.addEventListener("click",f),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=f=>{this.options.unit=f,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=Oh,u.TwoFingersTouchZoomHandler=ki,u.TwoFingersTouchZoomRotateHandler=Ru,u.VectorTileSource=Ie,u.VideoSource=ve,u.addSourceType=(V,f)=>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,f)}),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,f){return Xe().setRTLTextPlugin(V,f)},u.setWorkerCount=function(V){he.workerCount=V},u.setWorkerUrl=function(V){i.a.WORKER_URL=V}}),d}()},88640:function(m,d,n){function l(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(d,{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})$/,c=new RegExp("^rgb\\(".concat(w,",").concat(w,",").concat(w,"\\)$")),s=new RegExp("^rgb\\(".concat(o,",").concat(o,",").concat(o,"\\)$")),p=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=c.exec(be))?new T(_e[1],_e[2],_e[3],1):(_e=s.exec(be))?new T(255*_e[1]/100,255*_e[2]/100,255*_e[3]/100,1):(_e=p.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 q(be,_e,Se){return 255*(be<60?_e+(Se-_e)*be/60:be<180?Se:be<240?_e+(Se-_e)*(240-be)/60:_e)}l(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}),l(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})),l(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(q(be>=240?be-240:be+120,Ie,Ce),q(be,Ie,Ce),q(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(m){m.exports=JSON.parse('["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]')},2362:function(m){m.exports=JSON.parse('["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]')},87486:function(m){m.exports=JSON.parse('["normal","italic","oblique"]')},99803:function(m){m.exports=JSON.parse('["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]')},54324:function(m){m.exports=JSON.parse('["inherit","initial","unset"]')},94316:function(m){m.exports=JSON.parse('["caption","icon","menu","message-box","small-caption","status-bar"]')},37071:function(m){m.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 © <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(m){m.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 © <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"}}]}`)}},h={};function R(m){var d=h[m];if(d!==void 0)return d.exports;var n=h[m]={id:m,exports:{}};return r[m].call(n.exports,n,n.exports,R),n.exports}return R.m=r,R.n=function(m){var d=m&&m.__esModule?function(){return m.default}:function(){return m};return R.d(d,{a:d}),d},R.d=function(m,d){for(var n in d)R.o(d,n)&&!R.o(m,n)&&Object.defineProperty(m,n,{enumerable:!0,get:d[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(m,d){return Object.prototype.hasOwnProperty.call(m,d)},R.r=function(m){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(m,"__esModule",{value:!0})},R.b=document.baseURI||self.location.href,R.nc=void 0,R(20260)}()})})(f9);var PG=f9.exports;const Wp=c8(PG),DG={highlightColor:"#E4572E",selectedColor:"#F3A712",unhighlightedColor:"lightblue",highlightHiddenColor:"#1f77b4",annotationBackground:"#f8f8f8"},RG={xPosScalingFactor:80,xPosScalingThreshold:500,minAnnotationWidth:40},OG=Fv({name:"PlotlyLineplot",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Oy(),e=Ry();return{streamlitDataStore:t,selectionStore:e}},data(){return{isInitialized:!1,manualXRange:void 0,lastAutoZoomedPeakIndex:void 0}},computed:{id(){return`plot-${this.index}`},theme(){return this.streamlitDataStore.theme},styling(){return{...DG,...this.args.styling}},config(){return{...RG,...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",h=(e==null?void 0:e.yColumn)||this.args.yColumn||"y",R={x_values:t[r]||[],y_values:t[h]||[]},m=(e==null?void 0:e.highlightColumn)||this.args.highlightColumn;m&&t[m]&&(R.highlight_mask=t[m]);const d=(e==null?void 0:e.annotationColumn)||this.args.annotationColumn;if(d&&t[d]&&(R.annotations=t[d]),this.args.interactivity)for(const[l,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 h=`interactivity_${e}`,R=this.plotData[h];if(R&&Array.isArray(R)){for(let m=0;m<R.length;m++)if(R[m]===r)return m}else if(e===this.args.xColumn){const m=this.plotData.x_values;for(let d=0;d<m.length;d++)if(m[d]===r)return d}}},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),h=(r-e)*.02;return[e-h,r+h]},yRange(){if(!this.isDataReady||!this.plotData)return[0,1];const{x_values:t,y_values:e}=this.plotData,r=this.xRange;let h=0;for(let R=0;R<t.length;R++){const m=t[R],d=e[R];m>=r[0]&&m<=r[1]&&d>h&&(h=d)}return h===0?[0,1]:[0,h*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:h}=this.plotData;if(!r)return[];const R=[];for(let m=0;m<r.length;m++){const d=r[m];!d||d.length===0||h&&!h[m]||R.push({x:t[m],y:e[m],label:d,index:m})}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 h=e[1]/1.8,R=h*1.18,m=h*1.32,d=m-R,n=this.xPosScalingFactor,l=[];for(const i of t){const _=i.x>=r[0]&&i.x<=r[1];l.push({x:i.x,y:(R+m)/2,width:n*2,height:d,label:i.label,visible:_,inVisibleRange:_,index:i.index})}const u=l.filter(i=>i.inVisibleRange);if(u.length>1){let i=!1;const _=(r[1]-r[0])*.01;for(let b=0;b<u.length&&!i;b++)for(let w=b+1;w<u.length;w++){const v=u[b].x-u[b].width/2-_,o=u[b].x+u[b].width/2+_,a=u[w].x-u[w].width/2-_,c=u[w].x+u[w].width/2+_;if(!(o<a||c<v)){i=!0;break}}i&&l.forEach(b=>{b.inVisibleRange&&(b.visible=!1)})}return l},annotationShapes(){const t=this.annotationBoxData,e=[],r=this.yRange;if(r[1]<=0)return e;const h=r[1]/1.8,R=h*1.18,m=h*1.32,d=this.selectedPeakIndex;for(const n of t){if(!n.visible)continue;const u=n.index===d?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:m,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 m of t)m.visible&&e.push({x:m.x,y:R,xref:"x",yref:"y",text:m.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(h=>h.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,h=-1e7,R=[],m=[],d=[],n=[],l=[],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?(l.push(b,b,b),u.push(h,w,h)):v?(d.push(b,b,b),n.push(h,w,h)):(R.push(b,b,b),m.push(h,w,h))}return R.length>0&&t.push({x:R,y:m,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.unhighlightedColor},hoverinfo:"x+y"}),d.length>0&&t.push({x:d,y:n,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.highlightColor},hoverinfo:"x+y"}),l.length>0&&t.push({x:l,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,h,R;return{title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:!1,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:((h=this.theme)==null?void 0:h.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,h,R,m;console.log("[LinePlot] plotData changed",{newLength:(r=t==null?void 0:t.x_values)==null?void 0:r.length,oldLength:(h=e==null?void 0:e.x_values)==null?void 0:h.length,newFirstX:(R=t==null?void 0:t.x_values)==null?void 0:R[0],oldFirstX:(m=e==null?void 0:e.x_values)==null?void 0:m[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:{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 h=document.getElementById(this.id);h&&Wp.downloadImage(h,{filename:this.args.title||"plot",height:400,width:1200,format:"svg"})}}];await Wp.newPlot(this.id,this.traces,this.layout,{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:e,scrollZoom:!0,responsive:!0});const r=document.getElementById(this.id);r&&(r.on("plotly_click",h=>{this.onPlotClick(h)}),r.on("plotly_relayout",h=>{this.onRelayout(h)}))}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 h=1/0,R=1/0;for(const b of e){if(b.index===t)continue;const w=b.x-r.x;w<0&&-w<h?h=-w:w>0&&w<R&&(R=w)}const m=Math.min(h,R);this.actualPlotWidth,this.config.xPosScalingFactor;let d;if(m<1/0)d=m*2;else{const b=this.plotData.x_values;d=(Math.max(...b)-Math.min(...b))*.2}const n=this.plotData.x_values,l=Math.min(...n),u=Math.max(...n);let i=r.x-d/2,_=r.x+d/2;return i<l&&(i=l,_=Math.min(l+d,u)),_>u&&(_=u,i=Math.max(u-d,l)),[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 h=this.plotData.x_values;let R=0,m=1/0;for(let d=0;d<h.length;d++){const n=Math.abs(h[d]-r);n<m&&(m=n,R=d)}for(const[d,n]of Object.entries(this.interactivity)){const l=`interactivity_${n}`,u=this.plotData[l];u&&Array.isArray(u)&&R<u.length?this.selectionStore.updateSelection(d,u[R]):n===this.args.xColumn&&this.selectionStore.updateSelection(d,h[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,h;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:((h=this.theme)==null?void 0:h.font)||"Arial"}};await Wp.newPlot(this.id,this.getFallbackData(),R,{staticPlot:!0})}catch(R){console.error("PlotlyLineplot: Failed to render fallback:",R)}}}}),zG=["id"];function FG(t,e,r,h,R,m){return Ga(),wo("div",{id:t.id,class:"plot-container",style:ii(t.cssCustomProperties)},null,12,zG)}const h6=zy(OG,[["render",FG],["__scopeId","data-v-5cbbe0ca"]]),BG=Fv({name:"PlotlyHeatmap",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Oy(),e=Ry();return{streamlitDataStore:t,selectionStore:e}},data(){return{isInitialized:!1,zoomRange:void 0,colorbarVisible:!0,userOverrideColorbar:!1,plotWidth:800,resizeObserver:null}},computed:{id(){return`heatmap-${this.index}`},theme(){return this.streamlitDataStore.theme},isNarrowPlot(){return this.plotWidth<600},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)},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(){const t=this.intensityValues.filter(d=>d>0);if(t.length===0)return{tickvals:[0],ticktext:["0"]};const e=Math.min(...t),r=Math.max(...t),h=Math.floor(Math.log10(e)),R=Math.ceil(Math.log10(r)),m=Array.from({length:R-h+1},(d,n)=>Math.pow(10,h+n));return{tickvals:m.map(d=>Math.log10(d)),ticktext:m.map(d=>d.toExponential(0))}},data(){if(!this.isDataReady)return this.getFallbackData();const{tickvals:t,ticktext:e}=this.colorbarTicks;return[{type:"scattergl",name:"points",x:this.xValues,y:this.yValues,mode:"markers",marker:{color:this.logIntensityValues,colorscale:this.args.colorscale||"Portland",showscale:this.effectiveColorbarVisible,colorbar:{title:{text:"Intensity"},tickvals:t,ticktext:e,tickmode:"array"}},hovertext:this.intensityValues.map(r=>r.toExponential(2)),hoverinfo:"x+y+text"}]},layout(){var t,e,r,h;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,range:this.xRange},yaxis:{title:this.args.yLabel?{text:this.args.yLabel}:void 0,range:this.yRange},paper_bgcolor:((t=this.theme)==null?void 0:t.backgroundColor)||"white",plot_bgcolor:((e=this.theme)==null?void 0:e.secondaryBackgroundColor)||"#f5f5f5",font:{color:((r=this.theme)==null?void 0:r.textColor)||"black",family:((h=this.theme)==null?void 0:h.font)||"Arial"},margin:{l:60,r:this.effectiveColorbarVisible?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.setupResizeObserver()})},beforeUnmount(){this.cleanupResizeObserver()},methods:{async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyHeatmap: DOM element with id '${this.id}' not found`);return}await Wp.newPlot(this.id,this.data,this.layout,this.getPlotConfig()),this.setupPlotEventHandlers(),this.$nextTick(()=>{cf.setFrameHeight()})}catch(t){console.error("PlotlyHeatmap: Error rendering plot:",t),this.renderFallback()}},getPlotConfig(){return{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:[{title:"Download as SVG",name:"toImageSvg",icon:Wp.Icons.camera,click:t=>{Wp.downloadImage(t,{filename:this.args.title||"heatmap",height:400,width:1200,format:"svg"})}},{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()}}],scrollZoom:!0,responsive:!0}},setupPlotEventHandlers(){const t=document.getElementById(this.id);t&&(t.on("plotly_relayout",e=>{e["xaxis.autorange"]?this.zoomRange={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&&(this.zoomRange={xRange:[e["xaxis.range[0]"],e["xaxis.range[1]"]],yRange:[e["yaxis.range[0]"],e["yaxis.range[1]"]]})}),t.on("plotly_click",e=>{if(!(!this.interactivity||Object.keys(this.interactivity).length===0)&&e.points&&e.points.length>0){const r=e.points[0].pointIndex,h=this.heatmapData[r];if(h)for(const[R,m]of Object.entries(this.interactivity)){const d=h[m];d!==void 0&&this.selectionStore.updateSelection(R,d)}}}))},async toggleColorbar(){this.colorbarVisible=!this.colorbarVisible,this.userOverrideColorbar=!0,await this.updatePlot()},async updatePlot(){const t=document.getElementById(this.id);if(t)try{await Wp.restyle(t,{"marker.showscale":this.effectiveColorbarVisible},[0]),await Wp.relayout(t,{margin:{r:this.effectiveColorbarVisible?120:20}})}catch{}},setupResizeObserver(){const t=document.getElementById(this.id);t&&window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(e=>{for(const r of e){const h=r.contentRect.width;if(Math.abs(h-this.plotWidth)>10){const R=this.isNarrowPlot;this.plotWidth=h;const m=this.isNarrowPlot;R!==m&&!this.userOverrideColorbar&&(this.colorbarVisible=!m,this.updatePlot())}}}),this.resizeObserver.observe(t))},cleanupResizeObserver(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},getFallbackData(){return[{type:"scattergl",x:[0],y:[0],mode:"markers",marker:{color:"grey"},name:"No Data"}]},async renderFallback(){var t,e,r,h;try{const R={title:{text:"<b>No Data Available</b>"},showlegend:!1,xaxis:{title:{text:"X"}},yaxis:{title:{text:"Y"}},paper_bgcolor:((t=this.theme)==null?void 0:t.backgroundColor)||"white",plot_bgcolor:((e=this.theme)==null?void 0:e.secondaryBackgroundColor)||"#f5f5f5",font:{color:((r=this.theme)==null?void 0:r.textColor)||"black",family:((h=this.theme)==null?void 0:h.font)||"Arial"}};await Wp.newPlot(this.id,this.getFallbackData(),R,{staticPlot:!0})}catch(R){console.error("PlotlyHeatmap: Failed to render fallback:",R)}}}}),NG=["id"];function VG(t,e,r,h,R,m){return Ga(),wo("div",{id:t.id,class:"heatmap-container"},null,8,NG)}const f6=zy(BG,[["render",VG],["__scopeId","data-v-bbe00399"]]),jG=Fv({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:Oy()}},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 t,e,r,h;return{"--amino-acid-cell-color":((t=this.theme)==null?void 0:t.textColor)??"#000","--amino-acid-cell-bg-color":((e=this.theme)==null?void 0:e.secondaryBackgroundColor)??"#f0f0f0","--amino-acid-cell-hover-color":((r=this.theme)==null?void 0:r.textColor)??"#000","--amino-acid-cell-hover-bg-color":((h=this.theme)==null?void 0:h.backgroundColor)??"#fff","--amino-acid-font-size":`${this.fontSize}px`,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)}}}),UG=["id"],HG={key:0,class:"frag-marker-container frag-marker-a"},WG={key:1,class:"frag-marker-container frag-marker-b"},GG={key:2,class:"frag-marker-container frag-marker-c"},qG={key:3,class:"frag-marker-container frag-marker-x"},$G={key:4,class:"frag-marker-container frag-marker-y"},YG={key:5,class:"frag-marker-container frag-marker-z"},ZG={key:6,class:"rounded-lg mod-marker mod-start"},XG={key:7,class:"rounded-lg mod-marker mod-end"},KG={key:8,class:"rounded-lg mod-mass"},JG={key:9,class:"rounded-lg mod-mass-a"},QG={key:10,class:"rounded-lg mod-mass-b"},eq={key:11,class:"rounded-lg mod-mass-c"},tq={key:12,class:"frag-marker-extra-type"},nq={class:"aa-text"},rq={key:0},iq={key:1},aq={key:2};function oq(t,e,r,h,R,m){const d=iu("v-tooltip");return Ga(),wo("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?(Ga(),wo("div",HG,[...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?(Ga(),wo("div",WG,[...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?(Ga(),wo("div",GG,[...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?(Ga(),wo("div",qG,[...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?(Ga(),wo("div",$G,[...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?(Ga(),wo("div",YG,[...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?(Ga(),wo("div",ZG)):wl("",!0),t.modification!==null?(Ga(),wo("div",XG)):wl("",!0),t.modification!==null?(Ga(),wo("div",KG,[Fs(Bs(t.modificationDisplay)+" ",1),Qt(d,{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?(Ga(),wo("div",JG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.bIon?(Ga(),wo("div",QG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.cIon&&!t.sequenceObject.bIon?(Ga(),wo("div",eq,Bs(t.modificationDisplay),1)):wl("",!0),t.hasExtraFragTypes?(Ga(),wo("div",tq,[...e[7]||(e[7]=[en("svg",{viewBox:"0 0 10 10"},[en("circle",{cx:"5",cy:"5",r:"0.5",stroke:"black","stroke-width":"0.3",fill:"gold"})],-1)])])):wl("",!0),en("div",nq,Bs(t.aminoAcid),1),Qt(d,{activator:"parent"},{default:ds(()=>[en("div",null,"Position: "+Bs(t.index+1),1),t.prefix!==void 0?(Ga(),wo("div",rq,"Prefix: "+Bs(t.prefix),1)):wl("",!0),t.suffix!==void 0?(Ga(),wo("div",iq,"Suffix: "+Bs(t.suffix),1)):wl("",!0),t.hasExtraFragTypes?(Ga(),wo("div",aq,Bs(t.sequenceObject.extraTypes.join(", ")),1)):wl("",!0)]),_:1})],14,UG)}const sq=zy(jG,[["render",oq],["__scopeId","data-v-9b5f608d"]]),lq={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}]},uq=1.007276,cq={0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function hq(t){return String(t).split("").map(e=>cq[e]||e).join("")}const fq=Fv({name:"SequenceView",components:{AminoAcidCell:sq},props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Oy(),e=Ry();return{streamlitDataStore:t,selectionStore:e}},data(){return{rowWidth:35,fontSize:12,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:{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(){return this.args.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],h=this.sequenceObjects[e+1];(r.aIon||r.bIon||r.cIon||h.xIon||h.yIon||h.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(){var t,e;this.initializeSequenceObjects(),((t=this.sequenceData)==null?void 0:t.fragment_tolerance)!==void 0&&(this.fragmentMassTolerance=this.sequenceData.fragment_tolerance),((e=this.sequenceData)==null?void 0:e.fragment_tolerance_ppm)!==void 0&&(this.toleranceIsPpm=this.sequenceData.fragment_tolerance_ppm),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:[]})},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 h=this.sequence.length,m=["a","b","c"].includes(t)?e-1:h-e;if(m>=0&&m<this.sequenceObjects.length){const d=this.sequenceObjects[m],n=`${t}Ion`;d[n]=!0,r&&d.extraTypes.push(`${t}${r}`)}},matchFragmentsExternal(){const t=[];for(const e of this.externalAnnotations){let r=null,h=-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=_,h=i)}if(r===null)continue;const m=r-e.mz,d=m/e.mz*1e6;if(!this.isWithinTolerance(m,e.mz))continue;let n=0;const l=e.annotation.match(/[a-z](\d+)/i);l&&(n=parseInt(l[1],10));const u={Name:e.annotation,IonType:e.ion_type,IonNumber:n,TheoreticalMass:e.mz.toFixed(3),ObservedMass:r,MassDiffDa:m.toFixed(3),MassDiffPpm:d.toFixed(3)};e.charge>1&&(u.Charge=e.charge),this.peakIds&&h>=0&&this.peakIds[h]!==void 0&&(u.PeakId=this.peakIds[h]),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(lq).filter(([h])=>this.ionTypesExtra[h]||h==="default").map(([h,R])=>R).flat(),r=this.deconvolved?[1]:Array.from({length:this.maxCharge},(h,R)=>R+1);for(const h of this.ionTypes.filter(R=>R.selected)){const R=this.getFragmentMasses(h.text);for(let m=0;m<R.length;m++)for(const d of R[m])for(const{typeName:n,typeMass:l}of e){const u=d+l;for(const i of r){const _=this.deconvolved?u:(u+i*uq)/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=`${h.text}${m+1}`,s={Name:this.deconvolved?a:`${a}${hq(i)}⁺`,IonType:`${h.text}${n}`,IonNumber:m+1,TheoreticalMass:_.toFixed(3),ObservedMass:w,MassDiffDa:v.toFixed(3),MassDiffPpm:o.toFixed(3)};this.deconvolved||(s.Charge=i),this.peakIds&&this.peakIds[b]!==void 0&&(s.PeakId=this.peakIds[b]),t.push(s),this.markAminoAcidPosition(h.text,m+1,n)}}}}}return t},matchFragments(){if(this.sequence.length===0||this.observedMasses.length===0){this.fragmentTableData=[];return}this.useExternalAnnotations&&this.hasExternalAnnotations?this.fragmentTableData=this.matchFragmentsExternal():this.fragmentTableData=this.matchFragmentsTheoretical()},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 h=this.fragmentTableData.findIndex(R=>R.Name===r);h>=0&&(this.selectedFragmentRowIndex=h)}},onFragmentTableRowClick(t,{item:e}){const r=e.IonType.charAt(0),h=e.IonNumber,m=["a","b","c"].includes(r)?h-1:this.sequence.length-h;if(m>=0&&m<this.sequenceObjects.length&&(this.selectedAAIndex=m),e.PeakId!==void 0&&Object.keys(this.interactivity).length>0)for(const[d,n]of Object.entries(this.interactivity))this.selectionStore.updateSelection(d,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)}}}}),dq={class:"sequence-view-container"},pq={class:"d-flex justify-end px-4 mb-4"},mq={class:"d-flex justify-space-evenly"},gq={class:"d-flex justify-space-evenly"},vq={class:"d-flex align-center ga-2"},yq={key:0,class:"d-flex justify-center align-center row-number"},bq={key:1,class:"d-flex justify-center align-center terminal-cell"},xq={key:2,class:"d-flex justify-center align-center row-number"},_q={key:3,class:"d-flex justify-center align-center terminal-cell"},wq={key:0,class:"mt-4"},Tq={class:"d-flex justify-space-between align-center mb-2"},kq={class:"text-caption"};function Sq(t,e,r,h,R,m){var A;const d=iu("v-icon"),n=iu("v-tooltip"),l=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"),c=iu("v-card"),s=iu("v-menu"),p=iu("AminoAcidCell"),y=iu("v-divider"),x=iu("v-data-table"),S=iu("v-sheet"),C=iu("v-snackbar");return Ga(),wo("div",dq,[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",pq,[Qt(l,{variant:"text",icon:"",size:"small",disabled:t.sequence.length===0,onClick:t.copySequence},{default:ds(()=>[Qt(d,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(l,{id:"settings-btn",variant:"text",icon:"",size:"small"},{default:ds(()=>[Qt(d,null,{default:ds(()=>[...e[9]||(e[9]=[Fs("mdi-cog",-1)])]),_:1})]),_:1}),Qt(s,{"close-on-content-click":!1,activator:"#settings-btn",location:"bottom"},{default:ds(()=>[Qt(c,{"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",mq,[(Ga(!0),wo(yi,null,z_(t.ionTypes,E=>(Ga(),Q0(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",gq,[(Ga(!0),wo(yi,null,z_(t.ionTypesExtra,(E,P)=>(Ga(),Q0(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",vq,[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(l,{value:!0,size:"small"},{default:ds(()=>[...e[15]||(e[15]=[Fs("ppm",-1)])]),_:1}),Qt(l,{value:!1,size:"small"},{default:ds(()=>[...e[16]||(e[16]=[Fs("Da",-1)])]),_:1})]),_:1},8,["modelValue","disabled"])])]),_:1}),t.hasExternalAnnotations?(Ga(),Q0(_,{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%"}},[(Ga(!0),wo(yi,null,z_(t.sequenceObjects,(E,P)=>(Ga(),wo(yi,{key:P},[P!==0&&P%t.rowWidth===0?(Ga(),wo("div",yq,Bs(P+1),1)):wl("",!0),P===0?(Ga(),wo("div",bq,"N")):wl("",!0),Qt(p,{"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?(Ga(),wo("div",xq,Bs(P+1),1)):wl("",!0),P===t.sequence.length-1?(Ga(),wo("div",_q," C ")):wl("",!0)],64))),128))],2),t.showFragments&&t.fragmentTableData.length>0?(Ga(),wo("div",wq,[Qt(y,{class:"mb-4"}),en("div",Tq,[en("h5",null,"Matching Fragments ("+Bs(t.fragmentTableData.length)+")",1),en("span",kq,"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"])])}const d6=zy(fq,[["render",Sq],["__scopeId","data-v-abb2d7fb"]]),Aq=Fv({name:"App",components:{TabulatorTable:c6,PlotlyLineplot:h6,PlotlyHeatmap:f6,SequenceView:d6},setup(){const t=Oy(),e=Ry();let r,h;const R=()=>{const m=e.$state.counter,d=t.hash||null;if(m===r&&d===h)return;r=m,h=d??void 0;const n=JSON.parse(JSON.stringify(e.$state));n._vueDataHash=d,console.log("[Vue] sendStateToStreamlit",{counter:m,hash:d==null?void 0:d.substring(0,8)}),cf.setComponentValue(n)};return ti(()=>e.$state.counter,R,{immediate:!0}),ti(()=>t.hash,R),ti(()=>{var m;return(m=t.allDataForDrawing)==null?void 0:m.height},m=>{m&&typeof m=="number"&&cf.setFrameHeight(m)},{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"SequenceView":return d6;default:return console.warn(`Unknown component type: ${t}`),null}}},created(){cf.setComponentReady(),cf.setFrameHeight(400),cf.events.addEventListener(cf.RENDER_EVENT,this.updateStreamlitData)},mounted(){this.resizeObserver=new ResizeObserver(()=>{cf.setFrameHeight()}),this.resizeObserver.observe(this.$el)},unmounted(){cf.events.removeEventListener(cf.RENDER_EVENT,this.updateStreamlitData),this.resizeObserver&&this.resizeObserver.disconnect()},updated(){cf.setFrameHeight()},methods:{async updateStreamlitData(t){this.streamlitDataStore.updateRenderData(t.detail)}}}),Cq={key:0},Mq={key:1,class:"d-flex w-100",style:{height:"200px"}};function Eq(t,e,r,h,R,m){const d=iu("v-progress-linear"),n=iu("v-alert");return t.componentArgs!==void 0?(Ga(),wo("div",Cq,[(Ga(),Q0(AE(t.currentComponent),{args:t.componentArgs,index:0},null,8,["args"]))])):(Ga(),wo("div",Mq,[Qt(n,{class:"h-50 ma-8",icon:"mdi-application-variable-outline",title:"Loading...",type:"info",density:"compact"},{default:ds(()=>[Qt(d,{indeterminate:""})]),_:1})]))}const Iq=zy(Aq,[["render",Eq]]);function p9(t,e){e=Array.isArray(e)?e.slice(0,-1).map(r=>`'${r}'`).join(", ")+` or '${e.at(-1)}'`:`'${e}'`}const Ro=typeof window<"u",Gk=Ro&&"IntersectionObserver"in window,Lq=Ro&&("ontouchstart"in window||window.navigator.maxTouchPoints>0),p6=Ro&&"EyeDropper"in window,qk=Ro&&"matchMedia"in window&&typeof window.matchMedia=="function",pp=()=>qk&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function m6(t,e,r){Pq(t,e),e.set(t,r)}function Pq(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function g6(t,e,r){return t.set(m9(t,e),r),r}function Rp(t,e){return t.get(m9(t,e))}function m9(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 g9(t,e,r){const h=e.length-1;if(h<0)return t===void 0?r:t;for(let R=0;R<h;R++){if(t==null)return r;t=t[e[R]]}return t==null||t[e[h]]===void 0?r:t[e[h]]}function Ev(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(/^\./,""),g9(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 Ev(t,e,r);if(Array.isArray(e))return g9(t,e,r);if(typeof e!="function")return r;const h=e(t,r);return typeof h>"u"?r:h}function If(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Array.from({length:t},(r,h)=>e+h)}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 $k(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 v9(t){return Object.keys(t)}function dv(t,e){return e.every(r=>t.hasOwnProperty(r))}function Kh(t,e){const r={};for(const h of e)Object.prototype.hasOwnProperty.call(t,h)&&(r[h]=t[h]);return r}function WT(t,e,r){const h=Object.create(null),R=Object.create(null);for(const m in t)e.some(d=>d instanceof RegExp?d.test(m):d===m)?h[m]=t[m]:R[m]=t[m];return[h,R]}function qa(t,e){const r={...t};return e.forEach(h=>delete r[h]),r}const y9=/^on[^a-z]/,Yk=t=>y9.test(t),Dq=["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"],Rq=["ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Enter","Escape","Tab"," "];function Oq(t){return t.isComposing&&Rq.includes(t.key)}function Ag(t){const[e,r]=WT(t,[y9]),h=qa(e,Dq),[R,m]=WT(r,["class","style","id",/^data-/]);return Object.assign(R,e),Object.assign(m,h),[R,m]}function Ss(t){return t==null?[]:Array.isArray(t)?t:[t]}function b9(t,e){let r=0;const h=function(){for(var R=arguments.length,m=new Array(R),d=0;d<R;d++)m[d]=arguments[d];clearTimeout(r),r=setTimeout(()=>t(...m),qh(e))};return h.clear=()=>{clearTimeout(r)},h.immediate=t,h}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 v6(t){const e=t.toString().trim();return e.includes(".")?e.length-e.indexOf(".")-1:0}function y6(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 b6(t,e){return(arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0").repeat(Math.max(0,e-t.length))+t}function zq(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const r=[];let h=0;for(;h<t.length;)r.push(t.substr(h,e)),h+=e;return r}function x6(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 h=-1;for(;Math.abs(t)>=e&&h<r.length-1;)t/=e,++h;return`${t.toFixed(1)} ${r[h]}B`}function ah(){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 h={};for(const R in t)h[R]=t[R];for(const R in e){const m=t[R],d=e[R];if(UT(m)&&UT(d)){h[R]=ah(m,d,r);continue}if(r&&Array.isArray(m)&&Array.isArray(d)){h[R]=r(m,d);continue}h[R]=d}return h}function x9(t){return t.map(e=>e.type===yi?x9(e.children):e).flat()}function bv(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(bv.cache.has(t))return bv.cache.get(t);const e=t.replace(/[^a-z]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase();return bv.cache.set(t,e),e}bv.cache=new Map;function W0(t,e){if(!e||typeof e!="object")return[];if(Array.isArray(e))return e.map(r=>W0(t,r)).flat(1);if(e.suspense)return W0(t,e.ssContent);if(Array.isArray(e.children))return e.children.map(r=>W0(t,r)).flat(1);if(e.component){if(Object.getOwnPropertyDescriptor(e.component.provides,t))return[e.component];if(e.component.subTree)return W0(t,e.component.subTree).flat(1)}return[]}var A0=new WeakMap,nv=new WeakMap;class _9{constructor(e){m6(this,A0,[]),m6(this,nv,0),this.size=e}get isFull(){return Rp(A0,this).length===this.size}push(e){Rp(A0,this)[Rp(nv,this)]=e,g6(nv,this,(Rp(nv,this)+1)%this.size)}values(){return Rp(A0,this).slice(Rp(nv,this)).concat(Rp(A0,this).slice(0,Rp(nv,this)))}clear(){Rp(A0,this).length=0,g6(nv,this,0)}}function Fq(t){return"touches"in t?{clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:{clientX:t.clientX,clientY:t.clientY}}function Zk(t){const e=cc({});fl(()=>{const h=t();for(const R in h)e[R]=h[R]},{flush:"sync"});const r={};for(const h in e)r[h]=Nn(()=>e[h]);return r}function V2(t,e){return t.includes(e)}function w9(t){return t[2].toLowerCase()+t.slice(3)}const Wc=()=>[Function,Array];function _6(t,e){return e="on"+yp(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),h=1;h<e;h++)r[h-1]=arguments[h];if(Array.isArray(t))for(const R of t)R(...r);else typeof t=="function"&&t(...r)}function xv(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 h;try{h=[...t.querySelectorAll(r)]}catch{return[]}return h.filter(R=>!R.closest("[inert]")).filter(R=>!!R.offsetParent||R.getClientRects().length>0).filter(R=>{var m,d;return!((m=R.parentElement)!=null&&m.closest("details:not([open])"))||R.tagName==="SUMMARY"&&((d=R.parentElement)==null?void 0:d.tagName)==="DETAILS"})}function T9(t,e,r){let h,R=t.indexOf(document.activeElement);const m=e==="next"?1:-1;do R+=m,h=t[R];while((!h||h.offsetParent==null||!((r==null?void 0:r(h))??!0))&&R<t.length&&R>=0);return h}function _v(t,e){var h,R,m,d;const r=xv(t);if(e==null)(t===document.activeElement||!t.contains(document.activeElement))&&((h=r[0])==null||h.focus());else if(e==="first")(R=r[0])==null||R.focus();else if(e==="last")(m=r.at(-1))==null||m.focus();else if(typeof e=="number")(d=r[e])==null||d.focus();else{const n=T9(r,e);n?n.focus():_v(t,e==="next"?"first":"last")}}function C_(t){return t==null||typeof t=="string"&&t.trim()===""}function Pw(){}function xy(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===Ah?!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 Bq(t,e){if(!Ro||t===0)return e(),()=>{};const r=window.setTimeout(e,t);return()=>window.clearTimeout(r)}function Nq(t,e){const r=t.clientX,h=t.clientY,R=e.getBoundingClientRect(),m=R.left,d=R.top,n=R.right,l=R.bottom;return r>=m&&r<=n&&h>=d&&h<=l}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:()=>$k(t.value)}),e}function _y(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 Vq(t,e,r){const h=new RegExp(`[\\d\\-${U2(r)}]`),R=t.split("").filter(d=>h.test(d)).filter((d,n,l)=>n===0&&/[-]/.test(d)||d===r&&n===l.indexOf(d)||/\d/.test(d)).join("");if(e===0)return R.split(r)[0];const m=new RegExp(`${U2(r)}\\d`);if(e!==null&&m.test(R)){const d=R.split(r);return[d[0],d[1].substring(0,e)].join(r)}return R}function jq(t){const e={};for(const r in t)e[Xh(r)]=t[r];return e}function Uq(t){const e=["checked","disabled"];return Object.fromEntries(Object.entries(t).filter(r=>{let[h,R]=r;return e.includes(h)?!!R:R!==void 0}))}function w6(t){const e=r=>Array.isArray(r)?r.map(h=>e(h)):Xs(r)||sp(r)||Yb(r)?e(Zi(r)):UT(r)?Object.keys(r).reduce((h,R)=>(h[R]=e(r[R]),h),{}):r;return e(t)}const k9=["top","bottom"],Hq=["start","end","left","right"];function GT(t,e){let[r,h]=t.split(" ");return h||(h=V2(k9,r)?"start":V2(Hq,r)?"top":"center"),{side:qT(r,e),align:qT(h,e)}}function qT(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 T6(t){return{side:t.align,align:t.side}}function k6(t){return V2(k9,t.side)?"y":"x"}class nd{constructor(e){const r=document.body.currentCSSZoom??1,h=e instanceof Element,R=h?1+(1-r)/r:1,{x:m,y:d,width:n,height:l}=h?e.getBoundingClientRect():e;this.x=m*R,this.y=d*R,this.width=n*R,this.height=l*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 S6(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 S9(t){if(Array.isArray(t)){const e=document.body.currentCSSZoom??1,r=1+(1-e)/e;return new nd({x:t[0]*r,y:t[1]*r,width:0*r,height:0*r})}else return new nd(t)}function Wq(t){if(t===document.documentElement)if(visualViewport){const e=document.body.currentCSSZoom??1;return new nd({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 nd({x:0,y:0,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight});else return new nd(t)}function Xk(t){const e=new nd(t),r=getComputedStyle(t),h=r.transform;if(h){let R,m,d,n,l;if(h.startsWith("matrix3d("))R=h.slice(9,-1).split(/, /),m=Number(R[0]),d=Number(R[5]),n=Number(R[12]),l=Number(R[13]);else if(h.startsWith("matrix("))R=h.slice(7,-1).split(/, /),m=Number(R[0]),d=Number(R[3]),n=Number(R[4]),l=Number(R[5]);else return new nd(e);const u=r.transformOrigin,i=e.x-n-(1-m)*parseFloat(u),_=e.y-l-(1-d)*parseFloat(u.slice(u.indexOf(" ")+1)),b=m?e.width/m:t.offsetWidth+1,w=d?e.height/d:t.offsetHeight+1;return new nd({x:i,y:_,width:b,height:w})}else return new nd(e)}function Gp(t,e,r){if(typeof t.animate>"u")return{finished:Promise.resolve()};let h;try{h=t.animate(e,r)}catch{return{finished:Promise.resolve()}}return typeof h.finished>"u"&&(h.finished=new Promise(R=>{h.onfinish=()=>{R(h)}})),h}const Z_=new WeakMap;function Gq(t,e){Object.keys(e).forEach(r=>{if(Yk(r)){const h=w9(r),R=Z_.get(t);if(e[r]==null)R==null||R.forEach(m=>{const[d,n]=m;d===h&&(t.removeEventListener(h,n),R.delete(m))});else if(!R||![...R].some(m=>m[0]===h&&m[1]===e[r])){t.addEventListener(h,e[r]);const m=R||new Set;m.add([h,e[r]]),Z_.has(t)||Z_.set(t,m)}}else e[r]==null?t.removeAttribute(r):t.setAttribute(r,e[r])})}function qq(t,e){Object.keys(e).forEach(r=>{if(Yk(r)){const h=w9(r),R=Z_.get(t);R==null||R.forEach(m=>{const[d,n]=m;d===h&&(t.removeEventListener(h,n),R.delete(m))})}else t.removeAttribute(r)})}const C0=2.4,A6=.2126729,C6=.7151522,M6=.072175,$q=.55,Yq=.58,Zq=.57,Xq=.62,E_=.03,E6=1.45,Kq=5e-4,Jq=1.25,Qq=1.25,I6=.078,L6=12.82051282051282,I_=.06,P6=.001;function D6(t,e){const r=(t.r/255)**C0,h=(t.g/255)**C0,R=(t.b/255)**C0,m=(e.r/255)**C0,d=(e.g/255)**C0,n=(e.b/255)**C0;let l=r*A6+h*C6+R*M6,u=m*A6+d*C6+n*M6;if(l<=E_&&(l+=(E_-l)**E6),u<=E_&&(u+=(E_-u)**E6),Math.abs(u-l)<Kq)return 0;let i;if(u>l){const _=(u**$q-l**Yq)*Jq;i=_<P6?0:_<I6?_-_*L6*I_:_-I_}else{const _=(u**Xq-l**Zq)*Qq;i=_>-P6?0:_>-I6?_-_*L6*I_:_+I_}return i*100}const H2=.20689655172413793,e$=t=>t>H2**3?Math.cbrt(t):t/(3*H2**2)+4/29,t$=t=>t>H2?t**3:3*H2**2*(t-4/29);function A9(t){const e=e$,r=e(t[1]);return[116*r-16,500*(e(t[0]/.95047)-r),200*(r-e(t[2]/1.08883))]}function C9(t){const e=t$,r=(t[0]+16)/116;return[e(r+t[1]/500)*.95047,e(r),e(r-t[2]/200)*1.08883]}const n$=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]],r$=t=>t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055,i$=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],a$=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4;function M9(t){const e=Array(3),r=r$,h=n$;for(let R=0;R<3;++R)e[R]=Math.round(Vo(r(h[R][0]*t[0]+h[R][1]*t[1]+h[R][2]*t[2]))*255);return{r:e[0],g:e[1],b:e[2]}}function Kk(t){let{r:e,g:r,b:h}=t;const R=[0,0,0],m=a$,d=i$;e=m(e/255),r=m(r/255),h=m(h/255);for(let n=0;n<3;++n)R[n]=d[n][0]*e+d[n][1]*r+d[n][2]*h;return R}function $T(t){return!!t&&/^(#|var\(--|(rgb|hsl)a?\()/.test(t)}function o$(t){return $T(t)&&!/^((rgb|hsl)a?\()?var\(--/.test(t)}const R6=/^(?<fn>(?:rgb|hsl)a?)\((?<values>.+)\)/,s$={rgb:(t,e,r,h)=>({r:t,g:e,b:r,a:h}),rgba:(t,e,r,h)=>({r:t,g:e,b:r,a:h}),hsl:(t,e,r,h)=>O6({h:t,s:e,l:r,a:h}),hsla:(t,e,r,h)=>O6({h:t,s:e,l:r,a:h}),hsv:(t,e,r,h)=>mp({h:t,s:e,v:r,a:h}),hsva:(t,e,r,h)=>mp({h:t,s:e,v:r,a:h})};function Lf(t){if(typeof t=="number")return{r:(t&16711680)>>16,g:(t&65280)>>8,b:t&255};if(typeof t=="string"&&R6.test(t)){const{groups:e}=t.match(R6),{fn:r,values:h}=e,R=h.split(/,\s*|\s*\/\s*|\s+/).map((m,d)=>m.endsWith("%")||d>0&&d<3&&["hsl","hsla","hsv","hsva"].includes(r)?parseFloat(m)/100:parseFloat(m));return s$[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),P9(e)}else if(typeof t=="object"){if(dv(t,["r","g","b"]))return t;if(dv(t,["h","s","l"]))return mp(Jk(t));if(dv(t,["h","s","v"]))return mp(t)}throw new TypeError(`Invalid color: ${t==null?t:String(t)||t.constructor.name}
|
|
4204
|
+
`),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(f,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)}))(f,Kt),this.binderUniforms=z?z.getUniforms(f,Kt):[]}draw(f,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft,yt,Ct,kt,Bt){const At=f.gl;if(this.failedToCreate)return;if(f.program.set(this.program),f.setDepthMode(z),f.setStencilMode(j),f.setColorMode($),f.setCullFace(ie),xe){f.activeTexture.set(At.TEXTURE2),At.bindTexture(At.TEXTURE_2D,xe.depthTexture),f.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(f,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(f,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,f,g){const z=1/Tt(g,1,f.transform.tileZoom),j=Math.pow(2,g.tileID.overscaledZ),$=g.tileSize*Math.pow(2,f.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,f,g,z)=>{const j=f.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,-f.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,f,g,z,j,$,ie)=>i.e(sr(V,f,g,z),Wn($,f,ie),{u_height_factor:-Math.pow(2,j.overscaledZ)/ie.tileSize/8}),wr=V=>({u_matrix:V}),Ur=(V,f,g,z)=>i.e(wr(V),Wn(g,f,z)),ei=(V,f)=>({u_matrix:V,u_world:f}),vn=(V,f,g,z,j)=>i.e(Ur(V,f,g,z),{u_world:j}),qn=(V,f,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(f.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,f)=>({u_matrix:f,u_pixel_extrude_scale:[1/V.width,1/V.height]}),ln=(V,f,g)=>({u_matrix:V,u_inv_matrix:f,u_camera_to_center_distance:g.cameraToCenterDistance,u_viewport_size:[g.width,g.height]}),bn=(V,f,g=1)=>({u_matrix:V,u_color:f,u_overlay:0,u_overlay_scale:g}),Fn=V=>({u_matrix:V}),Bn=(V,f,g,z)=>({u_matrix:V,u_extrude_scale:Tt(f,1,g),u_intensity:z}),Kn=(V,f,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:f.paint.get("heatmap-opacity")}},Hn=(V,f,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(f.tileID.toUnwrapped(),xe),u_image:0,u_latrange:hn(0,f.tileID),u_light:[g.paint.get("hillshade-exaggeration"),de],u_shadow:j,u_highlight:$,u_accent:ie}},Dn=(V,f)=>{const g=f.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:f.getUnpackVector()}};function hn(V,f){const g=Math.pow(2,f.canonical.z),z=f.canonical.y;return[new i.Z(0,z/g).toLngLat().lat,new i.Z(0,(z+1)/g).toLngLat().lat]}const cn=(V,f,g,z)=>{const j=V.transform;return{u_matrix:yr(V,f,g,z),u_ratio:1/Tt(f,1,j.zoom),u_device_pixel_ratio:V.pixelRatio,u_units_to_pixels:[1/j.pixelsToGLUnits[0],1/j.pixelsToGLUnits[1]]}},En=(V,f,g,z,j)=>i.e(cn(V,f,g,j),{u_image:0,u_image_height:z}),tr=(V,f,g,z,j)=>{const $=V.transform,ie=fr(f,$);return{u_matrix:yr(V,f,g,j),u_texsize:f.imageAtlasTexture.size,u_ratio:1/Tt(f,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,f,g,z,j,$)=>{const ie=V.transform,de=V.lineAtlas,xe=fr(f,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,f,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,f){return 1/Tt(V,1,f.tileZoom)}function yr(V,f,g,z){return V.translatePosMatrix(z?z.posMatrix:f.tileID.posMatrix,f,g.paint.get("line-translate"),g.paint.get("line-translate-anchor"))}const Or=(V,f,g,z,j)=>{return{u_matrix:V,u_tl_parent:f,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 f=Math.sin(V),g=Math.cos(V);return[(2*g+1)/3,(-Math.sqrt(3)*f-g+1)/3,(Math.sqrt(3)*f-g+1)/3]}const Br=(V,f,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:f?f.uSizeT:0,u_size:f?f.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,f,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt,ft)=>{const yt=ie.transform;return i.e(Br(V,f,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,f,g,z,j,$,ie,de,xe,Ae,Re,je,tt,lt)=>i.e(Cr(V,f,g,z,j,$,ie,de,xe,Ae,Re,!0,je,!0,lt),{u_texsize_icon:tt,u_texture_icon:1}),$r=(V,f,g)=>({u_matrix:V,u_opacity:f,u_color:g}),fi=(V,f,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:f}),Qr={fillExtrusion:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_lightpos:new i.aO(V,f.u_lightpos),u_lightintensity:new i.aJ(V,f.u_lightintensity),u_lightcolor:new i.aO(V,f.u_lightcolor),u_vertical_gradient:new i.aJ(V,f.u_vertical_gradient),u_opacity:new i.aJ(V,f.u_opacity)}),fillExtrusionPattern:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_lightpos:new i.aO(V,f.u_lightpos),u_lightintensity:new i.aJ(V,f.u_lightintensity),u_lightcolor:new i.aO(V,f.u_lightcolor),u_vertical_gradient:new i.aJ(V,f.u_vertical_gradient),u_height_factor:new i.aJ(V,f.u_height_factor),u_image:new i.aI(V,f.u_image),u_texsize:new i.aP(V,f.u_texsize),u_pixel_coord_upper:new i.aP(V,f.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,f.u_pixel_coord_lower),u_scale:new i.aO(V,f.u_scale),u_fade:new i.aJ(V,f.u_fade),u_opacity:new i.aJ(V,f.u_opacity)}),fill:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix)}),fillPattern:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_image:new i.aI(V,f.u_image),u_texsize:new i.aP(V,f.u_texsize),u_pixel_coord_upper:new i.aP(V,f.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,f.u_pixel_coord_lower),u_scale:new i.aO(V,f.u_scale),u_fade:new i.aJ(V,f.u_fade)}),fillOutline:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_world:new i.aP(V,f.u_world)}),fillOutlinePattern:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_world:new i.aP(V,f.u_world),u_image:new i.aI(V,f.u_image),u_texsize:new i.aP(V,f.u_texsize),u_pixel_coord_upper:new i.aP(V,f.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,f.u_pixel_coord_lower),u_scale:new i.aO(V,f.u_scale),u_fade:new i.aJ(V,f.u_fade)}),circle:(V,f)=>({u_camera_to_center_distance:new i.aJ(V,f.u_camera_to_center_distance),u_scale_with_map:new i.aI(V,f.u_scale_with_map),u_pitch_with_map:new i.aI(V,f.u_pitch_with_map),u_extrude_scale:new i.aP(V,f.u_extrude_scale),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_matrix:new i.aK(V,f.u_matrix)}),collisionBox:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_pixel_extrude_scale:new i.aP(V,f.u_pixel_extrude_scale)}),collisionCircle:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_inv_matrix:new i.aK(V,f.u_inv_matrix),u_camera_to_center_distance:new i.aJ(V,f.u_camera_to_center_distance),u_viewport_size:new i.aP(V,f.u_viewport_size)}),debug:(V,f)=>({u_color:new i.aM(V,f.u_color),u_matrix:new i.aK(V,f.u_matrix),u_overlay:new i.aI(V,f.u_overlay),u_overlay_scale:new i.aJ(V,f.u_overlay_scale)}),clippingMask:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix)}),heatmap:(V,f)=>({u_extrude_scale:new i.aJ(V,f.u_extrude_scale),u_intensity:new i.aJ(V,f.u_intensity),u_matrix:new i.aK(V,f.u_matrix)}),heatmapTexture:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_world:new i.aP(V,f.u_world),u_image:new i.aI(V,f.u_image),u_color_ramp:new i.aI(V,f.u_color_ramp),u_opacity:new i.aJ(V,f.u_opacity)}),hillshade:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_image:new i.aI(V,f.u_image),u_latrange:new i.aP(V,f.u_latrange),u_light:new i.aP(V,f.u_light),u_shadow:new i.aM(V,f.u_shadow),u_highlight:new i.aM(V,f.u_highlight),u_accent:new i.aM(V,f.u_accent)}),hillshadePrepare:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_image:new i.aI(V,f.u_image),u_dimension:new i.aP(V,f.u_dimension),u_zoom:new i.aJ(V,f.u_zoom),u_unpack:new i.aL(V,f.u_unpack)}),line:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_ratio:new i.aJ(V,f.u_ratio),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,f.u_units_to_pixels)}),lineGradient:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_ratio:new i.aJ(V,f.u_ratio),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,f.u_units_to_pixels),u_image:new i.aI(V,f.u_image),u_image_height:new i.aJ(V,f.u_image_height)}),linePattern:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_texsize:new i.aP(V,f.u_texsize),u_ratio:new i.aJ(V,f.u_ratio),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_image:new i.aI(V,f.u_image),u_units_to_pixels:new i.aP(V,f.u_units_to_pixels),u_scale:new i.aO(V,f.u_scale),u_fade:new i.aJ(V,f.u_fade)}),lineSDF:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_ratio:new i.aJ(V,f.u_ratio),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_units_to_pixels:new i.aP(V,f.u_units_to_pixels),u_patternscale_a:new i.aP(V,f.u_patternscale_a),u_patternscale_b:new i.aP(V,f.u_patternscale_b),u_sdfgamma:new i.aJ(V,f.u_sdfgamma),u_image:new i.aI(V,f.u_image),u_tex_y_a:new i.aJ(V,f.u_tex_y_a),u_tex_y_b:new i.aJ(V,f.u_tex_y_b),u_mix:new i.aJ(V,f.u_mix)}),raster:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_tl_parent:new i.aP(V,f.u_tl_parent),u_scale_parent:new i.aJ(V,f.u_scale_parent),u_buffer_scale:new i.aJ(V,f.u_buffer_scale),u_fade_t:new i.aJ(V,f.u_fade_t),u_opacity:new i.aJ(V,f.u_opacity),u_image0:new i.aI(V,f.u_image0),u_image1:new i.aI(V,f.u_image1),u_brightness_low:new i.aJ(V,f.u_brightness_low),u_brightness_high:new i.aJ(V,f.u_brightness_high),u_saturation_factor:new i.aJ(V,f.u_saturation_factor),u_contrast_factor:new i.aJ(V,f.u_contrast_factor),u_spin_weights:new i.aO(V,f.u_spin_weights)}),symbolIcon:(V,f)=>({u_is_size_zoom_constant:new i.aI(V,f.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,f.u_is_size_feature_constant),u_size_t:new i.aJ(V,f.u_size_t),u_size:new i.aJ(V,f.u_size),u_camera_to_center_distance:new i.aJ(V,f.u_camera_to_center_distance),u_pitch:new i.aJ(V,f.u_pitch),u_rotate_symbol:new i.aI(V,f.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,f.u_aspect_ratio),u_fade_change:new i.aJ(V,f.u_fade_change),u_matrix:new i.aK(V,f.u_matrix),u_label_plane_matrix:new i.aK(V,f.u_label_plane_matrix),u_coord_matrix:new i.aK(V,f.u_coord_matrix),u_is_text:new i.aI(V,f.u_is_text),u_pitch_with_map:new i.aI(V,f.u_pitch_with_map),u_is_along_line:new i.aI(V,f.u_is_along_line),u_is_variable_anchor:new i.aI(V,f.u_is_variable_anchor),u_texsize:new i.aP(V,f.u_texsize),u_texture:new i.aI(V,f.u_texture),u_translation:new i.aP(V,f.u_translation),u_pitched_scale:new i.aJ(V,f.u_pitched_scale)}),symbolSDF:(V,f)=>({u_is_size_zoom_constant:new i.aI(V,f.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,f.u_is_size_feature_constant),u_size_t:new i.aJ(V,f.u_size_t),u_size:new i.aJ(V,f.u_size),u_camera_to_center_distance:new i.aJ(V,f.u_camera_to_center_distance),u_pitch:new i.aJ(V,f.u_pitch),u_rotate_symbol:new i.aI(V,f.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,f.u_aspect_ratio),u_fade_change:new i.aJ(V,f.u_fade_change),u_matrix:new i.aK(V,f.u_matrix),u_label_plane_matrix:new i.aK(V,f.u_label_plane_matrix),u_coord_matrix:new i.aK(V,f.u_coord_matrix),u_is_text:new i.aI(V,f.u_is_text),u_pitch_with_map:new i.aI(V,f.u_pitch_with_map),u_is_along_line:new i.aI(V,f.u_is_along_line),u_is_variable_anchor:new i.aI(V,f.u_is_variable_anchor),u_texsize:new i.aP(V,f.u_texsize),u_texture:new i.aI(V,f.u_texture),u_gamma_scale:new i.aJ(V,f.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_is_halo:new i.aI(V,f.u_is_halo),u_translation:new i.aP(V,f.u_translation),u_pitched_scale:new i.aJ(V,f.u_pitched_scale)}),symbolTextAndIcon:(V,f)=>({u_is_size_zoom_constant:new i.aI(V,f.u_is_size_zoom_constant),u_is_size_feature_constant:new i.aI(V,f.u_is_size_feature_constant),u_size_t:new i.aJ(V,f.u_size_t),u_size:new i.aJ(V,f.u_size),u_camera_to_center_distance:new i.aJ(V,f.u_camera_to_center_distance),u_pitch:new i.aJ(V,f.u_pitch),u_rotate_symbol:new i.aI(V,f.u_rotate_symbol),u_aspect_ratio:new i.aJ(V,f.u_aspect_ratio),u_fade_change:new i.aJ(V,f.u_fade_change),u_matrix:new i.aK(V,f.u_matrix),u_label_plane_matrix:new i.aK(V,f.u_label_plane_matrix),u_coord_matrix:new i.aK(V,f.u_coord_matrix),u_is_text:new i.aI(V,f.u_is_text),u_pitch_with_map:new i.aI(V,f.u_pitch_with_map),u_is_along_line:new i.aI(V,f.u_is_along_line),u_is_variable_anchor:new i.aI(V,f.u_is_variable_anchor),u_texsize:new i.aP(V,f.u_texsize),u_texsize_icon:new i.aP(V,f.u_texsize_icon),u_texture:new i.aI(V,f.u_texture),u_texture_icon:new i.aI(V,f.u_texture_icon),u_gamma_scale:new i.aJ(V,f.u_gamma_scale),u_device_pixel_ratio:new i.aJ(V,f.u_device_pixel_ratio),u_is_halo:new i.aI(V,f.u_is_halo),u_translation:new i.aP(V,f.u_translation),u_pitched_scale:new i.aJ(V,f.u_pitched_scale)}),background:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_opacity:new i.aJ(V,f.u_opacity),u_color:new i.aM(V,f.u_color)}),backgroundPattern:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_opacity:new i.aJ(V,f.u_opacity),u_image:new i.aI(V,f.u_image),u_pattern_tl_a:new i.aP(V,f.u_pattern_tl_a),u_pattern_br_a:new i.aP(V,f.u_pattern_br_a),u_pattern_tl_b:new i.aP(V,f.u_pattern_tl_b),u_pattern_br_b:new i.aP(V,f.u_pattern_br_b),u_texsize:new i.aP(V,f.u_texsize),u_mix:new i.aJ(V,f.u_mix),u_pattern_size_a:new i.aP(V,f.u_pattern_size_a),u_pattern_size_b:new i.aP(V,f.u_pattern_size_b),u_scale_a:new i.aJ(V,f.u_scale_a),u_scale_b:new i.aJ(V,f.u_scale_b),u_pixel_coord_upper:new i.aP(V,f.u_pixel_coord_upper),u_pixel_coord_lower:new i.aP(V,f.u_pixel_coord_lower),u_tile_units_to_pixels:new i.aJ(V,f.u_tile_units_to_pixels)}),terrain:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_texture:new i.aI(V,f.u_texture),u_ele_delta:new i.aJ(V,f.u_ele_delta),u_fog_matrix:new i.aK(V,f.u_fog_matrix),u_fog_color:new i.aM(V,f.u_fog_color),u_fog_ground_blend:new i.aJ(V,f.u_fog_ground_blend),u_fog_ground_blend_opacity:new i.aJ(V,f.u_fog_ground_blend_opacity),u_horizon_color:new i.aM(V,f.u_horizon_color),u_horizon_fog_blend:new i.aJ(V,f.u_horizon_fog_blend)}),terrainDepth:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_ele_delta:new i.aJ(V,f.u_ele_delta)}),terrainCoords:(V,f)=>({u_matrix:new i.aK(V,f.u_matrix),u_texture:new i.aI(V,f.u_texture),u_terrain_coords_id:new i.aJ(V,f.u_terrain_coords_id),u_ele_delta:new i.aJ(V,f.u_ele_delta)}),sky:(V,f)=>({u_sky_color:new i.aM(V,f.u_sky_color),u_horizon_color:new i.aM(V,f.u_horizon_color),u_horizon:new i.aJ(V,f.u_horizon),u_sky_horizon_blend:new i.aJ(V,f.u_sky_horizon_blend)})};class Hr{constructor(f,g,z){this.context=f;const j=f.gl;this.buffer=j.createBuffer(),this.dynamicDraw=!!z,this.context.unbindVAO(),f.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(f){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,f.arrayBuffer)}destroy(){const f=this.context.gl;this.buffer&&(f.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(f,g,z,j){this.length=g.length,this.attributes=z,this.itemSize=g.bytesPerElement,this.dynamicDraw=j,this.context=f;const $=f.gl;this.buffer=$.createBuffer(),f.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(f){if(f.length!==this.length)throw new Error(`Length of new data is ${f.length}, which doesn't match current length of ${this.length}`);const g=this.context.gl;this.bind(),g.bufferSubData(g.ARRAY_BUFFER,0,f.arrayBuffer)}enableAttributes(f,g){for(let z=0;z<this.attributes.length;z++){const j=this.attributes[z],$=g.attributes[j.name];$!==void 0&&f.enableVertexAttribArray($)}}setVertexAttribPointers(f,g,z){for(let j=0;j<this.attributes.length;j++){const $=this.attributes[j],ie=g.attributes[$.name];ie!==void 0&&f.vertexAttribPointer(ie,$.components,f[oi[$.type]],!1,this.itemSize,$.offset+this.itemSize*(z||0))}}destroy(){const f=this.context.gl;this.buffer&&(f.deleteBuffer(this.buffer),delete this.buffer)}}const Bi=new WeakMap;function Ya(V){var f;if(Bi.has(V))return Bi.get(V);{const g=(f=V.getParameter(V.VERSION))===null||f===void 0?void 0:f.startsWith("WebGL 2.0");return Bi.set(V,g),g}}class Vi{constructor(f){this.gl=f.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(f){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ns extends Vi{getDefault(){return i.aN.transparent}set(f){const g=this.current;(f.r!==g.r||f.g!==g.g||f.b!==g.b||f.a!==g.a||this.dirty)&&(this.gl.clearColor(f.r,f.g,f.b,f.a),this.current=f,this.dirty=!1)}}class no extends Vi{getDefault(){return 1}set(f){(f!==this.current||this.dirty)&&(this.gl.clearDepth(f),this.current=f,this.dirty=!1)}}class ko extends Vi{getDefault(){return 0}set(f){(f!==this.current||this.dirty)&&(this.gl.clearStencil(f),this.current=f,this.dirty=!1)}}class el extends Vi{getDefault(){return[!0,!0,!0,!0]}set(f){const g=this.current;(f[0]!==g[0]||f[1]!==g[1]||f[2]!==g[2]||f[3]!==g[3]||this.dirty)&&(this.gl.colorMask(f[0],f[1],f[2],f[3]),this.current=f,this.dirty=!1)}}class Ui extends Vi{getDefault(){return!0}set(f){(f!==this.current||this.dirty)&&(this.gl.depthMask(f),this.current=f,this.dirty=!1)}}class Wo extends Vi{getDefault(){return 255}set(f){(f!==this.current||this.dirty)&&(this.gl.stencilMask(f),this.current=f,this.dirty=!1)}}class Bl extends Vi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(f){const g=this.current;(f.func!==g.func||f.ref!==g.ref||f.mask!==g.mask||this.dirty)&&(this.gl.stencilFunc(f.func,f.ref,f.mask),this.current=f,this.dirty=!1)}}class jo extends Vi{getDefault(){const f=this.gl;return[f.KEEP,f.KEEP,f.KEEP]}set(f){const g=this.current;(f[0]!==g[0]||f[1]!==g[1]||f[2]!==g[2]||this.dirty)&&(this.gl.stencilOp(f[0],f[1],f[2]),this.current=f,this.dirty=!1)}}class Wu extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;f?g.enable(g.STENCIL_TEST):g.disable(g.STENCIL_TEST),this.current=f,this.dirty=!1}}class Sl extends Vi{getDefault(){return[0,1]}set(f){const g=this.current;(f[0]!==g[0]||f[1]!==g[1]||this.dirty)&&(this.gl.depthRange(f[0],f[1]),this.current=f,this.dirty=!1)}}class Is extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;f?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST),this.current=f,this.dirty=!1}}class Gu extends Vi{getDefault(){return this.gl.LESS}set(f){(f!==this.current||this.dirty)&&(this.gl.depthFunc(f),this.current=f,this.dirty=!1)}}class qu extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;f?g.enable(g.BLEND):g.disable(g.BLEND),this.current=f,this.dirty=!1}}class dc extends Vi{getDefault(){const f=this.gl;return[f.ONE,f.ZERO]}set(f){const g=this.current;(f[0]!==g[0]||f[1]!==g[1]||this.dirty)&&(this.gl.blendFunc(f[0],f[1]),this.current=f,this.dirty=!1)}}class tl extends Vi{getDefault(){return i.aN.transparent}set(f){const g=this.current;(f.r!==g.r||f.g!==g.g||f.b!==g.b||f.a!==g.a||this.dirty)&&(this.gl.blendColor(f.r,f.g,f.b,f.a),this.current=f,this.dirty=!1)}}class Su extends Vi{getDefault(){return this.gl.FUNC_ADD}set(f){(f!==this.current||this.dirty)&&(this.gl.blendEquation(f),this.current=f,this.dirty=!1)}}class Al extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;f?g.enable(g.CULL_FACE):g.disable(g.CULL_FACE),this.current=f,this.dirty=!1}}class ro extends Vi{getDefault(){return this.gl.BACK}set(f){(f!==this.current||this.dirty)&&(this.gl.cullFace(f),this.current=f,this.dirty=!1)}}class rs extends Vi{getDefault(){return this.gl.CCW}set(f){(f!==this.current||this.dirty)&&(this.gl.frontFace(f),this.current=f,this.dirty=!1)}}class $u extends Vi{getDefault(){return null}set(f){(f!==this.current||this.dirty)&&(this.gl.useProgram(f),this.current=f,this.dirty=!1)}}class Au extends Vi{getDefault(){return this.gl.TEXTURE0}set(f){(f!==this.current||this.dirty)&&(this.gl.activeTexture(f),this.current=f,this.dirty=!1)}}class fu extends Vi{getDefault(){const f=this.gl;return[0,0,f.drawingBufferWidth,f.drawingBufferHeight]}set(f){const g=this.current;(f[0]!==g[0]||f[1]!==g[1]||f[2]!==g[2]||f[3]!==g[3]||this.dirty)&&(this.gl.viewport(f[0],f[1],f[2],f[3]),this.current=f,this.dirty=!1)}}class Yu extends Vi{getDefault(){return null}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.bindFramebuffer(g.FRAMEBUFFER,f),this.current=f,this.dirty=!1}}class du extends Vi{getDefault(){return null}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.bindRenderbuffer(g.RENDERBUFFER,f),this.current=f,this.dirty=!1}}class Zu extends Vi{getDefault(){return null}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.bindTexture(g.TEXTURE_2D,f),this.current=f,this.dirty=!1}}class Xu extends Vi{getDefault(){return null}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.bindBuffer(g.ARRAY_BUFFER,f),this.current=f,this.dirty=!1}}class Cu extends Vi{getDefault(){return null}set(f){const g=this.gl;g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,f),this.current=f,this.dirty=!1}}class Ls extends Vi{getDefault(){return null}set(f){var g;if(f===this.current&&!this.dirty)return;const z=this.gl;Ya(z)?z.bindVertexArray(f):(g=z.getExtension("OES_vertex_array_object"))===null||g===void 0||g.bindVertexArrayOES(f),this.current=f,this.dirty=!1}}class Lh extends Vi{getDefault(){return 4}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_ALIGNMENT,f),this.current=f,this.dirty=!1}}class fh extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f),this.current=f,this.dirty=!1}}class pc extends Vi{getDefault(){return!1}set(f){if(f===this.current&&!this.dirty)return;const g=this.gl;g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,f),this.current=f,this.dirty=!1}}class Ph extends Vi{constructor(f,g){super(f),this.context=f,this.parent=g}getDefault(){return null}}class Jh extends Ph{setDirty(){this.dirty=!0}set(f){if(f===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,f,0),this.current=f,this.dirty=!1}}class Nl extends Ph{set(f){if(f===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const g=this.gl;g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,f),this.current=f,this.dirty=!1}}class Qh extends Ph{set(f){if(f===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,f),this.current=f,this.dirty=!1}}class sd{constructor(f,g,z,j,$){this.context=f,this.width=g,this.height=z;const ie=f.gl,de=this.framebuffer=ie.createFramebuffer();if(this.colorAttachment=new Jh(f,de),j)this.depthAttachment=$?new Qh(f,de):new Nl(f,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 f=this.context.gl,g=this.colorAttachment.get();if(g&&f.deleteTexture(g),this.depthAttachment){const z=this.depthAttachment.get();z&&f.deleteRenderbuffer(z)}f.deleteFramebuffer(this.framebuffer)}}class Go{constructor(f,g,z){this.blendFunction=f,this.blendColor=g,this.mask=z}}Go.Replace=[1,0],Go.disabled=new Go(Go.Replace,i.aN.transparent,[!1,!1,!1,!1]),Go.unblended=new Go(Go.Replace,i.aN.transparent,[!0,!0,!0,!0]),Go.alphaBlended=new Go([1,771],i.aN.transparent,[!0,!0,!0,!0]);class Yc{constructor(f){var g,z;if(this.gl=f,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 Gu(this),this.blend=new qu(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 Lh(this),this.pixelStoreUnpackPremultiplyAlpha=new fh(this),this.pixelStoreUnpackFlipY=new pc(this),this.extTextureFilterAnisotropic=f.getExtension("EXT_texture_filter_anisotropic")||f.getExtension("MOZ_EXT_texture_filter_anisotropic")||f.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=f.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=f.getParameter(f.MAX_TEXTURE_SIZE),Ya(f)){this.HALF_FLOAT=f.HALF_FLOAT;const j=f.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(g=f.RGBA16F)!==null&&g!==void 0?g:j==null?void 0:j.RGBA16F_EXT,this.RGB16F=(z=f.RGB16F)!==null&&z!==void 0?z:j==null?void 0:j.RGB16F_EXT,f.getExtension("EXT_color_buffer_float")}else{f.getExtension("EXT_color_buffer_half_float"),f.getExtension("OES_texture_half_float_linear");const j=f.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(f,g){return new Hr(this,f,g)}createVertexBuffer(f,g,z){return new Mi(this,f,g,z)}createRenderbuffer(f,g,z){const j=this.gl,$=j.createRenderbuffer();return this.bindRenderbuffer.set($),j.renderbufferStorage(j.RENDERBUFFER,f,g,z),this.bindRenderbuffer.set(null),$}createFramebuffer(f,g,z,j){return new sd(this,f,g,z,j)}clear({color:f,depth:g,stencil:z}){const j=this.gl;let $=0;f&&($|=j.COLOR_BUFFER_BIT,this.clearColor.set(f),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(f){f.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(f.mode),this.frontFace.set(f.frontFace))}setDepthMode(f){f.func!==this.gl.ALWAYS||f.mask?(this.depthTest.set(!0),this.depthFunc.set(f.func),this.depthMask.set(f.mask),this.depthRange.set(f.range)):this.depthTest.set(!1)}setStencilMode(f){f.test.func!==this.gl.ALWAYS||f.mask?(this.stencilTest.set(!0),this.stencilMask.set(f.mask),this.stencilOp.set([f.fail,f.depthFail,f.pass]),this.stencilFunc.set({func:f.test.func,ref:f.ref,mask:f.test.mask})):this.stencilTest.set(!1)}setColorMode(f){i.aF(f.blendFunction,Go.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(f.blendFunction),this.blendColor.set(f.blendColor)),this.colorMask.set(f.mask)}createVertexArray(){var f;return Ya(this.gl)?this.gl.createVertexArray():(f=this.gl.getExtension("OES_vertex_array_object"))===null||f===void 0?void 0:f.createVertexArrayOES()}deleteVertexArray(f){var g;return Ya(this.gl)?this.gl.deleteVertexArray(f):(g=this.gl.getExtension("OES_vertex_array_object"))===null||g===void 0?void 0:g.deleteVertexArrayOES(f)}unbindVAO(){this.bindVertexArray.set(null)}}class Qi{constructor(f,g,z){this.func=f,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(f,g,z,j,$,ie){this.test=f,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(f,g,z){this.enable=f,this.mode=g,this.frontFace=z}}let Vl;function dl(V,f,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=f.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 Zc=i.ao(new Float32Array(16));function Ku(V,f,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,f,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,f,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,f,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),f.map.showCollisionBoxes&&(dl(V,f,g,z,!0),dl(V,f,g,z,!1))}function pl(V,f,g,z,j,$){const{horizontalAlign:ie,verticalAlign:de}=i.av(V),xe=-(ie-.5)*f,Ae=-(de-.5)*g;return new i.P((xe/j+z[0])*$,(Ae/j+z[1])*$)}function Cl(V,f,g,z,j,$){const ie=f.tileAnchorPoint.add(new i.P(f.translation[0],f.translation[1]));if(f.pitchWithMap){let de=z.mult($);return g||(de=de.rotate(-j)),Ut(ie.add(de),f.labelPlaneMatrix,f.getElevation).point}if(g){const de=$e(f.tileAnchorPoint.x+1,f.tileAnchorPoint.y,f).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,f,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,f,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,f,g){return g.iconsInText&&f?"symbolTextAndIcon":V?"symbolSDF":"symbolIcon"}function Pc(V,f,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=f.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],qi=null;if(j){if(vi=er.glyphAtlasTexture,Wi=lt.LINEAR,ri=er.glyphAtlasTexture.size,Tr.iconsInText){Yi=er.imageAtlasTexture.size,qi=er.imageAtlasTexture;const Gi=Pr.kind==="composite"||Pr.kind==="camera";Di=br||V.options.rotating||V.options.zooming||Gi?lt.LINEAR:lt.NEAREST}}else{const Gi=g.layout.get("icon-size").constantOr(0)!==1||Tr.iconsNeedLinear;vi=er.imageAtlasTexture,Wi=ur||V.options.rotating||V.options.zooming||Gi||br?lt.LINEAR:lt.NEAREST,ri=er.imageAtlasTexture.size}const ea=Tt(er,1,V.transform.zoom),_a=$t?$n.posMatrix:Zc,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 Gi=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,Gi)}const Pa=$n.posMatrix,va=j&&Tn||oo,Ca=Bt||va?Zc:So,Wa=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,Wa,Aa,ri,Yi,jn):Cr(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,Wa,Aa,j,ri,!0,jn):Br(Pr.kind,li,At,kt,Bt,va,V,Pa,Ca,Wa,Aa,j,ri,jn);const Lo={program:Nr,buffers:rr,uniformValues:Kl,atlasTexture:vi,atlasTextureIcon:qi,atlasInterpolation:Wi,atlasInterpolationIcon:Di,isSDF:ur,hasHalo:aa};if(Kt&&Tr.canOverlap){Yt=!0;const Gi=rr.segments.get();for(const _s of Gi)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,ef(er.buffers,$n.segments,g,V,er.program,pn,Re,je,Tr,$n.terrainData)),Tr.u_is_halo=0}ef(er.buffers,$n.segments,g,V,er.program,pn,Re,je,er.uniformValues,$n.terrainData)}}function ef(V,f,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,f,g.paint,z.transform.zoom,V.programConfigurations.get(g.id),V.dynamicLayoutVertexBuffer,V.opacityVertexBuffer)}function Ju(V,f,g,z){if(g.paint.get("heatmap-opacity")!==0)if(V.renderPass==="offscreen"){const j=V.context,$=j.gl,ie=Za.disabled,de=new Go([$.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(f.hasRenderableParent(Ae))continue;const Re=f.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,f,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(f);ie=$[xe],de=$[xe]}ie&&de&&V.setConstantPatternPositions(ie,de)}function dh(V,f,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=f.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):ei(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 Xc(V,f,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=f.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 Kc(V,f,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(f);de.activeTexture.set(xe.TEXTURE0),xe.bindTexture(xe.TEXTURE_2D,Ae.colorAttachment.get());const tt=je?f: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,f,g,z,j,$){const ie=V.context,de=ie.gl,xe=f.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),f.demTexture=f.demTexture||V.getTileTexture(Re),f.demTexture){const lt=f.demTexture;lt.update(je,{premultiply:!1}),lt.bind(de.NEAREST,de.CLAMP_TO_EDGE)}else f.demTexture=new D(ie,je,de.RGBA,{premultiply:!1}),f.demTexture.bind(de.NEAREST,de.CLAMP_TO_EDGE);ie.activeTexture.set(de.TEXTURE0);let tt=f.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=f.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(f.tileID,xe),null,g.id,V.rasterBoundsBuffer,V.quadTriangleIndexBuffer,V.rasterBoundsSegments),f.needsHillshadePrepare=!1}}function jl(V,f,g,z,j,$){const ie=z.paint.get("raster-fade-duration");if(!$&&ie>0){const de=v.now(),xe=(de-V.timeAdded)/ie,Ae=f?(de-f.timeAdded)/ie:-1,Re=g.getSource(),je=j.coveringZoomLevel({tileSize:Re.tileSize,roundZoom:Re.roundZoom}),tt=!f||Math.abs(f.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),f?{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),Dh=new i.aN(0,1,1,1);function Rh(V){const f=V.transform.padding;ph(V,V.transform.height-(f.top||0),3,pu),ph(V,f.bottom||0,3,ec),Ps(V,f.left||0,3,Ul),Ps(V,V.transform.width-(f.right||0),3,ga);const g=V.transform.centerPoint;(function(z,j,$,ie){Jc(z,j-1,$-10,2,20,ie),Jc(z,j-10,$-1,20,2,ie)})(V,g.x,V.transform.height-g.y,Dh)}function ph(V,f,g,z){Jc(V,0,f+g/2,V.transform.width,g,z)}function Ps(V,f,g,z){Jc(V,f-g/2,0,g,V.transform.height,z)}function Jc(V,f,g,z,j,$){const ie=V.context,de=ie.gl;de.enable(de.SCISSOR_TEST),de.scissor(f*V.pixelRatio,g*V.pixelRatio,z*V.pixelRatio,j*V.pixelRatio),ie.clear({color:$}),de.disable(de.SCISSOR_TEST)}function Hf(V,f,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=f.getTileByID(g.key).latestRawTileData,lt=tt&&tt.byteLength||0,ft=Math.floor(lt/1024),yt=f.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,Go.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,f,g){const z=V.context,j=z.gl,$=V.colorModeForRenderPass(),ie=new Qi(j.LEQUAL,Qi.ReadWrite,V.depthRangeFor3D),de=V.useProgram("terrain"),xe=f.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=f.getTerrainData(Ae.tileID);z.activeTexture.set(j.TEXTURE0),j.bindTexture(j.TEXTURE_2D,Re.texture);const tt=V.transform.calculatePosMatrix(Ae.tileID.toUnwrapped()),lt=f.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(f,g,z){this.vertexBuffer=f,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(f,g){this.context=new Yc(f),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(f,g,z){if(this.width=Math.floor(f*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 f=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=f.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=f.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=f.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=f.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=f.createIndexBuffer(ie);const de=new i.aY;de.emplaceBack(0,1,2),de.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=f.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 f=this.context,g=f.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(f,g.TRIANGLES,Qi.disabled,this.stencilClearMode,Go.disabled,Xa.disabled,Fn(z),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(f,g){if(this.currentStencilSource===f.source||!f.isTileClipped()||!g||!g.length)return;this.currentStencilSource=f.source;const z=this.context,j=z.gl;this.nextStencilID+g.length>256&&this.clearStencil(),z.setColorMode(Go.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),Go.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 f=this.nextStencilID++,g=this.context.gl;return new Za({func:g.NOTEQUAL,mask:255},f,255,g.KEEP,g.KEEP,g.REPLACE)}stencilModeForClipping(f){const g=this.context.gl;return new Za({func:g.EQUAL,mask:255},this._tileClippingMaskIDs[f.key],0,g.KEEP,g.KEEP,g.REPLACE)}stencilConfigForOverlap(f){const g=this.context.gl,z=f.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 f=this.context.gl;return this._showOverdrawInspector?new Go([f.CONSTANT_COLOR,f.ONE],new i.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Go.unblended:Go.alphaBlended}depthModeForSublayer(f,g,z){if(!this.opaquePassEnabledForLayer())return Qi.disabled;const j=1-((1+this.currentLayer)*this.numSublayers+f)*this.depthEpsilon;return new Qi(z||this.context.gl.LEQUAL,g,[j,j])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(f,g){var z;this.style=f,this.options=g,this.lineAtlas=f.lineAtlas,this.imageManager=f.imageManager,this.glyphManager=f.glyphManager,this.symbolFadeChange=f.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-(f._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&&Rh(this),this.context.setDefault()}maybeDrawDepthAndCoords(f){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=f?!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=Go.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=Go.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(f,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(f,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:qn($,$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)}})(f,g,z,j);break;case"heatmap":Ju(f,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}})(f,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);dh($,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);dh($,ie,de,xe,ft,je,!0)}})(f,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))Xc($,ie,de,xe,Re,Za.disabled,Go.disabled),Xc($,ie,de,xe,Re,$.stencilModeFor3D(),$.colorModeForRenderPass());else{const je=$.colorModeForRenderPass();Xc($,ie,de,xe,Re,Za.disabled,je)}}})(f,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"&&Kc($,ft,yt,de,Re,tt[ft.overscaledZ],je)}Ae.viewport.set([0,0,$.width,$.height])})(f,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)}})(f,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)}})(f,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)}})(f,0,z)}}translatePosMatrix(f,g,z,j,$){if(!z[0]&&!z[1])return f;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,f,de),xe}saveTileTexture(f){const g=this._tileTextures[f.size[0]];g?g.push(f):this._tileTextures[f.size[0]]=[f]}getTileTexture(f){const g=this._tileTextures[f];return g&&g.length>0?g.pop():null}isPatternMissing(f){if(!f)return!1;if(!f.from||!f.to)return!0;const g=this.imageManager.getPattern(f.from.toString()),z=this.imageManager.getPattern(f.to.toString());return!g||!z}useProgram(f,g){this.cache=this.cache||{};const z=f+(g?g.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[z]||(this.cache[z]=new or(this.context,Ir[f],g,Qr[f],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 f=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(f.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;const f=this.context.gl;this.debugOverlayTexture=new D(this.context,this.debugOverlayCanvas,f.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:f,drawingBufferHeight:g}=this.context.gl;return this.width!==f||this.height!==g}}class mu{constructor(f,g){this.points=f,this.planes=g}static fromInvProjectionMatrix(f,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,f))[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(f,g){this.min=f,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(f){const g=[f%2==0,f<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(f){return Math.max(Math.min(this.max[0],f[0]),this.min[0])-f[0]}distanceY(f){return Math.max(Math.min(this.max[1],f[1]),this.min[1])-f[1]}intersects(f){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<f.planes.length;j++){const $=f.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<f.points.length;de++){const xe=f.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(f=0,g=0,z=0,j=0){if(isNaN(f)||f<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=f,this.bottom=g,this.left=z,this.right=j}interpolate(f,g,z){return g.top!=null&&f.top!=null&&(this.top=i.z.number(f.top,g.top,z)),g.bottom!=null&&f.bottom!=null&&(this.bottom=i.z.number(f.bottom,g.bottom,z)),g.left!=null&&f.left!=null&&(this.left=i.z.number(f.left,g.left,z)),g.right!=null&&f.right!=null&&(this.right=i.z.number(f.right,g.right,z)),this}getCenter(f,g){const z=i.ad((this.left+f-this.right)/2,0,f),j=i.ad((this.top+g-this.bottom)/2,0,g);return new i.P(z,j)}equals(f){return this.top===f.top&&this.bottom===f.bottom&&this.left===f.left&&this.right===f.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 Qc=85.051129;class Ia{constructor(f,g,z,j,$){this.tileSize=512,this._renderWorldCopies=$===void 0||!!$,this._minZoom=f||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 f=new Ia(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return f.apply(this),f}apply(f){this.tileSize=f.tileSize,this.latRange=f.latRange,this.width=f.width,this.height=f.height,this._center=f._center,this._elevation=f._elevation,this.minElevationForCurrentTile=f.minElevationForCurrentTile,this.zoom=f.zoom,this.angle=f.angle,this._fov=f._fov,this._pitch=f._pitch,this._unmodified=f._unmodified,this._edgeInsets=f._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(f){this._minZoom!==f&&(this._minZoom=f,this.zoom=Math.max(this.zoom,f))}get maxZoom(){return this._maxZoom}set maxZoom(f){this._maxZoom!==f&&(this._maxZoom=f,this.zoom=Math.min(this.zoom,f))}get minPitch(){return this._minPitch}set minPitch(f){this._minPitch!==f&&(this._minPitch=f,this.pitch=Math.max(this.pitch,f))}get maxPitch(){return this._maxPitch}set maxPitch(f){this._maxPitch!==f&&(this._maxPitch=f,this.pitch=Math.min(this.pitch,f))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(f){f===void 0?f=!0:f===null&&(f=!1),this._renderWorldCopies=f}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(f){const g=-i.b3(f,-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(f){const g=i.ad(f,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(f){f=Math.max(.01,Math.min(60,f)),this._fov!==f&&(this._unmodified=!1,this._fov=f/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(f){const g=Math.min(Math.max(f,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(f){f.lat===this._center.lat&&f.lng===this._center.lng||(this._unmodified=!1,this._center=f,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(f){f!==this._elevation&&(this._elevation=f,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(f){this._edgeInsets.equals(f)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,f,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(f){return this._edgeInsets.equals(f)}interpolatePadding(f,g,z){this._unmodified=!1,this._edgeInsets.interpolate(f,g,z),this._constrain(),this._calcMatrices()}coveringZoomLevel(f){const g=(f.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/f.tileSize));return Math.max(0,g)}getVisibleUnwrappedCoordinates(f){const g=[new i.b4(0,f)];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,f))}return g}coveringTiles(f){var g,z;let j=this.coveringZoomLevel(f);const $=j;if(f.minzoom!==void 0&&j<f.minzoom)return[];f.maxzoom!==void 0&&j>f.maxzoom&&(j=f.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=f.minzoom||0;!f.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(tt=j);const lt=f.terrain?2/Math.min(this.tileSize,f.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=f.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=f.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(f.terrain){const Pr=new i.S(Ar,At.wrap,Ar,Tr,rr),br=f.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(f,g){this.width=f,this.height=g,this.pixelsToGLUnits=[2/f,-2/g],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(f){return Math.pow(2,f)}scaleZoom(f){return Math.log(f)/Math.LN2}project(f){const g=i.ad(f.lat,-85.051129,Qc);return new i.P(i.O(f.lng)*this.worldSize,i.Q(g)*this.worldSize)}unproject(f){return new i.Z(f.x/this.worldSize,f.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(f){const g=this.elevation,z=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,j=this.pointLocation(this.centerPoint,f),$=f.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(f,g){const z=this.pointCoordinate(g),j=this.pointCoordinate(this.centerPoint),$=this.locationCoordinate(f),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(f,g){return g?this.coordinatePoint(this.locationCoordinate(f),g.getElevationForLngLatZoom(f,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(f))}pointLocation(f,g){return this.coordinateLocation(this.pointCoordinate(f,g))}locationCoordinate(f){return i.Z.fromLngLat(f)}coordinateLocation(f){return f&&f.toLngLat()}pointCoordinate(f,g){if(g){const ft=g.pointCoordinate(f);if(ft!=null)return ft}const z=[f.x,f.y,0,1],j=[f.x,f.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(f,g=0,z=this.pixelMatrix){const j=[f.x*this.worldSize,f.y*this.worldSize,g,1];return i.ag(j,j,z),new i.P(j[0]/j[3],j[1]/j[3])}getBounds(){const f=Math.max(0,this.height/2-this.getHorizon());return new Se().extend(this.pointLocation(new i.P(0,f))).extend(this.pointLocation(new i.P(this.width,f))).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(f){f?(this.lngRange=[f.getWest(),f.getEast()],this.latRange=[f.getSouth(),f.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Qc])}calculateTileMatrix(f){const g=f.canonical,z=this.worldSize/this.zoomScale(g.z),j=g.x+Math.pow(2,g.z)*f.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(f,g=!1){const z=f.key,j=g?this._alignedPosMatrixCache:this._posMatrixCache;if(j[z])return j[z];const $=this.calculateTileMatrix(f);return i.L($,g?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,$),j[z]=new Float32Array($),j[z]}calculateFogMatrix(f){const g=f.key,z=this._fogMatrixCache;if(z[g])return z[g];const j=this.calculateTileMatrix(f);return i.L(j,this.fogMatrix,j),z[g]=new Float32Array(j),z[g]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(f,g){g=i.ad(+g,this.minZoom,this.maxZoom);const z={center:new i.N(f.lng,f.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:$},f);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 f=this._unmodified,{center:g,zoom:z}=this.getConstrained(this.center,this.zoom);this.center=g,this.zoom=z,this._unmodified=f,this._constraining=!1}_calcMatrices(){if(!this.height)return;const f=this._fov/2,g=this.centerOffset,z=this.point.x,j=this.point.y;this.cameraToCenterDistance=.5/Math.tan(f)*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 f=this.pointCoordinate(new i.P(0,0)),g=[f.x*this.worldSize,f.y*this.worldSize,0,1];return i.ag(g,g,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const f=this._pitch,g=Math.tan(f)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,g))}getCameraQueryGeometry(f){const g=this.getCameraPoint();if(f.length===1)return[f[0],g];{let z=g.x,j=g.y,$=g.x,ie=g.y;for(const de of f)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(f,g){const z=this.locationCoordinate(f),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,f){let g,z=!1,j=null,$=null;const ie=()=>{j=null,z&&(V.apply($,g),j=setTimeout(ie,f),z=!1)};return(...de)=>(z=!0,$=this,g=de,j||ie(),j)}class qo{constructor(f){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=f&&encodeURIComponent(f)}addTo(f){return this._map=f,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(f){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+=f?`/${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),eh=i.e({deceleration:1e3,maxSpeed:90},nl);class zc{constructor(f){this._map=f,this.clear()}clear(){this._inertiaBuffer=[]}record(f){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:v.now(),settings:f})}_drainInertiaBuffer(){const f=this._inertiaBuffer,g=v.now();for(;f.length>0&&g-f[0].time>160;)f.shift()}_onMoveEnd(f){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,f||{}));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,eh);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,f){(!V.duration||V.duration<f.duration)&&(V.duration=f.duration,V.easing=f.easing)}function vc(V,f,g){const{maxSpeed:z,linearity:j,deceleration:$}=g,ie=i.ad(V*j/(f/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(f,g,z,j={}){const $=o.mousePos(g.getCanvas(),z),ie=g.unproject($);super(f,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(f,g,z){const j=f==="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(f,{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(f,g,z){super(f,{originalEvent:z}),this._defaultPrevented=!1}}class Fc{constructor(f,g){this._map=f,this._clickTolerance=g.clickTolerance}reset(){delete this._mousedownPos}wheel(f){return this._firePreventable(new Mu(f.type,this._map,f))}mousedown(f,g){return this._mousedownPos=g,this._firePreventable(new Ds(f.type,this._map,f))}mouseup(f){this._map.fire(new Ds(f.type,this._map,f))}click(f,g){this._mousedownPos&&this._mousedownPos.dist(g)>=this._clickTolerance||this._map.fire(new Ds(f.type,this._map,f))}dblclick(f){return this._firePreventable(new Ds(f.type,this._map,f))}mouseover(f){this._map.fire(new Ds(f.type,this._map,f))}mouseout(f){this._map.fire(new Ds(f.type,this._map,f))}touchstart(f){return this._firePreventable(new ys(f.type,this._map,f))}touchmove(f){this._map.fire(new ys(f.type,this._map,f))}touchend(f){this._map.fire(new ys(f.type,this._map,f))}touchcancel(f){this._map.fire(new ys(f.type,this._map,f))}_firePreventable(f){if(this._map.fire(f),f.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(f){this._map=f}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(f){this._map.fire(new Ds(f.type,this._map,f))}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(f){this._delayContextMenu?this._contextMenuEvent=f:this._ignoreContextMenu||this._map.fire(new Ds(f.type,this._map,f)),this._map.listens("contextmenu")&&f.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class io{constructor(f){this._map=f}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(f){return this.transform.pointLocation(i.P.convert(f),this._map.terrain)}}class bs{constructor(f,g){this._map=f,this._tr=new io(f),this._el=f.getCanvasContainer(),this._container=f.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(f,g){this.isEnabled()&&f.shiftKey&&f.button===0&&(o.disableDrag(),this._startPos=this._lastPos=g,this._active=!0)}mousemoveWindow(f,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",f));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(f,g){if(!this._active||f.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:f})),{cameraAnimation:$=>$.fitScreenCoordinates(z,j,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",f)}keydown(f){this._active&&f.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",f))}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(f,g){return this._map.fire(new i.k(f,{originalEvent:g}))}}function Ba(V,f){if(V.length!==f.length)throw new Error(`The number of touches and points are not equal - touches ${V.length}, points ${f.length}`);const g={};for(let z=0;z<V.length;z++)g[V[z].identifier]=f[z];return g}class $o{constructor(f){this.reset(),this.numTouches=f.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(f,g,z){(this.centroid||z.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=f.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(f,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(f,g,z){if((!this.centroid||f.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(f){this.singleTap=new $o(f),this.numTaps=f.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(f,g,z){this.singleTap.touchstart(f,g,z)}touchmove(f,g,z){this.singleTap.touchmove(f,g,z)}touchend(f,g,z){const j=this.singleTap.touchend(f,g,z);if(j){const $=f.timeStamp-this.lastTime<500,ie=!this.lastTap||this.lastTap.dist(j)<30;if($&&ie||this.reset(),this.count++,this.lastTime=f.timeStamp,this.lastTap=j,this.count===this.numTaps)return this.reset(),j}}}class is{constructor(f){this._tr=new io(f),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(f,g,z){this._zoomIn.touchstart(f,g,z),this._zoomOut.touchstart(f,g,z)}touchmove(f,g,z){this._zoomIn.touchmove(f,g,z),this._zoomOut.touchmove(f,g,z)}touchend(f,g,z){const j=this._zoomIn.touchend(f,g,z),$=this._zoomOut.touchend(f,g,z),ie=this._tr;return j?(this._active=!0,f.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom+1,around:ie.unproject(j)},{originalEvent:f})}):$?(this._active=!0,f.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:de=>de.easeTo({duration:300,zoom:ie.zoom-1,around:ie.unproject($)},{originalEvent:f})}):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(f){this._enabled=!!f.enable,this._moveStateManager=f.moveStateManager,this._clickTolerance=f.clickTolerance||1,this._moveFunction=f.move,this._activateOnStart=!!f.activateOnStart,f.assignEvents(this),this.reset()}reset(f){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(f)}_move(...f){const g=this._moveFunction(...f);if(g.bearingDelta||g.pitchDelta||g.around||g.panDelta)return this._active=!0,g}dragStart(f,g){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(f)&&(this._moveStateManager.startMove(f),this._lastPoint=g.length?g[0]:g,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(f,g){if(!this.isEnabled())return;const z=this._lastPoint;if(!z)return;if(f.preventDefault(),!this._moveStateManager.isValidMoveEvent(f))return void this.reset(f);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(f){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(f)&&(this._moved&&o.suppressClick(),this.reset(f))}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(f){this._correctEvent=f.checkCorrectEvent}startMove(f){const g=o.mouseButton(f);this._eventButton=g}endMove(f){delete this._eventButton}isValidStartEvent(f){return this._correctEvent(f)}isValidMoveEvent(f){return!function(g,z){const j=Eu[z];return g.buttons===void 0||(g.buttons&j)!==j}(f,this._eventButton)}isValidEndEvent(f){return o.mouseButton(f)===this._eventButton}}class nc{constructor(){this._firstTouch=void 0}_isOneFingerTouch(f){return f.targetTouches.length===1}_isSameTouchEvent(f){return f.targetTouches[0].identifier===this._firstTouch}startMove(f){const g=f.targetTouches[0].identifier;this._firstTouch=g}endMove(f){delete this._firstTouch}isValidStartEvent(f){return this._isOneFingerTouch(f)}isValidMoveEvent(f){return this._isOneFingerTouch(f)&&this._isSameTouchEvent(f)}isValidEndEvent(f){return this._isOneFingerTouch(f)&&this._isSameTouchEvent(f)}}const Rs=V=>{V.mousedown=V.dragStart,V.mousemoveWindow=V.dragMove,V.mouseup=V.dragEnd,V.contextmenu=f=>{f.preventDefault()}},yc=({enable:V,clickTolerance:f,bearingDegreesPerPixelMoved:g=.8})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:f,move:(j,$)=>({bearingDelta:($.x-j.x)*g}),moveStateManager:z,enable:V,assignEvents:Rs})},Iu=({enable:V,clickTolerance:f,pitchDegreesPerPixelMoved:g=-.5})=>{const z=new ml({checkCorrectEvent:j=>o.mouseButton(j)===0&&j.ctrlKey||o.mouseButton(j)===2});return new xs({clickTolerance:f,move:(j,$)=>({pitchDelta:($.y-j.y)*g}),moveStateManager:z,enable:V,assignEvents:Rs})};class Gl{constructor(f,g){this._clickTolerance=f.clickTolerance||1,this._map=g,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new i.P(0,0)}_shouldBePrevented(f){return f<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(f,g,z){return this._calculateTransform(f,g,z)}touchmove(f,g,z){if(this._active){if(!this._shouldBePrevented(z.length))return f.preventDefault(),this._calculateTransform(f,g,z);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",f)}}touchend(f,g,z){this._calculateTransform(f,g,z),this._active&&this._shouldBePrevented(z.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(f,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(f,g,z){this._firstTwoTouches||z.length<2||(this._firstTwoTouches=[z[0].identifier,z[1].identifier],this._start([g[0],g[1]]))}touchmove(f,g,z){if(!this._firstTwoTouches)return;f.preventDefault();const[j,$]=this._firstTwoTouches,ie=Ha(z,g,j),de=Ha(z,g,$);if(!ie||!de)return;const xe=this._aroundCenter?null:ie.add(de).div(2);return this._move([ie,de],xe,f)}touchend(f,g,z){if(!this._firstTwoTouches)return;const[j,$]=this._firstTwoTouches,ie=Ha(z,g,j),de=Ha(z,g,$);ie&&de||(this._active&&o.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(f){this._enabled=!0,this._aroundCenter=!!f&&f.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Ha(V,f,g){for(let z=0;z<V.length;z++)if(V[z].identifier===g)return f[z]}function ql(V,f){return Math.log(V/f)/Math.LN2}class ki extends as{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(f){this._startDistance=this._distance=f[0].dist(f[1])}_move(f,g){const z=this._distance;if(this._distance=f[0].dist(f[1]),this._active||!(Math.abs(ql(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ql(this._distance,z),pinchAround:g}}}function th(V,f){return 180*V.angleWith(f)/Math.PI}class Oh extends as{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(f){this._startVector=this._vector=f[0].sub(f[1]),this._minDiameter=f[0].dist(f[1])}_move(f,g,z){const j=this._vector;if(this._vector=f[0].sub(f[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:th(this._vector,j),pinchAround:g}}_isBelowThreshold(f){this._minDiameter=Math.min(this._minDiameter,f.mag());const g=25/(Math.PI*this._minDiameter)*360,z=th(f,this._startVector);return Math.abs(z)<g}}function Lu(V){return Math.abs(V.y)>Math.abs(V.x)}class rc extends as{constructor(f){super(),this._currentTouchCount=0,this._map=f}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(f,g,z){super.touchstart(f,g,z),this._currentTouchCount=z.length}_start(f){this._lastPoints=f,Lu(f[0].sub(f[1]))&&(this._valid=!1)}_move(f,g,z){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const j=f[0].sub(this._lastPoints[0]),$=f[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(j,$,z.timeStamp),this._valid?(this._lastPoints=f,this._active=!0,{pitchDelta:(j.y+$.y)/2*-.5}):void 0}gestureBeginsVertically(f,g,z){if(this._valid!==void 0)return this._valid;const j=f.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=f.y>0==g.y>0;return Lu(f)&&Lu(g)&&ie}}const ic={panStep:100,bearingStep:15,pitchStep:10};class Bc{constructor(f){this._tr=new io(f);const g=ic;this._panStep=g.panStep,this._bearingStep=g.bearingStep,this._pitchStep=g.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(f){if(f.altKey||f.ctrlKey||f.metaKey)return;let g=0,z=0,j=0,$=0,ie=0;switch(f.keyCode){case 61:case 107:case 171:case 187:g=1;break;case 189:case 109:case 173:g=-1;break;case 37:f.shiftKey?z=-1:(f.preventDefault(),$=-1);break;case 39:f.shiftKey?z=1:(f.preventDefault(),$=1);break;case 38:f.shiftKey?j=1:(f.preventDefault(),ie=-1);break;case 40:f.shiftKey?j=-1:(f.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*(f.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:f})}}}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(f,g){this._onTimeout=z=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(z)},this._map=f,this._tr=new io(f),this._triggerRenderFrame=g,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(f){this._defaultZoomRate=f}setWheelZoomRate(f){this._wheelZoomRate=f}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(f){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!f&&f.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(f){return!!this._map.cooperativeGestures.isEnabled()&&!(f.ctrlKey||this._map.cooperativeGestures.isBypassed(f))}wheel(f){if(!this.isEnabled())return;if(this._shouldBePrevented(f))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",f);let g=f.deltaMode===WheelEvent.DOM_DELTA_LINE?40*f.deltaY:f.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,f)):this._type||(this._type=Math.abs(j*g)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,g+=this._lastValue)),f.shiftKey&&g&&(g/=4),this._type&&(this._lastWheelEvent=f,this._delta-=g,this._active||this._start(f)),f.preventDefault()}_start(f){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(),f),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 f=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"?f.zoomScale(this._targetZoom):f.scale;this._targetZoom=Math.min(f.maxZoom,Math.max(f.minZoom,f.scaleZoom(Re*Ae))),this._type==="wheel"&&(this._startZoom=f.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const g=typeof this._targetZoom=="number"?this._targetZoom:f.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:$-f.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(f){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:f,easing:g},g}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ao{constructor(f,g){this._clickZoom=f,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(f){this._tr=new io(f),this.reset()}reset(){this._active=!1}dblclick(f,g){return f.preventDefault(),{cameraAnimation:z=>{z.easeTo({duration:300,zoom:this._tr.zoom+(f.shiftKey?-1:1),around:this._tr.unproject(g)},{originalEvent:f})}}}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(f,g,z){if(!this._swipePoint)if(this._tapTime){const j=g[0],$=f.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(f,g,z)}touchmove(f,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,f.preventDefault(),this._active=!0,{zoomDelta:$/128}}}else this._tap.touchmove(f,g,z)}touchend(f,g,z){if(this._tapTime)this._swipePoint&&z.length===0&&this.reset();else{const j=this._tap.touchend(f,g,z);j&&(this._tapTime=f.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(f,g,z){this._el=f,this._mousePan=g,this._touchPan=z}enable(f){this._inertiaOptions=f||{},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(f,g,z){this._pitchWithRotate=f.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(f,g,z,j){this._el=f,this._touchZoom=g,this._touchRotate=z,this._tapDragZoom=j,this._rotationDisabled=!1,this._enabled=!0}enable(f){this._touchZoom.enable(f),this._rotationDisabled||this._touchRotate.enable(f),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(f,g){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=f,this._options=g,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const f=this._map.getCanvasContainer();f.classList.add("maplibregl-cooperative-gestures"),this._container=o.create("div","maplibregl-cooperative-gesture-screen",f);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(f){return f[this._bypassKey]}notifyGestureBlocked(f,g){this._enabled&&(this._map.fire(new i.k("cooperativegestureprevented",{gestureType:f,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(f,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=f,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zc(f),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[f,g,z]of this._listeners)o.removeEventListener(f,g,f===document?this.handleWindowEvent:this.handleEvent,z)}_addDefaultHandlers(f){const g=this._map,z=g.getCanvasContainer();this._add("mapEvent",new Fc(g,f));const j=g.boxZoom=new bs(g,f);this._add("boxZoom",j),f.interactive&&f.boxZoom&&j.enable();const $=g.cooperativeGestures=new Ml(g,f.cooperativeGestures);this._add("cooperativeGestures",$),f.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),f.interactive&&f.doubleClickZoom&&g.doubleClickZoom.enable();const xe=new Du;this._add("tapDragZoom",xe);const Ae=g.touchPitch=new rc(g);this._add("touchPitch",Ae),f.interactive&&f.touchPitch&&g.touchPitch.enable(f.touchPitch);const Re=yc(f),je=Iu(f);g.dragRotate=new js(f,Re,je),this._add("mouseRotate",Re,["mousePitch"]),this._add("mousePitch",je,["mouseRotate"]),f.interactive&&f.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})})(f),lt=new Gl(f,g);g.dragPan=new $l(z,tt,lt),this._add("mousePan",tt),this._add("touchPan",lt,["touchZoom","touchRotate"]),f.interactive&&f.dragPan&&g.dragPan.enable(f.dragPan);const ft=new Oh,yt=new ki;g.touchZoomRotate=new Ru(z,yt,ft,xe),this._add("touchRotate",ft,["touchPan","touchZoom"]),this._add("touchZoom",yt,["touchPan","touchRotate"]),f.interactive&&f.touchZoomRotate&&g.touchZoomRotate.enable(f.touchZoomRotate);const Ct=g.scrollZoom=new Pu(g,()=>this._triggerRenderFrame());this._add("scrollZoom",Ct,["mousePan"]),f.interactive&&f.scrollZoom&&g.scrollZoom.enable(f.scrollZoom);const kt=g.keyboard=new Bc(g);this._add("keyboard",kt),f.interactive&&f.keyboard&&g.keyboard.enable(),this._add("blockableMapEvent",new Vs(g))}_add(f,g,z){this._handlers.push({handlerName:f,handler:g,allowed:z}),this._handlersById[f]=g}stop(f){if(!this._updatingCamera){for(const{handler:g}of this._handlers)g.reset();this._inertia.clear(),this._fireEvents({},{},f),this._changes=[]}}isActive(){for(const{handler:f}of this._handlers)if(f.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(f,g,z){for(const j in f)if(j!==z&&(!g||g.indexOf(j)<0))return!0;return!1}_getMapTouches(f){const g=[];for(const z of f){const j=z.target;this._el.contains(j)&&g.push(z)}return g}mergeHandlerResult(f,g,z,j,$){if(!z)return;i.e(f,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 f={},g={},z={};for(const[j,$,ie]of this._changes)j.panDelta&&(f.panDelta=(f.panDelta||new i.P(0,0))._add(j.panDelta)),j.zoomDelta&&(f.zoomDelta=(f.zoomDelta||0)+j.zoomDelta),j.bearingDelta&&(f.bearingDelta=(f.bearingDelta||0)+j.bearingDelta),j.pitchDelta&&(f.pitchDelta=(f.pitchDelta||0)+j.pitchDelta),j.around!==void 0&&(f.around=j.around),j.pinchAround!==void 0&&(f.pinchAround=j.pinchAround),j.noInertia&&(f.noInertia=j.noInertia),i.e(g,$),i.e(z,ie);this._updateMapTransform(f,g,z),this._changes=[]}_updateMapTransform(f,g,z){const j=this._map,$=j._getTransformForUpdate(),ie=j.terrain;if(!(bi(f)||ie&&this._terrainMovement))return this._fireEvents(g,z,!0);let{panDelta:de,zoomDelta:xe,bearingDelta:Ae,pitchDelta:Re,around:je,pinchAround:tt}=f;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(),f.noInertia||this._inertia.record(f),this._fireEvents(g,z,!0)}_fireEvents(f,g,z){const j=il(this._eventsInProgress),$=il(f),ie={};for(const je in f){const{originalEvent:tt}=f[je];this._eventsInProgress[je]||(ie[`${je}start`]=tt),this._eventsInProgress[je]=f[je]}!j&&$&&this._fireEvent("movestart",$.originalEvent);for(const je in ie)this._fireEvent(je,ie[je]);$&&this._fireEvent("move",$.originalEvent);for(const je in f){const{originalEvent:tt}=f[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&<<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(f,g){this._map.fire(new i.k(f,g?{originalEvent:g}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(f=>{delete this._frameId,this.handleEvent(new Yl("renderFrame",{timeStamp:f})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Yo extends i.E{constructor(f,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=f,this._bearingSnap=g.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new i.N(this.transform.center.lng,this.transform.center.lat)}setCenter(f,g){return this.jumpTo({center:f},g)}panBy(f,g,z){return f=i.P.convert(f).mult(-1),this.panTo(this.transform.center,i.e({offset:f},g),z)}panTo(f,g,z){return this.easeTo(i.e({center:f},g),z)}getZoom(){return this.transform.zoom}setZoom(f,g){return this.jumpTo({zoom:f},g),this}zoomTo(f,g,z){return this.easeTo(i.e({zoom:f},g),z)}zoomIn(f,g){return this.zoomTo(this.getZoom()+1,f,g),this}zoomOut(f,g){return this.zoomTo(this.getZoom()-1,f,g),this}getBearing(){return this.transform.bearing}setBearing(f,g){return this.jumpTo({bearing:f},g),this}getPadding(){return this.transform.padding}setPadding(f,g){return this.jumpTo({padding:f},g),this}rotateTo(f,g,z){return this.easeTo(i.e({bearing:f},g),z)}resetNorth(f,g){return this.rotateTo(0,i.e({duration:1e3},f),g),this}resetNorthPitch(f,g){return this.easeTo(i.e({bearing:0,pitch:0,duration:1e3},f),g),this}snapToNorth(f,g){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(f,g):this}getPitch(){return this.transform.pitch}setPitch(f,g){return this.jumpTo({pitch:f},g),this}cameraForBounds(f,g){f=Se.convert(f);const z=g&&g.bearing||0;return this._cameraForBoxAndBearing(f.getNorthWest(),f.getSouthEast(),z,g)}_cameraForBoxAndBearing(f,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(f,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(f,g,z){return this._fitInternal(this.cameraForBounds(f,g),g,z)}fitScreenCoordinates(f,g,z,j,$){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(i.P.convert(f)),this.transform.pointLocation(i.P.convert(g)),z,j),j,$)}_fitInternal(f,g,z){return f?(delete(g=i.e(f,g)).padding,g.linear?this.easeTo(g,z):this.flyTo(g,z)):this}jumpTo(f,g){this.stop();const z=this._getTransformForUpdate();let j=!1,$=!1,ie=!1;return"zoom"in f&&z.zoom!==+f.zoom&&(j=!0,z.zoom=+f.zoom),f.center!==void 0&&(z.center=i.N.convert(f.center)),"bearing"in f&&z.bearing!==+f.bearing&&($=!0,z.bearing=+f.bearing),"pitch"in f&&z.pitch!==+f.pitch&&(ie=!0,z.pitch=+f.pitch),f.padding==null||z.isPaddingEqual(f.padding)||(z.padding=f.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(f,g,z,j=0){const $=i.Z.fromLngLat(f,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(f,g){var z;this._stop(!1,f.easeId),((f=i.e({offset:[0,0],duration:500,easing:i.b9},f)).animate===!1||!f.essential&&v.prefersReducedMotion)&&(f.duration=0);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in f?this._normalizeBearing(f.bearing,ie):ie,Re="pitch"in f?+f.pitch:de,je="padding"in f?f.padding:j.padding,tt=i.P.convert(f.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(f.center||ft),(z=f.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;f.around&&($t=i.N.convert(f.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=f.easeId,this._prepareEase(g,f.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&&!f.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&&f.freezeElevation&&this._finalizeElevation(),this._afterEase(g,pn)},f),this}_prepareEase(f,g,z={}){this._moving=!0,g||z.moving||this.fire(new i.k("movestart",f)),this._zooming&&!z.zooming&&this.fire(new i.k("zoomstart",f)),this._rotating&&!z.rotating&&this.fire(new i.k("rotatestart",f)),this._pitching&&!z.pitching&&this.fire(new i.k("pitchstart",f))}_prepareElevation(f){this._elevationCenter=f,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(f){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const g=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(f<1&&g!==this._elevationTarget){const z=this._elevationTarget-this._elevationStart,j=(g-(z*f+this._elevationStart))/(1-f);this._elevationStart+=f*(z-j),this._elevationTarget=g}this.transform.elevation=i.z.number(this._elevationStart,this._elevationTarget,f)}_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(f){const g=f.getCameraPosition(),z=this.terrain.getElevationForLngLatZoom(g.lngLat,f.zoom);if(g.altitude<z){const j=this.calculateCameraOptionsFromTo(g.lngLat,z,f.center,f.elevation);return{pitch:j.pitch,zoom:j.zoom}}return{}}_applyUpdatedTransform(f){const g=[];if(this.terrain&&g.push(j=>this._elevateCameraIfInsideTerrain(j)),this.transformCameraUpdate&&g.push(j=>this.transformCameraUpdate(j)),!g.length)return;const z=f.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(f){this.fire(new i.k("move",f)),this._zooming&&this.fire(new i.k("zoom",f)),this._rotating&&this.fire(new i.k("rotate",f)),this._pitching&&this.fire(new i.k("pitch",f))}_afterEase(f,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",f)),j&&this.fire(new i.k("rotateend",f)),$&&this.fire(new i.k("pitchend",f)),this.fire(new i.k("moveend",f))}flyTo(f,g){var z;if(!f.essential&&v.prefersReducedMotion){const ur=i.M(f,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ur,g)}this.stop(),f=i.e({offset:[0,0],speed:1.2,curve:1.42,easing:i.b9},f);const j=this._getTransformForUpdate(),$=j.zoom,ie=j.bearing,de=j.pitch,xe=j.padding,Ae="bearing"in f?this._normalizeBearing(f.bearing,ie):ie,Re="pitch"in f?+f.pitch:de,je="padding"in f?f.padding:j.padding,tt=i.P.convert(f.offset);let lt=j.centerPoint.add(tt);const ft=j.pointLocation(lt),{center:yt,zoom:Ct}=j.getConstrained(i.N.convert(f.center||ft),(z=f.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=f.curve;const Kt=Math.max(j.width,j.height),Yt=Kt/kt,pn=At.mag();if("minZoom"in f){const ur=i.ad(Math.min(f.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(f,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 f)f.duration=+f.duration;else{const ur="screenSpeed"in f?+f.screenSpeed/$t:+f.speed;f.duration=1e3*Ar/ur}return f.maxDuration&&f.duration>f.maxDuration&&(f.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&&!f.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&&f.freezeElevation&&this._finalizeElevation(),this._afterEase(g)},f),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(f,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 f||(z=this.handlers)===null||z===void 0||z.stop(!1),this}_ease(f,g,z){z.animate===!1||z.duration===0?(f(1),g()):(this._easeStart=v.now(),this._easeOptions=z,this._onEaseFrame=f,this._onEaseEnd=g,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(f,g){f=i.b3(f,-180,180);const z=Math.abs(f-g);return Math.abs(f-360-g)<z&&(f-=360),Math.abs(f+360-g)<z&&(f+=360),f}_normalizeCenter(f,g){if(!g.renderWorldCopies||g.lngRange)return;const z=f.lng-g.center.lng;f.lng+=z>180?-360:z<-180?360:0}queryTerrainElevation(f){return this.terrain?this.terrain.getElevationForLngLatZoom(i.N.convert(f),this.transform.tileZoom)-this.transform.elevation:null}}const Us={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class yl{constructor(f=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=f}getDefaultPosition(){return"bottom-right"}onAdd(f){return this._map=f,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(f,g){const z=this._map._getUIString(`AttributionControl.${g}`);f.title=z,f.setAttribute("aria-label",z)}_updateAttributions(){if(!this._map.style)return;let f=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?f=f.concat(this.options.customAttribution.map(j=>typeof j!="string"?"":j)):typeof this.options.customAttribution=="string"&&f.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&&f.indexOf(ie.attribution)<0&&f.push(ie.attribution)}}f=f.filter(j=>String(j).trim()),f.sort((j,$)=>j.length-$.length),f=f.filter((j,$)=>{for(let ie=$+1;ie<f.length;ie++)if(f[ie].indexOf(j)>=0)return!1;return!0});const z=f.join(" | ");z!==this._attribHTML&&(this._attribHTML=z,f.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(f={}){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=f}getDefaultPosition(){return"bottom-left"}onAdd(f){this._map=f,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 nh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(f){const g=++this._id;return this._queue.push({callback:f,id:g,cancelled:!1}),g}remove(f){const g=this._currentlyRunning,z=g?this._queue.concat(g):this._queue;for(const j of z)if(j.id===f)return void(j.cancelled=!0)}run(f=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(f),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(f){super(),this.sourceCache=f,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,f.usedForTerrain=!0,f.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(f,g){this.sourceCache.update(f,g),this._renderableTilesKeys=[];const z={};for(const j of f.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(f){for(const g in this._tiles){const z=this._tiles[g];(!f||z.tileID.equals(f)||z.tileID.isChildOf(f)||f.isChildOf(z.tileID))&&(z.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(f=>this.getTileByID(f))}getTileByID(f){return this._tiles[f]}getTerrainCoords(f){const g={};for(const z of this._renderableTilesKeys){const j=this._tiles[z].tileID;if(j.canonical.equals(f.canonical)){const $=f.clone();$.posMatrix=new Float64Array(16),i.aQ($.posMatrix,0,i.X,0,i.X,0,1),g[z]=$}else if(j.canonical.isChildOf(f.canonical)){const $=f.clone();$.posMatrix=new Float64Array(16);const ie=j.canonical.z-f.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(f.canonical.isChildOf(j.canonical)){const $=f.clone();$.posMatrix=new Float64Array(16);const ie=f.canonical.z-j.canonical.z,de=f.canonical.x-(f.canonical.x>>ie<<ie),xe=f.canonical.y-(f.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(f,g){const z=this.sourceCache._source;let j=f.overscaledZ-this.deltaZoom;if(j>z.maxzoom&&(j=z.maxzoom),j<z.minzoom)return null;this._sourceTileCache[f.key]||(this._sourceTileCache[f.key]=f.scaledTo(j).key);let $=this.sourceCache.getTileByID(this._sourceTileCache[f.key]);if((!$||!$.dem)&&g)for(;j>=z.minzoom&&(!$||!$.dem);)$=this.sourceCache.getTileByID(f.scaledTo(j--).key);return $}tilesAfterTime(f=Date.now()){return Object.values(this._tiles).filter(g=>g.timeAdded>=f)}}class xa{constructor(f,g,z){this.painter=f,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(f,g,z,j=i.X){var $;if(!(g>=0&&g<j&&z>=0&&z<j))return 0;const ie=this.getTerrainData(f),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(f,g){const{tileID:z,mercatorX:j,mercatorY:$}=this._getOverscaledTileIDFromLngLatZoom(f,g);return this.getElevation(z,j%i.X,$%i.X,i.X)}getElevation(f,g,z,j=i.X){return this.getDEMElevation(f,g,z,j)*this.exaggeration}getTerrainData(f){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(f,!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+f.key;if(z&&!this._demMatrixCache[z]){const j=this.sourceCache.sourceCache._source.maxzoom;let $=f.canonical.z-g.tileID.canonical.z;f.overscaledZ>f.canonical.z&&(f.canonical.z>=j?$=f.canonical.z-j:i.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const ie=f.canonical.x-(f.canonical.x>>$<<$),de=f.canonical.y-(f.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[f.key]={matrix:xe,coord:f}}return{u_depth:2,u_terrain:3,u_terrain_dim:g&&g.dem&&g.dem.dim||1,u_terrain_matrix:z?this._demMatrixCache[f.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(f){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(f==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const f=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(f,z,f.gl.RGBA,{premultiply:!1});return j.bind(f.gl.NEAREST,f.gl.CLAMP_TO_EDGE),this._coordsTexture=j,j}pointCoordinate(f){this.painter.maybeDrawDepthAndCoords(!0);const g=new Uint8Array(4),z=this.painter.context,j=z.gl,$=Math.round(f.x*this.painter.pixelRatio/devicePixelRatio),ie=Math.round(f.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(f){const g=new Uint8Array(4),z=this.painter.context,j=z.gl;return z.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),j.readPixels(f.x,this.painter.height/devicePixelRatio-f.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 f=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(f.createVertexBuffer(g,mi.members),f.createIndexBuffer(z),i.a0.simpleSegment(0,0,g.length,z.length)),this._mesh}getMeshFrameDelta(f){return 2*Math.PI*i.bd/Math.pow(2,f)/5}getMinTileElevationForLngLatZoom(f,g){var z;const{tileID:j}=this._getOverscaledTileIDFromLngLatZoom(f,g);return(z=this.getMinMaxElevation(j).minElevation)!==null&&z!==void 0?z:0}getMinMaxElevation(f){const g=this.getTerrainData(f).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(f,g){const z=i.Z.fromLngLat(f.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(f,g,z){this._context=f,this._size=g,this._tileSize=z,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const f of this._objects)f.texture.destroy(),f.fbo.destroy()}_createObject(f){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:f,fbo:g,texture:z,stamp:-1,inUse:!1}}getObjectForId(f){return this._objects[f]}useObject(f){f.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(g=>f.id!==g),this._recentlyUsed.push(f.id)}stampObject(f){f.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 f=this._createObject(this._objects.length);return this._objects.push(f),f}freeObject(f){f.inUse=!1}freeAllObjects(){for(const f of this._objects)this.freeObject(f)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(f=>!f.inUse)===!1}}const El={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class vu{constructor(f,g){this.painter=f,this.terrain=g,this.pool=new ac(f.context,30,g.sourceCache.tileSize*g.qualityFactor)}destruct(){this.pool.destruct()}getTexture(f){return this.pool.getObjectForId(f.rtt[this._stacks.length-1].id).texture}prepareForRender(f,g){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=f._order.filter(z=>!f._layers[z].isHidden(g)),this._coordsDescendingInv={};for(const z in f.sourceCaches){this._coordsDescendingInv[z]={};const j=f.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 f._order){const j=f._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(f){if(f.isHidden(this.painter.transform.zoom))return!1;const g=f.type,z=this.painter,j=this._renderableLayerIds[this._renderableLayerIds.length-1]===f.id;if(El[g]&&(this._prevType&&El[this._prevType]||this._stacks.push([]),this._prevType=g,this._stacks[this._stacks.length-1].push(f.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 mh={"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"},rh=_,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(f,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=f.dragRotate._mouseRotate.getClickTolerance(),$=f.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=f,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(f,g){this.mouseRotate.dragStart(f,g),this.mousePitch&&this.mousePitch.dragStart(f,g),o.disableDrag()}startTouch(f,g){this.touchRotate.dragStart(f,g),this.touchPitch&&this.touchPitch.dragStart(f,g),o.disableDrag()}moveMouse(f,g){const z=this.map,{bearingDelta:j}=this.mouseRotate.dragMove(f,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.mousePitch){const{pitchDelta:$}=this.mousePitch.dragMove(f,g)||{};$&&z.setPitch(z.getPitch()+$)}}moveTouch(f,g){const z=this.map,{bearingDelta:j}=this.touchRotate.dragMove(f,g)||{};if(j&&z.setBearing(z.getBearing()+j),this.touchPitch){const{pitchDelta:$}=this.touchPitch.dragMove(f,g)||{};$&&z.setPitch(z.getPitch()+$)}}off(){const f=this.element;o.removeEventListener(f,"mousedown",this.mousedown),o.removeEventListener(f,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend),o.removeEventListener(f,"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,f,g){const z=new i.N(V.lng,V.lat);if(V=new i.N(V.lng,V.lat),f){const j=new i.N(V.lng-360,V.lat),$=new i.N(V.lng+360,V.lat),ie=g.locationPoint(V).distSqr(f);g.locationPoint(j).distSqr(f)<ie?V=j:g.locationPoint($).distSqr(f)<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,f,g){const z=V.classList;for(const j in Xl)z.remove(`maplibregl-${g}-anchor-${j}`);z.add(`maplibregl-${g}-anchor-${f}`)}class yo extends i.E{constructor(f){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=f&&f.anchor||"center",this._color=f&&f.color||"#3FB1CE",this._scale=f&&f.scale||1,this._draggable=f&&f.draggable||!1,this._clickTolerance=f&&f.clickTolerance||0,this._subpixelPositioning=f&&f.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=f&&f.rotation||0,this._rotationAlignment=f&&f.rotationAlignment||"auto",this._pitchAlignment=f&&f.pitchAlignment&&f.pitchAlignment!=="auto"?f.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(f==null?void 0:f.opacity,f==null?void 0:f.opacityWhenCovered),f&&f.element)this._element=f.element,this._offset=i.P.convert(f&&f.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(f&&f.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"),f&&f.className)for(const g of f.className.split(" "))this._element.classList.add(g);this._popup=null}addTo(f){return this.remove(),this._map=f,this._element.setAttribute("aria-label",f._getUIString("Marker.Title")),f.getCanvasContainer().appendChild(this._element),f.on("move",this._update),f.on("moveend",this._update),f.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(f){return this._lngLat=i.N.convert(f),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(f){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),f){if(!("offset"in f.options)){const j=Math.abs(13.5)/Math.SQRT2;f.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=f,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(f){return this._subpixelPositioning=f,this}getPopup(){return this._popup}togglePopup(){const f=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:f?(f.isOpen()?f.remove():(f.setLngLat(this._lngLat),f.addTo(this._map)),this):this}_updateOpacity(f=!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(f)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(f){return this._offset=i.P.convert(f),this._update(),this}addClassName(f){this._element.classList.add(f)}removeClassName(f){this._element.classList.remove(f)}toggleClassName(f){return this._element.classList.toggle(f)}setDraggable(f){return this._draggable=!!f,this._map&&(f?(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(f){return this._rotation=f||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(f){return this._rotationAlignment=f||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(f){return this._pitchAlignment=f&&f!=="auto"?f:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(f,g){return f===void 0&&g===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),f!==void 0&&(this._opacity=f),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(f){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 yo({element:this._dotElement}),this._circleElement=o.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new yo({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),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,f)}onAdd(f){return this._map=f,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(f){const g=this._map.getMaxBounds(),z=f.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 f=this._map.getBounds(),g=f.getSouthEast(),z=f.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 f;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),na++,na>1?(f={maximumAge:6e5,timeout:0},bc=!0):(f=this.options.positionOptions,bc=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,f)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}}const gi={maxWidth:100,unit:"metric"};function Ka(V,f,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(f,z,xe/5280,V._getUIString("ScaleControl.Miles")):ss(f,z,xe,V._getUIString("ScaleControl.Feet"))}else g&&g.unit==="nautical"?ss(f,z,de/1852,V._getUIString("ScaleControl.NauticalMiles")):de>=1e3?ss(f,z,de/1e3,V._getUIString("ScaleControl.Kilometers")):ss(f,z,de,V._getUIString("ScaleControl.Meters"))}function ss(V,f,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=f*$+"px",V.innerHTML=`${j} ${z}`}class sc extends i.E{constructor(f={}){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,f&&f.container&&(f.container instanceof HTMLElement?this._container=f.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(f){return this._map=f,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 f=this._fullscreenButton=o.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);o.create("span","maplibregl-ctrl-icon",f).setAttribute("aria-hidden","true"),f.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const f=this._getTitle();this._fullscreenButton.setAttribute("aria-label",f),this._fullscreenButton.title=f}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new 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(f){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),f)}addTo(f){return this._map&&this.remove(),this._map=f,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new i.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(f){return this._lngLat=i.N.convert(f),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(f){return this.setDOMContent(document.createTextNode(f))}setHTML(f){const g=document.createDocumentFragment(),z=document.createElement("body");let j;for(z.innerHTML=f;j=z.firstChild,j;)g.appendChild(j);return this.setDOMContent(g)}getMaxWidth(){var f;return(f=this._container)===null||f===void 0?void 0:f.style.maxWidth}setMaxWidth(f){return this.options.maxWidth=f,this._update(),this}setDOMContent(f){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=o.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(f),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(f){return this._container&&this._container.classList.add(f),this}removeClassName(f){return this._container&&this._container.classList.remove(f),this}setOffset(f){return this.options.offset=f,this._update(),this}toggleClassName(f){if(this._container)return this._container.classList.toggle(f)}setSubpixelPositioning(f){this.options.subpixelPositioning=f}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const f=this._container.querySelector(gt);f&&f.focus()}}function Pt(V){if(V){if(typeof V=="number"){const f=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(f,f),"top-right":new i.P(-f,f),bottom:new i.P(0,-V),"bottom-left":new i.P(f,-f),"bottom-right":new i.P(-f,-f),left:new i.P(V,0),right:new i.P(-V,0)}}if(V instanceof i.P||Array.isArray(V)){const f=i.P.convert(V);return{center:f,top:f,"top-left":f,"top-right":f,bottom:f,"bottom-left":f,"bottom-right":f,left:f,right:f}}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=qo,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 f=Object.assign(Object.assign({},Ou),V);if(f.minZoom!=null&&f.maxZoom!=null&&f.minZoom>f.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(f.minPitch!=null&&f.maxPitch!=null&&f.minPitch>f.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(f.minPitch!=null&&f.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(f.maxPitch!=null&&f.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ia(f.minZoom,f.maxZoom,f.minPitch,f.maxPitch,f.renderWorldCopies),{bearingSnap:f.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new nh,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=f.interactive,this._maxTileCacheSize=f.maxTileCacheSize,this._maxTileCacheZoomLevels=f.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=f.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=f.preserveDrawingBuffer===!0,this._antialias=f.antialias===!0,this._trackResize=f.trackResize===!0,this._bearingSnap=f.bearingSnap,this._refreshExpiredTiles=f.refreshExpiredTiles===!0,this._fadeDuration=f.fadeDuration,this._crossSourceCollisions=f.crossSourceCollisions===!0,this._collectResourceTiming=f.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},mh),f.locale),this._clickTolerance=f.clickTolerance,this._overridePixelRatio=f.pixelRatio,this._maxCanvasSize=f.maxCanvasSize,this.transformCameraUpdate=f.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=f.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=S.addThrottleControl(()=>this.isMoving()),this._requestManager=new C(f.transformRequest),typeof f.container=="string"){if(this._container=document.getElementById(f.container),!this._container)throw new Error(`Container '${f.container}' not found.`)}else{if(!(f.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=f.container}if(f.maxBounds&&this.setMaxBounds(f.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).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,f);const g=typeof f.hash=="string"&&f.hash||void 0;this._hash=f.hash&&new qo(g).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:f.center,zoom:f.zoom,bearing:f.bearing,pitch:f.pitch}),f.bounds&&(this.resize(),this.fitBounds(f.bounds,i.e({},f.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=f.localIdeographFontFamily,this._validateStyle=f.validateStyle,f.style&&this.setStyle(f.style,{localIdeographFontFamily:f.localIdeographFontFamily}),f.attributionControl&&this.addControl(new yl(typeof f.attributionControl=="boolean"?void 0:f.attributionControl)),f.maplibreLogo&&this.addControl(new os,f.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,f){if(f===void 0&&(f=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[f];return f.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 f=this._controls.indexOf(V);return f>-1&&this._controls.splice(f,1),V.onRemove(this),this}hasControl(V){return this._controls.indexOf(V)>-1}calculateCameraOptionsFromTo(V,f,g,z){return z==null&&this.terrain&&(z=this.terrain.getElevationForLngLatZoom(g,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(V,f,g,z)}resize(V){var f;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),(f=this._requestedCameraState)===null||f===void 0||f.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,f){const{0:g,1:z}=this._maxCanvasSize,j=this.getPixelRatio(),$=V*j,ie=f*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,f,g){if(V==="mouseenter"||V==="mouseover"){let z=!1;return{layer:f,listener:g,delegates:{mousemove:$=>{const ie=this.getLayer(f)?this.queryRenderedFeatures($.point,{layers:[f]}):[];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:f,listener:g,delegates:{mousemove:ie=>{(this.getLayer(f)?this.queryRenderedFeatures(ie.point,{layers:[f]}):[]).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(f)?this.queryRenderedFeatures(j.point,{layers:[f]}):[];$.length&&(j.features=$,g.call(this,j),delete j.features)};return{layer:f,listener:g,delegates:{[V]:z}}}}on(V,f,g){if(g===void 0)return super.on(V,f);const z=this._createDelegatedListener(V,f,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,f,g){if(g===void 0)return super.once(V,f);const z=this._createDelegatedListener(V,f,g);for(const j in z.delegates)this.once(j,z.delegates[j]);return this}off(V,f,g){return g===void 0?super.off(V,f):(this._delegatedListeners&&this._delegatedListeners[V]&&(z=>{const j=z[V];for(let $=0;$<j.length;$++){const ie=j[$];if(ie.layer===f&&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,f){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(f=f||(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,f,this.transform)}querySourceFeatures(V,f){return this.style.querySourceFeatures(V,f)}setStyle(V,f){return(f=i.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},f)).diff!==!1&&f.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&V?(this._diffStyle(V,f),this):(this._localIdeographFontFamily=f.localIdeographFontFamily,this._updateStyle(V,f))}setTransformRequest(V){return this._requestManager.setTransformRequest(V),this}_getUIString(V){const f=this._locale[V];if(f==null)throw new Error(`Missing UI string '${V}'`);return f}_updateStyle(V,f){if(f.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(V,f));const g=this.style&&f.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!V)),V?(this.style=new Jr(this,f||{}),this.style.setEventedParent(this,{style:this.style}),typeof V=="string"?this.style.loadURL(V,f,g):this.style.loadJSON(V,f,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,f){if(typeof V=="string"){const g=V,z=this._requestManager.transformRequest(g,"Style");i.h(z,new AbortController).then(j=>{this._updateDiff(j.data,f)}).catch(j=>{j&&this.fire(new i.j(j))})}else typeof V=="object"&&this._updateDiff(V,f)}_updateDiff(V,f){try{this.style.setState(V,f)&&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,f)}}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,f){return this._lazyInitEmptyStyle(),this.style.addSource(V,f),this._update(!0)}isSourceLoaded(V){const f=this.style&&this.style.sourceCaches[V];if(f!==void 0)return f.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 f=this.style.sourceCaches[V.source];if(!f)throw new Error(`cannot load terrain, because there exists no source with ID: ${V.source}`);this.terrain===null&&f.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,f,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,f;return(f=(V=this.terrain)===null||V===void 0?void 0:V.options)!==null&&f!==void 0?f:null}areTilesLoaded(){const V=this.style&&this.style.sourceCaches;for(const f in V){const g=V[f]._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,f,g={}){const{pixelRatio:z=1,sdf:j=!1,stretchX:$,stretchY:ie,content:de,textFitWidth:xe,textFitHeight:Ae}=g;if(this._lazyInitEmptyStyle(),!(f instanceof HTMLImageElement||i.b(f))){if(f.width===void 0||f.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}=f,lt=f;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&<.onAdd(this,V),this}}{const{width:Re,height:je,data:tt}=v.getImageData(f);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,f){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=f instanceof HTMLImageElement||i.b(f)?v.getImageData(f):f,{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=!(f instanceof HTMLImageElement||i.b(f));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,f){return this._lazyInitEmptyStyle(),this.style.addLayer(V,f),this._update(!0)}moveLayer(V,f){return this.style.moveLayer(V,f),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,f,g){return this.style.setLayerZoomRange(V,f,g),this._update(!0)}setFilter(V,f,g={}){return this.style.setFilter(V,f,g),this._update(!0)}getFilter(V){return this.style.getFilter(V)}setPaintProperty(V,f,g,z={}){return this.style.setPaintProperty(V,f,g,z),this._update(!0)}getPaintProperty(V,f){return this.style.getPaintProperty(V,f)}setLayoutProperty(V,f,g,z={}){return this.style.setLayoutProperty(V,f,g,z),this._update(!0)}getLayoutProperty(V,f){return this.style.getLayoutProperty(V,f)}setGlyphs(V,f={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(V,f),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(V,f,g={}){return this._lazyInitEmptyStyle(),this.style.addSprite(V,f,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,f={}){return this._lazyInitEmptyStyle(),this.style.setSprite(V,f,g=>{g||this._update(!0)}),this}setLight(V,f={}){return this._lazyInitEmptyStyle(),this.style.setLight(V,f),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,f){return this.style.setFeatureState(V,f),this._update()}removeFeatureState(V,f){return this.style.removeFeatureState(V,f),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,f=0;return this._container&&(V=this._container.clientWidth||400,f=this._container.clientHeight||300),[V,f]}_setupContainer(){const V=this._container;V.classList.add("maplibregl-map");const f=this._canvasContainer=o.create("div","maplibregl-canvas-container",V);this._interactive&&f.classList.add("maplibregl-interactive"),this._canvas=o.create("canvas","maplibregl-canvas",f),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,f,g){this._canvas.width=Math.floor(g*V),this._canvas.height=Math.floor(g*f),this._canvas.style.width=`${V}px`,this._canvas.style.height=`${f}px`}_setupPainter(){const V={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let f=null;this._canvas.addEventListener("webglcontextcreationerror",z=>{f={requestedAttributes:V},z&&(f.statusMessage=z.statusMessage,f.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 f?(f.message=z,new Error(JSON.stringify(f))):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 f=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:f,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,f,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new 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 f=this.painter.context.gl.getExtension("WEBGL_lose_context");f!=null&&f.loseContext&&f.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 rh}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Ds,u.MapTouchEvent=ys,u.MapWheelEvent=Mu,u.Marker=yo,u.NavigationControl=class{constructor(V){this._updateZoomButtons=()=>{const f=this._map.getZoom(),g=f===this._map.getMaxZoom(),z=f===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 f=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=f},this._setButtonTitle=(f,g)=>{const z=this._map._getUIString(`NavigationControl.${g}`);f.title=z,f.setAttribute("aria-label",z)},this.options=i.e({},Zl,V),this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",f=>f.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",f=>this._map.zoomIn({},{originalEvent:f})),o.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",f=>this._map.zoomOut({},{originalEvent:f})),o.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",f=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:f}):this._map.resetNorth({},{originalEvent:f})}),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,f){const g=o.create("button",V,this._container);return g.type="button",g.addEventListener("click",f),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=f=>{this.options.unit=f,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=Oh,u.TwoFingersTouchZoomHandler=ki,u.TwoFingersTouchZoomRotateHandler=Ru,u.VectorTileSource=Ie,u.VideoSource=ve,u.addSourceType=(V,f)=>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,f)}),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,f){return Xe().setRTLTextPlugin(V,f)},u.setWorkerCount=function(V){he.workerCount=V},u.setWorkerUrl=function(V){i.a.WORKER_URL=V}}),d}()},88640:function(m,d,n){function l(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(d,{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})$/,c=new RegExp("^rgb\\(".concat(w,",").concat(w,",").concat(w,"\\)$")),s=new RegExp("^rgb\\(".concat(o,",").concat(o,",").concat(o,"\\)$")),p=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=c.exec(be))?new T(_e[1],_e[2],_e[3],1):(_e=s.exec(be))?new T(255*_e[1]/100,255*_e[2]/100,255*_e[3]/100,1):(_e=p.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 q(be,_e,Se){return 255*(be<60?_e+(Se-_e)*be/60:be<180?Se:be<240?_e+(Se-_e)*(240-be)/60:_e)}l(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}),l(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})),l(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(q(be>=240?be-240:be+120,Ie,Ce),q(be,Ie,Ce),q(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(m){m.exports=JSON.parse('["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]')},2362:function(m){m.exports=JSON.parse('["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]')},87486:function(m){m.exports=JSON.parse('["normal","italic","oblique"]')},99803:function(m){m.exports=JSON.parse('["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]')},54324:function(m){m.exports=JSON.parse('["inherit","initial","unset"]')},94316:function(m){m.exports=JSON.parse('["caption","icon","menu","message-box","small-caption","status-bar"]')},37071:function(m){m.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 © <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(m){m.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 © <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"}}]}`)}},h={};function R(m){var d=h[m];if(d!==void 0)return d.exports;var n=h[m]={id:m,exports:{}};return r[m].call(n.exports,n,n.exports,R),n.exports}return R.m=r,R.n=function(m){var d=m&&m.__esModule?function(){return m.default}:function(){return m};return R.d(d,{a:d}),d},R.d=function(m,d){for(var n in d)R.o(d,n)&&!R.o(m,n)&&Object.defineProperty(m,n,{enumerable:!0,get:d[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(m,d){return Object.prototype.hasOwnProperty.call(m,d)},R.r=function(m){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(m,"__esModule",{value:!0})},R.b=document.baseURI||self.location.href,R.nc=void 0,R(20260)}()})})(f9);var PG=f9.exports;const Wp=c8(PG),DG={highlightColor:"#E4572E",selectedColor:"#F3A712",unhighlightedColor:"lightblue",highlightHiddenColor:"#1f77b4",annotationBackground:"#f8f8f8"},RG={xPosScalingFactor:80,xPosScalingThreshold:500,minAnnotationWidth:40},OG=Fv({name:"PlotlyLineplot",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Oy(),e=Ry();return{streamlitDataStore:t,selectionStore:e}},data(){return{isInitialized:!1,manualXRange:void 0,lastAutoZoomedPeakIndex:void 0}},computed:{id(){return`plot-${this.index}`},theme(){return this.streamlitDataStore.theme},styling(){return{...DG,...this.args.styling}},config(){return{...RG,...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",h=(e==null?void 0:e.yColumn)||this.args.yColumn||"y",R={x_values:t[r]||[],y_values:t[h]||[]},m=(e==null?void 0:e.highlightColumn)||this.args.highlightColumn;m&&t[m]&&(R.highlight_mask=t[m]);const d=(e==null?void 0:e.annotationColumn)||this.args.annotationColumn;if(d&&t[d]&&(R.annotations=t[d]),this.args.interactivity)for(const[l,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 h=`interactivity_${e}`,R=this.plotData[h];if(R&&Array.isArray(R)){for(let m=0;m<R.length;m++)if(R[m]===r)return m}else if(e===this.args.xColumn){const m=this.plotData.x_values;for(let d=0;d<m.length;d++)if(m[d]===r)return d}}},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),h=(r-e)*.02;return[e-h,r+h]},yRange(){if(!this.isDataReady||!this.plotData)return[0,1];const{x_values:t,y_values:e}=this.plotData,r=this.xRange;let h=0;for(let R=0;R<t.length;R++){const m=t[R],d=e[R];m>=r[0]&&m<=r[1]&&d>h&&(h=d)}return h===0?[0,1]:[0,h*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:h}=this.plotData;if(!r)return[];const R=[];for(let m=0;m<r.length;m++){const d=r[m];!d||d.length===0||h&&!h[m]||R.push({x:t[m],y:e[m],label:d,index:m})}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 h=e[1]/1.8,R=h*1.18,m=h*1.32,d=m-R,n=this.xPosScalingFactor,l=[];for(const i of t){const _=i.x>=r[0]&&i.x<=r[1];l.push({x:i.x,y:(R+m)/2,width:n*2,height:d,label:i.label,visible:_,inVisibleRange:_,index:i.index})}const u=l.filter(i=>i.inVisibleRange);if(u.length>1){let i=!1;const _=(r[1]-r[0])*.01;for(let b=0;b<u.length&&!i;b++)for(let w=b+1;w<u.length;w++){const v=u[b].x-u[b].width/2-_,o=u[b].x+u[b].width/2+_,a=u[w].x-u[w].width/2-_,c=u[w].x+u[w].width/2+_;if(!(o<a||c<v)){i=!0;break}}i&&l.forEach(b=>{b.inVisibleRange&&(b.visible=!1)})}return l},annotationShapes(){const t=this.annotationBoxData,e=[],r=this.yRange;if(r[1]<=0)return e;const h=r[1]/1.8,R=h*1.18,m=h*1.32,d=this.selectedPeakIndex;for(const n of t){if(!n.visible)continue;const u=n.index===d?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:m,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 m of t)m.visible&&e.push({x:m.x,y:R,xref:"x",yref:"y",text:m.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(h=>h.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,h=-1e7,R=[],m=[],d=[],n=[],l=[],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?(l.push(b,b,b),u.push(h,w,h)):v?(d.push(b,b,b),n.push(h,w,h)):(R.push(b,b,b),m.push(h,w,h))}return R.length>0&&t.push({x:R,y:m,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.unhighlightedColor},hoverinfo:"x+y"}),d.length>0&&t.push({x:d,y:n,mode:"lines",type:"scatter",connectgaps:!1,marker:{color:this.styling.highlightColor},hoverinfo:"x+y"}),l.length>0&&t.push({x:l,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,h,R;return{title:this.args.title?{text:`<b>${this.args.title}</b>`}:void 0,showlegend:!1,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:((h=this.theme)==null?void 0:h.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,h,R,m;console.log("[LinePlot] plotData changed",{newLength:(r=t==null?void 0:t.x_values)==null?void 0:r.length,oldLength:(h=e==null?void 0:e.x_values)==null?void 0:h.length,newFirstX:(R=t==null?void 0:t.x_values)==null?void 0:R[0],oldFirstX:(m=e==null?void 0:e.x_values)==null?void 0:m[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:{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 h=document.getElementById(this.id);h&&Wp.downloadImage(h,{filename:this.args.title||"plot",height:400,width:1200,format:"svg"})}}];await Wp.newPlot(this.id,this.traces,this.layout,{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:e,scrollZoom:!0,responsive:!0});const r=document.getElementById(this.id);r&&(r.on("plotly_click",h=>{this.onPlotClick(h)}),r.on("plotly_relayout",h=>{this.onRelayout(h)}))}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 h=1/0,R=1/0;for(const b of e){if(b.index===t)continue;const w=b.x-r.x;w<0&&-w<h?h=-w:w>0&&w<R&&(R=w)}const m=Math.min(h,R);this.actualPlotWidth,this.config.xPosScalingFactor;let d;if(m<1/0)d=m*2;else{const b=this.plotData.x_values;d=(Math.max(...b)-Math.min(...b))*.2}const n=this.plotData.x_values,l=Math.min(...n),u=Math.max(...n);let i=r.x-d/2,_=r.x+d/2;return i<l&&(i=l,_=Math.min(l+d,u)),_>u&&(_=u,i=Math.max(u-d,l)),[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 h=this.plotData.x_values;let R=0,m=1/0;for(let d=0;d<h.length;d++){const n=Math.abs(h[d]-r);n<m&&(m=n,R=d)}for(const[d,n]of Object.entries(this.interactivity)){const l=`interactivity_${n}`,u=this.plotData[l];u&&Array.isArray(u)&&R<u.length?this.selectionStore.updateSelection(d,u[R]):n===this.args.xColumn&&this.selectionStore.updateSelection(d,h[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,h;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:((h=this.theme)==null?void 0:h.font)||"Arial"}};await Wp.newPlot(this.id,this.getFallbackData(),R,{staticPlot:!0})}catch(R){console.error("PlotlyLineplot: Failed to render fallback:",R)}}}}),zG=["id"];function FG(t,e,r,h,R,m){return Ga(),wo("div",{id:t.id,class:"plot-container",style:ii(t.cssCustomProperties)},null,12,zG)}const h6=zy(OG,[["render",FG],["__scopeId","data-v-5cbbe0ca"]]),BG=Fv({name:"PlotlyHeatmap",props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Oy(),e=Ry();return{streamlitDataStore:t,selectionStore:e}},data(){return{isInitialized:!1,zoomRange:void 0,colorbarVisible:!0,userOverrideColorbar:!1,plotWidth:800,resizeObserver:null}},computed:{id(){return`heatmap-${this.index}`},theme(){return this.streamlitDataStore.theme},isNarrowPlot(){return this.plotWidth<600},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)},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(){const t=this.intensityValues.filter(d=>d>0);if(t.length===0)return{tickvals:[0],ticktext:["0"]};const e=Math.min(...t),r=Math.max(...t),h=Math.floor(Math.log10(e)),R=Math.ceil(Math.log10(r)),m=Array.from({length:R-h+1},(d,n)=>Math.pow(10,h+n));return{tickvals:m.map(d=>Math.log10(d)),ticktext:m.map(d=>d.toExponential(0))}},data(){if(!this.isDataReady)return this.getFallbackData();const{tickvals:t,ticktext:e}=this.colorbarTicks;return[{type:"scattergl",name:"points",x:this.xValues,y:this.yValues,mode:"markers",marker:{color:this.logIntensityValues,colorscale:this.args.colorscale||"Portland",showscale:this.effectiveColorbarVisible,colorbar:{title:{text:"Intensity"},tickvals:t,ticktext:e,tickmode:"array"}},hovertext:this.intensityValues.map(r=>r.toExponential(2)),hoverinfo:"x+y+text"}]},layout(){var t,e,r,h;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,range:this.xRange},yaxis:{title:this.args.yLabel?{text:this.args.yLabel}:void 0,range:this.yRange},paper_bgcolor:((t=this.theme)==null?void 0:t.backgroundColor)||"white",plot_bgcolor:((e=this.theme)==null?void 0:e.secondaryBackgroundColor)||"#f5f5f5",font:{color:((r=this.theme)==null?void 0:r.textColor)||"black",family:((h=this.theme)==null?void 0:h.font)||"Arial"},margin:{l:60,r:this.effectiveColorbarVisible?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.setupResizeObserver()})},beforeUnmount(){this.cleanupResizeObserver()},methods:{async renderPlot(){try{if(!document.getElementById(this.id)){console.warn(`PlotlyHeatmap: DOM element with id '${this.id}' not found`);return}await Wp.newPlot(this.id,this.data,this.layout,this.getPlotConfig()),this.setupPlotEventHandlers(),this.$nextTick(()=>{cf.setFrameHeight()})}catch(t){console.error("PlotlyHeatmap: Error rendering plot:",t),this.renderFallback()}},getPlotConfig(){return{modeBarButtonsToRemove:["toImage","sendDataToCloud"],modeBarButtonsToAdd:[{title:"Download as SVG",name:"toImageSvg",icon:Wp.Icons.camera,click:t=>{Wp.downloadImage(t,{filename:this.args.title||"heatmap",height:400,width:1200,format:"svg"})}},{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()}}],scrollZoom:!0,responsive:!0}},setupPlotEventHandlers(){const t=document.getElementById(this.id);t&&(t.on("plotly_relayout",e=>{e["xaxis.autorange"]?this.zoomRange={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&&(this.zoomRange={xRange:[e["xaxis.range[0]"],e["xaxis.range[1]"]],yRange:[e["yaxis.range[0]"],e["yaxis.range[1]"]]})}),t.on("plotly_click",e=>{if(!(!this.interactivity||Object.keys(this.interactivity).length===0)&&e.points&&e.points.length>0){const r=e.points[0].pointIndex,h=this.heatmapData[r];if(h)for(const[R,m]of Object.entries(this.interactivity)){const d=h[m];d!==void 0&&this.selectionStore.updateSelection(R,d)}}}))},async toggleColorbar(){this.colorbarVisible=!this.colorbarVisible,this.userOverrideColorbar=!0,await this.updatePlot()},async updatePlot(){const t=document.getElementById(this.id);if(t)try{await Wp.restyle(t,{"marker.showscale":this.effectiveColorbarVisible},[0]),await Wp.relayout(t,{margin:{r:this.effectiveColorbarVisible?120:20}})}catch{}},setupResizeObserver(){const t=document.getElementById(this.id);t&&window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(e=>{for(const r of e){const h=r.contentRect.width;if(Math.abs(h-this.plotWidth)>10){const R=this.isNarrowPlot;this.plotWidth=h;const m=this.isNarrowPlot;R!==m&&!this.userOverrideColorbar&&(this.colorbarVisible=!m,this.updatePlot())}}}),this.resizeObserver.observe(t))},cleanupResizeObserver(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},getFallbackData(){return[{type:"scattergl",x:[0],y:[0],mode:"markers",marker:{color:"grey"},name:"No Data"}]},async renderFallback(){var t,e,r,h;try{const R={title:{text:"<b>No Data Available</b>"},showlegend:!1,xaxis:{title:{text:"X"}},yaxis:{title:{text:"Y"}},paper_bgcolor:((t=this.theme)==null?void 0:t.backgroundColor)||"white",plot_bgcolor:((e=this.theme)==null?void 0:e.secondaryBackgroundColor)||"#f5f5f5",font:{color:((r=this.theme)==null?void 0:r.textColor)||"black",family:((h=this.theme)==null?void 0:h.font)||"Arial"}};await Wp.newPlot(this.id,this.getFallbackData(),R,{staticPlot:!0})}catch(R){console.error("PlotlyHeatmap: Failed to render fallback:",R)}}}}),NG=["id"];function VG(t,e,r,h,R,m){return Ga(),wo("div",{id:t.id,class:"heatmap-container"},null,8,NG)}const f6=zy(BG,[["render",VG],["__scopeId","data-v-bbe00399"]]),jG=Fv({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:Oy()}},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,h,R,m;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":((h=this.theme)==null?void 0:h.secondaryBackgroundColor)??"#f0f0f0","--amino-acid-cell-hover-color":((R=this.theme)==null?void 0:R.textColor)??"#000","--amino-acid-cell-hover-bg-color":((m=this.theme)==null?void 0:m.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)}}}),UG=["id"],HG={key:0,class:"frag-marker-container frag-marker-a"},WG={key:1,class:"frag-marker-container frag-marker-b"},GG={key:2,class:"frag-marker-container frag-marker-c"},qG={key:3,class:"frag-marker-container frag-marker-x"},$G={key:4,class:"frag-marker-container frag-marker-y"},YG={key:5,class:"frag-marker-container frag-marker-z"},ZG={key:6,class:"rounded-lg mod-marker mod-start"},XG={key:7,class:"rounded-lg mod-marker mod-end"},KG={key:8,class:"rounded-lg mod-mass"},JG={key:9,class:"rounded-lg mod-mass-a"},QG={key:10,class:"rounded-lg mod-mass-b"},eq={key:11,class:"rounded-lg mod-mass-c"},tq={key:12,class:"frag-marker-extra-type"},nq={class:"aa-text"},rq={key:0},iq={key:1},aq={key:2};function oq(t,e,r,h,R,m){const d=iu("v-tooltip");return Ga(),wo("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?(Ga(),wo("div",HG,[...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?(Ga(),wo("div",WG,[...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?(Ga(),wo("div",GG,[...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?(Ga(),wo("div",qG,[...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?(Ga(),wo("div",$G,[...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?(Ga(),wo("div",YG,[...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?(Ga(),wo("div",ZG)):wl("",!0),t.modification!==null?(Ga(),wo("div",XG)):wl("",!0),t.modification!==null?(Ga(),wo("div",KG,[Fs(Bs(t.modificationDisplay)+" ",1),Qt(d,{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?(Ga(),wo("div",JG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.bIon?(Ga(),wo("div",QG,Bs(t.modificationDisplay),1)):wl("",!0),t.showFragments&&t.modification!==null&&t.sequenceObject.cIon&&!t.sequenceObject.bIon?(Ga(),wo("div",eq,Bs(t.modificationDisplay),1)):wl("",!0),t.hasExtraFragTypes?(Ga(),wo("div",tq,[...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",nq,Bs(t.aminoAcid),1),Qt(d,{activator:"parent"},{default:ds(()=>[en("div",null,"Position: "+Bs(t.index+1),1),t.prefix!==void 0?(Ga(),wo("div",rq,"Prefix: "+Bs(t.prefix),1)):wl("",!0),t.suffix!==void 0?(Ga(),wo("div",iq,"Suffix: "+Bs(t.suffix),1)):wl("",!0),t.hasExtraFragTypes?(Ga(),wo("div",aq,Bs(t.sequenceObject.extraTypes.join(", ")),1)):wl("",!0)]),_:1})],14,UG)}const sq=zy(jG,[["render",oq],["__scopeId","data-v-3401e0d8"]]),lq={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}]},uq=1.007276,cq={0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function hq(t){return String(t).split("").map(e=>cq[e]||e).join("")}const fq=Fv({name:"SequenceView",components:{AminoAcidCell:sq},props:{args:{type:Object,required:!0},index:{type:Number,required:!0}},setup(){const t=Oy(),e=Ry();return{streamlitDataStore:t,selectionStore:e}},data(){return{rowWidth:35,fontSize:12,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:{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(){return this.args.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],h=this.sequenceObjects[e+1];(r.aIon||r.bIon||r.cIon||h.xIon||h.yIon||h.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(){var t,e;this.initializeSequenceObjects(),((t=this.sequenceData)==null?void 0:t.fragment_tolerance)!==void 0&&(this.fragmentMassTolerance=this.sequenceData.fragment_tolerance),((e=this.sequenceData)==null?void 0:e.fragment_tolerance_ppm)!==void 0&&(this.toleranceIsPpm=this.sequenceData.fragment_tolerance_ppm),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:[]})},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 h=this.sequence.length,m=["a","b","c"].includes(t)?e-1:h-e;if(m>=0&&m<this.sequenceObjects.length){const d=this.sequenceObjects[m],n=`${t}Ion`;d[n]=!0,r&&d.extraTypes.push(`${t}${r}`)}},matchFragmentsExternal(){const t=[];for(const e of this.externalAnnotations){let r=null,h=-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=_,h=i)}if(r===null)continue;const m=r-e.mz,d=m/e.mz*1e6;if(!this.isWithinTolerance(m,e.mz))continue;let n=0;const l=e.annotation.match(/[a-z](\d+)/i);l&&(n=parseInt(l[1],10));const u={Name:e.annotation,IonType:e.ion_type,IonNumber:n,TheoreticalMass:e.mz.toFixed(3),ObservedMass:r,MassDiffDa:m.toFixed(3),MassDiffPpm:d.toFixed(3)};e.charge>1&&(u.Charge=e.charge),this.peakIds&&h>=0&&this.peakIds[h]!==void 0&&(u.PeakId=this.peakIds[h]),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(lq).filter(([h])=>this.ionTypesExtra[h]||h==="default").map(([h,R])=>R).flat(),r=this.deconvolved?[1]:Array.from({length:this.maxCharge},(h,R)=>R+1);for(const h of this.ionTypes.filter(R=>R.selected)){const R=this.getFragmentMasses(h.text);for(let m=0;m<R.length;m++)for(const d of R[m])for(const{typeName:n,typeMass:l}of e){const u=d+l;for(const i of r){const _=this.deconvolved?u:(u+i*uq)/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=`${h.text}${m+1}`,s={Name:this.deconvolved?a:`${a}${hq(i)}⁺`,IonType:`${h.text}${n}`,IonNumber:m+1,TheoreticalMass:_.toFixed(3),ObservedMass:w,MassDiffDa:v.toFixed(3),MassDiffPpm:o.toFixed(3)};this.deconvolved||(s.Charge=i),this.peakIds&&this.peakIds[b]!==void 0&&(s.PeakId=this.peakIds[b]),t.push(s),this.markAminoAcidPosition(h.text,m+1,n)}}}}}return t},matchFragments(){if(this.sequence.length===0||this.observedMasses.length===0){this.fragmentTableData=[];return}this.useExternalAnnotations&&this.hasExternalAnnotations?this.fragmentTableData=this.matchFragmentsExternal():this.fragmentTableData=this.matchFragmentsTheoretical()},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 h=this.fragmentTableData.findIndex(R=>R.Name===r);h>=0&&(this.selectedFragmentRowIndex=h)}},onFragmentTableRowClick(t,{item:e}){const r=e.IonType.charAt(0),h=e.IonNumber,m=["a","b","c"].includes(r)?h-1:this.sequence.length-h;if(m>=0&&m<this.sequenceObjects.length&&(this.selectedAAIndex=m),e.PeakId!==void 0&&Object.keys(this.interactivity).length>0)for(const[d,n]of Object.entries(this.interactivity))this.selectionStore.updateSelection(d,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)}}}}),dq={class:"sequence-view-container"},pq={class:"d-flex justify-end px-4 mb-4"},mq={class:"d-flex justify-space-evenly"},gq={class:"d-flex justify-space-evenly"},vq={class:"d-flex align-center ga-2"},yq={key:0,class:"d-flex justify-center align-center row-number"},bq={key:1,class:"d-flex justify-center align-center terminal-cell"},xq={key:2,class:"d-flex justify-center align-center row-number"},_q={key:3,class:"d-flex justify-center align-center terminal-cell"},wq={key:0,class:"mt-4"},Tq={class:"d-flex justify-space-between align-center mb-2"},kq={class:"text-caption"};function Sq(t,e,r,h,R,m){var A;const d=iu("v-icon"),n=iu("v-tooltip"),l=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"),c=iu("v-card"),s=iu("v-menu"),p=iu("AminoAcidCell"),y=iu("v-divider"),x=iu("v-data-table"),S=iu("v-sheet"),C=iu("v-snackbar");return Ga(),wo("div",dq,[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",pq,[Qt(l,{variant:"text",icon:"",size:"small",disabled:t.sequence.length===0,onClick:t.copySequence},{default:ds(()=>[Qt(d,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(l,{id:"settings-btn",variant:"text",icon:"",size:"small"},{default:ds(()=>[Qt(d,null,{default:ds(()=>[...e[9]||(e[9]=[Fs("mdi-cog",-1)])]),_:1})]),_:1}),Qt(s,{"close-on-content-click":!1,activator:"#settings-btn",location:"bottom"},{default:ds(()=>[Qt(c,{"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",mq,[(Ga(!0),wo(yi,null,z_(t.ionTypes,E=>(Ga(),Q0(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",gq,[(Ga(!0),wo(yi,null,z_(t.ionTypesExtra,(E,P)=>(Ga(),Q0(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",vq,[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(l,{value:!0,size:"small"},{default:ds(()=>[...e[15]||(e[15]=[Fs("ppm",-1)])]),_:1}),Qt(l,{value:!1,size:"small"},{default:ds(()=>[...e[16]||(e[16]=[Fs("Da",-1)])]),_:1})]),_:1},8,["modelValue","disabled"])])]),_:1}),t.hasExternalAnnotations?(Ga(),Q0(_,{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%"}},[(Ga(!0),wo(yi,null,z_(t.sequenceObjects,(E,P)=>(Ga(),wo(yi,{key:P},[P!==0&&P%t.rowWidth===0?(Ga(),wo("div",yq,Bs(P+1),1)):wl("",!0),P===0?(Ga(),wo("div",bq,"N")):wl("",!0),Qt(p,{"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?(Ga(),wo("div",xq,Bs(P+1),1)):wl("",!0),P===t.sequence.length-1?(Ga(),wo("div",_q," C ")):wl("",!0)],64))),128))],2),t.showFragments&&t.fragmentTableData.length>0?(Ga(),wo("div",wq,[Qt(y,{class:"mb-4"}),en("div",Tq,[en("h5",null,"Matching Fragments ("+Bs(t.fragmentTableData.length)+")",1),en("span",kq,"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"])])}const d6=zy(fq,[["render",Sq],["__scopeId","data-v-c91905f9"]]),Aq=Fv({name:"App",components:{TabulatorTable:c6,PlotlyLineplot:h6,PlotlyHeatmap:f6,SequenceView:d6},setup(){const t=Oy(),e=Ry();let r,h;const R=()=>{const m=e.$state.counter,d=t.hash||null;if(m===r&&d===h)return;r=m,h=d??void 0;const n=JSON.parse(JSON.stringify(e.$state));n._vueDataHash=d,console.log("[Vue] sendStateToStreamlit",{counter:m,hash:d==null?void 0:d.substring(0,8)}),cf.setComponentValue(n)};return ti(()=>e.$state.counter,R,{immediate:!0}),ti(()=>t.hash,R),ti(()=>{var m;return(m=t.allDataForDrawing)==null?void 0:m.height},m=>{m&&typeof m=="number"&&cf.setFrameHeight(m)},{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"SequenceView":return d6;default:return console.warn(`Unknown component type: ${t}`),null}}},created(){cf.setComponentReady(),cf.setFrameHeight(400),cf.events.addEventListener(cf.RENDER_EVENT,this.updateStreamlitData)},mounted(){this.resizeObserver=new ResizeObserver(()=>{cf.setFrameHeight()}),this.resizeObserver.observe(this.$el)},unmounted(){cf.events.removeEventListener(cf.RENDER_EVENT,this.updateStreamlitData),this.resizeObserver&&this.resizeObserver.disconnect()},updated(){cf.setFrameHeight()},methods:{async updateStreamlitData(t){this.streamlitDataStore.updateRenderData(t.detail)}}}),Cq={key:0},Mq={key:1,class:"d-flex w-100",style:{height:"200px"}};function Eq(t,e,r,h,R,m){const d=iu("v-progress-linear"),n=iu("v-alert");return t.componentArgs!==void 0?(Ga(),wo("div",Cq,[(Ga(),Q0(AE(t.currentComponent),{args:t.componentArgs,index:0},null,8,["args"]))])):(Ga(),wo("div",Mq,[Qt(n,{class:"h-50 ma-8",icon:"mdi-application-variable-outline",title:"Loading...",type:"info",density:"compact"},{default:ds(()=>[Qt(d,{indeterminate:""})]),_:1})]))}const Iq=zy(Aq,[["render",Eq]]);function p9(t,e){e=Array.isArray(e)?e.slice(0,-1).map(r=>`'${r}'`).join(", ")+` or '${e.at(-1)}'`:`'${e}'`}const Ro=typeof window<"u",Gk=Ro&&"IntersectionObserver"in window,Lq=Ro&&("ontouchstart"in window||window.navigator.maxTouchPoints>0),p6=Ro&&"EyeDropper"in window,qk=Ro&&"matchMedia"in window&&typeof window.matchMedia=="function",pp=()=>qk&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function m6(t,e,r){Pq(t,e),e.set(t,r)}function Pq(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function g6(t,e,r){return t.set(m9(t,e),r),r}function Rp(t,e){return t.get(m9(t,e))}function m9(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 g9(t,e,r){const h=e.length-1;if(h<0)return t===void 0?r:t;for(let R=0;R<h;R++){if(t==null)return r;t=t[e[R]]}return t==null||t[e[h]]===void 0?r:t[e[h]]}function Ev(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(/^\./,""),g9(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 Ev(t,e,r);if(Array.isArray(e))return g9(t,e,r);if(typeof e!="function")return r;const h=e(t,r);return typeof h>"u"?r:h}function If(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Array.from({length:t},(r,h)=>e+h)}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 $k(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 v9(t){return Object.keys(t)}function dv(t,e){return e.every(r=>t.hasOwnProperty(r))}function Kh(t,e){const r={};for(const h of e)Object.prototype.hasOwnProperty.call(t,h)&&(r[h]=t[h]);return r}function WT(t,e,r){const h=Object.create(null),R=Object.create(null);for(const m in t)e.some(d=>d instanceof RegExp?d.test(m):d===m)?h[m]=t[m]:R[m]=t[m];return[h,R]}function qa(t,e){const r={...t};return e.forEach(h=>delete r[h]),r}const y9=/^on[^a-z]/,Yk=t=>y9.test(t),Dq=["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"],Rq=["ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Enter","Escape","Tab"," "];function Oq(t){return t.isComposing&&Rq.includes(t.key)}function Ag(t){const[e,r]=WT(t,[y9]),h=qa(e,Dq),[R,m]=WT(r,["class","style","id",/^data-/]);return Object.assign(R,e),Object.assign(m,h),[R,m]}function Ss(t){return t==null?[]:Array.isArray(t)?t:[t]}function b9(t,e){let r=0;const h=function(){for(var R=arguments.length,m=new Array(R),d=0;d<R;d++)m[d]=arguments[d];clearTimeout(r),r=setTimeout(()=>t(...m),qh(e))};return h.clear=()=>{clearTimeout(r)},h.immediate=t,h}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 v6(t){const e=t.toString().trim();return e.includes(".")?e.length-e.indexOf(".")-1:0}function y6(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 b6(t,e){return(arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0").repeat(Math.max(0,e-t.length))+t}function zq(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const r=[];let h=0;for(;h<t.length;)r.push(t.substr(h,e)),h+=e;return r}function x6(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 h=-1;for(;Math.abs(t)>=e&&h<r.length-1;)t/=e,++h;return`${t.toFixed(1)} ${r[h]}B`}function ah(){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 h={};for(const R in t)h[R]=t[R];for(const R in e){const m=t[R],d=e[R];if(UT(m)&&UT(d)){h[R]=ah(m,d,r);continue}if(r&&Array.isArray(m)&&Array.isArray(d)){h[R]=r(m,d);continue}h[R]=d}return h}function x9(t){return t.map(e=>e.type===yi?x9(e.children):e).flat()}function bv(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(bv.cache.has(t))return bv.cache.get(t);const e=t.replace(/[^a-z]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase();return bv.cache.set(t,e),e}bv.cache=new Map;function W0(t,e){if(!e||typeof e!="object")return[];if(Array.isArray(e))return e.map(r=>W0(t,r)).flat(1);if(e.suspense)return W0(t,e.ssContent);if(Array.isArray(e.children))return e.children.map(r=>W0(t,r)).flat(1);if(e.component){if(Object.getOwnPropertyDescriptor(e.component.provides,t))return[e.component];if(e.component.subTree)return W0(t,e.component.subTree).flat(1)}return[]}var A0=new WeakMap,nv=new WeakMap;class _9{constructor(e){m6(this,A0,[]),m6(this,nv,0),this.size=e}get isFull(){return Rp(A0,this).length===this.size}push(e){Rp(A0,this)[Rp(nv,this)]=e,g6(nv,this,(Rp(nv,this)+1)%this.size)}values(){return Rp(A0,this).slice(Rp(nv,this)).concat(Rp(A0,this).slice(0,Rp(nv,this)))}clear(){Rp(A0,this).length=0,g6(nv,this,0)}}function Fq(t){return"touches"in t?{clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:{clientX:t.clientX,clientY:t.clientY}}function Zk(t){const e=cc({});fl(()=>{const h=t();for(const R in h)e[R]=h[R]},{flush:"sync"});const r={};for(const h in e)r[h]=Nn(()=>e[h]);return r}function V2(t,e){return t.includes(e)}function w9(t){return t[2].toLowerCase()+t.slice(3)}const Wc=()=>[Function,Array];function _6(t,e){return e="on"+yp(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),h=1;h<e;h++)r[h-1]=arguments[h];if(Array.isArray(t))for(const R of t)R(...r);else typeof t=="function"&&t(...r)}function xv(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 h;try{h=[...t.querySelectorAll(r)]}catch{return[]}return h.filter(R=>!R.closest("[inert]")).filter(R=>!!R.offsetParent||R.getClientRects().length>0).filter(R=>{var m,d;return!((m=R.parentElement)!=null&&m.closest("details:not([open])"))||R.tagName==="SUMMARY"&&((d=R.parentElement)==null?void 0:d.tagName)==="DETAILS"})}function T9(t,e,r){let h,R=t.indexOf(document.activeElement);const m=e==="next"?1:-1;do R+=m,h=t[R];while((!h||h.offsetParent==null||!((r==null?void 0:r(h))??!0))&&R<t.length&&R>=0);return h}function _v(t,e){var h,R,m,d;const r=xv(t);if(e==null)(t===document.activeElement||!t.contains(document.activeElement))&&((h=r[0])==null||h.focus());else if(e==="first")(R=r[0])==null||R.focus();else if(e==="last")(m=r.at(-1))==null||m.focus();else if(typeof e=="number")(d=r[e])==null||d.focus();else{const n=T9(r,e);n?n.focus():_v(t,e==="next"?"first":"last")}}function C_(t){return t==null||typeof t=="string"&&t.trim()===""}function Pw(){}function xy(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===Ah?!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 Bq(t,e){if(!Ro||t===0)return e(),()=>{};const r=window.setTimeout(e,t);return()=>window.clearTimeout(r)}function Nq(t,e){const r=t.clientX,h=t.clientY,R=e.getBoundingClientRect(),m=R.left,d=R.top,n=R.right,l=R.bottom;return r>=m&&r<=n&&h>=d&&h<=l}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:()=>$k(t.value)}),e}function _y(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 Vq(t,e,r){const h=new RegExp(`[\\d\\-${U2(r)}]`),R=t.split("").filter(d=>h.test(d)).filter((d,n,l)=>n===0&&/[-]/.test(d)||d===r&&n===l.indexOf(d)||/\d/.test(d)).join("");if(e===0)return R.split(r)[0];const m=new RegExp(`${U2(r)}\\d`);if(e!==null&&m.test(R)){const d=R.split(r);return[d[0],d[1].substring(0,e)].join(r)}return R}function jq(t){const e={};for(const r in t)e[Xh(r)]=t[r];return e}function Uq(t){const e=["checked","disabled"];return Object.fromEntries(Object.entries(t).filter(r=>{let[h,R]=r;return e.includes(h)?!!R:R!==void 0}))}function w6(t){const e=r=>Array.isArray(r)?r.map(h=>e(h)):Xs(r)||sp(r)||Yb(r)?e(Zi(r)):UT(r)?Object.keys(r).reduce((h,R)=>(h[R]=e(r[R]),h),{}):r;return e(t)}const k9=["top","bottom"],Hq=["start","end","left","right"];function GT(t,e){let[r,h]=t.split(" ");return h||(h=V2(k9,r)?"start":V2(Hq,r)?"top":"center"),{side:qT(r,e),align:qT(h,e)}}function qT(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 T6(t){return{side:t.align,align:t.side}}function k6(t){return V2(k9,t.side)?"y":"x"}class nd{constructor(e){const r=document.body.currentCSSZoom??1,h=e instanceof Element,R=h?1+(1-r)/r:1,{x:m,y:d,width:n,height:l}=h?e.getBoundingClientRect():e;this.x=m*R,this.y=d*R,this.width=n*R,this.height=l*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 S6(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 S9(t){if(Array.isArray(t)){const e=document.body.currentCSSZoom??1,r=1+(1-e)/e;return new nd({x:t[0]*r,y:t[1]*r,width:0*r,height:0*r})}else return new nd(t)}function Wq(t){if(t===document.documentElement)if(visualViewport){const e=document.body.currentCSSZoom??1;return new nd({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 nd({x:0,y:0,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight});else return new nd(t)}function Xk(t){const e=new nd(t),r=getComputedStyle(t),h=r.transform;if(h){let R,m,d,n,l;if(h.startsWith("matrix3d("))R=h.slice(9,-1).split(/, /),m=Number(R[0]),d=Number(R[5]),n=Number(R[12]),l=Number(R[13]);else if(h.startsWith("matrix("))R=h.slice(7,-1).split(/, /),m=Number(R[0]),d=Number(R[3]),n=Number(R[4]),l=Number(R[5]);else return new nd(e);const u=r.transformOrigin,i=e.x-n-(1-m)*parseFloat(u),_=e.y-l-(1-d)*parseFloat(u.slice(u.indexOf(" ")+1)),b=m?e.width/m:t.offsetWidth+1,w=d?e.height/d:t.offsetHeight+1;return new nd({x:i,y:_,width:b,height:w})}else return new nd(e)}function Gp(t,e,r){if(typeof t.animate>"u")return{finished:Promise.resolve()};let h;try{h=t.animate(e,r)}catch{return{finished:Promise.resolve()}}return typeof h.finished>"u"&&(h.finished=new Promise(R=>{h.onfinish=()=>{R(h)}})),h}const Z_=new WeakMap;function Gq(t,e){Object.keys(e).forEach(r=>{if(Yk(r)){const h=w9(r),R=Z_.get(t);if(e[r]==null)R==null||R.forEach(m=>{const[d,n]=m;d===h&&(t.removeEventListener(h,n),R.delete(m))});else if(!R||![...R].some(m=>m[0]===h&&m[1]===e[r])){t.addEventListener(h,e[r]);const m=R||new Set;m.add([h,e[r]]),Z_.has(t)||Z_.set(t,m)}}else e[r]==null?t.removeAttribute(r):t.setAttribute(r,e[r])})}function qq(t,e){Object.keys(e).forEach(r=>{if(Yk(r)){const h=w9(r),R=Z_.get(t);R==null||R.forEach(m=>{const[d,n]=m;d===h&&(t.removeEventListener(h,n),R.delete(m))})}else t.removeAttribute(r)})}const C0=2.4,A6=.2126729,C6=.7151522,M6=.072175,$q=.55,Yq=.58,Zq=.57,Xq=.62,E_=.03,E6=1.45,Kq=5e-4,Jq=1.25,Qq=1.25,I6=.078,L6=12.82051282051282,I_=.06,P6=.001;function D6(t,e){const r=(t.r/255)**C0,h=(t.g/255)**C0,R=(t.b/255)**C0,m=(e.r/255)**C0,d=(e.g/255)**C0,n=(e.b/255)**C0;let l=r*A6+h*C6+R*M6,u=m*A6+d*C6+n*M6;if(l<=E_&&(l+=(E_-l)**E6),u<=E_&&(u+=(E_-u)**E6),Math.abs(u-l)<Kq)return 0;let i;if(u>l){const _=(u**$q-l**Yq)*Jq;i=_<P6?0:_<I6?_-_*L6*I_:_-I_}else{const _=(u**Xq-l**Zq)*Qq;i=_>-P6?0:_>-I6?_-_*L6*I_:_+I_}return i*100}const H2=.20689655172413793,e$=t=>t>H2**3?Math.cbrt(t):t/(3*H2**2)+4/29,t$=t=>t>H2?t**3:3*H2**2*(t-4/29);function A9(t){const e=e$,r=e(t[1]);return[116*r-16,500*(e(t[0]/.95047)-r),200*(r-e(t[2]/1.08883))]}function C9(t){const e=t$,r=(t[0]+16)/116;return[e(r+t[1]/500)*.95047,e(r),e(r-t[2]/200)*1.08883]}const n$=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]],r$=t=>t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055,i$=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],a$=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4;function M9(t){const e=Array(3),r=r$,h=n$;for(let R=0;R<3;++R)e[R]=Math.round(Vo(r(h[R][0]*t[0]+h[R][1]*t[1]+h[R][2]*t[2]))*255);return{r:e[0],g:e[1],b:e[2]}}function Kk(t){let{r:e,g:r,b:h}=t;const R=[0,0,0],m=a$,d=i$;e=m(e/255),r=m(r/255),h=m(h/255);for(let n=0;n<3;++n)R[n]=d[n][0]*e+d[n][1]*r+d[n][2]*h;return R}function $T(t){return!!t&&/^(#|var\(--|(rgb|hsl)a?\()/.test(t)}function o$(t){return $T(t)&&!/^((rgb|hsl)a?\()?var\(--/.test(t)}const R6=/^(?<fn>(?:rgb|hsl)a?)\((?<values>.+)\)/,s$={rgb:(t,e,r,h)=>({r:t,g:e,b:r,a:h}),rgba:(t,e,r,h)=>({r:t,g:e,b:r,a:h}),hsl:(t,e,r,h)=>O6({h:t,s:e,l:r,a:h}),hsla:(t,e,r,h)=>O6({h:t,s:e,l:r,a:h}),hsv:(t,e,r,h)=>mp({h:t,s:e,v:r,a:h}),hsva:(t,e,r,h)=>mp({h:t,s:e,v:r,a:h})};function Lf(t){if(typeof t=="number")return{r:(t&16711680)>>16,g:(t&65280)>>8,b:t&255};if(typeof t=="string"&&R6.test(t)){const{groups:e}=t.match(R6),{fn:r,values:h}=e,R=h.split(/,\s*|\s*\/\s*|\s+/).map((m,d)=>m.endsWith("%")||d>0&&d<3&&["hsl","hsla","hsv","hsva"].includes(r)?parseFloat(m)/100:parseFloat(m));return s$[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),P9(e)}else if(typeof t=="object"){if(dv(t,["r","g","b"]))return t;if(dv(t,["h","s","l"]))return mp(Jk(t));if(dv(t,["h","s","v"]))return mp(t)}throw new TypeError(`Invalid color: ${t==null?t:String(t)||t.constructor.name}
|
|
4205
4205
|
Expected #hex, #hexa, rgb(), rgba(), hsl(), hsla(), object or number`)}function mp(t){const{h:e,s:r,v:h,a:R}=t,m=n=>{const l=(n+e/60)%6;return h-h*r*Math.max(Math.min(l,4-l,1),0)},d=[m(5),m(3),m(1)].map(n=>Math.round(n*255));return{r:d[0],g:d[1],b:d[2],a:R}}function O6(t){return mp(Jk(t))}function ux(t){if(!t)return{h:0,s:1,v:1,a:1};const e=t.r/255,r=t.g/255,h=t.b/255,R=Math.max(e,r,h),m=Math.min(e,r,h);let d=0;R!==m&&(R===e?d=60*(0+(r-h)/(R-m)):R===r?d=60*(2+(h-e)/(R-m)):R===h&&(d=60*(4+(e-r)/(R-m)))),d<0&&(d=d+360);const n=R===0?0:(R-m)/R,l=[d,n,R];return{h:l[0],s:l[1],v:l[2],a:t.a}}function YT(t){const{h:e,s:r,v:h,a:R}=t,m=h-h*r/2,d=m===1||m===0?0:(h-m)/Math.min(m,1-m);return{h:e,s:d,l:m,a:R}}function Jk(t){const{h:e,s:r,l:h,a:R}=t,m=h+r*Math.min(h,1-h),d=m===0?0:2-2*h/m;return{h:e,s:d,v:m,a:R}}function E9(t){let{r:e,g:r,b:h,a:R}=t;return R===void 0?`rgb(${e}, ${r}, ${h})`:`rgba(${e}, ${r}, ${h}, ${R})`}function I9(t){return E9(mp(t))}function L_(t){const e=Math.round(t).toString(16);return("00".substr(0,2-e.length)+e).toUpperCase()}function L9(t){let{r:e,g:r,b:h,a:R}=t;return`#${[L_(e),L_(r),L_(h),R!==void 0?L_(Math.round(R*255)):""].join("")}`}function P9(t){t=u$(t);let[e,r,h,R]=zq(t,2).map(m=>parseInt(m,16));return R=R===void 0?R:R/255,{r:e,g:r,b:h,a:R}}function l$(t){const e=P9(t);return ux(e)}function D9(t){return L9(mp(t))}function u$(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=y6(y6(t,6),8,"F")),t}function c$(t,e){const r=A9(Kk(t));return r[0]=r[0]+e*10,M9(C9(r))}function h$(t,e){const r=A9(Kk(t));return r[0]=r[0]-e*10,M9(C9(r))}function ZT(t){const e=Lf(t);return Kk(e)[1]}function f$(t,e){const r=ZT(t),h=ZT(e),R=Math.max(r,h),m=Math.min(r,h);return(R+.05)/(m+.05)}function R9(t){const e=Math.abs(D6(Lf(0),Lf(t)));return Math.abs(D6(Lf(16777215),Lf(t)))>Math.min(e,50)?"#fff":"#000"}function ir(t,e){return r=>Object.keys(t).reduce((h,R)=>{const d=typeof t[R]=="object"&&t[R]!=null&&!Array.isArray(t[R])?t[R]:{type:t[R]};return r&&R in r?h[R]={...d,default:r[R]}:h[R]=d,e&&!h[R].source&&(h[R].source=e),h},{})}const Ti=ir({class:[String,Array,Object],style:{type:[String,Array,Object],default:null}},"component");function lu(t,e){const r=Ey();if(!r)throw new Error(`[Vuetify] ${t} must be called from inside a setup function`);return r}function bp(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"composables";const e=lu(t).type;return bv((e==null?void 0:e.aliasName)||(e==null?void 0:e.name))}function d$(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 wy=Symbol.for("vuetify:defaults");function p$(t){return qr(t)}function Qk(){const t=Ea(wy);if(!t)throw new Error("[Vuetify] Could not find defaults instance");return t}function kl(t,e){const r=Qk(),h=qr(t),R=an(()=>{if(qh(e==null?void 0:e.disabled))return r.value;const d=qh(e==null?void 0:e.scoped),n=qh(e==null?void 0:e.reset),l=qh(e==null?void 0:e.root);if(h.value==null&&!(d||n||l))return r.value;let u=ah(h.value,{prev:r.value});if(d)return u;if(n||l){const i=Number(n||1/0);for(let _=0;_<=i&&!(!u||!("prev"in u));_++)u=u.prev;return u&&typeof l=="string"&&l in u&&(u=ah(ah(u,{prev:u}),u[l])),u}return u.prev?ah(u.prev,u):u});return Ns(wy,R),R}function m$(t,e){return t.props&&(typeof t.props[e]<"u"||typeof t.props[bv(e)]<"u")}function g$(){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]:Qk();const h=lu("useDefaults");if(e=e??h.type.name??h.type.__name,!e)throw new Error("[Vuetify] Could not determine component name");const R=an(()=>{var l;return(l=r.value)==null?void 0:l[t._as??e]}),m=new Proxy(t,{get(l,u){var w,v,o,a;const i=Reflect.get(l,u);if(u==="class"||u==="style")return[(w=R.value)==null?void 0:w[u],i].filter(c=>c!=null);if(m$(h.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}}),d=ni();fl(()=>{if(R.value){const l=Object.entries(R.value).filter(u=>{let[i]=u;return i.startsWith(i[0].toUpperCase())});d.value=l.length?Object.fromEntries(l):void 0}else d.value=void 0});function n(){const l=d$(wy,h);Ns(wy,an(()=>d.value?ah((l==null?void 0:l.value)??{},d.value):l==null?void 0:l.value))}return{props:m,provideSubDefaults:n}}function Eh(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(h){return Kh(h,e)},t.props._as=String,t.setup=function(h,R){const m=Qk();if(!m.value)return t._setup(h,R);const{props:d,provideSubDefaults:n}=g$(h,h._as??t.name,m),l=t._setup(d,R);return n(),l}}return t}function zr(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return e=>(t?Eh:Fv)(e)}function v$(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??yp(Xh(t.replace(/__/g,"-"))),props:{tag:{type:String,default:e},...Ti()},setup(h,R){let{slots:m}=R;return()=>{var d;return lm(h.tag,{class:[t,h.class],style:h.style},(d=m.default)==null?void 0:d.call(m))}}})}function y$(t,e,r,h){if(!r||mg(t)||mg(e))return;const R=r.get(t);if(R)R.set(e,h);else{const m=new WeakMap;m.set(e,h),r.set(t,m)}}function b$(t,e,r){var m,d;if(!r||mg(t)||mg(e))return null;const h=(m=r.get(t))==null?void 0:m.get(e);if(typeof h=="boolean")return h;const R=(d=r.get(e))==null?void 0:d.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 h=Object.keys(t);if(h.length!==Object.keys(e).length)return!1;const R=b$(t,e,r);return R||(y$(t,e,r,!0),h.every(m=>Ec(t[m],e[m],r)))}function O9(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)",z6="cubic-bezier(0.0, 0, 0.2, 1)",F6="cubic-bezier(0.4, 0, 1, 1)",x$={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(h=>Yk(h)&&h.endsWith(e)).reduce((h,R)=>(h[R.slice(0,-e.length)]=m=>lx(t[R],m,r(m)),h),{})}function Rw(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;for(;t;){if(e?_$(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,h=e.overflowX==="scroll"||e.overflowX==="auto"&&t.scrollWidth>t.clientWidth;return r||h}function _$(t){if(!t||t.nodeType!==Node.ELEMENT_NODE)return!1;const e=window.getComputedStyle(t);return["scroll","auto"].includes(e.overflowY)}function w$(t){let{depth:e,isLast:r,isLastGroup:h,leafLinks:R,separateRoots:m,parentIndentLines:d,variant:n}=t;const l=r&&(!h||m||e>1);return!d||!e?{leaf:void 0,node:void 0,children:d,footer:d&&(!l||n==="simple")?[...d,m?"none":"line"]:["none"]}:n==="simple"?{leaf:[...d,"line"],node:[...d,"line"],children:[...d,"line"],footer:[...d,"line","line"]}:{leaf:[...d,l?"last-leaf":"leaf",...R?["leaf-link"]:[]],node:[...d,l?"last-leaf":"leaf"],children:[...d,l?"none":"line"],footer:[...d,l?"none":"line"]}}function T$(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 k$(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{leading:!0,trailing:!0},h=0,R=0,m=!1,d=0;function n(){clearTimeout(h),m=!1,d=0}const l=function(){for(var u=arguments.length,i=new Array(u),_=0;_<u;_++)i[_]=arguments[_];clearTimeout(h);const b=Date.now();d||(d=b);const w=b-Math.max(d,R);function v(){R=Date.now(),h=setTimeout(n,e),t(...i)}m?w>=e?v():r.trailing&&(h=setTimeout(v,e-w)):(m=!0,r.leading&&v())};return l.clear=n,l.immediate=t,l}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 h=t.icon;return Qt(t.tag,null,{default:()=>{var R;return[t.icon?Qt(h,null,null):(R=r.default)==null?void 0:R.call(r)]}})}}}),tS=Eh({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(h=>Array.isArray(h)?en("path",{d:h[0],"fill-opacity":h[1]},null):en("path",{d:h},null)):en("path",{d:t.icon},null)])]})}}),S$=Eh({name:"VLigatureIcon",props:Ow(),setup(t){return()=>Qt(t.tag,null,{default:()=>[t.icon]})}}),nS=Eh({name:"VClassIcon",props:Ow(),setup(t){return()=>Qt(t.tag,{class:jr(t.icon)},null)}}),A$=t=>{const e=Ea(XT);if(!e)throw new Error("Missing Vuetify Icons provide!");return{iconData:an(()=>{var l;const h=Mc(t);if(!h)return{component:KT};let R=h;if(typeof R=="string"&&(R=R.trim(),R.startsWith("$")&&(R=(l=e.aliases)==null?void 0:l[R.slice(1)])),Array.isArray(R))return{component:tS,icon:R};if(typeof R!="string")return{component:KT,icon:R};const m=Object.keys(e.sets).find(u=>typeof R=="string"&&R.startsWith(`${u}:`)),d=m?R.slice(m.length+1):R;return{component:e.sets[m??e.defaultSet].component,icon:d}})}},C$={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"},M$={component:t=>lm(nS,{...t,class:"mdi"})};function E$(){return{svg:{component:tS},class:{component:nS}}}function I$(t){const e=E$(),r=(t==null?void 0:t.defaultSet)??"mdi";return r==="mdi"&&!e.mdi&&(e.mdi=M$),ah({defaultSet:r,sets:e,aliases:{...C$,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 oh(t,e){let r;function h(){r=ag(),r.run(()=>e.length?e(()=>{r==null||r.stop(),h()}):e())}ti(t,R=>{R&&!r?h():R||(r==null||r.stop(),r=void 0)},{immediate:!0}),ju(()=>{r==null||r.stop()})}function Ri(t,e,r){let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:_=>_,R=arguments.length>4&&arguments[4]!==void 0?arguments[4]:_=>_;const m=lu("useProxiedModel"),d=qr(t[e]!==void 0?t[e]:r),n=bv(e),u=an(n!==e?()=>{var _,b,w,v;return t[e],!!(((_=m.vnode.props)!=null&&_.hasOwnProperty(e)||(b=m.vnode.props)!=null&&b.hasOwnProperty(n))&&((w=m.vnode.props)!=null&&w.hasOwnProperty(`onUpdate:${e}`)||(v=m.vnode.props)!=null&&v.hasOwnProperty(`onUpdate:${n}`)))}:()=>{var _,b;return t[e],!!((_=m.vnode.props)!=null&&_.hasOwnProperty(e)&&((b=m.vnode.props)!=null&&b.hasOwnProperty(`onUpdate:${e}`)))});oh(()=>!u.value,()=>{ti(()=>t[e],_=>{d.value=_})});const i=an({get(){const _=t[e];return h(u.value?_:d.value)},set(_){const b=R(_),w=Zi(u.value?t[e]:d.value);w===b||h(w)===_||(d.value=b,m==null||m.emit(`update:${e}`,b))}});return Object.defineProperty(i,"externalValue",{get:()=>u.value?t[e]:d.value}),i}const L$={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"}}},B6="$vuetify.",N6=(t,e)=>t.replace(/\{(\d+)\}/g,(r,h)=>String(e[Number(h)])),z9=(t,e,r)=>function(h){for(var R=arguments.length,m=new Array(R>1?R-1:0),d=1;d<R;d++)m[d-1]=arguments[d];if(!h.startsWith(B6))return N6(h,m);const n=h.replace(B6,""),l=t.value&&r.value[t.value],u=e.value&&r.value[e.value];let i=Ev(l,n,null);return i||(`${h}${t.value}`,i=Ev(u,n,null)),i||(i=h),typeof i!="string"&&(i=h),N6(i,m)};function rS(t,e){return(r,h)=>new Intl.NumberFormat([t.value,e.value],h).format(r)}function F9(t,e){return rS(t,e)(.1).includes(",")?",":"."}function x5(t,e,r){const h=Ri(t,e,t[e]??r.value);return h.value=t[e]??r.value,ti(r,R=>{t[e]==null&&(h.value=r.value)}),h}function B9(t){return e=>{const r=x5(e,"locale",t.current),h=x5(e,"fallback",t.fallback),R=x5(e,"messages",t.messages);return{name:"vuetify",current:r,fallback:h,messages:R,decimalSeparator:Nn(()=>F9(r,h)),t:z9(r,h,R),n:rS(r,h),provide:B9({current:r,fallback:h,messages:R})}}}function P$(t){const e=ni((t==null?void 0:t.locale)??"en"),r=ni((t==null?void 0:t.fallback)??"en"),h=qr({en:L$,...t==null?void 0:t.messages});return{name:"vuetify",current:e,fallback:r,messages:h,decimalSeparator:Nn(()=>(t==null?void 0:t.decimalSeparator)??F9(e,r)),t:z9(e,r,h),n:rS(e,r),provide:B9({current:e,fallback:r,messages:h})}}const Ty=Symbol.for("vuetify:locale");function D$(t){return t.name!=null}function R$(t){const e=t!=null&&t.adapter&&D$(t==null?void 0:t.adapter)?t==null?void 0:t.adapter:P$(t),r=z$(e,t);return{...e,...r}}function Fo(){const t=Ea(Ty);if(!t)throw new Error("[Vuetify] Could not find injected locale instance");return t}function N9(t){const e=Ea(Ty);if(!e)throw new Error("[Vuetify] Could not find injected locale instance");const r=e.provide(t),h=F$(r,e.rtl,t),R={...r,...h};return Ns(Ty,R),R}function O$(){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 z$(t,e){const r=qr((e==null?void 0:e.rtl)??O$()),h=an(()=>r.value[t.current.value]??!1);return{isRtl:h,rtl:r,rtlClasses:Nn(()=>`v-locale--is-${h.value?"rtl":"ltr"}`)}}function F$(t,e,r){const h=an(()=>r.rtl??e.value[t.current.value]??!1);return{isRtl:h,rtl:e,rtlClasses:Nn(()=>`v-locale--is-${h.value?"rtl":"ltr"}`)}}function ku(){const t=Ea(Ty);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
|
|
4206
4206
|
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
|
|
4207
4207
|
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
|