!function(){"use strict";var t={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const e=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function i(t,i){const n={};for(const e in t)"ref"!==e&&(n[e]=t[e]);return e.forEach((t=>{t in i&&(n[t]=i[t])})),n}function n(t){t=t.slice();const e=Object.create(null);for(let i=0;i`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const w=[o,a,l,h,u,c,f,d,x(g),m,y,_];function b(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!b(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of w)if(!b(t,e))return null}return`Expected ${v(t)} but found ${v(e)} instead.`}function S(t,e){return e.some((e=>e.kind===t.kind))}function C(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function E(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const R=.96422,T=.82521,I=4/29,M=6/29,k=3*M*M,P=M*M*M,F=Math.PI/180,A=180/Math.PI;function L(t){return(t%=360)<0&&(t+=360),t}function O([t,e,i,n]){let r,s;const o=D((.2225045*(t=z(t))+.7168786*(e=z(e))+.0606169*(i=z(i)))/1);t===e&&e===i?r=s=o:(r=D((.4360747*t+.3850649*e+.1430804*i)/R),s=D((.0139322*t+.0971045*e+.7141733*i)/T));const a=116*o-16;return[a<0?0:a,500*(r-o),200*(o-s),n]}function z(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function D(t){return t>P?Math.pow(t,1/3):t/k+I}function j([t,e,i,n]){let r=(t+16)/116,s=isNaN(e)?r:r+e/500,o=isNaN(i)?r:r-i/200;return r=1*G(r),s=R*G(s),o=T*G(o),[N(3.1338561*s-1.6168667*r-.4906146*o),N(-.9787684*s+1.9161415*r+.033454*o),N(.0719453*s-.2289914*r+1.4052427*o),n]}function N(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function G(t){return t>M?t*t*t:k*(t-I)}function X(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=U[t];if(e){const[t,i,n]=e;return[t/255,i/255,n/255,1]}if(t.startsWith("#")){if(/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[W(t.slice(i,i+=e)),W(t.slice(i,i+=e)),W(t.slice(i,i+=e)),W(t.slice(i,i+e)||"ff")]}}if(t.startsWith("rgb")){const e=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=t.match(e);if(i){const[t,e,n,r,s,o,a,l,h,u,c,d]=i,g=[r||" ",a||" ",u].join("");if(" "===g||" /"===g||",,"===g||",,,"===g){const t=[n,o,h].join(""),i="%%%"===t?100:""===t?255:0;if(i){const t=[V(+e/i,0,1),V(+s/i,0,1),V(+l/i,0,1),c?q(+c,d):1];if($(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,n,r,s,o,a,l,h]=i,u=[n||" ",s||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const t=[+e,V(+r,0,100),V(+o,0,100),l?q(+l,h):1];if($(t))return function([t,e,i,n]){function r(n){const r=(n+t/30)%12,s=e*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(r-3,9-r,1))}return t=L(t),e/=100,i/=100,[r(0),r(8),r(4),n]}(t)}}}function W(t){return parseInt(t.padEnd(2,t),16)/255}function q(t,e){return V(e?t/100:t,0,1)}function V(t,e,i){return Math.min(Math.max(e,t),i)}function $(t){return!t.some(Number.isNaN)}const U={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function K(t,e,i){return t+i*(e-t)}function B(t,e,i){return t.map(((t,n)=>K(t,e[n],i)))}class Z{constructor(t,e,i,n=1,r=!0){this.r=t,this.g=e,this.b=i,this.a=n,r||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,e,i,n]))}static parse(t){if(t instanceof Z)return t;if("string"!=typeof t)return;const e=X(t);return e?new Z(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:n}=this,r=n||1/0;return this.overwriteGetter("rgb",[t/r,e/r,i/r,n])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,n,r]=O(t),s=Math.sqrt(i*i+n*n);return[Math.round(1e4*s)?L(Math.atan2(n,i)*A):NaN,s,e,r]}(this.rgb))}get lab(){return this.overwriteGetter("lab",O(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,n]=this.rgb;return`rgba(${[t,e,i].map((t=>Math.round(255*t))).join(",")},${n})`}static interpolate(t,e,i,n="rgb"){switch(n){case"rgb":{const[n,r,s,o]=B(t.rgb,e.rgb,i);return new Z(n,r,s,o,!1)}case"hcl":{const[n,r,s,o]=t.hcl,[a,l,h,u]=e.hcl;let c,d;if(isNaN(n)||isNaN(a))isNaN(n)?isNaN(a)?c=NaN:(c=a,1!==s&&0!==s||(d=l)):(c=n,1!==h&&0!==h||(d=r));else{let t=a-n;a>n&&t>180?t-=360:a180&&(t+=360),c=n+i*t}const[g,p,f,m]=function([t,e,i,n]){return t=isNaN(t)?0:t*F,j([i,Math.cos(t)*e,Math.sin(t)*e,n])}([c,null!=d?d:K(r,l,i),K(s,h,i),K(o,u,i)]);return new Z(g,p,f,m,!1)}case"lab":{const[n,r,s,o]=j(B(t.lab,e.lab,i));return new Z(n,r,s,o,!1)}}}}Z.black=new Z(0,0,0,1),Z.white=new Z(1,1,1,1),Z.transparent=new Z(0,0,0,0),Z.red=new Z(1,0,0,1);class Y{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const H=["bottom","center","top"];class J{constructor(t,e,i,n,r,s){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r,this.verticalAlign=s}}class Q{constructor(t){this.sections=t}static fromString(t){return new Q([new J(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Q?t:Q.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class tt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof tt)return t;if("number"==typeof t)return new tt([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new tt(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new tt(B(t.values,e.values,i))}}class et{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const it=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class nt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof nt)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255)){return`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}return void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`}function at(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof st||t instanceof Z||t instanceof Y||t instanceof Q||t instanceof tt||t instanceof nt||t instanceof rt)return!0;if(Array.isArray(t)){for(const e of t)if(!at(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!at(t[e]))return!1;return!0}return!1}function lt(t){if(null===t)return o;if("string"==typeof t)return l;if("boolean"==typeof t)return h;if("number"==typeof t)return a;if(t instanceof Z)return u;if(t instanceof st)return c;if(t instanceof Y)return p;if(t instanceof Q)return f;if(t instanceof tt)return m;if(t instanceof nt)return _;if(t instanceof rt)return y;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=lt(e);if(i){if(i===t)continue;i=g;break}i=t}return x(i||g,e)}return d}function ht(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Z||t instanceof st||t instanceof Q||t instanceof tt||t instanceof nt||t instanceof rt?t.toString():JSON.stringify(t)}class ut{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!at(t[1]))return e.error("invalid value");const i=t[1];let n=lt(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new ut(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const ct={string:l,number:a,boolean:h,object:d};class dt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,s;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in ct)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=ct[i],n++}else r=g;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}i=x(r,s)}else{if(!ct[r])throw new Error(`Types doesn't contain name = ${r}`);i=ct[r]}const s=[];for(;nt.outputDefined()))}}const gt={"to-boolean":h,"to-color":u,"to-number":a,"to-string":l};class pt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!gt[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=gt[i],r=[];for(let i=1;i4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:ot(e[0],e[1],e[2],e[3]),!i))return new Z(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new et(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const i of this.args){e=i.evaluate(t);const n=tt.parse(e);if(n)return n}throw new et(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const n=nt.parse(e);if(n)return n}throw new et(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new et(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return Q.fromString(ht(this.args[0].evaluate(t)));case"resolvedImage":return rt.fromString(ht(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return ht(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const ft=["Unknown","Point","LineString","Polygon"];class mt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?ft[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Z.parse(t)),e}}class yt{constructor(t,e,i=[],n,r=new s,o=[]){this.registry=t,this.path=i,this.key=i.map((t=>`[${t}]`)).join(""),this.scope=r,this.errors=o,this.expectedType=n,this._isConstant=e}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new dt(e,[t]):"coerce"===i?new pt(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("projectionDefinition"!==t.kind||"string"!==r.kind&&"array"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind)if("padding"!==t.kind||"value"!==r.kind&&"number"!==r.kind&&"array"!==r.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==r.kind&&"array"!==r.kind){if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof ut)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const t=new mt;try{n=new ut(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new yt(this.registry,this._isConstant,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new r(i,t))}checkSubtype(t,e){const i=b(t,e);return i&&this.error(i),i}}class _t{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n=i.length)throw new et(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new et(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class wt{constructor(t,e){this.type=h,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,g),n=e.parse(t[2],2,g);return i&&n?S(i.type,[h,l,a,o,g])?new wt(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${v(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!C(e,["boolean","string","number","null"]))throw new et(`Expected first argument to be of type boolean, string, number or null, but found ${v(lt(e))} instead.`);if(!C(i,["string","array"]))throw new et(`Expected second argument to be of type array or string, but found ${v(lt(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class bt{constructor(t,e,i){this.type=a,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,g),n=e.parse(t[2],2,g);if(!i||!n)return null;if(!S(i.type,[h,l,a,o,g]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${v(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,a);return r?new bt(i,n,r):null}return new bt(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!C(e,["boolean","string","number","null"]))throw new et(`Expected first argument to be of type boolean, string, number or null, but found ${v(lt(e))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),C(i,["string"])){const t=i.indexOf(e,n);return-1===t?-1:[...i.slice(0,t)].length}if(C(i,["array"]))return i.indexOf(e,n);throw new et(`Expected second argument to be of type array or string, but found ${v(lt(i))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class St{constructor(t,e,i,n,r,s){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},s=[];for(let o=2;oNumber.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,lt(t)))return null}else i=lt(t);if(void 0!==r[String(t)])return h.error("Branch labels must be unique.");r[String(t)]=s.length}const u=e.parse(l,o,n);if(!u)return null;n=n||u.type,s.push(u)}const o=e.parse(t[1],1,g);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new St(i,n,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(lt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class Ct{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;re.outputDefined()))&&this.otherwise.outputDefined()}}class Et{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,g),n=e.parse(t[2],2,a);if(!i||!n)return null;if(!S(i.type,[x(g),l,g]))return e.error(`Expected first argument to be of type array or string, but found ${v(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,a);return r?new Et(i.type,i,n,r):null}return new Et(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);let n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),C(e,["string"]))return[...e].slice(i,n).join("");if(C(e,["array"]))return e.slice(i,n);throw new et(`Expected first argument to be of type array or string, but found ${v(lt(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Rt(t,e){const i=t.length-1;let n,r,s=0,o=i,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],r=t[a+1],n<=e){if(a===i||ee))throw new et("Input is not a number.");o=a-1}return 0}class Tt{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,a);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const h=e.parse(o,l,r);if(!h)return null;r=r||h.type,n.push([s,h])}return new Tt(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);return i[Rt(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function It(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Mt,kt;var Pt=function(){if(kt)return Mt;function t(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}return kt=1,Mt=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var r=this.sampleCurveX(i)-t;if(Math.abs(r)r?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},Mt}(),Ft=It(Pt);class At{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let r=0;if("exponential"===t.name)r=Lt(e,t.base,i,n);else if("linear"===t.name)r=Lt(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new Ft(s[0],s[1],s[2],s[3]).solve(Lt(e,1,i,n))}return r}static parse(t,e){let[i,n,r,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,a),!r)return null;const o=[];let l=null;"interpolate-hcl"===i||"interpolate-lab"===i?l=u:e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(let t=0;t=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const h=e.parse(n,a,l);if(!h)return null;l=l||h.type,o.push([i,h])}return E(l,a)||E(l,c)||E(l,u)||E(l,m)||E(l,_)||E(l,x(a))?new At(l,i,n,r,o):e.error(`Type ${v(l)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const s=Rt(e,n),o=e[s],a=e[s+1],l=At.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return K(h,u,l);case"color":return Z.interpolate(h,u,l);case"padding":return tt.interpolate(h,u,l);case"variableAnchorOffsetCollection":return nt.interpolate(h,u,l);case"array":return B(h,u,l);case"projectionDefinition":return st.interpolate(h,u,l)}case"interpolate-hcl":return Z.interpolate(h,u,l,"hcl");case"interpolate-lab":return Z.interpolate(h,u,l,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Lt(t,e,i,n){const r=n-i,s=t-i;return 0===r?0:1===e?s/r:(Math.pow(e,s)-1)/(Math.pow(e,r)-1)}class Ot{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=null;const n=e.expectedType;n&&"value"!==n.kind&&(i=n);const r=[];for(const n of t.slice(1)){const t=e.parse(n,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,r.push(t)}if(!i)throw new Error("No output type");const s=n&&r.some((t=>b(n,t.type)));return new Ot(s?g:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args)if(n++,i=r.evaluate(t),i&&i instanceof rt&&!i.available&&(e||(e=i.name),i=null,n===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}function zt(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Dt(t,e,i,n){return 0===n.compare(e,i)}function jt(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=h,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let s=e.parse(t[1],1,g);if(!s)return null;if(!zt(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${v(s.type)}'.`);let o=e.parse(t[2],2,g);if(!o)return null;if(!zt(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${v(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${v(s.type)}' and '${v(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new dt(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new dt(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,p),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=lt(s),i=lt(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new et(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=lt(s),i=lt(o);if("string"!==t.kind||"string"!==i.kind)return e(r,s,o)}return this.collator?i(r,s,o,this.collator.evaluate(r)):e(r,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const Nt=jt("==",(function(t,e,i){return e===i}),Dt),Gt=jt("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!Dt(0,e,i,n)})),Xt=jt("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),qt=jt("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),Vt=jt(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class $t{constructor(t,e,i){this.type=p,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,h);if(!n)return null;const r=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,h);if(!r)return null;let s=null;return i.locale&&(s=e.parse(i.locale,1,l),!s)?null:new $t(n,r,s)}evaluate(t){return new Y(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Ut{constructor(t,e,i,n,r){this.type=l,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=r}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,a);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,l),!r))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,l),!s))return null;let o=null;if(n["min-fraction-digits"]&&(o=e.parse(n["min-fraction-digits"],1,a),!o))return null;let h=null;return n["max-fraction-digits"]&&(h=e.parse(n["max-fraction-digits"],1,a),!h)?null:new Ut(i,r,s,o,h)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Kt{constructor(t){this.type=f,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const s=t[i];if(r&&"object"==typeof s&&!Array.isArray(s)){r=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,a),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,x(l)),!i))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,u),!o))return null;let h=null;if(s["vertical-align"]){if("string"==typeof s["vertical-align"]&&!H.includes(s["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(h=e.parse(s["vertical-align"],1,l),!h)return null}const c=n[n.length-1];c.scale=t,c.font=i,c.textColor=o,c.verticalAlign=h}else{const s=e.parse(t[i],1,g);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:s,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Kt(n)}evaluate(t){return new Q(this.sections.map((e=>{const i=e.content.evaluate(t);return lt(i)===y?new J("",i,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new J(ht(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class Bt{constructor(t){this.type=y,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,l);return i?new Bt(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=rt.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class Zt{constructor(t){this.type=a,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${v(i.type)} instead.`):new Zt(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new et(`Expected value to be of type string or array, but found ${v(lt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Yt=8192;function Ht(t,e){const i=(180+t[0])/360;const n=(r=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360);var r;const s=Math.pow(2,e.z);return[Math.round(i*s*Yt),Math.round(n*s*Yt)]}function Jt(t,e){const i=Math.pow(2,e.z),n=(t[0]/Yt+e.x)/i,r=(t[1]/Yt+e.y)/i;return[(o=n,360*o-180),(s=r,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,o}function Qt(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function te(t,e){return!(t[0]<=e[0])&&(!(t[2]>=e[2])&&(!(t[1]<=e[1])&&!(t[3]>=e[3])))}function ee(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function ie(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],s=t[0]-i[0],o=t[1]-i[1];return n*o-s*r==0&&n*s<=0&&r*o<=0}function ne(t,e,i,n){const r=[e[0]-t[0],e[1]-t[1]],s=[n[0]-i[0],n[1]-i[1]];return 0!=(o=s)[0]*(a=r)[1]-o[1]*a[0]&&!(!he(t,e,i,n)||!he(i,n,t,e));var o,a}function re(t,e,i){for(const n of i)for(let i=0;i0&&c<0||u<0&&c>0}function ue(t,e,i){const n=[];for(let r=0;ri[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}Qt(e,t)}function ge(t,e,i,n){const r=Math.pow(2,n.z)*Yt,s=[n.x*Yt,n.y*Yt],o=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];de(n,e,i,r),o.push(n)}return o}function pe(t,e,i,n){const r=Math.pow(2,n.z)*Yt,s=[n.x*Yt,n.y*Yt],o=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+s[0],n.y+s[1]];Qt(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=r/2){!function(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}(e);for(const t of o)for(const n of t)de(n,e,i,r)}return o}class fe{constructor(t,e){this.type=h,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(at(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const i of e.features){const{type:e,coordinates:n}=i.geometry;"Polygon"===e&&t.push(n),"MultiPolygon"===e&&t.push(...n)}if(t.length){return new fe(e,{type:"MultiPolygon",coordinates:t})}}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new fe(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new fe(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=ue(e.coordinates,n,r),o=ge(t.geometry(),i,n,r);if(!te(i,n))return!1;for(const t of o)if(!se(t,s))return!1}if("MultiPolygon"===e.type){const s=ce(e.coordinates,n,r),o=ge(t.geometry(),i,n,r);if(!te(i,n))return!1;for(const t of o)if(!oe(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=ue(e.coordinates,n,r),o=pe(t.geometry(),i,n,r);if(!te(i,n))return!1;for(const t of o)if(!ae(t,s))return!1}if("MultiPolygon"===e.type){const s=ce(e.coordinates,n,r),o=pe(t.geometry(),i,n,r);if(!te(i,n))return!1;for(const t of o)if(!le(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class me{constructor(t=[],e=(t,e)=>te?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,n=e[t];for(;t>0;){const r=t-1>>1,s=e[r];if(i(n,s)>=0)break;e[t]=s,t=r}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t=0)break;e[t]=e[n],t=n}e[t]=r}}function ye(t){let e=0;for(let i,n,r=0,s=t.length,o=s-1;r1?(l=t[a+1][0],h=t[a+1][1]):d>0&&(l+=u/this.kx*d,h+=c/this.ky*d)),u=this.wrap(e[0]-l)*this.kx,c=(e[1]-h)*this.ky;const g=u*u+c*c;g180;)t-=360;return t}}function be(t,e){return e[0]-t[0]}function Se(t){return t[1]-t[0]+1}function Ce(t,e){return t[1]>=t[0]&&t[1]t[1])return[null,null];const i=Se(t);if(e){if(2===i)return[t,null];const e=Math.floor(i/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===i)return[t,null];const n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function Re(t,e){if(!Ce(e,t.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)Qt(i,t[n]);return i}function Te(t){const e=[1/0,1/0,-1/0,-1/0];for(const i of t)for(const t of i)Qt(e,t);return e}function Ie(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Me(t,e,i){if(!Ie(t)||!Ie(e))return NaN;let n=0,r=0;return t[2]e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(r=t[1]-e[3]),t[3]=n)return n;if(te(r,s)){if(ze(t,e))return 0}else if(ze(e,t))return 0;let o=1/0;for(const n of t)for(let t=0,r=n.length,s=r-1;t0;){const r=o.pop();if(r[0]>=s)continue;const l=r[1],h=e?50:100;if(Se(l)<=h){if(!Ce(l,t.length))return NaN;if(e){const e=Oe(t,l,i,n);if(isNaN(e)||0===e)return e;s=Math.min(s,e)}else for(let e=l[0];e<=l[1];++e){const r=Le(t[e],i,n);if(s=Math.min(s,r),0===s)return 0}}else{const i=Ee(l,e);je(o,s,n,t,a,i[0]),je(o,s,n,t,a,i[1])}}return s}function Xe(t,e,i,n,r,s=1/0){let o=Math.min(s,r.distance(t[0],i[0]));if(0===o)return o;const a=new me([[0,[0,t.length-1],[0,i.length-1]]],be);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],h=s[2],u=e?50:100,c=n?50:100;if(Se(l)<=u&&Se(h)<=c){if(!Ce(l,t.length)&&Ce(h,i.length))return NaN;let s;if(e&&n)s=Fe(t,l,i,h,r),o=Math.min(o,s);else if(e&&!n){const e=t.slice(l[0],l[1]+1);for(let t=h[0];t<=h[1];++t)if(s=ke(i[t],e,r),o=Math.min(o,s),0===o)return o}else if(!e&&n){const e=i.slice(h[0],h[1]+1);for(let i=l[0];i<=l[1];++i)if(s=ke(t[i],e,r),o=Math.min(o,s),0===o)return o}else s=Ae(t,l,i,h,r),o=Math.min(o,s)}else{const s=Ee(l,e),u=Ee(h,n);Ne(a,o,r,t,i,s[0],u[0]),Ne(a,o,r,t,i,s[0],u[1]),Ne(a,o,r,t,i,s[1],u[0]),Ne(a,o,r,t,i,s[1],u[1])}}return o}function We(t,e){const i=t.geometry();if(0===i.length||0===i[0].length)return NaN;const n=function(t){if(t.length<=1)return[t];const e=[];let i,n;for(const r of t){const t=ye(r);0!==t&&(r.area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(i&&e.push(i),i=[r]):i.push(r))}return i&&e.push(i),e}(i).map((e=>e.map((e=>e.map((e=>Jt([e.x,e.y],t.canonical))))))),r=new we(n[0][0][0][1]);let s=1/0;for(const t of e)for(const e of n){switch(t.type){case"Point":s=Math.min(s,Ge([t.coordinates],!1,e,r,s));break;case"LineString":s=Math.min(s,Ge(t.coordinates,!0,e,r,s));break;case"Polygon":s=Math.min(s,De(e,t.coordinates,r,s))}if(0===s)return s}return s}function qe(t){return"MultiPolygon"===t.type?t.coordinates.map((t=>({type:"Polygon",coordinates:t}))):"MultiLineString"===t.type?t.coordinates.map((t=>({type:"LineString",coordinates:t}))):"MultiPoint"===t.type?t.coordinates.map((t=>({type:"Point",coordinates:t}))):[t]}class Ve{constructor(t,e){this.type=a,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(at(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new Ve(e,e.features.map((t=>qe(t.geometry))).flat());if("Feature"===e.type)return new Ve(e,qe(e.geometry));if("type"in e&&"coordinates"in e)return new Ve(e,qe(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=t.geometry(),n=i.flat().map((e=>Jt([e.x,e.y],t.canonical)));if(0===i.length)return NaN;const r=new we(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,Xe(n,!1,[t.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,Xe(n,!1,t.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,Ge(n,!1,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=t.geometry(),n=i.flat().map((e=>Jt([e.x,e.y],t.canonical)));if(0===i.length)return NaN;const r=new we(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,Xe(n,!0,[t.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,Xe(n,!0,t.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,Ge(n,!0,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return We(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const $e={"==":Nt,"!=":Gt,">":Wt,"<":Xt,">=":Vt,"<=":qt,array:dt,at:vt,boolean:dt,case:Ct,coalesce:Ot,collator:$t,format:Kt,image:Bt,in:wt,"index-of":bt,interpolate:At,"interpolate-hcl":At,"interpolate-lab":At,length:Zt,let:_t,literal:ut,match:St,number:dt,"number-format":Ut,object:dt,slice:Et,step:Tt,string:dt,"to-boolean":pt,"to-color":pt,"to-number":pt,"to-string":pt,var:xt,within:fe,distance:Ve};class Ue{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],n=Ue.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,s]of o){a=new yt(e.registry,He,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(v).join(", ")})`:`(${v(e.type)}...)`;var e})).join(" | "),n=[];for(let i=1;i{i=e?i&&He(t):i&&t instanceof ut})),!!i&&(Je(t)&&ti(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]))}function Je(t){if(t instanceof Ue){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof fe)return!1;if(t instanceof Ve)return!1;let e=!0;return t.eachChild((t=>{e&&!Je(t)&&(e=!1)})),e}function Qe(t){if(t instanceof Ue&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Qe(t)&&(e=!1)})),e}function ti(t,e){if(t instanceof Ue&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!ti(t,e)&&(i=!1)})),i}function ei(t){return{result:"success",value:t}}function ii(t){return{result:"error",value:t}}function ni(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}Ue.register($e,{error:[{kind:"error"},[l],(t,[e])=>{throw new et(e.evaluate(t))}],typeof:[l,[g],(t,[e])=>v(lt(e.evaluate(t)))],"to-rgba":[x(a,4),[u],(t,[e])=>{const[i,n,r,s]=e.evaluate(t).rgb;return[255*i,255*n,255*r,s]}],rgb:[u,[a,a,a],Ke],rgba:[u,[a,a,a,a],Ke],has:{type:h,overloads:[[[l],(t,[e])=>Be(e.evaluate(t),t.properties())],[[l,d],(t,[e,i])=>Be(e.evaluate(t),i.evaluate(t))]]},get:{type:g,overloads:[[[l],(t,[e])=>Ze(e.evaluate(t),t.properties())],[[l,d],(t,[e,i])=>Ze(e.evaluate(t),i.evaluate(t))]]},"feature-state":[g,[l],(t,[e])=>Ze(e.evaluate(t),t.featureState||{})],properties:[d,[],t=>t.properties()],"geometry-type":[l,[],t=>t.geometryType()],id:[g,[],t=>t.id()],zoom:[a,[],t=>t.globals.zoom],"heatmap-density":[a,[],t=>t.globals.heatmapDensity||0],"line-progress":[a,[],t=>t.globals.lineProgress||0],accumulated:[g,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[a,Ye(a),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[a,Ye(a),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:a,overloads:[[[a,a],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[a],(t,[e])=>-e.evaluate(t)]]},"/":[a,[a,a],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[a,[a,a],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[a,[],()=>Math.LN2],pi:[a,[],()=>Math.PI],e:[a,[],()=>Math.E],"^":[a,[a,a],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[a,[a],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[a,[a],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[a,[a],(t,[e])=>Math.log(e.evaluate(t))],log2:[a,[a],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[a,[a],(t,[e])=>Math.sin(e.evaluate(t))],cos:[a,[a],(t,[e])=>Math.cos(e.evaluate(t))],tan:[a,[a],(t,[e])=>Math.tan(e.evaluate(t))],asin:[a,[a],(t,[e])=>Math.asin(e.evaluate(t))],acos:[a,[a],(t,[e])=>Math.acos(e.evaluate(t))],atan:[a,[a],(t,[e])=>Math.atan(e.evaluate(t))],min:[a,Ye(a),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[a,Ye(a),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[a,[a],(t,[e])=>Math.abs(e.evaluate(t))],round:[a,[a],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[a,[a],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[a,[a],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[h,[l,g],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[h,[g],(t,[e])=>t.id()===e.value],"filter-type-==":[h,[l],(t,[e])=>t.geometryType()===e.value],"filter-<":[h,[l,g],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n{const i=t.id(),n=e.value;return typeof i==typeof n&&i":[h,[l,g],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[h,[g],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[h,[l,g],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[h,[g],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[h,[l,g],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[h,[g],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[h,[g],(t,[e])=>e.value in t.properties()],"filter-has-id":[h,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[h,[x(l)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[h,[x(g)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[h,[l,x(g)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[h,[l,x(g)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:h,overloads:[[[h,h],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[Ye(h),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:h,overloads:[[[h,h],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[Ye(h),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[h,[h],(t,[e])=>!e.evaluate(t)],"is-supported-script":[h,[l],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[l,[l],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[l,[l],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[l,Ye(g),(t,e)=>e.map((e=>ht(e.evaluate(t)))).join("")],"resolved-locale":[l,[p],(t,[e])=>e.evaluate(t).resolvedLocale()]});class ri{constructor(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new mt,this._defaultValue=e?"color"===(i=e).type&&ni(i.default)?new Z(0,0,0,0):"color"===i.type?Z.parse(i.default)||null:"padding"===i.type?tt.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?nt.parse(i.default)||null:"projectionDefinition"===i.type?st.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,s){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new et(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function si(t,e){const i=new yt($e,He,[],e?function(t){const e={color:u,string:l,number:a,enum:l,boolean:h,formatted:f,padding:m,projectionDefinition:c,resolvedImage:y,variableAnchorOffsetCollection:_};if("array"===t.type)return x(e[t.value]||g,t.length);return e[t.type]}(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?ei(new ri(n,e)):ii(i.errors)}class oi{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Qe(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._styleExpression.evaluate(t,e,i,n,r,s)}}class ai{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Qe(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._styleExpression.evaluate(t,e,i,n,r,s)}interpolationFactor(t,e,i){return this.interpolationType?At.interpolationFactor(this.interpolationType,t,e,i):0}}function li(t,e){const i=si(t,e);if("error"===i.result)return i;const n=i.value.expression,s=Je(n);if(!s&&("data-driven"!==(o=e)["property-type"]&&"cross-faded-data-driven"!==o["property-type"]))return ii([new r("","data expressions not supported")]);var o;const a=ti(n,["zoom"]);if(!a&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(e))return ii([new r("","zoom expressions not supported")]);const l=hi(n);if(!l&&!a)return ii([new r("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(l instanceof r)return ii([l]);if(l instanceof At&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return ii([new r("",'"interpolate" expressions cannot be used with this property')]);if(!l)return ei(new oi(s?"constant":"source",i.value));const h=l instanceof At?l.interpolation:void 0;return ei(new ai(s?"camera":"composite",i.value,l.labels,h))}function hi(t){let e=null;if(t instanceof _t)e=hi(t.result);else if(t instanceof Ot){for(const i of t.args)if(e=hi(i),e)break}else(t instanceof Tt||t instanceof At)&&t.input instanceof Ue&&"zoom"===t.input.name&&(e=t);return e instanceof r||t.eachChild((t=>{const i=hi(t);i instanceof r?e=i:!e&&i?e=new r("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new r("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function ui(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!ui(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const ci={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function di(t){if(null==t)return{filter:()=>!0,needGeometry:!1};ui(t)||(t=fi(t));const e=si(t,ci);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,i,n)=>e.value.evaluate(t,i,{},n),needGeometry:pi(t)}}function gi(t,e){return te?1:0}function pi(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?mi(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(fi))):"all"===e?["all"].concat(t.slice(1).map(fi)):"none"===e?["all"].concat(t.slice(1).map(fi).map(xi)):"in"===e?yi(t[1],t.slice(2)):"!in"===e?xi(yi(t[1],t.slice(2))):"has"===e?_i(t[1]):"!has"!==e||xi(_i(t[1]))}function mi(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function yi(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(gi)]]:["filter-in-small",t,["literal",e]]}}function _i(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function xi(t){return["!",t]}function vi(t){return"object"==typeof t?["literal",t]:t}function wi(t,e){let i=t.stops;if(!i)return function(t,e){const i=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",i]:i;if("enum"===e.type)return["match",i,Object.keys(e.values),i,t.default];{const n=["color"===e.type?"to-color":e.type,i,vi(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}}(t,e);const n=i&&"object"==typeof i[0][0],r=n||void 0!==t.property,s=n||!r;return i=i.map((t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],Ii(t[1])]:[t[0],vi(t[1])])),n?function(t,e,i){const n={},r={},s=[];for(let e=0;e3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function Ti(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function Ii(t){const e=["concat"],i=/{([^{}]+)}/g;let n=0;for(let r=i.exec(t);null!==r;r=i.exec(t)){const s=t.slice(n,i.lastIndex-r[0].length);n=i.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(1===e.length)return t;if(n1?c[c.length-2].toLowerCase():"";if(d==g||d==g.replace("-","")||p+"-"+d==g){o=r?o:ki[g],c.pop(),p&&g.startsWith(p)&&c.pop();break}}r||"number"!=typeof d||(o=d,r=!0);var f=c.join(Pi).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==f.indexOf(Pi)&&(f='"'+f+'"'),l.push(f)}n=Ai[t]=[a,o,l]}return n[0]+Pi+n[1]+Pi+e+"px"+(i?"/"+i:"")+Pi+n[2]}var Oi="add",zi="remove",Di="propertychange",ji="change",Ni="error",Gi="contextmenu",Xi="click",Wi="dblclick",qi="keydown",Vi="keypress",$i="load",Ui="touchmove",Ki="wheel";class Bi{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Zi(t,e){return t>e?1:te?-1:0}function Hi(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r0?r-1:r}return n-1}if(i>0){for(let i=1;i0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=rn,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}function cn(t,e,i,n,r){if(r){const r=i;i=function(s){return t.removeEventListener(e,i),r.call(n??this,s)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function dn(t,e,i,n){return cn(t,e,i,n,!0)}function gn(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),an(t))}class pn extends un{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(ji)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new wn(Oi,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new wn(zi,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new wn(zi,i,t)),this.dispatchEvent(new wn(Oi,e,t))}updateLength_(){this.set(vn,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,r=i.length;n{this.clickTimeoutId_=void 0;const e=new Cn(En.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==En.POINTERUP||e.type==En.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=En.POINTERDOWN&&e.type!=En.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Cn(En.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(gn),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new Cn(En.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(cn(t,En.POINTERMOVE,this.handlePointerMove_,this),cn(t,En.POINTERUP,this.handlePointerUp_,this),cn(this.element_,En.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(cn(this.element_.getRootNode(),En.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Cn(En.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new Cn(En.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(gn(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Ui,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(gn(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(gn),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var Dn="postrender",jn="movestart",Nn="moveend",Gn="loadstart",Xn="loadend",Wn="layergroup",qn="size",Vn="target",$n="view",Un=0,Kn=1,Bn=2,Zn=3,Yn=4;function Hn(t,e){if(!t)throw new Error(e)}const Jn=1/0;class Qn{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,an(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){Hn(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Jn&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;for(;t>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=st;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,o,a;for(o=0;ot.apply(null,e)),(t=>t[0].getKey())),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);if(e){t[0].addEventListener(ji,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===Bn||i===Zn||i===Yn){i!==Zn&&e.removeEventListener(ji,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_0;){const t=this.dequeue()[0],e=t.getKey();t.getState()!==Un||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}}var er=0,ir=1,nr={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function rr(t,e,i){return Math.min(Math.max(t,e),i)}function sr(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return or(t,e,i,n)}function or(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function ar(t){return 180*t/Math.PI}function lr(t){return t*Math.PI/180}function hr(t,e){const i=t%e;return i*e<0?i+e:i}function ur(t,e,i){return t+i*(e-t)}function cr(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function dr(t,e){return Math.floor(cr(t,e))}function gr(t,e){return Math.ceil(cr(t,e))}function pr(t,e,i){if(t>=e&&tg&&(d=(g+d)/2,g=d),p>f&&(p=(f+p)/2,f=p);let m=rr(n[0],d,g),y=rr(n[1],p,f);if(o&&i&&r){const t=30*r;m+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),y+=-t*Math.log(1+Math.max(0,p-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-f)/t)}return[m,y]}}function mr(t){return t}var yr=0,_r=1,xr=2,vr=4,wr=8,br=16;function Sr(t){const e=Pr();for(let i=0,n=t.length;ir&&(l|=vr),as&&(l|=xr),l===yr&&(l=_r),l}function Pr(){return[1/0,1/0,-1/0,-1/0]}function Fr(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function Ar(t){return Fr(1/0,1/0,-1/0,-1/0,t)}function Lr(t,e){const i=t[0],n=t[1];return Fr(i,n,i,n,e)}function Or(t,e,i,n,r){return Nr(Ar(r),t,e,i,n)}function zr(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Dr(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function jr(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function Nr(t,e,i,n,r){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function es(t){return t[2]1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s=i[2])){const e=Qr(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function rs(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];ns(t,e);const r=Qr(n);if(Qr(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function ss(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function os(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function as(t,e){if(e.canWrapX()){const i=Qr(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let r=0;e.canWrapX()&&(t[0]n[2])&&(i=i||Qr(n),r=Math.floor((t[0]-n[0])/i));return r}(t,e,i);n&&(t[0]-=n*i)}return t}function ls(t){return Math.pow(t,3)}function hs(t){return 1-ls(1-t)}function us(t){return 3*t*t-2*t*t*t}function cs(t){return t}function ds(t,e,i){i=i||6371008.8;const n=lr(t[1]),r=lr(e[1]),s=(r-n)/2,o=lr(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function gs(...t){console.warn(...t)}const ps={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class fs{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ps[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const ms=6378137,ys=Math.PI*ms,_s=[-ys,-ys,ys,ys],xs=[-180,-85,180,85],vs=ms*Math.log(Math.tan(Math.PI/2));class ws extends fs{constructor(t){super({code:t,units:"m",extent:_s,global:!0,worldExtent:xs,getPointResolution:function(t,e){return t/Math.cosh(e[1]/ms)}})}}const bs=[new ws("EPSG:3857"),new ws("EPSG:102100"),new ws("EPSG:102113"),new ws("EPSG:900913"),new ws("http://www.opengis.net/def/crs/EPSG/0/3857"),new ws("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Ss(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;ivs?n=vs:n<-vs&&(n=-vs),e[i+1]=n}return e}function Cs(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i84&&(e=84);const n=lr(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=lr(t),u=lr(to(i.number)),c=Hs/Math.sqrt(1-Ls*r**2),d=Ds*s**2,g=s*pr(h-u,-Math.PI,Math.PI),p=g*g,f=p*g,m=f*g,y=m*g,_=y*g,x=Hs*(Vs*n-.002514607064228144*Math.sin(2*n)+$s*Math.sin(4*n)-Us*Math.sin(6*n)),v=As*c*(g+f/6*(1-a+d)+y/120*(5-18*a+l+72*d-58*Ds))+5e5;let w=As*(x+c*o*(p/2+m/24*(5-a+9*d+4*d**2)+_/720*(61-58*a+l+600*d-330*Ds)));return i.north||(w+=1e7),[v,w]}function to(t){return 6*(t-1)-180+3}const eo=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function io(t){let e=0;for(const i of eo){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function no(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(oo=!1,gs("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Co(t,e){return t}function Eo(t,e){return t}var Ro,To,Io;go(bs),go(Is),Ro=bs,To=Ss,Io=Cs,Is.forEach((function(t){Ro.forEach((function(e){Ps(t,e,To),Ps(e,t,Io)}))}));const Mo=new Array(6);function ko(t){return Fo(t,1,0,0,1,0,0)}function Po(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],u=e[2],c=e[3],d=e[4],g=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*u+r*c,t[3]=n*u+s*c,t[4]=i*d+r*g+o,t[5]=n*d+s*g+a,t}function Fo(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function Ao(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Lo(t,e,i){return Po(t,Fo(Mo,e,0,0,i,0,0))}function Oo(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}function zo(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;Hn(0!==i,"Transformation matrix cannot be inverted");const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-s/i,t[2]=-o/i,t[3]=r/i,t[4]=(o*h-a*l)/i,t[5]=-(r*h-s*l)/i,t}const Do=[1e5,1e5,1e5,1e5,2,2];function jo(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function No(t,e,i,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)}))}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return fn()}closestPointXY(t,e,i,n){return fn()}containsXY(t,e){return 0===this.closestPointXY(t,e,Wo,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return fn()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Ar(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){fn()}scale(t,e,i){fn()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return fn()}getType(){return fn()}applyTransform(t){fn()}intersectsExtent(t){return fn()}translate(t,e){fn()}transform(t,e){const i=uo(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=Zr(o)/Zr(s);Oo(Xo,o[0],o[3],a,-a,0,0,0);const l=No(t,0,t.length,r,Xo,n),h=xo(i,e);return h?h(l,l,r):l}:xo(i,e);return this.applyTransform(n),this}}class Vo extends qo{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Or(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return fn()}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(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length1)c=i;else{if(d>0){for(let r=0;rr&&(r=a),s=i,o=n}return r}function Ho(t,e,i,n,r){for(let s=0,o=i.length;s0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],c=t[s+1],d=t[i],g=t[i+1];for(let e=s+n;eo&&(u=e,o=i)}o>r&&(l[(u-e)/n]=1,s+n0&&p>d)&&(g<0&&f0&&f>g)?(a=i,l=c):(s[o++]=a,s[o++]=l,h=a,u=l,a=i,l=c)}return s[o++]=a,s[o++]=l,o}function ua(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;ls&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function fa(t,e,i,n,r,s){if(0===i.length)return!1;if(!pa(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;ey&&(h=(u+c)/2,fa(t,e,i,n,h,p)&&(m=h,y=r)),u=c}return isNaN(m)&&(m=r[s]),o?(o.push(m,p,y),o):[m,p,y]}function ya(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||_a(t,e,i,n,(function(t,e){return function(t,e,i){let n=!1;const r=kr(t,e),s=kr(t,i);if(r===_r||s===_r)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],u=e[0],c=e[1],d=i[0],g=i[1],p=(g-c)/(d-u);let f,m;s&xr&&!(r&xr)&&(f=d-(g-h)/p,n=f>=o&&f<=l),n||!(s&vr)||r&vr||(m=g-(d-l)*p,n=m>=a&&m<=h),n||!(s&wr)||r&wr||(f=d-(g-a)/p,n=f>=o&&f<=l),n||!(s&br)||r&br||(m=g-(d-o)*p,n=m>=a&&m<=h)}return n}(r,t,e)})))}function va(t,e,i,n,r){return!!xa(t,e,i,n,r)||(!!pa(t,e,i,n,r[0],r[1])||(!!pa(t,e,i,n,r[0],r[3])||(!!pa(t,e,i,n,r[2],r[1])||!!pa(t,e,i,n,r[2],r[3]))))}function wa(t,e,i,n,r){if(!va(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e0}function Ca(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;su&&d1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[ir]>0}cancelAnimations(){let t;this.setHint(er,-this.hints_[er]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?hr(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[i]=null,this.setHint(er,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&ja(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var r,s;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],os(i,t-this.getRotation()),s=e,(r=i)[0]+=+s[0],r[1]+=+s[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(void 0!==n&&void 0!==r){i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?bo(t,this.getProjection()):t}getCenterInternal(){return this.get(nr.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return Co(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Hn(e,"The view center is not defined");const i=this.getResolution();Hn(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return Hn(void 0!==n,"The view rotation is not defined"),Kr(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(nr.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Eo(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=Qr(t)/e[0],n=Zr(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(nr.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=Ga(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=Hi(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=rr(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,rr(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Hn(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){Hn(!es(t),"Cannot fit empty extent provided as `geometry`");i=ka(Eo(t,this.getProjection()))}else if("Circle"===t.getType()){const e=Eo(t.getExtent(),this.getProjection());i=ka(e),i.rotate(this.getRotation(),$r(e))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;tt.trim().replace(/^['"]|['"]$/g,""))),i};function Ya(t,e,i,n){let r;return r=i&&i.length?i.shift():kn?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let Ha;function Ja(){return Ha||(Ha=Ya(1,1)),Ha}function Qa(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function tl(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function el(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(-1===i)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get:(t,e,i)=>"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)})}function il(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}class nl extends xn{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let t=0,e=this.listenerKeys.length;te.getAttributions(t))));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach((t=>i.add(t))):i.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some((t=>!1===t.getSource()?.getAttributionsCollapsible()));this.setCollapsible(t)}return Array.from(i)}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map((t=>on((()=>t))))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!tn(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.lastChild.remove()}(this.ulElement_);for(let t=0,i=e.length;t0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:hs}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(Xa);t||0!==i?t&&0!==i&&this.element.classList.remove(Xa):this.element.classList.add(Xa)}this.label_.style.transform=t}this.rotation_=i}}class ol extends nl{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=n,h.setAttribute("type","button"),h.title=a,h.appendChild("string"==typeof s?document.createTextNode(s):s),h.addEventListener(Xi,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild("string"==typeof o?document.createTextNode(o):o),u.addEventListener(Xi,this.handleClick_.bind(this,-i),!1);const c=e+" "+Wa+" "+Va,d=this.element;d.className=c,d.appendChild(h),d.appendChild(u),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:hs})):e.setZoom(n)}}}class al{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}var ll="active";class hl extends xn{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(ll)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(ll,t)}setMap(t){this.map_=t}}function ul(t,e,i,n){const r=t.getZoom();if(void 0===r)return;const s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:hs})}class cl extends hl{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==En.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;ul(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}}function dl(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n0}}else if(t.type==En.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==En.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function Sl(t){const e=t.length;let i=0,n=0;for(let r=0;r0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class El extends bl{constructor(t){t=t||{},super({stopDown:nn}),this.condition_=t.condition?t.condition:gl,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!vl(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===La)return;const n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){if(!vl(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!vl(t))return!1;if(ml(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}class Rl extends Bi{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new Ma([i])}getGeometry(){return this.geometry_}}const Tl="boxstart",Il="boxdrag",Ml="boxend",kl="boxcancel";class Pl extends hn{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Fl extends bl{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Rl(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??ml,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Pl(Il,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Pl(e?Ml:kl,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Pl(Tl,t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Pl(kl,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Pl(kl,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Al extends Fl{constructor(t){super({condition:(t=t||{}).condition?t.condition:_l,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),r=e.getResolution()/n;i=i.clone(),i.scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:hs})}}var Ll="ArrowLeft",Ol="ArrowUp",zl="ArrowRight",Dl="ArrowDown";class jl extends hl{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return yl(t)&&xl(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==qi){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Dl||n==Ll||n==zl||n==Ol)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==Dl?a=-s:n==Ll?o=-s:n==zl?o=s:a=s;const l=[o,a];os(l,r.getRotation()),function(t,e,i){const n=t.getCenterInternal();if(n){const r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:cs,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}}class Nl extends hl{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return In?e.metaKey:e.ctrlKey}(t)&&xl(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==qi||t.type==Vi){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;ul(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}class Gl extends hl{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:fl;this.condition_=t.onFocusOnly?dl(pl,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==Ki)return!0;const e=t.map,i=t.originalEvent;i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let n=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:n*=40;break;case WheelEvent.DOM_DELTA_PAGE:n*=300}if(0===n)return!1;this.lastDelta_=n;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(n)<4?"trackpad":"wheel");const s=e.getView();if("trackpad"===this.mode_&&!s.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(s.getAnimating()&&s.cancelAnimations(),s.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s.adjustZoom(-n/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=r,!1;this.totalDelta_+=n;const o=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),o),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-rr(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),ul(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class Xl extends bl{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=nn),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==La&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Sl(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){if(this.targetPointers.length<2){return t.map.getView().endInteraction(this.duration_),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class Wl extends bl{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=nn),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Sl(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var ql="opacity",Vl="visible",$l="extent",Ul="zIndex",Kl="maxResolution",Bl="minResolution",Zl="maxZoom",Yl="minZoom",Hl="source",Jl="map";class Ql extends xn{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[ql]=void 0!==t.opacity?t.opacity:1,Hn("number"==typeof e[ql],"Layer opacity must be a number"),e[Vl]=void 0===t.visible||t.visible,e[Ul]=t.zIndex,e[Kl]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Bl]=void 0!==t.minResolution?t.minResolution:0,e[Yl]=void 0!==t.minZoom?t.minZoom:-1/0,e[Zl]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=rr(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return fn()}getLayerStatesArray(t){return fn()}getExtent(){return this.get($l)}getMaxResolution(){return this.get(Kl)}getMinResolution(){return this.get(Bl)}getMinZoom(){return this.get(Yl)}getMaxZoom(){return this.get(Zl)}getOpacity(){return this.get(ql)}getSourceState(){return fn()}getVisible(){return this.get(Vl)}getZIndex(){return this.get(Ul)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set($l,t)}setMaxResolution(t){this.set(Kl,t)}setMinResolution(t){this.set(Bl,t)}setMaxZoom(t){this.set(Zl,t)}setMinZoom(t){this.set(Yl,t)}setOpacity(t){Hn("number"==typeof t,"Layer opacity must be a number"),this.set(ql,t)}setVisible(t){this.set(Vl,t)}setZIndex(t){this.set(Ul,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const th="addlayer",eh="removelayer";class ih extends hn{constructor(t,e){super(t),this.layer=e}}const nh="layers";class rh extends Ql{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(nh,this.handleLayersChanged_),i?Array.isArray(i)?i=new bn(i.slice(),{unique:!0}):Hn("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new bn(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(gn),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(cn(t,Oi,this.handleLayersAdd_,this),cn(t,zi,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(gn);an(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t{this.dispatchEvent("sourceready")}),0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof Da?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find((t=>t.layer===this)),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return ch(n,e.viewState)&&(!r||ts(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof Da?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Jl,t)}getMapInternal(){return this.get(Jl)}setMap(t){this.mapPrecomposeKey_&&(gn(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(gn(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=cn(t,ah,this.handlePrecompose_,this),this.mapRenderKey_=cn(this,ji,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Hn(!e.some((t=>t.layer===i.layer)),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Hl,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function ch(t,e){if(!t.visible)return!1;const i=e.resolution;if(i=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}function dh(t,e,i=0,n=t.length-1,r=ph){for(;n>i;){if(n-i>600){const s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);dh(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(gh(t,i,e),r(t[n],s)>0&&gh(t,i,n);o0;)a--}0===r(t[i],s)?gh(t,i,a):(a++,gh(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function gh(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function ph(t,e){return te?1:0}let fh=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Rh(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=Th(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,yh(i,this.toBBox),yh(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Th([t,e]),this.data.height=t.height+1,this.data.leaf=!1,yh(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,s=1/0;for(let o=e;o<=i-e;o++){const e=_h(t,0,o,this.toBBox),a=_h(t,o,i,this.toBBox),l=Ch(e,a),h=bh(e)+bh(a);l=e;n--){const e=t.children[n];xh(o,t.leaf?r(e):e),a+=Sh(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)xh(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():yh(t[i],this.toBBox)}};function mh(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n=t.minX&&e.maxY>=t.minY}function Th(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ih(t,e,i,n,r){const s=[e,i];for(;s.length;){if((i=s.pop())-(e=s.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;dh(t,o,e,i,r),s.push(e,o,o,i)}}const Mh=[NaN,NaN,NaN,0];let kh;const Ph=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Fh=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ah=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Lh=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Oh(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function zh(t){throw new Error('failed to parse "'+t+'" as color')}function Dh(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Fh)||t.match(Ph)||t.match(Ah);if(e){const t=e[4],i=100/255;return[rr(Oh(e[1],i)+.5|0,0,255),rr(Oh(e[2],i)+.5|0,0,255),rr(Oh(e[3],i)+.5|0,0,255),void 0!==t?rr(Oh(t,100),0,1):1]}zh(t)}if(t.startsWith("#")){if(Lh.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,r=e.length;t.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Wh(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function qh(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function Vh(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function $h(t){const e=qh(t[0]),i=qh(t[1]),n=qh(t[2]),r=Vh(.222488403*e+.716873169*i+.06060791*n),s=500*(Vh(.452247074*e+.399439023*i+.148375274*n)-r),o=200*(r-Vh(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,t[3]]}function Uh(t){if("none"===t)return Mh;if(jh.hasOwnProperty(t))return jh[t];if(Nh>=1024){let t=0;for(const e in jh)3&t++||(delete jh[e],--Nh)}const e=Dh(t);4!==e.length&&zh(t);for(const i of e)isNaN(i)&&zh(t);return jh[t]=e,++Nh,e}function Kh(t){return Array.isArray(t)?t:Uh(t)}function Bh(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function Zh(t){return t[0]>0&&t[1]>0}function Yh(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let Hh=0;const Jh=1<e){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}}function dc(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s{for(let e=0;e{for(let r=0;r{const n=t.args;let r=e.properties[i];for(let t=1,e=n.length;tt.variables[i];case oc:return e=>{const n=t.args;if(!(i in e.properties))return!1;let r=e.properties[i];for(let t=1,e=n.length;tt.featureId;case yu:return t=>t.geometryType;case mu:{const e=t.args.map((t=>_c(t)));return t=>"".concat(...e.map((e=>e(t).toString())))}case bu:return t=>t.resolution;case xu:case vu:case Ku:case Hu:case wu:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e{for(let e=0;e{for(let e=0;e{const e=n[0](t),i=n[1](t),r=n[2](t);return e>=i&&e<=r};case Hu:return t=>{const e=n[0](t);for(let r=1;r!n[0](t);default:throw new Error(`Unsupported logical operator ${e}`)}}(t);case Eu:case Ru:case Mu:case ku:case Tu:case Iu:return function(t){const e=t.operator,i=_c(t.args[0]),n=_c(t.args[1]);switch(e){case Eu:return t=>i(t)===n(t);case Ru:return t=>i(t)!==n(t);case Mu:return t=>i(t)i(t)<=n(t);case Tu:return t=>i(t)>n(t);case Iu:return t=>i(t)>=n(t);default:throw new Error(`Unsupported comparison operator ${e}`)}}(t);case Pu:case Fu:case Au:case Lu:case Ou:case zu:case Du:case ju:case Nu:case Gu:case Xu:case Wu:case qu:case Vu:case $u:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e{let e=1;for(let r=0;rn[0](t)/n[1](t);case Au:return t=>{let e=0;for(let r=0;rn[0](t)-n[1](t);case Ou:return t=>{const e=n[0](t),i=n[1](t);if(er?r:e};case zu:return t=>n[0](t)%n[1](t);case Du:return t=>Math.pow(n[0](t),n[1](t));case ju:return t=>Math.abs(n[0](t));case Nu:return t=>Math.floor(n[0](t));case Gu:return t=>Math.ceil(n[0](t));case Xu:return t=>Math.round(n[0](t));case Wu:return t=>Math.sin(n[0](t));case qu:return t=>Math.cos(n[0](t));case Vu:return 2===i?t=>Math.atan2(n[0](t),n[1](t)):t=>Math.atan(n[0](t));case $u:return t=>Math.sqrt(n[0](t));default:throw new Error(`Unsupported numeric operator ${e}`)}}(t);case Yu:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n{for(let n=0;n{const n=i[0](t);for(let r=1;r{const n=i[0](t),r=i[1](t);let s,o;for(let a=2;a=r)return 2===a?l:h?vc(n,r,s,o,e,l):xc(n,r,s,o,e,l);s=e,o=l}return o}}(t);case sc:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e{const i=n[0](e);return t.args[0].type===eu?Bh(i):i.toString()};throw new Error(`Unsupported convert operator ${e}`)}(t);default:throw new Error(`Unsupported operator ${i}`)}}function xc(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function vc(t,e,i,n,r,s){if(0===r-i)return n;const o=$h(n),a=$h(s);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,r=Wh(e),s=Wh(e+i/500*Math.cos(n)),o=Wh(e-i/200*Math.sin(n)),a=Xh(3.021973625*s-1.617392459*r-.404875592*o),l=Xh(-.943766287*s+1.916279586*r+.027607165*o),h=Xh(.069407491*s-.22898585*r+1.159737864*o);return[rr(a+.5|0,0,255),rr(l+.5|0,0,255),rr(h+.5|0,0,255),t[3]]}([xc(t,e,i,o[0],r,a[0]),xc(t,e,i,o[1],r,a[1]),o[2]+xc(t,e,i,0,r,l),xc(t,e,i,n[3],r,s[3])])}var wc=0,bc=1,Sc=2,Cc=3,Ec=4;class Rc extends un{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state="function"==typeof n?wc:n,this.image_=null,this.loader="function"==typeof n?n:null}changed(){this.dispatchEvent(ji)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==wc&&this.loader){this.state=bc,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;on((()=>this.loader(this.getExtent(),e,this.getPixelRatio()))).then((t=>{"image"in t&&(this.image_=t.image),"extent"in t&&(this.extent=t.extent),"resolution"in t&&(this.resolution=t.resolution),"pixelRatio"in t&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||Fn&&t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=Sc})).catch((t=>{this.state=Cc,console.error(t)})).finally((()=>this.changed()))}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function Tc(t,e){return e&&(t.src=e),t.src&&Pn?new Promise(((e,i)=>t.decode().then((()=>e(t))).catch((n=>t.complete&&t.width?e(t):i(n))))):function(t){return new Promise(((e,i)=>{function n(){s(),e(t)}function r(){s(),i(new Error("Image load error"))}function s(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r)}))}(t)}function Ic(t,e,i){return e+":"+t+":"+(i?Kh(i):"null")}const Mc=new class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=Ic(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=Ic(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,n,r){const s=Ic(t,e,i),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===wc&&n.load(),n.getImageState()===bc?n.ready().then((()=>{this.patternCache_[s]=Ja().createPattern(n.getImage(1),"repeat")})):this.patternCache_[s]=Ja().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let kc=null;class Pc extends un{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=void 0===n?wc:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===Sc){kc||(kc=Ya(1,1,void 0,{willReadFrequently:!0})),kc.drawImage(this.image_,0,0);try{kc.getImageData(0,0,1,1),this.tainted_=!1}catch{kc=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(ji)}handleImageError_(){this.imageState_=Cc,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Sc,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=Ya(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===wc){this.image_||this.initializeImage_(),this.imageState_=bc;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Tc(this.image_,this.src_).then((t=>{this.image_=t,this.handleImageLoad_()})).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==Sc)return;const e=this.image_,i=Ya(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var r;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(r=this.color_)?r:Bh(r),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise((t=>{if(this.imageState_===Sc||this.imageState_===Cc)t();else{const e=()=>{this.imageState_!==Sc&&this.imageState_!==Cc||(this.removeEventListener(ji,e),t())};this.addEventListener(ji,e)}}))),this.ready_}}function Fc(t,e,i,n,r,s){let o=void 0===e?void 0:Mc.get(e,i,r);return o||(o=new Pc(t,t&&"src"in t?t.src||void 0:e,i,n,r),Mc.set(e,i,r,o,s)),s&&o&&!Mc.getPattern(e,i,r)&&Mc.set(e,i,r,o,s),o}function Ac(t){return t?Array.isArray(t)?Bh(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Mc.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,i=Mc.getPattern(e,void 0,t.color);if(i)return i;const n=Mc.get(t.src,"anonymous",null);if(n.getImageState()!==Sc)return null;const r=Ya(t.size[0],t.size[1]);return r.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Fc(r.canvas,e,void 0,Sc,t.color,!0),Mc.getPattern(e,void 0,t.color)}(t):t:null}const Lc="10px sans-serif",Oc="#000",zc="round",Dc=[],jc="round",Nc="#000",Gc="center",Xc="middle",Wc=[0,0,0,0],qc=new xn;let Vc,$c=null;const Uc={},Kc=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Bc(t,e,i){return`${t} ${e} 16px "${i}"`}const Zc=function(){const t=100;let e,i;async function n(t){await i.ready;const e=await i.load(t);if(0===e.length)return!1;const n=Za(t),r=n.families[0].toLowerCase(),s=n.weight;return e.some((t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),i=Ba[t.weight]||t.weight;return e===r&&t.style===n.style&&i==s}))}async function r(){await i.ready;let s=!0;const o=qc.getProperties(),a=Object.keys(o).filter((e=>o[e]=0;--e){const i=a[e];let r=o[i];rMath.max(e,Jc(t,i))),0);return i[e]=n,n}function td(t,e,i,n,r,s,o,a,l,h,u){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(u[0],u[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;tthis.imageState_=Sc)),this.render()}clone(){const t=this.getScale(),e=new id({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(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=Mc.get(i,null,null)?.getImage(1);if(!n){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=Ya(r,r);this.draw_(e,s,t),n=s.canvas;const o=new Pc(n,void 0,null,Sc,null);Mc.set(i,null,null,o),createImageBitmap(n).then((t=>{o.setImage(t)}))}return n}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,r=void 0===this.radius2_?n:this.radius2_;if(n{this.patternImage_=null})),e.getImageState()===wc&&e.load(),e.getImageState()===bc&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?yn(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:Kh(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function sd(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class od extends ed{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const s=void 0!==t.img?t.img:null;let o,a=t.src;if(Hn(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||yn(s)),Hn(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Hn(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=wc:void 0!==s&&(o="complete"in s?s.complete?s.src?Sc:wc:bc:Sc),this.color_=void 0!==t.color?Kh(t.color):null,this.iconImage_=Fc(s,a,this.crossOrigin_,o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(sd(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(sd(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new od({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:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){const e=t?Kh(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every(((t,i)=>t===e[i])))return;this.color_=e;const i=this.getSrc(),n=void 0!==i?null:this.getHitDetectionImage(),r=void 0!==i?wc:this.iconImage_.getImageState();this.iconImage_=Fc(n,i,this.crossOrigin_,r,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Fc(null,t,this.crossOrigin_,wc,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==Sc?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==Sc?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(ji,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(ji,t)}ready(){return this.iconImage_.ready()}}class ad{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){const t=this.getColor();return new ad({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),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_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}}class ld{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=cd,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new ld({geometry:t??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(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=cd,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let hd=null;function ud(t,e){if(!hd){const t=new rd({color:"rgba(255,255,255,0.4)"}),e=new ad({color:"#3399CC",width:1.25});hd=[new ld({image:new nd({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return hd}function cd(t){return t.getGeometry()}class dd{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=Yh(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new rd({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new dd({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof rd?this.getFill().clone():this.getFill(),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_}getKeepUpright(){return this.keepUpright_}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(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Yh(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}function gd(t){return!0}function pd(t){const e=du(),i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;r0&&"string"==typeof p[0]?m=Sd(t,i+"color",e):f=Od(p,i+"color")}const y=function(t,e){const i=t[e];if(void 0===i)return;if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}(t,i+"cross-origin"),_=function(t,e){const i=t[e];if(void 0===i)return;return Fd(i,e)}(t,i+"offset"),x=Md(t,i+"offset-origin"),v=Id(t,i+"width"),w=Id(t,i+"height"),b=function(t,e){const i=t[e];if(void 0===i)return;if("number"==typeof i)return Yh(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}(t,i+"size"),S=Pd(t,i+"declutter-mode"),C={src:r,anchorOrigin:c,anchorXUnits:d,anchorYUnits:g,crossOrigin:y,offset:_,offsetOrigin:x,height:w,width:v,size:b,declutterMode:S};let E=null;return function(t){if(E)m&&E.setColor(m(t));else{const e=m?m(t):f;E=new od(void 0!==e?Object.assign({},C,{color:e}):Object.assign({},C))}return a&&E.setOpacity(a(t)),l&&E.setDisplacement(l(t)),h&&E.setRotation(h(t)),u&&E.setRotateWithView(u(t)),o&&E.setScale(o(t)),s&&E.setAnchor(s(t)),E}}(t,e);if("shape-points"in t)return function(t,e){const i="shape-",n=i+"points",r=i+"radius",s=Ld(t[n],n);if(!(r in t))throw new Error(`Expected a number for ${r}`);const o=vd(t,r,e),a="number"==typeof t[r]?t[r]:5,l=i+"radius2",h=vd(t,l,e),u="number"==typeof t[l]?t[l]:void 0,c=yd(t,i,e),d=_d(t,i,e),g=Td(t,i+"scale",e),p=Ed(t,i+"displacement",e),f=vd(t,i+"rotation",e),m=bd(t,i+"rotate-with-view",e),y=Id(t,i+"angle"),_=Pd(t,i+"declutter-mode"),x=new id({points:s,radius:a,radius2:u,angle:y,declutterMode:_});return function(t){return o&&x.setRadius(o(t)),h&&x.setRadius2(h(t)),c&&x.setFill(c(t)),d&&x.setStroke(d(t)),p&&x.setDisplacement(p(t)),f&&x.setRotation(f(t)),m&&x.setRotateWithView(m(t)),g&&x.setScale(g(t)),x}}(t,e);if("circle-radius"in t)return function(t,e){const i="circle-",n=yd(t,i,e),r=_d(t,i,e),s=vd(t,i+"radius",e),o=Td(t,i+"scale",e),a=Ed(t,i+"displacement",e),l=vd(t,i+"rotation",e),h=bd(t,i+"rotate-with-view",e),u=Pd(t,i+"declutter-mode"),c=new nd({radius:5,declutterMode:u});return function(t){return s&&c.setRadius(s(t)),n&&c.setFill(n(t)),r&&c.setStroke(r(t)),a&&c.setDisplacement(a(t)),l&&c.setRotation(l(t)),h&&c.setRotateWithView(h(t)),o&&c.setScale(o(t)),c}}(t,e);return null}(t,e),o=vd(t,"z-index",e);if(!(i||n||r||s||ln(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new ld;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(r){const i=r(t);i&&(e=!1),a.setText(i)}if(s){const i=s(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function yd(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=wd(t,e+"pattern-src",i),r=Rd(t,e+"pattern-offset",i),s=Rd(t,e+"pattern-size",i),o=Sd(t,e+"color",i);return function(t){return{src:n(t),offset:r&&r(t),size:s&&s(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=Sd(t,e+"fill-color",i)}if(!n)return null;const r=new rd;return function(t){const e=n(t);return e===Mh?null:(r.setColor(e),r)}}function _d(t,e,i){const n=vd(t,e+"stroke-width",i),r=Sd(t,e+"stroke-color",i);if(!n&&!r)return null;const s=wd(t,e+"stroke-line-cap",i),o=wd(t,e+"stroke-line-join",i),a=Cd(t,e+"stroke-line-dash",i),l=vd(t,e+"stroke-line-dash-offset",i),h=vd(t,e+"stroke-miter-limit",i),u=vd(t,e+"stroke-offset",i),c=new ad;return function(t){if(r){const e=r(t);if(e===Mh)return null;c.setColor(e)}if(n&&c.setWidth(n(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");c.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(e)}return a&&c.setLineDash(a(t)),l&&c.setLineDashOffset(l(t)),h&&c.setMiterLimit(h(t)),u&&c.setOffset(u(t)),c}}function xd(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function vd(t,e,i){const n=xd(t,e);if(void 0===n)return;const r=yc(n,Qh,i);return function(t){return Ld(r(t),e)}}function wd(t,e,i){const n=xd(t,e);if(void 0===n)return null;const r=yc(n,tu,i);return function(t){return Ad(r(t),e)}}function bd(t,e,i){const n=xd(t,e);if(void 0===n)return null;const r=yc(n,Jh,i);return function(t){const i=r(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Sd(t,e,i){const n=xd(t,e);if(void 0===n)return null;const r=yc(n,eu,i);return function(t){return Od(r(t),e)}}function Cd(t,e,i){const n=xd(t,e);if(void 0===n)return null;if(Array.isArray(n)&&(0===n.length||"string"!=typeof n[0])){const t=n.map(((t,n)=>{if("number"==typeof t)return()=>t;const r=yc(t,Qh,i);return function(t){return Ld(r(t),`${e}[${n}]`)}}));return function(e){const i=new Array(t.length);for(let n=0;n4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function zd(t,e){const i=Fd(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const Dd="renderOrder";class jd extends uh{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Dd)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==!1&&(t.declutter[i]=new fh(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Dd,t)}setStyle(t){this.style_=void 0===t?ud:t;const e=function(t){if(void 0===t)return ud;if(!t)return null;if("function"==typeof t)return t;if(t instanceof ld)return t;if(!Array.isArray(t))return fd([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof ld){const i=new Array(e);for(let n=0;n=0;--r){const s=p[r],c=s.layer;if(c.hasRenderer()&&ch(s,h)&&o.call(a,c)){const r=c.getRenderer(),o=c.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=u.bind(null,s.managed);y[0]=a[0]+g[n][0],y[1]=a[1]+g[n][1],l=r.forEachFeatureAtCoordinate(y,e,i,h,m)}if(l)return l}}if(0===m.length)return;const _=1/m.length;return m.forEach(((t,e)=>t.distanceSq+=e*_)),m.sort(((t,e)=>t.distanceSq-e.distanceSq)),m.some((t=>l=t.callback(t.feature,t.layer,t.geometry))),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,en,this,r,s)}getMap(){return this.map_}renderFrame(t){fn()}scheduleExpireIconCache(t){Mc.canExpireCache()&&t.postRenderFunctions.push(Xd)}}function Xd(t,e){Mc.expire()}class Wd extends Gd{constructor(t){super(t),this.fontChangeListenerKey_=cn(qc,Di,t.redrawText,t),this.element_=kn?el():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Wa+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Nd(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){gn(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(ah,t);const e=t.layerStatesArray.sort(((t,e)=>t.zIndex-e.zIndex));e.some((t=>t.layer instanceof jd&&t.layer.getDeclutter()))&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let s=0,o=e.length;s0)&&(t.fillStyle=n,t.fillRect(0,0,s.width,s.height)),il(i)&&i.width>0){t.save();const n=e.style.opacity||i.style.opacity;t.globalAlpha=""===n?1:Number(n);const r=i.style.transform;if(r)t.transform(...jo(r));else{const e=parseFloat(i.style.width)/i.width,n=parseFloat(i.style.height)/i.height;t.transform(e,0,0,n,0,0)}t.drawImage(i,0,0),t.restore()}}}this.dispatchRenderEvent(lh,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach((e=>e.layer.renderDeferred(t)))}}}function qd(t){t instanceof uh?t.setMapInternal(null):t instanceof rh&&t.getLayers().forEach(qd)}function Vd(t,e){if(t instanceof uh)t.setMapInternal(e);else if(t instanceof rh){const i=t.getLayers().getArray();for(let t=0,n=i.length;tthis.updateSize()))),this.controls=e.controls||(kn?new bn:function(t){t=t||{};const e=new bn;return(void 0===t.zoom||t.zoom)&&e.push(new ol(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new sl(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new rl(t.attributionOptions)),e}()),this.interactions=e.interactions||(kn?new bn:function(t){t=t||{};const e=new bn,i=new al(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new El),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new cl({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new Cl({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Xl),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Wl({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new jl),e.push(new Nl({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Gl({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Al({duration:t.zoomDuration})),e}({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new tr(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Wn,this.handleLayerGroupChanged_),this.addChangeListener($n,this.handleViewChanged_),this.addChangeListener(qn,this.handleSizeChanged_),this.addChangeListener(Vn,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof Da||t.view.then((function(t){i.setView(new Da(t))})),this.controls.addEventListener(Oi,(t=>{t.element.setMap(this)})),this.controls.addEventListener(zi,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(Oi,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(zi,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(Oi,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(zi,(t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)})),this.controls.forEach((t=>{t.setMap(this)})),this.interactions.forEach((t=>{t.setMap(this)})),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Vd(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,s=void 0!==i.layerFilter?i.layerFilter:en,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i}getAllLayers(){const t=[];return function e(i){i.forEach((function(i){i instanceof rh?e(i.getLayers()):t.push(i)}))}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:en,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],r=e.height/i[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/n,(s.clientY-e.top)/r]}getTarget(){return this.get(Vn)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return bo(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Ao(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Wn)}setLayers(t){const e=this.getLayerGroup();if(t instanceof bn)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;if(!n.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[er]||e[ir]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new ih("removelayer",e)),this.set(Wn,t)}setSize(t){this.set(qn,t)}setTarget(t){this.set(Vn,t)}setView(t){if(!t||t instanceof Da)return void this.set($n,t);this.set($n,new Da);const e=this;t.then((function(t){e.setView(new Da(t))}))}updateSize(){const t=this.getTargetElement();let e;if(t){let i,n;if(il(t)){const e=t.getContext("2d").getTransform();i=t.width/e.a,n=t.height/e.d}else{const e=getComputedStyle(t);i=t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),n=t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)}isNaN(i)||isNaN(n)||(e=[Math.max(0,i),Math.max(0,n)],!Zh(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&gs("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&tn(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}class Ud extends xn{constructor(t){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_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Ud(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}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_&&(gn(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=cn(t,ji,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{Hn("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function Kd(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}(u,c);d<0?(l=(c-u[-d-2])/(u[-d-1]-u[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,s=s||new Array(o);for(let e=0;e>1;rt.clone()))}function Jd(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;a{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=oa(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=aa(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=ua(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new rg(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_})),this}}function sg(t,e,i,n,r,s,o){let a,l;void 0!==i&&void 0!==n?(a=t-i,l=e-n):void 0!==r&&void 0!==s?(a=r-t,l=s-e):(a=1,l=0);const h=Math.hypot(a,l),u=a/h,c=l/h;if(a=-c,l=u,void 0===i||void 0===n)return[t+a*o,e+l*o];if(void 0===r||void 0===s)return[t+a*o,e+l*o];const d=function(t,e,i){const n=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),r=[(e[0]-t[0])/n,(e[1]-t[1])/n],s=[-r[1],r[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),a=[(i[0]-t[0])/o,(i[1]-t[1])/o];let l=0===n||0===o?0:Math.acos(rr(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:2*Math.PI-l}([t,e],[i,n],[r,s]);if(Math.cos(d)>.998)return[t+u*o,e+c*o];const g=Math.cos(d/2),p=Math.sin(d/2);return[t+(p*a+g*l)*(1/p)*o,e+(-g*a+p*l)*(1/p)*o]}rg.prototype.getFlatCoordinates=rg.prototype.getOrientedFlatCoordinates;class og{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}class ag extends og{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?cr(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,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_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const r=No(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;t0&&(a=function(t,e,i,n,r,s){r=r??[],s=s??e;const o=t[0],a=t[1],l=t[t.length-4],h=t[t.length-3];let u,c,d,g,p,f,m,y,_=0;for(let x=0;xt*this.pixelRatio_)),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:jc,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Ac(t||Nc),strokeOffset:(h??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Ac(t||Oc)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),r=i.getLineDashOffset(),s=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:zc,lineDash:n||Dc,lineDashOffset:r||0,lineJoin:void 0!==s?s:jc,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Ac(t||Nc)}}else this.textStrokeState_=null;const n=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),u=t.getTextAlign(),c=t.getTextBaseline();this.textState_={font:void 0!==n?n:Lc,textAlign:void 0!==u?u:Gc,textBaseline:void 0!==c?c:Xc},this.text_=void 0!==h?Array.isArray(h)?h.reduce(((t,e,i)=>t+(i%2?" ":e)),""):h:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}}const lg={Point:function(t,e,i,n,r,s){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Sc)return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,h),s.drawPoint(e,n,r)}if(l){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a,h),s.drawText(e,n,r)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},MultiPoint:function(t,e,i,n,r,s){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),u=s&&a&&h?{}:void 0;if(a){if(o.getImageState()!=Sc)return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,u),s.drawMultiPoint(e,n,r)}if(h){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(l,u),s.drawText(e,n,r)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},GeometryCollection:function(t,e,i,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a0;return c&&Promise.all(l).then((()=>r(null))),function(t,e,i,n,r,s,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r),h=i.getRenderer();if(h)gg(t,l,i,e,o);else{(0,lg[l.getType()])(t,l,i,e,o,s)}}(t,e,i,n,s,o,a),c}function gg(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function fg(t,e){return function(i,n,r,s,o){pg(t,e,i,n,r,((t,e)=>{this.addFeatures(t),void 0!==s&&s(t)}),(()=>{this.changed(),void 0!==o&&o()}))}}function mg(t,e){return[[-1/0,-1/0,1/0,1/0]]}function yg(t,e){return[t]}class _g{constructor(t){this.rbush_=new fh(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[yn(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;nt):null}var wg="addfeature",bg="changefeature",Sg="clear",Cg="removefeature",Eg="featuresloadstart",Rg="featuresloadend",Tg="featuresloaderror";class Ig extends hn{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Mg extends xg{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=rn,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(Hn(this.format_,"`format` must be set when `url` is set"),this.loader_=fg(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:mg;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new _g:null,this.loadedExtentsRtree_=new _g,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new bn(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=yn(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Ig(wg,t))}setupChangeEvents_(t,e){e instanceof rg||(this.featureChangeKeys_[t]=[cn(e,ji,this.handleFeatureChange_,this),cn(e,Di,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof rg){const n=this.idIndex_[t];n instanceof rg?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(Hn(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(zi,(t=>{e||(e=!0,this.removeFeature(t.element),e=!1)})),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(gn)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach((t=>{this.removeFeatureInternal(t)}));for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Ig(Sg);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,(function(i){const n=i.getGeometry();if(n instanceof rg||n.intersectsCoordinate(t))return e(i)}))}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,(function(i){const n=i.getGeometry();if(n instanceof rg||n.intersectsExtent(t)){const t=e(i);if(t)return t}}))}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),ln(this.nullGeometryFeatures_)||Qi(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)})),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=rs(t,e);return[].concat(...i.map((t=>this.featuresRtree_.getInExtent(t))))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||en,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof rg?0:e.closestPointXY(i,n,s,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new Ig(Rg,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Ig(Tg))})),n.insert(s,{extent:s.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,(function(e){if(zr(e.extent,t))return e}));i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;ia&&(this.instructions.push([Lg,a,h,t,i,na,r]),this.hitDetectionInstructions.push([Lg,a,h,t,n||i,na,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([Lg,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([Lg,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[kg,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[kg,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,r,s=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[Gg,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Xg,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!tn(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Dg,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Er(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Cr(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class Bg extends Kg{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n,r){const s=this.state,o=void 0!==s.fillStyle,a=void 0!==s.strokeStyle,l=i.length;this.instructions.push($g),this.hitDetectionInstructions.push($g);for(let s=0;sthis.drawCircle(t,e,i))))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Gg,Oc]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Xg,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Dc,0]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const u=[Fg,h,o];this.instructions.push($g,u),this.hitDetectionInstructions.push($g,u),void 0!==n.fillStyle&&(this.instructions.push(qg),this.hitDetectionInstructions.push(qg)),void 0!==n.strokeStyle&&(this.instructions.push(Vg),this.hitDetectionInstructions.push(Vg)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_((()=>this.drawPolygon(t,e,i))))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Gg,Oc]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Xg,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Dc,0]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_((()=>this.drawMultiPolygon(t,e,i))))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Gg,Oc]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Xg,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Dc,0]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let u=0;for(let t=0,e=a.length;t0&&void 0!==i&&void 0!==n&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=n,e.strokeOffset=r,t(),e.fillStyle=i,!0)}}function Zg(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a=t){const e=(t-a+c)/c,d=ur(i,h,e),g=ur(n,u,e);l.push(d,g),s.push(l),l=[d,g],a==t&&(o+=r),a=0}else if(a0&&s.push(l),s}function Yg(t,e,i,n,r){let s,o,a,l,h,u,c,d,g,p,f=i,m=i,y=0,_=0,x=i;for(o=i;ot&&(_>y&&(y=_,f=x,m=o),_=0,x=o-r)),a=l,c=g,d=p),h=i,u=n}return _+=l,_>y?[x,o]:[f,m]}const Hg={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const Jg={Circle:Bg,Default:Kg,Image:class extends Kg{constructor(t,e,i,n){super(t,e,i,n),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(t,e,i){if(!this.image_||this.maxExtent&&!Tr(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([zg,s,o,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([zg,s,o,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(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let e=0,i=n.length;e{const n=o[2*(t+i)]===h[i*u]&&o[2*(t+i)+1]===h[i*u+1];return n||--t,n}))}this.saveTextStates_();const c=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(t,e,i);let g=s.padding;if(g!=Wc&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),g=[t,e,i,n]}const p=this.pixelRatio;this.instructions.push([zg,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,g==Wc?Wc:g.map((function(t){return t*p})),c,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const f=1/p,m=c?c.slice(0):null;m&&(m[1]=Oc),this.hitDetectionInstructions.push([zg,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[f,f],NaN,this.declutterMode_,this.declutterImageWithText_,g,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Oc:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{if(!ts(this.maxExtent,t.getExtent()))return;let n;if(h=t.getFlatCoordinates(),"LineString"==l)n=[h.length];else if("MultiLineString"==l)n=t.getEnds();else if("Polygon"==l)n=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();n=[];for(let t=0,i=e.length;tt[2]}else I=w>R;const M=Math.PI,k=[],P=S+n===e;let F;if(y=0,_=C,g=t[e=S],p=t[e+1],P){x(),F=Math.atan2(p-m,g-f),I&&(F+=F>0?-M:M);const t=(R+w)/2,e=(T+b)/2;return k[0]=[t,e,(E-s)/2,F,r],k}for(let t=0,c=(r=r.replace(/\n/g," ")).length;t0?-M:M),void 0!==F){let t=d-F;if(t+=t>M?-2*M:t<-M?2*M:0,Math.abs(t)>o)return null}F=d;const w=t;let b=0;for(;t{if("function"==typeof Ja()[e])return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach((e=>{for(let i=0,n=e.length;i0&&t.push("\n",""),t.push(e,""),t}function cp(t,e,i){return i%2==0&&(t+=e),t}class dp{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new ep:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],u=a.justify?Hg[a.justify]:hp(Array.isArray(t)?t[0]:t,a.textAlign||Gc),c=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(up,[]),{width:g,height:p,widths:f,heights:m,lineWidths:y}=function(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,u=e.length;h<=u;h+=2){const c=e[h];if("\n"===c||h===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,g=Jc(d,c);i.push(g),o+=g;const p=Yc(d);n.push(p),l=Math.max(l,p)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}(a,d),_=g+c,x=[],v=(_+2)*h[0],w=(p+c)*h[1],b={width:v<0?Math.floor(v):Math.ceil(v),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",s.strokeStyle),x.push("lineWidth",c),x.push("lineCap",s.lineCap),x.push("lineJoin",s.lineJoin),x.push("miterLimit",s.miterLimit),x.push("setLineDash",[s.lineDash]),x.push("lineDashOffset",s.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const S=.5-u;let C=u*_+S*c;const E=[],R=[];let T,I=0,M=0,k=0,P=0;for(let t=0,e=d.length;tt?t-l:r,x=s+h>e?e-h:s,v=g[3]+_*c[0]+g[1],w=g[0]+x*c[1]+g[2],b=m-g[3],S=y-g[0];let C;return(p||0!==u)&&(np[0]=b,op[0]=b,np[1]=S,rp[1]=S,rp[0]=b+v,sp[0]=rp[0],sp[1]=S+w,op[1]=sp[1]),0!==u?(C=Oo([1,0,0,1,0,0],i,n,1,1,u,-i,-n),Ao(C,np),Ao(C,rp),Ao(C,sp),Ao(C,op),Fr(Math.min(np[0],rp[0],sp[0],op[0]),Math.min(np[1],rp[1],sp[1],op[1]),Math.max(np[0],rp[0],sp[0],op[0]),Math.max(np[1],rp[1],sp[1],op[1]),ip)):Fr(Math.min(b,b+v),Math.min(S,S+w),Math.max(b,b+v),Math.max(S,S+w),ip),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:_,drawImageH:x,originX:l,originY:h,declutterBox:{minX:ip[0],minY:ip[1],maxX:ip[2],maxY:ip[3],value:f},canvasTransform:C,scale:c}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,np,rp,sp,op,s,o),td(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Ao(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=hp(Array.isArray(t)?t[0]:t,r.textAlign||Gc),h=Hg[r.textBaseline||Xc],u=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*u,anchorY:h*s.height/a+2*(.5-h)*u}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;var u,c;this.pixelCoordinates_&&tn(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=No(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),u=this.renderedTransform_,c=i,u[0]=c[0],u[1]=c[1],u[2]=c[2],u[3]=c[3],u[4]=c[4],u[5]=c[5]);let d=0;const g=n.length;let p,f,m,y,_,x,v,w,b,S,C,E,R,T,I,M,k=0,P=0,F=0;const A=this.coordinateCache_,L=this.viewRotation_,O=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,z={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:L},D=this.instructions!=n||this.overlaps?0:200;let j,N,G,X;for(;dD&&(this.fill_(t),P=0),F>D&&(t.stroke(),F=0),P||F||(t.beginPath(),w=NaN,b=NaN),++d;break;case Fg:k=i[1],y=i[2]??0;const n=h[k],u=h[k+1],c=h[k+2]-y-n,g=h[k+3]-y-u,W=Math.sqrt(c*c+g*g);t.moveTo(n+W,u),t.arc(n,u,W,0,2*Math.PI,!0),++d;break;case Ag:t.closePath(),++d;break;case Lg:k=i[1],p=i[2];const q=i[3],V=i[4],$=i[5];z.geometry=q,z.feature=j,d in A||(A[d]=[]);const U=A[d];$?$(h,k,p,2,U):(U[0]=h[k],U[1]=h[k+1],U.length=2),l&&(l.zIndex=i[6]),V(U,z),++d;break;case zg:k=i[1],p=i[2],E=i[3],f=i[4],m=i[5];let K=i[6];const B=i[7],Z=i[8],Y=i[9],H=i[10];let J=i[11];const Q=i[12];let tt=i[13];v=i[14]||"declutter";const et=i[15];if(!E&&i.length>=20){R=i[19],T=i[20],I=i[21],M=i[22];const t=this.drawLabelWithPointPlacement_(R,T,I,M);E=t.label,i[3]=E;const e=i[23];f=(t.anchorX-e)*this.pixelRatio,i[4]=f;const n=i[24];m=(t.anchorY-n)*this.pixelRatio,i[5]=m,K=E.height,i[6]=K,tt=E.width,i[13]=tt}let it,nt,rt,st;i.length>25&&(it=i[25]),i.length>17?(nt=i[16],rt=i[17],st=i[18]):(nt=Wc,rt=null,st=null),H&&O?J+=L:H||O||(J-=L);let ot=0;for(;k!pp.includes(t)));let mp=!1,yp=!1;class _p{constructor(t,e,i,n,r,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new dp(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e{const i=Ya(1,1,null,{willReadFrequently:e});let n=0;const r=performance.now();for(;performance.now()-r<50;++n)i.fillStyle=`rgba(255,0,${n%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=n>t?n:t,n},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};mp=i[t],yp=!0}();const o=2*(n=Math.round(n))+1,a=Oo(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=Ya(o,o,null,{willReadFrequently:mp}));const h=this.hitDetectionContext_;let u;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(u=[1/0,1/0,-1/0,-1/0],jr(u,t),Cr(u,e*(this.renderBuffer_+n),u));const c=function(t){if(void 0!==xp[t])return xp[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let r=0;r<=t;++r)for(let s=0;s<=t;++s){const o=r*r+s*s;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(c[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const p=Object.keys(this.executorsByZIndex_).map(Number);let f,m,y,_,x;for(p.sort(Zi),f=p.length-1;f>=0;--f){const t=p[f].toString();for(y=this.executorsByZIndex_[t],m=gp.length-1;m>=0;--m)if(d=gp[m],_=y[d],void 0!==_&&(x=_.executeHitDetection(h,a,i,g,u),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return No(o,0,8,2,t,o),o}isEmpty(){return ln(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?Yi:Zi),s=s||gp;const l=gp.length;for(let h=0,u=a.length;hg.execute(t,e,i,n,r,o))):g.execute(u,e,i,n,r,o),c&&u.restore(),s){s.offset();const t=a[h]*l+gp.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Zi);for(let i=0,n=e.length;i{t.draw(this.renderedContext_),t.clear()})),t[e[i]].length=0}}const xp={};const vp=.5;function wp(t,e,i,n,r,s,o,a,l){const h=l?Co(r):r,u=Ya(t[0]*vp,t[1]*vp);u.imageSmoothingEnabled=!1;const c=u.canvas,d=new ag(u,vp,r,null,o,a,l?yo(null,l):null),g=i.length,p=Math.floor(16777215/g),f={};for(let t=1;t<=g;++t){const e=i[t-1],r=e.getStyleFunction()||n;if(!r)continue;let o=r(e,s);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*p).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;tthis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return fn()}getData(t){return null}prepareFrame(t){return fn()}renderFrame(t,e){return fn()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==Sc&&e.getState()!==Cc||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Sc&&e!=Cc&&t.addEventListener(ji,this.boundHandleImageChange_),e==wc&&(t.load(),e=t.getState()),e==Sc}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const Cp=[];let Ep=null;class Rp extends Sp{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;Ep||(Ep=Ya(1,1,void 0,{willReadFrequently:!0})),Ep.clearRect(0,0,1,1);try{Ep.drawImage(t,e,i,1,1,0,0,1,1),n=Ep.getImageData(0,0,1,1).data}catch{return Ep=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&tn(Kh(t.style.backgroundColor),Kh(i)))){const e=t.firstElementChild;il(e)&&(s=e.getContext("2d"))}if(s&&function(t,e){const i=jo(t),n=jo(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*Do[t]))return!1;return!0}(s.canvas.style.transform,e)?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=kn?el():document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=Ya();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=Hr(i),r=Jr(i),s=Vr(i),o=qr(i);Ao(e.coordinateToPixelTransform,n),Ao(e.coordinateToPixelTransform,r),Ao(e.coordinateToPixelTransform,s),Ao(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Ao(a,n),Ao(a,r),Ao(a,s),Ao(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(Qr(i)/n*s),a=Math.round(Zr(i)/n*s);Oo(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),zo(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.join(", ")+")";if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new Nd(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(sh,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(oh,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new ep),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(sh,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(oh,this.context,t))}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,u=-h,c=-t[0]+o,d=-t[1];return Oo(this.tempTransform,a,l,h,u,-i,c,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class Tp extends Rp{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],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(t,e,i){const n=e.extent,r=e.viewState,s=r.center,o=r.resolution,a=r.projection,l=r.rotation,h=a.getExtent(),u=this.getLayer().getSource(),c=this.getLayer().getDeclutter(),d=e.pixelRatio,g=e.viewHints,p=!(g[er]||g[ir]),f=this.context,m=Math.round(Qr(n)/o*d),y=Math.round(Zr(n)/o*d),_=u.getWrapX()&&a.canWrapX(),x=_?Qr(h):null,v=_?Math.ceil((n[2]-h[2])/x)+(this.extendX_?2:1):1;let w=_?Math.floor((n[0]-h[0])/x)-(this.extendX_?1:0):0;do{let n=this.getRenderTransform(s,o,0,d,m,y,w*x);e.declutter&&(n=n.slice(0)),t.execute(f,[f.canvas.width,f.canvas.height],n,l,p,void 0===i?gp:i?pp:fp,i?c&&e.declutter[c]:void 0)}while(++w{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*vp,h=t[1]*vp;a.push(this.getRenderTransform(e,i,n,vp,l,h,0).slice());const u=o.getSource(),c=r.getExtent();if(u.getWrapX()&&r.canWrapX()&&!Ir(c,s)){let t=s[0];const r=Qr(c);let o,u=0;for(;tc[2];)++u,o=r*u,a.push(this.getRenderTransform(e,i,n,vp,l,h,o).slice()),t-=r}this.hitDetectionImageData_=wp(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,ug(i,this.renderedPixelRatio_),null)}e(bp(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,i,(function(t,e,i){const s=yn(t),o=l[s];if(o){if(!0!==o&&it.value)):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[er],r=t.viewHints[ir],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,u=l.resolution,c=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let p=e.getRenderOrder();void 0===p&&(p=hg);const f=l.center.slice(),m=Cr(a,g*u),y=m.slice(),_=[m.slice()],x=h.getExtent(),v=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,v){const t=i.getExtent();t&&!es(t)&&(this.extendX_=t[0]x[2])}if(v&&(!Ir(x,t.extent)||this.extendX_)){const t=Qr(x),e=Math.max(Qr(m)/2,t);let i=x[0],n=x[2];this.extendX_&&(i-=t,n+=t),m[0]=i-e,m[2]=n+e,as(f,h);const r=ns(_[0],h);r[0]x[0]&&r[2]>x[2]&&_.push([r[0]-t,r[1],r[2]-t,r[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===c&&this.renderedRevision_==d&&this.renderedRenderOrder_==p&&this.renderedFrameDeclutter_===!!t.declutter&&Ir(this.wrappedRenderedExtent_,m))return tn(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=f,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new Qg(cg(u,c),m,u,c);for(let t=0,e=_.length;t{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,u)),n){const e=this.renderFeature(t,b,n,w,undefined,this.getLayer().getDeclutter(),i);S=S&&!e}},E=Co(m),R=i.getFeaturesInExtent(E);p&&R.sort(p);for(let t=0,e=R.length;tt)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){fn()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:ls(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class Pp extends kp{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_,kn?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==n&&(this.image_.crossOrigin=n)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=Bn,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=Zn,this.unlistenImage_(),this.image_=function(){const t=Ya(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(kn)this.state=Bn;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=Bn:this.state=Yn}this.unlistenImage_(),this.changed()}load(){this.state==Zn&&(this.state=Un,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Un&&(this.state=Kn,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const n=t;let r=!0,s=!1,o=!1;const a=[dn(n,$i,(function(){o=!0,s||e()}))];return n.src&&Pn?(s=!0,n.decode().then((function(){r&&e()})).catch((function(t){r&&(o?e():i())}))):a.push(dn(n,Ni,i)),function(){r=!1,a.forEach(gn)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}class Fp{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Ap(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new Fp(t,e,i,n)}const Lp=[];class Op extends kp{constructor(t,e,i,n,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=Ya(1,1,Lp)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=yn(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(Qa(this.context_),Lp.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let zp=class extends kp{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==Un&&(this.setState(Kn),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(Zn)}setFeatures(t){this.features_=t,this.setState(Bn)}setLoader(t){this.loader_=t}};const Dp="https://api.mapbox.com";function jp(t){const e="mapbox://";return 0!==t.indexOf(e)?"":t.slice(9)}function Np(t,e,i){const n=jp(t);if(!n)return decodeURI(new URL(t,i).href);const r="sprites/";if(0!==n.indexOf(r))throw new Error(`unexpected sprites url: ${t}`);const s=n.slice(8);return`${Dp}/styles/v1/${s}/sprite?access_token=${e}`}function Gp(t,e){const i=jp(t);if(!i)return decodeURI(new URL(t,location.href).href);const n="styles/";if(0!==i.indexOf(n))throw new Error(`unexpected style url: ${t}`);const r=i.slice(7);return`${Dp}/styles/v1/${r}?&access_token=${e}`}const Xp=["a","b","c","d"];function Wp(t,e,i,n){const r=new URL(t,n||location.href),s=jp(t);if(!s)return e?(r.searchParams.has(i)||r.searchParams.set(i,e),[decodeURI(r.href)]):[decodeURI(r.href)];if("mapbox.satellite"===s){const t=window.devicePixelRatio>=1.5?"@2x":"";return[`https://api.mapbox.com/v4/${s}/{z}/{x}/{y}${t}.webp?access_token=${e}`]}return Xp.map((t=>`https://${t}.tiles.mapbox.com/v4/${s}/{z}/{x}/{y}.vector.pbf?access_token=${e}`))}const qp=Object.freeze({}),Vp={},$p={};let Up=0;function Kp(t){return t.id||(t.id=Up++),t.id}function Bp(t){let e=Vp[t.id];return e||(e={},Vp[Kp(t)]=e),e}function Zp(t){return t*Math.PI/180}const Yp=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function Hp(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const i=document.createElement("canvas");return i.width=t,i.height=e,i}function Jp(t,e){let i=0;const n=e.length;for(;ir)).then((t=>t instanceof Response?(n&&(n.url=t.url),o(t)):(t instanceof Request||(t=new Request(t)),t.headers.get("Accept")||t.headers.set("Accept","application/json"),n&&(n.url=t.url),fetch(t).then(o).catch(s)))).catch(s);return tf[e]=[r,a],a}function nf(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return ef("Style",t=Gp(t,e.accessToken),e);try{const e=JSON.parse(t);return Promise.resolve(e)}catch(t){return Promise.reject(t)}}const rf={};function sf(t,e,i={}){const n=[e,JSON.stringify(t)].toString();let r=rf[n];if(!r||i.transformRequest){let s;i.transformRequest&&(s=(t,e)=>{const n=i.transformRequest&&i.transformRequest(e,"Tiles")||e;if(t instanceof zp)t.setLoader(((e,i,r)=>{const s=function(i){i.arrayBuffer().then((i=>{const n=t.getFormat().readFeatures(i,{extent:e,featureProjection:r});t.setFeatures(n)}))};on((()=>n)).then((e=>{if(e instanceof Response)return s(e);fetch(e).then(s).catch((e=>t.setState(Zn)))})).catch((e=>t.setState(Zn)))}));else{const e=t.getImage();on((()=>n)).then((i=>{if("string"==typeof i)return void(e.src=i);const n=t=>t.blob().then((t=>{const i=URL.createObjectURL(t);e.addEventListener("load",(()=>URL.revokeObjectURL(i))),e.addEventListener("error",(()=>URL.revokeObjectURL(i))),e.src=i}));if(i instanceof Response)return n(i);fetch(i).then(n).catch((e=>t.setState(Zn)))})).catch((e=>t.setState(Zn)))}});const o=t.url;if(o&&!t.tiles){const n=Wp(o,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(o.startsWith("mapbox://"))r=Promise.resolve({tileJson:Object.assign({},t,{url:void 0,tiles:n}),tileLoadFunction:s});else{const t={};r=ef("Source",n[0],i,t).then((function(e){return e.tiles=e.tiles.map((function(n){return"tms"===e.scheme&&(n=n.replace("{y}","{-y}")),Wp(n,i.accessToken,i.accessTokenParam||"access_token",t.url)[0]})),Promise.resolve({tileJson:e,tileLoadFunction:s})}))}}else t.tiles?(t=Object.assign({},t,{tiles:t.tiles.map((function(n){return"tms"===t.scheme&&(n=n.replace("{y}","{-y}")),Wp(n,i.accessToken,i.accessTokenParam||"access_token",e||location.href)[0]}))}),r=Promise.resolve({tileJson:Object.assign({},t),tileLoadFunction:s})):r=Promise.reject(new Error("source has no `tiles` nor `url`"));rf[n]=r}return r}function of(t,e,i,n){const r=[2*i*e.pixelRatio+e.width,2*i*e.pixelRatio+e.height],s=Hp(r[0],r[1]),o=s.getContext("2d");o.drawImage(t,e.x,e.y,e.width,e.height,i*e.pixelRatio,i*e.pixelRatio,e.width,e.height);const a=o.getImageData(0,0,r[0],r[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${255*n.r},${255*n.g},${255*n.b},${n.a})`;const l=a.data;for(let t=0,n=a.width;t0&&o.arc(t,r,i*e.pixelRatio,0,2*Math.PI)}return o.fill(),s}function af(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}function lf(t,e,i){const n=Hp(e.width,e.height),r=n.getContext("2d");r.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let t=0,e=s.width;t0?(o[r+0]=Math.round(255*i.r*l),o[r+1]=Math.round(255*i.g*l),o[r+2]=Math.round(255*i.b*l),o[r+3]=Math.round(255*l)):o[r+3]=0}return r.putImageData(s,0,0),n}const hf=Array(256).join(" ");function uf(t,e){if(e>=.05){let i="";const n=t.split("\n"),r=hf.slice(0,Math.round(e/.1));for(let t=0,e=n.length;t0&&(i+="\n"),i+=n[t].split("").join(r);return i}return t}let cf;function df(){return cf||(cf=Hp(1,1).getContext("2d")),cf}function gf(t,e){return df().measureText(t).width+(t.length-1)*e}const pf={};function ff(t,e,i,n){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t1){const t=df();t.font=e;const r=t.measureText("M").width*i;let a="";const l=[];for(let t=0,e=o.length;t1;++t){const i=l[t];if(gf(i,n)<.35*r){const r=t>0?gf(l[t-1],n):1/0,s=t.7*r&&gf(s,n)<.6*r){const o=i.split(" "),a=o.pop();gf(a,n)<.2*r&&(l[t]=o.join(" "),l[t+1]=a+" "+s),e-=1}}s=l.join("\n")}else s=t;s=uf(s,n),pf[r]=s}return s}qc.on("propertychange",(()=>{for(const t in pf)delete pf[t]}));const mf=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],yf={};const _f={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},xf={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},vf={zoom:0,distanceFromCenter:0};let wf,bf;function Sf(t,e,i,n,r,s){const o=t.id;r||(r={},console.warn("No functionCache provided to getValue()")),r[o]||(r[o]={});const a=r[o];if(!a[i]){let n=(t[e]||qp)[i];const r=Mi[`${e}_${t.type}`][i];void 0===n&&(n=r.default);let s=(l=n,Array.isArray(l)&&l.length>0&&"string"==typeof l[0]&&l[0]in $e);if(!s&&ni(n)&&(n=wi(n,r),s=!0),s){const t=function(t,e){const i=li(t,e);if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return i.value}(n,r);a[i]=t.evaluate.bind(t)}else{const t=r.type;"color"!==t&&"colorArray"!==t||(n=Z.parse(n)),a[i]=function(){return n}}}var l;return a[i](vf,n,s)}function Cf(t,e,i,n){if(!Sf(t,"layout",`${i}-allow-overlap`,e,n))return"declutter";return Sf(t,"layout",`${i}-ignore-placement`,e,n)?"none":"obstacle"}function Ef(t,e,i,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(t in n))try{n[t]=di(e).filter}catch(e){console.warn("Filter will evaluate to false: "+e.message),n[t]=function(){return!1}}return n[t](vf,i)}function Rf(t,e){if(t){if(0===t.a||0===e)return;const i=t.a;return e=void 0===e?1:e,0===i?"transparent":"rgba("+Math.round(255*t.r/i)+","+Math.round(255*t.g/i)+","+Math.round(255*t.b/i)+","+i*e+")"}return t}Ue.register($e,{...Ue.definitions,pitch:[{kind:"number"},[],t=>vf.pitch||90],"distance-from-center":[{kind:"number"},[],t=>vf.distanceFromCenter||0]});const Tf=/\{[^{}}]*\}/g;function If(t,e){return t.replace(Tf,(function(t){return e[t.slice(1,-1)]||""}))}function Mf(t,e){let i=t.split(":")[0];return i===t&&(i="default"),e[i]}const kf={};function Pf(t,e,i,r=Yp,s=void 0,o=void 0,a=void 0,l=void 0){if("string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");kf[function(t,e){return Kp(t)+"."+yn(e)}(e,t)]=Array.from(arguments);const h={};("string"==typeof o||o instanceof Request||o instanceof Response||o instanceof Promise)&&(o={default:o});for(const e in o){const i=o[e];on((()=>i)).then((async i=>{let n;if("undefined"!=typeof Image){const r=new Image;if("string"==typeof i)r.crossOrigin="anonymous",r.src=i;else{let t;i instanceof Request?t=await fetch(i):i instanceof Response&&(t=i);const e=await t.blob();n=URL.createObjectURL(e),r.src=n}r.addEventListener("load",(function i(){r.removeEventListener("load",i),h[e]={image:r,size:[r.width,r.height]},t.changed(),n&&URL.revokeObjectURL(n)})),r.addEventListener("error",(function t(){URL.revokeObjectURL(n),r.removeEventListener("error",t)}))}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:i}),t.addEventListener("message",(function(t){"imageLoaded"===t.data.action&&t.data.src===i&&(h[e]={image:t.data.image,size:[t.data.image.width,t.data.image.height]})}))}}))}const u=n(e.layers),c={},d=[],g={},p={},f=Bp(e),m=function(t){let e=$p[t.id];return e||(e={},$p[Kp(t)]=e),e}(e);let y;for(let t=0,n=u.length;t=c.maxzoom)continue;const R=c.filter;if(!R||Ef(b,R,T,m)){let r,o,m,y,w,b;const R=u.index;if(3==S&&("fill"==c.type||"fill-extrusion"==c.type))if(o=Sf(c,"paint",c.type+"-opacity",T,f,I),c.type+"-pattern"in E){const t=Sf(c,"paint",c.type+"-pattern",T,f,I);if(t){const e="string"==typeof t?If(t,d):t.toString(),i=Mf(e,h);if(s&&s[e]&&i){++M,b=v[M],b&&b.getFill()&&!b.getStroke()&&!b.getText()||(b=new ld({fill:new rd}),v[M]=b),m=b.getFill(),b.setZIndex(R);const t=e+"."+o;let n=p[t];if(!n){const r=s[e],a=Hp(r.width,r.height),l=a.getContext("2d");l.globalAlpha=o,l.drawImage(i.image,r.x,r.y,r.width,r.height,0,0,r.width,r.height),n=l.createPattern(a,"repeat"),p[t]=n}m.setColor(n)}}}else r=Rf(Sf(c,"paint",c.type+"-color",T,f,I),o),c.type+"-outline-color"in E&&(w=Rf(Sf(c,"paint",c.type+"-outline-color",T,f,I),o)),w||(w=r),(r||w)&&(++M,b=v[M],(!b||r&&!b.getFill()||!r&&b.getFill()||w&&!b.getStroke()||!w&&b.getStroke()||b.getText())&&(b=new ld({fill:r?new rd:void 0,stroke:w?new ad:void 0}),v[M]=b),r&&(m=b.getFill(),m.setColor(r)),w&&(y=b.getStroke(),y.setColor(w),y.setWidth(.5)),b.setZIndex(R));if(1!=S&&"line"==c.type){r="line-pattern"in E?void 0:Rf(Sf(c,"paint","line-color",T,f,I),Sf(c,"paint","line-opacity",T,f,I));const t=Sf(c,"paint","line-width",T,f,I);r&&t>0&&(++M,b=v[M],b&&b.getStroke()&&!b.getFill()&&!b.getText()||(b=new ld({stroke:new ad}),v[M]=b),y=b.getStroke(),y.setLineCap(Sf(c,"layout","line-cap",T,f,I)),y.setLineJoin(Sf(c,"layout","line-join",T,f,I)),y.setMiterLimit(Sf(c,"layout","line-miter-limit",T,f,I)),y.setColor(r),y.setWidth(t),y.setLineDash(E["line-dasharray"]?Sf(c,"paint","line-dasharray",T,f,I).map((function(e){return e*t})):null),b.setZIndex(R))}let k,P,F,A,L,O,z,D,j,N=!1,G=null,X=0;if((1==S||2==S)&&"icon-image"in C){const e=Sf(c,"layout","icon-image",T,f,I);if(e){let r;k="string"==typeof e?If(e,d):e.toString();const o=l?l(t,k):void 0,a=Mf(k,h);if(s&&s[k]&&a||o){const t=Sf(c,"layout","icon-rotation-alignment",T,f,I);if(2==S){const e=i.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const i=e.getExtent();if(Math.sqrt(Math.max(Math.pow((i[2]-i[0])/n,2),Math.pow((i[3]-i[1])/n,2)))>150){const i="MultiLineString"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();bf||(wf=[NaN,NaN],bf=new rg("Point",wf,[],2,{},void 0)),r=bf,wf[0]=i[0],wf[1]=i[1];if("line"===Sf(c,"layout","symbol-placement",T,f,I)&&"map"===t){const t=e.getStride(),n=e.getFlatCoordinates();for(let e=0,r=n.length-t;e=l){X=Math.atan2(s-a,o-r);break}}}}}}if(2!==S||r){const e=Sf(c,"layout","icon-size",T,f,I),i=void 0!==E["icon-color"]?Sf(c,"paint","icon-color",T,f,I):null;if(!i||0!==i.a){const n=Sf(c,"paint","icon-halo-color",T,f,I),r=Sf(c,"paint","icon-halo-width",T,f,I);let l=`${k}.${e}.${r}.${n}`;if(null!==i&&(l+=`.${i}`),P=g[l],!P){const h=Cf(c,T,"icon",f);let u;"icon-offset"in C&&(u=Sf(c,"layout","icon-offset",T,f,I).slice(0),u[0]*=e,u[1]*=-e);let d=i?[255*i.r,255*i.g,255*i.b,i.a]:void 0;if(o){const i={color:d,rotateWithView:"map"===t,displacement:u,declutterMode:h,scale:e};"string"==typeof o?i.src=o:(i.img=o,i.imgSize=[o.width,o.height]),P=new od(i)}else{const o=s[k];let l,c,g;if(r)o.sdf?(l=of(lf(a.image,o,i||[0,0,0,1]),{x:0,y:0,width:o.width,height:o.height,pixelRatio:o.pixelRatio},r,n),d=void 0):l=of(a.image,o,r,n);else{if(o.sdf&&!a.unSDFed){const t=lf(a.image,{x:0,y:0,width:a.size[0],height:a.size[1]},{r:1,g:1,b:1});a.image=t,a.unSDFed=!0}l=a.image,c=[o.width,o.height],g=[o.x,o.y]}P=new od({color:d,img:l,imgSize:a.size,size:c,offset:g,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:u,declutterMode:h})}g[l]=P}}P&&(++M,b=v[M],b&&b.getImage()&&!b.getFill()&&!b.getStroke()||(b=new ld,v[M]=b),b.setGeometry(r),P.setRotation(X+Zp(Sf(c,"layout","icon-rotate",T,f,I))),P.setOpacity(Sf(c,"paint","icon-opacity",T,f,I)),P.setAnchor(xf[Sf(c,"layout","icon-anchor",T,f,I)]),b.setImage(P),G=b.getText(),b.setText(void 0),b.setZIndex(R),N=!0,F=!1)}else F=!0}}}if(1==S&&"circle"===c.type){++M,b=v[M],b&&b.getImage()&&!b.getFill()&&!b.getStroke()||(b=new ld,v[M]=b);const t="circle-radius"in E?Sf(c,"paint","circle-radius",T,f,I):5,e=Rf(Sf(c,"paint","circle-stroke-color",T,f,I),Sf(c,"paint","circle-stroke-opacity",T,f,I)),i=Sf(c,"paint","circle-translate",T,f,I),n=Rf(Sf(c,"paint","circle-color",T,f,I),Sf(c,"paint","circle-opacity",T,f,I)),r=Sf(c,"paint","circle-stroke-width",T,f,I),s=t+"."+e+"."+n+"."+r+"."+i[0]+"."+i[1];P=g[s],P||(P=new nd({radius:t,displacement:[i[0],-i[1]],stroke:e&&r>0?new ad({width:r,color:e}):void 0,fill:n?new rd({color:n}):void 0,declutterMode:"none"}),g[s]=P),b.setImage(P),G=b.getText(),b.setText(void 0),b.setGeometry(void 0),b.setZIndex(R),N=!0}if("text-field"in C){z=Math.round(Sf(c,"layout","text-size",T,f,I));const t=Sf(c,"layout","text-font",T,f,I);O=Sf(c,"layout","text-line-height",T,f,I),L=Li(a?a(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,z,O),L.includes("sans-serif")||(L+=",sans-serif"),D=Sf(c,"layout","text-letter-spacing",T,f,I),j=Sf(c,"layout","text-max-width",T,f,I);const i=Sf(c,"layout","text-field",T,f,I);A="object"==typeof i&&i.sections?1===i.sections.length?i.toString():i.sections.reduce(((e,i,n)=>{const r=i.fontStack?i.fontStack.split(","):t,s=Li(a?a(r):r,z*(i.scale||1),O);let o=i.text;if("\n"===o)return e.push("\n",""),e;if(2==S)return e.push(uf(o,D),s),e;o=ff(o,s,j,D).split("\n");for(let t=0,i=o.length;t0&&e.push("\n",""),e.push(o[t],s);return e}),[]):If(i,d).trim(),o=Sf(c,"paint","text-opacity",T,f,I)}if(A&&o&&!F){N||(++M,b=v[M],b&&b.getText()&&!b.getFill()&&!b.getStroke()||(b=new ld,v[M]=b),b.setImage(void 0),b.setGeometry(void 0));const t=Cf(c,T,"text",f);b.getText()||b.setText(G),G=b.getText(),(!G||"getDeclutterMode"in G&&G.getDeclutterMode()!==t)&&(G=new dd({padding:[2,2,2,2],declutterMode:t}),b.setText(G));const e=Sf(c,"layout","text-transform",T,f,I);"uppercase"==e?A=Array.isArray(A)?A.map(((t,e)=>e%2?t:t.toUpperCase())):A.toUpperCase():"lowercase"==e&&(A=Array.isArray(A)?A.map(((t,e)=>e%2?t:t.toLowerCase())):A.toLowerCase());const i=Array.isArray(A)?A:2==S?uf(A,D):ff(A,L,j,D);if(G.setText(i),G.setFont(L),G.setRotation(Zp(Sf(c,"layout","text-rotate",T,f,I))),"function"==typeof G.setKeepUpright){const t=Sf(c,"layout","text-keep-upright",T,f,I);G.setKeepUpright(t)}const n=Sf(c,"layout","text-anchor",T,f,I),r=N||1==S?"point":Sf(c,"layout","symbol-placement",T,f,I);let s;if("line-center"===r?(G.setPlacement("line"),s="center"):G.setPlacement(r),"line"===r&&"function"==typeof G.setRepeat){const t=Sf(c,"layout","symbol-spacing",T,f,I);G.setRepeat(2*t)}G.setOverflow("point"===r);let a=Sf(c,"paint","text-halo-width",T,f,I);const l=Sf(c,"layout","text-offset",T,f,I),h=Sf(c,"paint","text-translate",T,f,I);let u=0,d=0;if("point"==r){s="center",-1!==n.indexOf("left")?(s="left",d=a):-1!==n.indexOf("right")&&(s="right",d=-a);const t=Sf(c,"layout","text-rotation-alignment",T,f,I);G.setRotateWithView("map"==t)}else G.setMaxAngle(Zp(Sf(c,"layout","text-max-angle",T,f,I))*A.length/i.length),G.setRotateWithView(!1);G.setTextAlign(s);let g="middle";0==n.indexOf("bottom")?(g="bottom",u=-a-.5*(O-1)*z):0==n.indexOf("top")&&(g="top",u=a+.5*(O-1)*z),G.setTextBaseline(g);const p=Sf(c,"layout","text-justify",T,f,I);G.setJustify("auto"===p?void 0:p),G.setOffsetX(l[0]*z+d+h[0]),G.setOffsetY(l[1]*z+u+h[1]),x.setColor(Rf(Sf(c,"paint","text-color",T,f,I),o)),G.setFill(x);const m=Rf(Sf(c,"paint","text-halo-color",T,f,I),o);if(m&&a>0){_.setColor(m),a*=2;const t=.5*z;_.setWidth(a<=t?a:t),G.setStroke(_)}else G.setStroke(void 0);const y=Sf(c,"layout","text-padding",T,f,I),w=G.getPadding();y!==w[0]&&(w[0]=y,w[1]=y,w[2]=y,w[3]=y),b.setZIndex(R)}}}return M>-1?(v.length=M+1,v):void 0};return t.setStyle(w),t.set("mapbox-layers",d),t.set("mapbox-source",y),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),w}class Ff{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Ud,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?uo(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=uo(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return fn()}readFeature(t,e){return fn()}readFeatures(t,e){return fn()}readGeometry(t,e){return fn()}readProjection(t){return fn()}writeFeature(t,e){return fn()}writeFeatures(t,e){return fn()}writeGeometry(t,e){return fn()}}function Af(t,e,i){const n=i?uo(i.featureProjection):null,r=i?uo(i.dataProjection):null;let s=t;if(n&&r&&!mo(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform(xo(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;iOf({...t,geometry:e}))).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const r=i.layout.length;return Af(new rg(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(Ea(t,0,e,i)||Ta(t=t.slice(),0,e,i),t):(Ca(t,0,e,i)||Ra(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,r):i.flatCoordinates,i.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function zf(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map((t=>zf(t,e)));return new Yd(i)}return Af(new(0,Lf[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}class Df extends Ff{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(jf(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(jf(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return fn()}readFeaturesFromObject(t,e){return fn()}readGeometry(t,e){return this.readGeometryFromObject(jf(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return fn()}readProjection(t){return this.readProjectionFromObject(jf(t))}readProjectionFromObject(t){return fn()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return fn()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return fn()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return fn()}}function jf(t){if("string"==typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}class Nf extends Df{constructor(t){t=t||{},super(),this.dataProjection=uo(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=uo(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const n=Gf(i.geometry);if(this.featureClass===rg)return Of({geometry:n,id:i.id,properties:i.properties},e);const r=new Ud;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(zf(n,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,r=n.length;t>3,r=this.pos;this.type=7&i,t(n,e,this),this.pos===r&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Wf;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Wf;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return Uf(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return Uf(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return Uf(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return Uf(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return Uf(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return Uf(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Vf?Vf.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e268435455||t<0?function(t,e){let i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(i=~(-t%4294967296),n=~(-t/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){const i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let n,r,s=0;s55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&Kf(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i=128&&Kf(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Bf,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Zf,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Jf,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Yf,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Hf,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Qf,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,tm,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,em,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,im,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function Uf(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Kf(t,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let e=i.pos-1;e>=t;e--)i.buf[e+n]=i.buf[e]}function Bf(t,e){for(let i=0;i>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>u&&(n.push(h),u=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>u&&(i.push(i[u],i[u+1]),h+=2)}}h>u&&(n.push(h),u=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon");return i}(n,l.length);if(this.featureClass===rg)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=Ia(a,l);t=e.length>1?new ig(a,"XY",e):new Ma(a,"XY",l)}else t="Point"===h?new da(a,"XY"):"LineString"===h?new Qd(a,"XY"):"MultiPoint"===h?new eg(a,"XY"):"MultiLineString"===h?new tg(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=Af(t,!1,i);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=uo((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new $f(t),s=r.readFields(rm,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function om(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos=o.width)return null;const h=Zr(s),u=Math.floor(o.height*((s[3]-n[1])/h));return u<0||u>=o.height?null:this.getImageData(o,l,u)}renderFrame(t,e){const i=this.image,n=i.getExtent(),r=i.getResolution(),[s,o]=Array.isArray(r)?r:[r,r],a=i.getPixelRatio(),l=t.layerStatesArray[t.layerIndex],h=t.pixelRatio,u=t.viewState,c=u.center,d=u.resolution,g=h*s/(d*a),p=h*o/(d*a);this.prepareContainer(t,e);const f=this.context.canvas.width,m=this.context.canvas.height,y=this.getRenderContext(t);let _=!1,x=!0;if(l.extent){const e=Eo(l.extent,u.projection);x=ts(e,t.extent),_=x&&!Ir(e,t.extent),_&&this.clipUnrotated(y,t,e)}const v=i.getImage(),w=Oo(this.tempTransform,f/2,m/2,g,p,0,a*(n[0]-c[0])/s,a*(c[1]-n[3])/o);this.renderedResolution=o*h/a;const b=v.width*w[0],S=v.height*w[3];if(this.getLayer().getSource().getInterpolate()||(y.imageSmoothingEnabled=!1),this.preRender(y,t),x&&b>=.5&&S>=.5){const t=w[4],e=w[5],i=l.opacity;1!==i&&(y.save(),y.globalAlpha=i),y.drawImage(v,0,0,+v.width,+v.height,t,e,b,S),1!==i&&y.restore()}return this.postRender(this.context,t),_&&y.restore(),y.imageSmoothingEnabled=!0,this.container}}class hm extends uh{constructor(t){super(t=t||{})}}class um extends hm{constructor(t){super(t)}createRenderer(){return new lm(this)}getData(t){return super.getData(t)}}function cm(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const dm=new Error("disposed"),gm=[256,256];class pm extends kp{constructor(t){const e=Un;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=cm(this.data_);return t?[t.width,t.height]:gm}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==Un&&this.state!==Zn)return;this.state=Kn,this.changed();const t=this;this.loader_().then((function(e){t.data_=e,t.state=Bn,t.changed()})).catch((function(e){t.error_=e,t.state=Zn,t.changed()}))}disposeInternal(){this.controller_&&(this.controller_.abort(dm),this.controller_=null),super.disposeInternal()}}let fm;const mm=[];function ym(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function _m(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function xm(t,e,i,n){const r=vo(i,e,t);let s=co(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||Tr(l,r)){const e=co(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}function vm(t,e,i,n,r,s,o,a,l,h,u,c,d,g){const p=Ya(Math.round(i*t),Math.round(i*e),mm);if(c||(p.imageSmoothingEnabled=!1),0===l.length)return p.canvas;function f(t){return Math.round(t*i)/i}p.scale(i,i),p.globalCompositeOperation="lighter";const m=[1/0,1/0,-1/0,-1/0];let y;l.forEach((function(t,e,i){Dr(m,t.extent)}));const _=i/n,x=(c?1:1+Math.pow(2,-24))/_;d&&1===l.length&&0===h||(y=Ya(Math.round(Qr(m)*_),Math.round(Zr(m)*_),mm),c||(y.imageSmoothingEnabled=!1),l.forEach((function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){y.save();const e=(t.clipExtent[0]-m[0])*_,i=-(t.clipExtent[3]-m[3])*_,n=Qr(t.clipExtent)*_,r=Zr(t.clipExtent)*_;y.rect(c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),y.clip()}const e=(t.extent[0]-m[0])*_,i=-(t.extent[3]-m[3])*_,n=Qr(t.extent)*_,r=Zr(t.extent)*_;y.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&y.restore()}})));const v=Hr(o);return a.getTriangles().forEach((function(t,e,i){const n=t.source,r=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],u=n[1][1],d=n[2][0],g=n[2][1];const _=f((r[0][0]-v[0])/s),w=f(-(r[0][1]-v[1])/s),b=f((r[1][0]-v[0])/s),S=f(-(r[1][1]-v[1])/s),C=f((r[2][0]-v[0])/s),E=f(-(r[2][1]-v[1])/s),R=o,T=a;o=0,a=0,h-=R,u-=T,d-=R,g-=T;const I=function(t){const e=t.length;for(let i=0;ir&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}([[h,u,0,0,b-_],[d,g,0,0,C-_],[0,0,h,u,S-w],[0,0,d,g,E-w]]);if(!I)return;if(p.save(),p.beginPath(),function(){if(void 0===fm){const t=Ya(6,6,mm);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",ym(t,4,5,4,0),ym(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;fm=_m(e,0)||_m(e,4)||_m(e,8),Qa(t),mm.push(t.canvas)}return fm}()||!c){p.moveTo(b,S);const t=4,e=_-b,i=w-S;for(let n=0;nAo(o,vo(t,this.targetProj_,this.sourceProj_)),function(t,e,i,n){const r=t.length;i=void 0!==i?i:2,n=n??i,e=void 0!==e?e:new Array(r);for(let s=0;s=o?t[s+i]:r[i]}return e}):xo(this.targetProj_,this.sourceProj_);var h;this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&Qr(n)>=Qr(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Qr(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Qr(this.targetProj_.getExtent()):null;const u=Hr(i),c=Jr(i),d=Vr(i),g=qr(i),p=this.transformInv_(u),f=this.transformInv_(c),m=this.transformInv_(d),y=this.transformInv_(g),_=10+(s?Math.max(0,Math.ceil(Math.log2(Wr(i)/(s*s*256*256)))):0);if(this.addQuad_(u,c,d,g,p,f,m,y,_),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n.5&&u<1;let g=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){g=Qr(Sr([t,e,i,n]))/this.targetWorldWidth_>.25||g}!d&&this.sourceProj_.isGlobal()&&u&&(g=u>.25||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!ts(h,this.maxSourceExtent_))return;let p=0;if(!(g||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)g=!0;else if(p=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=p&&2!=p&&4!=p&&8!=p)return;if(l>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let s;if(d){s=(hr(r[0],c)+hr(o[0],c))/2-hr(n[0],c)}else s=(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];g=s*s+a*a>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],u=this.transformInv_(h),c=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(c);this.addQuad_(t,e,h,c,r,s,u,d,l-1),this.addQuad_(c,h,i,n,d,u,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],u=this.transformInv_(h),c=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(c);this.addQuad_(t,h,c,n,r,u,d,a,l-1),this.addQuad_(h,e,i,c,u,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&p||this.addTriangle_(t,i,n,r,o,a),14&p||this.addTriangle_(t,i,e,r,o,s),p&&(13&p||this.addTriangle_(e,n,t,s,a,r),7&p||this.addTriangle_(e,n,i,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){const r=e.source;jr(t,r[0]),jr(t,r[1]),jr(t,r[2])})),t}getTriangles(){return this.triangles_}}class bm extends kp{constructor(t,e,i,n,r,s,o,a,l,h,u,c){super(r,Un,c),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let p=this.sourceTileGrid_.getExtent();const f=g?Yr(d,g):d;if(0===Wr(f))return void(this.state=Yn);const m=t.getExtent();m&&(p=p?Yr(p,m):m);const y=n.getResolution(this.wrappedTileCoord_[0]),_=function(t,e,i,n){const r=$r(i);let s=xm(t,e,r,n);return(!isFinite(s)||s<=0)&&Xr(i,(function(i){return s=xm(t,e,i,n),isFinite(s)&&s>0})),s}(t,i,f,y);if(!isFinite(_)||_<=0)return void(this.state=Yn);const x=void 0!==h?h:.5;if(this.triangulation_=new wm(t,i,f,p,_*x,y),0===this.triangulation_.getTriangles().length)return void(this.state=Yn);this.sourceZ_=e.getZForResolution(_);let v=this.triangulation_.calculateSourceExtent();if(p&&(t.canWrapX()?(v[1]=rr(v[1],p[1],p[3]),v[3]=rr(v[3],p[1],p[3])):v=Yr(v,p)),Wr(v)){let i=0,n=0;t.canWrapX()&&(i=Qr(m),n=Math.floor((v[0]-m[0])/i));rs(v.slice(),t,!0).forEach((t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=n*i;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:r})}++n})),0===this.sourceTiles_.length&&(this.state=Yn)}else this.state=Yn}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{const i=e.tile;if(i&&i.getState()==Bn){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}})),this.sourceTiles_.length=0,0===t.length)this.state=Zn;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=vm(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=Bn}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(this.state==Un){this.state=Kn,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((({tile:e})=>{const i=e.getState();if(i==Un||i==Kn){t++;const i=cn(e,ji,(n=>{const r=e.getState();r!=Bn&&r!=Zn&&r!=Yn||(gn(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}));this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t},e,i){t.getState()==Un&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(gn),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Qa(this.canvas_.getContext("2d")),mm.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class Sm{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof Bi&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return Hn(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return Hn(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){Hn(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}function Cm(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Em(t,e,i,n,r){return`${yn(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,n,r)}`}function Rm(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function Tm(t,e,i){const n=t[i];return!!n&&n.delete(e)}function Im(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=Yr(e,Eo(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=Yr(e,i))}return e}class Mm extends Rp{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new Fp(0,0,0,0),this.tempTileCoord_=Cm(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Sm(i),this.sourceTileCache_=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Sm(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=Em(s,s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{const l=n.viewState.projection,h=s.getProjection();if(a=s.getTile(t,e,i,n.pixelRatio,l,!h||mo(h,l)?void 0:this.getSourceTileCache()),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Ao(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Tr(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||r.getState()!==Bn)continue;const h=a.getOrigin(t),u=Yh(a.getTileSize(t)),c=a.getResolution(t);let d;if(r instanceof Pp||r instanceof bm)d=r.getImage();else{if(!(r instanceof pm))continue;if(d=cm(r.getData()),!d)continue}const g=Math.floor(l*((n[0]-h[0])/c-i[1]*u[0])),p=Math.floor(l*((h[1]-n[1])/c-i[2]*u[1])),f=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,g+f,p+f)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=yn(a);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],c=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),c?c.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),g=s.rotation,p=g?Br(s.center,s.resolution,g,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(g&&!l.tileCoordIntersectsViewport([r,e,o],p))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!Rm(n,i,r))continue;const a=i.getKey();if(u[a]=!0,i.getState()===Un&&!t.tileQueue.isKeyQueued(a)){const n=Cm(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t0&&setTimeout((()=>{this.enqueueTiles(t,C,c-1,b,S-1)}),0),!(c in b))return this.container;const E=yn(this),R=t.time;for(const e of b[c]){const i=e.getState();if(i===Yn)continue;const n=e.tileCoord;if(i===Bn){if(1===e.getAlpha(E,R)){e.endTransition(E);continue}}i!==Zn&&(this.renderComplete=!1);if(this.findStaleTile_(n,b)){Tm(b,e,c),t.animate=!0;continue}if(this.findAltTiles_(u,n,c+1,b))continue;const r=u.getMinZoom();for(let t=c-1;t>=r;--t){if(this.findAltTiles_(u,n,t,b))break}}const T=d/s*a/f,I=this.getRenderContext(t);Oo(this.tempTransform,m/2,y/2,T,T,0,-m/2,-y/2),i.extent&&this.clipUnrotated(I,t,_),h.getInterpolate()||(I.imageSmoothingEnabled=!1),this.preRender(I,t);const M=Object.keys(b).map(Number);let k;M.sort(Zi);const P=[],F=[];for(let e=M.length-1;e>=0;--e){const i=M[e],n=h.getTilePixelSize(i,a,r),s=u.getResolution(i)/d,o=n[0]*s*T,l=n[1]*s*T,c=u.getTileCoordForCoordAndZ(Hr(w),i),g=u.getTileCoordExtent(c),p=Ao(this.tempTransform,[f*(g[0]-w[0])/d,f*(w[3]-g[3])/d]),m=f*h.getGutterForProjection(r);for(const e of b[i]){if(e.getState()!==Bn)continue;const n=e.tileCoord,r=c[1]-n[1],s=Math.round(p[0]-(r-1)*o),a=c[2]-n[2],u=Math.round(p[1]-(a-1)*l),d=Math.round(p[0]-r*o),g=Math.round(p[1]-a*l),f=s-d,y=u-g,_=1===M.length;let x=!1;k=[d,g,d+f,g,d+f,g+y,d,g+y];for(let t=0,e=P.length;t{const i=yn(h),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,r,s,o,a){let l;if(t instanceof pm){if(l=cm(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const h=this.getRenderContext(e),u=yn(this),c=e.layerStatesArray[e.layerIndex],d=c.opacity*(a?t.getAlpha(u,e.time):1),g=d!==h.globalAlpha;g&&(h.save(),h.globalAlpha=d),h.drawImage(l,o,o,l.width-2*o,l.height-2*o,i,n,r,s),g&&h.restore(),d!==c.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const n=yn(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}}var km="preload",Pm="useInterimTilesOnError";class Fm extends uh{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(km)}setPreload(t){this.set(km,t)}getUseInterimTilesOnError(){return this.get(Pm)}setUseInterimTilesOnError(t){this.set(Pm,t)}getData(t){return super.getData(t)}}class Am extends Fm{constructor(t){super(t)}createRenderer(){return new Mm(this,{cacheSize:this.getCacheSize()})}}const Lm={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Om={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class zm extends Mm{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,i,n,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState,o=s.resolution,a=n.viewHints,l=this.getLayer().getSource(),h=l.getTileGridForProjection(s.projection),u=!(a[er]||a[ir]),c=h.getZForResolution(o,l.zDirection)===t;return u&&c?r.wantedResolution=o:r.wantedResolution||(r.wantedResolution=h.getResolution(t)),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedPixelRatio===e&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=!!n.getDeclutter(),u=l.getTileGrid(),c=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),g=yn(n);delete t.hitDetectionImageData[g],t.executorGroups[g]=[],a.dirty=!1;for(let r=0,p=d.length;rt.value)):null;let m;t:for(let e=0,n=d.length;e{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=Ao(this.renderedPixelToCoordinateTransform_,t.slice()),u=l.getTileCoordForCoordAndResolution(h,a).toString(),c=this.renderedTiles.find((t=>t.tileCoord.toString()===u&&t.getState()===Bn));if(!c||c.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!Ir(o,l.getTileCoordExtent(c.tileCoord))&&as(h,s);const d=yn(n),g=Hr(l.getTileCoordExtent(c.wrappedTileCoord)),p=[(h[0]-g[0])/a,(g[1]-h[1])/a],f=c.getSourceTiles().reduce(((t,e)=>t.concat(e.getFeatures())),[]);let m=c.hitDetectionImageData[d];if(!m){const t=Yh(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;m=wp(t,[this.getRenderTransform(l.getTileCoordCenter(c.wrappedTileCoord),a,0,vp,t[0]*vp,t[1]*vp,0)],f,n.getStyleFunction(),l.getTileCoordExtent(c.wrappedTileCoord),c.getReplayState(n).renderedResolution,e),c.hitDetectionImageData[d]=m}e(bp(p,f,m))}))}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach((i=>{if(i.tileCoord[0]!==r||i.getState()!==Bn)return;const o=i.getSourceTiles();for(let i=0,r=o.length;i=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,pp,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=yn(this.getLayer()),n=e.reduce(((t,e,n)=>(e.executorGroups[i].forEach((e=>t.push({executorGroup:e,index:n}))),t)),[]),r=n.map((({executorGroup:t})=>t.getDeferredZIndexContexts())),s={};for(let t=0,e=n.length;t{r.forEach(((e,i)=>{e[t]&&(e[t].forEach((t=>{const{executorGroup:e,index:r}=n[i],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()})),e[t].length=0)}))}))}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,d=u.getTileCoordExtent(t.wrappedTileCoord),g=u.getTileCoordExtent(c,this.tempExtent)[0]-d[0];return Po(Lo(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,g))}postRender(t,e){const i=e.viewHints,n=!(i[er]||i[ir]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?Om[s].filter((t=>!pp.includes(t))):Om[s],h=e.viewState,u=h.rotation,c=r.getSource(),d=c.getTileGridForProjection(h.projection).getZForResolution(h.resolution,c.zDirection),g=this.renderedTiles,p=[],f=[],m=[],y=yn(r);let _=!0;for(let i=g.length-1;i>=0;--i){const s=g[i];_=_&&!s.getReplayState(r).dirty;const o=s.executorGroups[y].filter((t=>t.hasExecutors(l)));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),c=s.tileCoord[0];let x=!1;const v=o[0].getClipCoords(h);let w,b=t;if(v){w=new ep,b=w.getContext();for(let t=0,e=p.length;t{const e=this.sourceImage_.getState();e!=Sc&&e!=Cc||(this.unlistenSource_(),this.reproject_())})),this.sourceImage_.load())}}unlistenSource_(){gn(this.sourceListenerKey_),this.sourceListenerKey_=null}}const Gm="imageloadstart",Xm="imageloadend",Wm="imageloaderror";class qm extends hn{constructor(t,e){super(t),this.image=e}}class Vm extends xg{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:void 0===t.interpolate||t.interpolate}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=void 0!==t.resolutions?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!t.loader&&0===t.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){t=e[Hi(e,t,0)]}return t}getImage(t,e,i,n){const r=this.getProjection();if(!r||!n||mo(r,n))return r&&(n=r),this.getImageInternal(t,e,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&mo(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&zr(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Nm(r,n,t,e,i,((t,e,i)=>this.getImageInternal(t,e,i,r)),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,n){if(this.loader){const r=function(t,e,i,n){const r=e/i,s=$r(t),o=gr(Qr(t)/r,4),a=gr(Zr(t)/r,4),l=gr((n-1)*o/2,4),h=o+2*l,u=gr((n-1)*a/2,4);return Kr(s,r,0,[h,a+2*u])}(t,e,i,1),s=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===n&&(this.wantedExtent_&&Ir(this.wantedExtent_,r)||Ir(this.image.getExtent(),r))&&(this.wantedResolution_&&jm(this.wantedResolution_)===s||jm(this.image.getResolution())===s)))return this.image;this.wantedProjection_=n,this.wantedExtent_=r,this.wantedResolution_=s,this.image=new Rc(r,s,i,this.loader),this.image.addEventListener(ji,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case bc:this.loading=!0,i=Gm;break;case Sc:this.loading=!1,i=Xm;break;case Cc:this.loading=!1,i=Wm;break;default:return}this.hasListener(i)&&this.dispatchEvent(new qm(i,e))}}const $m=[0,0,0];class Um{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,Hn(function(t,e){const i=e||Zi;return t.every((function(e,n){if(0===n)return!0;const r=i(t[n-1],e);return!(r>0||0===r)}))}(this.resolutions_,((t,e)=>e-t)),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t{const n=new Fp(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n})):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,n){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=Ap(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;ti||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class Jm extends hn{constructor(t,e){super(t),this.tile=e}}function Qm(t){return function(e){const i=e.buffers,n=e.meta,r=e.imageOps,s=e.width,o=e.height,a=i.length,l=i[0].byteLength;if(r){const e=new Array(a);for(let t=0;tthis.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||0===this.queue_.length)return;const t=this.queue_.shift();this.job_=t;const e=t.inputs[0].width,i=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),r=this.workers_.length;if(this.running_=r,1===r)return void this.workers_[0].postMessage({buffers:n,meta:t.meta,imageOps:this.imageOps_,width:e,height:i},n);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let s=0;sthis.getTileInternal(t,e,i,n,o,s)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,i,n,r,s){const o=this.getKey(),a=Em(this,o,t,e,i);if(s&&s.containsKey(a)){return s.get(a)}const l=this.createTile_(t,e,i,n,r,o);return s?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=uo(t);if(i){const t=yn(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}}function vy(t,e){if(kn){const i=t.getCrossOrigin();let n="same-origin",r="same-origin";return"anonymous"===i||""===i?(n="cors",r="omit"):"use-credentials"===i&&(n="cors",r="include"),void fetch(e,{mode:n,credentials:r}).then((t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()})).then((t=>createImageBitmap(t))).then((e=>{const i=t.getImage();i.width=e.width,i.height=e.height;i.getContext("2d").drawImage(e,0,0),e.close?.(),i.dispatchEvent(new Event("load"))})).catch((()=>{t.getImage().dispatchEvent(new Event("error"))}))}t.getImage().src=e}class wy extends xy{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:uo("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)!function(t,e,i){const n=document.createElement("script"),r="olc_"+yn(e);function s(){delete window[r],n.parentNode.removeChild(n)}n.async=!0,n.src=t+(t.includes("?")?"&":"?")+"callback="+r;const o=setTimeout((function(){s(),i&&i()}),1e4);window[r]=function(t){clearTimeout(o),s(),e(t)},document.head.appendChild(n)}(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch{return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=uo("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const r=yo(e,i);n=is(t.bounds,r)}const r=Ym(i),s=t.minzoom||0,o=Bm({extent:r,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=py(t.tiles,o),t.attribution&&!this.getAttributions()){const e=void 0!==n?n:r;this.setAttributions((function(i){return ts(e,i.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}}class by extends _y{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||Ym(e),n=t.tileGrid||Bm({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Sy,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:zp,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(t,e,i){if(i.getState()===Un){i.setState(Kn);const n=i.wrappedTileCoord,r=this.getTileGridForProjection(e);let s=r.getTileCoordExtent(n);const o=n[0],a=r.getResolution(o);Cr(s,-a,s);const l=this.projection;e&&this.projection&&!mo(e,l)&&(s=wo(s,e,l));const h=this.tileGrid,u=h.getExtent();u&&Yr(s,u,s);let c=a;e&&l&&!mo(e,l)&&(c=a/l.getMetersPerUnit()/e.getMetersPerUnit());const d=h.getZForResolution(c,this.zDirection);h.forEachTileCoord(s,d,(n=>{const r=this.tileUrlFunction(n,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(n,r?Un:Yn,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];i.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(i.getKey());const o=s.getState();if(o{this.handleTileChange(e);const n=s.getState();if(n===Bn||n===Zn){const e=s.getKey();e in i.errorTileKeys?s.getState()===Bn&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,n===Zn?i.errorTileKeys[e]=!0:s.removeEventListener(ji,t),0===i.loadingSourceTiles&&i.setState(ln(i.errorTileKeys)?Bn:Zn)}};s.addEventListener(ji,t),i.loadingSourceTiles++}o===Un&&(s.extent=h.getTileCoordExtent(n),s.projection=this.projection,s.resolution=h.getResolution(n[0]),s.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===Zn))?Zn:Bn)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,n=i.length;t{u=u&&!this.tileUrlFunction(t,n,l)}))}const c=new Op(s,u?Yn:Un,o,this.getSourceTiles.bind(this,n,r),this.removeSourceTiles.bind(this));return c.key=this.getKey(),c}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const n=this.projection;if(null!==n&&!mo(n,t))return Km(t);const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map((function(t,e){return r.getOrigin(e)})),a=s.map((function(t,e){return r.getTileSize(e)})),l=43;for(let t=s.length;td?c-A+d:d-A,F=Math.atan(Math.sqrt(k*k+P*P)),W=m*Math.cos(F)+f*Math.sin(F)*Math.cos(p-A),L=Math.cos(F),O=255*W,N=Math.min(Math.max(2*e.sunEl,0),1),G=1.875-1.75*e.opacity,X=.5!==e.opacity?d*((Math.pow(G,F)-1)/(Math.pow(G,d)-1)):F,D={r:(1-L)*x.r*N*255,g:(1-L)*x.g*N*255,b:(1-L)*x.b*N*255,a:(1-L)*x.a*N*255},z=Math.abs(((A+p)/Math.PI+.5)%2-1),j={r:(y.r*(1-z)+_.r*z)*O,g:(y.g*(1-z)+_.g*z)*O,b:(y.b*(1-z)+_.b*z)*O,a:(y.a*(1-z)+_.a*z)*O},T=4*(b*n+w),o[T]=D.r*(1-z)+j.r,o[T+1]=D.g*(1-z)+j.g,o[T+2]=D.b*(1-z)+j.b,o[T+3]=s[T+3]*e.opacity*N*Math.sin(X);return new ImageData(o,n,r)}function Ey(t,e){const i=t[0],n=i.width,r=i.height,s=i.data,o=new Uint8ClampedArray(s.length),a=n-1,l=r-1,h=[0,0,0,0];let u,c,d;const g=(p=e.saturation)>0?1-1/(1.001-p):-p;var p;const f=(m=e.contrast)>0?1/(1-m):1+m;var m;const y=function(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}(e.hueRotate),_=y,x=[y[2],y[0],y[1]],v=[y[1],y[2],y[0]],w=e.brightnessLow,b=e.brightnessHigh;for(c=0;c<=l;++c)for(u=0;u<=a;++u){d=4*(c*n+u),h[0]=s[d],h[1]=s[d+1],h[2]=s[d+2],h[3]=s[d+3];const t=h[0],e=h[1],i=h[2],r=(t,e)=>{let i=0;for(let n=0;n{e.accessToken=t,e.accessTokenParam=i}))}return e}function Iy(t,e,i="",n={},r=void 0){let s,o,a,l,h=!0;return"string"==typeof i||Array.isArray(i)?l=i:(a=i,l=a.source||a.layers,n=a),"string"==typeof n?(s=n,a={}):(s=n.styleUrl,a=n),!1===a.updateSource&&(h=!1),r||(r=a.resolutions),s||"string"!=typeof e||e.trim().startsWith("{")||(s=e),s&&(s=s.startsWith("data:")?location.href:Gp(s,a.accessToken),a=Ty(s,a)),new Promise((function(i,n){nf(e,a).then((function(e){if(8!=e.version)return n(new Error("glStyle version 8 required."));if(!(t instanceof Ip||t instanceof Dm))return n(new Error("Can only apply to VectorLayer or VectorTileLayer"));const u=t instanceof Dm?"vector":"geojson";if(l?o=Array.isArray(l)?e.layers.find((function(t){return t.id===l[0]})).source:l:(o=e.layers.find((function(t){return t.source&&e.sources[t.source].type===u})).source,l=o),!o)return n(new Error(`No ${u} source found in the glStyle.`));function c(){if(!h)return Promise.resolve();if(t instanceof Dm)return Fy(e.sources[o],s,a).then((function(e){const i=t.getSource();i?e!==i&&(i.setTileUrlFunction(e.getTileUrlFunction()),"function"==typeof i.setUrls&&"function"==typeof e.getUrls&&i.setUrls(e.getUrls()),i.format_||(i.format_=e.format_),i.getAttributions()||i.setAttributions(e.getAttributions()),i.getTileLoadFunction()===Sy&&i.setTileLoadFunction(e.getTileLoadFunction()),mo(i.getProjection(),e.getProjection())&&(i.tileGrid=e.getTileGrid())):t.setSource(e);const n=t.getSource().getTileGrid();!isFinite(t.getMaxResolution())&&!isFinite(t.getMinZoom())&&n.getMinZoom()>0&&t.setMaxResolution(Qp(Math.max(0,n.getMinZoom()-1e-12),n.getResolutions()))}));const i=e.sources[o];let n=t.getSource();n&&n.get("mapbox-source")===i||(n=Oy(i,s,a));const r=t.getSource();return r?n!==r&&(r.getAttributions()||r.setAttributions(n.getAttributions()),r.format_||(r.format_=n.getFormat()),r.url_=n.getUrl()):t.setSource(n),Promise.resolve()}let d,g;const p={},f={};function m(){if(g||e.sprite&&!p)g?(t.setStyle(g),c().then(i).catch(n)):n(new Error("Something went wrong trying to apply style."));else{if(a.projection&&!r){const t=uo(a.projection).getUnits();"m"!==t&&(r=Yp.map((e=>e/ps[t])))}let s;const h=t.getSource();h instanceof by&&h.format_ instanceof nm&&(s=h.format_.layerName_),g=Pf(t,e,l,r,p,f,((t,e=a.webfonts)=>function(t,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(kn)return t;let i;for(let e=0,n=t.length;e{await document.fonts.ready;for(let t=0,n=i.length;tt.family.replace(/^['"]|['"]$/g,"").toLowerCase()===r.toLowerCase()&&t.weight==s&&t.style===o))){const t=e.replace("{font-family}",r.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",r.replace(/ /g,"+")).replace("{fontweight}",s).replace("{-fontstyle}",o.replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",o);if(!document.querySelector('link[href="'+t+'"]')){const e=document.createElement("link");e.href=t,e.rel="stylesheet",document.head.appendChild(e)}}}})(),t):t}(t,e)),a.getImage,s),t.getStyle()?c().then(i).catch(n):n(new Error(`Nothing to show for source [${o}]`))}}if(e.sprite){const t=function(t,e,i){if("string"==typeof t)return[{id:"default",url:Np(t,e,i)}];for(const n of t)n.url=Np(n.url,e,i);return t}(e.sprite,a.accessToken,s||location.href);d=kn?1:window.devicePixelRatio>=1.5?.5:1;const i=.5==d?"@2x":"";Promise.all(t.map((function(t){const e=new URL(t.url);let r=e.origin+e.pathname+i+".json"+e.search;return new Promise((function(t,i){ef("Sprite",r,a).then(t).catch((function(n){r=e.origin+e.pathname+".json"+e.search,ef("Sprite",r,a).then(t).catch(i)}))})).then((function(r){let s;if(void 0===r&&n(new Error("No sprites found.")),s=e.origin+e.pathname+i+".png"+e.search,a.transformRequest){const t=a.transformRequest(s,"SpriteImage")||s;(t instanceof Request||t instanceof Promise)&&(s=t)}f[t.id]=s;for(const e in r){const i="default"==t.id?e:`${t.id}:${e}`;p[i]=r[e]}})).catch((function(t){n(new Error(`Sprites cannot be loaded: ${r}: ${t.message}`))}))}))).then(m).catch(n)}else m()})).catch(n)}))}function My(t,e){let i;return t.some((function(t){if(t.id==e)return i=t.source,!0})),i}function ky(t,e,i){const n=new wy({tileJSON:e,tileSize:t.tileSize||e.tileSize||512}),r=n.getTileJSON(),s=n.getTileGrid(),o=uo(i.projection||"EPSG:3857"),a=function(t,e){const i=t.bounds;if(i){const t=fo([i[0],i[1]],e),n=fo([i[2],i[3]],e);return[t[0],t[1],n[0],n[1]]}return uo(e).getExtent()}(r,o),l=o.getExtent(),h=r.minzoom||0,u=r.maxzoom||22,c={attributions:n.getAttributions(),projection:o,tileGrid:new Um({origin:l?Hr(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:h,resolutions:Ry(o,e.tileSize).slice(0,u+1),tileSize:s.getTileSize(0)})};return Array.isArray(r.tiles)?c.urls=r.tiles:c.url=r.tiles,c}function Py(t,e,i){const n=kn?{style:{}}:document.createElement("div");return n.className="ol-mapbox-style-background",n.style.position="absolute",n.style.width="100%",n.style.height="100%",new uh({source:new xg({}),render(r){const s=function(t,e,i,n){const r={id:t.id,type:t.type},s=t.layout||{},o=t.paint||{};let a;r.paint=o,vf.zoom=Jp(e,i.resolutions||Yp),vf.distanceFromCenter=0;const l=Sf(r,"paint","background-color",qp,n);return void 0!==o["background-opacity"]&&(a=Sf(r,"paint","background-opacity",qp,n)),"none"==s.visibility?void 0:Rf(l,a)}(t,r.viewState.resolution,e,i);return n.style.backgroundColor=s,n}})}function Fy(t,e,i){return new Promise((function(n,r){sf(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=ky(t,e,i);s.tileLoadFunction=r,s.format=new nm({layerName:"mvt:layer"});const o=new by(s);o.set("mapbox-source",t),n(o)})).catch(r)}))}function Ay(t){return`{bbox-${(t?t.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function Ly(t,e,i){const n=new Am;return function(t,e,i){return new Promise((function(n,r){sf(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=new wy({interpolate:void 0===i.interpolate||i.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:e});s.tileGrid=ky(t,e,i).tileGrid,i.projection&&(s.projection=uo(i.projection));const o=s.getTileUrlFunction();r&&s.setTileLoadFunction(r),s.setTileUrlFunction((function(t,e,i){const n=Ay(i);let r=o(t,e,i);if(-1!=r.indexOf(n)){const e=s.getTileGrid().getTileCoordExtent(t);r=r.replace(n,e.toString())}return r})),s.set("mapbox-source",t),n(s)})).catch((function(t){r(t)}))}))}(t,e,i).then((function(t){n.setSource(t)})).catch((function(){n.setSource(void 0)})),n}function Oy(t,e,i){const n=i.projection?new Nf({dataProjection:i.projection}):new Nf,r=t.data,s={};if("string"==typeof r){const[s]=Wp(r,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){const e=(t,e,i)=>{const n=Ay(i);return s.replace(n,`${t.join(",")}`)},r=new Mg({attributions:t.attribution,format:n,loader:(t,n,s,o,a)=>{ef("GeoJSON","function"==typeof e?e(t,n,s):e,i).then((t=>{const e=r.getFormat().readFeatures(t,{featureProjection:s});r.addFeatures(e),o(e)})).catch((e=>{r.removeLoadedExtent(t),a()}))},strategy:yg});return r.set("mapbox-source",t),r}const o=new Mg({attributions:t.attribution,format:n,url:s,loader:(t,e,n,r,a)=>{ef("GeoJSON",s,i).then((t=>{const e=o.getFormat().readFeatures(t,{featureProjection:n});o.addFeatures(e),r(e)})).catch((e=>{o.removeLoadedExtent(t),a()}))}});return o}s.features=n.readFeatures(r,{featureProjection:"EPSG:3857"});const o=new Mg(Object.assign({attributions:t.attribution,format:n},s));return o.set("mapbox-source",t),o}function zy(t,e,i){let n=null;return function(r){t.paint&&"raster-opacity"in t.paint&&r.frameState.viewState.zoom!==n&&(n=r.frameState.viewState.zoom,delete i[t.id],function(t,e,i,n){vf.zoom=i,vf.distanceFromCenter=0;const r=Sf(t,"paint","raster-opacity",qp,n);e.setOpacity(r)}(t,e,n,i))}}function Dy(t,e,i,n){const r=Bp(t),s=t.layers,o=i.type,a=i.source||My(s,i.ref),l=t.sources[a];let h;if("background"==o)h=Py(i,n,r);else if("vector"==l.type)h=function(t,e,i){const n=new Dm({declutter:!0,visible:!1});return Fy(t,e,i).then((function(t){n.setSource(t)})).catch((function(t){n.setSource(void 0)})),n}(l,e,n);else if("raster"==l.type){const t=["raster-saturation","raster-contrast","raster-brightness-max","raster-brightness-min","raster-hue-rotate"];!!Object.keys(i.paint||{}).find((e=>t.includes(e)))?(h=function(t,e,i){const n=Ly(t,e,i);return new um({source:new sy({operationType:"image",operation:Ey,sources:[n]})})}(l,e,n),h.getSource().on("beforeoperations",(function(t){vf.zoom=Jp(t.resolution,n.resolutions||Yp),vf.distanceFromCenter=0;const e=t.data;e.saturation=Sf(i,"paint","raster-saturation",qp,r),e.contrast=Sf(i,"paint","raster-contrast",qp,r),e.brightnessHigh=Sf(i,"paint","raster-brightness-max",qp,r),e.brightnessLow=Sf(i,"paint","raster-brightness-min",qp,r),e.hueRotate=Sf(i,"paint","raster-hue-rotate",qp,r)}))):h=Ly(l,e,n),h.setVisible(!i.layout||"none"!==i.layout.visibility),h.on("prerender",zy(i,h,r))}else if("geojson"==l.type)h=function(t,e,i){return new Ip({declutter:!0,source:Oy(t,e,i),visible:!1})}(l,e,n);else if("raster-dem"==l.type&&"hillshade"==i.type){const t=function(t,e,i){const n=Ly(t,e,i);return new um({source:new sy({operationType:"image",operation:Cy,sources:[n]})})}(l,e,n);h=t,t.getSource().on("beforeoperations",(function(t){const e=t.data;e.resolution=co(n.projection||"EPSG:3857",t.resolution,$r(t.extent),"m"),vf.zoom=Jp(t.resolution,n.resolutions||Yp),vf.distanceFromCenter=0,e.encoding=l.encoding,e.vert=5*Sf(i,"paint","hillshade-exaggeration",qp,r),e.sunAz=Sf(i,"paint","hillshade-illumination-direction",qp,r),e.sunEl=35,e.opacity=.3,e.highlightColor=Sf(i,"paint","hillshade-highlight-color",qp,r),e.shadowColor=Sf(i,"paint","hillshade-shadow-color",qp,r),e.accentColor=Sf(i,"paint","hillshade-accent-color",qp,r)})),h.setVisible(!i.layout||"none"!==i.layout.visibility)}const u=a;return h&&h.set("mapbox-source",u),h}function jy(t,e,i,r,s,o={}){let a=24,l=0;const h=i.layers;for(let t=0,i=h.length;t0||i>0)&&t.setMaxResolution(Math.min(Qp(Math.max(0,a-1e-12),Yp),Qp(Math.max(0,i-1e-12),e.getResolutions()))),l<24&&t.setMinResolution(Qp(l,Yp))}}else a>0&&t.setMaxResolution(Qp(Math.max(0,a-1e-12),Yp));c instanceof Mg||c instanceof by?Iy(t,i,e,Object.assign({styleUrl:r},o)).then((function(){!function(t,e){function i(){const i=e.get("mapbox-style");if(!i)return;const r=n(i.layers),s=t.get("mapbox-layers"),o=r.filter((function(t){return s.includes(t.id)})).some((function(t){return!t.layout||!t.layout.visibility||"visible"===t.layout.visibility}));t.get("visible")!==o&&t.setVisible(o)}t.on("change",i),i()}(t,s),h()})).catch(u):h()}else u(new Error("Error accessing data for source "+t.get("mapbox-source")))};t.set("mapbox-layers",e);const d=s.getLayers();-1===d.getArray().indexOf(t)&&d.push(t),t.getSource()?c():t.once("change:source",c)}))}const Ny=["fullscreenchange","webkitfullscreenchange"],Gy="enterfullscreen",Xy="leavefullscreen";function Wy(t){const e=t.body;return!!(e.webkitRequestFullscreen||e.requestFullscreen&&t.fullscreenEnabled)}function qy(t){return!(!t.webkitIsFullScreen&&!t.fullscreenElement)}function Vy(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen()}const $y=[{center:[0,405e4],zoom:2},{center:[-10026264.955714773,3498225.377934253],zoom:12.3},{center:[-8120333.846364162,-5972314.327727663],zoom:10.15},{center:[12700564.586161729,2575397.3413926377],zoom:13.8},{center:[8976666.32253083,814262.3154676007],zoom:15.7},{center:[1284003.7367688504,5950927.737276901],zoom:11.19},{center:[-8468554.506387988,5696886.564463913],zoom:10.11},{center:[707717.3609533564,6361291.958635207],zoom:10.02},{center:[3345381.3050933336,-216864.19183635892],zoom:13.9},{center:[3318257.9642649507,-1786301.1175574847],zoom:6.1},{center:[19365301.097574536,-5033096.120372388],zoom:10.77},{center:[-13542913.807564376,5913315.884147839],zoom:11.59},{center:[9680854.2477813,3231923.470902604],zoom:8.06},{center:[-10341383.185823392,1826844.1155603195],zoom:9.27},{center:[3232422.751942559,5017252.706810253],zoom:12.25},{center:[-16373943.169136822,8651360.275919426],zoom:8.49},{center:[12475943.19806142,4172022.2635435928],zoom:9.91}],Uy=document.getElementById("map"),Ky=new $d({target:Uy,view:new Da($y[Math.random()*$y.length|0])});Ky.addControl(new class extends nl{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.on,this.once,this.un,this.keys_=void 0!==t.keys&&t.keys,this.source_=t.source,this.isInFullscreen_=!1,this.boundHandleMapTargetChange_=this.handleMapTargetChange_.bind(this),this.cssClassName_=void 0!==t.className?t.className:"ol-full-screen",this.documentListeners_=[],this.activeClassName_=void 0!==t.activeClassName?t.activeClassName.split(" "):[this.cssClassName_+"-true"],this.inactiveClassName_=void 0!==t.inactiveClassName?t.inactiveClassName.split(" "):[this.cssClassName_+"-false"];const e=void 0!==t.label?t.label:"⤢";this.labelNode_="string"==typeof e?document.createTextNode(e):e;const i=void 0!==t.labelActive?t.labelActive:"×";this.labelActiveNode_="string"==typeof i?document.createTextNode(i):i;const n=t.tipLabel?t.tipLabel:"Toggle full-screen";this.button_=document.createElement("button"),this.button_.title=n,this.button_.setAttribute("type","button"),this.button_.appendChild(this.labelNode_),this.button_.addEventListener(Xi,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_),this.element.className=`${this.cssClassName_} ${Wa} ${Va}`,this.element.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(Wy(e))if(qy(e))!function(t){t.exitFullscreen?t.exitFullscreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()}(e);else{let i;i=this.source_?"string"==typeof this.source_?e.getElementById(this.source_):this.source_:t.getTargetElement(),this.keys_?function(t){t.webkitRequestFullscreen?t.webkitRequestFullscreen():Vy(t)}(i):Vy(i)}}handleFullScreenChange_(){const t=this.getMap();if(!t)return;const e=this.isInFullscreen_;this.isInFullscreen_=qy(t.getOwnerDocument()),e!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(tl(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(Gy)):(tl(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(Xy)),t.updateSize())}setClassName_(t,e){e?(t.classList.remove(...this.inactiveClassName_),t.classList.add(...this.activeClassName_)):(t.classList.remove(...this.activeClassName_),t.classList.add(...this.inactiveClassName_))}setMap(t){const e=this.getMap();e&&e.removeChangeListener(Vn,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(Vn,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let e=0,i=t.length;e