mobility-toolbox-js 3.0.0-beta.21 → 3.0.0-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mbt.min.js CHANGED
@@ -577,7 +577,7 @@ uniform ${O} ${D} u_${G};
577
577
  `),ee=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(ee,ne),P.compileShader(ee),!P.getShaderParameter(ee,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(ee)}`);P.attachShader(this.program,ee);let fe=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(fe,ue),P.compileShader(fe),!P.getShaderParameter(fe,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(fe)}`);P.attachShader(this.program,fe),this.attributes={};let xe={};this.numAttributes=O.length;for(let we=0;we<this.numAttributes;we++)O[we]&&(P.bindAttribLocation(this.program,we,O[we]),this.attributes[O[we]]=we);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(fe),P.deleteShader(ee);for(let we=0;we<re.length;we++){let Me=re[we];if(Me&&!xe[Me]){let Oe=P.getUniformLocation(this.program,Me);Oe&&(xe[Me]=Oe)}}this.fixedUniforms=f(i,xe),this.terrainUniforms=((we,Me)=>({u_depth:new o.aI(we,Me.u_depth),u_terrain:new o.aI(we,Me.u_terrain),u_terrain_dim:new o.aJ(we,Me.u_terrain_dim),u_terrain_matrix:new o.aK(we,Me.u_terrain_matrix),u_terrain_unpack:new o.aL(we,Me.u_terrain_unpack),u_terrain_exaggeration:new o.aJ(we,Me.u_terrain_exaggeration)}))(i,xe),this.binderUniforms=p?p.getUniforms(i,xe):[]}draw(i,u,p,f,x,E,P,T,R,O,D,G,W,K,re,Y,ne,ue){let ee=i.gl;if(this.failedToCreate)return;if(i.program.set(this.program),i.setDepthMode(p),i.setStencilMode(f),i.setColorMode(x),i.setCullFace(E),T){i.activeTexture.set(ee.TEXTURE2),ee.bindTexture(ee.TEXTURE_2D,T.depthTexture),i.activeTexture.set(ee.TEXTURE3),ee.bindTexture(ee.TEXTURE_2D,T.texture);for(let xe in this.terrainUniforms)this.terrainUniforms[xe].set(T[xe])}for(let xe in this.fixedUniforms)this.fixedUniforms[xe].set(P[xe]);re&&re.setUniforms(i,this.binderUniforms,W,{zoom:K});let fe=0;switch(u){case ee.LINES:fe=2;break;case ee.TRIANGLES:fe=3;break;case ee.LINE_STRIP:fe=1}for(let xe of G.get()){let we=xe.vaos||(xe.vaos={});(we[R]||(we[R]=new Ic)).bind(i,this,O,re?re.getPaintVertexBuffers():[],D,xe.vertexOffset,Y,ne,ue),ee.drawElements(u,xe.primitiveLength*fe,ee.UNSIGNED_SHORT,xe.primitiveOffset*fe*2)}}}function Tc(_,i,u){let p=1/It(u,1,i.transform.tileZoom),f=Math.pow(2,u.tileID.overscaledZ),x=u.tileSize*Math.pow(2,i.transform.tileZoom)/f,E=x*(u.tileID.canonical.x+u.tileID.wrap*f),P=x*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture.size,u_scale:[p,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[E>>16,P>>16],u_pixel_coord_lower:[65535&E,65535&P]}}let Cc=(_,i,u,p)=>{let f=i.style.light,x=f.properties.get("position"),E=[x.x,x.y,x.z],P=function(){var R=new o.A(9);return o.A!=Float32Array&&(R[1]=0,R[2]=0,R[3]=0,R[5]=0,R[6]=0,R[7]=0),R[0]=1,R[4]=1,R[8]=1,R}();f.properties.get("anchor")==="viewport"&&function(R,O){var D=Math.sin(O),G=Math.cos(O);R[0]=G,R[1]=D,R[2]=0,R[3]=-D,R[4]=G,R[5]=0,R[6]=0,R[7]=0,R[8]=1}(P,-i.transform.angle),function(R,O,D){var G=O[0],W=O[1],K=O[2];R[0]=G*D[0]+W*D[3]+K*D[6],R[1]=G*D[1]+W*D[4]+K*D[7],R[2]=G*D[2]+W*D[5]+K*D[8]}(E,E,P);let T=f.properties.get("color");return{u_matrix:_,u_lightpos:E,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+u,u_opacity:p}},Mc=(_,i,u,p,f,x,E)=>o.e(Cc(_,i,u,p),Tc(x,i,E),{u_height_factor:-Math.pow(2,f.overscaledZ)/E.tileSize/8}),hl=_=>({u_matrix:_}),ga=(_,i,u,p)=>o.e(hl(_),Tc(u,i,p)),Xy=(_,i)=>({u_matrix:_,u_world:i}),Hy=(_,i,u,p,f)=>o.e(ga(_,i,u,p),{u_world:f}),Sf=(_,i,u,p)=>{let f=_.transform,x,E;if(p.paint.get("circle-pitch-alignment")==="map"){let P=It(u,1,f.zoom);x=!0,E=[P,P]}else x=!1,E=f.pixelsToGLUnits;return{u_camera_to_center_distance:f.cameraToCenterDistance,u_scale_with_map:+(p.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(i.posMatrix,u,p.paint.get("circle-translate"),p.paint.get("circle-translate-anchor")),u_pitch_with_map:+x,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:E}},Ky=(_,i,u)=>({u_matrix:_,u_inv_matrix:i,u_camera_to_center_distance:u.cameraToCenterDistance,u_viewport_size:[u.width,u.height]}),rs=(_,i,u=1)=>({u_matrix:_,u_color:i,u_overlay:0,u_overlay_scale:u}),pl=_=>({u_matrix:_}),xn=(_,i,u,p)=>({u_matrix:_,u_extrude_scale:It(i,1,u),u_intensity:p});function vn(_,i){let u=Math.pow(2,i.canonical.z),p=i.canonical.y;return[new o.Z(0,p/u).toLngLat().lat,new o.Z(0,(p+1)/u).toLngLat().lat]}let dl=(_,i,u,p)=>{let f=_.transform;return{u_matrix:If(_,i,u,p),u_ratio:1/It(i,1,f.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1]]}},Rc=(_,i,u,p,f)=>o.e(dl(_,i,u,f),{u_image:0,u_image_height:p}),Af=(_,i,u,p,f)=>{let x=_.transform,E=zs(i,x);return{u_matrix:If(_,i,u,f),u_texsize:i.imageAtlasTexture.size,u_ratio:1/It(i,1,x.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[E,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]]}},Ef=(_,i,u,p,f,x)=>{let E=_.lineAtlas,P=zs(i,_.transform),T=u.layout.get("line-cap")==="round",R=E.getDash(p.from,T),O=E.getDash(p.to,T),D=R.width*f.fromScale,G=O.width*f.toScale;return o.e(dl(_,i,u,x),{u_patternscale_a:[P/D,-R.height/2],u_patternscale_b:[P/G,-O.height/2],u_sdfgamma:E.width/(256*Math.min(D,G)*_.pixelRatio)/2,u_image:0,u_tex_y_a:R.y,u_tex_y_b:O.y,u_mix:f.t})};function zs(_,i){return 1/It(_,1,i.tileZoom)}function If(_,i,u,p){return _.translatePosMatrix(p?p.posMatrix:i.tileID.posMatrix,i,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}let Yy=(_,i,u,p,f)=>{return{u_matrix:_,u_tl_parent:i,u_scale_parent:u,u_buffer_scale:1,u_fade_t:p.mix,u_opacity:p.opacity*f.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:f.paint.get("raster-brightness-min"),u_brightness_high:f.paint.get("raster-brightness-max"),u_saturation_factor:(E=f.paint.get("raster-saturation"),E>0?1-1/(1.001-E):-E),u_contrast_factor:(x=f.paint.get("raster-contrast"),x>0?1/(1-x):1+x),u_spin_weights:Jy(f.paint.get("raster-hue-rotate"))};var x,E};function Jy(_){_*=Math.PI/180;let i=Math.sin(_),u=Math.cos(_);return[(2*u+1)/3,(-Math.sqrt(3)*i-u+1)/3,(Math.sqrt(3)*i-u+1)/3]}let Pf=(_,i,u,p,f,x,E,P,T,R,O,D,G,W)=>{let K=E.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:K.cameraToCenterDistance,u_pitch:K.pitch/360*2*Math.PI,u_rotate_symbol:+u,u_aspect_ratio:K.width/K.height,u_fade_change:E.options.fadeDuration?E.symbolFadeChange:1,u_matrix:P,u_label_plane_matrix:T,u_coord_matrix:R,u_is_text:+D,u_pitch_with_map:+p,u_is_along_line:f,u_is_variable_anchor:x,u_texsize:G,u_texture:0,u_translation:O,u_pitched_scale:W}},Tf=(_,i,u,p,f,x,E,P,T,R,O,D,G,W,K)=>{let re=E.transform;return o.e(Pf(_,i,u,p,f,x,E,P,T,R,O,D,G,K),{u_gamma_scale:p?Math.cos(re._pitch)*re.cameraToCenterDistance:1,u_device_pixel_ratio:E.pixelRatio,u_is_halo:+W})},Qy=(_,i,u,p,f,x,E,P,T,R,O,D,G,W)=>o.e(Tf(_,i,u,p,f,x,E,P,T,R,O,!0,D,!0,W),{u_texsize_icon:G,u_texture_icon:1}),kc=(_,i,u)=>({u_matrix:_,u_opacity:i,u_color:u}),Wh=(_,i,u,p,f,x)=>o.e(function(E,P,T,R){let O=T.imageManager.getPattern(E.from.toString()),D=T.imageManager.getPattern(E.to.toString()),{width:G,height:W}=T.imageManager.getPixelSize(),K=Math.pow(2,R.tileID.overscaledZ),re=R.tileSize*Math.pow(2,T.transform.tileZoom)/K,Y=re*(R.tileID.canonical.x+R.tileID.wrap*K),ne=re*R.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:O.tl,u_pattern_br_a:O.br,u_pattern_tl_b:D.tl,u_pattern_br_b:D.br,u_texsize:[G,W],u_mix:P.t,u_pattern_size_a:O.displaySize,u_pattern_size_b:D.displaySize,u_scale_a:P.fromScale,u_scale_b:P.toScale,u_tile_units_to_pixels:1/It(R,1,T.transform.tileZoom),u_pixel_coord_upper:[Y>>16,ne>>16],u_pixel_coord_lower:[65535&Y,65535&ne]}}(p,x,u,f),{u_matrix:_,u_opacity:i}),Fc={fillExtrusion:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_lightpos:new o.aO(_,i.u_lightpos),u_lightintensity:new o.aJ(_,i.u_lightintensity),u_lightcolor:new o.aO(_,i.u_lightcolor),u_vertical_gradient:new o.aJ(_,i.u_vertical_gradient),u_opacity:new o.aJ(_,i.u_opacity)}),fillExtrusionPattern:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_lightpos:new o.aO(_,i.u_lightpos),u_lightintensity:new o.aJ(_,i.u_lightintensity),u_lightcolor:new o.aO(_,i.u_lightcolor),u_vertical_gradient:new o.aJ(_,i.u_vertical_gradient),u_height_factor:new o.aJ(_,i.u_height_factor),u_image:new o.aI(_,i.u_image),u_texsize:new o.aP(_,i.u_texsize),u_pixel_coord_upper:new o.aP(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new o.aP(_,i.u_pixel_coord_lower),u_scale:new o.aO(_,i.u_scale),u_fade:new o.aJ(_,i.u_fade),u_opacity:new o.aJ(_,i.u_opacity)}),fill:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix)}),fillPattern:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_image:new o.aI(_,i.u_image),u_texsize:new o.aP(_,i.u_texsize),u_pixel_coord_upper:new o.aP(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new o.aP(_,i.u_pixel_coord_lower),u_scale:new o.aO(_,i.u_scale),u_fade:new o.aJ(_,i.u_fade)}),fillOutline:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_world:new o.aP(_,i.u_world)}),fillOutlinePattern:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_world:new o.aP(_,i.u_world),u_image:new o.aI(_,i.u_image),u_texsize:new o.aP(_,i.u_texsize),u_pixel_coord_upper:new o.aP(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new o.aP(_,i.u_pixel_coord_lower),u_scale:new o.aO(_,i.u_scale),u_fade:new o.aJ(_,i.u_fade)}),circle:(_,i)=>({u_camera_to_center_distance:new o.aJ(_,i.u_camera_to_center_distance),u_scale_with_map:new o.aI(_,i.u_scale_with_map),u_pitch_with_map:new o.aI(_,i.u_pitch_with_map),u_extrude_scale:new o.aP(_,i.u_extrude_scale),u_device_pixel_ratio:new o.aJ(_,i.u_device_pixel_ratio),u_matrix:new o.aK(_,i.u_matrix)}),collisionBox:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_pixel_extrude_scale:new o.aP(_,i.u_pixel_extrude_scale)}),collisionCircle:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_inv_matrix:new o.aK(_,i.u_inv_matrix),u_camera_to_center_distance:new o.aJ(_,i.u_camera_to_center_distance),u_viewport_size:new o.aP(_,i.u_viewport_size)}),debug:(_,i)=>({u_color:new o.aM(_,i.u_color),u_matrix:new o.aK(_,i.u_matrix),u_overlay:new o.aI(_,i.u_overlay),u_overlay_scale:new o.aJ(_,i.u_overlay_scale)}),clippingMask:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix)}),heatmap:(_,i)=>({u_extrude_scale:new o.aJ(_,i.u_extrude_scale),u_intensity:new o.aJ(_,i.u_intensity),u_matrix:new o.aK(_,i.u_matrix)}),heatmapTexture:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_world:new o.aP(_,i.u_world),u_image:new o.aI(_,i.u_image),u_color_ramp:new o.aI(_,i.u_color_ramp),u_opacity:new o.aJ(_,i.u_opacity)}),hillshade:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_image:new o.aI(_,i.u_image),u_latrange:new o.aP(_,i.u_latrange),u_light:new o.aP(_,i.u_light),u_shadow:new o.aM(_,i.u_shadow),u_highlight:new o.aM(_,i.u_highlight),u_accent:new o.aM(_,i.u_accent)}),hillshadePrepare:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_image:new o.aI(_,i.u_image),u_dimension:new o.aP(_,i.u_dimension),u_zoom:new o.aJ(_,i.u_zoom),u_unpack:new o.aL(_,i.u_unpack)}),line:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_ratio:new o.aJ(_,i.u_ratio),u_device_pixel_ratio:new o.aJ(_,i.u_device_pixel_ratio),u_units_to_pixels:new o.aP(_,i.u_units_to_pixels)}),lineGradient:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_ratio:new o.aJ(_,i.u_ratio),u_device_pixel_ratio:new o.aJ(_,i.u_device_pixel_ratio),u_units_to_pixels:new o.aP(_,i.u_units_to_pixels),u_image:new o.aI(_,i.u_image),u_image_height:new o.aJ(_,i.u_image_height)}),linePattern:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_texsize:new o.aP(_,i.u_texsize),u_ratio:new o.aJ(_,i.u_ratio),u_device_pixel_ratio:new o.aJ(_,i.u_device_pixel_ratio),u_image:new o.aI(_,i.u_image),u_units_to_pixels:new o.aP(_,i.u_units_to_pixels),u_scale:new o.aO(_,i.u_scale),u_fade:new o.aJ(_,i.u_fade)}),lineSDF:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_ratio:new o.aJ(_,i.u_ratio),u_device_pixel_ratio:new o.aJ(_,i.u_device_pixel_ratio),u_units_to_pixels:new o.aP(_,i.u_units_to_pixels),u_patternscale_a:new o.aP(_,i.u_patternscale_a),u_patternscale_b:new o.aP(_,i.u_patternscale_b),u_sdfgamma:new o.aJ(_,i.u_sdfgamma),u_image:new o.aI(_,i.u_image),u_tex_y_a:new o.aJ(_,i.u_tex_y_a),u_tex_y_b:new o.aJ(_,i.u_tex_y_b),u_mix:new o.aJ(_,i.u_mix)}),raster:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_tl_parent:new o.aP(_,i.u_tl_parent),u_scale_parent:new o.aJ(_,i.u_scale_parent),u_buffer_scale:new o.aJ(_,i.u_buffer_scale),u_fade_t:new o.aJ(_,i.u_fade_t),u_opacity:new o.aJ(_,i.u_opacity),u_image0:new o.aI(_,i.u_image0),u_image1:new o.aI(_,i.u_image1),u_brightness_low:new o.aJ(_,i.u_brightness_low),u_brightness_high:new o.aJ(_,i.u_brightness_high),u_saturation_factor:new o.aJ(_,i.u_saturation_factor),u_contrast_factor:new o.aJ(_,i.u_contrast_factor),u_spin_weights:new o.aO(_,i.u_spin_weights)}),symbolIcon:(_,i)=>({u_is_size_zoom_constant:new o.aI(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new o.aI(_,i.u_is_size_feature_constant),u_size_t:new o.aJ(_,i.u_size_t),u_size:new o.aJ(_,i.u_size),u_camera_to_center_distance:new o.aJ(_,i.u_camera_to_center_distance),u_pitch:new o.aJ(_,i.u_pitch),u_rotate_symbol:new o.aI(_,i.u_rotate_symbol),u_aspect_ratio:new o.aJ(_,i.u_aspect_ratio),u_fade_change:new o.aJ(_,i.u_fade_change),u_matrix:new o.aK(_,i.u_matrix),u_label_plane_matrix:new o.aK(_,i.u_label_plane_matrix),u_coord_matrix:new o.aK(_,i.u_coord_matrix),u_is_text:new o.aI(_,i.u_is_text),u_pitch_with_map:new o.aI(_,i.u_pitch_with_map),u_is_along_line:new o.aI(_,i.u_is_along_line),u_is_variable_anchor:new o.aI(_,i.u_is_variable_anchor),u_texsize:new o.aP(_,i.u_texsize),u_texture:new o.aI(_,i.u_texture),u_translation:new o.aP(_,i.u_translation),u_pitched_scale:new o.aJ(_,i.u_pitched_scale)}),symbolSDF:(_,i)=>({u_is_size_zoom_constant:new o.aI(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new o.aI(_,i.u_is_size_feature_constant),u_size_t:new o.aJ(_,i.u_size_t),u_size:new o.aJ(_,i.u_size),u_camera_to_center_distance:new o.aJ(_,i.u_camera_to_center_distance),u_pitch:new o.aJ(_,i.u_pitch),u_rotate_symbol:new o.aI(_,i.u_rotate_symbol),u_aspect_ratio:new o.aJ(_,i.u_aspect_ratio),u_fade_change:new o.aJ(_,i.u_fade_change),u_matrix:new o.aK(_,i.u_matrix),u_label_plane_matrix:new o.aK(_,i.u_label_plane_matrix),u_coord_matrix:new o.aK(_,i.u_coord_matrix),u_is_text:new o.aI(_,i.u_is_text),u_pitch_with_map:new o.aI(_,i.u_pitch_with_map),u_is_along_line:new o.aI(_,i.u_is_along_line),u_is_variable_anchor:new o.aI(_,i.u_is_variable_anchor),u_texsize:new o.aP(_,i.u_texsize),u_texture:new o.aI(_,i.u_texture),u_gamma_scale:new o.aJ(_,i.u_gamma_scale),u_device_pixel_ratio:new o.aJ(_,i.u_device_pixel_ratio),u_is_halo:new o.aI(_,i.u_is_halo),u_translation:new o.aP(_,i.u_translation),u_pitched_scale:new o.aJ(_,i.u_pitched_scale)}),symbolTextAndIcon:(_,i)=>({u_is_size_zoom_constant:new o.aI(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new o.aI(_,i.u_is_size_feature_constant),u_size_t:new o.aJ(_,i.u_size_t),u_size:new o.aJ(_,i.u_size),u_camera_to_center_distance:new o.aJ(_,i.u_camera_to_center_distance),u_pitch:new o.aJ(_,i.u_pitch),u_rotate_symbol:new o.aI(_,i.u_rotate_symbol),u_aspect_ratio:new o.aJ(_,i.u_aspect_ratio),u_fade_change:new o.aJ(_,i.u_fade_change),u_matrix:new o.aK(_,i.u_matrix),u_label_plane_matrix:new o.aK(_,i.u_label_plane_matrix),u_coord_matrix:new o.aK(_,i.u_coord_matrix),u_is_text:new o.aI(_,i.u_is_text),u_pitch_with_map:new o.aI(_,i.u_pitch_with_map),u_is_along_line:new o.aI(_,i.u_is_along_line),u_is_variable_anchor:new o.aI(_,i.u_is_variable_anchor),u_texsize:new o.aP(_,i.u_texsize),u_texsize_icon:new o.aP(_,i.u_texsize_icon),u_texture:new o.aI(_,i.u_texture),u_texture_icon:new o.aI(_,i.u_texture_icon),u_gamma_scale:new o.aJ(_,i.u_gamma_scale),u_device_pixel_ratio:new o.aJ(_,i.u_device_pixel_ratio),u_is_halo:new o.aI(_,i.u_is_halo),u_translation:new o.aP(_,i.u_translation),u_pitched_scale:new o.aJ(_,i.u_pitched_scale)}),background:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_opacity:new o.aJ(_,i.u_opacity),u_color:new o.aM(_,i.u_color)}),backgroundPattern:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_opacity:new o.aJ(_,i.u_opacity),u_image:new o.aI(_,i.u_image),u_pattern_tl_a:new o.aP(_,i.u_pattern_tl_a),u_pattern_br_a:new o.aP(_,i.u_pattern_br_a),u_pattern_tl_b:new o.aP(_,i.u_pattern_tl_b),u_pattern_br_b:new o.aP(_,i.u_pattern_br_b),u_texsize:new o.aP(_,i.u_texsize),u_mix:new o.aJ(_,i.u_mix),u_pattern_size_a:new o.aP(_,i.u_pattern_size_a),u_pattern_size_b:new o.aP(_,i.u_pattern_size_b),u_scale_a:new o.aJ(_,i.u_scale_a),u_scale_b:new o.aJ(_,i.u_scale_b),u_pixel_coord_upper:new o.aP(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new o.aP(_,i.u_pixel_coord_lower),u_tile_units_to_pixels:new o.aJ(_,i.u_tile_units_to_pixels)}),terrain:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_texture:new o.aI(_,i.u_texture),u_ele_delta:new o.aJ(_,i.u_ele_delta),u_fog_matrix:new o.aK(_,i.u_fog_matrix),u_fog_color:new o.aM(_,i.u_fog_color),u_fog_ground_blend:new o.aJ(_,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new o.aJ(_,i.u_fog_ground_blend_opacity),u_horizon_color:new o.aM(_,i.u_horizon_color),u_horizon_fog_blend:new o.aJ(_,i.u_horizon_fog_blend)}),terrainDepth:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_ele_delta:new o.aJ(_,i.u_ele_delta)}),terrainCoords:(_,i)=>({u_matrix:new o.aK(_,i.u_matrix),u_texture:new o.aI(_,i.u_texture),u_terrain_coords_id:new o.aJ(_,i.u_terrain_coords_id),u_ele_delta:new o.aJ(_,i.u_ele_delta)}),sky:(_,i)=>({u_sky_color:new o.aM(_,i.u_sky_color),u_horizon_color:new o.aM(_,i.u_horizon_color),u_horizon:new o.aJ(_,i.u_horizon),u_sky_horizon_blend:new o.aJ(_,i.u_sky_horizon_blend)})};class Zh{constructor(i,u,p){this.context=i;let f=i.gl;this.buffer=f.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){let u=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),u.bufferSubData(u.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Xh={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class mo{constructor(i,u,p,f){this.length=u.length,this.attributes=p,this.itemSize=u.bytesPerElement,this.dynamicDraw=f,this.context=i;let x=i.gl;this.buffer=x.createBuffer(),i.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){if(i.length!==this.length)throw new Error(`Length of new data is ${i.length}, which doesn't match current length of ${this.length}`);let u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,u){for(let p=0;p<this.attributes.length;p++){let f=u.attributes[this.attributes[p].name];f!==void 0&&i.enableVertexAttribArray(f)}}setVertexAttribPointers(i,u,p){for(let f=0;f<this.attributes.length;f++){let x=this.attributes[f],E=u.attributes[x.name];E!==void 0&&i.vertexAttribPointer(E,x.components,i[Xh[x.type]],!1,this.itemSize,x.offset+this.itemSize*(p||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Hh=new WeakMap;function ya(_){var i;if(Hh.has(_))return Hh.get(_);{let u=(i=_.getParameter(_.VERSION))===null||i===void 0?void 0:i.startsWith("WebGL 2.0");return Hh.set(_,u),u}}class Nt{constructor(i){this.gl=i.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(i){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class fl extends Nt{getDefault(){return o.aN.transparent}set(i){let u=this.current;(i.r!==u.r||i.g!==u.g||i.b!==u.b||i.a!==u.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class e_ extends Nt{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class Lc extends Nt{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}class t_ extends Nt{getDefault(){return[!0,!0,!0,!0]}set(i){let u=this.current;(i[0]!==u[0]||i[1]!==u[1]||i[2]!==u[2]||i[3]!==u[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class _a extends Nt{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class r_ extends Nt{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class Cf extends Nt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){let u=this.current;(i.func!==u.func||i.ref!==u.ref||i.mask!==u.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class i_ extends Nt{getDefault(){let i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){let u=this.current;(i[0]!==u[0]||i[1]!==u[1]||i[2]!==u[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class Mf extends Nt{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let u=this.gl;i?u.enable(u.STENCIL_TEST):u.disable(u.STENCIL_TEST),this.current=i,this.dirty=!1}}class Kh extends Nt{getDefault(){return[0,1]}set(i){let u=this.current;(i[0]!==u[0]||i[1]!==u[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class Rf extends Nt{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let u=this.gl;i?u.enable(u.DEPTH_TEST):u.disable(u.DEPTH_TEST),this.current=i,this.dirty=!1}}class kf extends Nt{getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class Ff extends Nt{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let u=this.gl;i?u.enable(u.BLEND):u.disable(u.BLEND),this.current=i,this.dirty=!1}}class Lf extends Nt{getDefault(){let i=this.gl;return[i.ONE,i.ZERO]}set(i){let u=this.current;(i[0]!==u[0]||i[1]!==u[1]||this.dirty)&&(this.gl.blendFunc(i[0],i[1]),this.current=i,this.dirty=!1)}}class Bs extends Nt{getDefault(){return o.aN.transparent}set(i){let u=this.current;(i.r!==u.r||i.g!==u.g||i.b!==u.b||i.a!==u.a||this.dirty)&&(this.gl.blendColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class Df extends Nt{getDefault(){return this.gl.FUNC_ADD}set(i){(i!==this.current||this.dirty)&&(this.gl.blendEquation(i),this.current=i,this.dirty=!1)}}class n_ extends Nt{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let u=this.gl;i?u.enable(u.CULL_FACE):u.disable(u.CULL_FACE),this.current=i,this.dirty=!1}}class o_ extends Nt{getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class Of extends Nt{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}class ml extends Nt{getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}}class s_ extends Nt{getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class Dc extends Nt{getDefault(){let i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){let u=this.current;(i[0]!==u[0]||i[1]!==u[1]||i[2]!==u[2]||i[3]!==u[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class a_ extends Nt{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let u=this.gl;u.bindFramebuffer(u.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class l_ extends Nt{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let u=this.gl;u.bindRenderbuffer(u.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class zf extends Nt{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let u=this.gl;u.bindTexture(u.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class Bf extends Nt{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let u=this.gl;u.bindBuffer(u.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class Nf extends Nt{getDefault(){return null}set(i){let u=this.gl;u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class Yh extends Nt{getDefault(){return null}set(i){var u;if(i===this.current&&!this.dirty)return;let p=this.gl;ya(p)?p.bindVertexArray(i):(u=p.getExtension("OES_vertex_array_object"))===null||u===void 0||u.bindVertexArrayOES(i),this.current=i,this.dirty=!1}}class jf extends Nt{getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;let u=this.gl;u.pixelStorei(u.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class Oc extends Nt{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let u=this.gl;u.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class Mo extends Nt{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let u=this.gl;u.pixelStorei(u.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class gl extends Nt{constructor(i,u){super(i),this.context=i,this.parent=u}getDefault(){return null}}class Jh extends gl{setDirty(){this.dirty=!0}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let u=this.gl;u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class Qh extends gl{set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let u=this.gl;u.framebufferRenderbuffer(u.FRAMEBUFFER,u.DEPTH_ATTACHMENT,u.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Uf extends gl{set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let u=this.gl;u.framebufferRenderbuffer(u.FRAMEBUFFER,u.DEPTH_STENCIL_ATTACHMENT,u.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class ep{constructor(i,u,p,f,x){this.context=i,this.width=u,this.height=p;let E=i.gl,P=this.framebuffer=E.createFramebuffer();if(this.colorAttachment=new Jh(i,P),f)this.depthAttachment=x?new Uf(i,P):new Qh(i,P);else if(x)throw new Error("Stencil cannot be set without depth");if(E.checkFramebufferStatus(E.FRAMEBUFFER)!==E.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let i=this.context.gl,u=this.colorAttachment.get();if(u&&i.deleteTexture(u),this.depthAttachment){let p=this.depthAttachment.get();p&&i.deleteRenderbuffer(p)}i.deleteFramebuffer(this.framebuffer)}}class pr{constructor(i,u,p){this.blendFunction=i,this.blendColor=u,this.mask=p}}pr.Replace=[1,0],pr.disabled=new pr(pr.Replace,o.aN.transparent,[!1,!1,!1,!1]),pr.unblended=new pr(pr.Replace,o.aN.transparent,[!0,!0,!0,!0]),pr.alphaBlended=new pr([1,771],o.aN.transparent,[!0,!0,!0,!0]);class tp{constructor(i){var u,p;if(this.gl=i,this.clearColor=new fl(this),this.clearDepth=new e_(this),this.clearStencil=new Lc(this),this.colorMask=new t_(this),this.depthMask=new _a(this),this.stencilMask=new r_(this),this.stencilFunc=new Cf(this),this.stencilOp=new i_(this),this.stencilTest=new Mf(this),this.depthRange=new Kh(this),this.depthTest=new Rf(this),this.depthFunc=new kf(this),this.blend=new Ff(this),this.blendFunc=new Lf(this),this.blendColor=new Bs(this),this.blendEquation=new Df(this),this.cullFace=new n_(this),this.cullFaceSide=new o_(this),this.frontFace=new Of(this),this.program=new ml(this),this.activeTexture=new s_(this),this.viewport=new Dc(this),this.bindFramebuffer=new a_(this),this.bindRenderbuffer=new l_(this),this.bindTexture=new zf(this),this.bindVertexBuffer=new Bf(this),this.bindElementBuffer=new Nf(this),this.bindVertexArray=new Yh(this),this.pixelStoreUnpack=new jf(this),this.pixelStoreUnpackPremultiplyAlpha=new Oc(this),this.pixelStoreUnpackFlipY=new Mo(this),this.extTextureFilterAnisotropic=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=i.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),ya(i)){this.HALF_FLOAT=i.HALF_FLOAT;let f=i.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(u=i.RGBA16F)!==null&&u!==void 0?u:f?.RGBA16F_EXT,this.RGB16F=(p=i.RGB16F)!==null&&p!==void 0?p:f?.RGB16F_EXT,i.getExtension("EXT_color_buffer_float")}else{i.getExtension("EXT_color_buffer_half_float"),i.getExtension("OES_texture_half_float_linear");let f=i.getExtension("OES_texture_half_float");this.HALF_FLOAT=f?.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(i,u){return new Zh(this,i,u)}createVertexBuffer(i,u,p){return new mo(this,i,u,p)}createRenderbuffer(i,u,p){let f=this.gl,x=f.createRenderbuffer();return this.bindRenderbuffer.set(x),f.renderbufferStorage(f.RENDERBUFFER,i,u,p),this.bindRenderbuffer.set(null),x}createFramebuffer(i,u,p,f){return new ep(this,i,u,p,f)}clear({color:i,depth:u,stencil:p}){let f=this.gl,x=0;i&&(x|=f.COLOR_BUFFER_BIT,this.clearColor.set(i),this.colorMask.set([!0,!0,!0,!0])),u!==void 0&&(x|=f.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(u),this.depthMask.set(!0)),p!==void 0&&(x|=f.STENCIL_BUFFER_BIT,this.clearStencil.set(p),this.stencilMask.set(255)),f.clear(x)}setCullFace(i){i.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(i.mode),this.frontFace.set(i.frontFace))}setDepthMode(i){i.func!==this.gl.ALWAYS||i.mask?(this.depthTest.set(!0),this.depthFunc.set(i.func),this.depthMask.set(i.mask),this.depthRange.set(i.range)):this.depthTest.set(!1)}setStencilMode(i){i.test.func!==this.gl.ALWAYS||i.mask?(this.stencilTest.set(!0),this.stencilMask.set(i.mask),this.stencilOp.set([i.fail,i.depthFail,i.pass]),this.stencilFunc.set({func:i.test.func,ref:i.ref,mask:i.test.mask})):this.stencilTest.set(!1)}setColorMode(i){o.aF(i.blendFunction,pr.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor)),this.colorMask.set(i.mask)}createVertexArray(){var i;return ya(this.gl)?this.gl.createVertexArray():(i=this.gl.getExtension("OES_vertex_array_object"))===null||i===void 0?void 0:i.createVertexArrayOES()}deleteVertexArray(i){var u;return ya(this.gl)?this.gl.deleteVertexArray(i):(u=this.gl.getExtension("OES_vertex_array_object"))===null||u===void 0?void 0:u.deleteVertexArrayOES(i)}unbindVAO(){this.bindVertexArray.set(null)}}class Dt{constructor(i,u,p){this.func=i,this.mask=u,this.range=p}}Dt.ReadOnly=!1,Dt.ReadWrite=!0,Dt.disabled=new Dt(519,Dt.ReadOnly,[0,1]);let rp=7680;class Sr{constructor(i,u,p,f,x,E){this.test=i,this.ref=u,this.mask=p,this.fail=f,this.depthFail=x,this.pass=E}}Sr.disabled=new Sr({func:519,mask:0},0,0,rp,rp,rp);class gr{constructor(i,u,p){this.enable=i,this.mode=u,this.frontFace=p}}let yl;function Gf(_,i,u,p,f){let x=_.context,E=x.gl,P=_.useProgram("collisionBox"),T=[],R=0,O=0;for(let ne=0;ne<p.length;ne++){let ue=p[ne],ee=i.getTile(ue).getBucket(u);if(!ee)continue;let fe=f?ee.textCollisionBox:ee.iconCollisionBox,xe=ee.collisionCircleArray;if(xe.length>0){let we=o.H();o.aR(we,ee.placementInvProjMatrix,_.transform.glCoordMatrix),o.aR(we,we,ee.placementViewportMatrix),T.push({circleArray:xe,circleOffset:O,transform:ue.posMatrix,invTransform:we,coord:ue}),R+=xe.length/4,O=R}fe&&P.draw(x,E.LINES,Dt.disabled,Sr.disabled,_.colorModeForRenderPass(),gr.disabled,{u_matrix:ue.posMatrix,u_pixel_extrude_scale:[1/(D=_.transform).width,1/D.height]},_.style.map.terrain&&_.style.map.terrain.getTerrainData(ue),u.id,fe.layoutVertexBuffer,fe.indexBuffer,fe.segments,null,_.transform.zoom,null,null,fe.collisionVertexBuffer)}var D;if(!f||!T.length)return;let G=_.useProgram("collisionCircle"),W=new o.aS;W.resize(4*R),W._trim();let K=0;for(let ne of T)for(let ue=0;ue<ne.circleArray.length/4;ue++){let ee=4*ue,fe=ne.circleArray[ee+0],xe=ne.circleArray[ee+1],we=ne.circleArray[ee+2],Me=ne.circleArray[ee+3];W.emplace(K++,fe,xe,we,Me,0),W.emplace(K++,fe,xe,we,Me,1),W.emplace(K++,fe,xe,we,Me,2),W.emplace(K++,fe,xe,we,Me,3)}(!yl||yl.length<2*R)&&(yl=function(ne){let ue=2*ne,ee=new o.aU;ee.resize(ue),ee._trim();for(let fe=0;fe<ue;fe++){let xe=6*fe;ee.uint16[xe+0]=4*fe+0,ee.uint16[xe+1]=4*fe+1,ee.uint16[xe+2]=4*fe+2,ee.uint16[xe+3]=4*fe+2,ee.uint16[xe+4]=4*fe+3,ee.uint16[xe+5]=4*fe+0}return ee}(R));let re=x.createIndexBuffer(yl,!0),Y=x.createVertexBuffer(W,o.aT.members,!0);for(let ne of T){let ue=Ky(ne.transform,ne.invTransform,_.transform);G.draw(x,E.TRIANGLES,Dt.disabled,Sr.disabled,_.colorModeForRenderPass(),gr.disabled,ue,_.style.map.terrain&&_.style.map.terrain.getTerrainData(ne.coord),u.id,Y,re,o.a0.simpleSegment(0,2*ne.circleOffset,ne.circleArray.length,ne.circleArray.length/2),null,_.transform.zoom,null,null,null)}Y.destroy(),re.destroy()}gr.disabled=new gr(!1,1029,2305),gr.backCCW=new gr(!0,1029,2305);let ip=o.ao(new Float32Array(16));function zc(_,i,u,p,f,x){let{horizontalAlign:E,verticalAlign:P}=o.av(_);return new o.P((-(E-.5)*i/f+p[0])*x,(-(P-.5)*u/f+p[1])*x)}function Bc(_,i,u,p,f,x){let E=i.tileAnchorPoint.add(new o.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let P=p.mult(x);return u||(P=P.rotate(-f)),ie(E.add(P),i.labelPlaneMatrix,i.getElevation).point}if(u){let P=Se(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(_),T=Math.atan(P.y/P.x)+(P.x<0?Math.PI:0);return _.add(p.rotate(T))}return _.add(p)}function Nc(_,i,u,p,f,x,E,P,T,R,O,D,G,W){let K=_.text.placedSymbolArray,re=_.text.dynamicLayoutVertexArray,Y=_.icon.dynamicLayoutVertexArray,ne={};re.clear();for(let ue=0;ue<K.length;ue++){let ee=K.get(ue),fe=ee.hidden||!ee.crossTileID||_.allowVerticalPlacement&&!ee.placedOrientation?null:p[ee.crossTileID];if(fe){let xe=new o.P(ee.anchorX,ee.anchorY),we={getElevation:W,width:f.width,height:f.height,labelPlaneMatrix:x,lineVertexArray:null,pitchWithMap:u,projection:O,projectionCache:null,tileAnchorPoint:xe,translation:D,unwrappedTileID:G},Me=u?ie(xe,E,W):Se(xe.x,xe.y,we),Oe=N(f.cameraToCenterDistance,Me.signedDistanceFromCamera),Ye=o.aj(_.textSizeData,T,ee)*Oe/o.aq;u&&(Ye*=_.tilePixelRatio/P);let{width:Je,height:ze,anchor:Ne,textOffset:it,textBoxScale:St}=fe,Ge=zc(Ne,Je,ze,it,St,Ye),Ze=O.getPitchedTextCorrection(f,xe.add(new o.P(D[0],D[1])),G),_t=Bc(Me.point,we,i,Ge,f.angle,Ze),_r=_.allowVerticalPlacement&&ee.placedOrientation===o.ai.vertical?Math.PI/2:0;for(let kt=0;kt<ee.numGlyphs;kt++)o.ak(re,_t,_r);R&&ee.associatedIconIndex>=0&&(ne[ee.associatedIconIndex]={shiftedAnchor:_t,angle:_r})}else ot(ee.numGlyphs,re)}if(R){Y.clear();let ue=_.icon.placedSymbolArray;for(let ee=0;ee<ue.length;ee++){let fe=ue.get(ee);if(fe.hidden)ot(fe.numGlyphs,Y);else{let xe=ne[ee];if(xe)for(let we=0;we<fe.numGlyphs;we++)o.ak(Y,xe.shiftedAnchor,xe.angle);else ot(fe.numGlyphs,Y)}}_.icon.dynamicLayoutVertexBuffer.updateData(Y)}_.text.dynamicLayoutVertexBuffer.updateData(re)}function np(_,i,u){return u.iconsInText&&i?"symbolTextAndIcon":_?"symbolSDF":"symbolIcon"}function is(_,i,u,p,f,x,E,P,T,R,O,D){let G=_.context,W=G.gl,K=_.transform,re=Ac(),Y=P==="map",ne=T==="map",ue=P!=="viewport"&&u.layout.get("symbol-placement")!=="point",ee=Y&&!ne&&!ue,fe=!ne&&ue,xe=!u.layout.get("symbol-sort-key").isConstant(),we=!1,Me=_.depthModeForSublayer(0,Dt.ReadOnly),Oe=u._unevaluatedLayout.hasValue("text-variable-anchor")||u._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Ye=[],Je=re.getCircleRadiusCorrection(K);for(let ze of p){let Ne=i.getTile(ze),it=Ne.getBucket(u);if(!it)continue;let St=f?it.text:it.icon;if(!St||!St.segments.get().length||!St.hasVisibleVertices)continue;let Ge=St.programConfigurations.get(u.id),Ze=f||it.sdfIcons,_t=f?it.textSizeData:it.iconSizeData,_r=ne||K.pitch!==0,kt=_.useProgram(np(Ze,f,it),Ge),Ot=o.ah(_t,K.zoom),xr=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ze),di,Qn,vr,tn,Oi=[0,0],fi=null;if(f)Qn=Ne.glyphAtlasTexture,vr=W.LINEAR,di=Ne.glyphAtlasTexture.size,it.iconsInText&&(Oi=Ne.imageAtlasTexture.size,fi=Ne.imageAtlasTexture,tn=_r||_.options.rotating||_.options.zooming||_t.kind==="composite"||_t.kind==="camera"?W.LINEAR:W.NEAREST);else{let Er=u.layout.get("icon-size").constantOr(0)!==1||it.iconsNeedLinear;Qn=Ne.imageAtlasTexture,vr=Ze||_.options.rotating||_.options.zooming||Er||_r?W.LINEAR:W.NEAREST,di=Ne.imageAtlasTexture.size}let mi=It(Ne,1,_.transform.zoom),eo=fe?ze.posMatrix:ip,Ws=Kn(eo,ne,Y,_.transform,mi),eu=Qi(eo,ne,Y,_.transform,mi),Pa=Qi(ze.posMatrix,ne,Y,_.transform,mi),Zs=re.translatePosition(_.transform,Ne,x,E),tu=Oe&&it.hasTextData(),Dp=u.layout.get("icon-text-fit")!=="none"&&tu&&it.hasIconData();if(ue){let Er=_.style.map.terrain?(Op,$r)=>_.style.map.terrain.getElevation(ze,Op,$r):null,Ca=u.layout.get("text-rotation-alignment")==="map";$(it,ze.posMatrix,_,f,Ws,Pa,ne,R,Ca,re,ze.toUnwrapped(),K.width,K.height,Zs,Er)}let ni=ze.posMatrix,to=f&&Oe||Dp,ss=ue||to?ip:Ws,Ta=eu,gi=Ze&&u.paint.get(f?"text-halo-width":"icon-halo-width").constantOr(1)!==0,yi;yi=Ze?it.iconsInText?Qy(_t.kind,Ot,ee,ne,ue,to,_,ni,ss,Ta,Zs,di,Oi,Je):Tf(_t.kind,Ot,ee,ne,ue,to,_,ni,ss,Ta,Zs,f,di,!0,Je):Pf(_t.kind,Ot,ee,ne,ue,to,_,ni,ss,Ta,Zs,f,di,Je);let Hr={program:kt,buffers:St,uniformValues:yi,atlasTexture:Qn,atlasTextureIcon:fi,atlasInterpolation:vr,atlasInterpolationIcon:tn,isSDF:Ze,hasHalo:gi};if(xe&&it.canOverlap){we=!0;let Er=St.segments.get();for(let Ca of Er)Ye.push({segments:new o.a0([Ca]),sortKey:Ca.sortKey,state:Hr,terrainData:xr})}else Ye.push({segments:St.segments,sortKey:0,state:Hr,terrainData:xr})}we&&Ye.sort((ze,Ne)=>ze.sortKey-Ne.sortKey);for(let ze of Ye){let Ne=ze.state;if(G.activeTexture.set(W.TEXTURE0),Ne.atlasTexture.bind(Ne.atlasInterpolation,W.CLAMP_TO_EDGE),Ne.atlasTextureIcon&&(G.activeTexture.set(W.TEXTURE1),Ne.atlasTextureIcon&&Ne.atlasTextureIcon.bind(Ne.atlasInterpolationIcon,W.CLAMP_TO_EDGE)),Ne.isSDF){let it=Ne.uniformValues;Ne.hasHalo&&(it.u_is_halo=1,Ns(Ne.buffers,ze.segments,u,_,Ne.program,Me,O,D,it,ze.terrainData)),it.u_is_halo=0}Ns(Ne.buffers,ze.segments,u,_,Ne.program,Me,O,D,Ne.uniformValues,ze.terrainData)}}function Ns(_,i,u,p,f,x,E,P,T,R){let O=p.context;f.draw(O,O.gl.TRIANGLES,x,E,P,gr.disabled,T,R,u.id,_.layoutVertexBuffer,_.indexBuffer,i,u.paint,p.transform.zoom,_.programConfigurations.get(u.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function bn(_,i,u,p,f){if(!u||!p||!p.imageAtlas)return;let x=p.imageAtlas.patternPositions,E=x[u.to.toString()],P=x[u.from.toString()];if(!E&&P&&(E=P),!P&&E&&(P=E),!E||!P){let T=f.getPaintProperty(i);E=x[T],P=x[T]}E&&P&&_.setConstantPatternPositions(E,P)}function op(_,i,u,p,f,x,E){let P=_.context.gl,T="fill-pattern",R=u.paint.get(T),O=R&&R.constantOr(1),D=u.getCrossfadeParameters(),G,W,K,re,Y;E?(W=O&&!u.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",G=P.LINES):(W=O?"fillPattern":"fill",G=P.TRIANGLES);let ne=R.constantOr(null);for(let ue of p){let ee=i.getTile(ue);if(O&&!ee.patternsLoaded())continue;let fe=ee.getBucket(u);if(!fe)continue;let xe=fe.programConfigurations.get(u.id),we=_.useProgram(W,xe),Me=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ue);O&&(_.context.activeTexture.set(P.TEXTURE0),ee.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),xe.updatePaintBuffers(D)),bn(xe,T,ne,ee,u);let Oe=Me?ue:null,Ye=_.translatePosMatrix(Oe?Oe.posMatrix:ue.posMatrix,ee,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));if(E){re=fe.indexBuffer2,Y=fe.segments2;let Je=[P.drawingBufferWidth,P.drawingBufferHeight];K=W==="fillOutlinePattern"&&O?Hy(Ye,_,D,ee,Je):Xy(Ye,Je)}else re=fe.indexBuffer,Y=fe.segments,K=O?ga(Ye,_,D,ee):hl(Ye);we.draw(_.context,G,f,_.stencilModeForClipping(ue),x,gr.disabled,K,Me,u.id,fe.layoutVertexBuffer,re,Y,u.paint,_.transform.zoom,xe)}}function jc(_,i,u,p,f,x,E){let P=_.context,T=P.gl,R="fill-extrusion-pattern",O=u.paint.get(R),D=O.constantOr(1),G=u.getCrossfadeParameters(),W=u.paint.get("fill-extrusion-opacity"),K=O.constantOr(null);for(let re of p){let Y=i.getTile(re),ne=Y.getBucket(u);if(!ne)continue;let ue=_.style.map.terrain&&_.style.map.terrain.getTerrainData(re),ee=ne.programConfigurations.get(u.id),fe=_.useProgram(D?"fillExtrusionPattern":"fillExtrusion",ee);D&&(_.context.activeTexture.set(T.TEXTURE0),Y.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ee.updatePaintBuffers(G)),bn(ee,R,K,Y,u);let xe=_.translatePosMatrix(re.posMatrix,Y,u.paint.get("fill-extrusion-translate"),u.paint.get("fill-extrusion-translate-anchor")),we=u.paint.get("fill-extrusion-vertical-gradient"),Me=D?Mc(xe,_,we,W,re,G,Y):Cc(xe,_,we,W);fe.draw(P,P.gl.TRIANGLES,f,x,E,gr.backCCW,Me,ue,u.id,ne.layoutVertexBuffer,ne.indexBuffer,ne.segments,u.paint,_.transform.zoom,ee,_.style.map.terrain&&ne.centroidVertexBuffer)}}function sp(_,i,u,p,f,x,E){let P=_.context,T=P.gl,R=u.fbo;if(!R)return;let O=_.useProgram("hillshade"),D=_.style.map.terrain&&_.style.map.terrain.getTerrainData(i);P.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,R.colorAttachment.get()),O.draw(P,T.TRIANGLES,f,x,E,gr.disabled,((G,W,K,re)=>{let Y=K.paint.get("hillshade-shadow-color"),ne=K.paint.get("hillshade-highlight-color"),ue=K.paint.get("hillshade-accent-color"),ee=K.paint.get("hillshade-illumination-direction")*(Math.PI/180);K.paint.get("hillshade-illumination-anchor")==="viewport"&&(ee-=G.transform.angle);let fe=!G.options.moving;return{u_matrix:re?re.posMatrix:G.transform.calculatePosMatrix(W.tileID.toUnwrapped(),fe),u_image:0,u_latrange:vn(0,W.tileID),u_light:[K.paint.get("hillshade-exaggeration"),ee],u_shadow:Y,u_highlight:ne,u_accent:ue}})(_,u,p,D?i:null),D,p.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function js(_,i,u,p,f,x){let E=_.context,P=E.gl,T=i.dem;if(T&&T.data){let R=T.dim,O=T.stride,D=T.getPixels();if(E.activeTexture.set(P.TEXTURE1),E.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||_.getTileTexture(O),i.demTexture){let W=i.demTexture;W.update(D,{premultiply:!1}),W.bind(P.NEAREST,P.CLAMP_TO_EDGE)}else i.demTexture=new Ae(E,D,P.RGBA,{premultiply:!1}),i.demTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE);E.activeTexture.set(P.TEXTURE0);let G=i.fbo;if(!G){let W=new Ae(E,{width:R,height:R,data:null},P.RGBA);W.bind(P.LINEAR,P.CLAMP_TO_EDGE),G=i.fbo=E.createFramebuffer(R,R,!0,!1),G.colorAttachment.set(W.texture)}E.bindFramebuffer.set(G.framebuffer),E.viewport.set([0,0,R,R]),_.useProgram("hillshadePrepare").draw(E,P.TRIANGLES,p,f,x,gr.disabled,((W,K)=>{let re=K.stride,Y=o.H();return o.aQ(Y,0,o.X,-o.X,0,0,1),o.J(Y,Y,[0,-o.X,0]),{u_matrix:Y,u_image:1,u_dimension:[re,re],u_zoom:W.overscaledZ,u_unpack:K.getUnpackVector()}})(i.tileID,T),null,u.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function Uc(_,i,u,p,f,x){let E=p.paint.get("raster-fade-duration");if(!x&&E>0){let P=A.now(),T=(P-_.timeAdded)/E,R=i?(P-i.timeAdded)/E:-1,O=u.getSource(),D=f.coveringZoomLevel({tileSize:O.tileSize,roundZoom:O.roundZoom}),G=!i||Math.abs(i.tileID.overscaledZ-D)>Math.abs(_.tileID.overscaledZ-D),W=G&&_.refreshedUponExpiration?1:o.ad(G?T:1-R,0,1);return _.refreshedUponExpiration&&T>=1&&(_.refreshedUponExpiration=!1),i?{opacity:1,mix:1-W}:{opacity:W,mix:0}}return{opacity:1,mix:0}}let Gc=new o.aN(1,0,0,1),_l=new o.aN(0,1,0,1),Vc=new o.aN(0,0,1,1),Vf=new o.aN(1,0,1,1),xa=new o.aN(0,1,1,1);function Us(_,i,u,p){va(_,0,i+u/2,_.transform.width,u,p)}function ap(_,i,u,p){va(_,i-u/2,0,u,_.transform.height,p)}function va(_,i,u,p,f,x){let E=_.context,P=E.gl;P.enable(P.SCISSOR_TEST),P.scissor(i*_.pixelRatio,u*_.pixelRatio,p*_.pixelRatio,f*_.pixelRatio),E.clear({color:x}),P.disable(P.SCISSOR_TEST)}function Vt(_,i,u){let p=_.context,f=p.gl,x=u.posMatrix,E=_.useProgram("debug"),P=Dt.disabled,T=Sr.disabled,R=_.colorModeForRenderPass(),O="$debug",D=_.style.map.terrain&&_.style.map.terrain.getTerrainData(u);p.activeTexture.set(f.TEXTURE0);let G=i.getTileByID(u.key).latestRawTileData,W=Math.floor((G&&G.byteLength||0)/1024),K=i.getTile(u).tileSize,re=512/Math.min(K,512)*(u.overscaledZ/_.transform.zoom)*.5,Y=u.canonical.toString();u.overscaledZ!==u.canonical.z&&(Y+=` => ${u.overscaledZ}`),function(ne,ue){ne.initDebugOverlayCanvas();let ee=ne.debugOverlayCanvas,fe=ne.context.gl,xe=ne.debugOverlayCanvas.getContext("2d");xe.clearRect(0,0,ee.width,ee.height),xe.shadowColor="white",xe.shadowBlur=2,xe.lineWidth=1.5,xe.strokeStyle="white",xe.textBaseline="top",xe.font="bold 36px Open Sans, sans-serif",xe.fillText(ue,5,5),xe.strokeText(ue,5,5),ne.debugOverlayTexture.update(ee),ne.debugOverlayTexture.bind(fe.LINEAR,fe.CLAMP_TO_EDGE)}(_,`${Y} ${W}kB`),E.draw(p,f.TRIANGLES,P,T,pr.alphaBlended,gr.disabled,rs(x,o.aN.transparent,re),null,O,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),E.draw(p,f.LINE_STRIP,P,T,R,gr.disabled,rs(x,o.aN.red),D,O,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function xl(_,i,u){let p=_.context,f=p.gl,x=_.colorModeForRenderPass(),E=new Dt(f.LEQUAL,Dt.ReadWrite,_.depthRangeFor3D),P=_.useProgram("terrain"),T=i.getTerrainMesh();p.bindFramebuffer.set(null),p.viewport.set([0,0,_.width,_.height]);for(let R of u){let O=_.renderToTexture.getTexture(R),D=i.getTerrainData(R.tileID);p.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,O.texture);let G=_.transform.calculatePosMatrix(R.tileID.toUnwrapped()),W=i.getMeshFrameDelta(_.transform.zoom),K=_.transform.calculateFogMatrix(R.tileID.toUnwrapped()),re=$h(G,W,K,_.style.sky,_.transform.pitch);P.draw(p,f.TRIANGLES,E,Sr.disabled,x,gr.backCCW,re,D,"terrain",T.vertexBuffer,T.indexBuffer,T.segments)}}class qf{constructor(i,u,p){this.vertexBuffer=i,this.indexBuffer=u,this.segments=p}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class $f{constructor(i,u){this.context=new tp(i),this.transform=u,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ft.maxUnderzooming+ft.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Mn}resize(i,u,p){if(this.width=Math.floor(i*p),this.height=Math.floor(u*p),this.pixelRatio=p,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let f of this.style._order)this.style._layers[f].resize()}setup(){let i=this.context,u=new o.aX;u.emplaceBack(0,0),u.emplaceBack(o.X,0),u.emplaceBack(0,o.X),u.emplaceBack(o.X,o.X),this.tileExtentBuffer=i.createVertexBuffer(u,cl.members),this.tileExtentSegments=o.a0.simpleSegment(0,0,4,2);let p=new o.aX;p.emplaceBack(0,0),p.emplaceBack(o.X,0),p.emplaceBack(0,o.X),p.emplaceBack(o.X,o.X),this.debugBuffer=i.createVertexBuffer(p,cl.members),this.debugSegments=o.a0.simpleSegment(0,0,4,5);let f=new o.$;f.emplaceBack(0,0,0,0),f.emplaceBack(o.X,0,o.X,0),f.emplaceBack(0,o.X,0,o.X),f.emplaceBack(o.X,o.X,o.X,o.X),this.rasterBoundsBuffer=i.createVertexBuffer(f,Tn.members),this.rasterBoundsSegments=o.a0.simpleSegment(0,0,4,2);let x=new o.aX;x.emplaceBack(0,0),x.emplaceBack(1,0),x.emplaceBack(0,1),x.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(x,cl.members),this.viewportSegments=o.a0.simpleSegment(0,0,4,2);let E=new o.aZ;E.emplaceBack(0),E.emplaceBack(1),E.emplaceBack(3),E.emplaceBack(2),E.emplaceBack(0),this.tileBorderIndexBuffer=i.createIndexBuffer(E);let P=new o.aY;P.emplaceBack(0,1,2),P.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(P);let T=this.context.gl;this.stencilClearMode=new Sr({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO)}clearStencil(){let i=this.context,u=i.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let p=o.H();o.aQ(p,0,this.width,this.height,0,0,1),o.K(p,p,[u.drawingBufferWidth,u.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(i,u.TRIANGLES,Dt.disabled,this.stencilClearMode,pr.disabled,gr.disabled,pl(p),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(i,u){if(this.currentStencilSource===i.source||!i.isTileClipped()||!u||!u.length)return;this.currentStencilSource=i.source;let p=this.context,f=p.gl;this.nextStencilID+u.length>256&&this.clearStencil(),p.setColorMode(pr.disabled),p.setDepthMode(Dt.disabled);let x=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let E of u){let P=this._tileClippingMaskIDs[E.key]=this.nextStencilID++,T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(E);x.draw(p,f.TRIANGLES,Dt.disabled,new Sr({func:f.ALWAYS,mask:0},P,255,f.KEEP,f.KEEP,f.REPLACE),pr.disabled,gr.disabled,pl(E.posMatrix),T,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let i=this.nextStencilID++,u=this.context.gl;return new Sr({func:u.NOTEQUAL,mask:255},i,255,u.KEEP,u.KEEP,u.REPLACE)}stencilModeForClipping(i){let u=this.context.gl;return new Sr({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,u.KEEP,u.KEEP,u.REPLACE)}stencilConfigForOverlap(i){let u=this.context.gl,p=i.sort((E,P)=>P.overscaledZ-E.overscaledZ),f=p[p.length-1].overscaledZ,x=p[0].overscaledZ-f+1;if(x>1){this.currentStencilSource=void 0,this.nextStencilID+x>256&&this.clearStencil();let E={};for(let P=0;P<x;P++)E[P+f]=new Sr({func:u.GEQUAL,mask:255},P+this.nextStencilID,255,u.KEEP,u.KEEP,u.REPLACE);return this.nextStencilID+=x,[E,p]}return[{[f]:Sr.disabled},p]}colorModeForRenderPass(){let i=this.context.gl;return this._showOverdrawInspector?new pr([i.CONSTANT_COLOR,i.ONE],new o.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?pr.unblended:pr.alphaBlended}depthModeForSublayer(i,u,p){if(!this.opaquePassEnabledForLayer())return Dt.disabled;let f=1-((1+this.currentLayer)*this.numSublayers+i)*this.depthEpsilon;return new Dt(p||this.context.gl.LEQUAL,u,[f,f])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(i,u){this.style=i,this.options=u,this.lineAtlas=i.lineAtlas,this.imageManager=i.imageManager,this.glyphManager=i.glyphManager,this.symbolFadeChange=i.placement.symbolFadeChange(A.now()),this.imageManager.beginFrame();let p=this.style._order,f=this.style.sourceCaches,x={},E={},P={};for(let T in f){let R=f[T];R.used&&R.prepare(this.context),x[T]=R.getVisibleCoordinates(),E[T]=x[T].slice().reverse(),P[T]=R.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let T=0;T<p.length;T++)if(this.style._layers[p[T]].is3D()){this.opaquePassCutoff=T;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let T of p){let R=this.style._layers[T];if(!R.hasOffscreenPass()||R.isHidden(this.transform.zoom))continue;let O=E[R.source];(R.type==="custom"||O.length)&&this.renderLayer(this,f[R.source],R,O)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:u.showOverdrawInspector?o.aN.black:o.aN.transparent,depth:1}),this.clearStencil(),this.style.stylesheet.sky&&function(T,R){let O=T.context,D=O.gl,G=((ne,ue,ee)=>({u_sky_color:ne.properties.get("sky-color"),u_horizon_color:ne.properties.get("horizon-color"),u_horizon:(ue.height/2+ue.getHorizon())*ee,u_sky_horizon_blend:ne.properties.get("sky-horizon-blend")*ue.height/2*ee}))(R,T.style.map.transform,T.pixelRatio),W=new Dt(D.LEQUAL,Dt.ReadWrite,[0,1]),K=Sr.disabled,re=T.colorModeForRenderPass(),Y=T.useProgram("sky");if(!R.mesh){let ne=new o.aX;ne.emplaceBack(-1,-1),ne.emplaceBack(1,-1),ne.emplaceBack(1,1),ne.emplaceBack(-1,1);let ue=new o.aY;ue.emplaceBack(0,1,2),ue.emplaceBack(0,2,3),R.mesh=new qf(O.createVertexBuffer(ne,cl.members),O.createIndexBuffer(ue),o.a0.simpleSegment(0,0,ne.length,ue.length))}Y.draw(O,D.TRIANGLES,W,K,re,gr.disabled,G,void 0,"sky",R.mesh.vertexBuffer,R.mesh.indexBuffer,R.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=u.showOverdrawInspector,this.depthRangeFor3D=[0,1-(i._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=p.length-1;this.currentLayer>=0;this.currentLayer--){let T=this.style._layers[p[this.currentLayer]],R=f[T.source],O=x[T.source];this._renderTileClippingMasks(T,O),this.renderLayer(this,R,T,O)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<p.length;this.currentLayer++){let T=this.style._layers[p[this.currentLayer]],R=f[T.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(T))continue;let O=(T.type==="symbol"?P:E)[T.source];this._renderTileClippingMasks(T,x[T.source]),this.renderLayer(this,R,T,O)}if(this.options.showTileBoundaries){let T=function(R,O){let D=null,G=Object.values(R._layers).flatMap(Y=>Y.source&&!Y.isHidden(O)?[R.sourceCaches[Y.source]]:[]),W=G.filter(Y=>Y.getSource().type==="vector"),K=G.filter(Y=>Y.getSource().type!=="vector"),re=Y=>{(!D||D.getSource().maxzoom<Y.getSource().maxzoom)&&(D=Y)};return W.forEach(Y=>re(Y)),D||K.forEach(Y=>re(Y)),D}(this.style,this.transform.zoom);T&&function(R,O,D){for(let G=0;G<D.length;G++)Vt(R,O,D[G])}(this,T,T.getVisibleCoordinates())}this.options.showPadding&&function(T){let R=T.transform.padding;Us(T,T.transform.height-(R.top||0),3,Gc),Us(T,R.bottom||0,3,_l),ap(T,R.left||0,3,Vc),ap(T,T.transform.width-(R.right||0),3,Vf);let O=T.transform.centerPoint;(function(D,G,W,K){va(D,G-1,W-10,2,20,K),va(D,G-10,W-1,20,2,K)})(T,O.x,T.transform.height-O.y,xa)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(i){if(!this.style||!this.style.map||!this.style.map.terrain)return;let u=this.terrainFacilitator.matrix,p=this.transform.modelViewProjectionMatrix,f=this.terrainFacilitator.dirty;f||(f=i?!o.a_(u,p):!o.a$(u,p)),f||(f=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),f&&(o.b0(u,p),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(x,E){let P=x.context,T=P.gl,R=pr.unblended,O=new Dt(T.LEQUAL,Dt.ReadWrite,[0,1]),D=E.getTerrainMesh(),G=E.sourceCache.getRenderableTiles(),W=x.useProgram("terrainDepth");P.bindFramebuffer.set(E.getFramebuffer("depth").framebuffer),P.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),P.clear({color:o.aN.transparent,depth:1});for(let K of G){let re=E.getTerrainData(K.tileID),Y={u_matrix:x.transform.calculatePosMatrix(K.tileID.toUnwrapped()),u_ele_delta:E.getMeshFrameDelta(x.transform.zoom)};W.draw(P,T.TRIANGLES,O,Sr.disabled,R,gr.backCCW,Y,re,"terrain",D.vertexBuffer,D.indexBuffer,D.segments)}P.bindFramebuffer.set(null),P.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain),function(x,E){let P=x.context,T=P.gl,R=pr.unblended,O=new Dt(T.LEQUAL,Dt.ReadWrite,[0,1]),D=E.getTerrainMesh(),G=E.getCoordsTexture(),W=E.sourceCache.getRenderableTiles(),K=x.useProgram("terrainCoords");P.bindFramebuffer.set(E.getFramebuffer("coords").framebuffer),P.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),P.clear({color:o.aN.transparent,depth:1}),E.coordsIndex=[];for(let re of W){let Y=E.getTerrainData(re.tileID);P.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,G.texture);let ne={u_matrix:x.transform.calculatePosMatrix(re.tileID.toUnwrapped()),u_terrain_coords_id:(255-E.coordsIndex.length)/255,u_texture:0,u_ele_delta:E.getMeshFrameDelta(x.transform.zoom)};K.draw(P,T.TRIANGLES,O,Sr.disabled,R,gr.backCCW,ne,Y,"terrain",D.vertexBuffer,D.indexBuffer,D.segments),E.coordsIndex.push(re.tileID.key)}P.bindFramebuffer.set(null),P.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain))}renderLayer(i,u,p,f){if(!p.isHidden(this.transform.zoom)&&(p.type==="background"||p.type==="custom"||(f||[]).length))switch(this.id=p.id,p.type){case"symbol":(function(x,E,P,T,R){if(x.renderPass!=="translucent")return;let O=Sr.disabled,D=x.colorModeForRenderPass();(P._unevaluatedLayout.hasValue("text-variable-anchor")||P._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(G,W,K,re,Y,ne,ue,ee,fe){let xe=W.transform,we=Ac(),Me=Y==="map",Oe=ne==="map";for(let Ye of G){let Je=re.getTile(Ye),ze=Je.getBucket(K);if(!ze||!ze.text||!ze.text.segments.get().length)continue;let Ne=o.ah(ze.textSizeData,xe.zoom),it=It(Je,1,W.transform.zoom),St=Kn(Ye.posMatrix,Oe,Me,W.transform,it),Ge=K.layout.get("icon-text-fit")!=="none"&&ze.hasIconData();if(Ne){let Ze=Math.pow(2,xe.zoom-Je.tileID.overscaledZ),_t=W.style.map.terrain?(kt,Ot)=>W.style.map.terrain.getElevation(Ye,kt,Ot):null,_r=we.translatePosition(xe,Je,ue,ee);Nc(ze,Me,Oe,fe,xe,St,Ye.posMatrix,Ze,Ne,Ge,we,_r,Ye.toUnwrapped(),_t)}}}(T,x,P,E,P.layout.get("text-rotation-alignment"),P.layout.get("text-pitch-alignment"),P.paint.get("text-translate"),P.paint.get("text-translate-anchor"),R),P.paint.get("icon-opacity").constantOr(1)!==0&&is(x,E,P,T,!1,P.paint.get("icon-translate"),P.paint.get("icon-translate-anchor"),P.layout.get("icon-rotation-alignment"),P.layout.get("icon-pitch-alignment"),P.layout.get("icon-keep-upright"),O,D),P.paint.get("text-opacity").constantOr(1)!==0&&is(x,E,P,T,!0,P.paint.get("text-translate"),P.paint.get("text-translate-anchor"),P.layout.get("text-rotation-alignment"),P.layout.get("text-pitch-alignment"),P.layout.get("text-keep-upright"),O,D),E.map.showCollisionBoxes&&(Gf(x,E,P,T,!0),Gf(x,E,P,T,!1))})(i,u,p,f,this.style.placement.variableOffsets);break;case"circle":(function(x,E,P,T){if(x.renderPass!=="translucent")return;let R=P.paint.get("circle-opacity"),O=P.paint.get("circle-stroke-width"),D=P.paint.get("circle-stroke-opacity"),G=!P.layout.get("circle-sort-key").isConstant();if(R.constantOr(1)===0&&(O.constantOr(1)===0||D.constantOr(1)===0))return;let W=x.context,K=W.gl,re=x.depthModeForSublayer(0,Dt.ReadOnly),Y=Sr.disabled,ne=x.colorModeForRenderPass(),ue=[];for(let ee=0;ee<T.length;ee++){let fe=T[ee],xe=E.getTile(fe),we=xe.getBucket(P);if(!we)continue;let Me=we.programConfigurations.get(P.id),Oe=x.useProgram("circle",Me),Ye=we.layoutVertexBuffer,Je=we.indexBuffer,ze=x.style.map.terrain&&x.style.map.terrain.getTerrainData(fe),Ne={programConfiguration:Me,program:Oe,layoutVertexBuffer:Ye,indexBuffer:Je,uniformValues:Sf(x,fe,xe,P),terrainData:ze};if(G){let it=we.segments.get();for(let St of it)ue.push({segments:new o.a0([St]),sortKey:St.sortKey,state:Ne})}else ue.push({segments:we.segments,sortKey:0,state:Ne})}G&&ue.sort((ee,fe)=>ee.sortKey-fe.sortKey);for(let ee of ue){let{programConfiguration:fe,program:xe,layoutVertexBuffer:we,indexBuffer:Me,uniformValues:Oe,terrainData:Ye}=ee.state;xe.draw(W,K.TRIANGLES,re,Y,ne,gr.disabled,Oe,Ye,P.id,we,Me,ee.segments,P.paint,x.transform.zoom,fe)}})(i,u,p,f);break;case"heatmap":(function(x,E,P,T){if(P.paint.get("heatmap-opacity")!==0)if(x.renderPass==="offscreen"){let R=x.context,O=R.gl,D=Sr.disabled,G=new pr([O.ONE,O.ONE],o.aN.transparent,[!0,!0,!0,!0]);(function(W,K,re){let Y=W.gl;W.activeTexture.set(Y.TEXTURE1),W.viewport.set([0,0,K.width/4,K.height/4]);let ne=re.heatmapFbo;if(ne)Y.bindTexture(Y.TEXTURE_2D,ne.colorAttachment.get()),W.bindFramebuffer.set(ne.framebuffer);else{let ue=Y.createTexture();Y.bindTexture(Y.TEXTURE_2D,ue),Y.texParameteri(Y.TEXTURE_2D,Y.TEXTURE_WRAP_S,Y.CLAMP_TO_EDGE),Y.texParameteri(Y.TEXTURE_2D,Y.TEXTURE_WRAP_T,Y.CLAMP_TO_EDGE),Y.texParameteri(Y.TEXTURE_2D,Y.TEXTURE_MIN_FILTER,Y.LINEAR),Y.texParameteri(Y.TEXTURE_2D,Y.TEXTURE_MAG_FILTER,Y.LINEAR),ne=re.heatmapFbo=W.createFramebuffer(K.width/4,K.height/4,!1,!1),function(ee,fe,xe,we){var Me,Oe;let Ye=ee.gl,Je=(Me=ee.HALF_FLOAT)!==null&&Me!==void 0?Me:Ye.UNSIGNED_BYTE,ze=(Oe=ee.RGBA16F)!==null&&Oe!==void 0?Oe:Ye.RGBA;Ye.texImage2D(Ye.TEXTURE_2D,0,ze,fe.width/4,fe.height/4,0,Ye.RGBA,Je,null),we.colorAttachment.set(xe)}(W,K,ue,ne)}})(R,x,P),R.clear({color:o.aN.transparent});for(let W=0;W<T.length;W++){let K=T[W];if(E.hasRenderableParent(K))continue;let re=E.getTile(K),Y=re.getBucket(P);if(!Y)continue;let ne=Y.programConfigurations.get(P.id),ue=x.useProgram("heatmap",ne),{zoom:ee}=x.transform;ue.draw(R,O.TRIANGLES,Dt.disabled,D,G,gr.disabled,xn(K.posMatrix,re,ee,P.paint.get("heatmap-intensity")),null,P.id,Y.layoutVertexBuffer,Y.indexBuffer,Y.segments,P.paint,x.transform.zoom,ne)}R.viewport.set([0,0,x.width,x.height])}else x.renderPass==="translucent"&&(x.context.setColorMode(x.colorModeForRenderPass()),function(R,O){let D=R.context,G=D.gl,W=O.heatmapFbo;if(!W)return;D.activeTexture.set(G.TEXTURE0),G.bindTexture(G.TEXTURE_2D,W.colorAttachment.get()),D.activeTexture.set(G.TEXTURE1);let K=O.colorRampTexture;K||(K=O.colorRampTexture=new Ae(D,O.colorRamp,G.RGBA)),K.bind(G.LINEAR,G.CLAMP_TO_EDGE),R.useProgram("heatmapTexture").draw(D,G.TRIANGLES,Dt.disabled,Sr.disabled,R.colorModeForRenderPass(),gr.disabled,((re,Y,ne,ue)=>{let ee=o.H();o.aQ(ee,0,re.width,re.height,0,0,1);let fe=re.context.gl;return{u_matrix:ee,u_world:[fe.drawingBufferWidth,fe.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:Y.paint.get("heatmap-opacity")}})(R,O),null,O.id,R.viewportBuffer,R.quadTriangleIndexBuffer,R.viewportSegments,O.paint,R.transform.zoom)}(x,P))})(i,u,p,f);break;case"line":(function(x,E,P,T){if(x.renderPass!=="translucent")return;let R=P.paint.get("line-opacity"),O=P.paint.get("line-width");if(R.constantOr(1)===0||O.constantOr(1)===0)return;let D=x.depthModeForSublayer(0,Dt.ReadOnly),G=x.colorModeForRenderPass(),W=P.paint.get("line-dasharray"),K=P.paint.get("line-pattern"),re=K.constantOr(1),Y=P.paint.get("line-gradient"),ne=P.getCrossfadeParameters(),ue=re?"linePattern":W?"lineSDF":Y?"lineGradient":"line",ee=x.context,fe=ee.gl,xe=!0;for(let we of T){let Me=E.getTile(we);if(re&&!Me.patternsLoaded())continue;let Oe=Me.getBucket(P);if(!Oe)continue;let Ye=Oe.programConfigurations.get(P.id),Je=x.context.program.get(),ze=x.useProgram(ue,Ye),Ne=xe||ze.program!==Je,it=x.style.map.terrain&&x.style.map.terrain.getTerrainData(we),St=K.constantOr(null);if(St&&Me.imageAtlas){let _t=Me.imageAtlas,_r=_t.patternPositions[St.to.toString()],kt=_t.patternPositions[St.from.toString()];_r&&kt&&Ye.setConstantPatternPositions(_r,kt)}let Ge=it?we:null,Ze=re?Af(x,Me,P,ne,Ge):W?Ef(x,Me,P,W,ne,Ge):Y?Rc(x,Me,P,Oe.lineClipsArray.length,Ge):dl(x,Me,P,Ge);if(re)ee.activeTexture.set(fe.TEXTURE0),Me.imageAtlasTexture.bind(fe.LINEAR,fe.CLAMP_TO_EDGE),Ye.updatePaintBuffers(ne);else if(W&&(Ne||x.lineAtlas.dirty))ee.activeTexture.set(fe.TEXTURE0),x.lineAtlas.bind(ee);else if(Y){let _t=Oe.gradients[P.id],_r=_t.texture;if(P.gradientVersion!==_t.version){let kt=256;if(P.stepInterpolant){let Ot=E.getSource().maxzoom,xr=we.canonical.z===Ot?Math.ceil(1<<x.transform.maxZoom-we.canonical.z):1;kt=o.ad(o.aV(Oe.maxLineLength/o.X*1024*xr),256,ee.maxTextureSize)}_t.gradient=o.aW({expression:P.gradientExpression(),evaluationKey:"lineProgress",resolution:kt,image:_t.gradient||void 0,clips:Oe.lineClipsArray}),_t.texture?_t.texture.update(_t.gradient):_t.texture=new Ae(ee,_t.gradient,fe.RGBA),_t.version=P.gradientVersion,_r=_t.texture}ee.activeTexture.set(fe.TEXTURE0),_r.bind(P.stepInterpolant?fe.NEAREST:fe.LINEAR,fe.CLAMP_TO_EDGE)}ze.draw(ee,fe.TRIANGLES,D,x.stencilModeForClipping(we),G,gr.disabled,Ze,it,P.id,Oe.layoutVertexBuffer,Oe.indexBuffer,Oe.segments,P.paint,x.transform.zoom,Ye,Oe.layoutVertexBuffer2),xe=!1}})(i,u,p,f);break;case"fill":(function(x,E,P,T){let R=P.paint.get("fill-color"),O=P.paint.get("fill-opacity");if(O.constantOr(1)===0)return;let D=x.colorModeForRenderPass(),G=P.paint.get("fill-pattern"),W=x.opaquePassEnabledForLayer()&&!G.constantOr(1)&&R.constantOr(o.aN.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===W){let K=x.depthModeForSublayer(1,x.renderPass==="opaque"?Dt.ReadWrite:Dt.ReadOnly);op(x,E,P,T,K,D,!1)}if(x.renderPass==="translucent"&&P.paint.get("fill-antialias")){let K=x.depthModeForSublayer(P.getPaintProperty("fill-outline-color")?2:0,Dt.ReadOnly);op(x,E,P,T,K,D,!0)}})(i,u,p,f);break;case"fill-extrusion":(function(x,E,P,T){let R=P.paint.get("fill-extrusion-opacity");if(R!==0&&x.renderPass==="translucent"){let O=new Dt(x.context.gl.LEQUAL,Dt.ReadWrite,x.depthRangeFor3D);if(R!==1||P.paint.get("fill-extrusion-pattern").constantOr(1))jc(x,E,P,T,O,Sr.disabled,pr.disabled),jc(x,E,P,T,O,x.stencilModeFor3D(),x.colorModeForRenderPass());else{let D=x.colorModeForRenderPass();jc(x,E,P,T,O,Sr.disabled,D)}}})(i,u,p,f);break;case"hillshade":(function(x,E,P,T){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;let R=x.context,O=x.depthModeForSublayer(0,Dt.ReadOnly),D=x.colorModeForRenderPass(),[G,W]=x.renderPass==="translucent"?x.stencilConfigForOverlap(T):[{},T];for(let K of W){let re=E.getTile(K);re.needsHillshadePrepare!==void 0&&re.needsHillshadePrepare&&x.renderPass==="offscreen"?js(x,re,P,O,Sr.disabled,D):x.renderPass==="translucent"&&sp(x,K,re,P,O,G[K.overscaledZ],D)}R.viewport.set([0,0,x.width,x.height])})(i,u,p,f);break;case"raster":(function(x,E,P,T){if(x.renderPass!=="translucent"||P.paint.get("raster-opacity")===0||!T.length)return;let R=x.context,O=R.gl,D=E.getSource(),G=x.useProgram("raster"),W=x.colorModeForRenderPass(),[K,re]=D instanceof Yi?[{},T]:x.stencilConfigForOverlap(T),Y=re[re.length-1].overscaledZ,ne=!x.options.moving;for(let ue of re){let ee=x.depthModeForSublayer(ue.overscaledZ-Y,P.paint.get("raster-opacity")===1?Dt.ReadWrite:Dt.ReadOnly,O.LESS),fe=E.getTile(ue);fe.registerFadeDuration(P.paint.get("raster-fade-duration"));let xe=E.findLoadedParent(ue,0),we=E.findLoadedSibling(ue),Me=Uc(fe,xe||we||null,E,P,x.transform,x.style.map.terrain),Oe,Ye,Je=P.paint.get("raster-resampling")==="nearest"?O.NEAREST:O.LINEAR;R.activeTexture.set(O.TEXTURE0),fe.texture.bind(Je,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),R.activeTexture.set(O.TEXTURE1),xe?(xe.texture.bind(Je,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),Oe=Math.pow(2,xe.tileID.overscaledZ-fe.tileID.overscaledZ),Ye=[fe.tileID.canonical.x*Oe%1,fe.tileID.canonical.y*Oe%1]):fe.texture.bind(Je,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST);let ze=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ue),Ne=ze?ue:null,it=Ne?Ne.posMatrix:x.transform.calculatePosMatrix(ue.toUnwrapped(),ne),St=Yy(it,Ye||[0,0],Oe||1,Me,P);D instanceof Yi?G.draw(R,O.TRIANGLES,ee,Sr.disabled,W,gr.disabled,St,ze,P.id,D.boundsBuffer,x.quadTriangleIndexBuffer,D.boundsSegments):G.draw(R,O.TRIANGLES,ee,K[ue.overscaledZ],W,gr.disabled,St,ze,P.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}})(i,u,p,f);break;case"background":(function(x,E,P,T){let R=P.paint.get("background-color"),O=P.paint.get("background-opacity");if(O===0)return;let D=x.context,G=D.gl,W=x.transform,K=W.tileSize,re=P.paint.get("background-pattern");if(x.isPatternMissing(re))return;let Y=!re&&R.a===1&&O===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==Y)return;let ne=Sr.disabled,ue=x.depthModeForSublayer(0,Y==="opaque"?Dt.ReadWrite:Dt.ReadOnly),ee=x.colorModeForRenderPass(),fe=x.useProgram(re?"backgroundPattern":"background"),xe=T||W.coveringTiles({tileSize:K,terrain:x.style.map.terrain});re&&(D.activeTexture.set(G.TEXTURE0),x.imageManager.bind(x.context));let we=P.getCrossfadeParameters();for(let Me of xe){let Oe=T?Me.posMatrix:x.transform.calculatePosMatrix(Me.toUnwrapped()),Ye=re?Wh(Oe,O,x,re,{tileID:Me,tileSize:K},we):kc(Oe,O,R),Je=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Me);fe.draw(D,G.TRIANGLES,ue,ne,ee,gr.disabled,Ye,Je,P.id,x.tileExtentBuffer,x.quadTriangleIndexBuffer,x.tileExtentSegments)}})(i,0,p,f);break;case"custom":(function(x,E,P){let T=x.context,R=P.implementation;if(x.renderPass==="offscreen"){let O=R.prerender;O&&(x.setCustomLayerDefaults(),T.setColorMode(x.colorModeForRenderPass()),O.call(R,T.gl,x.transform.customLayerMatrix()),T.setDirty(),x.setBaseState())}else if(x.renderPass==="translucent"){x.setCustomLayerDefaults(),T.setColorMode(x.colorModeForRenderPass()),T.setStencilMode(Sr.disabled);let O=R.renderingMode==="3d"?new Dt(x.context.gl.LEQUAL,Dt.ReadWrite,x.depthRangeFor3D):x.depthModeForSublayer(0,Dt.ReadOnly);T.setDepthMode(O),R.render(T.gl,x.transform.customLayerMatrix()),T.setDirty(),x.setBaseState(),T.bindFramebuffer.set(null)}})(i,0,p)}}translatePosMatrix(i,u,p,f,x){if(!p[0]&&!p[1])return i;let E=x?f==="map"?this.transform.angle:0:f==="viewport"?-this.transform.angle:0;if(E){let R=Math.sin(E),O=Math.cos(E);p=[p[0]*O-p[1]*R,p[0]*R+p[1]*O]}let P=[x?p[0]:It(u,p[0],this.transform.zoom),x?p[1]:It(u,p[1],this.transform.zoom),0],T=new Float32Array(16);return o.J(T,i,P),T}saveTileTexture(i){let u=this._tileTextures[i.size[0]];u?u.push(i):this._tileTextures[i.size[0]]=[i]}getTileTexture(i){let u=this._tileTextures[i];return u&&u.length>0?u.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;let u=this.imageManager.getPattern(i.from.toString()),p=this.imageManager.getPattern(i.to.toString());return!u||!p}useProgram(i,u){this.cache=this.cache||{};let p=i+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[p]||(this.cache[p]=new Pc(this.context,ts[i],u,Fc[i],this._showOverdrawInspector,this.style.map.terrain)),this.cache[p]}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(){let i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ae(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:i,drawingBufferHeight:u}=this.context.gl;return this.width!==i||this.height!==u}}class Gs{constructor(i,u){this.points=i,this.planes=u}static fromInvProjectionMatrix(i,u,p){let f=Math.pow(2,p),x=[[-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(P=>{let T=1/(P=o.ag([],P,i))[3]/u*f;return o.b1(P,P,[T,T,1/P[3],T])}),E=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(P=>{let T=function(G,W){var K=W[0],re=W[1],Y=W[2],ne=K*K+re*re+Y*Y;return ne>0&&(ne=1/Math.sqrt(ne)),G[0]=W[0]*ne,G[1]=W[1]*ne,G[2]=W[2]*ne,G}([],function(G,W,K){var re=W[0],Y=W[1],ne=W[2],ue=K[0],ee=K[1],fe=K[2];return G[0]=Y*fe-ne*ee,G[1]=ne*ue-re*fe,G[2]=re*ee-Y*ue,G}([],de([],x[P[0]],x[P[1]]),de([],x[P[2]],x[P[1]]))),R=-((O=T)[0]*(D=x[P[1]])[0]+O[1]*D[1]+O[2]*D[2]);var O,D;return T.concat(R)});return new Gs(x,E)}}class qc{constructor(i,u){this.min=i,this.max=u,this.center=function(p,f,x){return p[0]=.5*f[0],p[1]=.5*f[1],p[2]=.5*f[2],p}([],function(p,f,x){return p[0]=f[0]+x[0],p[1]=f[1]+x[1],p[2]=f[2]+x[2],p}([],this.min,this.max))}quadrant(i){let u=[i%2==0,i<2],p=pe(this.min),f=pe(this.max);for(let x=0;x<u.length;x++)p[x]=u[x]?this.min[x]:this.center[x],f[x]=u[x]?this.center[x]:this.max[x];return f[2]=this.max[2],new qc(p,f)}distanceX(i){return Math.max(Math.min(this.max[0],i[0]),this.min[0])-i[0]}distanceY(i){return Math.max(Math.min(this.max[1],i[1]),this.min[1])-i[1]}intersects(i){let u=[[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]],p=!0;for(let f=0;f<i.planes.length;f++){let x=i.planes[f],E=0;for(let P=0;P<u.length;P++)o.b2(x,u[P])>=0&&E++;if(E===0)return 0;E!==u.length&&(p=!1)}if(p)return 2;for(let f=0;f<3;f++){let x=Number.MAX_VALUE,E=-Number.MAX_VALUE;for(let P=0;P<i.points.length;P++){let T=i.points[P][f]-this.min[f];x=Math.min(x,T),E=Math.max(E,T)}if(E<0||x>this.max[f]-this.min[f])return 0}return 1}}class $c{constructor(i=0,u=0,p=0,f=0){if(isNaN(i)||i<0||isNaN(u)||u<0||isNaN(p)||p<0||isNaN(f)||f<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=u,this.left=p,this.right=f}interpolate(i,u,p){return u.top!=null&&i.top!=null&&(this.top=o.z.number(i.top,u.top,p)),u.bottom!=null&&i.bottom!=null&&(this.bottom=o.z.number(i.bottom,u.bottom,p)),u.left!=null&&i.left!=null&&(this.left=o.z.number(i.left,u.left,p)),u.right!=null&&i.right!=null&&(this.right=o.z.number(i.right,u.right,p)),this}getCenter(i,u){let p=o.ad((this.left+i-this.right)/2,0,i),f=o.ad((this.top+u-this.bottom)/2,0,u);return new o.P(p,f)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new $c(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}let lp=85.051129;class cp{constructor(i,u,p,f,x){this.tileSize=512,this._renderWorldCopies=x===void 0||!!x,this._minZoom=i||0,this._maxZoom=u||22,this._minPitch=p??0,this._maxPitch=f??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new o.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new $c,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){let i=new cp(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.apply(this),i}apply(i){this.tileSize=i.tileSize,this.latRange=i.latRange,this.width=i.width,this.height=i.height,this._center=i._center,this._elevation=i._elevation,this.minElevationForCurrentTile=i.minElevationForCurrentTile,this.zoom=i.zoom,this.angle=i.angle,this._fov=i._fov,this._pitch=i._pitch,this._unmodified=i._unmodified,this._edgeInsets=i._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(i){let u=-o.b3(i,-180,180)*Math.PI/180;this.angle!==u&&(this._unmodified=!1,this.angle=u,this._calcMatrices(),this.rotationMatrix=function(){var p=new o.A(4);return o.A!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p}(),function(p,f,x){var E=f[0],P=f[1],T=f[2],R=f[3],O=Math.sin(x),D=Math.cos(x);p[0]=E*D+T*O,p[1]=P*D+R*O,p[2]=E*-O+T*D,p[3]=P*-O+R*D}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){let u=o.ad(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==u&&(this._unmodified=!1,this._pitch=u,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(i){let u=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==u&&(this._unmodified=!1,this._zoom=u,this.tileZoom=Math.max(0,Math.floor(u)),this.scale=this.zoomScale(u),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(i){i!==this._elevation&&(this._elevation=i,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,u,p){this._unmodified=!1,this._edgeInsets.interpolate(i,u,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){let u=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,u)}getVisibleUnwrappedCoordinates(i){let u=[new o.b4(0,i)];if(this._renderWorldCopies){let p=this.pointCoordinate(new o.P(0,0)),f=this.pointCoordinate(new o.P(this.width,0)),x=this.pointCoordinate(new o.P(this.width,this.height)),E=this.pointCoordinate(new o.P(0,this.height)),P=Math.floor(Math.min(p.x,f.x,x.x,E.x)),T=Math.floor(Math.max(p.x,f.x,x.x,E.x)),R=1;for(let O=P-R;O<=T+R;O++)O!==0&&u.push(new o.b4(O,i))}return u}coveringTiles(i){var u,p;let f=this.coveringZoomLevel(i),x=f;if(i.minzoom!==void 0&&f<i.minzoom)return[];i.maxzoom!==void 0&&f>i.maxzoom&&(f=i.maxzoom);let E=this.pointCoordinate(this.getCameraPoint()),P=o.Z.fromLngLat(this.center),T=Math.pow(2,f),R=[T*E.x,T*E.y,0],O=[T*P.x,T*P.y,0],D=Gs.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,f),G=i.minzoom||0;!i.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(G=f);let W=i.terrain?2/Math.min(this.tileSize,i.tileSize)*this.tileSize:3,K=ee=>({aabb:new qc([ee*T,0,0],[(ee+1)*T,T,0]),zoom:0,x:0,y:0,wrap:ee,fullyVisible:!1}),re=[],Y=[],ne=f,ue=i.reparseOverscaled?x:f;if(this._renderWorldCopies)for(let ee=1;ee<=3;ee++)re.push(K(-ee)),re.push(K(ee));for(re.push(K(0));re.length>0;){let ee=re.pop(),fe=ee.x,xe=ee.y,we=ee.fullyVisible;if(!we){let ze=ee.aabb.intersects(D);if(ze===0)continue;we=ze===2}let Me=i.terrain?R:O,Oe=ee.aabb.distanceX(Me),Ye=ee.aabb.distanceY(Me),Je=Math.max(Math.abs(Oe),Math.abs(Ye));if(ee.zoom===ne||Je>W+(1<<ne-ee.zoom)-2&&ee.zoom>=G){let ze=ne-ee.zoom,Ne=R[0]-.5-(fe<<ze),it=R[1]-.5-(xe<<ze);Y.push({tileID:new o.S(ee.zoom===ne?ue:ee.zoom,ee.wrap,ee.zoom,fe,xe),distanceSq:_e([O[0]-.5-fe,O[1]-.5-xe]),tileDistanceToCamera:Math.sqrt(Ne*Ne+it*it)})}else for(let ze=0;ze<4;ze++){let Ne=(fe<<1)+ze%2,it=(xe<<1)+(ze>>1),St=ee.zoom+1,Ge=ee.aabb.quadrant(ze);if(i.terrain){let Ze=new o.S(St,ee.wrap,St,Ne,it),_t=i.terrain.getMinMaxElevation(Ze),_r=(u=_t.minElevation)!==null&&u!==void 0?u:this.elevation,kt=(p=_t.maxElevation)!==null&&p!==void 0?p:this.elevation;Ge=new qc([Ge.min[0],Ge.min[1],_r],[Ge.max[0],Ge.max[1],kt])}re.push({aabb:Ge,zoom:St,x:Ne,y:it,wrap:ee.wrap,fullyVisible:we})}}return Y.sort((ee,fe)=>ee.distanceSq-fe.distanceSq).map(ee=>ee.tileID)}resize(i,u){this.width=i,this.height=u,this.pixelsToGLUnits=[2/i,-2/u],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(i){let u=o.ad(i.lat,-85.051129,lp);return new o.P(o.O(i.lng)*this.worldSize,o.Q(u)*this.worldSize)}unproject(i){return new o.Z(i.x/this.worldSize,i.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(i){let u=this.elevation,p=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,f=this.pointLocation(this.centerPoint,i),x=i.getElevationForLngLatZoom(f,this.tileZoom);if(!(this.elevation-x))return;let E=p+u-x,P=Math.cos(this._pitch)*this.cameraToCenterDistance/E/o.b5(1,f.lat),T=this.scaleZoom(P/this.tileSize);this._elevation=x,this._center=f,this.zoom=T}setLocationAtPoint(i,u){let p=this.pointCoordinate(u),f=this.pointCoordinate(this.centerPoint),x=this.locationCoordinate(i),E=new o.Z(x.x-(p.x-f.x),x.y-(p.y-f.y));this.center=this.coordinateLocation(E),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(i,u){return u?this.coordinatePoint(this.locationCoordinate(i),u.getElevationForLngLatZoom(i,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(i))}pointLocation(i,u){return this.coordinateLocation(this.pointCoordinate(i,u))}locationCoordinate(i){return o.Z.fromLngLat(i)}coordinateLocation(i){return i&&i.toLngLat()}pointCoordinate(i,u){if(u){let G=u.pointCoordinate(i);if(G!=null)return G}let p=[i.x,i.y,0,1],f=[i.x,i.y,1,1];o.ag(p,p,this.pixelMatrixInverse),o.ag(f,f,this.pixelMatrixInverse);let x=p[3],E=f[3],P=p[1]/x,T=f[1]/E,R=p[2]/x,O=f[2]/E,D=R===O?0:(0-R)/(O-R);return new o.Z(o.z.number(p[0]/x,f[0]/E,D)/this.worldSize,o.z.number(P,T,D)/this.worldSize)}coordinatePoint(i,u=0,p=this.pixelMatrix){let f=[i.x*this.worldSize,i.y*this.worldSize,u,1];return o.ag(f,f,p),new o.P(f[0]/f[3],f[1]/f[3])}getBounds(){let i=Math.max(0,this.height/2-this.getHorizon());return new Ee().extend(this.pointLocation(new o.P(0,i))).extend(this.pointLocation(new o.P(this.width,i))).extend(this.pointLocation(new o.P(this.width,this.height))).extend(this.pointLocation(new o.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ee([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(i){i?(this.lngRange=[i.getWest(),i.getEast()],this.latRange=[i.getSouth(),i.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,lp])}calculateTileMatrix(i){let u=i.canonical,p=this.worldSize/this.zoomScale(u.z),f=u.x+Math.pow(2,u.z)*i.wrap,x=o.ao(new Float64Array(16));return o.J(x,x,[f*p,u.y*p,0]),o.K(x,x,[p/o.X,p/o.X,1]),x}calculatePosMatrix(i,u=!1){let p=i.key,f=u?this._alignedPosMatrixCache:this._posMatrixCache;if(f[p])return f[p];let x=this.calculateTileMatrix(i);return o.L(x,u?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,x),f[p]=new Float32Array(x),f[p]}calculateFogMatrix(i){let u=i.key,p=this._fogMatrixCache;if(p[u])return p[u];let f=this.calculateTileMatrix(i);return o.L(f,this.fogMatrix,f),p[u]=new Float32Array(f),p[u]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(i,u){u=o.ad(+u,this.minZoom,this.maxZoom);let p={center:new o.N(i.lng,i.lat),zoom:u},f=this.lngRange;if(!this._renderWorldCopies&&f===null){let ee=179.9999999999;f=[-ee,ee]}let x=this.tileSize*this.zoomScale(p.zoom),E=0,P=x,T=0,R=x,O=0,D=0,{x:G,y:W}=this.size;if(this.latRange){let ee=this.latRange;E=o.Q(ee[1])*x,P=o.Q(ee[0])*x,P-E<W&&(O=W/(P-E))}f&&(T=o.b3(o.O(f[0])*x,0,x),R=o.b3(o.O(f[1])*x,0,x),R<T&&(R+=x),R-T<G&&(D=G/(R-T)));let{x:K,y:re}=this.project.call({worldSize:x},i),Y,ne,ue=Math.max(D||0,O||0);if(ue){let ee=new o.P(D?(R+T)/2:K,O?(P+E)/2:re);return p.center=this.unproject.call({worldSize:x},ee).wrap(),p.zoom+=this.scaleZoom(ue),p}if(this.latRange){let ee=W/2;re-ee<E&&(ne=E+ee),re+ee>P&&(ne=P-ee)}if(f){let ee=(T+R)/2,fe=K;this._renderWorldCopies&&(fe=o.b3(K,ee-x/2,ee+x/2));let xe=G/2;fe-xe<T&&(Y=T+xe),fe+xe>R&&(Y=R-xe)}if(Y!==void 0||ne!==void 0){let ee=new o.P(Y??K,ne??re);p.center=this.unproject.call({worldSize:x},ee).wrap()}return p}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let i=this._unmodified,{center:u,zoom:p}=this.getConstrained(this.center,this.zoom);this.center=u,this.zoom=p,this._unmodified=i,this._constraining=!1}_calcMatrices(){if(!this.height)return;let i=this.centerOffset,u=this.point.x,p=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=o.b5(1,this.center.lat)*this.worldSize;let f=o.ao(new Float64Array(16));o.K(f,f,[this.width/2,-this.height/2,1]),o.J(f,f,[1,-1,0]),this.labelPlaneMatrix=f,f=o.ao(new Float64Array(16)),o.K(f,f,[1,-1,1]),o.J(f,f,[-1,-1,0]),o.K(f,f,[2/this.width,2/this.height,1]),this.glCoordMatrix=f;let x=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),E=Math.min(this.elevation,this.minElevationForCurrentTile),P=x-E*this._pixelPerMeter/Math.cos(this._pitch),T=E<0?P:x,R=Math.PI/2+this._pitch,O=this._fov*(.5+i.y/this.height),D=Math.sin(O)*T/Math.sin(o.ad(Math.PI-R-O,.01,Math.PI-.01)),G=this.getHorizon(),W=2*Math.atan(G/this.cameraToCenterDistance)*(.5+i.y/(2*G)),K=Math.sin(W)*T/Math.sin(o.ad(Math.PI-R-W,.01,Math.PI-.01)),re=Math.min(D,K),Y=1.01*(Math.cos(Math.PI/2-this._pitch)*re+T),ne=this.height/50;f=new Float64Array(16),o.b6(f,this._fov,this.width/this.height,ne,Y),f[8]=2*-i.x/this.width,f[9]=2*i.y/this.height,o.K(f,f,[1,-1,1]),o.J(f,f,[0,0,-this.cameraToCenterDistance]),o.b7(f,f,this._pitch),o.ae(f,f,this.angle),o.J(f,f,[-u,-p,0]),this.mercatorMatrix=o.K([],f,[this.worldSize,this.worldSize,this.worldSize]),o.K(f,f,[1,1,this._pixelPerMeter]),this.pixelMatrix=o.L(new Float64Array(16),this.labelPlaneMatrix,f),o.J(f,f,[0,0,-this.elevation]),this.modelViewProjectionMatrix=f,this.invModelViewProjectionMatrix=o.at([],f),this.fogMatrix=new Float64Array(16),o.b6(this.fogMatrix,this._fov,this.width/this.height,x,Y),this.fogMatrix[8]=2*-i.x/this.width,this.fogMatrix[9]=2*i.y/this.height,o.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),o.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),o.b7(this.fogMatrix,this.fogMatrix,this._pitch),o.ae(this.fogMatrix,this.fogMatrix,this.angle),o.J(this.fogMatrix,this.fogMatrix,[-u,-p,0]),o.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),o.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=o.L(new Float64Array(16),this.labelPlaneMatrix,f);let ue=this.width%2/2,ee=this.height%2/2,fe=Math.cos(this.angle),xe=Math.sin(this.angle),we=u-Math.round(u)+fe*ue+xe*ee,Me=p-Math.round(p)+fe*ee+xe*ue,Oe=new Float64Array(f);if(o.J(Oe,Oe,[we>.5?we-1:we,Me>.5?Me-1:Me,0]),this.alignedModelViewProjectionMatrix=Oe,f=o.at(new Float64Array(16),this.pixelMatrix),!f)throw new Error("failed to invert matrix");this.pixelMatrixInverse=f,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let i=this.pointCoordinate(new o.P(0,0)),u=[i.x*this.worldSize,i.y*this.worldSize,0,1];return o.ag(u,u,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.P(0,i))}getCameraQueryGeometry(i){let u=this.getCameraPoint();if(i.length===1)return[i[0],u];{let p=u.x,f=u.y,x=u.x,E=u.y;for(let P of i)p=Math.min(p,P.x),f=Math.min(f,P.y),x=Math.max(x,P.x),E=Math.max(E,P.y);return[new o.P(p,f),new o.P(x,f),new o.P(x,E),new o.P(p,E),new o.P(p,f)]}}lngLatToCameraDepth(i,u){let p=this.locationCoordinate(i),f=[p.x*this.worldSize,p.y*this.worldSize,u,1];return o.ag(f,f,this.modelViewProjectionMatrix),f[2]/f[3]}}function Wc(_,i){let u,p=!1,f=null,x=null,E=()=>{f=null,p&&(_.apply(x,u),f=setTimeout(E,i),p=!1)};return(...P)=>(p=!0,x=this,u=P,f||E(),f)}class vl{constructor(i){this._getCurrentHash=()=>{let u=window.location.hash.replace("#","");if(this._hashName){let p;return u.split("&").map(f=>f.split("=")).forEach(f=>{f[0]===this._hashName&&(p=f)}),(p&&p[1]||"").split("/")}return u.split("/")},this._onHashChange=()=>{let u=this._getCurrentHash();if(u.length>=3&&!u.some(p=>isNaN(p))){let p=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(u[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+u[2],+u[1]],zoom:+u[0],bearing:p,pitch:+(u[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let u=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,u)}catch{}},this._updateHash=Wc(this._updateHashUnthrottled,300),this._hashName=i&&encodeURIComponent(i)}addTo(i){return this._map=i,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(i){let u=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,f=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,f),E=Math.round(u.lng*x)/x,P=Math.round(u.lat*x)/x,T=this._map.getBearing(),R=this._map.getPitch(),O="";if(O+=i?`/${E}/${P}/${p}`:`${p}/${P}/${E}`,(T||R)&&(O+="/"+Math.round(10*T)/10),R&&(O+=`/${Math.round(R)}`),this._hashName){let D=this._hashName,G=!1,W=window.location.hash.slice(1).split("&").map(K=>{let re=K.split("=")[0];return re===D?(G=!0,`${re}=${O}`):K}).filter(K=>K);return G||W.push(`${D}=${O}`),`#${W.join("&")}`}return`#${O}`}}let Vs={linearity:.3,easing:o.b8(0,0,.3,1)},up=o.e({deceleration:2500,maxSpeed:1400},Vs),hp=o.e({deceleration:20,maxSpeed:1400},Vs),Wf=o.e({deceleration:1e3,maxSpeed:360},Vs),Zc=o.e({deceleration:1e3,maxSpeed:90},Vs);class Xc{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:A.now(),settings:i})}_drainInertiaBuffer(){let i=this._inertiaBuffer,u=A.now();for(;i.length>0&&u-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let u={zoom:0,bearing:0,pitch:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:x}of this._inertiaBuffer)u.zoom+=x.zoomDelta||0,u.bearing+=x.bearingDelta||0,u.pitch+=x.pitchDelta||0,x.panDelta&&u.pan._add(x.panDelta),x.around&&(u.around=x.around),x.pinchAround&&(u.pinchAround=x.pinchAround);let p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,f={};if(u.pan.mag()){let x=Hc(u.pan.mag(),p,o.e({},up,i||{}));f.offset=u.pan.mult(x.amount/u.pan.mag()),f.center=this._map.transform.center,ba(f,x)}if(u.zoom){let x=Hc(u.zoom,p,hp);f.zoom=this._map.transform.zoom+x.amount,ba(f,x)}if(u.bearing){let x=Hc(u.bearing,p,Wf);f.bearing=this._map.transform.bearing+o.ad(x.amount,-179,179),ba(f,x)}if(u.pitch){let x=Hc(u.pitch,p,Zc);f.pitch=this._map.transform.pitch+x.amount,ba(f,x)}if(f.zoom||f.bearing){let x=u.pinchAround===void 0?u.around:u.pinchAround;f.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),o.e(f,{noMoveStart:!0})}}function ba(_,i){(!_.duration||_.duration<i.duration)&&(_.duration=i.duration,_.easing=i.easing)}function Hc(_,i,u){let{maxSpeed:p,linearity:f,deceleration:x}=u,E=o.ad(_*f/(i/1e3),-p,p),P=Math.abs(E)/(x*f);return{easing:u.easing,duration:1e3*P,amount:E*(P/2)}}class Di extends o.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,u,p,f={}){let x=S.mousePos(u.getCanvas(),p),E=u.unproject(x);super(i,o.e({point:x,lngLat:E,originalEvent:p},f)),this._defaultPrevented=!1,this.target=u}}class bl extends o.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,u,p){let f=i==="touchend"?p.changedTouches:p.touches,x=S.touchPos(u.getCanvasContainer(),f),E=x.map(T=>u.unproject(T)),P=x.reduce((T,R,O,D)=>T.add(R.div(D.length)),new o.P(0,0));super(i,{points:x,point:P,lngLats:E,lngLat:u.unproject(P),originalEvent:p}),this._defaultPrevented=!1}}class pp extends o.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,u,p){super(i,{originalEvent:p}),this._defaultPrevented=!1}}class Kc{constructor(i,u){this._map=i,this._clickTolerance=u.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new pp(i.type,this._map,i))}mousedown(i,u){return this._mousedownPos=u,this._firePreventable(new Di(i.type,this._map,i))}mouseup(i){this._map.fire(new Di(i.type,this._map,i))}click(i,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new Di(i.type,this._map,i))}dblclick(i){return this._firePreventable(new Di(i.type,this._map,i))}mouseover(i){this._map.fire(new Di(i.type,this._map,i))}mouseout(i){this._map.fire(new Di(i.type,this._map,i))}touchstart(i){return this._firePreventable(new bl(i.type,this._map,i))}touchmove(i){this._map.fire(new bl(i.type,this._map,i))}touchend(i){this._map.fire(new bl(i.type,this._map,i))}touchcancel(i){this._map.fire(new bl(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class dp{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(i){this._map.fire(new Di(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Di("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._ignoreContextMenu||this._map.fire(new Di(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class wa{constructor(i){this._map=i}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(i){return this.transform.pointLocation(o.P.convert(i),this._map.terrain)}}class fp{constructor(i,u){this._map=i,this._tr=new wa(i),this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=u.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,u){this.isEnabled()&&i.shiftKey&&i.button===0&&(S.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)}mousemoveWindow(i,u){if(!this._active)return;let p=u;if(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)<this._clickTolerance)return;let f=this._startPos;this._lastPos=p,this._box||(this._box=S.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",i));let x=Math.min(f.x,p.x),E=Math.max(f.x,p.x),P=Math.min(f.y,p.y),T=Math.max(f.y,p.y);S.setTransform(this._box,`translate(${x}px,${P}px)`),this._box.style.width=E-x+"px",this._box.style.height=T-P+"px"}mouseupWindow(i,u){if(!this._active||i.button!==0)return;let p=this._startPos,f=u;if(this.reset(),S.suppressClick(),p.x!==f.x||p.y!==f.y)return this._map.fire(new o.k("boxzoomend",{originalEvent:i})),{cameraAnimation:x=>x.fitScreenCoordinates(p,f,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",i)}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(S.remove(this._box),this._box=null),S.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(i,u){return this._map.fire(new o.k(i,{originalEvent:u}))}}function Sa(_,i){if(_.length!==i.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${i.length}`);let u={};for(let p=0;p<_.length;p++)u[_[p].identifier]=i[p];return u}class mp{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(i,u,p){(this.centroid||p.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=i.timeStamp),p.length===this.numTouches&&(this.centroid=function(f){let x=new o.P(0,0);for(let E of f)x._add(E);return x.div(f.length)}(u),this.touches=Sa(p,u)))}touchmove(i,u,p){if(this.aborted||!this.centroid)return;let f=Sa(p,u);for(let x in this.touches){let E=f[x];(!E||E.dist(this.touches[x])>30)&&(this.aborted=!0)}}touchend(i,u,p){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){let f=!this.aborted&&this.centroid;if(this.reset(),f)return f}}}class gp{constructor(i){this.singleTap=new mp(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,u,p){this.singleTap.touchstart(i,u,p)}touchmove(i,u,p){this.singleTap.touchmove(i,u,p)}touchend(i,u,p){let f=this.singleTap.touchend(i,u,p);if(f){let x=i.timeStamp-this.lastTime<500,E=!this.lastTap||this.lastTap.dist(f)<30;if(x&&E||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=f,this.count===this.numTaps)return this.reset(),f}}}class Zf{constructor(i){this._tr=new wa(i),this._zoomIn=new gp({numTouches:1,numTaps:2}),this._zoomOut=new gp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,u,p){this._zoomIn.touchstart(i,u,p),this._zoomOut.touchstart(i,u,p)}touchmove(i,u,p){this._zoomIn.touchmove(i,u,p),this._zoomOut.touchmove(i,u,p)}touchend(i,u,p){let f=this._zoomIn.touchend(i,u,p),x=this._zoomOut.touchend(i,u,p),E=this._tr;return f?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:P=>P.easeTo({duration:300,zoom:E.zoom+1,around:E.unproject(f)},{originalEvent:i})}):x?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:P=>P.easeTo({duration:300,zoom:E.zoom-1,around:E.unproject(x)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class yr{constructor(i){this._enabled=!!i.enable,this._moveStateManager=i.moveStateManager,this._clickTolerance=i.clickTolerance||1,this._moveFunction=i.move,this._activateOnStart=!!i.activateOnStart,i.assignEvents(this),this.reset()}reset(i){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(i)}_move(...i){let u=this._moveFunction(...i);if(u.bearingDelta||u.pitchDelta||u.around||u.panDelta)return this._active=!0,u}dragStart(i,u){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(i)&&(this._moveStateManager.startMove(i),this._lastPoint=u.length?u[0]:u,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(i,u){if(!this.isEnabled())return;let p=this._lastPoint;if(!p)return;if(i.preventDefault(),!this._moveStateManager.isValidMoveEvent(i))return void this.reset(i);let f=u.length?u[0]:u;return!this._moved&&f.dist(p)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=f,this._move(p,f))}dragEnd(i){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(i)&&(this._moved&&S.suppressClick(),this.reset(i))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let qs={0:1,2:2};class en{constructor(i){this._correctEvent=i.checkCorrectEvent}startMove(i){let u=S.mouseButton(i);this._eventButton=u}endMove(i){delete this._eventButton}isValidStartEvent(i){return this._correctEvent(i)}isValidMoveEvent(i){return!function(u,p){let f=qs[p];return u.buttons===void 0||(u.buttons&f)!==f}(i,this._eventButton)}isValidEndEvent(i){return S.mouseButton(i)===this._eventButton}}class Yc{constructor(){this._firstTouch=void 0}_isOneFingerTouch(i){return i.targetTouches.length===1}_isSameTouchEvent(i){return i.targetTouches[0].identifier===this._firstTouch}startMove(i){this._firstTouch=i.targetTouches[0].identifier}endMove(i){delete this._firstTouch}isValidStartEvent(i){return this._isOneFingerTouch(i)}isValidMoveEvent(i){return this._isOneFingerTouch(i)&&this._isSameTouchEvent(i)}isValidEndEvent(i){return this._isOneFingerTouch(i)&&this._isSameTouchEvent(i)}}let wl=_=>{_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=i=>{i.preventDefault()}},yp=({enable:_,clickTolerance:i,bearingDegreesPerPixelMoved:u=.8})=>{let p=new en({checkCorrectEvent:f=>S.mouseButton(f)===0&&f.ctrlKey||S.mouseButton(f)===2});return new yr({clickTolerance:i,move:(f,x)=>({bearingDelta:(x.x-f.x)*u}),moveStateManager:p,enable:_,assignEvents:wl})},$s=({enable:_,clickTolerance:i,pitchDegreesPerPixelMoved:u=-.5})=>{let p=new en({checkCorrectEvent:f=>S.mouseButton(f)===0&&f.ctrlKey||S.mouseButton(f)===2});return new yr({clickTolerance:i,move:(f,x)=>({pitchDelta:(x.y-f.y)*u}),moveStateManager:p,enable:_,assignEvents:wl})};class Sl{constructor(i,u){this._clickTolerance=i.clickTolerance||1,this._map=u,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(i,u,p){return this._calculateTransform(i,u,p)}touchmove(i,u,p){if(this._active&&!(p.length<this.minTouchs()))return i.preventDefault(),this._calculateTransform(i,u,p)}touchend(i,u,p){this._calculateTransform(i,u,p),this._active&&p.length<this.minTouchs()&&this.reset()}touchcancel(){this.reset()}_calculateTransform(i,u,p){p.length>0&&(this._active=!0);let f=Sa(p,u),x=new o.P(0,0),E=new o.P(0,0),P=0;for(let R in f){let O=f[R],D=this._touches[R];D&&(x._add(O),E._add(O.sub(D)),P++,f[R]=O)}if(this._touches=f,P<this.minTouchs()||!E.mag())return;let T=E.div(P);return this._sum._add(T),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(P),panDelta:T}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Al{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(i,u,p){this._firstTwoTouches||p.length<2||(this._firstTwoTouches=[p[0].identifier,p[1].identifier],this._start([u[0],u[1]]))}touchmove(i,u,p){if(!this._firstTwoTouches)return;i.preventDefault();let[f,x]=this._firstTwoTouches,E=El(p,u,f),P=El(p,u,x);if(!E||!P)return;let T=this._aroundCenter?null:E.add(P).div(2);return this._move([E,P],T,i)}touchend(i,u,p){if(!this._firstTwoTouches)return;let[f,x]=this._firstTwoTouches,E=El(p,u,f),P=El(p,u,x);E&&P||(this._active&&S.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&i.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function El(_,i,u){for(let p=0;p<_.length;p++)if(_[p].identifier===u)return i[p]}function _p(_,i){return Math.log(_/i)/Math.LN2}class xp extends Al{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,u){let p=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(Math.abs(_p(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:_p(this._distance,p),pinchAround:u}}}function vp(_,i){return 180*_.angleWith(i)/Math.PI}class bp extends Al{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,u,p){let f=this._vector;if(this._vector=i[0].sub(i[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:vp(this._vector,f),pinchAround:u}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());let u=25/(Math.PI*this._minDiameter)*360,p=vp(i,this._startVector);return Math.abs(p)<u}}function Ro(_){return Math.abs(_.y)>Math.abs(_.x)}class wp extends Al{constructor(i){super(),this._currentTouchCount=0,this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(i,u,p){super.touchstart(i,u,p),this._currentTouchCount=p.length}_start(i){this._lastPoints=i,Ro(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,u,p){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let f=i[0].sub(this._lastPoints[0]),x=i[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(f,x,p.timeStamp),this._valid?(this._lastPoints=i,this._active=!0,{pitchDelta:(f.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(i,u,p){if(this._valid!==void 0)return this._valid;let f=i.mag()>=2,x=u.mag()>=2;if(!f&&!x)return;if(!f||!x)return this._firstMove===void 0&&(this._firstMove=p),p-this._firstMove<100&&void 0;let E=i.y>0==u.y>0;return Ro(i)&&Ro(u)&&E}}let Xf={panStep:100,bearingStep:15,pitchStep:10};class Sp{constructor(i){this._tr=new wa(i);let u=Xf;this._panStep=u.panStep,this._bearingStep=u.bearingStep,this._pitchStep=u.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let u=0,p=0,f=0,x=0,E=0;switch(i.keyCode){case 61:case 107:case 171:case 187:u=1;break;case 189:case 109:case 173:u=-1;break;case 37:i.shiftKey?p=-1:(i.preventDefault(),x=-1);break;case 39:i.shiftKey?p=1:(i.preventDefault(),x=1);break;case 38:i.shiftKey?f=1:(i.preventDefault(),E=-1);break;case 40:i.shiftKey?f=-1:(i.preventDefault(),E=1);break;default:return}return this._rotationDisabled&&(p=0,f=0),{cameraAnimation:P=>{let T=this._tr;P.easeTo({duration:300,easeId:"keyboardHandler",easing:Hf,zoom:u?Math.round(T.zoom)+u*(i.shiftKey?2:1):T.zoom,bearing:T.bearing+p*this._bearingStep,pitch:T.pitch+f*this._pitchStep,offset:[-x*this._panStep,-E*this._panStep],center:T.center},{originalEvent:i})}}}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 Hf(_){return _*(2-_)}let Ap=4.000244140625;class Ep{constructor(i,u){this._onTimeout=p=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(p)},this._map=i,this._tr=new wa(i),this._triggerRenderFrame=u,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&i.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(i){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!i[this._map.cooperativeGestures._bypassKey])return;let u=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY,p=A.now(),f=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,u!==0&&u%Ap==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":f>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(f*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),i.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=i,this._delta-=u,this._active||this._start(i)),i.preventDefault()}_start(i){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);let u=S.mousePos(this._map.getCanvas(),i),p=this._tr;this._around=u.y>p.transform.height/2-p.transform.getHorizon()?o.N.convert(this._aroundCenter?p.center:p.unproject(u)):o.N.convert(p.center),this._aroundPoint=p.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let i=this._tr.transform;if(this._delta!==0){let P=this._type==="wheel"&&Math.abs(this._delta)>Ap?this._wheelZoomRate:this._defaultZoomRate,T=2/(1+Math.exp(-Math.abs(this._delta*P)));this._delta<0&&T!==0&&(T=1/T);let R=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(R*T))),this._type==="wheel"&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let u=typeof this._targetZoom=="number"?this._targetZoom:i.zoom,p=this._startZoom,f=this._easing,x,E=!1;if(this._type==="wheel"&&p&&f){let P=Math.min((A.now()-this._lastWheelEventTime)/200,1),T=f(P);x=o.z.number(p,u,T),P<1?this._frameId||(this._frameId=!0):E=!0}else x=u,E=!0;return this._active=!0,E&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!E,zoomDelta:x-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let u=o.b9;if(this._prevEase){let p=this._prevEase,f=(A.now()-p.start)/p.duration,x=p.easing(f+.01)-p.easing(f),E=.27/Math.sqrt(x*x+1e-4)*.01,P=Math.sqrt(.0729-E*E);u=o.b8(E,P,.25,1)}return this._prevEase={start:A.now(),duration:i,easing:u},u}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ip{constructor(i,u){this._clickZoom=i,this._tapZoom=u}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 Il{constructor(i){this._tr=new wa(i),this.reset()}reset(){this._active=!1}dblclick(i,u){return i.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:this._tr.zoom+(i.shiftKey?-1:1),around:this._tr.unproject(u)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Kf{constructor(){this._tap=new gp({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(i,u,p){if(!this._swipePoint)if(this._tapTime){let f=u[0],x=i.timeStamp-this._tapTime<500,E=this._tapPoint.dist(f)<30;x&&E?p.length>0&&(this._swipePoint=f,this._swipeTouch=p[0].identifier):this.reset()}else this._tap.touchstart(i,u,p)}touchmove(i,u,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;let f=u[0],x=f.y-this._swipePoint.y;return this._swipePoint=f,i.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(i,u,p)}touchend(i,u,p){if(this._tapTime)this._swipePoint&&p.length===0&&this.reset();else{let f=this._tap.touchend(i,u,p);f&&(this._tapTime=i.timeStamp,this._tapPoint=f)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Rn{constructor(i,u,p){this._el=i,this._mousePan=u,this._touchPan=p}enable(i){this._inertiaOptions=i||{},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 Yn{constructor(i,u,p){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=u,this._mousePitch=p}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 Pp{constructor(i,u,p,f){this._el=i,this._touchZoom=u,this._touchRotate=p,this._tapDragZoom=f,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),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 Jn{constructor(i,u){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=i,this._options=u,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let i=this._map.getCanvasContainer();i.classList.add("maplibregl-cooperative-gestures"),this._container=S.create("div","maplibregl-cooperative-gesture-screen",i);let u=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(u=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let p=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),f=document.createElement("div");f.className="maplibregl-desktop-message",f.textContent=u,this._container.appendChild(f);let x=document.createElement("div");x.className="maplibregl-mobile-message",x.textContent=p,this._container.appendChild(x),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(S.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._destoryUI()}isEnabled(){return this._enabled}touchmove(i){this._onCooperativeGesture(i.touches.length===1)}wheel(i){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!i[this._bypassKey])}_onCooperativeGesture(i){this._enabled&&i&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let ko=_=>_.zoom||_.drag||_.pitch||_.rotate;class c_ extends o.k{}function Tp(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class u_{constructor(i,u){this.handleWindowEvent=f=>{this.handleEvent(f,`${f.type}Window`)},this.handleEvent=(f,x)=>{if(f.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let E=f.type==="renderFrame"?void 0:f,P={needsRenderFrame:!1},T={},R={},O=f.touches,D=O?this._getMapTouches(O):void 0,G=D?S.touchPos(this._map.getCanvas(),D):S.mousePos(this._map.getCanvas(),f);for(let{handlerName:re,handler:Y,allowed:ne}of this._handlers){if(!Y.isEnabled())continue;let ue;this._blockedByActive(R,ne,re)?Y.reset():Y[x||f.type]&&(ue=Y[x||f.type](f,G,D),this.mergeHandlerResult(P,T,ue,re,E),ue&&ue.needsRenderFrame&&this._triggerRenderFrame()),(ue||Y.isActive())&&(R[re]=Y)}let W={};for(let re in this._previousActiveHandlers)R[re]||(W[re]=E);this._previousActiveHandlers=R,(Object.keys(W).length||Tp(P))&&(this._changes.push([P,T,W]),this._triggerRenderFrame()),(Object.keys(R).length||Tp(P))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:K}=P;K&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],K(this._map))},this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Xc(i),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u);let p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[window,"blur",void 0]];for(let[f,x,E]of this._listeners)S.addEventListener(f,x,f===document?this.handleWindowEvent:this.handleEvent,E)}destroy(){for(let[i,u,p]of this._listeners)S.removeEventListener(i,u,i===document?this.handleWindowEvent:this.handleEvent,p)}_addDefaultHandlers(i){let u=this._map,p=u.getCanvasContainer();this._add("mapEvent",new Kc(u,i));let f=u.boxZoom=new fp(u,i);this._add("boxZoom",f),i.interactive&&i.boxZoom&&f.enable();let x=u.cooperativeGestures=new Jn(u,i.cooperativeGestures);this._add("cooperativeGestures",x),i.cooperativeGestures&&x.enable();let E=new Zf(u),P=new Il(u);u.doubleClickZoom=new Ip(P,E),this._add("tapZoom",E),this._add("clickZoom",P),i.interactive&&i.doubleClickZoom&&u.doubleClickZoom.enable();let T=new Kf;this._add("tapDragZoom",T);let R=u.touchPitch=new wp(u);this._add("touchPitch",R),i.interactive&&i.touchPitch&&u.touchPitch.enable(i.touchPitch);let O=yp(i),D=$s(i);u.dragRotate=new Yn(i,O,D),this._add("mouseRotate",O,["mousePitch"]),this._add("mousePitch",D,["mouseRotate"]),i.interactive&&i.dragRotate&&u.dragRotate.enable();let G=(({enable:ue,clickTolerance:ee})=>{let fe=new en({checkCorrectEvent:xe=>S.mouseButton(xe)===0&&!xe.ctrlKey});return new yr({clickTolerance:ee,move:(xe,we)=>({around:we,panDelta:we.sub(xe)}),activateOnStart:!0,moveStateManager:fe,enable:ue,assignEvents:wl})})(i),W=new Sl(i,u);u.dragPan=new Rn(p,G,W),this._add("mousePan",G),this._add("touchPan",W,["touchZoom","touchRotate"]),i.interactive&&i.dragPan&&u.dragPan.enable(i.dragPan);let K=new bp,re=new xp;u.touchZoomRotate=new Pp(p,re,K,T),this._add("touchRotate",K,["touchPan","touchZoom"]),this._add("touchZoom",re,["touchPan","touchRotate"]),i.interactive&&i.touchZoomRotate&&u.touchZoomRotate.enable(i.touchZoomRotate);let Y=u.scrollZoom=new Ep(u,()=>this._triggerRenderFrame());this._add("scrollZoom",Y,["mousePan"]),i.interactive&&i.scrollZoom&&u.scrollZoom.enable(i.scrollZoom);let ne=u.keyboard=new Sp(u);this._add("keyboard",ne),i.interactive&&i.keyboard&&u.keyboard.enable(),this._add("blockableMapEvent",new dp(u))}_add(i,u,p){this._handlers.push({handlerName:i,handler:u,allowed:p}),this._handlersById[i]=u}stop(i){if(!this._updatingCamera){for(let{handler:u}of this._handlers)u.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(let{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ko(this._eventsInProgress)||this.isZooming()}_blockedByActive(i,u,p){for(let f in i)if(f!==p&&(!u||u.indexOf(f)<0))return!0;return!1}_getMapTouches(i){let u=[];for(let p of i)this._el.contains(p.target)&&u.push(p);return u}mergeHandlerResult(i,u,p,f,x){if(!p)return;o.e(i,p);let E={handlerName:f,originalEvent:p.originalEvent||x};p.zoomDelta!==void 0&&(u.zoom=E),p.panDelta!==void 0&&(u.drag=E),p.pitchDelta!==void 0&&(u.pitch=E),p.bearingDelta!==void 0&&(u.rotate=E)}_applyChanges(){let i={},u={},p={};for(let[f,x,E]of this._changes)f.panDelta&&(i.panDelta=(i.panDelta||new o.P(0,0))._add(f.panDelta)),f.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+f.zoomDelta),f.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+f.bearingDelta),f.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+f.pitchDelta),f.around!==void 0&&(i.around=f.around),f.pinchAround!==void 0&&(i.pinchAround=f.pinchAround),f.noInertia&&(i.noInertia=f.noInertia),o.e(u,x),o.e(p,E);this._updateMapTransform(i,u,p),this._changes=[]}_updateMapTransform(i,u,p){let f=this._map,x=f._getTransformForUpdate(),E=f.terrain;if(!(Tp(i)||E&&this._terrainMovement))return this._fireEvents(u,p,!0);let{panDelta:P,zoomDelta:T,bearingDelta:R,pitchDelta:O,around:D,pinchAround:G}=i;G!==void 0&&(D=G),f._stop(!0),D=D||f.transform.centerPoint;let W=x.pointLocation(P?D.sub(P):D);R&&(x.bearing+=R),O&&(x.pitch+=O),T&&(x.zoom+=T),E?this._terrainMovement||!u.drag&&!u.zoom?u.drag&&this._terrainMovement?x.center=x.pointLocation(x.centerPoint.sub(P)):x.setLocationAtPoint(W,D):(this._terrainMovement=!0,this._map._elevationFreeze=!0,x.setLocationAtPoint(W,D)):x.setLocationAtPoint(W,D),f._applyUpdatedTransform(x),this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(u,p,!0)}_fireEvents(i,u,p){let f=ko(this._eventsInProgress),x=ko(i),E={};for(let D in i){let{originalEvent:G}=i[D];this._eventsInProgress[D]||(E[`${D}start`]=G),this._eventsInProgress[D]=i[D]}!f&&x&&this._fireEvent("movestart",x.originalEvent);for(let D in E)this._fireEvent(D,E[D]);x&&this._fireEvent("move",x.originalEvent);for(let D in i){let{originalEvent:G}=i[D];this._fireEvent(D,G)}let P={},T;for(let D in this._eventsInProgress){let{handlerName:G,originalEvent:W}=this._eventsInProgress[D];this._handlersById[G].isActive()||(delete this._eventsInProgress[D],T=u[G]||W,P[`${D}end`]=T)}for(let D in P)this._fireEvent(D,P[D]);let R=ko(this._eventsInProgress),O=(f||x)&&!R;if(O&&this._terrainMovement&&(this._map._elevationFreeze=!1,this._terrainMovement=!1,this._map.transform.recalculateZoom(this._map.terrain)),p&&O){this._updatingCamera=!0;let D=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),G=W=>W!==0&&-this._bearingSnap<W&&W<this._bearingSnap;!D||!D.essential&&A.prefersReducedMotion?(this._map.fire(new o.k("moveend",{originalEvent:T})),G(this._map.getBearing())&&this._map.resetNorth()):(G(D.bearing||this._map.getBearing())&&(D.bearing=0),D.freezeElevation=!0,this._map.easeTo(D,{originalEvent:T})),this._updatingCamera=!1}}_fireEvent(i,u){this._map.fire(new o.k(i,u?{originalEvent:u}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{delete this._frameId,this.handleEvent(new c_("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class h_ extends o.E{constructor(i,u){super(),this._renderFrameCallback=()=>{let p=Math.min((A.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=u.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new o.N(this.transform.center.lng,this.transform.center.lat)}setCenter(i,u){return this.jumpTo({center:i},u)}panBy(i,u,p){return i=o.P.convert(i).mult(-1),this.panTo(this.transform.center,o.e({offset:i},u),p)}panTo(i,u,p){return this.easeTo(o.e({center:i},u),p)}getZoom(){return this.transform.zoom}setZoom(i,u){return this.jumpTo({zoom:i},u),this}zoomTo(i,u,p){return this.easeTo(o.e({zoom:i},u),p)}zoomIn(i,u){return this.zoomTo(this.getZoom()+1,i,u),this}zoomOut(i,u){return this.zoomTo(this.getZoom()-1,i,u),this}getBearing(){return this.transform.bearing}setBearing(i,u){return this.jumpTo({bearing:i},u),this}getPadding(){return this.transform.padding}setPadding(i,u){return this.jumpTo({padding:i},u),this}rotateTo(i,u,p){return this.easeTo(o.e({bearing:i},u),p)}resetNorth(i,u){return this.rotateTo(0,o.e({duration:1e3},i),u),this}resetNorthPitch(i,u){return this.easeTo(o.e({bearing:0,pitch:0,duration:1e3},i),u),this}snapToNorth(i,u){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,u):this}getPitch(){return this.transform.pitch}setPitch(i,u){return this.jumpTo({pitch:i},u),this}cameraForBounds(i,u){i=Ee.convert(i);let p=u&&u.bearing||0;return this._cameraForBoxAndBearing(i.getNorthWest(),i.getSouthEast(),p,u)}_cameraForBoxAndBearing(i,u,p,f){let x={top:0,bottom:0,right:0,left:0};if(typeof(f=o.e({padding:x,offset:[0,0],maxZoom:this.transform.maxZoom},f)).padding=="number"){let ze=f.padding;f.padding={top:ze,bottom:ze,right:ze,left:ze}}f.padding=o.e(x,f.padding);let E=this.transform,P=E.padding,T=new Ee(i,u),R=E.project(T.getNorthWest()),O=E.project(T.getNorthEast()),D=E.project(T.getSouthEast()),G=E.project(T.getSouthWest()),W=o.ba(-p),K=R.rotate(W),re=O.rotate(W),Y=D.rotate(W),ne=G.rotate(W),ue=new o.P(Math.max(K.x,re.x,ne.x,Y.x),Math.max(K.y,re.y,ne.y,Y.y)),ee=new o.P(Math.min(K.x,re.x,ne.x,Y.x),Math.min(K.y,re.y,ne.y,Y.y)),fe=ue.sub(ee),xe=(E.width-(P.left+P.right+f.padding.left+f.padding.right))/fe.x,we=(E.height-(P.top+P.bottom+f.padding.top+f.padding.bottom))/fe.y;if(we<0||xe<0)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let Me=Math.min(E.scaleZoom(E.scale*Math.min(xe,we)),f.maxZoom),Oe=o.P.convert(f.offset),Ye=new o.P((f.padding.left-f.padding.right)/2,(f.padding.top-f.padding.bottom)/2).rotate(o.ba(p)),Je=Oe.add(Ye).mult(E.scale/E.zoomScale(Me));return{center:E.unproject(R.add(D).div(2).sub(Je)),zoom:Me,bearing:p}}fitBounds(i,u,p){return this._fitInternal(this.cameraForBounds(i,u),u,p)}fitScreenCoordinates(i,u,p,f,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(o.P.convert(i)),this.transform.pointLocation(o.P.convert(u)),p,f),f,x)}_fitInternal(i,u,p){return i?(delete(u=o.e(i,u)).padding,u.linear?this.easeTo(u,p):this.flyTo(u,p)):this}jumpTo(i,u){this.stop();let p=this._getTransformForUpdate(),f=!1,x=!1,E=!1;return"zoom"in i&&p.zoom!==+i.zoom&&(f=!0,p.zoom=+i.zoom),i.center!==void 0&&(p.center=o.N.convert(i.center)),"bearing"in i&&p.bearing!==+i.bearing&&(x=!0,p.bearing=+i.bearing),"pitch"in i&&p.pitch!==+i.pitch&&(E=!0,p.pitch=+i.pitch),i.padding==null||p.isPaddingEqual(i.padding)||(p.padding=i.padding),this._applyUpdatedTransform(p),this.fire(new o.k("movestart",u)).fire(new o.k("move",u)),f&&this.fire(new o.k("zoomstart",u)).fire(new o.k("zoom",u)).fire(new o.k("zoomend",u)),x&&this.fire(new o.k("rotatestart",u)).fire(new o.k("rotate",u)).fire(new o.k("rotateend",u)),E&&this.fire(new o.k("pitchstart",u)).fire(new o.k("pitch",u)).fire(new o.k("pitchend",u)),this.fire(new o.k("moveend",u))}calculateCameraOptionsFromTo(i,u,p,f=0){let x=o.Z.fromLngLat(i,u),E=o.Z.fromLngLat(p,f),P=E.x-x.x,T=E.y-x.y,R=E.z-x.z,O=Math.hypot(P,T,R);if(O===0)throw new Error("Can't calculate camera options with same From and To");let D=Math.hypot(P,T),G=this.transform.scaleZoom(this.transform.cameraToCenterDistance/O/this.transform.tileSize),W=180*Math.atan2(P,-T)/Math.PI,K=180*Math.acos(D/O)/Math.PI;return K=R<0?90-K:90+K,{center:E.toLngLat(),zoom:G,pitch:K,bearing:W}}easeTo(i,u){var p;this._stop(!1,i.easeId),((i=o.e({offset:[0,0],duration:500,easing:o.b9},i)).animate===!1||!i.essential&&A.prefersReducedMotion)&&(i.duration=0);let f=this._getTransformForUpdate(),x=this.getZoom(),E=this.getBearing(),P=this.getPitch(),T=this.getPadding(),R="bearing"in i?this._normalizeBearing(i.bearing,E):E,O="pitch"in i?+i.pitch:P,D="padding"in i?i.padding:f.padding,G=o.P.convert(i.offset),W=f.centerPoint.add(G),K=f.pointLocation(W),{center:re,zoom:Y}=f.getConstrained(o.N.convert(i.center||K),(p=i.zoom)!==null&&p!==void 0?p:x);this._normalizeCenter(re);let ne=f.project(K),ue=f.project(re).sub(ne),ee=f.zoomScale(Y-x),fe,xe;i.around&&(fe=o.N.convert(i.around),xe=f.locationPoint(fe));let we={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||Y!==x,this._rotating=this._rotating||E!==R,this._pitching=this._pitching||O!==P,this._padding=!f.isPaddingEqual(D),this._easeId=i.easeId,this._prepareEase(u,i.noMoveStart,we),this.terrain&&this._prepareElevation(re),this._ease(Me=>{if(this._zooming&&(f.zoom=o.z.number(x,Y,Me)),this._rotating&&(f.bearing=o.z.number(E,R,Me)),this._pitching&&(f.pitch=o.z.number(P,O,Me)),this._padding&&(f.interpolatePadding(T,D,Me),W=f.centerPoint.add(G)),this.terrain&&!i.freezeElevation&&this._updateElevation(Me),fe)f.setLocationAtPoint(fe,xe);else{let Oe=f.zoomScale(f.zoom-x),Ye=Y>x?Math.min(2,ee):Math.max(.5,ee),Je=Math.pow(Ye,1-Me),ze=f.unproject(ne.add(ue.mult(Me*Je)).mult(Oe));f.setLocationAtPoint(f.renderWorldCopies?ze.wrap():ze,W)}this._applyUpdatedTransform(f),this._fireMoveEvents(u)},Me=>{this.terrain&&i.freezeElevation&&this._finalizeElevation(),this._afterEase(u,Me)},i),this}_prepareEase(i,u,p={}){this._moving=!0,u||p.moving||this.fire(new o.k("movestart",i)),this._zooming&&!p.zooming&&this.fire(new o.k("zoomstart",i)),this._rotating&&!p.rotating&&this.fire(new o.k("rotatestart",i)),this._pitching&&!p.pitching&&this.fire(new o.k("pitchstart",i))}_prepareElevation(i){this._elevationCenter=i,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(i){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let u=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(i<1&&u!==this._elevationTarget){let p=this._elevationTarget-this._elevationStart;this._elevationStart+=i*(p-(u-(p*i+this._elevationStart))/(1-i)),this._elevationTarget=u}this.transform.elevation=o.z.number(this._elevationStart,this._elevationTarget,i)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(i){if(!this.transformCameraUpdate)return;let u=i.clone(),{center:p,zoom:f,pitch:x,bearing:E,elevation:P}=this.transformCameraUpdate(u);p&&(u.center=p),f!==void 0&&(u.zoom=f),x!==void 0&&(u.pitch=x),E!==void 0&&(u.bearing=E),P!==void 0&&(u.elevation=P),this.transform.apply(u)}_fireMoveEvents(i){this.fire(new o.k("move",i)),this._zooming&&this.fire(new o.k("zoom",i)),this._rotating&&this.fire(new o.k("rotate",i)),this._pitching&&this.fire(new o.k("pitch",i))}_afterEase(i,u){if(this._easeId&&u&&this._easeId===u)return;delete this._easeId;let p=this._zooming,f=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,p&&this.fire(new o.k("zoomend",i)),f&&this.fire(new o.k("rotateend",i)),x&&this.fire(new o.k("pitchend",i)),this.fire(new o.k("moveend",i))}flyTo(i,u){var p;if(!i.essential&&A.prefersReducedMotion){let Ze=o.M(i,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ze,u)}this.stop(),i=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.b9},i);let f=this._getTransformForUpdate(),x=this.getZoom(),E=this.getBearing(),P=this.getPitch(),T=this.getPadding(),R="bearing"in i?this._normalizeBearing(i.bearing,E):E,O="pitch"in i?+i.pitch:P,D="padding"in i?i.padding:f.padding,G=o.P.convert(i.offset),W=f.centerPoint.add(G),K=f.pointLocation(W),{center:re,zoom:Y}=f.getConstrained(o.N.convert(i.center||K),(p=i.zoom)!==null&&p!==void 0?p:x);this._normalizeCenter(re);let ne=f.zoomScale(Y-x),ue=f.project(K),ee=f.project(re).sub(ue),fe=i.curve,xe=Math.max(f.width,f.height),we=xe/ne,Me=ee.mag();if("minZoom"in i){let Ze=o.ad(Math.min(i.minZoom,x,Y),f.minZoom,f.maxZoom),_t=xe/f.zoomScale(Ze-x);fe=Math.sqrt(_t/Me*2)}let Oe=fe*fe;function Ye(Ze){let _t=(we*we-xe*xe+(Ze?-1:1)*Oe*Oe*Me*Me)/(2*(Ze?we:xe)*Oe*Me);return Math.log(Math.sqrt(_t*_t+1)-_t)}function Je(Ze){return(Math.exp(Ze)-Math.exp(-Ze))/2}function ze(Ze){return(Math.exp(Ze)+Math.exp(-Ze))/2}let Ne=Ye(!1),it=function(Ze){return ze(Ne)/ze(Ne+fe*Ze)},St=function(Ze){return xe*((ze(Ne)*(Je(_t=Ne+fe*Ze)/ze(_t))-Je(Ne))/Oe)/Me;var _t},Ge=(Ye(!0)-Ne)/fe;if(Math.abs(Me)<1e-6||!isFinite(Ge)){if(Math.abs(xe-we)<1e-6)return this.easeTo(i,u);let Ze=we<xe?-1:1;Ge=Math.abs(Math.log(we/xe))/fe,St=()=>0,it=_t=>Math.exp(Ze*fe*_t)}return i.duration="duration"in i?+i.duration:1e3*Ge/("screenSpeed"in i?+i.screenSpeed/fe:+i.speed),i.maxDuration&&i.duration>i.maxDuration&&(i.duration=0),this._zooming=!0,this._rotating=E!==R,this._pitching=O!==P,this._padding=!f.isPaddingEqual(D),this._prepareEase(u,!1),this.terrain&&this._prepareElevation(re),this._ease(Ze=>{let _t=Ze*Ge,_r=1/it(_t);f.zoom=Ze===1?Y:x+f.scaleZoom(_r),this._rotating&&(f.bearing=o.z.number(E,R,Ze)),this._pitching&&(f.pitch=o.z.number(P,O,Ze)),this._padding&&(f.interpolatePadding(T,D,Ze),W=f.centerPoint.add(G)),this.terrain&&!i.freezeElevation&&this._updateElevation(Ze);let kt=Ze===1?re:f.unproject(ue.add(ee.mult(St(_t))).mult(_r));f.setLocationAtPoint(f.renderWorldCopies?kt.wrap():kt,W),this._applyUpdatedTransform(f),this._fireMoveEvents(u)},()=>{this.terrain&&i.freezeElevation&&this._finalizeElevation(),this._afterEase(u)},i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,u){var p;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let f=this._onEaseEnd;delete this._onEaseEnd,f.call(this,u)}return i||(p=this.handlers)===null||p===void 0||p.stop(!1),this}_ease(i,u,p){p.animate===!1||p.duration===0?(i(1),u()):(this._easeStart=A.now(),this._easeOptions=p,this._onEaseFrame=i,this._onEaseEnd=u,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(i,u){i=o.b3(i,-180,180);let p=Math.abs(i-u);return Math.abs(i-360-u)<p&&(i-=360),Math.abs(i+360-u)<p&&(i+=360),i}_normalizeCenter(i){let u=this.transform;if(!u.renderWorldCopies||u.lngRange)return;let p=i.lng-u.center.lng;i.lng+=p>180?-360:p<-180?360:0}queryTerrainElevation(i){return this.terrain?this.terrain.getElevationForLngLatZoom(o.N.convert(i),this.transform.tileZoom)-this.transform.elevation:null}}let Cp={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Aa{constructor(i=Cp){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=u=>{!u||u.sourceDataType!=="metadata"&&u.sourceDataType!=="visibility"&&u.dataType!=="style"&&u.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=i}getDefaultPosition(){return"bottom-right"}onAdd(i){return this._map=i,this._compact=this.options.compact,this._container=S.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=S.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=S.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(){S.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(i,u){let p=this._map._getUIString(`AttributionControl.${u}`);i.title=p,i.setAttribute("aria-label",p)}_updateAttributions(){if(!this._map.style)return;let i=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=i.concat(this.options.customAttribution.map(f=>typeof f!="string"?"":f)):typeof this.options.customAttribution=="string"&&i.push(this.options.customAttribution)),this._map.style.stylesheet){let f=this._map.style.stylesheet;this.styleOwner=f.owner,this.styleId=f.id}let u=this._map.style.sourceCaches;for(let f in u){let x=u[f];if(x.used||x.usedForTerrain){let E=x.getSource();E.attribution&&i.indexOf(E.attribution)<0&&i.push(E.attribution)}}i=i.filter(f=>String(f).trim()),i.sort((f,x)=>f.length-x.length),i=i.filter((f,x)=>{for(let E=x+1;E<i.length;E++)if(i[E].indexOf(f)>=0)return!1;return!0});let p=i.join(" | ");p!==this._attribHTML&&(this._attribHTML=p,i.length?(this._innerContainer.innerHTML=p,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class go{constructor(i={}){this._updateCompact=()=>{let u=this._container.children;if(u.length){let p=u[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&p.classList.add("maplibregl-compact"):p.classList.remove("maplibregl-compact")}},this.options=i}getDefaultPosition(){return"bottom-left"}onAdd(i){this._map=i,this._compact=this.options&&this.options.compact,this._container=S.create("div","maplibregl-ctrl");let u=S.create("a","maplibregl-ctrl-logo");return u.target="_blank",u.rel="noopener nofollow",u.href="https://maplibre.org/",u.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),u.setAttribute("rel","noopener nofollow"),this._container.appendChild(u),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){S.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class tt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){let u=++this._id;return this._queue.push({callback:i,id:u,cancelled:!1}),u}remove(i){let u=this._currentlyRunning,p=u?this._queue.concat(u):this._queue;for(let f of p)if(f.id===i)return void(f.cancelled=!0)}run(i=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let u=this._currentlyRunning=this._queue;this._queue=[];for(let p of u)if(!p.cancelled&&(p.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Yf=o.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Mp extends o.E{constructor(i){super(),this.sourceCache=i,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,i.usedForTerrain=!0,i.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(i,u){this.sourceCache.update(i,u),this._renderableTilesKeys=[];let p={};for(let f of i.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:u}))p[f.key]=!0,this._renderableTilesKeys.push(f.key),this._tiles[f.key]||(f.posMatrix=new Float64Array(16),o.aQ(f.posMatrix,0,o.X,0,o.X,0,1),this._tiles[f.key]=new fo(f,this.tileSize));for(let f in this._tiles)p[f]||delete this._tiles[f]}freeRtt(i){for(let u in this._tiles){let p=this._tiles[u];(!i||p.tileID.equals(i)||p.tileID.isChildOf(i)||i.isChildOf(p.tileID))&&(p.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(i=>this.getTileByID(i))}getTileByID(i){return this._tiles[i]}getTerrainCoords(i){let u={};for(let p of this._renderableTilesKeys){let f=this._tiles[p].tileID;if(f.canonical.equals(i.canonical)){let x=i.clone();x.posMatrix=new Float64Array(16),o.aQ(x.posMatrix,0,o.X,0,o.X,0,1),u[p]=x}else if(f.canonical.isChildOf(i.canonical)){let x=i.clone();x.posMatrix=new Float64Array(16);let E=f.canonical.z-i.canonical.z,P=f.canonical.x-(f.canonical.x>>E<<E),T=f.canonical.y-(f.canonical.y>>E<<E),R=o.X>>E;o.aQ(x.posMatrix,0,R,0,R,0,1),o.J(x.posMatrix,x.posMatrix,[-P*R,-T*R,0]),u[p]=x}else if(i.canonical.isChildOf(f.canonical)){let x=i.clone();x.posMatrix=new Float64Array(16);let E=i.canonical.z-f.canonical.z,P=i.canonical.x-(i.canonical.x>>E<<E),T=i.canonical.y-(i.canonical.y>>E<<E),R=o.X>>E;o.aQ(x.posMatrix,0,o.X,0,o.X,0,1),o.J(x.posMatrix,x.posMatrix,[P*R,T*R,0]),o.K(x.posMatrix,x.posMatrix,[1/2**E,1/2**E,0]),u[p]=x}}return u}getSourceTile(i,u){let p=this.sourceCache._source,f=i.overscaledZ-this.deltaZoom;if(f>p.maxzoom&&(f=p.maxzoom),f<p.minzoom)return null;this._sourceTileCache[i.key]||(this._sourceTileCache[i.key]=i.scaledTo(f).key);let x=this.sourceCache.getTileByID(this._sourceTileCache[i.key]);if((!x||!x.dem)&&u)for(;f>=p.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(i.scaledTo(f--).key);return x}tilesAfterTime(i=Date.now()){return Object.values(this._tiles).filter(u=>u.timeAdded>=i)}}class Jf{constructor(i,u,p){this.painter=i,this.sourceCache=new Mp(u),this.options=p,this.exaggeration=typeof p.exaggeration=="number"?p.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(i,u,p,f=o.X){var x;if(!(u>=0&&u<f&&p>=0&&p<f))return 0;let E=this.getTerrainData(i),P=(x=E.tile)===null||x===void 0?void 0:x.dem;if(!P)return 0;let T=function(K,re,Y){var ne=re[0],ue=re[1];return K[0]=Y[0]*ne+Y[4]*ue+Y[12],K[1]=Y[1]*ne+Y[5]*ue+Y[13],K}([],[u/f*o.X,p/f*o.X],E.u_terrain_matrix),R=[T[0]*P.dim,T[1]*P.dim],O=Math.floor(R[0]),D=Math.floor(R[1]),G=R[0]-O,W=R[1]-D;return P.get(O,D)*(1-G)*(1-W)+P.get(O+1,D)*G*(1-W)+P.get(O,D+1)*(1-G)*W+P.get(O+1,D+1)*G*W}getElevationForLngLatZoom(i,u){let{tileID:p,mercatorX:f,mercatorY:x}=this._getOverscaledTileIDFromLngLatZoom(i,u);return this.getElevation(p,f%o.X,x%o.X,o.X)}getElevation(i,u,p,f=o.X){return this.getDEMElevation(i,u,p,f)*this.exaggeration}getTerrainData(i){if(!this._emptyDemTexture){let f=this.painter.context,x=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Ae(f,x,f.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ae(f,new o.R({width:1,height:1}),f.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(f.gl.NEAREST,f.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.ao([])}let u=this.sourceCache.getSourceTile(i,!0);if(u&&u.dem&&(!u.demTexture||u.needsTerrainPrepare)){let f=this.painter.context;u.demTexture=this.painter.getTileTexture(u.dem.stride),u.demTexture?u.demTexture.update(u.dem.getPixels(),{premultiply:!1}):u.demTexture=new Ae(f,u.dem.getPixels(),f.gl.RGBA,{premultiply:!1}),u.demTexture.bind(f.gl.NEAREST,f.gl.CLAMP_TO_EDGE),u.needsTerrainPrepare=!1}let p=u&&u+u.tileID.key+i.key;if(p&&!this._demMatrixCache[p]){let f=this.sourceCache.sourceCache._source.maxzoom,x=i.canonical.z-u.tileID.canonical.z;i.overscaledZ>i.canonical.z&&(i.canonical.z>=f?x=i.canonical.z-f:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let E=i.canonical.x-(i.canonical.x>>x<<x),P=i.canonical.y-(i.canonical.y>>x<<x),T=o.bb(new Float64Array(16),[1/(o.X<<x),1/(o.X<<x),0]);o.J(T,T,[E*o.X,P*o.X,0]),this._demMatrixCache[i.key]={matrix:T,coord:i}}return{u_depth:2,u_terrain:3,u_terrain_dim:u&&u.dem&&u.dem.dim||1,u_terrain_matrix:p?this._demMatrixCache[i.key].matrix:this._emptyDemMatrix,u_terrain_unpack:u&&u.dem&&u.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(u&&u.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:u}}getFramebuffer(i){let u=this.painter,p=u.width/devicePixelRatio,f=u.height/devicePixelRatio;return!this._fbo||this._fbo.width===p&&this._fbo.height===f||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Ae(u.context,{width:p,height:f,data:null},u.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(u.context.gl.NEAREST,u.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Ae(u.context,{width:p,height:f,data:null},u.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(u.context.gl.NEAREST,u.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=u.context.createFramebuffer(p,f,!0,!1),this._fbo.depthAttachment.set(u.context.createRenderbuffer(u.context.gl.DEPTH_COMPONENT16,p,f))),this._fbo.colorAttachment.set(i==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let i=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let u=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let x=0,E=0;x<this._coordsTextureSize;x++)for(let P=0;P<this._coordsTextureSize;P++,E+=4)u[E+0]=255&P,u[E+1]=255&x,u[E+2]=P>>8<<4|x>>8,u[E+3]=0;let p=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(u.buffer)),f=new Ae(i,p,i.gl.RGBA,{premultiply:!1});return f.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._coordsTexture=f,f}pointCoordinate(i){this.painter.maybeDrawDepthAndCoords(!0);let u=new Uint8Array(4),p=this.painter.context,f=p.gl,x=Math.round(i.x*this.painter.pixelRatio/devicePixelRatio),E=Math.round(i.y*this.painter.pixelRatio/devicePixelRatio),P=Math.round(this.painter.height/devicePixelRatio);p.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),f.readPixels(x,P-E-1,1,1,f.RGBA,f.UNSIGNED_BYTE,u),p.bindFramebuffer.set(null);let T=u[0]+(u[2]>>4<<8),R=u[1]+((15&u[2])<<8),O=this.coordsIndex[255-u[3]],D=O&&this.sourceCache.getTileByID(O);if(!D)return null;let G=this._coordsTextureSize,W=(1<<D.tileID.canonical.z)*G;return new o.Z((D.tileID.canonical.x*G+T)/W+D.tileID.wrap,(D.tileID.canonical.y*G+R)/W,this.getElevation(D.tileID,T,R,G))}depthAtPoint(i){let u=new Uint8Array(4),p=this.painter.context,f=p.gl;return p.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),f.readPixels(i.x,this.painter.height/devicePixelRatio-i.y-1,1,1,f.RGBA,f.UNSIGNED_BYTE,u),p.bindFramebuffer.set(null),(u[0]/16777216+u[1]/65536+u[2]/256+u[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;let i=this.painter.context,u=new o.bc,p=new o.aY,f=this.meshSize,x=o.X/f,E=f*f;for(let D=0;D<=f;D++)for(let G=0;G<=f;G++)u.emplaceBack(G*x,D*x,0);for(let D=0;D<E;D+=f+1)for(let G=0;G<f;G++)p.emplaceBack(G+D,f+G+D+1,f+G+D+2),p.emplaceBack(G+D,f+G+D+2,G+D+1);let P=u.length,T=P+2*(f+1);for(let D of[0,1])for(let G=0;G<=f;G++)for(let W of[0,1])u.emplaceBack(G*x,D*o.X,W);for(let D=0;D<2*f;D+=2)p.emplaceBack(T+D,T+D+1,T+D+3),p.emplaceBack(T+D,T+D+3,T+D+2),p.emplaceBack(P+D,P+D+3,P+D+1),p.emplaceBack(P+D,P+D+2,P+D+3);let R=u.length,O=R+2*(f+1);for(let D of[0,1])for(let G=0;G<=f;G++)for(let W of[0,1])u.emplaceBack(D*o.X,G*x,W);for(let D=0;D<2*f;D+=2)p.emplaceBack(R+D,R+D+1,R+D+3),p.emplaceBack(R+D,R+D+3,R+D+2),p.emplaceBack(O+D,O+D+3,O+D+1),p.emplaceBack(O+D,O+D+2,O+D+3);return this._mesh=new qf(i.createVertexBuffer(u,Yf.members),i.createIndexBuffer(p),o.a0.simpleSegment(0,0,u.length,p.length)),this._mesh}getMeshFrameDelta(i){return 2*Math.PI*o.bd/Math.pow(2,i)/5}getMinTileElevationForLngLatZoom(i,u){var p;let{tileID:f}=this._getOverscaledTileIDFromLngLatZoom(i,u);return(p=this.getMinMaxElevation(f).minElevation)!==null&&p!==void 0?p:0}getMinMaxElevation(i){let u=this.getTerrainData(i).tile,p={minElevation:null,maxElevation:null};return u&&u.dem&&(p.minElevation=u.dem.min*this.exaggeration,p.maxElevation=u.dem.max*this.exaggeration),p}_getOverscaledTileIDFromLngLatZoom(i,u){let p=o.Z.fromLngLat(i.wrap()),f=(1<<u)*o.X,x=p.x*f,E=p.y*f,P=Math.floor(x/o.X),T=Math.floor(E/o.X);return{tileID:new o.S(u,0,u,P,T),mercatorX:x,mercatorY:E}}}class Pl{constructor(i,u,p){this._context=i,this._size=u,this._tileSize=p,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let i of this._objects)i.texture.destroy(),i.fbo.destroy()}_createObject(i){let u=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),p=new Ae(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return p.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),u.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),u.colorAttachment.set(p.texture),{id:i,fbo:u,texture:p,stamp:-1,inUse:!1}}getObjectForId(i){return this._objects[i]}useObject(i){i.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(u=>i.id!==u),this._recentlyUsed.push(i.id)}stampObject(i){i.stamp=++this._stamp}getOrCreateFreeObject(){for(let u of this._recentlyUsed)if(!this._objects[u].inUse)return this._objects[u];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let i=this._createObject(this._objects.length);return this._objects.push(i),i}freeObject(i){i.inUse=!1}freeAllObjects(){for(let i of this._objects)this.freeObject(i)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(i=>!i.inUse)===!1}}let yo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Qf{constructor(i,u){this.painter=i,this.terrain=u,this.pool=new Pl(i.context,30,u.sourceCache.tileSize*u.qualityFactor)}destruct(){this.pool.destruct()}getTexture(i){return this.pool.getObjectForId(i.rtt[this._stacks.length-1].id).texture}prepareForRender(i,u){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=i._order.filter(p=>!i._layers[p].isHidden(u)),this._coordsDescendingInv={};for(let p in i.sourceCaches){this._coordsDescendingInv[p]={};let f=i.sourceCaches[p].getVisibleCoordinates();for(let x of f){let E=this.terrain.sourceCache.getTerrainCoords(x);for(let P in E)this._coordsDescendingInv[p][P]||(this._coordsDescendingInv[p][P]=[]),this._coordsDescendingInv[p][P].push(E[P])}}this._coordsDescendingInvStr={};for(let p of i._order){let f=i._layers[p],x=f.source;if(yo[f.type]&&!this._coordsDescendingInvStr[x]){this._coordsDescendingInvStr[x]={};for(let E in this._coordsDescendingInv[x])this._coordsDescendingInvStr[x][E]=this._coordsDescendingInv[x][E].map(P=>P.key).sort().join()}}for(let p of this._renderableTiles)for(let f in this._coordsDescendingInvStr){let x=this._coordsDescendingInvStr[f][p.tileID.key];x&&x!==p.rttCoords[f]&&(p.rtt=[])}}renderLayer(i){if(i.isHidden(this.painter.transform.zoom))return!1;let u=i.type,p=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===i.id;if(yo[u]&&(this._prevType&&yo[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(i.id),!f))return!0;if(yo[this._prevType]||yo[u]&&f){this._prevType=u;let x=this._stacks.length-1,E=this._stacks[x]||[];for(let P of this._renderableTiles){if(this.pool.isFull()&&(xl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(P),P.rtt[x]){let R=this.pool.getObjectForId(P.rtt[x].id);if(R.stamp===P.rtt[x].stamp){this.pool.useObject(R);continue}}let T=this.pool.getOrCreateFreeObject();this.pool.useObject(T),this.pool.stampObject(T),P.rtt[x]={id:T.id,stamp:T.stamp},p.context.bindFramebuffer.set(T.fbo.framebuffer),p.context.clear({color:o.aN.transparent,stencil:0}),p.currentStencilSource=void 0;for(let R=0;R<E.length;R++){let O=p.style._layers[E[R]],D=O.source?this._coordsDescendingInv[O.source][P.tileID.key]:[P.tileID];p.context.viewport.set([0,0,T.fbo.width,T.fbo.height]),p._renderTileClippingMasks(O,D),p.renderLayer(p,p.style.sourceCaches[O.source],O,D),O.source&&(P.rttCoords[O.source]=this._coordsDescendingInvStr[O.source][P.tileID.key])}}return xl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),yo[u]}return!1}}let He={"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 \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Rp=m,p_={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Cp,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:o.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},em=_=>{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},kp={showCompass:!0,showZoom:!0,visualizePitch:!1};class tm{constructor(i,u,p=!1){this.mousedown=E=>{this.startMouse(o.e({},E,{ctrlKey:!0,preventDefault:()=>E.preventDefault()}),S.mousePos(this.element,E)),S.addEventListener(window,"mousemove",this.mousemove),S.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=E=>{this.moveMouse(E,S.mousePos(this.element,E))},this.mouseup=E=>{this.mouseRotate.dragEnd(E),this.mousePitch&&this.mousePitch.dragEnd(E),this.offTemp()},this.touchstart=E=>{E.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=S.touchPos(this.element,E.targetTouches)[0],this.startTouch(E,this._startPos),S.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),S.addEventListener(window,"touchend",this.touchend))},this.touchmove=E=>{E.targetTouches.length!==1?this.reset():(this._lastPos=S.touchPos(this.element,E.targetTouches)[0],this.moveTouch(E,this._lastPos))},this.touchend=E=>{E.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;let f=i.dragRotate._mouseRotate.getClickTolerance(),x=i.dragRotate._mousePitch.getClickTolerance();this.element=u,this.mouseRotate=yp({clickTolerance:f,enable:!0}),this.touchRotate=(({enable:E,clickTolerance:P,bearingDegreesPerPixelMoved:T=.8})=>{let R=new Yc;return new yr({clickTolerance:P,move:(O,D)=>({bearingDelta:(D.x-O.x)*T}),moveStateManager:R,enable:E,assignEvents:em})})({clickTolerance:f,enable:!0}),this.map=i,p&&(this.mousePitch=$s({clickTolerance:x,enable:!0}),this.touchPitch=(({enable:E,clickTolerance:P,pitchDegreesPerPixelMoved:T=-.5})=>{let R=new Yc;return new yr({clickTolerance:P,move:(O,D)=>({pitchDelta:(D.y-O.y)*T}),moveStateManager:R,enable:E,assignEvents:em})})({clickTolerance:x,enable:!0})),S.addEventListener(u,"mousedown",this.mousedown),S.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),S.addEventListener(u,"touchcancel",this.reset)}startMouse(i,u){this.mouseRotate.dragStart(i,u),this.mousePitch&&this.mousePitch.dragStart(i,u),S.disableDrag()}startTouch(i,u){this.touchRotate.dragStart(i,u),this.touchPitch&&this.touchPitch.dragStart(i,u),S.disableDrag()}moveMouse(i,u){let p=this.map,{bearingDelta:f}=this.mouseRotate.dragMove(i,u)||{};if(f&&p.setBearing(p.getBearing()+f),this.mousePitch){let{pitchDelta:x}=this.mousePitch.dragMove(i,u)||{};x&&p.setPitch(p.getPitch()+x)}}moveTouch(i,u){let p=this.map,{bearingDelta:f}=this.touchRotate.dragMove(i,u)||{};if(f&&p.setBearing(p.getBearing()+f),this.touchPitch){let{pitchDelta:x}=this.touchPitch.dragMove(i,u)||{};x&&p.setPitch(p.getPitch()+x)}}off(){let i=this.element;S.removeEventListener(i,"mousedown",this.mousedown),S.removeEventListener(i,"touchstart",this.touchstart,{passive:!1}),S.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),S.removeEventListener(window,"touchend",this.touchend),S.removeEventListener(i,"touchcancel",this.reset),this.offTemp()}offTemp(){S.enableDrag(),S.removeEventListener(window,"mousemove",this.mousemove),S.removeEventListener(window,"mouseup",this.mouseup),S.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),S.removeEventListener(window,"touchend",this.touchend)}}let ns;function rm(_,i,u){let p=new o.N(_.lng,_.lat);if(_=new o.N(_.lng,_.lat),i){let f=new o.N(_.lng-360,_.lat),x=new o.N(_.lng+360,_.lat),E=u.locationPoint(_).distSqr(i);u.locationPoint(f).distSqr(i)<E?_=f:u.locationPoint(x).distSqr(i)<E&&(_=x)}for(;Math.abs(_.lng-u.center.lng)>180;){let f=u.locationPoint(_);if(f.x>=0&&f.y>=0&&f.x<=u.width&&f.y<=u.height)break;_.lng>u.center.lng?_.lng-=360:_.lng+=360}return _.lng!==p.lng&&u.locationPoint(_).y>u.height/2-u.getHorizon()?_:p}let Fp={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 os(_,i,u){let p=_.classList;for(let f in Fp)p.remove(`maplibregl-${u}-anchor-${f}`);p.add(`maplibregl-${u}-anchor-${i}`)}class dr extends o.E{constructor(i){if(super(),this._onKeyPress=u=>{let p=u.code,f=u.charCode||u.keyCode;p!=="Space"&&p!=="Enter"&&f!==32&&f!==13||this.togglePopup()},this._onMapClick=u=>{let p=u.originalEvent.target,f=this._element;this._popup&&(p===f||f.contains(p))&&this.togglePopup()},this._update=u=>{var p;if(!this._map)return;let f=this._map.loaded()&&!this._map.isMoving();(u?.type==="terrain"||u?.type==="render"&&!f)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?rm(this._lngLat,this._flatPos,this._map.transform):(p=this._lngLat)===null||p===void 0?void 0:p.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 x="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?x=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(x=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let E="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?E="rotateX(0deg)":this._pitchAlignment==="map"&&(E=`rotateX(${this._map.getPitch()}deg)`),u&&u.type!=="moveend"||(this._pos=this._pos.round()),S.setTransform(this._element,`${Fp[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${E} ${x}`),A.frameAsync(new AbortController).then(()=>{this._updateOpacity(u&&u.type==="moveend")}).catch(()=>{})},this._onMove=u=>{if(!this._isDragging){let p=this._clickTolerance||this._map._clickTolerance;this._isDragging=u.point.dist(this._pointerdownPos)>=p}this._isDragging&&(this._pos=u.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.k("dragstart"))),this.fire(new o.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 o.k("dragend")),this._state="inactive"},this._addDragHandler=u=>{this._element.contains(u.originalEvent.target)&&(u.preventDefault(),this._positionDelta=u.point.sub(this._pos).add(this._offset),this._pointerdownPos=u.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=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment!=="auto"?i.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(i?.opacity,i?.opacityWhenCovered),i&&i.element)this._element=i.element,this._offset=o.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=S.create("div");let u=S.createNS("http://www.w3.org/2000/svg","svg"),p=41,f=27;u.setAttributeNS(null,"display","block"),u.setAttributeNS(null,"height",`${p}px`),u.setAttributeNS(null,"width",`${f}px`),u.setAttributeNS(null,"viewBox",`0 0 ${f} ${p}`);let x=S.createNS("http://www.w3.org/2000/svg","g");x.setAttributeNS(null,"stroke","none"),x.setAttributeNS(null,"stroke-width","1"),x.setAttributeNS(null,"fill","none"),x.setAttributeNS(null,"fill-rule","evenodd");let E=S.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill-rule","nonzero");let P=S.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"transform","translate(3.0, 29.0)"),P.setAttributeNS(null,"fill","#000000");let T=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let ne of T){let ue=S.createNS("http://www.w3.org/2000/svg","ellipse");ue.setAttributeNS(null,"opacity","0.04"),ue.setAttributeNS(null,"cx","10.5"),ue.setAttributeNS(null,"cy","5.80029008"),ue.setAttributeNS(null,"rx",ne.rx),ue.setAttributeNS(null,"ry",ne.ry),P.appendChild(ue)}let R=S.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill",this._color);let O=S.createNS("http://www.w3.org/2000/svg","path");O.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"),R.appendChild(O);let D=S.createNS("http://www.w3.org/2000/svg","g");D.setAttributeNS(null,"opacity","0.25"),D.setAttributeNS(null,"fill","#000000");let G=S.createNS("http://www.w3.org/2000/svg","path");G.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"),D.appendChild(G);let W=S.createNS("http://www.w3.org/2000/svg","g");W.setAttributeNS(null,"transform","translate(6.0, 7.0)"),W.setAttributeNS(null,"fill","#FFFFFF");let K=S.createNS("http://www.w3.org/2000/svg","g");K.setAttributeNS(null,"transform","translate(8.0, 8.0)");let re=S.createNS("http://www.w3.org/2000/svg","circle");re.setAttributeNS(null,"fill","#000000"),re.setAttributeNS(null,"opacity","0.25"),re.setAttributeNS(null,"cx","5.5"),re.setAttributeNS(null,"cy","5.5"),re.setAttributeNS(null,"r","5.4999962");let Y=S.createNS("http://www.w3.org/2000/svg","circle");Y.setAttributeNS(null,"fill","#FFFFFF"),Y.setAttributeNS(null,"cx","5.5"),Y.setAttributeNS(null,"cy","5.5"),Y.setAttributeNS(null,"r","5.4999962"),K.appendChild(re),K.appendChild(Y),E.appendChild(P),E.appendChild(R),E.appendChild(D),E.appendChild(W),E.appendChild(K),u.appendChild(E),u.setAttributeNS(null,"height",p*this._scale+"px"),u.setAttributeNS(null,"width",f*this._scale+"px"),this._element.appendChild(u),this._offset=o.P.convert(i&&i.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",u=>{u.preventDefault()}),this._element.addEventListener("mousedown",u=>{u.preventDefault()}),os(this._element,this._anchor,"marker"),i&&i.className)for(let u of i.className.split(" "))this._element.classList.add(u);this._popup=null}addTo(i){return this.remove(),this._map=i,this._element.setAttribute("aria-label",i._getUIString("Marker.Title")),i.getCanvasContainer().appendChild(this._element),i.on("move",this._update),i.on("moveend",this._update),i.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),S.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=o.N.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){let f=Math.abs(13.5)/Math.SQRT2;i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[f,-1*(38.1-13.5+f)],"bottom-right":[-f,-1*(38.1-13.5+f)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=i,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let i=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:i?(i.isOpen()?i.remove():(i.setLngLat(this._lngLat),i.addTo(this._map)),this):this}_updateOpacity(i=!1){var u,p;if(!(!((u=this._map)===null||u===void 0)&&u.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(i)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let f=this._map,x=f.terrain.depthAtPoint(this._pos),E=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,E)-x<.006)return void(this._element.style.opacity=this._opacity);let P=-this._offset.y/f.transform._pixelPerMeter,T=Math.sin(f.getPitch()*Math.PI/180)*P,R=f.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),O=f.transform.lngLatToCameraDepth(this._lngLat,E+T)-R>.006;!((p=this._popup)===null||p===void 0)&&p.isOpen()&&O&&this._popup.remove(),this._element.style.opacity=O?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(i){return this._offset=o.P.convert(i),this._update(),this}addClassName(i){this._element.classList.add(i)}removeClassName(i){this._element.classList.remove(i)}toggleClassName(i){return this._element.classList.toggle(i)}setDraggable(i){return this._draggable=!!i,this._map&&(i?(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(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&i!=="auto"?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(i,u){return i===void 0&&u===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),i!==void 0&&(this._opacity=i),u!==void 0&&(this._opacityWhenCovered=u),this._map&&this._updateOpacity(!0),this}}let Jc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Ea=0,Ia=!1,im={maxWidth:100,unit:"metric"};function Lp(_,i,u){let p=u&&u.maxWidth||100,f=_._container.clientHeight/2,x=_.unproject([0,f]),E=_.unproject([p,f]),P=x.distanceTo(E);if(u&&u.unit==="imperial"){let T=3.2808*P;T>5280?Tl(i,p,T/5280,_._getUIString("ScaleControl.Miles")):Tl(i,p,T,_._getUIString("ScaleControl.Feet"))}else u&&u.unit==="nautical"?Tl(i,p,P/1852,_._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Tl(i,p,P/1e3,_._getUIString("ScaleControl.Kilometers")):Tl(i,p,P,_._getUIString("ScaleControl.Meters"))}function Tl(_,i,u,p){let f=function(x){let E=Math.pow(10,`${Math.floor(x)}`.length-1),P=x/E;return P=P>=10?10:P>=5?5:P>=3?3:P>=2?2:P>=1?1:function(T){let R=Math.pow(10,Math.ceil(-Math.log(T)/Math.LN10));return Math.round(T*R)/R}(P),E*P}(u);_.style.width=i*(f/u)+"px",_.innerHTML=`${f}&nbsp;${p}`}let _o={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Qc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function lt(_){if(_){if(typeof _=="number"){let i=Math.round(Math.abs(_)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,_),"top-left":new o.P(i,i),"top-right":new o.P(-i,i),bottom:new o.P(0,-_),"bottom-left":new o.P(i,-i),"bottom-right":new o.P(-i,-i),left:new o.P(_,0),right:new o.P(-_,0)}}if(_ instanceof o.P||Array.isArray(_)){let i=o.P.convert(_);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:o.P.convert(_.center||[0,0]),top:o.P.convert(_.top||[0,0]),"top-left":o.P.convert(_["top-left"]||[0,0]),"top-right":o.P.convert(_["top-right"]||[0,0]),bottom:o.P.convert(_.bottom||[0,0]),"bottom-left":o.P.convert(_["bottom-left"]||[0,0]),"bottom-right":o.P.convert(_["bottom-right"]||[0,0]),left:o.P.convert(_.left||[0,0]),right:o.P.convert(_.right||[0,0])}}return lt(new o.P(0,0))}let mt=m;l.AJAXError=o.bg,l.Evented=o.E,l.LngLat=o.N,l.MercatorCoordinate=o.Z,l.Point=o.P,l.addProtocol=o.bh,l.config=o.a,l.removeProtocol=o.bi,l.AttributionControl=Aa,l.BoxZoomHandler=fp,l.CanvasSource=Fi,l.CooperativeGesturesHandler=Jn,l.DoubleClickZoomHandler=Ip,l.DragPanHandler=Rn,l.DragRotateHandler=Yn,l.EdgeInsets=$c,l.FullscreenControl=class extends o.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var i;let u=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((i=u?.shadowRoot)===null||i===void 0)&&i.fullscreenElement;)u=u.shadowRoot.fullscreenElement;u===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:o.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=S.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){S.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let _=this._fullscreenButton=S.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);S.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new o.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.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()}},l.GeoJSONSource=Xn,l.GeolocateControl=class extends o.E{constructor(_){super(),this._onSuccess=i=>{if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new o.k("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,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(i),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(i),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.k("geolocate",i)),this._finish()}},this._updateCamera=i=>{let u=new o.N(i.coords.longitude,i.coords.latitude),p=i.coords.accuracy,f=this._map.getBearing(),x=o.e({bearing:f},this.options.fitBoundsOptions),E=Ee.fromLngLat(u,p);this._map.fitBounds(E,x,{geolocateSource:!0})},this._updateMarker=i=>{if(i){let u=new o.N(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(u).addTo(this._map),this._userLocationDotMarker.setLngLat(u).addTo(this._map),this._accuracy=i.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=i=>{if(this._map){if(this.options.trackUserLocation)if(i.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;let u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(i.code===3&&Ia)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.k("error",i)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=i=>{if(this._map){if(this._container.addEventListener("contextmenu",u=>u.preventDefault()),this._geolocateButton=S.create("button","maplibregl-ctrl-geolocate",this._container),S.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",i===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");let u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}else{let u=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=S.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new dr({element:this._dotElement}),this._circleElement=S.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new dr({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",u=>{u.geolocateSource||this._watchState!=="ACTIVE_LOCK"||u.originalEvent&&u.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new o.k("trackuserlocationend")),this.fire(new o.k("userlocationlostfocus")))})}},this.options=o.e({},Jc,_)}onAdd(_){return this._map=_,this._container=S.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return o._(this,arguments,void 0,function*(i=!1){if(ns!==void 0&&!i)return ns;if(window.navigator.permissions===void 0)return ns=!!window.navigator.geolocation,ns;try{ns=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{ns=!!window.navigator.geolocation}return ns})}().then(i=>this._setupUI(i)),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(),S.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ea=0,Ia=!1}_isOutOfMapMaxBounds(_){let i=this._map.getMaxBounds(),u=_.coords;return i&&(u.longitude<i.getWest()||u.longitude>i.getEast()||u.latitude<i.getSouth()||u.latitude>i.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(){let _=this._map.getBounds(),i=_.getSouthEast(),u=_.getNorthEast(),p=i.distanceTo(u),f=Math.ceil(this._accuracy/(p/this._map._container.clientHeight)*2);this._circleElement.style.width=`${f}px`,this._circleElement.style.height=`${f}px`}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ea--,Ia=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new o.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 o.k("trackuserlocationstart")),this.fire(new o.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 _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ea++,Ea>1?(_={maximumAge:6e5,timeout:0},Ia=!0):(_=this.options.positionOptions,Ia=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}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)}},l.Hash=vl,l.ImageSource=Yi,l.KeyboardHandler=Sp,l.LngLatBounds=Ee,l.LogoControl=go,l.Map=class extends h_{constructor(_){o.be.mark(o.bf.create);let i=Object.assign(Object.assign({},p_),_);if(i.minZoom!=null&&i.maxZoom!=null&&i.minZoom>i.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(i.minPitch!=null&&i.maxPitch!=null&&i.minPitch>i.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(i.minPitch!=null&&i.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(i.maxPitch!=null&&i.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new cp(i.minZoom,i.maxZoom,i.minPitch,i.maxPitch,i.renderWorldCopies),{bearingSnap:i.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new tt,this._controls=[],this._mapId=o.a4(),this._contextLost=u=>{u.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.k("webglcontextlost",{originalEvent:u}))},this._contextRestored=u=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.k("webglcontextrestored",{originalEvent:u}))},this._onMapScroll=u=>{if(u.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=i.interactive,this._maxTileCacheSize=i.maxTileCacheSize,this._maxTileCacheZoomLevels=i.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=i.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=i.preserveDrawingBuffer===!0,this._antialias=i.antialias===!0,this._trackResize=i.trackResize===!0,this._bearingSnap=i.bearingSnap,this._refreshExpiredTiles=i.refreshExpiredTiles===!0,this._fadeDuration=i.fadeDuration,this._crossSourceCollisions=i.crossSourceCollisions===!0,this._collectResourceTiming=i.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},He),i.locale),this._clickTolerance=i.clickTolerance,this._overridePixelRatio=i.pixelRatio,this._maxCanvasSize=i.maxCanvasSize,this.transformCameraUpdate=i.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=i.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=H.addThrottleControl(()=>this.isMoving()),this._requestManager=new ae(i.transformRequest),typeof i.container=="string"){if(this._container=document.getElementById(i.container),!this._container)throw new Error(`Container '${i.container}' not found.`)}else{if(!(i.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=i.container}if(i.maxBounds&&this.setMaxBounds(i.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 u=!1,p=Wc(f=>{this._trackResize&&!this._removed&&this.resize(f)._update()},50);this._resizeObserver=new ResizeObserver(f=>{u?p(f):u=!0}),this._resizeObserver.observe(this._container)}this.handlers=new u_(this,i),this._hash=i.hash&&new vl(typeof i.hash=="string"&&i.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch}),i.bounds&&(this.resize(),this.fitBounds(i.bounds,o.e({},i.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=i.localIdeographFontFamily,this._validateStyle=i.validateStyle,i.style&&this.setStyle(i.style,{localIdeographFontFamily:i.localIdeographFontFamily}),i.attributionControl&&this.addControl(new Aa(typeof i.attributionControl=="boolean"?void 0:i.attributionControl)),i.maplibreLogo&&this.addControl(new go,i.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",u=>{this._update(u.dataType==="style"),this.fire(new o.k(`${u.dataType}data`,u))}),this.on("dataloading",u=>{this.fire(new o.k(`${u.dataType}dataloading`,u))}),this.on("dataabort",u=>{this.fire(new o.k("sourcedataabort",u))})}_getMapId(){return this._mapId}addControl(_,i){if(i===void 0&&(i=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new o.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let u=_.onAdd(this);this._controls.push(_);let p=this._controlPositions[i];return i.indexOf("bottom")!==-1?p.insertBefore(u,p.firstChild):p.appendChild(u),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new o.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let i=this._controls.indexOf(_);return i>-1&&this._controls.splice(i,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,i,u,p){return p==null&&this.terrain&&(p=this.terrain.getElevationForLngLatZoom(u,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,i,u,p)}resize(_){var i;let u=this._containerDimensions(),p=u[0],f=u[1],x=this._getClampedPixelRatio(p,f);if(this._resizeCanvas(p,f,x),this.painter.resize(p,f,x),this.painter.overLimit()){let P=this.painter.context.gl;this._maxCanvasSize=[P.drawingBufferWidth,P.drawingBufferHeight];let T=this._getClampedPixelRatio(p,f);this._resizeCanvas(p,f,T),this.painter.resize(p,f,T)}this.transform.resize(p,f),(i=this._requestedCameraState)===null||i===void 0||i.resize(p,f);let E=!this._moving;return E&&(this.stop(),this.fire(new o.k("movestart",_)).fire(new o.k("move",_))),this.fire(new o.k("resize",_)),E&&this.fire(new o.k("moveend",_)),this}_getClampedPixelRatio(_,i){let{0:u,1:p}=this._maxCanvasSize,f=this.getPixelRatio(),x=_*f,E=i*f;return Math.min(x>u?u/x:1,E>p?p/E:1)*f}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(Ee.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(o.N.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(o.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,i,u){if(_==="mouseenter"||_==="mouseover"){let p=!1;return{layer:i,listener:u,delegates:{mousemove:x=>{let E=this.getLayer(i)?this.queryRenderedFeatures(x.point,{layers:[i]}):[];E.length?p||(p=!0,u.call(this,new Di(_,this,x.originalEvent,{features:E}))):p=!1},mouseout:()=>{p=!1}}}}if(_==="mouseleave"||_==="mouseout"){let p=!1;return{layer:i,listener:u,delegates:{mousemove:E=>{(this.getLayer(i)?this.queryRenderedFeatures(E.point,{layers:[i]}):[]).length?p=!0:p&&(p=!1,u.call(this,new Di(_,this,E.originalEvent)))},mouseout:E=>{p&&(p=!1,u.call(this,new Di(_,this,E.originalEvent)))}}}}{let p=f=>{let x=this.getLayer(i)?this.queryRenderedFeatures(f.point,{layers:[i]}):[];x.length&&(f.features=x,u.call(this,f),delete f.features)};return{layer:i,listener:u,delegates:{[_]:p}}}}on(_,i,u){if(u===void 0)return super.on(_,i);let p=this._createDelegatedListener(_,i,u);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(p);for(let f in p.delegates)this.on(f,p.delegates[f]);return this}once(_,i,u){if(u===void 0)return super.once(_,i);let p=this._createDelegatedListener(_,i,u);for(let f in p.delegates)this.once(f,p.delegates[f]);return this}off(_,i,u){return u===void 0?super.off(_,i):(this._delegatedListeners&&this._delegatedListeners[_]&&(p=>{let f=this._delegatedListeners[_];for(let x=0;x<f.length;x++){let E=f[x];if(E.layer===i&&E.listener===u){for(let P in E.delegates)this.off(P,E.delegates[P]);return f.splice(x,1),this}}})(),this)}queryRenderedFeatures(_,i){if(!this.style)return[];let u,p=_ instanceof o.P||Array.isArray(_),f=p?_:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(p?{}:_)||{},f instanceof o.P||typeof f[0]=="number")u=[o.P.convert(f)];else{let x=o.P.convert(f[0]),E=o.P.convert(f[1]);u=[x,new o.P(E.x,x.y),E,new o.P(x.x,E.y),x]}return this.style.queryRenderedFeatures(u,i,this.transform)}querySourceFeatures(_,i){return this.style.querySourceFeatures(_,i)}setStyle(_,i){return(i=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff!==!1&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&_?(this._diffStyle(_,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(_,i))}setTransformRequest(_){return this._requestManager.setTransformRequest(_),this}_getUIString(_){let i=this._locale[_];if(i==null)throw new Error(`Missing UI string '${_}'`);return i}_updateStyle(_,i){if(i.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(_,i));let u=this.style&&i.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new qh(this,i||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,i,u):this.style.loadJSON(_,i,u),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new qh(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,i){if(typeof _=="string"){let u=this._requestManager.transformRequest(_,"Style");o.h(u,new AbortController).then(p=>{this._updateDiff(p.data,i)}).catch(p=>{p&&this.fire(new o.j(p))})}else typeof _=="object"&&this._updateDiff(_,i)}_updateDiff(_,i){try{this.style.setState(_,i)&&this._update(!0)}catch(u){o.w(`Unable to perform style diff: ${u.message||u.error||u}. Rebuilding the style from scratch.`),this._updateStyle(_,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.w("There is no style added to the map.")}addSource(_,i){return this._lazyInitEmptyStyle(),this.style.addSource(_,i),this._update(!0)}isSourceLoaded(_){let i=this.style&&this.style.sourceCaches[_];if(i!==void 0)return i.loaded();this.fire(new o.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){let i=this.style.sourceCaches[_.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&i.reload();for(let u in this.style._layers){let p=this.style._layers[u];p.type==="hillshade"&&p.source===_.source&&o.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Jf(this.painter,i,_),this.painter.renderToTexture=new Qf(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=u=>{u.dataType==="style"?this.terrain.sourceCache.freeRtt():u.dataType==="source"&&u.tile&&(u.sourceId!==_.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(u.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 o.k("terrain",{terrain:_})),this}getTerrain(){var _,i;return(i=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&i!==void 0?i:null}areTilesLoaded(){let _=this.style&&this.style.sourceCaches;for(let i in _){let u=_[i]._tiles;for(let p in u){let f=u[p];if(f.state!=="loaded"&&f.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,i,u={}){let{pixelRatio:p=1,sdf:f=!1,stretchX:x,stretchY:E,content:P,textFitWidth:T,textFitHeight:R}=u;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||o.b(i))){if(i.width===void 0||i.height===void 0)return this.fire(new o.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`")));{let{width:O,height:D,data:G}=i,W=i;return this.style.addImage(_,{data:new o.R({width:O,height:D},new Uint8Array(G)),pixelRatio:p,stretchX:x,stretchY:E,content:P,textFitWidth:T,textFitHeight:R,sdf:f,version:0,userImage:W}),W.onAdd&&W.onAdd(this,_),this}}{let{width:O,height:D,data:G}=A.getImageData(i);this.style.addImage(_,{data:new o.R({width:O,height:D},G),pixelRatio:p,stretchX:x,stretchY:E,content:P,textFitWidth:T,textFitHeight:R,sdf:f,version:0})}}updateImage(_,i){let u=this.style.getImage(_);if(!u)return this.fire(new o.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let p=i instanceof HTMLImageElement||o.b(i)?A.getImageData(i):i,{width:f,height:x,data:E}=p;if(f===void 0||x===void 0)return this.fire(new o.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(f!==u.data.width||x!==u.data.height)return this.fire(new o.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let P=!(i instanceof HTMLImageElement||o.b(i));return u.data.replace(E,P),this.style.updateImage(_,u),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new o.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return H.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,i){return this._lazyInitEmptyStyle(),this.style.addLayer(_,i),this._update(!0)}moveLayer(_,i){return this.style.moveLayer(_,i),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,i,u){return this.style.setLayerZoomRange(_,i,u),this._update(!0)}setFilter(_,i,u={}){return this.style.setFilter(_,i,u),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,i,u,p={}){return this.style.setPaintProperty(_,i,u,p),this._update(!0)}getPaintProperty(_,i){return this.style.getPaintProperty(_,i)}setLayoutProperty(_,i,u,p={}){return this.style.setLayoutProperty(_,i,u,p),this._update(!0)}getLayoutProperty(_,i){return this.style.getLayoutProperty(_,i)}setGlyphs(_,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,i,u={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,i,u,p=>{p||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,i,u=>{u||this._update(!0)}),this}setLight(_,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,i),this._update(!0)}getLight(){return this.style.getLight()}setSky(_){return this._lazyInitEmptyStyle(),this.style.setSky(_),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(_,i){return this.style.setFeatureState(_,i),this._update()}removeFeatureState(_,i){return this.style.removeFeatureState(_,i),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,i=0;return this._container&&(_=this._container.clientWidth||400,i=this._container.clientHeight||300),[_,i]}_setupContainer(){let _=this._container;_.classList.add("maplibregl-map");let i=this._canvasContainer=S.create("div","maplibregl-canvas-container",_);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=S.create("canvas","maplibregl-canvas",i),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");let u=this._containerDimensions(),p=this._getClampedPixelRatio(u[0],u[1]);this._resizeCanvas(u[0],u[1],p);let f=this._controlContainer=S.create("div","maplibregl-control-container",_),x=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(E=>{x[E]=S.create("div",`maplibregl-ctrl-${E} `,f)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,i,u){this._canvas.width=Math.floor(u*_),this._canvas.height=Math.floor(u*i),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${i}px`}_setupPainter(){let _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},i=null;this._canvas.addEventListener("webglcontextcreationerror",p=>{i={requestedAttributes:_},p&&(i.statusMessage=p.statusMessage,i.type=p.type)},{once:!0});let u=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!u){let p="Failed to initialize WebGL";throw i?(i.message=p,new Error(JSON.stringify(i))):new Error(p)}this.painter=new $f(u,this.transform),M.testSupport(u)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){let i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let f=this.transform.zoom,x=A.now();this.style.zoomHistory.update(f,x);let E=new o.a9(f,{now:x,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),P=E.crossFadingFactor();P===1&&P===this._crossFadingFactor||(u=!0,this._crossFadingFactor=P),this.style.update(E)}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,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new o.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.be.mark(o.bf.load),this.fire(new o.k("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.k("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,o.be.mark(o.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;this._hash&&this._hash.remove();for(let u of this._controls)u.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),H.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();let i=this.painter.context.gl.getExtension("WEBGL_lose_context");i?.loseContext&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),S.remove(this._canvasContainer),S.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),o.be.clearMetrics(),this._removed=!0,this.fire(new o.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,A.frameAsync(this._frameRequest).then(_=>{o.be.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return Rp}getCameraTargetElevation(){return this.transform.elevation}},l.MapMouseEvent=Di,l.MapTouchEvent=bl,l.MapWheelEvent=pp,l.Marker=dr,l.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{let i=this._map.getZoom(),u=i===this._map.getMaxZoom(),p=i===this._map.getMinZoom();this._zoomInButton.disabled=u,this._zoomOutButton.disabled=p,this._zoomInButton.setAttribute("aria-disabled",u.toString()),this._zoomOutButton.setAttribute("aria-disabled",p.toString())},this._rotateCompassArrow=()=>{let i=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=i},this._setButtonTitle=(i,u)=>{let p=this._map._getUIString(`NavigationControl.${u}`);i.title=p,i.setAttribute("aria-label",p)},this.options=o.e({},kp,_),this._container=S.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),S.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),S.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=S.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,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 tm(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){S.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(_,i){let u=S.create("button",_,this._container);return u.type="button",u.addEventListener("click",i),u}},l.Popup=class extends o.E{constructor(_){super(),this.remove=()=>(this._content&&S.remove(this._content),this._container&&(S.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.k("close"))),this),this._onMouseUp=i=>{this._update(i.point)},this._onMouseMove=i=>{this._update(i.point)},this._onDrag=i=>{this._update(i.point)},this._update=i=>{var u;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=S.create("div","maplibregl-popup",this._map.getContainer()),this._tip=S.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let P of this.options.className.split(" "))this._container.classList.add(P);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?rm(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.wrap(),this._trackPointer&&!i)return;let p=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map.transform.locationPoint(this._lngLat));let f=this.options.anchor,x=lt(this.options.offset);if(!f){let P=this._container.offsetWidth,T=this._container.offsetHeight,R;R=p.y+x.bottom.y<T?["top"]:p.y>this._map.transform.height-T?["bottom"]:[],p.x<P/2?R.push("left"):p.x>this._map.transform.width-P/2&&R.push("right"),f=R.length===0?"bottom":R.join("-")}let E=p.add(x[f]);this.options.subpixelPositioning||(E=E.round()),S.setTransform(this._container,`${Fp[f]} translate(${E.x}px,${E.y}px)`),os(this._container,f,"popup")},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(_o),_)}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new o.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=o.N.convert(_),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(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){let i=document.createDocumentFragment(),u=document.createElement("body"),p;for(u.innerHTML=_;p=u.firstChild,p;)i.appendChild(p);return this.setDOMContent(i)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=S.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){return this._container&&this._container.classList.add(_),this}removeClassName(_){return this._container&&this._container.classList.remove(_),this}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=S.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let _=this._container.querySelector(Qc);_&&_.focus()}},l.RasterDEMTileSource=ir,l.RasterTileSource=Et,l.ScaleControl=class{constructor(_){this._onMove=()=>{Lp(this._map,this._container,this.options)},this.setUnit=i=>{this.options.unit=i,Lp(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},im),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=S.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){S.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},l.ScrollZoomHandler=Ep,l.Style=qh,l.TerrainControl=class{constructor(_){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=_}onAdd(_){return this._map=_,this._container=S.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=S.create("button","maplibregl-ctrl-terrain",this._container),S.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(){S.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},l.TwoFingersTouchPitchHandler=wp,l.TwoFingersTouchRotateHandler=bp,l.TwoFingersTouchZoomHandler=xp,l.TwoFingersTouchZoomRotateHandler=Pp,l.VectorTileSource=ki,l.VideoSource=Cn,l.addSourceType=(_,i)=>o._(void 0,void 0,void 0,function*(){if(Hn(_))throw new Error(`A source type called "${_}" already exists.`);((u,p)=>{po[u]=p})(_,i)}),l.clearPrewarmedResources=function(){let _=Fr;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(jt),Fr=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()"))},l.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},l.getRTLTextPluginStatus=function(){return Li().getRTLTextPluginStatus()},l.getVersion=function(){return mt},l.getWorkerCount=function(){return Pr.workerCount},l.getWorkerUrl=function(){return o.a.WORKER_URL},l.importScriptInWorkers=function(_){return En().broadcast("IS",_)},l.prewarm=function(){Mi().acquire(jt)},l.setMaxParallelImageRequests=function(_){o.a.MAX_PARALLEL_IMAGE_REQUESTS=_},l.setRTLTextPlugin=function(_,i){return Li().setRTLTextPlugin(_,i)},l.setWorkerCount=function(_){Pr.workerCount=_},l.setWorkerUrl=function(_){o.a.WORKER_URL=_}});var a=s;return a})});var ec=ke((bee,M2)=>{var i3="Expected a function",T2=NaN,n3="[object Symbol]",o3=/^\s+|\s+$/g,s3=/^[-+]0x[0-9a-f]+$/i,a3=/^0b[01]+$/i,l3=/^0o[0-7]+$/i,c3=parseInt,u3=typeof global=="object"&&global&&global.Object===Object&&global,h3=typeof self=="object"&&self&&self.Object===Object&&self,p3=u3||h3||Function("return this")(),d3=Object.prototype,f3=d3.toString,m3=Math.max,g3=Math.min,nb=function(){return p3.Date.now()};function y3(s,e,t){var a,l,o,m,g,b,A=0,S=!1,M=!1,k=!0;if(typeof s!="function")throw new TypeError(i3);e=C2(e)||0,ob(t)&&(S=!!t.leading,M="maxWait"in t,o=M?m3(C2(t.maxWait)||0,e):o,k="trailing"in t?!!t.trailing:k);function j(_e){var Pe=a,Re=l;return a=l=void 0,A=_e,m=s.apply(Re,Pe),m}function Z(_e){return A=_e,g=setTimeout(H,e),S?j(_e):m}function te(_e){var Pe=_e-b,Re=_e-A,Ae=e-Pe;return M?g3(Ae,o-Re):Ae}function q(_e){var Pe=_e-b,Re=_e-A;return b===void 0||Pe>=e||Pe<0||M&&Re>=o}function H(){var _e=nb();if(q(_e))return ae(_e);g=setTimeout(H,te(_e))}function ae(_e){return g=void 0,k&&a?j(_e):(a=l=void 0,m)}function pe(){g!==void 0&&clearTimeout(g),A=0,a=b=l=g=void 0}function ve(){return g===void 0?m:ae(nb())}function de(){var _e=nb(),Pe=q(_e);if(a=arguments,l=this,b=_e,Pe){if(g===void 0)return Z(b);if(M)return g=setTimeout(H,e),j(b)}return g===void 0&&(g=setTimeout(H,e)),m}return de.cancel=pe,de.flush=ve,de}function ob(s){var e=typeof s;return!!s&&(e=="object"||e=="function")}function _3(s){return!!s&&typeof s=="object"}function x3(s){return typeof s=="symbol"||_3(s)&&f3.call(s)==n3}function C2(s){if(typeof s=="number")return s;if(x3(s))return T2;if(ob(s)){var e=typeof s.valueOf=="function"?s.valueOf():s;s=ob(e)?e+"":e}if(typeof s!="string")return s===0?s:+s;s=s.replace(o3,"");var t=a3.test(s);return t||l3.test(s)?c3(s.slice(2),t?2:8):s3.test(s)?T2:+s}M2.exports=y3});var U2=ke((Kee,j2)=>{var N2="Expected a function",z2=NaN,w3="[object Symbol]",S3=/^\s+|\s+$/g,A3=/^[-+]0x[0-9a-f]+$/i,E3=/^0b[01]+$/i,I3=/^0o[0-7]+$/i,P3=parseInt,T3=typeof global=="object"&&global&&global.Object===Object&&global,C3=typeof self=="object"&&self&&self.Object===Object&&self,M3=T3||C3||Function("return this")(),R3=Object.prototype,k3=R3.toString,F3=Math.max,L3=Math.min,hb=function(){return M3.Date.now()};function D3(s,e,t){var a,l,o,m,g,b,A=0,S=!1,M=!1,k=!0;if(typeof s!="function")throw new TypeError(N2);e=B2(e)||0,Ag(t)&&(S=!!t.leading,M="maxWait"in t,o=M?F3(B2(t.maxWait)||0,e):o,k="trailing"in t?!!t.trailing:k);function j(_e){var Pe=a,Re=l;return a=l=void 0,A=_e,m=s.apply(Re,Pe),m}function Z(_e){return A=_e,g=setTimeout(H,e),S?j(_e):m}function te(_e){var Pe=_e-b,Re=_e-A,Ae=e-Pe;return M?L3(Ae,o-Re):Ae}function q(_e){var Pe=_e-b,Re=_e-A;return b===void 0||Pe>=e||Pe<0||M&&Re>=o}function H(){var _e=hb();if(q(_e))return ae(_e);g=setTimeout(H,te(_e))}function ae(_e){return g=void 0,k&&a?j(_e):(a=l=void 0,m)}function pe(){g!==void 0&&clearTimeout(g),A=0,a=b=l=g=void 0}function ve(){return g===void 0?m:ae(hb())}function de(){var _e=hb(),Pe=q(_e);if(a=arguments,l=this,b=_e,Pe){if(g===void 0)return Z(b);if(M)return g=setTimeout(H,e),j(b)}return g===void 0&&(g=setTimeout(H,e)),m}return de.cancel=pe,de.flush=ve,de}function O3(s,e,t){var a=!0,l=!0;if(typeof s!="function")throw new TypeError(N2);return Ag(t)&&(a="leading"in t?!!t.leading:a,l="trailing"in t?!!t.trailing:l),D3(s,e,{leading:a,maxWait:e,trailing:l})}function Ag(s){var e=typeof s;return!!s&&(e=="object"||e=="function")}function z3(s){return!!s&&typeof s=="object"}function B3(s){return typeof s=="symbol"||z3(s)&&k3.call(s)==w3}function B2(s){if(typeof s=="number")return s;if(B3(s))return z2;if(Ag(s)){var e=typeof s.valueOf=="function"?s.valueOf():s;s=Ag(e)?e+"":e}if(typeof s!="string")return s===0?s:+s;s=s.replace(S3,"");var t=E3.test(s);return t||I3.test(s)?P3(s.slice(2),t?2:8):A3.test(s)?z2:+s}j2.exports=O3});var Sb=ke((Are,eP)=>{"use strict";var Q2=Object.prototype.toString;eP.exports=function(e){var t=Q2.call(e),a=t==="[object Arguments]";return a||(a=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Q2.call(e.callee)==="[object Function]"),a}});var cP=ke((Ere,lP)=>{"use strict";var aP;Object.keys||(Qd=Object.prototype.hasOwnProperty,Ab=Object.prototype.toString,tP=Sb(),Eb=Object.prototype.propertyIsEnumerable,rP=!Eb.call({toString:null},"toString"),iP=Eb.call(function(){},"prototype"),ef=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],kg=function(s){var e=s.constructor;return e&&e.prototype===s},nP={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},oP=function(){if(typeof window>"u")return!1;for(var s in window)try{if(!nP["$"+s]&&Qd.call(window,s)&&window[s]!==null&&typeof window[s]=="object")try{kg(window[s])}catch{return!0}}catch{return!0}return!1}(),sP=function(s){if(typeof window>"u"||!oP)return kg(s);try{return kg(s)}catch{return!1}},aP=function(e){var t=e!==null&&typeof e=="object",a=Ab.call(e)==="[object Function]",l=tP(e),o=t&&Ab.call(e)==="[object String]",m=[];if(!t&&!a&&!l)throw new TypeError("Object.keys called on a non-object");var g=iP&&a;if(o&&e.length>0&&!Qd.call(e,0))for(var b=0;b<e.length;++b)m.push(String(b));if(l&&e.length>0)for(var A=0;A<e.length;++A)m.push(String(A));else for(var S in e)!(g&&S==="prototype")&&Qd.call(e,S)&&m.push(String(S));if(rP)for(var M=sP(e),k=0;k<ef.length;++k)!(M&&ef[k]==="constructor")&&Qd.call(e,ef[k])&&m.push(ef[k]);return m});var Qd,Ab,tP,Eb,rP,iP,ef,kg,nP,oP,sP;lP.exports=aP});var tf=ke((Ire,pP)=>{"use strict";var n5=Array.prototype.slice,o5=Sb(),uP=Object.keys,Fg=uP?function(e){return uP(e)}:cP(),hP=Object.keys;Fg.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(a){return o5(a)?hP(n5.call(a)):hP(a)})}else Object.keys=Fg;return Object.keys||Fg};pP.exports=Fg});var Uu=ke((Pre,dP)=>{"use strict";dP.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),a=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(a)!=="[object Symbol]")return!1;var l=42;e[t]=l;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var m=Object.getOwnPropertyDescriptor(e,t);if(m.value!==l||m.enumerable!==!0)return!1}return!0}});var ho=ke((Tre,mP)=>{"use strict";var fP=typeof Symbol<"u"&&Symbol,s5=Uu();mP.exports=function(){return typeof fP!="function"||typeof Symbol!="function"||typeof fP("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:s5()}});var yP=ke((Cre,gP)=>{"use strict";var a5="Function.prototype.bind called on incompatible ",Ib=Array.prototype.slice,l5=Object.prototype.toString,c5="[object Function]";gP.exports=function(e){var t=this;if(typeof t!="function"||l5.call(t)!==c5)throw new TypeError(a5+t);for(var a=Ib.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(Ib.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(Ib.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var xP=ke((Mre,_P)=>{"use strict";var u5=yP();_P.exports=Function.prototype.bind||u5});var bP=ke((Rre,vP)=>{"use strict";var h5="Function.prototype.bind called on incompatible ",Pb=Array.prototype.slice,p5=Object.prototype.toString,d5="[object Function]";vP.exports=function(e){var t=this;if(typeof t!="function"||p5.call(t)!==d5)throw new TypeError(h5+t);for(var a=Pb.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(Pb.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(Pb.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var SP=ke((kre,wP)=>{"use strict";var f5=bP();wP.exports=Function.prototype.bind||f5});var As=ke((Fre,AP)=>{"use strict";var m5=SP();AP.exports=m5.call(Function.call,Object.prototype.hasOwnProperty)});var MP=ke((Lre,CP)=>{"use strict";var $t,$u=SyntaxError,TP=Function,qu=TypeError,Tb=function(s){try{return TP('"use strict"; return ('+s+").constructor;")()}catch{}},tc=Object.getOwnPropertyDescriptor;if(tc)try{tc({},"")}catch{tc=null}var Cb=function(){throw new qu},g5=tc?function(){try{return arguments.callee,Cb}catch{try{return tc(arguments,"callee").get}catch{return Cb}}}():Cb,Gu=ho()(),Es=Object.getPrototypeOf||function(s){return s.__proto__},Vu={},y5=typeof Uint8Array>"u"?$t:Es(Uint8Array),rc={"%AggregateError%":typeof AggregateError>"u"?$t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$t:ArrayBuffer,"%ArrayIteratorPrototype%":Gu?Es([][Symbol.iterator]()):$t,"%AsyncFromSyncIteratorPrototype%":$t,"%AsyncFunction%":Vu,"%AsyncGenerator%":Vu,"%AsyncGeneratorFunction%":Vu,"%AsyncIteratorPrototype%":Vu,"%Atomics%":typeof Atomics>"u"?$t:Atomics,"%BigInt%":typeof BigInt>"u"?$t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?$t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$t:FinalizationRegistry,"%Function%":TP,"%GeneratorFunction%":Vu,"%Int8Array%":typeof Int8Array>"u"?$t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Gu?Es(Es([][Symbol.iterator]())):$t,"%JSON%":typeof JSON=="object"?JSON:$t,"%Map%":typeof Map>"u"?$t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Gu?$t:Es(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$t:Promise,"%Proxy%":typeof Proxy>"u"?$t:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?$t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Gu?$t:Es(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Gu?Es(""[Symbol.iterator]()):$t,"%Symbol%":Gu?Symbol:$t,"%SyntaxError%":$u,"%ThrowTypeError%":g5,"%TypedArray%":y5,"%TypeError%":qu,"%Uint8Array%":typeof Uint8Array>"u"?$t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$t:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?$t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$t:WeakSet};try{null.error}catch(s){EP=Es(Es(s)),rc["%Error.prototype%"]=EP}var EP,_5=function s(e){var t;if(e==="%AsyncFunction%")t=Tb("async function () {}");else if(e==="%GeneratorFunction%")t=Tb("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Tb("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&(t=Es(l.prototype))}return rc[e]=t,t},IP={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},rf=xP(),Lg=As(),x5=rf.call(Function.call,Array.prototype.concat),v5=rf.call(Function.apply,Array.prototype.splice),PP=rf.call(Function.call,String.prototype.replace),Dg=rf.call(Function.call,String.prototype.slice),b5=rf.call(Function.call,RegExp.prototype.exec),w5=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,S5=/\\(\\)?/g,A5=function(e){var t=Dg(e,0,1),a=Dg(e,-1);if(t==="%"&&a!=="%")throw new $u("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new $u("invalid intrinsic syntax, expected opening `%`");var l=[];return PP(e,w5,function(o,m,g,b){l[l.length]=g?PP(b,S5,"$1"):m||o}),l},E5=function(e,t){var a=e,l;if(Lg(IP,a)&&(l=IP[a],a="%"+l[0]+"%"),Lg(rc,a)){var o=rc[a];if(o===Vu&&(o=_5(a)),typeof o>"u"&&!t)throw new qu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new $u("intrinsic "+e+" does not exist!")};CP.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new qu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new qu('"allowMissing" argument must be a boolean');if(b5(/^%?[^%]*%?$/,e)===null)throw new $u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=A5(e),l=a.length>0?a[0]:"",o=E5("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],v5(a,x5([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=Dg(k,0,1),Z=Dg(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new $u("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",Lg(rc,m))g=rc[m];else if(g!=null){if(!(k in g)){if(!t)throw new qu("base intrinsic for "+e+" exists, but the property is not available.");return}if(tc&&S+1>=a.length){var te=tc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=Lg(g,k),g=g[k];M&&!b&&(rc[m]=g)}}return g}});var nf=ke((Dre,RP)=>{"use strict";var I5=MP(),Mb=I5("%Object.defineProperty%",!0),Rb=function(){if(Mb)try{return Mb({},"a",{value:1}),!0}catch{return!1}return!1};Rb.hasArrayLengthDefineBug=function(){if(!Rb())return null;try{return Mb([],"length",{value:1}).length!==1}catch{return!0}};RP.exports=Rb});var kb=ke((Ore,DP)=>{"use strict";var P5=tf(),T5=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",C5=Object.prototype.toString,M5=Array.prototype.concat,kP=Object.defineProperty,R5=function(s){return typeof s=="function"&&C5.call(s)==="[object Function]"},k5=nf()(),FP=kP&&k5,F5=function(s,e,t,a){if(e in s){if(a===!0){if(s[e]===t)return}else if(!R5(a)||!a())return}FP?kP(s,e,{configurable:!0,enumerable:!1,value:t,writable:!0}):s[e]=t},LP=function(s,e){var t=arguments.length>2?arguments[2]:{},a=P5(e);T5&&(a=M5.call(a,Object.getOwnPropertySymbols(e)));for(var l=0;l<a.length;l+=1)F5(s,a[l],e[a[l]],t[a[l]])};LP.supportsDescriptors=!!FP;DP.exports=LP});var zP=ke((zre,OP)=>{"use strict";var L5="Function.prototype.bind called on incompatible ",Fb=Array.prototype.slice,D5=Object.prototype.toString,O5="[object Function]";OP.exports=function(e){var t=this;if(typeof t!="function"||D5.call(t)!==O5)throw new TypeError(L5+t);for(var a=Fb.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(Fb.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(Fb.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var Lb=ke((Bre,BP)=>{"use strict";var z5=zP();BP.exports=Function.prototype.bind||z5});var zb=ke((Nre,VP)=>{"use strict";var Wt,Hu=SyntaxError,GP=Function,Xu=TypeError,Db=function(s){try{return GP('"use strict"; return ('+s+").constructor;")()}catch{}},ic=Object.getOwnPropertyDescriptor;if(ic)try{ic({},"")}catch{ic=null}var Ob=function(){throw new Xu},B5=ic?function(){try{return arguments.callee,Ob}catch{try{return ic(arguments,"callee").get}catch{return Ob}}}():Ob,Wu=ho()(),Is=Object.getPrototypeOf||function(s){return s.__proto__},Zu={},N5=typeof Uint8Array>"u"?Wt:Is(Uint8Array),nc={"%AggregateError%":typeof AggregateError>"u"?Wt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Wt:ArrayBuffer,"%ArrayIteratorPrototype%":Wu?Is([][Symbol.iterator]()):Wt,"%AsyncFromSyncIteratorPrototype%":Wt,"%AsyncFunction%":Zu,"%AsyncGenerator%":Zu,"%AsyncGeneratorFunction%":Zu,"%AsyncIteratorPrototype%":Zu,"%Atomics%":typeof Atomics>"u"?Wt:Atomics,"%BigInt%":typeof BigInt>"u"?Wt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Wt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Wt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Wt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Wt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Wt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Wt:FinalizationRegistry,"%Function%":GP,"%GeneratorFunction%":Zu,"%Int8Array%":typeof Int8Array>"u"?Wt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Wt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Wt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Wu?Is(Is([][Symbol.iterator]())):Wt,"%JSON%":typeof JSON=="object"?JSON:Wt,"%Map%":typeof Map>"u"?Wt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Wu?Wt:Is(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Wt:Promise,"%Proxy%":typeof Proxy>"u"?Wt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Wt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Wt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Wu?Wt:Is(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Wt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Wu?Is(""[Symbol.iterator]()):Wt,"%Symbol%":Wu?Symbol:Wt,"%SyntaxError%":Hu,"%ThrowTypeError%":B5,"%TypedArray%":N5,"%TypeError%":Xu,"%Uint8Array%":typeof Uint8Array>"u"?Wt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Wt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Wt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Wt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Wt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Wt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Wt:WeakSet};try{null.error}catch(s){NP=Is(Is(s)),nc["%Error.prototype%"]=NP}var NP,j5=function s(e){var t;if(e==="%AsyncFunction%")t=Db("async function () {}");else if(e==="%GeneratorFunction%")t=Db("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Db("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&(t=Is(l.prototype))}return nc[e]=t,t},jP={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},of=Lb(),Og=As(),U5=of.call(Function.call,Array.prototype.concat),G5=of.call(Function.apply,Array.prototype.splice),UP=of.call(Function.call,String.prototype.replace),zg=of.call(Function.call,String.prototype.slice),V5=of.call(Function.call,RegExp.prototype.exec),q5=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,$5=/\\(\\)?/g,W5=function(e){var t=zg(e,0,1),a=zg(e,-1);if(t==="%"&&a!=="%")throw new Hu("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new Hu("invalid intrinsic syntax, expected opening `%`");var l=[];return UP(e,q5,function(o,m,g,b){l[l.length]=g?UP(b,$5,"$1"):m||o}),l},Z5=function(e,t){var a=e,l;if(Og(jP,a)&&(l=jP[a],a="%"+l[0]+"%"),Og(nc,a)){var o=nc[a];if(o===Zu&&(o=j5(a)),typeof o>"u"&&!t)throw new Xu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new Hu("intrinsic "+e+" does not exist!")};VP.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Xu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Xu('"allowMissing" argument must be a boolean');if(V5(/^%?[^%]*%?$/,e)===null)throw new Hu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=W5(e),l=a.length>0?a[0]:"",o=Z5("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],G5(a,U5([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=zg(k,0,1),Z=zg(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new Hu("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",Og(nc,m))g=nc[m];else if(g!=null){if(!(k in g)){if(!t)throw new Xu("base intrinsic for "+e+" exists, but the property is not available.");return}if(ic&&S+1>=a.length){var te=ic(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=Og(g,k),g=g[k];M&&!b&&(nc[m]=g)}}return g}});var Ng=ke((jre,Bg)=>{"use strict";var Bb=Lb(),Ku=zb(),WP=Ku("%Function.prototype.apply%"),ZP=Ku("%Function.prototype.call%"),XP=Ku("%Reflect.apply%",!0)||Bb.call(ZP,WP),qP=Ku("%Object.getOwnPropertyDescriptor%",!0),oc=Ku("%Object.defineProperty%",!0),X5=Ku("%Math.max%");if(oc)try{oc({},"a",{value:1})}catch{oc=null}Bg.exports=function(e){var t=XP(Bb,ZP,arguments);if(qP&&oc){var a=qP(t,"length");a.configurable&&oc(t,"length",{value:1+X5(0,e.length-(arguments.length-1))})}return t};var $P=function(){return XP(Bb,WP,arguments)};oc?oc(Bg.exports,"apply",{value:$P}):Bg.exports.apply=$P});var Po=ke((Ure,YP)=>{"use strict";var HP=zb(),KP=Ng(),H5=KP(HP("String.prototype.indexOf"));YP.exports=function(e,t){var a=HP(e,!!t);return typeof a=="function"&&H5(e,".prototype.")>-1?KP(a):a}});var Nb=ke((Gre,rT)=>{"use strict";var K5=tf(),eT=Uu()(),tT=Po(),JP=Object,Y5=tT("Array.prototype.push"),QP=tT("Object.prototype.propertyIsEnumerable"),J5=eT?Object.getOwnPropertySymbols:null;rT.exports=function(e,t){if(e==null)throw new TypeError("target must be an object");var a=JP(e);if(arguments.length===1)return a;for(var l=1;l<arguments.length;++l){var o=JP(arguments[l]),m=K5(o),g=eT&&(Object.getOwnPropertySymbols||J5);if(g)for(var b=g(o),A=0;A<b.length;++A){var S=b[A];QP(o,S)&&Y5(m,S)}for(var M=0;M<m.length;++M){var k=m[M];if(QP(o,k)){var j=o[k];a[k]=j}}}return a}});var Ub=ke((Vre,iT)=>{"use strict";var jb=Nb(),Q5=function(){if(!Object.assign)return!1;for(var s="abcdefghijklmnopqrst",e=s.split(""),t={},a=0;a<e.length;++a)t[e[a]]=e[a];var l=Object.assign({},t),o="";for(var m in l)o+=m;return s!==o},e4=function(){if(!Object.assign||!Object.preventExtensions)return!1;var s=Object.preventExtensions({1:2});try{Object.assign(s,"xy")}catch{return s[1]==="y"}return!1};iT.exports=function(){return!Object.assign||Q5()||e4()?jb:Object.assign}});var oT=ke((qre,nT)=>{"use strict";var t4=kb(),r4=Ub();nT.exports=function(){var e=r4();return t4(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e}});var cT=ke(($re,lT)=>{"use strict";var i4=kb(),n4=Ng(),o4=Nb(),sT=Ub(),s4=oT(),a4=n4.apply(sT()),aT=function(e,t){return a4(Object,arguments)};i4(aT,{getPolyfill:sT,implementation:o4,shim:s4});lT.exports=aT});var hT=ke((Wre,uT)=>{"use strict";uT.exports=Error});var dT=ke((Zre,pT)=>{"use strict";pT.exports=EvalError});var mT=ke((Xre,fT)=>{"use strict";fT.exports=RangeError});var yT=ke((Hre,gT)=>{"use strict";gT.exports=ReferenceError});var Gb=ke((Kre,_T)=>{"use strict";_T.exports=SyntaxError});var Qa=ke((Yre,xT)=>{"use strict";xT.exports=TypeError});var bT=ke((Jre,vT)=>{"use strict";vT.exports=URIError});var Vb=ke((Qre,ST)=>{"use strict";var wT={foo:{}},l4=Object;ST.exports=function(){return{__proto__:wT}.foo===wT.foo&&!({__proto__:null}instanceof l4)}});var IT=ke((eie,ET)=>{"use strict";var c4="Function.prototype.bind called on incompatible ",u4=Object.prototype.toString,h4=Math.max,p4="[object Function]",AT=function(e,t){for(var a=[],l=0;l<e.length;l+=1)a[l]=e[l];for(var o=0;o<t.length;o+=1)a[o+e.length]=t[o];return a},d4=function(e,t){for(var a=[],l=t||0,o=0;l<e.length;l+=1,o+=1)a[o]=e[l];return a},f4=function(s,e){for(var t="",a=0;a<s.length;a+=1)t+=s[a],a+1<s.length&&(t+=e);return t};ET.exports=function(e){var t=this;if(typeof t!="function"||u4.apply(t)!==p4)throw new TypeError(c4+t);for(var a=d4(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,AT(a,arguments));return Object(S)===S?S:this}return t.apply(e,AT(a,arguments))},m=h4(0,t.length-a.length),g=[],b=0;b<m;b++)g[b]="$"+b;if(l=Function("binder","return function ("+f4(g,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var Yu=ke((tie,PT)=>{"use strict";var m4=IT();PT.exports=Function.prototype.bind||m4});var qb=ke((rie,TT)=>{"use strict";var g4=Function.prototype.call,y4=Object.prototype.hasOwnProperty,_4=Yu();TT.exports=_4.call(g4,y4)});var da=ke((iie,FT)=>{"use strict";var Zt,x4=hT(),v4=dT(),b4=mT(),w4=yT(),th=Gb(),eh=Qa(),S4=bT(),kT=Function,$b=function(s){try{return kT('"use strict"; return ('+s+").constructor;")()}catch{}},sc=Object.getOwnPropertyDescriptor;if(sc)try{sc({},"")}catch{sc=null}var Wb=function(){throw new eh},A4=sc?function(){try{return arguments.callee,Wb}catch{try{return sc(arguments,"callee").get}catch{return Wb}}}():Wb,Ju=ho()(),E4=Vb()(),Ti=Object.getPrototypeOf||(E4?function(s){return s.__proto__}:null),Qu={},I4=typeof Uint8Array>"u"||!Ti?Zt:Ti(Uint8Array),ac={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Zt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Zt:ArrayBuffer,"%ArrayIteratorPrototype%":Ju&&Ti?Ti([][Symbol.iterator]()):Zt,"%AsyncFromSyncIteratorPrototype%":Zt,"%AsyncFunction%":Qu,"%AsyncGenerator%":Qu,"%AsyncGeneratorFunction%":Qu,"%AsyncIteratorPrototype%":Qu,"%Atomics%":typeof Atomics>"u"?Zt:Atomics,"%BigInt%":typeof BigInt>"u"?Zt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Zt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Zt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Zt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":x4,"%eval%":eval,"%EvalError%":v4,"%Float32Array%":typeof Float32Array>"u"?Zt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Zt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Zt:FinalizationRegistry,"%Function%":kT,"%GeneratorFunction%":Qu,"%Int8Array%":typeof Int8Array>"u"?Zt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Zt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Zt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ju&&Ti?Ti(Ti([][Symbol.iterator]())):Zt,"%JSON%":typeof JSON=="object"?JSON:Zt,"%Map%":typeof Map>"u"?Zt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ju||!Ti?Zt:Ti(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Zt:Promise,"%Proxy%":typeof Proxy>"u"?Zt:Proxy,"%RangeError%":b4,"%ReferenceError%":w4,"%Reflect%":typeof Reflect>"u"?Zt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Zt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ju||!Ti?Zt:Ti(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Zt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ju&&Ti?Ti(""[Symbol.iterator]()):Zt,"%Symbol%":Ju?Symbol:Zt,"%SyntaxError%":th,"%ThrowTypeError%":A4,"%TypedArray%":I4,"%TypeError%":eh,"%Uint8Array%":typeof Uint8Array>"u"?Zt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Zt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Zt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Zt:Uint32Array,"%URIError%":S4,"%WeakMap%":typeof WeakMap>"u"?Zt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Zt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Zt:WeakSet};if(Ti)try{null.error}catch(s){CT=Ti(Ti(s)),ac["%Error.prototype%"]=CT}var CT,P4=function s(e){var t;if(e==="%AsyncFunction%")t=$b("async function () {}");else if(e==="%GeneratorFunction%")t=$b("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=$b("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&Ti&&(t=Ti(l.prototype))}return ac[e]=t,t},MT={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},sf=Yu(),jg=qb(),T4=sf.call(Function.call,Array.prototype.concat),C4=sf.call(Function.apply,Array.prototype.splice),RT=sf.call(Function.call,String.prototype.replace),Ug=sf.call(Function.call,String.prototype.slice),M4=sf.call(Function.call,RegExp.prototype.exec),R4=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,k4=/\\(\\)?/g,F4=function(e){var t=Ug(e,0,1),a=Ug(e,-1);if(t==="%"&&a!=="%")throw new th("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new th("invalid intrinsic syntax, expected opening `%`");var l=[];return RT(e,R4,function(o,m,g,b){l[l.length]=g?RT(b,k4,"$1"):m||o}),l},L4=function(e,t){var a=e,l;if(jg(MT,a)&&(l=MT[a],a="%"+l[0]+"%"),jg(ac,a)){var o=ac[a];if(o===Qu&&(o=P4(a)),typeof o>"u"&&!t)throw new eh("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new th("intrinsic "+e+" does not exist!")};FT.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new eh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new eh('"allowMissing" argument must be a boolean');if(M4(/^%?[^%]*%?$/,e)===null)throw new th("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=F4(e),l=a.length>0?a[0]:"",o=L4("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],C4(a,T4([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=Ug(k,0,1),Z=Ug(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new th("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",jg(ac,m))g=ac[m];else if(g!=null){if(!(k in g)){if(!t)throw new eh("base intrinsic for "+e+" exists, but the property is not available.");return}if(sc&&S+1>=a.length){var te=sc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=jg(g,k),g=g[k];M&&!b&&(ac[m]=g)}}return g}});var rh=ke((nie,LT)=>{"use strict";var D4=da(),Gg=D4("%Object.defineProperty%",!0)||!1;if(Gg)try{Gg({},"a",{value:1})}catch{Gg=!1}LT.exports=Gg});var OT=ke((oie,DT)=>{"use strict";var O4="Function.prototype.bind called on incompatible ",Zb=Array.prototype.slice,z4=Object.prototype.toString,B4="[object Function]";DT.exports=function(e){var t=this;if(typeof t!="function"||z4.call(t)!==B4)throw new TypeError(O4+t);for(var a=Zb.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(Zb.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(Zb.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var BT=ke((sie,zT)=>{"use strict";var N4=OT();zT.exports=Function.prototype.bind||N4});var qT=ke((aie,VT)=>{"use strict";var Xt,sh=SyntaxError,GT=Function,oh=TypeError,Xb=function(s){try{return GT('"use strict"; return ('+s+").constructor;")()}catch{}},lc=Object.getOwnPropertyDescriptor;if(lc)try{lc({},"")}catch{lc=null}var Hb=function(){throw new oh},j4=lc?function(){try{return arguments.callee,Hb}catch{try{return lc(arguments,"callee").get}catch{return Hb}}}():Hb,ih=ho()(),Ps=Object.getPrototypeOf||function(s){return s.__proto__},nh={},U4=typeof Uint8Array>"u"?Xt:Ps(Uint8Array),cc={"%AggregateError%":typeof AggregateError>"u"?Xt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Xt:ArrayBuffer,"%ArrayIteratorPrototype%":ih?Ps([][Symbol.iterator]()):Xt,"%AsyncFromSyncIteratorPrototype%":Xt,"%AsyncFunction%":nh,"%AsyncGenerator%":nh,"%AsyncGeneratorFunction%":nh,"%AsyncIteratorPrototype%":nh,"%Atomics%":typeof Atomics>"u"?Xt:Atomics,"%BigInt%":typeof BigInt>"u"?Xt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Xt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Xt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Xt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Xt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Xt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Xt:FinalizationRegistry,"%Function%":GT,"%GeneratorFunction%":nh,"%Int8Array%":typeof Int8Array>"u"?Xt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Xt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Xt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ih?Ps(Ps([][Symbol.iterator]())):Xt,"%JSON%":typeof JSON=="object"?JSON:Xt,"%Map%":typeof Map>"u"?Xt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ih?Xt:Ps(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Xt:Promise,"%Proxy%":typeof Proxy>"u"?Xt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Xt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Xt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ih?Xt:Ps(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Xt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ih?Ps(""[Symbol.iterator]()):Xt,"%Symbol%":ih?Symbol:Xt,"%SyntaxError%":sh,"%ThrowTypeError%":j4,"%TypedArray%":U4,"%TypeError%":oh,"%Uint8Array%":typeof Uint8Array>"u"?Xt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Xt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Xt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Xt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Xt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Xt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Xt:WeakSet};try{null.error}catch(s){NT=Ps(Ps(s)),cc["%Error.prototype%"]=NT}var NT,G4=function s(e){var t;if(e==="%AsyncFunction%")t=Xb("async function () {}");else if(e==="%GeneratorFunction%")t=Xb("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Xb("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&(t=Ps(l.prototype))}return cc[e]=t,t},jT={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},af=BT(),Vg=As(),V4=af.call(Function.call,Array.prototype.concat),q4=af.call(Function.apply,Array.prototype.splice),UT=af.call(Function.call,String.prototype.replace),qg=af.call(Function.call,String.prototype.slice),$4=af.call(Function.call,RegExp.prototype.exec),W4=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Z4=/\\(\\)?/g,X4=function(e){var t=qg(e,0,1),a=qg(e,-1);if(t==="%"&&a!=="%")throw new sh("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new sh("invalid intrinsic syntax, expected opening `%`");var l=[];return UT(e,W4,function(o,m,g,b){l[l.length]=g?UT(b,Z4,"$1"):m||o}),l},H4=function(e,t){var a=e,l;if(Vg(jT,a)&&(l=jT[a],a="%"+l[0]+"%"),Vg(cc,a)){var o=cc[a];if(o===nh&&(o=G4(a)),typeof o>"u"&&!t)throw new oh("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new sh("intrinsic "+e+" does not exist!")};VT.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new oh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new oh('"allowMissing" argument must be a boolean');if($4(/^%?[^%]*%?$/,e)===null)throw new sh("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=X4(e),l=a.length>0?a[0]:"",o=H4("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],q4(a,V4([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=qg(k,0,1),Z=qg(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new sh("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",Vg(cc,m))g=cc[m];else if(g!=null){if(!(k in g)){if(!t)throw new oh("base intrinsic for "+e+" exists, but the property is not available.");return}if(lc&&S+1>=a.length){var te=lc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=Vg(g,k),g=g[k];M&&!b&&(cc[m]=g)}}return g}});var ah=ke((lie,$T)=>{"use strict";var K4=qT(),$g=K4("%Object.getOwnPropertyDescriptor%",!0);if($g)try{$g([],"length")}catch{$g=null}$T.exports=$g});var HT=ke((cie,XT)=>{"use strict";var WT=rh(),Y4=Gb(),lh=Qa(),ZT=ah();XT.exports=function(e,t,a){if(!e||typeof e!="object"&&typeof e!="function")throw new lh("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new lh("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new lh("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new lh("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new lh("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new lh("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,m=arguments.length>5?arguments[5]:null,g=arguments.length>6?arguments[6]:!1,b=!!ZT&&ZT(e,t);if(WT)WT(e,t,{configurable:m===null&&b?b.configurable:!m,enumerable:l===null&&b?b.enumerable:!l,value:a,writable:o===null&&b?b.writable:!o});else if(g||!l&&!o&&!m)e[t]=a;else throw new Y4("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var JT=ke((uie,YT)=>{"use strict";var Kb=rh(),KT=function(){return!!Kb};KT.hasArrayLengthDefineBug=function(){if(!Kb)return null;try{return Kb([],"length",{value:1}).length!==1}catch{return!0}};YT.exports=KT});var Wg=ke((hie,rC)=>{"use strict";var J4=da(),QT=HT(),Q4=JT()(),eC=ah(),tC=Qa(),eN=J4("%Math.floor%");rC.exports=function(e,t){if(typeof e!="function")throw new tC("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||eN(t)!==t)throw new tC("`length` must be a positive 32-bit integer");var a=arguments.length>2&&!!arguments[2],l=!0,o=!0;if("length"in e&&eC){var m=eC(e,"length");m&&!m.configurable&&(l=!1),m&&!m.writable&&(o=!1)}return(l||o||!a)&&(Q4?QT(e,"length",t,!0,!0):QT(e,"length",t)),e}});var lC=ke((pie,Zg)=>{"use strict";var Yb=Yu(),Xg=da(),tN=Wg(),rN=Qa(),oC=Xg("%Function.prototype.apply%"),sC=Xg("%Function.prototype.call%"),aC=Xg("%Reflect.apply%",!0)||Yb.call(sC,oC),iC=rh(),iN=Xg("%Math.max%");Zg.exports=function(e){if(typeof e!="function")throw new rN("a function is required");var t=aC(Yb,sC,arguments);return tN(t,1+iN(0,e.length-(arguments.length-1)),!0)};var nC=function(){return aC(Yb,oC,arguments)};iC?iC(Zg.exports,"apply",{value:nC}):Zg.exports.apply=nC});var pC=ke((die,hC)=>{"use strict";var cC=da(),uC=lC(),nN=uC(cC("String.prototype.indexOf"));hC.exports=function(e,t){var a=cC(e,!!t);return typeof a=="function"&&nN(e,".prototype.")>-1?uC(a):a}});var fC=ke((fie,dC)=>{"use strict";var oN="Function.prototype.bind called on incompatible ",Jb=Array.prototype.slice,sN=Object.prototype.toString,aN="[object Function]";dC.exports=function(e){var t=this;if(typeof t!="function"||sN.call(t)!==aN)throw new TypeError(oN+t);for(var a=Jb.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(Jb.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(Jb.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var gC=ke((mie,mC)=>{"use strict";var lN=fC();mC.exports=Function.prototype.bind||lN});var wC=ke((gie,bC)=>{"use strict";var Ht,ph=SyntaxError,vC=Function,hh=TypeError,Qb=function(s){try{return vC('"use strict"; return ('+s+").constructor;")()}catch{}},uc=Object.getOwnPropertyDescriptor;if(uc)try{uc({},"")}catch{uc=null}var e1=function(){throw new hh},cN=uc?function(){try{return arguments.callee,e1}catch{try{return uc(arguments,"callee").get}catch{return e1}}}():e1,ch=ho()(),uN=Vb()(),Ci=Object.getPrototypeOf||(uN?function(s){return s.__proto__}:null),uh={},hN=typeof Uint8Array>"u"||!Ci?Ht:Ci(Uint8Array),hc={"%AggregateError%":typeof AggregateError>"u"?Ht:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Ht:ArrayBuffer,"%ArrayIteratorPrototype%":ch&&Ci?Ci([][Symbol.iterator]()):Ht,"%AsyncFromSyncIteratorPrototype%":Ht,"%AsyncFunction%":uh,"%AsyncGenerator%":uh,"%AsyncGeneratorFunction%":uh,"%AsyncIteratorPrototype%":uh,"%Atomics%":typeof Atomics>"u"?Ht:Atomics,"%BigInt%":typeof BigInt>"u"?Ht:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Ht:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Ht:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Ht:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Ht:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Ht:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Ht:FinalizationRegistry,"%Function%":vC,"%GeneratorFunction%":uh,"%Int8Array%":typeof Int8Array>"u"?Ht:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Ht:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Ht:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ch&&Ci?Ci(Ci([][Symbol.iterator]())):Ht,"%JSON%":typeof JSON=="object"?JSON:Ht,"%Map%":typeof Map>"u"?Ht:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ch||!Ci?Ht:Ci(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Ht:Promise,"%Proxy%":typeof Proxy>"u"?Ht:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Ht:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Ht:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ch||!Ci?Ht:Ci(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Ht:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ch&&Ci?Ci(""[Symbol.iterator]()):Ht,"%Symbol%":ch?Symbol:Ht,"%SyntaxError%":ph,"%ThrowTypeError%":cN,"%TypedArray%":hN,"%TypeError%":hh,"%Uint8Array%":typeof Uint8Array>"u"?Ht:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Ht:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Ht:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Ht:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Ht:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Ht:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Ht:WeakSet};if(Ci)try{null.error}catch(s){yC=Ci(Ci(s)),hc["%Error.prototype%"]=yC}var yC,pN=function s(e){var t;if(e==="%AsyncFunction%")t=Qb("async function () {}");else if(e==="%GeneratorFunction%")t=Qb("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Qb("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&Ci&&(t=Ci(l.prototype))}return hc[e]=t,t},_C={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},lf=gC(),Hg=As(),dN=lf.call(Function.call,Array.prototype.concat),fN=lf.call(Function.apply,Array.prototype.splice),xC=lf.call(Function.call,String.prototype.replace),Kg=lf.call(Function.call,String.prototype.slice),mN=lf.call(Function.call,RegExp.prototype.exec),gN=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yN=/\\(\\)?/g,_N=function(e){var t=Kg(e,0,1),a=Kg(e,-1);if(t==="%"&&a!=="%")throw new ph("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new ph("invalid intrinsic syntax, expected opening `%`");var l=[];return xC(e,gN,function(o,m,g,b){l[l.length]=g?xC(b,yN,"$1"):m||o}),l},xN=function(e,t){var a=e,l;if(Hg(_C,a)&&(l=_C[a],a="%"+l[0]+"%"),Hg(hc,a)){var o=hc[a];if(o===uh&&(o=pN(a)),typeof o>"u"&&!t)throw new hh("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new ph("intrinsic "+e+" does not exist!")};bC.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new hh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new hh('"allowMissing" argument must be a boolean');if(mN(/^%?[^%]*%?$/,e)===null)throw new ph("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=_N(e),l=a.length>0?a[0]:"",o=xN("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],fN(a,dN([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=Kg(k,0,1),Z=Kg(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new ph("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",Hg(hc,m))g=hc[m];else if(g!=null){if(!(k in g)){if(!t)throw new hh("base intrinsic for "+e+" exists, but the property is not available.");return}if(uc&&S+1>=a.length){var te=uc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=Hg(g,k),g=g[k];M&&!b&&(hc[m]=g)}}return g}});var r1=ke((yie,EC)=>{"use strict";var vN=nf()(),t1=wC(),SC=vN&&t1("%Object.defineProperty%",!0),bN=t1("%SyntaxError%"),dh=t1("%TypeError%"),AC=ah();EC.exports=function(e,t,a){if(!e||typeof e!="object"&&typeof e!="function")throw new dh("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new dh("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new dh("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new dh("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new dh("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new dh("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,m=arguments.length>5?arguments[5]:null,g=arguments.length>6?arguments[6]:!1,b=!!AC&&AC(e,t);if(SC)SC(e,t,{configurable:m===null&&b?b.configurable:!m,enumerable:l===null&&b?b.enumerable:!l,value:a,writable:o===null&&b?b.writable:!o});else if(g||!l&&!o&&!m)e[t]=a;else throw new bN("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var fh=ke((_ie,CC)=>{"use strict";var wN=tf(),SN=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",AN=Object.prototype.toString,EN=Array.prototype.concat,IC=r1(),IN=function(s){return typeof s=="function"&&AN.call(s)==="[object Function]"},PC=nf()(),PN=function(s,e,t,a){if(e in s){if(a===!0){if(s[e]===t)return}else if(!IN(a)||!a())return}PC?IC(s,e,t,!0):IC(s,e,t)},TC=function(s,e){var t=arguments.length>2?arguments[2]:{},a=wN(e);SN&&(a=EN.call(a,Object.getOwnPropertySymbols(e)));for(var l=0;l<a.length;l+=1)PN(s,a[l],e[a[l]],t[a[l]])};TC.supportsDescriptors=!!PC;CC.exports=TC});var RC=ke((xie,MC)=>{"use strict";var TN="Function.prototype.bind called on incompatible ",i1=Array.prototype.slice,CN=Object.prototype.toString,MN="[object Function]";MC.exports=function(e){var t=this;if(typeof t!="function"||CN.call(t)!==MN)throw new TypeError(TN+t);for(var a=i1.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(i1.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(i1.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var n1=ke((vie,kC)=>{"use strict";var RN=RC();kC.exports=Function.prototype.bind||RN});var BC=ke((bie,zC)=>{"use strict";var Kt,_h=SyntaxError,OC=Function,yh=TypeError,o1=function(s){try{return OC('"use strict"; return ('+s+").constructor;")()}catch{}},pc=Object.getOwnPropertyDescriptor;if(pc)try{pc({},"")}catch{pc=null}var s1=function(){throw new yh},kN=pc?function(){try{return arguments.callee,s1}catch{try{return pc(arguments,"callee").get}catch{return s1}}}():s1,mh=ho()(),Ts=Object.getPrototypeOf||function(s){return s.__proto__},gh={},FN=typeof Uint8Array>"u"?Kt:Ts(Uint8Array),dc={"%AggregateError%":typeof AggregateError>"u"?Kt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Kt:ArrayBuffer,"%ArrayIteratorPrototype%":mh?Ts([][Symbol.iterator]()):Kt,"%AsyncFromSyncIteratorPrototype%":Kt,"%AsyncFunction%":gh,"%AsyncGenerator%":gh,"%AsyncGeneratorFunction%":gh,"%AsyncIteratorPrototype%":gh,"%Atomics%":typeof Atomics>"u"?Kt:Atomics,"%BigInt%":typeof BigInt>"u"?Kt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Kt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Kt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Kt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Kt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Kt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Kt:FinalizationRegistry,"%Function%":OC,"%GeneratorFunction%":gh,"%Int8Array%":typeof Int8Array>"u"?Kt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Kt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Kt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":mh?Ts(Ts([][Symbol.iterator]())):Kt,"%JSON%":typeof JSON=="object"?JSON:Kt,"%Map%":typeof Map>"u"?Kt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!mh?Kt:Ts(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Kt:Promise,"%Proxy%":typeof Proxy>"u"?Kt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Kt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Kt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!mh?Kt:Ts(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Kt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":mh?Ts(""[Symbol.iterator]()):Kt,"%Symbol%":mh?Symbol:Kt,"%SyntaxError%":_h,"%ThrowTypeError%":kN,"%TypedArray%":FN,"%TypeError%":yh,"%Uint8Array%":typeof Uint8Array>"u"?Kt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Kt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Kt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Kt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Kt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Kt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Kt:WeakSet};try{null.error}catch(s){FC=Ts(Ts(s)),dc["%Error.prototype%"]=FC}var FC,LN=function s(e){var t;if(e==="%AsyncFunction%")t=o1("async function () {}");else if(e==="%GeneratorFunction%")t=o1("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=o1("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&(t=Ts(l.prototype))}return dc[e]=t,t},LC={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},cf=n1(),Yg=As(),DN=cf.call(Function.call,Array.prototype.concat),ON=cf.call(Function.apply,Array.prototype.splice),DC=cf.call(Function.call,String.prototype.replace),Jg=cf.call(Function.call,String.prototype.slice),zN=cf.call(Function.call,RegExp.prototype.exec),BN=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,NN=/\\(\\)?/g,jN=function(e){var t=Jg(e,0,1),a=Jg(e,-1);if(t==="%"&&a!=="%")throw new _h("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new _h("invalid intrinsic syntax, expected opening `%`");var l=[];return DC(e,BN,function(o,m,g,b){l[l.length]=g?DC(b,NN,"$1"):m||o}),l},UN=function(e,t){var a=e,l;if(Yg(LC,a)&&(l=LC[a],a="%"+l[0]+"%"),Yg(dc,a)){var o=dc[a];if(o===gh&&(o=LN(a)),typeof o>"u"&&!t)throw new yh("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new _h("intrinsic "+e+" does not exist!")};zC.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new yh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new yh('"allowMissing" argument must be a boolean');if(zN(/^%?[^%]*%?$/,e)===null)throw new _h("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=jN(e),l=a.length>0?a[0]:"",o=UN("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],ON(a,DN([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=Jg(k,0,1),Z=Jg(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new _h("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",Yg(dc,m))g=dc[m];else if(g!=null){if(!(k in g)){if(!t)throw new yh("base intrinsic for "+e+" exists, but the property is not available.");return}if(pc&&S+1>=a.length){var te=pc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=Yg(g,k),g=g[k];M&&!b&&(dc[m]=g)}}return g}});var qC=ke((wie,Qg)=>{"use strict";var a1=n1(),xh=BC(),UC=xh("%Function.prototype.apply%"),GC=xh("%Function.prototype.call%"),VC=xh("%Reflect.apply%",!0)||a1.call(GC,UC),NC=xh("%Object.getOwnPropertyDescriptor%",!0),fc=xh("%Object.defineProperty%",!0),GN=xh("%Math.max%");if(fc)try{fc({},"a",{value:1})}catch{fc=null}Qg.exports=function(e){var t=VC(a1,GC,arguments);if(NC&&fc){var a=NC(t,"length");a.configurable&&fc(t,"length",{value:1+GN(0,e.length-(arguments.length-1))})}return t};var jC=function(){return VC(a1,UC,arguments)};fc?fc(Qg.exports,"apply",{value:jC}):Qg.exports.apply=jC});var WC=ke((Sie,$C)=>{"use strict";var hf=function(){return typeof function(){}.name=="string"},uf=Object.getOwnPropertyDescriptor;if(uf)try{uf([],"length")}catch{uf=null}hf.functionsHaveConfigurableNames=function(){if(!hf()||!uf)return!1;var e=uf(function(){},"name");return!!e&&!!e.configurable};var VN=Function.prototype.bind;hf.boundFunctionsHaveNames=function(){return hf()&&typeof VN=="function"&&function(){}.bind().name!==""};$C.exports=hf});var HC=ke((Aie,XC)=>{"use strict";var ZC=r1(),qN=nf()(),$N=WC().functionsHaveConfigurableNames(),WN=TypeError;XC.exports=function(e,t){if(typeof e!="function")throw new WN("`fn` is not a function");var a=arguments.length>2&&!!arguments[2];return(!a||$N)&&(qN?ZC(e,"name",t,!0,!0):ZC(e,"name",t)),e}});var l1=ke((Eie,KC)=>{"use strict";var ZN=HC(),XN=Object,HN=TypeError;KC.exports=ZN(function(){if(this!=null&&this!==XN(this))throw new HN("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0)});var c1=ke((Iie,YC)=>{"use strict";var KN=l1(),YN=fh().supportsDescriptors,JN=Object.getOwnPropertyDescriptor;YC.exports=function(){if(YN&&/a/mig.flags==="gim"){var e=JN(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var t="",a={};if(Object.defineProperty(a,"hasIndices",{get:function(){t+="d"}}),Object.defineProperty(a,"sticky",{get:function(){t+="y"}}),t==="dy")return e.get}}return KN}});var eM=ke((Pie,QC)=>{"use strict";var QN=fh().supportsDescriptors,e6=c1(),t6=Object.getOwnPropertyDescriptor,r6=Object.defineProperty,i6=TypeError,JC=Object.getPrototypeOf,n6=/a/;QC.exports=function(){if(!QN||!JC)throw new i6("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=e6(),t=JC(n6),a=t6(t,"flags");return(!a||a.get!==e)&&r6(t,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var nM=ke((Tie,iM)=>{"use strict";var o6=fh(),s6=qC(),a6=l1(),tM=c1(),l6=eM(),rM=s6(tM());o6(rM,{getPolyfill:tM,implementation:a6,shim:l6});iM.exports=rM});var el=ke((Cie,oM)=>{"use strict";var c6=Uu();oM.exports=function(){return c6()&&!!Symbol.toStringTag}});var h1=ke((Mie,aM)=>{"use strict";var u6=el()(),h6=Po(),u1=h6("Object.prototype.toString"),ey=function(e){return u6&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:u1(e)==="[object Arguments]"},sM=function(e){return ey(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&u1(e)!=="[object Array]"&&u1(e.callee)==="[object Function]"},p6=function(){return ey(arguments)}();ey.isLegacyArguments=sM;aM.exports=p6?ey:sM});var cM=ke((Rie,lM)=>{"use strict";var d6="Function.prototype.bind called on incompatible ",p1=Array.prototype.slice,f6=Object.prototype.toString,m6="[object Function]";lM.exports=function(e){var t=this;if(typeof t!="function"||f6.call(t)!==m6)throw new TypeError(d6+t);for(var a=p1.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(p1.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(p1.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var hM=ke((kie,uM)=>{"use strict";var g6=cM();uM.exports=Function.prototype.bind||g6});var yM=ke((Fie,gM)=>{"use strict";var Yt,Sh=SyntaxError,mM=Function,wh=TypeError,d1=function(s){try{return mM('"use strict"; return ('+s+").constructor;")()}catch{}},mc=Object.getOwnPropertyDescriptor;if(mc)try{mc({},"")}catch{mc=null}var f1=function(){throw new wh},y6=mc?function(){try{return arguments.callee,f1}catch{try{return mc(arguments,"callee").get}catch{return f1}}}():f1,vh=ho()(),Cs=Object.getPrototypeOf||function(s){return s.__proto__},bh={},_6=typeof Uint8Array>"u"?Yt:Cs(Uint8Array),gc={"%AggregateError%":typeof AggregateError>"u"?Yt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Yt:ArrayBuffer,"%ArrayIteratorPrototype%":vh?Cs([][Symbol.iterator]()):Yt,"%AsyncFromSyncIteratorPrototype%":Yt,"%AsyncFunction%":bh,"%AsyncGenerator%":bh,"%AsyncGeneratorFunction%":bh,"%AsyncIteratorPrototype%":bh,"%Atomics%":typeof Atomics>"u"?Yt:Atomics,"%BigInt%":typeof BigInt>"u"?Yt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Yt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Yt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Yt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Yt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Yt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Yt:FinalizationRegistry,"%Function%":mM,"%GeneratorFunction%":bh,"%Int8Array%":typeof Int8Array>"u"?Yt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Yt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Yt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":vh?Cs(Cs([][Symbol.iterator]())):Yt,"%JSON%":typeof JSON=="object"?JSON:Yt,"%Map%":typeof Map>"u"?Yt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!vh?Yt:Cs(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Yt:Promise,"%Proxy%":typeof Proxy>"u"?Yt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Yt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Yt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!vh?Yt:Cs(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Yt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":vh?Cs(""[Symbol.iterator]()):Yt,"%Symbol%":vh?Symbol:Yt,"%SyntaxError%":Sh,"%ThrowTypeError%":y6,"%TypedArray%":_6,"%TypeError%":wh,"%Uint8Array%":typeof Uint8Array>"u"?Yt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Yt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Yt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Yt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Yt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Yt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Yt:WeakSet};try{null.error}catch(s){pM=Cs(Cs(s)),gc["%Error.prototype%"]=pM}var pM,x6=function s(e){var t;if(e==="%AsyncFunction%")t=d1("async function () {}");else if(e==="%GeneratorFunction%")t=d1("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=d1("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&(t=Cs(l.prototype))}return gc[e]=t,t},dM={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},pf=hM(),ty=As(),v6=pf.call(Function.call,Array.prototype.concat),b6=pf.call(Function.apply,Array.prototype.splice),fM=pf.call(Function.call,String.prototype.replace),ry=pf.call(Function.call,String.prototype.slice),w6=pf.call(Function.call,RegExp.prototype.exec),S6=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,A6=/\\(\\)?/g,E6=function(e){var t=ry(e,0,1),a=ry(e,-1);if(t==="%"&&a!=="%")throw new Sh("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new Sh("invalid intrinsic syntax, expected opening `%`");var l=[];return fM(e,S6,function(o,m,g,b){l[l.length]=g?fM(b,A6,"$1"):m||o}),l},I6=function(e,t){var a=e,l;if(ty(dM,a)&&(l=dM[a],a="%"+l[0]+"%"),ty(gc,a)){var o=gc[a];if(o===bh&&(o=x6(a)),typeof o>"u"&&!t)throw new wh("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new Sh("intrinsic "+e+" does not exist!")};gM.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new wh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new wh('"allowMissing" argument must be a boolean');if(w6(/^%?[^%]*%?$/,e)===null)throw new Sh("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=E6(e),l=a.length>0?a[0]:"",o=I6("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],b6(a,v6([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=ry(k,0,1),Z=ry(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new Sh("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",ty(gc,m))g=gc[m];else if(g!=null){if(!(k in g)){if(!t)throw new wh("base intrinsic for "+e+" exists, but the property is not available.");return}if(mc&&S+1>=a.length){var te=mc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=ty(g,k),g=g[k];M&&!b&&(gc[m]=g)}}return g}});var _M=ke(()=>{});var BM=ke((Oie,zM)=>{var A1=typeof Map=="function"&&Map.prototype,m1=Object.getOwnPropertyDescriptor&&A1?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ny=A1&&m1&&typeof m1.get=="function"?m1.get:null,xM=A1&&Map.prototype.forEach,E1=typeof Set=="function"&&Set.prototype,g1=Object.getOwnPropertyDescriptor&&E1?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,oy=E1&&g1&&typeof g1.get=="function"?g1.get:null,vM=E1&&Set.prototype.forEach,P6=typeof WeakMap=="function"&&WeakMap.prototype,ff=P6?WeakMap.prototype.has:null,T6=typeof WeakSet=="function"&&WeakSet.prototype,mf=T6?WeakSet.prototype.has:null,C6=typeof WeakRef=="function"&&WeakRef.prototype,bM=C6?WeakRef.prototype.deref:null,M6=Boolean.prototype.valueOf,R6=Object.prototype.toString,k6=Function.prototype.toString,F6=String.prototype.match,I1=String.prototype.slice,rl=String.prototype.replace,L6=String.prototype.toUpperCase,wM=String.prototype.toLowerCase,RM=RegExp.prototype.test,SM=Array.prototype.concat,Ms=Array.prototype.join,D6=Array.prototype.slice,AM=Math.floor,x1=typeof BigInt=="function"?BigInt.prototype.valueOf:null,y1=Object.getOwnPropertySymbols,v1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ah=typeof Symbol=="function"&&typeof Symbol.iterator=="object",pn=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ah||!0)?Symbol.toStringTag:null,kM=Object.prototype.propertyIsEnumerable,EM=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(s){return s.__proto__}:null);function IM(s,e){if(s===1/0||s===-1/0||s!==s||s&&s>-1e3&&s<1e3||RM.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof s=="number"){var a=s<0?-AM(-s):AM(s);if(a!==s){var l=String(a),o=I1.call(e,l.length+1);return rl.call(l,t,"$&_")+"."+rl.call(rl.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return rl.call(e,t,"$&_")}var b1=_M(),PM=b1.custom,TM=LM(PM)?PM:null;zM.exports=function s(e,t,a,l){var o=t||{};if(tl(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(tl(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var m=tl(o,"customInspect")?o.customInspect:!0;if(typeof m!="boolean"&&m!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(tl(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(tl(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var g=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return OM(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var b=String(e);return g?IM(e,b):b}if(typeof e=="bigint"){var A=String(e)+"n";return g?IM(e,A):A}var S=typeof o.depth>"u"?5:o.depth;if(typeof a>"u"&&(a=0),a>=S&&S>0&&typeof e=="object")return w1(e)?"[Array]":"[Object]";var M=Q6(o,a);if(typeof l>"u")l=[];else if(DM(l,e)>=0)return"[Circular]";function k(pt,Tt,Qe){if(Tt&&(l=D6.call(l),l.push(Tt)),Qe){var nt={depth:o.depth};return tl(o,"quoteStyle")&&(nt.quoteStyle=o.quoteStyle),s(pt,nt,a+1,l)}return s(pt,o,a+1,l)}if(typeof e=="function"&&!CM(e)){var j=q6(e),Z=iy(e,k);return"[Function"+(j?": "+j:" (anonymous)")+"]"+(Z.length>0?" { "+Ms.call(Z,", ")+" }":"")}if(LM(e)){var te=Ah?rl.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):v1.call(e);return typeof e=="object"&&!Ah?df(te):te}if(K6(e)){for(var q="<"+wM.call(String(e.nodeName)),H=e.attributes||[],ae=0;ae<H.length;ae++)q+=" "+H[ae].name+"="+FM(O6(H[ae].value),"double",o);return q+=">",e.childNodes&&e.childNodes.length&&(q+="..."),q+="</"+wM.call(String(e.nodeName))+">",q}if(w1(e)){if(e.length===0)return"[]";var pe=iy(e,k);return M&&!J6(pe)?"["+S1(pe,M)+"]":"[ "+Ms.call(pe,", ")+" ]"}if(B6(e)){var ve=iy(e,k);return!("cause"in Error.prototype)&&"cause"in e&&!kM.call(e,"cause")?"{ ["+String(e)+"] "+Ms.call(SM.call("[cause]: "+k(e.cause),ve),", ")+" }":ve.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Ms.call(ve,", ")+" }"}if(typeof e=="object"&&m){if(TM&&typeof e[TM]=="function"&&b1)return b1(e,{depth:S-a});if(m!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if($6(e)){var de=[];return xM&&xM.call(e,function(pt,Tt){de.push(k(Tt,e,!0)+" => "+k(pt,e))}),MM("Map",ny.call(e),de,M)}if(X6(e)){var _e=[];return vM&&vM.call(e,function(pt){_e.push(k(pt,e))}),MM("Set",oy.call(e),_e,M)}if(W6(e))return _1("WeakMap");if(H6(e))return _1("WeakSet");if(Z6(e))return _1("WeakRef");if(j6(e))return df(k(Number(e)));if(G6(e))return df(k(x1.call(e)));if(U6(e))return df(M6.call(e));if(N6(e))return df(k(String(e)));if(!z6(e)&&!CM(e)){var Pe=iy(e,k),Re=EM?EM(e)===Object.prototype:e instanceof Object||e.constructor===Object,Ae=e instanceof Object?"":"null prototype",ut=!Re&&pn&&Object(e)===e&&pn in e?I1.call(il(e),8,-1):Ae?"Object":"",Ve=Re||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Ue=Ve+(ut||Ae?"["+Ms.call(SM.call([],ut||[],Ae||[]),": ")+"] ":"");return Pe.length===0?Ue+"{}":M?Ue+"{"+S1(Pe,M)+"}":Ue+"{ "+Ms.call(Pe,", ")+" }"}return String(e)};function FM(s,e,t){var a=(t.quoteStyle||e)==="double"?'"':"'";return a+s+a}function O6(s){return rl.call(String(s),/"/g,"&quot;")}function w1(s){return il(s)==="[object Array]"&&(!pn||!(typeof s=="object"&&pn in s))}function z6(s){return il(s)==="[object Date]"&&(!pn||!(typeof s=="object"&&pn in s))}function CM(s){return il(s)==="[object RegExp]"&&(!pn||!(typeof s=="object"&&pn in s))}function B6(s){return il(s)==="[object Error]"&&(!pn||!(typeof s=="object"&&pn in s))}function N6(s){return il(s)==="[object String]"&&(!pn||!(typeof s=="object"&&pn in s))}function j6(s){return il(s)==="[object Number]"&&(!pn||!(typeof s=="object"&&pn in s))}function U6(s){return il(s)==="[object Boolean]"&&(!pn||!(typeof s=="object"&&pn in s))}function LM(s){if(Ah)return s&&typeof s=="object"&&s instanceof Symbol;if(typeof s=="symbol")return!0;if(!s||typeof s!="object"||!v1)return!1;try{return v1.call(s),!0}catch{}return!1}function G6(s){if(!s||typeof s!="object"||!x1)return!1;try{return x1.call(s),!0}catch{}return!1}var V6=Object.prototype.hasOwnProperty||function(s){return s in this};function tl(s,e){return V6.call(s,e)}function il(s){return R6.call(s)}function q6(s){if(s.name)return s.name;var e=F6.call(k6.call(s),/^function\s*([\w$]+)/);return e?e[1]:null}function DM(s,e){if(s.indexOf)return s.indexOf(e);for(var t=0,a=s.length;t<a;t++)if(s[t]===e)return t;return-1}function $6(s){if(!ny||!s||typeof s!="object")return!1;try{ny.call(s);try{oy.call(s)}catch{return!0}return s instanceof Map}catch{}return!1}function W6(s){if(!ff||!s||typeof s!="object")return!1;try{ff.call(s,ff);try{mf.call(s,mf)}catch{return!0}return s instanceof WeakMap}catch{}return!1}function Z6(s){if(!bM||!s||typeof s!="object")return!1;try{return bM.call(s),!0}catch{}return!1}function X6(s){if(!oy||!s||typeof s!="object")return!1;try{oy.call(s);try{ny.call(s)}catch{return!0}return s instanceof Set}catch{}return!1}function H6(s){if(!mf||!s||typeof s!="object")return!1;try{mf.call(s,mf);try{ff.call(s,ff)}catch{return!0}return s instanceof WeakSet}catch{}return!1}function K6(s){return!s||typeof s!="object"?!1:typeof HTMLElement<"u"&&s instanceof HTMLElement?!0:typeof s.nodeName=="string"&&typeof s.getAttribute=="function"}function OM(s,e){if(s.length>e.maxStringLength){var t=s.length-e.maxStringLength,a="... "+t+" more character"+(t>1?"s":"");return OM(I1.call(s,0,e.maxStringLength),e)+a}var l=rl.call(rl.call(s,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Y6);return FM(l,"single",e)}function Y6(s){var e=s.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+L6.call(e.toString(16))}function df(s){return"Object("+s+")"}function _1(s){return s+" { ? }"}function MM(s,e,t,a){var l=a?S1(t,a):Ms.call(t,", ");return s+" ("+e+") {"+l+"}"}function J6(s){for(var e=0;e<s.length;e++)if(DM(s[e],`
578
578
  `)>=0)return!1;return!0}function Q6(s,e){var t;if(s.indent===" ")t=" ";else if(typeof s.indent=="number"&&s.indent>0)t=Ms.call(Array(s.indent+1)," ");else return null;return{base:t,prev:Ms.call(Array(e+1),t)}}function S1(s,e){if(s.length===0)return"";var t=`
579
579
  `+e.prev+e.base;return t+Ms.call(s,","+t)+`
580
- `+e.prev}function iy(s,e){var t=w1(s),a=[];if(t){a.length=s.length;for(var l=0;l<s.length;l++)a[l]=tl(s,l)?e(s[l],s):""}var o=typeof y1=="function"?y1(s):[],m;if(Ah){m={};for(var g=0;g<o.length;g++)m["$"+o[g]]=o[g]}for(var b in s)tl(s,b)&&(t&&String(Number(b))===b&&b<s.length||Ah&&m["$"+b]instanceof Symbol||(RM.call(/[^\w$]/,b)?a.push(e(b,s)+": "+e(s[b],s)):a.push(b+": "+e(s[b],s))));if(typeof y1=="function")for(var A=0;A<o.length;A++)kM.call(s,o[A])&&a.push("["+e(o[A])+"]: "+e(s[o[A]],s));return a}});var C1=ke((zie,NM)=>{"use strict";var P1=yM(),Eh=Po(),ej=BM(),tj=P1("%TypeError%"),sy=P1("%WeakMap%",!0),ay=P1("%Map%",!0),rj=Eh("WeakMap.prototype.get",!0),ij=Eh("WeakMap.prototype.set",!0),nj=Eh("WeakMap.prototype.has",!0),oj=Eh("Map.prototype.get",!0),sj=Eh("Map.prototype.set",!0),aj=Eh("Map.prototype.has",!0),T1=function(s,e){for(var t=s,a;(a=t.next)!==null;t=a)if(a.key===e)return t.next=a.next,a.next=s.next,s.next=a,a},lj=function(s,e){var t=T1(s,e);return t&&t.value},cj=function(s,e,t){var a=T1(s,e);a?a.value=t:s.next={key:e,next:s.next,value:t}},uj=function(s,e){return!!T1(s,e)};NM.exports=function(){var e,t,a,l={assert:function(o){if(!l.has(o))throw new tj("Side channel does not contain "+ej(o))},get:function(o){if(sy&&o&&(typeof o=="object"||typeof o=="function")){if(e)return rj(e,o)}else if(ay){if(t)return oj(t,o)}else if(a)return lj(a,o)},has:function(o){if(sy&&o&&(typeof o=="object"||typeof o=="function")){if(e)return nj(e,o)}else if(ay){if(t)return aj(t,o)}else if(a)return uj(a,o);return!1},set:function(o,m){sy&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new sy),ij(e,o,m)):ay?(t||(t=new ay),sj(t,o,m)):(a||(a={key:{},next:null}),cj(a,o,m))}};return l}});var UM=ke((Bie,jM)=>{"use strict";var hj=qb(),gf=C1()(),fa=Qa(),M1={assert:function(s,e){if(!s||typeof s!="object"&&typeof s!="function")throw new fa("`O` is not an object");if(typeof e!="string")throw new fa("`slot` must be a string");if(gf.assert(s),!M1.has(s,e))throw new fa("`"+e+"` is not present on `O`")},get:function(s,e){if(!s||typeof s!="object"&&typeof s!="function")throw new fa("`O` is not an object");if(typeof e!="string")throw new fa("`slot` must be a string");var t=gf.get(s);return t&&t["$"+e]},has:function(s,e){if(!s||typeof s!="object"&&typeof s!="function")throw new fa("`O` is not an object");if(typeof e!="string")throw new fa("`slot` must be a string");var t=gf.get(s);return!!t&&hj(t,"$"+e)},set:function(s,e,t){if(!s||typeof s!="object"&&typeof s!="function")throw new fa("`O` is not an object");if(typeof e!="string")throw new fa("`slot` must be a string");var a=gf.get(s);a||(a={},gf.set(s,a)),a["$"+e]=t}};Object.freeze&&Object.freeze(M1);jM.exports=M1});var qM=ke((Nie,VM)=>{"use strict";var yf=UM(),pj=SyntaxError,GM=typeof StopIteration=="object"?StopIteration:null;VM.exports=function(e){if(!GM)throw new pj("this environment lacks StopIteration");yf.set(e,"[[Done]]",!1);var t={next:function(){var l=yf.get(this,"[[Iterator]]"),o=yf.get(l,"[[Done]]");try{return{done:o,value:o?void 0:l.next()}}catch(m){if(yf.set(l,"[[Done]]",!0),m!==GM)throw m;return{done:!0,value:void 0}}}};return yf.set(t,"[[Iterator]]",e),t}});var R1=ke((jie,$M)=>{var dj={}.toString;$M.exports=Array.isArray||function(s){return dj.call(s)=="[object Array]"}});var k1=ke((Uie,WM)=>{"use strict";var fj=String.prototype.valueOf,mj=function(e){try{return fj.call(e),!0}catch{return!1}},gj=Object.prototype.toString,yj="[object String]",_j=el()();WM.exports=function(e){return typeof e=="string"?!0:typeof e!="object"?!1:_j?mj(e):gj.call(e)===yj}});var XM=ke((Gie,ZM)=>{"use strict";var xj="Function.prototype.bind called on incompatible ",F1=Array.prototype.slice,vj=Object.prototype.toString,bj="[object Function]";ZM.exports=function(e){var t=this;if(typeof t!="function"||vj.call(t)!==bj)throw new TypeError(xj+t);for(var a=F1.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(F1.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(F1.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var KM=ke((Vie,HM)=>{"use strict";var wj=XM();HM.exports=Function.prototype.bind||wj});var rR=ke((qie,tR)=>{"use strict";var Jt,Ch=SyntaxError,eR=Function,Th=TypeError,L1=function(s){try{return eR('"use strict"; return ('+s+").constructor;")()}catch{}},yc=Object.getOwnPropertyDescriptor;if(yc)try{yc({},"")}catch{yc=null}var D1=function(){throw new Th},Sj=yc?function(){try{return arguments.callee,D1}catch{try{return yc(arguments,"callee").get}catch{return D1}}}():D1,Ih=ho()(),Rs=Object.getPrototypeOf||function(s){return s.__proto__},Ph={},Aj=typeof Uint8Array>"u"?Jt:Rs(Uint8Array),_c={"%AggregateError%":typeof AggregateError>"u"?Jt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Jt:ArrayBuffer,"%ArrayIteratorPrototype%":Ih?Rs([][Symbol.iterator]()):Jt,"%AsyncFromSyncIteratorPrototype%":Jt,"%AsyncFunction%":Ph,"%AsyncGenerator%":Ph,"%AsyncGeneratorFunction%":Ph,"%AsyncIteratorPrototype%":Ph,"%Atomics%":typeof Atomics>"u"?Jt:Atomics,"%BigInt%":typeof BigInt>"u"?Jt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Jt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Jt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Jt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Jt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Jt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Jt:FinalizationRegistry,"%Function%":eR,"%GeneratorFunction%":Ph,"%Int8Array%":typeof Int8Array>"u"?Jt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Jt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Jt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ih?Rs(Rs([][Symbol.iterator]())):Jt,"%JSON%":typeof JSON=="object"?JSON:Jt,"%Map%":typeof Map>"u"?Jt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ih?Jt:Rs(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Jt:Promise,"%Proxy%":typeof Proxy>"u"?Jt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Jt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Jt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ih?Jt:Rs(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Jt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ih?Rs(""[Symbol.iterator]()):Jt,"%Symbol%":Ih?Symbol:Jt,"%SyntaxError%":Ch,"%ThrowTypeError%":Sj,"%TypedArray%":Aj,"%TypeError%":Th,"%Uint8Array%":typeof Uint8Array>"u"?Jt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Jt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Jt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Jt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Jt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Jt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Jt:WeakSet};try{null.error}catch(s){YM=Rs(Rs(s)),_c["%Error.prototype%"]=YM}var YM,Ej=function s(e){var t;if(e==="%AsyncFunction%")t=L1("async function () {}");else if(e==="%GeneratorFunction%")t=L1("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=L1("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&(t=Rs(l.prototype))}return _c[e]=t,t},JM={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},_f=KM(),ly=As(),Ij=_f.call(Function.call,Array.prototype.concat),Pj=_f.call(Function.apply,Array.prototype.splice),QM=_f.call(Function.call,String.prototype.replace),cy=_f.call(Function.call,String.prototype.slice),Tj=_f.call(Function.call,RegExp.prototype.exec),Cj=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Mj=/\\(\\)?/g,Rj=function(e){var t=cy(e,0,1),a=cy(e,-1);if(t==="%"&&a!=="%")throw new Ch("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new Ch("invalid intrinsic syntax, expected opening `%`");var l=[];return QM(e,Cj,function(o,m,g,b){l[l.length]=g?QM(b,Mj,"$1"):m||o}),l},kj=function(e,t){var a=e,l;if(ly(JM,a)&&(l=JM[a],a="%"+l[0]+"%"),ly(_c,a)){var o=_c[a];if(o===Ph&&(o=Ej(a)),typeof o>"u"&&!t)throw new Th("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new Ch("intrinsic "+e+" does not exist!")};tR.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Th("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Th('"allowMissing" argument must be a boolean');if(Tj(/^%?[^%]*%?$/,e)===null)throw new Ch("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=Rj(e),l=a.length>0?a[0]:"",o=kj("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],Pj(a,Ij([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=cy(k,0,1),Z=cy(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new Ch("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",ly(_c,m))g=_c[m];else if(g!=null){if(!(k in g)){if(!t)throw new Th("base intrinsic for "+e+" exists, but the property is not available.");return}if(yc&&S+1>=a.length){var te=yc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=ly(g,k),g=g[k];M&&!b&&(_c[m]=g)}}return g}});var sR=ke(($ie,oR)=>{"use strict";var O1=typeof Map=="function"&&Map.prototype?Map:null,Fj=typeof Set=="function"&&Set.prototype?Set:null,uy;O1||(uy=function(e){return!1});var nR=O1?Map.prototype.has:null,iR=Fj?Set.prototype.has:null;!uy&&!nR&&(uy=function(e){return!1});oR.exports=uy||function(e){if(!e||typeof e!="object")return!1;try{if(nR.call(e),iR)try{iR.call(e)}catch{return!0}return e instanceof O1}catch{}return!1}});var uR=ke((Wie,cR)=>{"use strict";var Lj=typeof Map=="function"&&Map.prototype?Map:null,z1=typeof Set=="function"&&Set.prototype?Set:null,hy;z1||(hy=function(e){return!1});var aR=Lj?Map.prototype.has:null,lR=z1?Set.prototype.has:null;!hy&&!lR&&(hy=function(e){return!1});cR.exports=hy||function(e){if(!e||typeof e!="object")return!1;try{if(lR.call(e),aR)try{aR.call(e)}catch{return!0}return e instanceof z1}catch{}return!1}});var wR=ke((Zie,fy)=>{"use strict";var hR=h1(),pR=qM();ho()()||Uu()()?(py=Symbol.iterator,fy.exports=function(e){if(e!=null&&typeof e[py]<"u")return e[py]();if(hR(e))return Array.prototype[py].call(e)}):(dR=R1(),fR=k1(),B1=rR(),mR=B1("%Map%",!0),gR=B1("%Set%",!0),To=Po(),N1=To("Array.prototype.push"),j1=To("String.prototype.charCodeAt"),yR=To("String.prototype.slice"),_R=function(e,t){var a=e.length;if(t+1>=a)return t+1;var l=j1(e,t);if(l<55296||l>56319)return t+1;var o=j1(e,t+1);return o<56320||o>57343?t+1:t+2},dy=function(e){var t=0;return{next:function(){var l=t>=e.length,o;return l||(o=e[t],t+=1),{done:l,value:o}}}},U1=function(e,t){if(dR(e)||hR(e))return dy(e);if(fR(e)){var a=0;return{next:function(){var o=_R(e,a),m=yR(e,a,o);return a=o,{done:o>e.length,value:m}}}}if(t&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()},!mR&&!gR?fy.exports=function(e){if(e!=null)return U1(e,!0)}:(xR=sR(),vR=uR(),G1=To("Map.prototype.forEach",!0),V1=To("Set.prototype.forEach",!0),(typeof process>"u"||!process.versions||!process.versions.node)&&(q1=To("Map.prototype.iterator",!0),$1=To("Set.prototype.iterator",!0)),W1=To("Map.prototype.@@iterator",!0)||To("Map.prototype._es6-shim iterator_",!0),Z1=To("Set.prototype.@@iterator",!0)||To("Set.prototype._es6-shim iterator_",!0),bR=function(e){if(xR(e)){if(q1)return pR(q1(e));if(W1)return W1(e);if(G1){var t=[];return G1(e,function(l,o){N1(t,[o,l])}),dy(t)}}if(vR(e)){if($1)return pR($1(e));if(Z1)return Z1(e);if(V1){var a=[];return V1(e,function(l){N1(a,l)}),dy(a)}}},fy.exports=function(e){return bR(e)||U1(e)}));var py,dR,fR,B1,mR,gR,To,N1,j1,yR,_R,dy,U1,xR,vR,G1,V1,q1,$1,W1,Z1,bR});var TR=ke((Xie,my)=>{"use strict";var X1=Yu(),gy=da(),Dj=Wg(),Oj=Qa(),ER=gy("%Function.prototype.apply%"),IR=gy("%Function.prototype.call%"),PR=gy("%Reflect.apply%",!0)||X1.call(IR,ER),SR=rh(),zj=gy("%Math.max%");my.exports=function(e){if(typeof e!="function")throw new Oj("a function is required");var t=PR(X1,IR,arguments);return Dj(t,1+zj(0,e.length-(arguments.length-1)),!0)};var AR=function(){return PR(X1,ER,arguments)};SR?SR(my.exports,"apply",{value:AR}):my.exports.apply=AR});var H1=ke((Hie,MR)=>{"use strict";var CR=function(s){return s!==s};MR.exports=function(e,t){return e===0&&t===0?1/e===1/t:!!(e===t||CR(e)&&CR(t))}});var K1=ke((Kie,RR)=>{"use strict";var Bj=H1();RR.exports=function(){return typeof Object.is=="function"?Object.is:Bj}});var FR=ke((Yie,kR)=>{"use strict";var Nj=K1(),jj=fh();kR.exports=function(){var e=Nj();return jj(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var zR=ke((Jie,OR)=>{"use strict";var Uj=fh(),Gj=TR(),Vj=H1(),LR=K1(),qj=FR(),DR=Gj(LR(),Object);Uj(DR,{getPolyfill:LR,implementation:Vj,shim:qj});OR.exports=DR});var NR=ke((Qie,BR)=>{"use strict";var $j="Function.prototype.bind called on incompatible ",Y1=Array.prototype.slice,Wj=Object.prototype.toString,Zj="[object Function]";BR.exports=function(e){var t=this;if(typeof t!="function"||Wj.call(t)!==Zj)throw new TypeError($j+t);for(var a=Y1.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(Y1.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(Y1.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var UR=ke((ene,jR)=>{"use strict";var Xj=NR();jR.exports=Function.prototype.bind||Xj});var ZR=ke((tne,WR)=>{"use strict";var Qt,Fh=SyntaxError,$R=Function,kh=TypeError,J1=function(s){try{return $R('"use strict"; return ('+s+").constructor;")()}catch{}},xc=Object.getOwnPropertyDescriptor;if(xc)try{xc({},"")}catch{xc=null}var Q1=function(){throw new kh},Hj=xc?function(){try{return arguments.callee,Q1}catch{try{return xc(arguments,"callee").get}catch{return Q1}}}():Q1,Mh=ho()(),ks=Object.getPrototypeOf||function(s){return s.__proto__},Rh={},Kj=typeof Uint8Array>"u"?Qt:ks(Uint8Array),vc={"%AggregateError%":typeof AggregateError>"u"?Qt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Qt:ArrayBuffer,"%ArrayIteratorPrototype%":Mh?ks([][Symbol.iterator]()):Qt,"%AsyncFromSyncIteratorPrototype%":Qt,"%AsyncFunction%":Rh,"%AsyncGenerator%":Rh,"%AsyncGeneratorFunction%":Rh,"%AsyncIteratorPrototype%":Rh,"%Atomics%":typeof Atomics>"u"?Qt:Atomics,"%BigInt%":typeof BigInt>"u"?Qt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Qt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Qt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Qt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Qt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Qt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Qt:FinalizationRegistry,"%Function%":$R,"%GeneratorFunction%":Rh,"%Int8Array%":typeof Int8Array>"u"?Qt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Qt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Qt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Mh?ks(ks([][Symbol.iterator]())):Qt,"%JSON%":typeof JSON=="object"?JSON:Qt,"%Map%":typeof Map>"u"?Qt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Mh?Qt:ks(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Qt:Promise,"%Proxy%":typeof Proxy>"u"?Qt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Qt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Qt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Mh?Qt:ks(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Qt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Mh?ks(""[Symbol.iterator]()):Qt,"%Symbol%":Mh?Symbol:Qt,"%SyntaxError%":Fh,"%ThrowTypeError%":Hj,"%TypedArray%":Kj,"%TypeError%":kh,"%Uint8Array%":typeof Uint8Array>"u"?Qt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Qt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Qt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Qt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Qt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Qt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Qt:WeakSet};try{null.error}catch(s){GR=ks(ks(s)),vc["%Error.prototype%"]=GR}var GR,Yj=function s(e){var t;if(e==="%AsyncFunction%")t=J1("async function () {}");else if(e==="%GeneratorFunction%")t=J1("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=J1("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&(t=ks(l.prototype))}return vc[e]=t,t},VR={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},xf=UR(),yy=As(),Jj=xf.call(Function.call,Array.prototype.concat),Qj=xf.call(Function.apply,Array.prototype.splice),qR=xf.call(Function.call,String.prototype.replace),_y=xf.call(Function.call,String.prototype.slice),eU=xf.call(Function.call,RegExp.prototype.exec),tU=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,rU=/\\(\\)?/g,iU=function(e){var t=_y(e,0,1),a=_y(e,-1);if(t==="%"&&a!=="%")throw new Fh("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new Fh("invalid intrinsic syntax, expected opening `%`");var l=[];return qR(e,tU,function(o,m,g,b){l[l.length]=g?qR(b,rU,"$1"):m||o}),l},nU=function(e,t){var a=e,l;if(yy(VR,a)&&(l=VR[a],a="%"+l[0]+"%"),yy(vc,a)){var o=vc[a];if(o===Rh&&(o=Yj(a)),typeof o>"u"&&!t)throw new kh("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new Fh("intrinsic "+e+" does not exist!")};WR.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new kh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new kh('"allowMissing" argument must be a boolean');if(eU(/^%?[^%]*%?$/,e)===null)throw new Fh("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=iU(e),l=a.length>0?a[0]:"",o=nU("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],Qj(a,Jj([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=_y(k,0,1),Z=_y(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new Fh("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",yy(vc,m))g=vc[m];else if(g!=null){if(!(k in g)){if(!t)throw new kh("base intrinsic for "+e+" exists, but the property is not available.");return}if(xc&&S+1>=a.length){var te=xc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=yy(g,k),g=g[k];M&&!b&&(vc[m]=g)}}return g}});var YR=ke((rne,KR)=>{"use strict";var HR=Function.prototype.toString,Lh=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,tw,xy;if(typeof Lh=="function"&&typeof Object.defineProperty=="function")try{tw=Object.defineProperty({},"length",{get:function(){throw xy}}),xy={},Lh(function(){throw 42},null,tw)}catch(s){s!==xy&&(Lh=null)}else Lh=null;var oU=/^\s*class\b/,rw=function(e){try{var t=HR.call(e);return oU.test(t)}catch{return!1}},ew=function(e){try{return rw(e)?!1:(HR.call(e),!0)}catch{return!1}},vy=Object.prototype.toString,sU="[object Object]",aU="[object Function]",lU="[object GeneratorFunction]",cU="[object HTMLAllCollection]",uU="[object HTML document.all class]",hU="[object HTMLCollection]",pU=typeof Symbol=="function"&&!!Symbol.toStringTag,dU=!(0 in[,]),iw=function(){return!1};typeof document=="object"&&(XR=document.all,vy.call(XR)===vy.call(document.all)&&(iw=function(e){if((dU||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=vy.call(e);return(t===cU||t===uU||t===hU||t===sU)&&e("")==null}catch{}return!1}));var XR;KR.exports=Lh?function(e){if(iw(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Lh(e,null,tw)}catch(t){if(t!==xy)return!1}return!rw(e)&&ew(e)}:function(e){if(iw(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(pU)return ew(e);if(rw(e))return!1;var t=vy.call(e);return t!==aU&&t!==lU&&!/^\[object HTML/.test(t)?!1:ew(e)}});var nw=ke((ine,QR)=>{"use strict";var fU=YR(),mU=Object.prototype.toString,JR=Object.prototype.hasOwnProperty,gU=function(e,t,a){for(var l=0,o=e.length;l<o;l++)JR.call(e,l)&&(a==null?t(e[l],l,e):t.call(a,e[l],l,e))},yU=function(e,t,a){for(var l=0,o=e.length;l<o;l++)a==null?t(e.charAt(l),l,e):t.call(a,e.charAt(l),l,e)},_U=function(e,t,a){for(var l in e)JR.call(e,l)&&(a==null?t(e[l],l,e):t.call(a,e[l],l,e))},xU=function(e,t,a){if(!fU(t))throw new TypeError("iterator must be a function");var l;arguments.length>=3&&(l=a),mU.call(e)==="[object Array]"?gU(e,t,l):typeof e=="string"?yU(e,t,l):_U(e,t,l)};QR.exports=xU});var tk=ke((nne,ek)=>{"use strict";var ow=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],vU=typeof globalThis>"u"?global:globalThis;ek.exports=function(){for(var e=[],t=0;t<ow.length;t++)typeof vU[ow[t]]=="function"&&(e[e.length]=ow[t]);return e}});var ak=ke((one,sk)=>{"use strict";var rk=nw(),bU=tk(),aw=Po(),wU=aw("Object.prototype.toString"),ik=el()(),by=ah(),SU=typeof globalThis>"u"?global:globalThis,nk=bU(),AU=aw("Array.prototype.indexOf",!0)||function(e,t){for(var a=0;a<e.length;a+=1)if(e[a]===t)return a;return-1},EU=aw("String.prototype.slice"),ok={},sw=Object.getPrototypeOf;ik&&by&&sw&&rk(nk,function(s){var e=new SU[s];if(Symbol.toStringTag in e){var t=sw(e),a=by(t,Symbol.toStringTag);if(!a){var l=sw(t);a=by(l,Symbol.toStringTag)}ok[s]=a.get}});var IU=function(e){var t=!1;return rk(ok,function(a,l){if(!t)try{t=a.call(e)===l}catch{}}),t};sk.exports=function(e){if(!e||typeof e!="object")return!1;if(!ik||!(Symbol.toStringTag in e)){var t=EU(wU(e),8,-1);return AU(nk,t)>-1}return by?IU(e):!1}});var lw=ke((sne,dk)=>{"use strict";var PU=Ng(),TU=Po(),pk=ZR(),CU=ak(),lk=pk("ArrayBuffer",!0),ck=pk("Float32Array",!0),wy=TU("ArrayBuffer.prototype.byteLength",!0),uk=lk&&!wy&&new lk().slice,hk=uk&&PU(uk);dk.exports=wy||hk?function(e){if(!e||typeof e!="object")return!1;try{return wy?wy(e):hk(e,0),!0}catch{return!1}}:ck?function(e){try{return new ck(e).buffer===e&&!CU(e)}catch(t){return typeof e=="object"&&t.name==="RangeError"}}:function(e){return!1}});var mk=ke((ane,fk)=>{"use strict";var MU=Date.prototype.getDay,RU=function(e){try{return MU.call(e),!0}catch{return!1}},kU=Object.prototype.toString,FU="[object Date]",LU=el()();fk.exports=function(e){return typeof e!="object"||e===null?!1:LU?RU(e):kU.call(e)===FU}});var vk=ke((lne,xk)=>{"use strict";var cw=Po(),gk=el()(),yk,_k,uw,hw;gk&&(yk=cw("Object.prototype.hasOwnProperty"),_k=cw("RegExp.prototype.exec"),uw={},Sy=function(){throw uw},hw={toString:Sy,valueOf:Sy},typeof Symbol.toPrimitive=="symbol"&&(hw[Symbol.toPrimitive]=Sy));var Sy,DU=cw("Object.prototype.toString"),OU=Object.getOwnPropertyDescriptor,zU="[object RegExp]";xk.exports=gk?function(e){if(!e||typeof e!="object")return!1;var t=OU(e,"lastIndex"),a=t&&yk(t,"value");if(!a)return!1;try{_k(e,hw)}catch(l){return l===uw}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:DU(e)===zU}});var Sk=ke((cne,wk)=>{"use strict";var BU=Po(),bk=BU("SharedArrayBuffer.prototype.byteLength",!0);wk.exports=bk?function(e){if(!e||typeof e!="object")return!1;try{return bk(e),!0}catch{return!1}}:function(e){return!1}});var Ek=ke((une,Ak)=>{"use strict";var NU=Number.prototype.toString,jU=function(e){try{return NU.call(e),!0}catch{return!1}},UU=Object.prototype.toString,GU="[object Number]",VU=el()();Ak.exports=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:VU?jU(e):UU.call(e)===GU}});var Tk=ke((hne,Pk)=>{"use strict";var Ik=Po(),qU=Ik("Boolean.prototype.toString"),$U=Ik("Object.prototype.toString"),WU=function(e){try{return qU(e),!0}catch{return!1}},ZU="[object Boolean]",XU=el()();Pk.exports=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:XU&&Symbol.toStringTag in e?WU(e):$U(e)===ZU}});var kk=ke((pne,pw)=>{"use strict";var HU=Object.prototype.toString,KU=ho()();KU?(Ck=Symbol.prototype.toString,Mk=/^Symbol\(.*\)$/,Rk=function(e){return typeof e.valueOf()!="symbol"?!1:Mk.test(Ck.call(e))},pw.exports=function(e){if(typeof e=="symbol")return!0;if(HU.call(e)!=="[object Symbol]")return!1;try{return Rk(e)}catch{return!1}}):pw.exports=function(e){return!1};var Ck,Mk,Rk});var Dk=ke((dne,Lk)=>{"use strict";var Fk=typeof BigInt<"u"&&BigInt;Lk.exports=function(){return typeof Fk=="function"&&typeof BigInt=="function"&&typeof Fk(42)=="bigint"&&typeof BigInt(42)=="bigint"}});var Bk=ke((fne,dw)=>{"use strict";var YU=Dk()();YU?(Ok=BigInt.prototype.valueOf,zk=function(e){try{return Ok.call(e),!0}catch{}return!1},dw.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:zk(e)}):dw.exports=function(e){return!1};var Ok,zk});var jk=ke((mne,Nk)=>{"use strict";var JU=k1(),QU=Ek(),eG=Tk(),tG=kk(),rG=Bk();Nk.exports=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(JU(e))return"String";if(QU(e))return"Number";if(eG(e))return"Boolean";if(tG(e))return"Symbol";if(rG(e))return"BigInt"}});var qk=ke((gne,Vk)=>{"use strict";var fw=typeof Map=="function"&&Map.prototype?Map:null,iG=typeof Set=="function"&&Set.prototype?Set:null,Ay;fw||(Ay=function(e){return!1});var Gk=fw?Map.prototype.has:null,Uk=iG?Set.prototype.has:null;!Ay&&!Gk&&(Ay=function(e){return!1});Vk.exports=Ay||function(e){if(!e||typeof e!="object")return!1;try{if(Gk.call(e),Uk)try{Uk.call(e)}catch{return!0}return e instanceof fw}catch{}return!1}});var Xk=ke((yne,Zk)=>{"use strict";var nG=typeof Map=="function"&&Map.prototype?Map:null,mw=typeof Set=="function"&&Set.prototype?Set:null,Ey;mw||(Ey=function(e){return!1});var $k=nG?Map.prototype.has:null,Wk=mw?Set.prototype.has:null;!Ey&&!Wk&&(Ey=function(e){return!1});Zk.exports=Ey||function(e){if(!e||typeof e!="object")return!1;try{if(Wk.call(e),$k)try{$k.call(e)}catch{return!0}return e instanceof mw}catch{}return!1}});var Yk=ke((_ne,Kk)=>{"use strict";var Iy=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Hk=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Py;Iy||(Py=function(e){return!1});var yw=Iy?Iy.prototype.has:null,gw=Hk?Hk.prototype.has:null;!Py&&!yw&&(Py=function(e){return!1});Kk.exports=Py||function(e){if(!e||typeof e!="object")return!1;try{if(yw.call(e,yw),gw)try{gw.call(e,gw)}catch{return!0}return e instanceof Iy}catch{}return!1}});var Qk=ke((xne,Jk)=>{"use strict";var oG="Function.prototype.bind called on incompatible ",_w=Array.prototype.slice,sG=Object.prototype.toString,aG="[object Function]";Jk.exports=function(e){var t=this;if(typeof t!="function"||sG.call(t)!==aG)throw new TypeError(oG+t);for(var a=_w.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(_w.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(_w.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var tF=ke((vne,eF)=>{"use strict";var lG=Qk();eF.exports=Function.prototype.bind||lG});var aF=ke((bne,sF)=>{"use strict";var er,Bh=SyntaxError,oF=Function,zh=TypeError,xw=function(s){try{return oF('"use strict"; return ('+s+").constructor;")()}catch{}},bc=Object.getOwnPropertyDescriptor;if(bc)try{bc({},"")}catch{bc=null}var vw=function(){throw new zh},cG=bc?function(){try{return arguments.callee,vw}catch{try{return bc(arguments,"callee").get}catch{return vw}}}():vw,Dh=ho()(),Fs=Object.getPrototypeOf||function(s){return s.__proto__},Oh={},uG=typeof Uint8Array>"u"?er:Fs(Uint8Array),wc={"%AggregateError%":typeof AggregateError>"u"?er:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?er:ArrayBuffer,"%ArrayIteratorPrototype%":Dh?Fs([][Symbol.iterator]()):er,"%AsyncFromSyncIteratorPrototype%":er,"%AsyncFunction%":Oh,"%AsyncGenerator%":Oh,"%AsyncGeneratorFunction%":Oh,"%AsyncIteratorPrototype%":Oh,"%Atomics%":typeof Atomics>"u"?er:Atomics,"%BigInt%":typeof BigInt>"u"?er:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?er:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?er:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?er:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?er:Float32Array,"%Float64Array%":typeof Float64Array>"u"?er:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?er:FinalizationRegistry,"%Function%":oF,"%GeneratorFunction%":Oh,"%Int8Array%":typeof Int8Array>"u"?er:Int8Array,"%Int16Array%":typeof Int16Array>"u"?er:Int16Array,"%Int32Array%":typeof Int32Array>"u"?er:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Dh?Fs(Fs([][Symbol.iterator]())):er,"%JSON%":typeof JSON=="object"?JSON:er,"%Map%":typeof Map>"u"?er:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Dh?er:Fs(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?er:Promise,"%Proxy%":typeof Proxy>"u"?er:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?er:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?er:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Dh?er:Fs(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?er:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Dh?Fs(""[Symbol.iterator]()):er,"%Symbol%":Dh?Symbol:er,"%SyntaxError%":Bh,"%ThrowTypeError%":cG,"%TypedArray%":uG,"%TypeError%":zh,"%Uint8Array%":typeof Uint8Array>"u"?er:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?er:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?er:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?er:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?er:WeakMap,"%WeakRef%":typeof WeakRef>"u"?er:WeakRef,"%WeakSet%":typeof WeakSet>"u"?er:WeakSet};try{null.error}catch(s){rF=Fs(Fs(s)),wc["%Error.prototype%"]=rF}var rF,hG=function s(e){var t;if(e==="%AsyncFunction%")t=xw("async function () {}");else if(e==="%GeneratorFunction%")t=xw("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=xw("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&(t=Fs(l.prototype))}return wc[e]=t,t},iF={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},vf=tF(),Ty=As(),pG=vf.call(Function.call,Array.prototype.concat),dG=vf.call(Function.apply,Array.prototype.splice),nF=vf.call(Function.call,String.prototype.replace),Cy=vf.call(Function.call,String.prototype.slice),fG=vf.call(Function.call,RegExp.prototype.exec),mG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,gG=/\\(\\)?/g,yG=function(e){var t=Cy(e,0,1),a=Cy(e,-1);if(t==="%"&&a!=="%")throw new Bh("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new Bh("invalid intrinsic syntax, expected opening `%`");var l=[];return nF(e,mG,function(o,m,g,b){l[l.length]=g?nF(b,gG,"$1"):m||o}),l},_G=function(e,t){var a=e,l;if(Ty(iF,a)&&(l=iF[a],a="%"+l[0]+"%"),Ty(wc,a)){var o=wc[a];if(o===Oh&&(o=hG(a)),typeof o>"u"&&!t)throw new zh("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new Bh("intrinsic "+e+" does not exist!")};sF.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new zh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new zh('"allowMissing" argument must be a boolean');if(fG(/^%?[^%]*%?$/,e)===null)throw new Bh("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=yG(e),l=a.length>0?a[0]:"",o=_G("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],dG(a,pG([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=Cy(k,0,1),Z=Cy(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new Bh("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",Ty(wc,m))g=wc[m];else if(g!=null){if(!(k in g)){if(!t)throw new zh("base intrinsic for "+e+" exists, but the property is not available.");return}if(bc&&S+1>=a.length){var te=bc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=Ty(g,k),g=g[k];M&&!b&&(wc[m]=g)}}return g}});var cF=ke((wne,ww)=>{"use strict";var xG=aF(),lF=Po(),vG=xG("%WeakSet%",!0),bw=lF("WeakSet.prototype.has",!0);bw?(My=lF("WeakMap.prototype.has",!0),ww.exports=function(e){if(!e||typeof e!="object")return!1;try{if(bw(e,bw),My)try{My(e,My)}catch{return!0}return e instanceof vG}catch{}return!1}):ww.exports=function(e){return!1};var My});var hF=ke((Sne,uF)=>{"use strict";var bG=qk(),wG=Xk(),SG=Yk(),AG=cF();uF.exports=function(e){if(e&&typeof e=="object"){if(bG(e))return"Map";if(wG(e))return"Set";if(SG(e))return"WeakMap";if(AG(e))return"WeakSet"}return!1}});var dF=ke((Ane,pF)=>{"use strict";pF.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var mF=ke((Ene,fF)=>{"use strict";var Sw=dF(),EG=typeof globalThis>"u"?global:globalThis;fF.exports=function(){for(var e=[],t=0;t<Sw.length;t++)typeof EG[Sw[t]]=="function"&&(e[e.length]=Sw[t]);return e}});var Ew=ke((Ine,Ry)=>{"use strict";var Aw=Yu(),ky=da(),IG=Wg(),PG=Qa(),_F=ky("%Function.prototype.apply%"),xF=ky("%Function.prototype.call%"),vF=ky("%Reflect.apply%",!0)||Aw.call(xF,_F),gF=rh(),TG=ky("%Math.max%");Ry.exports=function(e){if(typeof e!="function")throw new PG("a function is required");var t=vF(Aw,xF,arguments);return IG(t,1+TG(0,e.length-(arguments.length-1)),!0)};var yF=function(){return vF(Aw,_F,arguments)};gF?gF(Ry.exports,"apply",{value:yF}):Ry.exports.apply=yF});var AF=ke((Pne,SF)=>{"use strict";var bF=da(),wF=Ew(),CG=wF(bF("String.prototype.indexOf"));SF.exports=function(e,t){var a=bF(e,!!t);return typeof a=="function"&&CG(e,".prototype.")>-1?wF(a):a}});var IF=ke((Tne,EF)=>{"use strict";var MG=Uu();EF.exports=function(){return MG()&&!!Symbol.toStringTag}});var RF=ke((Cne,MF)=>{"use strict";var Ly=nw(),RG=mF(),PF=Ew(),Tw=AF(),Fy=ah(),kG=Tw("Object.prototype.toString"),CF=IF()(),TF=typeof globalThis>"u"?global:globalThis,Pw=RG(),Cw=Tw("String.prototype.slice"),Iw=Object.getPrototypeOf,FG=Tw("Array.prototype.indexOf",!0)||function(e,t){for(var a=0;a<e.length;a+=1)if(e[a]===t)return a;return-1},Dy={__proto__:null};CF&&Fy&&Iw?Ly(Pw,function(s){var e=new TF[s];if(Symbol.toStringTag in e){var t=Iw(e),a=Fy(t,Symbol.toStringTag);if(!a){var l=Iw(t);a=Fy(l,Symbol.toStringTag)}Dy["$"+s]=PF(a.get)}}):Ly(Pw,function(s){var e=new TF[s],t=e.slice||e.set;t&&(Dy["$"+s]=PF(t))});var LG=function(e){var t=!1;return Ly(Dy,function(a,l){if(!t)try{"$"+a(e)===l&&(t=Cw(l,1))}catch{}}),t},DG=function(e){var t=!1;return Ly(Dy,function(a,l){if(!t)try{a(e),t=Cw(l,1)}catch{}}),t};MF.exports=function(e){if(!e||typeof e!="object")return!1;if(!CF){var t=Cw(kG(e),8,-1);return FG(Pw,t)>-1?t:t!=="Object"?!1:DG(e)}return Fy?LG(e):null}});var LF=ke((Mne,FF)=>{"use strict";var OG=Po(),kF=OG("ArrayBuffer.prototype.byteLength",!0),zG=lw();FF.exports=function(e){return zG(e)?kF?kF(e):e.byteLength:NaN}});var oL=ke((Rne,nL)=>{"use strict";var tL=cT(),Ls=pC(),DF=nM(),BG=da(),Nh=wR(),NG=C1(),OF=zR(),zF=h1(),BF=R1(),NF=lw(),jF=mk(),UF=vk(),GF=Sk(),VF=tf(),qF=jk(),$F=hF(),WF=RF(),ZF=LF(),XF=Ls("SharedArrayBuffer.prototype.byteLength",!0),HF=Ls("Date.prototype.getTime"),Mw=Object.getPrototypeOf,KF=Ls("Object.prototype.toString"),zy=BG("%Set%",!0),Rw=Ls("Map.prototype.has",!0),By=Ls("Map.prototype.get",!0),YF=Ls("Map.prototype.size",!0),Ny=Ls("Set.prototype.add",!0),rL=Ls("Set.prototype.delete",!0),jy=Ls("Set.prototype.has",!0),Oy=Ls("Set.prototype.size",!0);function JF(s,e,t,a){for(var l=Nh(s),o;(o=l.next())&&!o.done;)if(Yo(e,o.value,t,a))return rL(s,o.value),!0;return!1}function iL(s){if(typeof s>"u")return null;if(typeof s!="object")return typeof s=="symbol"?!1:typeof s=="string"||typeof s=="number"?+s==+s:!0}function jG(s,e,t,a,l,o){var m=iL(t);if(m!=null)return m;var g=By(e,m),b=tL({},l,{strict:!1});return typeof g>"u"&&!Rw(e,m)||!Yo(a,g,b,o)?!1:!Rw(s,m)&&Yo(a,g,b,o)}function UG(s,e,t){var a=iL(t);return a??(jy(e,a)&&!jy(s,a))}function QF(s,e,t,a,l,o){for(var m=Nh(s),g,b;(g=m.next())&&!g.done;)if(b=g.value,Yo(t,b,l,o)&&Yo(a,By(e,b),l,o))return rL(s,b),!0;return!1}function Yo(s,e,t,a){var l=t||{};if(l.strict?OF(s,e):s===e)return!0;var o=qF(s),m=qF(e);if(o!==m)return!1;if(!s||!e||typeof s!="object"&&typeof e!="object")return l.strict?OF(s,e):s==e;var g=a.has(s),b=a.has(e),A;if(g&&b){if(a.get(s)===a.get(e))return!0}else A={};return g||a.set(s,A),b||a.set(e,A),qG(s,e,l,a)}function eL(s){return!s||typeof s!="object"||typeof s.length!="number"||typeof s.copy!="function"||typeof s.slice!="function"||s.length>0&&typeof s[0]!="number"?!1:!!(s.constructor&&s.constructor.isBuffer&&s.constructor.isBuffer(s))}function GG(s,e,t,a){if(Oy(s)!==Oy(e))return!1;for(var l=Nh(s),o=Nh(e),m,g,b;(m=l.next())&&!m.done;)if(m.value&&typeof m.value=="object")b||(b=new zy),Ny(b,m.value);else if(!jy(e,m.value)){if(t.strict||!UG(s,e,m.value))return!1;b||(b=new zy),Ny(b,m.value)}if(b){for(;(g=o.next())&&!g.done;)if(g.value&&typeof g.value=="object"){if(!JF(b,g.value,t.strict,a))return!1}else if(!t.strict&&!jy(s,g.value)&&!JF(b,g.value,t.strict,a))return!1;return Oy(b)===0}return!0}function VG(s,e,t,a){if(YF(s)!==YF(e))return!1;for(var l=Nh(s),o=Nh(e),m,g,b,A,S,M;(m=l.next())&&!m.done;)if(A=m.value[0],S=m.value[1],A&&typeof A=="object")b||(b=new zy),Ny(b,A);else if(M=By(e,A),typeof M>"u"&&!Rw(e,A)||!Yo(S,M,t,a)){if(t.strict||!jG(s,e,A,S,t,a))return!1;b||(b=new zy),Ny(b,A)}if(b){for(;(g=o.next())&&!g.done;)if(A=g.value[0],M=g.value[1],A&&typeof A=="object"){if(!QF(b,s,A,M,t,a))return!1}else if(!t.strict&&(!s.has(A)||!Yo(By(s,A),M,t,a))&&!QF(b,s,A,M,tL({},t,{strict:!1}),a))return!1;return Oy(b)===0}return!0}function qG(s,e,t,a){var l,o;if(typeof s!=typeof e||s==null||e==null||KF(s)!==KF(e)||zF(s)!==zF(e))return!1;var m=BF(s),g=BF(e);if(m!==g)return!1;var b=s instanceof Error,A=e instanceof Error;if(b!==A||(b||A)&&(s.name!==e.name||s.message!==e.message))return!1;var S=UF(s),M=UF(e);if(S!==M||(S||M)&&(s.source!==e.source||DF(s)!==DF(e)))return!1;var k=jF(s),j=jF(e);if(k!==j||(k||j)&&HF(s)!==HF(e)||t.strict&&Mw&&Mw(s)!==Mw(e))return!1;var Z=WF(s),te=WF(e);if(Z!==te)return!1;if(Z||te){if(s.length!==e.length)return!1;for(l=0;l<s.length;l++)if(s[l]!==e[l])return!1;return!0}var q=eL(s),H=eL(e);if(q!==H)return!1;if(q||H){if(s.length!==e.length)return!1;for(l=0;l<s.length;l++)if(s[l]!==e[l])return!1;return!0}var ae=NF(s),pe=NF(e);if(ae!==pe)return!1;if(ae||pe)return ZF(s)!==ZF(e)?!1:typeof Uint8Array=="function"&&Yo(new Uint8Array(s),new Uint8Array(e),t,a);var ve=GF(s),de=GF(e);if(ve!==de)return!1;if(ve||de)return XF(s)!==XF(e)?!1:typeof Uint8Array=="function"&&Yo(new Uint8Array(s),new Uint8Array(e),t,a);if(typeof s!=typeof e)return!1;var _e=VF(s),Pe=VF(e);if(_e.length!==Pe.length)return!1;for(_e.sort(),Pe.sort(),l=_e.length-1;l>=0;l--)if(_e[l]!=Pe[l])return!1;for(l=_e.length-1;l>=0;l--)if(o=_e[l],!Yo(s[o],e[o],t,a))return!1;var Re=$F(s),Ae=$F(e);return Re!==Ae?!1:Re==="Set"||Ae==="Set"?GG(s,e,t,a):Re==="Map"?VG(s,e,t,a):!0}nL.exports=function(e,t,a){return Yo(e,t,a,NG())}});var Tg={};nx(Tg,{CopyrightControl:()=>eI,Layer:()=>Pg,MaplibreLayer:()=>L2,MaplibreStyleLayer:()=>O2,MobilityLayerMixin:()=>Ss,RealtimeAPI:()=>nd,RealtimeLayer:()=>$2,RealtimeModes:()=>Jr,RoutingAPI:()=>od,RoutingControl:()=>w2,StopFinderControl:()=>E2,StopsAPI:()=>sd,VECTOR_TILE_FEATURE_PROPERTY:()=>Tu,VectorLayer:()=>X2,compareDepartures:()=>Cd,createCanvas:()=>zo,createRealtimeFilters:()=>bx,debounceDeparturesMessages:()=>h0,debounceWebsocketMessages:()=>id,fullTrajectoryDelayStyle:()=>G2,fullTrajectoryStyle:()=>Ig,getCircleCanvas:()=>yx,getDelayBgCanvas:()=>mx,getDelayTextCanvas:()=>gx,getFeatureInfoAtCoordinate:()=>H2,getHoursAndMinutes:()=>BA,getLayersAsFlatArray:()=>Nl,getMapGlCopyrights:()=>ad,getTextCanvas:()=>_x,getUTCDateString:()=>OA,getUTCTimeString:()=>zA,getUrlWithParams:()=>Ol,getVehiclePosition:()=>Pd,pad:()=>Rm,realtimeConfig:()=>Pu,realtimeDefaultStyle:()=>zl,realtimeDelayStyle:()=>xx,realtimeSimpleStyle:()=>vx,removeDuplicate:()=>Bl,renderTrajectories:()=>Td,routingStyle:()=>q2,sortAndFilterDepartures:()=>Md,sortByDelay:()=>wx});var IO=(s,e,t=100)=>{let a={},l={},o=[];return m=>{let{source:g,content:b}=m;a[g]&&window.clearTimeout(a[g]),e?l[e(b)]=b:o.push(b),a[g]=window.setTimeout(()=>{let A=e?Object.values(l):o;s(A)},t)}},id=IO;var PO=(s,e)=>s===e.SCHEMATIC?"_schematic":"",Oo=PO;var ox=class s{constructor(){this.defineProperties()}static getRequestString(e,t={}){let a=`${e} ${t.channel}`;return a+=t.args?` ${t.args}`:"",a+=t.id?` ${t.id}`:"",a.trim()}addEvents(e,t){this.websocket&&(this.websocket.addEventListener("message",e),t&&(this.websocket.addEventListener("error",t),this.websocket.addEventListener("close",t)))}close(){this.websocket&&(this.open||this.connecting)&&(this.websocket.onclose=()=>{},this.websocket.close(),this.messagesOnOpen=[])}connect(e,t=()=>{}){if(!e){this.websocket?.close();return}if(this.websocket){if(this.websocket.url===e&&(this.open||this.connecting))return;this.websocket.url!==e&&(this.open||this.connecting)&&this.websocket.close()}this.websocket=new WebSocket(e),this.open?(t(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{t(),this.subscribePreviousSubscriptions()})}defineProperties(){Object.defineProperties(this,{closed:{get:()=>!this.websocket||this.websocket.readyState===this.websocket.CLOSED},closing:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CLOSING)},connecting:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CONNECTING)},messagesOnOpen:{value:[],writable:!0},open:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.OPEN)},subscribed:{value:{},writable:!0},subscriptions:{value:[],writable:!0}})}get(e,t,a){let l=s.getRequestString("GET",e);this.send(l);let o=S=>(...M)=>{S(...M);let k=this.requests.findIndex(te=>l===te.requestString&&t===te.cb),{onErrorCb:j,onMessageCb:Z}=this.requests[k];this.removeEvents(Z,j),this.requests.splice(k,1)},{onErrorCb:m,onMessageCb:g}=this.listen(e,o(t),a&&o(a));this.requests||(this.requests=[]);let b=this.requests.findIndex(S=>l===S.requestString&&t===S.cb),A={cb:t,errorCb:a,onErrorCb:m,onMessageCb:g,params:e,requestString:l};b>-1?this.requests[b]=A:this.requests.push(A)}listen(e,t,a){this.unlisten(e,t);let l=o=>{let m;try{m=JSON.parse(o.data)}catch(A){console.error("WebSocket: unable to parse JSON data",A,o.data);return}let g=e.channel;g+=e.args?` ${e.args}`:"";let b;m.source==="buffer"?b=m.content:b=[m],b.forEach(A=>{A?.source===g&&(!e.id||e.id===m.client_reference)&&t(A)})};return this.addEvents(l,a),{onErrorCb:a,onMessageCb:l}}removeEvents(e,t){this.websocket&&(this.websocket.removeEventListener("message",e),t&&(this.websocket.removeEventListener("error",t),this.websocket.removeEventListener("close",t)))}send(e){if(!this.websocket||this.closed||this.closing)return;let t=()=>{this.websocket?.send(e)};this.open?this.messagesOnOpen.includes(e)||t():this.messagesOnOpen.includes(e)||(this.messagesOnOpen.push(e),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],t()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}subscribe(e,t,a,l=!1){let{onErrorCb:o,onMessageCb:m}=this.listen(e,t,a),g=s.getRequestString("",e),b=this.subscriptions.findIndex(S=>e.channel===S.params.channel&&t===S.cb),A={cb:t,errorCb:a,onErrorCb:o,onMessageCb:m,params:e,quiet:l};b>-1?this.subscriptions[b]=A:this.subscriptions.push(A),this.subscribed[g]||(A.quiet||(this.send(`GET ${g}`),this.send(`SUB ${g}`)),this.subscribed[g]=!0)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(e=>{this.subscribed[e]=!1}),[...this.subscriptions].forEach(e=>{this.subscribe(e.params,e.cb,e.errorCb,e.quiet)})}unlisten(e,t){[...this.subscriptions||[],...this.requests||[]].filter(a=>a.params.channel===e.channel&&(!t||a.cb===t)).forEach(({onErrorCb:a,onMessageCb:l})=>{this.removeEvents(l,a)})}unsubscribe(e,t){let a=this.subscriptions.filter(l=>l.params.channel===e&&(!t||l.cb===t));a.forEach(({onErrorCb:l,onMessageCb:o})=>{this.removeEvents(o,l)}),this.subscriptions=this.subscriptions.filter(l=>l.params.channel!==e||t&&l.cb!==t),e&&this.subscribed[e]&&!this.subscriptions.find(l=>l.params.channel===e)&&a.find(l=>!l.quiet)&&(this.send(`DEL ${e}`),this.subscribed[e]=!1)}},LA=ox;var Jr={RAW:"raw",SCHEMATIC:"schematic",TOPOGRAPHIC:"topographic"},sx=class{constructor(e={}){this.version="2";let t=e;typeof e=="string"&&(t={url:e});let{apiKey:a}=t,{url:l}=t,o=new LA,m="";a&&!l?.includes("key=")&&(m=`?key=${a}`),this._url=(l||"wss://api.geops.io/tracker-ws/v1/")+m,this._buffer=t.buffer||[100,100],this._bbox=t.bbox,this.version=t.version||"2",this.pingIntervalMs=t.pingIntervalMs||1e4,this.reconnectTimeoutMs=t.reconnectTimeoutMs||100,this.wsApi=o}close(){this.wsApi.close()}get(e){let t=e;return typeof e=="string"&&(t={channel:e}),new Promise((a,l)=>{this.wsApi.get(t,a,l)})}getFullTrajectory(e,t,a){let l="";this.version==="1"&&(l=Oo(t,Jr));let o=[`full_trajectory${l}`];return e&&o.push(e),(!t||t===Jr.TOPOGRAPHIC)&&a&&o.push(`gen${a}`),this.get(o.join("_"))}getStation(e,t){let a={args:e,channel:`station${Oo(t,Jr)}`};return this.get(a)}getStations(e,t=100){return new Promise(a=>{this.get(`station${Oo(e,Jr)}`).then(id(a,void 0,t))})}getStopSequence(e){return this.get(`stopsequence_${e}`)}getTrajectory(e,t){return this.get(`partial_trajectory${Oo(t,Jr)}_${e}`)}onClose(){window.clearTimeout(this.pingInterval),window.clearTimeout(this.reconnectTimeout),this.reconnectTimeoutMs&&(this.reconnectTimeout=window.setTimeout(()=>this.open(),this.reconnectTimeoutMs))}onOpen(){this.bbox&&this.wsApi.send(`BBOX ${this.bbox.join(" ")}`),this.buffer&&this.wsApi.send(`BUFFER ${this.buffer.join(" ")}`),this.pingIntervalMs&&(window.clearInterval(this.pingInterval),this.pingInterval=window.setInterval(()=>{this.wsApi.send("PING")},this.pingIntervalMs))}open(){this.wsApi.connect(this.url,this.onOpen.bind(this)),this.wsApi.websocket&&(this.wsApi.websocket.onclose=()=>{this.onClose()})}reset(){this.wsApi.send("RESET")}subscribe(e,t,a=()=>{},l=!1){!e||!t||this.wsApi.subscribe({channel:e},t,a,l)}subscribeDeletedVehicles(e,t,a=()=>{},l=!1){this.unsubscribeDeletedVehicles(t);let o="";this.version==="1"&&(o=Oo(e,Jr)),this.subscribe(`deleted_vehicles${o}`,t,a,l)}subscribeDepartures(e,t,a=()=>{},l=!1){this.subscribeTimetable(e,t,a,l)}subscribeDisruptions(e,t,a=()=>{},l=!1){this.subscribeNewsticker(e,t,a,l)}subscribeExtraGeoms(e,t=()=>{},a=!1){this.subscribe("extra_geoms",e,t,a)}subscribeFullTrajectory(e,t,a,l=()=>{},o=!1){let m="";this.version==="1"&&(m=Oo(t,Jr)),this.subscribe(`full_trajectory${m}_${e}`,a,l,o)}subscribeHealthCheck(e,t=()=>{},a=!1){this.subscribe("healthcheck",e,t,a)}subscribeNewsticker(e,t,a=()=>{},l=!1){this.subscribe(`${e}_newsticker`,t,a,l)}subscribeStations(e,t,a=()=>{},l=!1){this.subscribe(`station${Oo(e,Jr)}`,t,a,l)}subscribeStopSequence(e,t,a=()=>{},l=!1){this.subscribe(`stopsequence_${e}`,t,a,l)}subscribeTimetable(e,t,a=()=>{},l=!1){this.subscribe(`timetable_${e}`,t,a,l)}subscribeTrajectory(e,t,a=()=>{},l=!1){this.unsubscribeTrajectory(t);let o="";this.version==="1"&&(o=Oo(e,Jr)),this.subscribe(`trajectory${o}`,t,a,l)}unsubscribe(e,t="",a){let l=Oo(Jr.SCHEMATIC,Jr),o=Oo(Jr.TOPOGRAPHIC,Jr);this.wsApi.unsubscribe(`${e}${l}${t||""}`,a),this.wsApi.unsubscribe(`${e}${o}${t||""}`,a)}unsubscribeDeletedVehicles(e){this.unsubscribe("deleted_vehicles","",e)}unsubscribeDepartures(e,t){this.unsubscribeTimetabe(e,t)}unsubscribeDisruptions(e,t){this.unsubscribeNewsticker(e,t)}unsubscribeExtraGeoms(e){this.unsubscribe("extra_geoms","",e)}unsubscribeFullTrajectory(e,t){this.unsubscribe("full_trajectory",`_${e}`,t)}unsubscribeHealthCheck(e){this.unsubscribe("healthcheck","",e)}unsubscribeNewsticker(e,t){this.unsubscribe(`${e}_newsticker`,"",t)}unsubscribeStations(e){this.unsubscribe("station","",e)}unsubscribeStopSequence(e,t){this.unsubscribe("stopsequence",`_${e}`,t)}unsubscribeTimetabe(e,t){this.unsubscribe(`timetable_${e}`,"",t)}unsubscribeTrajectory(e){this.unsubscribe("trajectory","",e)}get bbox(){return this._bbox}set bbox(e){JSON.stringify(e)!==JSON.stringify(this._bbox)&&(this._bbox=e,this.wsApi&&this._bbox&&this.wsApi.send(`BBOX ${this._bbox.join(" ")}`))}get buffer(){return this._buffer}set buffer(e){JSON.stringify(e)!==JSON.stringify(this._buffer)&&(this._buffer=e,this.wsApi&&this._buffer&&this.wsApi.send(`BUFFER ${this._buffer.join(" ")}`))}get url(){return this._url}set url(e){this._url!==e&&(this._url=e,(this.wsApi.open||this.wsApi.connecting)&&this.open())}},nd=sx;var TO=(s,e)=>{let t=new URL(s);return Object.entries(e||{}).forEach(([l,o])=>{o!=null&&t.searchParams.set(l,o)}),t},Ol=TO;var ax=class{constructor(e){this.url=e.url,this.apiKey=e.apiKey}async fetch(e,t,a){if(!this.url)throw new Error(`No url defined for request to ${this.url}/${e}`);if(!this.url&&!this.apiKey&&!/key=/.test(this.url))throw new Error(`No apiKey defined for request to ${this.url}`);let l=t||{},o=Ol(`${this.url}${e||""}`,{key:this.apiKey,...l}),g=await(await fetch(o.toString(),a)).json();if(g.error)throw new Error(g.error);return g}},Cm=ax;var lx=class extends Cm{constructor(e={}){super({url:"https://api.geops.io/routing/v1/",...e})}route(e,t){return this.fetch("",e,t)}},od=lx;var cx=class extends Cm{constructor(e={}){super({url:"https://api.geops.io/stops/v1/",...e})}search(e,t){return this.fetch("",e,t)}},sd=cx;var CO=(s,e)=>{let t=null;return typeof window>"u"?null:(typeof document<"u"&&document?.createElement?(t=document.createElement("canvas"),t.width=s,t.height=e):OffscreenCanvas?t=new OffscreenCanvas(s,e):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),t)},zo=CO;var ux={},mx=(s,e,t)=>{let a=`${s}, ${e}, ${t}`;if(!ux[a]){let l=zo(s*2,s*2);if(l){let o=l.getContext("2d");if(!o)return null;o.beginPath(),o.arc(s,s,e,0,2*Math.PI,!1),o.fillStyle=t,o.filter="blur(1px)",o.fill(),ux[a]=l}}return ux[a]},hx={},gx=(s,e,t,a,l="#000",o=1)=>{let m=`${s}, ${t}, ${a}, ${l}, ${o}`;if(!hx[m]){let g=zo(Math.ceil(s.length*e),Math.ceil(e+8*o));if(g){let b=g.getContext("2d");if(!b)return null;b.font=t,b.textAlign="left",b.textBaseline="middle",b.font=t,b.fillStyle=a,b.strokeStyle=l,b.lineWidth=1.5*o,b.strokeText(s,0,e),b.fillText(s,0,e),hx[m]=g}}return hx[m]},px={},yx=(s,e,t,a,l,o)=>{let m=`${s}, ${e}, ${t}, ${a}, ${l}, ${o}`;if(!px[m]){let g=zo(s*2,s*2);if(g){let b=g.getContext("2d");if(!b)return null;b.fillStyle=t,a&&(b.lineWidth=1*o,b.strokeStyle="#000000"),b.beginPath(),b.arc(s,s,e,0,2*Math.PI,!1),b.fill(),l&&b.setLineDash([5,3]),a&&b.stroke(),px[m]=g}}return px[m]},dx={},_x=(s,e,t,a,l,o,m,g)=>{let b=`${s}, ${e}, ${t}, ${a},${l}, ${o}, ${m}`;if(!dx[b]){let A=zo(e*2,e*2);if(A){let S=A.getContext("2d");if(!S)return null;o&&(S.save(),S.textBaseline="middle",S.textAlign="center",S.font=g(t+2,s),S.strokeStyle=l,S.strokeText(s,e,e),S.restore()),S.textBaseline="middle",S.textAlign="center",S.fillStyle=a,S.font=g(t,s),S.strokeStyle=l,S.strokeText(s,e,e),S.fillText(s,e,e),dx[b]=A}}return dx[b]},fx={},MO=(s,e,t)=>{let{delayDisplay:a=3e5,delayOutlineColor:l="#000",getBgColor:o=()=>"#000",getDelayColor:m=()=>"#000",getDelayFont:g=jt=>`bold ${jt}px arial, sans-serif`,getDelayText:b=()=>null,getMaxRadiusForStrokeAndDelay:A=()=>7,getMaxRadiusForText:S=()=>10,getRadius:M=()=>0,getText:k=jt=>jt,getTextColor:j=()=>"#000",getTextFont:Z=jt=>`bold ${jt}px arial, sans-serif`,getTextSize:te=()=>14,hoverVehicleId:q,selectedVehicleId:H,useDelayStyle:ae}=t,{pixelRatio:pe=1,zoom:ve}=e,{type:de}=s.properties,{delay:_e,line:Pe,operator_provides_realtime_journey:Re,state:Ae,train_id:ut}=s.properties,{color:Ve,name:Ue,text_color:pt}=Pe||{};Ue=k(Ue);let Tt=Ae==="JOURNEY_CANCELLED";de||(de="Rail"),Ue||(Ue="I"),pt||(pt="#000000"),Ve&&!Ve.startsWith("#")&&(Ve=`#${Ve}`),pt.startsWith("#")||(pt=`#${pt}`);let Qe=Math.min(Math.floor(ve||1),16),nt=!!(q&&q===ut),yt=!!(H&&H===ut),dt=M(de,Qe)*pe,Rt=dt>=A()*pe;(nt||yt)&&(dt=Rt?dt+5*pe:14*pe);let bt=dt>S()*pe,Bt=`${dt}${nt||yt}`;if(ae?(Bt+=`${Re}${_e}`,Rt&&(Bt+=`${Tt}`)):(Bt+=`${Ve||de}`,Rt&&(Bt+=`${Tt}${_e}`)),bt&&(Bt+=`${Ue}${pt}`),!fx[Bt]){if(dt===0)return null;let jt=1*pe,Pr=dt+2*pe,$e=dt*2,Fr=Pr*2+jt*2,Lr=Fr/2,Mi=null;Rt&&_e!==null&&(Mi=mx(Lr,Pr,m(_e,Tt)));let Ri=null,En=0;if(Rt&&(nt||(_e||0)>=a||Tt)){En=Math.max(Tt?19:14,Math.min(Tt?19:17,dt*1.2))*pe;let Et=b(_e,Tt);Et&&(Ri=gx(Et,En,g(En,Et),m(_e,Tt,!0),l,pe))}let ii;ae?ii=m(_e,Tt):ii=Ve||o(de);let Wn=yx(Lr,dt,ii,Rt||nt||yt,!!Rt&&!!ae&&_e===null&&Re==="yes",pe),Ee=Fr+(Ri?.width||0)*2,ki=zo(Ee,Fr);if(ki){let Et=ki.getContext("2d");if(!Et)return null;let ir=Ri?.width||0;Mi&&Et.drawImage(Mi,ir,0),Wn&&Et.drawImage(Wn,ir,0);let Xn=null;if(bt){let Tn=Math.max(dt,10),Yi=te(Et,$e,Ue,Tn,Z),Cn=ae?"#000000":pt||j(de);Xn=_x(Ue,Lr,Yi,Cn,ii,!!ae&&_e===null&&Re==="yes",pe,Z)}Xn&&Et.drawImage(Xn,ir,0),Ri&&Et.drawImage(Ri,ir+Math.ceil(Lr+Pr)+jt,Math.ceil(Lr-En)),fx[Bt]=ki}}return fx[Bt]},zl=MO;var RO=(s,e,t)=>zl(s,e,{...t,useDelayStyle:!0}),xx=RO;var Mm,kO=()=>{if(!Mm){Mm=zo(15,15);let s=Mm?.getContext("2d");s&&(s.arc(8,8,5,0,2*Math.PI,!1),s.fillStyle="#8ED6FF",s.fill(),s.lineWidth=3,s.strokeStyle="black",s.stroke(),s.lineWidth=3)}return Mm},vx=kO;var FO=s=>{let e=s.filter(o=>o!=null&&o.trim&&o.trim()),t=e.map(o=>o.toLowerCase());return[...new Set(t)].map(o=>e.find(m=>m.toLowerCase()===o))},Bl=FO;var LO=s=>{if(!s)return[];let{style:e}=s;if(!e)return[];let{sourceCaches:t}=e,a=[];return Object.values(t).forEach(l=>{if(l.used){let o=l.getSource(),m=o.attribution||o.options?.attribution;m&&(a=a.concat(m.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),Bl(a)},ad=LO;var DO=(s,e,t,a)=>{let l=[];if(!s&&!e&&!t&&!a)return null;if(a){let o=typeof a=="string"?[a]:a,m=g=>{let b=g.properties.name||g.properties.line&&g.properties.line.name||"";return b?o.some(A=>new RegExp(A,"i").test(b)):!1};l.push(m)}if(s){let m=(typeof s=="string"?s.split(","):s).map(b=>b.replace(/\s+/g,"").toUpperCase()),g=b=>{let{line:A,name:S}=b.properties,M=(S||A&&A.name||"").toUpperCase();return M?m.includes(M):!1};l.push(g)}if(e){let m=(typeof e=="string"?e.split(","):e).map(b=>parseInt(b,10)),g=b=>{let A=b.properties.route_identifier||b.properties.routeIdentifier||"",S=parseInt(A.split(".")[0],10);return m.includes(S)};l.push(g)}if(t){let o=typeof t=="string"?[t]:t,m=g=>o.some(b=>{let A=g.properties.operator||g.properties.tenant||"";return new RegExp(b,"i").test(A)});l.push(m)}return l.length?o=>{for(let m=0;m<l.length;m+=1)if(!l[m](o))return!1;return!0}:null},bx=DO;var DA=s=>{let e=s;Array.isArray(e)||(e=[s]);let t=[];return e.forEach(a=>{t.push(a);let l=a.children||a.get("children")||a.getLayers?.()?.getArray();t=t.concat(DA(l||[]))}),t},Nl=DA;var OA=(s=new Date)=>{let e=(s.getUTCMonth()+1).toString();e=e.length===1?`0${e}`:e;let t=s.getUTCDate().toString();return t=t.length===1?`0${t}`:t,[s.getUTCFullYear(),e,t].join("")},zA=s=>[s.getUTCHours(),s.getUTCMinutes(),`${s.getUTCSeconds()}.${s.getUTCMilliseconds()}`].join(":"),Rm=s=>s<10?`0${s}`:`${s}`,BA=s=>{if(!s||s<=0)return"";let e=new Date(s);return`${Rm(e.getHours())}:${Rm(e.getMinutes())}`};var OO=(s,e)=>{let t=s.properties,a=e.properties;return t.delay===null&&a.delay!==null?1:a.delay===null&&t.delay!==null?-1:t.cancelled&&!a.cancelled?a.delay<18e4?-1:1:a.cancelled&&!t.cancelled?t.delay<18e4?1:-1:a.delay-t.delay},wx=OO;function Ar(s,e){if(!s)throw new Error(e)}var b8=new Array(6);function wi(){return[1,0,0,1,0,0]}function jA(s,e){return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s}function Ni(s,e){let t=e[0],a=e[1];return e[0]=s[0]*t+s[2]*a+s[4],e[1]=s[1]*t+s[3]*a+s[5],e}function ln(s,e,t,a,l,o,m,g){let b=Math.sin(o),A=Math.cos(o);return s[0]=a*A,s[1]=l*b,s[2]=-a*b,s[3]=l*A,s[4]=m*a*A-g*a*b+e,s[5]=m*l*b+g*l*A+t,s}function UA(s,e,t,a,l,o,m){return Sx(ln(wi(),s,e,t,a,l,o,m))}function GA(s,e){let t=zO(e);Ar(t!==0,"Transformation matrix cannot be inverted");let a=e[0],l=e[1],o=e[2],m=e[3],g=e[4],b=e[5];return s[0]=m/t,s[1]=-l/t,s[2]=-o/t,s[3]=a/t,s[4]=(o*b-m*g)/t,s[5]=-(a*b-l*g)/t,s}function zO(s){return s[0]*s[3]-s[1]*s[2]}var NA=[1e6,1e6,1e6,1e6,2,2];function Sx(s){return"matrix("+s.map((t,a)=>Math.round(t*NA[a])/NA[a]).join(", ")+")"}var Ax=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var zr=Ax;var km={PROPERTYCHANGE:"propertychange"};var Ex=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},VA=Ex;function qA(s,e,t){let a,l;t=t||Bo;let o=0,m=s.length,g=!1;for(;o<m;)a=o+(m-o>>1),l=+t(s[a],e),l<0?o=a+1:(m=a,g=!l);return g?o:~o}function Bo(s,e){return s>e?1:s<e?-1:0}function Fm(s,e,t){if(s[0]<=e)return 0;let a=s.length;if(e<=s[a-1])return a-1;if(typeof t=="function"){for(let l=1;l<a;++l){let o=s[l];if(o===e)return l;if(o<e)return t(e,s[l-1],o)>0?l-1:l}return a-1}if(t>0){for(let l=1;l<a;++l)if(s[l]<e)return l-1;return a-1}if(t<0){for(let l=1;l<a;++l)if(s[l]<=e)return l;return a-1}for(let l=1;l<a;++l){if(s[l]==e)return l;if(s[l]<e)return s[l-1]-e<e-s[l]?l-1:l}return a-1}function $A(s,e,t){for(;e<t;){let a=s[e];s[e]=s[t],s[t]=a,++e,--t}}function ji(s,e){let t=Array.isArray(e)?e:[e],a=t.length;for(let l=0;l<a;l++)s[s.length]=t[l]}function Fn(s,e){let t=s.length;if(t!==e.length)return!1;for(let a=0;a<t;a++)if(s[a]!==e[a])return!1;return!0}function Lm(){return!0}function No(){}function Dm(s){let e=!1,t,a,l;return function(){let o=Array.prototype.slice.call(arguments);return(!e||this!==l||!Fn(o,a))&&(e=!0,l=this,a=o,t=s.apply(this,arguments)),t}}function yu(s){for(let e in s)delete s[e]}function lo(s){let e;for(e in s)return!1;return!e}var Ix=class extends VA{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let a=this.listeners_||(this.listeners_={}),l=a[e]||(a[e]=[]);l.includes(t)||l.push(t)}dispatchEvent(e){let t=typeof e=="string",a=t?e:e.type,l=this.listeners_&&this.listeners_[a];if(!l)return;let o=t?new zr(e):e;o.target||(o.target=this.eventTarget_||this);let m=this.dispatching_||(this.dispatching_={}),g=this.pendingRemovals_||(this.pendingRemovals_={});a in m||(m[a]=0,g[a]=0),++m[a];let b;for(let A=0,S=l.length;A<S;++A)if("handleEvent"in l[A]?b=l[A].handleEvent(o):b=l[A].call(this,o),b===!1||o.propagationStopped){b=!1;break}if(--m[a]===0){let A=g[a];for(delete g[a];A--;)this.removeEventListener(a,No);delete m[a]}return b}disposeInternal(){this.listeners_&&yu(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let a=this.listeners_[e];if(!a)return;let l=a.indexOf(t);l!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(a[l]=No,++this.pendingRemovals_[e]):(a.splice(l,1),a.length===0&&delete this.listeners_[e]))}},Om=Ix;var Ir={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function Ui(s,e,t,a,l){if(a&&a!==s&&(t=t.bind(a)),l){let m=t;t=function(){s.removeEventListener(e,t),m.apply(this,arguments)}}let o={target:s,type:e,listener:t};return s.addEventListener(e,t),o}function Px(s,e,t,a){return Ui(s,e,t,a,!0)}function cn(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),yu(s))}var _u=class extends Om{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Ir.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let a=e.length,l=new Array(a);for(let o=0;o<a;++o)l[o]=Ui(this,e[o],t);return l}return Ui(this,e,t)}onceInternal(e,t){let a;if(Array.isArray(e)){let l=e.length;a=new Array(l);for(let o=0;o<l;++o)a[o]=Px(this,e[o],t)}else a=Px(this,e,t);return t.ol_key=a,a}unInternal(e,t){let a=t.ol_key;if(a)jl(a);else if(Array.isArray(e))for(let l=0,o=e.length;l<o;++l)this.removeEventListener(e[l],t);else this.removeEventListener(e,t)}};_u.prototype.on;_u.prototype.once;_u.prototype.un;function jl(s){if(Array.isArray(s))for(let e=0,t=s.length;e<t;++e)cn(s[e]);else cn(s)}var zm=_u;function Pt(){throw new Error("Unimplemented abstract method.")}var BO=0;function Ut(s){return s.ol_uid||(s.ol_uid=String(++BO))}var Bm=class extends zr{constructor(e,t,a){super(e),this.key=t,this.oldValue=a}},Tx=class extends zm{constructor(e){super(),this.on,this.once,this.un,Ut(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let a;a=`change:${e}`,this.hasListener(a)&&this.dispatchEvent(new Bm(a,e,t)),a=km.PROPERTYCHANGE,this.hasListener(a)&&this.dispatchEvent(new Bm(a,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,a){let l=this.values_||(this.values_={});if(a)l[e]=t;else{let o=l[e];l[e]=t,o!==t&&this.notify(e,o)}}setProperties(e,t){for(let a in e)this.set(a,e[a],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){let a=this.values_[e];delete this.values_[e],lo(this.values_)&&(this.values_=null),t||this.notify(e,a)}}},Si=Tx;var Qr={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ps(s){let e=On();for(let t=0,a=s.length;t<a;++t)Cx(e,s[t]);return e}function NO(s,e,t){let a=Math.min.apply(null,s),l=Math.min.apply(null,e),o=Math.max.apply(null,s),m=Math.max.apply(null,e);return ea(a,l,o,m,t)}function Ln(s,e,t){return t?(t[0]=s[0]-e,t[1]=s[1]-e,t[2]=s[2]+e,t[3]=s[3]+e,t):[s[0]-e,s[1]-e,s[2]+e,s[3]+e]}function WA(s,e){return e?(e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e):s.slice()}function Dn(s,e,t){let a,l;return e<s[0]?a=s[0]-e:s[2]<e?a=e-s[2]:a=0,t<s[1]?l=s[1]-t:s[3]<t?l=t-s[3]:l=0,a*a+l*l}function Js(s,e){return ld(s,e[0],e[1])}function Qs(s,e){return s[0]<=e[0]&&e[2]<=s[2]&&s[1]<=e[1]&&e[3]<=s[3]}function ld(s,e,t){return s[0]<=e&&e<=s[2]&&s[1]<=t&&t<=s[3]}function Nm(s,e){let t=s[0],a=s[1],l=s[2],o=s[3],m=e[0],g=e[1],b=Qr.UNKNOWN;return m<t?b=b|Qr.LEFT:m>l&&(b=b|Qr.RIGHT),g<a?b=b|Qr.BELOW:g>o&&(b=b|Qr.ABOVE),b===Qr.UNKNOWN&&(b=Qr.INTERSECTING),b}function On(){return[1/0,1/0,-1/0,-1/0]}function ea(s,e,t,a,l){return l?(l[0]=s,l[1]=e,l[2]=t,l[3]=a,l):[s,e,t,a]}function xu(s){return ea(1/0,1/0,-1/0,-1/0,s)}function Ba(s,e){let t=s[0],a=s[1];return ea(t,a,t,a,e)}function vu(s,e,t,a,l){let o=xu(l);return Mx(o,s,e,t,a)}function jm(s,e){return s[0]==e[0]&&s[2]==e[2]&&s[1]==e[1]&&s[3]==e[3]}function ZA(s,e){return e[0]<s[0]&&(s[0]=e[0]),e[2]>s[2]&&(s[2]=e[2]),e[1]<s[1]&&(s[1]=e[1]),e[3]>s[3]&&(s[3]=e[3]),s}function Cx(s,e){e[0]<s[0]&&(s[0]=e[0]),e[0]>s[2]&&(s[2]=e[0]),e[1]<s[1]&&(s[1]=e[1]),e[1]>s[3]&&(s[3]=e[1])}function Mx(s,e,t,a,l){for(;t<a;t+=l)jO(s,e[t],e[t+1]);return s}function jO(s,e,t){s[0]=Math.min(s[0],e),s[1]=Math.min(s[1],t),s[2]=Math.max(s[2],e),s[3]=Math.max(s[3],t)}function XA(s,e){let t;return t=e(Rx(s)),t||(t=e(kx(s)),t)||(t=e(Lx(s)),t)||(t=e(Fx(s)),t)?t:!1}function Rx(s){return[s[0],s[1]]}function kx(s){return[s[2],s[1]]}function bo(s){return[(s[0]+s[2])/2,(s[1]+s[3])/2]}function HA(s,e,t,a,l){let[o,m,g,b,A,S,M,k]=UO(s,e,t,a);return ea(Math.min(o,g,A,M),Math.min(m,b,S,k),Math.max(o,g,A,M),Math.max(m,b,S,k),l)}function UO(s,e,t,a){let l=e*a[0]/2,o=e*a[1]/2,m=Math.cos(t),g=Math.sin(t),b=l*m,A=l*g,S=o*m,M=o*g,k=s[0],j=s[1];return[k-b+M,j-A-S,k-b-M,j-A+S,k+b-M,j+A+S,k+b+M,j+A-S,k-b+M,j-A-S]}function si(s){return s[3]-s[1]}function Fx(s){return[s[0],s[3]]}function Lx(s){return[s[2],s[3]]}function kr(s){return s[2]-s[0]}function ei(s,e){return s[0]<=e[2]&&s[2]>=e[0]&&s[1]<=e[3]&&s[3]>=e[1]}function cd(s){return s[2]<s[0]||s[3]<s[1]}function KA(s,e){return e?(e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e):s}function YA(s,e,t){let a=!1,l=Nm(s,e),o=Nm(s,t);if(l===Qr.INTERSECTING||o===Qr.INTERSECTING)a=!0;else{let m=s[0],g=s[1],b=s[2],A=s[3],S=e[0],M=e[1],k=t[0],j=t[1],Z=(j-M)/(k-S),te,q;o&Qr.ABOVE&&!(l&Qr.ABOVE)&&(te=k-(j-A)/Z,a=te>=m&&te<=b),!a&&o&Qr.RIGHT&&!(l&Qr.RIGHT)&&(q=j-(k-b)*Z,a=q>=g&&q<=A),!a&&o&Qr.BELOW&&!(l&Qr.BELOW)&&(te=k-(j-g)/Z,a=te>=m&&te<=b),!a&&o&Qr.LEFT&&!(l&Qr.LEFT)&&(q=j-(k-m)*Z,a=q>=g&&q<=A)}return a}function JA(s,e,t,a){if(cd(s))return xu(t);let l=[];if(a>1){let g=s[2]-s[0],b=s[3]-s[1];for(let A=0;A<a;++A)l.push(s[0]+g*A/a,s[1],s[2],s[1]+b*A/a,s[2]-g*A/a,s[3],s[0],s[3]-b*A/a)}else l=[s[0],s[1],s[2],s[1],s[2],s[3],s[0],s[3]];e(l,l,2);let o=[],m=[];for(let g=0,b=l.length;g<b;g+=2)o.push(l[g]),m.push(l[g+1]);return NO(o,m,t)}function Dx(s,e){let t=e.getExtent(),a=bo(s);if(e.canWrapX()&&(a[0]<t[0]||a[0]>=t[2])){let l=kr(t),m=Math.floor((a[0]-t[0])/l)*l;s[0]-=m,s[2]-=m}return s}function QA(s,e,t){if(e.canWrapX()){let a=e.getExtent();if(!isFinite(s[0])||!isFinite(s[2]))return[[a[0],s[1],a[2],s[3]]];Dx(s,e);let l=kr(a);if(kr(s)>l&&!t)return[[a[0],s[1],a[2],s[3]]];if(s[0]<a[0])return[[s[0]+l,s[1],a[2],s[3]],[a[0],s[1],s[2],s[3]]];if(s[2]>a[2])return[[s[0],s[1],a[2],s[3]],[a[0],s[1],s[2]-l,s[3]]]}return[s]}var ud={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Ox=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ud[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Um=Ox;var hd=6378137,bu=Math.PI*hd,GO=[-bu,-bu,bu,bu],VO=[-180,-85,180,85],Gm=hd*Math.log(Math.tan(Math.PI/2)),Na=class extends Um{constructor(e){super({code:e,units:"m",extent:GO,global:!0,worldExtent:VO,getPointResolution:function(t,a){return t/Math.cosh(a[1]/hd)}})}},zx=[new Na("EPSG:3857"),new Na("EPSG:102100"),new Na("EPSG:102113"),new Na("EPSG:900913"),new Na("http://www.opengis.net/def/crs/EPSG/0/3857"),new Na("http://www.opengis.net/gml/srs/epsg.xml#3857")];function eE(s,e,t){let a=s.length;t=t>1?t:2,e===void 0&&(t>2?e=s.slice():e=new Array(a));for(let l=0;l<a;l+=t){e[l]=bu*s[l]/180;let o=hd*Math.log(Math.tan(Math.PI*(+s[l+1]+90)/360));o>Gm?o=Gm:o<-Gm&&(o=-Gm),e[l+1]=o}return e}function tE(s,e,t){let a=s.length;t=t>1?t:2,e===void 0&&(t>2?e=s.slice():e=new Array(a));for(let l=0;l<a;l+=t)e[l]=180*s[l]/bu,e[l+1]=360*Math.atan(Math.exp(s[l+1]/hd))/Math.PI-90;return e}var qO=6378137,rE=[-180,-90,180,90],$O=Math.PI*qO/180,ta=class extends Um{constructor(e,t){super({code:e,units:"degrees",extent:rE,axisOrientation:t,global:!0,metersPerUnit:$O,worldExtent:rE})}},Bx=[new ta("CRS:84"),new ta("EPSG:4326","neu"),new ta("urn:ogc:def:crs:OGC:1.3:CRS84"),new ta("urn:ogc:def:crs:OGC:2:84"),new ta("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ta("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ta("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var Nx={};function iE(s){return Nx[s]||Nx[s.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function nE(s,e){Nx[s]=e}var wu={};function pd(s,e,t){let a=s.getCode(),l=e.getCode();a in wu||(wu[a]={}),wu[a][l]=t}function oE(s,e){let t;return s in wu&&e in wu[s]&&(t=wu[s][e]),t}function Br(s,e,t){return Math.min(Math.max(s,e),t)}function sE(s,e,t,a,l,o){let m=l-t,g=o-a;if(m!==0||g!==0){let b=((s-t)*m+(e-a)*g)/(m*m+g*g);b>1?(t=l,a=o):b>0&&(t+=m*b,a+=g*b)}return jo(s,e,t,a)}function jo(s,e,t,a){let l=t-s,o=a-e;return l*l+o*o}function aE(s){return s*180/Math.PI}function lE(s){return s*Math.PI/180}function Ul(s,e){let t=s%e;return t*e<0?t+e:t}function Gi(s,e,t){return s+t*(e-s)}function cE(s,e){let t=Math.pow(10,e);return Math.round(s*t)/t}function uE(s,e){return s[0]+=+e[0],s[1]+=+e[1],s}function jx(s,e){let t=s[0],a=s[1],l=e[0],o=e[1],m=l[0],g=l[1],b=o[0],A=o[1],S=b-m,M=A-g,k=S===0&&M===0?0:(S*(t-m)+M*(a-g))/(S*S+M*M||0),j,Z;return k<=0?(j=m,Z=g):k>=1?(j=b,Z=A):(j=m+k*S,Z=g+k*M),[j,Z]}function An(s,e){let t=!0;for(let a=s.length-1;a>=0;--a)if(s[a]!=e[a]){t=!1;break}return t}function hE(s,e){let t=Math.cos(e),a=Math.sin(e),l=s[0]*t-s[1]*a,o=s[1]*t+s[0]*a;return s[0]=l,s[1]=o,s}function Su(s,e){let t=s[0]-e[0],a=s[1]-e[1];return t*t+a*a}function Ux(s,e){return Math.sqrt(Su(s,e))}function pE(s,e){return Su(s,jx(s,e))}function dE(s,e){if(e.canWrapX()){let t=kr(e.getExtent()),a=fE(s,e,t);a&&(s[0]-=a*t)}return s}function fE(s,e,t){let a=e.getExtent(),l=0;return e.canWrapX()&&(s[0]<a[0]||s[0]>a[2])&&(t=t||kr(a),l=Math.floor((s[0]-a[0])/t)),l}var mE={info:1,warn:2,error:3,none:4},WO=mE.info;function gE(...s){WO>mE.warn||console.warn(...s)}var Gx=!0;function Vx(s){Gx=!(s===void 0?!0:s)}function qx(s,e){if(e!==void 0){for(let t=0,a=s.length;t<a;++t)e[t]=s[t];e=e}else e=s.slice();return e}function ZO(s,e){if(e!==void 0&&s!==e){for(let t=0,a=s.length;t<a;++t)e[t]=s[t];s=e}return s}function XO(s){nE(s.getCode(),s),pd(s,s,qx)}function HO(s){s.forEach(XO)}function Zr(s){return typeof s=="string"?iE(s):s||null}function yE(s){HO(s),s.forEach(function(e){s.forEach(function(t){e!==t&&pd(e,t,qx)})})}function KO(s,e,t,a){s.forEach(function(l){e.forEach(function(o){pd(l,o,t),pd(o,l,a)})})}function Vm(s,e){return s?typeof s=="string"?Zr(s):s:Zr(e)}function Ai(s,e){return Vx(),qm(s,"EPSG:4326",e!==void 0?e:"EPSG:3857")}function Gl(s,e){let t=qm(s,e!==void 0?e:"EPSG:3857","EPSG:4326"),a=t[0];return(a<-180||a>180)&&(t[0]=Ul(a+180,360)-180),t}function _E(s,e){if(s===e)return!0;let t=s.getUnits()===e.getUnits();return(s.getCode()===e.getCode()||Au(s,e)===qx)&&t}function Au(s,e){let t=s.getCode(),a=e.getCode(),l=oE(t,a);return l||(l=ZO),l}function Vl(s,e){let t=Zr(s),a=Zr(e);return Au(t,a)}function qm(s,e,t){return Vl(e,t)(s,void 0,s.length)}function dd(s,e,t,a){let l=Vl(e,t);return JA(s,l,void 0,a)}var Uo=null;function co(){return Uo}function ql(s,e){return Uo?qm(s,e,Uo):s}function ti(s,e){return Uo?qm(s,Uo,e):(Gx&&!An(s,[0,0])&&s[0]>=-180&&s[0]<=180&&s[1]>=-90&&s[1]<=90&&(Gx=!1,gE("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),s)}function ds(s,e){return Uo?dd(s,e,Uo):s}function fs(s,e){return Uo?dd(s,Uo,e):s}function xE(s,e){if(!Uo)return s;let t=Zr(e).getMetersPerUnit(),a=Uo.getMetersPerUnit();return t&&a?s*t/a:s}function YO(){yE(zx),yE(Bx),KO(Bx,zx,eE,tE)}YO();function zn(s,e,t,a,l,o){o=o||[];let m=0;for(let g=e;g<t;g+=a){let b=s[g],A=s[g+1];o[m++]=l[0]*b+l[2]*A+l[4],o[m++]=l[1]*b+l[3]*A+l[5]}return o&&o.length!=m&&(o.length=m),o}function $m(s,e,t,a,l,o,m){m=m||[];let g=Math.cos(l),b=Math.sin(l),A=o[0],S=o[1],M=0;for(let k=e;k<t;k+=a){let j=s[k]-A,Z=s[k+1]-S;m[M++]=A+j*g-Z*b,m[M++]=S+j*b+Z*g;for(let te=k+2;te<k+a;++te)m[M++]=s[te]}return m&&m.length!=M&&(m.length=M),m}function vE(s,e,t,a,l,o,m,g){g=g||[];let b=m[0],A=m[1],S=0;for(let M=e;M<t;M+=a){let k=s[M]-b,j=s[M+1]-A;g[S++]=b+l*k,g[S++]=A+o*j;for(let Z=M+2;Z<M+a;++Z)g[S++]=s[Z]}return g&&g.length!=S&&(g.length=S),g}function bE(s,e,t,a,l,o,m){m=m||[];let g=0;for(let b=e;b<t;b+=a){m[g++]=s[b]+l,m[g++]=s[b+1]+o;for(let A=b+2;A<b+a;++A)m[g++]=s[A]}return m&&m.length!=g&&(m.length=g),m}var wE=wi(),$x=class extends Si{constructor(){super(),this.extent_=On(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Dm((e,t,a)=>{if(!a)return this.getSimplifiedGeometry(t);let l=this.clone();return l.applyTransform(a),l.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return Pt()}closestPointXY(e,t,a,l){return Pt()}containsXY(e,t){let a=this.getClosestPoint([e,t]);return a[0]===e&&a[1]===t}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return Pt()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&xu(t),this.extentRevision_=this.getRevision()}return KA(this.extent_,e)}rotate(e,t){Pt()}scale(e,t,a){Pt()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return Pt()}getType(){return Pt()}applyTransform(e){Pt()}intersectsExtent(e){return Pt()}translate(e,t){Pt()}transform(e,t){let a=Zr(e),l=a.getUnits()=="tile-pixels"?function(o,m,g){let b=a.getExtent(),A=a.getWorldExtent(),S=si(A)/si(b);return ln(wE,A[0],A[3],S,-S,0,0,0),zn(o,0,o.length,g,wE,m),Vl(a,t)(o,m,g)}:Vl(a,t);return this.applyTransform(l),this}},Wm=$x;var Wx=class extends Wm{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return vu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return Pt()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=SE(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){Pt()}setLayout(e,t,a){let l;if(e)l=SE(e);else{for(let o=0;o<a;++o){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}l=t.length,e=ja(l)}this.layout=e,this.stride=l}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(e,t){let a=this.getFlatCoordinates();if(a){let l=this.getStride();$m(a,0,a.length,l,e,t,a),this.changed()}}scale(e,t,a){t===void 0&&(t=e),a||(a=bo(this.getExtent()));let l=this.getFlatCoordinates();if(l){let o=this.getStride();vE(l,0,l.length,o,e,t,a,l),this.changed()}}translate(e,t){let a=this.getFlatCoordinates();if(a){let l=this.getStride();bE(a,0,a.length,l,e,t,a),this.changed()}}};function ja(s){let e;return s==2?e="XY":s==3?e="XYZ":s==4&&(e="XYZM"),e}function SE(s){let e;return s=="XY"?e=2:s=="XYZ"||s=="XYM"?e=3:s=="XYZM"&&(e=4),e}function AE(s,e,t){let a=s.getFlatCoordinates();if(!a)return null;let l=s.getStride();return zn(a,0,a.length,l,e,t)}var Vi=Wx;function EE(s,e,t,a){for(let l=0,o=t.length;l<o;++l)s[e++]=t[l];return e}function $l(s,e,t,a){for(let l=0,o=t.length;l<o;++l){let m=t[l];for(let g=0;g<a;++g)s[e++]=m[g]}return e}function Ua(s,e,t,a,l){l=l||[];let o=0;for(let m=0,g=t.length;m<g;++m){let b=$l(s,e,t[m],a);l[o++]=b,e=b}return l.length=o,l}function Zm(s,e,t,a,l){l=l||[];let o=0;for(let m=0,g=t.length;m<g;++m){let b=Ua(s,e,t[m],a,l[o]);b.length===0&&(b[0]=e),l[o++]=b,e=b[b.length-1]}return l.length=o,l}var Xx=class s extends Wm{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(cn),this.changeEventsKeys_.length=0}listenGeometriesChange_(){let e=this.geometries_;for(let t=0,a=e.length;t<a;++t)this.changeEventsKeys_.push(Ui(e[t],Ir.CHANGE,this.changed,this))}clone(){let e=new s(Zx(this.geometries_));return e.applyProperties(this),e}closestPointXY(e,t,a,l){if(l<Dn(this.getExtent(),e,t))return l;let o=this.geometries_;for(let m=0,g=o.length;m<g;++m)l=o[m].closestPointXY(e,t,a,l);return l}containsXY(e,t){let a=this.geometries_;for(let l=0,o=a.length;l<o;++l)if(a[l].containsXY(e,t))return!0;return!1}computeExtent(e){xu(e);let t=this.geometries_;for(let a=0,l=t.length;a<l;++a)ZA(e,t[a].getExtent());return e}getGeometries(){return Zx(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[],t=this.geometries_;for(let a=0,l=t.length;a<l;++a)t[a].getType()===this.getType()?e=e.concat(t[a].getGeometriesArrayRecursive()):e.push(t[a]);return e}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=[],a=this.geometries_,l=!1;for(let o=0,m=a.length;o<m;++o){let g=a[o],b=g.getSimplifiedGeometry(e);t.push(b),b!==g&&(l=!0)}return l?new s(t):(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getType(){return"GeometryCollection"}intersectsExtent(e){let t=this.geometries_;for(let a=0,l=t.length;a<l;++a)if(t[a].intersectsExtent(e))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(e,t){let a=this.geometries_;for(let l=0,o=a.length;l<o;++l)a[l].rotate(e,t);this.changed()}scale(e,t,a){a||(a=bo(this.getExtent()));let l=this.geometries_;for(let o=0,m=l.length;o<m;++o)l[o].scale(e,t,a);this.changed()}setGeometries(e){this.setGeometriesArray(Zx(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){let t=this.geometries_;for(let a=0,l=t.length;a<l;++a)t[a].applyTransform(e);this.changed()}translate(e,t){let a=this.geometries_;for(let l=0,o=a.length;l<o;++l)a[l].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}};function Zx(s){return s.map(e=>e.clone())}var Hx=Xx;function IE(s,e,t,a,l,o,m){let g=s[e],b=s[e+1],A=s[t]-g,S=s[t+1]-b,M;if(A===0&&S===0)M=e;else{let k=((l-g)*A+(o-b)*S)/(A*A+S*S);if(k>1)M=t;else if(k>0){for(let j=0;j<a;++j)m[j]=Gi(s[e+j],s[t+j],k);m.length=a;return}else M=e}for(let k=0;k<a;++k)m[k]=s[M+k];m.length=a}function fd(s,e,t,a,l){let o=s[e],m=s[e+1];for(e+=a;e<t;e+=a){let g=s[e],b=s[e+1],A=jo(o,m,g,b);A>l&&(l=A),o=g,m=b}return l}function md(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o){let g=t[o];l=fd(s,e,g,a,l),e=g}return l}function PE(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o){let g=t[o];l=md(s,e,g,a,l),e=g[g.length-1]}return l}function gd(s,e,t,a,l,o,m,g,b,A,S){if(e==t)return A;let M,k;if(l===0){if(k=jo(m,g,s[e],s[e+1]),k<A){for(M=0;M<a;++M)b[M]=s[e+M];return b.length=a,k}return A}S=S||[NaN,NaN];let j=e+a;for(;j<t;)if(IE(s,j-a,j,a,m,g,S),k=jo(m,g,S[0],S[1]),k<A){for(A=k,M=0;M<a;++M)b[M]=S[M];b.length=a,j+=a}else j+=a*Math.max((Math.sqrt(k)-Math.sqrt(A))/l|0,1);if(o&&(IE(s,t-a,e,a,m,g,S),k=jo(m,g,S[0],S[1]),k<A)){for(A=k,M=0;M<a;++M)b[M]=S[M];b.length=a}return A}function yd(s,e,t,a,l,o,m,g,b,A,S){S=S||[NaN,NaN];for(let M=0,k=t.length;M<k;++M){let j=t[M];A=gd(s,e,j,a,l,o,m,g,b,A,S),e=j}return A}function TE(s,e,t,a,l,o,m,g,b,A,S){S=S||[NaN,NaN];for(let M=0,k=t.length;M<k;++M){let j=t[M];A=yd(s,e,j,a,l,o,m,g,b,A,S),e=j[j.length-1]}return A}function Wl(s,e,t,a,l,o,m){let g=(t-e)/a;if(g<3){for(;e<t;e+=a)o[m++]=s[e],o[m++]=s[e+1];return m}let b=new Array(g);b[0]=1,b[g-1]=1;let A=[e,t-a],S=0;for(;A.length>0;){let M=A.pop(),k=A.pop(),j=0,Z=s[k],te=s[k+1],q=s[M],H=s[M+1];for(let ae=k+a;ae<M;ae+=a){let pe=s[ae],ve=s[ae+1],de=sE(pe,ve,Z,te,q,H);de>j&&(S=ae,j=de)}j>l&&(b[(S-e)/a]=1,k+a<S&&A.push(k,S),S+a<M&&A.push(S,M))}for(let M=0;M<g;++M)b[M]&&(o[m++]=s[e+M*a],o[m++]=s[e+M*a+1]);return m}function Xm(s,e,t,a,l,o,m,g){for(let b=0,A=t.length;b<A;++b){let S=t[b];m=Wl(s,e,S,a,l,o,m),g.push(m),e=S}return m}function Ga(s,e){return e*Math.round(s/e)}function JO(s,e,t,a,l,o,m){if(e==t)return m;let g=Ga(s[e],l),b=Ga(s[e+1],l);e+=a,o[m++]=g,o[m++]=b;let A,S;do if(A=Ga(s[e],l),S=Ga(s[e+1],l),e+=a,e==t)return o[m++]=A,o[m++]=S,m;while(A==g&&S==b);for(;e<t;){let M=Ga(s[e],l),k=Ga(s[e+1],l);if(e+=a,M==A&&k==S)continue;let j=A-g,Z=S-b,te=M-g,q=k-b;if(j*q==Z*te&&(j<0&&te<j||j==te||j>0&&te>j)&&(Z<0&&q<Z||Z==q||Z>0&&q>Z)){A=M,S=k;continue}o[m++]=A,o[m++]=S,g=A,b=S,A=M,S=k}return o[m++]=A,o[m++]=S,m}function _d(s,e,t,a,l,o,m,g){for(let b=0,A=t.length;b<A;++b){let S=t[b];m=JO(s,e,S,a,l,o,m),g.push(m),e=S}return m}function CE(s,e,t,a,l,o,m,g){for(let b=0,A=t.length;b<A;++b){let S=t[b],M=[];m=_d(s,e,S,a,l,o,m,M),g.push(M),e=S[S.length-1]}return m}function wo(s,e,t,a,l){l=l!==void 0?l:[];let o=0;for(let m=e;m<t;m+=a)l[o++]=s.slice(m,m+a);return l.length=o,l}function Va(s,e,t,a,l){l=l!==void 0?l:[];let o=0;for(let m=0,g=t.length;m<g;++m){let b=t[m];l[o++]=wo(s,e,b,a,l[o]),e=b}return l.length=o,l}function xd(s,e,t,a,l){l=l!==void 0?l:[];let o=0;for(let m=0,g=t.length;m<g;++m){let b=t[m];l[o++]=b.length===1&&b[0]===e?[]:Va(s,e,b,a,l[o]),e=b[b.length-1]}return l.length=o,l}function Kx(s,e,t,a){let l=0,o=s[t-a],m=s[t-a+1];for(;e<t;e+=a){let g=s[e],b=s[e+1];l+=m*g-o*b,o=g,m=b}return l/2}function Yx(s,e,t,a){let l=0;for(let o=0,m=t.length;o<m;++o){let g=t[o];l+=Kx(s,e,g,a),e=g}return l}function ME(s,e,t,a){let l=0;for(let o=0,m=t.length;o<m;++o){let g=t[o];l+=Yx(s,e,g,a),e=g[g.length-1]}return l}var Jx=class s extends Vi{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new s(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,a,l){return l<Dn(this.getExtent(),e,t)?l:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(fd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),gd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,a,l))}getArea(){return Kx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return wo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=Wl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new s(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=$l(this.flatCoordinates,0,e,this.stride),this.changed()}},Qx=Jx;function Hm(s,e,t,a,l){let o;for(e+=a;e<t;e+=a)if(o=l(s.slice(e-a,e),s.slice(e,e+a)),o)return o;return!1}function Zl(s,e,t,a,l,o,m){let g,b,A=(t-e)/a;if(A===1)g=e;else if(A===2)g=e,b=l;else if(A!==0){let S=s[e],M=s[e+1],k=0,j=[0];for(let q=e+a;q<t;q+=a){let H=s[q],ae=s[q+1];k+=Math.sqrt((H-S)*(H-S)+(ae-M)*(ae-M)),j.push(k),S=H,M=ae}let Z=l*k,te=qA(j,Z);te<0?(b=(Z-j[-te-2])/(j[-te-1]-j[-te-2]),g=e+(-te-2)*a):g=e+te*a}m=m>1?m:2,o=o||new Array(m);for(let S=0;S<m;++S)o[S]=g===void 0?NaN:b===void 0?s[g+S]:Gi(s[g+S],s[g+a+S],b);return o}function Km(s,e,t,a,l,o){if(t==e)return null;let m;if(l<s[e+a-1])return o?(m=s.slice(e,e+a),m[a-1]=l,m):null;if(s[t-1]<l)return o?(m=s.slice(t-a,t),m[a-1]=l,m):null;if(l==s[e+a-1])return s.slice(e,e+a);let g=e/a,b=t/a;for(;g<b;){let k=g+b>>1;l<s[(k+1)*a-1]?b=k:g=k+1}let A=s[g*a-1];if(l==A)return s.slice((g-1)*a,(g-1)*a+a);let S=s[(g+1)*a-1],M=(l-A)/(S-A);m=[];for(let k=0;k<a-1;++k)m.push(Gi(s[(g-1)*a+k],s[g*a+k],M));return m.push(l),m}function RE(s,e,t,a,l,o,m){if(m)return Km(s,e,t[t.length-1],a,l,o);let g;if(l<s[a-1])return o?(g=s.slice(0,a),g[a-1]=l,g):null;if(s[s.length-1]<l)return o?(g=s.slice(s.length-a),g[a-1]=l,g):null;for(let b=0,A=t.length;b<A;++b){let S=t[b];if(e!=S){if(l<s[e+a-1])return null;if(l<=s[S-1])return Km(s,e,S,a,l,!1);e=S}}return null}function kE(s,e,t,a,l){return!XA(l,function(m){return!qa(s,e,t,a,m[0],m[1])})}function qa(s,e,t,a,l,o){let m=0,g=s[t-a],b=s[t-a+1];for(;e<t;e+=a){let A=s[e],S=s[e+1];b<=o?S>o&&(A-g)*(o-b)-(l-g)*(S-b)>0&&m++:S<=o&&(A-g)*(o-b)-(l-g)*(S-b)<0&&m--,g=A,b=S}return m!==0}function vd(s,e,t,a,l,o){if(t.length===0||!qa(s,e,t[0],a,l,o))return!1;for(let m=1,g=t.length;m<g;++m)if(qa(s,t[m-1],t[m],a,l,o))return!1;return!0}function FE(s,e,t,a,l,o){if(t.length===0)return!1;for(let m=0,g=t.length;m<g;++m){let b=t[m];if(vd(s,e,b,a,l,o))return!0;e=b[b.length-1]}return!1}function bd(s,e,t,a,l){let o=Mx(On(),s,e,t,a);return ei(l,o)?Qs(l,o)||o[0]>=l[0]&&o[2]<=l[2]||o[1]>=l[1]&&o[3]<=l[3]?!0:Hm(s,e,t,a,function(m,g){return YA(l,m,g)}):!1}function LE(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o){if(bd(s,e,t[o],a,l))return!0;e=t[o]}return!1}function QO(s,e,t,a,l){return!!(bd(s,e,t,a,l)||qa(s,e,t,a,l[0],l[1])||qa(s,e,t,a,l[0],l[3])||qa(s,e,t,a,l[2],l[1])||qa(s,e,t,a,l[2],l[3]))}function e0(s,e,t,a,l){if(!QO(s,e,t[0],a,l))return!1;if(t.length===1)return!0;for(let o=1,m=t.length;o<m;++o)if(kE(s,t[o-1],t[o],a,l)&&!bd(s,t[o-1],t[o],a,l))return!1;return!0}function DE(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o){let g=t[o];if(e0(s,e,g,a,l))return!0;e=g[g.length-1]}return!1}function Ym(s,e,t,a){let l=s[e],o=s[e+1],m=0;for(let g=e+a;g<t;g+=a){let b=s[g],A=s[g+1];m+=Math.sqrt((b-l)*(b-l)+(A-o)*(A-o)),l=b,o=A}return m}var t0=class s extends Vi{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){ji(this.flatCoordinates,e),this.changed()}clone(){let e=new s(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,a,l){return l<Dn(this.getExtent(),e,t)?l:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(fd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),gd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,a,l))}forEachSegment(e){return Hm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,Km(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return wo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return Zl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return Ym(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){let t=[];return t.length=Wl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new s(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return bd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=$l(this.flatCoordinates,0,e,this.stride),this.changed()}},Go=t0;var r0=class s extends Vi{constructor(e,t,a){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&a)this.setFlatCoordinates(t,e),this.ends_=a;else{let l=e,o=[],m=[];for(let b=0,A=l.length;b<A;++b){let S=l[b];ji(o,S.getFlatCoordinates()),m.push(o.length)}let g=l.length===0?this.getLayout():l[0].getLayout();this.setFlatCoordinates(g,o),this.ends_=m}}appendLineString(e){ji(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new s(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,a,l){return l<Dn(this.getExtent(),e,t)?l:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(md(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),yd(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,a,l))}getCoordinateAtM(e,t,a){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,a=a!==void 0?a:!1,RE(this.flatCoordinates,0,this.ends_,this.stride,e,t,a))}getCoordinates(){return Va(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new Go(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,a=this.layout,l=[],o=0;for(let m=0,g=t.length;m<g;++m){let b=t[m],A=new Go(e.slice(o,b),a);l.push(A),o=b}return l}getFlatMidpoints(){let e=[],t=this.flatCoordinates,a=0,l=this.ends_,o=this.stride;for(let m=0,g=l.length;m<g;++m){let b=l[m],A=Zl(t,a,b,o,.5);ji(e,A),a=b}return e}getSimplifiedGeometryInternal(e){let t=[],a=[];return t.length=Xm(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,a),new s(t,"XY",a)}getType(){return"MultiLineString"}intersectsExtent(e){return LE(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let a=Ua(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=a.length===0?0:a[a.length-1],this.changed()}},i0=r0;var n0=class s extends Vi{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let e=new s(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,a,l){let o=this.flatCoordinates,m=jo(e,t,o[0],o[1]);if(m<l){let g=this.stride;for(let b=0;b<g;++b)a[b]=o[b];return a.length=g,m}return l}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return Ba(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return ld(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=EE(this.flatCoordinates,0,e,this.stride),this.changed()}},Ei=n0;var o0=class s extends Vi{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){ji(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new s(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,a,l){if(l<Dn(this.getExtent(),e,t))return l;let o=this.flatCoordinates,m=this.stride;for(let g=0,b=o.length;g<b;g+=m){let A=jo(e,t,o[g],o[g+1]);if(A<l){l=A;for(let S=0;S<m;++S)a[S]=o[g+S];a.length=m}}return l}getCoordinates(){return wo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Ei(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,a=this.stride,l=[];for(let o=0,m=e.length;o<m;o+=a){let g=new Ei(e.slice(o,o+a),t);l.push(g)}return l}getType(){return"MultiPoint"}intersectsExtent(e){let t=this.flatCoordinates,a=this.stride;for(let l=0,o=t.length;l<o;l+=a){let m=t[l],g=t[l+1];if(ld(e,m,g))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=$l(this.flatCoordinates,0,e,this.stride),this.changed()}},wd=o0;function Sd(s,e,t,a,l,o,m){let g,b,A,S,M,k,j,Z=l[o+1],te=[];for(let ae=0,pe=t.length;ae<pe;++ae){let ve=t[ae];for(S=s[ve-a],k=s[ve-a+1],g=e;g<ve;g+=a)M=s[g],j=s[g+1],(Z<=k&&j<=Z||k<=Z&&Z<=j)&&(A=(Z-k)/(j-k)*(M-S)+S,te.push(A)),S=M,k=j}let q=NaN,H=-1/0;for(te.sort(Bo),S=te[0],g=1,b=te.length;g<b;++g){M=te[g];let ae=Math.abs(M-S);ae>H&&(A=(S+M)/2,vd(s,e,t,a,A,Z)&&(q=A,H=ae)),S=M}return isNaN(q)&&(q=l[o]),m?(m.push(q,Z,H),m):[q,Z,H]}function Jm(s,e,t,a,l){let o=[];for(let m=0,g=t.length;m<g;++m){let b=t[m];o=Sd(s,e,b,a,l,2*m,o),e=b[b.length-1]}return o}function OE(s,e,t,a){for(;e<t-a;){for(let l=0;l<a;++l){let o=s[e+l];s[e+l]=s[t-a+l],s[t-a+l]=o}e+=a,t-=a}}function s0(s,e,t,a){let l=0,o=s[t-a],m=s[t-a+1];for(;e<t;e+=a){let g=s[e],b=s[e+1];l+=(g-o)*(b+m),o=g,m=b}return l===0?void 0:l>0}function Ad(s,e,t,a,l){l=l!==void 0?l:!1;for(let o=0,m=t.length;o<m;++o){let g=t[o],b=s0(s,e,g,a);if(o===0){if(l&&b||!l&&!b)return!1}else if(l&&!b||!l&&b)return!1;e=g}return!0}function Qm(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o){let g=t[o];if(!Ad(s,e,g,a,l))return!1;g.length&&(e=g[g.length-1])}return!0}function Eu(s,e,t,a,l){l=l!==void 0?l:!1;for(let o=0,m=t.length;o<m;++o){let g=t[o],b=s0(s,e,g,a);(o===0?l&&b||!l&&!b:l&&!b||!l&&b)&&OE(s,e,g,a),e=g}return e}function Ed(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o)e=Eu(s,e,t[o],a,l);return e}function zE(s,e){let t=[],a=0,l=0,o;for(let m=0,g=e.length;m<g;++m){let b=e[m],A=s0(s,a,b,2);if(o===void 0&&(o=A),A===o)t.push(e.slice(l,m+1));else{if(t.length===0)continue;t[t.length-1].push(e[l])}l=m+1,a=b}return t}var Id=class s extends Vi{constructor(e,t,a){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&a?(this.setFlatCoordinates(t,e),this.ends_=a):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?ji(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new s(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,a,l){return l<Dn(this.getExtent(),e,t)?l:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(md(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),yd(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,a,l))}containsXY(e,t){return vd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return Yx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Eu(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Va(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=bo(this.getExtent());this.flatInteriorPoint_=Sd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ei(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new Qx(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,a=this.ends_,l=[],o=0;for(let m=0,g=a.length;m<g;++m){let b=a[m],A=new Qx(t.slice(o,b),e);l.push(A),o=b}return l}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Ad(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Eu(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],a=[];return t.length=_d(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,a),new s(t,"XY",a)}getType(){return"Polygon"}intersectsExtent(e){return e0(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let a=Ua(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=a.length===0?0:a[a.length-1],this.changed()}},Iu=Id;function a0(s){if(cd(s))throw new Error("Cannot create polygon from empty extent");let e=s[0],t=s[1],a=s[2],l=s[3],o=[e,t,e,l,a,l,a,t,e,t];return new Id(o,"XY",[o.length])}function l0(s,e,t){e=e||32;let a=s.getStride(),l=s.getLayout(),o=s.getCenter(),m=a*(e+1),g=new Array(m);for(let S=0;S<m;S+=a){g[S]=0,g[S+1]=0;for(let M=2;M<a;M++)g[S+M]=o[M]}let b=[g.length],A=new Id(g,l,b);return ez(A,o,s.getRadius(),t),A}function ez(s,e,t,a){let l=s.getFlatCoordinates(),o=s.getStride(),m=l.length/o-1,g=a||0;for(let b=0;b<=m;++b){let A=b*o,S=g+Ul(b,m)*2*Math.PI/m;l[A]=e[0]+t*Math.cos(S),l[A+1]=e[1]+t*Math.sin(S)}s.changed()}function eg(s,e,t,a){let l=[],o=On();for(let m=0,g=t.length;m<g;++m){let b=t[m];o=vu(s,e,b[0],a),l.push((o[0]+o[2])/2,(o[1]+o[3])/2),e=b[b.length-1]}return l}var c0=class s extends Vi{constructor(e,t,a){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!a&&!Array.isArray(e[0])){let l=e,o=[],m=[];for(let g=0,b=l.length;g<b;++g){let A=l[g],S=o.length,M=A.getEnds();for(let k=0,j=M.length;k<j;++k)M[k]+=S;ji(o,A.getFlatCoordinates()),m.push(M)}t=l.length===0?this.getLayout():l[0].getLayout(),e=o,a=m}t!==void 0&&a?(this.setFlatCoordinates(t,e),this.endss_=a):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let a=this.flatCoordinates.length;ji(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let l=0,o=t.length;l<o;++l)t[l]+=a}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let l=0;l<e;++l)t[l]=this.endss_[l].slice();let a=new s(this.flatCoordinates.slice(),this.layout,t);return a.applyProperties(this),a}closestPointXY(e,t,a,l){return l<Dn(this.getExtent(),e,t)?l:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(PE(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),TE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,a,l))}containsXY(e,t){return FE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return ME(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Ed(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,xd(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=eg(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Jm(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new wd(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Qm(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Ed(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],a=[];return t.length=CE(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,a),new s(t,"XY",a)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let o=this.endss_[e-1];t=o[o.length-1]}let a=this.endss_[e].slice(),l=a[a.length-1];if(t!==0)for(let o=0,m=a.length;o<m;++o)a[o]-=t;return new Iu(this.flatCoordinates.slice(t,l),this.layout,a)}getPolygons(){let e=this.layout,t=this.flatCoordinates,a=this.endss_,l=[],o=0;for(let m=0,g=a.length;m<g;++m){let b=a[m].slice(),A=b[b.length-1];if(o!==0)for(let M=0,k=b.length;M<k;++M)b[M]-=o;let S=new Iu(t.slice(o,A),e,b);l.push(S),o=A}return l}getType(){return"MultiPolygon"}intersectsExtent(e){return DE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let a=Zm(this.flatCoordinates,0,e,this.stride,this.endss_);if(a.length===0)this.flatCoordinates.length=0;else{let l=a[a.length-1];this.flatCoordinates.length=l.length===0?0:l[l.length-1]}this.changed()}},u0=c0;var tz=(s,e,t)=>{let{coordinate:a,olGeometry:l,time_intervals:o}=e.properties,{coordinates:m,type:g}=e.geometry,b=l,A,S;if(l&&(g=b.getType(),m=b.getCoordinates()),t&&a)A=a;else if(g==="Point")A=m;else if(g==="LineString"){b||(b=new Go(m));let M=o||[[]],k=M[0],j=M[M.length-1];if(s<k[0])[,,S]=k,A=b.getFirstCoordinate();else if(s>j[0])[,,S]=j,A=b.getLastCoordinate();else for(let Z=0;Z<M.length-1;Z+=1){let[te,q]=M[Z],[H,ae]=M[Z+1];if(te<=s&&s<=H){let ve=Math.min((s-te)/(H-te),1)*(ae-q)+q;A=b.getCoordinateAt(ve),[,,S]=M[Z];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",b);return{coord:A,rotation:S}},Pd=tz;var rz=(s,e,t,a,l)=>{if(!s)return{renderedTrajectories:[]};let{center:o,pixelRatio:m=1,resolution:g,rotation:b=0,size:A=[],time:S=Date.now()}=a;if(!g||!o)return{renderedTrajectories:[]};let{filter:M,getScreenPixel:k=(Ae,ut)=>(ut.zoom||0)<12?Ae.map(Ve=>Math.floor(Ve)):Ae,hoverVehicleId:j,noInterpolate:Z=!1,selectedVehicleId:te}=l,q=s.getContext("2d");q?.clearRect(0,0,s.width,s.height);let[H,ae]=A;H&&ae&&(s.width!==H||s.height!==ae)&&([s.width,s.height]=[H*m,ae*m]);let pe=ln(wi(),A[0]/2,A[1]/2,1/g,-1/g,-b,-o[0],-o[1]);s.style&&(s.style.width=`${s.width/m}px`,s.style.height=`${s.height/m}px`);let ve,de,_e,Pe,Re=[];for(let Ae=e.length-1;Ae>=0;Ae-=1){let ut=e[Ae];if(M&&!M(ut))continue;let{timeOffset:Ve,train_id:Ue}=ut.properties,{coord:pt,rotation:Tt}=Pd(S-(Ve||0),ut,Z);if(e[Ae].properties.coordinate=pt,e[Ae].properties.rotation=Tt,!pt)continue;let Qe=Ni(pe,[...pt]);if(!Qe||(Qe=Qe.map(yt=>yt*m),Qe[0]<0||Qe[0]>s.width||Qe[1]<0||Qe[1]>s.height))continue;let nt=t(ut,a,l);if(nt){if(j!==Ue&&te!==Ue){let[yt,dt]=k([Qe[0]-nt.width/2,Qe[1]-nt.height/2],a);q?.drawImage(nt,yt,dt)}j&&j===Ue&&(ve=nt,de=Qe),te&&te===Ue&&(_e=nt,Pe=Qe),Re.push(ut)}}return _e&&Pe&&q?.drawImage(_e,Math.floor(Pe[0]-_e.width/2),Math.floor(Pe[1]-_e.height/2)),ve&&de&&q?.drawImage(ve,Math.floor(de[0]-ve.width/2),Math.floor(de[1]-ve.height/2)),{renderedTrajectories:Re}},Td=rz;var iz=(s,e,t=!1)=>{let a=["HIDDEN","LEAVING","BOARDING"],l=s.has_fzo&&a.indexOf(s.state)>-1,o=e.has_fzo&&a.indexOf(e.state)>-1;if(l||o){if(l!==o)return l?-1:1;if(s.state!==e.state)return a.indexOf(s.state)-a.indexOf(e.state)}let m=null,g=null,b=Date.now();return t?(m=new Date(s.min_arrival_time||s.time).getTime()-b,g=new Date(e.min_arrival_time||e.time).getTime()-b):(m=new Date(s.time).getTime()-b,g=new Date(e.time).getTime()-b),m-g},Cd=iz;var nz=(s,e=!1,t=30)=>{let a=Object.keys(s).map(M=>s[M]);a.sort((M,k)=>Cd(M,k,e));let l=new Date;l.setMinutes(l.getMinutes()+t);let o=l.getTime(),m=new Date;m.setMinutes(m.getMinutes()-t);let g=m.getTime(),b=[],A=[],S=null;for(let M=a.length-1;M>=0;M-=1){let k={...a[M]},j=new Date(k.time).getTime();j>g&&j<o&&(k.state==="BOARDING"&&(A.includes(k.platform)?k.state="HIDDEN":A.push(k.platform)),S&&k.to[0]===S.to[0]&&Math.abs(j-S.time)<1e3&&k.line.name===S.line.name&&(k.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(k.state)&&(k.cancelled=!0),S=k,S.time=j,b.unshift(k))}return b},Md=nz;var oz=(s,e=!1,t=30,a=100)=>{let l={},o={};return m=>{let{source:g,content:b}=m;l[g]&&window.clearTimeout(l[g]),b&&(o[b.call_id]=b,l[g]=window.setTimeout(()=>{let A=Md(o,e||!1,t);s(A)},a))}},h0=oz;var Pu={};nx(Pu,{MOTS_ALL:()=>lz,MOTS_ONLY_RAIL:()=>Vo,MOTS_WITHOUT_CABLE:()=>tg,MOTS_WITH_CABLE:()=>az,bgColors:()=>NE,getBgColor:()=>uz,getDelayColor:()=>dz,getDelayText:()=>fz,getRadius:()=>cz,getTextColor:()=>hz,getTextSize:()=>pz,getTypeIndex:()=>rg,textColors:()=>jE,types:()=>BE});var sz=[[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15]],Vo=["rail"],az=["cablecar","gondola","funicular","coach"],tg=["tram","subway","rail","bus"],lz=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"],BE=[/^Tram/i,/^Subway( \/ Metro \/ S-Bahn)?/i,/^Train/i,/^Bus/i,/^Ferry/i,/^Cable ?Car/i,/^Gondola/i,/^Funicular/i,/^(Long distance bus|coach)/i,/^Rail/i],NE=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],jE=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],rg=s=>typeof s=="string"?BE.findIndex(e=>e.test(s)):s,cz=(s,e)=>{try{let t=rg(s||0);return sz[t][e]}catch{return 1}},uz=s=>{try{let e=rg(s);return NE[e]}catch{return"#ffffff"}},hz=s=>{try{let e=rg(s);return jE[e]}catch{return"#ffffff"}},pz=(s,e,t,a,l)=>{if(!s)return 0;s.font=l(a,t);let o=s.measureText(t),m=25,g=0;for(;o.width>e-6&&g<m;)a-=.5,s.font=l(a,t),o=s.measureText(t),g+=1;return a},dz=(s,e,t)=>e?t?"#ff0000":"#a0a0a0":s===null?"#a0a0a0":s>=36e5?"#ed004c":s>=5e5?"#e80000":s>=3e5?"#ff4a00":s>=18e4?"#f7bf00":"#00a00c",fz=(s,e)=>e?String.fromCodePoint(215):s>=36e5?`+${Math.round(s/36e5)}h`:s>=6e4?`+${Math.round(s/6e4)}m`:s>=1e3?`+${Math.round(s/1e3)}s`:s>0?`+${s}ms`:"";var Tu="vectorTileFeature";var lr={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var p0=class extends Si{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[lr.OPACITY]=e.opacity!==void 0?e.opacity:1,Ar(typeof t[lr.OPACITY]=="number","Layer opacity must be a number"),t[lr.VISIBLE]=e.visible!==void 0?e.visible:!0,t[lr.Z_INDEX]=e.zIndex,t[lr.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[lr.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[lr.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[lr.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},a=this.getZIndex();return t.opacity=Br(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=a===void 0&&!t.managed?1/0:a,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return Pt()}getLayerStatesArray(e){return Pt()}getExtent(){return this.get(lr.EXTENT)}getMaxResolution(){return this.get(lr.MAX_RESOLUTION)}getMinResolution(){return this.get(lr.MIN_RESOLUTION)}getMinZoom(){return this.get(lr.MIN_ZOOM)}getMaxZoom(){return this.get(lr.MAX_ZOOM)}getOpacity(){return this.get(lr.OPACITY)}getSourceState(){return Pt()}getVisible(){return this.get(lr.VISIBLE)}getZIndex(){return this.get(lr.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(lr.EXTENT,e)}setMaxResolution(e){this.set(lr.MAX_RESOLUTION,e)}setMinResolution(e){this.set(lr.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(lr.MAX_ZOOM,e)}setMinZoom(e){this.set(lr.MIN_ZOOM,e)}setOpacity(e){Ar(typeof e=="number","Layer opacity must be a number"),this.set(lr.OPACITY,e)}setVisible(e){this.set(lr.VISIBLE,e)}setZIndex(e){this.set(lr.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},UE=p0;var ms={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Bn={ANIMATING:0,INTERACTING:1};var So={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function d0(s,e,t){return function(a,l,o,m,g){if(!a)return;if(!l&&!e)return a;let b=e?0:o[0]*l,A=e?0:o[1]*l,S=g?g[0]:0,M=g?g[1]:0,k=s[0]+b/2+S,j=s[2]-b/2+S,Z=s[1]+A/2+M,te=s[3]-A/2+M;k>j&&(k=(j+k)/2,j=k),Z>te&&(Z=(te+Z)/2,te=Z);let q=Br(a[0],k,j),H=Br(a[1],Z,te);if(m&&t&&l){let ae=30*l;q+=-ae*Math.log(1+Math.max(0,k-a[0])/ae)+ae*Math.log(1+Math.max(0,a[0]-j)/ae),H+=-ae*Math.log(1+Math.max(0,Z-a[1])/ae)+ae*Math.log(1+Math.max(0,a[1]-te)/ae)}return[q,H]}}function GE(s){return s}function f0(s,e,t,a){let l=kr(e)/t[0],o=si(e)/t[1];return a?Math.min(s,Math.max(l,o)):Math.min(s,Math.min(l,o))}function m0(s,e,t){let a=Math.min(s,e),l=50;return a*=Math.log(1+l*Math.max(0,s/e-1))/l+1,t&&(a=Math.max(a,t),a/=Math.log(1+l*Math.max(0,t/s-1))/l+1),Br(a,t/2,e*2)}function VE(s,e,t,a){return e=e!==void 0?e:!0,function(l,o,m,g){if(l!==void 0){let b=s[0],A=s[s.length-1],S=t?f0(b,t,m,a):b;if(g)return e?m0(l,S,A):Br(l,A,S);let M=Math.min(S,l),k=Math.floor(Fm(s,M,o));return s[k]>S&&k<s.length-1?s[k+1]:s[k]}}}function qE(s,e,t,a,l,o){return a=a!==void 0?a:!0,t=t!==void 0?t:0,function(m,g,b,A){if(m!==void 0){let S=l?f0(e,l,b,o):e;if(A)return a?m0(m,S,t):Br(m,t,S);let M=1e-9,k=Math.ceil(Math.log(e/S)/Math.log(s)-M),j=-g*(.5-M)+.5,Z=Math.min(S,m),te=Math.floor(Math.log(e/Z)/Math.log(s)+j),q=Math.max(k,te),H=e/Math.pow(s,q);return Br(H,t,S)}}}function g0(s,e,t,a,l){return t=t!==void 0?t:!0,function(o,m,g,b){if(o!==void 0){let A=a?f0(s,a,g,l):s;return!t||!b?Br(o,e,A):m0(o,A,e)}}}function $E(s){if(s!==void 0)return 0}function y0(s){if(s!==void 0)return s}function WE(s){let e=2*Math.PI/s;return function(t,a){if(a)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t}}function ZE(s){let e=s===void 0?lE(5):s;return function(t,a){return a||t===void 0?t:Math.abs(t)<=e?0:t}}function mz(s){return Math.pow(s,3)}function XE(s){return 1-mz(1-s)}function HE(s){return 3*s*s-2*s*s*s}var _0=0,v0=class extends Si{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Vm(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&Vx(),e.center&&(e.center=ti(e.center,this.projection_)),e.extent&&(e.extent=fs(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let g in So)delete t[g];this.setProperties(t,!0);let a=yz(e);this.maxResolution_=a.maxResolution,this.minResolution_=a.minResolution,this.zoomFactor_=a.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=a.minZoom;let l=gz(e),o=a.constraint,m=_z(e);this.constraints_={center:l,resolution:o,rotation:m},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let a=this.getCenterInternal();if(a){let l=e||[0,0,0,0];t=t||[0,0,0,0];let o=this.getResolution(),m=o/2*(l[3]-t[3]+t[1]-l[1]),g=o/2*(l[0]-t[0]+t[2]-l[2]);this.setCenterInternal([a[0]+m,a[1]-g])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let a=0;a<t.length;++a){let l=arguments[a];l.center&&(l=Object.assign({},l),l.center=ti(l.center,this.getProjection())),l.anchor&&(l=Object.assign({},l),l.anchor=ti(l.anchor,this.getProjection())),t[a]=l}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,a;t>1&&typeof arguments[t-1]=="function"&&(a=arguments[t-1],--t);let l=0;for(;l<t&&!this.isDef();++l){let S=arguments[l];S.center&&this.setCenterInternal(S.center),S.zoom!==void 0?this.setZoom(S.zoom):S.resolution&&this.setResolution(S.resolution),S.rotation!==void 0&&this.setRotation(S.rotation)}if(l===t){a&&ig(a,!0);return}let o=Date.now(),m=this.targetCenter_.slice(),g=this.targetResolution_,b=this.targetRotation_,A=[];for(;l<t;++l){let S=arguments[l],M={start:o,complete:!1,anchor:S.anchor,duration:S.duration!==void 0?S.duration:1e3,easing:S.easing||HE,callback:a};if(S.center&&(M.sourceCenter=m,M.targetCenter=S.center.slice(),m=M.targetCenter),S.zoom!==void 0?(M.sourceResolution=g,M.targetResolution=this.getResolutionForZoom(S.zoom),g=M.targetResolution):S.resolution&&(M.sourceResolution=g,M.targetResolution=S.resolution,g=M.targetResolution),S.rotation!==void 0){M.sourceRotation=b;let k=Ul(S.rotation-b+Math.PI,2*Math.PI)-Math.PI;M.targetRotation=b+k,b=M.targetRotation}xz(M)?M.complete=!0:o+=M.duration,A.push(M)}this.animations_.push(A),this.setHint(Bn.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Bn.ANIMATING]>0}getInteracting(){return this.hints_[Bn.INTERACTING]>0}cancelAnimations(){this.setHint(Bn.ANIMATING,-this.hints_[Bn.ANIMATING]);let e;for(let t=0,a=this.animations_.length;t<a;++t){let l=this.animations_[t];if(l[0].callback&&ig(l[0].callback,!1),!e)for(let o=0,m=l.length;o<m;++o){let g=l[o];if(!g.complete){e=g.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let a=this.animations_.length-1;a>=0;--a){let l=this.animations_[a],o=!0;for(let m=0,g=l.length;m<g;++m){let b=l[m];if(b.complete)continue;let A=e-b.start,S=b.duration>0?A/b.duration:1;S>=1?(b.complete=!0,S=1):o=!1;let M=b.easing(S);if(b.sourceCenter){let k=b.sourceCenter[0],j=b.sourceCenter[1],Z=b.targetCenter[0],te=b.targetCenter[1];this.nextCenter_=b.targetCenter;let q=k+M*(Z-k),H=j+M*(te-j);this.targetCenter_=[q,H]}if(b.sourceResolution&&b.targetResolution){let k=M===1?b.targetResolution:b.sourceResolution+M*(b.targetResolution-b.sourceResolution);if(b.anchor){let j=this.getViewportSize_(this.getRotation()),Z=this.constraints_.resolution(k,0,j,!0);this.targetCenter_=this.calculateCenterZoom(Z,b.anchor)}this.nextResolution_=b.targetResolution,this.targetResolution_=k,this.applyTargetState_(!0)}if(b.sourceRotation!==void 0&&b.targetRotation!==void 0){let k=M===1?Ul(b.targetRotation+Math.PI,2*Math.PI)-Math.PI:b.sourceRotation+M*(b.targetRotation-b.sourceRotation);if(b.anchor){let j=this.constraints_.rotation(k,!0);this.targetCenter_=this.calculateCenterRotate(j,b.anchor)}this.nextRotation_=b.targetRotation,this.targetRotation_=k}if(this.applyTargetState_(!0),t=!0,!b.complete)break}if(o){this.animations_[a]=null,this.setHint(Bn.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let m=l[0].callback;m&&ig(m,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let a,l=this.getCenterInternal();return l!==void 0&&(a=[l[0]-t[0],l[1]-t[1]],hE(a,e-this.getRotation()),uE(a,t)),a}calculateCenterZoom(e,t){let a,l=this.getCenterInternal(),o=this.getResolution();if(l!==void 0&&o!==void 0){let m=t[0]-e*(t[0]-l[0])/o,g=t[1]-e*(t[1]-l[1])/o;a=[m,g]}return a}getViewportSize_(e){let t=this.viewportSize_;if(e){let a=t[0],l=t[1];return[Math.abs(a*Math.cos(e))+Math.abs(l*Math.sin(e)),Math.abs(a*Math.sin(e))+Math.abs(l*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&ql(e,this.getProjection())}getCenterInternal(){return this.get(So.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return ds(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();Ar(t,"The view center is not defined");let a=this.getResolution();Ar(a!==void 0,"The view resolution is not defined");let l=this.getRotation();return Ar(l!==void 0,"The view rotation is not defined"),HA(t,a,l,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(So.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(fs(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let a=kr(e)/t[0],l=si(e)/t[1];return Math.max(a,l)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),a=this.minResolution_,l=Math.log(t/a)/Math.log(e);return function(o){return t/Math.pow(e,o*l)}}getRotation(){return this.get(So.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),a=this.getConstrainedResolution(this.maxResolution_),l=this.minResolution_,o=Math.log(a/l)/t;return function(m){return Math.log(a/m)/t/o}}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),a=this.padding_;return a&&(t=[t[0]-a[1]-a[3],t[1]-a[0]-a[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),a=this.getRotation(),l=this.getCenterInternal(),o=this.padding_;if(o){let m=this.getViewportSizeMinusPadding_();l=x0(l,this.getViewportSize_(),[m[0]/2+o[3],m[1]/2+o[0]],t,a)}return{center:l.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:a,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,a,l;if(this.resolutions_){let o=Fm(this.resolutions_,e,1);t=o,a=this.resolutions_[o],o==this.resolutions_.length-1?l=2:l=a/this.resolutions_[o+1]}else a=this.maxResolution_,l=this.zoomFactor_;return t+Math.log(a/e)/Math.log(l)}getResolutionForZoom(e){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;let t=Br(Math.floor(e),0,this.resolutions_.length-2),a=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(a,Br(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let a;if(Ar(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Ar(!cd(e),"Cannot fit empty extent provided as `geometry`");let l=fs(e,this.getProjection());a=a0(l)}else if(e.getType()==="Circle"){let l=fs(e.getExtent(),this.getProjection());a=a0(l),a.rotate(this.getRotation(),bo(l))}else{let l=co();l?a=e.clone().transform(l,this.getProjection()):a=e}this.fitInternal(a,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),a=Math.cos(t),l=Math.sin(-t),o=e.getFlatCoordinates(),m=e.getStride(),g=1/0,b=1/0,A=-1/0,S=-1/0;for(let M=0,k=o.length;M<k;M+=m){let j=o[M]*a-o[M+1]*l,Z=o[M]*l+o[M+1]*a;g=Math.min(g,j),b=Math.min(b,Z),A=Math.max(A,j),S=Math.max(S,Z)}return[g,b,A,S]}fitInternal(e,t){t=t||{};let a=t.size;a||(a=this.getViewportSizeMinusPadding_());let l=t.padding!==void 0?t.padding:[0,0,0,0],o=t.nearest!==void 0?t.nearest:!1,m;t.minResolution!==void 0?m=t.minResolution:t.maxZoom!==void 0?m=this.getResolutionForZoom(t.maxZoom):m=0;let g=this.rotatedExtentForGeometry(e),b=this.getResolutionForExtentInternal(g,[a[0]-l[1]-l[3],a[1]-l[0]-l[2]]);b=isNaN(b)?m:Math.max(b,m),b=this.getConstrainedResolution(b,o?0:1);let A=this.getRotation(),S=Math.sin(A),M=Math.cos(A),k=bo(g);k[0]+=(l[1]-l[3])/2*b,k[1]+=(l[0]-l[2])/2*b;let j=k[0]*M-k[1]*S,Z=k[1]*M+k[0]*S,te=this.getConstrainedCenter([j,Z],b),q=t.callback?t.callback:No;t.duration!==void 0?this.animateInternal({resolution:b,center:te,duration:t.duration,easing:t.easing},q):(this.targetResolution_=b,this.targetCenter_=te,this.applyTargetState_(!1,!0),ig(q,!0))}centerOn(e,t,a){this.centerOnInternal(ti(e,this.getProjection()),t,a)}centerOnInternal(e,t,a){this.setCenterInternal(x0(e,t,a,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,a,l){let o,m=this.padding_;if(m&&e){let g=this.getViewportSizeMinusPadding_(-a),b=x0(e,l,[g[0]/2+m[3],g[1]/2+m[0]],t,a);o=[e[0]-b[0],e[1]-b[1]]}return o}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=ql(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&ti(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let a=this.getAnimating()||this.getInteracting(),l=this.getViewportSize_(this.getRotation()),o=this.constraints_.resolution(this.targetResolution_*e,0,l,a);t&&(this.targetCenter_=this.calculateCenterZoom(o,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=ti(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let a=this.getAnimating()||this.getInteracting(),l=this.constraints_.rotation(this.targetRotation_+e,a);t&&(this.targetCenter_=this.calculateCenterRotate(l,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&ti(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let a=this.getAnimating()||this.getInteracting()||t,l=this.constraints_.rotation(this.targetRotation_,a),o=this.getViewportSize_(l),m=this.constraints_.resolution(this.targetResolution_,0,o,a),g=this.constraints_.center(this.targetCenter_,m,o,a,this.calculateCenterShift(this.targetCenter_,m,l,o));this.get(So.ROTATION)!==l&&this.set(So.ROTATION,l),this.get(So.RESOLUTION)!==m&&(this.set(So.RESOLUTION,m),this.set("zoom",this.getZoom(),!0)),(!g||!this.get(So.CENTER)||!An(this.get(So.CENTER),g))&&this.set(So.CENTER,g),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,a){e=e!==void 0?e:200;let l=t||0,o=this.constraints_.rotation(this.targetRotation_),m=this.getViewportSize_(o),g=this.constraints_.resolution(this.targetResolution_,l,m),b=this.constraints_.center(this.targetCenter_,g,m,!1,this.calculateCenterShift(this.targetCenter_,g,o,m));if(e===0&&!this.cancelAnchor_){this.targetResolution_=g,this.targetRotation_=o,this.targetCenter_=b,this.applyTargetState_();return}a=a||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==g||this.getRotation()!==o||!this.getCenterInternal()||!An(this.getCenterInternal(),b))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:o,center:b,resolution:g,duration:e,easing:XE,anchor:a}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Bn.INTERACTING,1)}endInteraction(e,t,a){a=a&&ti(a,this.getProjection()),this.endInteractionInternal(e,t,a)}endInteractionInternal(e,t,a){this.getInteracting()&&(this.setHint(Bn.INTERACTING,-1),this.resolveConstraints(e,t,a))}getConstrainedCenter(e,t){let a=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),a)}getConstrainedZoom(e,t){let a=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(a,t))}getConstrainedResolution(e,t){t=t||0;let a=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,a)}};function ig(s,e){setTimeout(function(){s(e)},0)}function gz(s){if(s.extent!==void 0){let t=s.smoothExtentConstraint!==void 0?s.smoothExtentConstraint:!0;return d0(s.extent,s.constrainOnlyCenter,t)}let e=Vm(s.projection,"EPSG:3857");if(s.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,d0(t,!1,!1)}return GE}function yz(s){let e,t,a,m=s.minZoom!==void 0?s.minZoom:_0,g=s.maxZoom!==void 0?s.maxZoom:28,b=s.zoomFactor!==void 0?s.zoomFactor:2,A=s.multiWorld!==void 0?s.multiWorld:!1,S=s.smoothResolutionConstraint!==void 0?s.smoothResolutionConstraint:!0,M=s.showFullExtent!==void 0?s.showFullExtent:!1,k=Vm(s.projection,"EPSG:3857"),j=k.getExtent(),Z=s.constrainOnlyCenter,te=s.extent;if(!A&&!te&&k.isGlobal()&&(Z=!1,te=j),s.resolutions!==void 0){let q=s.resolutions;t=q[m],a=q[g]!==void 0?q[g]:q[q.length-1],s.constrainResolution?e=VE(q,S,!Z&&te,M):e=g0(t,a,S,!Z&&te,M)}else{let H=(j?Math.max(kr(j),si(j)):360*ud.degrees/k.getMetersPerUnit())/256/Math.pow(2,_0),ae=H/Math.pow(2,28-_0);t=s.maxResolution,t!==void 0?m=0:t=H/Math.pow(b,m),a=s.minResolution,a===void 0&&(s.maxZoom!==void 0?s.maxResolution!==void 0?a=t/Math.pow(b,g):a=H/Math.pow(b,g):a=ae),g=m+Math.floor(Math.log(t/a)/Math.log(b)),a=t/Math.pow(b,g-m),s.constrainResolution?e=qE(b,t,a,S,!Z&&te,M):e=g0(t,a,S,!Z&&te,M)}return{constraint:e,maxResolution:t,minResolution:a,minZoom:m,zoomFactor:b}}function _z(s){if(s.enableRotation!==void 0?s.enableRotation:!0){let t=s.constrainRotation;return t===void 0||t===!0?ZE():t===!1?y0:typeof t=="number"?WE(t):y0}return $E}function xz(s){return!(s.sourceCenter&&s.targetCenter&&!An(s.sourceCenter,s.targetCenter)||s.sourceResolution!==s.targetResolution||s.sourceRotation!==s.targetRotation)}function x0(s,e,t,a,l){let o=Math.cos(-l),m=Math.sin(-l),g=s[0]*o-s[1]*m,b=s[1]*o+s[0]*m;g+=(e[0]/2-t[0])*a,b+=(t[1]-e[1]/2)*a,m=-m;let A=g*o-b*m,S=b*o+g*m;return[A,S]}var b0=v0;var w0=class extends UE{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(lr.SOURCE,this.handleSourcePropertyChange_);let a=e.source?e.source:null;this.setSource(a)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(lr.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(cn(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=Ui(e,Ir.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,a=this.getMapInternal();!e&&a&&(e=a.getView()),e instanceof b0?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&a&&(t.layerStatesArray=a.getLayerGroup().getLayerStatesArray());let l;t.layerStatesArray?l=t.layerStatesArray.find(m=>m.layer===this):l=this.getLayerState();let o=this.getExtent();return S0(l,t.viewState)&&(!o||ei(o,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t,a=this.getSource();if(a&&(t=a.getAttributions()),!t)return[];let l=e instanceof b0?e.getViewStateAndExtent():e,o=t(l);return Array.isArray(o)||(o=[o]),o}render(e,t){let a=this.getRenderer();return a.prepareFrame(e)?(this.rendered=!0,a.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(lr.MAP,e)}getMapInternal(){return this.get(lr.MAP)}setMap(e){this.mapPrecomposeKey_&&(cn(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(cn(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=Ui(e,ms.PRECOMPOSE,function(t){let l=t.frameState.layerStatesArray,o=this.getLayerState(!1);Ar(!l.some(function(m){return m.layer===o.layer}),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),l.push(o)},this),this.mapRenderKey_=Ui(this,Ir.CHANGE,e.render,e),this.changed())}setSource(e){this.set(lr.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}};function S0(s,e){if(!s.visible)return!1;let t=e.resolution;if(t<s.minResolution||t>=s.maxResolution)return!1;let a=e.zoom;return a>s.minZoom&&a<=s.maxZoom}var qo=w0;var KE={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var $a=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",u7=$a.includes("firefox"),vz=$a.includes("safari")&&!$a.includes("chrom"),h7=vz&&($a.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test($a)),p7=$a.includes("webkit")&&!$a.includes("edge"),d7=$a.includes("macintosh");var ng=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,YE=typeof Image<"u"&&Image.prototype.decode;var f7=function(){let s=!1;try{let e=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return s}();function Xr(s,e,t,a){let l;return t&&t.length?l=t.shift():ng?l=new OffscreenCanvas(s||300,e||300):l=document.createElement("canvas"),s&&(l.width=s),e&&(l.height=e),l.getContext("2d",a)}var A0;function Cu(){return A0||(A0=Xr(1,1)),A0}function JE(s){let e=s.canvas;e.width=1,e.height=1,s.clearRect(0,0,1,1)}function E0(s){return s&&s.parentNode?s.parentNode.removeChild(s):null}var I0=class extends Si{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){E0(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&E0(this.element);for(let t=0,a=this.listenerKeys.length;t<a;++t)cn(this.listenerKeys[t]);this.listenerKeys.length=0,this.map_=e,e&&((this.target_?this.target_:e.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==No&&this.listenerKeys.push(Ui(e,KE.POSTRENDER,this.render,this)),e.render())}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Mu=I0;var bz=()=>{let s=document.createElement("div");return Object.assign(s.style,{position:"absolute",bottom:0,right:0,fontSize:".8rem",padding:"0 10px"}),s},QE=bz;var P0=class extends Mu{constructor(e={}){let t=QE();t.className=e.className||"mbt-copyright",super({element:t,...e}),this.format=e.format||(a=>a?.join(" | "))}render({frameState:e}){if(!e){this.element.innerHTML="";return}let t=[];e?.layerStatesArray.forEach(l=>{let{layer:o}=l;if(e&&S0(l,e.viewState)&&(o?.getSource()?.getAttributions()&&(t=t.concat(o.getSource().getAttributions()(e))),o?.get("copyrights"))){let m=o.get("copyrights");m=Array.isArray(m)?m:[m],m?.length&&t.push(...m)}});let a=Bl(t)||[];this.element.innerHTML=this.format(a)}},eI=P0;var $o={ADD:"add",REMOVE:"remove"};var tI={LENGTH:"length"},Ru=class extends zr{constructor(e,t,a){super(e),this.element=t,this.index=a}},T0=class extends Si{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e||[],this.unique_)for(let a=0,l=this.array_.length;a<l;++a)this.assertUnique_(this.array_[a],a);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,a=e.length;t<a;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let a=0,l=t.length;a<l;++a)e(t[a],a,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(tI.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Ru($o.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){this.unique_&&this.assertUnique_(e);let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let a=0,l=t.length;a<l;++a)if(t[a]===e)return this.removeAt(a)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Ru($o.REMOVE,t,e)),t}setAt(e,t){let a=this.getLength();if(e>=a){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let l=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Ru($o.REMOVE,l,e)),this.dispatchEvent(new Ru($o.ADD,t,e))}updateLength_(){this.set(tI.LENGTH,this.array_.length)}assertUnique_(e,t){for(let a=0,l=this.array_.length;a<l;++a)if(this.array_[a]===e&&a!==t)throw new Error("Duplicate item added to a unique collection")}},Rd=T0;var C0=class s extends Si{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new s(this.hasProperties()?this.getProperties():null);e.setGeometryName(this.getGeometryName());let t=this.getGeometry();t&&e.setGeometry(t.clone());let a=this.getStyle();return a&&e.setStyle(a),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(cn(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=Ui(e,Ir.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?wz(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}};function wz(s){if(typeof s=="function")return s;let e;return Array.isArray(s)?e=s:(Ar(typeof s.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[s]),function(){return e}}var Ao=C0;var Mt={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};var ra={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var Xl={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"]};Xl.whitepoint={2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}};Xl.max=Xl.whitepoint[2].D65;Xl.rgb=function(s,e){e=e||Xl.whitepoint[2].E;var t=s[0]/e[0],a=s[1]/e[1],l=s[2]/e[2],o,m,g;return o=t*3.240969941904521+a*-1.537383177570093+l*-.498610760293,m=t*-.96924363628087+a*1.87596750150772+l*.041555057407175,g=t*.055630079696993+a*-.20397695888897+l*1.056971514242878,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o=o*12.92,m=m>.0031308?1.055*Math.pow(m,1/2.4)-.055:m=m*12.92,g=g>.0031308?1.055*Math.pow(g,1/2.4)-.055:g=g*12.92,o=Math.min(Math.max(0,o),1),m=Math.min(Math.max(0,m),1),g=Math.min(Math.max(0,g),1),[o*255,m*255,g*255]};ra.xyz=function(s,e){var t=s[0]/255,a=s[1]/255,l=s[2]/255;t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,a=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92,l=l>.04045?Math.pow((l+.055)/1.055,2.4):l/12.92;var o=t*.41239079926595+a*.35758433938387+l*.18048078840183,m=t*.21263900587151+a*.71516867876775+l*.072192315360733,g=t*.019330818715591+a*.11919477979462+l*.95053215224966;return e=e||Xl.whitepoint[2].E,[o*e[0],m*e[1],g*e[2]]};var Nn=Xl;var og={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(s,e,t){var a,l,o,m,g,b,A,S,M,k,j,Z,te;if(o=s[0],m=s[1],g=s[2],o===0)return[0,0,0];var q=.0011070564598794539;return e=e||"D65",t=t||2,M=Nn.whitepoint[t][e][0],k=Nn.whitepoint[t][e][1],j=Nn.whitepoint[t][e][2],Z=4*M/(M+15*k+3*j),te=9*k/(M+15*k+3*j),a=m/(13*o)+Z||0,l=g/(13*o)+te||0,A=o>8?k*Math.pow((o+16)/116,3):k*o*q,b=A*9*a/(4*l)||0,S=A*(12-3*a-20*l)/(4*l)||0,[b,A,S]}};Nn.luv=function(s,e,t){var a,l,o,m,g,b,A,S,M,k,j,Z,te,q=.008856451679035631,H=903.2962962962961;e=e||"D65",t=t||2,M=Nn.whitepoint[t][e][0],k=Nn.whitepoint[t][e][1],j=Nn.whitepoint[t][e][2],Z=4*M/(M+15*k+3*j),te=9*k/(M+15*k+3*j),b=s[0],A=s[1],S=s[2],a=4*b/(b+15*A+3*S)||0,l=9*A/(b+15*A+3*S)||0;var ae=A/k;return o=ae<=q?H*ae:116*Math.pow(ae,1/3)-16,m=13*o*(a-Z),g=13*o*(l-te),[o,m,g]};var rI={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(s){var e=s[0],t=s[1],a=s[2],l,o,m;return m=a/360*2*Math.PI,l=t*Math.cos(m),o=t*Math.sin(m),[e,l,o]},xyz:function(s){return og.xyz(rI.luv(s))}},iI=rI;og.lchuv=function(s){var e=s[0],t=s[1],a=s[2],l=Math.sqrt(t*t+a*a),o=Math.atan2(a,t),m=o*360/2/Math.PI;return m<0&&(m+=360),[e,l,m]};Nn.lchuv=function(s){return og.lchuv(Nn.luv(s))};var M0=ao(oI(),1),aI=Sz,sI={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function Sz(s){var e,t=[],a=1,l;if(typeof s=="number")return{space:"rgb",values:[s>>>16,(s&65280)>>>8,s&255],alpha:1};if(typeof s=="number")return{space:"rgb",values:[s>>>16,(s&65280)>>>8,s&255],alpha:1};if(s=String(s).toLowerCase(),M0.default[s])t=M0.default[s].slice(),l="rgb";else if(s==="transparent")a=0,l="rgb",t=[0,0,0];else if(s[0]==="#"){var o=s.slice(1),m=o.length,g=m<=4;a=1,g?(t=[parseInt(o[0]+o[0],16),parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16)],m===4&&(a=parseInt(o[3]+o[3],16)/255)):(t=[parseInt(o[0]+o[1],16),parseInt(o[2]+o[3],16),parseInt(o[4]+o[5],16)],m===8&&(a=parseInt(o[6]+o[7],16)/255)),t[0]||(t[0]=0),t[1]||(t[1]=0),t[2]||(t[2]=0),l="rgb"}else if(e=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(s)){var b=e[1];l=b.replace(/a$/,"");var A=l==="cmyk"?4:l==="gray"?1:3;t=e[2].trim().split(/\s*[,\/]\s*|\s+/),l==="color"&&(l=t.shift()),t=t.map(function(S,M){if(S[S.length-1]==="%")return S=parseFloat(S)/100,M===3?S:l==="rgb"?S*255:l[0]==="h"||l[0]==="l"&&!M?S*100:l==="lab"?S*125:l==="lch"?M<2?S*150:S*360:l[0]==="o"&&!M?S:l==="oklab"?S*.4:l==="oklch"?M<2?S*.4:S*360:S;if(l[M]==="h"||M===2&&l[l.length-1]==="h"){if(sI[S]!==void 0)return sI[S];if(S.endsWith("deg"))return parseFloat(S);if(S.endsWith("turn"))return parseFloat(S)*360;if(S.endsWith("grad"))return parseFloat(S)*360/400;if(S.endsWith("rad"))return parseFloat(S)*180/Math.PI}return S==="none"?0:parseFloat(S)}),a=t.length>A?t.pop():1}else/[0-9](?:\s|\/|,)/.test(s)&&(t=s.match(/([0-9]+)/g).map(function(S){return parseFloat(S)}),l=s.match(/([a-z])/ig)?.join("")?.toLowerCase()||"rgb");return{space:l,values:t,alpha:a}}var sg={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(s){var e=s[0]/360,t=s[1]/100,a=s[2]/100,l,o,m,g,b,A=0;if(t===0)return b=a*255,[b,b,b];for(o=a<.5?a*(1+t):a+t-a*t,l=2*a-o,g=[0,0,0];A<3;)m=e+1/3*-(A-1),m<0?m++:m>1&&m--,b=6*m<1?l+(o-l)*6*m:2*m<1?o:3*m<2?l+(o-l)*(2/3-m)*6:l,g[A++]=b*255;return g}};ra.hsl=function(s){var e=s[0]/255,t=s[1]/255,a=s[2]/255,l=Math.min(e,t,a),o=Math.max(e,t,a),m=o-l,g,b,A;return o===l?g=0:e===o?g=(t-a)/m:t===o?g=2+(a-e)/m:a===o&&(g=4+(e-t)/m),g=Math.min(g*60,360),g<0&&(g+=360),A=(l+o)/2,o===l?b=0:A<=.5?b=m/(o+l):b=m/(2-o-l),[g,b*100,A*100]};function R0(s){Array.isArray(s)&&s.raw&&(s=String.raw(...arguments)),s instanceof Number&&(s=+s);var e,t,a,l=aI(s);if(!l.space)return[];let o=l.space[0]==="h"?sg.min:ra.min,m=l.space[0]==="h"?sg.max:ra.max;return e=Array(3),e[0]=Math.min(Math.max(l.values[0],o[0]),m[0]),e[1]=Math.min(Math.max(l.values[1],o[1]),m[1]),e[2]=Math.min(Math.max(l.values[2],o[2]),m[2]),l.space[0]==="h"&&(e=sg.rgb(e)),e.push(Math.min(Math.max(l.alpha,0),1)),e}function lI(s){return typeof s=="string"?s:Fd(s)}var Az=1024,kd={},k0=0;function cI(s){if(s.length===4)return s;let e=s.slice();return e[3]=1,e}function F0(s){let e=Nn.lchuv(ra.xyz(s));return e[3]=s[3],e}function uI(s){let e=Nn.rgb(iI.xyz(s));return e[3]=s[3],e}function ag(s){if(kd.hasOwnProperty(s))return kd[s];if(k0>=Az){let t=0;for(let a in kd)t++&3||(delete kd[a],--k0)}let e=R0(s);if(e.length!==4)throw new Error('Failed to parse "'+s+'" as color');for(let t of e)if(isNaN(t))throw new Error('Failed to parse "'+s+'" as color');return L0(e),kd[s]=e,++k0,e}function ia(s){return Array.isArray(s)?s:ag(s)}function L0(s){return s[0]=Br(s[0]+.5|0,0,255),s[1]=Br(s[1]+.5|0,0,255),s[2]=Br(s[2]+.5|0,0,255),s[3]=Br(s[3],0,1),s}function Fd(s){let e=s[0];e!=(e|0)&&(e=e+.5|0);let t=s[1];t!=(t|0)&&(t=t+.5|0);let a=s[2];a!=(a|0)&&(a=a+.5|0);let l=s[3]===void 0?1:Math.round(s[3]*1e3)/1e3;return"rgba("+e+","+t+","+a+","+l+")"}function hI(s){try{return ag(s),!0}catch{return!1}}function Ez(s,e){return new Promise((t,a)=>{function l(){m(),t(s)}function o(){m(),a(new Error("Image load error"))}function m(){s.removeEventListener("load",l),s.removeEventListener("error",o)}s.addEventListener("load",l),s.addEventListener("error",o),e&&(s.src=e)})}function pI(s,e){return e&&(s.src=e),s.src&&YE?new Promise((t,a)=>s.decode().then(()=>t(s)).catch(l=>s.complete&&s.width?t(s):a(l))):Ez(s)}var O0=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let a=this.cache_[t];!(e++&3)&&!a.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t,a){let l=D0(e,t,a);return l in this.cache_?this.cache_[l]:null}getPattern(e,t,a){let l=D0(e,t,a);return l in this.patternCache_?this.patternCache_[l]:null}set(e,t,a,l,o){let m=D0(e,t,a),g=m in this.cache_;this.cache_[m]=l,o&&(l.getImageState()===Mt.IDLE&&l.load(),l.getImageState()===Mt.LOADING?l.ready().then(()=>{this.patternCache_[m]=Cu().createPattern(l.getImage(1),"repeat")}):this.patternCache_[m]=Cu().createPattern(l.getImage(1),"repeat")),g||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function D0(s,e,t){let a=t?ia(t):"null";return e+":"+s+":"+a}var gs=new O0;var Ld=null,z0=class extends Om{constructor(e,t,a,l,o){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=a,this.canvas_={},this.color_=o,this.imageState_=l===void 0?Mt.IDLE:l,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Mt.LOADED){Ld||(Ld=Xr(1,1,void 0,{willReadFrequently:!0})),Ld.drawImage(this.image_,0,0);try{Ld.getImageData(0,0,1,1),this.tainted_=!1}catch{Ld=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Ir.CHANGE)}handleImageError_(){this.imageState_=Mt.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mt.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],a=Xr(e,t);a.fillRect(0,0,e,t),this.hitDetectionImage_=a.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Mt.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mt.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&pI(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Mt.LOADED)return;let t=this.image_,a=document.createElement("canvas");a.width=Math.ceil(t.width*e),a.height=Math.ceil(t.height*e);let l=a.getContext("2d");l.scale(e,e),l.drawImage(t,0,0),l.globalCompositeOperation="multiply",l.fillStyle=lI(this.color_),l.fillRect(0,0,a.width/e,a.height/e),l.globalCompositeOperation="destination-in",l.drawImage(t,0,0),this.canvas_[e]=a}ready(){return this.ready_||(this.ready_=new Promise(e=>{this.imageState_===Mt.LOADED||this.imageState_===Mt.ERROR?e():this.addEventListener(Ir.CHANGE,function t(){(this.imageState_===Mt.LOADED||this.imageState_===Mt.ERROR)&&(this.removeEventListener(Ir.CHANGE,t),e())})})),this.ready_}};function ku(s,e,t,a,l,o){let m=e===void 0?void 0:gs.get(e,t,l);return m||(m=new z0(s,s&&"src"in s?s.src||void 0:e,t,a,l),gs.set(e,t,l,m,o)),o&&m&&!gs.getPattern(e,t,l)&&gs.set(e,t,l,m,o),m}var B0=class s{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new s({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=ku(null,e.src,"anonymous",void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Mt.IDLE&&t.load(),t.getImageState()===Mt.LOADING&&(this.patternImage_=t)}this.color_=e}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},qi=B0;var N0=class s{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}clone(){let e=this.getColor();return new s({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setWidth(e){this.width_=e}},ai=N0;function Wa(s,e){return Array.isArray(s)?s:(e===void 0?e=[s,s]:(e[0]=s,e[1]=s),e)}var j0=class s{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Wa(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new s({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return Pt()}getImage(e){return Pt()}getHitDetectionImage(){return Pt()}getPixelRatio(e){return 1}getImageState(){return Pt()}getImageSize(){return Pt()}getOrigin(){return Pt()}getSize(){return Pt()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Wa(e)}listenImageChange(e){Pt()}load(){Pt()}unlistenImageChange(e){Pt()}ready(){return Promise.resolve()}},lg=j0;function jn(s){return s?Array.isArray(s)?Fd(s):typeof s=="object"&&"src"in s?Iz(s):s:null}function Iz(s){if(!s.offset||!s.size)return gs.getPattern(s.src,"anonymous",s.color);let e=s.src+":"+s.offset,t=gs.getPattern(e,void 0,s.color);if(t)return t;let a=gs.get(s.src,"anonymous",null);if(a.getImageState()!==Mt.LOADED)return null;let l=Xr(s.size[0],s.size[1]);return l.drawImage(a.getImage(1),s.offset[0],s.offset[1],s.size[0],s.size[1],0,0,s.size[0],s.size[1]),ku(l.canvas,e,void 0,Mt.LOADED,s.color,!0),gs.getPattern(e,void 0,s.color)}var Pz=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),dI=["style","variant","weight","size","lineHeight","family"],U0=function(s){let e=s.match(Pz);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let a=0,l=dI.length;a<l;++a){let o=e[a+1];o!==void 0&&(t[dI[a]]=o)}return t.families=t.family.split(/,\s?/),t};var ug="10px sans-serif",li="#000",ys="round",Un=[],Gn=0,_s="round",na=10,oa="#000",Xa="center",Hl="middle",sa=[0,0,0,0],aa=1,Za=new Si,Fu=null,G0,V0={},fI=function(){let e="32px ",t=["monospace","serif"],a=t.length,l="wmytzilWMYTZIL@#/&?$%10\uF013",o,m;function g(A,S,M){let k=!0;for(let j=0;j<a;++j){let Z=t[j];if(m=cg(A+" "+S+" "+e+Z,l),M!=Z){let te=cg(A+" "+S+" "+e+M+","+Z,l);k=k&&te!=m}}return!!k}function b(){let A=!0,S=Za.getKeys();for(let M=0,k=S.length;M<k;++M){let j=S[M];Za.get(j)<100&&(g.apply(this,j.split(`
580
+ `+e.prev}function iy(s,e){var t=w1(s),a=[];if(t){a.length=s.length;for(var l=0;l<s.length;l++)a[l]=tl(s,l)?e(s[l],s):""}var o=typeof y1=="function"?y1(s):[],m;if(Ah){m={};for(var g=0;g<o.length;g++)m["$"+o[g]]=o[g]}for(var b in s)tl(s,b)&&(t&&String(Number(b))===b&&b<s.length||Ah&&m["$"+b]instanceof Symbol||(RM.call(/[^\w$]/,b)?a.push(e(b,s)+": "+e(s[b],s)):a.push(b+": "+e(s[b],s))));if(typeof y1=="function")for(var A=0;A<o.length;A++)kM.call(s,o[A])&&a.push("["+e(o[A])+"]: "+e(s[o[A]],s));return a}});var C1=ke((zie,NM)=>{"use strict";var P1=yM(),Eh=Po(),ej=BM(),tj=P1("%TypeError%"),sy=P1("%WeakMap%",!0),ay=P1("%Map%",!0),rj=Eh("WeakMap.prototype.get",!0),ij=Eh("WeakMap.prototype.set",!0),nj=Eh("WeakMap.prototype.has",!0),oj=Eh("Map.prototype.get",!0),sj=Eh("Map.prototype.set",!0),aj=Eh("Map.prototype.has",!0),T1=function(s,e){for(var t=s,a;(a=t.next)!==null;t=a)if(a.key===e)return t.next=a.next,a.next=s.next,s.next=a,a},lj=function(s,e){var t=T1(s,e);return t&&t.value},cj=function(s,e,t){var a=T1(s,e);a?a.value=t:s.next={key:e,next:s.next,value:t}},uj=function(s,e){return!!T1(s,e)};NM.exports=function(){var e,t,a,l={assert:function(o){if(!l.has(o))throw new tj("Side channel does not contain "+ej(o))},get:function(o){if(sy&&o&&(typeof o=="object"||typeof o=="function")){if(e)return rj(e,o)}else if(ay){if(t)return oj(t,o)}else if(a)return lj(a,o)},has:function(o){if(sy&&o&&(typeof o=="object"||typeof o=="function")){if(e)return nj(e,o)}else if(ay){if(t)return aj(t,o)}else if(a)return uj(a,o);return!1},set:function(o,m){sy&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new sy),ij(e,o,m)):ay?(t||(t=new ay),sj(t,o,m)):(a||(a={key:{},next:null}),cj(a,o,m))}};return l}});var UM=ke((Bie,jM)=>{"use strict";var hj=qb(),gf=C1()(),fa=Qa(),M1={assert:function(s,e){if(!s||typeof s!="object"&&typeof s!="function")throw new fa("`O` is not an object");if(typeof e!="string")throw new fa("`slot` must be a string");if(gf.assert(s),!M1.has(s,e))throw new fa("`"+e+"` is not present on `O`")},get:function(s,e){if(!s||typeof s!="object"&&typeof s!="function")throw new fa("`O` is not an object");if(typeof e!="string")throw new fa("`slot` must be a string");var t=gf.get(s);return t&&t["$"+e]},has:function(s,e){if(!s||typeof s!="object"&&typeof s!="function")throw new fa("`O` is not an object");if(typeof e!="string")throw new fa("`slot` must be a string");var t=gf.get(s);return!!t&&hj(t,"$"+e)},set:function(s,e,t){if(!s||typeof s!="object"&&typeof s!="function")throw new fa("`O` is not an object");if(typeof e!="string")throw new fa("`slot` must be a string");var a=gf.get(s);a||(a={},gf.set(s,a)),a["$"+e]=t}};Object.freeze&&Object.freeze(M1);jM.exports=M1});var qM=ke((Nie,VM)=>{"use strict";var yf=UM(),pj=SyntaxError,GM=typeof StopIteration=="object"?StopIteration:null;VM.exports=function(e){if(!GM)throw new pj("this environment lacks StopIteration");yf.set(e,"[[Done]]",!1);var t={next:function(){var l=yf.get(this,"[[Iterator]]"),o=yf.get(l,"[[Done]]");try{return{done:o,value:o?void 0:l.next()}}catch(m){if(yf.set(l,"[[Done]]",!0),m!==GM)throw m;return{done:!0,value:void 0}}}};return yf.set(t,"[[Iterator]]",e),t}});var R1=ke((jie,$M)=>{var dj={}.toString;$M.exports=Array.isArray||function(s){return dj.call(s)=="[object Array]"}});var k1=ke((Uie,WM)=>{"use strict";var fj=String.prototype.valueOf,mj=function(e){try{return fj.call(e),!0}catch{return!1}},gj=Object.prototype.toString,yj="[object String]",_j=el()();WM.exports=function(e){return typeof e=="string"?!0:typeof e!="object"?!1:_j?mj(e):gj.call(e)===yj}});var XM=ke((Gie,ZM)=>{"use strict";var xj="Function.prototype.bind called on incompatible ",F1=Array.prototype.slice,vj=Object.prototype.toString,bj="[object Function]";ZM.exports=function(e){var t=this;if(typeof t!="function"||vj.call(t)!==bj)throw new TypeError(xj+t);for(var a=F1.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(F1.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(F1.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var KM=ke((Vie,HM)=>{"use strict";var wj=XM();HM.exports=Function.prototype.bind||wj});var rR=ke((qie,tR)=>{"use strict";var Jt,Ch=SyntaxError,eR=Function,Th=TypeError,L1=function(s){try{return eR('"use strict"; return ('+s+").constructor;")()}catch{}},yc=Object.getOwnPropertyDescriptor;if(yc)try{yc({},"")}catch{yc=null}var D1=function(){throw new Th},Sj=yc?function(){try{return arguments.callee,D1}catch{try{return yc(arguments,"callee").get}catch{return D1}}}():D1,Ih=ho()(),Rs=Object.getPrototypeOf||function(s){return s.__proto__},Ph={},Aj=typeof Uint8Array>"u"?Jt:Rs(Uint8Array),_c={"%AggregateError%":typeof AggregateError>"u"?Jt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Jt:ArrayBuffer,"%ArrayIteratorPrototype%":Ih?Rs([][Symbol.iterator]()):Jt,"%AsyncFromSyncIteratorPrototype%":Jt,"%AsyncFunction%":Ph,"%AsyncGenerator%":Ph,"%AsyncGeneratorFunction%":Ph,"%AsyncIteratorPrototype%":Ph,"%Atomics%":typeof Atomics>"u"?Jt:Atomics,"%BigInt%":typeof BigInt>"u"?Jt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Jt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Jt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Jt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Jt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Jt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Jt:FinalizationRegistry,"%Function%":eR,"%GeneratorFunction%":Ph,"%Int8Array%":typeof Int8Array>"u"?Jt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Jt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Jt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ih?Rs(Rs([][Symbol.iterator]())):Jt,"%JSON%":typeof JSON=="object"?JSON:Jt,"%Map%":typeof Map>"u"?Jt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ih?Jt:Rs(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Jt:Promise,"%Proxy%":typeof Proxy>"u"?Jt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Jt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Jt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ih?Jt:Rs(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Jt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ih?Rs(""[Symbol.iterator]()):Jt,"%Symbol%":Ih?Symbol:Jt,"%SyntaxError%":Ch,"%ThrowTypeError%":Sj,"%TypedArray%":Aj,"%TypeError%":Th,"%Uint8Array%":typeof Uint8Array>"u"?Jt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Jt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Jt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Jt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Jt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Jt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Jt:WeakSet};try{null.error}catch(s){YM=Rs(Rs(s)),_c["%Error.prototype%"]=YM}var YM,Ej=function s(e){var t;if(e==="%AsyncFunction%")t=L1("async function () {}");else if(e==="%GeneratorFunction%")t=L1("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=L1("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&(t=Rs(l.prototype))}return _c[e]=t,t},JM={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},_f=KM(),ly=As(),Ij=_f.call(Function.call,Array.prototype.concat),Pj=_f.call(Function.apply,Array.prototype.splice),QM=_f.call(Function.call,String.prototype.replace),cy=_f.call(Function.call,String.prototype.slice),Tj=_f.call(Function.call,RegExp.prototype.exec),Cj=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Mj=/\\(\\)?/g,Rj=function(e){var t=cy(e,0,1),a=cy(e,-1);if(t==="%"&&a!=="%")throw new Ch("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new Ch("invalid intrinsic syntax, expected opening `%`");var l=[];return QM(e,Cj,function(o,m,g,b){l[l.length]=g?QM(b,Mj,"$1"):m||o}),l},kj=function(e,t){var a=e,l;if(ly(JM,a)&&(l=JM[a],a="%"+l[0]+"%"),ly(_c,a)){var o=_c[a];if(o===Ph&&(o=Ej(a)),typeof o>"u"&&!t)throw new Th("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new Ch("intrinsic "+e+" does not exist!")};tR.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Th("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Th('"allowMissing" argument must be a boolean');if(Tj(/^%?[^%]*%?$/,e)===null)throw new Ch("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=Rj(e),l=a.length>0?a[0]:"",o=kj("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],Pj(a,Ij([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=cy(k,0,1),Z=cy(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new Ch("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",ly(_c,m))g=_c[m];else if(g!=null){if(!(k in g)){if(!t)throw new Th("base intrinsic for "+e+" exists, but the property is not available.");return}if(yc&&S+1>=a.length){var te=yc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=ly(g,k),g=g[k];M&&!b&&(_c[m]=g)}}return g}});var sR=ke(($ie,oR)=>{"use strict";var O1=typeof Map=="function"&&Map.prototype?Map:null,Fj=typeof Set=="function"&&Set.prototype?Set:null,uy;O1||(uy=function(e){return!1});var nR=O1?Map.prototype.has:null,iR=Fj?Set.prototype.has:null;!uy&&!nR&&(uy=function(e){return!1});oR.exports=uy||function(e){if(!e||typeof e!="object")return!1;try{if(nR.call(e),iR)try{iR.call(e)}catch{return!0}return e instanceof O1}catch{}return!1}});var uR=ke((Wie,cR)=>{"use strict";var Lj=typeof Map=="function"&&Map.prototype?Map:null,z1=typeof Set=="function"&&Set.prototype?Set:null,hy;z1||(hy=function(e){return!1});var aR=Lj?Map.prototype.has:null,lR=z1?Set.prototype.has:null;!hy&&!lR&&(hy=function(e){return!1});cR.exports=hy||function(e){if(!e||typeof e!="object")return!1;try{if(lR.call(e),aR)try{aR.call(e)}catch{return!0}return e instanceof z1}catch{}return!1}});var wR=ke((Zie,fy)=>{"use strict";var hR=h1(),pR=qM();ho()()||Uu()()?(py=Symbol.iterator,fy.exports=function(e){if(e!=null&&typeof e[py]<"u")return e[py]();if(hR(e))return Array.prototype[py].call(e)}):(dR=R1(),fR=k1(),B1=rR(),mR=B1("%Map%",!0),gR=B1("%Set%",!0),To=Po(),N1=To("Array.prototype.push"),j1=To("String.prototype.charCodeAt"),yR=To("String.prototype.slice"),_R=function(e,t){var a=e.length;if(t+1>=a)return t+1;var l=j1(e,t);if(l<55296||l>56319)return t+1;var o=j1(e,t+1);return o<56320||o>57343?t+1:t+2},dy=function(e){var t=0;return{next:function(){var l=t>=e.length,o;return l||(o=e[t],t+=1),{done:l,value:o}}}},U1=function(e,t){if(dR(e)||hR(e))return dy(e);if(fR(e)){var a=0;return{next:function(){var o=_R(e,a),m=yR(e,a,o);return a=o,{done:o>e.length,value:m}}}}if(t&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()},!mR&&!gR?fy.exports=function(e){if(e!=null)return U1(e,!0)}:(xR=sR(),vR=uR(),G1=To("Map.prototype.forEach",!0),V1=To("Set.prototype.forEach",!0),(typeof process>"u"||!process.versions||!process.versions.node)&&(q1=To("Map.prototype.iterator",!0),$1=To("Set.prototype.iterator",!0)),W1=To("Map.prototype.@@iterator",!0)||To("Map.prototype._es6-shim iterator_",!0),Z1=To("Set.prototype.@@iterator",!0)||To("Set.prototype._es6-shim iterator_",!0),bR=function(e){if(xR(e)){if(q1)return pR(q1(e));if(W1)return W1(e);if(G1){var t=[];return G1(e,function(l,o){N1(t,[o,l])}),dy(t)}}if(vR(e)){if($1)return pR($1(e));if(Z1)return Z1(e);if(V1){var a=[];return V1(e,function(l){N1(a,l)}),dy(a)}}},fy.exports=function(e){return bR(e)||U1(e)}));var py,dR,fR,B1,mR,gR,To,N1,j1,yR,_R,dy,U1,xR,vR,G1,V1,q1,$1,W1,Z1,bR});var TR=ke((Xie,my)=>{"use strict";var X1=Yu(),gy=da(),Dj=Wg(),Oj=Qa(),ER=gy("%Function.prototype.apply%"),IR=gy("%Function.prototype.call%"),PR=gy("%Reflect.apply%",!0)||X1.call(IR,ER),SR=rh(),zj=gy("%Math.max%");my.exports=function(e){if(typeof e!="function")throw new Oj("a function is required");var t=PR(X1,IR,arguments);return Dj(t,1+zj(0,e.length-(arguments.length-1)),!0)};var AR=function(){return PR(X1,ER,arguments)};SR?SR(my.exports,"apply",{value:AR}):my.exports.apply=AR});var H1=ke((Hie,MR)=>{"use strict";var CR=function(s){return s!==s};MR.exports=function(e,t){return e===0&&t===0?1/e===1/t:!!(e===t||CR(e)&&CR(t))}});var K1=ke((Kie,RR)=>{"use strict";var Bj=H1();RR.exports=function(){return typeof Object.is=="function"?Object.is:Bj}});var FR=ke((Yie,kR)=>{"use strict";var Nj=K1(),jj=fh();kR.exports=function(){var e=Nj();return jj(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var zR=ke((Jie,OR)=>{"use strict";var Uj=fh(),Gj=TR(),Vj=H1(),LR=K1(),qj=FR(),DR=Gj(LR(),Object);Uj(DR,{getPolyfill:LR,implementation:Vj,shim:qj});OR.exports=DR});var NR=ke((Qie,BR)=>{"use strict";var $j="Function.prototype.bind called on incompatible ",Y1=Array.prototype.slice,Wj=Object.prototype.toString,Zj="[object Function]";BR.exports=function(e){var t=this;if(typeof t!="function"||Wj.call(t)!==Zj)throw new TypeError($j+t);for(var a=Y1.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(Y1.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(Y1.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var UR=ke((ene,jR)=>{"use strict";var Xj=NR();jR.exports=Function.prototype.bind||Xj});var ZR=ke((tne,WR)=>{"use strict";var Qt,Fh=SyntaxError,$R=Function,kh=TypeError,J1=function(s){try{return $R('"use strict"; return ('+s+").constructor;")()}catch{}},xc=Object.getOwnPropertyDescriptor;if(xc)try{xc({},"")}catch{xc=null}var Q1=function(){throw new kh},Hj=xc?function(){try{return arguments.callee,Q1}catch{try{return xc(arguments,"callee").get}catch{return Q1}}}():Q1,Mh=ho()(),ks=Object.getPrototypeOf||function(s){return s.__proto__},Rh={},Kj=typeof Uint8Array>"u"?Qt:ks(Uint8Array),vc={"%AggregateError%":typeof AggregateError>"u"?Qt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Qt:ArrayBuffer,"%ArrayIteratorPrototype%":Mh?ks([][Symbol.iterator]()):Qt,"%AsyncFromSyncIteratorPrototype%":Qt,"%AsyncFunction%":Rh,"%AsyncGenerator%":Rh,"%AsyncGeneratorFunction%":Rh,"%AsyncIteratorPrototype%":Rh,"%Atomics%":typeof Atomics>"u"?Qt:Atomics,"%BigInt%":typeof BigInt>"u"?Qt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Qt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Qt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Qt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Qt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Qt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Qt:FinalizationRegistry,"%Function%":$R,"%GeneratorFunction%":Rh,"%Int8Array%":typeof Int8Array>"u"?Qt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Qt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Qt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Mh?ks(ks([][Symbol.iterator]())):Qt,"%JSON%":typeof JSON=="object"?JSON:Qt,"%Map%":typeof Map>"u"?Qt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Mh?Qt:ks(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Qt:Promise,"%Proxy%":typeof Proxy>"u"?Qt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Qt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Qt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Mh?Qt:ks(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Qt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Mh?ks(""[Symbol.iterator]()):Qt,"%Symbol%":Mh?Symbol:Qt,"%SyntaxError%":Fh,"%ThrowTypeError%":Hj,"%TypedArray%":Kj,"%TypeError%":kh,"%Uint8Array%":typeof Uint8Array>"u"?Qt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Qt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Qt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Qt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Qt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Qt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Qt:WeakSet};try{null.error}catch(s){GR=ks(ks(s)),vc["%Error.prototype%"]=GR}var GR,Yj=function s(e){var t;if(e==="%AsyncFunction%")t=J1("async function () {}");else if(e==="%GeneratorFunction%")t=J1("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=J1("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&(t=ks(l.prototype))}return vc[e]=t,t},VR={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},xf=UR(),yy=As(),Jj=xf.call(Function.call,Array.prototype.concat),Qj=xf.call(Function.apply,Array.prototype.splice),qR=xf.call(Function.call,String.prototype.replace),_y=xf.call(Function.call,String.prototype.slice),eU=xf.call(Function.call,RegExp.prototype.exec),tU=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,rU=/\\(\\)?/g,iU=function(e){var t=_y(e,0,1),a=_y(e,-1);if(t==="%"&&a!=="%")throw new Fh("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new Fh("invalid intrinsic syntax, expected opening `%`");var l=[];return qR(e,tU,function(o,m,g,b){l[l.length]=g?qR(b,rU,"$1"):m||o}),l},nU=function(e,t){var a=e,l;if(yy(VR,a)&&(l=VR[a],a="%"+l[0]+"%"),yy(vc,a)){var o=vc[a];if(o===Rh&&(o=Yj(a)),typeof o>"u"&&!t)throw new kh("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new Fh("intrinsic "+e+" does not exist!")};WR.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new kh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new kh('"allowMissing" argument must be a boolean');if(eU(/^%?[^%]*%?$/,e)===null)throw new Fh("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=iU(e),l=a.length>0?a[0]:"",o=nU("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],Qj(a,Jj([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=_y(k,0,1),Z=_y(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new Fh("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",yy(vc,m))g=vc[m];else if(g!=null){if(!(k in g)){if(!t)throw new kh("base intrinsic for "+e+" exists, but the property is not available.");return}if(xc&&S+1>=a.length){var te=xc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=yy(g,k),g=g[k];M&&!b&&(vc[m]=g)}}return g}});var YR=ke((rne,KR)=>{"use strict";var HR=Function.prototype.toString,Lh=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,tw,xy;if(typeof Lh=="function"&&typeof Object.defineProperty=="function")try{tw=Object.defineProperty({},"length",{get:function(){throw xy}}),xy={},Lh(function(){throw 42},null,tw)}catch(s){s!==xy&&(Lh=null)}else Lh=null;var oU=/^\s*class\b/,rw=function(e){try{var t=HR.call(e);return oU.test(t)}catch{return!1}},ew=function(e){try{return rw(e)?!1:(HR.call(e),!0)}catch{return!1}},vy=Object.prototype.toString,sU="[object Object]",aU="[object Function]",lU="[object GeneratorFunction]",cU="[object HTMLAllCollection]",uU="[object HTML document.all class]",hU="[object HTMLCollection]",pU=typeof Symbol=="function"&&!!Symbol.toStringTag,dU=!(0 in[,]),iw=function(){return!1};typeof document=="object"&&(XR=document.all,vy.call(XR)===vy.call(document.all)&&(iw=function(e){if((dU||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=vy.call(e);return(t===cU||t===uU||t===hU||t===sU)&&e("")==null}catch{}return!1}));var XR;KR.exports=Lh?function(e){if(iw(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Lh(e,null,tw)}catch(t){if(t!==xy)return!1}return!rw(e)&&ew(e)}:function(e){if(iw(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(pU)return ew(e);if(rw(e))return!1;var t=vy.call(e);return t!==aU&&t!==lU&&!/^\[object HTML/.test(t)?!1:ew(e)}});var nw=ke((ine,QR)=>{"use strict";var fU=YR(),mU=Object.prototype.toString,JR=Object.prototype.hasOwnProperty,gU=function(e,t,a){for(var l=0,o=e.length;l<o;l++)JR.call(e,l)&&(a==null?t(e[l],l,e):t.call(a,e[l],l,e))},yU=function(e,t,a){for(var l=0,o=e.length;l<o;l++)a==null?t(e.charAt(l),l,e):t.call(a,e.charAt(l),l,e)},_U=function(e,t,a){for(var l in e)JR.call(e,l)&&(a==null?t(e[l],l,e):t.call(a,e[l],l,e))},xU=function(e,t,a){if(!fU(t))throw new TypeError("iterator must be a function");var l;arguments.length>=3&&(l=a),mU.call(e)==="[object Array]"?gU(e,t,l):typeof e=="string"?yU(e,t,l):_U(e,t,l)};QR.exports=xU});var tk=ke((nne,ek)=>{"use strict";var ow=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],vU=typeof globalThis>"u"?global:globalThis;ek.exports=function(){for(var e=[],t=0;t<ow.length;t++)typeof vU[ow[t]]=="function"&&(e[e.length]=ow[t]);return e}});var ak=ke((one,sk)=>{"use strict";var rk=nw(),bU=tk(),aw=Po(),wU=aw("Object.prototype.toString"),ik=el()(),by=ah(),SU=typeof globalThis>"u"?global:globalThis,nk=bU(),AU=aw("Array.prototype.indexOf",!0)||function(e,t){for(var a=0;a<e.length;a+=1)if(e[a]===t)return a;return-1},EU=aw("String.prototype.slice"),ok={},sw=Object.getPrototypeOf;ik&&by&&sw&&rk(nk,function(s){var e=new SU[s];if(Symbol.toStringTag in e){var t=sw(e),a=by(t,Symbol.toStringTag);if(!a){var l=sw(t);a=by(l,Symbol.toStringTag)}ok[s]=a.get}});var IU=function(e){var t=!1;return rk(ok,function(a,l){if(!t)try{t=a.call(e)===l}catch{}}),t};sk.exports=function(e){if(!e||typeof e!="object")return!1;if(!ik||!(Symbol.toStringTag in e)){var t=EU(wU(e),8,-1);return AU(nk,t)>-1}return by?IU(e):!1}});var lw=ke((sne,dk)=>{"use strict";var PU=Ng(),TU=Po(),pk=ZR(),CU=ak(),lk=pk("ArrayBuffer",!0),ck=pk("Float32Array",!0),wy=TU("ArrayBuffer.prototype.byteLength",!0),uk=lk&&!wy&&new lk().slice,hk=uk&&PU(uk);dk.exports=wy||hk?function(e){if(!e||typeof e!="object")return!1;try{return wy?wy(e):hk(e,0),!0}catch{return!1}}:ck?function(e){try{return new ck(e).buffer===e&&!CU(e)}catch(t){return typeof e=="object"&&t.name==="RangeError"}}:function(e){return!1}});var mk=ke((ane,fk)=>{"use strict";var MU=Date.prototype.getDay,RU=function(e){try{return MU.call(e),!0}catch{return!1}},kU=Object.prototype.toString,FU="[object Date]",LU=el()();fk.exports=function(e){return typeof e!="object"||e===null?!1:LU?RU(e):kU.call(e)===FU}});var vk=ke((lne,xk)=>{"use strict";var cw=Po(),gk=el()(),yk,_k,uw,hw;gk&&(yk=cw("Object.prototype.hasOwnProperty"),_k=cw("RegExp.prototype.exec"),uw={},Sy=function(){throw uw},hw={toString:Sy,valueOf:Sy},typeof Symbol.toPrimitive=="symbol"&&(hw[Symbol.toPrimitive]=Sy));var Sy,DU=cw("Object.prototype.toString"),OU=Object.getOwnPropertyDescriptor,zU="[object RegExp]";xk.exports=gk?function(e){if(!e||typeof e!="object")return!1;var t=OU(e,"lastIndex"),a=t&&yk(t,"value");if(!a)return!1;try{_k(e,hw)}catch(l){return l===uw}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:DU(e)===zU}});var Sk=ke((cne,wk)=>{"use strict";var BU=Po(),bk=BU("SharedArrayBuffer.prototype.byteLength",!0);wk.exports=bk?function(e){if(!e||typeof e!="object")return!1;try{return bk(e),!0}catch{return!1}}:function(e){return!1}});var Ek=ke((une,Ak)=>{"use strict";var NU=Number.prototype.toString,jU=function(e){try{return NU.call(e),!0}catch{return!1}},UU=Object.prototype.toString,GU="[object Number]",VU=el()();Ak.exports=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:VU?jU(e):UU.call(e)===GU}});var Tk=ke((hne,Pk)=>{"use strict";var Ik=Po(),qU=Ik("Boolean.prototype.toString"),$U=Ik("Object.prototype.toString"),WU=function(e){try{return qU(e),!0}catch{return!1}},ZU="[object Boolean]",XU=el()();Pk.exports=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:XU&&Symbol.toStringTag in e?WU(e):$U(e)===ZU}});var kk=ke((pne,pw)=>{"use strict";var HU=Object.prototype.toString,KU=ho()();KU?(Ck=Symbol.prototype.toString,Mk=/^Symbol\(.*\)$/,Rk=function(e){return typeof e.valueOf()!="symbol"?!1:Mk.test(Ck.call(e))},pw.exports=function(e){if(typeof e=="symbol")return!0;if(HU.call(e)!=="[object Symbol]")return!1;try{return Rk(e)}catch{return!1}}):pw.exports=function(e){return!1};var Ck,Mk,Rk});var Dk=ke((dne,Lk)=>{"use strict";var Fk=typeof BigInt<"u"&&BigInt;Lk.exports=function(){return typeof Fk=="function"&&typeof BigInt=="function"&&typeof Fk(42)=="bigint"&&typeof BigInt(42)=="bigint"}});var Bk=ke((fne,dw)=>{"use strict";var YU=Dk()();YU?(Ok=BigInt.prototype.valueOf,zk=function(e){try{return Ok.call(e),!0}catch{}return!1},dw.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:zk(e)}):dw.exports=function(e){return!1};var Ok,zk});var jk=ke((mne,Nk)=>{"use strict";var JU=k1(),QU=Ek(),eG=Tk(),tG=kk(),rG=Bk();Nk.exports=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(JU(e))return"String";if(QU(e))return"Number";if(eG(e))return"Boolean";if(tG(e))return"Symbol";if(rG(e))return"BigInt"}});var qk=ke((gne,Vk)=>{"use strict";var fw=typeof Map=="function"&&Map.prototype?Map:null,iG=typeof Set=="function"&&Set.prototype?Set:null,Ay;fw||(Ay=function(e){return!1});var Gk=fw?Map.prototype.has:null,Uk=iG?Set.prototype.has:null;!Ay&&!Gk&&(Ay=function(e){return!1});Vk.exports=Ay||function(e){if(!e||typeof e!="object")return!1;try{if(Gk.call(e),Uk)try{Uk.call(e)}catch{return!0}return e instanceof fw}catch{}return!1}});var Xk=ke((yne,Zk)=>{"use strict";var nG=typeof Map=="function"&&Map.prototype?Map:null,mw=typeof Set=="function"&&Set.prototype?Set:null,Ey;mw||(Ey=function(e){return!1});var $k=nG?Map.prototype.has:null,Wk=mw?Set.prototype.has:null;!Ey&&!Wk&&(Ey=function(e){return!1});Zk.exports=Ey||function(e){if(!e||typeof e!="object")return!1;try{if(Wk.call(e),$k)try{$k.call(e)}catch{return!0}return e instanceof mw}catch{}return!1}});var Yk=ke((_ne,Kk)=>{"use strict";var Iy=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Hk=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Py;Iy||(Py=function(e){return!1});var yw=Iy?Iy.prototype.has:null,gw=Hk?Hk.prototype.has:null;!Py&&!yw&&(Py=function(e){return!1});Kk.exports=Py||function(e){if(!e||typeof e!="object")return!1;try{if(yw.call(e,yw),gw)try{gw.call(e,gw)}catch{return!0}return e instanceof Iy}catch{}return!1}});var Qk=ke((xne,Jk)=>{"use strict";var oG="Function.prototype.bind called on incompatible ",_w=Array.prototype.slice,sG=Object.prototype.toString,aG="[object Function]";Jk.exports=function(e){var t=this;if(typeof t!="function"||sG.call(t)!==aG)throw new TypeError(oG+t);for(var a=_w.call(arguments,1),l,o=function(){if(this instanceof l){var S=t.apply(this,a.concat(_w.call(arguments)));return Object(S)===S?S:this}else return t.apply(e,a.concat(_w.call(arguments)))},m=Math.max(0,t.length-a.length),g=[],b=0;b<m;b++)g.push("$"+b);if(l=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var A=function(){};A.prototype=t.prototype,l.prototype=new A,A.prototype=null}return l}});var tF=ke((vne,eF)=>{"use strict";var lG=Qk();eF.exports=Function.prototype.bind||lG});var aF=ke((bne,sF)=>{"use strict";var er,Bh=SyntaxError,oF=Function,zh=TypeError,xw=function(s){try{return oF('"use strict"; return ('+s+").constructor;")()}catch{}},bc=Object.getOwnPropertyDescriptor;if(bc)try{bc({},"")}catch{bc=null}var vw=function(){throw new zh},cG=bc?function(){try{return arguments.callee,vw}catch{try{return bc(arguments,"callee").get}catch{return vw}}}():vw,Dh=ho()(),Fs=Object.getPrototypeOf||function(s){return s.__proto__},Oh={},uG=typeof Uint8Array>"u"?er:Fs(Uint8Array),wc={"%AggregateError%":typeof AggregateError>"u"?er:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?er:ArrayBuffer,"%ArrayIteratorPrototype%":Dh?Fs([][Symbol.iterator]()):er,"%AsyncFromSyncIteratorPrototype%":er,"%AsyncFunction%":Oh,"%AsyncGenerator%":Oh,"%AsyncGeneratorFunction%":Oh,"%AsyncIteratorPrototype%":Oh,"%Atomics%":typeof Atomics>"u"?er:Atomics,"%BigInt%":typeof BigInt>"u"?er:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?er:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?er:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?er:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?er:Float32Array,"%Float64Array%":typeof Float64Array>"u"?er:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?er:FinalizationRegistry,"%Function%":oF,"%GeneratorFunction%":Oh,"%Int8Array%":typeof Int8Array>"u"?er:Int8Array,"%Int16Array%":typeof Int16Array>"u"?er:Int16Array,"%Int32Array%":typeof Int32Array>"u"?er:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Dh?Fs(Fs([][Symbol.iterator]())):er,"%JSON%":typeof JSON=="object"?JSON:er,"%Map%":typeof Map>"u"?er:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Dh?er:Fs(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?er:Promise,"%Proxy%":typeof Proxy>"u"?er:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?er:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?er:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Dh?er:Fs(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?er:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Dh?Fs(""[Symbol.iterator]()):er,"%Symbol%":Dh?Symbol:er,"%SyntaxError%":Bh,"%ThrowTypeError%":cG,"%TypedArray%":uG,"%TypeError%":zh,"%Uint8Array%":typeof Uint8Array>"u"?er:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?er:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?er:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?er:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?er:WeakMap,"%WeakRef%":typeof WeakRef>"u"?er:WeakRef,"%WeakSet%":typeof WeakSet>"u"?er:WeakSet};try{null.error}catch(s){rF=Fs(Fs(s)),wc["%Error.prototype%"]=rF}var rF,hG=function s(e){var t;if(e==="%AsyncFunction%")t=xw("async function () {}");else if(e==="%GeneratorFunction%")t=xw("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=xw("async function* () {}");else if(e==="%AsyncGenerator%"){var a=s("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=s("%AsyncGenerator%");l&&(t=Fs(l.prototype))}return wc[e]=t,t},iF={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},vf=tF(),Ty=As(),pG=vf.call(Function.call,Array.prototype.concat),dG=vf.call(Function.apply,Array.prototype.splice),nF=vf.call(Function.call,String.prototype.replace),Cy=vf.call(Function.call,String.prototype.slice),fG=vf.call(Function.call,RegExp.prototype.exec),mG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,gG=/\\(\\)?/g,yG=function(e){var t=Cy(e,0,1),a=Cy(e,-1);if(t==="%"&&a!=="%")throw new Bh("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new Bh("invalid intrinsic syntax, expected opening `%`");var l=[];return nF(e,mG,function(o,m,g,b){l[l.length]=g?nF(b,gG,"$1"):m||o}),l},_G=function(e,t){var a=e,l;if(Ty(iF,a)&&(l=iF[a],a="%"+l[0]+"%"),Ty(wc,a)){var o=wc[a];if(o===Oh&&(o=hG(a)),typeof o>"u"&&!t)throw new zh("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:a,value:o}}throw new Bh("intrinsic "+e+" does not exist!")};sF.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new zh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new zh('"allowMissing" argument must be a boolean');if(fG(/^%?[^%]*%?$/,e)===null)throw new Bh("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=yG(e),l=a.length>0?a[0]:"",o=_G("%"+l+"%",t),m=o.name,g=o.value,b=!1,A=o.alias;A&&(l=A[0],dG(a,pG([0,1],A)));for(var S=1,M=!0;S<a.length;S+=1){var k=a[S],j=Cy(k,0,1),Z=Cy(k,-1);if((j==='"'||j==="'"||j==="`"||Z==='"'||Z==="'"||Z==="`")&&j!==Z)throw new Bh("property names with quotes must have matching quotes");if((k==="constructor"||!M)&&(b=!0),l+="."+k,m="%"+l+"%",Ty(wc,m))g=wc[m];else if(g!=null){if(!(k in g)){if(!t)throw new zh("base intrinsic for "+e+" exists, but the property is not available.");return}if(bc&&S+1>=a.length){var te=bc(g,k);M=!!te,M&&"get"in te&&!("originalValue"in te.get)?g=te.get:g=g[k]}else M=Ty(g,k),g=g[k];M&&!b&&(wc[m]=g)}}return g}});var cF=ke((wne,ww)=>{"use strict";var xG=aF(),lF=Po(),vG=xG("%WeakSet%",!0),bw=lF("WeakSet.prototype.has",!0);bw?(My=lF("WeakMap.prototype.has",!0),ww.exports=function(e){if(!e||typeof e!="object")return!1;try{if(bw(e,bw),My)try{My(e,My)}catch{return!0}return e instanceof vG}catch{}return!1}):ww.exports=function(e){return!1};var My});var hF=ke((Sne,uF)=>{"use strict";var bG=qk(),wG=Xk(),SG=Yk(),AG=cF();uF.exports=function(e){if(e&&typeof e=="object"){if(bG(e))return"Map";if(wG(e))return"Set";if(SG(e))return"WeakMap";if(AG(e))return"WeakSet"}return!1}});var dF=ke((Ane,pF)=>{"use strict";pF.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var mF=ke((Ene,fF)=>{"use strict";var Sw=dF(),EG=typeof globalThis>"u"?global:globalThis;fF.exports=function(){for(var e=[],t=0;t<Sw.length;t++)typeof EG[Sw[t]]=="function"&&(e[e.length]=Sw[t]);return e}});var Ew=ke((Ine,Ry)=>{"use strict";var Aw=Yu(),ky=da(),IG=Wg(),PG=Qa(),_F=ky("%Function.prototype.apply%"),xF=ky("%Function.prototype.call%"),vF=ky("%Reflect.apply%",!0)||Aw.call(xF,_F),gF=rh(),TG=ky("%Math.max%");Ry.exports=function(e){if(typeof e!="function")throw new PG("a function is required");var t=vF(Aw,xF,arguments);return IG(t,1+TG(0,e.length-(arguments.length-1)),!0)};var yF=function(){return vF(Aw,_F,arguments)};gF?gF(Ry.exports,"apply",{value:yF}):Ry.exports.apply=yF});var AF=ke((Pne,SF)=>{"use strict";var bF=da(),wF=Ew(),CG=wF(bF("String.prototype.indexOf"));SF.exports=function(e,t){var a=bF(e,!!t);return typeof a=="function"&&CG(e,".prototype.")>-1?wF(a):a}});var IF=ke((Tne,EF)=>{"use strict";var MG=Uu();EF.exports=function(){return MG()&&!!Symbol.toStringTag}});var RF=ke((Cne,MF)=>{"use strict";var Ly=nw(),RG=mF(),PF=Ew(),Tw=AF(),Fy=ah(),kG=Tw("Object.prototype.toString"),CF=IF()(),TF=typeof globalThis>"u"?global:globalThis,Pw=RG(),Cw=Tw("String.prototype.slice"),Iw=Object.getPrototypeOf,FG=Tw("Array.prototype.indexOf",!0)||function(e,t){for(var a=0;a<e.length;a+=1)if(e[a]===t)return a;return-1},Dy={__proto__:null};CF&&Fy&&Iw?Ly(Pw,function(s){var e=new TF[s];if(Symbol.toStringTag in e){var t=Iw(e),a=Fy(t,Symbol.toStringTag);if(!a){var l=Iw(t);a=Fy(l,Symbol.toStringTag)}Dy["$"+s]=PF(a.get)}}):Ly(Pw,function(s){var e=new TF[s],t=e.slice||e.set;t&&(Dy["$"+s]=PF(t))});var LG=function(e){var t=!1;return Ly(Dy,function(a,l){if(!t)try{"$"+a(e)===l&&(t=Cw(l,1))}catch{}}),t},DG=function(e){var t=!1;return Ly(Dy,function(a,l){if(!t)try{a(e),t=Cw(l,1)}catch{}}),t};MF.exports=function(e){if(!e||typeof e!="object")return!1;if(!CF){var t=Cw(kG(e),8,-1);return FG(Pw,t)>-1?t:t!=="Object"?!1:DG(e)}return Fy?LG(e):null}});var LF=ke((Mne,FF)=>{"use strict";var OG=Po(),kF=OG("ArrayBuffer.prototype.byteLength",!0),zG=lw();FF.exports=function(e){return zG(e)?kF?kF(e):e.byteLength:NaN}});var oL=ke((Rne,nL)=>{"use strict";var tL=cT(),Ls=pC(),DF=nM(),BG=da(),Nh=wR(),NG=C1(),OF=zR(),zF=h1(),BF=R1(),NF=lw(),jF=mk(),UF=vk(),GF=Sk(),VF=tf(),qF=jk(),$F=hF(),WF=RF(),ZF=LF(),XF=Ls("SharedArrayBuffer.prototype.byteLength",!0),HF=Ls("Date.prototype.getTime"),Mw=Object.getPrototypeOf,KF=Ls("Object.prototype.toString"),zy=BG("%Set%",!0),Rw=Ls("Map.prototype.has",!0),By=Ls("Map.prototype.get",!0),YF=Ls("Map.prototype.size",!0),Ny=Ls("Set.prototype.add",!0),rL=Ls("Set.prototype.delete",!0),jy=Ls("Set.prototype.has",!0),Oy=Ls("Set.prototype.size",!0);function JF(s,e,t,a){for(var l=Nh(s),o;(o=l.next())&&!o.done;)if(Yo(e,o.value,t,a))return rL(s,o.value),!0;return!1}function iL(s){if(typeof s>"u")return null;if(typeof s!="object")return typeof s=="symbol"?!1:typeof s=="string"||typeof s=="number"?+s==+s:!0}function jG(s,e,t,a,l,o){var m=iL(t);if(m!=null)return m;var g=By(e,m),b=tL({},l,{strict:!1});return typeof g>"u"&&!Rw(e,m)||!Yo(a,g,b,o)?!1:!Rw(s,m)&&Yo(a,g,b,o)}function UG(s,e,t){var a=iL(t);return a??(jy(e,a)&&!jy(s,a))}function QF(s,e,t,a,l,o){for(var m=Nh(s),g,b;(g=m.next())&&!g.done;)if(b=g.value,Yo(t,b,l,o)&&Yo(a,By(e,b),l,o))return rL(s,b),!0;return!1}function Yo(s,e,t,a){var l=t||{};if(l.strict?OF(s,e):s===e)return!0;var o=qF(s),m=qF(e);if(o!==m)return!1;if(!s||!e||typeof s!="object"&&typeof e!="object")return l.strict?OF(s,e):s==e;var g=a.has(s),b=a.has(e),A;if(g&&b){if(a.get(s)===a.get(e))return!0}else A={};return g||a.set(s,A),b||a.set(e,A),qG(s,e,l,a)}function eL(s){return!s||typeof s!="object"||typeof s.length!="number"||typeof s.copy!="function"||typeof s.slice!="function"||s.length>0&&typeof s[0]!="number"?!1:!!(s.constructor&&s.constructor.isBuffer&&s.constructor.isBuffer(s))}function GG(s,e,t,a){if(Oy(s)!==Oy(e))return!1;for(var l=Nh(s),o=Nh(e),m,g,b;(m=l.next())&&!m.done;)if(m.value&&typeof m.value=="object")b||(b=new zy),Ny(b,m.value);else if(!jy(e,m.value)){if(t.strict||!UG(s,e,m.value))return!1;b||(b=new zy),Ny(b,m.value)}if(b){for(;(g=o.next())&&!g.done;)if(g.value&&typeof g.value=="object"){if(!JF(b,g.value,t.strict,a))return!1}else if(!t.strict&&!jy(s,g.value)&&!JF(b,g.value,t.strict,a))return!1;return Oy(b)===0}return!0}function VG(s,e,t,a){if(YF(s)!==YF(e))return!1;for(var l=Nh(s),o=Nh(e),m,g,b,A,S,M;(m=l.next())&&!m.done;)if(A=m.value[0],S=m.value[1],A&&typeof A=="object")b||(b=new zy),Ny(b,A);else if(M=By(e,A),typeof M>"u"&&!Rw(e,A)||!Yo(S,M,t,a)){if(t.strict||!jG(s,e,A,S,t,a))return!1;b||(b=new zy),Ny(b,A)}if(b){for(;(g=o.next())&&!g.done;)if(A=g.value[0],M=g.value[1],A&&typeof A=="object"){if(!QF(b,s,A,M,t,a))return!1}else if(!t.strict&&(!s.has(A)||!Yo(By(s,A),M,t,a))&&!QF(b,s,A,M,tL({},t,{strict:!1}),a))return!1;return Oy(b)===0}return!0}function qG(s,e,t,a){var l,o;if(typeof s!=typeof e||s==null||e==null||KF(s)!==KF(e)||zF(s)!==zF(e))return!1;var m=BF(s),g=BF(e);if(m!==g)return!1;var b=s instanceof Error,A=e instanceof Error;if(b!==A||(b||A)&&(s.name!==e.name||s.message!==e.message))return!1;var S=UF(s),M=UF(e);if(S!==M||(S||M)&&(s.source!==e.source||DF(s)!==DF(e)))return!1;var k=jF(s),j=jF(e);if(k!==j||(k||j)&&HF(s)!==HF(e)||t.strict&&Mw&&Mw(s)!==Mw(e))return!1;var Z=WF(s),te=WF(e);if(Z!==te)return!1;if(Z||te){if(s.length!==e.length)return!1;for(l=0;l<s.length;l++)if(s[l]!==e[l])return!1;return!0}var q=eL(s),H=eL(e);if(q!==H)return!1;if(q||H){if(s.length!==e.length)return!1;for(l=0;l<s.length;l++)if(s[l]!==e[l])return!1;return!0}var ae=NF(s),pe=NF(e);if(ae!==pe)return!1;if(ae||pe)return ZF(s)!==ZF(e)?!1:typeof Uint8Array=="function"&&Yo(new Uint8Array(s),new Uint8Array(e),t,a);var ve=GF(s),de=GF(e);if(ve!==de)return!1;if(ve||de)return XF(s)!==XF(e)?!1:typeof Uint8Array=="function"&&Yo(new Uint8Array(s),new Uint8Array(e),t,a);if(typeof s!=typeof e)return!1;var _e=VF(s),Pe=VF(e);if(_e.length!==Pe.length)return!1;for(_e.sort(),Pe.sort(),l=_e.length-1;l>=0;l--)if(_e[l]!=Pe[l])return!1;for(l=_e.length-1;l>=0;l--)if(o=_e[l],!Yo(s[o],e[o],t,a))return!1;var Re=$F(s),Ae=$F(e);return Re!==Ae?!1:Re==="Set"||Ae==="Set"?GG(s,e,t,a):Re==="Map"?VG(s,e,t,a):!0}nL.exports=function(e,t,a){return Yo(e,t,a,NG())}});var Tg={};nx(Tg,{CopyrightControl:()=>eI,Layer:()=>Pg,MaplibreLayer:()=>L2,MaplibreStyleLayer:()=>O2,MobilityLayerMixin:()=>Ss,RealtimeAPI:()=>nd,RealtimeLayer:()=>$2,RealtimeModes:()=>Jr,RoutingAPI:()=>od,RoutingControl:()=>w2,StopFinderControl:()=>E2,StopsAPI:()=>sd,VECTOR_TILE_FEATURE_PROPERTY:()=>Tu,VectorLayer:()=>X2,compareDepartures:()=>Cd,createCanvas:()=>zo,createRealtimeFilters:()=>bx,debounceDeparturesMessages:()=>h0,debounceWebsocketMessages:()=>id,fullTrajectoryDelayStyle:()=>G2,fullTrajectoryStyle:()=>Ig,getCircleCanvas:()=>yx,getDelayBgCanvas:()=>mx,getDelayTextCanvas:()=>gx,getFeatureInfoAtCoordinate:()=>H2,getHoursAndMinutes:()=>BA,getLayersAsFlatArray:()=>Nl,getMapGlCopyrights:()=>ad,getTextCanvas:()=>_x,getUTCDateString:()=>OA,getUTCTimeString:()=>zA,getUrlWithParams:()=>Ol,getVehiclePosition:()=>Pd,pad:()=>Rm,realtimeConfig:()=>Pu,realtimeDefaultStyle:()=>zl,realtimeDelayStyle:()=>xx,realtimeSimpleStyle:()=>vx,removeDuplicate:()=>Bl,renderTrajectories:()=>Td,routingStyle:()=>q2,sortAndFilterDepartures:()=>Md,sortByDelay:()=>wx});var IO=(s,e,t=100)=>{let a={},l={},o=[];return m=>{let{source:g,content:b}=m;a[g]&&window.clearTimeout(a[g]),e?l[e(b)]=b:o.push(b),a[g]=window.setTimeout(()=>{let A=e?Object.values(l):o;s(A)},t)}},id=IO;var PO=(s,e)=>s===e.SCHEMATIC?"_schematic":"",Oo=PO;var ox=class s{constructor(){this.defineProperties()}static getRequestString(e,t={}){let a=`${e} ${t.channel}`;return a+=t.args?` ${t.args}`:"",a+=t.id?` ${t.id}`:"",a.trim()}addEvents(e,t){this.websocket&&(this.websocket.addEventListener("message",e),t&&(this.websocket.addEventListener("error",t),this.websocket.addEventListener("close",t)))}close(){this.websocket&&(this.open||this.connecting)&&(this.websocket.onclose=()=>{},this.websocket.close(),this.messagesOnOpen=[])}connect(e,t=()=>{}){if(!e){this.websocket?.close();return}if(this.websocket){if(this.websocket.url===e&&(this.open||this.connecting))return;this.websocket.url!==e&&(this.open||this.connecting)&&this.websocket.close()}this.websocket=new WebSocket(e),this.open?(t(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{t(),this.subscribePreviousSubscriptions()})}defineProperties(){Object.defineProperties(this,{closed:{get:()=>!this.websocket||this.websocket.readyState===this.websocket.CLOSED},closing:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CLOSING)},connecting:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CONNECTING)},messagesOnOpen:{value:[],writable:!0},open:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.OPEN)},subscribed:{value:{},writable:!0},subscriptions:{value:[],writable:!0}})}get(e,t,a){let l=s.getRequestString("GET",e);this.send(l);let o=S=>(...M)=>{S(...M);let k=this.requests.findIndex(te=>l===te.requestString&&t===te.cb),{onErrorCb:j,onMessageCb:Z}=this.requests[k];this.removeEvents(Z,j),this.requests.splice(k,1)},{onErrorCb:m,onMessageCb:g}=this.listen(e,o(t),a&&o(a));this.requests||(this.requests=[]);let b=this.requests.findIndex(S=>l===S.requestString&&t===S.cb),A={cb:t,errorCb:a,onErrorCb:m,onMessageCb:g,params:e,requestString:l};b>-1?this.requests[b]=A:this.requests.push(A)}listen(e,t,a){this.unlisten(e,t);let l=o=>{let m;try{m=JSON.parse(o.data)}catch(A){console.error("WebSocket: unable to parse JSON data",A,o.data);return}let g=e.channel;g+=e.args?` ${e.args}`:"";let b;m.source==="buffer"?b=m.content:b=[m],b.forEach(A=>{A?.source===g&&(!e.id||e.id===m.client_reference)&&t(A)})};return this.addEvents(l,a),{onErrorCb:a,onMessageCb:l}}removeEvents(e,t){this.websocket&&(this.websocket.removeEventListener("message",e),t&&(this.websocket.removeEventListener("error",t),this.websocket.removeEventListener("close",t)))}send(e){if(!this.websocket||this.closed||this.closing)return;let t=()=>{this.websocket?.send(e)};this.open?this.messagesOnOpen.includes(e)||t():this.messagesOnOpen.includes(e)||(this.messagesOnOpen.push(e),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],t()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}subscribe(e,t,a,l=!1){let{onErrorCb:o,onMessageCb:m}=this.listen(e,t,a),g=s.getRequestString("",e),b=this.subscriptions.findIndex(S=>e.channel===S.params.channel&&t===S.cb),A={cb:t,errorCb:a,onErrorCb:o,onMessageCb:m,params:e,quiet:l};b>-1?this.subscriptions[b]=A:this.subscriptions.push(A),this.subscribed[g]||(A.quiet||(this.send(`GET ${g}`),this.send(`SUB ${g}`)),this.subscribed[g]=!0)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(e=>{this.subscribed[e]=!1}),[...this.subscriptions].forEach(e=>{this.subscribe(e.params,e.cb,e.errorCb,e.quiet)})}unlisten(e,t){[...this.subscriptions||[],...this.requests||[]].filter(a=>a.params.channel===e.channel&&(!t||a.cb===t)).forEach(({onErrorCb:a,onMessageCb:l})=>{this.removeEvents(l,a)})}unsubscribe(e,t){let a=this.subscriptions.filter(l=>l.params.channel===e&&(!t||l.cb===t));a.forEach(({onErrorCb:l,onMessageCb:o})=>{this.removeEvents(o,l)}),this.subscriptions=this.subscriptions.filter(l=>l.params.channel!==e||t&&l.cb!==t),e&&this.subscribed[e]&&!this.subscriptions.find(l=>l.params.channel===e)&&a.find(l=>!l.quiet)&&(this.send(`DEL ${e}`),this.subscribed[e]=!1)}},LA=ox;var Jr={RAW:"raw",SCHEMATIC:"schematic",TOPOGRAPHIC:"topographic"},sx=class{constructor(e={}){this.version="2";let t=e;typeof e=="string"&&(t={url:e});let{apiKey:a}=t,{url:l}=t,o=new LA,m="";a&&!l?.includes("key=")&&(m=`?key=${a}`),this._url=(l||"wss://api.geops.io/tracker-ws/v1/")+m,this._buffer=t.buffer||[100,100],this._bbox=t.bbox,this.version=t.version||"2",this.pingIntervalMs=t.pingIntervalMs||1e4,this.reconnectTimeoutMs=t.reconnectTimeoutMs||100,this.wsApi=o}close(){this.wsApi.close()}get(e){let t=e;return typeof e=="string"&&(t={channel:e}),new Promise((a,l)=>{this.wsApi.get(t,a,l)})}getFullTrajectory(e,t,a){let l="";this.version==="1"&&(l=Oo(t,Jr));let o=[`full_trajectory${l}`];return e&&o.push(e),(!t||t===Jr.TOPOGRAPHIC)&&a&&o.push(`gen${a}`),this.get(o.join("_"))}getStation(e,t){let a={args:e,channel:`station${Oo(t,Jr)}`};return this.get(a)}getStations(e,t=100){return new Promise(a=>{this.get(`station${Oo(e,Jr)}`).then(id(a,void 0,t))})}getStopSequence(e){return this.get(`stopsequence_${e}`)}getTrajectory(e,t){return this.get(`partial_trajectory${Oo(t,Jr)}_${e}`)}onClose(){window.clearTimeout(this.pingInterval),window.clearTimeout(this.reconnectTimeout),this.reconnectTimeoutMs&&(this.reconnectTimeout=window.setTimeout(()=>this.open(),this.reconnectTimeoutMs))}onOpen(){this.bbox&&this.wsApi.send(`BBOX ${this.bbox.join(" ")}`),this.buffer&&this.wsApi.send(`BUFFER ${this.buffer.join(" ")}`),this.pingIntervalMs&&(window.clearInterval(this.pingInterval),this.pingInterval=window.setInterval(()=>{this.wsApi.send("PING")},this.pingIntervalMs))}open(){this.wsApi.connect(this.url,this.onOpen.bind(this)),this.wsApi.websocket&&(this.wsApi.websocket.onclose=()=>{this.onClose()})}reset(){this.wsApi.send("RESET")}subscribe(e,t,a=()=>{},l=!1){!e||!t||this.wsApi.subscribe({channel:e},t,a,l)}subscribeDeletedVehicles(e,t,a=()=>{},l=!1){this.unsubscribeDeletedVehicles(t);let o="";this.version==="1"&&(o=Oo(e,Jr)),this.subscribe(`deleted_vehicles${o}`,t,a,l)}subscribeDepartures(e,t,a=()=>{},l=!1){this.subscribeTimetable(e,t,a,l)}subscribeDisruptions(e,t,a=()=>{},l=!1){this.subscribeNewsticker(e,t,a,l)}subscribeExtraGeoms(e,t=()=>{},a=!1){this.subscribe("extra_geoms",e,t,a)}subscribeFullTrajectory(e,t,a,l=()=>{},o=!1){let m="";this.version==="1"&&(m=Oo(t,Jr)),this.subscribe(`full_trajectory${m}_${e}`,a,l,o)}subscribeHealthCheck(e,t=()=>{},a=!1){this.subscribe("healthcheck",e,t,a)}subscribeNewsticker(e,t,a=()=>{},l=!1){this.subscribe(`${e}_newsticker`,t,a,l)}subscribeStations(e,t,a=()=>{},l=!1){this.subscribe(`station${Oo(e,Jr)}`,t,a,l)}subscribeStopSequence(e,t,a=()=>{},l=!1){this.subscribe(`stopsequence_${e}`,t,a,l)}subscribeTimetable(e,t,a=()=>{},l=!1){this.subscribe(`timetable_${e}`,t,a,l)}subscribeTrajectory(e,t,a=()=>{},l=!1){this.unsubscribeTrajectory(t);let o="";this.version==="1"&&(o=Oo(e,Jr)),this.subscribe(`trajectory${o}`,t,a,l)}unsubscribe(e,t="",a){let l=Oo(Jr.SCHEMATIC,Jr),o=Oo(Jr.TOPOGRAPHIC,Jr);this.wsApi.unsubscribe(`${e}${l}${t||""}`,a),this.wsApi.unsubscribe(`${e}${o}${t||""}`,a)}unsubscribeDeletedVehicles(e){this.unsubscribe("deleted_vehicles","",e)}unsubscribeDepartures(e,t){this.unsubscribeTimetabe(e,t)}unsubscribeDisruptions(e,t){this.unsubscribeNewsticker(e,t)}unsubscribeExtraGeoms(e){this.unsubscribe("extra_geoms","",e)}unsubscribeFullTrajectory(e,t){this.unsubscribe("full_trajectory",`_${e}`,t)}unsubscribeHealthCheck(e){this.unsubscribe("healthcheck","",e)}unsubscribeNewsticker(e,t){this.unsubscribe(`${e}_newsticker`,"",t)}unsubscribeStations(e){this.unsubscribe("station","",e)}unsubscribeStopSequence(e,t){this.unsubscribe("stopsequence",`_${e}`,t)}unsubscribeTimetabe(e,t){this.unsubscribe(`timetable_${e}`,"",t)}unsubscribeTrajectory(e){this.unsubscribe("trajectory","",e)}get bbox(){return this._bbox}set bbox(e){JSON.stringify(e)!==JSON.stringify(this._bbox)&&(this._bbox=e,this.wsApi&&this._bbox&&this.wsApi.send(`BBOX ${this._bbox.join(" ")}`))}get buffer(){return this._buffer}set buffer(e){JSON.stringify(e)!==JSON.stringify(this._buffer)&&(this._buffer=e,this.wsApi&&this._buffer&&this.wsApi.send(`BUFFER ${this._buffer.join(" ")}`))}get url(){return this._url}set url(e){this._url!==e&&(this._url=e,(this.wsApi.open||this.wsApi.connecting)&&this.open())}},nd=sx;var TO=(s,e)=>{let t=new URL(s);return Object.entries(e||{}).forEach(([l,o])=>{o!=null&&t.searchParams.set(l,o)}),t},Ol=TO;var ax=class{constructor(e){this.url=e.url,this.apiKey=e.apiKey}async fetch(e,t,a){if(!this.url)throw new Error(`No url defined for request to ${this.url}/${e}`);if(!this.url&&!this.apiKey&&!/key=/.test(this.url))throw new Error(`No apiKey defined for request to ${this.url}`);let l=t||{},o=Ol(`${this.url}${e||""}`,{key:this.apiKey,...l}),g=await(await fetch(o.toString(),a)).json();if(g.error)throw new Error(g.error);return g}},Cm=ax;var lx=class extends Cm{constructor(e={}){super({url:"https://api.geops.io/routing/v1/",...e})}route(e,t){return this.fetch("",e,t)}},od=lx;var cx=class extends Cm{constructor(e={}){super({...e,url:e.url||"https://api.geops.io/stops/v1/"})}search(e,t){return this.fetch("",e,t)}},sd=cx;var CO=(s,e)=>{let t=null;return typeof window>"u"?null:(typeof document<"u"&&document?.createElement?(t=document.createElement("canvas"),t.width=s,t.height=e):OffscreenCanvas?t=new OffscreenCanvas(s,e):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),t)},zo=CO;var ux={},mx=(s,e,t)=>{let a=`${s}, ${e}, ${t}`;if(!ux[a]){let l=zo(s*2,s*2);if(l){let o=l.getContext("2d");if(!o)return null;o.beginPath(),o.arc(s,s,e,0,2*Math.PI,!1),o.fillStyle=t,o.filter="blur(1px)",o.fill(),ux[a]=l}}return ux[a]},hx={},gx=(s,e,t,a,l="#000",o=1)=>{let m=`${s}, ${t}, ${a}, ${l}, ${o}`;if(!hx[m]){let g=zo(Math.ceil(s.length*e),Math.ceil(e+8*o));if(g){let b=g.getContext("2d");if(!b)return null;b.font=t,b.textAlign="left",b.textBaseline="middle",b.font=t,b.fillStyle=a,b.strokeStyle=l,b.lineWidth=1.5*o,b.strokeText(s,0,e),b.fillText(s,0,e),hx[m]=g}}return hx[m]},px={},yx=(s,e,t,a,l,o)=>{let m=`${s}, ${e}, ${t}, ${a}, ${l}, ${o}`;if(!px[m]){let g=zo(s*2,s*2);if(g){let b=g.getContext("2d");if(!b)return null;b.fillStyle=t,a&&(b.lineWidth=1*o,b.strokeStyle="#000000"),b.beginPath(),b.arc(s,s,e,0,2*Math.PI,!1),b.fill(),l&&b.setLineDash([5,3]),a&&b.stroke(),px[m]=g}}return px[m]},dx={},_x=(s,e,t,a,l,o,m,g)=>{let b=`${s}, ${e}, ${t}, ${a},${l}, ${o}, ${m}`;if(!dx[b]){let A=zo(e*2,e*2);if(A){let S=A.getContext("2d");if(!S)return null;o&&(S.save(),S.textBaseline="middle",S.textAlign="center",S.font=g(t+2,s),S.strokeStyle=l,S.strokeText(s,e,e),S.restore()),S.textBaseline="middle",S.textAlign="center",S.fillStyle=a,S.font=g(t,s),S.strokeStyle=l,S.strokeText(s,e,e),S.fillText(s,e,e),dx[b]=A}}return dx[b]},fx={},MO=(s,e,t)=>{let{delayDisplay:a=3e5,delayOutlineColor:l="#000",getBgColor:o=()=>"#000",getDelayColor:m=()=>"#000",getDelayFont:g=jt=>`bold ${jt}px arial, sans-serif`,getDelayText:b=()=>null,getMaxRadiusForStrokeAndDelay:A=()=>7,getMaxRadiusForText:S=()=>10,getRadius:M=()=>0,getText:k=jt=>jt,getTextColor:j=()=>"#000",getTextFont:Z=jt=>`bold ${jt}px arial, sans-serif`,getTextSize:te=()=>14,hoverVehicleId:q,selectedVehicleId:H,useDelayStyle:ae}=t,{pixelRatio:pe=1,zoom:ve}=e,{type:de}=s.properties,{delay:_e,line:Pe,operator_provides_realtime_journey:Re,state:Ae,train_id:ut}=s.properties,{color:Ve,name:Ue,text_color:pt}=Pe||{};Ue=k(Ue);let Tt=Ae==="JOURNEY_CANCELLED";de||(de="Rail"),Ue||(Ue="I"),pt||(pt="#000000"),Ve&&!Ve.startsWith("#")&&(Ve=`#${Ve}`),pt.startsWith("#")||(pt=`#${pt}`);let Qe=Math.min(Math.floor(ve||1),16),nt=!!(q&&q===ut),yt=!!(H&&H===ut),dt=M(de,Qe)*pe,Rt=dt>=A()*pe;(nt||yt)&&(dt=Rt?dt+5*pe:14*pe);let bt=dt>S()*pe,Bt=`${dt}${nt||yt}`;if(ae?(Bt+=`${Re}${_e}`,Rt&&(Bt+=`${Tt}`)):(Bt+=`${Ve||de}`,Rt&&(Bt+=`${Tt}${_e}`)),bt&&(Bt+=`${Ue}${pt}`),!fx[Bt]){if(dt===0)return null;let jt=1*pe,Pr=dt+2*pe,$e=dt*2,Fr=Pr*2+jt*2,Lr=Fr/2,Mi=null;Rt&&_e!==null&&(Mi=mx(Lr,Pr,m(_e,Tt)));let Ri=null,En=0;if(Rt&&(nt||(_e||0)>=a||Tt)){En=Math.max(Tt?19:14,Math.min(Tt?19:17,dt*1.2))*pe;let Et=b(_e,Tt);Et&&(Ri=gx(Et,En,g(En,Et),m(_e,Tt,!0),l,pe))}let ii;ae?ii=m(_e,Tt):ii=Ve||o(de);let Wn=yx(Lr,dt,ii,Rt||nt||yt,!!Rt&&!!ae&&_e===null&&Re==="yes",pe),Ee=Fr+(Ri?.width||0)*2,ki=zo(Ee,Fr);if(ki){let Et=ki.getContext("2d");if(!Et)return null;let ir=Ri?.width||0;Mi&&Et.drawImage(Mi,ir,0),Wn&&Et.drawImage(Wn,ir,0);let Xn=null;if(bt){let Tn=Math.max(dt,10),Yi=te(Et,$e,Ue,Tn,Z),Cn=ae?"#000000":pt||j(de);Xn=_x(Ue,Lr,Yi,Cn,ii,!!ae&&_e===null&&Re==="yes",pe,Z)}Xn&&Et.drawImage(Xn,ir,0),Ri&&Et.drawImage(Ri,ir+Math.ceil(Lr+Pr)+jt,Math.ceil(Lr-En)),fx[Bt]=ki}}return fx[Bt]},zl=MO;var RO=(s,e,t)=>zl(s,e,{...t,useDelayStyle:!0}),xx=RO;var Mm,kO=()=>{if(!Mm){Mm=zo(15,15);let s=Mm?.getContext("2d");s&&(s.arc(8,8,5,0,2*Math.PI,!1),s.fillStyle="#8ED6FF",s.fill(),s.lineWidth=3,s.strokeStyle="black",s.stroke(),s.lineWidth=3)}return Mm},vx=kO;var FO=s=>{let e=s.filter(o=>o!=null&&o.trim&&o.trim()),t=e.map(o=>o.toLowerCase());return[...new Set(t)].map(o=>e.find(m=>m.toLowerCase()===o))},Bl=FO;var LO=s=>{if(!s)return[];let{style:e}=s;if(!e)return[];let{sourceCaches:t}=e,a=[];return Object.values(t).forEach(l=>{if(l.used){let o=l.getSource(),m=o.attribution||o.options?.attribution;m&&(a=a.concat(m.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),Bl(a)},ad=LO;var DO=(s,e,t,a)=>{let l=[];if(!s&&!e&&!t&&!a)return null;if(a){let o=typeof a=="string"?[a]:a,m=g=>{let b=g.properties.name||g.properties.line&&g.properties.line.name||"";return b?o.some(A=>new RegExp(A,"i").test(b)):!1};l.push(m)}if(s){let m=(typeof s=="string"?s.split(","):s).map(b=>b.replace(/\s+/g,"").toUpperCase()),g=b=>{let{line:A,name:S}=b.properties,M=(S||A&&A.name||"").toUpperCase();return M?m.includes(M):!1};l.push(g)}if(e){let m=(typeof e=="string"?e.split(","):e).map(b=>parseInt(b,10)),g=b=>{let A=b.properties.route_identifier||b.properties.routeIdentifier||"",S=parseInt(A.split(".")[0],10);return m.includes(S)};l.push(g)}if(t){let o=typeof t=="string"?[t]:t,m=g=>o.some(b=>{let A=g.properties.operator||g.properties.tenant||"";return new RegExp(b,"i").test(A)});l.push(m)}return l.length?o=>{for(let m=0;m<l.length;m+=1)if(!l[m](o))return!1;return!0}:null},bx=DO;var DA=s=>{let e=s;Array.isArray(e)||(e=[s]);let t=[];return e.forEach(a=>{t.push(a);let l=a.children||a.get("children")||a.getLayers?.()?.getArray();t=t.concat(DA(l||[]))}),t},Nl=DA;var OA=(s=new Date)=>{let e=(s.getUTCMonth()+1).toString();e=e.length===1?`0${e}`:e;let t=s.getUTCDate().toString();return t=t.length===1?`0${t}`:t,[s.getUTCFullYear(),e,t].join("")},zA=s=>[s.getUTCHours(),s.getUTCMinutes(),`${s.getUTCSeconds()}.${s.getUTCMilliseconds()}`].join(":"),Rm=s=>s<10?`0${s}`:`${s}`,BA=s=>{if(!s||s<=0)return"";let e=new Date(s);return`${Rm(e.getHours())}:${Rm(e.getMinutes())}`};var OO=(s,e)=>{let t=s.properties,a=e.properties;return t.delay===null&&a.delay!==null?1:a.delay===null&&t.delay!==null?-1:t.cancelled&&!a.cancelled?a.delay<18e4?-1:1:a.cancelled&&!t.cancelled?t.delay<18e4?1:-1:a.delay-t.delay},wx=OO;function Ar(s,e){if(!s)throw new Error(e)}var b8=new Array(6);function wi(){return[1,0,0,1,0,0]}function jA(s,e){return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s}function Ni(s,e){let t=e[0],a=e[1];return e[0]=s[0]*t+s[2]*a+s[4],e[1]=s[1]*t+s[3]*a+s[5],e}function ln(s,e,t,a,l,o,m,g){let b=Math.sin(o),A=Math.cos(o);return s[0]=a*A,s[1]=l*b,s[2]=-a*b,s[3]=l*A,s[4]=m*a*A-g*a*b+e,s[5]=m*l*b+g*l*A+t,s}function UA(s,e,t,a,l,o,m){return Sx(ln(wi(),s,e,t,a,l,o,m))}function GA(s,e){let t=zO(e);Ar(t!==0,"Transformation matrix cannot be inverted");let a=e[0],l=e[1],o=e[2],m=e[3],g=e[4],b=e[5];return s[0]=m/t,s[1]=-l/t,s[2]=-o/t,s[3]=a/t,s[4]=(o*b-m*g)/t,s[5]=-(a*b-l*g)/t,s}function zO(s){return s[0]*s[3]-s[1]*s[2]}var NA=[1e6,1e6,1e6,1e6,2,2];function Sx(s){return"matrix("+s.map((t,a)=>Math.round(t*NA[a])/NA[a]).join(", ")+")"}var Ax=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var zr=Ax;var km={PROPERTYCHANGE:"propertychange"};var Ex=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},VA=Ex;function qA(s,e,t){let a,l;t=t||Bo;let o=0,m=s.length,g=!1;for(;o<m;)a=o+(m-o>>1),l=+t(s[a],e),l<0?o=a+1:(m=a,g=!l);return g?o:~o}function Bo(s,e){return s>e?1:s<e?-1:0}function Fm(s,e,t){if(s[0]<=e)return 0;let a=s.length;if(e<=s[a-1])return a-1;if(typeof t=="function"){for(let l=1;l<a;++l){let o=s[l];if(o===e)return l;if(o<e)return t(e,s[l-1],o)>0?l-1:l}return a-1}if(t>0){for(let l=1;l<a;++l)if(s[l]<e)return l-1;return a-1}if(t<0){for(let l=1;l<a;++l)if(s[l]<=e)return l;return a-1}for(let l=1;l<a;++l){if(s[l]==e)return l;if(s[l]<e)return s[l-1]-e<e-s[l]?l-1:l}return a-1}function $A(s,e,t){for(;e<t;){let a=s[e];s[e]=s[t],s[t]=a,++e,--t}}function ji(s,e){let t=Array.isArray(e)?e:[e],a=t.length;for(let l=0;l<a;l++)s[s.length]=t[l]}function Fn(s,e){let t=s.length;if(t!==e.length)return!1;for(let a=0;a<t;a++)if(s[a]!==e[a])return!1;return!0}function Lm(){return!0}function No(){}function Dm(s){let e=!1,t,a,l;return function(){let o=Array.prototype.slice.call(arguments);return(!e||this!==l||!Fn(o,a))&&(e=!0,l=this,a=o,t=s.apply(this,arguments)),t}}function yu(s){for(let e in s)delete s[e]}function lo(s){let e;for(e in s)return!1;return!e}var Ix=class extends VA{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let a=this.listeners_||(this.listeners_={}),l=a[e]||(a[e]=[]);l.includes(t)||l.push(t)}dispatchEvent(e){let t=typeof e=="string",a=t?e:e.type,l=this.listeners_&&this.listeners_[a];if(!l)return;let o=t?new zr(e):e;o.target||(o.target=this.eventTarget_||this);let m=this.dispatching_||(this.dispatching_={}),g=this.pendingRemovals_||(this.pendingRemovals_={});a in m||(m[a]=0,g[a]=0),++m[a];let b;for(let A=0,S=l.length;A<S;++A)if("handleEvent"in l[A]?b=l[A].handleEvent(o):b=l[A].call(this,o),b===!1||o.propagationStopped){b=!1;break}if(--m[a]===0){let A=g[a];for(delete g[a];A--;)this.removeEventListener(a,No);delete m[a]}return b}disposeInternal(){this.listeners_&&yu(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let a=this.listeners_[e];if(!a)return;let l=a.indexOf(t);l!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(a[l]=No,++this.pendingRemovals_[e]):(a.splice(l,1),a.length===0&&delete this.listeners_[e]))}},Om=Ix;var Ir={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function Ui(s,e,t,a,l){if(a&&a!==s&&(t=t.bind(a)),l){let m=t;t=function(){s.removeEventListener(e,t),m.apply(this,arguments)}}let o={target:s,type:e,listener:t};return s.addEventListener(e,t),o}function Px(s,e,t,a){return Ui(s,e,t,a,!0)}function cn(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),yu(s))}var _u=class extends Om{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Ir.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let a=e.length,l=new Array(a);for(let o=0;o<a;++o)l[o]=Ui(this,e[o],t);return l}return Ui(this,e,t)}onceInternal(e,t){let a;if(Array.isArray(e)){let l=e.length;a=new Array(l);for(let o=0;o<l;++o)a[o]=Px(this,e[o],t)}else a=Px(this,e,t);return t.ol_key=a,a}unInternal(e,t){let a=t.ol_key;if(a)jl(a);else if(Array.isArray(e))for(let l=0,o=e.length;l<o;++l)this.removeEventListener(e[l],t);else this.removeEventListener(e,t)}};_u.prototype.on;_u.prototype.once;_u.prototype.un;function jl(s){if(Array.isArray(s))for(let e=0,t=s.length;e<t;++e)cn(s[e]);else cn(s)}var zm=_u;function Pt(){throw new Error("Unimplemented abstract method.")}var BO=0;function Ut(s){return s.ol_uid||(s.ol_uid=String(++BO))}var Bm=class extends zr{constructor(e,t,a){super(e),this.key=t,this.oldValue=a}},Tx=class extends zm{constructor(e){super(),this.on,this.once,this.un,Ut(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let a;a=`change:${e}`,this.hasListener(a)&&this.dispatchEvent(new Bm(a,e,t)),a=km.PROPERTYCHANGE,this.hasListener(a)&&this.dispatchEvent(new Bm(a,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,a){let l=this.values_||(this.values_={});if(a)l[e]=t;else{let o=l[e];l[e]=t,o!==t&&this.notify(e,o)}}setProperties(e,t){for(let a in e)this.set(a,e[a],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){let a=this.values_[e];delete this.values_[e],lo(this.values_)&&(this.values_=null),t||this.notify(e,a)}}},Si=Tx;var Qr={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ps(s){let e=On();for(let t=0,a=s.length;t<a;++t)Cx(e,s[t]);return e}function NO(s,e,t){let a=Math.min.apply(null,s),l=Math.min.apply(null,e),o=Math.max.apply(null,s),m=Math.max.apply(null,e);return ea(a,l,o,m,t)}function Ln(s,e,t){return t?(t[0]=s[0]-e,t[1]=s[1]-e,t[2]=s[2]+e,t[3]=s[3]+e,t):[s[0]-e,s[1]-e,s[2]+e,s[3]+e]}function WA(s,e){return e?(e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e):s.slice()}function Dn(s,e,t){let a,l;return e<s[0]?a=s[0]-e:s[2]<e?a=e-s[2]:a=0,t<s[1]?l=s[1]-t:s[3]<t?l=t-s[3]:l=0,a*a+l*l}function Js(s,e){return ld(s,e[0],e[1])}function Qs(s,e){return s[0]<=e[0]&&e[2]<=s[2]&&s[1]<=e[1]&&e[3]<=s[3]}function ld(s,e,t){return s[0]<=e&&e<=s[2]&&s[1]<=t&&t<=s[3]}function Nm(s,e){let t=s[0],a=s[1],l=s[2],o=s[3],m=e[0],g=e[1],b=Qr.UNKNOWN;return m<t?b=b|Qr.LEFT:m>l&&(b=b|Qr.RIGHT),g<a?b=b|Qr.BELOW:g>o&&(b=b|Qr.ABOVE),b===Qr.UNKNOWN&&(b=Qr.INTERSECTING),b}function On(){return[1/0,1/0,-1/0,-1/0]}function ea(s,e,t,a,l){return l?(l[0]=s,l[1]=e,l[2]=t,l[3]=a,l):[s,e,t,a]}function xu(s){return ea(1/0,1/0,-1/0,-1/0,s)}function Ba(s,e){let t=s[0],a=s[1];return ea(t,a,t,a,e)}function vu(s,e,t,a,l){let o=xu(l);return Mx(o,s,e,t,a)}function jm(s,e){return s[0]==e[0]&&s[2]==e[2]&&s[1]==e[1]&&s[3]==e[3]}function ZA(s,e){return e[0]<s[0]&&(s[0]=e[0]),e[2]>s[2]&&(s[2]=e[2]),e[1]<s[1]&&(s[1]=e[1]),e[3]>s[3]&&(s[3]=e[3]),s}function Cx(s,e){e[0]<s[0]&&(s[0]=e[0]),e[0]>s[2]&&(s[2]=e[0]),e[1]<s[1]&&(s[1]=e[1]),e[1]>s[3]&&(s[3]=e[1])}function Mx(s,e,t,a,l){for(;t<a;t+=l)jO(s,e[t],e[t+1]);return s}function jO(s,e,t){s[0]=Math.min(s[0],e),s[1]=Math.min(s[1],t),s[2]=Math.max(s[2],e),s[3]=Math.max(s[3],t)}function XA(s,e){let t;return t=e(Rx(s)),t||(t=e(kx(s)),t)||(t=e(Lx(s)),t)||(t=e(Fx(s)),t)?t:!1}function Rx(s){return[s[0],s[1]]}function kx(s){return[s[2],s[1]]}function bo(s){return[(s[0]+s[2])/2,(s[1]+s[3])/2]}function HA(s,e,t,a,l){let[o,m,g,b,A,S,M,k]=UO(s,e,t,a);return ea(Math.min(o,g,A,M),Math.min(m,b,S,k),Math.max(o,g,A,M),Math.max(m,b,S,k),l)}function UO(s,e,t,a){let l=e*a[0]/2,o=e*a[1]/2,m=Math.cos(t),g=Math.sin(t),b=l*m,A=l*g,S=o*m,M=o*g,k=s[0],j=s[1];return[k-b+M,j-A-S,k-b-M,j-A+S,k+b-M,j+A+S,k+b+M,j+A-S,k-b+M,j-A-S]}function si(s){return s[3]-s[1]}function Fx(s){return[s[0],s[3]]}function Lx(s){return[s[2],s[3]]}function kr(s){return s[2]-s[0]}function ei(s,e){return s[0]<=e[2]&&s[2]>=e[0]&&s[1]<=e[3]&&s[3]>=e[1]}function cd(s){return s[2]<s[0]||s[3]<s[1]}function KA(s,e){return e?(e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e):s}function YA(s,e,t){let a=!1,l=Nm(s,e),o=Nm(s,t);if(l===Qr.INTERSECTING||o===Qr.INTERSECTING)a=!0;else{let m=s[0],g=s[1],b=s[2],A=s[3],S=e[0],M=e[1],k=t[0],j=t[1],Z=(j-M)/(k-S),te,q;o&Qr.ABOVE&&!(l&Qr.ABOVE)&&(te=k-(j-A)/Z,a=te>=m&&te<=b),!a&&o&Qr.RIGHT&&!(l&Qr.RIGHT)&&(q=j-(k-b)*Z,a=q>=g&&q<=A),!a&&o&Qr.BELOW&&!(l&Qr.BELOW)&&(te=k-(j-g)/Z,a=te>=m&&te<=b),!a&&o&Qr.LEFT&&!(l&Qr.LEFT)&&(q=j-(k-m)*Z,a=q>=g&&q<=A)}return a}function JA(s,e,t,a){if(cd(s))return xu(t);let l=[];if(a>1){let g=s[2]-s[0],b=s[3]-s[1];for(let A=0;A<a;++A)l.push(s[0]+g*A/a,s[1],s[2],s[1]+b*A/a,s[2]-g*A/a,s[3],s[0],s[3]-b*A/a)}else l=[s[0],s[1],s[2],s[1],s[2],s[3],s[0],s[3]];e(l,l,2);let o=[],m=[];for(let g=0,b=l.length;g<b;g+=2)o.push(l[g]),m.push(l[g+1]);return NO(o,m,t)}function Dx(s,e){let t=e.getExtent(),a=bo(s);if(e.canWrapX()&&(a[0]<t[0]||a[0]>=t[2])){let l=kr(t),m=Math.floor((a[0]-t[0])/l)*l;s[0]-=m,s[2]-=m}return s}function QA(s,e,t){if(e.canWrapX()){let a=e.getExtent();if(!isFinite(s[0])||!isFinite(s[2]))return[[a[0],s[1],a[2],s[3]]];Dx(s,e);let l=kr(a);if(kr(s)>l&&!t)return[[a[0],s[1],a[2],s[3]]];if(s[0]<a[0])return[[s[0]+l,s[1],a[2],s[3]],[a[0],s[1],s[2],s[3]]];if(s[2]>a[2])return[[s[0],s[1],a[2],s[3]],[a[0],s[1],s[2]-l,s[3]]]}return[s]}var ud={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Ox=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ud[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Um=Ox;var hd=6378137,bu=Math.PI*hd,GO=[-bu,-bu,bu,bu],VO=[-180,-85,180,85],Gm=hd*Math.log(Math.tan(Math.PI/2)),Na=class extends Um{constructor(e){super({code:e,units:"m",extent:GO,global:!0,worldExtent:VO,getPointResolution:function(t,a){return t/Math.cosh(a[1]/hd)}})}},zx=[new Na("EPSG:3857"),new Na("EPSG:102100"),new Na("EPSG:102113"),new Na("EPSG:900913"),new Na("http://www.opengis.net/def/crs/EPSG/0/3857"),new Na("http://www.opengis.net/gml/srs/epsg.xml#3857")];function eE(s,e,t){let a=s.length;t=t>1?t:2,e===void 0&&(t>2?e=s.slice():e=new Array(a));for(let l=0;l<a;l+=t){e[l]=bu*s[l]/180;let o=hd*Math.log(Math.tan(Math.PI*(+s[l+1]+90)/360));o>Gm?o=Gm:o<-Gm&&(o=-Gm),e[l+1]=o}return e}function tE(s,e,t){let a=s.length;t=t>1?t:2,e===void 0&&(t>2?e=s.slice():e=new Array(a));for(let l=0;l<a;l+=t)e[l]=180*s[l]/bu,e[l+1]=360*Math.atan(Math.exp(s[l+1]/hd))/Math.PI-90;return e}var qO=6378137,rE=[-180,-90,180,90],$O=Math.PI*qO/180,ta=class extends Um{constructor(e,t){super({code:e,units:"degrees",extent:rE,axisOrientation:t,global:!0,metersPerUnit:$O,worldExtent:rE})}},Bx=[new ta("CRS:84"),new ta("EPSG:4326","neu"),new ta("urn:ogc:def:crs:OGC:1.3:CRS84"),new ta("urn:ogc:def:crs:OGC:2:84"),new ta("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ta("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ta("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var Nx={};function iE(s){return Nx[s]||Nx[s.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function nE(s,e){Nx[s]=e}var wu={};function pd(s,e,t){let a=s.getCode(),l=e.getCode();a in wu||(wu[a]={}),wu[a][l]=t}function oE(s,e){let t;return s in wu&&e in wu[s]&&(t=wu[s][e]),t}function Br(s,e,t){return Math.min(Math.max(s,e),t)}function sE(s,e,t,a,l,o){let m=l-t,g=o-a;if(m!==0||g!==0){let b=((s-t)*m+(e-a)*g)/(m*m+g*g);b>1?(t=l,a=o):b>0&&(t+=m*b,a+=g*b)}return jo(s,e,t,a)}function jo(s,e,t,a){let l=t-s,o=a-e;return l*l+o*o}function aE(s){return s*180/Math.PI}function lE(s){return s*Math.PI/180}function Ul(s,e){let t=s%e;return t*e<0?t+e:t}function Gi(s,e,t){return s+t*(e-s)}function cE(s,e){let t=Math.pow(10,e);return Math.round(s*t)/t}function uE(s,e){return s[0]+=+e[0],s[1]+=+e[1],s}function jx(s,e){let t=s[0],a=s[1],l=e[0],o=e[1],m=l[0],g=l[1],b=o[0],A=o[1],S=b-m,M=A-g,k=S===0&&M===0?0:(S*(t-m)+M*(a-g))/(S*S+M*M||0),j,Z;return k<=0?(j=m,Z=g):k>=1?(j=b,Z=A):(j=m+k*S,Z=g+k*M),[j,Z]}function An(s,e){let t=!0;for(let a=s.length-1;a>=0;--a)if(s[a]!=e[a]){t=!1;break}return t}function hE(s,e){let t=Math.cos(e),a=Math.sin(e),l=s[0]*t-s[1]*a,o=s[1]*t+s[0]*a;return s[0]=l,s[1]=o,s}function Su(s,e){let t=s[0]-e[0],a=s[1]-e[1];return t*t+a*a}function Ux(s,e){return Math.sqrt(Su(s,e))}function pE(s,e){return Su(s,jx(s,e))}function dE(s,e){if(e.canWrapX()){let t=kr(e.getExtent()),a=fE(s,e,t);a&&(s[0]-=a*t)}return s}function fE(s,e,t){let a=e.getExtent(),l=0;return e.canWrapX()&&(s[0]<a[0]||s[0]>a[2])&&(t=t||kr(a),l=Math.floor((s[0]-a[0])/t)),l}var mE={info:1,warn:2,error:3,none:4},WO=mE.info;function gE(...s){WO>mE.warn||console.warn(...s)}var Gx=!0;function Vx(s){Gx=!(s===void 0?!0:s)}function qx(s,e){if(e!==void 0){for(let t=0,a=s.length;t<a;++t)e[t]=s[t];e=e}else e=s.slice();return e}function ZO(s,e){if(e!==void 0&&s!==e){for(let t=0,a=s.length;t<a;++t)e[t]=s[t];s=e}return s}function XO(s){nE(s.getCode(),s),pd(s,s,qx)}function HO(s){s.forEach(XO)}function Zr(s){return typeof s=="string"?iE(s):s||null}function yE(s){HO(s),s.forEach(function(e){s.forEach(function(t){e!==t&&pd(e,t,qx)})})}function KO(s,e,t,a){s.forEach(function(l){e.forEach(function(o){pd(l,o,t),pd(o,l,a)})})}function Vm(s,e){return s?typeof s=="string"?Zr(s):s:Zr(e)}function Ai(s,e){return Vx(),qm(s,"EPSG:4326",e!==void 0?e:"EPSG:3857")}function Gl(s,e){let t=qm(s,e!==void 0?e:"EPSG:3857","EPSG:4326"),a=t[0];return(a<-180||a>180)&&(t[0]=Ul(a+180,360)-180),t}function _E(s,e){if(s===e)return!0;let t=s.getUnits()===e.getUnits();return(s.getCode()===e.getCode()||Au(s,e)===qx)&&t}function Au(s,e){let t=s.getCode(),a=e.getCode(),l=oE(t,a);return l||(l=ZO),l}function Vl(s,e){let t=Zr(s),a=Zr(e);return Au(t,a)}function qm(s,e,t){return Vl(e,t)(s,void 0,s.length)}function dd(s,e,t,a){let l=Vl(e,t);return JA(s,l,void 0,a)}var Uo=null;function co(){return Uo}function ql(s,e){return Uo?qm(s,e,Uo):s}function ti(s,e){return Uo?qm(s,Uo,e):(Gx&&!An(s,[0,0])&&s[0]>=-180&&s[0]<=180&&s[1]>=-90&&s[1]<=90&&(Gx=!1,gE("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),s)}function ds(s,e){return Uo?dd(s,e,Uo):s}function fs(s,e){return Uo?dd(s,Uo,e):s}function xE(s,e){if(!Uo)return s;let t=Zr(e).getMetersPerUnit(),a=Uo.getMetersPerUnit();return t&&a?s*t/a:s}function YO(){yE(zx),yE(Bx),KO(Bx,zx,eE,tE)}YO();function zn(s,e,t,a,l,o){o=o||[];let m=0;for(let g=e;g<t;g+=a){let b=s[g],A=s[g+1];o[m++]=l[0]*b+l[2]*A+l[4],o[m++]=l[1]*b+l[3]*A+l[5]}return o&&o.length!=m&&(o.length=m),o}function $m(s,e,t,a,l,o,m){m=m||[];let g=Math.cos(l),b=Math.sin(l),A=o[0],S=o[1],M=0;for(let k=e;k<t;k+=a){let j=s[k]-A,Z=s[k+1]-S;m[M++]=A+j*g-Z*b,m[M++]=S+j*b+Z*g;for(let te=k+2;te<k+a;++te)m[M++]=s[te]}return m&&m.length!=M&&(m.length=M),m}function vE(s,e,t,a,l,o,m,g){g=g||[];let b=m[0],A=m[1],S=0;for(let M=e;M<t;M+=a){let k=s[M]-b,j=s[M+1]-A;g[S++]=b+l*k,g[S++]=A+o*j;for(let Z=M+2;Z<M+a;++Z)g[S++]=s[Z]}return g&&g.length!=S&&(g.length=S),g}function bE(s,e,t,a,l,o,m){m=m||[];let g=0;for(let b=e;b<t;b+=a){m[g++]=s[b]+l,m[g++]=s[b+1]+o;for(let A=b+2;A<b+a;++A)m[g++]=s[A]}return m&&m.length!=g&&(m.length=g),m}var wE=wi(),$x=class extends Si{constructor(){super(),this.extent_=On(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Dm((e,t,a)=>{if(!a)return this.getSimplifiedGeometry(t);let l=this.clone();return l.applyTransform(a),l.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return Pt()}closestPointXY(e,t,a,l){return Pt()}containsXY(e,t){let a=this.getClosestPoint([e,t]);return a[0]===e&&a[1]===t}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return Pt()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&xu(t),this.extentRevision_=this.getRevision()}return KA(this.extent_,e)}rotate(e,t){Pt()}scale(e,t,a){Pt()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return Pt()}getType(){return Pt()}applyTransform(e){Pt()}intersectsExtent(e){return Pt()}translate(e,t){Pt()}transform(e,t){let a=Zr(e),l=a.getUnits()=="tile-pixels"?function(o,m,g){let b=a.getExtent(),A=a.getWorldExtent(),S=si(A)/si(b);return ln(wE,A[0],A[3],S,-S,0,0,0),zn(o,0,o.length,g,wE,m),Vl(a,t)(o,m,g)}:Vl(a,t);return this.applyTransform(l),this}},Wm=$x;var Wx=class extends Wm{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return vu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return Pt()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=SE(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){Pt()}setLayout(e,t,a){let l;if(e)l=SE(e);else{for(let o=0;o<a;++o){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}l=t.length,e=ja(l)}this.layout=e,this.stride=l}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(e,t){let a=this.getFlatCoordinates();if(a){let l=this.getStride();$m(a,0,a.length,l,e,t,a),this.changed()}}scale(e,t,a){t===void 0&&(t=e),a||(a=bo(this.getExtent()));let l=this.getFlatCoordinates();if(l){let o=this.getStride();vE(l,0,l.length,o,e,t,a,l),this.changed()}}translate(e,t){let a=this.getFlatCoordinates();if(a){let l=this.getStride();bE(a,0,a.length,l,e,t,a),this.changed()}}};function ja(s){let e;return s==2?e="XY":s==3?e="XYZ":s==4&&(e="XYZM"),e}function SE(s){let e;return s=="XY"?e=2:s=="XYZ"||s=="XYM"?e=3:s=="XYZM"&&(e=4),e}function AE(s,e,t){let a=s.getFlatCoordinates();if(!a)return null;let l=s.getStride();return zn(a,0,a.length,l,e,t)}var Vi=Wx;function EE(s,e,t,a){for(let l=0,o=t.length;l<o;++l)s[e++]=t[l];return e}function $l(s,e,t,a){for(let l=0,o=t.length;l<o;++l){let m=t[l];for(let g=0;g<a;++g)s[e++]=m[g]}return e}function Ua(s,e,t,a,l){l=l||[];let o=0;for(let m=0,g=t.length;m<g;++m){let b=$l(s,e,t[m],a);l[o++]=b,e=b}return l.length=o,l}function Zm(s,e,t,a,l){l=l||[];let o=0;for(let m=0,g=t.length;m<g;++m){let b=Ua(s,e,t[m],a,l[o]);b.length===0&&(b[0]=e),l[o++]=b,e=b[b.length-1]}return l.length=o,l}var Xx=class s extends Wm{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(cn),this.changeEventsKeys_.length=0}listenGeometriesChange_(){let e=this.geometries_;for(let t=0,a=e.length;t<a;++t)this.changeEventsKeys_.push(Ui(e[t],Ir.CHANGE,this.changed,this))}clone(){let e=new s(Zx(this.geometries_));return e.applyProperties(this),e}closestPointXY(e,t,a,l){if(l<Dn(this.getExtent(),e,t))return l;let o=this.geometries_;for(let m=0,g=o.length;m<g;++m)l=o[m].closestPointXY(e,t,a,l);return l}containsXY(e,t){let a=this.geometries_;for(let l=0,o=a.length;l<o;++l)if(a[l].containsXY(e,t))return!0;return!1}computeExtent(e){xu(e);let t=this.geometries_;for(let a=0,l=t.length;a<l;++a)ZA(e,t[a].getExtent());return e}getGeometries(){return Zx(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[],t=this.geometries_;for(let a=0,l=t.length;a<l;++a)t[a].getType()===this.getType()?e=e.concat(t[a].getGeometriesArrayRecursive()):e.push(t[a]);return e}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=[],a=this.geometries_,l=!1;for(let o=0,m=a.length;o<m;++o){let g=a[o],b=g.getSimplifiedGeometry(e);t.push(b),b!==g&&(l=!0)}return l?new s(t):(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getType(){return"GeometryCollection"}intersectsExtent(e){let t=this.geometries_;for(let a=0,l=t.length;a<l;++a)if(t[a].intersectsExtent(e))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(e,t){let a=this.geometries_;for(let l=0,o=a.length;l<o;++l)a[l].rotate(e,t);this.changed()}scale(e,t,a){a||(a=bo(this.getExtent()));let l=this.geometries_;for(let o=0,m=l.length;o<m;++o)l[o].scale(e,t,a);this.changed()}setGeometries(e){this.setGeometriesArray(Zx(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){let t=this.geometries_;for(let a=0,l=t.length;a<l;++a)t[a].applyTransform(e);this.changed()}translate(e,t){let a=this.geometries_;for(let l=0,o=a.length;l<o;++l)a[l].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}};function Zx(s){return s.map(e=>e.clone())}var Hx=Xx;function IE(s,e,t,a,l,o,m){let g=s[e],b=s[e+1],A=s[t]-g,S=s[t+1]-b,M;if(A===0&&S===0)M=e;else{let k=((l-g)*A+(o-b)*S)/(A*A+S*S);if(k>1)M=t;else if(k>0){for(let j=0;j<a;++j)m[j]=Gi(s[e+j],s[t+j],k);m.length=a;return}else M=e}for(let k=0;k<a;++k)m[k]=s[M+k];m.length=a}function fd(s,e,t,a,l){let o=s[e],m=s[e+1];for(e+=a;e<t;e+=a){let g=s[e],b=s[e+1],A=jo(o,m,g,b);A>l&&(l=A),o=g,m=b}return l}function md(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o){let g=t[o];l=fd(s,e,g,a,l),e=g}return l}function PE(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o){let g=t[o];l=md(s,e,g,a,l),e=g[g.length-1]}return l}function gd(s,e,t,a,l,o,m,g,b,A,S){if(e==t)return A;let M,k;if(l===0){if(k=jo(m,g,s[e],s[e+1]),k<A){for(M=0;M<a;++M)b[M]=s[e+M];return b.length=a,k}return A}S=S||[NaN,NaN];let j=e+a;for(;j<t;)if(IE(s,j-a,j,a,m,g,S),k=jo(m,g,S[0],S[1]),k<A){for(A=k,M=0;M<a;++M)b[M]=S[M];b.length=a,j+=a}else j+=a*Math.max((Math.sqrt(k)-Math.sqrt(A))/l|0,1);if(o&&(IE(s,t-a,e,a,m,g,S),k=jo(m,g,S[0],S[1]),k<A)){for(A=k,M=0;M<a;++M)b[M]=S[M];b.length=a}return A}function yd(s,e,t,a,l,o,m,g,b,A,S){S=S||[NaN,NaN];for(let M=0,k=t.length;M<k;++M){let j=t[M];A=gd(s,e,j,a,l,o,m,g,b,A,S),e=j}return A}function TE(s,e,t,a,l,o,m,g,b,A,S){S=S||[NaN,NaN];for(let M=0,k=t.length;M<k;++M){let j=t[M];A=yd(s,e,j,a,l,o,m,g,b,A,S),e=j[j.length-1]}return A}function Wl(s,e,t,a,l,o,m){let g=(t-e)/a;if(g<3){for(;e<t;e+=a)o[m++]=s[e],o[m++]=s[e+1];return m}let b=new Array(g);b[0]=1,b[g-1]=1;let A=[e,t-a],S=0;for(;A.length>0;){let M=A.pop(),k=A.pop(),j=0,Z=s[k],te=s[k+1],q=s[M],H=s[M+1];for(let ae=k+a;ae<M;ae+=a){let pe=s[ae],ve=s[ae+1],de=sE(pe,ve,Z,te,q,H);de>j&&(S=ae,j=de)}j>l&&(b[(S-e)/a]=1,k+a<S&&A.push(k,S),S+a<M&&A.push(S,M))}for(let M=0;M<g;++M)b[M]&&(o[m++]=s[e+M*a],o[m++]=s[e+M*a+1]);return m}function Xm(s,e,t,a,l,o,m,g){for(let b=0,A=t.length;b<A;++b){let S=t[b];m=Wl(s,e,S,a,l,o,m),g.push(m),e=S}return m}function Ga(s,e){return e*Math.round(s/e)}function JO(s,e,t,a,l,o,m){if(e==t)return m;let g=Ga(s[e],l),b=Ga(s[e+1],l);e+=a,o[m++]=g,o[m++]=b;let A,S;do if(A=Ga(s[e],l),S=Ga(s[e+1],l),e+=a,e==t)return o[m++]=A,o[m++]=S,m;while(A==g&&S==b);for(;e<t;){let M=Ga(s[e],l),k=Ga(s[e+1],l);if(e+=a,M==A&&k==S)continue;let j=A-g,Z=S-b,te=M-g,q=k-b;if(j*q==Z*te&&(j<0&&te<j||j==te||j>0&&te>j)&&(Z<0&&q<Z||Z==q||Z>0&&q>Z)){A=M,S=k;continue}o[m++]=A,o[m++]=S,g=A,b=S,A=M,S=k}return o[m++]=A,o[m++]=S,m}function _d(s,e,t,a,l,o,m,g){for(let b=0,A=t.length;b<A;++b){let S=t[b];m=JO(s,e,S,a,l,o,m),g.push(m),e=S}return m}function CE(s,e,t,a,l,o,m,g){for(let b=0,A=t.length;b<A;++b){let S=t[b],M=[];m=_d(s,e,S,a,l,o,m,M),g.push(M),e=S[S.length-1]}return m}function wo(s,e,t,a,l){l=l!==void 0?l:[];let o=0;for(let m=e;m<t;m+=a)l[o++]=s.slice(m,m+a);return l.length=o,l}function Va(s,e,t,a,l){l=l!==void 0?l:[];let o=0;for(let m=0,g=t.length;m<g;++m){let b=t[m];l[o++]=wo(s,e,b,a,l[o]),e=b}return l.length=o,l}function xd(s,e,t,a,l){l=l!==void 0?l:[];let o=0;for(let m=0,g=t.length;m<g;++m){let b=t[m];l[o++]=b.length===1&&b[0]===e?[]:Va(s,e,b,a,l[o]),e=b[b.length-1]}return l.length=o,l}function Kx(s,e,t,a){let l=0,o=s[t-a],m=s[t-a+1];for(;e<t;e+=a){let g=s[e],b=s[e+1];l+=m*g-o*b,o=g,m=b}return l/2}function Yx(s,e,t,a){let l=0;for(let o=0,m=t.length;o<m;++o){let g=t[o];l+=Kx(s,e,g,a),e=g}return l}function ME(s,e,t,a){let l=0;for(let o=0,m=t.length;o<m;++o){let g=t[o];l+=Yx(s,e,g,a),e=g[g.length-1]}return l}var Jx=class s extends Vi{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new s(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,a,l){return l<Dn(this.getExtent(),e,t)?l:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(fd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),gd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,a,l))}getArea(){return Kx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return wo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=Wl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new s(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=$l(this.flatCoordinates,0,e,this.stride),this.changed()}},Qx=Jx;function Hm(s,e,t,a,l){let o;for(e+=a;e<t;e+=a)if(o=l(s.slice(e-a,e),s.slice(e,e+a)),o)return o;return!1}function Zl(s,e,t,a,l,o,m){let g,b,A=(t-e)/a;if(A===1)g=e;else if(A===2)g=e,b=l;else if(A!==0){let S=s[e],M=s[e+1],k=0,j=[0];for(let q=e+a;q<t;q+=a){let H=s[q],ae=s[q+1];k+=Math.sqrt((H-S)*(H-S)+(ae-M)*(ae-M)),j.push(k),S=H,M=ae}let Z=l*k,te=qA(j,Z);te<0?(b=(Z-j[-te-2])/(j[-te-1]-j[-te-2]),g=e+(-te-2)*a):g=e+te*a}m=m>1?m:2,o=o||new Array(m);for(let S=0;S<m;++S)o[S]=g===void 0?NaN:b===void 0?s[g+S]:Gi(s[g+S],s[g+a+S],b);return o}function Km(s,e,t,a,l,o){if(t==e)return null;let m;if(l<s[e+a-1])return o?(m=s.slice(e,e+a),m[a-1]=l,m):null;if(s[t-1]<l)return o?(m=s.slice(t-a,t),m[a-1]=l,m):null;if(l==s[e+a-1])return s.slice(e,e+a);let g=e/a,b=t/a;for(;g<b;){let k=g+b>>1;l<s[(k+1)*a-1]?b=k:g=k+1}let A=s[g*a-1];if(l==A)return s.slice((g-1)*a,(g-1)*a+a);let S=s[(g+1)*a-1],M=(l-A)/(S-A);m=[];for(let k=0;k<a-1;++k)m.push(Gi(s[(g-1)*a+k],s[g*a+k],M));return m.push(l),m}function RE(s,e,t,a,l,o,m){if(m)return Km(s,e,t[t.length-1],a,l,o);let g;if(l<s[a-1])return o?(g=s.slice(0,a),g[a-1]=l,g):null;if(s[s.length-1]<l)return o?(g=s.slice(s.length-a),g[a-1]=l,g):null;for(let b=0,A=t.length;b<A;++b){let S=t[b];if(e!=S){if(l<s[e+a-1])return null;if(l<=s[S-1])return Km(s,e,S,a,l,!1);e=S}}return null}function kE(s,e,t,a,l){return!XA(l,function(m){return!qa(s,e,t,a,m[0],m[1])})}function qa(s,e,t,a,l,o){let m=0,g=s[t-a],b=s[t-a+1];for(;e<t;e+=a){let A=s[e],S=s[e+1];b<=o?S>o&&(A-g)*(o-b)-(l-g)*(S-b)>0&&m++:S<=o&&(A-g)*(o-b)-(l-g)*(S-b)<0&&m--,g=A,b=S}return m!==0}function vd(s,e,t,a,l,o){if(t.length===0||!qa(s,e,t[0],a,l,o))return!1;for(let m=1,g=t.length;m<g;++m)if(qa(s,t[m-1],t[m],a,l,o))return!1;return!0}function FE(s,e,t,a,l,o){if(t.length===0)return!1;for(let m=0,g=t.length;m<g;++m){let b=t[m];if(vd(s,e,b,a,l,o))return!0;e=b[b.length-1]}return!1}function bd(s,e,t,a,l){let o=Mx(On(),s,e,t,a);return ei(l,o)?Qs(l,o)||o[0]>=l[0]&&o[2]<=l[2]||o[1]>=l[1]&&o[3]<=l[3]?!0:Hm(s,e,t,a,function(m,g){return YA(l,m,g)}):!1}function LE(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o){if(bd(s,e,t[o],a,l))return!0;e=t[o]}return!1}function QO(s,e,t,a,l){return!!(bd(s,e,t,a,l)||qa(s,e,t,a,l[0],l[1])||qa(s,e,t,a,l[0],l[3])||qa(s,e,t,a,l[2],l[1])||qa(s,e,t,a,l[2],l[3]))}function e0(s,e,t,a,l){if(!QO(s,e,t[0],a,l))return!1;if(t.length===1)return!0;for(let o=1,m=t.length;o<m;++o)if(kE(s,t[o-1],t[o],a,l)&&!bd(s,t[o-1],t[o],a,l))return!1;return!0}function DE(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o){let g=t[o];if(e0(s,e,g,a,l))return!0;e=g[g.length-1]}return!1}function Ym(s,e,t,a){let l=s[e],o=s[e+1],m=0;for(let g=e+a;g<t;g+=a){let b=s[g],A=s[g+1];m+=Math.sqrt((b-l)*(b-l)+(A-o)*(A-o)),l=b,o=A}return m}var t0=class s extends Vi{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){ji(this.flatCoordinates,e),this.changed()}clone(){let e=new s(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,a,l){return l<Dn(this.getExtent(),e,t)?l:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(fd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),gd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,a,l))}forEachSegment(e){return Hm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,Km(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return wo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return Zl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return Ym(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){let t=[];return t.length=Wl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new s(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return bd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=$l(this.flatCoordinates,0,e,this.stride),this.changed()}},Go=t0;var r0=class s extends Vi{constructor(e,t,a){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&a)this.setFlatCoordinates(t,e),this.ends_=a;else{let l=e,o=[],m=[];for(let b=0,A=l.length;b<A;++b){let S=l[b];ji(o,S.getFlatCoordinates()),m.push(o.length)}let g=l.length===0?this.getLayout():l[0].getLayout();this.setFlatCoordinates(g,o),this.ends_=m}}appendLineString(e){ji(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new s(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,a,l){return l<Dn(this.getExtent(),e,t)?l:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(md(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),yd(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,a,l))}getCoordinateAtM(e,t,a){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,a=a!==void 0?a:!1,RE(this.flatCoordinates,0,this.ends_,this.stride,e,t,a))}getCoordinates(){return Va(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new Go(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,a=this.layout,l=[],o=0;for(let m=0,g=t.length;m<g;++m){let b=t[m],A=new Go(e.slice(o,b),a);l.push(A),o=b}return l}getFlatMidpoints(){let e=[],t=this.flatCoordinates,a=0,l=this.ends_,o=this.stride;for(let m=0,g=l.length;m<g;++m){let b=l[m],A=Zl(t,a,b,o,.5);ji(e,A),a=b}return e}getSimplifiedGeometryInternal(e){let t=[],a=[];return t.length=Xm(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,a),new s(t,"XY",a)}getType(){return"MultiLineString"}intersectsExtent(e){return LE(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let a=Ua(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=a.length===0?0:a[a.length-1],this.changed()}},i0=r0;var n0=class s extends Vi{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let e=new s(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,a,l){let o=this.flatCoordinates,m=jo(e,t,o[0],o[1]);if(m<l){let g=this.stride;for(let b=0;b<g;++b)a[b]=o[b];return a.length=g,m}return l}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return Ba(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return ld(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=EE(this.flatCoordinates,0,e,this.stride),this.changed()}},Ei=n0;var o0=class s extends Vi{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){ji(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new s(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,a,l){if(l<Dn(this.getExtent(),e,t))return l;let o=this.flatCoordinates,m=this.stride;for(let g=0,b=o.length;g<b;g+=m){let A=jo(e,t,o[g],o[g+1]);if(A<l){l=A;for(let S=0;S<m;++S)a[S]=o[g+S];a.length=m}}return l}getCoordinates(){return wo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Ei(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,a=this.stride,l=[];for(let o=0,m=e.length;o<m;o+=a){let g=new Ei(e.slice(o,o+a),t);l.push(g)}return l}getType(){return"MultiPoint"}intersectsExtent(e){let t=this.flatCoordinates,a=this.stride;for(let l=0,o=t.length;l<o;l+=a){let m=t[l],g=t[l+1];if(ld(e,m,g))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=$l(this.flatCoordinates,0,e,this.stride),this.changed()}},wd=o0;function Sd(s,e,t,a,l,o,m){let g,b,A,S,M,k,j,Z=l[o+1],te=[];for(let ae=0,pe=t.length;ae<pe;++ae){let ve=t[ae];for(S=s[ve-a],k=s[ve-a+1],g=e;g<ve;g+=a)M=s[g],j=s[g+1],(Z<=k&&j<=Z||k<=Z&&Z<=j)&&(A=(Z-k)/(j-k)*(M-S)+S,te.push(A)),S=M,k=j}let q=NaN,H=-1/0;for(te.sort(Bo),S=te[0],g=1,b=te.length;g<b;++g){M=te[g];let ae=Math.abs(M-S);ae>H&&(A=(S+M)/2,vd(s,e,t,a,A,Z)&&(q=A,H=ae)),S=M}return isNaN(q)&&(q=l[o]),m?(m.push(q,Z,H),m):[q,Z,H]}function Jm(s,e,t,a,l){let o=[];for(let m=0,g=t.length;m<g;++m){let b=t[m];o=Sd(s,e,b,a,l,2*m,o),e=b[b.length-1]}return o}function OE(s,e,t,a){for(;e<t-a;){for(let l=0;l<a;++l){let o=s[e+l];s[e+l]=s[t-a+l],s[t-a+l]=o}e+=a,t-=a}}function s0(s,e,t,a){let l=0,o=s[t-a],m=s[t-a+1];for(;e<t;e+=a){let g=s[e],b=s[e+1];l+=(g-o)*(b+m),o=g,m=b}return l===0?void 0:l>0}function Ad(s,e,t,a,l){l=l!==void 0?l:!1;for(let o=0,m=t.length;o<m;++o){let g=t[o],b=s0(s,e,g,a);if(o===0){if(l&&b||!l&&!b)return!1}else if(l&&!b||!l&&b)return!1;e=g}return!0}function Qm(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o){let g=t[o];if(!Ad(s,e,g,a,l))return!1;g.length&&(e=g[g.length-1])}return!0}function Eu(s,e,t,a,l){l=l!==void 0?l:!1;for(let o=0,m=t.length;o<m;++o){let g=t[o],b=s0(s,e,g,a);(o===0?l&&b||!l&&!b:l&&!b||!l&&b)&&OE(s,e,g,a),e=g}return e}function Ed(s,e,t,a,l){for(let o=0,m=t.length;o<m;++o)e=Eu(s,e,t[o],a,l);return e}function zE(s,e){let t=[],a=0,l=0,o;for(let m=0,g=e.length;m<g;++m){let b=e[m],A=s0(s,a,b,2);if(o===void 0&&(o=A),A===o)t.push(e.slice(l,m+1));else{if(t.length===0)continue;t[t.length-1].push(e[l])}l=m+1,a=b}return t}var Id=class s extends Vi{constructor(e,t,a){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&a?(this.setFlatCoordinates(t,e),this.ends_=a):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?ji(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new s(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,a,l){return l<Dn(this.getExtent(),e,t)?l:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(md(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),yd(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,a,l))}containsXY(e,t){return vd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return Yx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Eu(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Va(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=bo(this.getExtent());this.flatInteriorPoint_=Sd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ei(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new Qx(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,a=this.ends_,l=[],o=0;for(let m=0,g=a.length;m<g;++m){let b=a[m],A=new Qx(t.slice(o,b),e);l.push(A),o=b}return l}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Ad(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Eu(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],a=[];return t.length=_d(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,a),new s(t,"XY",a)}getType(){return"Polygon"}intersectsExtent(e){return e0(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let a=Ua(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=a.length===0?0:a[a.length-1],this.changed()}},Iu=Id;function a0(s){if(cd(s))throw new Error("Cannot create polygon from empty extent");let e=s[0],t=s[1],a=s[2],l=s[3],o=[e,t,e,l,a,l,a,t,e,t];return new Id(o,"XY",[o.length])}function l0(s,e,t){e=e||32;let a=s.getStride(),l=s.getLayout(),o=s.getCenter(),m=a*(e+1),g=new Array(m);for(let S=0;S<m;S+=a){g[S]=0,g[S+1]=0;for(let M=2;M<a;M++)g[S+M]=o[M]}let b=[g.length],A=new Id(g,l,b);return ez(A,o,s.getRadius(),t),A}function ez(s,e,t,a){let l=s.getFlatCoordinates(),o=s.getStride(),m=l.length/o-1,g=a||0;for(let b=0;b<=m;++b){let A=b*o,S=g+Ul(b,m)*2*Math.PI/m;l[A]=e[0]+t*Math.cos(S),l[A+1]=e[1]+t*Math.sin(S)}s.changed()}function eg(s,e,t,a){let l=[],o=On();for(let m=0,g=t.length;m<g;++m){let b=t[m];o=vu(s,e,b[0],a),l.push((o[0]+o[2])/2,(o[1]+o[3])/2),e=b[b.length-1]}return l}var c0=class s extends Vi{constructor(e,t,a){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!a&&!Array.isArray(e[0])){let l=e,o=[],m=[];for(let g=0,b=l.length;g<b;++g){let A=l[g],S=o.length,M=A.getEnds();for(let k=0,j=M.length;k<j;++k)M[k]+=S;ji(o,A.getFlatCoordinates()),m.push(M)}t=l.length===0?this.getLayout():l[0].getLayout(),e=o,a=m}t!==void 0&&a?(this.setFlatCoordinates(t,e),this.endss_=a):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let a=this.flatCoordinates.length;ji(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let l=0,o=t.length;l<o;++l)t[l]+=a}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let l=0;l<e;++l)t[l]=this.endss_[l].slice();let a=new s(this.flatCoordinates.slice(),this.layout,t);return a.applyProperties(this),a}closestPointXY(e,t,a,l){return l<Dn(this.getExtent(),e,t)?l:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(PE(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),TE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,a,l))}containsXY(e,t){return FE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return ME(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Ed(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,xd(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=eg(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Jm(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new wd(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Qm(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Ed(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],a=[];return t.length=CE(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,a),new s(t,"XY",a)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let o=this.endss_[e-1];t=o[o.length-1]}let a=this.endss_[e].slice(),l=a[a.length-1];if(t!==0)for(let o=0,m=a.length;o<m;++o)a[o]-=t;return new Iu(this.flatCoordinates.slice(t,l),this.layout,a)}getPolygons(){let e=this.layout,t=this.flatCoordinates,a=this.endss_,l=[],o=0;for(let m=0,g=a.length;m<g;++m){let b=a[m].slice(),A=b[b.length-1];if(o!==0)for(let M=0,k=b.length;M<k;++M)b[M]-=o;let S=new Iu(t.slice(o,A),e,b);l.push(S),o=A}return l}getType(){return"MultiPolygon"}intersectsExtent(e){return DE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let a=Zm(this.flatCoordinates,0,e,this.stride,this.endss_);if(a.length===0)this.flatCoordinates.length=0;else{let l=a[a.length-1];this.flatCoordinates.length=l.length===0?0:l[l.length-1]}this.changed()}},u0=c0;var tz=(s,e,t)=>{let{coordinate:a,olGeometry:l,time_intervals:o}=e.properties,{coordinates:m,type:g}=e.geometry,b=l,A,S;if(l&&(g=b.getType(),m=b.getCoordinates()),t&&a)A=a;else if(g==="Point")A=m;else if(g==="LineString"){b||(b=new Go(m));let M=o||[[]],k=M[0],j=M[M.length-1];if(s<k[0])[,,S]=k,A=b.getFirstCoordinate();else if(s>j[0])[,,S]=j,A=b.getLastCoordinate();else for(let Z=0;Z<M.length-1;Z+=1){let[te,q]=M[Z],[H,ae]=M[Z+1];if(te<=s&&s<=H){let ve=Math.min((s-te)/(H-te),1)*(ae-q)+q;A=b.getCoordinateAt(ve),[,,S]=M[Z];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",b);return{coord:A,rotation:S}},Pd=tz;var rz=(s,e,t,a,l)=>{if(!s)return{renderedTrajectories:[]};let{center:o,pixelRatio:m=1,resolution:g,rotation:b=0,size:A=[],time:S=Date.now()}=a;if(!g||!o)return{renderedTrajectories:[]};let{filter:M,getScreenPixel:k=(Ae,ut)=>(ut.zoom||0)<12?Ae.map(Ve=>Math.floor(Ve)):Ae,hoverVehicleId:j,noInterpolate:Z=!1,selectedVehicleId:te}=l,q=s.getContext("2d");q?.clearRect(0,0,s.width,s.height);let[H,ae]=A;H&&ae&&(s.width!==H||s.height!==ae)&&([s.width,s.height]=[H*m,ae*m]);let pe=ln(wi(),A[0]/2,A[1]/2,1/g,-1/g,-b,-o[0],-o[1]);s.style&&(s.style.width=`${s.width/m}px`,s.style.height=`${s.height/m}px`);let ve,de,_e,Pe,Re=[];for(let Ae=e.length-1;Ae>=0;Ae-=1){let ut=e[Ae];if(M&&!M(ut))continue;let{timeOffset:Ve,train_id:Ue}=ut.properties,{coord:pt,rotation:Tt}=Pd(S-(Ve||0),ut,Z);if(e[Ae].properties.coordinate=pt,e[Ae].properties.rotation=Tt,!pt)continue;let Qe=Ni(pe,[...pt]);if(!Qe||(Qe=Qe.map(yt=>yt*m),Qe[0]<0||Qe[0]>s.width||Qe[1]<0||Qe[1]>s.height))continue;let nt=t(ut,a,l);if(nt){if(j!==Ue&&te!==Ue){let[yt,dt]=k([Qe[0]-nt.width/2,Qe[1]-nt.height/2],a);q?.drawImage(nt,yt,dt)}j&&j===Ue&&(ve=nt,de=Qe),te&&te===Ue&&(_e=nt,Pe=Qe),Re.push(ut)}}return _e&&Pe&&q?.drawImage(_e,Math.floor(Pe[0]-_e.width/2),Math.floor(Pe[1]-_e.height/2)),ve&&de&&q?.drawImage(ve,Math.floor(de[0]-ve.width/2),Math.floor(de[1]-ve.height/2)),{renderedTrajectories:Re}},Td=rz;var iz=(s,e,t=!1)=>{let a=["HIDDEN","LEAVING","BOARDING"],l=s.has_fzo&&a.indexOf(s.state)>-1,o=e.has_fzo&&a.indexOf(e.state)>-1;if(l||o){if(l!==o)return l?-1:1;if(s.state!==e.state)return a.indexOf(s.state)-a.indexOf(e.state)}let m=null,g=null,b=Date.now();return t?(m=new Date(s.min_arrival_time||s.time).getTime()-b,g=new Date(e.min_arrival_time||e.time).getTime()-b):(m=new Date(s.time).getTime()-b,g=new Date(e.time).getTime()-b),m-g},Cd=iz;var nz=(s,e=!1,t=30)=>{let a=Object.keys(s).map(M=>s[M]);a.sort((M,k)=>Cd(M,k,e));let l=new Date;l.setMinutes(l.getMinutes()+t);let o=l.getTime(),m=new Date;m.setMinutes(m.getMinutes()-t);let g=m.getTime(),b=[],A=[],S=null;for(let M=a.length-1;M>=0;M-=1){let k={...a[M]},j=new Date(k.time).getTime();j>g&&j<o&&(k.state==="BOARDING"&&(A.includes(k.platform)?k.state="HIDDEN":A.push(k.platform)),S&&k.to[0]===S.to[0]&&Math.abs(j-S.time)<1e3&&k.line.name===S.line.name&&(k.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(k.state)&&(k.cancelled=!0),S=k,S.time=j,b.unshift(k))}return b},Md=nz;var oz=(s,e=!1,t=30,a=100)=>{let l={},o={};return m=>{let{source:g,content:b}=m;l[g]&&window.clearTimeout(l[g]),b&&(o[b.call_id]=b,l[g]=window.setTimeout(()=>{let A=Md(o,e||!1,t);s(A)},a))}},h0=oz;var Pu={};nx(Pu,{MOTS_ALL:()=>lz,MOTS_ONLY_RAIL:()=>Vo,MOTS_WITHOUT_CABLE:()=>tg,MOTS_WITH_CABLE:()=>az,bgColors:()=>NE,getBgColor:()=>uz,getDelayColor:()=>dz,getDelayText:()=>fz,getRadius:()=>cz,getTextColor:()=>hz,getTextSize:()=>pz,getTypeIndex:()=>rg,textColors:()=>jE,types:()=>BE});var sz=[[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15]],Vo=["rail"],az=["cablecar","gondola","funicular","coach"],tg=["tram","subway","rail","bus"],lz=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"],BE=[/^Tram/i,/^Subway( \/ Metro \/ S-Bahn)?/i,/^Train/i,/^Bus/i,/^Ferry/i,/^Cable ?Car/i,/^Gondola/i,/^Funicular/i,/^(Long distance bus|coach)/i,/^Rail/i],NE=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],jE=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],rg=s=>typeof s=="string"?BE.findIndex(e=>e.test(s)):s,cz=(s,e)=>{try{let t=rg(s||0);return sz[t][e]}catch{return 1}},uz=s=>{try{let e=rg(s);return NE[e]}catch{return"#ffffff"}},hz=s=>{try{let e=rg(s);return jE[e]}catch{return"#ffffff"}},pz=(s,e,t,a,l)=>{if(!s)return 0;s.font=l(a,t);let o=s.measureText(t),m=25,g=0;for(;o.width>e-6&&g<m;)a-=.5,s.font=l(a,t),o=s.measureText(t),g+=1;return a},dz=(s,e,t)=>e?t?"#ff0000":"#a0a0a0":s===null?"#a0a0a0":s>=36e5?"#ed004c":s>=5e5?"#e80000":s>=3e5?"#ff4a00":s>=18e4?"#f7bf00":"#00a00c",fz=(s,e)=>e?String.fromCodePoint(215):s>=36e5?`+${Math.round(s/36e5)}h`:s>=6e4?`+${Math.round(s/6e4)}m`:s>=1e3?`+${Math.round(s/1e3)}s`:s>0?`+${s}ms`:"";var Tu="vectorTileFeature";var lr={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var p0=class extends Si{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[lr.OPACITY]=e.opacity!==void 0?e.opacity:1,Ar(typeof t[lr.OPACITY]=="number","Layer opacity must be a number"),t[lr.VISIBLE]=e.visible!==void 0?e.visible:!0,t[lr.Z_INDEX]=e.zIndex,t[lr.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[lr.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[lr.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[lr.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},a=this.getZIndex();return t.opacity=Br(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=a===void 0&&!t.managed?1/0:a,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return Pt()}getLayerStatesArray(e){return Pt()}getExtent(){return this.get(lr.EXTENT)}getMaxResolution(){return this.get(lr.MAX_RESOLUTION)}getMinResolution(){return this.get(lr.MIN_RESOLUTION)}getMinZoom(){return this.get(lr.MIN_ZOOM)}getMaxZoom(){return this.get(lr.MAX_ZOOM)}getOpacity(){return this.get(lr.OPACITY)}getSourceState(){return Pt()}getVisible(){return this.get(lr.VISIBLE)}getZIndex(){return this.get(lr.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(lr.EXTENT,e)}setMaxResolution(e){this.set(lr.MAX_RESOLUTION,e)}setMinResolution(e){this.set(lr.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(lr.MAX_ZOOM,e)}setMinZoom(e){this.set(lr.MIN_ZOOM,e)}setOpacity(e){Ar(typeof e=="number","Layer opacity must be a number"),this.set(lr.OPACITY,e)}setVisible(e){this.set(lr.VISIBLE,e)}setZIndex(e){this.set(lr.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},UE=p0;var ms={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Bn={ANIMATING:0,INTERACTING:1};var So={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function d0(s,e,t){return function(a,l,o,m,g){if(!a)return;if(!l&&!e)return a;let b=e?0:o[0]*l,A=e?0:o[1]*l,S=g?g[0]:0,M=g?g[1]:0,k=s[0]+b/2+S,j=s[2]-b/2+S,Z=s[1]+A/2+M,te=s[3]-A/2+M;k>j&&(k=(j+k)/2,j=k),Z>te&&(Z=(te+Z)/2,te=Z);let q=Br(a[0],k,j),H=Br(a[1],Z,te);if(m&&t&&l){let ae=30*l;q+=-ae*Math.log(1+Math.max(0,k-a[0])/ae)+ae*Math.log(1+Math.max(0,a[0]-j)/ae),H+=-ae*Math.log(1+Math.max(0,Z-a[1])/ae)+ae*Math.log(1+Math.max(0,a[1]-te)/ae)}return[q,H]}}function GE(s){return s}function f0(s,e,t,a){let l=kr(e)/t[0],o=si(e)/t[1];return a?Math.min(s,Math.max(l,o)):Math.min(s,Math.min(l,o))}function m0(s,e,t){let a=Math.min(s,e),l=50;return a*=Math.log(1+l*Math.max(0,s/e-1))/l+1,t&&(a=Math.max(a,t),a/=Math.log(1+l*Math.max(0,t/s-1))/l+1),Br(a,t/2,e*2)}function VE(s,e,t,a){return e=e!==void 0?e:!0,function(l,o,m,g){if(l!==void 0){let b=s[0],A=s[s.length-1],S=t?f0(b,t,m,a):b;if(g)return e?m0(l,S,A):Br(l,A,S);let M=Math.min(S,l),k=Math.floor(Fm(s,M,o));return s[k]>S&&k<s.length-1?s[k+1]:s[k]}}}function qE(s,e,t,a,l,o){return a=a!==void 0?a:!0,t=t!==void 0?t:0,function(m,g,b,A){if(m!==void 0){let S=l?f0(e,l,b,o):e;if(A)return a?m0(m,S,t):Br(m,t,S);let M=1e-9,k=Math.ceil(Math.log(e/S)/Math.log(s)-M),j=-g*(.5-M)+.5,Z=Math.min(S,m),te=Math.floor(Math.log(e/Z)/Math.log(s)+j),q=Math.max(k,te),H=e/Math.pow(s,q);return Br(H,t,S)}}}function g0(s,e,t,a,l){return t=t!==void 0?t:!0,function(o,m,g,b){if(o!==void 0){let A=a?f0(s,a,g,l):s;return!t||!b?Br(o,e,A):m0(o,A,e)}}}function $E(s){if(s!==void 0)return 0}function y0(s){if(s!==void 0)return s}function WE(s){let e=2*Math.PI/s;return function(t,a){if(a)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t}}function ZE(s){let e=s===void 0?lE(5):s;return function(t,a){return a||t===void 0?t:Math.abs(t)<=e?0:t}}function mz(s){return Math.pow(s,3)}function XE(s){return 1-mz(1-s)}function HE(s){return 3*s*s-2*s*s*s}var _0=0,v0=class extends Si{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Vm(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&Vx(),e.center&&(e.center=ti(e.center,this.projection_)),e.extent&&(e.extent=fs(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let g in So)delete t[g];this.setProperties(t,!0);let a=yz(e);this.maxResolution_=a.maxResolution,this.minResolution_=a.minResolution,this.zoomFactor_=a.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=a.minZoom;let l=gz(e),o=a.constraint,m=_z(e);this.constraints_={center:l,resolution:o,rotation:m},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let a=this.getCenterInternal();if(a){let l=e||[0,0,0,0];t=t||[0,0,0,0];let o=this.getResolution(),m=o/2*(l[3]-t[3]+t[1]-l[1]),g=o/2*(l[0]-t[0]+t[2]-l[2]);this.setCenterInternal([a[0]+m,a[1]-g])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let a=0;a<t.length;++a){let l=arguments[a];l.center&&(l=Object.assign({},l),l.center=ti(l.center,this.getProjection())),l.anchor&&(l=Object.assign({},l),l.anchor=ti(l.anchor,this.getProjection())),t[a]=l}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,a;t>1&&typeof arguments[t-1]=="function"&&(a=arguments[t-1],--t);let l=0;for(;l<t&&!this.isDef();++l){let S=arguments[l];S.center&&this.setCenterInternal(S.center),S.zoom!==void 0?this.setZoom(S.zoom):S.resolution&&this.setResolution(S.resolution),S.rotation!==void 0&&this.setRotation(S.rotation)}if(l===t){a&&ig(a,!0);return}let o=Date.now(),m=this.targetCenter_.slice(),g=this.targetResolution_,b=this.targetRotation_,A=[];for(;l<t;++l){let S=arguments[l],M={start:o,complete:!1,anchor:S.anchor,duration:S.duration!==void 0?S.duration:1e3,easing:S.easing||HE,callback:a};if(S.center&&(M.sourceCenter=m,M.targetCenter=S.center.slice(),m=M.targetCenter),S.zoom!==void 0?(M.sourceResolution=g,M.targetResolution=this.getResolutionForZoom(S.zoom),g=M.targetResolution):S.resolution&&(M.sourceResolution=g,M.targetResolution=S.resolution,g=M.targetResolution),S.rotation!==void 0){M.sourceRotation=b;let k=Ul(S.rotation-b+Math.PI,2*Math.PI)-Math.PI;M.targetRotation=b+k,b=M.targetRotation}xz(M)?M.complete=!0:o+=M.duration,A.push(M)}this.animations_.push(A),this.setHint(Bn.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Bn.ANIMATING]>0}getInteracting(){return this.hints_[Bn.INTERACTING]>0}cancelAnimations(){this.setHint(Bn.ANIMATING,-this.hints_[Bn.ANIMATING]);let e;for(let t=0,a=this.animations_.length;t<a;++t){let l=this.animations_[t];if(l[0].callback&&ig(l[0].callback,!1),!e)for(let o=0,m=l.length;o<m;++o){let g=l[o];if(!g.complete){e=g.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let a=this.animations_.length-1;a>=0;--a){let l=this.animations_[a],o=!0;for(let m=0,g=l.length;m<g;++m){let b=l[m];if(b.complete)continue;let A=e-b.start,S=b.duration>0?A/b.duration:1;S>=1?(b.complete=!0,S=1):o=!1;let M=b.easing(S);if(b.sourceCenter){let k=b.sourceCenter[0],j=b.sourceCenter[1],Z=b.targetCenter[0],te=b.targetCenter[1];this.nextCenter_=b.targetCenter;let q=k+M*(Z-k),H=j+M*(te-j);this.targetCenter_=[q,H]}if(b.sourceResolution&&b.targetResolution){let k=M===1?b.targetResolution:b.sourceResolution+M*(b.targetResolution-b.sourceResolution);if(b.anchor){let j=this.getViewportSize_(this.getRotation()),Z=this.constraints_.resolution(k,0,j,!0);this.targetCenter_=this.calculateCenterZoom(Z,b.anchor)}this.nextResolution_=b.targetResolution,this.targetResolution_=k,this.applyTargetState_(!0)}if(b.sourceRotation!==void 0&&b.targetRotation!==void 0){let k=M===1?Ul(b.targetRotation+Math.PI,2*Math.PI)-Math.PI:b.sourceRotation+M*(b.targetRotation-b.sourceRotation);if(b.anchor){let j=this.constraints_.rotation(k,!0);this.targetCenter_=this.calculateCenterRotate(j,b.anchor)}this.nextRotation_=b.targetRotation,this.targetRotation_=k}if(this.applyTargetState_(!0),t=!0,!b.complete)break}if(o){this.animations_[a]=null,this.setHint(Bn.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let m=l[0].callback;m&&ig(m,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let a,l=this.getCenterInternal();return l!==void 0&&(a=[l[0]-t[0],l[1]-t[1]],hE(a,e-this.getRotation()),uE(a,t)),a}calculateCenterZoom(e,t){let a,l=this.getCenterInternal(),o=this.getResolution();if(l!==void 0&&o!==void 0){let m=t[0]-e*(t[0]-l[0])/o,g=t[1]-e*(t[1]-l[1])/o;a=[m,g]}return a}getViewportSize_(e){let t=this.viewportSize_;if(e){let a=t[0],l=t[1];return[Math.abs(a*Math.cos(e))+Math.abs(l*Math.sin(e)),Math.abs(a*Math.sin(e))+Math.abs(l*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&ql(e,this.getProjection())}getCenterInternal(){return this.get(So.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return ds(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();Ar(t,"The view center is not defined");let a=this.getResolution();Ar(a!==void 0,"The view resolution is not defined");let l=this.getRotation();return Ar(l!==void 0,"The view rotation is not defined"),HA(t,a,l,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(So.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(fs(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let a=kr(e)/t[0],l=si(e)/t[1];return Math.max(a,l)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),a=this.minResolution_,l=Math.log(t/a)/Math.log(e);return function(o){return t/Math.pow(e,o*l)}}getRotation(){return this.get(So.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),a=this.getConstrainedResolution(this.maxResolution_),l=this.minResolution_,o=Math.log(a/l)/t;return function(m){return Math.log(a/m)/t/o}}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),a=this.padding_;return a&&(t=[t[0]-a[1]-a[3],t[1]-a[0]-a[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),a=this.getRotation(),l=this.getCenterInternal(),o=this.padding_;if(o){let m=this.getViewportSizeMinusPadding_();l=x0(l,this.getViewportSize_(),[m[0]/2+o[3],m[1]/2+o[0]],t,a)}return{center:l.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:a,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,a,l;if(this.resolutions_){let o=Fm(this.resolutions_,e,1);t=o,a=this.resolutions_[o],o==this.resolutions_.length-1?l=2:l=a/this.resolutions_[o+1]}else a=this.maxResolution_,l=this.zoomFactor_;return t+Math.log(a/e)/Math.log(l)}getResolutionForZoom(e){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;let t=Br(Math.floor(e),0,this.resolutions_.length-2),a=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(a,Br(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let a;if(Ar(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Ar(!cd(e),"Cannot fit empty extent provided as `geometry`");let l=fs(e,this.getProjection());a=a0(l)}else if(e.getType()==="Circle"){let l=fs(e.getExtent(),this.getProjection());a=a0(l),a.rotate(this.getRotation(),bo(l))}else{let l=co();l?a=e.clone().transform(l,this.getProjection()):a=e}this.fitInternal(a,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),a=Math.cos(t),l=Math.sin(-t),o=e.getFlatCoordinates(),m=e.getStride(),g=1/0,b=1/0,A=-1/0,S=-1/0;for(let M=0,k=o.length;M<k;M+=m){let j=o[M]*a-o[M+1]*l,Z=o[M]*l+o[M+1]*a;g=Math.min(g,j),b=Math.min(b,Z),A=Math.max(A,j),S=Math.max(S,Z)}return[g,b,A,S]}fitInternal(e,t){t=t||{};let a=t.size;a||(a=this.getViewportSizeMinusPadding_());let l=t.padding!==void 0?t.padding:[0,0,0,0],o=t.nearest!==void 0?t.nearest:!1,m;t.minResolution!==void 0?m=t.minResolution:t.maxZoom!==void 0?m=this.getResolutionForZoom(t.maxZoom):m=0;let g=this.rotatedExtentForGeometry(e),b=this.getResolutionForExtentInternal(g,[a[0]-l[1]-l[3],a[1]-l[0]-l[2]]);b=isNaN(b)?m:Math.max(b,m),b=this.getConstrainedResolution(b,o?0:1);let A=this.getRotation(),S=Math.sin(A),M=Math.cos(A),k=bo(g);k[0]+=(l[1]-l[3])/2*b,k[1]+=(l[0]-l[2])/2*b;let j=k[0]*M-k[1]*S,Z=k[1]*M+k[0]*S,te=this.getConstrainedCenter([j,Z],b),q=t.callback?t.callback:No;t.duration!==void 0?this.animateInternal({resolution:b,center:te,duration:t.duration,easing:t.easing},q):(this.targetResolution_=b,this.targetCenter_=te,this.applyTargetState_(!1,!0),ig(q,!0))}centerOn(e,t,a){this.centerOnInternal(ti(e,this.getProjection()),t,a)}centerOnInternal(e,t,a){this.setCenterInternal(x0(e,t,a,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,a,l){let o,m=this.padding_;if(m&&e){let g=this.getViewportSizeMinusPadding_(-a),b=x0(e,l,[g[0]/2+m[3],g[1]/2+m[0]],t,a);o=[e[0]-b[0],e[1]-b[1]]}return o}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=ql(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&ti(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let a=this.getAnimating()||this.getInteracting(),l=this.getViewportSize_(this.getRotation()),o=this.constraints_.resolution(this.targetResolution_*e,0,l,a);t&&(this.targetCenter_=this.calculateCenterZoom(o,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=ti(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let a=this.getAnimating()||this.getInteracting(),l=this.constraints_.rotation(this.targetRotation_+e,a);t&&(this.targetCenter_=this.calculateCenterRotate(l,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&ti(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let a=this.getAnimating()||this.getInteracting()||t,l=this.constraints_.rotation(this.targetRotation_,a),o=this.getViewportSize_(l),m=this.constraints_.resolution(this.targetResolution_,0,o,a),g=this.constraints_.center(this.targetCenter_,m,o,a,this.calculateCenterShift(this.targetCenter_,m,l,o));this.get(So.ROTATION)!==l&&this.set(So.ROTATION,l),this.get(So.RESOLUTION)!==m&&(this.set(So.RESOLUTION,m),this.set("zoom",this.getZoom(),!0)),(!g||!this.get(So.CENTER)||!An(this.get(So.CENTER),g))&&this.set(So.CENTER,g),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,a){e=e!==void 0?e:200;let l=t||0,o=this.constraints_.rotation(this.targetRotation_),m=this.getViewportSize_(o),g=this.constraints_.resolution(this.targetResolution_,l,m),b=this.constraints_.center(this.targetCenter_,g,m,!1,this.calculateCenterShift(this.targetCenter_,g,o,m));if(e===0&&!this.cancelAnchor_){this.targetResolution_=g,this.targetRotation_=o,this.targetCenter_=b,this.applyTargetState_();return}a=a||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==g||this.getRotation()!==o||!this.getCenterInternal()||!An(this.getCenterInternal(),b))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:o,center:b,resolution:g,duration:e,easing:XE,anchor:a}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Bn.INTERACTING,1)}endInteraction(e,t,a){a=a&&ti(a,this.getProjection()),this.endInteractionInternal(e,t,a)}endInteractionInternal(e,t,a){this.getInteracting()&&(this.setHint(Bn.INTERACTING,-1),this.resolveConstraints(e,t,a))}getConstrainedCenter(e,t){let a=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),a)}getConstrainedZoom(e,t){let a=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(a,t))}getConstrainedResolution(e,t){t=t||0;let a=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,a)}};function ig(s,e){setTimeout(function(){s(e)},0)}function gz(s){if(s.extent!==void 0){let t=s.smoothExtentConstraint!==void 0?s.smoothExtentConstraint:!0;return d0(s.extent,s.constrainOnlyCenter,t)}let e=Vm(s.projection,"EPSG:3857");if(s.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,d0(t,!1,!1)}return GE}function yz(s){let e,t,a,m=s.minZoom!==void 0?s.minZoom:_0,g=s.maxZoom!==void 0?s.maxZoom:28,b=s.zoomFactor!==void 0?s.zoomFactor:2,A=s.multiWorld!==void 0?s.multiWorld:!1,S=s.smoothResolutionConstraint!==void 0?s.smoothResolutionConstraint:!0,M=s.showFullExtent!==void 0?s.showFullExtent:!1,k=Vm(s.projection,"EPSG:3857"),j=k.getExtent(),Z=s.constrainOnlyCenter,te=s.extent;if(!A&&!te&&k.isGlobal()&&(Z=!1,te=j),s.resolutions!==void 0){let q=s.resolutions;t=q[m],a=q[g]!==void 0?q[g]:q[q.length-1],s.constrainResolution?e=VE(q,S,!Z&&te,M):e=g0(t,a,S,!Z&&te,M)}else{let H=(j?Math.max(kr(j),si(j)):360*ud.degrees/k.getMetersPerUnit())/256/Math.pow(2,_0),ae=H/Math.pow(2,28-_0);t=s.maxResolution,t!==void 0?m=0:t=H/Math.pow(b,m),a=s.minResolution,a===void 0&&(s.maxZoom!==void 0?s.maxResolution!==void 0?a=t/Math.pow(b,g):a=H/Math.pow(b,g):a=ae),g=m+Math.floor(Math.log(t/a)/Math.log(b)),a=t/Math.pow(b,g-m),s.constrainResolution?e=qE(b,t,a,S,!Z&&te,M):e=g0(t,a,S,!Z&&te,M)}return{constraint:e,maxResolution:t,minResolution:a,minZoom:m,zoomFactor:b}}function _z(s){if(s.enableRotation!==void 0?s.enableRotation:!0){let t=s.constrainRotation;return t===void 0||t===!0?ZE():t===!1?y0:typeof t=="number"?WE(t):y0}return $E}function xz(s){return!(s.sourceCenter&&s.targetCenter&&!An(s.sourceCenter,s.targetCenter)||s.sourceResolution!==s.targetResolution||s.sourceRotation!==s.targetRotation)}function x0(s,e,t,a,l){let o=Math.cos(-l),m=Math.sin(-l),g=s[0]*o-s[1]*m,b=s[1]*o+s[0]*m;g+=(e[0]/2-t[0])*a,b+=(t[1]-e[1]/2)*a,m=-m;let A=g*o-b*m,S=b*o+g*m;return[A,S]}var b0=v0;var w0=class extends UE{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(lr.SOURCE,this.handleSourcePropertyChange_);let a=e.source?e.source:null;this.setSource(a)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(lr.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(cn(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=Ui(e,Ir.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,a=this.getMapInternal();!e&&a&&(e=a.getView()),e instanceof b0?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&a&&(t.layerStatesArray=a.getLayerGroup().getLayerStatesArray());let l;t.layerStatesArray?l=t.layerStatesArray.find(m=>m.layer===this):l=this.getLayerState();let o=this.getExtent();return S0(l,t.viewState)&&(!o||ei(o,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t,a=this.getSource();if(a&&(t=a.getAttributions()),!t)return[];let l=e instanceof b0?e.getViewStateAndExtent():e,o=t(l);return Array.isArray(o)||(o=[o]),o}render(e,t){let a=this.getRenderer();return a.prepareFrame(e)?(this.rendered=!0,a.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(lr.MAP,e)}getMapInternal(){return this.get(lr.MAP)}setMap(e){this.mapPrecomposeKey_&&(cn(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(cn(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=Ui(e,ms.PRECOMPOSE,function(t){let l=t.frameState.layerStatesArray,o=this.getLayerState(!1);Ar(!l.some(function(m){return m.layer===o.layer}),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),l.push(o)},this),this.mapRenderKey_=Ui(this,Ir.CHANGE,e.render,e),this.changed())}setSource(e){this.set(lr.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}};function S0(s,e){if(!s.visible)return!1;let t=e.resolution;if(t<s.minResolution||t>=s.maxResolution)return!1;let a=e.zoom;return a>s.minZoom&&a<=s.maxZoom}var qo=w0;var KE={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var $a=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",u7=$a.includes("firefox"),vz=$a.includes("safari")&&!$a.includes("chrom"),h7=vz&&($a.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test($a)),p7=$a.includes("webkit")&&!$a.includes("edge"),d7=$a.includes("macintosh");var ng=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,YE=typeof Image<"u"&&Image.prototype.decode;var f7=function(){let s=!1;try{let e=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return s}();function Xr(s,e,t,a){let l;return t&&t.length?l=t.shift():ng?l=new OffscreenCanvas(s||300,e||300):l=document.createElement("canvas"),s&&(l.width=s),e&&(l.height=e),l.getContext("2d",a)}var A0;function Cu(){return A0||(A0=Xr(1,1)),A0}function JE(s){let e=s.canvas;e.width=1,e.height=1,s.clearRect(0,0,1,1)}function E0(s){return s&&s.parentNode?s.parentNode.removeChild(s):null}var I0=class extends Si{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){E0(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&E0(this.element);for(let t=0,a=this.listenerKeys.length;t<a;++t)cn(this.listenerKeys[t]);this.listenerKeys.length=0,this.map_=e,e&&((this.target_?this.target_:e.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==No&&this.listenerKeys.push(Ui(e,KE.POSTRENDER,this.render,this)),e.render())}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Mu=I0;var bz=()=>{let s=document.createElement("div");return Object.assign(s.style,{position:"absolute",bottom:0,right:0,fontSize:".8rem",padding:"0 10px"}),s},QE=bz;var P0=class extends Mu{constructor(e={}){let t=QE();t.className=e.className||"mbt-copyright",super({element:t,...e}),this.format=e.format||(a=>a?.join(" | "))}render({frameState:e}){if(!e){this.element.innerHTML="";return}let t=[];e?.layerStatesArray.forEach(l=>{let{layer:o}=l;if(e&&S0(l,e.viewState)&&(o?.getSource()?.getAttributions()&&(t=t.concat(o.getSource().getAttributions()(e))),o?.get("copyrights"))){let m=o.get("copyrights");m=Array.isArray(m)?m:[m],m?.length&&t.push(...m)}});let a=Bl(t)||[];this.element.innerHTML=this.format(a)}},eI=P0;var $o={ADD:"add",REMOVE:"remove"};var tI={LENGTH:"length"},Ru=class extends zr{constructor(e,t,a){super(e),this.element=t,this.index=a}},T0=class extends Si{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e||[],this.unique_)for(let a=0,l=this.array_.length;a<l;++a)this.assertUnique_(this.array_[a],a);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,a=e.length;t<a;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let a=0,l=t.length;a<l;++a)e(t[a],a,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(tI.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Ru($o.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){this.unique_&&this.assertUnique_(e);let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let a=0,l=t.length;a<l;++a)if(t[a]===e)return this.removeAt(a)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Ru($o.REMOVE,t,e)),t}setAt(e,t){let a=this.getLength();if(e>=a){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let l=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Ru($o.REMOVE,l,e)),this.dispatchEvent(new Ru($o.ADD,t,e))}updateLength_(){this.set(tI.LENGTH,this.array_.length)}assertUnique_(e,t){for(let a=0,l=this.array_.length;a<l;++a)if(this.array_[a]===e&&a!==t)throw new Error("Duplicate item added to a unique collection")}},Rd=T0;var C0=class s extends Si{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new s(this.hasProperties()?this.getProperties():null);e.setGeometryName(this.getGeometryName());let t=this.getGeometry();t&&e.setGeometry(t.clone());let a=this.getStyle();return a&&e.setStyle(a),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(cn(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=Ui(e,Ir.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?wz(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}};function wz(s){if(typeof s=="function")return s;let e;return Array.isArray(s)?e=s:(Ar(typeof s.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[s]),function(){return e}}var Ao=C0;var Mt={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};var ra={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var Xl={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"]};Xl.whitepoint={2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}};Xl.max=Xl.whitepoint[2].D65;Xl.rgb=function(s,e){e=e||Xl.whitepoint[2].E;var t=s[0]/e[0],a=s[1]/e[1],l=s[2]/e[2],o,m,g;return o=t*3.240969941904521+a*-1.537383177570093+l*-.498610760293,m=t*-.96924363628087+a*1.87596750150772+l*.041555057407175,g=t*.055630079696993+a*-.20397695888897+l*1.056971514242878,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o=o*12.92,m=m>.0031308?1.055*Math.pow(m,1/2.4)-.055:m=m*12.92,g=g>.0031308?1.055*Math.pow(g,1/2.4)-.055:g=g*12.92,o=Math.min(Math.max(0,o),1),m=Math.min(Math.max(0,m),1),g=Math.min(Math.max(0,g),1),[o*255,m*255,g*255]};ra.xyz=function(s,e){var t=s[0]/255,a=s[1]/255,l=s[2]/255;t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,a=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92,l=l>.04045?Math.pow((l+.055)/1.055,2.4):l/12.92;var o=t*.41239079926595+a*.35758433938387+l*.18048078840183,m=t*.21263900587151+a*.71516867876775+l*.072192315360733,g=t*.019330818715591+a*.11919477979462+l*.95053215224966;return e=e||Xl.whitepoint[2].E,[o*e[0],m*e[1],g*e[2]]};var Nn=Xl;var og={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(s,e,t){var a,l,o,m,g,b,A,S,M,k,j,Z,te;if(o=s[0],m=s[1],g=s[2],o===0)return[0,0,0];var q=.0011070564598794539;return e=e||"D65",t=t||2,M=Nn.whitepoint[t][e][0],k=Nn.whitepoint[t][e][1],j=Nn.whitepoint[t][e][2],Z=4*M/(M+15*k+3*j),te=9*k/(M+15*k+3*j),a=m/(13*o)+Z||0,l=g/(13*o)+te||0,A=o>8?k*Math.pow((o+16)/116,3):k*o*q,b=A*9*a/(4*l)||0,S=A*(12-3*a-20*l)/(4*l)||0,[b,A,S]}};Nn.luv=function(s,e,t){var a,l,o,m,g,b,A,S,M,k,j,Z,te,q=.008856451679035631,H=903.2962962962961;e=e||"D65",t=t||2,M=Nn.whitepoint[t][e][0],k=Nn.whitepoint[t][e][1],j=Nn.whitepoint[t][e][2],Z=4*M/(M+15*k+3*j),te=9*k/(M+15*k+3*j),b=s[0],A=s[1],S=s[2],a=4*b/(b+15*A+3*S)||0,l=9*A/(b+15*A+3*S)||0;var ae=A/k;return o=ae<=q?H*ae:116*Math.pow(ae,1/3)-16,m=13*o*(a-Z),g=13*o*(l-te),[o,m,g]};var rI={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(s){var e=s[0],t=s[1],a=s[2],l,o,m;return m=a/360*2*Math.PI,l=t*Math.cos(m),o=t*Math.sin(m),[e,l,o]},xyz:function(s){return og.xyz(rI.luv(s))}},iI=rI;og.lchuv=function(s){var e=s[0],t=s[1],a=s[2],l=Math.sqrt(t*t+a*a),o=Math.atan2(a,t),m=o*360/2/Math.PI;return m<0&&(m+=360),[e,l,m]};Nn.lchuv=function(s){return og.lchuv(Nn.luv(s))};var M0=ao(oI(),1),aI=Sz,sI={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function Sz(s){var e,t=[],a=1,l;if(typeof s=="number")return{space:"rgb",values:[s>>>16,(s&65280)>>>8,s&255],alpha:1};if(typeof s=="number")return{space:"rgb",values:[s>>>16,(s&65280)>>>8,s&255],alpha:1};if(s=String(s).toLowerCase(),M0.default[s])t=M0.default[s].slice(),l="rgb";else if(s==="transparent")a=0,l="rgb",t=[0,0,0];else if(s[0]==="#"){var o=s.slice(1),m=o.length,g=m<=4;a=1,g?(t=[parseInt(o[0]+o[0],16),parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16)],m===4&&(a=parseInt(o[3]+o[3],16)/255)):(t=[parseInt(o[0]+o[1],16),parseInt(o[2]+o[3],16),parseInt(o[4]+o[5],16)],m===8&&(a=parseInt(o[6]+o[7],16)/255)),t[0]||(t[0]=0),t[1]||(t[1]=0),t[2]||(t[2]=0),l="rgb"}else if(e=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(s)){var b=e[1];l=b.replace(/a$/,"");var A=l==="cmyk"?4:l==="gray"?1:3;t=e[2].trim().split(/\s*[,\/]\s*|\s+/),l==="color"&&(l=t.shift()),t=t.map(function(S,M){if(S[S.length-1]==="%")return S=parseFloat(S)/100,M===3?S:l==="rgb"?S*255:l[0]==="h"||l[0]==="l"&&!M?S*100:l==="lab"?S*125:l==="lch"?M<2?S*150:S*360:l[0]==="o"&&!M?S:l==="oklab"?S*.4:l==="oklch"?M<2?S*.4:S*360:S;if(l[M]==="h"||M===2&&l[l.length-1]==="h"){if(sI[S]!==void 0)return sI[S];if(S.endsWith("deg"))return parseFloat(S);if(S.endsWith("turn"))return parseFloat(S)*360;if(S.endsWith("grad"))return parseFloat(S)*360/400;if(S.endsWith("rad"))return parseFloat(S)*180/Math.PI}return S==="none"?0:parseFloat(S)}),a=t.length>A?t.pop():1}else/[0-9](?:\s|\/|,)/.test(s)&&(t=s.match(/([0-9]+)/g).map(function(S){return parseFloat(S)}),l=s.match(/([a-z])/ig)?.join("")?.toLowerCase()||"rgb");return{space:l,values:t,alpha:a}}var sg={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(s){var e=s[0]/360,t=s[1]/100,a=s[2]/100,l,o,m,g,b,A=0;if(t===0)return b=a*255,[b,b,b];for(o=a<.5?a*(1+t):a+t-a*t,l=2*a-o,g=[0,0,0];A<3;)m=e+1/3*-(A-1),m<0?m++:m>1&&m--,b=6*m<1?l+(o-l)*6*m:2*m<1?o:3*m<2?l+(o-l)*(2/3-m)*6:l,g[A++]=b*255;return g}};ra.hsl=function(s){var e=s[0]/255,t=s[1]/255,a=s[2]/255,l=Math.min(e,t,a),o=Math.max(e,t,a),m=o-l,g,b,A;return o===l?g=0:e===o?g=(t-a)/m:t===o?g=2+(a-e)/m:a===o&&(g=4+(e-t)/m),g=Math.min(g*60,360),g<0&&(g+=360),A=(l+o)/2,o===l?b=0:A<=.5?b=m/(o+l):b=m/(2-o-l),[g,b*100,A*100]};function R0(s){Array.isArray(s)&&s.raw&&(s=String.raw(...arguments)),s instanceof Number&&(s=+s);var e,t,a,l=aI(s);if(!l.space)return[];let o=l.space[0]==="h"?sg.min:ra.min,m=l.space[0]==="h"?sg.max:ra.max;return e=Array(3),e[0]=Math.min(Math.max(l.values[0],o[0]),m[0]),e[1]=Math.min(Math.max(l.values[1],o[1]),m[1]),e[2]=Math.min(Math.max(l.values[2],o[2]),m[2]),l.space[0]==="h"&&(e=sg.rgb(e)),e.push(Math.min(Math.max(l.alpha,0),1)),e}function lI(s){return typeof s=="string"?s:Fd(s)}var Az=1024,kd={},k0=0;function cI(s){if(s.length===4)return s;let e=s.slice();return e[3]=1,e}function F0(s){let e=Nn.lchuv(ra.xyz(s));return e[3]=s[3],e}function uI(s){let e=Nn.rgb(iI.xyz(s));return e[3]=s[3],e}function ag(s){if(kd.hasOwnProperty(s))return kd[s];if(k0>=Az){let t=0;for(let a in kd)t++&3||(delete kd[a],--k0)}let e=R0(s);if(e.length!==4)throw new Error('Failed to parse "'+s+'" as color');for(let t of e)if(isNaN(t))throw new Error('Failed to parse "'+s+'" as color');return L0(e),kd[s]=e,++k0,e}function ia(s){return Array.isArray(s)?s:ag(s)}function L0(s){return s[0]=Br(s[0]+.5|0,0,255),s[1]=Br(s[1]+.5|0,0,255),s[2]=Br(s[2]+.5|0,0,255),s[3]=Br(s[3],0,1),s}function Fd(s){let e=s[0];e!=(e|0)&&(e=e+.5|0);let t=s[1];t!=(t|0)&&(t=t+.5|0);let a=s[2];a!=(a|0)&&(a=a+.5|0);let l=s[3]===void 0?1:Math.round(s[3]*1e3)/1e3;return"rgba("+e+","+t+","+a+","+l+")"}function hI(s){try{return ag(s),!0}catch{return!1}}function Ez(s,e){return new Promise((t,a)=>{function l(){m(),t(s)}function o(){m(),a(new Error("Image load error"))}function m(){s.removeEventListener("load",l),s.removeEventListener("error",o)}s.addEventListener("load",l),s.addEventListener("error",o),e&&(s.src=e)})}function pI(s,e){return e&&(s.src=e),s.src&&YE?new Promise((t,a)=>s.decode().then(()=>t(s)).catch(l=>s.complete&&s.width?t(s):a(l))):Ez(s)}var O0=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let a=this.cache_[t];!(e++&3)&&!a.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t,a){let l=D0(e,t,a);return l in this.cache_?this.cache_[l]:null}getPattern(e,t,a){let l=D0(e,t,a);return l in this.patternCache_?this.patternCache_[l]:null}set(e,t,a,l,o){let m=D0(e,t,a),g=m in this.cache_;this.cache_[m]=l,o&&(l.getImageState()===Mt.IDLE&&l.load(),l.getImageState()===Mt.LOADING?l.ready().then(()=>{this.patternCache_[m]=Cu().createPattern(l.getImage(1),"repeat")}):this.patternCache_[m]=Cu().createPattern(l.getImage(1),"repeat")),g||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function D0(s,e,t){let a=t?ia(t):"null";return e+":"+s+":"+a}var gs=new O0;var Ld=null,z0=class extends Om{constructor(e,t,a,l,o){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=a,this.canvas_={},this.color_=o,this.imageState_=l===void 0?Mt.IDLE:l,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Mt.LOADED){Ld||(Ld=Xr(1,1,void 0,{willReadFrequently:!0})),Ld.drawImage(this.image_,0,0);try{Ld.getImageData(0,0,1,1),this.tainted_=!1}catch{Ld=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Ir.CHANGE)}handleImageError_(){this.imageState_=Mt.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mt.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],a=Xr(e,t);a.fillRect(0,0,e,t),this.hitDetectionImage_=a.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Mt.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mt.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&pI(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Mt.LOADED)return;let t=this.image_,a=document.createElement("canvas");a.width=Math.ceil(t.width*e),a.height=Math.ceil(t.height*e);let l=a.getContext("2d");l.scale(e,e),l.drawImage(t,0,0),l.globalCompositeOperation="multiply",l.fillStyle=lI(this.color_),l.fillRect(0,0,a.width/e,a.height/e),l.globalCompositeOperation="destination-in",l.drawImage(t,0,0),this.canvas_[e]=a}ready(){return this.ready_||(this.ready_=new Promise(e=>{this.imageState_===Mt.LOADED||this.imageState_===Mt.ERROR?e():this.addEventListener(Ir.CHANGE,function t(){(this.imageState_===Mt.LOADED||this.imageState_===Mt.ERROR)&&(this.removeEventListener(Ir.CHANGE,t),e())})})),this.ready_}};function ku(s,e,t,a,l,o){let m=e===void 0?void 0:gs.get(e,t,l);return m||(m=new z0(s,s&&"src"in s?s.src||void 0:e,t,a,l),gs.set(e,t,l,m,o)),o&&m&&!gs.getPattern(e,t,l)&&gs.set(e,t,l,m,o),m}var B0=class s{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new s({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=ku(null,e.src,"anonymous",void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Mt.IDLE&&t.load(),t.getImageState()===Mt.LOADING&&(this.patternImage_=t)}this.color_=e}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},qi=B0;var N0=class s{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}clone(){let e=this.getColor();return new s({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setWidth(e){this.width_=e}},ai=N0;function Wa(s,e){return Array.isArray(s)?s:(e===void 0?e=[s,s]:(e[0]=s,e[1]=s),e)}var j0=class s{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Wa(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new s({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return Pt()}getImage(e){return Pt()}getHitDetectionImage(){return Pt()}getPixelRatio(e){return 1}getImageState(){return Pt()}getImageSize(){return Pt()}getOrigin(){return Pt()}getSize(){return Pt()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Wa(e)}listenImageChange(e){Pt()}load(){Pt()}unlistenImageChange(e){Pt()}ready(){return Promise.resolve()}},lg=j0;function jn(s){return s?Array.isArray(s)?Fd(s):typeof s=="object"&&"src"in s?Iz(s):s:null}function Iz(s){if(!s.offset||!s.size)return gs.getPattern(s.src,"anonymous",s.color);let e=s.src+":"+s.offset,t=gs.getPattern(e,void 0,s.color);if(t)return t;let a=gs.get(s.src,"anonymous",null);if(a.getImageState()!==Mt.LOADED)return null;let l=Xr(s.size[0],s.size[1]);return l.drawImage(a.getImage(1),s.offset[0],s.offset[1],s.size[0],s.size[1],0,0,s.size[0],s.size[1]),ku(l.canvas,e,void 0,Mt.LOADED,s.color,!0),gs.getPattern(e,void 0,s.color)}var Pz=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),dI=["style","variant","weight","size","lineHeight","family"],U0=function(s){let e=s.match(Pz);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let a=0,l=dI.length;a<l;++a){let o=e[a+1];o!==void 0&&(t[dI[a]]=o)}return t.families=t.family.split(/,\s?/),t};var ug="10px sans-serif",li="#000",ys="round",Un=[],Gn=0,_s="round",na=10,oa="#000",Xa="center",Hl="middle",sa=[0,0,0,0],aa=1,Za=new Si,Fu=null,G0,V0={},fI=function(){let e="32px ",t=["monospace","serif"],a=t.length,l="wmytzilWMYTZIL@#/&?$%10\uF013",o,m;function g(A,S,M){let k=!0;for(let j=0;j<a;++j){let Z=t[j];if(m=cg(A+" "+S+" "+e+Z,l),M!=Z){let te=cg(A+" "+S+" "+e+M+","+Z,l);k=k&&te!=m}}return!!k}function b(){let A=!0,S=Za.getKeys();for(let M=0,k=S.length;M<k;++M){let j=S[M];Za.get(j)<100&&(g.apply(this,j.split(`
581
581
  `))?(yu(V0),Fu=null,G0=void 0,Za.set(j,100)):(Za.set(j,Za.get(j)+1,!0),A=!1))}A&&(clearInterval(o),o=void 0)}return function(A){let S=U0(A);if(!S)return;let M=S.families;for(let k=0,j=M.length;k<j;++k){let Z=M[k],te=S.style+`
582
582
  `+S.weight+`
583
583
  `+Z;Za.get(te)===void 0&&(Za.set(te,100,!0),g(S.style,S.weight,Z)||(Za.set(te,0,!0),o===void 0&&(o=setInterval(b,32))))}}}(),Tz=function(){let s;return function(e){let t=V0[e];if(t==null){if(ng){let a=U0(e),l=mI(e,"\u017Dg");t=(isNaN(Number(a.lineHeight))?1.2:Number(a.lineHeight))*(l.actualBoundingBoxAscent+l.actualBoundingBoxDescent)}else s||(s=document.createElement("div"),s.innerHTML="M",s.style.minHeight="0",s.style.maxHeight="none",s.style.height="auto",s.style.padding="0",s.style.border="none",s.style.position="absolute",s.style.display="block",s.style.left="-99999px"),s.style.font=e,document.body.appendChild(s),t=s.offsetHeight,document.body.removeChild(s);V0[e]=t}return t}}();function mI(s,e){return Fu||(Fu=Xr(1,1)),s!=G0&&(Fu.font=s,G0=Fu.font),Fu.measureText(e)}function cg(s,e){return mI(s,e).width}function q0(s,e,t){if(e in t)return t[e];let a=e.split(`
@@ -585,7 +585,7 @@ uniform ${O} ${D} u_${G};
585
585
  `||A===S){o=Math.max(o,m),l.push(m),m=0,g+=b,b=0;continue}let k=e[A+1]||s.font,j=cg(k,M);t.push(j),m+=j;let Z=Tz(k);a.push(Z),b=Math.max(b,Z)}return{width:o,height:g,widths:t,heights:a,lineWidths:l}}function yI(s,e,t,a,l,o,m,g,b,A,S){s.save(),t!==1&&(s.globalAlpha===void 0?s.globalAlpha=M=>M.globalAlpha*=t:s.globalAlpha*=t),e&&s.transform.apply(s,e),a.contextInstructions?(s.translate(b,A),s.scale(S[0],S[1]),Cz(a,s)):S[0]<0||S[1]<0?(s.translate(b,A),s.scale(S[0],S[1]),s.drawImage(a,l,o,m,g,0,0,m,g)):s.drawImage(a,l,o,m,g,b,A,m*S[0],g*S[1]),s.restore()}function Cz(s,e){let t=s.contextInstructions;for(let a=0,l=t.length;a<l;a+=2)Array.isArray(t[a+1])?e[t[a]].apply(e,t[a+1]):e[t[a]]=t[a+1]}var $0=class s extends lg{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.canvases_,this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius_=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Mt.LOADING:Mt.LOADED,this.imageState_===Mt.LOADING&&this.ready().then(()=>this.imageState_=Mt.LOADED),this.render()}clone(){let e=this.getScale(),t=new s({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),a=this.getScaleArray();return[e[0]/2-t[0]/a[0],e[1]/2+t[1]/a[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.canvases_[e];if(!t){let a=this.renderOptions_,l=Xr(a.size*e,a.size*e);this.draw_(a,l,e),t=l.canvas,this.canvases_[e]=t}return t}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,a){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let l=this.radius_,o=this.radius2_===void 0?l:this.radius2_;if(l<o){let _e=l;l=o,o=_e}let m=this.radius2_===void 0?this.points_:this.points_*2,g=2*Math.PI/m,b=o*Math.sin(g),A=Math.sqrt(o*o-b*b),S=l-A,M=Math.sqrt(b*b+S*S),k=M/b;if(e==="miter"&&k<=a)return k*t;let j=t/2/k,Z=t/2*(S/M),q=Math.sqrt((l+j)*(l+j)+Z*Z)-l;if(this.radius2_===void 0||e==="bevel")return q*2;let H=l*Math.sin(g),ae=Math.sqrt(l*l-H*H),pe=o-ae,de=Math.sqrt(H*H+pe*pe)/H;if(de<=a){let _e=de*t/2-o-l;return 2*Math.max(q,_e)}return q*2}createRenderOptions(){let e=ys,t=_s,a=0,l=null,o=0,m,g=0;this.stroke_&&(m=jn(this.stroke_.getColor()??oa),g=this.stroke_.getWidth()??aa,l=this.stroke_.getLineDash(),o=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??_s,e=this.stroke_.getLineCap()??ys,a=this.stroke_.getMiterLimit()??na);let b=this.calculateLineJoinSize_(t,g,a),A=Math.max(this.radius_,this.radius2_||0),S=Math.ceil(2*A+b);return{strokeStyle:m,strokeWidth:g,size:S,lineCap:e,lineDash:l,lineDashOffset:o,lineJoin:t,miterLimit:a}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.canvases_={},this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,a){if(t.scale(a,a),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let l=this.fill_.getColor();l===null&&(l=li),t.fillStyle=jn(l),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let a=this.fill_.getColor(),l=0;typeof a=="string"&&(a=ia(a)),a===null?l=1:Array.isArray(a)&&(l=a.length===4?a[3]:1),l===0&&(t=Xr(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,a=this.radius_;if(t===1/0)e.arc(0,0,a,0,2*Math.PI);else{let l=this.radius2_===void 0?a:this.radius2_;this.radius2_!==void 0&&(t*=2);let o=this.angle_-Math.PI/2,m=2*Math.PI/t;for(let g=0;g<t;g++){let b=o+g*m,A=g%2===0?a:l;e.lineTo(A*Math.cos(b),A*Math.sin(b))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=li,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},hg=$0;var W0=class s extends hg{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){let e=this.getScale(),t=new s({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}setRadius(e){this.radius_=e,this.render()}},Vn=W0;var Ha=class s{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=_I,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new s({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=_I,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function xI(s){let e;if(typeof s=="function")e=s;else{let t;Array.isArray(s)?t=s:(Ar(typeof s.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[s]),e=function(){return t}}return e}var Z0=null;function X0(s,e){if(!Z0){let t=new qi({color:"rgba(255,255,255,0.4)"}),a=new ai({color:"#3399CC",width:1.25});Z0=[new Ha({image:new Vn({fill:t,stroke:a,radius:5}),fill:t,stroke:a})]}return Z0}function vI(){let s={},e=[255,255,255,1],t=[0,153,255,1],a=3;return s.Polygon=[new Ha({fill:new qi({color:[255,255,255,.5]})})],s.MultiPolygon=s.Polygon,s.LineString=[new Ha({stroke:new ai({color:e,width:a+2})}),new Ha({stroke:new ai({color:t,width:a})})],s.MultiLineString=s.LineString,s.Circle=s.Polygon.concat(s.LineString),s.Point=[new Ha({image:new Vn({radius:a*2,fill:new qi({color:t}),stroke:new ai({color:e,width:a/2})}),zIndex:1/0})],s.MultiPoint=s.Point,s.GeometryCollection=s.Polygon.concat(s.LineString,s.Point),s}function _I(s){return s.getGeometry()}var $i=Ha;var Mz="#333",H0=class s{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=Wa(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new qi({color:Mz}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new s({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Wa(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},bI=H0;var LI=ao(J0(),1);function wI(s,e,t,a){return t!==void 0&&a!==void 0?[t/s,a/e]:t!==void 0?t/s:a!==void 0?a/e:1}var Q0=class s extends lg{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,a=e.rotation!==void 0?e.rotation:0,l=e.scale!==void 0?e.scale:1,o=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:a,scale:l,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:o,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null;let m=e.img!==void 0?e.img:null,g=e.src;Ar(!(g!==void 0&&m),"`image` and `src` cannot be provided at the same time"),(g===void 0||g.length===0)&&m&&(g=m.src||Ut(m)),Ar(g!==void 0&&g.length>0,"A defined and non-empty `src` or `image` must be provided"),Ar(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let b;if(e.src!==void 0?b=Mt.IDLE:m!==void 0&&("complete"in m?m.complete?b=m.src?Mt.LOADED:Mt.IDLE:b=Mt.LOADING:b=Mt.LOADED),this.color_=e.color!==void 0?ia(e.color):null,this.iconImage_=ku(m,g,this.crossOrigin_,b,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,e.width!==void 0||e.height!==void 0){let A,S;if(e.size)[A,S]=e.size;else{let M=this.getImage(1);if(M.width&&M.height)A=M.width,S=M.height;else if(M instanceof HTMLImageElement){this.initialOptions_=e;let k=()=>{if(this.unlistenImageChange(k),!this.initialOptions_)return;let j=this.iconImage_.getSize();this.setScale(wI(j[0],j[1],e.width,e.height))};this.listenImageChange(k);return}}A!==void 0&&this.setScale(wI(A,S,e.width,e.height))}}clone(){let e,t,a;return this.initialOptions_?(t=this.initialOptions_.width,a=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new s({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:a,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let l=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!l)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=l[0]),this.anchorYUnits_=="fraction"&&(e[1]*=l[1])}if(this.anchorOrigin_!="top-left"){if(!l)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+l[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+l[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),a=this.getScaleArray();return[e[0]-t[0]/a[0],e[1]+t[1]/a[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),a=this.iconImage_.getSize();if(!t||!a)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=a[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=a[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Mt.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Mt.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(Ir.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(Ir.CHANGE,e)}ready(){return this.iconImage_.ready()}},Dd=Q0;var Kl=0,Lu=0,Nr=1<<Kl++,gt=1<<Kl++,qn=1<<Kl++,ri=1<<Kl++,Zo=1<<Kl++,zd=1<<Kl++,un=Math.pow(2,Kl)-1,AI={[Nr]:"boolean",[gt]:"number",[qn]:"string",[ri]:"color",[Zo]:"number[]",[zd]:"size"},Rz=Object.keys(AI).map(Number).sort(Bo);function Wi(s){let e=[];for(let t of Rz)kz(s,t)&&e.push(AI[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function kz(s,e){return(s&e)===e}function Xo(s,e){return!!(s&e)}function pg(s,e){return s===e}var Wo=class{constructor(e,t){this.type=e,this.value=t}},ev=class{constructor(e,t,...a){this.type=e,this.operator=t,this.args=a}};function tv(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,style:{}}}function Fz(s){switch(s){case"string":return qn;case"color":return ri;case"number":return gt;case"boolean":return Nr;case"number[]":return Zo;default:throw new Error(`Unrecognized type hint: ${s}`)}}function cr(s,e,t){switch(typeof s){case"boolean":return new Wo(Nr,s);case"number":return new Wo(t===zd?zd:gt,s);case"string":{let l=qn;return hI(s)&&(l|=ri),pg(l&t,Lu)||(l&=t),new Wo(l,s)}default:}if(!Array.isArray(s))throw new Error("Expression must be an array or a primitive value");if(s.length===0)throw new Error("Empty expression");if(typeof s[0]=="string")return $z(s,e,t);for(let l of s)if(typeof l!="number")throw new Error("Expected an array of numbers");let a=Zo;return s.length===2?a|=zd:(s.length===3||s.length===4)&&(a|=ri),t&&(a&=t),new Wo(a,s)}var Fe={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string"},Lz={[Fe.Get]:Ft(([s,e])=>e!==void 0?Fz(e.value):un,zt(1,2),Dz),[Fe.Var]:Ft(([s])=>s.type,zt(1,1),Oz),[Fe.Id]:Ft(gt|qn,Od,zz),[Fe.Concat]:Ft(qn,zt(2,1/0),rr(un)),[Fe.GeometryType]:Ft(qn,Od,Bz),[Fe.Resolution]:Ft(gt,Od),[Fe.Zoom]:Ft(gt,Od),[Fe.Time]:Ft(gt,Od),[Fe.Any]:Ft(Nr,zt(2,1/0),rr(Nr)),[Fe.All]:Ft(Nr,zt(2,1/0),rr(Nr)),[Fe.Not]:Ft(Nr,zt(1,1),rr(Nr)),[Fe.Equal]:Ft(Nr,zt(2,2),rr(un),Ka),[Fe.NotEqual]:Ft(Nr,zt(2,2),rr(un),Ka),[Fe.GreaterThan]:Ft(Nr,zt(2,2),rr(un),Ka),[Fe.GreaterThanOrEqualTo]:Ft(Nr,zt(2,2),rr(un),Ka),[Fe.LessThan]:Ft(Nr,zt(2,2),rr(un),Ka),[Fe.LessThanOrEqualTo]:Ft(Nr,zt(2,2),rr(un),Ka),[Fe.Multiply]:Ft(s=>{let e=gt|ri;for(let t=0;t<s.length;t++)e&=s[t].type;return e},zt(2,1/0),rr(gt|ri),Ka),[Fe.Coalesce]:Ft(s=>{let e=un;for(let t=1;t<s.length;t+=2)e&=s[t].type;return e&=s[s.length-1].type,e},zt(2,1/0),rr(un),Ka),[Fe.Divide]:Ft(gt,zt(2,2),rr(gt)),[Fe.Add]:Ft(gt,zt(2,1/0),rr(gt)),[Fe.Subtract]:Ft(gt,zt(2,2),rr(gt)),[Fe.Clamp]:Ft(gt,zt(3,3),rr(gt)),[Fe.Mod]:Ft(gt,zt(2,2),rr(gt)),[Fe.Pow]:Ft(gt,zt(2,2),rr(gt)),[Fe.Abs]:Ft(gt,zt(1,1),rr(gt)),[Fe.Floor]:Ft(gt,zt(1,1),rr(gt)),[Fe.Ceil]:Ft(gt,zt(1,1),rr(gt)),[Fe.Round]:Ft(gt,zt(1,1),rr(gt)),[Fe.Sin]:Ft(gt,zt(1,1),rr(gt)),[Fe.Cos]:Ft(gt,zt(1,1),rr(gt)),[Fe.Atan]:Ft(gt,zt(1,2),rr(gt)),[Fe.Sqrt]:Ft(gt,zt(1,1),rr(gt)),[Fe.Match]:Ft(s=>{let e=un;for(let t=2;t<s.length;t+=2)e&=s[t].type;return e&=s[s.length-1].type,e},zt(4,1/0),SI,jz),[Fe.Between]:Ft(Nr,zt(3,3),rr(gt)),[Fe.Interpolate]:Ft(s=>{let e=ri|gt;for(let t=3;t<s.length;t+=2)e&=s[t].type;return e},zt(6,1/0),SI,Uz),[Fe.Case]:Ft(s=>{let e=un;for(let t=1;t<s.length;t+=2)e&=s[t].type;return e&=s[s.length-1].type,e},zt(3,1/0),Nz,Gz),[Fe.In]:Ft(Nr,zt(2,2),Vz),[Fe.Number]:Ft(gt,zt(1,1/0),rr(un)),[Fe.String]:Ft(qn,zt(1,1/0),rr(un)),[Fe.Array]:Ft(s=>s.length===2?Zo|zd:s.length===3||s.length===4?Zo|ri:Zo,zt(1,1/0),rr(gt)),[Fe.Color]:Ft(ri,zt(1,4),rr(gt)),[Fe.Band]:Ft(gt,zt(1,3),rr(gt)),[Fe.Palette]:Ft(ri,zt(2,2),qz),[Fe.ToString]:Ft(qn,zt(1,1),rr(Nr|gt|qn|ri))};function Dz(s,e){let t=cr(s[1],e);if(!(t instanceof Wo))throw new Error("Expected a literal argument for get operation");if(typeof t.value!="string")throw new Error("Expected a string argument for get operation");if(e.properties.add(t.value),s.length===3){let a=cr(s[2],e);return[t,a]}return[t]}function Oz(s,e,t,a){let l=s[1];if(typeof l!="string")throw new Error("Expected a string argument for var operation");if(e.variables.add(l),!("variables"in e.style)||e.style.variables[l]===void 0)return[new Wo(un,l)];let o=e.style.variables[l],m=cr(o,e);if(m.value=l,a&&!Xo(a,m.type))throw new Error(`The variable ${l} has type ${Wi(m.type)} but the following type was expected: ${Wi(a)}`);return[m]}function zz(s,e){e.featureId=!0}function Bz(s,e){e.geometryType=!0}function Od(s,e){let t=s[0];if(s.length!==1)throw new Error(`Expected no arguments for ${t} operation`);return[]}function zt(s,e){return function(t,a){let l=t[0],o=t.length-1;if(s===e){if(o!==s){let m=s===1?"":"s";throw new Error(`Expected ${s} argument${m} for ${l}, got ${o}`)}}else if(o<s||o>e){let m=e===1/0?`${s} or more`:`${s} to ${e}`;throw new Error(`Expected ${m} arguments for ${l}, got ${o}`)}}}function rr(s){return function(e,t){let a=e[0],l=e.length-1,o=new Array(l);for(let m=0;m<l;++m){let g=cr(e[m+1],t);if(!Xo(s,g.type)){let b=Wi(s),A=Wi(g.type);throw new Error(`Unexpected type for argument ${m} of ${a} operation, got ${b} but expected ${A}`)}g.type&=s,o[m]=g}return o}}function Ka(s,e,t){let a=s[0],l=s.length-1,o=un;for(let g=0;g<t.length;++g)o&=t[g].type;if(o===Lu)throw new Error(`No common type could be found for arguments of ${a} operation`);let m=new Array(l);for(let g=0;g<l;++g)m[g]=cr(s[g+1],e,o);return m}function Nz(s,e){let t=s[0],a=s.length-1;if(a%2===0)throw new Error(`An odd amount of arguments was expected for operation ${t}, got ${JSON.stringify(a)} instead`)}function SI(s,e){let t=s[0],a=s.length-1;if(a%2===1)throw new Error(`An even amount of arguments was expected for operation ${t}, got ${JSON.stringify(a)} instead`)}function jz(s,e,t,a){let l=s.length-1,m=cr(s[1],e).type,g=cr(s[s.length-1],e),b=a!==void 0?a&g.type:g.type,A=new Array(l-2);for(let M=0;M<l-2;M+=2){let k=cr(s[M+2],e),j=cr(s[M+3],e);m&=k.type,b&=j.type,A[M]=k,A[M+1]=j}let S=qn|gt|Nr;if(!Xo(S,m))throw new Error(`Expected an input of type ${Wi(S)} for the interpolate operation, got ${Wi(m)} instead`);if(m&=S,pg(b,Lu))throw new Error("Could not find a common output type for the following match operation: "+JSON.stringify(s));for(let M=0;M<l-2;M+=2){let k=cr(s[M+2],e,m),j=cr(s[M+3],e,b);A[M]=k,A[M+1]=j}return[cr(s[1],e,m),...A,cr(s[s.length-1],e,b)]}function Uz(s,e,t,a){let l=s[1],o;switch(l[0]){case"linear":o=1;break;case"exponential":if(o=l[1],typeof o!="number")throw new Error(`Expected a number base for exponential interpolation, got ${JSON.stringify(o)} instead`);break;default:o=null}if(!o)throw new Error(`Invalid interpolation type: ${JSON.stringify(l)}`);o=cr(o,e);let m=cr(s[2],e);if(!Xo(gt,m.type))throw new Error(`Expected an input of type number for the interpolate operation, got ${Wi(m.type)} instead`);m=cr(s[2],e,gt);let g=new Array(s.length-3);for(let b=0;b<g.length;b+=2){let A=cr(s[b+3],e);if(!Xo(gt,A.type))throw new Error(`Expected all stop input values in the interpolate operation to be of type number, got ${Wi(A.type)} at position ${b+2} instead`);let S=cr(s[b+4],e);if(!Xo(gt|ri,S.type))throw new Error(`Expected all stop output values in the interpolate operation to be a number or color, got ${Wi(S.type)} at position ${b+3} instead`);A=cr(s[b+3],e,gt),S=cr(s[b+4],e,gt|ri),g[b]=A,g[b+1]=S}return[o,m,...g]}function Gz(s,e,t,a){let l=cr(s[s.length-1],e,a),o=a!==void 0?a&l.type:l.type,m=new Array(s.length-1);for(let g=0;g<m.length-1;g+=2){let b=cr(s[g+1],e),A=cr(s[g+2],e,a);if(!Xo(Nr,b.type))throw new Error(`Expected all conditions in the case operation to be of type boolean, got ${Wi(b.type)} at position ${g} instead`);o&=A.type,m[g]=b,m[g+1]=A}if(pg(o,Lu))throw new Error("Could not find a common output type for the following case operation: "+JSON.stringify(s));for(let g=0;g<m.length-1;g+=2)m[g+1]=cr(s[g+2],e,o);return m[m.length-1]=cr(s[s.length-1],e,o),m}function Vz(s,e){let t=s[2];if(!Array.isArray(t))throw new Error('The "in" operator was provided a literal value which was not an array as second argument.');if(typeof t[0]=="string"){if(t[0]!=="literal")throw new Error('For the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions.');if(!Array.isArray(t[1]))throw new Error('The "in" operator was provided a literal value which was not an array as second argument.');t=t[1]}let a=qn|gt,l=new Array(t.length);for(let m=0;m<l.length;m++){let g=cr(t[m],e);a&=g.type,l[m]=g}if(pg(a,Lu))throw new Error("Could not find a common type for the following in operation: "+JSON.stringify(s));return[cr(s[1],e,a),...l]}function qz(s,e){let t=cr(s[1],e,gt);if(t.type!==gt)throw new Error(`The first argument of palette must be an number, got ${Wi(t.type)} instead`);let a=s[2];if(!Array.isArray(a))throw new Error("The second argument of palette must be an array");let l=new Array(a.length);for(let o=0;o<l.length;o++){let m=cr(a[o],e,ri);if(!(m instanceof Wo))throw new Error(`The palette color at index ${o} must be a literal value`);if(!Xo(m.type,ri))throw new Error(`The palette color at index ${o} should be of type color, got ${Wi(m.type)} instead`);l[o]=m}return[t,...l]}function Ft(s,...e){return function(t,a,l){let o=t[0],m=[];for(let b=0;b<e.length;b++)m=e[b](t,a,m,l)||m;let g=typeof s=="function"?s(m):s;if(l!==void 0){if(!Xo(g,l))throw new Error(`The following expression was expected to return ${Wi(l)}, but returns ${Wi(g)} instead: ${JSON.stringify(t)}`);g&=l}if(g===Lu)throw new Error(`No matching type was found for the following expression: ${JSON.stringify(t)}`);return new ev(g,o,...m)}}function $z(s,e,t){let a=s[0],l=Lz[a];if(!l)throw new Error(`Unknown operator: ${a}`);return l(s,e,t)}function rv(s){if(!s)return"";let e=s.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return rv(s.getGeometries()[0]);default:return""}}function iv(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function xs(s,e,t){let a=cr(s,t);if(!Xo(e,a.type)){let l=Wi(e),o=Wi(a.type);throw new Error(`Expected expression to be of type ${l}, got ${o}`)}return Ho(a,t)}function Ho(s,e){if(s instanceof Wo){if(s.type===ri&&typeof s.value=="string"){let a=ag(s.value);return function(){return a}}return function(){return s.value}}let t=s.operator;switch(t){case Fe.Number:case Fe.String:case Fe.Coalesce:return Wz(s,e);case Fe.Get:case Fe.Var:return Zz(s,e);case Fe.Id:return a=>a.featureId;case Fe.GeometryType:return a=>a.geometryType;case Fe.Concat:{let a=s.args.map(l=>Ho(l,e));return l=>"".concat(...a.map(o=>o(l).toString()))}case Fe.Resolution:return a=>a.resolution;case Fe.Any:case Fe.All:case Fe.Between:case Fe.In:case Fe.Not:return Hz(s,e);case Fe.Equal:case Fe.NotEqual:case Fe.LessThan:case Fe.LessThanOrEqualTo:case Fe.GreaterThan:case Fe.GreaterThanOrEqualTo:return Xz(s,e);case Fe.Multiply:case Fe.Divide:case Fe.Add:case Fe.Subtract:case Fe.Clamp:case Fe.Mod:case Fe.Pow:case Fe.Abs:case Fe.Floor:case Fe.Ceil:case Fe.Round:case Fe.Sin:case Fe.Cos:case Fe.Atan:case Fe.Sqrt:return Kz(s,e);case Fe.Case:return Yz(s,e);case Fe.Match:return Jz(s,e);case Fe.Interpolate:return Qz(s,e);case Fe.ToString:return eB(s,e);default:throw new Error(`Unsupported operator ${t}`)}}function Wz(s,e){let t=s.operator,a=s.args.length,l=new Array(a);for(let o=0;o<a;++o)l[o]=Ho(s.args[o],e);switch(t){case Fe.Coalesce:return o=>{for(let m=0;m<a;++m){let g=l[m](o);if(typeof g<"u"&&g!==null)return g}throw new Error("Expected one of the values to be non-null")};case Fe.Number:case Fe.String:return o=>{for(let m=0;m<a;++m){let g=l[m](o);if(typeof g===t)return g}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function Zz(s,e){let a=s.args[0].value;switch(s.operator){case Fe.Get:return l=>l.properties[a];case Fe.Var:return l=>l.variables[a];default:throw new Error(`Unsupported accessor operator ${s.operator}`)}}function Xz(s,e){let t=s.operator,a=Ho(s.args[0],e),l=Ho(s.args[1],e);switch(t){case Fe.Equal:return o=>a(o)===l(o);case Fe.NotEqual:return o=>a(o)!==l(o);case Fe.LessThan:return o=>a(o)<l(o);case Fe.LessThanOrEqualTo:return o=>a(o)<=l(o);case Fe.GreaterThan:return o=>a(o)>l(o);case Fe.GreaterThanOrEqualTo:return o=>a(o)>=l(o);default:throw new Error(`Unsupported comparison operator ${t}`)}}function Hz(s,e){let t=s.operator,a=s.args.length,l=new Array(a);for(let o=0;o<a;++o)l[o]=Ho(s.args[o],e);switch(t){case Fe.Any:return o=>{for(let m=0;m<a;++m)if(l[m](o))return!0;return!1};case Fe.All:return o=>{for(let m=0;m<a;++m)if(!l[m](o))return!1;return!0};case Fe.Between:return o=>{let m=l[0](o),g=l[1](o),b=l[2](o);return m>=g&&m<=b};case Fe.In:return o=>{let m=l[0](o);for(let g=1;g<a;++g)if(m===l[g](o))return!0;return!1};case Fe.Not:return o=>!l[0](o);default:throw new Error(`Unsupported logical operator ${t}`)}}function Kz(s,e){let t=s.operator,a=s.args.length,l=new Array(a);for(let o=0;o<a;++o)l[o]=Ho(s.args[o],e);switch(t){case Fe.Multiply:return o=>{let m=1;for(let g=0;g<a;++g)m*=l[g](o);return m};case Fe.Divide:return o=>l[0](o)/l[1](o);case Fe.Add:return o=>{let m=0;for(let g=0;g<a;++g)m+=l[g](o);return m};case Fe.Subtract:return o=>l[0](o)-l[1](o);case Fe.Clamp:return o=>{let m=l[0](o),g=l[1](o);if(m<g)return g;let b=l[2](o);return m>b?b:m};case Fe.Mod:return o=>l[0](o)%l[1](o);case Fe.Pow:return o=>Math.pow(l[0](o),l[1](o));case Fe.Abs:return o=>Math.abs(l[0](o));case Fe.Floor:return o=>Math.floor(l[0](o));case Fe.Ceil:return o=>Math.ceil(l[0](o));case Fe.Round:return o=>Math.round(l[0](o));case Fe.Sin:return o=>Math.sin(l[0](o));case Fe.Cos:return o=>Math.cos(l[0](o));case Fe.Atan:return a===2?o=>Math.atan2(l[0](o),l[1](o)):o=>Math.atan(l[0](o));case Fe.Sqrt:return o=>Math.sqrt(l[0](o));default:throw new Error(`Unsupported numeric operator ${t}`)}}function Yz(s,e){let t=s.args.length,a=new Array(t);for(let l=0;l<t;++l)a[l]=Ho(s.args[l],e);return l=>{for(let o=0;o<t-1;o+=2)if(a[o](l))return a[o+1](l);return a[t-1](l)}}function Jz(s,e){let t=s.args.length,a=new Array(t);for(let l=0;l<t;++l)a[l]=Ho(s.args[l],e);return l=>{let o=a[0](l);for(let m=1;m<t;m+=2)if(o===a[m](l))return a[m+1](l);return a[t-1](l)}}function Qz(s,e){let t=s.args.length,a=new Array(t);for(let l=0;l<t;++l)a[l]=Ho(s.args[l],e);return l=>{let o=a[0](l),m=a[1](l),g,b;for(let A=2;A<t;A+=2){let S=a[A](l),M=a[A+1](l),k=Array.isArray(M);if(k&&(M=cI(M)),S>=m)return A===2?M:k?tB(o,m,g,b,S,M):Bd(o,m,g,b,S,M);g=S,b=M}return b}}function eB(s,e){let t=s.operator,a=s.args.length,l=new Array(a);for(let o=0;o<a;++o)l[o]=Ho(s.args[o],e);switch(t){case Fe.ToString:return o=>{let m=l[0](o);return s.args[0].type===ri?Fd(m):m.toString()};default:throw new Error(`Unsupported convert operator ${t}`)}}function Bd(s,e,t,a,l,o){let m=l-t;if(m===0)return a;let g=e-t,b=s===1?g/m:(Math.pow(s,g)-1)/(Math.pow(s,m)-1);return a+b*(o-a)}function tB(s,e,t,a,l,o){if(l-t===0)return a;let g=F0(a),b=F0(o),A=b[2]-g[2];A>180?A-=360:A<-180&&(A+=360);let S=[Bd(s,e,t,g[0],l,b[0]),Bd(s,e,t,g[1],l,b[1]),g[2]+Bd(s,e,t,0,l,A),Bd(s,e,t,a[3],l,o[3])];return L0(uI(S))}function rB(s){return!0}function TI(s){let e=tv(),t=iB(s,e),a=iv();return function(l,o){if(a.properties=l.getPropertiesInternal(),a.resolution=o,e.featureId){let m=l.getId();m!==void 0?a.featureId=m:a.featureId=null}return e.geometryType&&(a.geometryType=rv(l.getGeometry())),t(a)}}function sv(s){let e=tv(),t=s.length,a=new Array(t);for(let m=0;m<t;++m)a[m]=nv(s[m],e);let l=iv(),o=new Array(t);return function(m,g){if(l.properties=m.getPropertiesInternal(),l.resolution=g,e.featureId){let A=m.getId();A!==void 0?l.featureId=A:l.featureId=null}let b=0;for(let A=0;A<t;++A){let S=a[A](l);S&&(o[b]=S,b+=1)}return o.length=b,o}}function iB(s,e){let t=s.length,a=new Array(t);for(let l=0;l<t;++l){let o=s[l],m="filter"in o?xs(o.filter,Nr,e):rB,g;if(Array.isArray(o.style)){let b=o.style.length;g=new Array(b);for(let A=0;A<b;++A)g[A]=nv(o.style[A],e)}else g=[nv(o.style,e)];a[l]={filter:m,styles:g}}return function(l){let o=[],m=!1;for(let g=0;g<t;++g){let b=a[g].filter;if(b(l)&&!(s[g].else&&m)){m=!0;for(let A of a[g].styles){let S=A(l);S&&o.push(S)}}}return o}}function nv(s,e){let t=Nd(s,"",e),a=jd(s,"",e),l=nB(s,e),o=oB(s,e),m=$n(s,"z-index",e);if(!t&&!a&&!l&&!o&&!lo(s))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(s));let g=new $i;return function(b){let A=!0;if(t){let S=t(b);S&&(A=!1),g.setFill(S)}if(a){let S=a(b);S&&(A=!1),g.setStroke(S)}if(l){let S=l(b);S&&(A=!1),g.setText(S)}if(o){let S=o(b);S&&(A=!1),g.setImage(S)}return m&&g.setZIndex(m(b)),A?null:g}}function Nd(s,e,t){let a;if(e+"fill-pattern-src"in s?a=cB(s,e+"fill-",t):a=av(s,e+"fill-color",t),!a)return null;let l=new qi;return function(o){let m=a(o);return m==="none"?null:(l.setColor(m),l)}}function jd(s,e,t){let a=$n(s,e+"stroke-width",t),l=av(s,e+"stroke-color",t);if(!a&&!l)return null;let o=la(s,e+"stroke-line-cap",t),m=la(s,e+"stroke-line-join",t),g=CI(s,e+"stroke-line-dash",t),b=$n(s,e+"stroke-line-dash-offset",t),A=$n(s,e+"stroke-miter-limit",t),S=new ai;return function(M){if(l){let k=l(M);if(k==="none")return null;S.setColor(k)}if(a&&S.setWidth(a(M)),o){let k=o(M);if(k!=="butt"&&k!=="round"&&k!=="square")throw new Error("Expected butt, round, or square line cap");S.setLineCap(k)}if(m){let k=m(M);if(k!=="bevel"&&k!=="round"&&k!=="miter")throw new Error("Expected bevel, round, or miter line join");S.setLineJoin(k)}return g&&S.setLineDash(g(M)),b&&S.setLineDashOffset(b(M)),A&&S.setMiterLimit(A(M)),S}}function nB(s,e){let t="text-",a=la(s,t+"value",e);if(!a)return null;let l=Nd(s,t,e),o=Nd(s,t+"background-",e),m=jd(s,t,e),g=jd(s,t+"background-",e),b=la(s,t+"font",e),A=$n(s,t+"max-angle",e),S=$n(s,t+"offset-x",e),M=$n(s,t+"offset-y",e),k=Ud(s,t+"overflow",e),j=la(s,t+"placement",e),Z=$n(s,t+"repeat",e),te=mg(s,t+"scale",e),q=Ud(s,t+"rotate-with-view",e),H=$n(s,t+"rotation",e),ae=la(s,t+"align",e),pe=la(s,t+"justify",e),ve=la(s,t+"baseline",e),de=CI(s,t+"padding",e),_e=gg(s,t+"declutter-mode"),Pe=new bI({declutterMode:_e});return function(Re){if(Pe.setText(a(Re)),l&&Pe.setFill(l(Re)),o&&Pe.setBackgroundFill(o(Re)),m&&Pe.setStroke(m(Re)),g&&Pe.setBackgroundStroke(g(Re)),b&&Pe.setFont(b(Re)),A&&Pe.setMaxAngle(A(Re)),S&&Pe.setOffsetX(S(Re)),M&&Pe.setOffsetY(M(Re)),k&&Pe.setOverflow(k(Re)),j){let Ae=j(Re);if(Ae!=="point"&&Ae!=="line")throw new Error("Expected point or line for text-placement");Pe.setPlacement(Ae)}if(Z&&Pe.setRepeat(Z(Re)),te&&Pe.setScale(te(Re)),q&&Pe.setRotateWithView(q(Re)),H&&Pe.setRotation(H(Re)),ae){let Ae=ae(Re);if(Ae!=="left"&&Ae!=="center"&&Ae!=="right"&&Ae!=="end"&&Ae!=="start")throw new Error("Expected left, right, center, start, or end for text-align");Pe.setTextAlign(Ae)}if(pe){let Ae=pe(Re);if(Ae!=="left"&&Ae!=="right"&&Ae!=="center")throw new Error("Expected left, right, or center for text-justify");Pe.setJustify(Ae)}if(ve){let Ae=ve(Re);if(Ae!=="bottom"&&Ae!=="top"&&Ae!=="middle"&&Ae!=="alphabetic"&&Ae!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");Pe.setTextBaseline(Ae)}return de&&Pe.setPadding(de(Re)),Pe}}function oB(s,e){return"icon-src"in s?sB(s,e):"shape-points"in s?aB(s,e):"circle-radius"in s?lB(s,e):null}function sB(s,e){let t="icon-",a=t+"src",l=MI(s[a],a),o=dg(s,t+"anchor",e),m=mg(s,t+"scale",e),g=$n(s,t+"opacity",e),b=dg(s,t+"displacement",e),A=$n(s,t+"rotation",e),S=Ud(s,t+"rotate-with-view",e),M=II(s,t+"anchor-origin"),k=PI(s,t+"anchor-x-units"),j=PI(s,t+"anchor-y-units"),Z=dB(s,t+"color"),te=hB(s,t+"cross-origin"),q=pB(s,t+"offset"),H=II(s,t+"offset-origin"),ae=fg(s,t+"width"),pe=fg(s,t+"height"),ve=uB(s,t+"size"),de=gg(s,t+"declutter-mode"),_e=new Dd({src:l,anchorOrigin:M,anchorXUnits:k,anchorYUnits:j,color:Z,crossOrigin:te,offset:q,offsetOrigin:H,height:pe,width:ae,size:ve,declutterMode:de});return function(Pe){return g&&_e.setOpacity(g(Pe)),b&&_e.setDisplacement(b(Pe)),A&&_e.setRotation(A(Pe)),S&&_e.setRotateWithView(S(Pe)),m&&_e.setScale(m(Pe)),o&&_e.setAnchor(o(Pe)),_e}}function aB(s,e){let t="shape-",a=t+"points",l=t+"radius",o=ov(s[a],a),m=ov(s[l],l),g=Nd(s,t,e),b=jd(s,t,e),A=mg(s,t+"scale",e),S=dg(s,t+"displacement",e),M=$n(s,t+"rotation",e),k=Ud(s,t+"rotate-with-view",e),j=fg(s,t+"radius2"),Z=fg(s,t+"angle"),te=gg(s,t+"declutter-mode"),q=new hg({points:o,radius:m,radius2:j,angle:Z,declutterMode:te});return function(H){return g&&q.setFill(g(H)),b&&q.setStroke(b(H)),S&&q.setDisplacement(S(H)),M&&q.setRotation(M(H)),k&&q.setRotateWithView(k(H)),A&&q.setScale(A(H)),q}}function lB(s,e){let t="circle-",a=Nd(s,t,e),l=jd(s,t,e),o=$n(s,t+"radius",e),m=mg(s,t+"scale",e),g=dg(s,t+"displacement",e),b=$n(s,t+"rotation",e),A=Ud(s,t+"rotate-with-view",e),S=gg(s,t+"declutter-mode"),M=new Vn({radius:5,declutterMode:S});return function(k){return o&&M.setRadius(o(k)),a&&M.setFill(a(k)),l&&M.setStroke(l(k)),g&&M.setDisplacement(g(k)),b&&M.setRotation(b(k)),A&&M.setRotateWithView(A(k)),m&&M.setScale(m(k)),M}}function $n(s,e,t){if(!(e in s))return;let a=xs(s[e],gt,t);return function(l){return ov(a(l),e)}}function la(s,e,t){if(!(e in s))return null;let a=xs(s[e],qn,t);return function(l){return MI(a(l),e)}}function cB(s,e,t){let a=la(s,e+"pattern-src",t),l=EI(s,e+"pattern-offset",t),o=EI(s,e+"pattern-size",t),m=av(s,e+"color",t);return function(g){return{src:a(g),offset:l&&l(g),size:o&&o(g),color:m&&m(g)}}}function Ud(s,e,t){if(!(e in s))return null;let a=xs(s[e],Nr,t);return function(l){let o=a(l);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function av(s,e,t){if(!(e in s))return null;let a=xs(s[e],ri|qn,t);return function(l){return RI(a(l),e)}}function CI(s,e,t){if(!(e in s))return null;let a=xs(s[e],Zo,t);return function(l){return Gd(a(l),e)}}function dg(s,e,t){if(!(e in s))return null;let a=xs(s[e],Zo,t);return function(l){let o=Gd(a(l),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function EI(s,e,t){if(!(e in s))return null;let a=xs(s[e],Zo,t);return function(l){return kI(a(l),e)}}function mg(s,e,t){if(!(e in s))return null;let a=xs(s[e],Zo|gt,t);return function(l){return fB(a(l),e)}}function fg(s,e){let t=s[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function uB(s,e){let t=s[e];if(t!==void 0){if(typeof t=="number")return Wa(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function hB(s,e){let t=s[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function II(s,e){let t=s[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function PI(s,e){let t=s[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function pB(s,e){let t=s[e];if(t!==void 0)return Gd(t,e)}function gg(s,e){let t=s[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function dB(s,e){let t=s[e];if(t!==void 0)return RI(t,e)}function Gd(s,e){if(!Array.isArray(s))throw new Error(`Expected an array for ${e}`);let t=s.length;for(let a=0;a<t;++a)if(typeof s[a]!="number")throw new Error(`Expected an array of numbers for ${e}`);return s}function MI(s,e){if(typeof s!="string")throw new Error(`Expected a string for ${e}`);return s}function ov(s,e){if(typeof s!="number")throw new Error(`Expected a number for ${e}`);return s}function RI(s,e){if(typeof s=="string")return s;let t=Gd(s,e),a=t.length;if(a<3||a>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function kI(s,e){let t=Gd(s,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function fB(s,e){return typeof s=="number"?s:kI(s,e)}var FI={RENDER_ORDER:"renderOrder"},lv=class extends qo{constructor(e){e=e||{};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(FI.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let a=this.getDeclutter();a in e.declutter||(e.declutter[a]=new LI.default(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(FI.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?X0:e;let t=mB(e);this.styleFunction_=e===null?void 0:xI(t),this.changed()}};function mB(s){if(s===void 0)return X0;if(!s)return null;if(typeof s=="function"||s instanceof $i)return s;if(!Array.isArray(s))return sv([s]);if(s.length===0)return[];let e=s.length,t=s[0];if(t instanceof $i){let l=new Array(e);for(let o=0;o<e;++o){let m=s[o];if(!(m instanceof $i))throw new Error("Expected a list of style instances");l[o]=m}return l}if("style"in t){let l=new Array(e);for(let o=0;o<e;++o){let m=s[o];if(!("style"in m))throw new Error("Expected a list of rules with a style property");l[o]=m}return TI(l)}return sv(s)}var DI=lv;var Vd={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},qd=[Vd.FILL],vs=[Vd.STROKE],ca=[Vd.BEGIN_PATH],cv=[Vd.CLOSE_PATH],xt=Vd;var uv=class{drawCustom(e,t,a,l,o){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,a){}drawFeature(e,t,a){}drawGeometryCollection(e,t,a){}drawLineString(e,t,a){}drawMultiLineString(e,t,a){}drawMultiPoint(e,t,a){}drawMultiPolygon(e,t,a){}drawPoint(e,t,a){}drawPolygon(e,t,a){}drawText(e,t,a){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},yg=uv;var hv=class extends yg{constructor(e,t,a,l){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=l,this.maxLineWidth=0,this.resolution=a,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(a){return a*t})}appendFlatPointCoordinates(e,t){let a=this.getBufferedMaxExtent(),l=this.tmpCoordinate_,o=this.coordinates,m=o.length;for(let g=0,b=e.length;g<b;g+=t)l[0]=e[g],l[1]=e[g+1],Js(a,l)&&(o[m++]=l[0],o[m++]=l[1]);return m}appendFlatLineCoordinates(e,t,a,l,o,m){let g=this.coordinates,b=g.length,A=this.getBufferedMaxExtent();m&&(t+=l);let S=e[t],M=e[t+1],k=this.tmpCoordinate_,j=!0,Z,te,q;for(Z=t+l;Z<a;Z+=l)k[0]=e[Z],k[1]=e[Z+1],q=Nm(A,k),q!==te?(j&&(g[b++]=S,g[b++]=M,j=!1),g[b++]=k[0],g[b++]=k[1]):q===Qr.INTERSECTING?(g[b++]=k[0],g[b++]=k[1],j=!1):j=!0,S=k[0],M=k[1],te=q;return(o&&j||Z===t+l)&&(g[b++]=S,g[b++]=M),b}drawCustomCoordinates_(e,t,a,l,o){for(let m=0,g=a.length;m<g;++m){let b=a[m],A=this.appendFlatLineCoordinates(e,t,b,l,!1,!1);o.push(A),t=b}return t}drawCustom(e,t,a,l,o){this.beginGeometry(e,t,o);let m=e.getType(),g=e.getStride(),b=this.coordinates.length,A,S,M,k,j;switch(m){case"MultiPolygon":A=e.getOrientedFlatCoordinates(),k=[];let Z=e.getEndss();j=0;for(let te=0,q=Z.length;te<q;++te){let H=[];j=this.drawCustomCoordinates_(A,j,Z[te],g,H),k.push(H)}this.instructions.push([xt.CUSTOM,b,k,e,a,xd,o]),this.hitDetectionInstructions.push([xt.CUSTOM,b,k,e,l||a,xd,o]);break;case"Polygon":case"MultiLineString":M=[],A=m=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),j=this.drawCustomCoordinates_(A,0,e.getEnds(),g,M),this.instructions.push([xt.CUSTOM,b,M,e,a,Va,o]),this.hitDetectionInstructions.push([xt.CUSTOM,b,M,e,l||a,Va,o]);break;case"LineString":case"Circle":A=e.getFlatCoordinates(),S=this.appendFlatLineCoordinates(A,0,A.length,g,!1,!1),this.instructions.push([xt.CUSTOM,b,S,e,a,wo,o]),this.hitDetectionInstructions.push([xt.CUSTOM,b,S,e,l||a,wo,o]);break;case"MultiPoint":A=e.getFlatCoordinates(),S=this.appendFlatPointCoordinates(A,g),S>b&&(this.instructions.push([xt.CUSTOM,b,S,e,a,wo,o]),this.hitDetectionInstructions.push([xt.CUSTOM,b,S,e,l||a,wo,o]));break;case"Point":A=e.getFlatCoordinates(),this.coordinates.push(A[0],A[1]),S=this.coordinates.length,this.instructions.push([xt.CUSTOM,b,S,e,a,void 0,o]),this.hitDetectionInstructions.push([xt.CUSTOM,b,S,e,l||a,void 0,o]);break;default:}this.endGeometry(t)}beginGeometry(e,t,a){this.beginGeometryInstruction1_=[xt.BEGIN_GEOMETRY,t,0,e,a],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[xt.BEGIN_GEOMETRY,t,0,e,a],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,a=e.length,l,o,m=-1;for(t=0;t<a;++t)l=e[t],o=l[0],o==xt.END_GEOMETRY?m=t:o==xt.BEGIN_GEOMETRY&&(l[2]=t,$A(this.hitDetectionInstructions,m,t),m=-1)}setFillStrokeStyle(e,t){let a=this.state;if(e){let l=e.getColor();a.fillPatternScale=l&&typeof l=="object"&&"src"in l?this.pixelRatio:1,a.fillStyle=jn(l||li)}else a.fillStyle=void 0;if(t){let l=t.getColor();a.strokeStyle=jn(l||oa);let o=t.getLineCap();a.lineCap=o!==void 0?o:ys;let m=t.getLineDash();a.lineDash=m?m.slice():Un;let g=t.getLineDashOffset();a.lineDashOffset=g||Gn;let b=t.getLineJoin();a.lineJoin=b!==void 0?b:_s;let A=t.getWidth();a.lineWidth=A!==void 0?A:aa;let S=t.getMiterLimit();a.miterLimit=S!==void 0?S:na,a.lineWidth>this.maxLineWidth&&(this.maxLineWidth=a.lineWidth,this.bufferedMaxExtent_=null)}else a.strokeStyle=void 0,a.lineCap=void 0,a.lineDash=null,a.lineDashOffset=void 0,a.lineJoin=void 0,a.lineWidth=void 0,a.miterLimit=void 0}createFill(e){let t=e.fillStyle,a=[xt.SET_FILL_STYLE,t];return typeof t!="string"&&a.push(e.fillPatternScale),a}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[xt.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,this.applyPixelRatio(e.lineDash),e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let a=e.fillStyle;(typeof a!="string"||e.currentFillStyle!=a)&&(a!==void 0&&this.instructions.push(t.call(this,e)),e.currentFillStyle=a)}updateStrokeStyle(e,t){let a=e.strokeStyle,l=e.lineCap,o=e.lineDash,m=e.lineDashOffset,g=e.lineJoin,b=e.lineWidth,A=e.miterLimit;(e.currentStrokeStyle!=a||e.currentLineCap!=l||o!=e.currentLineDash&&!Fn(e.currentLineDash,o)||e.currentLineDashOffset!=m||e.currentLineJoin!=g||e.currentLineWidth!=b||e.currentMiterLimit!=A)&&(a!==void 0&&t.call(this,e),e.currentStrokeStyle=a,e.currentLineCap=l,e.currentLineDash=o,e.currentLineDashOffset=m,e.currentLineJoin=g,e.currentLineWidth=b,e.currentMiterLimit=A)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[xt.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=WA(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;Ln(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},bs=hv;var pv=class extends bs{constructor(e,t,a,l){super(e,t,a,l),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,a){if(!this.image_||this.maxExtent&&!Js(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,a);let l=e.getFlatCoordinates(),o=e.getStride(),m=this.coordinates.length,g=this.appendFlatPointCoordinates(l,o);this.instructions.push([xt.DRAW_IMAGE,m,g,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([xt.DRAW_IMAGE,m,g,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,a){if(!this.image_)return;this.beginGeometry(e,t,a);let l=e.getFlatCoordinates(),o=[];for(let b=0,A=l.length;b<A;b+=e.getStride())(!this.maxExtent||Js(this.maxExtent,l.slice(b,b+2)))&&o.push(l[b],l[b+1]);let m=this.coordinates.length,g=this.appendFlatPointCoordinates(o,2);this.instructions.push([xt.DRAW_IMAGE,m,g,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([xt.DRAW_IMAGE,m,g,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let a=e.getAnchor(),l=e.getSize(),o=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=a[0],this.anchorY_=a[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=l[1],this.opacity_=e.getOpacity(),this.originX_=o[0],this.originY_=o[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=l[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},OI=pv;var dv=class extends bs{constructor(e,t,a,l){super(e,t,a,l)}drawFlatCoordinates_(e,t,a,l){let o=this.coordinates.length,m=this.appendFlatLineCoordinates(e,t,a,l,!1,!1),g=[xt.MOVE_TO_LINE_TO,o,m];return this.instructions.push(g),this.hitDetectionInstructions.push(g),a}drawLineString(e,t,a){let l=this.state,o=l.strokeStyle,m=l.lineWidth;if(o===void 0||m===void 0)return;this.updateStrokeStyle(l,this.applyStroke),this.beginGeometry(e,t,a),this.hitDetectionInstructions.push([xt.SET_STROKE_STYLE,l.strokeStyle,l.lineWidth,l.lineCap,l.lineJoin,l.miterLimit,Un,Gn],ca);let g=e.getFlatCoordinates(),b=e.getStride();this.drawFlatCoordinates_(g,0,g.length,b),this.hitDetectionInstructions.push(vs),this.endGeometry(t)}drawMultiLineString(e,t,a){let l=this.state,o=l.strokeStyle,m=l.lineWidth;if(o===void 0||m===void 0)return;this.updateStrokeStyle(l,this.applyStroke),this.beginGeometry(e,t,a),this.hitDetectionInstructions.push([xt.SET_STROKE_STYLE,l.strokeStyle,l.lineWidth,l.lineCap,l.lineJoin,l.miterLimit,Un,Gn],ca);let g=e.getEnds(),b=e.getFlatCoordinates(),A=e.getStride(),S=0;for(let M=0,k=g.length;M<k;++M)S=this.drawFlatCoordinates_(b,S,g[M],A);this.hitDetectionInstructions.push(vs),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(vs),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(vs),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(ca)}},zI=dv;var fv=class extends bs{constructor(e,t,a,l){super(e,t,a,l)}drawFlatCoordinatess_(e,t,a,l){let o=this.state,m=o.fillStyle!==void 0,g=o.strokeStyle!==void 0,b=a.length;this.instructions.push(ca),this.hitDetectionInstructions.push(ca);for(let A=0;A<b;++A){let S=a[A],M=this.coordinates.length,k=this.appendFlatLineCoordinates(e,t,S,l,!0,!g),j=[xt.MOVE_TO_LINE_TO,M,k];this.instructions.push(j),this.hitDetectionInstructions.push(j),g&&(this.instructions.push(cv),this.hitDetectionInstructions.push(cv)),t=S}return m&&(this.instructions.push(qd),this.hitDetectionInstructions.push(qd)),g&&(this.instructions.push(vs),this.hitDetectionInstructions.push(vs)),t}drawCircle(e,t,a){let l=this.state,o=l.fillStyle,m=l.strokeStyle;if(o===void 0&&m===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,a),l.fillStyle!==void 0&&this.hitDetectionInstructions.push([xt.SET_FILL_STYLE,li]),l.strokeStyle!==void 0&&this.hitDetectionInstructions.push([xt.SET_STROKE_STYLE,l.strokeStyle,l.lineWidth,l.lineCap,l.lineJoin,l.miterLimit,Un,Gn]);let g=e.getFlatCoordinates(),b=e.getStride(),A=this.coordinates.length;this.appendFlatLineCoordinates(g,0,g.length,b,!1,!1);let S=[xt.CIRCLE,A];this.instructions.push(ca,S),this.hitDetectionInstructions.push(ca,S),l.fillStyle!==void 0&&(this.instructions.push(qd),this.hitDetectionInstructions.push(qd)),l.strokeStyle!==void 0&&(this.instructions.push(vs),this.hitDetectionInstructions.push(vs)),this.endGeometry(t)}drawPolygon(e,t,a){let l=this.state,o=l.fillStyle,m=l.strokeStyle;if(o===void 0&&m===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,a),l.fillStyle!==void 0&&this.hitDetectionInstructions.push([xt.SET_FILL_STYLE,li]),l.strokeStyle!==void 0&&this.hitDetectionInstructions.push([xt.SET_STROKE_STYLE,l.strokeStyle,l.lineWidth,l.lineCap,l.lineJoin,l.miterLimit,Un,Gn]);let g=e.getEnds(),b=e.getOrientedFlatCoordinates(),A=e.getStride();this.drawFlatCoordinatess_(b,0,g,A),this.endGeometry(t)}drawMultiPolygon(e,t,a){let l=this.state,o=l.fillStyle,m=l.strokeStyle;if(o===void 0&&m===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,a),l.fillStyle!==void 0&&this.hitDetectionInstructions.push([xt.SET_FILL_STYLE,li]),l.strokeStyle!==void 0&&this.hitDetectionInstructions.push([xt.SET_STROKE_STYLE,l.strokeStyle,l.lineWidth,l.lineCap,l.lineJoin,l.miterLimit,Un,Gn]);let g=e.getEndss(),b=e.getOrientedFlatCoordinates(),A=e.getStride(),S=0;for(let M=0,k=g.length;M<k;++M)S=this.drawFlatCoordinatess_(b,S,g[M],A);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let a=0,l=t.length;a<l;++a)t[a]=Ga(t[a],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;e.fillStyle!==void 0&&this.updateFillStyle(e,this.createFill),e.strokeStyle!==void 0&&this.updateStrokeStyle(e,this.applyStroke)}},mv=fv;function BI(s,e,t,a,l){let o=[],m=t,g=0,b=e.slice(t,2);for(;g<s&&m+l<a;){let[A,S]=b.slice(-2),M=e[m+l],k=e[m+l+1],j=Math.sqrt((M-A)*(M-A)+(k-S)*(k-S));if(g+=j,g>=s){let Z=(s-g+j)/j,te=Gi(A,M,Z),q=Gi(S,k,Z);b.push(te,q),o.push(b),b=[te,q],g==s&&(m+=l),g=0}else if(g<s)b.push(e[m+l],e[m+l+1]),m+=l;else{let Z=j-g,te=Gi(A,M,Z/j),q=Gi(S,k,Z/j);b.push(te,q),o.push(b),b=[te,q],g=0,m+=l}}return g>0&&o.push(b),o}function NI(s,e,t,a,l){let o=t,m=t,g=0,b=0,A=t,S,M,k,j,Z,te,q,H,ae,pe;for(M=t;M<a;M+=l){let ve=e[M],de=e[M+1];Z!==void 0&&(ae=ve-Z,pe=de-te,j=Math.sqrt(ae*ae+pe*pe),q!==void 0&&(b+=k,S=Math.acos((q*ae+H*pe)/(k*j)),S>s&&(b>g&&(g=b,o=A,m=M),b=0,A=M-l)),k=j,q=ae,H=pe),Z=ve,te=de}return b+=j,b>g?[A,M]:[o,m]}var $d={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},gv=class extends bs{constructor(e,t,a,l){super(e,t,a,l),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[li]={fillStyle:li},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,a){let l=this.textFillState_,o=this.textStrokeState_,m=this.textState_;if(this.text_===""||!m||!l&&!o)return;let g=this.coordinates,b=g.length,A=e.getType(),S=null,M=e.getStride();if(m.placement==="line"&&(A=="LineString"||A=="MultiLineString"||A=="Polygon"||A=="MultiPolygon")){if(!ei(this.maxExtent,e.getExtent()))return;let k;if(S=e.getFlatCoordinates(),A=="LineString")k=[S.length];else if(A=="MultiLineString")k=e.getEnds();else if(A=="Polygon")k=e.getEnds().slice(0,1);else if(A=="MultiPolygon"){let q=e.getEndss();k=[];for(let H=0,ae=q.length;H<ae;++H)k.push(q[H][0])}this.beginGeometry(e,t,a);let j=m.repeat,Z=j?void 0:m.textAlign,te=0;for(let q=0,H=k.length;q<H;++q){let ae;j?ae=BI(j*this.resolution,S,te,k[q],M):ae=[S.slice(te,k[q])];for(let pe=0,ve=ae.length;pe<ve;++pe){let de=ae[pe],_e=0,Pe=de.length;if(Z==null){let Ae=NI(m.maxAngle,de,0,de.length,2);_e=Ae[0],Pe=Ae[1]}for(let Ae=_e;Ae<Pe;Ae+=M)g.push(de[Ae],de[Ae+1]);let Re=g.length;te=k[q],this.drawChars_(b,Re),b=Re}}this.endGeometry(t)}else{let k=m.overflow?null:[];switch(A){case"Point":case"MultiPoint":S=e.getFlatCoordinates();break;case"LineString":S=e.getFlatMidpoint();break;case"Circle":S=e.getCenter();break;case"MultiLineString":S=e.getFlatMidpoints(),M=2;break;case"Polygon":S=e.getFlatInteriorPoint(),m.overflow||k.push(S[2]/this.resolution),M=3;break;case"MultiPolygon":let ae=e.getFlatInteriorPoints();S=[];for(let pe=0,ve=ae.length;pe<ve;pe+=3)m.overflow||k.push(ae[pe+2]/this.resolution),S.push(ae[pe],ae[pe+1]);if(S.length===0)return;M=2;break;default:}let j=this.appendFlatPointCoordinates(S,M);if(j===b)return;if(k&&(j-b)/2!==S.length/M){let ae=b/2;k=k.filter((pe,ve)=>{let de=g[(ae+ve)*2]===S[ve*M]&&g[(ae+ve)*2+1]===S[ve*M+1];return de||--ae,de})}this.saveTextStates_(),(m.backgroundFill||m.backgroundStroke)&&(this.setFillStrokeStyle(m.backgroundFill,m.backgroundStroke),m.backgroundFill&&this.updateFillStyle(this.state,this.createFill),m.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(e,t,a);let Z=m.padding;if(Z!=sa&&(m.scale[0]<0||m.scale[1]<0)){let ae=m.padding[0],pe=m.padding[1],ve=m.padding[2],de=m.padding[3];m.scale[0]<0&&(pe=-pe,de=-de),m.scale[1]<0&&(ae=-ae,ve=-ve),Z=[ae,pe,ve,de]}let te=this.pixelRatio;this.instructions.push([xt.DRAW_IMAGE,b,j,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,Z==sa?sa:Z.map(function(ae){return ae*te}),!!m.backgroundFill,!!m.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,k]);let q=1/te,H=this.state.fillStyle;m.backgroundFill&&(this.state.fillStyle=li,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([xt.DRAW_IMAGE,b,j,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[q,q],NaN,this.declutterMode_,this.declutterImageWithText_,Z,!!m.backgroundFill,!!m.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?li:this.fillKey_,this.textOffsetX_,this.textOffsetY_,k]),m.backgroundFill&&(this.state.fillStyle=H,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,a=this.textFillState_,l=this.strokeKey_;e&&(l in this.strokeStates||(this.strokeStates[l]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let o=this.textKey_;o in this.textStates||(this.textStates[o]={font:t.font,textAlign:t.textAlign||Xa,justify:t.justify,textBaseline:t.textBaseline||Hl,scale:t.scale});let m=this.fillKey_;a&&(m in this.fillStates||(this.fillStates[m]={fillStyle:a.fillStyle}))}drawChars_(e,t){let a=this.textStrokeState_,l=this.textState_,o=this.strokeKey_,m=this.textKey_,g=this.fillKey_;this.saveTextStates_();let b=this.pixelRatio,A=$d[l.textBaseline],S=this.textOffsetY_*b,M=this.text_,k=a?a.lineWidth*Math.abs(l.scale[0])/2:0;this.instructions.push([xt.DRAW_CHARS,e,t,A,l.overflow,g,l.maxAngle,b,S,o,k*b,M,m,1,this.declutterMode_]),this.hitDetectionInstructions.push([xt.DRAW_CHARS,e,t,A,l.overflow,g&&li,l.maxAngle,b,S,o,k*b,M,m,1/b,this.declutterMode_])}setTextStyle(e,t){let a,l,o;if(!e)this.text_="";else{let m=e.getFill();m?(l=this.textFillState_,l||(l={},this.textFillState_=l),l.fillStyle=jn(m.getColor()||li)):(l=null,this.textFillState_=l);let g=e.getStroke();if(!g)o=null,this.textStrokeState_=o;else{o=this.textStrokeState_,o||(o={},this.textStrokeState_=o);let Z=g.getLineDash(),te=g.getLineDashOffset(),q=g.getWidth(),H=g.getMiterLimit();o.lineCap=g.getLineCap()||ys,o.lineDash=Z?Z.slice():Un,o.lineDashOffset=te===void 0?Gn:te,o.lineJoin=g.getLineJoin()||_s,o.lineWidth=q===void 0?aa:q,o.miterLimit=H===void 0?na:H,o.strokeStyle=jn(g.getColor()||oa)}a=this.textState_;let b=e.getFont()||ug;fI(b);let A=e.getScaleArray();a.overflow=e.getOverflow(),a.font=b,a.maxAngle=e.getMaxAngle(),a.placement=e.getPlacement(),a.textAlign=e.getTextAlign(),a.repeat=e.getRepeat(),a.justify=e.getJustify(),a.textBaseline=e.getTextBaseline()||Hl,a.backgroundFill=e.getBackgroundFill(),a.backgroundStroke=e.getBackgroundStroke(),a.padding=e.getPadding()||sa,a.scale=A===void 0?[1,1]:A;let S=e.getOffsetX(),M=e.getOffsetY(),k=e.getRotateWithView(),j=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=S===void 0?0:S,this.textOffsetY_=M===void 0?0:M,this.textRotateWithView_=k===void 0?!1:k,this.textRotation_=j===void 0?0:j,this.strokeKey_=o?(typeof o.strokeStyle=="string"?o.strokeStyle:Ut(o.strokeStyle))+o.lineCap+o.lineDashOffset+"|"+o.lineWidth+o.lineJoin+o.miterLimit+"["+o.lineDash.join()+"]":"",this.textKey_=a.font+a.scale+(a.textAlign||"?")+(a.repeat||"?")+(a.justify||"?")+(a.textBaseline||"?"),this.fillKey_=l&&l.fillStyle?typeof l.fillStyle=="string"?l.fillStyle:"|"+Ut(l.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},jI=gv;var gB={Circle:mv,Default:bs,Image:OI,LineString:zI,Polygon:mv,Text:jI},yv=class{constructor(e,t,a,l){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=l,this.resolution_=a,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let a=this.buildersByZIndex_[t];for(let l in a){let o=a[l].finish();e[t][l]=o}}return e}getBuilder(e,t){let a=e!==void 0?e.toString():"0",l=this.buildersByZIndex_[a];l===void 0&&(l={},this.buildersByZIndex_[a]=l);let o=l[t];if(o===void 0){let m=gB[t];o=new m(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),l[t]=o}return o}},UI=yv;var _v=class extends zm{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e}getFeatures(e){return Pt()}getData(e){return null}prepareFrame(e){return Pt()}renderFrame(e,t){return Pt()}loadedTileCallback(e,t,a){e[t]||(e[t]={}),e[t][a.tileCoord.toString()]=a}createLoadedTileFinder(e,t,a){return(l,o)=>{let m=this.loadedTileCallback.bind(this,a,l);return e.forEachLoadedTile(t,l,o,m)}}forEachFeatureAtCoordinate(e,t,a,l,o){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Mt.LOADED||t.getState()===Mt.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Mt.LOADED&&t!=Mt.ERROR&&e.addEventListener(Ir.CHANGE,this.boundHandleImageChange_),t==Mt.IDLE&&(e.load(),t=e.getState()),t==Mt.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},Du=_v;var xv=class extends zr{constructor(e,t,a,l){super(e),this.inversePixelTransform=t,this.frameState=a,this.context=l}},GI=xv;var vv=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Cu(),{get:(e,t)=>{if(typeof Cu()[t]=="function")return this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(t),this.pushMethodArgs_},set:(e,t,a)=>(this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(t,a),!0)})}pushMethodArgs_=(...e)=>(this.instructions_[this.zIndex+this.offset_].push(e),this);pushFunction(e){this.instructions_[this.zIndex+this.offset_].push(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let a=0,l=t.length;a<l;++a){let o=t[a];if(typeof o=="function"){o(e);continue}let m=t[++a];if(typeof e[o]=="function")e[o](...m);else{if(typeof m=="function"){e[o]=m(e);continue}e[o]=m}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},_g=vv;var wv=[],Ou=null;function yB(){Ou=Xr(1,1,void 0,{willReadFrequently:!0})}var bv=class extends Du{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=wi(),this.pixelTransform=wi(),this.inversePixelTransform=wi(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(e,t,a){Ou||yB(),Ou.clearRect(0,0,1,1);let l;try{Ou.drawImage(e,t,a,1,1,0,0,1,1),l=Ou.getImageData(0,0,1,1).data}catch{return Ou=null,null}return l}getBackground(e){let a=this.getLayer().getBackground();return typeof a=="function"&&(a=a(e.viewState.resolution)),a||void 0}useContainer(e,t,a){let l=this.getLayer().getClassName(),o,m;if(e&&e.className===l&&(!a||e&&e.style.backgroundColor&&Fn(ia(e.style.backgroundColor),ia(a)))){let g=e.firstElementChild;g instanceof HTMLCanvasElement&&(m=g.getContext("2d"))}if(m&&m.canvas.style.transform===t?(this.container=e,this.context=m,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=document.createElement("div"),o.className=l;let g=o.style;g.position="absolute",g.width="100%",g.height="100%",m=Xr();let b=m.canvas;o.appendChild(b),g=b.style,g.position="absolute",g.left="0",g.transformOrigin="top left",this.container=o,this.context=m}!this.containerReused&&a&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=a)}clipUnrotated(e,t,a){let l=Fx(a),o=Lx(a),m=kx(a),g=Rx(a);Ni(t.coordinateToPixelTransform,l),Ni(t.coordinateToPixelTransform,o),Ni(t.coordinateToPixelTransform,m),Ni(t.coordinateToPixelTransform,g);let b=this.inversePixelTransform;Ni(b,l),Ni(b,o),Ni(b,m),Ni(b,g),e.save(),e.beginPath(),e.moveTo(Math.round(l[0]),Math.round(l[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(m[0]),Math.round(m[1])),e.lineTo(Math.round(g[0]),Math.round(g[1])),e.clip()}prepareContainer(e,t){let a=e.extent,l=e.viewState.resolution,o=e.viewState.rotation,m=e.pixelRatio,g=Math.round(kr(a)/l*m),b=Math.round(si(a)/l*m);ln(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/m,1/m,o,-g/2,-b/2),GA(this.inversePixelTransform,this.pixelTransform);let A=Sx(this.pixelTransform);if(this.useContainer(t,A,this.getBackground(e)),!this.containerReused){let S=this.context.canvas;S.width!=g||S.height!=b?(S.width=g,S.height=b):this.context.clearRect(0,0,g,b),A!==S.style.transform&&(S.style.transform=A)}}dispatchRenderEvent_(e,t,a){let l=this.getLayer();if(l.hasListener(e)){let o=new GI(e,this.inversePixelTransform,a,t);l.dispatchEvent(o)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(ms.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(ms.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new _g),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(ms.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(ms.POSTRENDER,this.context,e))}getRenderTransform(e,t,a,l,o,m,g){let b=o/2,A=m/2,S=l/t,M=-S,k=-e[0]+g,j=-e[1];return ln(this.tempTransform,b,A,S,M,-a,k,j)}disposeInternal(){delete this.frameState,super.disposeInternal()}},xg=bv;function VI(s,e,t,a,l,o,m,g,b,A,S,M){let k=s[e],j=s[e+1],Z=0,te=0,q=0,H=0;function ae(){Z=k,te=j,e+=a,k=s[e],j=s[e+1],H+=q,q=Math.sqrt((k-Z)*(k-Z)+(j-te)*(j-te))}do ae();while(e<t-a&&H+q<o);let pe=q===0?0:(o-H)/q,ve=Gi(Z,k,pe),de=Gi(te,j,pe),_e=e-a,Pe=H,Re=o+g*b(A,l,S);for(;e<t-a&&H+q<Re;)ae();pe=q===0?0:(Re-H)/q;let Ae=Gi(Z,k,pe),ut=Gi(te,j,pe),Ve;if(M){let nt=[ve,de,Ae,ut];$m(nt,0,4,2,M,nt,nt),Ve=nt[0]>nt[2]}else Ve=ve>Ae;let Ue=Math.PI,pt=[],Tt=_e+a===e;e=_e,q=0,H=Pe,k=s[e],j=s[e+1];let Qe;if(Tt){ae(),Qe=Math.atan2(j-te,k-Z),Ve&&(Qe+=Qe>0?-Ue:Ue);let nt=(Ae+ve)/2,yt=(ut+de)/2;return pt[0]=[nt,yt,(Re-o)/2,Qe,l],pt}l=l.replace(/\n/g," ");for(let nt=0,yt=l.length;nt<yt;){ae();let dt=Math.atan2(j-te,k-Z);if(Ve&&(dt+=dt>0?-Ue:Ue),Qe!==void 0){let $e=dt-Qe;if($e+=$e>Ue?-2*Ue:$e<-Ue?2*Ue:0,Math.abs($e)>m)return null}Qe=dt;let Rt=nt,bt=0;for(;nt<yt;++nt){let $e=Ve?yt-nt-1:nt,Fr=g*b(A,l[$e],S);if(e+a<t&&H+q<o+bt+Fr/2)break;bt+=Fr}if(nt===Rt)continue;let Bt=Ve?l.substring(yt-Rt,yt-nt):l.substring(Rt,nt);pe=q===0?0:(o+bt/2-H)/q;let jt=Gi(Z,k,pe),Pr=Gi(te,j,pe);pt.push([jt,Pr,bt/2,dt,Bt]),o+=bt}return pt}var zu=On(),Ya=[],ua=[],ha=[],Ja=[];function qI(s){return s[3].declutterBox}var $I=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function Sv(s,e){return e==="start"?e=$I.test(s)?"right":"left":e==="end"&&(e=$I.test(s)?"left":"right"),$d[e]}function _B(s,e,t){return t>0&&s.push(`
586
586
  `,""),s.push(e,""),s}var Av=class{constructor(e,t,a,l,o){this.overlaps=a,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=l.instructions,this.coordinates=l.coordinates,this.coordinateCache_={},this.renderedTransform_=wi(),this.hitDetectionInstructions=l.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=l.fillStates||{},this.strokeStates=l.strokeStates||{},this.textStates=l.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=o?new _g:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,a,l){let o=e+t+a+l;if(this.labels_[o])return this.labels_[o];let m=l?this.strokeStates[l]:null,g=a?this.fillStates[a]:null,b=this.textStates[t],A=this.pixelRatio,S=[b.scale[0]*A,b.scale[1]*A],M=Array.isArray(e),k=b.justify?$d[b.justify]:Sv(Array.isArray(e)?e[0]:e,b.textAlign||Xa),j=l&&m.lineWidth?m.lineWidth:0,Z=M?e:e.split(`
587
587
  `).reduce(_B,[]),{width:te,height:q,widths:H,heights:ae,lineWidths:pe}=gI(b,Z),ve=te+j,de=[],_e=(ve+2)*S[0],Pe=(q+j)*S[1],Re={width:_e<0?Math.floor(_e):Math.ceil(_e),height:Pe<0?Math.floor(Pe):Math.ceil(Pe),contextInstructions:de};(S[0]!=1||S[1]!=1)&&de.push("scale",S),l&&(de.push("strokeStyle",m.strokeStyle),de.push("lineWidth",j),de.push("lineCap",m.lineCap),de.push("lineJoin",m.lineJoin),de.push("miterLimit",m.miterLimit),de.push("setLineDash",[m.lineDash]),de.push("lineDashOffset",m.lineDashOffset)),a&&de.push("fillStyle",g.fillStyle),de.push("textBaseline","middle"),de.push("textAlign","center");let Ae=.5-k,ut=k*ve+Ae*j,Ve=[],Ue=[],pt=0,Tt=0,Qe=0,nt=0,yt;for(let dt=0,Rt=Z.length;dt<Rt;dt+=2){let bt=Z[dt];if(bt===`
588
- `){Tt+=pt,pt=0,ut=k*ve+Ae*j,++nt;continue}let Bt=Z[dt+1]||b.font;Bt!==yt&&(l&&Ve.push("font",Bt),a&&Ue.push("font",Bt),yt=Bt),pt=Math.max(pt,ae[Qe]);let jt=[bt,ut+Ae*H[Qe]+k*(H[Qe]-pe[nt]),.5*(j+pt)+Tt];ut+=H[Qe],l&&Ve.push("strokeText",jt),a&&Ue.push("fillText",jt),++Qe}return Array.prototype.push.apply(de,Ve),Array.prototype.push.apply(de,Ue),this.labels_[o]=Re,Re}replayTextBackground_(e,t,a,l,o,m,g){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,a),e.lineTo.apply(e,l),e.lineTo.apply(e,o),e.lineTo.apply(e,t),m&&(this.alignAndScaleFill_=m[2],this.fill_(e)),g&&(this.setStrokeStyle_(e,g),e.stroke())}calculateImageOrLabelDimensions_(e,t,a,l,o,m,g,b,A,S,M,k,j,Z,te,q){g*=k[0],b*=k[1];let H=a-g,ae=l-b,pe=o+A>e?e-A:o,ve=m+S>t?t-S:m,de=Z[3]+pe*k[0]+Z[1],_e=Z[0]+ve*k[1]+Z[2],Pe=H-Z[3],Re=ae-Z[0];(te||M!==0)&&(Ya[0]=Pe,Ja[0]=Pe,Ya[1]=Re,ua[1]=Re,ua[0]=Pe+de,ha[0]=ua[0],ha[1]=Re+_e,Ja[1]=ha[1]);let Ae;return M!==0?(Ae=ln(wi(),a,l,1,1,M,-a,-l),Ni(Ae,Ya),Ni(Ae,ua),Ni(Ae,ha),Ni(Ae,Ja),ea(Math.min(Ya[0],ua[0],ha[0],Ja[0]),Math.min(Ya[1],ua[1],ha[1],Ja[1]),Math.max(Ya[0],ua[0],ha[0],Ja[0]),Math.max(Ya[1],ua[1],ha[1],Ja[1]),zu)):ea(Math.min(Pe,Pe+de),Math.min(Re,Re+_e),Math.max(Pe,Pe+de),Math.max(Re,Re+_e),zu),j&&(H=Math.round(H),ae=Math.round(ae)),{drawImageX:H,drawImageY:ae,drawImageW:pe,drawImageH:ve,originX:A,originY:S,declutterBox:{minX:zu[0],minY:zu[1],maxX:zu[2],maxY:zu[3],value:q},canvasTransform:Ae,scale:k}}replayImageOrLabel_(e,t,a,l,o,m,g){let b=!!(m||g),A=l.declutterBox,S=g?g[2]*l.scale[0]/2:0;return A.minX-S<=t[0]&&A.maxX+S>=0&&A.minY-S<=t[1]&&A.maxY+S>=0&&(b&&this.replayTextBackground_(e,Ya,ua,ha,Ja,m,g),yI(e,l.canvasTransform,o,a,l.originX,l.originY,l.drawImageW,l.drawImageH,l.drawImageX,l.drawImageY,l.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let a=Ni(this.renderedTransform_,[0,0]),l=512*this.pixelRatio;e.save(),e.translate(a[0]%l,a[1]%l),t!==1&&e.scale(t,t),e.rotate(this.viewRotation_)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6])}drawLabelWithPointPlacement_(e,t,a,l){let o=this.textStates[t],m=this.createLabel(e,t,l,a),g=this.strokeStates[a],b=this.pixelRatio,A=Sv(Array.isArray(e)?e[0]:e,o.textAlign||Xa),S=$d[o.textBaseline||Hl],M=g&&g.lineWidth?g.lineWidth:0,k=m.width/b-2*o.scale[0],j=A*k+2*(.5-A)*M,Z=S*m.height/b+2*(.5-S)*M;return{label:m,anchorX:j,anchorY:Z}}execute_(e,t,a,l,o,m,g,b){let A=this.zIndexContext_,S;this.pixelCoordinates_&&Fn(a,this.renderedTransform_)?S=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),S=zn(this.coordinates,0,this.coordinates.length,2,a,this.pixelCoordinates_),jA(this.renderedTransform_,a));let M=0,k=l.length,j=0,Z,te,q,H,ae,pe,ve,de,_e,Pe,Re,Ae,ut,Ve=0,Ue=0,pt=null,Tt=null,Qe=this.coordinateCache_,nt=this.viewRotation_,yt=Math.round(Math.atan2(-a[1],a[0])*1e12)/1e12,dt={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:nt},Rt=this.instructions!=l||this.overlaps?0:200,bt,Bt,jt,Pr;for(;M<k;){let $e=l[M];switch($e[0]){case xt.BEGIN_GEOMETRY:bt=$e[1],Pr=$e[3],bt.getGeometry()?g!==void 0&&!ei(g,Pr.getExtent())?M=$e[2]+1:++M:M=$e[2],A&&(A.zIndex=$e[4]);break;case xt.BEGIN_PATH:Ve>Rt&&(this.fill_(e),Ve=0),Ue>Rt&&(e.stroke(),Ue=0),!Ve&&!Ue&&(e.beginPath(),ae=NaN,pe=NaN),++M;break;case xt.CIRCLE:j=$e[1];let Lr=S[j],Mi=S[j+1],Ri=S[j+2],En=S[j+3],ii=Ri-Lr,In=En-Mi,Pn=Math.sqrt(ii*ii+In*In);e.moveTo(Lr+Pn,Mi),e.arc(Lr,Mi,Pn,0,2*Math.PI,!0),++M;break;case xt.CLOSE_PATH:e.closePath(),++M;break;case xt.CUSTOM:j=$e[1],Z=$e[2];let Wn=$e[3],Ee=$e[4],Zn=$e[5];dt.geometry=Wn,dt.feature=bt,M in Qe||(Qe[M]=[]);let ki=Qe[M];Zn?Zn(S,j,Z,2,ki):(ki[0]=S[j],ki[1]=S[j+1],ki.length=2),A&&(A.zIndex=$e[6]),Ee(ki,dt),++M;break;case xt.DRAW_IMAGE:j=$e[1],Z=$e[2],_e=$e[3],te=$e[4],q=$e[5];let Et=$e[6],ir=$e[7],Xn=$e[8],Tn=$e[9],Yi=$e[10],Cn=$e[11],Fi=$e[12],po=$e[13];H=$e[14]||"declutter";let Hn=$e[15];if(!_e&&$e.length>=20){Pe=$e[19],Re=$e[20],Ae=$e[21],ut=$e[22];let le=this.drawLabelWithPointPlacement_(Pe,Re,Ae,ut);_e=le.label,$e[3]=_e;let he=$e[23];te=(le.anchorX-he)*this.pixelRatio,$e[4]=te;let me=$e[24];q=(le.anchorY-me)*this.pixelRatio,$e[5]=q,Et=_e.height,$e[6]=Et,po=_e.width,$e[13]=po}let Be;$e.length>25&&(Be=$e[25]);let Ji,jr,Li;$e.length>17?(Ji=$e[16],jr=$e[17],Li=$e[18]):(Ji=sa,jr=!1,Li=!1),Yi&&yt?Cn+=nt:!Yi&&!yt&&(Cn-=nt);let fo=0;for(;j<Z;j+=2){if(Be&&Be[fo++]<po/this.pixelRatio)continue;let le=this.calculateImageOrLabelDimensions_(_e.width,_e.height,S[j],S[j+1],po,Et,te,q,Xn,Tn,Cn,Fi,o,Ji,jr||Li,bt),he=[e,t,_e,le,ir,jr?pt:null,Li?Tt:null];if(b){let me,se,Se;if(Hn){let De=Z-j;if(!Hn[De]){Hn[De]={args:he,declutterMode:H};continue}let Ke=Hn[De];me=Ke.args,se=Ke.declutterMode,delete Hn[De],Se=qI(me)}let Ce,be;if(me&&(se!=="declutter"||!b.collides(Se))&&(Ce=!0),(H!=="declutter"||!b.collides(le.declutterBox))&&(be=!0),se==="declutter"&&H==="declutter"){let De=Ce&&be;Ce=De,be=De}Ce&&(se!=="none"&&b.insert(Se),this.replayImageOrLabel_.apply(this,me)),be&&(H!=="none"&&b.insert(le.declutterBox),this.replayImageOrLabel_.apply(this,he))}else this.replayImageOrLabel_.apply(this,he)}++M;break;case xt.DRAW_CHARS:let je=$e[1],Ct=$e[2],ft=$e[3],ci=$e[4];ut=$e[5];let dn=$e[6],wt=$e[7],fn=$e[8];Ae=$e[9];let mn=$e[10];Pe=$e[11],Re=$e[12];let Kn=[$e[13],$e[13]];H=$e[14]||"declutter";let Qi=this.textStates[Re],ie=Qi.font,N=[Qi.scale[0]*wt,Qi.scale[1]*wt],B;ie in this.widths_?B=this.widths_[ie]:(B={},this.widths_[ie]=B);let $=Ym(S,je,Ct,2),Q=Math.abs(N[0])*q0(ie,Pe,B);if(ci||Q<=$){let le=this.textStates[Re].textAlign,he=($-Q)*Sv(Pe,le),me=VI(S,je,Ct,2,Pe,he,dn,Math.abs(N[0]),q0,ie,B,yt?0:this.viewRotation_);e:if(me){let se=[],Se,Ce,be,De,Ke;if(Ae)for(Se=0,Ce=me.length;Se<Ce;++Se){Ke=me[Se],be=Ke[4],De=this.createLabel(be,Re,"",Ae),te=Ke[2]+(N[0]<0?-mn:mn),q=ft*De.height+(.5-ft)*2*mn*N[1]/N[0]-fn;let ot=this.calculateImageOrLabelDimensions_(De.width,De.height,Ke[0],Ke[1],De.width,De.height,te,q,0,0,Ke[3],Kn,!1,sa,!1,bt);if(b&&H==="declutter"&&b.collides(ot.declutterBox))break e;se.push([e,t,De,ot,1,null,null])}if(ut)for(Se=0,Ce=me.length;Se<Ce;++Se){Ke=me[Se],be=Ke[4],De=this.createLabel(be,Re,ut,""),te=Ke[2],q=ft*De.height-fn;let ot=this.calculateImageOrLabelDimensions_(De.width,De.height,Ke[0],Ke[1],De.width,De.height,te,q,0,0,Ke[3],Kn,!1,sa,!1,bt);if(b&&H==="declutter"&&b.collides(ot.declutterBox))break e;se.push([e,t,De,ot,1,null,null])}b&&H!=="none"&&b.load(se.map(qI));for(let ot=0,At=se.length;ot<At;++ot)this.replayImageOrLabel_.apply(this,se[ot])}}++M;break;case xt.END_GEOMETRY:if(m!==void 0){bt=$e[1];let le=m(bt,Pr,H);if(le)return le}++M;break;case xt.FILL:Rt?Ve++:this.fill_(e),++M;break;case xt.MOVE_TO_LINE_TO:for(j=$e[1],Z=$e[2],Bt=S[j],jt=S[j+1],e.moveTo(Bt,jt),ae=Bt+.5|0,pe=jt+.5|0,j+=2;j<Z;j+=2)Bt=S[j],jt=S[j+1],ve=Bt+.5|0,de=jt+.5|0,(j==Z-2||ve!==ae||de!==pe)&&(e.lineTo(Bt,jt),ae=ve,pe=de);++M;break;case xt.SET_FILL_STYLE:pt=$e,this.alignAndScaleFill_=$e[2],Ve&&(this.fill_(e),Ve=0,Ue&&(e.stroke(),Ue=0)),e.fillStyle=$e[1],++M;break;case xt.SET_STROKE_STYLE:Tt=$e,Ue&&(e.stroke(),Ue=0),this.setStrokeStyle_(e,$e),++M;break;case xt.STROKE:Rt?Ue++:e.stroke(),++M;break;default:++M;break}}Ve&&this.fill_(e),Ue&&e.stroke()}execute(e,t,a,l,o,m){this.viewRotation_=l,this.execute_(e,t,a,this.instructions,o,void 0,void 0,m)}executeHitDetection(e,t,a,l,o){return this.viewRotation_=a,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,l,o)}},WI=Av;var Yl=["Polygon","Circle","LineString","Image","Text","Default"],Pv=["Image","Text"],ZI=Yl.filter(s=>!Pv.includes(s)),Iv=class{constructor(e,t,a,l,o,m,g){this.maxExtent_=e,this.overlaps_=l,this.pixelRatio_=a,this.resolution_=t,this.renderBuffer_=m,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=wi(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(o,g)}clip(e,t){let a=this.getClipCoords(t);e.beginPath(),e.moveTo(a[0],a[1]),e.lineTo(a[2],a[3]),e.lineTo(a[4],a[5]),e.lineTo(a[6],a[7]),e.clip()}createExecutors_(e,t){for(let a in e){let l=this.executorsByZIndex_[a];l===void 0&&(l={},this.executorsByZIndex_[a]=l);let o=e[a];for(let m in o){let g=o[m];l[m]=new WI(this.resolution_,this.pixelRatio_,this.overlaps_,g,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let a=this.executorsByZIndex_[t];for(let l=0,o=e.length;l<o;++l)if(e[l]in a)return!0}return!1}forEachFeatureAtCoordinate(e,t,a,l,o,m){l=Math.round(l);let g=l*2+1,b=ln(this.hitDetectionTransform_,l+.5,l+.5,1/t,-1/t,-a,-e[0],-e[1]),A=!this.hitDetectionContext_;A&&(this.hitDetectionContext_=Xr(g,g,void 0,{willReadFrequently:!0}));let S=this.hitDetectionContext_;S.canvas.width!==g||S.canvas.height!==g?(S.canvas.width=g,S.canvas.height=g):A||S.clearRect(0,0,g,g);let M;this.renderBuffer_!==void 0&&(M=On(),Cx(M,e),Ln(M,t*(this.renderBuffer_+l),M));let k=xB(l),j;function Z(de,_e,Pe){let Re=S.getImageData(0,0,g,g).data;for(let Ae=0,ut=k.length;Ae<ut;Ae++)if(Re[k[Ae]]>0){if(!m||Pe==="none"||j!=="Image"&&j!=="Text"||m.includes(de)){let Ve=(k[Ae]-3)/4,Ue=l-Ve%g,pt=l-(Ve/g|0),Tt=o(de,_e,Ue*Ue+pt*pt);if(Tt)return Tt}S.clearRect(0,0,g,g);break}}let te=Object.keys(this.executorsByZIndex_).map(Number);te.sort(Bo);let q,H,ae,pe,ve;for(q=te.length-1;q>=0;--q){let de=te[q].toString();for(ae=this.executorsByZIndex_[de],H=Yl.length-1;H>=0;--H)if(j=Yl[H],pe=ae[j],pe!==void 0&&(ve=pe.executeHitDetection(S,b,a,Z,M),ve))return ve}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let a=t[0],l=t[1],o=t[2],m=t[3],g=[a,l,a,m,o,m,o,l];return zn(g,0,8,2,e,g),g}isEmpty(){return lo(this.executorsByZIndex_)}execute(e,t,a,l,o,m,g){let b=Object.keys(this.executorsByZIndex_).map(Number);b.sort(Bo),m=m||Yl;let A=Yl.length,S,M,k,j,Z;for(g&&b.reverse(),S=0,M=b.length;S<M;++S){let te=b[S].toString();for(Z=this.executorsByZIndex_[te],k=0,j=m.length;k<j;++k){let q=m[k],H=Z[q];if(H!==void 0){let ae=g===null?void 0:H.getZIndexContext(),pe=ae?ae.getContext():e,ve=this.maxExtent_&&q!=="Image"&&q!=="Text";if(ve&&(pe.save(),this.clip(pe,a)),!ae||q==="Text"||q==="Image"?H.execute(pe,t,a,l,o,g):ae.pushFunction(de=>H.execute(de,t,a,l,o,g)),ve&&pe.restore(),ae){ae.offset();let de=b[S]*A+k;this.deferredZIndexContexts_[de]||(this.deferredZIndexContexts_[de]=[]),this.deferredZIndexContexts_[de].push(ae)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Bo);for(let a=0,l=t.length;a<l;++a)e[t[a]].forEach(o=>{o.draw(this.renderedContext_),o.clear()}),e[t[a]].length=0}},Ev={};function xB(s){if(Ev[s]!==void 0)return Ev[s];let e=s*2+1,t=s*s,a=new Array(t+1);for(let o=0;o<=s;++o)for(let m=0;m<=s;++m){let g=o*o+m*m;if(g>t)break;let b=a[g];b||(b=[],a[g]=b),b.push(((s+o)*e+(s+m))*4+3),o>0&&b.push(((s-o)*e+(s+m))*4+3),m>0&&(b.push(((s+o)*e+(s-m))*4+3),o>0&&b.push(((s-o)*e+(s-m))*4+3))}let l=[];for(let o=0,m=a.length;o<m;++o)a[o]&&l.push(...a[o]);return Ev[s]=l,l}var XI=Iv;var Tv=class extends yg{constructor(e,t,a,l,o,m,g){super(),this.context_=e,this.pixelRatio_=t,this.extent_=a,this.transform_=l,this.transformRotation_=l?cE(Math.atan2(l[1],l[0]),10):0,this.viewRotation_=o,this.squaredTolerance_=m,this.userTransform_=g,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=wi()}drawImages_(e,t,a,l){if(!this.image_)return;let o=zn(e,t,a,l,this.transform_,this.pixelCoordinates_),m=this.context_,g=this.tmpLocalTransform_,b=m.globalAlpha;this.imageOpacity_!=1&&(m.globalAlpha=b*this.imageOpacity_);let A=this.imageRotation_;this.transformRotation_===0&&(A-=this.viewRotation_),this.imageRotateWithView_&&(A+=this.viewRotation_);for(let S=0,M=o.length;S<M;S+=2){let k=o[S]-this.imageAnchorX_,j=o[S+1]-this.imageAnchorY_;if(A!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let Z=k+this.imageAnchorX_,te=j+this.imageAnchorY_;ln(g,Z,te,1,1,A,-Z,-te),m.save(),m.transform.apply(m,g),m.translate(Z,te),m.scale(this.imageScale_[0],this.imageScale_[1]),m.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),m.restore()}else m.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,k,j,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(m.globalAlpha=b)}drawText_(e,t,a,l){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let o=zn(e,t,a,l,this.transform_,this.pixelCoordinates_),m=this.context_,g=this.textRotation_;for(this.transformRotation_===0&&(g-=this.viewRotation_),this.textRotateWithView_&&(g+=this.viewRotation_);t<a;t+=l){let b=o[t]+this.textOffsetX_,A=o[t+1]+this.textOffsetY_;g!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(m.save(),m.translate(b-this.textOffsetX_,A-this.textOffsetY_),m.rotate(g),m.translate(this.textOffsetX_,this.textOffsetY_),m.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&m.strokeText(this.text_,0,0),this.textFillState_&&m.fillText(this.text_,0,0),m.restore()):(this.textStrokeState_&&m.strokeText(this.text_,b,A),this.textFillState_&&m.fillText(this.text_,b,A))}}moveToLineTo_(e,t,a,l,o){let m=this.context_,g=zn(e,t,a,l,this.transform_,this.pixelCoordinates_);m.moveTo(g[0],g[1]);let b=g.length;o&&(b-=2);for(let A=2;A<b;A+=2)m.lineTo(g[A],g[A+1]);return o&&m.closePath(),a}drawRings_(e,t,a,l){for(let o=0,m=a.length;o<m;++o)t=this.moveToLineTo_(e,t,a[o],l,!0);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ei(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=AE(e,this.transform_,this.pixelCoordinates_),a=t[2]-t[0],l=t[3]-t[1],o=Math.sqrt(a*a+l*l),m=this.context_;m.beginPath(),m.arc(t[0],t[1],o,0,2*Math.PI),this.fillState_&&m.fill(),this.strokeState_&&m.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){let a=t.getGeometryFunction()(e);a&&(this.setStyle(t),this.drawGeometry(a))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let a=0,l=t.length;a<l;++a)this.drawGeometry(t[a])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),a=e.getStride();this.image_&&this.drawImages_(t,0,t.length,a),this.text_!==""&&this.drawText_(t,0,t.length,a)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),a=e.getStride();this.image_&&this.drawImages_(t,0,t.length,a),this.text_!==""&&this.drawText_(t,0,t.length,a)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ei(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,a=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(a,0,a.length,e.getStride(),!1),t.stroke()}if(this.text_!==""){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(ei(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let a=this.context_,l=e.getFlatCoordinates(),o=0,m=e.getEnds(),g=e.getStride();a.beginPath();for(let b=0,A=m.length;b<A;++b)o=this.moveToLineTo_(l,o,m[b],g,!1);a.stroke()}if(this.text_!==""){let a=e.getFlatMidpoints();this.drawText_(a,0,a.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ei(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride()),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ei(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,a=e.getOrientedFlatCoordinates(),l=0,o=e.getEndss(),m=e.getStride();t.beginPath();for(let g=0,b=o.length;g<b;++g){let A=o[g];l=this.drawRings_(a,l,A,m)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,a=this.contextFillState_;a?a.fillStyle!=e.fillStyle&&(a.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,a=this.contextStrokeState_;a?(a.lineCap!=e.lineCap&&(a.lineCap=e.lineCap,t.lineCap=e.lineCap),Fn(a.lineDash,e.lineDash)||t.setLineDash(a.lineDash=e.lineDash),a.lineDashOffset!=e.lineDashOffset&&(a.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),a.lineJoin!=e.lineJoin&&(a.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),a.lineWidth!=e.lineWidth&&(a.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),a.miterLimit!=e.miterLimit&&(a.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),a.strokeStyle!=e.strokeStyle&&(a.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,a=this.contextTextState_,l=e.textAlign?e.textAlign:Xa;a?(a.font!=e.font&&(a.font=e.font,t.font=e.font),a.textAlign!=l&&(a.textAlign=l,t.textAlign=l),a.textBaseline!=e.textBaseline&&(a.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=l,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:l,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let a=e.getColor();this.fillState_={fillStyle:jn(a||li)}}if(!t)this.strokeState_=null;else{let a=t.getColor(),l=t.getLineCap(),o=t.getLineDash(),m=t.getLineDashOffset(),g=t.getLineJoin(),b=t.getWidth(),A=t.getMiterLimit(),S=o||Un;this.strokeState_={lineCap:l!==void 0?l:ys,lineDash:this.pixelRatio_===1?S:S.map(M=>M*this.pixelRatio_),lineDashOffset:(m||Gn)*this.pixelRatio_,lineJoin:g!==void 0?g:_s,lineWidth:(b!==void 0?b:aa)*this.pixelRatio_,miterLimit:A!==void 0?A:na,strokeStyle:jn(a||oa)}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let a=e.getPixelRatio(this.pixelRatio_),l=e.getAnchor(),o=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=l[0]*a,this.imageAnchorY_=l[1]*a,this.imageHeight_=t[1]*a,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=o[0],this.imageOriginY_=o[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let m=e.getScaleArray();this.imageScale_=[m[0]*this.pixelRatio_/a,m[1]*this.pixelRatio_/a],this.imageWidth_=t[0]*a}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let j=t.getColor();this.textFillState_={fillStyle:jn(j||li)}}let a=e.getStroke();if(!a)this.textStrokeState_=null;else{let j=a.getColor(),Z=a.getLineCap(),te=a.getLineDash(),q=a.getLineDashOffset(),H=a.getLineJoin(),ae=a.getWidth(),pe=a.getMiterLimit();this.textStrokeState_={lineCap:Z!==void 0?Z:ys,lineDash:te||Un,lineDashOffset:q||Gn,lineJoin:H!==void 0?H:_s,lineWidth:ae!==void 0?ae:aa,miterLimit:pe!==void 0?pe:na,strokeStyle:jn(j||oa)}}let l=e.getFont(),o=e.getOffsetX(),m=e.getOffsetY(),g=e.getRotateWithView(),b=e.getRotation(),A=e.getScaleArray(),S=e.getText(),M=e.getTextAlign(),k=e.getTextBaseline();this.textState_={font:l!==void 0?l:ug,textAlign:M!==void 0?M:Xa,textBaseline:k!==void 0?k:Hl},this.text_=S!==void 0?Array.isArray(S)?S.reduce((j,Z,te)=>j+=te%2?" ":Z,""):S:"",this.textOffsetX_=o!==void 0?this.pixelRatio_*o:0,this.textOffsetY_=m!==void 0?this.pixelRatio_*m:0,this.textRotateWithView_=g!==void 0?g:!1,this.textRotation_=b!==void 0?b:0,this.textScale_=[this.pixelRatio_*A[0],this.pixelRatio_*A[1]]}}},HI=Tv;var Ko=.5;function KI(s,e,t,a,l,o,m,g,b){let A=b?ds(l,b):l,S=s[0]*Ko,M=s[1]*Ko,k=Xr(S,M);k.imageSmoothingEnabled=!1;let j=k.canvas,Z=new HI(k,Ko,l,null,m,g,b?Au(co(),b):null),te=t.length,q=Math.floor((256*256*256-1)/te),H={};for(let pe=1;pe<=te;++pe){let ve=t[pe-1],de=ve.getStyleFunction()||a;if(!de)continue;let _e=de(ve,o);if(!_e)continue;Array.isArray(_e)||(_e=[_e]);let Re=(pe*q).toString(16).padStart(7,"#00000");for(let Ae=0,ut=_e.length;Ae<ut;++Ae){let Ve=_e[Ae],Ue=Ve.getGeometryFunction()(ve);if(!Ue||!ei(A,Ue.getExtent()))continue;let pt=Ve.clone(),Tt=pt.getFill();Tt&&Tt.setColor(Re);let Qe=pt.getStroke();Qe&&(Qe.setColor(Re),Qe.setLineDash(null)),pt.setText(void 0);let nt=Ve.getImage();if(nt){let bt=nt.getImageSize();if(!bt)continue;let Bt=Xr(bt[0],bt[1],void 0,{alpha:!1}),jt=Bt.canvas;Bt.fillStyle=Re,Bt.fillRect(0,0,jt.width,jt.height),pt.setImage(new Dd({img:jt,anchor:nt.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:nt.getOrigin(),opacity:1,size:nt.getSize(),scale:nt.getScale(),rotation:nt.getRotation(),rotateWithView:nt.getRotateWithView()}))}let yt=pt.getZIndex()||0,dt=H[yt];dt||(dt={},H[yt]=dt,dt.Polygon=[],dt.Circle=[],dt.LineString=[],dt.Point=[]);let Rt=Ue.getType();if(Rt==="GeometryCollection"){let bt=Ue.getGeometriesArrayRecursive();for(let Bt=0,jt=bt.length;Bt<jt;++Bt){let Pr=bt[Bt];dt[Pr.getType().replace("Multi","")].push(Pr,pt)}}else dt[Rt.replace("Multi","")].push(Ue,pt)}}let ae=Object.keys(H).map(Number).sort(Bo);for(let pe=0,ve=ae.length;pe<ve;++pe){let de=H[ae[pe]];for(let _e in de){let Pe=de[_e];for(let Re=0,Ae=Pe.length;Re<Ae;Re+=2){Z.setStyle(Pe[Re+1]);for(let ut=0,Ve=e.length;ut<Ve;++ut)Z.setTransform(e[ut]),Z.drawGeometry(Pe[Re])}}}return k.getImageData(0,0,j.width,j.height)}function YI(s,e,t){let a=[];if(t){let l=Math.floor(Math.round(s[0])*Ko),o=Math.floor(Math.round(s[1])*Ko),m=(Br(l,0,t.width-1)+Br(o,0,t.height-1)*t.width)*4,g=t.data[m],b=t.data[m+1],S=t.data[m+2]+256*(b+256*g),M=Math.floor((256*256*256-1)/e.length);S&&S%M===0&&a.push(e[S/M-1])}return a}var vB=.5,JI={Point:PB,LineString:AB,Polygon:CB,MultiPoint:TB,MultiLineString:EB,MultiPolygon:IB,GeometryCollection:SB,Circle:bB};function QI(s,e){return parseInt(Ut(s),10)-parseInt(Ut(e),10)}function Cv(s,e){let t=Mv(s,e);return t*t}function Mv(s,e){return vB*s/e}function bB(s,e,t,a,l){let o=t.getFill(),m=t.getStroke();if(o||m){let b=s.getBuilder(t.getZIndex(),"Circle");b.setFillStrokeStyle(o,m),b.drawCircle(e,a,l)}let g=t.getText();if(g&&g.getText()){let b=s.getBuilder(t.getZIndex(),"Text");b.setTextStyle(g),b.drawText(e,a)}}function Rv(s,e,t,a,l,o,m,g){let b=[],A=t.getImage();if(A){let k=!0,j=A.getImageState();j==Mt.LOADED||j==Mt.ERROR?k=!1:j==Mt.IDLE&&A.load(),k&&b.push(A.ready())}let S=t.getFill();S&&S.loading()&&b.push(S.ready());let M=b.length>0;return M&&Promise.all(b).then(()=>l(null)),wB(s,e,t,a,o,m,g),M}function wB(s,e,t,a,l,o,m){let g=t.getGeometryFunction()(e);if(!g)return;let b=g.simplifyTransformed(a,l);if(t.getRenderer())e2(s,b,t,e,m);else{let S=JI[b.getType()];S(s,b,t,e,m,o)}}function e2(s,e,t,a,l){if(e.getType()=="GeometryCollection"){let m=e.getGeometries();for(let g=0,b=m.length;g<b;++g)e2(s,m[g],t,a,l);return}s.getBuilder(t.getZIndex(),"Default").drawCustom(e,a,t.getRenderer(),t.getHitDetectionRenderer(),l)}function SB(s,e,t,a,l,o){let m=e.getGeometriesArray(),g,b;for(g=0,b=m.length;g<b;++g){let A=JI[m[g].getType()];A(s,m[g],t,a,l,o)}}function AB(s,e,t,a,l){let o=t.getStroke();if(o){let g=s.getBuilder(t.getZIndex(),"LineString");g.setFillStrokeStyle(null,o),g.drawLineString(e,a,l)}let m=t.getText();if(m&&m.getText()){let g=s.getBuilder(t.getZIndex(),"Text");g.setTextStyle(m),g.drawText(e,a,l)}}function EB(s,e,t,a,l){let o=t.getStroke();if(o){let g=s.getBuilder(t.getZIndex(),"LineString");g.setFillStrokeStyle(null,o),g.drawMultiLineString(e,a,l)}let m=t.getText();if(m&&m.getText()){let g=s.getBuilder(t.getZIndex(),"Text");g.setTextStyle(m),g.drawText(e,a,l)}}function IB(s,e,t,a,l){let o=t.getFill(),m=t.getStroke();if(m||o){let b=s.getBuilder(t.getZIndex(),"Polygon");b.setFillStrokeStyle(o,m),b.drawMultiPolygon(e,a,l)}let g=t.getText();if(g&&g.getText()){let b=s.getBuilder(t.getZIndex(),"Text");b.setTextStyle(g),b.drawText(e,a,l)}}function PB(s,e,t,a,l,o){let m=t.getImage(),g=t.getText(),b=g&&g.getText(),A=o&&m&&b?{}:void 0;if(m){if(m.getImageState()!=Mt.LOADED)return;let S=s.getBuilder(t.getZIndex(),"Image");S.setImageStyle(m,A),S.drawPoint(e,a,l)}if(b){let S=s.getBuilder(t.getZIndex(),"Text");S.setTextStyle(g,A),S.drawText(e,a,l)}}function TB(s,e,t,a,l,o){let m=t.getImage(),g=m&&m.getOpacity()!==0,b=t.getText(),A=b&&b.getText(),S=o&&g&&A?{}:void 0;if(g){if(m.getImageState()!=Mt.LOADED)return;let M=s.getBuilder(t.getZIndex(),"Image");M.setImageStyle(m,S),M.drawMultiPoint(e,a,l)}if(A){let M=s.getBuilder(t.getZIndex(),"Text");M.setTextStyle(b,S),M.drawText(e,a,l)}}function CB(s,e,t,a,l){let o=t.getFill(),m=t.getStroke();if(o||m){let b=s.getBuilder(t.getZIndex(),"Polygon");b.setFillStrokeStyle(o,m),b.drawPolygon(e,a,l)}let g=t.getText();if(g&&g.getText()){let b=s.getBuilder(t.getZIndex(),"Text");b.setTextStyle(g),b.drawText(e,a,l)}}var kv=class extends xg{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=On(),this.wrappedRenderedExtent_=On(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,a){let l=t.extent,o=t.viewState,m=o.center,g=o.resolution,b=o.projection,A=o.rotation,S=b.getExtent(),M=this.getLayer().getSource(),k=this.getLayer().getDeclutter(),j=t.pixelRatio,Z=t.viewHints,te=!(Z[Bn.ANIMATING]||Z[Bn.INTERACTING]),q=this.context,H=Math.round(kr(l)/g*j),ae=Math.round(si(l)/g*j),pe=M.getWrapX()&&b.canWrapX(),ve=pe?kr(S):null,de=pe?Math.ceil((l[2]-S[2])/ve)+1:1,_e=pe?Math.floor((l[0]-S[0])/ve):0;do{let Pe=this.getRenderTransform(m,g,0,j,H,ae,_e*ve);t.declutter&&(Pe=Pe.slice(0)),e.execute(q,[q.canvas.width,q.canvas.height],Pe,A,te,a===void 0?Yl:a?Pv:ZI,a?k&&t.declutter[k]:void 0)}while(++_e<de)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Xr(this.context.canvas.width,this.context.canvas.height,wv))}resetDrawContext_(){if(this.opacity_!==1){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,JE(this.context),wv.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(e,t){let a=e.layerStatesArray[e.layerIndex];this.opacity_=a.opacity;let l=e.viewState;this.prepareContainer(e,t);let o=this.context,m=this.replayGroup_,g=m&&!m.isEmpty();if(!g&&!(this.getLayer().hasListener(ms.PRERENDER)||this.getLayer().hasListener(ms.POSTRENDER)))return null;this.setDrawContext_(),this.preRender(o,e);let b=l.projection;if(this.clipped_=!1,g&&a.extent&&this.clipping){let A=fs(a.extent,b);g=ei(A,e.extent),this.clipped_=g&&!Qs(A,e.extent),this.clipped_&&this.clipUnrotated(o,e,A)}return g&&this.renderWorlds(m,e,this.getLayer().getDeclutter()?!1:void 0),!e.declutter&&this.clipped_&&o.restore(),this.postRender(o,e),this.renderedRotation_!==l.rotation&&(this.renderedRotation_=l.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let a=this.frameState.size.slice(),l=this.renderedCenter_,o=this.renderedResolution_,m=this.renderedRotation_,g=this.renderedProjection_,b=this.wrappedRenderedExtent_,A=this.getLayer(),S=[],M=a[0]*Ko,k=a[1]*Ko;S.push(this.getRenderTransform(l,o,m,Ko,M,k,0).slice());let j=A.getSource(),Z=g.getExtent();if(j.getWrapX()&&g.canWrapX()&&!Qs(Z,b)){let q=b[0],H=kr(Z),ae=0,pe;for(;q<Z[0];)--ae,pe=H*ae,S.push(this.getRenderTransform(l,o,m,Ko,M,k,pe).slice()),q+=H;for(ae=0,q=b[2];q>Z[2];)++ae,pe=H*ae,S.push(this.getRenderTransform(l,o,m,Ko,M,k,pe).slice()),q-=H}let te=co();this.hitDetectionImageData_=KI(a,S,this.renderedFeatures_,A.getStyleFunction(),b,o,m,Cv(o,this.renderedPixelRatio_),te?g:null)}t(YI(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,a,l,o){if(!this.replayGroup_)return;let m=t.viewState.resolution,g=t.viewState.rotation,b=this.getLayer(),A={},S=function(Z,te,q){let H=Ut(Z),ae=A[H];if(ae){if(ae!==!0&&q<ae.distanceSq){if(q===0)return A[H]=!0,o.splice(o.lastIndexOf(ae),1),l(Z,b,te);ae.geometry=te,ae.distanceSq=q}}else{if(q===0)return A[H]=!0,l(Z,b,te);o.push(A[H]={feature:Z,layer:b,geometry:te,distanceSq:q,callback:l})}},M,k=[this.replayGroup_],j=this.getLayer().getDeclutter();return k.some(Z=>M=Z.forEachFeatureAtCoordinate(e,m,g,a,S,j&&t.declutter[j]?t.declutter[j].all().map(te=>te.value):null)),M}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),a=t.getSource();if(!a)return!1;let l=e.viewHints[Bn.ANIMATING],o=e.viewHints[Bn.INTERACTING],m=t.getUpdateWhileAnimating(),g=t.getUpdateWhileInteracting();if(this.ready&&!m&&l||!g&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let b=e.extent,A=e.viewState,S=A.projection,M=A.resolution,k=e.pixelRatio,j=t.getRevision(),Z=t.getRenderBuffer(),te=t.getRenderOrder();te===void 0&&(te=QI);let q=A.center.slice(),H=Ln(b,Z*M),ae=H.slice(),pe=[H.slice()],ve=S.getExtent();if(a.getWrapX()&&S.canWrapX()&&!Qs(ve,e.extent)){let Qe=kr(ve),nt=Math.max(kr(H)/2,Qe);H[0]=ve[0]-nt,H[2]=ve[2]+nt,dE(q,S);let yt=Dx(pe[0],S);yt[0]<ve[0]&&yt[2]<ve[2]?pe.push([yt[0]+Qe,yt[1],yt[2]+Qe,yt[3]]):yt[0]>ve[0]&&yt[2]>ve[2]&&pe.push([yt[0]-Qe,yt[1],yt[2]-Qe,yt[3]])}if(this.ready&&this.renderedResolution_==M&&this.renderedRevision_==j&&this.renderedRenderOrder_==te&&this.renderedFrameDeclutter_===!!e.declutter&&Qs(this.wrappedRenderedExtent_,H))return Fn(this.renderedExtent_,ae)||(this.hitDetectionImageData_=null,this.renderedExtent_=ae),this.renderedCenter_=q,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let de=new UI(Mv(M,k),H,M,k),_e=co(),Pe;if(_e){for(let Qe=0,nt=pe.length;Qe<nt;++Qe){let yt=pe[Qe],dt=ds(yt,S);a.loadFeatures(dt,xE(M,S),_e)}Pe=Au(_e,S)}else for(let Qe=0,nt=pe.length;Qe<nt;++Qe)a.loadFeatures(pe[Qe],M,S);let Re=Cv(M,k),Ae=!0,ut=(Qe,nt)=>{let yt,dt=Qe.getStyleFunction()||t.getStyleFunction();if(dt&&(yt=dt(Qe,M)),yt){let Rt=this.renderFeature(Qe,Re,yt,de,Pe,this.getLayer().getDeclutter(),nt);Ae=Ae&&!Rt}},Ve=ds(H,S),Ue=a.getFeaturesInExtent(Ve);te&&Ue.sort(te);for(let Qe=0,nt=Ue.length;Qe<nt;++Qe)ut(Ue[Qe],Qe);this.renderedFeatures_=Ue,this.ready=Ae;let pt=de.finish(),Tt=new XI(H,M,k,a.getOverlaps(),pt,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=M,this.renderedRevision_=j,this.renderedRenderOrder_=te,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=ae,this.wrappedRenderedExtent_=H,this.renderedCenter_=q,this.renderedProjection_=S,this.renderedPixelRatio_=k,this.replayGroup_=Tt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,a,l,o,m,g){if(!a)return!1;let b=!1;if(Array.isArray(a))for(let A=0,S=a.length;A<S;++A)b=Rv(l,e,a[A],t,this.boundHandleStyleImageChange_,o,m,g)||b;else b=Rv(l,e,a,t,this.boundHandleStyleImageChange_,o,m,g);return b}},t2=kv;var Fv=class extends DI{constructor(e){super(e)}createRenderer(){return new t2(this)}},Jl=Fv;var r2=ao(J0(),1);var Lv=class{constructor(e){this.rbush_=new r2.default(e),this.items_={}}insert(e,t){let a={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(a),this.items_[Ut(t)]=a}load(e,t){let a=new Array(t.length);for(let l=0,o=t.length;l<o;l++){let m=e[l],g=t[l],b={minX:m[0],minY:m[1],maxX:m[2],maxY:m[3],value:g};a[l]=b,this.items_[Ut(g)]=b}this.rbush_.load(a)}remove(e){let t=Ut(e),a=this.items_[t];return delete this.items_[t],this.rbush_.remove(a)!==null}update(e,t){let a=this.items_[Ut(t)],l=[a.minX,a.minY,a.maxX,a.maxY];jm(l,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(l){return l.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let a;for(let l=0,o=e.length;l<o;l++)if(a=t(e[l]),a)return a;return a}isEmpty(){return lo(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return ea(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},Wd=Lv;var i2=wi(),Zd=class s{constructor(e,t,a,l,o,m){this.styleFunction,this.extent_,this.id_=m,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=a||null,this.properties_=o,this.squaredTolerance_,this.stride_=l,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Ba(this.flatCoordinates_):vu(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=bo(this.getExtent());this.flatInteriorPoints_=Sd(this.flatCoordinates_,0,this.ends_,2,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=zE(this.flatCoordinates_,this.ends_),t=eg(this.flatCoordinates_,0,e,2);this.flatInteriorPoints_=Jm(this.flatCoordinates_,0,e,2,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Zl(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,a=this.ends_;for(let l=0,o=a.length;l<o;++l){let m=a[l],g=Zl(e,t,m,2,.5);ji(this.flatMidpoints_,g),t=m}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=Zr(e);let t=e.getExtent(),a=e.getWorldExtent();if(t&&a){let l=si(a)/si(t);ln(i2,a[0],a[3],l,-l,0,0,0),zn(this.flatCoordinates_,0,this.flatCoordinates_.length,2,i2,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new s(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Dm((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);let a=this.simplifiedGeometry_.getFlatCoordinates(),l;switch(this.type_){case"LineString":a.length=Wl(a,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,a,0),l=[a.length];break;case"MultiLineString":l=[],a.length=Xm(a,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,a,0,l);break;case"Polygon":l=[],a.length=_d(a,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),a,0,l);break;default:}return l&&(this.simplifiedGeometry_=new s(this.type_,a,l,2,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}};Zd.prototype.getFlatCoordinates=Zd.prototype.getOrientedFlatCoordinates;var Eo=Zd;var Dv=class extends Si{constructor(e){super(),this.projection=Zr(e.projection),this.attributions_=n2(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible!==void 0?e.attributionsCollapsible:!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(a,l){t.viewResolver=a,t.viewRejector=l})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=n2(e),this.changed()}setState(e){this.state_=e,this.changed()}};function n2(s){return s?Array.isArray(s)?function(e){return s}:typeof s=="function"?s:function(e){return[s]}:null}var pa=Dv;var hn={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function o2(s,e){return[[-1/0,-1/0,1/0,1/0]]}var MB=!1;function RB(s,e,t,a,l,o,m){let g=new XMLHttpRequest;g.open("GET",typeof s=="function"?s(t,a,l):s,!0),e.getType()=="arraybuffer"&&(g.responseType="arraybuffer"),g.withCredentials=MB,g.onload=function(b){if(!g.status||g.status>=200&&g.status<300){let A=e.getType();try{let S;A=="text"||A=="json"?S=g.responseText:A=="xml"?S=g.responseXML||g.responseText:A=="arraybuffer"&&(S=g.response),S?o(e.readFeatures(S,{extent:t,featureProjection:l}),e.readProjection(S)):m()}catch{m()}}else m()},g.onerror=m,g.send()}function Ov(s,e){return function(t,a,l,o,m){let g=this;RB(s,e,t,a,l,function(b,A){g.addFeatures(b),o!==void 0&&o(b)},m||No)}}var ws=class extends zr{constructor(e,t,a){super(e),this.feature=t,this.features=a}},zv=class extends pa{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=No,this.format_=e.format,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(Ar(this.format_,"`format` must be set when `url` is set"),this.loader_=Ov(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:o2;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new Wd:null,this.loadedExtentsRtree_=new Wd,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let a,l;Array.isArray(e.features)?l=e.features:e.features&&(a=e.features,l=a.getArray()),!t&&a===void 0&&(a=new Rd(l)),l!==void 0&&this.addFeaturesInternal(l),a!==void 0&&this.bindFeaturesCollection_(a)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Ut(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let a=e.getGeometry();if(a){let l=a.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(l,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new ws(hn.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof Eo||(this.featureChangeKeys_[e]=[Ui(t,Ir.CHANGE,this.handleFeatureChange_,this),Ui(t,km.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let a=!0;if(t.getId()!==void 0){let l=String(t.getId());if(!(l in this.idIndex_))this.idIndex_[l]=t;else if(t instanceof Eo){let o=this.idIndex_[l];o instanceof Eo?Array.isArray(o)?o.push(t):this.idIndex_[l]=[o,t]:a=!1}else a=!1}return a&&(Ar(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),a}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],a=[],l=[];for(let o=0,m=e.length;o<m;o++){let g=e[o],b=Ut(g);this.addToIndex_(b,g)&&a.push(g)}for(let o=0,m=a.length;o<m;o++){let g=a[o],b=Ut(g);this.setupChangeEvents_(b,g);let A=g.getGeometry();if(A){let S=A.getExtent();t.push(S),l.push(g)}else this.nullGeometryFeatures_[b]=g}if(this.featuresRtree_&&this.featuresRtree_.load(t,l),this.hasListener(hn.ADDFEATURE))for(let o=0,m=a.length;o<m;o++)this.dispatchEvent(new ws(hn.ADDFEATURE,a[o]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(hn.ADDFEATURE,function(a){t||(t=!0,e.push(a.feature),t=!1)}),this.addEventListener(hn.REMOVEFEATURE,function(a){t||(t=!0,e.remove(a.feature),t=!1)}),e.addEventListener($o.ADD,a=>{t||(t=!0,this.addFeature(a.element),t=!1)}),e.addEventListener($o.REMOVE,a=>{t||(t=!0,this.removeFeature(a.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let a in this.featureChangeKeys_)this.featureChangeKeys_[a].forEach(cn);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){let a=l=>{this.removeFeatureInternal(l)};this.featuresRtree_.forEach(a);for(let l in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[l])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new ws(hn.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let a=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(a,function(l){let o=l.getGeometry();if(o instanceof Eo||o.intersectsCoordinate(e))return t(l)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(a){let l=a.getGeometry();if(l instanceof Eo||l.intersectsExtent(e)){let o=t(a);if(o)return o}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),lo(this.nullGeometryFeatures_)||ji(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(a){t.push(a)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let l=QA(e,t);return[].concat(...l.map(o=>this.featuresRtree_.getInExtent(o)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let a=e[0],l=e[1],o=null,m=[NaN,NaN],g=1/0,b=[-1/0,-1/0,1/0,1/0];return t=t||Lm,this.featuresRtree_.forEachInExtent(b,function(A){if(t(A)){let S=A.getGeometry(),M=g;if(g=S instanceof Eo?0:S.closestPointXY(a,l,m,g),g<M){o=A;let k=Math.sqrt(g);b[0]=a-k,b[1]=l-k,b[2]=a+k,b[3]=l+k}}}),o}getExtent(e){return this.featuresRtree_.getExtent(e)}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,a=Ut(t),l=t.getGeometry();if(!l)a in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[a]=t);else{let m=l.getExtent();a in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[a],this.featuresRtree_&&this.featuresRtree_.insert(m,t)):this.featuresRtree_&&this.featuresRtree_.update(m,t)}let o=t.getId();if(o!==void 0){let m=o.toString();this.idIndex_[m]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[m]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[a]=t;this.changed(),this.dispatchEvent(new ws(hn.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();return t!==void 0?t in this.idIndex_:Ut(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&lo(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,a){let l=this.loadedExtentsRtree_,o=this.strategy_(e,t,a);for(let m=0,g=o.length;m<g;++m){let b=o[m];l.forEachInExtent(b,function(S){return Qs(S.extent,b)})||(++this.loadingExtentsCount_,this.dispatchEvent(new ws(hn.FEATURESLOADSTART)),this.loader_.call(this,b,t,a,S=>{--this.loadingExtentsCount_,this.dispatchEvent(new ws(hn.FEATURESLOADEND,void 0,S))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ws(hn.FEATURESLOADERROR))}),l.insert(b,{extent:b.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,a;t.forEachInExtent(e,function(l){if(jm(l.extent,e))return a=l,!0}),a&&t.remove(a)}removeFeatures(e){let t=[];for(let a=0,l=e.length;a<l;++a){let o=e[a],m=this.removeFeatureInternal(o);m&&t.push(m)}t.length>0&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Ut(e);if(!(t in this.uidIndex_))return;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(cn),delete this.featureChangeKeys_[t];let l=e.getId();if(l!==void 0){let o=l.toString(),m=this.idIndex_[o];m===e?delete this.idIndex_[o]:Array.isArray(m)&&(m.splice(m.indexOf(e),1),m.length===1&&(this.idIndex_[o]=m[0]))}return delete this.uidIndex_[t],this.hasListener(hn.REMOVEFEATURE)&&this.dispatchEvent(new ws(hn.REMOVEFEATURE,e)),e}removeFromIdIndex_(e){let t=!1;for(let a in this.idIndex_){let l=this.idIndex_[a];if(e instanceof Eo&&Array.isArray(l)&&l.includes(e))l.splice(l.indexOf(e),1);else if(this.idIndex_[a]===e){delete this.idIndex_[a],t=!0;break}}return t}setLoader(e){this.loader_=e}setUrl(e){Ar(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(Ov(e,this.format_))}},Ql=zv;var uo={SINGLECLICK:"singleclick",CLICK:Ir.CLICK,DBLCLICK:Ir.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Bv={ACTIVE:"active"};var Nv=class extends Si{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Bv.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(Bv.ACTIVE,e)}setMap(e){this.map_=e}};var s2=Nv;var jv=class extends s2{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==uo.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==uo.POINTERUP){let a=this.handleUpEvent(e);this.handlingDownUpSequence=a&&this.targetPointers.length>0}}else if(e.type==uo.POINTERDOWN){let a=this.handleDownEvent(e);this.handlingDownUpSequence=a,t=this.stopDown(a)}else e.type==uo.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};var a2=jv;var l2=function(s){let e=s.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var c2=Lm,u2=function(s){return s.type==uo.CLICK};var h2=function(s){return s.type==uo.SINGLECLICK};var p2=function(s){let e=s.originalEvent;return Ar(e!==void 0,"mapBrowserEvent must originate from a pointer event"),e.isPrimary&&e.button===0};var Uv=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Ao,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let a=t.dataProjection?Zr(t.dataProjection):this.readProjection(e);t.extent&&a&&a.getUnits()==="tile-pixels"&&(a=Zr(a),a.setWorldExtent(t.extent)),t={dataProjection:a,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return Pt()}readFeature(e,t){return Pt()}readFeatures(e,t){return Pt()}readGeometry(e,t){return Pt()}readProjection(e){return Pt()}writeFeature(e,t){return Pt()}writeFeatures(e,t){return Pt()}writeGeometry(e,t){return Pt()}},d2=Uv;function vg(s,e,t){let a=t?Zr(t.featureProjection):null,l=t?Zr(t.dataProjection):null,o=s;if(a&&l&&!_E(a,l)){e&&(o=s.clone());let m=e?a:l,g=e?l:a;m.getUnits()==="tile-pixels"?o.transform(m,g):o.applyTransform(Vl(m,g))}if(e&&t&&t.decimals!==void 0){let m=Math.pow(10,t.decimals),g=function(b){for(let A=0,S=b.length;A<S;++A)b[A]=Math.round(b[A]*m)/m;return b};o===s&&(o=s.clone()),o.applyTransform(g)}return o}var kB={Point:Ei,LineString:Go,Polygon:Iu,MultiPoint:wd,MultiLineString:i0,MultiPolygon:u0};function FB(s,e,t){return Array.isArray(e[0])?(Qm(s,0,e,t)||(s=s.slice(),Ed(s,0,e,t)),s):(Ad(s,0,e,t)||(s=s.slice(),Eu(s,0,e,t)),s)}function Gv(s,e){let t=s.geometry;if(!t)return[];if(Array.isArray(t))return t.map(o=>Gv({...s,geometry:o})).flat();let a=t.type==="MultiPolygon"?"Polygon":t.type;if(a==="GeometryCollection"||a==="Circle")throw new Error("Unsupported geometry type: "+a);let l=t.layout.length;return vg(new Eo(a,a==="Polygon"?FB(t.flatCoordinates,t.ends,l):t.flatCoordinates,t.ends?.flat(),l,s.properties||{},s.id).enableSimplifyTransformed(),!1,e)}function bg(s,e){if(!s)return null;if(Array.isArray(s)){let a=s.map(l=>bg(l,e));return new Hx(a)}let t=kB[s.type];return vg(new t(s.flatCoordinates,s.layout,s.ends),!1,e)}var Vv=class extends d2{constructor(){super()}getType(){return"json"}readFeature(e,t){return this.readFeatureFromObject(wg(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(wg(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return Pt()}readFeaturesFromObject(e,t){return Pt()}readGeometry(e,t){return this.readGeometryFromObject(wg(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return Pt()}readProjection(e){return this.readProjectionFromObject(wg(e))}readProjectionFromObject(e){return Pt()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return Pt()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return Pt()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return Pt()}};function wg(s){if(typeof s=="string"){let e=JSON.parse(s);return e||null}return s!==null?s:null}var f2=Vv;var qv=class extends f2{constructor(e){e=e||{},super(),this.dataProjection=Zr(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=Zr(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,t){let a=null;e.type==="Feature"?a=e:a={type:"Feature",geometry:e,properties:null};let l=Wv(a.geometry,t);if(this.featureClass===Eo)return Gv({geometry:l,id:a.id,properties:a.properties},t);let o=new Ao;return this.geometryName_?o.setGeometryName(this.geometryName_):this.extractGeometryName_&&a.geometry_name&&o.setGeometryName(a.geometry_name),o.setGeometry(bg(l,t)),"id"in a&&o.setId(a.id),a.properties&&o.setProperties(a.properties,!0),o}readFeaturesFromObject(e,t){let a=e,l=null;if(a.type==="FeatureCollection"){let o=e;l=[];let m=o.features;for(let g=0,b=m.length;g<b;++g){let A=this.readFeatureFromObject(m[g],t);A&&l.push(A)}}else l=[this.readFeatureFromObject(e,t)];return l.flat()}readGeometryFromObject(e,t){return LB(e,t)}readProjectionFromObject(e){let t=e.crs,a;if(t)if(t.type=="name")a=Zr(t.properties.name);else if(t.type==="EPSG")a=Zr("EPSG:"+t.properties.code);else throw new Error("Unknown SRS type");else a=this.dataProjection;return a}writeFeatureObject(e,t){t=this.adaptOptions(t);let a={type:"Feature",geometry:null,properties:null},l=e.getId();if(l!==void 0&&(a.id=l),!e.hasProperties())return a;let o=e.getProperties(),m=e.getGeometry();return m&&(a.geometry=$v(m,t),delete o[e.getGeometryName()]),lo(o)||(a.properties=o),a}writeFeaturesObject(e,t){t=this.adaptOptions(t);let a=[];for(let l=0,o=e.length;l<o;++l)a.push(this.writeFeatureObject(e[l],t));return{type:"FeatureCollection",features:a}}writeGeometryObject(e,t){return $v(e,this.adaptOptions(t))}};function Wv(s,e){if(!s)return null;let t;switch(s.type){case"Point":{t=OB(s);break}case"LineString":{t=zB(s);break}case"Polygon":{t=UB(s);break}case"MultiPoint":{t=NB(s);break}case"MultiLineString":{t=BB(s);break}case"MultiPolygon":{t=jB(s);break}case"GeometryCollection":{t=DB(s);break}default:throw new Error("Unsupported GeoJSON type: "+s.type)}return t}function LB(s,e){let t=Wv(s,e);return bg(t,e)}function DB(s,e){return s.geometries.map(function(a){return Wv(a,e)})}function OB(s){let e=s.coordinates;return{type:"Point",flatCoordinates:e,layout:ja(e.length)}}function zB(s){let e=s.coordinates,t=e.flat();return{type:"LineString",flatCoordinates:t,ends:[t.length],layout:ja(e[0]?.length||2)}}function BB(s){let e=s.coordinates,t=e[0]?.[0]?.length||2,a=[],l=Ua(a,0,e,t);return{type:"MultiLineString",flatCoordinates:a,ends:l,layout:ja(t)}}function NB(s){let e=s.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:ja(e[0]?.length||2)}}function jB(s){let e=s.coordinates,t=[],a=e[0]?.[0]?.[0].length||2,l=Zm(t,0,e,a);return{type:"MultiPolygon",flatCoordinates:t,ends:l,layout:ja(a)}}function UB(s){let e=s.coordinates,t=[],a=e[0]?.[0]?.length,l=Ua(t,0,e,a);return{type:"Polygon",flatCoordinates:t,ends:l,layout:ja(a)}}function $v(s,e){s=vg(s,!0,e);let t=s.getType(),a;switch(t){case"Point":{a=ZB(s,e);break}case"LineString":{a=VB(s,e);break}case"Polygon":{a=XB(s,e);break}case"MultiPoint":{a=$B(s,e);break}case"MultiLineString":{a=qB(s,e);break}case"MultiPolygon":{a=WB(s,e);break}case"GeometryCollection":{a=GB(s,e);break}case"Circle":{a={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+t)}return a}function GB(s,e){return e=Object.assign({},e),delete e.featureProjection,{type:"GeometryCollection",geometries:s.getGeometriesArray().map(function(a){return $v(a,e)})}}function VB(s,e){return{type:"LineString",coordinates:s.getCoordinates()}}function qB(s,e){return{type:"MultiLineString",coordinates:s.getCoordinates()}}function $B(s,e){return{type:"MultiPoint",coordinates:s.getCoordinates()}}function WB(s,e){let t;return e&&(t=e.rightHanded),{type:"MultiPolygon",coordinates:s.getCoordinates(t)}}function ZB(s,e){return{type:"Point",coordinates:s.getCoordinates()}}function XB(s,e){let t;return e&&(t=e.rightHanded),{type:"Polygon",coordinates:s.getCoordinates(t)}}var Ii=qv;var m2=0,Xd=1,g2=[0,0,0,0],Bu=[],Zv={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},Hd=class extends zr{constructor(e,t,a){super(e),this.features=t,this.mapBrowserEvent=a}},Xv=class extends a2{constructor(e){super(e),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=e.condition?e.condition:p2,this.defaultDeleteCondition_=function(a){return l2(a)&&h2(a)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:c2,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new Wd,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new Jl({source:new Ql({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:KB(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let t;if(e.features?t=e.features:e.source&&(this.source_=e.source,t=new Rd(this.source_.getFeatures()),this.source_.addEventListener(hn.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(hn.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!t)throw new Error("The modify interaction requires features, a source or a layer");e.hitDetection&&(this.hitDetection_=e.hitDetection),this.features_=t,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener($o.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener($o.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=e.snapToPointer===void 0?!this.hitDetection_:e.snapToPointer}addFeature_(e){let t=e.getGeometry();if(t){let l=this.SEGMENT_WRITERS_[t.getType()];l&&l(e,t)}let a=this.getMap();a&&a.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,a),e.addEventListener(Ir.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Rd;let a=this.featuresBeingModified_.getArray();for(let l=0,o=t.length;l<o;++l){let m=t[l];for(let g=0,b=m.length;g<b;++g){let A=m[g].feature;A&&!a.includes(A)&&this.featuresBeingModified_.push(A)}}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new Hd(Zv.MODIFYSTART,this.featuresBeingModified_,e))}}removeFeature_(e){this.removeFeatureSegmentData_(e),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.removeEventListener(Ir.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(e){let t=this.rBush_,a=[];t.forEach(function(l){e===l.feature&&a.push(l)});for(let l=a.length-1;l>=0;--l){let o=a[l];for(let m=this.dragSegments_.length-1;m>=0;--m)this.dragSegments_[m][0]===o&&this.dragSegments_.splice(m,1);t.remove(o)}}setActive(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(e)}setMap(e){this.overlay_.setMap(e),super.setMap(e)}getOverlay(){return this.overlay_}handleSourceAdd_(e){e.feature&&this.features_.push(e.feature)}handleSourceRemove_(e){e.feature&&this.features_.remove(e.feature)}handleFeatureAdd_(e){this.addFeature_(e.element)}handleFeatureChange_(e){if(!this.changingFeature_){let t=e.target;this.removeFeature_(t),this.addFeature_(t)}}handleFeatureRemove_(e){this.removeFeature_(e.element)}writePointGeometry_(e,t){let a=t.getCoordinates(),l={feature:e,geometry:t,segment:[a,a]};this.rBush_.insert(t.getExtent(),l)}writeMultiPointGeometry_(e,t){let a=t.getCoordinates();for(let l=0,o=a.length;l<o;++l){let m=a[l],g={feature:e,geometry:t,depth:[l],index:l,segment:[m,m]};this.rBush_.insert(t.getExtent(),g)}}writeLineStringGeometry_(e,t){let a=t.getCoordinates();for(let l=0,o=a.length-1;l<o;++l){let m=a.slice(l,l+2),g={feature:e,geometry:t,index:l,segment:m};this.rBush_.insert(ps(m),g)}}writeMultiLineStringGeometry_(e,t){let a=t.getCoordinates();for(let l=0,o=a.length;l<o;++l){let m=a[l];for(let g=0,b=m.length-1;g<b;++g){let A=m.slice(g,g+2),S={feature:e,geometry:t,depth:[l],index:g,segment:A};this.rBush_.insert(ps(A),S)}}}writePolygonGeometry_(e,t){let a=t.getCoordinates();for(let l=0,o=a.length;l<o;++l){let m=a[l];for(let g=0,b=m.length-1;g<b;++g){let A=m.slice(g,g+2),S={feature:e,geometry:t,depth:[l],index:g,segment:A};this.rBush_.insert(ps(A),S)}}}writeMultiPolygonGeometry_(e,t){let a=t.getCoordinates();for(let l=0,o=a.length;l<o;++l){let m=a[l];for(let g=0,b=m.length;g<b;++g){let A=m[g];for(let S=0,M=A.length-1;S<M;++S){let k=A.slice(S,S+2),j={feature:e,geometry:t,depth:[g,l],index:S,segment:k};this.rBush_.insert(ps(k),j)}}}}writeCircleGeometry_(e,t){let a=t.getCenter(),l={feature:e,geometry:t,index:m2,segment:[a,a]},o={feature:e,geometry:t,index:Xd,segment:[a,a]},m=[l,o];l.featureSegments=m,o.featureSegments=m,this.rBush_.insert(Ba(a),l);let g=t,b=co();if(b&&this.getMap()){let A=this.getMap().getView().getProjection();g=g.clone().transform(b,A),g=l0(g).transform(A,b)}this.rBush_.insert(g.getExtent(),o)}writeGeometryCollectionGeometry_(e,t){let a=t.getGeometriesArray();for(let l=0;l<a.length;++l){let o=a[l],m=this.SEGMENT_WRITERS_[o.getType()];m(e,o)}}createOrUpdateVertexFeature_(e,t,a){let l=this.vertexFeature_;return l?l.getGeometry().setCoordinates(e):(l=new Ao(new Ei(e)),this.vertexFeature_=l,this.overlay_.getSource().addFeature(l)),l.set("features",t),l.set("geometries",a),l}handleEvent(e){if(!e.originalEvent)return!0;this.lastPointerEvent_=e;let t;return!e.map.getView().getInteracting()&&e.type==uo.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(e),this.vertexFeature_&&this.deleteCondition_(e)&&(e.type!=uo.SINGLECLICK||!this.ignoreNextSingleClick_?t=this.removePoint():t=!0),e.type==uo.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(e)&&!t}handleDragEvent(e){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(e,this.dragSegments_);let t=[e.coordinate[0]+this.delta_[0],e.coordinate[1]+this.delta_[1]],a=[],l=[];for(let o=0,m=this.dragSegments_.length;o<m;++o){let g=this.dragSegments_[o],b=g[0],A=b.feature;a.includes(A)||a.push(A);let S=b.geometry;l.includes(S)||l.push(S);let M=b.depth,k,j=b.segment,Z=g[1];for(;t.length<S.getStride();)t.push(j[Z][t.length]);switch(S.getType()){case"Point":k=t,j[0]=t,j[1]=t;break;case"MultiPoint":k=S.getCoordinates(),k[b.index]=t,j[0]=t,j[1]=t;break;case"LineString":k=S.getCoordinates(),k[b.index+Z]=t,j[Z]=t;break;case"MultiLineString":k=S.getCoordinates(),k[M[0]][b.index+Z]=t,j[Z]=t;break;case"Polygon":k=S.getCoordinates(),k[M[0]][b.index+Z]=t,j[Z]=t;break;case"MultiPolygon":k=S.getCoordinates(),k[M[1]][M[0]][b.index+Z]=t,j[Z]=t;break;case"Circle":if(j[0]=t,j[1]=t,b.index===m2)this.changingFeature_=!0,S.setCenter(t),this.changingFeature_=!1;else{this.changingFeature_=!0;let te=e.map.getView().getProjection(),q=Ux(ti(S.getCenter(),te),ti(t,te)),H=co();if(H){let ae=S.clone().transform(H,te);ae.setRadius(q),q=ae.transform(te,H).getRadius()}S.setRadius(q),this.changingFeature_=!1}break;default:}k&&this.setGeometryCoordinates_(S,k)}this.createOrUpdateVertexFeature_(t,a,l)}handleDownEvent(e){if(!this.condition_(e))return!1;let t=e.coordinate;this.handlePointerAtPixel_(e.pixel,e.map,t),this.dragSegments_.length=0,this.featuresBeingModified_=null;let a=this.vertexFeature_;if(a){let l=e.map.getView().getProjection(),o=[],m=a.getGeometry().getCoordinates(),g=ps([m]),b=this.rBush_.getInExtent(g),A={};b.sort(HB);for(let S=0,M=b.length;S<M;++S){let k=b[S],j=k.segment,Z=Ut(k.geometry),te=k.depth;if(te&&(Z+="-"+te.join("-")),A[Z]||(A[Z]=new Array(2)),k.geometry.getType()==="Circle"&&k.index===Xd){let q=_2(t,k,l);An(q,m)&&!A[Z][0]&&(this.dragSegments_.push([k,0]),A[Z][0]=k);continue}if(An(j[0],m)&&!A[Z][0]){this.dragSegments_.push([k,0]),A[Z][0]=k;continue}if(An(j[1],m)&&!A[Z][1]){if(A[Z][0]&&A[Z][0].index===0){let q=k.geometry.getCoordinates();switch(k.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":q=q[te[1]];case"Polygon":if(k.index!==q[te[0]].length-2)continue;break;default:}}this.dragSegments_.push([k,1]),A[Z][1]=k;continue}Ut(j)in this.vertexSegments_&&!A[Z][0]&&!A[Z][1]&&this.insertVertexCondition_(e)&&o.push(k)}o.length&&this.willModifyFeatures_(e,[o]);for(let S=o.length-1;S>=0;--S)this.insertVertex_(o[S],m)}return!!this.vertexFeature_}handleUpEvent(e){for(let t=this.dragSegments_.length-1;t>=0;--t){let a=this.dragSegments_[t][0],l=a.geometry;if(l.getType()==="Circle"){let o=l.getCenter(),m=a.featureSegments[0],g=a.featureSegments[1];m.segment[0]=o,m.segment[1]=o,g.segment[0]=o,g.segment[1]=o,this.rBush_.update(Ba(o),m);let b=l,A=co();if(A){let S=e.map.getView().getProjection();b=b.clone().transform(A,S),b=l0(b).transform(S,A)}this.rBush_.update(b.getExtent(),g)}else this.rBush_.update(ps(a.segment),a)}return this.featuresBeingModified_&&(this.dispatchEvent(new Hd(Zv.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null),!1}handlePointerMove_(e){this.lastPixel_=e.pixel,this.handlePointerAtPixel_(e.pixel,e.map,e.coordinate)}handlePointerAtPixel_(e,t,a){let l=a||t.getCoordinateFromPixel(e),o=t.getView().getProjection(),m=function(A,S){return y2(l,A,o)-y2(l,S,o)},g,b;if(this.hitDetection_){let A=typeof this.hitDetection_=="object"?S=>S===this.hitDetection_:void 0;t.forEachFeatureAtPixel(e,(S,M,k)=>{k&&k.getType()==="Point"&&(k=new Ei(ql(k.getCoordinates(),o)));let j=k||S.getGeometry();if(S instanceof Ao&&this.features_.getArray().includes(S)){b=j;let Z=S.getGeometry().getFlatCoordinates().slice(0,2);g=[{feature:S,geometry:b,segment:[Z,Z]}]}return!0},{layerFilter:A})}if(!g){let A=fs(Ba(l,g2),o),S=t.getView().getResolution()*this.pixelTolerance_,M=ds(Ln(A,S,g2),o);g=this.rBush_.getInExtent(M)}if(g&&g.length>0){let A=g.sort(m)[0],S=A.segment,M=_2(l,A,o),k=t.getPixelFromCoordinate(M),j=Ux(e,k);if(b||j<=this.pixelTolerance_){let Z={};if(Z[Ut(S)]=!0,this.snapToPointer_||(this.delta_[0]=M[0]-l[0],this.delta_[1]=M[1]-l[1]),A.geometry.getType()==="Circle"&&A.index===Xd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(M,[A.feature],[A.geometry]);else{let te=t.getPixelFromCoordinate(S[0]),q=t.getPixelFromCoordinate(S[1]),H=Su(k,te),ae=Su(k,q);j=Math.sqrt(Math.min(H,ae)),this.snappedToVertex_=j<=this.pixelTolerance_,this.snappedToVertex_&&(M=H>ae?S[1]:S[0]),this.createOrUpdateVertexFeature_(M,[A.feature],[A.geometry]);let pe={};pe[Ut(A.geometry)]=!0;for(let ve=1,de=g.length;ve<de;++ve){let _e=g[ve].segment;if(An(S[0],_e[0])&&An(S[1],_e[1])||An(S[0],_e[1])&&An(S[1],_e[0])){let Pe=Ut(g[ve].geometry);Pe in pe||(pe[Pe]=!0,Z[Ut(_e)]=!0)}else break}}this.vertexSegments_=Z;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(e,t){let a=e.segment,l=e.feature,o=e.geometry,m=e.depth,g=e.index,b;for(;t.length<o.getStride();)t.push(0);switch(o.getType()){case"MultiLineString":b=o.getCoordinates(),b[m[0]].splice(g+1,0,t);break;case"Polygon":b=o.getCoordinates(),b[m[0]].splice(g+1,0,t);break;case"MultiPolygon":b=o.getCoordinates(),b[m[1]][m[0]].splice(g+1,0,t);break;case"LineString":b=o.getCoordinates(),b.splice(g+1,0,t);break;default:return}this.setGeometryCoordinates_(o,b);let A=this.rBush_;A.remove(e),this.updateSegmentIndices_(o,g,m,1);let S={segment:[a[0],t],feature:l,geometry:o,depth:m,index:g};A.insert(ps(S.segment),S),this.dragSegments_.push([S,1]);let M={segment:[t,a[1]],feature:l,geometry:o,depth:m,index:g+1};A.insert(ps(M.segment),M),this.dragSegments_.push([M,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=uo.POINTERDRAG){let e=this.lastPointerEvent_;this.willModifyFeatures_(e,this.dragSegments_);let t=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new Hd(Zv.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null,t}return!1}removeVertex_(){let e=this.dragSegments_,t={},a=!1,l,o,m,g,b,A,S,M,k,j,Z;for(b=e.length-1;b>=0;--b)m=e[b],j=m[0],Z=Ut(j.feature),j.depth&&(Z+="-"+j.depth.join("-")),Z in t||(t[Z]={}),m[1]===0?(t[Z].right=j,t[Z].index=j.index):m[1]==1&&(t[Z].left=j,t[Z].index=j.index+1);for(Z in t){switch(k=t[Z].right,S=t[Z].left,A=t[Z].index,M=A-1,S!==void 0?j=S:j=k,M<0&&(M=0),g=j.geometry,o=g.getCoordinates(),l=o,a=!1,g.getType()){case"MultiLineString":o[j.depth[0]].length>2&&(o[j.depth[0]].splice(A,1),a=!0);break;case"LineString":o.length>2&&(o.splice(A,1),a=!0);break;case"MultiPolygon":l=l[j.depth[1]];case"Polygon":l=l[j.depth[0]],l.length>4&&(A==l.length-1&&(A=0),l.splice(A,1),a=!0,A===0&&(l.pop(),l.push(l[0]),M=l.length-1));break;default:}if(a){this.setGeometryCoordinates_(g,o);let te=[];if(S!==void 0&&(this.rBush_.remove(S),te.push(S.segment[0])),k!==void 0&&(this.rBush_.remove(k),te.push(k.segment[1])),S!==void 0&&k!==void 0){let q={depth:j.depth,feature:j.feature,geometry:j.geometry,index:M,segment:te};this.rBush_.insert(ps(q.segment),q)}this.updateSegmentIndices_(g,A,j.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.length=0}}return a}setGeometryCoordinates_(e,t){this.changingFeature_=!0,e.setCoordinates(t),this.changingFeature_=!1}updateSegmentIndices_(e,t,a,l){this.rBush_.forEachInExtent(e.getExtent(),function(o){o.geometry===e&&(a===void 0||o.depth===void 0||Fn(o.depth,a))&&o.index>t&&(o.index+=l)})}};function HB(s,e){return s.index-e.index}function y2(s,e,t){let a=e.geometry;if(a.getType()==="Circle"){let o=a;if(e.index===Xd){let m=co();m&&(o=o.clone().transform(m,t));let g=Su(o.getCenter(),ti(s,t)),b=Math.sqrt(g)-o.getRadius();return b*b}}let l=ti(s,t);return Bu[0]=ti(e.segment[0],t),Bu[1]=ti(e.segment[1],t),pE(l,Bu)}function _2(s,e,t){let a=e.geometry;if(a.getType()==="Circle"&&e.index===Xd){let o=a,m=co();return m&&(o=o.clone().transform(m,t)),ql(o.getClosestPoint(ti(s,t)),t)}let l=ti(s,t);return Bu[0]=ti(e.segment[0],t),Bu[1]=ti(e.segment[1],t),ql(jx(l,Bu),t)}function KB(){let s=vI();return function(e,t){return s.Point}}var Hv=Xv;var YB=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,x2=/^([\d.]+),([\d.]+)$/,v2=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,Sg="stop-fetch",b2=s=>{let e=[];return s.forEach(t=>{let a=t.getGeometry()?.getCoordinates();a?.length&&e.push(...a)}),e},Kv=class s extends Mu{constructor(t={}){super(t);this.abortControllers={};this.cacheStationData={};this.format=new Ii({featureProjection:"EPSG:3857"});this.graphs=[];this.initialRouteDrag={};this.segments=[];this.snapToClosestStation=!1;this.useRawViaPoints=!1;this.viaPoints=[];this.element||this.createDefaultElement(),this.loading=!1,this.active=t.active||!0,this.graphs=t.graphs||[["osm",0,99]],this.mot=t.mot||"bus",this.modify=t.modify!==!1,this.routingApiParams=t.routingApiParams,this.useRawViaPoints=t.useRawViaPoints||!1,this.snapToClosestStation=t.snapToClosestStation||!1,this.apiKey=t.apiKey,this.stopsApiKey=t.stopsApiKey||this.apiKey,this.stopsApiUrl=t.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new od({...t}),this.routingLayer=t.routingLayer||new Jl({source:new Ql,style:t.style}),this.onRouteError=t.onRouteError||(a=>{this.dispatchEvent(new zr("change:route")),this.reset(),console.error(a)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction(),this.on("propertychange",a=>{a.key==="active"&&this.onActiveChange(),a.key==="mot"&&this.viaPoints&&this.drawRoute()})}static getGraphsResolutions(t,a){let l=a.getView();return t.map(([,o,m])=>[l.getResolutionForZoom(o),l.getResolutionForZoom(m||o+1)])}abortRequests(){this.graphs.forEach(t=>{let a=t[0];this.abortControllers[a]&&this.abortControllers[a].abort(),this.abortControllers[a]=new AbortController}),this.abortControllers[Sg]?.abort(),this.abortControllers[Sg]=new AbortController,this.loading=!1}activate(){let t=this.getMap();t&&(this.format=new Ii({featureProjection:t.getView().getProjection()}),this.graphsResolutions=s.getGraphsResolutions(this.graphs,t),this.modifyInteraction&&t.removeInteraction(this.modifyInteraction),this.modifyInteraction&&t.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}addListeners(){this.modify&&(this.removeListeners(),this.onMapClickKey=this.getMap()?.on("singleclick",this.onMapClick))}addViaPoint(t,a=-1,l=0){this.viaPoints.splice(a===-1?this.viaPoints.length:a,l,t),this.drawRoute(),this.dispatchEvent(new zr("change:route"))}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new Hv({deleteCondition:t=>{let l=(t.target?.getFeaturesAtPixel(t.pixel,{hitTolerance:5})).find(o=>o.getGeometry()?.getType()==="Point"&&o.get("index"));return u2(t)&&l?(this.removeViaPoint(l.get("index")),!0):!1},pixelTolerance:6,source:this.routingLayer?.getSource()||void 0}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}deactivate(){let t=this.getMap();t&&(this.modifyInteraction&&t.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}drawRoute(){if(this.abortRequests(),this.routingLayer?.getSource()?.clear(!0),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[Sg]);let t=this.viaPoints.map(a=>{if(Array.isArray(a)){let l=this.getMap()?.getView().getProjection(),[o,m]=Gl(a,l);return this.snapToClosestStation?[`@${m}`,o]:[m,o]}return this.useRawViaPoints?a:`!${a}`});return this.loading=!0,this.viaPoints.forEach((a,l)=>this.drawViaPoint(a,l,this.abortControllers[Sg])),Promise.all(this.graphs.map(([a],l)=>{let{signal:o}=this.abortControllers[a];return this.api?this.api.route({"coord-punish":1e3,"coord-radius":100,elevation:!1,graph:a,mot:this.mot,"resolve-hops":!1,via:`${t.join("|")}`,...this.routingApiParams||{}},{signal:o}).then(m=>{if(this.segments=this.format.readFeatures(m),this.mot==="foot"){let A=this.segments.reduce((S,M)=>{let k=M.get("trg");return S.find(j=>j[0]===k[0]&&j[1]===k[1])?S:[...S,k]},[]);this.segments=A.map(S=>{let M=this.segments.filter(j=>{let Z=j.get("trg");return Z[0]===S[0]&&Z[1]===S[1]}),k=b2(M);return new Ao({geometry:new Go(k)})})}let g=b2(this.segments),b=new Ao({geometry:new Go(g)});b.set("graph",a),b.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[l]?.length>=2&&(b.set("minResolution",this.graphsResolutions[l][0]),b.set("maxResolution",this.graphsResolutions[l][1])),this.routingLayer?.getSource()?.addFeature(b),this.loading=!1}).catch(m=>{/AbortError/.test(m.message)||(this.segments=[],this.dispatchEvent(new zr("error")),this.onRouteError(m,this),this.routingLayer?.getSource()?.clear(),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(t,a,l){let o=new Ao;if(o.set("viaPointIdx",a),Array.isArray(t))return o.setGeometry(new Ei(t)),this.routingLayer?.getSource()?.addFeature(o),Promise.resolve(o);if(!this.useRawViaPoints||v2.test(t)){let S,M;return this.useRawViaPoints?[,S,,M]=v2.exec(t)||[]:[S,M]=t.split("$"),fetch(`${this.stopsApiUrl}lookup/${S}?key=${this.stopsApiKey}`,{signal:l.signal}).then(k=>k.json()).then(k=>{let{coordinates:j}=k.features[0].geometry;return this.cacheStationData[t]=Ai(j),o.set("viaPointTrack",M),o.setGeometry(new Ei(Ai(j))),this.routingLayer?.getSource()?.addFeature(o),o}).catch(k=>{/AbortError/.test(k.message)||(this.dispatchEvent(new zr("error")),this.onRouteError(k,this),this.loading=!1)})}if(this.useRawViaPoints&&x2.test(t)){let[S,M]=x2.exec(t)||[];if(M&&S){let k=parseFloat(M),j=parseFloat(S),Z=Ai([k,j],this.getMap()?.getView().getProjection());return o.setGeometry(new Ei(Z)),this.routingLayer?.getSource()?.addFeature(o),Promise.resolve(o)}}let[,m,,g,b,,A]=YB.exec(t)||[];if(b&&g){let S=Ai([parseFloat(b),parseFloat(g)],this.getMap()?.getView().getProjection());return o.set("viaPointTrack",A),o.setGeometry(new Ei(S)),this.routingLayer?.getSource()?.addFeature(o),Promise.resolve(o)}return m?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${m}&limit=1`,{signal:l.signal}).then(S=>S.json()).then(S=>{let{coordinates:M}=S.features[0].geometry;return this.cacheStationData[t]=Ai(M),o.set("viaPointTrack",A),o.setGeometry(new Ei(Ai(M))),this.routingLayer?.getSource()?.addFeature(o),o}).catch(S=>(this.dispatchEvent(new zr("error")),this.onRouteError(S,this),this.loading=!1,null)):Promise.resolve(null)}onActiveChange(){this.get("active")?this.activate():this.deactivate(),this.render()}onMapClick(t){let l=t.target.getFeaturesAtPixel(t.pixel,{hitTolerance:5,layerFilter:o=>o===this.routingLayer}).find(o=>o.getGeometry()?.getType()==="Point"&&o.get("viaPointIdx")!==void 0);if(l){this.removeViaPoint(l.get("viaPointIdx"));return}this.addViaPoint(t.coordinate)}onModifyEnd(t){let a=t.mapBrowserEvent.coordinate,{oldRoute:l,segmentIndex:o,viaPoint:m}=this.initialRouteDrag||{};return m?this.addViaPoint(a,m.get("viaPointIdx"),1):l?o===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(a,(o||0)+1):this.addViaPoint(a,0,1)}onModifyStart(t){let a=-1,l=t.features.getArray().find(m=>m.getGeometry()?.getType()==="LineString");if(l?.getGeometry()&&t.mapBrowserEvent.coordinate){let m=Ln(new Ei(l.getGeometry()?.getClosestPoint(t.mapBrowserEvent.coordinate)).getExtent(),.001);a=this.segments.findIndex(g=>g.getGeometry()?.intersectsExtent(m))}let o=(t.features.getArray().filter(m=>m.getGeometry()?.getType()==="Point")||[])[0];this.initialRouteDrag={oldRoute:l&&l.clone(),segmentIndex:a,viaPoint:o}}removeListeners(){this.onMapClickKey&&jl(this.onMapClickKey)}removeViaPoint(t=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[t]&&this.viaPoints.splice(t,1),this.drawRoute(),this.dispatchEvent(new zr("change:route"))}render(){}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.getSource()?.clear(),this.dispatchEvent(new zr("change:route"))}setMap(t){super.setMap(t),t&&this.active?this.activate():t||(this.active=!1)}setViaPoints(t){this.viaPoints=[...t],this.drawRoute(),this.dispatchEvent(new zr("change:route"))}get active(){return this.get("active")}set active(t){this.set("active",t)}get loading(){return this.get("loading")}set loading(t){this.set("loading",t)}get modify(){return this.get("modify")}set modify(t){this.set("modify",t)}get mot(){return this.get("mot")}set mot(t){this.set("mot",t)}},w2=Kv;var Yv=class{constructor(e){let{apiKey:t,apiParams:a,placeholder:l,url:o}=e||{};this.apiParams={limit:20,...a||{}},this.placeholder=l||"Search for a stop...";let m={apiKey:t};o&&(m.url=o),this.api=new sd(m),this.abortController=new AbortController,this.createElement(e),this.options=e}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}createElement({element:e}){this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=t=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(t.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),e.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",cursor:"pointer",overflowY:"auto"}),e.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{cursor:"pointer",display:"none",fontSize:"200%",padding:"0 10px",position:"absolute",right:"0"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),e.appendChild(this.clearElt)}render(e){let t=e?.features||[];this.suggestionsElt&&(this.suggestionsElt.style.display=t.length?"block":"none",this.suggestionsElt.innerHTML="",t.forEach(a=>{let l=document.createElement("div");l.innerHTML=a?.properties?.name,l.onclick=o=>{this.options?.onSuggestionClick?.(a,o)},Object.assign(l.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(l)}))}search(e,t){return(e!==void 0||e!==null)&&(this.apiParams.q=e),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,t&&{signal:t.signal}).then(a=>{this.render(a)}).catch(()=>{this.render()})}},S2=Yv;var JB=()=>{let s=document.createElement("div");return Object.assign(s.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px",maxHeight:"90%"}),s},A2=JB;var Jv=class extends Mu{constructor(e){let t=A2();t.className=e?.className||"mbt-stop-finder";let a={element:t,...e||{}};super(a),this.controller=new S2({onSuggestionClick:this.onSuggestionClick.bind(this),...a})}onSuggestionClick(e){let t=Ai(e.geometry.coordinates);this.getMap()?.getView().setCenter(t)}search(e,t){return this.controller.search(e,t)}},E2=Jv;var P2=ao(tb(),1);var QB="vectorTileFeature",rb={"EPSG:3857":new Ii({featureProjection:"EPSG:3857"})},Nu=class extends Du{getFeaturesAtCoordinate(e,t=5){let a=this.getMapLibrePixels(e,t);if(!a)return[];let l=this.getLayer().get("queryRenderedFeaturesOptions")||{};return this.getLayer().mapLibreMap?.queryRenderedFeatures(a,l).map(m=>this.toOlFeature(m))||[]}prepareFrame(){return!0}renderFrame(e){let t=this.getLayer(),{mapLibreMap:a}=t,l=t.getMapInternal();if(!t||!l||!a)return null;let o=a.getCanvas(),{viewState:m}=e;a.jumpTo({center:Gl(m.center),zoom:m.zoom-1,bearing:aE(-m.rotation)});let g=t.getOpacity().toString();return o&&g!==o.style.opacity&&(o.style.opacity=g),o.isConnected?e3(o,e)||a.resize():l.render(),a.redraw(),a.getContainer()}getFeatures(e){let t=this.getLayer().getMapInternal()?.getCoordinateFromPixel(e);return Promise.resolve(this.getFeaturesAtCoordinate(t))}forEachFeatureAtCoordinate(e,t,a,l){let o=this.getFeaturesAtCoordinate(e,a);return o.forEach(m=>{let g=m.getGeometry();g instanceof Vi&&l(m,this.layer_,g)}),o?.[0]}getMapLibrePixels(e,t){if(!e)return;let a=this.getLayer().mapLibreMap?.project(Gl(e));if(a?.x===void 0||a?.y===void 0)return;let l=[a.x,a.y];if(t){let[o,m]=l;l=[[o-t,m-t],[o+t,m+t]]}return l}toOlFeature(e){let l=this.getLayer().getMapInternal()?.getView()?.getProjection()?.getCode()||"EPSG:3857";rb[l]||(rb[l]=new Ii({featureProjection:l}));let o=rb[l].readFeature(e);return o&&o.set(QB,e,!0),o}};function e3(s,e){return s.width===Math.floor(e.size[0]*e.pixelRatio)&&s.height===Math.floor(e.size[1]*e.pixelRatio)}var t3=s=>{if(!s)return[];let{style:e}=s;if(!e)return[];let{sourceCaches:t}=e,a=[];return Object.values(t).forEach(l=>{if(l.used){let{attribution:o}=l.getSource();o&&(a=a.concat(o.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),r3(a)},r3=s=>{let e=s.filter(l=>l!=null&&l.trim&&l.trim()),t=e.map(l=>l.toLowerCase());return[...new Set(t)].map(l=>e.find(o=>o.toLowerCase()===l))},ib=t3;var ju=class extends qo{mapLibreMap;loaded=!1;olListenersKeys=[];constructor(e){super({source:new pa({attributions:()=>ib(this.mapLibreMap)}),...e})}disposeInternal(){jl(this.olListenersKeys),this.loaded=!1,this.mapLibreMap&&(this.mapLibreMap.triggerRepaint=()=>{},this.mapLibreMap.remove()),super.disposeInternal()}setMapInternal(e){super.setMapInternal(e),e?this.loadMapLibreMap():this.dispose()}loadMapLibreMap(){this.loaded=!1;let e=this.getMapInternal();if(e&&this.olListenersKeys.push(e.on("change:target",this.loadMapLibreMap.bind(this))),!e?.getTargetElement())return;if(!this.getVisible()){this.olListenersKeys.push(this.once("change:visible",this.loadMapLibreMap.bind(this)));return}let t=document.createElement("div");t.style.position="absolute",t.style.width="100%",t.style.height="100%";let a=this.get("mapLibreOptions");this.mapLibreMap=new P2.Map(Object.assign({},a,{container:t,attributionControl:!1,interactive:!1,trackResize:!1})),this.mapLibreMap.on("sourcedata",()=>{this.getSource()?.refresh()}),this.mapLibreMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new zr("load"))})}createRenderer(){return new Nu(this)}};var lb=ao(ec());var R2=ao(ec());var Pi=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Pi=(0,R2.default)(s=>{console.warn(s)},1e3));function v3(s){return class extends s{constructor(...a){let l=a[0];super(l);this.olEventsKeys=[];this.options={};l.properties&&(Pi("Deprecated. Don't use properties options. Pass the values directly in options object."),this.setProperties(l.properties)),this.olEventsKeys?.push(this.on("propertychange",o=>{o.key==="children"&&this.onChildrenChange(o.oldValue)})),this.options=l,this.set("children",l.children||[])}attachToMap(a){(super.attachToMap||(()=>{}))(a),(this.get("children")||[]).forEach(l=>{a.addLayer(l)})}detachFromMap(){(this.get("children")||[]).forEach(a=>{this.map.removeLayer(a)}),(super.detachFromMap||(()=>{}))()}flat(){return Pi("Layer.flat is deprecated. Use getLayersAsFlatArray utils method instead."),Nl(this)}onChildrenChange(a){(a||[]).forEach(l=>{l.set("parent",void 0)}),(this.get("children")||[]).forEach(l=>{l.set("parent",this)})}setMapInternal(a){super.setMapInternal(a),a?this.attachToMap(a):this.detachFromMap()}get children(){return Pi("Layer.children is deprecated. Use the Layer.get('children') method instead."),this.get("children")||[]}set children(a){Pi("Layer.children is deprecated. Use the Layer.set('children', children) method instead."),this.set("children",a||[])}get copyrights(){return Pi("Layer.copyrights is deprecated. Get the attributions from the source object"),this.get("copyrights")}set copyrights(a){Pi("Layer.copyrights is deprecated. Set the attributions to the source object.");let l=a&&!Array.isArray(a)?[a]:a;this.set("copyrights",l||[])}get disabled(){return Pi("Layer.disabled is deprecated. Use the Layer.get('disabled') method instead."),this.get("disabled")}set disabled(a){Pi("Layer.disabled is deprecated. Use the Layer.set('disabled', newValue) method instead."),this.set("disabled",a)}get group(){return Pi("Layer.group is deprecated. Use the Layer.get('group') method instead."),this.get("group")}get hitTolerance(){return Pi("Layer.hitTolerance is deprecated.Pass the hitTolerance when you request the features."),this.get("hitTolerance")||5}get key(){return this.get("key")||this.get("name")||Ut(this)}get map(){return this.getMapInternal()}get name(){return Pi("Layer.name is deprecated. Use the Layer.get('name') method instead."),this.get("name")}get olLayer(){return Pi("Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. This getter is only a redirect to the current 'this' object."),this}set olLayer(a){Pi("Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. This setter has no effect.")}get parent(){return Pi("Layer.parent is deprecated. Use the Layer.get('parent') method instead."),this.get("parent")}set parent(a){Pi("Layer.parent is deprecated. Use the Layer.set('parent', parent) method instead."),this.set("parent",a)}get visible(){return Pi("Layer.visible is deprecated. Use the Layer.getVisible() method instead."),this.getVisible()}set visible(a){Pi("Layer.visible is deprecated. Use the Layer.setVisible(newValue) method instead."),this.setVisible(a)}}}var k2=v3;function b3(s){return class extends k2(s){}}var Ss=b3;var F2=(s,e,t,a)=>Ol(`${s}/styles/${e}/style.json`,{[a]:t}).toString(),sb=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(sb=(0,lb.default)(s=>{console.warn(s)},1e3));var ab=class s extends Ss(ju){constructor(e){let t={apiKeyName:"key",style:"travic_v2",url:"https://maps.geops.io",...e||{},mapLibreOptions:{...e.mapLibreOptions||{}}};!t.mapLibreOptions.style&&t.apiKey&&t.style&&typeof t.style=="string"&&(t.mapLibreOptions.style=F2(t.url,t.style,t.apiKey,t.apiKeyName)),super(t)}attachToMap(e){super.attachToMap(e);let t=(0,lb.default)(this.updateMaplibreMap.bind(this),150);this.olEventsKeys.push(this.on("propertychange",a=>{/(url|style)/.test(a.key)&&t()}))}clone(e){return new s({...this.options||{},...e||{}})}getStyle(){return this.style&&typeof this.style=="object"&&this.style.name&&this.style.version?this.style:this.url.includes("style.json")?this.url:F2(this.url,this.style,this.get("apiKey"),this.get("apiKeyName"))}updateMaplibreMap(){try{this.mapLibreMap?.setStyle(this.getStyle(),{diff:!1})}catch(e){console.error("Error while updating MaplibreMap",e)}}get maplibreMap(){return sb("MaplibreLayer.maplibreMap is deprecated. Use layer.mapLibreMap."),this.mapLibreMap}get mbMap(){return sb("MaplibreLayer.mbMap is deprecated. Use layer.maplibreMap."),this.maplibreMap}get style(){return this.get("style")}set style(e){this.set("style",e)}get url(){return this.get("url")}set url(e){this.set("url",e)}},L2=ab;var D2=ao(ec());var cb={"EPSG:3857":new Ii({featureProjection:"EPSG:3857"})},Kd=class extends Du{forEachFeatureAtCoordinate(e,t,a,l){let o=this.getFeaturesAtCoordinate(e,a);return o.forEach(m=>{l(m,this.layer_,m.getGeometry())}),o?.[0]}getFeatures(e){let t=this.getLayer()?.getMapInternal()?.getCoordinateFromPixel(e);return Promise.resolve(this.getFeaturesAtCoordinate(t))}getFeaturesAtCoordinate(e,t=5){if(!e)return[];let a=this.getLayer(),l=a.getMapInternal(),{mapLibreMap:o}=a.maplibreLayer,m=l?.getView()?.getProjection()?.getCode()||"EPSG:3857",g=[];if(cb[m]||(cb[m]=new Ii({featureProjection:m})),o?.isStyleLoaded()){let b=e&&o.project(Gl(e));if(b?.x&&b?.y){let A=[b.x,b.y];if(t){let[M,k]=A;A=[[M-t,k-t],[M+t,k+t]]}let S=a.layers||[];a.layersFilter&&(S=o.getStyle().layers.filter(a.layersFilter)),a.queryRenderedLayersFilter&&(S=o.getStyle().layers.filter(a.queryRenderedLayersFilter)),g=o.queryRenderedFeatures(A,{layers:S.map(M=>M.id),validate:!1}).map(M=>{let k=cb[m].readFeature(M);return k&&k.set(Tu,M),k})}}return g}prepareFrame(){return!0}renderFrame(){return null}};var Io=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Io=(0,D2.default)((...s)=>{console.warn(...s)},1e3));var ub=class s extends Ss(qo){constructor(t={mapLibreOptions:{style:{layers:[],sources:{},version:8}}}){t.mapboxLayer&&(Io("options.mapboxLayer is deprecated. Use options.maplibreLayer instead."),t.maplibreLayer=t.mapboxLayer,delete t.mapboxLayer);super({source:new pa({}),...t});this.highlightedFeatures=[];this.selectedFeatures=[];this.onLoad=this.onLoad.bind(this),!this.layersFilter&&this.layers&&(this.layersFilter=a=>!!this.layers.find(l=>a.id===l.id))}addLayers(){if(!this.maplibreLayer?.mapLibreMap||!Array.isArray(this.layers))return;let{mapLibreMap:t}=this.maplibreLayer;t&&(this.layers.forEach(a=>{let{id:l,source:o}=a;(!o||o&&t.getSource(o))&&l&&!t.getLayer(l)&&t.addLayer(a,this.beforeId)}),this.applyLayoutVisibility())}addSources(){if(!this.maplibreLayer?.mapLibreMap||!this.sources)return;let{mapLibreMap:t}=this.maplibreLayer;t&&Object.entries(this.sources).forEach(([a,l])=>{t.getSource(a)||t.addSource(a,l)})}applyLayoutVisibility(t){if(!this.maplibreLayer?.mapLibreMap?.getStyle()||!this.layersFilter)return;let{mapLibreMap:a}=this.maplibreLayer,l=a.getStyle(),o=this.getVisible()?"visible":"none",m=l.layers||[];for(let g=0;g<m.length;g+=1){let b=m[g];if(this.layersFilter(b)){let{id:A}=b;a.getLayer(A)&&(a.setLayoutProperty(A,"visibility",o),(this.getMinZoom()||this.getMaxZoom())&&a.setLayerZoomRange(A,this.getMinZoom()?this.getMinZoom()-1:0,this.getMaxZoom()?this.getMaxZoom()-1:24))}}}attachToMap(t){if(this.maplibreLayer&&!this.maplibreLayer.map&&t.addLayer(this.maplibreLayer),super.attachToMap(t),!this.map||!this.maplibreLayer)return;if(!this.map.getTargetElement()){this.olEventsKeys.push(this.map.on("change:target",()=>{this.attachToMap(t)}));return}let{mapLibreMap:a}=this.maplibreLayer;a&&(a.loaded()?this.onLoad():a.once("load",this.onLoad)),this.olEventsKeys.push(this.maplibreLayer.on("load",this.onLoad.bind(this)),this.on("change:visible",l=>{this.applyLayoutVisibility(l)}),this.on("propertychange",l=>{/(sources|layers|layersFilter|maplibreLayer|beforeId)/.test(l.key)&&(this.detachFromMap(),this.attachToMap(t))}))}clone(t){return new s({...this.options,...t})}createRenderer(){return new Kd(this)}detachFromMap(){this.maplibreLayer?.mapLibreMap&&(this.maplibreLayer.mapLibreMap.off("load",this.onLoad),this.removeLayers(),this.removeSources()),super.detachFromMap()}getFeatureInfoAtCoordinate(t){if(Io("Deprecated. getFeatureInfoAtCoordinate([layer], coordinate) from ol package instead."),!this.maplibreLayer?.mapLibreMap)return Promise.resolve({coordinate:t,features:[],layer:this});let{mapLibreMap:a}=this.maplibreLayer;if(!a.isStyleLoaded())return Promise.resolve({coordinate:t,features:[],layer:this});let l=this.layers||[];return this.layersFilter&&(l=a.getStyle().layers.filter(this.layersFilter)),this.queryRenderedLayersFilter&&(l=a.getStyle().layers.filter(this.queryRenderedLayersFilter)),Promise.resolve({coordinate:t,features:[],layer:this})}highlight(t=[]){Io("Deprecated. Use layer.setFeatureState(features, {highlighted: true}) instead.");let a=this.highlightedFeatures?.filter(l=>!(this.selectedFeatures||[]).map(o=>o.getId()).includes(l.getId()))||[];this.setHoverState(a,!1),this.highlightedFeatures=t,this.setHoverState(this.highlightedFeatures,!0)}onLoad(){if(!this.maplibreLayer?.mapLibreMap)return;this.addSources(),this.addLayers();let{mapLibreMap:t}=this.maplibreLayer,a=t.getStyle();if(a?.layers&&this.layersFilter){let l=a.layers.filter(this.layersFilter);this.set("disabled",!l.length)}this.applyLayoutVisibility()}removeLayers(){if(!this.maplibreLayer?.mapLibreMap||!Array.isArray(this.layers))return;let{mapLibreMap:t}=this.maplibreLayer;t&&this.layers.forEach(a=>{let{id:l}=a;l&&t.getLayer(l)&&t.removeLayer(l)})}removeSources(){if(!this.maplibreLayer?.mapLibreMap||!this.sources)return;let{mapLibreMap:t}=this.maplibreLayer;t&&Object.keys(this.sources).forEach(a=>{t.getSource(a)&&t.removeSource(a)})}select(t=[]){Io("Deprecated. Use layer.setFeatureState(features, {selected: true}) instead."),this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=t,this.setHoverState(this.selectedFeatures||[],!0)}setFeatureState(t,a){if(!this.maplibreLayer?.mapLibreMap||!t.length)return;let{mapLibreMap:l}=this.maplibreLayer;t.forEach(o=>{let{source:m,sourceLayer:g}=o.get(Tu)||{};if(!m&&!g||!o.getId()){o.getId()||Io("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/Maplibre/tippecanoe#adding-calculated-attributes.",o.getProperties());return}l.setFeatureState({id:o.getId(),source:m,sourceLayer:g},a)})}setHoverState(t,a){Io(`Deprecated. Use layer.setFeatureState(features, {hover: ${a}}) instead.`),this.setFeatureState(t,{hover:a})}get beforeId(){return this.get("beforeId")}set beforeId(t){this.set("beforeId",t)}get layers(){return this.get("layers")}set layers(t){this.set("layers",t)}get layersFilter(){return this.get("layersFilter")}set layersFilter(t){this.set("layersFilter",t)}get mapboxLayer(){return Io("Deprecated. Use maplibreLayer instead."),this.get("maplibreLayer")}get maplibreLayer(){return this.get("maplibreLayer")}set maplibreLayer(t){this.set("maplibreLayer",t)}get queryRenderedLayersFilter(){return this.get("queryRenderedLayersFilter")}set queryRenderedLayersFilter(t){this.set("queryRenderedLayersFilter",t)}get sources(){return this.get("sources")}set sources(t){this.set("sources",t)}get styleLayer(){return Io("MaplibreStyleLayer.styleLayer is deprecated. Use MaplibreStyleLayer.layer instead."),this.layers[0]}set styleLayer(t){Io("MaplibreStyleLayer.styleLayer is deprecated. Use MaplibreStyleLayer.layer instead."),this.layers=[t]}get styleLayers(){return Io("MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead."),this.layers}set styleLayers(t){Io("MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead."),this.layers=t}},O2=ub;var fb=ao(ec());var pb=ao(ec()),db=ao(U2());function N3(s){return class extends s{constructor(t){super({hitTolerance:10,...t}),this.defineProperties(t),this.debug=t.debug||!1,this.mode=t.mode||Jr.TOPOGRAPHIC,this.api=t.api||new nd(t),this.tenant=t.tenant||"",this.minZoomInterpolation=t.minZoomInterpolation||8,this.format=new Ii,this.onStart=t.onStart,this.onStop=t.onStop,this.motsByZoom=t.motsByZoom||[Vo,Vo,Vo,Vo,Vo,Vo,Vo,Vo,Vo,tg,tg],this.getMotsByZoom=a=>t.getMotsByZoom?t.getMotsByZoom(a,this.motsByZoom):this.motsByZoom[a],this.generalizationLevelByZoom=t.generalizationLevelByZoom||[],this.getGeneralizationLevelByZoom=a=>t.getGeneralizationLevelByZoom?t.getGeneralizationLevelByZoom(a,this.generalizationLevelByZoom):this.generalizationLevelByZoom[a],this.renderTimeIntervalByZoom=t.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=a=>t.getRenderTimeIntervalByZoom?t.getRenderTimeIntervalByZoom(a,this.renderTimeIntervalByZoom):this.renderTimeIntervalByZoom[a],this.isUpdateBboxOnMoveEnd=t.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,db.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,pb.default)(this.renderTrajectoriesInternal,50,{leading:!0,maxWait:5e3,trailing:!0}),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}addTrajectory(t){this.trajectories||(this.trajectories={});let a=t.properties.train_id;a!==void 0&&(this.trajectories[a]=t),this.renderTrajectories()}attachToMap(t){super.attachToMap(t),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}defineProperties(t){(super.defineProperties||(()=>{}))(t);let{bboxParameters:a,canvas:l,filter:o,hoverVehicleId:m,live:g,mode:b,pixelRatio:A,selectedVehicleId:S,sort:M,speed:k,style:j,styleOptions:Z,time:te}=t,q=l,H=k||1,ae=te||new Date,pe=b||Jr.TOPOGRAPHIC,ve=j||zl;Object.defineProperties(this,{bboxParameters:{value:a,writable:!0},canvas:{get:()=>(q||(q=document.createElement("canvas")),q),set:de=>{q=de}},filter:{value:o,writable:!0},hoverVehicleId:{value:m,writable:!0},isTrackerLayer:{value:!0},live:{value:g===!1?g:!0,writable:!0},mode:{get:()=>pe,set:de=>{de!==pe&&(pe=de,this.api?.wsApi?.open&&(this.stop(),this.start()))}},pixelRatio:{value:A||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},selectedVehicleId:{value:S,writable:!0},sort:{value:M,writable:!0},speed:{get:()=>H,set:de=>{H=de,this.start()}},style:{get:()=>ve,set:de=>{ve=de,this.renderTrajectories()}},styleOptions:{value:{...Pu,...Z||{}}},time:{get:()=>ae,set:de=>{ae=de?.getTime?de:new Date(de),this.renderTrajectories()}},trajectories:{value:{},writable:!0},useDebounce:{value:t.useDebounce||!1,writable:!0},useRequestAnimationFrame:{value:t.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:t.useThrottle!==!1,writable:!0}})}detachFromMap(){if(document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),jl(this.visibilityRef),this.canvas){let t=this.canvas.getContext("2d");t&&t.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap()}}getFeatureInfoAtCoordinate(t,a){let{nb:l,resolution:o}=a,m=Ln([...t,...t],this.hitTolerance*o),g=Object.values(this.trajectories||{});this.sort&&(g=g.sort(this.sort));let b=[];for(let A=0;A<g.length;A+=1){let{coordinate:S}=g[A].properties;if(S&&Js(m,S)&&b.push(g[A]),b.length===l)break}return Promise.resolve({coordinate:t,features:b.map(A=>this.format.readFeature(A)),layer:this})}getRefreshTimeInMs(t=0){let a=t!==void 0?Math.round(t):-1,l=this.getRenderTimeIntervalByZoom(a)||25,o=Math.max(25,l/(this.speed||1)),m=Math.min(o,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,db.default)(this.renderTrajectoriesInternal,m,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,pb.default)(this.renderTrajectoriesInternal,m,{leading:!0,maxWait:5e3,trailing:!0})),this.api?.buffer){let[,g]=this.api.buffer;this.api.buffer=[m,g]}return o}getTrajectoryInfos(t){let a=[this.api.getStopSequence(t),this.api.getFullTrajectory(t,this.mode,this.getGeneralizationLevelByZoom(Math.floor(this.map?.getView()?.getZoom()||0)))];return Promise.all(a).then(([l,o])=>({fullTrajectory:o,stopSequence:l}))}getVehicle(t){return this.trajectories&&Object.values(this.trajectories).filter(t)||[]}highlightVehicle(t){this.hoverVehicleId!==t&&(this.hoverVehicleId=t,this.renderTrajectories(!0))}onDeleteTrajectoryMessage(t){t.content&&this.removeTrajectory(t.content)}onDocumentVisibilityChange(){if(document.hidden)this.stop(),this.trajectories={};else{if(this.getVisible()===!1)return;this.start()}}onTrajectoryMessage(t){if(!t.content)return;let a=t.content,{geometry:l,properties:{raw_coordinates:o,time_since_update:m,train_id:g}}=a;m<0||this.purgeTrajectory(a)||(this.debug&&this.mode===Jr.TOPOGRAPHIC&&o?a.properties.olGeometry=this.format.readGeometry({coordinates:Ai(o,this.map.getView().getProjection()),type:"Point"}):a.properties.olGeometry=this.format.readGeometry(l),a.properties.timeOffset=Date.now()-t.timestamp,this.addTrajectory(a))}onZoomEnd(){this.startUpdateTime()}purgeOutOfDateTrajectories(){Object.entries(this.trajectories||{}).forEach(([t,a])=>{let l=a?.properties?.time_intervals;this.time&&l?.length&&l[l.length-1][0]<this.time.getTime()&&this.removeTrajectory(t)})}purgeTrajectory(t,a,l){let{bounds:o,type:m}=t.properties;return this.isUpdateBboxOnMoveEnd&&!ei(a,o)||this.mots&&!this.mots.includes(m)?(this.removeTrajectory(t),!0):!1}removeTrajectory(t){let a;typeof t!="string"?a=t?.properties?.train_id:a=t,a!==void 0&&this.trajectories&&delete this.trajectories[a]}renderTrajectories(t,a){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),t&&(!a&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(t,a)}):!a&&this.useDebounce?this.debounceRenderTrajectories(t,a):!a&&this.useThrottle?this.throttleRenderTrajectories(t,a):this.renderTrajectoriesInternal(t,a))}renderTrajectoriesInternal(t,a=!1){if(!this.map||!this.trajectories)return!1;let l=this.live?Date.now():this.time?.getTime(),o=Object.values(this.trajectories);return this.sort&&o.sort(this.sort),!this.canvas||!this.style||(this.renderState=Td(this.canvas,o,this.style,{...t,pixelRatio:this.pixelRatio||1,time:l},{filter:this.filter,hoverVehicleId:this.hoverVehicleId,noInterpolate:(t.zoom||0)<this.minZoomInterpolation?!0:a,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}selectVehicle(t){this.selectedVehicleId!==t&&(this.selectedVehicleId=t,this.renderTrajectories(!0))}setBbox(t,a){if(this.trajectories&&t&&a){let S=Object.keys(this.trajectories);for(let M=S.length-1;M>=0;M-=1)this.purgeTrajectory(this.trajectories[S[M]],t,a)}let l=Math.floor(a);if(!t||Number.isNaN(l))return;let[o,m,g,b]=t,A=[Math.floor(o),Math.floor(m),Math.ceil(g),Math.ceil(b),l];this.generalizationLevel=this.getGeneralizationLevelByZoom(l),this.generalizationLevel&&A.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(l),this.mots&&A.push(`mots=${this.mots}`),this.tenant&&A.push(`tenant=${this.tenant}`),this.mode!=="topographic"&&A.push(`channel_prefix=${this.mode}`),this.bboxParameters&&Object.entries(this.bboxParameters).forEach(([S,M])=>{A.push(`${S}=${M}`)}),this.api.bbox=A}start(){this.stop(),this.purgeOutOfDateTrajectories(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.onStart&&this.onStart(this)}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close(),this.onStop&&this.onStop(this)}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}}}var Eg=N3;var j3=new Ii,Yd=class extends xg{forEachFeatureAtCoordinate(e,t,a,l){let o=this.getFeaturesAtCoordinate(e,a);return o.forEach(m=>{l(m,this.layer_,m.getGeometry())}),o?.[0]}getData(e){let t;try{let{pixelRatio:a}=this.getLayer();return t=this.canvas?.getContext("2d",{willReadFrequently:!0})?.getImageData(e[0]*(a||1),e[1]*(a||1),1,1).data||null,t}catch(a){console.error("error getting data",a)}return null}getFeatures(e){let t=this.getLayer()?.getMapInternal()?.getCoordinateFromPixel(e);return Promise.resolve(this.getFeaturesAtCoordinate(t))}getFeaturesAtCoordinate(e,t=5){if(!e)return[];let a=this.getLayer(),o=a.getMapInternal()?.getView()?.getResolution()||1,m=10,g=Ln([...e,...e],t*o),b=[],A=Object.values(a.trajectories||{});a.sort&&(A=A.sort(this.sort));let S=[];for(let M=0;M<A.length;M+=1){let k=A[M];if(k.properties.coordinate&&Js(g,k.properties.coordinate)&&S.push(A[M]),S.length===m)break}return b=S.map(M=>j3.readFeature(M)),b}prepareFrame(){return!0}renderFrame(e){let{canvas:t,renderedViewState:a}=this.getLayer();if(this.container||(this.container=document.createElement("div"),this.container.className=this.getLayer().getClassName(),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",t instanceof HTMLCanvasElement&&(t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.transformOrigin="top left",this.container.appendChild(t))),a){let{center:l,resolution:o,rotation:m}=e.viewState,{center:g,resolution:b,rotation:A}=a;if(b/o>=3){let S=t?.getContext("2d");t?.width&&t?.height&&S?.clearRect(0,0,t.width,t.height)}else{let S=this.getLayer().getMapInternal(),M=S?.getPixelFromCoordinate(g),k=S?.getPixelFromCoordinate(l);M&&k&&(this.container.style.transform=UA(M[0]-k[0],M[1]-k[1],b/o,b/o,m-A,0,0))}}return this.container}};var U3=new $i({zIndex:2,image:new Vn({radius:5,fill:new qi({color:"#000000"})}),stroke:new ai({color:"#000000",width:6})}),G3=(s,e,t)=>{let a="#ffffff",l=s.get("type"),o=s.get("stroke");return o&&o[0]!=="#"&&(o=`#${o}`),a=o||t?.getBgColor(l),a=/#ffffff/i.test(a)?"#ff0000":a,[U3,new $i({zIndex:3,image:new Vn({radius:4,fill:new qi({color:a})}),stroke:new ai({color:a,width:4})})]},Ig=G3;var V3=new $i({zIndex:2,image:new Vn({radius:5,fill:new qi({color:"#000000"})}),stroke:new ai({color:"#000000",width:6})}),q3=new $i({zIndex:3,image:new Vn({radius:4,fill:new qi({color:"#a0a0a0"})}),stroke:new ai({color:"#a0a0a0",width:4})}),$3=()=>[V3,q3],G2=$3;var V2=new Vn({radius:6,fill:new qi({color:[255,0,0,1]}),stroke:new ai({color:[0,0,0,1],width:1})}),W3=new $i({stroke:new ai({color:[0,0,0,1],width:5})}),Z3=new $i({image:V2,stroke:new ai({color:[255,0,0,1],width:3})}),X3=new $i({image:V2,stroke:new ai({color:[255,0,0,1],width:3,lineDash:[1,10]})}),H3=(s,e)=>{let t=s.get("minResolution"),a=s.get("maxResolution"),l=e<=t&&e>a;return t&&a&&!l?[]:s.get("mot")!=="foot"?[W3,Z3]:[X3]},q2=H3;var K3=new Ii,mb=class s extends Eg(Ss(qo)){constructor(t){super({source:new pa({}),...t});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!t.allowRenderWhenAnimating,this.vectorLayer=new Jl({source:new Ql({features:[]}),style:(a,l)=>(t.fullTrajectoryStyle||Ig)(a,l,this.styleOptions),updateWhileAnimating:this.allowRenderWhenAnimating,updateWhileInteracting:!0}),this.renderState={center:[0,0],rotation:0,zoom:void 0},this.onZoomEndDebounced=(0,fb.default)(this.onZoomEnd,100),this.onMoveEndDebounced=(0,fb.default)(this.onMoveEnd,100)}attachToMap(t){if(super.attachToMap(t),this.map){this.getVisible()&&this.start();let a=this.map.getLayers().getArray().indexOf(this);this.map.getLayers().insertAt(a,this.vectorLayer),this.olEventsKeys.push(...this.map.on(["moveend","change:target"],l=>{let o=(l.map||l.target).getView();if(!o||o?.getAnimating()||o?.getInteracting())return;let m=o.getZoom();this.currentZoom!==m&&this.onZoomEndDebounced(l),this.currentZoom=m,this.onMoveEndDebounced(l)}),this.on("change:visible",l=>{l.target.getVisible()?this.start():this.stop()}),this.on("propertychange",l=>{/(opacity|visible|zIndex|minResolution|maxResolution|minZoom|maxZoom)/.test(l.key)&&this.vectorLayer.set(l.key,l.target.get(l.key))}))}}clone(t){return new s({...this.options,...t})}createRenderer(){return new Yd(this)}detachFromMap(){this.map?.removeLayer(this.vectorLayer),super.detachFromMap()}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView()?.getZoom()||0)}highlight(t){this.highlightVehicle(t?.get("train_id"))}highlightTrajectory(t){return t?this.api.getFullTrajectory(t,this.mode,this.getGeneralizationLevelByZoom(Math.floor(this.map?.getView()?.getZoom()||0))).then(a=>{let l=a.content;if(!l?.features?.length)return[];let o=K3.readFeatures(l);return this.vectorLayer?.getSource()?.clear(!0),o.length&&this.vectorLayer?.getSource()?.addFeatures(o),o}).catch(()=>(this.vectorLayer?.getSource()?.clear(!0),[])):(this.vectorLayer?.getSource()?.clear(!0),Promise.resolve([]))}onMoveEnd(t){!this.isUpdateBboxOnMoveEnd||!this.getVisible()||this.setBbox()}onZoomEnd(){super.onZoomEnd(),!(!this.isUpdateBboxOnMoveEnd||!this.getVisible())&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(t,a,l){let o=this.map.getView()?.getCenter();return!a&&!o?!1:super.purgeTrajectory(t,a||this.map.getView().calculateExtent(),l||this.map.getView().getZoom()||0)}renderTrajectories(t){if(!this.map)return;let a=this.map.getView();a?.getCenter()&&super.renderTrajectories({center:a.getCenter(),extent:a.calculateExtent(),pixelRatio:this.pixelRatio,resolution:a.getResolution(),rotation:a.getRotation(),size:this.map.getSize(),zoom:a.getZoom()},t)}renderTrajectoriesInternal(t,a){if(!this.map?.getView())return!1;let l=!1;if(l=(this.allowRenderWhenAnimating?!1:this.map.getView().getAnimating()||this.map.getView().getInteracting())?!1:super.renderTrajectoriesInternal(t,a),l){this.renderedViewState={...t};let{container:m}=this.getRenderer();m&&(m.style.transform="")}return l}select(t){this.selectVehicle(t?.get("train_id")),this.highlightTrajectory(t?.get("train_id"))}setBbox(t,a){let l=t||this.map?.getView()?.calculateExtent();l&&super.setBbox(l,a||this.map?.getView()?.getZoom()||0)}},$2=mb;var W2=ao(ec());var Z2=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Z2=(0,W2.default)(s=>{console.warn(s)},1e3));var gb=class s extends Ss(qo){constructor(e){super(e),Z2("Layer is deprecated. Use an OpenLayers Layer instead.")}clone(e){return new s({...this.options||{},...e||{}})}},Pg=gb;var yb=class s extends Pg{clone(e){return new s({...this.options,...e})}getFeatureInfoAtCoordinate(e){let t=[];if(this.map){let a=this.map.getPixelFromCoordinate(e);t=this.map.getFeaturesAtPixel(a,{hitTolerance:this.hitTolerance||5,layerFilter:l=>l===this.olLayer})}return Promise.resolve({coordinate:e,features:t,layer:this})}},X2=yb;var Y3=new Ii,J3=(s,e,t)=>{let a,{coordinate:l,params:o,projection:m,resolution:g}=e;return s&&g&&m&&(a=s.getFeatureInfoUrl(l,g,m,{info_format:"application/json",query_layers:s.getParams().layers,...o})),fetch(a,{signal:t.signal}).then(b=>b.json()).then(b=>Y3.readFeatures(b)).catch(()=>[])},Jd={},Q3=async(s,e,t=5)=>{Object.values(Jd).forEach(o=>{o?.abort()}),Jd={};let l=Nl(e).map(o=>{let m=o.getMapInternal(),g=m?.getView()?.getProjection()?.getCode(),b={coordinate:s,features:[],layer:o};if(!g)return Promise.resolve(b);if(o.getFeatureInfoAtCoordinate)return o.getFeatureInfoAtCoordinate(s);let A=o?.getSource();if(A?.getFeatureInfoUrl){let k=Ut(o);Jd[k]?.abort(),Jd[k]=new AbortController;let j=m?.getView()?.getResolution();return J3(A,{coordinate:s,params:{info_format:"application/json",query_layers:A.getParams().layers},projection:g,resolution:j},Jd[k]).then(Z=>({coordinate:s,features:Z,layer:o})).catch(()=>({coordinate:s,features:[],layer:o}))}let S=m?.getPixelFromCoordinate(s);if(!S)return Promise.resolve(b);let M=m?.getFeaturesAtPixel(S,{hitTolerance:o.get("hitTolerance")||t||5,layerFilter:k=>k===o});return Promise.resolve({coordinate:s,features:M,layer:o})});return Promise.all(l)},H2=Q3;var Wy={};nx(Wy,{CopyrightControl:()=>K2,Layer:()=>Rg,RealtimeAPI:()=>nd,RealtimeLayer:()=>IL,RealtimeModes:()=>Jr,RoutingAPI:()=>od,StopsAPI:()=>sd,VECTOR_TILE_FEATURE_PROPERTY:()=>Tu,compareDepartures:()=>Cd,createCanvas:()=>zo,createRealtimeFilters:()=>bx,debounceDeparturesMessages:()=>h0,debounceWebsocketMessages:()=>id,getCircleCanvas:()=>yx,getDelayBgCanvas:()=>mx,getDelayTextCanvas:()=>gx,getHoursAndMinutes:()=>BA,getLayersAsFlatArray:()=>Nl,getMapGlCopyrights:()=>ad,getMercatorResolution:()=>EL,getSourceCoordinates:()=>$y,getTextCanvas:()=>_x,getUTCDateString:()=>OA,getUTCTimeString:()=>zA,getUrlWithParams:()=>Ol,getVehiclePosition:()=>Pd,pad:()=>Rm,realtimeConfig:()=>Pu,realtimeDefaultStyle:()=>zl,realtimeDelayStyle:()=>xx,realtimeSimpleStyle:()=>vx,removeDuplicate:()=>Bl,renderTrajectories:()=>Td,sortAndFilterDepartures:()=>Md,sortByDelay:()=>wx});var e5=" | ",_b=class{constructor(e={}){this.options=e}onAdd(e){return this.map=e,this.container||(this.container=document.createElement("div")),this.render=this.render.bind(this),this.map.on("idle",this.render),this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.render(),this.container}onRemove(){return this.container?.parentElement&&this.container.parentElement?.removeChild(this.container),this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),this.map=void 0,this.container}getDefaultPosition(){return"bottom-right"}render(){if(this.map&&this.container){let e=this.options?.separator||e5,t=this.options?.customAttribution||ad(this.map),a=(Array.isArray(t)?t:[t]).join(e);this.container.innerHTML!==a&&(this.content=a,this.container.innerHTML=this.content)}}},K2=_b;var Zi=[];for(Cg=0;Cg<256;++Cg)Zi.push((Cg+256).toString(16).slice(1));var Cg;function Y2(s,e=0){return(Zi[s[e+0]]+Zi[s[e+1]]+Zi[s[e+2]]+Zi[s[e+3]]+"-"+Zi[s[e+4]]+Zi[s[e+5]]+"-"+Zi[s[e+6]]+Zi[s[e+7]]+"-"+Zi[s[e+8]]+Zi[s[e+9]]+"-"+Zi[s[e+10]]+Zi[s[e+11]]+Zi[s[e+12]]+Zi[s[e+13]]+Zi[s[e+14]]+Zi[s[e+15]]).toLowerCase()}var Mg,t5=new Uint8Array(16);function xb(){if(!Mg&&(Mg=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Mg))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mg(t5)}var r5=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vb={randomUUID:r5};function i5(s,e,t){if(vb.randomUUID&&!e&&!s)return vb.randomUUID();s=s||{};var a=s.random||(s.rng||xb)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,e){t=t||0;for(var l=0;l<16;++l)e[t+l]=a[l];return e}return Y2(a)}var bb=i5;var J2=ao(tb()),wb=class extends J2.Evented{constructor(t={}){super();this.options={};this.type="custom";this.options=t,this.id=t.id||bb(),this.type="custom"}onAdd(t,a){this.map=t}onRemove(t,a){this.map=void 0}render(t){}},Rg=wb;var aL=ao(oL(),1),$G=Object.defineProperty,mr=(s,e)=>$G(s,"name",{value:e,configurable:!0}),WG=class{constructor(e){this.direction=!1,this.compareProperties=!0;var t,a,l;this.precision=10**-((t=e?.precision)!=null?t:17),this.direction=(a=e?.direction)!=null?a:!1,this.compareProperties=(l=e?.compareProperties)!=null?l:!0}compare(e,t){if(e.type!==t.type||!bf(e,t))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,t.coordinates);case"LineString":return this.compareLine(e.coordinates,t.coordinates);case"Polygon":return this.comparePolygon(e,t);case"GeometryCollection":return this.compareGeometryCollection(e,t);case"Feature":return this.compareFeature(e,t);case"FeatureCollection":return this.compareFeatureCollection(e,t);default:if(e.type.startsWith("Multi")){let a=kw(e),l=kw(t);return a.every(o=>l.some(m=>this.compare(o,m)))}}return!1}compareCoord(e,t){return e.length===t.length&&e.every((a,l)=>Math.abs(a-t[l])<this.precision)}compareLine(e,t,a=0,l=!1){if(!bf(e,t))return!1;let o=e,m=t;if(l&&!this.compareCoord(o[0],m[0])){let b=this.fixStartIndex(m,o);if(b)m=b;else return!1}let g=this.compareCoord(o[a],m[a]);return this.direction||g?this.comparePath(o,m):this.compareCoord(o[a],m[m.length-(1+a)])?this.comparePath(o.slice().reverse(),m):!1}fixStartIndex(e,t){let a,l=-1;for(let o=0;o<e.length;o++)if(this.compareCoord(e[o],t[0])){l=o;break}return l>=0&&(a=[].concat(e.slice(l,e.length),e.slice(1,l+1))),a}comparePath(e,t){return e.every((a,l)=>this.compareCoord(a,t[l]))}comparePolygon(e,t){if(this.compareLine(e.coordinates[0],t.coordinates[0],1,!0)){let a=e.coordinates.slice(1,e.coordinates.length),l=t.coordinates.slice(1,t.coordinates.length);return a.every(o=>l.some(m=>this.compareLine(o,m,1,!0)))}return!1}compareGeometryCollection(e,t){return bf(e.geometries,t.geometries)&&this.compareBBox(e,t)&&e.geometries.every((a,l)=>this.compare(a,t.geometries[l]))}compareFeature(e,t){return e.id===t.id&&(this.compareProperties?(0,aL.default)(e.properties,t.properties):!0)&&this.compareBBox(e,t)&&this.compare(e.geometry,t.geometry)}compareFeatureCollection(e,t){return bf(e.features,t.features)&&this.compareBBox(e,t)&&e.features.every((a,l)=>this.compare(a,t.features[l]))}compareBBox(e,t){return!e.bbox&&!t.bbox||(e.bbox&&t.bbox?this.compareCoord(e.bbox,t.bbox):!1)}};mr(WG,"GeojsonEquality");function bf(s,e){return s.coordinates?s.coordinates.length===e.coordinates.length:s.length===e.length}mr(bf,"sameLength");function kw(s){return s.coordinates.map(e=>({type:s.type.replace("Multi",""),coordinates:e}))}mr(kw,"explode");var Xi=63710088e-1,lL={centimeters:Xi*100,centimetres:Xi*100,degrees:360/(2*Math.PI),feet:Xi*3.28084,inches:Xi*39.37,kilometers:Xi/1e3,kilometres:Xi/1e3,meters:Xi,metres:Xi,miles:Xi/1609.344,millimeters:Xi*1e3,millimetres:Xi*1e3,nauticalmiles:Xi/1852,radians:1,yards:Xi*1.0936},sL={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Jo(s,e,t={}){let a={type:"Feature"};return(t.id===0||t.id)&&(a.id=t.id),t.bbox&&(a.bbox=t.bbox),a.properties=e||{},a.geometry=s,a}mr(Jo,"feature");function ZG(s,e,t={}){switch(s){case"Point":return Hi(e).geometry;case"LineString":return Ds(e).geometry;case"Polygon":return Fw(e).geometry;case"MultiPoint":return uL(e).geometry;case"MultiLineString":return cL(e).geometry;case"MultiPolygon":return hL(e).geometry;default:throw new Error(s+" is invalid")}}mr(ZG,"geometry");function Hi(s,e,t={}){if(!s)throw new Error("coordinates is required");if(!Array.isArray(s))throw new Error("coordinates must be an Array");if(s.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Sc(s[0])||!Sc(s[1]))throw new Error("coordinates must contain numbers");return Jo({type:"Point",coordinates:s},e,t)}mr(Hi,"point");function XG(s,e,t={}){return Uy(s.map(a=>Hi(a,e)),t)}mr(XG,"points");function Fw(s,e,t={}){for(let l of s){if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(l[l.length-1].length!==l[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<l[l.length-1].length;o++)if(l[l.length-1][o]!==l[0][o])throw new Error("First and last Position are not equivalent.")}return Jo({type:"Polygon",coordinates:s},e,t)}mr(Fw,"polygon");function HG(s,e,t={}){return Uy(s.map(a=>Fw(a,e)),t)}mr(HG,"polygons");function Ds(s,e,t={}){if(s.length<2)throw new Error("coordinates must be an array of two or more positions");return Jo({type:"LineString",coordinates:s},e,t)}mr(Ds,"lineString");function KG(s,e,t={}){return Uy(s.map(a=>Ds(a,e)),t)}mr(KG,"lineStrings");function Uy(s,e={}){let t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=s,t}mr(Uy,"featureCollection");function cL(s,e,t={}){return Jo({type:"MultiLineString",coordinates:s},e,t)}mr(cL,"multiLineString");function uL(s,e,t={}){return Jo({type:"MultiPoint",coordinates:s},e,t)}mr(uL,"multiPoint");function hL(s,e,t={}){return Jo({type:"MultiPolygon",coordinates:s},e,t)}mr(hL,"multiPolygon");function YG(s,e,t={}){return Jo({type:"GeometryCollection",geometries:s},e,t)}mr(YG,"geometryCollection");function JG(s,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");let t=Math.pow(10,e||0);return Math.round(s*t)/t}mr(JG,"round");function pL(s,e="kilometers"){let t=lL[e];if(!t)throw new Error(e+" units is invalid");return s*t}mr(pL,"radiansToLength");function Lw(s,e="kilometers"){let t=lL[e];if(!t)throw new Error(e+" units is invalid");return s/t}mr(Lw,"lengthToRadians");function QG(s,e){return Gy(Lw(s,e))}mr(QG,"lengthToDegrees");function eV(s){let e=s%360;return e<0&&(e+=360),e}mr(eV,"bearingToAzimuth");function Gy(s){return s%(2*Math.PI)*180/Math.PI}mr(Gy,"radiansToDegrees");function nl(s){return s%360*Math.PI/180}mr(nl,"degreesToRadians");function wf(s,e="kilometers",t="kilometers"){if(!(s>=0))throw new Error("length must be a positive number");return pL(Lw(s,e),t)}mr(wf,"convertLength");function tV(s,e="meters",t="kilometers"){if(!(s>=0))throw new Error("area must be a positive number");let a=sL[e];if(!a)throw new Error("invalid original units");let l=sL[t];if(!l)throw new Error("invalid final units");return s/a*l}mr(tV,"convertArea");function Sc(s){return!isNaN(s)&&s!==null&&!Array.isArray(s)}mr(Sc,"isNumber");function jh(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}mr(jh,"isObject");function rV(s){if(!s)throw new Error("bbox is required");if(!Array.isArray(s))throw new Error("bbox must be an Array");if(s.length!==4&&s.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");s.forEach(e=>{if(!Sc(e))throw new Error("bbox must only contain numbers")})}mr(rV,"validateBBox");function iV(s){if(!s)throw new Error("id is required");if(["string","number"].indexOf(typeof s)===-1)throw new Error("id must be a number or a string")}mr(iV,"validateId");var nV=Object.defineProperty,Ki=(s,e)=>nV(s,"name",{value:e,configurable:!0});function ma(s,e,t){if(s!==null)for(var a,l,o,m,g,b,A,S=0,M=0,k,j=s.type,Z=j==="FeatureCollection",te=j==="Feature",q=Z?s.features.length:1,H=0;H<q;H++){A=Z?s.features[H].geometry:te?s.geometry:s,k=A?A.type==="GeometryCollection":!1,g=k?A.geometries.length:1;for(var ae=0;ae<g;ae++){var pe=0,ve=0;if(m=k?A.geometries[ae]:A,m!==null){b=m.coordinates;var de=m.type;switch(S=t&&(de==="Polygon"||de==="MultiPolygon")?1:0,de){case null:break;case"Point":if(e(b,M,H,pe,ve)===!1)return!1;M++,pe++;break;case"LineString":case"MultiPoint":for(a=0;a<b.length;a++){if(e(b[a],M,H,pe,ve)===!1)return!1;M++,de==="MultiPoint"&&pe++}de==="LineString"&&pe++;break;case"Polygon":case"MultiLineString":for(a=0;a<b.length;a++){for(l=0;l<b[a].length-S;l++){if(e(b[a][l],M,H,pe,ve)===!1)return!1;M++}de==="MultiLineString"&&pe++,de==="Polygon"&&ve++}de==="Polygon"&&pe++;break;case"MultiPolygon":for(a=0;a<b.length;a++){for(ve=0,l=0;l<b[a].length;l++){for(o=0;o<b[a][l].length-S;o++){if(e(b[a][l][o],M,H,pe,ve)===!1)return!1;M++}ve++}pe++}break;case"GeometryCollection":for(a=0;a<m.geometries.length;a++)if(ma(m.geometries[a],e,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}Ki(ma,"coordEach");function oV(s,e,t,a){var l=t;return ma(s,function(o,m,g,b,A){m===0&&t===void 0?l=o:l=e(l,o,m,g,b,A)},a),l}Ki(oV,"coordReduce");function dL(s,e){var t;switch(s.type){case"FeatureCollection":for(t=0;t<s.features.length&&e(s.features[t].properties,t)!==!1;t++);break;case"Feature":e(s.properties,0);break}}Ki(dL,"propEach");function sV(s,e,t){var a=t;return dL(s,function(l,o){o===0&&t===void 0?a=l:a=e(a,l,o)}),a}Ki(sV,"propReduce");function fL(s,e){if(s.type==="Feature")e(s,0);else if(s.type==="FeatureCollection")for(var t=0;t<s.features.length&&e(s.features[t],t)!==!1;t++);}Ki(fL,"featureEach");function aV(s,e,t){var a=t;return fL(s,function(l,o){o===0&&t===void 0?a=l:a=e(a,l,o)}),a}Ki(aV,"featureReduce");function lV(s){var e=[];return ma(s,function(t){e.push(t)}),e}Ki(lV,"coordAll");function Dw(s,e){var t,a,l,o,m,g,b,A,S,M,k=0,j=s.type==="FeatureCollection",Z=s.type==="Feature",te=j?s.features.length:1;for(t=0;t<te;t++){for(g=j?s.features[t].geometry:Z?s.geometry:s,A=j?s.features[t].properties:Z?s.properties:{},S=j?s.features[t].bbox:Z?s.bbox:void 0,M=j?s.features[t].id:Z?s.id:void 0,b=g?g.type==="GeometryCollection":!1,m=b?g.geometries.length:1,l=0;l<m;l++){if(o=b?g.geometries[l]:g,o===null){if(e(null,k,A,S,M)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(o,k,A,S,M)===!1)return!1;break}case"GeometryCollection":{for(a=0;a<o.geometries.length;a++)if(e(o.geometries[a],k,A,S,M)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}k++}}Ki(Dw,"geomEach");function cV(s,e,t){var a=t;return Dw(s,function(l,o,m,g,b){o===0&&t===void 0?a=l:a=e(a,l,o,m,g,b)}),a}Ki(cV,"geomReduce");function Vy(s,e){Dw(s,function(t,a,l,o,m){var g=t===null?null:t.type;switch(g){case null:case"Point":case"LineString":case"Polygon":return e(Jo(t,l,{bbox:o,id:m}),a,0)===!1?!1:void 0}var b;switch(g){case"MultiPoint":b="Point";break;case"MultiLineString":b="LineString";break;case"MultiPolygon":b="Polygon";break}for(var A=0;A<t.coordinates.length;A++){var S=t.coordinates[A],M={type:b,coordinates:S};if(e(Jo(M,l),a,A)===!1)return!1}})}Ki(Vy,"flattenEach");function uV(s,e,t){var a=t;return Vy(s,function(l,o,m){o===0&&m===0&&t===void 0?a=l:a=e(a,l,o,m)}),a}Ki(uV,"flattenReduce");function mL(s,e){Vy(s,function(t,a,l){var o=0;if(t.geometry){var m=t.geometry.type;if(!(m==="Point"||m==="MultiPoint")){var g,b=0,A=0,S=0;if(ma(t,function(M,k,j,Z,te){if(g===void 0||a>b||Z>A||te>S){g=M,b=a,A=Z,S=te,o=0;return}var q=Ds([g,M],t.properties);if(e(q,a,l,te,o)===!1)return!1;o++,g=M})===!1)return!1}}})}Ki(mL,"segmentEach");function hV(s,e,t){var a=t,l=!1;return mL(s,function(o,m,g,b,A){l===!1&&t===void 0?a=o:a=e(a,o,m,g,b,A),l=!0}),a}Ki(hV,"segmentReduce");function gL(s,e){if(!s)throw new Error("geojson is required");Vy(s,function(t,a,l){if(t.geometry!==null){var o=t.geometry.type,m=t.geometry.coordinates;switch(o){case"LineString":if(e(t,a,l,0,0)===!1)return!1;break;case"Polygon":for(var g=0;g<m.length;g++)if(e(Ds(m[g],t.properties),a,l,g)===!1)return!1;break}}})}Ki(gL,"lineEach");function pV(s,e,t){var a=t;return gL(s,function(l,o,m,g){o===0&&t===void 0?a=l:a=e(a,l,o,m,g)}),a}Ki(pV,"lineReduce");function dV(s,e){if(e=e||{},!jh(e))throw new Error("options is invalid");var t=e.featureIndex||0,a=e.multiFeatureIndex||0,l=e.geometryIndex||0,o=e.segmentIndex||0,m=e.properties,g;switch(s.type){case"FeatureCollection":t<0&&(t=s.features.length+t),m=m||s.features[t].properties,g=s.features[t].geometry;break;case"Feature":m=m||s.properties,g=s.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":g=s;break;default:throw new Error("geojson is invalid")}if(g===null)return null;var b=g.coordinates;switch(g.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=b.length+o-1),Ds([b[o],b[o+1]],m,e);case"Polygon":return l<0&&(l=b.length+l),o<0&&(o=b[l].length+o-1),Ds([b[l][o],b[l][o+1]],m,e);case"MultiLineString":return a<0&&(a=b.length+a),o<0&&(o=b[a].length+o-1),Ds([b[a][o],b[a][o+1]],m,e);case"MultiPolygon":return a<0&&(a=b.length+a),l<0&&(l=b[a].length+l),o<0&&(o=b[a][l].length-o-1),Ds([b[a][l][o],b[a][l][o+1]],m,e)}throw new Error("geojson is invalid")}Ki(dV,"findSegment");function fV(s,e){if(e=e||{},!jh(e))throw new Error("options is invalid");var t=e.featureIndex||0,a=e.multiFeatureIndex||0,l=e.geometryIndex||0,o=e.coordIndex||0,m=e.properties,g;switch(s.type){case"FeatureCollection":t<0&&(t=s.features.length+t),m=m||s.features[t].properties,g=s.features[t].geometry;break;case"Feature":m=m||s.properties,g=s.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":g=s;break;default:throw new Error("geojson is invalid")}if(g===null)return null;var b=g.coordinates;switch(g.type){case"Point":return Hi(b,m,e);case"MultiPoint":return a<0&&(a=b.length+a),Hi(b[a],m,e);case"LineString":return o<0&&(o=b.length+o),Hi(b[o],m,e);case"Polygon":return l<0&&(l=b.length+l),o<0&&(o=b[l].length+o),Hi(b[l][o],m,e);case"MultiLineString":return a<0&&(a=b.length+a),o<0&&(o=b[a].length+o),Hi(b[a][o],m,e);case"MultiPolygon":return a<0&&(a=b.length+a),l<0&&(l=b[a].length+l),o<0&&(o=b[a][l].length-o),Hi(b[a][l][o],m,e)}throw new Error("geojson is invalid")}Ki(fV,"findPoint");var mV=Object.defineProperty,gV=(s,e)=>mV(s,"name",{value:e,configurable:!0});function Ow(s,e={}){let t=0,a=0,l=0;return ma(s,function(o){t+=o[0],a+=o[1],l++},!0),Hi([t/l,a/l],e.properties)}gV(Ow,"centroid");var yV=Object.defineProperty,ol=(s,e)=>yV(s,"name",{value:e,configurable:!0});function Qo(s){if(!s)throw new Error("coord is required");if(!Array.isArray(s)){if(s.type==="Feature"&&s.geometry!==null&&s.geometry.type==="Point")return[...s.geometry.coordinates];if(s.type==="Point")return[...s.coordinates]}if(Array.isArray(s)&&s.length>=2&&!Array.isArray(s[0])&&!Array.isArray(s[1]))return[...s];throw new Error("coord must be GeoJSON Point or an Array of numbers")}ol(Qo,"getCoord");function zw(s){if(Array.isArray(s))return s;if(s.type==="Feature"){if(s.geometry!==null)return s.geometry.coordinates}else if(s.coordinates)return s.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}ol(zw,"getCoords");function yL(s){if(s.length>1&&Sc(s[0])&&Sc(s[1]))return!0;if(Array.isArray(s[0])&&s[0].length)return yL(s[0]);throw new Error("coordinates must only contain numbers")}ol(yL,"containsNumber");function _V(s,e,t){if(!e||!t)throw new Error("type and name required");if(!s||s.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+s.type)}ol(_V,"geojsonType");function xV(s,e,t){if(!s)throw new Error("No feature passed");if(!t)throw new Error(".featureOf() requires a name");if(!s||s.type!=="Feature"||!s.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!s.geometry||s.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+s.geometry.type)}ol(xV,"featureOf");function vV(s,e,t){if(!s)throw new Error("No featureCollection passed");if(!t)throw new Error(".collectionOf() requires a name");if(!s||s.type!=="FeatureCollection")throw new Error("Invalid input to "+t+", FeatureCollection required");for(let a of s.features){if(!a||a.type!=="Feature"||!a.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!a.geometry||a.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+a.geometry.type)}}ol(vV,"collectionOf");function bV(s){return s.type==="Feature"?s.geometry:s}ol(bV,"getGeom");function wV(s,e){return s.type==="FeatureCollection"?"FeatureCollection":s.type==="GeometryCollection"?"GeometryCollection":s.type==="Feature"&&s.geometry!==null?s.geometry.type:s.type}ol(wV,"getType");var SV=Object.defineProperty,_L=(s,e)=>SV(s,"name",{value:e,configurable:!0});function Nw(s,e,t={}){let a;return t.final?a=Bw(Qo(e),Qo(s)):a=Bw(Qo(s),Qo(e)),a>180?-(360-a):a}_L(Nw,"rhumbBearing");function Bw(s,e){let t=nl(s[1]),a=nl(e[1]),l=nl(e[0]-s[0]);l>Math.PI&&(l-=2*Math.PI),l<-Math.PI&&(l+=2*Math.PI);let o=Math.log(Math.tan(a/2+Math.PI/4)/Math.tan(t/2+Math.PI/4)),m=Math.atan2(l,o);return(Gy(m)+360)%360}_L(Bw,"calculateRhumbBearing");var AV=Object.defineProperty,xL=(s,e)=>AV(s,"name",{value:e,configurable:!0});function jw(s,e,t={}){let a=Qo(s),l=Qo(e);l[0]+=l[0]-a[0]>180?-360:a[0]-l[0]>180?360:0;let o=vL(a,l);return wf(o,"meters",t.units)}xL(jw,"rhumbDistance");function vL(s,e,t){t=t===void 0?Xi:Number(t);let a=t,l=s[1]*Math.PI/180,o=e[1]*Math.PI/180,m=o-l,g=Math.abs(e[0]-s[0])*Math.PI/180;g>Math.PI&&(g-=2*Math.PI);let b=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(l/2+Math.PI/4)),A=Math.abs(b)>1e-11?m/b:Math.cos(l);return Math.sqrt(m*m+A*A*g*g)*a}xL(vL,"calculateRhumbDistance");var EV=Object.defineProperty,bL=(s,e)=>EV(s,"name",{value:e,configurable:!0});function Uw(s,e,t,a={}){let l=e<0,o=wf(Math.abs(e),a.units,"meters");l&&(o=-Math.abs(o));let m=Qo(s),g=wL(m,o,t);return g[0]+=g[0]-m[0]>180?-360:m[0]-g[0]>180?360:0,Hi(g,a.properties)}bL(Uw,"rhumbDestination");function wL(s,e,t,a){a=a===void 0?Xi:Number(a);let l=e/a,o=s[0]*Math.PI/180,m=nl(s[1]),g=nl(t),b=l*Math.cos(g),A=m+b;Math.abs(A)>Math.PI/2&&(A=A>0?Math.PI-A:-Math.PI-A);let S=Math.log(Math.tan(A/2+Math.PI/4)/Math.tan(m/2+Math.PI/4)),M=Math.abs(S)>1e-11?b/S:Math.cos(m),k=l*Math.sin(g)/M;return[((o+k)*180/Math.PI+540)%360-180,A*180/Math.PI]}bL(wL,"calculateRhumbDestination");var IV=Object.defineProperty,Uh=(s,e)=>IV(s,"name",{value:e,configurable:!0});function Gw(s){if(!s)throw new Error("geojson is required");switch(s.type){case"Feature":return Vw(s);case"FeatureCollection":return SL(s);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return qy(s);default:throw new Error("unknown GeoJSON type")}}Uh(Gw,"clone");function Vw(s){let e={type:"Feature"};return Object.keys(s).forEach(t=>{switch(t){case"type":case"properties":case"geometry":return;default:e[t]=s[t]}}),e.properties=qw(s.properties),s.geometry==null?e.geometry=null:e.geometry=qy(s.geometry),e}Uh(Vw,"cloneFeature");function qw(s){let e={};return s&&Object.keys(s).forEach(t=>{let a=s[t];typeof a=="object"?a===null?e[t]=null:Array.isArray(a)?e[t]=a.map(l=>l):e[t]=qw(a):e[t]=a}),e}Uh(qw,"cloneProperties");function SL(s){let e={type:"FeatureCollection"};return Object.keys(s).forEach(t=>{switch(t){case"type":case"features":return;default:e[t]=s[t]}}),e.features=s.features.map(t=>Vw(t)),e}Uh(SL,"cloneFeatureCollection");function qy(s){let e={type:s.type};return s.bbox&&(e.bbox=s.bbox),s.type==="GeometryCollection"?(e.geometries=s.geometries.map(t=>qy(t)),e):(e.coordinates=$w(s.coordinates),e)}Uh(qy,"cloneGeometry");function $w(s){let e=s;return typeof e[0]!="object"?e.slice():e.map(t=>$w(t))}Uh($w,"deepSlice");var PV=Object.defineProperty,TV=(s,e)=>PV(s,"name",{value:e,configurable:!0});function AL(s,e,t){if(t=t||{},!jh(t))throw new Error("options is invalid");var a=t.pivot,l=t.mutate;if(!s)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("angle is required");return e===0||(a||(a=Ow(s)),(l===!1||l===void 0)&&(s=Gw(s)),ma(s,function(o){var m=Nw(a,o),g=m+e,b=jw(a,o),A=zw(Uw(a,b,g));o[0]=A[0],o[1]=A[1]})),s}TV(AL,"transformRotate");var Ww=AL;var CV=(s,e=1)=>{let{height:t,width:a}=s.getCanvas(),l=s.unproject({x:0,y:0}),o=s.unproject({x:0,y:t/e}),m=s.unproject({x:a/e,y:t/e}),g=s.unproject({x:a/e,y:0});return[[l.lng,l.lat],[g.lng,g.lat],[m.lng,m.lat],[o.lng,o.lat]]},$y=CV;var MV=s=>{let e=s.getBounds().toArray(),t=Ai(e[0]),a=Ai(e[1]),l=[...t,...a],{width:o,height:m}=s.getCanvas(),g=kr(l)/o,b=si(l)/m;return Math.max(g,b)},EL=MV;var RV=s=>dd(s.toArray().flat(),"EPSG:4326","EPSG:3857"),Zw=RV;var Xw=class extends Eg(Rg){constructor(e={}){let t=document.createElement("canvas");super({canvas:t,id:"realtime",...e}),this.source={id:this.id,type:"canvas",canvas:this.canvas,coordinates:[[0,0],[1,1],[2,2],[0,0]],animate:!0,attribution:e.attribution?.join(", "),loaded:!0},this.layer={id:`${this.id}-raster`,type:"raster",source:this.id,layout:{visibility:"visible"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this)}onAdd(e,t){super.onAdd(e,t),e.isStyleLoaded()&&this.onLoad(),e.on("load",this.onLoad)}onRemove(e,t){e.off("load",this.onLoad),e.getLayer(this.layer.id)&&e.removeLayer(this.layer.id),e.getSource(this.id)&&e.removeSource(this.id),super.onRemove(e,t)}onLoad(){this.map.getSource(this.id)||this.map.addSource(this.id,this.source),this.map.getLayer(this.layer.id)||this.map.addLayer(this.layer,this.id),this.start()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map?.off("move",this.onMove),this.map?.off("moveend",this.onMoveEnd),this.map?.off("zoomend",this.onZoomEnd)}renderTrajectories(e=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:t,height:a}=this.map.getCanvas(),l=this.map.getCenter(),o=this.map.unproject({x:0,y:a/this.pixelRatio}),m=this.map.unproject({x:t/this.pixelRatio,y:0}),g=Ww(Hi([o.lng,o.lat]),-this.map.getBearing(),{pivot:[l.lng,l.lat]}).geometry.coordinates,b=Ww(Hi([m.lng,m.lat]),-this.map.getBearing(),{pivot:[l.lng,l.lat]}).geometry.coordinates,A=[...Ai(g),...Ai(b)],S=kr(A)/(t/this.pixelRatio),M=si(A)/(a/this.pixelRatio),k=Math.max(S,M),j={size:[t/this.pixelRatio,a/this.pixelRatio],center:Ai([l.lng,l.lat]),extent:A,resolution:k,zoom:this.map.getZoom()-1,rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(j,e)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}purgeTrajectory(e,t,a){return super.purgeTrajectory(e,t||Zw(this.map.getBounds()),a||Math.floor(this.map.getZoom()-1))}setBbox(e,t){super.setBbox(e||Zw(this.map.getBounds()),t||this.map.getZoom()-1)}renderTrajectoriesInternal(e,t=!1){let a=super.renderTrajectoriesInternal(e,t);if(a&&this.map.style){let l=$y(this.map,this.pixelRatio),o=this.map.getSource(this.id);o&&o.setCoordinates(l)}return a}onMove(){this.renderTrajectories()}onMoveEnd(){this.renderTrajectories(),this.isUpdateBboxOnMoveEnd&&this.setBbox()}},IL=Xw;var Hw={ol:Tg,maplibre:Wy};typeof window<"u"&&(window.mbt=Hw);var Ooe=Hw;})();
588
+ `){Tt+=pt,pt=0,ut=k*ve+Ae*j,++nt;continue}let Bt=Z[dt+1]||b.font;Bt!==yt&&(l&&Ve.push("font",Bt),a&&Ue.push("font",Bt),yt=Bt),pt=Math.max(pt,ae[Qe]);let jt=[bt,ut+Ae*H[Qe]+k*(H[Qe]-pe[nt]),.5*(j+pt)+Tt];ut+=H[Qe],l&&Ve.push("strokeText",jt),a&&Ue.push("fillText",jt),++Qe}return Array.prototype.push.apply(de,Ve),Array.prototype.push.apply(de,Ue),this.labels_[o]=Re,Re}replayTextBackground_(e,t,a,l,o,m,g){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,a),e.lineTo.apply(e,l),e.lineTo.apply(e,o),e.lineTo.apply(e,t),m&&(this.alignAndScaleFill_=m[2],this.fill_(e)),g&&(this.setStrokeStyle_(e,g),e.stroke())}calculateImageOrLabelDimensions_(e,t,a,l,o,m,g,b,A,S,M,k,j,Z,te,q){g*=k[0],b*=k[1];let H=a-g,ae=l-b,pe=o+A>e?e-A:o,ve=m+S>t?t-S:m,de=Z[3]+pe*k[0]+Z[1],_e=Z[0]+ve*k[1]+Z[2],Pe=H-Z[3],Re=ae-Z[0];(te||M!==0)&&(Ya[0]=Pe,Ja[0]=Pe,Ya[1]=Re,ua[1]=Re,ua[0]=Pe+de,ha[0]=ua[0],ha[1]=Re+_e,Ja[1]=ha[1]);let Ae;return M!==0?(Ae=ln(wi(),a,l,1,1,M,-a,-l),Ni(Ae,Ya),Ni(Ae,ua),Ni(Ae,ha),Ni(Ae,Ja),ea(Math.min(Ya[0],ua[0],ha[0],Ja[0]),Math.min(Ya[1],ua[1],ha[1],Ja[1]),Math.max(Ya[0],ua[0],ha[0],Ja[0]),Math.max(Ya[1],ua[1],ha[1],Ja[1]),zu)):ea(Math.min(Pe,Pe+de),Math.min(Re,Re+_e),Math.max(Pe,Pe+de),Math.max(Re,Re+_e),zu),j&&(H=Math.round(H),ae=Math.round(ae)),{drawImageX:H,drawImageY:ae,drawImageW:pe,drawImageH:ve,originX:A,originY:S,declutterBox:{minX:zu[0],minY:zu[1],maxX:zu[2],maxY:zu[3],value:q},canvasTransform:Ae,scale:k}}replayImageOrLabel_(e,t,a,l,o,m,g){let b=!!(m||g),A=l.declutterBox,S=g?g[2]*l.scale[0]/2:0;return A.minX-S<=t[0]&&A.maxX+S>=0&&A.minY-S<=t[1]&&A.maxY+S>=0&&(b&&this.replayTextBackground_(e,Ya,ua,ha,Ja,m,g),yI(e,l.canvasTransform,o,a,l.originX,l.originY,l.drawImageW,l.drawImageH,l.drawImageX,l.drawImageY,l.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let a=Ni(this.renderedTransform_,[0,0]),l=512*this.pixelRatio;e.save(),e.translate(a[0]%l,a[1]%l),t!==1&&e.scale(t,t),e.rotate(this.viewRotation_)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6])}drawLabelWithPointPlacement_(e,t,a,l){let o=this.textStates[t],m=this.createLabel(e,t,l,a),g=this.strokeStates[a],b=this.pixelRatio,A=Sv(Array.isArray(e)?e[0]:e,o.textAlign||Xa),S=$d[o.textBaseline||Hl],M=g&&g.lineWidth?g.lineWidth:0,k=m.width/b-2*o.scale[0],j=A*k+2*(.5-A)*M,Z=S*m.height/b+2*(.5-S)*M;return{label:m,anchorX:j,anchorY:Z}}execute_(e,t,a,l,o,m,g,b){let A=this.zIndexContext_,S;this.pixelCoordinates_&&Fn(a,this.renderedTransform_)?S=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),S=zn(this.coordinates,0,this.coordinates.length,2,a,this.pixelCoordinates_),jA(this.renderedTransform_,a));let M=0,k=l.length,j=0,Z,te,q,H,ae,pe,ve,de,_e,Pe,Re,Ae,ut,Ve=0,Ue=0,pt=null,Tt=null,Qe=this.coordinateCache_,nt=this.viewRotation_,yt=Math.round(Math.atan2(-a[1],a[0])*1e12)/1e12,dt={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:nt},Rt=this.instructions!=l||this.overlaps?0:200,bt,Bt,jt,Pr;for(;M<k;){let $e=l[M];switch($e[0]){case xt.BEGIN_GEOMETRY:bt=$e[1],Pr=$e[3],bt.getGeometry()?g!==void 0&&!ei(g,Pr.getExtent())?M=$e[2]+1:++M:M=$e[2],A&&(A.zIndex=$e[4]);break;case xt.BEGIN_PATH:Ve>Rt&&(this.fill_(e),Ve=0),Ue>Rt&&(e.stroke(),Ue=0),!Ve&&!Ue&&(e.beginPath(),ae=NaN,pe=NaN),++M;break;case xt.CIRCLE:j=$e[1];let Lr=S[j],Mi=S[j+1],Ri=S[j+2],En=S[j+3],ii=Ri-Lr,In=En-Mi,Pn=Math.sqrt(ii*ii+In*In);e.moveTo(Lr+Pn,Mi),e.arc(Lr,Mi,Pn,0,2*Math.PI,!0),++M;break;case xt.CLOSE_PATH:e.closePath(),++M;break;case xt.CUSTOM:j=$e[1],Z=$e[2];let Wn=$e[3],Ee=$e[4],Zn=$e[5];dt.geometry=Wn,dt.feature=bt,M in Qe||(Qe[M]=[]);let ki=Qe[M];Zn?Zn(S,j,Z,2,ki):(ki[0]=S[j],ki[1]=S[j+1],ki.length=2),A&&(A.zIndex=$e[6]),Ee(ki,dt),++M;break;case xt.DRAW_IMAGE:j=$e[1],Z=$e[2],_e=$e[3],te=$e[4],q=$e[5];let Et=$e[6],ir=$e[7],Xn=$e[8],Tn=$e[9],Yi=$e[10],Cn=$e[11],Fi=$e[12],po=$e[13];H=$e[14]||"declutter";let Hn=$e[15];if(!_e&&$e.length>=20){Pe=$e[19],Re=$e[20],Ae=$e[21],ut=$e[22];let le=this.drawLabelWithPointPlacement_(Pe,Re,Ae,ut);_e=le.label,$e[3]=_e;let he=$e[23];te=(le.anchorX-he)*this.pixelRatio,$e[4]=te;let me=$e[24];q=(le.anchorY-me)*this.pixelRatio,$e[5]=q,Et=_e.height,$e[6]=Et,po=_e.width,$e[13]=po}let Be;$e.length>25&&(Be=$e[25]);let Ji,jr,Li;$e.length>17?(Ji=$e[16],jr=$e[17],Li=$e[18]):(Ji=sa,jr=!1,Li=!1),Yi&&yt?Cn+=nt:!Yi&&!yt&&(Cn-=nt);let fo=0;for(;j<Z;j+=2){if(Be&&Be[fo++]<po/this.pixelRatio)continue;let le=this.calculateImageOrLabelDimensions_(_e.width,_e.height,S[j],S[j+1],po,Et,te,q,Xn,Tn,Cn,Fi,o,Ji,jr||Li,bt),he=[e,t,_e,le,ir,jr?pt:null,Li?Tt:null];if(b){let me,se,Se;if(Hn){let De=Z-j;if(!Hn[De]){Hn[De]={args:he,declutterMode:H};continue}let Ke=Hn[De];me=Ke.args,se=Ke.declutterMode,delete Hn[De],Se=qI(me)}let Ce,be;if(me&&(se!=="declutter"||!b.collides(Se))&&(Ce=!0),(H!=="declutter"||!b.collides(le.declutterBox))&&(be=!0),se==="declutter"&&H==="declutter"){let De=Ce&&be;Ce=De,be=De}Ce&&(se!=="none"&&b.insert(Se),this.replayImageOrLabel_.apply(this,me)),be&&(H!=="none"&&b.insert(le.declutterBox),this.replayImageOrLabel_.apply(this,he))}else this.replayImageOrLabel_.apply(this,he)}++M;break;case xt.DRAW_CHARS:let je=$e[1],Ct=$e[2],ft=$e[3],ci=$e[4];ut=$e[5];let dn=$e[6],wt=$e[7],fn=$e[8];Ae=$e[9];let mn=$e[10];Pe=$e[11],Re=$e[12];let Kn=[$e[13],$e[13]];H=$e[14]||"declutter";let Qi=this.textStates[Re],ie=Qi.font,N=[Qi.scale[0]*wt,Qi.scale[1]*wt],B;ie in this.widths_?B=this.widths_[ie]:(B={},this.widths_[ie]=B);let $=Ym(S,je,Ct,2),Q=Math.abs(N[0])*q0(ie,Pe,B);if(ci||Q<=$){let le=this.textStates[Re].textAlign,he=($-Q)*Sv(Pe,le),me=VI(S,je,Ct,2,Pe,he,dn,Math.abs(N[0]),q0,ie,B,yt?0:this.viewRotation_);e:if(me){let se=[],Se,Ce,be,De,Ke;if(Ae)for(Se=0,Ce=me.length;Se<Ce;++Se){Ke=me[Se],be=Ke[4],De=this.createLabel(be,Re,"",Ae),te=Ke[2]+(N[0]<0?-mn:mn),q=ft*De.height+(.5-ft)*2*mn*N[1]/N[0]-fn;let ot=this.calculateImageOrLabelDimensions_(De.width,De.height,Ke[0],Ke[1],De.width,De.height,te,q,0,0,Ke[3],Kn,!1,sa,!1,bt);if(b&&H==="declutter"&&b.collides(ot.declutterBox))break e;se.push([e,t,De,ot,1,null,null])}if(ut)for(Se=0,Ce=me.length;Se<Ce;++Se){Ke=me[Se],be=Ke[4],De=this.createLabel(be,Re,ut,""),te=Ke[2],q=ft*De.height-fn;let ot=this.calculateImageOrLabelDimensions_(De.width,De.height,Ke[0],Ke[1],De.width,De.height,te,q,0,0,Ke[3],Kn,!1,sa,!1,bt);if(b&&H==="declutter"&&b.collides(ot.declutterBox))break e;se.push([e,t,De,ot,1,null,null])}b&&H!=="none"&&b.load(se.map(qI));for(let ot=0,At=se.length;ot<At;++ot)this.replayImageOrLabel_.apply(this,se[ot])}}++M;break;case xt.END_GEOMETRY:if(m!==void 0){bt=$e[1];let le=m(bt,Pr,H);if(le)return le}++M;break;case xt.FILL:Rt?Ve++:this.fill_(e),++M;break;case xt.MOVE_TO_LINE_TO:for(j=$e[1],Z=$e[2],Bt=S[j],jt=S[j+1],e.moveTo(Bt,jt),ae=Bt+.5|0,pe=jt+.5|0,j+=2;j<Z;j+=2)Bt=S[j],jt=S[j+1],ve=Bt+.5|0,de=jt+.5|0,(j==Z-2||ve!==ae||de!==pe)&&(e.lineTo(Bt,jt),ae=ve,pe=de);++M;break;case xt.SET_FILL_STYLE:pt=$e,this.alignAndScaleFill_=$e[2],Ve&&(this.fill_(e),Ve=0,Ue&&(e.stroke(),Ue=0)),e.fillStyle=$e[1],++M;break;case xt.SET_STROKE_STYLE:Tt=$e,Ue&&(e.stroke(),Ue=0),this.setStrokeStyle_(e,$e),++M;break;case xt.STROKE:Rt?Ue++:e.stroke(),++M;break;default:++M;break}}Ve&&this.fill_(e),Ue&&e.stroke()}execute(e,t,a,l,o,m){this.viewRotation_=l,this.execute_(e,t,a,this.instructions,o,void 0,void 0,m)}executeHitDetection(e,t,a,l,o){return this.viewRotation_=a,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,l,o)}},WI=Av;var Yl=["Polygon","Circle","LineString","Image","Text","Default"],Pv=["Image","Text"],ZI=Yl.filter(s=>!Pv.includes(s)),Iv=class{constructor(e,t,a,l,o,m,g){this.maxExtent_=e,this.overlaps_=l,this.pixelRatio_=a,this.resolution_=t,this.renderBuffer_=m,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=wi(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(o,g)}clip(e,t){let a=this.getClipCoords(t);e.beginPath(),e.moveTo(a[0],a[1]),e.lineTo(a[2],a[3]),e.lineTo(a[4],a[5]),e.lineTo(a[6],a[7]),e.clip()}createExecutors_(e,t){for(let a in e){let l=this.executorsByZIndex_[a];l===void 0&&(l={},this.executorsByZIndex_[a]=l);let o=e[a];for(let m in o){let g=o[m];l[m]=new WI(this.resolution_,this.pixelRatio_,this.overlaps_,g,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let a=this.executorsByZIndex_[t];for(let l=0,o=e.length;l<o;++l)if(e[l]in a)return!0}return!1}forEachFeatureAtCoordinate(e,t,a,l,o,m){l=Math.round(l);let g=l*2+1,b=ln(this.hitDetectionTransform_,l+.5,l+.5,1/t,-1/t,-a,-e[0],-e[1]),A=!this.hitDetectionContext_;A&&(this.hitDetectionContext_=Xr(g,g,void 0,{willReadFrequently:!0}));let S=this.hitDetectionContext_;S.canvas.width!==g||S.canvas.height!==g?(S.canvas.width=g,S.canvas.height=g):A||S.clearRect(0,0,g,g);let M;this.renderBuffer_!==void 0&&(M=On(),Cx(M,e),Ln(M,t*(this.renderBuffer_+l),M));let k=xB(l),j;function Z(de,_e,Pe){let Re=S.getImageData(0,0,g,g).data;for(let Ae=0,ut=k.length;Ae<ut;Ae++)if(Re[k[Ae]]>0){if(!m||Pe==="none"||j!=="Image"&&j!=="Text"||m.includes(de)){let Ve=(k[Ae]-3)/4,Ue=l-Ve%g,pt=l-(Ve/g|0),Tt=o(de,_e,Ue*Ue+pt*pt);if(Tt)return Tt}S.clearRect(0,0,g,g);break}}let te=Object.keys(this.executorsByZIndex_).map(Number);te.sort(Bo);let q,H,ae,pe,ve;for(q=te.length-1;q>=0;--q){let de=te[q].toString();for(ae=this.executorsByZIndex_[de],H=Yl.length-1;H>=0;--H)if(j=Yl[H],pe=ae[j],pe!==void 0&&(ve=pe.executeHitDetection(S,b,a,Z,M),ve))return ve}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let a=t[0],l=t[1],o=t[2],m=t[3],g=[a,l,a,m,o,m,o,l];return zn(g,0,8,2,e,g),g}isEmpty(){return lo(this.executorsByZIndex_)}execute(e,t,a,l,o,m,g){let b=Object.keys(this.executorsByZIndex_).map(Number);b.sort(Bo),m=m||Yl;let A=Yl.length,S,M,k,j,Z;for(g&&b.reverse(),S=0,M=b.length;S<M;++S){let te=b[S].toString();for(Z=this.executorsByZIndex_[te],k=0,j=m.length;k<j;++k){let q=m[k],H=Z[q];if(H!==void 0){let ae=g===null?void 0:H.getZIndexContext(),pe=ae?ae.getContext():e,ve=this.maxExtent_&&q!=="Image"&&q!=="Text";if(ve&&(pe.save(),this.clip(pe,a)),!ae||q==="Text"||q==="Image"?H.execute(pe,t,a,l,o,g):ae.pushFunction(de=>H.execute(de,t,a,l,o,g)),ve&&pe.restore(),ae){ae.offset();let de=b[S]*A+k;this.deferredZIndexContexts_[de]||(this.deferredZIndexContexts_[de]=[]),this.deferredZIndexContexts_[de].push(ae)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Bo);for(let a=0,l=t.length;a<l;++a)e[t[a]].forEach(o=>{o.draw(this.renderedContext_),o.clear()}),e[t[a]].length=0}},Ev={};function xB(s){if(Ev[s]!==void 0)return Ev[s];let e=s*2+1,t=s*s,a=new Array(t+1);for(let o=0;o<=s;++o)for(let m=0;m<=s;++m){let g=o*o+m*m;if(g>t)break;let b=a[g];b||(b=[],a[g]=b),b.push(((s+o)*e+(s+m))*4+3),o>0&&b.push(((s-o)*e+(s+m))*4+3),m>0&&(b.push(((s+o)*e+(s-m))*4+3),o>0&&b.push(((s-o)*e+(s-m))*4+3))}let l=[];for(let o=0,m=a.length;o<m;++o)a[o]&&l.push(...a[o]);return Ev[s]=l,l}var XI=Iv;var Tv=class extends yg{constructor(e,t,a,l,o,m,g){super(),this.context_=e,this.pixelRatio_=t,this.extent_=a,this.transform_=l,this.transformRotation_=l?cE(Math.atan2(l[1],l[0]),10):0,this.viewRotation_=o,this.squaredTolerance_=m,this.userTransform_=g,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=wi()}drawImages_(e,t,a,l){if(!this.image_)return;let o=zn(e,t,a,l,this.transform_,this.pixelCoordinates_),m=this.context_,g=this.tmpLocalTransform_,b=m.globalAlpha;this.imageOpacity_!=1&&(m.globalAlpha=b*this.imageOpacity_);let A=this.imageRotation_;this.transformRotation_===0&&(A-=this.viewRotation_),this.imageRotateWithView_&&(A+=this.viewRotation_);for(let S=0,M=o.length;S<M;S+=2){let k=o[S]-this.imageAnchorX_,j=o[S+1]-this.imageAnchorY_;if(A!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let Z=k+this.imageAnchorX_,te=j+this.imageAnchorY_;ln(g,Z,te,1,1,A,-Z,-te),m.save(),m.transform.apply(m,g),m.translate(Z,te),m.scale(this.imageScale_[0],this.imageScale_[1]),m.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),m.restore()}else m.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,k,j,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(m.globalAlpha=b)}drawText_(e,t,a,l){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let o=zn(e,t,a,l,this.transform_,this.pixelCoordinates_),m=this.context_,g=this.textRotation_;for(this.transformRotation_===0&&(g-=this.viewRotation_),this.textRotateWithView_&&(g+=this.viewRotation_);t<a;t+=l){let b=o[t]+this.textOffsetX_,A=o[t+1]+this.textOffsetY_;g!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(m.save(),m.translate(b-this.textOffsetX_,A-this.textOffsetY_),m.rotate(g),m.translate(this.textOffsetX_,this.textOffsetY_),m.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&m.strokeText(this.text_,0,0),this.textFillState_&&m.fillText(this.text_,0,0),m.restore()):(this.textStrokeState_&&m.strokeText(this.text_,b,A),this.textFillState_&&m.fillText(this.text_,b,A))}}moveToLineTo_(e,t,a,l,o){let m=this.context_,g=zn(e,t,a,l,this.transform_,this.pixelCoordinates_);m.moveTo(g[0],g[1]);let b=g.length;o&&(b-=2);for(let A=2;A<b;A+=2)m.lineTo(g[A],g[A+1]);return o&&m.closePath(),a}drawRings_(e,t,a,l){for(let o=0,m=a.length;o<m;++o)t=this.moveToLineTo_(e,t,a[o],l,!0);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ei(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=AE(e,this.transform_,this.pixelCoordinates_),a=t[2]-t[0],l=t[3]-t[1],o=Math.sqrt(a*a+l*l),m=this.context_;m.beginPath(),m.arc(t[0],t[1],o,0,2*Math.PI),this.fillState_&&m.fill(),this.strokeState_&&m.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){let a=t.getGeometryFunction()(e);a&&(this.setStyle(t),this.drawGeometry(a))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let a=0,l=t.length;a<l;++a)this.drawGeometry(t[a])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),a=e.getStride();this.image_&&this.drawImages_(t,0,t.length,a),this.text_!==""&&this.drawText_(t,0,t.length,a)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),a=e.getStride();this.image_&&this.drawImages_(t,0,t.length,a),this.text_!==""&&this.drawText_(t,0,t.length,a)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ei(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,a=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(a,0,a.length,e.getStride(),!1),t.stroke()}if(this.text_!==""){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(ei(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let a=this.context_,l=e.getFlatCoordinates(),o=0,m=e.getEnds(),g=e.getStride();a.beginPath();for(let b=0,A=m.length;b<A;++b)o=this.moveToLineTo_(l,o,m[b],g,!1);a.stroke()}if(this.text_!==""){let a=e.getFlatMidpoints();this.drawText_(a,0,a.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ei(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride()),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ei(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,a=e.getOrientedFlatCoordinates(),l=0,o=e.getEndss(),m=e.getStride();t.beginPath();for(let g=0,b=o.length;g<b;++g){let A=o[g];l=this.drawRings_(a,l,A,m)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,a=this.contextFillState_;a?a.fillStyle!=e.fillStyle&&(a.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,a=this.contextStrokeState_;a?(a.lineCap!=e.lineCap&&(a.lineCap=e.lineCap,t.lineCap=e.lineCap),Fn(a.lineDash,e.lineDash)||t.setLineDash(a.lineDash=e.lineDash),a.lineDashOffset!=e.lineDashOffset&&(a.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),a.lineJoin!=e.lineJoin&&(a.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),a.lineWidth!=e.lineWidth&&(a.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),a.miterLimit!=e.miterLimit&&(a.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),a.strokeStyle!=e.strokeStyle&&(a.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,a=this.contextTextState_,l=e.textAlign?e.textAlign:Xa;a?(a.font!=e.font&&(a.font=e.font,t.font=e.font),a.textAlign!=l&&(a.textAlign=l,t.textAlign=l),a.textBaseline!=e.textBaseline&&(a.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=l,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:l,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let a=e.getColor();this.fillState_={fillStyle:jn(a||li)}}if(!t)this.strokeState_=null;else{let a=t.getColor(),l=t.getLineCap(),o=t.getLineDash(),m=t.getLineDashOffset(),g=t.getLineJoin(),b=t.getWidth(),A=t.getMiterLimit(),S=o||Un;this.strokeState_={lineCap:l!==void 0?l:ys,lineDash:this.pixelRatio_===1?S:S.map(M=>M*this.pixelRatio_),lineDashOffset:(m||Gn)*this.pixelRatio_,lineJoin:g!==void 0?g:_s,lineWidth:(b!==void 0?b:aa)*this.pixelRatio_,miterLimit:A!==void 0?A:na,strokeStyle:jn(a||oa)}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let a=e.getPixelRatio(this.pixelRatio_),l=e.getAnchor(),o=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=l[0]*a,this.imageAnchorY_=l[1]*a,this.imageHeight_=t[1]*a,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=o[0],this.imageOriginY_=o[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let m=e.getScaleArray();this.imageScale_=[m[0]*this.pixelRatio_/a,m[1]*this.pixelRatio_/a],this.imageWidth_=t[0]*a}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let j=t.getColor();this.textFillState_={fillStyle:jn(j||li)}}let a=e.getStroke();if(!a)this.textStrokeState_=null;else{let j=a.getColor(),Z=a.getLineCap(),te=a.getLineDash(),q=a.getLineDashOffset(),H=a.getLineJoin(),ae=a.getWidth(),pe=a.getMiterLimit();this.textStrokeState_={lineCap:Z!==void 0?Z:ys,lineDash:te||Un,lineDashOffset:q||Gn,lineJoin:H!==void 0?H:_s,lineWidth:ae!==void 0?ae:aa,miterLimit:pe!==void 0?pe:na,strokeStyle:jn(j||oa)}}let l=e.getFont(),o=e.getOffsetX(),m=e.getOffsetY(),g=e.getRotateWithView(),b=e.getRotation(),A=e.getScaleArray(),S=e.getText(),M=e.getTextAlign(),k=e.getTextBaseline();this.textState_={font:l!==void 0?l:ug,textAlign:M!==void 0?M:Xa,textBaseline:k!==void 0?k:Hl},this.text_=S!==void 0?Array.isArray(S)?S.reduce((j,Z,te)=>j+=te%2?" ":Z,""):S:"",this.textOffsetX_=o!==void 0?this.pixelRatio_*o:0,this.textOffsetY_=m!==void 0?this.pixelRatio_*m:0,this.textRotateWithView_=g!==void 0?g:!1,this.textRotation_=b!==void 0?b:0,this.textScale_=[this.pixelRatio_*A[0],this.pixelRatio_*A[1]]}}},HI=Tv;var Ko=.5;function KI(s,e,t,a,l,o,m,g,b){let A=b?ds(l,b):l,S=s[0]*Ko,M=s[1]*Ko,k=Xr(S,M);k.imageSmoothingEnabled=!1;let j=k.canvas,Z=new HI(k,Ko,l,null,m,g,b?Au(co(),b):null),te=t.length,q=Math.floor((256*256*256-1)/te),H={};for(let pe=1;pe<=te;++pe){let ve=t[pe-1],de=ve.getStyleFunction()||a;if(!de)continue;let _e=de(ve,o);if(!_e)continue;Array.isArray(_e)||(_e=[_e]);let Re=(pe*q).toString(16).padStart(7,"#00000");for(let Ae=0,ut=_e.length;Ae<ut;++Ae){let Ve=_e[Ae],Ue=Ve.getGeometryFunction()(ve);if(!Ue||!ei(A,Ue.getExtent()))continue;let pt=Ve.clone(),Tt=pt.getFill();Tt&&Tt.setColor(Re);let Qe=pt.getStroke();Qe&&(Qe.setColor(Re),Qe.setLineDash(null)),pt.setText(void 0);let nt=Ve.getImage();if(nt){let bt=nt.getImageSize();if(!bt)continue;let Bt=Xr(bt[0],bt[1],void 0,{alpha:!1}),jt=Bt.canvas;Bt.fillStyle=Re,Bt.fillRect(0,0,jt.width,jt.height),pt.setImage(new Dd({img:jt,anchor:nt.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:nt.getOrigin(),opacity:1,size:nt.getSize(),scale:nt.getScale(),rotation:nt.getRotation(),rotateWithView:nt.getRotateWithView()}))}let yt=pt.getZIndex()||0,dt=H[yt];dt||(dt={},H[yt]=dt,dt.Polygon=[],dt.Circle=[],dt.LineString=[],dt.Point=[]);let Rt=Ue.getType();if(Rt==="GeometryCollection"){let bt=Ue.getGeometriesArrayRecursive();for(let Bt=0,jt=bt.length;Bt<jt;++Bt){let Pr=bt[Bt];dt[Pr.getType().replace("Multi","")].push(Pr,pt)}}else dt[Rt.replace("Multi","")].push(Ue,pt)}}let ae=Object.keys(H).map(Number).sort(Bo);for(let pe=0,ve=ae.length;pe<ve;++pe){let de=H[ae[pe]];for(let _e in de){let Pe=de[_e];for(let Re=0,Ae=Pe.length;Re<Ae;Re+=2){Z.setStyle(Pe[Re+1]);for(let ut=0,Ve=e.length;ut<Ve;++ut)Z.setTransform(e[ut]),Z.drawGeometry(Pe[Re])}}}return k.getImageData(0,0,j.width,j.height)}function YI(s,e,t){let a=[];if(t){let l=Math.floor(Math.round(s[0])*Ko),o=Math.floor(Math.round(s[1])*Ko),m=(Br(l,0,t.width-1)+Br(o,0,t.height-1)*t.width)*4,g=t.data[m],b=t.data[m+1],S=t.data[m+2]+256*(b+256*g),M=Math.floor((256*256*256-1)/e.length);S&&S%M===0&&a.push(e[S/M-1])}return a}var vB=.5,JI={Point:PB,LineString:AB,Polygon:CB,MultiPoint:TB,MultiLineString:EB,MultiPolygon:IB,GeometryCollection:SB,Circle:bB};function QI(s,e){return parseInt(Ut(s),10)-parseInt(Ut(e),10)}function Cv(s,e){let t=Mv(s,e);return t*t}function Mv(s,e){return vB*s/e}function bB(s,e,t,a,l){let o=t.getFill(),m=t.getStroke();if(o||m){let b=s.getBuilder(t.getZIndex(),"Circle");b.setFillStrokeStyle(o,m),b.drawCircle(e,a,l)}let g=t.getText();if(g&&g.getText()){let b=s.getBuilder(t.getZIndex(),"Text");b.setTextStyle(g),b.drawText(e,a)}}function Rv(s,e,t,a,l,o,m,g){let b=[],A=t.getImage();if(A){let k=!0,j=A.getImageState();j==Mt.LOADED||j==Mt.ERROR?k=!1:j==Mt.IDLE&&A.load(),k&&b.push(A.ready())}let S=t.getFill();S&&S.loading()&&b.push(S.ready());let M=b.length>0;return M&&Promise.all(b).then(()=>l(null)),wB(s,e,t,a,o,m,g),M}function wB(s,e,t,a,l,o,m){let g=t.getGeometryFunction()(e);if(!g)return;let b=g.simplifyTransformed(a,l);if(t.getRenderer())e2(s,b,t,e,m);else{let S=JI[b.getType()];S(s,b,t,e,m,o)}}function e2(s,e,t,a,l){if(e.getType()=="GeometryCollection"){let m=e.getGeometries();for(let g=0,b=m.length;g<b;++g)e2(s,m[g],t,a,l);return}s.getBuilder(t.getZIndex(),"Default").drawCustom(e,a,t.getRenderer(),t.getHitDetectionRenderer(),l)}function SB(s,e,t,a,l,o){let m=e.getGeometriesArray(),g,b;for(g=0,b=m.length;g<b;++g){let A=JI[m[g].getType()];A(s,m[g],t,a,l,o)}}function AB(s,e,t,a,l){let o=t.getStroke();if(o){let g=s.getBuilder(t.getZIndex(),"LineString");g.setFillStrokeStyle(null,o),g.drawLineString(e,a,l)}let m=t.getText();if(m&&m.getText()){let g=s.getBuilder(t.getZIndex(),"Text");g.setTextStyle(m),g.drawText(e,a,l)}}function EB(s,e,t,a,l){let o=t.getStroke();if(o){let g=s.getBuilder(t.getZIndex(),"LineString");g.setFillStrokeStyle(null,o),g.drawMultiLineString(e,a,l)}let m=t.getText();if(m&&m.getText()){let g=s.getBuilder(t.getZIndex(),"Text");g.setTextStyle(m),g.drawText(e,a,l)}}function IB(s,e,t,a,l){let o=t.getFill(),m=t.getStroke();if(m||o){let b=s.getBuilder(t.getZIndex(),"Polygon");b.setFillStrokeStyle(o,m),b.drawMultiPolygon(e,a,l)}let g=t.getText();if(g&&g.getText()){let b=s.getBuilder(t.getZIndex(),"Text");b.setTextStyle(g),b.drawText(e,a,l)}}function PB(s,e,t,a,l,o){let m=t.getImage(),g=t.getText(),b=g&&g.getText(),A=o&&m&&b?{}:void 0;if(m){if(m.getImageState()!=Mt.LOADED)return;let S=s.getBuilder(t.getZIndex(),"Image");S.setImageStyle(m,A),S.drawPoint(e,a,l)}if(b){let S=s.getBuilder(t.getZIndex(),"Text");S.setTextStyle(g,A),S.drawText(e,a,l)}}function TB(s,e,t,a,l,o){let m=t.getImage(),g=m&&m.getOpacity()!==0,b=t.getText(),A=b&&b.getText(),S=o&&g&&A?{}:void 0;if(g){if(m.getImageState()!=Mt.LOADED)return;let M=s.getBuilder(t.getZIndex(),"Image");M.setImageStyle(m,S),M.drawMultiPoint(e,a,l)}if(A){let M=s.getBuilder(t.getZIndex(),"Text");M.setTextStyle(b,S),M.drawText(e,a,l)}}function CB(s,e,t,a,l){let o=t.getFill(),m=t.getStroke();if(o||m){let b=s.getBuilder(t.getZIndex(),"Polygon");b.setFillStrokeStyle(o,m),b.drawPolygon(e,a,l)}let g=t.getText();if(g&&g.getText()){let b=s.getBuilder(t.getZIndex(),"Text");b.setTextStyle(g),b.drawText(e,a,l)}}var kv=class extends xg{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=On(),this.wrappedRenderedExtent_=On(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,a){let l=t.extent,o=t.viewState,m=o.center,g=o.resolution,b=o.projection,A=o.rotation,S=b.getExtent(),M=this.getLayer().getSource(),k=this.getLayer().getDeclutter(),j=t.pixelRatio,Z=t.viewHints,te=!(Z[Bn.ANIMATING]||Z[Bn.INTERACTING]),q=this.context,H=Math.round(kr(l)/g*j),ae=Math.round(si(l)/g*j),pe=M.getWrapX()&&b.canWrapX(),ve=pe?kr(S):null,de=pe?Math.ceil((l[2]-S[2])/ve)+1:1,_e=pe?Math.floor((l[0]-S[0])/ve):0;do{let Pe=this.getRenderTransform(m,g,0,j,H,ae,_e*ve);t.declutter&&(Pe=Pe.slice(0)),e.execute(q,[q.canvas.width,q.canvas.height],Pe,A,te,a===void 0?Yl:a?Pv:ZI,a?k&&t.declutter[k]:void 0)}while(++_e<de)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Xr(this.context.canvas.width,this.context.canvas.height,wv))}resetDrawContext_(){if(this.opacity_!==1){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,JE(this.context),wv.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(e,t){let a=e.layerStatesArray[e.layerIndex];this.opacity_=a.opacity;let l=e.viewState;this.prepareContainer(e,t);let o=this.context,m=this.replayGroup_,g=m&&!m.isEmpty();if(!g&&!(this.getLayer().hasListener(ms.PRERENDER)||this.getLayer().hasListener(ms.POSTRENDER)))return null;this.setDrawContext_(),this.preRender(o,e);let b=l.projection;if(this.clipped_=!1,g&&a.extent&&this.clipping){let A=fs(a.extent,b);g=ei(A,e.extent),this.clipped_=g&&!Qs(A,e.extent),this.clipped_&&this.clipUnrotated(o,e,A)}return g&&this.renderWorlds(m,e,this.getLayer().getDeclutter()?!1:void 0),!e.declutter&&this.clipped_&&o.restore(),this.postRender(o,e),this.renderedRotation_!==l.rotation&&(this.renderedRotation_=l.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let a=this.frameState.size.slice(),l=this.renderedCenter_,o=this.renderedResolution_,m=this.renderedRotation_,g=this.renderedProjection_,b=this.wrappedRenderedExtent_,A=this.getLayer(),S=[],M=a[0]*Ko,k=a[1]*Ko;S.push(this.getRenderTransform(l,o,m,Ko,M,k,0).slice());let j=A.getSource(),Z=g.getExtent();if(j.getWrapX()&&g.canWrapX()&&!Qs(Z,b)){let q=b[0],H=kr(Z),ae=0,pe;for(;q<Z[0];)--ae,pe=H*ae,S.push(this.getRenderTransform(l,o,m,Ko,M,k,pe).slice()),q+=H;for(ae=0,q=b[2];q>Z[2];)++ae,pe=H*ae,S.push(this.getRenderTransform(l,o,m,Ko,M,k,pe).slice()),q-=H}let te=co();this.hitDetectionImageData_=KI(a,S,this.renderedFeatures_,A.getStyleFunction(),b,o,m,Cv(o,this.renderedPixelRatio_),te?g:null)}t(YI(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,a,l,o){if(!this.replayGroup_)return;let m=t.viewState.resolution,g=t.viewState.rotation,b=this.getLayer(),A={},S=function(Z,te,q){let H=Ut(Z),ae=A[H];if(ae){if(ae!==!0&&q<ae.distanceSq){if(q===0)return A[H]=!0,o.splice(o.lastIndexOf(ae),1),l(Z,b,te);ae.geometry=te,ae.distanceSq=q}}else{if(q===0)return A[H]=!0,l(Z,b,te);o.push(A[H]={feature:Z,layer:b,geometry:te,distanceSq:q,callback:l})}},M,k=[this.replayGroup_],j=this.getLayer().getDeclutter();return k.some(Z=>M=Z.forEachFeatureAtCoordinate(e,m,g,a,S,j&&t.declutter[j]?t.declutter[j].all().map(te=>te.value):null)),M}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),a=t.getSource();if(!a)return!1;let l=e.viewHints[Bn.ANIMATING],o=e.viewHints[Bn.INTERACTING],m=t.getUpdateWhileAnimating(),g=t.getUpdateWhileInteracting();if(this.ready&&!m&&l||!g&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let b=e.extent,A=e.viewState,S=A.projection,M=A.resolution,k=e.pixelRatio,j=t.getRevision(),Z=t.getRenderBuffer(),te=t.getRenderOrder();te===void 0&&(te=QI);let q=A.center.slice(),H=Ln(b,Z*M),ae=H.slice(),pe=[H.slice()],ve=S.getExtent();if(a.getWrapX()&&S.canWrapX()&&!Qs(ve,e.extent)){let Qe=kr(ve),nt=Math.max(kr(H)/2,Qe);H[0]=ve[0]-nt,H[2]=ve[2]+nt,dE(q,S);let yt=Dx(pe[0],S);yt[0]<ve[0]&&yt[2]<ve[2]?pe.push([yt[0]+Qe,yt[1],yt[2]+Qe,yt[3]]):yt[0]>ve[0]&&yt[2]>ve[2]&&pe.push([yt[0]-Qe,yt[1],yt[2]-Qe,yt[3]])}if(this.ready&&this.renderedResolution_==M&&this.renderedRevision_==j&&this.renderedRenderOrder_==te&&this.renderedFrameDeclutter_===!!e.declutter&&Qs(this.wrappedRenderedExtent_,H))return Fn(this.renderedExtent_,ae)||(this.hitDetectionImageData_=null,this.renderedExtent_=ae),this.renderedCenter_=q,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let de=new UI(Mv(M,k),H,M,k),_e=co(),Pe;if(_e){for(let Qe=0,nt=pe.length;Qe<nt;++Qe){let yt=pe[Qe],dt=ds(yt,S);a.loadFeatures(dt,xE(M,S),_e)}Pe=Au(_e,S)}else for(let Qe=0,nt=pe.length;Qe<nt;++Qe)a.loadFeatures(pe[Qe],M,S);let Re=Cv(M,k),Ae=!0,ut=(Qe,nt)=>{let yt,dt=Qe.getStyleFunction()||t.getStyleFunction();if(dt&&(yt=dt(Qe,M)),yt){let Rt=this.renderFeature(Qe,Re,yt,de,Pe,this.getLayer().getDeclutter(),nt);Ae=Ae&&!Rt}},Ve=ds(H,S),Ue=a.getFeaturesInExtent(Ve);te&&Ue.sort(te);for(let Qe=0,nt=Ue.length;Qe<nt;++Qe)ut(Ue[Qe],Qe);this.renderedFeatures_=Ue,this.ready=Ae;let pt=de.finish(),Tt=new XI(H,M,k,a.getOverlaps(),pt,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=M,this.renderedRevision_=j,this.renderedRenderOrder_=te,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=ae,this.wrappedRenderedExtent_=H,this.renderedCenter_=q,this.renderedProjection_=S,this.renderedPixelRatio_=k,this.replayGroup_=Tt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,a,l,o,m,g){if(!a)return!1;let b=!1;if(Array.isArray(a))for(let A=0,S=a.length;A<S;++A)b=Rv(l,e,a[A],t,this.boundHandleStyleImageChange_,o,m,g)||b;else b=Rv(l,e,a,t,this.boundHandleStyleImageChange_,o,m,g);return b}},t2=kv;var Fv=class extends DI{constructor(e){super(e)}createRenderer(){return new t2(this)}},Jl=Fv;var r2=ao(J0(),1);var Lv=class{constructor(e){this.rbush_=new r2.default(e),this.items_={}}insert(e,t){let a={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(a),this.items_[Ut(t)]=a}load(e,t){let a=new Array(t.length);for(let l=0,o=t.length;l<o;l++){let m=e[l],g=t[l],b={minX:m[0],minY:m[1],maxX:m[2],maxY:m[3],value:g};a[l]=b,this.items_[Ut(g)]=b}this.rbush_.load(a)}remove(e){let t=Ut(e),a=this.items_[t];return delete this.items_[t],this.rbush_.remove(a)!==null}update(e,t){let a=this.items_[Ut(t)],l=[a.minX,a.minY,a.maxX,a.maxY];jm(l,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(l){return l.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let a;for(let l=0,o=e.length;l<o;l++)if(a=t(e[l]),a)return a;return a}isEmpty(){return lo(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return ea(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},Wd=Lv;var i2=wi(),Zd=class s{constructor(e,t,a,l,o,m){this.styleFunction,this.extent_,this.id_=m,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=a||null,this.properties_=o,this.squaredTolerance_,this.stride_=l,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Ba(this.flatCoordinates_):vu(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=bo(this.getExtent());this.flatInteriorPoints_=Sd(this.flatCoordinates_,0,this.ends_,2,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=zE(this.flatCoordinates_,this.ends_),t=eg(this.flatCoordinates_,0,e,2);this.flatInteriorPoints_=Jm(this.flatCoordinates_,0,e,2,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Zl(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,a=this.ends_;for(let l=0,o=a.length;l<o;++l){let m=a[l],g=Zl(e,t,m,2,.5);ji(this.flatMidpoints_,g),t=m}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=Zr(e);let t=e.getExtent(),a=e.getWorldExtent();if(t&&a){let l=si(a)/si(t);ln(i2,a[0],a[3],l,-l,0,0,0),zn(this.flatCoordinates_,0,this.flatCoordinates_.length,2,i2,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new s(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Dm((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);let a=this.simplifiedGeometry_.getFlatCoordinates(),l;switch(this.type_){case"LineString":a.length=Wl(a,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,a,0),l=[a.length];break;case"MultiLineString":l=[],a.length=Xm(a,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,a,0,l);break;case"Polygon":l=[],a.length=_d(a,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),a,0,l);break;default:}return l&&(this.simplifiedGeometry_=new s(this.type_,a,l,2,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}};Zd.prototype.getFlatCoordinates=Zd.prototype.getOrientedFlatCoordinates;var Eo=Zd;var Dv=class extends Si{constructor(e){super(),this.projection=Zr(e.projection),this.attributions_=n2(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible!==void 0?e.attributionsCollapsible:!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(a,l){t.viewResolver=a,t.viewRejector=l})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=n2(e),this.changed()}setState(e){this.state_=e,this.changed()}};function n2(s){return s?Array.isArray(s)?function(e){return s}:typeof s=="function"?s:function(e){return[s]}:null}var pa=Dv;var hn={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function o2(s,e){return[[-1/0,-1/0,1/0,1/0]]}var MB=!1;function RB(s,e,t,a,l,o,m){let g=new XMLHttpRequest;g.open("GET",typeof s=="function"?s(t,a,l):s,!0),e.getType()=="arraybuffer"&&(g.responseType="arraybuffer"),g.withCredentials=MB,g.onload=function(b){if(!g.status||g.status>=200&&g.status<300){let A=e.getType();try{let S;A=="text"||A=="json"?S=g.responseText:A=="xml"?S=g.responseXML||g.responseText:A=="arraybuffer"&&(S=g.response),S?o(e.readFeatures(S,{extent:t,featureProjection:l}),e.readProjection(S)):m()}catch{m()}}else m()},g.onerror=m,g.send()}function Ov(s,e){return function(t,a,l,o,m){let g=this;RB(s,e,t,a,l,function(b,A){g.addFeatures(b),o!==void 0&&o(b)},m||No)}}var ws=class extends zr{constructor(e,t,a){super(e),this.feature=t,this.features=a}},zv=class extends pa{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=No,this.format_=e.format,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(Ar(this.format_,"`format` must be set when `url` is set"),this.loader_=Ov(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:o2;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new Wd:null,this.loadedExtentsRtree_=new Wd,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let a,l;Array.isArray(e.features)?l=e.features:e.features&&(a=e.features,l=a.getArray()),!t&&a===void 0&&(a=new Rd(l)),l!==void 0&&this.addFeaturesInternal(l),a!==void 0&&this.bindFeaturesCollection_(a)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Ut(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let a=e.getGeometry();if(a){let l=a.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(l,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new ws(hn.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof Eo||(this.featureChangeKeys_[e]=[Ui(t,Ir.CHANGE,this.handleFeatureChange_,this),Ui(t,km.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let a=!0;if(t.getId()!==void 0){let l=String(t.getId());if(!(l in this.idIndex_))this.idIndex_[l]=t;else if(t instanceof Eo){let o=this.idIndex_[l];o instanceof Eo?Array.isArray(o)?o.push(t):this.idIndex_[l]=[o,t]:a=!1}else a=!1}return a&&(Ar(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),a}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],a=[],l=[];for(let o=0,m=e.length;o<m;o++){let g=e[o],b=Ut(g);this.addToIndex_(b,g)&&a.push(g)}for(let o=0,m=a.length;o<m;o++){let g=a[o],b=Ut(g);this.setupChangeEvents_(b,g);let A=g.getGeometry();if(A){let S=A.getExtent();t.push(S),l.push(g)}else this.nullGeometryFeatures_[b]=g}if(this.featuresRtree_&&this.featuresRtree_.load(t,l),this.hasListener(hn.ADDFEATURE))for(let o=0,m=a.length;o<m;o++)this.dispatchEvent(new ws(hn.ADDFEATURE,a[o]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(hn.ADDFEATURE,function(a){t||(t=!0,e.push(a.feature),t=!1)}),this.addEventListener(hn.REMOVEFEATURE,function(a){t||(t=!0,e.remove(a.feature),t=!1)}),e.addEventListener($o.ADD,a=>{t||(t=!0,this.addFeature(a.element),t=!1)}),e.addEventListener($o.REMOVE,a=>{t||(t=!0,this.removeFeature(a.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let a in this.featureChangeKeys_)this.featureChangeKeys_[a].forEach(cn);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){let a=l=>{this.removeFeatureInternal(l)};this.featuresRtree_.forEach(a);for(let l in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[l])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new ws(hn.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let a=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(a,function(l){let o=l.getGeometry();if(o instanceof Eo||o.intersectsCoordinate(e))return t(l)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(a){let l=a.getGeometry();if(l instanceof Eo||l.intersectsExtent(e)){let o=t(a);if(o)return o}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),lo(this.nullGeometryFeatures_)||ji(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(a){t.push(a)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let l=QA(e,t);return[].concat(...l.map(o=>this.featuresRtree_.getInExtent(o)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let a=e[0],l=e[1],o=null,m=[NaN,NaN],g=1/0,b=[-1/0,-1/0,1/0,1/0];return t=t||Lm,this.featuresRtree_.forEachInExtent(b,function(A){if(t(A)){let S=A.getGeometry(),M=g;if(g=S instanceof Eo?0:S.closestPointXY(a,l,m,g),g<M){o=A;let k=Math.sqrt(g);b[0]=a-k,b[1]=l-k,b[2]=a+k,b[3]=l+k}}}),o}getExtent(e){return this.featuresRtree_.getExtent(e)}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,a=Ut(t),l=t.getGeometry();if(!l)a in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[a]=t);else{let m=l.getExtent();a in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[a],this.featuresRtree_&&this.featuresRtree_.insert(m,t)):this.featuresRtree_&&this.featuresRtree_.update(m,t)}let o=t.getId();if(o!==void 0){let m=o.toString();this.idIndex_[m]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[m]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[a]=t;this.changed(),this.dispatchEvent(new ws(hn.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();return t!==void 0?t in this.idIndex_:Ut(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&lo(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,a){let l=this.loadedExtentsRtree_,o=this.strategy_(e,t,a);for(let m=0,g=o.length;m<g;++m){let b=o[m];l.forEachInExtent(b,function(S){return Qs(S.extent,b)})||(++this.loadingExtentsCount_,this.dispatchEvent(new ws(hn.FEATURESLOADSTART)),this.loader_.call(this,b,t,a,S=>{--this.loadingExtentsCount_,this.dispatchEvent(new ws(hn.FEATURESLOADEND,void 0,S))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ws(hn.FEATURESLOADERROR))}),l.insert(b,{extent:b.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,a;t.forEachInExtent(e,function(l){if(jm(l.extent,e))return a=l,!0}),a&&t.remove(a)}removeFeatures(e){let t=[];for(let a=0,l=e.length;a<l;++a){let o=e[a],m=this.removeFeatureInternal(o);m&&t.push(m)}t.length>0&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Ut(e);if(!(t in this.uidIndex_))return;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(cn),delete this.featureChangeKeys_[t];let l=e.getId();if(l!==void 0){let o=l.toString(),m=this.idIndex_[o];m===e?delete this.idIndex_[o]:Array.isArray(m)&&(m.splice(m.indexOf(e),1),m.length===1&&(this.idIndex_[o]=m[0]))}return delete this.uidIndex_[t],this.hasListener(hn.REMOVEFEATURE)&&this.dispatchEvent(new ws(hn.REMOVEFEATURE,e)),e}removeFromIdIndex_(e){let t=!1;for(let a in this.idIndex_){let l=this.idIndex_[a];if(e instanceof Eo&&Array.isArray(l)&&l.includes(e))l.splice(l.indexOf(e),1);else if(this.idIndex_[a]===e){delete this.idIndex_[a],t=!0;break}}return t}setLoader(e){this.loader_=e}setUrl(e){Ar(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(Ov(e,this.format_))}},Ql=zv;var uo={SINGLECLICK:"singleclick",CLICK:Ir.CLICK,DBLCLICK:Ir.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Bv={ACTIVE:"active"};var Nv=class extends Si{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Bv.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(Bv.ACTIVE,e)}setMap(e){this.map_=e}};var s2=Nv;var jv=class extends s2{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==uo.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==uo.POINTERUP){let a=this.handleUpEvent(e);this.handlingDownUpSequence=a&&this.targetPointers.length>0}}else if(e.type==uo.POINTERDOWN){let a=this.handleDownEvent(e);this.handlingDownUpSequence=a,t=this.stopDown(a)}else e.type==uo.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};var a2=jv;var l2=function(s){let e=s.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var c2=Lm,u2=function(s){return s.type==uo.CLICK};var h2=function(s){return s.type==uo.SINGLECLICK};var p2=function(s){let e=s.originalEvent;return Ar(e!==void 0,"mapBrowserEvent must originate from a pointer event"),e.isPrimary&&e.button===0};var Uv=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Ao,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let a=t.dataProjection?Zr(t.dataProjection):this.readProjection(e);t.extent&&a&&a.getUnits()==="tile-pixels"&&(a=Zr(a),a.setWorldExtent(t.extent)),t={dataProjection:a,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return Pt()}readFeature(e,t){return Pt()}readFeatures(e,t){return Pt()}readGeometry(e,t){return Pt()}readProjection(e){return Pt()}writeFeature(e,t){return Pt()}writeFeatures(e,t){return Pt()}writeGeometry(e,t){return Pt()}},d2=Uv;function vg(s,e,t){let a=t?Zr(t.featureProjection):null,l=t?Zr(t.dataProjection):null,o=s;if(a&&l&&!_E(a,l)){e&&(o=s.clone());let m=e?a:l,g=e?l:a;m.getUnits()==="tile-pixels"?o.transform(m,g):o.applyTransform(Vl(m,g))}if(e&&t&&t.decimals!==void 0){let m=Math.pow(10,t.decimals),g=function(b){for(let A=0,S=b.length;A<S;++A)b[A]=Math.round(b[A]*m)/m;return b};o===s&&(o=s.clone()),o.applyTransform(g)}return o}var kB={Point:Ei,LineString:Go,Polygon:Iu,MultiPoint:wd,MultiLineString:i0,MultiPolygon:u0};function FB(s,e,t){return Array.isArray(e[0])?(Qm(s,0,e,t)||(s=s.slice(),Ed(s,0,e,t)),s):(Ad(s,0,e,t)||(s=s.slice(),Eu(s,0,e,t)),s)}function Gv(s,e){let t=s.geometry;if(!t)return[];if(Array.isArray(t))return t.map(o=>Gv({...s,geometry:o})).flat();let a=t.type==="MultiPolygon"?"Polygon":t.type;if(a==="GeometryCollection"||a==="Circle")throw new Error("Unsupported geometry type: "+a);let l=t.layout.length;return vg(new Eo(a,a==="Polygon"?FB(t.flatCoordinates,t.ends,l):t.flatCoordinates,t.ends?.flat(),l,s.properties||{},s.id).enableSimplifyTransformed(),!1,e)}function bg(s,e){if(!s)return null;if(Array.isArray(s)){let a=s.map(l=>bg(l,e));return new Hx(a)}let t=kB[s.type];return vg(new t(s.flatCoordinates,s.layout,s.ends),!1,e)}var Vv=class extends d2{constructor(){super()}getType(){return"json"}readFeature(e,t){return this.readFeatureFromObject(wg(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(wg(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return Pt()}readFeaturesFromObject(e,t){return Pt()}readGeometry(e,t){return this.readGeometryFromObject(wg(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return Pt()}readProjection(e){return this.readProjectionFromObject(wg(e))}readProjectionFromObject(e){return Pt()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return Pt()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return Pt()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return Pt()}};function wg(s){if(typeof s=="string"){let e=JSON.parse(s);return e||null}return s!==null?s:null}var f2=Vv;var qv=class extends f2{constructor(e){e=e||{},super(),this.dataProjection=Zr(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=Zr(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,t){let a=null;e.type==="Feature"?a=e:a={type:"Feature",geometry:e,properties:null};let l=Wv(a.geometry,t);if(this.featureClass===Eo)return Gv({geometry:l,id:a.id,properties:a.properties},t);let o=new Ao;return this.geometryName_?o.setGeometryName(this.geometryName_):this.extractGeometryName_&&a.geometry_name&&o.setGeometryName(a.geometry_name),o.setGeometry(bg(l,t)),"id"in a&&o.setId(a.id),a.properties&&o.setProperties(a.properties,!0),o}readFeaturesFromObject(e,t){let a=e,l=null;if(a.type==="FeatureCollection"){let o=e;l=[];let m=o.features;for(let g=0,b=m.length;g<b;++g){let A=this.readFeatureFromObject(m[g],t);A&&l.push(A)}}else l=[this.readFeatureFromObject(e,t)];return l.flat()}readGeometryFromObject(e,t){return LB(e,t)}readProjectionFromObject(e){let t=e.crs,a;if(t)if(t.type=="name")a=Zr(t.properties.name);else if(t.type==="EPSG")a=Zr("EPSG:"+t.properties.code);else throw new Error("Unknown SRS type");else a=this.dataProjection;return a}writeFeatureObject(e,t){t=this.adaptOptions(t);let a={type:"Feature",geometry:null,properties:null},l=e.getId();if(l!==void 0&&(a.id=l),!e.hasProperties())return a;let o=e.getProperties(),m=e.getGeometry();return m&&(a.geometry=$v(m,t),delete o[e.getGeometryName()]),lo(o)||(a.properties=o),a}writeFeaturesObject(e,t){t=this.adaptOptions(t);let a=[];for(let l=0,o=e.length;l<o;++l)a.push(this.writeFeatureObject(e[l],t));return{type:"FeatureCollection",features:a}}writeGeometryObject(e,t){return $v(e,this.adaptOptions(t))}};function Wv(s,e){if(!s)return null;let t;switch(s.type){case"Point":{t=OB(s);break}case"LineString":{t=zB(s);break}case"Polygon":{t=UB(s);break}case"MultiPoint":{t=NB(s);break}case"MultiLineString":{t=BB(s);break}case"MultiPolygon":{t=jB(s);break}case"GeometryCollection":{t=DB(s);break}default:throw new Error("Unsupported GeoJSON type: "+s.type)}return t}function LB(s,e){let t=Wv(s,e);return bg(t,e)}function DB(s,e){return s.geometries.map(function(a){return Wv(a,e)})}function OB(s){let e=s.coordinates;return{type:"Point",flatCoordinates:e,layout:ja(e.length)}}function zB(s){let e=s.coordinates,t=e.flat();return{type:"LineString",flatCoordinates:t,ends:[t.length],layout:ja(e[0]?.length||2)}}function BB(s){let e=s.coordinates,t=e[0]?.[0]?.length||2,a=[],l=Ua(a,0,e,t);return{type:"MultiLineString",flatCoordinates:a,ends:l,layout:ja(t)}}function NB(s){let e=s.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:ja(e[0]?.length||2)}}function jB(s){let e=s.coordinates,t=[],a=e[0]?.[0]?.[0].length||2,l=Zm(t,0,e,a);return{type:"MultiPolygon",flatCoordinates:t,ends:l,layout:ja(a)}}function UB(s){let e=s.coordinates,t=[],a=e[0]?.[0]?.length,l=Ua(t,0,e,a);return{type:"Polygon",flatCoordinates:t,ends:l,layout:ja(a)}}function $v(s,e){s=vg(s,!0,e);let t=s.getType(),a;switch(t){case"Point":{a=ZB(s,e);break}case"LineString":{a=VB(s,e);break}case"Polygon":{a=XB(s,e);break}case"MultiPoint":{a=$B(s,e);break}case"MultiLineString":{a=qB(s,e);break}case"MultiPolygon":{a=WB(s,e);break}case"GeometryCollection":{a=GB(s,e);break}case"Circle":{a={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+t)}return a}function GB(s,e){return e=Object.assign({},e),delete e.featureProjection,{type:"GeometryCollection",geometries:s.getGeometriesArray().map(function(a){return $v(a,e)})}}function VB(s,e){return{type:"LineString",coordinates:s.getCoordinates()}}function qB(s,e){return{type:"MultiLineString",coordinates:s.getCoordinates()}}function $B(s,e){return{type:"MultiPoint",coordinates:s.getCoordinates()}}function WB(s,e){let t;return e&&(t=e.rightHanded),{type:"MultiPolygon",coordinates:s.getCoordinates(t)}}function ZB(s,e){return{type:"Point",coordinates:s.getCoordinates()}}function XB(s,e){let t;return e&&(t=e.rightHanded),{type:"Polygon",coordinates:s.getCoordinates(t)}}var Ii=qv;var m2=0,Xd=1,g2=[0,0,0,0],Bu=[],Zv={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},Hd=class extends zr{constructor(e,t,a){super(e),this.features=t,this.mapBrowserEvent=a}},Xv=class extends a2{constructor(e){super(e),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=e.condition?e.condition:p2,this.defaultDeleteCondition_=function(a){return l2(a)&&h2(a)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:c2,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new Wd,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new Jl({source:new Ql({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:KB(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let t;if(e.features?t=e.features:e.source&&(this.source_=e.source,t=new Rd(this.source_.getFeatures()),this.source_.addEventListener(hn.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(hn.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!t)throw new Error("The modify interaction requires features, a source or a layer");e.hitDetection&&(this.hitDetection_=e.hitDetection),this.features_=t,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener($o.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener($o.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=e.snapToPointer===void 0?!this.hitDetection_:e.snapToPointer}addFeature_(e){let t=e.getGeometry();if(t){let l=this.SEGMENT_WRITERS_[t.getType()];l&&l(e,t)}let a=this.getMap();a&&a.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,a),e.addEventListener(Ir.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Rd;let a=this.featuresBeingModified_.getArray();for(let l=0,o=t.length;l<o;++l){let m=t[l];for(let g=0,b=m.length;g<b;++g){let A=m[g].feature;A&&!a.includes(A)&&this.featuresBeingModified_.push(A)}}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new Hd(Zv.MODIFYSTART,this.featuresBeingModified_,e))}}removeFeature_(e){this.removeFeatureSegmentData_(e),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.removeEventListener(Ir.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(e){let t=this.rBush_,a=[];t.forEach(function(l){e===l.feature&&a.push(l)});for(let l=a.length-1;l>=0;--l){let o=a[l];for(let m=this.dragSegments_.length-1;m>=0;--m)this.dragSegments_[m][0]===o&&this.dragSegments_.splice(m,1);t.remove(o)}}setActive(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(e)}setMap(e){this.overlay_.setMap(e),super.setMap(e)}getOverlay(){return this.overlay_}handleSourceAdd_(e){e.feature&&this.features_.push(e.feature)}handleSourceRemove_(e){e.feature&&this.features_.remove(e.feature)}handleFeatureAdd_(e){this.addFeature_(e.element)}handleFeatureChange_(e){if(!this.changingFeature_){let t=e.target;this.removeFeature_(t),this.addFeature_(t)}}handleFeatureRemove_(e){this.removeFeature_(e.element)}writePointGeometry_(e,t){let a=t.getCoordinates(),l={feature:e,geometry:t,segment:[a,a]};this.rBush_.insert(t.getExtent(),l)}writeMultiPointGeometry_(e,t){let a=t.getCoordinates();for(let l=0,o=a.length;l<o;++l){let m=a[l],g={feature:e,geometry:t,depth:[l],index:l,segment:[m,m]};this.rBush_.insert(t.getExtent(),g)}}writeLineStringGeometry_(e,t){let a=t.getCoordinates();for(let l=0,o=a.length-1;l<o;++l){let m=a.slice(l,l+2),g={feature:e,geometry:t,index:l,segment:m};this.rBush_.insert(ps(m),g)}}writeMultiLineStringGeometry_(e,t){let a=t.getCoordinates();for(let l=0,o=a.length;l<o;++l){let m=a[l];for(let g=0,b=m.length-1;g<b;++g){let A=m.slice(g,g+2),S={feature:e,geometry:t,depth:[l],index:g,segment:A};this.rBush_.insert(ps(A),S)}}}writePolygonGeometry_(e,t){let a=t.getCoordinates();for(let l=0,o=a.length;l<o;++l){let m=a[l];for(let g=0,b=m.length-1;g<b;++g){let A=m.slice(g,g+2),S={feature:e,geometry:t,depth:[l],index:g,segment:A};this.rBush_.insert(ps(A),S)}}}writeMultiPolygonGeometry_(e,t){let a=t.getCoordinates();for(let l=0,o=a.length;l<o;++l){let m=a[l];for(let g=0,b=m.length;g<b;++g){let A=m[g];for(let S=0,M=A.length-1;S<M;++S){let k=A.slice(S,S+2),j={feature:e,geometry:t,depth:[g,l],index:S,segment:k};this.rBush_.insert(ps(k),j)}}}}writeCircleGeometry_(e,t){let a=t.getCenter(),l={feature:e,geometry:t,index:m2,segment:[a,a]},o={feature:e,geometry:t,index:Xd,segment:[a,a]},m=[l,o];l.featureSegments=m,o.featureSegments=m,this.rBush_.insert(Ba(a),l);let g=t,b=co();if(b&&this.getMap()){let A=this.getMap().getView().getProjection();g=g.clone().transform(b,A),g=l0(g).transform(A,b)}this.rBush_.insert(g.getExtent(),o)}writeGeometryCollectionGeometry_(e,t){let a=t.getGeometriesArray();for(let l=0;l<a.length;++l){let o=a[l],m=this.SEGMENT_WRITERS_[o.getType()];m(e,o)}}createOrUpdateVertexFeature_(e,t,a){let l=this.vertexFeature_;return l?l.getGeometry().setCoordinates(e):(l=new Ao(new Ei(e)),this.vertexFeature_=l,this.overlay_.getSource().addFeature(l)),l.set("features",t),l.set("geometries",a),l}handleEvent(e){if(!e.originalEvent)return!0;this.lastPointerEvent_=e;let t;return!e.map.getView().getInteracting()&&e.type==uo.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(e),this.vertexFeature_&&this.deleteCondition_(e)&&(e.type!=uo.SINGLECLICK||!this.ignoreNextSingleClick_?t=this.removePoint():t=!0),e.type==uo.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(e)&&!t}handleDragEvent(e){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(e,this.dragSegments_);let t=[e.coordinate[0]+this.delta_[0],e.coordinate[1]+this.delta_[1]],a=[],l=[];for(let o=0,m=this.dragSegments_.length;o<m;++o){let g=this.dragSegments_[o],b=g[0],A=b.feature;a.includes(A)||a.push(A);let S=b.geometry;l.includes(S)||l.push(S);let M=b.depth,k,j=b.segment,Z=g[1];for(;t.length<S.getStride();)t.push(j[Z][t.length]);switch(S.getType()){case"Point":k=t,j[0]=t,j[1]=t;break;case"MultiPoint":k=S.getCoordinates(),k[b.index]=t,j[0]=t,j[1]=t;break;case"LineString":k=S.getCoordinates(),k[b.index+Z]=t,j[Z]=t;break;case"MultiLineString":k=S.getCoordinates(),k[M[0]][b.index+Z]=t,j[Z]=t;break;case"Polygon":k=S.getCoordinates(),k[M[0]][b.index+Z]=t,j[Z]=t;break;case"MultiPolygon":k=S.getCoordinates(),k[M[1]][M[0]][b.index+Z]=t,j[Z]=t;break;case"Circle":if(j[0]=t,j[1]=t,b.index===m2)this.changingFeature_=!0,S.setCenter(t),this.changingFeature_=!1;else{this.changingFeature_=!0;let te=e.map.getView().getProjection(),q=Ux(ti(S.getCenter(),te),ti(t,te)),H=co();if(H){let ae=S.clone().transform(H,te);ae.setRadius(q),q=ae.transform(te,H).getRadius()}S.setRadius(q),this.changingFeature_=!1}break;default:}k&&this.setGeometryCoordinates_(S,k)}this.createOrUpdateVertexFeature_(t,a,l)}handleDownEvent(e){if(!this.condition_(e))return!1;let t=e.coordinate;this.handlePointerAtPixel_(e.pixel,e.map,t),this.dragSegments_.length=0,this.featuresBeingModified_=null;let a=this.vertexFeature_;if(a){let l=e.map.getView().getProjection(),o=[],m=a.getGeometry().getCoordinates(),g=ps([m]),b=this.rBush_.getInExtent(g),A={};b.sort(HB);for(let S=0,M=b.length;S<M;++S){let k=b[S],j=k.segment,Z=Ut(k.geometry),te=k.depth;if(te&&(Z+="-"+te.join("-")),A[Z]||(A[Z]=new Array(2)),k.geometry.getType()==="Circle"&&k.index===Xd){let q=_2(t,k,l);An(q,m)&&!A[Z][0]&&(this.dragSegments_.push([k,0]),A[Z][0]=k);continue}if(An(j[0],m)&&!A[Z][0]){this.dragSegments_.push([k,0]),A[Z][0]=k;continue}if(An(j[1],m)&&!A[Z][1]){if(A[Z][0]&&A[Z][0].index===0){let q=k.geometry.getCoordinates();switch(k.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":q=q[te[1]];case"Polygon":if(k.index!==q[te[0]].length-2)continue;break;default:}}this.dragSegments_.push([k,1]),A[Z][1]=k;continue}Ut(j)in this.vertexSegments_&&!A[Z][0]&&!A[Z][1]&&this.insertVertexCondition_(e)&&o.push(k)}o.length&&this.willModifyFeatures_(e,[o]);for(let S=o.length-1;S>=0;--S)this.insertVertex_(o[S],m)}return!!this.vertexFeature_}handleUpEvent(e){for(let t=this.dragSegments_.length-1;t>=0;--t){let a=this.dragSegments_[t][0],l=a.geometry;if(l.getType()==="Circle"){let o=l.getCenter(),m=a.featureSegments[0],g=a.featureSegments[1];m.segment[0]=o,m.segment[1]=o,g.segment[0]=o,g.segment[1]=o,this.rBush_.update(Ba(o),m);let b=l,A=co();if(A){let S=e.map.getView().getProjection();b=b.clone().transform(A,S),b=l0(b).transform(S,A)}this.rBush_.update(b.getExtent(),g)}else this.rBush_.update(ps(a.segment),a)}return this.featuresBeingModified_&&(this.dispatchEvent(new Hd(Zv.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null),!1}handlePointerMove_(e){this.lastPixel_=e.pixel,this.handlePointerAtPixel_(e.pixel,e.map,e.coordinate)}handlePointerAtPixel_(e,t,a){let l=a||t.getCoordinateFromPixel(e),o=t.getView().getProjection(),m=function(A,S){return y2(l,A,o)-y2(l,S,o)},g,b;if(this.hitDetection_){let A=typeof this.hitDetection_=="object"?S=>S===this.hitDetection_:void 0;t.forEachFeatureAtPixel(e,(S,M,k)=>{k&&k.getType()==="Point"&&(k=new Ei(ql(k.getCoordinates(),o)));let j=k||S.getGeometry();if(S instanceof Ao&&this.features_.getArray().includes(S)){b=j;let Z=S.getGeometry().getFlatCoordinates().slice(0,2);g=[{feature:S,geometry:b,segment:[Z,Z]}]}return!0},{layerFilter:A})}if(!g){let A=fs(Ba(l,g2),o),S=t.getView().getResolution()*this.pixelTolerance_,M=ds(Ln(A,S,g2),o);g=this.rBush_.getInExtent(M)}if(g&&g.length>0){let A=g.sort(m)[0],S=A.segment,M=_2(l,A,o),k=t.getPixelFromCoordinate(M),j=Ux(e,k);if(b||j<=this.pixelTolerance_){let Z={};if(Z[Ut(S)]=!0,this.snapToPointer_||(this.delta_[0]=M[0]-l[0],this.delta_[1]=M[1]-l[1]),A.geometry.getType()==="Circle"&&A.index===Xd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(M,[A.feature],[A.geometry]);else{let te=t.getPixelFromCoordinate(S[0]),q=t.getPixelFromCoordinate(S[1]),H=Su(k,te),ae=Su(k,q);j=Math.sqrt(Math.min(H,ae)),this.snappedToVertex_=j<=this.pixelTolerance_,this.snappedToVertex_&&(M=H>ae?S[1]:S[0]),this.createOrUpdateVertexFeature_(M,[A.feature],[A.geometry]);let pe={};pe[Ut(A.geometry)]=!0;for(let ve=1,de=g.length;ve<de;++ve){let _e=g[ve].segment;if(An(S[0],_e[0])&&An(S[1],_e[1])||An(S[0],_e[1])&&An(S[1],_e[0])){let Pe=Ut(g[ve].geometry);Pe in pe||(pe[Pe]=!0,Z[Ut(_e)]=!0)}else break}}this.vertexSegments_=Z;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(e,t){let a=e.segment,l=e.feature,o=e.geometry,m=e.depth,g=e.index,b;for(;t.length<o.getStride();)t.push(0);switch(o.getType()){case"MultiLineString":b=o.getCoordinates(),b[m[0]].splice(g+1,0,t);break;case"Polygon":b=o.getCoordinates(),b[m[0]].splice(g+1,0,t);break;case"MultiPolygon":b=o.getCoordinates(),b[m[1]][m[0]].splice(g+1,0,t);break;case"LineString":b=o.getCoordinates(),b.splice(g+1,0,t);break;default:return}this.setGeometryCoordinates_(o,b);let A=this.rBush_;A.remove(e),this.updateSegmentIndices_(o,g,m,1);let S={segment:[a[0],t],feature:l,geometry:o,depth:m,index:g};A.insert(ps(S.segment),S),this.dragSegments_.push([S,1]);let M={segment:[t,a[1]],feature:l,geometry:o,depth:m,index:g+1};A.insert(ps(M.segment),M),this.dragSegments_.push([M,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=uo.POINTERDRAG){let e=this.lastPointerEvent_;this.willModifyFeatures_(e,this.dragSegments_);let t=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new Hd(Zv.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null,t}return!1}removeVertex_(){let e=this.dragSegments_,t={},a=!1,l,o,m,g,b,A,S,M,k,j,Z;for(b=e.length-1;b>=0;--b)m=e[b],j=m[0],Z=Ut(j.feature),j.depth&&(Z+="-"+j.depth.join("-")),Z in t||(t[Z]={}),m[1]===0?(t[Z].right=j,t[Z].index=j.index):m[1]==1&&(t[Z].left=j,t[Z].index=j.index+1);for(Z in t){switch(k=t[Z].right,S=t[Z].left,A=t[Z].index,M=A-1,S!==void 0?j=S:j=k,M<0&&(M=0),g=j.geometry,o=g.getCoordinates(),l=o,a=!1,g.getType()){case"MultiLineString":o[j.depth[0]].length>2&&(o[j.depth[0]].splice(A,1),a=!0);break;case"LineString":o.length>2&&(o.splice(A,1),a=!0);break;case"MultiPolygon":l=l[j.depth[1]];case"Polygon":l=l[j.depth[0]],l.length>4&&(A==l.length-1&&(A=0),l.splice(A,1),a=!0,A===0&&(l.pop(),l.push(l[0]),M=l.length-1));break;default:}if(a){this.setGeometryCoordinates_(g,o);let te=[];if(S!==void 0&&(this.rBush_.remove(S),te.push(S.segment[0])),k!==void 0&&(this.rBush_.remove(k),te.push(k.segment[1])),S!==void 0&&k!==void 0){let q={depth:j.depth,feature:j.feature,geometry:j.geometry,index:M,segment:te};this.rBush_.insert(ps(q.segment),q)}this.updateSegmentIndices_(g,A,j.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.length=0}}return a}setGeometryCoordinates_(e,t){this.changingFeature_=!0,e.setCoordinates(t),this.changingFeature_=!1}updateSegmentIndices_(e,t,a,l){this.rBush_.forEachInExtent(e.getExtent(),function(o){o.geometry===e&&(a===void 0||o.depth===void 0||Fn(o.depth,a))&&o.index>t&&(o.index+=l)})}};function HB(s,e){return s.index-e.index}function y2(s,e,t){let a=e.geometry;if(a.getType()==="Circle"){let o=a;if(e.index===Xd){let m=co();m&&(o=o.clone().transform(m,t));let g=Su(o.getCenter(),ti(s,t)),b=Math.sqrt(g)-o.getRadius();return b*b}}let l=ti(s,t);return Bu[0]=ti(e.segment[0],t),Bu[1]=ti(e.segment[1],t),pE(l,Bu)}function _2(s,e,t){let a=e.geometry;if(a.getType()==="Circle"&&e.index===Xd){let o=a,m=co();return m&&(o=o.clone().transform(m,t)),ql(o.getClosestPoint(ti(s,t)),t)}let l=ti(s,t);return Bu[0]=ti(e.segment[0],t),Bu[1]=ti(e.segment[1],t),ql(jx(l,Bu),t)}function KB(){let s=vI();return function(e,t){return s.Point}}var Hv=Xv;var YB=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,x2=/^([\d.]+),([\d.]+)$/,v2=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,Sg="stop-fetch",b2=s=>{let e=[];return s.forEach(t=>{let a=t.getGeometry()?.getCoordinates();a?.length&&e.push(...a)}),e},Kv=class s extends Mu{constructor(t={}){super(t);this.abortControllers={};this.cacheStationData={};this.format=new Ii({featureProjection:"EPSG:3857"});this.graphs=[];this.initialRouteDrag={};this.segments=[];this.snapToClosestStation=!1;this.useRawViaPoints=!1;this.viaPoints=[];this.element||this.createDefaultElement(),this.loading=!1,this.active=t.active||!0,this.graphs=t.graphs||[["osm",0,99]],this.mot=t.mot||"bus",this.modify=t.modify!==!1,this.routingApiParams=t.routingApiParams,this.useRawViaPoints=t.useRawViaPoints||!1,this.snapToClosestStation=t.snapToClosestStation||!1,this.apiKey=t.apiKey,this.stopsApiKey=t.stopsApiKey||this.apiKey,this.stopsApiUrl=t.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new od({...t}),this.routingLayer=t.routingLayer||new Jl({source:new Ql,style:t.style}),this.onRouteError=t.onRouteError||(a=>{this.dispatchEvent(new zr("change:route")),this.reset(),console.error(a)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction(),this.on("propertychange",a=>{a.key==="active"&&this.onActiveChange(),a.key==="mot"&&this.viaPoints&&this.drawRoute()})}static getGraphsResolutions(t,a){let l=a.getView();return t.map(([,o,m])=>[l.getResolutionForZoom(o),l.getResolutionForZoom(m||o+1)])}abortRequests(){this.graphs.forEach(t=>{let a=t[0];this.abortControllers[a]&&this.abortControllers[a].abort(),this.abortControllers[a]=new AbortController}),this.abortControllers[Sg]?.abort(),this.abortControllers[Sg]=new AbortController,this.loading=!1}activate(){let t=this.getMap();t&&(this.format=new Ii({featureProjection:t.getView().getProjection()}),this.graphsResolutions=s.getGraphsResolutions(this.graphs,t),this.modifyInteraction&&t.removeInteraction(this.modifyInteraction),this.modifyInteraction&&t.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}addListeners(){this.modify&&(this.removeListeners(),this.onMapClickKey=this.getMap()?.on("singleclick",this.onMapClick))}addViaPoint(t,a=-1,l=0){this.viaPoints.splice(a===-1?this.viaPoints.length:a,l,t),this.drawRoute(),this.dispatchEvent(new zr("change:route"))}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new Hv({deleteCondition:t=>{let l=(t.target?.getFeaturesAtPixel(t.pixel,{hitTolerance:5})).find(o=>o.getGeometry()?.getType()==="Point"&&o.get("index"));return u2(t)&&l?(this.removeViaPoint(l.get("index")),!0):!1},pixelTolerance:6,source:this.routingLayer?.getSource()||void 0}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}deactivate(){let t=this.getMap();t&&(this.modifyInteraction&&t.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}drawRoute(){if(this.abortRequests(),this.routingLayer?.getSource()?.clear(!0),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[Sg]);let t=this.viaPoints.map(a=>{if(Array.isArray(a)){let l=this.getMap()?.getView().getProjection(),[o,m]=Gl(a,l);return this.snapToClosestStation?[`@${m}`,o]:[m,o]}return this.useRawViaPoints?a:`!${a}`});return this.loading=!0,this.viaPoints.forEach((a,l)=>this.drawViaPoint(a,l,this.abortControllers[Sg])),Promise.all(this.graphs.map(([a],l)=>{let{signal:o}=this.abortControllers[a];return this.api?this.api.route({"coord-punish":1e3,"coord-radius":100,elevation:!1,graph:a,mot:this.mot,"resolve-hops":!1,via:`${t.join("|")}`,...this.routingApiParams||{}},{signal:o}).then(m=>{if(this.segments=this.format.readFeatures(m),this.mot==="foot"){let A=this.segments.reduce((S,M)=>{let k=M.get("trg");return S.find(j=>j[0]===k[0]&&j[1]===k[1])?S:[...S,k]},[]);this.segments=A.map(S=>{let M=this.segments.filter(j=>{let Z=j.get("trg");return Z[0]===S[0]&&Z[1]===S[1]}),k=b2(M);return new Ao({geometry:new Go(k)})})}let g=b2(this.segments),b=new Ao({geometry:new Go(g)});b.set("graph",a),b.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[l]?.length>=2&&(b.set("minResolution",this.graphsResolutions[l][0]),b.set("maxResolution",this.graphsResolutions[l][1])),this.routingLayer?.getSource()?.addFeature(b),this.loading=!1}).catch(m=>{/AbortError/.test(m.message)||(this.segments=[],this.dispatchEvent(new zr("error")),this.onRouteError(m,this),this.routingLayer?.getSource()?.clear(),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(t,a,l){let o=new Ao;if(o.set("viaPointIdx",a),Array.isArray(t))return o.setGeometry(new Ei(t)),this.routingLayer?.getSource()?.addFeature(o),Promise.resolve(o);if(!this.useRawViaPoints||v2.test(t)){let S,M;return this.useRawViaPoints?[,S,,M]=v2.exec(t)||[]:[S,M]=t.split("$"),fetch(`${this.stopsApiUrl}lookup/${S}?key=${this.stopsApiKey}`,{signal:l.signal}).then(k=>k.json()).then(k=>{let{coordinates:j}=k.features[0].geometry;return this.cacheStationData[t]=Ai(j),o.set("viaPointTrack",M),o.setGeometry(new Ei(Ai(j))),this.routingLayer?.getSource()?.addFeature(o),o}).catch(k=>{/AbortError/.test(k.message)||(this.dispatchEvent(new zr("error")),this.onRouteError(k,this),this.loading=!1)})}if(this.useRawViaPoints&&x2.test(t)){let[S,M]=x2.exec(t)||[];if(M&&S){let k=parseFloat(M),j=parseFloat(S),Z=Ai([k,j],this.getMap()?.getView().getProjection());return o.setGeometry(new Ei(Z)),this.routingLayer?.getSource()?.addFeature(o),Promise.resolve(o)}}let[,m,,g,b,,A]=YB.exec(t)||[];if(b&&g){let S=Ai([parseFloat(b),parseFloat(g)],this.getMap()?.getView().getProjection());return o.set("viaPointTrack",A),o.setGeometry(new Ei(S)),this.routingLayer?.getSource()?.addFeature(o),Promise.resolve(o)}return m?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${m}&limit=1`,{signal:l.signal}).then(S=>S.json()).then(S=>{let{coordinates:M}=S.features[0].geometry;return this.cacheStationData[t]=Ai(M),o.set("viaPointTrack",A),o.setGeometry(new Ei(Ai(M))),this.routingLayer?.getSource()?.addFeature(o),o}).catch(S=>(this.dispatchEvent(new zr("error")),this.onRouteError(S,this),this.loading=!1,null)):Promise.resolve(null)}onActiveChange(){this.get("active")?this.activate():this.deactivate(),this.render()}onMapClick(t){let l=t.target.getFeaturesAtPixel(t.pixel,{hitTolerance:5,layerFilter:o=>o===this.routingLayer}).find(o=>o.getGeometry()?.getType()==="Point"&&o.get("viaPointIdx")!==void 0);if(l){this.removeViaPoint(l.get("viaPointIdx"));return}this.addViaPoint(t.coordinate)}onModifyEnd(t){let a=t.mapBrowserEvent.coordinate,{oldRoute:l,segmentIndex:o,viaPoint:m}=this.initialRouteDrag||{};return m?this.addViaPoint(a,m.get("viaPointIdx"),1):l?o===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(a,(o||0)+1):this.addViaPoint(a,0,1)}onModifyStart(t){let a=-1,l=t.features.getArray().find(m=>m.getGeometry()?.getType()==="LineString");if(l?.getGeometry()&&t.mapBrowserEvent.coordinate){let m=Ln(new Ei(l.getGeometry()?.getClosestPoint(t.mapBrowserEvent.coordinate)).getExtent(),.001);a=this.segments.findIndex(g=>g.getGeometry()?.intersectsExtent(m))}let o=(t.features.getArray().filter(m=>m.getGeometry()?.getType()==="Point")||[])[0];this.initialRouteDrag={oldRoute:l&&l.clone(),segmentIndex:a,viaPoint:o}}removeListeners(){this.onMapClickKey&&jl(this.onMapClickKey)}removeViaPoint(t=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[t]&&this.viaPoints.splice(t,1),this.drawRoute(),this.dispatchEvent(new zr("change:route"))}render(){}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.getSource()?.clear(),this.dispatchEvent(new zr("change:route"))}setMap(t){super.setMap(t),t&&this.active?this.activate():t||(this.active=!1)}setViaPoints(t){this.viaPoints=[...t],this.drawRoute(),this.dispatchEvent(new zr("change:route"))}get active(){return this.get("active")}set active(t){this.set("active",t)}get loading(){return this.get("loading")}set loading(t){this.set("loading",t)}get modify(){return this.get("modify")}set modify(t){this.set("modify",t)}get mot(){return this.get("mot")}set mot(t){this.set("mot",t)}},w2=Kv;var Yv=class{constructor(e){let{apiKey:t,apiParams:a,placeholder:l,url:o}=e||{};this.apiParams={limit:20,...a||{}},this.placeholder=l||"Search for a stop...";let m={apiKey:t};o&&(m.url=o),this.api=new sd(m),this.abortController=new AbortController,this.createElement(e),this.options=e}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}createElement({element:e}){this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=t=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(t.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),e.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",cursor:"pointer",overflowY:"auto"}),e.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{cursor:"pointer",display:"none",fontSize:"200%",padding:"0 10px",position:"absolute",right:"0"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),e.appendChild(this.clearElt)}render(e){let t=e?.features||[];this.suggestionsElt&&(this.suggestionsElt.style.display=t.length?"block":"none",this.suggestionsElt.innerHTML="",t.forEach(a=>{let l=document.createElement("div");l.innerHTML=a?.properties?.name,l.onclick=o=>{this.options?.onSuggestionClick?.(a,o)},Object.assign(l.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(l)}))}search(e,t){return(e!==void 0||e!==null)&&(this.apiParams.q=e),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,t&&{signal:t.signal}).then(a=>{this.render(a)}).catch(()=>{this.render()})}},S2=Yv;var JB=()=>{let s=document.createElement("div");return Object.assign(s.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px",maxHeight:"90%"}),s},A2=JB;var Jv=class extends Mu{constructor(e){let t=A2();t.className=e?.className||"mbt-stop-finder";let a={element:t,...e||{}};super(a),this.controller=new S2({onSuggestionClick:this.onSuggestionClick.bind(this),...a})}onSuggestionClick(e){let t=Ai(e.geometry.coordinates);this.getMap()?.getView().setCenter(t)}search(e,t){return this.controller.search(e,t)}},E2=Jv;var P2=ao(tb(),1);var QB="vectorTileFeature",rb={"EPSG:3857":new Ii({featureProjection:"EPSG:3857"})},Nu=class extends Du{getFeaturesAtCoordinate(e,t=5){let a=this.getMapLibrePixels(e,t);if(!a)return[];let l=this.getLayer().get("queryRenderedFeaturesOptions")||{};return this.getLayer().mapLibreMap?.queryRenderedFeatures(a,l).map(m=>this.toOlFeature(m))||[]}prepareFrame(){return!0}renderFrame(e){let t=this.getLayer(),{mapLibreMap:a}=t,l=t.getMapInternal();if(!t||!l||!a)return null;let o=a.getCanvas(),{viewState:m}=e;a.jumpTo({center:Gl(m.center),zoom:m.zoom-1,bearing:aE(-m.rotation)});let g=t.getOpacity().toString();return o&&g!==o.style.opacity&&(o.style.opacity=g),o.isConnected?e3(o,e)||a.resize():l.render(),a.redraw(),a.getContainer()}getFeatures(e){let t=this.getLayer().getMapInternal()?.getCoordinateFromPixel(e);return Promise.resolve(this.getFeaturesAtCoordinate(t))}forEachFeatureAtCoordinate(e,t,a,l){let o=this.getFeaturesAtCoordinate(e,a);return o.forEach(m=>{let g=m.getGeometry();g instanceof Vi&&l(m,this.layer_,g)}),o?.[0]}getMapLibrePixels(e,t){if(!e)return;let a=this.getLayer().mapLibreMap?.project(Gl(e));if(a?.x===void 0||a?.y===void 0)return;let l=[a.x,a.y];if(t){let[o,m]=l;l=[[o-t,m-t],[o+t,m+t]]}return l}toOlFeature(e){let l=this.getLayer().getMapInternal()?.getView()?.getProjection()?.getCode()||"EPSG:3857";rb[l]||(rb[l]=new Ii({featureProjection:l}));let o=rb[l].readFeature(e);return o&&o.set(QB,e,!0),o}};function e3(s,e){return s.width===Math.floor(e.size[0]*e.pixelRatio)&&s.height===Math.floor(e.size[1]*e.pixelRatio)}var t3=s=>{if(!s)return[];let{style:e}=s;if(!e)return[];let{sourceCaches:t}=e,a=[];return Object.values(t).forEach(l=>{if(l.used){let{attribution:o}=l.getSource();o&&(a=a.concat(o.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),r3(a)},r3=s=>{let e=s.filter(l=>l!=null&&l.trim&&l.trim()),t=e.map(l=>l.toLowerCase());return[...new Set(t)].map(l=>e.find(o=>o.toLowerCase()===l))},ib=t3;var ju=class extends qo{mapLibreMap;loaded=!1;olListenersKeys=[];constructor(e){super({source:new pa({attributions:()=>ib(this.mapLibreMap)}),...e})}disposeInternal(){jl(this.olListenersKeys),this.loaded=!1,this.mapLibreMap&&(this.mapLibreMap.triggerRepaint=()=>{},this.mapLibreMap.remove()),super.disposeInternal()}setMapInternal(e){super.setMapInternal(e),e?this.loadMapLibreMap():this.dispose()}loadMapLibreMap(){this.loaded=!1;let e=this.getMapInternal();if(e&&this.olListenersKeys.push(e.on("change:target",this.loadMapLibreMap.bind(this))),!e?.getTargetElement())return;if(!this.getVisible()){this.olListenersKeys.push(this.once("change:visible",this.loadMapLibreMap.bind(this)));return}let t=document.createElement("div");t.style.position="absolute",t.style.width="100%",t.style.height="100%";let a=this.get("mapLibreOptions");this.mapLibreMap=new P2.Map(Object.assign({},a,{container:t,attributionControl:!1,interactive:!1,trackResize:!1})),this.mapLibreMap.on("sourcedata",()=>{this.getSource()?.refresh()}),this.mapLibreMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new zr("load"))})}createRenderer(){return new Nu(this)}};var lb=ao(ec());var R2=ao(ec());var Pi=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Pi=(0,R2.default)(s=>{console.warn(s)},1e3));function v3(s){return class extends s{constructor(...a){let l=a[0];super(l);this.olEventsKeys=[];this.options={};l.properties&&(Pi("Deprecated. Don't use properties options. Pass the values directly in options object."),this.setProperties(l.properties)),this.olEventsKeys?.push(this.on("propertychange",o=>{o.key==="children"&&this.onChildrenChange(o.oldValue)})),this.options=l,this.set("children",l.children||[])}attachToMap(a){(super.attachToMap||(()=>{}))(a),(this.get("children")||[]).forEach(l=>{a.addLayer(l)})}detachFromMap(){(this.get("children")||[]).forEach(a=>{this.map.removeLayer(a)}),(super.detachFromMap||(()=>{}))()}flat(){return Pi("Layer.flat is deprecated. Use getLayersAsFlatArray utils method instead."),Nl(this)}onChildrenChange(a){(a||[]).forEach(l=>{l.set("parent",void 0)}),(this.get("children")||[]).forEach(l=>{l.set("parent",this)})}setMapInternal(a){super.setMapInternal(a),a?this.attachToMap(a):this.detachFromMap()}get children(){return Pi("Layer.children is deprecated. Use the Layer.get('children') method instead."),this.get("children")||[]}set children(a){Pi("Layer.children is deprecated. Use the Layer.set('children', children) method instead."),this.set("children",a||[])}get copyrights(){return Pi("Layer.copyrights is deprecated. Get the attributions from the source object"),this.get("copyrights")}set copyrights(a){Pi("Layer.copyrights is deprecated. Set the attributions to the source object.");let l=a&&!Array.isArray(a)?[a]:a;this.set("copyrights",l||[])}get disabled(){return Pi("Layer.disabled is deprecated. Use the Layer.get('disabled') method instead."),this.get("disabled")}set disabled(a){Pi("Layer.disabled is deprecated. Use the Layer.set('disabled', newValue) method instead."),this.set("disabled",a)}get group(){return Pi("Layer.group is deprecated. Use the Layer.get('group') method instead."),this.get("group")}get hitTolerance(){return Pi("Layer.hitTolerance is deprecated.Pass the hitTolerance when you request the features."),this.get("hitTolerance")||5}get key(){return this.get("key")||this.get("name")||Ut(this)}get map(){return this.getMapInternal()}get name(){return Pi("Layer.name is deprecated. Use the Layer.get('name') method instead."),this.get("name")}get olLayer(){return Pi("Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. This getter is only a redirect to the current 'this' object."),this}set olLayer(a){Pi("Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. This setter has no effect.")}get parent(){return Pi("Layer.parent is deprecated. Use the Layer.get('parent') method instead."),this.get("parent")}set parent(a){Pi("Layer.parent is deprecated. Use the Layer.set('parent', parent) method instead."),this.set("parent",a)}get visible(){return Pi("Layer.visible is deprecated. Use the Layer.getVisible() method instead."),this.getVisible()}set visible(a){Pi("Layer.visible is deprecated. Use the Layer.setVisible(newValue) method instead."),this.setVisible(a)}}}var k2=v3;function b3(s){return class extends k2(s){}}var Ss=b3;var F2=(s,e,t,a)=>Ol(`${s}/styles/${e}/style.json`,{[a]:t}).toString(),sb=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(sb=(0,lb.default)(s=>{console.warn(s)},1e3));var ab=class s extends Ss(ju){constructor(e){let t={apiKeyName:"key",style:"travic_v2",url:"https://maps.geops.io",...e||{},mapLibreOptions:{...e.mapLibreOptions||{}}};!t.mapLibreOptions.style&&t.apiKey&&t.style&&typeof t.style=="string"&&(t.mapLibreOptions.style=F2(t.url,t.style,t.apiKey,t.apiKeyName)),super(t)}attachToMap(e){super.attachToMap(e);let t=(0,lb.default)(this.updateMaplibreMap.bind(this),150);t(),this.olEventsKeys.push(this.on("propertychange",a=>{/(url|style|apiKey|apiKeyName)/.test(a.key)&&t()}))}clone(e){return new s({...this.options||{},...e||{}})}getStyle(){return this.style&&typeof this.style=="object"&&this.style.name&&this.style.version?this.style:this.url.includes("style.json")?this.url:F2(this.url,this.style,this.get("apiKey"),this.get("apiKeyName"))}updateMaplibreMap(){try{this.mapLibreMap?.setStyle(this.getStyle(),{diff:!1})}catch(e){console.error("Error while updating MaplibreMap",e)}}set apiKey(e){this.set("apiKey",e)}get apiKey(){return this.get("apiKey")}set apiKeyName(e){this.set("apiKeyName",e)}get apiKeyName(){return this.get("apiKeyName")}get maplibreMap(){return sb("MaplibreLayer.maplibreMap is deprecated. Use layer.mapLibreMap."),this.mapLibreMap}get mbMap(){return sb("MaplibreLayer.mbMap is deprecated. Use layer.maplibreMap."),this.maplibreMap}get style(){return this.get("style")}set style(e){this.set("style",e)}get url(){return this.get("url")}set url(e){this.set("url",e)}},L2=ab;var D2=ao(ec());var cb={"EPSG:3857":new Ii({featureProjection:"EPSG:3857"})},Kd=class extends Du{forEachFeatureAtCoordinate(e,t,a,l){let o=this.getFeaturesAtCoordinate(e,a);return o.forEach(m=>{l(m,this.layer_,m.getGeometry())}),o?.[0]}getFeatures(e){let t=this.getLayer()?.getMapInternal()?.getCoordinateFromPixel(e);return Promise.resolve(this.getFeaturesAtCoordinate(t))}getFeaturesAtCoordinate(e,t=5){if(!e)return[];let a=this.getLayer(),l=a.getMapInternal(),{mapLibreMap:o}=a.maplibreLayer,m=l?.getView()?.getProjection()?.getCode()||"EPSG:3857",g=[];if(cb[m]||(cb[m]=new Ii({featureProjection:m})),o?.isStyleLoaded()){let b=e&&o.project(Gl(e));if(b?.x&&b?.y){let A=[b.x,b.y];if(t){let[M,k]=A;A=[[M-t,k-t],[M+t,k+t]]}let S=a.layers||[];a.layersFilter&&(S=o.getStyle().layers.filter(a.layersFilter)),a.queryRenderedLayersFilter&&(S=o.getStyle().layers.filter(a.queryRenderedLayersFilter)),g=o.queryRenderedFeatures(A,{layers:S.map(M=>M.id),validate:!1}).map(M=>{let k=cb[m].readFeature(M);return k&&k.set(Tu,M),k})}}return g}prepareFrame(){return!0}renderFrame(){return null}};var Io=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Io=(0,D2.default)((...s)=>{console.warn(...s)},1e3));var ub=class s extends Ss(qo){constructor(t={mapLibreOptions:{style:{layers:[],sources:{},version:8}}}){t.mapboxLayer&&(Io("options.mapboxLayer is deprecated. Use options.maplibreLayer instead."),t.maplibreLayer=t.mapboxLayer,delete t.mapboxLayer);super({source:new pa({}),...t});this.highlightedFeatures=[];this.selectedFeatures=[];this.onLoad=this.onLoad.bind(this),!this.layersFilter&&this.layers&&(this.layersFilter=a=>!!this.layers.find(l=>a.id===l.id))}addLayers(){if(!this.maplibreLayer?.mapLibreMap||!Array.isArray(this.layers))return;let{mapLibreMap:t}=this.maplibreLayer;t&&(this.layers.forEach(a=>{let{id:l,source:o}=a;(!o||o&&t.getSource(o))&&l&&!t.getLayer(l)&&t.addLayer(a,this.beforeId)}),this.applyLayoutVisibility())}addSources(){if(!this.maplibreLayer?.mapLibreMap||!this.sources)return;let{mapLibreMap:t}=this.maplibreLayer;t&&Object.entries(this.sources).forEach(([a,l])=>{t.getSource(a)||t.addSource(a,l)})}applyLayoutVisibility(t){if(!this.maplibreLayer?.mapLibreMap?.getStyle()||!this.layersFilter)return;let{mapLibreMap:a}=this.maplibreLayer,l=a.getStyle(),o=this.getVisible()?"visible":"none",m=l.layers||[];for(let g=0;g<m.length;g+=1){let b=m[g];if(this.layersFilter(b)){let{id:A}=b;a.getLayer(A)&&(a.setLayoutProperty(A,"visibility",o),(this.getMinZoom()||this.getMaxZoom())&&a.setLayerZoomRange(A,this.getMinZoom()?this.getMinZoom()-1:0,this.getMaxZoom()?this.getMaxZoom()-1:24))}}}attachToMap(t){if(this.maplibreLayer&&!this.maplibreLayer.map&&t.addLayer(this.maplibreLayer),super.attachToMap(t),!this.map||!this.maplibreLayer)return;if(!this.map.getTargetElement()){this.olEventsKeys.push(this.map.on("change:target",()=>{this.attachToMap(t)}));return}let{mapLibreMap:a}=this.maplibreLayer;a&&(a.loaded()?this.onLoad():a.once("load",this.onLoad)),this.olEventsKeys.push(this.maplibreLayer.on("load",this.onLoad.bind(this)),this.on("change:visible",l=>{this.applyLayoutVisibility(l)}),this.on("propertychange",l=>{/(sources|layers|layersFilter|maplibreLayer|beforeId)/.test(l.key)&&(this.detachFromMap(),this.attachToMap(t))}))}clone(t){return new s({...this.options,...t})}createRenderer(){return new Kd(this)}detachFromMap(){this.maplibreLayer?.mapLibreMap&&(this.maplibreLayer.mapLibreMap.off("load",this.onLoad),this.removeLayers(),this.removeSources()),super.detachFromMap()}getFeatureInfoAtCoordinate(t){if(Io("Deprecated. getFeatureInfoAtCoordinate([layer], coordinate) from ol package instead."),!this.maplibreLayer?.mapLibreMap)return Promise.resolve({coordinate:t,features:[],layer:this});let{mapLibreMap:a}=this.maplibreLayer;if(!a.isStyleLoaded())return Promise.resolve({coordinate:t,features:[],layer:this});let l=this.layers||[];return this.layersFilter&&(l=a.getStyle().layers.filter(this.layersFilter)),this.queryRenderedLayersFilter&&(l=a.getStyle().layers.filter(this.queryRenderedLayersFilter)),Promise.resolve({coordinate:t,features:[],layer:this})}highlight(t=[]){Io("Deprecated. Use layer.setFeatureState(features, {highlighted: true}) instead.");let a=this.highlightedFeatures?.filter(l=>!(this.selectedFeatures||[]).map(o=>o.getId()).includes(l.getId()))||[];this.setHoverState(a,!1),this.highlightedFeatures=t,this.setHoverState(this.highlightedFeatures,!0)}onLoad(){if(!this.maplibreLayer?.mapLibreMap)return;this.addSources(),this.addLayers();let{mapLibreMap:t}=this.maplibreLayer,a=t.getStyle();if(a?.layers&&this.layersFilter){let l=a.layers.filter(this.layersFilter);this.set("disabled",!l.length)}this.applyLayoutVisibility()}removeLayers(){if(!this.maplibreLayer?.mapLibreMap||!Array.isArray(this.layers))return;let{mapLibreMap:t}=this.maplibreLayer;t&&this.layers.forEach(a=>{let{id:l}=a;l&&t.getLayer(l)&&t.removeLayer(l)})}removeSources(){if(!this.maplibreLayer?.mapLibreMap||!this.sources)return;let{mapLibreMap:t}=this.maplibreLayer;t&&Object.keys(this.sources).forEach(a=>{t.getSource(a)&&t.removeSource(a)})}select(t=[]){Io("Deprecated. Use layer.setFeatureState(features, {selected: true}) instead."),this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=t,this.setHoverState(this.selectedFeatures||[],!0)}setFeatureState(t,a){if(!this.maplibreLayer?.mapLibreMap||!t.length)return;let{mapLibreMap:l}=this.maplibreLayer;t.forEach(o=>{let{source:m,sourceLayer:g}=o.get(Tu)||{};if(!m&&!g||!o.getId()){o.getId()||Io("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/Maplibre/tippecanoe#adding-calculated-attributes.",o.getProperties());return}l.setFeatureState({id:o.getId(),source:m,sourceLayer:g},a)})}setHoverState(t,a){Io(`Deprecated. Use layer.setFeatureState(features, {hover: ${a}}) instead.`),this.setFeatureState(t,{hover:a})}get beforeId(){return this.get("beforeId")}set beforeId(t){this.set("beforeId",t)}get layers(){return this.get("layers")}set layers(t){this.set("layers",t)}get layersFilter(){return this.get("layersFilter")}set layersFilter(t){this.set("layersFilter",t)}get mapboxLayer(){return Io("Deprecated. Use maplibreLayer instead."),this.get("maplibreLayer")}get maplibreLayer(){return this.get("maplibreLayer")}set maplibreLayer(t){this.set("maplibreLayer",t)}get queryRenderedLayersFilter(){return this.get("queryRenderedLayersFilter")}set queryRenderedLayersFilter(t){this.set("queryRenderedLayersFilter",t)}get sources(){return this.get("sources")}set sources(t){this.set("sources",t)}get styleLayer(){return Io("MaplibreStyleLayer.styleLayer is deprecated. Use MaplibreStyleLayer.layer instead."),this.layers[0]}set styleLayer(t){Io("MaplibreStyleLayer.styleLayer is deprecated. Use MaplibreStyleLayer.layer instead."),this.layers=[t]}get styleLayers(){return Io("MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead."),this.layers}set styleLayers(t){Io("MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead."),this.layers=t}},O2=ub;var fb=ao(ec());var pb=ao(ec()),db=ao(U2());function N3(s){return class extends s{constructor(t){super({hitTolerance:10,...t}),this.defineProperties(t),this.debug=t.debug||!1,this.mode=t.mode||Jr.TOPOGRAPHIC,this.api=t.api||new nd(t),this.tenant=t.tenant||"",this.minZoomInterpolation=t.minZoomInterpolation||8,this.format=new Ii,this.onStart=t.onStart,this.onStop=t.onStop,this.motsByZoom=t.motsByZoom||[Vo,Vo,Vo,Vo,Vo,Vo,Vo,Vo,Vo,tg,tg],this.getMotsByZoom=a=>t.getMotsByZoom?t.getMotsByZoom(a,this.motsByZoom):this.motsByZoom[a],this.generalizationLevelByZoom=t.generalizationLevelByZoom||[],this.getGeneralizationLevelByZoom=a=>t.getGeneralizationLevelByZoom?t.getGeneralizationLevelByZoom(a,this.generalizationLevelByZoom):this.generalizationLevelByZoom[a],this.renderTimeIntervalByZoom=t.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=a=>t.getRenderTimeIntervalByZoom?t.getRenderTimeIntervalByZoom(a,this.renderTimeIntervalByZoom):this.renderTimeIntervalByZoom[a],this.isUpdateBboxOnMoveEnd=t.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,db.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,pb.default)(this.renderTrajectoriesInternal,50,{leading:!0,maxWait:5e3,trailing:!0}),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}addTrajectory(t){this.trajectories||(this.trajectories={});let a=t.properties.train_id;a!==void 0&&(this.trajectories[a]=t),this.renderTrajectories()}attachToMap(t){super.attachToMap(t),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}defineProperties(t){(super.defineProperties||(()=>{}))(t);let{bboxParameters:a,canvas:l,filter:o,hoverVehicleId:m,live:g,mode:b,pixelRatio:A,selectedVehicleId:S,sort:M,speed:k,style:j,styleOptions:Z,time:te}=t,q=l,H=k||1,ae=te||new Date,pe=b||Jr.TOPOGRAPHIC,ve=j||zl;Object.defineProperties(this,{bboxParameters:{value:a,writable:!0},canvas:{get:()=>(q||(q=document.createElement("canvas")),q),set:de=>{q=de}},filter:{value:o,writable:!0},hoverVehicleId:{value:m,writable:!0},isTrackerLayer:{value:!0},live:{value:g===!1?g:!0,writable:!0},mode:{get:()=>pe,set:de=>{de!==pe&&(pe=de,this.api?.wsApi?.open&&(this.stop(),this.start()))}},pixelRatio:{value:A||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},selectedVehicleId:{value:S,writable:!0},sort:{value:M,writable:!0},speed:{get:()=>H,set:de=>{H=de,this.start()}},style:{get:()=>ve,set:de=>{ve=de,this.renderTrajectories()}},styleOptions:{value:{...Pu,...Z||{}}},time:{get:()=>ae,set:de=>{ae=de?.getTime?de:new Date(de),this.renderTrajectories()}},trajectories:{value:{},writable:!0},useDebounce:{value:t.useDebounce||!1,writable:!0},useRequestAnimationFrame:{value:t.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:t.useThrottle!==!1,writable:!0}})}detachFromMap(){if(document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),jl(this.visibilityRef),this.canvas){let t=this.canvas.getContext("2d");t&&t.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap()}}getFeatureInfoAtCoordinate(t,a){let{nb:l,resolution:o}=a,m=Ln([...t,...t],this.hitTolerance*o),g=Object.values(this.trajectories||{});this.sort&&(g=g.sort(this.sort));let b=[];for(let A=0;A<g.length;A+=1){let{coordinate:S}=g[A].properties;if(S&&Js(m,S)&&b.push(g[A]),b.length===l)break}return Promise.resolve({coordinate:t,features:b.map(A=>this.format.readFeature(A)),layer:this})}getRefreshTimeInMs(t=0){let a=t!==void 0?Math.round(t):-1,l=this.getRenderTimeIntervalByZoom(a)||25,o=Math.max(25,l/(this.speed||1)),m=Math.min(o,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,db.default)(this.renderTrajectoriesInternal,m,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,pb.default)(this.renderTrajectoriesInternal,m,{leading:!0,maxWait:5e3,trailing:!0})),this.api?.buffer){let[,g]=this.api.buffer;this.api.buffer=[m,g]}return o}getTrajectoryInfos(t){let a=[this.api.getStopSequence(t),this.api.getFullTrajectory(t,this.mode,this.getGeneralizationLevelByZoom(Math.floor(this.map?.getView()?.getZoom()||0)))];return Promise.all(a).then(([l,o])=>({fullTrajectory:o,stopSequence:l}))}getVehicle(t){return this.trajectories&&Object.values(this.trajectories).filter(t)||[]}highlightVehicle(t){this.hoverVehicleId!==t&&(this.hoverVehicleId=t,this.renderTrajectories(!0))}onDeleteTrajectoryMessage(t){t.content&&this.removeTrajectory(t.content)}onDocumentVisibilityChange(){if(document.hidden)this.stop(),this.trajectories={};else{if(this.getVisible()===!1)return;this.start()}}onTrajectoryMessage(t){if(!t.content)return;let a=t.content,{geometry:l,properties:{raw_coordinates:o,time_since_update:m,train_id:g}}=a;m<0||this.purgeTrajectory(a)||(this.debug&&this.mode===Jr.TOPOGRAPHIC&&o?a.properties.olGeometry=this.format.readGeometry({coordinates:Ai(o,this.map.getView().getProjection()),type:"Point"}):a.properties.olGeometry=this.format.readGeometry(l),a.properties.timeOffset=Date.now()-t.timestamp,this.addTrajectory(a))}onZoomEnd(){this.startUpdateTime()}purgeOutOfDateTrajectories(){Object.entries(this.trajectories||{}).forEach(([t,a])=>{let l=a?.properties?.time_intervals;this.time&&l?.length&&l[l.length-1][0]<this.time.getTime()&&this.removeTrajectory(t)})}purgeTrajectory(t,a,l){let{bounds:o,type:m}=t.properties;return this.isUpdateBboxOnMoveEnd&&!ei(a,o)||this.mots&&!this.mots.includes(m)?(this.removeTrajectory(t),!0):!1}removeTrajectory(t){let a;typeof t!="string"?a=t?.properties?.train_id:a=t,a!==void 0&&this.trajectories&&delete this.trajectories[a]}renderTrajectories(t,a){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),t&&(!a&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(t,a)}):!a&&this.useDebounce?this.debounceRenderTrajectories(t,a):!a&&this.useThrottle?this.throttleRenderTrajectories(t,a):this.renderTrajectoriesInternal(t,a))}renderTrajectoriesInternal(t,a=!1){if(!this.map||!this.trajectories)return!1;let l=this.live?Date.now():this.time?.getTime(),o=Object.values(this.trajectories);return this.sort&&o.sort(this.sort),!this.canvas||!this.style||(this.renderState=Td(this.canvas,o,this.style,{...t,pixelRatio:this.pixelRatio||1,time:l},{filter:this.filter,hoverVehicleId:this.hoverVehicleId,noInterpolate:(t.zoom||0)<this.minZoomInterpolation?!0:a,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}selectVehicle(t){this.selectedVehicleId!==t&&(this.selectedVehicleId=t,this.renderTrajectories(!0))}setBbox(t,a){if(this.trajectories&&t&&a){let S=Object.keys(this.trajectories);for(let M=S.length-1;M>=0;M-=1)this.purgeTrajectory(this.trajectories[S[M]],t,a)}let l=Math.floor(a);if(!t||Number.isNaN(l))return;let[o,m,g,b]=t,A=[Math.floor(o),Math.floor(m),Math.ceil(g),Math.ceil(b),l];this.generalizationLevel=this.getGeneralizationLevelByZoom(l),this.generalizationLevel&&A.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(l),this.mots&&A.push(`mots=${this.mots}`),this.tenant&&A.push(`tenant=${this.tenant}`),this.mode!=="topographic"&&A.push(`channel_prefix=${this.mode}`),this.bboxParameters&&Object.entries(this.bboxParameters).forEach(([S,M])=>{A.push(`${S}=${M}`)}),this.api.bbox=A}start(){this.stop(),this.purgeOutOfDateTrajectories(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.onStart&&this.onStart(this)}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close(),this.onStop&&this.onStop(this)}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}}}var Eg=N3;var j3=new Ii,Yd=class extends xg{forEachFeatureAtCoordinate(e,t,a,l){let o=this.getFeaturesAtCoordinate(e,a);return o.forEach(m=>{l(m,this.layer_,m.getGeometry())}),o?.[0]}getData(e){let t;try{let{pixelRatio:a}=this.getLayer();return t=this.canvas?.getContext("2d",{willReadFrequently:!0})?.getImageData(e[0]*(a||1),e[1]*(a||1),1,1).data||null,t}catch(a){console.error("error getting data",a)}return null}getFeatures(e){let t=this.getLayer()?.getMapInternal()?.getCoordinateFromPixel(e);return Promise.resolve(this.getFeaturesAtCoordinate(t))}getFeaturesAtCoordinate(e,t=5){if(!e)return[];let a=this.getLayer(),o=a.getMapInternal()?.getView()?.getResolution()||1,m=10,g=Ln([...e,...e],t*o),b=[],A=Object.values(a.trajectories||{});a.sort&&(A=A.sort(this.sort));let S=[];for(let M=0;M<A.length;M+=1){let k=A[M];if(k.properties.coordinate&&Js(g,k.properties.coordinate)&&S.push(A[M]),S.length===m)break}return b=S.map(M=>j3.readFeature(M)),b}prepareFrame(){return!0}renderFrame(e){let{canvas:t,renderedViewState:a}=this.getLayer();if(this.container||(this.container=document.createElement("div"),this.container.className=this.getLayer().getClassName(),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",t instanceof HTMLCanvasElement&&(t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.transformOrigin="top left",this.container.appendChild(t))),a){let{center:l,resolution:o,rotation:m}=e.viewState,{center:g,resolution:b,rotation:A}=a;if(b/o>=3){let S=t?.getContext("2d");t?.width&&t?.height&&S?.clearRect(0,0,t.width,t.height)}else{let S=this.getLayer().getMapInternal(),M=S?.getPixelFromCoordinate(g),k=S?.getPixelFromCoordinate(l);M&&k&&(this.container.style.transform=UA(M[0]-k[0],M[1]-k[1],b/o,b/o,m-A,0,0))}}return this.container}};var U3=new $i({zIndex:2,image:new Vn({radius:5,fill:new qi({color:"#000000"})}),stroke:new ai({color:"#000000",width:6})}),G3=(s,e,t)=>{let a="#ffffff",l=s.get("type"),o=s.get("stroke");return o&&o[0]!=="#"&&(o=`#${o}`),a=o||t?.getBgColor(l),a=/#ffffff/i.test(a)?"#ff0000":a,[U3,new $i({zIndex:3,image:new Vn({radius:4,fill:new qi({color:a})}),stroke:new ai({color:a,width:4})})]},Ig=G3;var V3=new $i({zIndex:2,image:new Vn({radius:5,fill:new qi({color:"#000000"})}),stroke:new ai({color:"#000000",width:6})}),q3=new $i({zIndex:3,image:new Vn({radius:4,fill:new qi({color:"#a0a0a0"})}),stroke:new ai({color:"#a0a0a0",width:4})}),$3=()=>[V3,q3],G2=$3;var V2=new Vn({radius:6,fill:new qi({color:[255,0,0,1]}),stroke:new ai({color:[0,0,0,1],width:1})}),W3=new $i({stroke:new ai({color:[0,0,0,1],width:5})}),Z3=new $i({image:V2,stroke:new ai({color:[255,0,0,1],width:3})}),X3=new $i({image:V2,stroke:new ai({color:[255,0,0,1],width:3,lineDash:[1,10]})}),H3=(s,e)=>{let t=s.get("minResolution"),a=s.get("maxResolution"),l=e<=t&&e>a;return t&&a&&!l?[]:s.get("mot")!=="foot"?[W3,Z3]:[X3]},q2=H3;var K3=new Ii,mb=class s extends Eg(Ss(qo)){constructor(t){super({source:new pa({}),...t});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!t.allowRenderWhenAnimating,this.vectorLayer=new Jl({source:new Ql({features:[]}),style:(a,l)=>(t.fullTrajectoryStyle||Ig)(a,l,this.styleOptions),updateWhileAnimating:this.allowRenderWhenAnimating,updateWhileInteracting:!0}),this.renderState={center:[0,0],rotation:0,zoom:void 0},this.onZoomEndDebounced=(0,fb.default)(this.onZoomEnd,100),this.onMoveEndDebounced=(0,fb.default)(this.onMoveEnd,100)}attachToMap(t){if(super.attachToMap(t),this.map){this.getVisible()&&this.start();let a=this.map.getLayers().getArray().indexOf(this);this.map.getLayers().insertAt(a,this.vectorLayer),this.olEventsKeys.push(...this.map.on(["moveend","change:target"],l=>{let o=(l.map||l.target).getView();if(!o||o?.getAnimating()||o?.getInteracting())return;let m=o.getZoom();this.currentZoom!==m&&this.onZoomEndDebounced(l),this.currentZoom=m,this.onMoveEndDebounced(l)}),this.on("change:visible",l=>{l.target.getVisible()?this.start():this.stop()}),this.on("propertychange",l=>{/(opacity|visible|zIndex|minResolution|maxResolution|minZoom|maxZoom)/.test(l.key)&&this.vectorLayer.set(l.key,l.target.get(l.key))}))}}clone(t){return new s({...this.options,...t})}createRenderer(){return new Yd(this)}detachFromMap(){this.map?.removeLayer(this.vectorLayer),super.detachFromMap()}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView()?.getZoom()||0)}highlight(t){this.highlightVehicle(t?.get("train_id"))}highlightTrajectory(t){return t?this.api.getFullTrajectory(t,this.mode,this.getGeneralizationLevelByZoom(Math.floor(this.map?.getView()?.getZoom()||0))).then(a=>{let l=a.content;if(!l?.features?.length)return[];let o=K3.readFeatures(l);return this.vectorLayer?.getSource()?.clear(!0),o.length&&this.vectorLayer?.getSource()?.addFeatures(o),o}).catch(()=>(this.vectorLayer?.getSource()?.clear(!0),[])):(this.vectorLayer?.getSource()?.clear(!0),Promise.resolve([]))}onMoveEnd(t){!this.isUpdateBboxOnMoveEnd||!this.getVisible()||this.setBbox()}onZoomEnd(){super.onZoomEnd(),!(!this.isUpdateBboxOnMoveEnd||!this.getVisible())&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(t,a,l){let o=this.map.getView()?.getCenter();return!a&&!o?!1:super.purgeTrajectory(t,a||this.map.getView().calculateExtent(),l||this.map.getView().getZoom()||0)}renderTrajectories(t){if(!this.map)return;let a=this.map.getView();a?.getCenter()&&super.renderTrajectories({center:a.getCenter(),extent:a.calculateExtent(),pixelRatio:this.pixelRatio,resolution:a.getResolution(),rotation:a.getRotation(),size:this.map.getSize(),zoom:a.getZoom()},t)}renderTrajectoriesInternal(t,a){if(!this.map?.getView())return!1;let l=!1;if(l=(this.allowRenderWhenAnimating?!1:this.map.getView().getAnimating()||this.map.getView().getInteracting())?!1:super.renderTrajectoriesInternal(t,a),l){this.renderedViewState={...t};let{container:m}=this.getRenderer();m&&(m.style.transform="")}return l}select(t){this.selectVehicle(t?.get("train_id")),this.highlightTrajectory(t?.get("train_id"))}setBbox(t,a){let l=t||this.map?.getView()?.calculateExtent();l&&super.setBbox(l,a||this.map?.getView()?.getZoom()||0)}},$2=mb;var W2=ao(ec());var Z2=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Z2=(0,W2.default)(s=>{console.warn(s)},1e3));var gb=class s extends Ss(qo){constructor(e){super(e),Z2("Layer is deprecated. Use an OpenLayers Layer instead.")}clone(e){return new s({...this.options||{},...e||{}})}},Pg=gb;var yb=class s extends Pg{clone(e){return new s({...this.options,...e})}getFeatureInfoAtCoordinate(e){let t=[];if(this.map){let a=this.map.getPixelFromCoordinate(e);t=this.map.getFeaturesAtPixel(a,{hitTolerance:this.hitTolerance||5,layerFilter:l=>l===this.olLayer})||[]}return Promise.resolve({coordinate:e,features:t,layer:this})}},X2=yb;var Y3=new Ii,J3=(s,e,t)=>{let a,{coordinate:l,params:o,projection:m,resolution:g}=e;return s&&g&&m&&(a=s.getFeatureInfoUrl(l,g,m,{info_format:"application/json",query_layers:s.getParams().layers,...o})),fetch(a,{signal:t.signal}).then(b=>b.json()).then(b=>Y3.readFeatures(b)).catch(()=>[])},Jd={},Q3=async(s,e,t=5)=>{Object.values(Jd).forEach(o=>{o?.abort()}),Jd={};let l=Nl(e).map(o=>{let m=o.getMapInternal(),g=m?.getView()?.getProjection()?.getCode(),b={coordinate:s,features:[],layer:o};if(!g)return Promise.resolve(b);if(o.getFeatureInfoAtCoordinate)return o.getFeatureInfoAtCoordinate(s);let A=o?.getSource();if(A?.getFeatureInfoUrl){let k=Ut(o);Jd[k]?.abort(),Jd[k]=new AbortController;let j=m?.getView()?.getResolution();return J3(A,{coordinate:s,params:{info_format:"application/json",query_layers:A.getParams().layers},projection:g,resolution:j},Jd[k]).then(Z=>({coordinate:s,features:Z,layer:o})).catch(()=>({coordinate:s,features:[],layer:o}))}let S=m?.getPixelFromCoordinate(s);if(!S)return Promise.resolve(b);let M=m?.getFeaturesAtPixel(S,{hitTolerance:o.get("hitTolerance")||t||5,layerFilter:k=>k===o});return Promise.resolve({coordinate:s,features:M,layer:o})});return Promise.all(l)},H2=Q3;var Wy={};nx(Wy,{CopyrightControl:()=>K2,Layer:()=>Rg,RealtimeAPI:()=>nd,RealtimeLayer:()=>IL,RealtimeModes:()=>Jr,RoutingAPI:()=>od,StopsAPI:()=>sd,VECTOR_TILE_FEATURE_PROPERTY:()=>Tu,compareDepartures:()=>Cd,createCanvas:()=>zo,createRealtimeFilters:()=>bx,debounceDeparturesMessages:()=>h0,debounceWebsocketMessages:()=>id,getCircleCanvas:()=>yx,getDelayBgCanvas:()=>mx,getDelayTextCanvas:()=>gx,getHoursAndMinutes:()=>BA,getLayersAsFlatArray:()=>Nl,getMapGlCopyrights:()=>ad,getMercatorResolution:()=>EL,getSourceCoordinates:()=>$y,getTextCanvas:()=>_x,getUTCDateString:()=>OA,getUTCTimeString:()=>zA,getUrlWithParams:()=>Ol,getVehiclePosition:()=>Pd,pad:()=>Rm,realtimeConfig:()=>Pu,realtimeDefaultStyle:()=>zl,realtimeDelayStyle:()=>xx,realtimeSimpleStyle:()=>vx,removeDuplicate:()=>Bl,renderTrajectories:()=>Td,sortAndFilterDepartures:()=>Md,sortByDelay:()=>wx});var e5=" | ",_b=class{constructor(e={}){this.options=e}onAdd(e){return this.map=e,this.container||(this.container=document.createElement("div")),this.render=this.render.bind(this),this.map.on("idle",this.render),this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.render(),this.container}onRemove(){return this.container?.parentElement&&this.container.parentElement?.removeChild(this.container),this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),this.map=void 0,this.container}getDefaultPosition(){return"bottom-right"}render(){if(this.map&&this.container){let e=this.options?.separator||e5,t=this.options?.customAttribution||ad(this.map),a=(Array.isArray(t)?t:[t]).join(e);this.container.innerHTML!==a&&(this.content=a,this.container.innerHTML=this.content)}}},K2=_b;var Zi=[];for(Cg=0;Cg<256;++Cg)Zi.push((Cg+256).toString(16).slice(1));var Cg;function Y2(s,e=0){return(Zi[s[e+0]]+Zi[s[e+1]]+Zi[s[e+2]]+Zi[s[e+3]]+"-"+Zi[s[e+4]]+Zi[s[e+5]]+"-"+Zi[s[e+6]]+Zi[s[e+7]]+"-"+Zi[s[e+8]]+Zi[s[e+9]]+"-"+Zi[s[e+10]]+Zi[s[e+11]]+Zi[s[e+12]]+Zi[s[e+13]]+Zi[s[e+14]]+Zi[s[e+15]]).toLowerCase()}var Mg,t5=new Uint8Array(16);function xb(){if(!Mg&&(Mg=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Mg))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mg(t5)}var r5=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vb={randomUUID:r5};function i5(s,e,t){if(vb.randomUUID&&!e&&!s)return vb.randomUUID();s=s||{};var a=s.random||(s.rng||xb)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,e){t=t||0;for(var l=0;l<16;++l)e[t+l]=a[l];return e}return Y2(a)}var bb=i5;var J2=ao(tb()),wb=class extends J2.Evented{constructor(t={}){super();this.options={};this.type="custom";this.options=t,this.id=t.id||bb(),this.type="custom"}onAdd(t,a){this.map=t}onRemove(t,a){this.map=void 0}render(t){}},Rg=wb;var aL=ao(oL(),1),$G=Object.defineProperty,mr=(s,e)=>$G(s,"name",{value:e,configurable:!0}),WG=class{constructor(e){this.direction=!1,this.compareProperties=!0;var t,a,l;this.precision=10**-((t=e?.precision)!=null?t:17),this.direction=(a=e?.direction)!=null?a:!1,this.compareProperties=(l=e?.compareProperties)!=null?l:!0}compare(e,t){if(e.type!==t.type||!bf(e,t))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,t.coordinates);case"LineString":return this.compareLine(e.coordinates,t.coordinates);case"Polygon":return this.comparePolygon(e,t);case"GeometryCollection":return this.compareGeometryCollection(e,t);case"Feature":return this.compareFeature(e,t);case"FeatureCollection":return this.compareFeatureCollection(e,t);default:if(e.type.startsWith("Multi")){let a=kw(e),l=kw(t);return a.every(o=>l.some(m=>this.compare(o,m)))}}return!1}compareCoord(e,t){return e.length===t.length&&e.every((a,l)=>Math.abs(a-t[l])<this.precision)}compareLine(e,t,a=0,l=!1){if(!bf(e,t))return!1;let o=e,m=t;if(l&&!this.compareCoord(o[0],m[0])){let b=this.fixStartIndex(m,o);if(b)m=b;else return!1}let g=this.compareCoord(o[a],m[a]);return this.direction||g?this.comparePath(o,m):this.compareCoord(o[a],m[m.length-(1+a)])?this.comparePath(o.slice().reverse(),m):!1}fixStartIndex(e,t){let a,l=-1;for(let o=0;o<e.length;o++)if(this.compareCoord(e[o],t[0])){l=o;break}return l>=0&&(a=[].concat(e.slice(l,e.length),e.slice(1,l+1))),a}comparePath(e,t){return e.every((a,l)=>this.compareCoord(a,t[l]))}comparePolygon(e,t){if(this.compareLine(e.coordinates[0],t.coordinates[0],1,!0)){let a=e.coordinates.slice(1,e.coordinates.length),l=t.coordinates.slice(1,t.coordinates.length);return a.every(o=>l.some(m=>this.compareLine(o,m,1,!0)))}return!1}compareGeometryCollection(e,t){return bf(e.geometries,t.geometries)&&this.compareBBox(e,t)&&e.geometries.every((a,l)=>this.compare(a,t.geometries[l]))}compareFeature(e,t){return e.id===t.id&&(this.compareProperties?(0,aL.default)(e.properties,t.properties):!0)&&this.compareBBox(e,t)&&this.compare(e.geometry,t.geometry)}compareFeatureCollection(e,t){return bf(e.features,t.features)&&this.compareBBox(e,t)&&e.features.every((a,l)=>this.compare(a,t.features[l]))}compareBBox(e,t){return!e.bbox&&!t.bbox||(e.bbox&&t.bbox?this.compareCoord(e.bbox,t.bbox):!1)}};mr(WG,"GeojsonEquality");function bf(s,e){return s.coordinates?s.coordinates.length===e.coordinates.length:s.length===e.length}mr(bf,"sameLength");function kw(s){return s.coordinates.map(e=>({type:s.type.replace("Multi",""),coordinates:e}))}mr(kw,"explode");var Xi=63710088e-1,lL={centimeters:Xi*100,centimetres:Xi*100,degrees:360/(2*Math.PI),feet:Xi*3.28084,inches:Xi*39.37,kilometers:Xi/1e3,kilometres:Xi/1e3,meters:Xi,metres:Xi,miles:Xi/1609.344,millimeters:Xi*1e3,millimetres:Xi*1e3,nauticalmiles:Xi/1852,radians:1,yards:Xi*1.0936},sL={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Jo(s,e,t={}){let a={type:"Feature"};return(t.id===0||t.id)&&(a.id=t.id),t.bbox&&(a.bbox=t.bbox),a.properties=e||{},a.geometry=s,a}mr(Jo,"feature");function ZG(s,e,t={}){switch(s){case"Point":return Hi(e).geometry;case"LineString":return Ds(e).geometry;case"Polygon":return Fw(e).geometry;case"MultiPoint":return uL(e).geometry;case"MultiLineString":return cL(e).geometry;case"MultiPolygon":return hL(e).geometry;default:throw new Error(s+" is invalid")}}mr(ZG,"geometry");function Hi(s,e,t={}){if(!s)throw new Error("coordinates is required");if(!Array.isArray(s))throw new Error("coordinates must be an Array");if(s.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Sc(s[0])||!Sc(s[1]))throw new Error("coordinates must contain numbers");return Jo({type:"Point",coordinates:s},e,t)}mr(Hi,"point");function XG(s,e,t={}){return Uy(s.map(a=>Hi(a,e)),t)}mr(XG,"points");function Fw(s,e,t={}){for(let l of s){if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(l[l.length-1].length!==l[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<l[l.length-1].length;o++)if(l[l.length-1][o]!==l[0][o])throw new Error("First and last Position are not equivalent.")}return Jo({type:"Polygon",coordinates:s},e,t)}mr(Fw,"polygon");function HG(s,e,t={}){return Uy(s.map(a=>Fw(a,e)),t)}mr(HG,"polygons");function Ds(s,e,t={}){if(s.length<2)throw new Error("coordinates must be an array of two or more positions");return Jo({type:"LineString",coordinates:s},e,t)}mr(Ds,"lineString");function KG(s,e,t={}){return Uy(s.map(a=>Ds(a,e)),t)}mr(KG,"lineStrings");function Uy(s,e={}){let t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=s,t}mr(Uy,"featureCollection");function cL(s,e,t={}){return Jo({type:"MultiLineString",coordinates:s},e,t)}mr(cL,"multiLineString");function uL(s,e,t={}){return Jo({type:"MultiPoint",coordinates:s},e,t)}mr(uL,"multiPoint");function hL(s,e,t={}){return Jo({type:"MultiPolygon",coordinates:s},e,t)}mr(hL,"multiPolygon");function YG(s,e,t={}){return Jo({type:"GeometryCollection",geometries:s},e,t)}mr(YG,"geometryCollection");function JG(s,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");let t=Math.pow(10,e||0);return Math.round(s*t)/t}mr(JG,"round");function pL(s,e="kilometers"){let t=lL[e];if(!t)throw new Error(e+" units is invalid");return s*t}mr(pL,"radiansToLength");function Lw(s,e="kilometers"){let t=lL[e];if(!t)throw new Error(e+" units is invalid");return s/t}mr(Lw,"lengthToRadians");function QG(s,e){return Gy(Lw(s,e))}mr(QG,"lengthToDegrees");function eV(s){let e=s%360;return e<0&&(e+=360),e}mr(eV,"bearingToAzimuth");function Gy(s){return s%(2*Math.PI)*180/Math.PI}mr(Gy,"radiansToDegrees");function nl(s){return s%360*Math.PI/180}mr(nl,"degreesToRadians");function wf(s,e="kilometers",t="kilometers"){if(!(s>=0))throw new Error("length must be a positive number");return pL(Lw(s,e),t)}mr(wf,"convertLength");function tV(s,e="meters",t="kilometers"){if(!(s>=0))throw new Error("area must be a positive number");let a=sL[e];if(!a)throw new Error("invalid original units");let l=sL[t];if(!l)throw new Error("invalid final units");return s/a*l}mr(tV,"convertArea");function Sc(s){return!isNaN(s)&&s!==null&&!Array.isArray(s)}mr(Sc,"isNumber");function jh(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}mr(jh,"isObject");function rV(s){if(!s)throw new Error("bbox is required");if(!Array.isArray(s))throw new Error("bbox must be an Array");if(s.length!==4&&s.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");s.forEach(e=>{if(!Sc(e))throw new Error("bbox must only contain numbers")})}mr(rV,"validateBBox");function iV(s){if(!s)throw new Error("id is required");if(["string","number"].indexOf(typeof s)===-1)throw new Error("id must be a number or a string")}mr(iV,"validateId");var nV=Object.defineProperty,Ki=(s,e)=>nV(s,"name",{value:e,configurable:!0});function ma(s,e,t){if(s!==null)for(var a,l,o,m,g,b,A,S=0,M=0,k,j=s.type,Z=j==="FeatureCollection",te=j==="Feature",q=Z?s.features.length:1,H=0;H<q;H++){A=Z?s.features[H].geometry:te?s.geometry:s,k=A?A.type==="GeometryCollection":!1,g=k?A.geometries.length:1;for(var ae=0;ae<g;ae++){var pe=0,ve=0;if(m=k?A.geometries[ae]:A,m!==null){b=m.coordinates;var de=m.type;switch(S=t&&(de==="Polygon"||de==="MultiPolygon")?1:0,de){case null:break;case"Point":if(e(b,M,H,pe,ve)===!1)return!1;M++,pe++;break;case"LineString":case"MultiPoint":for(a=0;a<b.length;a++){if(e(b[a],M,H,pe,ve)===!1)return!1;M++,de==="MultiPoint"&&pe++}de==="LineString"&&pe++;break;case"Polygon":case"MultiLineString":for(a=0;a<b.length;a++){for(l=0;l<b[a].length-S;l++){if(e(b[a][l],M,H,pe,ve)===!1)return!1;M++}de==="MultiLineString"&&pe++,de==="Polygon"&&ve++}de==="Polygon"&&pe++;break;case"MultiPolygon":for(a=0;a<b.length;a++){for(ve=0,l=0;l<b[a].length;l++){for(o=0;o<b[a][l].length-S;o++){if(e(b[a][l][o],M,H,pe,ve)===!1)return!1;M++}ve++}pe++}break;case"GeometryCollection":for(a=0;a<m.geometries.length;a++)if(ma(m.geometries[a],e,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}Ki(ma,"coordEach");function oV(s,e,t,a){var l=t;return ma(s,function(o,m,g,b,A){m===0&&t===void 0?l=o:l=e(l,o,m,g,b,A)},a),l}Ki(oV,"coordReduce");function dL(s,e){var t;switch(s.type){case"FeatureCollection":for(t=0;t<s.features.length&&e(s.features[t].properties,t)!==!1;t++);break;case"Feature":e(s.properties,0);break}}Ki(dL,"propEach");function sV(s,e,t){var a=t;return dL(s,function(l,o){o===0&&t===void 0?a=l:a=e(a,l,o)}),a}Ki(sV,"propReduce");function fL(s,e){if(s.type==="Feature")e(s,0);else if(s.type==="FeatureCollection")for(var t=0;t<s.features.length&&e(s.features[t],t)!==!1;t++);}Ki(fL,"featureEach");function aV(s,e,t){var a=t;return fL(s,function(l,o){o===0&&t===void 0?a=l:a=e(a,l,o)}),a}Ki(aV,"featureReduce");function lV(s){var e=[];return ma(s,function(t){e.push(t)}),e}Ki(lV,"coordAll");function Dw(s,e){var t,a,l,o,m,g,b,A,S,M,k=0,j=s.type==="FeatureCollection",Z=s.type==="Feature",te=j?s.features.length:1;for(t=0;t<te;t++){for(g=j?s.features[t].geometry:Z?s.geometry:s,A=j?s.features[t].properties:Z?s.properties:{},S=j?s.features[t].bbox:Z?s.bbox:void 0,M=j?s.features[t].id:Z?s.id:void 0,b=g?g.type==="GeometryCollection":!1,m=b?g.geometries.length:1,l=0;l<m;l++){if(o=b?g.geometries[l]:g,o===null){if(e(null,k,A,S,M)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(o,k,A,S,M)===!1)return!1;break}case"GeometryCollection":{for(a=0;a<o.geometries.length;a++)if(e(o.geometries[a],k,A,S,M)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}k++}}Ki(Dw,"geomEach");function cV(s,e,t){var a=t;return Dw(s,function(l,o,m,g,b){o===0&&t===void 0?a=l:a=e(a,l,o,m,g,b)}),a}Ki(cV,"geomReduce");function Vy(s,e){Dw(s,function(t,a,l,o,m){var g=t===null?null:t.type;switch(g){case null:case"Point":case"LineString":case"Polygon":return e(Jo(t,l,{bbox:o,id:m}),a,0)===!1?!1:void 0}var b;switch(g){case"MultiPoint":b="Point";break;case"MultiLineString":b="LineString";break;case"MultiPolygon":b="Polygon";break}for(var A=0;A<t.coordinates.length;A++){var S=t.coordinates[A],M={type:b,coordinates:S};if(e(Jo(M,l),a,A)===!1)return!1}})}Ki(Vy,"flattenEach");function uV(s,e,t){var a=t;return Vy(s,function(l,o,m){o===0&&m===0&&t===void 0?a=l:a=e(a,l,o,m)}),a}Ki(uV,"flattenReduce");function mL(s,e){Vy(s,function(t,a,l){var o=0;if(t.geometry){var m=t.geometry.type;if(!(m==="Point"||m==="MultiPoint")){var g,b=0,A=0,S=0;if(ma(t,function(M,k,j,Z,te){if(g===void 0||a>b||Z>A||te>S){g=M,b=a,A=Z,S=te,o=0;return}var q=Ds([g,M],t.properties);if(e(q,a,l,te,o)===!1)return!1;o++,g=M})===!1)return!1}}})}Ki(mL,"segmentEach");function hV(s,e,t){var a=t,l=!1;return mL(s,function(o,m,g,b,A){l===!1&&t===void 0?a=o:a=e(a,o,m,g,b,A),l=!0}),a}Ki(hV,"segmentReduce");function gL(s,e){if(!s)throw new Error("geojson is required");Vy(s,function(t,a,l){if(t.geometry!==null){var o=t.geometry.type,m=t.geometry.coordinates;switch(o){case"LineString":if(e(t,a,l,0,0)===!1)return!1;break;case"Polygon":for(var g=0;g<m.length;g++)if(e(Ds(m[g],t.properties),a,l,g)===!1)return!1;break}}})}Ki(gL,"lineEach");function pV(s,e,t){var a=t;return gL(s,function(l,o,m,g){o===0&&t===void 0?a=l:a=e(a,l,o,m,g)}),a}Ki(pV,"lineReduce");function dV(s,e){if(e=e||{},!jh(e))throw new Error("options is invalid");var t=e.featureIndex||0,a=e.multiFeatureIndex||0,l=e.geometryIndex||0,o=e.segmentIndex||0,m=e.properties,g;switch(s.type){case"FeatureCollection":t<0&&(t=s.features.length+t),m=m||s.features[t].properties,g=s.features[t].geometry;break;case"Feature":m=m||s.properties,g=s.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":g=s;break;default:throw new Error("geojson is invalid")}if(g===null)return null;var b=g.coordinates;switch(g.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=b.length+o-1),Ds([b[o],b[o+1]],m,e);case"Polygon":return l<0&&(l=b.length+l),o<0&&(o=b[l].length+o-1),Ds([b[l][o],b[l][o+1]],m,e);case"MultiLineString":return a<0&&(a=b.length+a),o<0&&(o=b[a].length+o-1),Ds([b[a][o],b[a][o+1]],m,e);case"MultiPolygon":return a<0&&(a=b.length+a),l<0&&(l=b[a].length+l),o<0&&(o=b[a][l].length-o-1),Ds([b[a][l][o],b[a][l][o+1]],m,e)}throw new Error("geojson is invalid")}Ki(dV,"findSegment");function fV(s,e){if(e=e||{},!jh(e))throw new Error("options is invalid");var t=e.featureIndex||0,a=e.multiFeatureIndex||0,l=e.geometryIndex||0,o=e.coordIndex||0,m=e.properties,g;switch(s.type){case"FeatureCollection":t<0&&(t=s.features.length+t),m=m||s.features[t].properties,g=s.features[t].geometry;break;case"Feature":m=m||s.properties,g=s.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":g=s;break;default:throw new Error("geojson is invalid")}if(g===null)return null;var b=g.coordinates;switch(g.type){case"Point":return Hi(b,m,e);case"MultiPoint":return a<0&&(a=b.length+a),Hi(b[a],m,e);case"LineString":return o<0&&(o=b.length+o),Hi(b[o],m,e);case"Polygon":return l<0&&(l=b.length+l),o<0&&(o=b[l].length+o),Hi(b[l][o],m,e);case"MultiLineString":return a<0&&(a=b.length+a),o<0&&(o=b[a].length+o),Hi(b[a][o],m,e);case"MultiPolygon":return a<0&&(a=b.length+a),l<0&&(l=b[a].length+l),o<0&&(o=b[a][l].length-o),Hi(b[a][l][o],m,e)}throw new Error("geojson is invalid")}Ki(fV,"findPoint");var mV=Object.defineProperty,gV=(s,e)=>mV(s,"name",{value:e,configurable:!0});function Ow(s,e={}){let t=0,a=0,l=0;return ma(s,function(o){t+=o[0],a+=o[1],l++},!0),Hi([t/l,a/l],e.properties)}gV(Ow,"centroid");var yV=Object.defineProperty,ol=(s,e)=>yV(s,"name",{value:e,configurable:!0});function Qo(s){if(!s)throw new Error("coord is required");if(!Array.isArray(s)){if(s.type==="Feature"&&s.geometry!==null&&s.geometry.type==="Point")return[...s.geometry.coordinates];if(s.type==="Point")return[...s.coordinates]}if(Array.isArray(s)&&s.length>=2&&!Array.isArray(s[0])&&!Array.isArray(s[1]))return[...s];throw new Error("coord must be GeoJSON Point or an Array of numbers")}ol(Qo,"getCoord");function zw(s){if(Array.isArray(s))return s;if(s.type==="Feature"){if(s.geometry!==null)return s.geometry.coordinates}else if(s.coordinates)return s.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}ol(zw,"getCoords");function yL(s){if(s.length>1&&Sc(s[0])&&Sc(s[1]))return!0;if(Array.isArray(s[0])&&s[0].length)return yL(s[0]);throw new Error("coordinates must only contain numbers")}ol(yL,"containsNumber");function _V(s,e,t){if(!e||!t)throw new Error("type and name required");if(!s||s.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+s.type)}ol(_V,"geojsonType");function xV(s,e,t){if(!s)throw new Error("No feature passed");if(!t)throw new Error(".featureOf() requires a name");if(!s||s.type!=="Feature"||!s.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!s.geometry||s.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+s.geometry.type)}ol(xV,"featureOf");function vV(s,e,t){if(!s)throw new Error("No featureCollection passed");if(!t)throw new Error(".collectionOf() requires a name");if(!s||s.type!=="FeatureCollection")throw new Error("Invalid input to "+t+", FeatureCollection required");for(let a of s.features){if(!a||a.type!=="Feature"||!a.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!a.geometry||a.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+a.geometry.type)}}ol(vV,"collectionOf");function bV(s){return s.type==="Feature"?s.geometry:s}ol(bV,"getGeom");function wV(s,e){return s.type==="FeatureCollection"?"FeatureCollection":s.type==="GeometryCollection"?"GeometryCollection":s.type==="Feature"&&s.geometry!==null?s.geometry.type:s.type}ol(wV,"getType");var SV=Object.defineProperty,_L=(s,e)=>SV(s,"name",{value:e,configurable:!0});function Nw(s,e,t={}){let a;return t.final?a=Bw(Qo(e),Qo(s)):a=Bw(Qo(s),Qo(e)),a>180?-(360-a):a}_L(Nw,"rhumbBearing");function Bw(s,e){let t=nl(s[1]),a=nl(e[1]),l=nl(e[0]-s[0]);l>Math.PI&&(l-=2*Math.PI),l<-Math.PI&&(l+=2*Math.PI);let o=Math.log(Math.tan(a/2+Math.PI/4)/Math.tan(t/2+Math.PI/4)),m=Math.atan2(l,o);return(Gy(m)+360)%360}_L(Bw,"calculateRhumbBearing");var AV=Object.defineProperty,xL=(s,e)=>AV(s,"name",{value:e,configurable:!0});function jw(s,e,t={}){let a=Qo(s),l=Qo(e);l[0]+=l[0]-a[0]>180?-360:a[0]-l[0]>180?360:0;let o=vL(a,l);return wf(o,"meters",t.units)}xL(jw,"rhumbDistance");function vL(s,e,t){t=t===void 0?Xi:Number(t);let a=t,l=s[1]*Math.PI/180,o=e[1]*Math.PI/180,m=o-l,g=Math.abs(e[0]-s[0])*Math.PI/180;g>Math.PI&&(g-=2*Math.PI);let b=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(l/2+Math.PI/4)),A=Math.abs(b)>1e-11?m/b:Math.cos(l);return Math.sqrt(m*m+A*A*g*g)*a}xL(vL,"calculateRhumbDistance");var EV=Object.defineProperty,bL=(s,e)=>EV(s,"name",{value:e,configurable:!0});function Uw(s,e,t,a={}){let l=e<0,o=wf(Math.abs(e),a.units,"meters");l&&(o=-Math.abs(o));let m=Qo(s),g=wL(m,o,t);return g[0]+=g[0]-m[0]>180?-360:m[0]-g[0]>180?360:0,Hi(g,a.properties)}bL(Uw,"rhumbDestination");function wL(s,e,t,a){a=a===void 0?Xi:Number(a);let l=e/a,o=s[0]*Math.PI/180,m=nl(s[1]),g=nl(t),b=l*Math.cos(g),A=m+b;Math.abs(A)>Math.PI/2&&(A=A>0?Math.PI-A:-Math.PI-A);let S=Math.log(Math.tan(A/2+Math.PI/4)/Math.tan(m/2+Math.PI/4)),M=Math.abs(S)>1e-11?b/S:Math.cos(m),k=l*Math.sin(g)/M;return[((o+k)*180/Math.PI+540)%360-180,A*180/Math.PI]}bL(wL,"calculateRhumbDestination");var IV=Object.defineProperty,Uh=(s,e)=>IV(s,"name",{value:e,configurable:!0});function Gw(s){if(!s)throw new Error("geojson is required");switch(s.type){case"Feature":return Vw(s);case"FeatureCollection":return SL(s);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return qy(s);default:throw new Error("unknown GeoJSON type")}}Uh(Gw,"clone");function Vw(s){let e={type:"Feature"};return Object.keys(s).forEach(t=>{switch(t){case"type":case"properties":case"geometry":return;default:e[t]=s[t]}}),e.properties=qw(s.properties),s.geometry==null?e.geometry=null:e.geometry=qy(s.geometry),e}Uh(Vw,"cloneFeature");function qw(s){let e={};return s&&Object.keys(s).forEach(t=>{let a=s[t];typeof a=="object"?a===null?e[t]=null:Array.isArray(a)?e[t]=a.map(l=>l):e[t]=qw(a):e[t]=a}),e}Uh(qw,"cloneProperties");function SL(s){let e={type:"FeatureCollection"};return Object.keys(s).forEach(t=>{switch(t){case"type":case"features":return;default:e[t]=s[t]}}),e.features=s.features.map(t=>Vw(t)),e}Uh(SL,"cloneFeatureCollection");function qy(s){let e={type:s.type};return s.bbox&&(e.bbox=s.bbox),s.type==="GeometryCollection"?(e.geometries=s.geometries.map(t=>qy(t)),e):(e.coordinates=$w(s.coordinates),e)}Uh(qy,"cloneGeometry");function $w(s){let e=s;return typeof e[0]!="object"?e.slice():e.map(t=>$w(t))}Uh($w,"deepSlice");var PV=Object.defineProperty,TV=(s,e)=>PV(s,"name",{value:e,configurable:!0});function AL(s,e,t){if(t=t||{},!jh(t))throw new Error("options is invalid");var a=t.pivot,l=t.mutate;if(!s)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("angle is required");return e===0||(a||(a=Ow(s)),(l===!1||l===void 0)&&(s=Gw(s)),ma(s,function(o){var m=Nw(a,o),g=m+e,b=jw(a,o),A=zw(Uw(a,b,g));o[0]=A[0],o[1]=A[1]})),s}TV(AL,"transformRotate");var Ww=AL;var CV=(s,e=1)=>{let{height:t,width:a}=s.getCanvas(),l=s.unproject({x:0,y:0}),o=s.unproject({x:0,y:t/e}),m=s.unproject({x:a/e,y:t/e}),g=s.unproject({x:a/e,y:0});return[[l.lng,l.lat],[g.lng,g.lat],[m.lng,m.lat],[o.lng,o.lat]]},$y=CV;var MV=s=>{let e=s.getBounds().toArray(),t=Ai(e[0]),a=Ai(e[1]),l=[...t,...a],{width:o,height:m}=s.getCanvas(),g=kr(l)/o,b=si(l)/m;return Math.max(g,b)},EL=MV;var RV=s=>dd(s.toArray().flat(),"EPSG:4326","EPSG:3857"),Zw=RV;var Xw=class extends Eg(Rg){constructor(e={}){let t=document.createElement("canvas");super({canvas:t,id:"realtime",...e}),this.source={id:this.id,type:"canvas",canvas:this.canvas,coordinates:[[0,0],[1,1],[2,2],[0,0]],animate:!0,attribution:e.attribution?.join(", "),loaded:!0},this.layer={id:`${this.id}-raster`,type:"raster",source:this.id,layout:{visibility:"visible"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this)}onAdd(e,t){super.onAdd(e,t),e.isStyleLoaded()&&this.onLoad(),e.on("load",this.onLoad)}onRemove(e,t){e.off("load",this.onLoad),e.getLayer(this.layer.id)&&e.removeLayer(this.layer.id),e.getSource(this.id)&&e.removeSource(this.id),super.onRemove(e,t)}onLoad(){this.map.getSource(this.id)||this.map.addSource(this.id,this.source),this.map.getLayer(this.layer.id)||this.map.addLayer(this.layer,this.id),this.start()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map?.off("move",this.onMove),this.map?.off("moveend",this.onMoveEnd),this.map?.off("zoomend",this.onZoomEnd)}renderTrajectories(e=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:t,height:a}=this.map.getCanvas(),l=this.map.getCenter(),o=this.map.unproject({x:0,y:a/this.pixelRatio}),m=this.map.unproject({x:t/this.pixelRatio,y:0}),g=Ww(Hi([o.lng,o.lat]),-this.map.getBearing(),{pivot:[l.lng,l.lat]}).geometry.coordinates,b=Ww(Hi([m.lng,m.lat]),-this.map.getBearing(),{pivot:[l.lng,l.lat]}).geometry.coordinates,A=[...Ai(g),...Ai(b)],S=kr(A)/(t/this.pixelRatio),M=si(A)/(a/this.pixelRatio),k=Math.max(S,M),j={size:[t/this.pixelRatio,a/this.pixelRatio],center:Ai([l.lng,l.lat]),extent:A,resolution:k,zoom:this.map.getZoom()-1,rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(j,e)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}purgeTrajectory(e,t,a){return super.purgeTrajectory(e,t||Zw(this.map.getBounds()),a||Math.floor(this.map.getZoom()-1))}setBbox(e,t){super.setBbox(e||Zw(this.map.getBounds()),t||this.map.getZoom()-1)}renderTrajectoriesInternal(e,t=!1){let a=super.renderTrajectoriesInternal(e,t);if(a&&this.map.style){let l=$y(this.map,this.pixelRatio),o=this.map.getSource(this.id);o&&o.setCoordinates(l)}return a}onMove(){this.renderTrajectories()}onMoveEnd(){this.renderTrajectories(),this.isUpdateBboxOnMoveEnd&&this.setBbox()}},IL=Xw;var Hw={ol:Tg,maplibre:Wy};typeof window<"u"&&(window.mbt=Hw);var Ooe=Hw;})();
589
589
  /*! Bundled license information:
590
590
 
591
591
  maplibre-gl/dist/maplibre-gl.js: