@defra/interactive-map 0.0.25-alpha → 0.0.26-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import e from"ol/Map.js";import t from"ol/View.js";import{getCenter as r}from"ol/extent.js";import"ol/format/GeoJSON.js";import n from"ol/format/MVT.js";import"ol/has.js";import"ol/layer/Group.js";import"ol/layer/Layer.js";import o from"ol/layer/Tile.js";import"ol/layer/Vector.js";import a from"ol/layer/VectorTile.js";import"ol/loadingstrategy.js";import{transformExtent as i}from"ol/proj.js";import"ol/proj/Units.js";import"ol/source/Source.js";import"ol/source/TileJSON.js";import"ol/source/Vector.js";import s from"ol/source/VectorTile.js";import"ol/tilegrid.js";import l from"ol/tilegrid/TileGrid.js";import{distance as u}from"ol/coordinate.js";import{toPromise as p}from"ol/functions.js";import c from"ol/render/Feature.js";import f from"ol/style/Circle.js";import d from"ol/style/Fill.js";import m from"ol/style/Icon.js";import y from"ol/style/Stroke.js";import h from"ol/style/Style.js";import g from"ol/style/Text.js";import"ol/events/Event.js";import"ol/events/EventType.js";import v from"@babel/runtime/helpers/asyncToGenerator";import{defaults as b}from"ol/interaction/defaults.js";import x from"proj4";import{register as w}from"ol/proj/proj4.js";import k from"ol/source/XYZ.js";import z from"ol/source/OGCVectorTile.js";import M from"ol/TileState.js";import{fromString as S}from"ol/color.js";import"ol/layer/Image.js";import"ol/source/Raster.js";import{checkedFonts as A}from"ol/render/canvas.js";import{getUid as _}from"ol/util.js";var j=[896,448,224,112,56,28,14,7,3.5,1.75,.875,.4375,.21875,.109375],E=[156543.03392800014,78271.51696400007,39135.758482000034,19567.879241000017,9783.939620500008,4891.969810250004,2445.984905125002,1222.992452562501,611.4962262812505,305.74811314062526,152.87405657031263,76.43702828515632,38.21851414257816,19.10925707128908,9.55462853564454,4.77731426782227,2.388657133911135,1.1943285669555674,.5971642834777837,.29858214173889186,.14929107086944593,.07464553543472296,.03732276771736148,.01866138385868074],C=[-238375,1376256],$=300,q=2,I=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"],T="uk",N="world";var P=(e,t)=>{var r=null,n=function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];clearTimeout(r),r=setTimeout(()=>{e(...o)},t)};return n.cancel=()=>{r&&(clearTimeout(r),r=null)},n};function O(e){var{map:t,view:r,emit:n,eventBus:o,events:a,on:i,debouncers:s}=e,l=!1,u=P(()=>{l=!1,n(a.MAP_MOVE_END)},500);s.push(u);var p,c,f,d=(p=()=>n(a.MAP_MOVE),c=10,f=0,function(){var e=Date.now();e-f>=c&&(f=e,p(...arguments))});i(r,"change",()=>{l||(l=!0,o.emit(a.MAP_MOVE_START)),u()}),i(t,"postrender",()=>{l&&d()})}function F(e){var{map:t,source:r,events:n,eventBus:o,getZoom:a,getCenter:i,getBounds:s,getResolution:l}=e,u=!1,p=[],c=[],f=t.getView(),d=f.getMinZoom(),m=f.getMaxZoom(),y=e=>{var t=(()=>{if(u)return null;var e=a();return{center:i(),bounds:s(),resolution:l(),zoom:e,isAtMaxZoom:e+.01>=m,isAtMinZoom:e-.01<=d}})();t&&o.emit(e,t)},h=(e,t,r)=>{e.on(t,r),p.push([e,t,r])};!function(e){var{source:t,map:r,emit:n,eventBus:o,events:a,on:i}=e,s=!1;i(t,"tileloadend",()=>{s||(s=!0,o.emit(a.MAP_LOADED))}),r.once("rendercomplete",()=>n(a.MAP_FIRST_IDLE))}({source:r,map:t,emit:y,eventBus:o,events:n,on:h}),O({map:t,view:t.getView(),emit:y,eventBus:o,events:n,on:h,debouncers:c}),function(e){var{map:t,eventBus:r,events:n,on:o}=e,a=null;o(t,"pointerdown",e=>{a=e.pixel}),o(t,"click",e=>{if(a){var t=e.pixel[0]-a[0],o=e.pixel[1]-a[1];if(Math.hypot(t,o)>6)return}r.emit(n.MAP_CLICK,{point:{x:e.pixel[0],y:e.pixel[1]},coords:e.coordinate})})}({map:t,eventBus:o,events:n,on:h}),h(t,"postrender",()=>o.emit(n.MAP_RENDER));var g=P(()=>y(n.MAP_DATA_CHANGE),500);return c.push(g),h(r,"tileloadend",g),{remove(){u=!0,c.forEach(e=>e.cancel()),p.forEach(e=>{var[t,r,n]=e;return t.un(r,n)})}}}var D={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},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"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{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:"filter"},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:{},"color-relief":{},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_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},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:"expression_name",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_color-relief","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","feature"]},"property-type":"cross-faded-data-driven"},"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const L=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function R(e,t){const r={};for(const t in e)"ref"!==t&&(r[t]=e[t]);return L.forEach(e=>{e in t&&(r[e]=t[e])}),r}class G extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Z{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,r]of t)this.bindings[e]=r}concat(e){return new Z(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const U={kind:"null"},V={kind:"number"},B={kind:"string"},J={kind:"boolean"},H={kind:"color"},W={kind:"projectionDefinition"},X={kind:"object"},Y={kind:"value"},K={kind:"collator"},Q={kind:"formatted"},ee={kind:"padding"},te={kind:"colorArray"},re={kind:"numberArray"},ne={kind:"resolvedImage"},oe={kind:"variableAnchorOffsetCollection"};function ae(e,t){return{kind:"array",itemType:e,N:t}}function ie(e){if("array"===e.kind){const t=ie(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const se=[U,V,B,J,H,W,Q,X,ae(Y),ee,re,te,ne,oe];function le(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!le(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of se)if(!le(e,t))return null}return`Expected ${ie(e)} but found ${ie(t)} instead.`}function ue(e,t){return t.some(t=>t.kind===e.kind)}function pe(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function ce(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const fe=.96422,de=.82521,me=4/29,ye=6/29,he=3*ye*ye,ge=ye*ye*ye,ve=Math.PI/180,be=180/Math.PI;function xe(e){return(e%=360)<0&&(e+=360),e}function we([e,t,r,n]){let o,a;const i=ze((.2225045*(e=ke(e))+.7168786*(t=ke(t))+.0606169*(r=ke(r)))/1);e===t&&t===r?o=a=i:(o=ze((.4360747*e+.3850649*t+.1430804*r)/fe),a=ze((.0139322*e+.0971045*t+.7141733*r)/de));const s=116*i-16;return[s<0?0:s,500*(o-i),200*(i-a),n]}function ke(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ze(e){return e>ge?Math.pow(e,1/3):e/he+me}function Me([e,t,r,n]){let o=(e+16)/116,a=isNaN(t)?o:o+t/500,i=isNaN(r)?o:o-r/200;return o=1*Ae(o),a=fe*Ae(a),i=de*Ae(i),[Se(3.1338561*a-1.6168667*o-.4906146*i),Se(-.9787684*a+1.9161415*o+.033454*i),Se(.0719453*a-.2289914*o+1.4052427*i),n]}function Se(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function Ae(e){return e>ye?e*e*e:he*(e-me)}const _e=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function je(e,t){return _e(e,t)?e[t]:void 0}function Ee(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=je(Te,e);if(t){const[e,r,n]=t;return[e/255,r/255,n/255,1]}if(e.startsWith("#")){if(/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let r=1;return[Ce(e.slice(r,r+=t)),Ce(e.slice(r,r+=t)),Ce(e.slice(r,r+=t)),Ce(e.slice(r,r+t)||"ff")]}}if(e.startsWith("rgb")){const t=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,r=e.match(t);if(r){const[e,t,n,o,a,i,s,l,u,p,c,f]=r,d=[o||" ",s||" ",p].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){const e=[n,i,u].join(""),r="%%%"===e?100:""===e?255:0;if(r){const e=[qe(+t/r,0,1),qe(+a/r,0,1),qe(+l/r,0,1),c?$e(+c,f):1];if(Ie(e))return e}}return}}const r=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){const[e,t,n,o,a,i,s,l,u]=r,p=[n||" ",a||" ",s].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const e=[+t,qe(+o,0,100),qe(+i,0,100),l?$e(+l,u):1];if(Ie(e))return function([e,t,r,n]){function o(n){const o=(n+e/30)%12,a=t*Math.min(r,1-r);return r-a*Math.max(-1,Math.min(o-3,9-o,1))}return e=xe(e),t/=100,r/=100,[o(0),o(8),o(4),n]}(e)}}}function Ce(e){return parseInt(e.padEnd(2,e),16)/255}function $e(e,t){return qe(t?e/100:e,0,1)}function qe(e,t,r){return Math.min(Math.max(t,e),r)}function Ie(e){return!e.some(Number.isNaN)}const Te={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 Ne(e,t,r){return e+r*(t-e)}function Pe(e,t,r){return e.map((e,n)=>Ne(e,t[n],r))}class Oe{constructor(e,t,r,n=1,o=!0){this.r=e,this.g=t,this.b=r,this.a=n,o||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,t,r,n]))}static parse(e){if(e instanceof Oe)return e;if("string"!=typeof e)return;const t=Ee(e);return t?new Oe(...t,!1):void 0}get rgb(){const{r:e,g:t,b:r,a:n}=this,o=n||1/0;return this.overwriteGetter("rgb",[e/o,t/o,r/o,n])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,r,n,o]=we(e),a=Math.sqrt(r*r+n*n);return[Math.round(1e4*a)?xe(Math.atan2(n,r)*be):NaN,a,t,o]}(this.rgb))}get lab(){return this.overwriteGetter("lab",we(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,r,n]=this.rgb;return`rgba(${[e,t,r].map(e=>Math.round(255*e)).join(",")},${n})`}static interpolate(e,t,r,n="rgb"){switch(n){case"rgb":{const[n,o,a,i]=Pe(e.rgb,t.rgb,r);return new Oe(n,o,a,i,!1)}case"hcl":{const[n,o,a,i]=e.hcl,[s,l,u,p]=t.hcl;let c,f;if(isNaN(n)||isNaN(s))isNaN(n)?isNaN(s)?c=NaN:(c=s,1!==a&&0!==a||(f=l)):(c=n,1!==u&&0!==u||(f=o));else{let e=s-n;s>n&&e>180?e-=360:s<n&&n-s>180&&(e+=360),c=n+r*e}const[d,m,y,h]=function([e,t,r,n]){return e=isNaN(e)?0:e*ve,Me([r,Math.cos(e)*t,Math.sin(e)*t,n])}([c,null!=f?f:Ne(o,l,r),Ne(a,u,r),Ne(i,p,r)]);return new Oe(d,m,y,h,!1)}case"lab":{const[n,o,a,i]=Me(Pe(e.lab,t.lab,r));return new Oe(n,o,a,i,!1)}}}}Oe.black=new Oe(0,0,0,1),Oe.white=new Oe(1,1,1,1),Oe.transparent=new Oe(0,0,0,0),Oe.red=new Oe(1,0,0,1);class Fe{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const De=["bottom","center","top"];class Le{constructor(e,t,r,n,o,a){this.text=e,this.image=t,this.scale=r,this.fontStack=n,this.textColor=o,this.verticalAlign=a}}class Re{constructor(e){this.sections=e}static fromString(e){return new Re([new Le(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(e){return e instanceof Re?e:Re.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}}class Ge{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ge)return e;if("number"==typeof e)return new Ge([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Ge(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new Ge(Pe(e.values,t.values,r))}}class Ze{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ze)return e;if("number"==typeof e)return new Ze([e]);if(Array.isArray(e)){for(const t of e)if("number"!=typeof t)return;return new Ze(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new Ze(Pe(e.values,t.values,r))}}class Ue{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ue)return e;if("string"==typeof e){const t=Oe.parse(e);if(!t)return;return new Ue([t])}if(!Array.isArray(e))return;const t=[];for(const r of e){if("string"!=typeof r)return;const e=Oe.parse(r);if(!e)return;t.push(e)}return new Ue(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r,n="rgb"){const o=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let a=0;a<e.values.length;a++)o.push(Oe.interpolate(e.values[a],t.values[a],r,n));return new Ue(o)}}class Ve extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Be=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Je{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Je)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){const r=e[t],n=e[t+1];if("string"!=typeof r||!Be.has(r))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new Je(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){const n=e.values,o=t.values;if(n.length!==o.length)throw new Ve(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const a=[];for(let e=0;e<n.length;e+=2){if(n[e]!==o[e])throw new Ve(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${n[e]}, to[${e}]: ${o[e]}`);a.push(n[e]);const[t,i]=n[e+1],[s,l]=o[e+1];a.push([Ne(t,s,r),Ne(i,l,r)])}return new Je(a)}}class He{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new He({name:e,available:!1}):null}}class We{constructor(e,t,r){this.from=e,this.to=t,this.transition=r}static interpolate(e,t,r){return new We(e,t,r)}static parse(e){return e instanceof We?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new We(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new We(e.from,e.to,e.transition):"string"==typeof e?new We(e,e,1):void 0}}function Xe(e,t,r,n){if(!("number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255)){return`Invalid rgba value [${("number"==typeof n?[e,t,r,n]:[e,t,r]).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 [${[e,t,r,n].join(", ")}]: 'a' must be between 0 and 1.`}function Ye(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof We||e instanceof Oe||e instanceof Fe||e instanceof Re||e instanceof Ge||e instanceof Ze||e instanceof Ue||e instanceof Je||e instanceof He)return!0;if(Array.isArray(e)){for(const t of e)if(!Ye(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Ye(e[t]))return!1;return!0}return!1}function Ke(e){if(null===e)return U;if("string"==typeof e)return B;if("boolean"==typeof e)return J;if("number"==typeof e)return V;if(e instanceof Oe)return H;if(e instanceof We)return W;if(e instanceof Fe)return K;if(e instanceof Re)return Q;if(e instanceof Ge)return ee;if(e instanceof Ze)return re;if(e instanceof Ue)return te;if(e instanceof Je)return oe;if(e instanceof He)return ne;if(Array.isArray(e)){const t=e.length;let r;for(const t of e){const e=Ke(t);if(r){if(r===e)continue;r=Y;break}r=e}return ae(r||Y,t)}return X}function Qe(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Oe||e instanceof We||e instanceof Re||e instanceof Ge||e instanceof Ze||e instanceof Ue||e instanceof Je||e instanceof He?e.toString():JSON.stringify(e)}class et{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ye(e[1]))return t.error("invalid value");const r=e[1];let n=Ke(r);const o=t.expectedType;return"array"!==n.kind||0!==n.N||!o||"array"!==o.kind||"number"==typeof o.N&&0!==o.N||(n=o),new et(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const tt={string:B,number:V,boolean:J,object:X};class rt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r,n=1;const o=e[0];if("array"===o){let o,a;if(e.length>2){const r=e[1];if("string"!=typeof r||!(r in tt)||"object"===r)return t.error('The item type argument of "array" must be one of string, number, boolean',1);o=tt[r],n++}else o=Y;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);a=e[2],n++}r=ae(o,a)}else{if(!tt[o])throw new Error(`Types doesn't contain name = ${o}`);r=tt[o]}const a=[];for(;n<e.length;n++){const r=t.parse(e[n],n,Y);if(!r)return null;a.push(r)}return new rt(r,a)}evaluate(e){for(let t=0;t<this.args.length;t++){const r=this.args[t].evaluate(e);if(!le(this.type,Ke(r)))return r;if(t===this.args.length-1)throw new Ve(`Expected value to be of type ${ie(this.type)}, but found ${ie(Ke(r))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const nt={"to-boolean":J,"to-color":H,"to-number":V,"to-string":B};class ot{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[0];if(!nt[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return t.error("Expected one argument.");const n=nt[r],o=[];for(let r=1;r<e.length;r++){const n=t.parse(e[r],r,Y);if(!n)return null;o.push(n)}return new ot(n,o)}evaluate(e){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(e));case"color":{let t,r;for(const n of this.args){if(t=n.evaluate(e),r=null,t instanceof Oe)return t;if("string"==typeof t){const r=e.parseColor(t);if(r)return r}else if(Array.isArray(t)&&(r=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Xe(t[0],t[1],t[2],t[3]),!r))return new Oe(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Ve(r||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const r of this.args){t=r.evaluate(e);const n=Ge.parse(t);if(n)return n}throw new Ve(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const r of this.args){t=r.evaluate(e);const n=Ze.parse(t);if(n)return n}throw new Ve(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const r of this.args){t=r.evaluate(e);const n=Ue.parse(t);if(n)return n}throw new Ve(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const r of this.args){t=r.evaluate(e);const n=Je.parse(t);if(n)return n}throw new Ve(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const r of this.args){if(t=r.evaluate(e),null===t)return 0;const n=Number(t);if(!isNaN(n))return n}throw new Ve(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Re.fromString(Qe(this.args[0].evaluate(e)));case"resolvedImage":return He.fromString(Qe(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Qe(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const at=["Unknown","Point","LineString","Polygon"];class it{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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?at[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(e){let t=this._parseColorCache.get(e);return t||(t=Oe.parse(e),this._parseColorCache.set(e,t)),t}}class st{constructor(e,t,r=[],n,o=new Z,a=[]){this.registry=e,this.path=r,this.key=r.map(e=>`[${e}]`).join(""),this.scope=o,this.errors=a,this.expectedType=n,this._isConstant=t}parse(e,t,r,n,o={}){return t?this.concat(t,r,n)._parse(e,o):this._parse(e,o)}_parse(e,t){function r(e,t,r){return"assert"===r?new rt(t,[e]):"coerce"===r?new ot(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=e[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 o=this.registry[n];if(o){let n=o.parse(e,this);if(!n)return null;if(this.expectedType){const e=this.expectedType,o=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==o.kind){if("projectionDefinition"===e.kind&&["string","array"].includes(o.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(o.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(o.kind)||"colorArray"===e.kind&&["value","string","array"].includes(o.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(o.kind))n=r(n,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,o))return null}else n=r(n,e,t.typeAnnotation||"assert")}if(!(n instanceof et)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const e=new it;try{n=new et(n.type,n.evaluate(e))}catch(e){return this.error(e.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===e?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,r){const n="number"==typeof e?this.path.concat(e):this.path,o=r?this.scope.concat(r):this.scope;return new st(this.registry,this._isConstant,n,t||null,o,this.errors)}error(e,...t){const r=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new G(r,e))}checkSubtype(e,t){const r=le(e,t);return r&&this.error(r),r}}class lt{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const r=[];for(let n=1;n<e.length-1;n+=2){const o=e[n];if("string"!=typeof o)return t.error(`Expected string, but found ${typeof o} instead.`,n);if(/[^a-zA-Z0-9_]/.test(o))return t.error("Variable names must contain only alphanumeric characters or '_'.",n);const a=t.parse(e[n+1],n+1);if(!a)return null;r.push([o,a])}const n=t.parse(e[e.length-1],e.length-1,t.expectedType,r);return n?new lt(r,n):null}outputDefined(){return this.result.outputDefined()}}class ut{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const r=e[1];return t.scope.has(r)?new ut(r,t.scope.get(r)):t.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class pt{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,V),n=t.parse(e[2],2,ae(t.expectedType||Y));if(!r||!n)return null;const o=n.type;return new pt(o.itemType,r,n)}evaluate(e){const t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new Ve(`Array index out of bounds: ${t} < 0.`);if(t>=r.length)throw new Ve(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t!==Math.floor(t))throw new Ve(`Array index must be an integer, but found ${t} instead.`);return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class ct{constructor(e,t){this.type=J,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Y),n=t.parse(e[2],2,Y);return r&&n?ue(r.type,[J,B,V,U,Y])?new ct(r,n):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(r.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!r)return!1;if(!pe(t,["boolean","string","number","null"]))throw new Ve(`Expected first argument to be of type boolean, string, number or null, but found ${ie(Ke(t))} instead.`);if(!pe(r,["string","array"]))throw new Ve(`Expected second argument to be of type array or string, but found ${ie(Ke(r))} instead.`);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class ft{constructor(e,t,r){this.type=V,this.needle=e,this.haystack=t,this.fromIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Y),n=t.parse(e[2],2,Y);if(!r||!n)return null;if(!ue(r.type,[J,B,V,U,Y]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(r.type)} instead`);if(4===e.length){const o=t.parse(e[3],3,V);return o?new ft(r,n,o):null}return new ft(r,n)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!pe(t,["boolean","string","number","null"]))throw new Ve(`Expected first argument to be of type boolean, string, number or null, but found ${ie(Ke(t))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),pe(r,["string"])){const e=r.indexOf(t,n);return-1===e?-1:[...r.slice(0,e)].length}if(pe(r,["array"]))return r.indexOf(t,n);throw new Ve(`Expected second argument to be of type array or string, but found ${ie(Ke(r))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class dt{constructor(e,t,r,n,o,a){this.inputType=e,this.type=t,this.input=r,this.cases=n,this.outputs=o,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let r,n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const o={},a=[];for(let i=2;i<e.length-1;i+=2){let s=e[i];const l=e[i+1];Array.isArray(s)||(s=[s]);const u=t.concat(i);if(0===s.length)return u.error("Expected at least one branch label.");for(const e of s){if("number"!=typeof e&&"string"!=typeof e)return u.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,Ke(e)))return null}else r=Ke(e);if(void 0!==o[String(e)])return u.error("Branch labels must be unique.");o[String(e)]=a.length}const p=t.parse(l,i,n);if(!p)return null;n=n||p.type,a.push(p)}const i=t.parse(e[1],1,Y);if(!i)return null;const s=t.parse(e[e.length-1],e.length-1,n);return s?"value"!==i.type.kind&&t.concat(1).checkSubtype(r,i.type)?null:new dt(r,n,i,o,a,s):null}evaluate(e){const t=this.input.evaluate(e);return(Ke(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class mt{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n=[];for(let o=1;o<e.length-1;o+=2){const a=t.parse(e[o],o,J);if(!a)return null;const i=t.parse(e[o+1],o+1,r);if(!i)return null;n.push([a,i]),r=r||i.type}const o=t.parse(e[e.length-1],e.length-1,r);if(!o)return null;if(!r)throw new Error("Can't infer output type");return new mt(r,n,o)}evaluate(e){for(const[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class yt{constructor(e,t,r,n){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Y),n=t.parse(e[2],2,V);if(!r||!n)return null;if(!ue(r.type,[ae(Y),B,Y]))return t.error(`Expected first argument to be of type array or string, but found ${ie(r.type)} instead`);if(4===e.length){const o=t.parse(e[3],3,V);return o?new yt(r.type,r,n,o):null}return new yt(r.type,r,n)}evaluate(e){const t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);let n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),pe(t,["string"]))return[...t].slice(r,n).join("");if(pe(t,["array"]))return t.slice(r,n);throw new Ve(`Expected first argument to be of type array or string, but found ${ie(Ke(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function ht(e,t){const r=e.length-1;let n,o,a=0,i=r,s=0;for(;a<=i;)if(s=Math.floor((a+i)/2),n=e[s],o=e[s+1],n<=t){if(s===r||t<o)return s;a=s+1}else{if(!(n>t))throw new Ve("Input is not a number.");i=s-1}return 0}class gt{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of r)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const r=t.parse(e[1],1,V);if(!r)return null;const n=[];let o=null;t.expectedType&&"value"!==t.expectedType.kind&&(o=t.expectedType);for(let r=1;r<e.length;r+=2){const a=1===r?-1/0:e[r],i=e[r+1],s=r,l=r+1;if("number"!=typeof a)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(n.length&&n[n.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const u=t.parse(i,l,o);if(!u)return null;o=o||u.type,n.push([a,u])}return new gt(o,r,n)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);const o=t.length;if(n>=t[o-1])return r[o-1].evaluate(e);return r[ht(t,n)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function vt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bt,xt;var wt=function(){if(xt)return bt;function e(e,t,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=n}return xt=1,bt=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var o=this.sampleCurveX(r)-e;if(Math.abs(o)<t)return r;var a=this.sampleCurveDerivativeX(r);if(Math.abs(a)<1e-6)break;r-=o/a}var i=0,s=1;for(r=e,n=0;n<20&&(o=this.sampleCurveX(r),!(Math.abs(o-e)<t));n++)e>o?i=r:s=r,r=.5*(s-i)+i;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},bt}(),kt=vt(wt);class zt{constructor(e,t,r,n,o){this.type=e,this.operator=t,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[e,t]of o)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,r,n){let o=0;if("exponential"===e.name)o=Mt(t,e.base,r,n);else if("linear"===e.name)o=Mt(t,1,r,n);else if("cubic-bezier"===e.name){const a=e.controlPoints;o=new kt(a[0],a[1],a[2],a[3]).solve(Mt(t,1,r,n))}return o}static parse(e,t){let[r,n,o,...a]=e;if(!Array.isArray(n)||0===n.length)return t.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const e=n[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:e}}else{if("cubic-bezier"!==n[0])return t.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const e=n.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,V),!o)return null;const i=[];let s=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||t.expectedType==te?t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType):s=H;for(let e=0;e<a.length;e+=2){const r=a[e],n=a[e+1],o=e+3,l=e+4;if("number"!=typeof r)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(i.length&&i[i.length-1][0]>=r)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);const u=t.parse(n,l,s);if(!u)return null;s=s||u.type,i.push([r,u])}return ce(s,V)||ce(s,W)||ce(s,H)||ce(s,ee)||ce(s,re)||ce(s,te)||ce(s,oe)||ce(s,ae(V))?new zt(s,r,n,o,i):t.error(`Type ${ie(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);const o=t.length;if(n>=t[o-1])return r[o-1].evaluate(e);const a=ht(t,n),i=t[a],s=t[a+1],l=zt.interpolationFactor(this.interpolation,n,i,s),u=r[a].evaluate(e),p=r[a+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ne(u,p,l);case"color":return Oe.interpolate(u,p,l);case"padding":return Ge.interpolate(u,p,l);case"colorArray":return Ue.interpolate(u,p,l);case"numberArray":return Ze.interpolate(u,p,l);case"variableAnchorOffsetCollection":return Je.interpolate(u,p,l);case"array":return Pe(u,p,l);case"projectionDefinition":return We.interpolate(u,p,l)}case"interpolate-hcl":switch(this.type.kind){case"color":return Oe.interpolate(u,p,l,"hcl");case"colorArray":return Ue.interpolate(u,p,l,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Oe.interpolate(u,p,l,"lab");case"colorArray":return Ue.interpolate(u,p,l,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Mt(e,t,r,n){const o=n-r,a=e-r;return 0===o?0:1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1)}class St{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r=null;const n=t.expectedType;n&&"value"!==n.kind&&(r=n);const o=[];for(const n of e.slice(1)){const e=t.parse(n,1+o.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,o.push(e)}if(!r)throw new Error("No output type");const a=n&&o.some(e=>le(n,e.type));return new St(a?Y:r,o)}evaluate(e){let t,r=null,n=0;for(const o of this.args)if(n++,r=o.evaluate(e),r&&r instanceof He&&!r.available&&(t||(t=r.name),r=null,n===this.args.length&&(r=t)),null!==r)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function At(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function _t(e,t,r,n){return 0===n.compare(t,r)}function jt(e,t,r){const n="=="!==e&&"!="!==e;return class o{constructor(e,t,r){this.type=J,this.lhs=e,this.rhs=t,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const r=e[0];let a=t.parse(e[1],1,Y);if(!a)return null;if(!At(r,a.type))return t.concat(1).error(`"${r}" comparisons are not supported for type '${ie(a.type)}'.`);let i=t.parse(e[2],2,Y);if(!i)return null;if(!At(r,i.type))return t.concat(2).error(`"${r}" comparisons are not supported for type '${ie(i.type)}'.`);if(a.type.kind!==i.type.kind&&"value"!==a.type.kind&&"value"!==i.type.kind)return t.error(`Cannot compare types '${ie(a.type)}' and '${ie(i.type)}'.`);n&&("value"===a.type.kind&&"value"!==i.type.kind?a=new rt(i.type,[a]):"value"!==a.type.kind&&"value"===i.type.kind&&(i=new rt(a.type,[i])));let s=null;if(4===e.length){if("string"!==a.type.kind&&"string"!==i.type.kind&&"value"!==a.type.kind&&"value"!==i.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,K),!s)return null}return new o(a,i,s)}evaluate(o){const a=this.lhs.evaluate(o),i=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){const t=Ke(a),r=Ke(i);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new Ve(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const e=Ke(a),r=Ke(i);if("string"!==e.kind||"string"!==r.kind)return t(o,a,i)}return this.collator?r(o,a,i,this.collator.evaluate(o)):t(o,a,i)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const Et=jt("==",function(e,t,r){return t===r},_t),Ct=jt("!=",function(e,t,r){return t!==r},function(e,t,r,n){return!_t(0,t,r,n)}),$t=jt("<",function(e,t,r){return t<r},function(e,t,r,n){return n.compare(t,r)<0}),qt=jt(">",function(e,t,r){return t>r},function(e,t,r,n){return n.compare(t,r)>0}),It=jt("<=",function(e,t,r){return t<=r},function(e,t,r,n){return n.compare(t,r)<=0}),Tt=jt(">=",function(e,t,r){return t>=r},function(e,t,r,n){return n.compare(t,r)>=0});class Nt{constructor(e,t,r){this.type=K,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const r=e[1];if("object"!=typeof r||Array.isArray(r))return t.error("Collator options argument must be an object.");const n=t.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,J);if(!n)return null;const o=t.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,J);if(!o)return null;let a=null;return r.locale&&(a=t.parse(r.locale,1,B),!a)?null:new Nt(n,o,a)}evaluate(e){return new Fe(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Pt{constructor(e,t,r,n,o,a){this.type=B,this.number=e,this.locale=t,this.currency=r,this.unit=n,this.minFractionDigits=o,this.maxFractionDigits=a}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const r=t.parse(e[1],1,V);if(!r)return null;const n=e[2];if("object"!=typeof n||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let o=null;if(n.locale&&(o=t.parse(n.locale,1,B),!o))return null;let a=null;if(n.currency&&(a=t.parse(n.currency,1,B),!a))return null;let i=null;if(n.unit&&(i=t.parse(n.unit,1,B),!i))return null;if(a&&i)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let s=null;if(n["min-fraction-digits"]&&(s=t.parse(n["min-fraction-digits"],1,V),!s))return null;let l=null;return n["max-fraction-digits"]&&(l=t.parse(n["max-fraction-digits"],1,V),!l)?null:new Pt(r,o,a,i,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Ot{constructor(e){this.type=Q,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return t.error("First argument must be an image or text section.");const n=[];let o=!1;for(let r=1;r<=e.length-1;++r){const a=e[r];if(o&&"object"==typeof a&&!Array.isArray(a)){o=!1;let e=null;if(a["font-scale"]&&(e=t.parse(a["font-scale"],1,V),!e))return null;let r=null;if(a["text-font"]&&(r=t.parse(a["text-font"],1,ae(B)),!r))return null;let i=null;if(a["text-color"]&&(i=t.parse(a["text-color"],1,H),!i))return null;let s=null;if(a["vertical-align"]){if("string"==typeof a["vertical-align"]&&!De.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(s=t.parse(a["vertical-align"],1,B),!s)return null}const l=n[n.length-1];l.scale=e,l.font=r,l.textColor=i,l.verticalAlign=s}else{const a=t.parse(e[r],1,Y);if(!a)return null;const i=a.type.kind;if("string"!==i&&"value"!==i&&"null"!==i&&"resolvedImage"!==i)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,n.push({content:a,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Ot(n)}evaluate(e){return new Re(this.sections.map(t=>{const r=t.content.evaluate(e);return Ke(r)===ne?new Le("",r,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new Le(Qe(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class Ft{constructor(e){this.type=ne,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const r=t.parse(e[1],1,B);return r?new Ft(r):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),r=He.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r}eachChild(e){e(this.input)}outputDefined(){return!1}}class Dt{constructor(e){this.type=V,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=t.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?t.error(`Expected argument of type string or array, but found ${ie(r.type)} instead.`):new Dt(r):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new Ve(`Expected value to be of type string or array, but found ${ie(Ke(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Lt=8192;function Rt(e,t){const r=(180+e[0])/360;const n=(o=e[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360);var o;const a=Math.pow(2,t.z);return[Math.round(r*a*Lt),Math.round(n*a*Lt)]}function Gt(e,t){const r=Math.pow(2,t.z),n=(e[0]/Lt+t.x)/r,o=(e[1]/Lt+t.y)/r;return[(i=n,360*i-180),(a=o,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,i}function Zt(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Ut(e,t){return!(e[0]<=t[0])&&(!(e[2]>=t[2])&&(!(e[1]<=t[1])&&!(e[3]>=t[3])))}function Vt(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Bt(e,t,r){const n=e[0]-t[0],o=e[1]-t[1],a=e[0]-r[0],i=e[1]-r[1];return n*i-a*o===0&&n*a<=0&&o*i<=0}function Jt(e,t,r,n){const o=[t[0]-e[0],t[1]-e[1]],a=[n[0]-r[0],n[1]-r[1]];return 0!==(i=a)[0]*(s=o)[1]-i[1]*s[0]&&!(!Qt(e,t,r,n)||!Qt(r,n,e,t));var i,s}function Ht(e,t,r){for(const n of r)for(let r=0;r<n.length-1;++r)if(Jt(e,t,n[r],n[r+1]))return!0;return!1}function Wt(e,t,r=!1){let n=!1;for(const o of t)for(let t=0;t<o.length-1;t++){if(Bt(e,o[t],o[t+1]))return r;Vt(e,o[t],o[t+1])&&(n=!n)}return n}function Xt(e,t){for(const r of t)if(Wt(e,r))return!0;return!1}function Yt(e,t){for(const r of e)if(!Wt(r,t))return!1;for(let r=0;r<e.length-1;++r)if(Ht(e[r],e[r+1],t))return!1;return!0}function Kt(e,t){for(const r of t)if(Yt(e,r))return!0;return!1}function Qt(e,t,r,n){const o=e[0]-r[0],a=e[1]-r[1],i=t[0]-r[0],s=t[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],p=o*u-l*a,c=i*u-l*s;return p>0&&c<0||p<0&&c>0}function er(e,t,r){const n=[];for(let o=0;o<e.length;o++){const a=[];for(let n=0;n<e[o].length;n++){const i=Rt(e[o][n],r);Zt(t,i),a.push(i)}n.push(a)}return n}function tr(e,t,r){const n=[];for(let o=0;o<e.length;o++){const a=er(e[o],t,r);n.push(a)}return n}function rr(e,t,r,n){if(e[0]<r[0]||e[0]>r[2]){const t=.5*n;let o=e[0]-r[0]>t?-n:r[0]-e[0]>t?n:0;0===o&&(o=e[0]-r[2]>t?-n:r[2]-e[0]>t?n:0),e[0]+=o}Zt(t,e)}function nr(e,t,r,n){const o=Math.pow(2,n.z)*Lt,a=[n.x*Lt,n.y*Lt],i=[];for(const n of e)for(const e of n){const n=[e.x+a[0],e.y+a[1]];rr(n,t,r,o),i.push(n)}return i}function or(e,t,r,n){const o=Math.pow(2,n.z)*Lt,a=[n.x*Lt,n.y*Lt],i=[];for(const r of e){const e=[];for(const n of r){const r=[n.x+a[0],n.y+a[1]];Zt(t,r),e.push(r)}i.push(e)}if(t[2]-t[0]<=o/2){!function(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}(t);for(const e of i)for(const n of e)rr(n,t,r,o)}return i}class ar{constructor(e,t){this.type=J,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ye(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const r of t.features){const{type:t,coordinates:n}=r.geometry;"Polygon"===t&&e.push(n),"MultiPolygon"===t&&e.push(...n)}if(e.length){return new ar(t,{type:"MultiPolygon",coordinates:e})}}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new ar(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new ar(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=e.canonicalID();if("Polygon"===t.type){const a=er(t.coordinates,n,o),i=nr(e.geometry(),r,n,o);if(!Ut(r,n))return!1;for(const e of i)if(!Wt(e,a))return!1}if("MultiPolygon"===t.type){const a=tr(t.coordinates,n,o),i=nr(e.geometry(),r,n,o);if(!Ut(r,n))return!1;for(const e of i)if(!Xt(e,a))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=e.canonicalID();if("Polygon"===t.type){const a=er(t.coordinates,n,o),i=or(e.geometry(),r,n,o);if(!Ut(r,n))return!1;for(const e of i)if(!Yt(e,a))return!1}if("MultiPolygon"===t.type){const a=tr(t.coordinates,n,o),i=or(e.geometry(),r,n,o);if(!Ut(r,n))return!1;for(const e of i)if(!Kt(e,a))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class ir{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,n=t[e];for(;e>0;){const o=e-1>>1,a=t[o];if(r(n,a)>=0)break;t[e]=a,e=o}t[e]=n}_down(e){const{data:t,compare:r}=this,n=this.length>>1,o=t[e];for(;e<n;){let n=1+(e<<1);const a=n+1;if(a<this.length&&r(t[a],t[n])<0&&(n=a),r(t[n],o)>=0)break;t[e]=t[n],e=n}t[e]=o}}function sr(e){let t=0;for(let r,n,o=0,a=e.length,i=a-1;o<a;i=o++)r=e[o],n=e[i],t+=(n.x-r.x)*(r.y+n.y);return t}const lr=1/298.257223563,ur=lr*(2-lr),pr=Math.PI/180;class cr{constructor(e){const t=6378.137*pr*1e3,r=Math.cos(e*pr),n=1/(1-ur*(1-r*r)),o=Math.sqrt(n);this.kx=t*o*r,this.ky=t*o*n*(1-ur)}distance(e,t){const r=this.wrap(e[0]-t[0])*this.kx,n=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+n*n)}pointOnLine(e,t){let r,n,o,a,i=1/0;for(let s=0;s<e.length-1;s++){let l=e[s][0],u=e[s][1],p=this.wrap(e[s+1][0]-l)*this.kx,c=(e[s+1][1]-u)*this.ky,f=0;0===p&&0===c||(f=(this.wrap(t[0]-l)*this.kx*p+(t[1]-u)*this.ky*c)/(p*p+c*c),f>1?(l=e[s+1][0],u=e[s+1][1]):f>0&&(l+=p/this.kx*f,u+=c/this.ky*f)),p=this.wrap(t[0]-l)*this.kx,c=(t[1]-u)*this.ky;const d=p*p+c*c;d<i&&(i=d,r=l,n=u,o=s,a=f)}return{point:[r,n],index:o,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function fr(e,t){return t[0]-e[0]}function dr(e){return e[1]-e[0]+1}function mr(e,t){return e[1]>=e[0]&&e[1]<t}function yr(e,t){if(e[0]>e[1])return[null,null];const r=dr(e);if(t){if(2===r)return[e,null];const t=Math.floor(r/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===r)return[e,null];const n=Math.floor(r/2)-1;return[[e[0],e[0]+n],[e[0]+n+1,e[1]]]}function hr(e,t){if(!mr(t,e.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let n=t[0];n<=t[1];++n)Zt(r,e[n]);return r}function gr(e){const t=[1/0,1/0,-1/0,-1/0];for(const r of e)for(const e of r)Zt(t,e);return t}function vr(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function br(e,t,r){if(!vr(e)||!vr(t))return NaN;let n=0,o=0;return e[2]<t[0]&&(n=t[0]-e[2]),e[0]>t[2]&&(n=e[0]-t[2]),e[1]>t[3]&&(o=e[1]-t[3]),e[3]<t[1]&&(o=t[1]-e[3]),r.distance([0,0],[n,o])}function xr(e,t,r){const n=r.pointOnLine(t,e);return r.distance(e,n.point)}function wr(e,t,r,n,o){const a=Math.min(xr(e,[r,n],o),xr(t,[r,n],o)),i=Math.min(xr(r,[e,t],o),xr(n,[e,t],o));return Math.min(a,i)}function kr(e,t,r,n,o){if(!(mr(t,e.length)&&mr(n,r.length)))return 1/0;let a=1/0;for(let i=t[0];i<t[1];++i){const t=e[i],s=e[i+1];for(let e=n[0];e<n[1];++e){const n=r[e],i=r[e+1];if(Jt(t,s,n,i))return 0;a=Math.min(a,wr(t,s,n,i,o))}}return a}function zr(e,t,r,n,o){if(!(mr(t,e.length)&&mr(n,r.length)))return NaN;let a=1/0;for(let i=t[0];i<=t[1];++i)for(let t=n[0];t<=n[1];++t)if(a=Math.min(a,o.distance(e[i],r[t])),0===a)return a;return a}function Mr(e,t,r){if(Wt(e,t,!0))return 0;let n=1/0;for(const o of t){const t=o[0],a=o[o.length-1];if(t!==a&&(n=Math.min(n,xr(e,[a,t],r)),0===n))return n;const i=r.pointOnLine(o,e);if(n=Math.min(n,r.distance(e,i.point)),0===n)return n}return n}function Sr(e,t,r,n){if(!mr(t,e.length))return NaN;for(let n=t[0];n<=t[1];++n)if(Wt(e[n],r,!0))return 0;let o=1/0;for(let a=t[0];a<t[1];++a){const t=e[a],i=e[a+1];for(const e of r)for(let r=0,a=e.length,s=a-1;r<a;s=r++){const a=e[s],l=e[r];if(Jt(t,i,a,l))return 0;o=Math.min(o,wr(t,i,a,l,n))}}return o}function Ar(e,t){for(const r of e)for(const e of r)if(Wt(e,t,!0))return!0;return!1}function _r(e,t,r,n=1/0){const o=gr(e),a=gr(t);if(n!==1/0&&br(o,a,r)>=n)return n;if(Ut(o,a)){if(Ar(e,t))return 0}else if(Ar(t,e))return 0;let i=1/0;for(const n of e)for(let e=0,o=n.length,a=o-1;e<o;a=e++){const o=n[a],s=n[e];for(const e of t)for(let t=0,n=e.length,a=n-1;t<n;a=t++){const n=e[a],l=e[t];if(Jt(o,s,n,l))return 0;i=Math.min(i,wr(o,s,n,l,r))}}return i}function jr(e,t,r,n,o,a){if(!a)return;const i=br(hr(n,a),o,r);i<t&&e.push([i,a,[0,0]])}function Er(e,t,r,n,o,a,i){if(!a||!i)return;const s=br(hr(n,a),hr(o,i),r);s<t&&e.push([s,a,i])}function Cr(e,t,r,n,o=1/0){let a=Math.min(n.distance(e[0],r[0][0]),o);if(0===a)return a;const i=new ir([[0,[0,e.length-1],[0,0]]],fr),s=gr(r);for(;i.length>0;){const o=i.pop();if(o[0]>=a)continue;const l=o[1],u=t?50:100;if(dr(l)<=u){if(!mr(l,e.length))return NaN;if(t){const t=Sr(e,l,r,n);if(isNaN(t)||0===t)return t;a=Math.min(a,t)}else for(let t=l[0];t<=l[1];++t){const o=Mr(e[t],r,n);if(a=Math.min(a,o),0===a)return 0}}else{const r=yr(l,t);jr(i,a,n,e,s,r[0]),jr(i,a,n,e,s,r[1])}}return a}function $r(e,t,r,n,o,a=1/0){let i=Math.min(a,o.distance(e[0],r[0]));if(0===i)return i;const s=new ir([[0,[0,e.length-1],[0,r.length-1]]],fr);for(;s.length>0;){const a=s.pop();if(a[0]>=i)continue;const l=a[1],u=a[2],p=t?50:100,c=n?50:100;if(dr(l)<=p&&dr(u)<=c){if(!mr(l,e.length)&&mr(u,r.length))return NaN;let a;if(t&&n)a=kr(e,l,r,u,o),i=Math.min(i,a);else if(t&&!n){const t=e.slice(l[0],l[1]+1);for(let e=u[0];e<=u[1];++e)if(a=xr(r[e],t,o),i=Math.min(i,a),0===i)return i}else if(!t&&n){const t=r.slice(u[0],u[1]+1);for(let r=l[0];r<=l[1];++r)if(a=xr(e[r],t,o),i=Math.min(i,a),0===i)return i}else a=zr(e,l,r,u,o),i=Math.min(i,a)}else{const a=yr(l,t),p=yr(u,n);Er(s,i,o,e,r,a[0],p[0]),Er(s,i,o,e,r,a[0],p[1]),Er(s,i,o,e,r,a[1],p[0]),Er(s,i,o,e,r,a[1],p[1])}}return i}function qr(e,t){const r=e.geometry();if(0===r.length||0===r[0].length)return NaN;const n=function(e){if(e.length<=1)return[e];const t=[];let r,n;for(const o of e){const e=sr(o);0!==e&&(o.area=Math.abs(e),void 0===n&&(n=e<0),n===e<0?(r&&t.push(r),r=[o]):r.push(o))}return r&&t.push(r),t}(r).map(t=>t.map(t=>t.map(t=>Gt([t.x,t.y],e.canonical)))),o=new cr(n[0][0][0][1]);let a=1/0;for(const e of t)for(const t of n){switch(e.type){case"Point":a=Math.min(a,Cr([e.coordinates],!1,t,o,a));break;case"LineString":a=Math.min(a,Cr(e.coordinates,!0,t,o,a));break;case"Polygon":a=Math.min(a,_r(t,e.coordinates,o,a))}if(0===a)return a}return a}function Ir(e){return"MultiPolygon"===e.type?e.coordinates.map(e=>({type:"Polygon",coordinates:e})):"MultiLineString"===e.type?e.coordinates.map(e=>({type:"LineString",coordinates:e})):"MultiPoint"===e.type?e.coordinates.map(e=>({type:"Point",coordinates:e})):[e]}class Tr{constructor(e,t){this.type=V,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ye(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new Tr(t,t.features.map(e=>Ir(e.geometry)).flat());if("Feature"===t.type)return new Tr(t,Ir(t.geometry));if("type"in t&&"coordinates"in t)return new Tr(t,Ir(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const r=e.geometry(),n=r.flat().map(t=>Gt([t.x,t.y],e.canonical));if(0===r.length)return NaN;const o=new cr(n[0][1]);let a=1/0;for(const e of t){switch(e.type){case"Point":a=Math.min(a,$r(n,!1,[e.coordinates],!1,o,a));break;case"LineString":a=Math.min(a,$r(n,!1,e.coordinates,!0,o,a));break;case"Polygon":a=Math.min(a,Cr(n,!1,e.coordinates,o,a))}if(0===a)return a}return a}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const r=e.geometry(),n=r.flat().map(t=>Gt([t.x,t.y],e.canonical));if(0===r.length)return NaN;const o=new cr(n[0][1]);let a=1/0;for(const e of t){switch(e.type){case"Point":a=Math.min(a,$r(n,!0,[e.coordinates],!1,o,a));break;case"LineString":a=Math.min(a,$r(n,!0,e.coordinates,!0,o,a));break;case"Polygon":a=Math.min(a,Cr(n,!0,e.coordinates,o,a))}if(0===a)return a}return a}(e,this.geometries);if("Polygon"===e.geometryType())return qr(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Nr{constructor(e){this.type=Y,this.key=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=e[1];return null==r?t.error("Global state property must be defined."):"string"!=typeof r?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new Nr(r)}evaluate(e){var t;const r=null===(t=e.globals)||void 0===t?void 0:t.globalState;return r&&0!==Object.keys(r).length?je(r,this.key):null}eachChild(){}outputDefined(){return!1}}const Pr={"==":Et,"!=":Ct,">":qt,"<":$t,">=":Tt,"<=":It,array:rt,at:pt,boolean:rt,case:mt,coalesce:St,collator:Nt,format:Ot,image:Ft,in:ct,"index-of":ft,interpolate:zt,"interpolate-hcl":zt,"interpolate-lab":zt,length:Dt,let:lt,literal:et,match:dt,number:rt,"number-format":Pt,object:rt,slice:yt,step:gt,string:rt,"to-boolean":ot,"to-color":ot,"to-number":ot,"to-string":ot,var:ut,within:ar,distance:Tr,"global-state":Nr};class Or{constructor(e,t,r,n){this.name=e,this.type=t,this._evaluate=r,this.args=n}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const r=e[0],n=Or.definitions[r];if(!n)return t.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(n)?n[0]:n.type,a=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,i=a.filter(([t])=>!Array.isArray(t)||t.length===e.length-1);let s=null;for(const[n,a]of i){s=new st(t.registry,Gr,t.path,null,t.scope);const i=[];let l=!1;for(let t=1;t<e.length;t++){const r=e[t],o=Array.isArray(n)?n[t-1]:n.type,a=s.parse(r,1+i.length,o);if(!a){l=!0;break}i.push(a)}if(!l)if(Array.isArray(n)&&n.length!==i.length)s.error(`Expected ${n.length} arguments, but found ${i.length} instead.`);else{for(let e=0;e<i.length;e++){const t=Array.isArray(n)?n[e]:n.type,r=i[e];s.concat(e+1).checkSubtype(t,r.type)}if(0===s.errors.length)return new Or(r,o,a,i)}}if(1===i.length)t.errors.push(...s.errors);else{const r=(i.length?i:a).map(([e])=>{return t=e,Array.isArray(t)?`(${t.map(ie).join(", ")})`:`(${ie(t.type)}...)`;var t}).join(" | "),n=[];for(let r=1;r<e.length;r++){const o=t.parse(e[r],1+n.length);if(!o)return null;n.push(ie(o.type))}t.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(e,t){Or.definitions=t;for(const r in t)e[r]=Or}}function Fr(e,[t,r,n,o]){t=t.evaluate(e),r=r.evaluate(e),n=n.evaluate(e);const a=o?o.evaluate(e):1,i=Xe(t,r,n,a);if(i)throw new Ve(i);return new Oe(t/255,r/255,n/255,a,!1)}function Dr(e,t){return e in t}function Lr(e,t){const r=t[e];return void 0===r?null:r}function Rr(e){return{type:e}}function Gr(e){if(e instanceof ut)return Gr(e.boundExpression);if(e instanceof Or&&"error"===e.name)return!1;if(e instanceof Nt)return!1;if(e instanceof ar)return!1;if(e instanceof Tr)return!1;if(e instanceof Nr)return!1;const t=e instanceof ot||e instanceof rt;let r=!0;return e.eachChild(e=>{r=t?r&&Gr(e):r&&e instanceof et}),!!r&&(Zr(e)&&Vr(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]))}function Zr(e){if(e instanceof Or){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof ar)return!1;if(e instanceof Tr)return!1;let t=!0;return e.eachChild(e=>{t&&!Zr(e)&&(t=!1)}),t}function Ur(e){if(e instanceof Or&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!Ur(e)&&(t=!1)}),t}function Vr(e,t){if(e instanceof Or&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!Vr(e,t)&&(r=!1)}),r}function Br(e){return{result:"success",value:e}}function Jr(e){return{result:"error",value:e}}function Hr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&Ke(e)===X}Or.register(Pr,{error:[{kind:"error"},[B],(e,[t])=>{throw new Ve(t.evaluate(e))}],typeof:[B,[Y],(e,[t])=>ie(Ke(t.evaluate(e)))],"to-rgba":[ae(V,4),[H],(e,[t])=>{const[r,n,o,a]=t.evaluate(e).rgb;return[255*r,255*n,255*o,a]}],rgb:[H,[V,V,V],Fr],rgba:[H,[V,V,V,V],Fr],has:{type:J,overloads:[[[B],(e,[t])=>Dr(t.evaluate(e),e.properties())],[[B,X],(e,[t,r])=>Dr(t.evaluate(e),r.evaluate(e))]]},get:{type:Y,overloads:[[[B],(e,[t])=>Lr(t.evaluate(e),e.properties())],[[B,X],(e,[t,r])=>Lr(t.evaluate(e),r.evaluate(e))]]},"feature-state":[Y,[B],(e,[t])=>Lr(t.evaluate(e),e.featureState||{})],properties:[X,[],e=>e.properties()],"geometry-type":[B,[],e=>e.geometryType()],id:[Y,[],e=>e.id()],zoom:[V,[],e=>e.globals.zoom],"heatmap-density":[V,[],e=>e.globals.heatmapDensity||0],elevation:[V,[],e=>e.globals.elevation||0],"line-progress":[V,[],e=>e.globals.lineProgress||0],accumulated:[Y,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[V,Rr(V),(e,t)=>{let r=0;for(const n of t)r+=n.evaluate(e);return r}],"*":[V,Rr(V),(e,t)=>{let r=1;for(const n of t)r*=n.evaluate(e);return r}],"-":{type:V,overloads:[[[V,V],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[V],(e,[t])=>-t.evaluate(e)]]},"/":[V,[V,V],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[V,[V,V],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[V,[],()=>Math.LN2],pi:[V,[],()=>Math.PI],e:[V,[],()=>Math.E],"^":[V,[V,V],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[V,[V],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[V,[V],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[V,[V],(e,[t])=>Math.log(t.evaluate(e))],log2:[V,[V],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[V,[V],(e,[t])=>Math.sin(t.evaluate(e))],cos:[V,[V],(e,[t])=>Math.cos(t.evaluate(e))],tan:[V,[V],(e,[t])=>Math.tan(t.evaluate(e))],asin:[V,[V],(e,[t])=>Math.asin(t.evaluate(e))],acos:[V,[V],(e,[t])=>Math.acos(t.evaluate(e))],atan:[V,[V],(e,[t])=>Math.atan(t.evaluate(e))],min:[V,Rr(V),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[V,Rr(V),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[V,[V],(e,[t])=>Math.abs(t.evaluate(e))],round:[V,[V],(e,[t])=>{const r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[V,[V],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[V,[V],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[J,[B,Y],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[J,[Y],(e,[t])=>e.id()===t.value],"filter-type-==":[J,[B],(e,[t])=>e.geometryType()===t.value],"filter-<":[J,[B,Y],(e,[t,r])=>{const n=e.properties()[t.value],o=r.value;return typeof n==typeof o&&n<o}],"filter-id-<":[J,[Y],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r<n}],"filter->":[J,[B,Y],(e,[t,r])=>{const n=e.properties()[t.value],o=r.value;return typeof n==typeof o&&n>o}],"filter-id->":[J,[Y],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r>n}],"filter-<=":[J,[B,Y],(e,[t,r])=>{const n=e.properties()[t.value],o=r.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[J,[Y],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r<=n}],"filter->=":[J,[B,Y],(e,[t,r])=>{const n=e.properties()[t.value],o=r.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[J,[Y],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r>=n}],"filter-has":[J,[Y],(e,[t])=>t.value in e.properties()],"filter-has-id":[J,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[J,[ae(B)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[J,[ae(Y)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[J,[B,ae(Y)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[J,[B,ae(Y)],(e,[t,r])=>function(e,t,r,n){for(;r<=n;){const o=r+n>>1;if(t[o]===e)return!0;t[o]>e?n=o-1:r=o+1}return!1}(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:J,overloads:[[[J,J],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Rr(J),(e,t)=>{for(const r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:J,overloads:[[[J,J],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Rr(J),(e,t)=>{for(const r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[J,[J],(e,[t])=>!t.evaluate(e)],"is-supported-script":[J,[B],(e,[t])=>{const r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[B,[B],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[B,[B],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[B,Rr(Y),(e,t)=>t.map(t=>Qe(t.evaluate(e))).join("")],split:[ae(B),[B,B],(e,[t,r])=>t.evaluate(e).split(r.evaluate(e))],join:[B,[ae(B),B],(e,[t,r])=>t.evaluate(e).join(r.evaluate(e))],"resolved-locale":[B,[K],(e,[t])=>t.evaluate(e).resolvedLocale()]});class Wr{constructor(e,t,r){this.expression=e,this._warningHistory={},this._evaluator=new it,this._defaultValue=t?function(e){if("color"===e.type&&Hr(e.default))return new Oe(0,0,0,0);switch(e.type){case"color":return Oe.parse(e.default)||null;case"padding":return Ge.parse(e.default)||null;case"numberArray":return Ze.parse(e.default)||null;case"colorArray":return Ue.parse(e.default)||null;case"variableAnchorOffsetCollection":return Je.parse(e.default)||null;case"projectionDefinition":return We.parse(e.default)||null;default:return void 0===e.default?null:e.default}}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this._globalState=r}evaluateWithoutErrorHandling(e,t,r,n,o,a){return this._globalState&&(e=nn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,n,o,a){this._globalState&&(e=nn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Ve(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function Xr(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Pr}function Yr(e,t,r){const n=new st(Pr,Gr,[],t?function(e){const t={color:H,string:B,number:V,enum:B,boolean:J,formatted:Q,padding:ee,numberArray:re,colorArray:te,projectionDefinition:W,resolvedImage:ne,variableAnchorOffsetCollection:oe};if("array"===e.type)return ae(t[e.value]||Y,e.length);return t[e.type]}(t):void 0),o=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return o?Br(new Wr(o,t,r)):Jr(n.errors)}class Kr{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!Ur(t.expression),this.globalStateRefs=rn(t.expression),this._globalState=r}evaluateWithoutErrorHandling(e,t,r,n,o,a){return this._globalState&&(e=nn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,o,a)}evaluate(e,t,r,n,o,a){return this._globalState&&(e=nn(e,this._globalState)),this._styleExpression.evaluate(e,t,r,n,o,a)}}class Qr{constructor(e,t,r,n,o){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Ur(t.expression),this.globalStateRefs=rn(t.expression),this.interpolationType=n,this._globalState=o}evaluateWithoutErrorHandling(e,t,r,n,o,a){return this._globalState&&(e=nn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,o,a)}evaluate(e,t,r,n,o,a){return this._globalState&&(e=nn(e,this._globalState)),this._styleExpression.evaluate(e,t,r,n,o,a)}interpolationFactor(e,t,r){return this.interpolationType?zt.interpolationFactor(this.interpolationType,e,t,r):0}}function en(e,t,r){const n=Yr(e,t,r);if("error"===n.result)return n;const o=n.value.expression,a=Zr(o);if(!a&&("data-driven"!==(i=t)["property-type"]&&"cross-faded-data-driven"!==i["property-type"]))return Jr([new G("","data expressions not supported")]);var i;const s=Vr(o,["zoom"]);if(!s&&!function(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}(t))return Jr([new G("","zoom expressions not supported")]);const l=tn(o);if(!l&&!s)return Jr([new G("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(l instanceof G)return Jr([l]);if(l instanceof zt&&!function(e){return!!e.expression&&e.expression.interpolated}(t))return Jr([new G("",'"interpolate" expressions cannot be used with this property')]);if(!l)return Br(new Kr(a?"constant":"source",n.value,r));const u=l instanceof zt?l.interpolation:void 0;return Br(new Qr(a?"camera":"composite",n.value,l.labels,u,r))}function tn(e){let t=null;if(e instanceof lt)t=tn(e.result);else if(e instanceof St){for(const r of e.args)if(t=tn(r),t)break}else(e instanceof gt||e instanceof zt)&&e.input instanceof Or&&"zoom"===e.input.name&&(t=e);return t instanceof G||e.eachChild(e=>{const r=tn(e);r instanceof G?t=r:!t&&r?t=new G("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new G("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function rn(e,t=new Set){return e instanceof Nr&&t.add(e.key),e.eachChild(e=>{rn(e,t)}),t}function nn(e,t){const{zoom:r,heatmapDensity:n,elevation:o,lineProgress:a,isSupportedScript:i,accumulated:s}=null!=e?e:{};return{zoom:r,heatmapDensity:n,elevation:o,lineProgress:a,isSupportedScript:i,accumulated:s,globalState:t}}function on(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!on(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}const an={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function sn(e,t){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};on(e)||(e=pn(e));const r=Yr(e,an,t);if("error"===r.result)throw new Error(r.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,t,n)=>r.value.evaluate(e,t,{},n),needGeometry:un(e),getGlobalStateRefs:()=>rn(r.value.expression)}}function ln(e,t){return e<t?-1:e>t?1:0}function un(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(un(e[t]))return!0;return!1}function pn(e){if(!e)return!0;const t=e[0];if(e.length<=1)return"any"!==t;var r;return"=="===t?cn(e[1],e[2],"=="):"!="===t?mn(cn(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?cn(e[1],e[2],t):"any"===t?(r=e.slice(1),["any"].concat(r.map(pn))):"all"===t?["all"].concat(e.slice(1).map(pn)):"none"===t?["all"].concat(e.slice(1).map(pn).map(mn)):"in"===t?fn(e[1],e.slice(2)):"!in"===t?mn(fn(e[1],e.slice(2))):"has"===t?dn(e[1]):"!has"!==t||mn(dn(e[1]))}function cn(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function fn(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(ln)]]:["filter-in-small",e,["literal",t]]}}function dn(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function mn(e){return["!",e]}function yn(e){return"object"==typeof e?["literal",e]:e}function hn(e,t){let r=e.stops;if(!r)return function(e,t){const r=["get",e.property];if(void 0===e.default)return"string"===t.type?["string",r]:r;if("enum"===t.type)return["match",r,Object.keys(t.values),r,e.default];{const n=["color"===t.type?"to-color":t.type,r,yn(e.default)];return"array"===t.type&&n.splice(1,0,t.value,t.length||null),n}}(e,t);const n=r&&"object"==typeof r[0][0],o=n||void 0!==e.property,a=n||!o;return r=r.map(e=>!o&&t.tokens&&"string"==typeof e[1]?[e[0],zn(e[1])]:[e[0],yn(e[1])]),n?function(e,t,r){const n={},o={},a=[];for(let t=0;t<r.length;t++){const i=r[t],s=i[0].zoom;void 0===n[s]&&(n[s]={zoom:s,type:e.type,property:e.property,default:e.default},o[s]=[],a.push(s)),o[s].push([i[0].value,i[1]])}const i=kn({},t);if("exponential"===i){const r=[gn(e),["linear"],["zoom"]];for(const e of a){wn(r,e,bn(n[e],t,o[e]),!1)}return r}{const e=["step",["zoom"]];for(const r of a){wn(e,r,bn(n[r],t,o[r]),!0)}return xn(e),e}}(e,t,r):a?function(e,t,r,n=["zoom"]){const o=kn(e,t);let a,i=!1;if("interval"===o)a=["step",n],i=!0;else{if("exponential"!==o)throw new Error(`Unknown zoom function type "${o}"`);{const t=void 0!==e.base?e.base:1;a=[gn(e),1===t?["linear"]:["exponential",t],n]}}for(const e of r)wn(a,e[0],e[1],i);return xn(a),a}(e,t,r):bn(e,t,r)}function gn(e){switch(e.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function vn(e,t){const r=yn((n=e.default,o=t.default,void 0!==n?n:void 0!==o?o:void 0));var n,o;return void 0===r&&"resolvedImage"===t.type?"":r}function bn(e,t,r){const n=kn(e,t),o=["get",e.property];if("categorical"===n&&"boolean"==typeof r[0][0]){const n=["case"];for(const e of r)n.push(["==",o,e[0]],e[1]);return n.push(vn(e,t)),n}if("categorical"===n){const n=["match",o];for(const e of r)wn(n,e[0],e[1],!1);return n.push(vn(e,t)),n}if("interval"===n){const t=["step",["number",o]];for(const e of r)wn(t,e[0],e[1],!0);return xn(t),void 0===e.default?t:["case",["==",["typeof",o],"number"],t,yn(e.default)]}if("exponential"===n){const t=void 0!==e.base?e.base:1,n=[gn(e),1===t?["linear"]:["exponential",t],["number",o]];for(const e of r)wn(n,e[0],e[1],!1);return void 0===e.default?n:["case",["==",["typeof",o],"number"],n,yn(e.default)]}throw new Error(`Unknown property function type ${n}`)}function xn(e){"step"===e[0]&&3===e.length&&(e.push(0),e.push(e[3]))}function wn(e,t,r,n){e.length>3&&t===e[e.length-2]||(n&&2===e.length||e.push(t),e.push(r))}function kn(e,t){return e.type?e.type:t.expression.interpolated?"exponential":"interval"}function zn(e){const t=["concat"],r=/{([^{}]+)}/g;let n=0;for(let o=r.exec(e);null!==o;o=r.exec(e)){const a=e.slice(n,r.lastIndex-o[0].length);n=r.lastIndex,a.length>0&&t.push(a),t.push(["get",o[1]])}if(1===t.length)return e;if(n<e.length)t.push(e.slice(n));else if(2===t.length)return["to-string",t[1]];return t}const Mn=D;function Sn(e,t){const r=t[0].evaluate(e),n=t[1].evaluate(e),o=t[2].evaluate(e),a=t[3]?t[3].evaluate(e):1;return Oe.parse(`hsla(${r}, ${n}%, ${o}%, ${a})`)}function An(e){if(Array.isArray(e)){if(0===e.length)return e;const t=e[0];if("literal"===t)return e;if("image"===t&&3===e.length&&"object"==typeof e[2]&&null!==e[2]&&!Array.isArray(e[2])){return["image-config",An(e[1]),["literal",e[2]]]}const r=e.length;for(let n=1;n<r;++n){const o=e[n],a=An(o);if(a!==o){const o=[t];for(let t=1;t<n;++t)o.push(e[t]);o.push(a);for(let t=n+1;t<r;++t)o.push(An(e[t]));return o}}}return e}const _n={},jn={zoom:0,distanceFromCenter:0};Or.register(Pr,{...Or.definitions,pitch:[{kind:"number"},[],e=>jn.pitch||0],"distance-from-center":[{kind:"number"},[],e=>jn.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(e,[t])=>function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,o=e[3],a=Math.max(t,r,n),i=Math.min(t,r,n),s=(a+i)/2;let l,u;if(a===i)l=0,u=0;else{const e=a-i;switch(u=s>.5?e/(2-a-i):e/(a+i),a){case t:l=(r-n)/e+(r<n?6:0);break;case r:l=(n-t)/e+2;break;case n:l=(t-r)/e+4;break;default:l=0}l/=6}return[360*l,100*u,100*s,o]}(S(t.evaluate(e)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],Sn],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],Sn],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(e,[t,r])=>t.evaluate(e)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(e,[t])=>{const r=_n[t.evaluate(e)];return void 0===r?{}:r}]});var En={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},Cn=" ",$n=/(italic|oblique)$/i,qn={};function In(e,t,r){var n=qn[e];if(!n){Array.isArray(e)||(e=[e]);for(var o,a,i=400,s="normal",l=[],u=0,p=e.length;u<p;++u){var c=e[u].split(" "),f=c[c.length-1].toLowerCase();for(var d in"normal"==f||"italic"==f||"oblique"==f?(s=a?s:f,a=!0,c.pop(),f=c[c.length-1].toLowerCase()):$n.test(f)&&(f=f.replace($n,""),s=a?s:c[c.length-1].replace(f,""),a=!0),En){var m=c.length>1?c[c.length-2].toLowerCase():"";if(f==d||f==d.replace("-","")||m+"-"+f==d){i=o?i:En[d],c.pop(),m&&d.startsWith(m)&&c.pop();break}}o||"number"!=typeof f||(i=f,o=!0);var y=c.join(Cn).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==y.indexOf(Cn)&&(y='"'+y+'"'),l.push(y)}n=qn[e]=[s,i,l]}return n[0]+Cn+n[1]+Cn+t+"px"+(r?"/"+r:"")+Cn+n[2]}const Tn=Object.freeze({}),Nn={},Pn={};let On=0;function Fn(e){return e.id||(e.id=On++),e.id}function Dn(e){return e*Math.PI/180}const Ln=function(){const e=[];for(let t=78271.51696402048;e.length<=24;t/=2)e.push(t);return e}();function Rn(e,t){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(e,t);const r=document.createElement("canvas");return r.width=e,r.height=t,r}function Gn(e,t,r,n){const o=[2*r*t.pixelRatio+t.width,2*r*t.pixelRatio+t.height],a=Rn(o[0],o[1]),i=a.getContext("2d");i.drawImage(e,t.x,t.y,t.width,t.height,r*t.pixelRatio,r*t.pixelRatio,t.width,t.height);const s=i.getImageData(0,0,o[0],o[1]);i.globalCompositeOperation="destination-over",i.fillStyle=`rgba(${255*n.r},${255*n.g},${255*n.b},${n.a})`;const l=s.data;for(let e=0,n=s.width;e<n;++e)for(let o=0,a=s.height;o<a;++o){l[4*(o*n+e)+3]>0&&i.arc(e,o,r*t.pixelRatio,0,2*Math.PI)}return i.fill(),a}function Zn(e,t,r){const n=Math.max(0,Math.min(1,(r-e)/(t-e)));return n*n*(3-2*n)}function Un(e,t,r){const n=Rn(t.width,t.height),o=n.getContext("2d");o.drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height);const a=o.getImageData(0,0,t.width,t.height),i=a.data;for(let e=0,t=a.width;e<t;++e)for(let n=0,o=a.height;n<o;++n){const o=4*(n*t+e),a=.75,s=.1,l=Zn(a-s,a+s,i[o+3]/255);l>0?(i[o+0]=Math.round(255*r.r*l),i[o+1]=Math.round(255*r.g*l),i[o+2]=Math.round(255*r.b*l),i[o+3]=Math.round(255*l)):i[o+3]=0}return o.putImageData(a,0,0),n}const Vn=Array(256).join(" ");function Bn(e,t){if(t>=.05){let r="";const n=e.split("\n"),o=Vn.slice(0,Math.round(t/.1));for(let e=0,t=n.length;e<t;++e)e>0&&(r+="\n"),r+=n[e].split("").join(o);return r}return e}let Jn;function Hn(){return Jn||(Jn=Rn(1,1).getContext("2d")),Jn}function Wn(e,t){return Hn().measureText(e).width+(e.length-1)*t}const Xn={};function Yn(e,t,r,n){if(-1!==e.indexOf("\n")){const o=e.split("\n"),a=[];for(let e=0,i=o.length;e<i;++e)a.push(Yn(o[e],t,r,n));return a.join("\n")}const o=r+","+t+","+e+","+n;let a=Xn[o];if(!a){const i=e.split(" ");if(i.length>1){const e=Hn();e.font=t;const o=e.measureText("M").width*r;let s="";const l=[];for(let e=0,t=i.length;e<t;++e){const t=i[e],r=s+(s?" ":"")+t;Wn(r,n)<=o?s=r:(s&&l.push(s),s=t)}s&&l.push(s);for(let e=0,t=l.length;e<t&&t>1;++e){const r=l[e];if(Wn(r,n)<.35*o){const o=e>0?Wn(l[e-1],n):1/0,a=e<t-1?Wn(l[e+1],n):1/0;l.splice(e,1),t-=1,o<a?(l[e-1]+=" "+r,e-=1):l[e]=r+" "+l[e]}}for(let e=0,t=l.length-1;e<t;++e){const r=l[e],a=l[e+1];if(Wn(r,n)>.7*o&&Wn(a,n)<.6*o){const i=r.split(" "),s=i.pop();Wn(s,n)<.2*o&&(l[e]=i.join(" "),l[e+1]=s+" "+a),t-=1}}a=l.join("\n")}else a=e;a=Bn(a,n),Xn[o]=a}return a}A.on("propertychange",()=>{for(const e in Xn)delete Xn[e]});const Kn={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},Qn={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]},eo=function(e,t){let r=en(e,t);if("error"===r.result){const n=An(e);n!==e&&(r=en(n,t))}if("error"===r.result){const n=r.value[0];return console.error("Error parsing expression:",e,n.key,n.message),{evaluate:()=>t.default}}return r.value};let to,ro;function no(e,t,r,n,o,a){const i=e.id;o||(o={},console.warn("No functionCache provided to getValue()")),o[i]||(o[i]={});const s=o[i];if(!s[r]){let n=(e[t]||Tn)[r];const o=Mn[`${t}_${e.type}`]&&Mn[`${t}_${e.type}`][r];void 0===n&&o&&(n=o.default);let a=Xr(n);if(!a&&Hr(n)&&(n=hn(n,o),a=!0),a){const e=eo(n,o);s[r]=e.evaluate.bind(e)}else{const e=o?o.type:typeof n;"color"!==e&&"colorArray"!==e||(n=Oe.parse(n));let t=!1;if("array"===e)for(let e=0;e<n.length;++e){const r=n[e];if(Xr(r)||Hr(r)){t=!0;break}}if(t){const e=Object.assign({},o,{type:o.value}),t=[];for(let r=0;r<n.length;++r){let o=n[r];if(!Xr(o)&&Hr(o)&&(o=hn(o,e)),Xr(o)){const r=eo(o,e);t.push(r.evaluate.bind(r))}else t.push(function(){return o})}s[r]=function(e,r,n){const o=[];for(let a=0;a<t.length;++a)o[a]=t[a](e,r,n);return o}}else s[r]=function(){return n}}}return s[r](jn,n,a)}function oo(e,t,r,n){if(!no(e,"layout",`${r}-allow-overlap`,t,n))return"declutter";return no(e,"layout",`${r}-ignore-placement`,t,n)?"none":"obstacle"}function ao(e,t,r,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(e in n))try{n[e]=sn(t).filter}catch(t){console.warn("Filter will evaluate to false: "+t.message),n[e]=function(){return!1}}return n[e](jn,r)}function io(e,t){if(e){if(0===e.a||0===t)return;const r=e.a;return t=void 0===t?1:t,0===r?"transparent":"rgba("+Math.round(255*e.r/r)+","+Math.round(255*e.g/r)+","+Math.round(255*e.b/r)+","+r*t+")"}return e}const so=/\{[^{}}]*\}/g;function lo(e,t){return e.replace(so,function(e){return t[e.slice(1,-1)]||""})}function uo(e,t){let r=e.split(":")[0];return r===e&&(r="default"),t[r]}const po={};function co(t,n,o,a=Ln,i=void 0,s=void 0,l=void 0,v=void 0){if("string"==typeof n&&(n=JSON.parse(n)),n.schema)for(const e in n.schema){const t=n.schema[e];"default"in t&&(_n[e]=t.default)}if(8!=n.version)throw new Error("glStyle version 8 required.");po[function(e,t){return Fn(e)+"."+_(t)}(n,t)]=Array.from(arguments);const b={};("string"==typeof s||s instanceof Request||s instanceof Response||s instanceof Promise)&&(s={default:s});for(const e in s){const r=s[e];p(()=>r).then(async r=>{let n;if("undefined"!=typeof Image){const o=new Image;if("string"==typeof r)o.crossOrigin="anonymous",o.src=r;else{let e;r instanceof Request?e=await fetch(r):r instanceof Response&&(e=r);const t=await e.blob();n=URL.createObjectURL(t),o.src=n}o.addEventListener("load",function r(){o.removeEventListener("load",r),b[e]={image:o,size:[o.width,o.height]},t.changed(),n&&URL.revokeObjectURL(n)}),o.addEventListener("error",function e(){URL.revokeObjectURL(n),o.removeEventListener("error",e)})}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:r}),t.addEventListener("message",function(t){"imageLoaded"===t.data.action&&t.data.src===r&&(b[e]={image:t.data.image,size:[t.data.image.width,t.data.image.height]})})}})}const x=function(e){e=e.slice();const t=Object.create(null);for(let r=0;r<e.length;r++)t[e[r].id]=e[r];for(let r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=R(e[r],t[e[r].ref]));return e}(n.layers),w={},k=[],z={},M={},S=function(e){let t=Nn[e.id];return t||(t={},Nn[Fn(e)]=t),t}(n),A=function(e){let t=Pn[e.id];return t||(t={},Pn[Fn(e)]=t),t}(n);let j;for(let e=0,t=x.length;e<t;++e){const t=x[e],r=t.id;if("string"==typeof o&&t.source==o||Array.isArray(o)&&-1!==o.indexOf(r)){const o=t["source-layer"];if(j){if(t.source!==j)throw new Error(`Layer "${r}" does not use source "${j}`)}else{j=t.source;const e=n.sources[j];if(!e)throw new Error(`Source "${j}" is not defined`);const r=e.type;if("vector"!==r&&"geojson"!==r)throw new Error(`Source "${j}" is not of type "vector" or "geojson", but "${r}"`)}let a=w[o];a||(a=[],w[o]=a),a.push({layer:t,index:e}),k.push(r)}}const E=[],C=function(o,s,p){const x=t.getSource?.()?.format_?.layerName_??"mvt:layer",k=o.getProperties(),_=w[k[x]];if(!_)return;let j=a.indexOf(s);-1==j&&(j=function(e,t){let r=0;const n=t.length;for(;r<n;++r)if(t[r]<e&&r+1<n){const n=t[r]/t[r+1];return r+Math.log(t[r]/e)/Math.log(n)}return n-1}(s,a)),jn.zoom=j,jn.distanceFromCenter=0;const C=o.getGeometry(),$=Kn[C.getType()],q=t.get("map");if(q&&q instanceof e&&1===$){const e=q.getSize();if(e){const t=q.getView().getCenter(),n=r(C.getExtent());jn.distanceFromCenter=u(t,n)/s/e[1]}}const I={id:o.getId(),properties:k,type:$},T=t.get("mapbox-featurestate")[o.getId()];let N=-1;for(let e=0,r=_.length;e<r;++e){const r=_[e],a=r.layer,u=a.id;if(void 0!==p&&p!==u)continue;const x=a.layout||Tn,w=a.paint||Tn;if("none"===no(a,"layout","visibility",I,S,T)||"minzoom"in a&&j<a.minzoom||"maxzoom"in a&&j>=a.maxzoom)continue;const C=a.filter;if(!C||ao(u,C,I,A)){let e,u,p,A,_,j;const C=r.index;if(3==$&&("fill"==a.type||"fill-extrusion"==a.type))if(u=no(a,"paint",a.type+"-opacity",I,S,T),a.type+"-pattern"in w){const e=no(a,"paint",a.type+"-pattern",I,S,T);if(e){const t="string"==typeof e?lo(e,k):e.toString(),r=uo(t,b);if(i&&i[t]&&r){++N,j=E[N],j&&j.getFill()&&!j.getStroke()&&!j.getText()||(j=new h({fill:new d}),E[N]=j),p=j.getFill(),j.setZIndex(C);const e=t+"."+u;let n=M[e];if(!n){const o=i[t],a=Rn(o.width,o.height),s=a.getContext("2d");s.globalAlpha=u,s.drawImage(r.image,o.x,o.y,o.width,o.height,0,0,o.width,o.height),n=s.createPattern(a,"repeat"),M[e]=n}p.setColor(n)}}}else if(e=io(no(a,"paint",a.type+"-color",I,S,T),u),a.type+"-outline-color"in w&&(_=io(no(a,"paint",a.type+"-outline-color",I,S,T),u)),_||(_=e),e||_){if(++N,j=E[N],(!j||e&&!j.getFill()||!e&&j.getFill()||_&&!j.getStroke()||!_&&j.getStroke()||j.getText())&&(j=new h({fill:e?new d:void 0,stroke:_?new y:void 0}),E[N]=j),e&&(p=j.getFill(),p.setColor(e)),"fill-extrusion"===a.type){const e=no(a,"paint","fill-extrusion-height",I,S,T);if(e>0){const t=Math.max(.1,.9-Math.min(e,225)/280);if(_&&"transparent"!==_){const e=Oe.parse(_);_=`rgba(${Math.round(255*e.r*t)},${Math.round(255*e.g*t)},${Math.round(255*e.b*t)},${e.a})`}}}_&&(A=j.getStroke(),A.setColor(_),A.setWidth(.5)),j.setZIndex(C)}if(1!=$&&"line"==a.type){e="line-pattern"in w?void 0:io(no(a,"paint","line-color",I,S,T),no(a,"paint","line-opacity",I,S,T));const t=no(a,"paint","line-width",I,S,T);e&&t>0&&(++N,j=E[N],j&&j.getStroke()&&!j.getFill()&&!j.getText()||(j=new h({stroke:new y}),E[N]=j),A=j.getStroke(),A.setLineCap(no(a,"layout","line-cap",I,S,T)),A.setLineJoin(no(a,"layout","line-join",I,S,T)),A.setMiterLimit(no(a,"layout","line-miter-limit",I,S,T)),A.setColor(e),A.setWidth(t),A.setLineDash(w["line-dasharray"]?no(a,"paint","line-dasharray",I,S,T).map(function(e){return e*t}):null),"function"==typeof A.setOffset&&A.setOffset(no(a,"paint","line-offset",I,S,T)),j.setZIndex(C))}let q,P,O,F,D,L,R,G,Z,U=!1,V=null,B=0;if((1==$||2==$)&&"icon-image"in x){const e=no(a,"layout","icon-image",I,S,T);if(e){let r;q="string"==typeof e?lo(e,k):e.toString();const n=v?v(t,q):void 0,l=uo(q,b);if(i&&i[q]&&l||n){const e=no(a,"layout","icon-rotation-alignment",I,S,T);if(2==$){const t=o.getGeometry();if(t.getFlatMidpoint||t.getFlatMidpoints){const n=t.getExtent();if(Math.sqrt(Math.max(Math.pow((n[2]-n[0])/s,2),Math.pow((n[3]-n[1])/s,2)))>150){const n="MultiLineString"===t.getType()?t.getFlatMidpoints():t.getFlatMidpoint();ro||(to=[NaN,NaN],ro=new c("Point",to,[],2,{},void 0)),r=ro,to[0]=n[0],to[1]=n[1];if("line"===no(a,"layout","symbol-placement",I,S,T)&&"map"===e){const e=t.getStride(),r=t.getFlatCoordinates();for(let t=0,o=r.length-e;t<o;t+=e){const o=r[t],a=r[t+1],i=r[t+e],s=r[t+e+1],l=Math.min(o,i),u=Math.max(o,i),p=n[0],c=(s-a)*(p-o)-(i-o)*(n[1]-a);if(Math.abs(c)<.001&&p<=u&&p>=l){B=Math.atan2(a-s,i-o);break}}}}}}if(2!==$||r){const t=no(a,"layout","icon-size",I,S,T),o=void 0!==w["icon-color"]?no(a,"paint","icon-color",I,S,T):null;if(!o||0!==o.a){const r=no(a,"paint","icon-halo-color",I,S,T),s=no(a,"paint","icon-halo-width",I,S,T);let u=`${q}.${t}.${s}.${r}`;if(null!==o&&(u+=`.${o}`),P=z[u],!P){const p=oo(a,I,"icon",S);let c;"icon-offset"in x&&(c=no(a,"layout","icon-offset",I,S,T).slice(0),c[0]*=t,c[1]*=-t);let f=o?[255*o.r,255*o.g,255*o.b,o.a]:void 0;if(n){const r={color:f,rotateWithView:"map"===e,displacement:c,declutterMode:p,scale:t};"string"==typeof n?r.src=n:(r.img=n,r.imgSize=[n.width,n.height]),P=new m(r)}else{const n=i[q];let a,u,d;if(s)n.sdf?(a=Gn(Un(l.image,n,o||[0,0,0,1]),{x:0,y:0,width:n.width,height:n.height,pixelRatio:n.pixelRatio},s,r),f=void 0):a=Gn(l.image,n,s,r);else{if(n.sdf&&!l.unSDFed){const e=Un(l.image,{x:0,y:0,width:l.size[0],height:l.size[1]},{r:1,g:1,b:1});l.image=e,l.unSDFed=!0}a=l.image,u=[n.width,n.height],d=[n.x,n.y]}P=new m({color:f,img:a,imgSize:l.size,size:u,offset:d,rotateWithView:"map"===e,scale:t/n.pixelRatio,displacement:c,declutterMode:p})}z[u]=P}}P&&(++N,j=E[N],j&&j.getImage()&&!j.getFill()&&!j.getStroke()||(j=new h,E[N]=j),j.setGeometry(r),P.setRotation(B+Dn(no(a,"layout","icon-rotate",I,S,T))),P.setOpacity(no(a,"paint","icon-opacity",I,S,T)),P.setAnchor(Qn[no(a,"layout","icon-anchor",I,S,T)]),j.setImage(P),V=j.getText(),j.setText(void 0),j.setZIndex(C),U=!0,O=!1)}else O=!0}}}if(1==$&&"circle"===a.type){++N,j=E[N],j&&j.getImage()&&!j.getFill()&&!j.getStroke()||(j=new h,E[N]=j);const e="circle-radius"in w?no(a,"paint","circle-radius",I,S,T):5,t=io(no(a,"paint","circle-stroke-color",I,S,T),no(a,"paint","circle-stroke-opacity",I,S,T)),r=no(a,"paint","circle-translate",I,S,T),n=io(no(a,"paint","circle-color",I,S,T),no(a,"paint","circle-opacity",I,S,T)),o=no(a,"paint","circle-stroke-width",I,S,T),i=e+"."+t+"."+n+"."+o+"."+r[0]+"."+r[1];P=z[i],P||(P=new f({radius:e,displacement:[r[0],-r[1]],stroke:t&&o>0?new y({width:o,color:t}):void 0,fill:n?new d({color:n}):void 0,declutterMode:"none"}),z[i]=P),j.setImage(P),V=j.getText(),j.setText(void 0),j.setGeometry(void 0),j.setZIndex(C),U=!0}if("text-field"in x){R=Math.round(no(a,"layout","text-size",I,S,T));const e=no(a,"layout","text-font",I,S,T);L=no(a,"layout","text-line-height",I,S,T),D=In(l?l(e,n.metadata?n.metadata["ol:webfonts"]:void 0):e,R,L),D.includes("sans-serif")||(D+=",sans-serif"),G=no(a,"layout","text-letter-spacing",I,S,T),Z=no(a,"layout","text-max-width",I,S,T);const t=no(a,"layout","text-field",I,S,T);F="object"==typeof t&&t.sections?1===t.sections.length?t.toString():t.sections.reduce((t,r,n)=>{const o=r.fontStack?r.fontStack.split(","):e,a=In(l?l(o):o,R*(r.scale||1),L);let i=r.text;if("\n"===i)return t.push("\n",""),t;if(2==$)return t.push(Bn(i,G),a),t;i=Yn(i,a,Z,G).split("\n");for(let e=0,r=i.length;e<r;++e)e>0&&t.push("\n",""),t.push(i[e],a);return t},[]):lo(t,k).trim(),u=no(a,"paint","text-opacity",I,S,T)}if(F&&u&&!O){U||(++N,j=E[N],j&&j.getText()&&!j.getFill()&&!j.getStroke()||(j=new h,E[N]=j),j.setImage(void 0),j.setGeometry(void 0));const e=oo(a,I,"text",S);j.getText()||j.setText(V),V=j.getText(),(!V||"getDeclutterMode"in V&&V.getDeclutterMode()!==e)&&(V=new g({padding:[2,2,2,2],declutterMode:e}),j.setText(V));const t=no(a,"layout","text-transform",I,S,T);"uppercase"==t?F=Array.isArray(F)?F.map((e,t)=>t%2?e:e.toUpperCase()):F.toUpperCase():"lowercase"==t&&(F=Array.isArray(F)?F.map((e,t)=>t%2?e:e.toLowerCase()):F.toLowerCase());const r=Array.isArray(F)?F:2==$?Bn(F,G):Yn(F,D,Z,G);if(V.setText(r),V.setFont(D),V.setRotation(Dn(no(a,"layout","text-rotate",I,S,T))),"function"==typeof V.setKeepUpright){const e=no(a,"layout","text-keep-upright",I,S,T);V.setKeepUpright(e)}const n=no(a,"layout","text-anchor",I,S,T),o=U||1==$?"point":no(a,"layout","symbol-placement",I,S,T);let i;if("line-center"===o?(V.setPlacement("line"),i="center"):V.setPlacement(o),"line"===o&&"function"==typeof V.setRepeat){const e=no(a,"layout","symbol-spacing",I,S,T);V.setRepeat(2*e)}V.setOverflow("point"===o);let s=no(a,"paint","text-halo-width",I,S,T);const l=no(a,"layout","text-offset",I,S,T),p=no(a,"paint","text-translate",I,S,T);let c=0,f=0;if("point"==o){i="center",-1!==n.indexOf("left")?(i="left",f=s):-1!==n.indexOf("right")&&(i="right",f=-s);const e=no(a,"layout","text-rotation-alignment",I,S,T);V.setRotateWithView("map"==e)}else V.setMaxAngle(Dn(no(a,"layout","text-max-angle",I,S,T))*F.length/r.length),V.setRotateWithView(!1);V.setTextAlign(i);let m="middle";0==n.indexOf("bottom")?(m="bottom",c=-s-.5*(L-1)*R):0==n.indexOf("top")&&(m="top",c=s+.5*(L-1)*R),V.setTextBaseline(m);const v=no(a,"layout","text-justify",I,S,T);V.setJustify("auto"===v?void 0:v),V.setOffsetX(l[0]*R+f+p[0]),V.setOffsetY(l[1]*R+c+p[1]);const b=V.getFill()||new d;b.setColor(io(no(a,"paint","text-color",I,S,T),u)),V.setFill(b);const x=io(no(a,"paint","text-halo-color",I,S,T),u);if(x&&s>0){const e=V.getStroke()||new y;e.setColor(x),s*=2;const t=.5*R;e.setWidth(s<=t?s:t),V.setStroke(e)}else V.setStroke(void 0);const w=no(a,"layout","text-padding",I,S,T),k=V.getPadding();w!==k[0]&&(k[0]=w,k[1]=w,k[2]=w,k[3]=w),j.setZIndex(C)}}}return N>-1?(E.length=N+1,E):void 0};return t.setStyle(C),t.set("mapbox-layers",k),t.set("mapbox-source",j),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),C}Oe.parse("#000000"),Oe.parse("#FFFFFF"),Oe.parse("#000000");var fo="EPSG:27700";function mo(e,t,r){var n=r&&r(e,t)||{};return fetch(n.url||e,{headers:n.headers||{}})}var yo=e=>(t,r)=>{var n=e(r,"Tile")||{},o=n.url||r,a=n.headers||{};fetch(o,{headers:a}).then(e=>e.blob()).then(e=>{t.getImage().src=URL.createObjectURL(e)}).catch(()=>t.setState(M.ERROR))};function ho(e,t){var r=new l({resolutions:j,origin:C,tileSize:256});return new k({projection:fo,tileGrid:r,tileUrlFunction:t=>{var[r,n,o]=t;return e.replace("{z}",r).replace("{x}",n).replace("{y}",o)},tileLoadFunction:t?yo(t):void 0})}function go(e,t){var r=e.indexOf("?"),[n,o]=r>=0?[e.slice(0,r),e.slice(r)]:[e,""],a="".concat(n,".json").concat(o),i="".concat(n,".png").concat(o);return{jsonUrl:a,pngUrl:i,fetch:()=>mo(a,"SpriteJSON",t).then(e=>e.json())}}function vo(e,t){return bo.apply(this,arguments)}function bo(){return bo=v(function*(e,t){var r=yield mo(e,"Style",t).then(e=>e.json()),o=Object.keys(r.sources)[0],i=r.sources[o].url,u=yield mo(i,"Source",t).then(e=>e.json()),p=[u.fullExtent.xmin,u.fullExtent.ymin,u.fullExtent.xmax,u.fullExtent.ymax],c=[u.tileInfo.origin.x,u.tileInfo.origin.y],f=u.tileInfo.lods.map(e=>e.resolution).slice(0,16),d=u.tileInfo.rows,m=u.tiles[0],y=go(r.sprite,t),h=yield y.fetch();!function(e){e.layers.forEach(e=>{var t;null!==(t=e.paint)&&void 0!==t&&t["icon-color"]&&(e.paint["icon-color"]=e.paint["icon-color"].replace(",0)",",1)"))})}(r);var g=new l({extent:p,origin:c,resolutions:f,tileSize:d}),v=new s({format:new n,url:m,projection:fo,tileGrid:g}),b=new a({source:v,declutter:!0,renderMode:"vector"});return co(b,r,o,f,h,y.pngUrl),{layer:b,source:v}}),bo.apply(this,arguments)}function xo(e,t){return wo.apply(this,arguments)}function wo(){return wo=v(function*(e,t){var r,o=yield mo(e,"Style",t).then(e=>e.json()),i=Object.keys(o.sources)[0],s=o.sources[i].url,u=go(o.sprite,t),p=null===(r=(yield mo(s,"Source",t).then(e=>e.json())).links)||void 0===r?void 0:r.find(e=>"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===e.rel),[c,f]=yield Promise.all([mo(p.href,"Source",t).then(e=>e.json()),u.fetch()]),d=c.tileMatrices.map(e=>e.cellSize),m=c.tileMatrices[0].pointOfOrigin,y=[c.tileMatrices[0].tileHeight,c.tileMatrices[0].tileWidth],h=new n;h.supportedMediaTypes.push("application/octet-stream");var g=new l({resolutions:d,origin:m,tileSize:y}),v=new z({url:s,format:h,tileGrid:g,projection:fo}),b=new a({source:v,declutter:!0,renderMode:"vector"});return co(b,o,i,d,f,u.pngUrl),{layer:b,source:v}}),wo.apply(this,arguments)}function ko(e,t,r){if(null!==e)for(var n,o,a,i,s,l,u,p,c=0,f=0,d=e.type,m="FeatureCollection"===d,y="Feature"===d,h=m?e.features.length:1,g=0;g<h;g++){s=(p=!!(u=m?e.features[g].geometry:y?e.geometry:e)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var v=0;v<s;v++){var b=0,x=0;if(null!==(i=p?u.geometries[v]:u)){l=i.coordinates;var w=i.type;switch(c=0,w){case null:break;case"Point":if(!1===t(l,f,g,b,x))return!1;f++,b++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===t(l[n],f,g,b,x))return!1;f++,"MultiPoint"===w&&b++}"LineString"===w&&b++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(o=0;o<l[n].length-c;o++){if(!1===t(l[n][o],f,g,b,x))return!1;f++}"MultiLineString"===w&&b++,"Polygon"===w&&x++}"Polygon"===w&&b++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(x=0,o=0;o<l[n].length;o++){for(a=0;a<l[n][o].length-c;a++){if(!1===t(l[n][o][a],f,g,b,x))return!1;f++}x++}b++}break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)if(!1===ko(i.geometries[n],t))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var zo=function(e,t={}){if(null!=e.bbox&&!0!==t.recompute)return e.bbox;const r=[1/0,1/0,-1/0,-1/0];return ko(e,e=>{r[0]>e[0]&&(r[0]=e[0]),r[1]>e[1]&&(r[1]=e[1]),r[2]<e[0]&&(r[2]=e[0]),r[3]<e[1]&&(r[3]=e[1])}),r},Mo=e=>{var t=e/1609.344;if(t<.5)return"".concat(Math.round(e),"m");if(t<10){var r=Number.parseFloat(t.toFixed(1)),n=1===r?"mile":"miles";return"".concat(r," ").concat(n)}var o=Math.round(t);return"".concat(o," miles")},So=(e,t,r)=>{var n=r.getTargetElement().getBoundingClientRect();if(!n.width||!n.height)return!1;var o=r.getViewport().getBoundingClientRect(),a=o.width/n.width,i=o.height/n.height,[s,l,u,p]=(e=>zo(e))(e),c=[[s,l],[s,p],[u,l],[u,p]].map(e=>r.getPixelFromCoordinate(e)).filter(Boolean);if(!c.length)return!1;var f=n.left+Math.min(...c.map(e=>e[0]))*a,d=n.left+Math.max(...c.map(e=>e[0]))*a,m=n.top+Math.min(...c.map(e=>e[1]))*i,y=n.top+Math.max(...c.map(e=>e[1]))*i;return f<t.right&&d>t.left&&m<t.bottom&&y>t.top},Ao="EPSG:27700",_o=e=>{if(e){var{top:t=0,right:r=0,bottom:n=0,left:o=0}=e;return[t,r,n,o]}};x.defs(Ao,"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs"),w(x);class jo{constructor(e){var{mapProviderConfig:t={},events:r,eventBus:n}=e;this.events=r,this.eventBus=n,this.capabilities={supportedShortcuts:I,supportsMapSizes:!0},Object.assign(this,t)}initMap(r){var n=this;return v(function*(){var a,i,{container:s,padding:l,mapStyle:u,mapSize:p,center:c,zoom:f,bounds:d,minZoom:m,maxZoom:y,transformRequest:h,pixelRatio:g}=r;n.mapStyleId=null==u?void 0:u.id,n.mapSize=p;var x,w,{events:k,eventBus:z}=n;if("raster"===u.type)w=ho(u.url,h),x=new o({source:w});else if("ogc-vt"===u.type){var M=yield xo(u.url,h);x=M.layer,w=M.source}else{var S=yield vo(u.url,h);x=S.layer,w=S.source}var A=(null!==(a=n.zoomAlignment)&&void 0!==a?a:T)===N?{resolutions:E,defaultMinZoom:6,maxZoom:20}:{resolutions:j,defaultMinZoom:0,maxZoom:j.length-1},_=new t({projection:Ao,center:c,zoom:null!=f?f:A.defaultMinZoom,minZoom:Math.max(null!=m?m:A.defaultMinZoom,A.defaultMinZoom),maxZoom:null!=y?y:A.maxZoom,resolutions:A.resolutions,constrainResolution:!1,padding:_o(l)}),C=new e({target:s,layers:[x],view:_,controls:[],interactions:b({doubleClickZoom:!1}),pixelRatio:g});d&&C.once("rendercomplete",()=>{_.fit(d,{size:C.getSize(),duration:0})}),n.mapEventHandles=F({map:C,source:w,events:k,eventBus:z,getZoom:n.getZoom.bind(n),getCenter:n.getCenter.bind(n),getBounds:n.getBounds.bind(n),getResolution:n.getResolution.bind(n)}),n.appEventHandles=function(e){var{mapProvider:t,layer:r,layerType:n,transformRequest:o,events:a,eventBus:i,map:s}=e,l=function(){var e=v(function*(e){if("raster"===n){var t=ho(e.url,o);r.setSource(t)}else if("ogc-vt"===e.type){var{layer:l}=yield xo(e.url,o);s.getLayers().setAt(0,l)}else{var{layer:u}=yield vo(e.url,o);s.getLayers().setAt(0,u)}i.emit(a.MAP_STYLE_CHANGE,{mapStyleId:e.id})});return function(t){return e.apply(this,arguments)}}(),u=e=>{s.setPixelRatio(e)},p=e=>{var{mapSize:r}=e;t.mapSize=r};return i.on(a.MAP_SET_STYLE,l),i.on(a.MAP_SET_PIXEL_RATIO,u),i.on(a.MAP_SIZE_CHANGE,p),{remove(){i.off(a.MAP_SET_STYLE,l),i.off(a.MAP_SET_PIXEL_RATIO,u),i.off(a.MAP_SIZE_CHANGE,p)}}}({mapProvider:n,layer:x,layerType:null!==(i=u.type)&&void 0!==i?i:"vector",transformRequest:h,events:k,eventBus:z,map:C})||[],n.map=C,n.view=_,n.tileLayer=x,n.source=w,z.emit(k.MAP_READY,{map:n.map,mapStyleId:n.mapStyleId,mapSize:n.mapSize,crs:n.crs})})()}destroyMap(){var e,t;null===(e=this.mapEventHandles)||void 0===e||e.remove(),null===(t=this.appEventHandles)||void 0===t||t.remove(),this.mapEventHandles=null,this.appEventHandles=null,this.map&&(this.map.setTarget(null),this.map=null),this.view=null,this.tileLayer=null,this.source=null}setView(e){var{center:t,zoom:r}=e;this.view.animate({center:null!=t?t:this.view.getCenter(),zoom:null!=r?r:this.view.getZoom(),duration:$})}zoomIn(e){this.view.animate({zoom:this.view.getZoom()+e,duration:$})}zoomOut(e){this.view.animate({zoom:this.view.getZoom()-e,duration:$})}panBy(e){var t=this.view.getCenter(),r=this.view.getResolution();this.view.animate({center:[t[0]+e[0]*r,t[1]-e[1]*r],duration:$})}fitToBounds(e){var t,r=Array.isArray(e)?e:(t=zo(e),i(t,"EPSG:4326","EPSG:27700"));this.view.fit(r,{duration:$})}setPadding(e){this.view.padding=_o(e)}getCenter(){var e=this.view.getCenter(),t=q;return[Math.round(e[0]*Math.pow(10,t))/Math.pow(10,t),Math.round(e[1]*Math.pow(10,t))/Math.pow(10,t)]}getZoom(){return this.view.getZoom()}getBounds(){return this.view.calculateExtent(this.map.getSize()).map(e=>Math.round(100*e)/100)}getFeaturesAtPoint(e,t){return[]}getVisibleFeatures(e){return[]}getAreaDimensions(){return(e=>{if(!e)return"";var[t,r,n,o]=e,a=n-t;return"".concat(Mo(o-r)," by ").concat(Mo(a))})((e=>{var t=e.getSize(),r=e.getView().padding||[0,0,0,0],[n,o,a,i]=r,s=[i,t[1]-a],l=[t[0]-o,n],u=e.getCoordinateFromPixel(s),p=e.getCoordinateFromPixel(l);return u&&p?[u[0],u[1],p[0],p[1]]:null})(this.map))}getCardinalMove(e,t){return((e,t)=>{var r=t[0]-e[0],n=t[1]-e[1],o=[];return Math.abs(n)>1&&o.push("".concat(n>0?"north":"south"," ").concat(Mo(Math.abs(n)))),Math.abs(r)>1&&o.push("".concat(r>0?"east":"west"," ").concat(Mo(Math.abs(r)))),o.join(", ")})(e,t)}getResolution(){return this.view.getResolution()}mapToScreen(e){if(!this.map)return{x:0,y:0};var t=this.map.getPixelFromCoordinate(e);return t?{x:t[0],y:t[1]}:{x:0,y:0}}screenToMap(e){return this.map.getCoordinateFromPixel([e.x,e.y])}isGeometryObscured(e,t){return So(e,t,this.map)}}export{jo as default};
1
+ import e from"ol/Map.js";import t from"ol/View.js";import{getCenter as r}from"ol/extent.js";import"ol/format/GeoJSON.js";import n from"ol/format/MVT.js";import"ol/has.js";import"ol/layer/Group.js";import"ol/layer/Layer.js";import o from"ol/layer/Tile.js";import"ol/layer/Vector.js";import a from"ol/layer/VectorTile.js";import"ol/loadingstrategy.js";import{transformExtent as i}from"ol/proj.js";import"ol/proj/Units.js";import"ol/source/Source.js";import"ol/source/TileJSON.js";import"ol/source/Vector.js";import s from"ol/source/VectorTile.js";import"ol/tilegrid.js";import l from"ol/tilegrid/TileGrid.js";import{distance as u}from"ol/coordinate.js";import{toPromise as p}from"ol/functions.js";import c from"ol/render/Feature.js";import f from"ol/style/Circle.js";import d from"ol/style/Fill.js";import m from"ol/style/Icon.js";import y from"ol/style/Stroke.js";import h from"ol/style/Style.js";import g from"ol/style/Text.js";import"ol/events/Event.js";import"ol/events/EventType.js";import v from"@babel/runtime/helpers/asyncToGenerator";import{defaults as b}from"ol/interaction/defaults.js";import x from"proj4";import{register as w}from"ol/proj/proj4.js";import k from"@babel/runtime/helpers/defineProperty";import z from"ol/source/XYZ.js";import M from"ol/source/OGCVectorTile.js";import S from"ol/TileState.js";import{fromString as A}from"ol/color.js";import"ol/layer/Image.js";import"ol/source/Raster.js";import{checkedFonts as _}from"ol/render/canvas.js";import{getUid as j}from"ol/util.js";var E=[896,448,224,112,56,28,14,7,3.5,1.75,.875,.4375,.21875,.109375],C=[156543.03392800014,78271.51696400007,39135.758482000034,19567.879241000017,9783.939620500008,4891.969810250004,2445.984905125002,1222.992452562501,611.4962262812505,305.74811314062526,152.87405657031263,76.43702828515632,38.21851414257816,19.10925707128908,9.55462853564454,4.77731426782227,2.388657133911135,1.1943285669555674,.5971642834777837,.29858214173889186,.14929107086944593,.07464553543472296,.03732276771736148,.01866138385868074],$=[-238375,1376256],q=300,I=2,P=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"],O="uk",T="world";var N=(e,t)=>{var r=null,n=function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];clearTimeout(r),r=setTimeout(()=>{e(...o)},t)};return n.cancel=()=>{r&&(clearTimeout(r),r=null)},n};function D(e){var{map:t,view:r,emit:n,eventBus:o,events:a,on:i,debouncers:s}=e,l=!1,u=N(()=>{l=!1,n(a.MAP_MOVE_END)},500);s.push(u);var p,c,f,d=(p=()=>n(a.MAP_MOVE),c=10,f=0,function(){var e=Date.now();e-f>=c&&(f=e,p(...arguments))});i(r,"change",()=>{l||(l=!0,o.emit(a.MAP_MOVE_START)),u()}),i(t,"postrender",()=>{l&&d()})}function F(e){var{map:t,source:r,events:n,eventBus:o,getZoom:a,getCenter:i,getBounds:s,getResolution:l}=e,u=!1,p=[],c=[],f=t.getView(),d=e=>{var t=(()=>{if(u)return null;var e=a();return{center:i(),bounds:s(),resolution:l(),zoom:e,isAtMaxZoom:e+.01>=f.getMaxZoom(),isAtMinZoom:e-.01<=f.getMinZoom()}})();t&&o.emit(e,t)},m=(e,t,r)=>{e.on(t,r),p.push([e,t,r])};!function(e){var{source:t,map:r,emit:n,eventBus:o,events:a,on:i}=e,s=!1;i(t,"tileloadend",()=>{s||(s=!0,o.emit(a.MAP_LOADED))}),r.once("rendercomplete",()=>n(a.MAP_FIRST_IDLE))}({source:r,map:t,emit:d,eventBus:o,events:n,on:m}),D({map:t,view:t.getView(),emit:d,eventBus:o,events:n,on:m,debouncers:c}),function(e){var{map:t,eventBus:r,events:n,on:o}=e,a=null;o(t,"pointerdown",e=>{a=e.pixel}),o(t,"click",e=>{if(a){var t=e.pixel[0]-a[0],o=e.pixel[1]-a[1];if(Math.hypot(t,o)>6)return}r.emit(n.MAP_CLICK,{point:{x:e.pixel[0],y:e.pixel[1]},coords:e.coordinate})})}({map:t,eventBus:o,events:n,on:m}),m(t,"postrender",()=>o.emit(n.MAP_RENDER));var y=N(()=>d(n.MAP_DATA_CHANGE),500);return c.push(y),m(r,"tileloadend",y),{remove(){u=!0,c.forEach(e=>e.cancel()),p.forEach(e=>{var[t,r,n]=e;return t.un(r,n)})}}}var L={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},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"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{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:"filter"},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:{},"color-relief":{},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_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},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:"expression_name",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_color-relief","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","feature"]},"property-type":"cross-faded-data-driven"},"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const R=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function G(e,t){const r={};for(const t in e)"ref"!==t&&(r[t]=e[t]);return R.forEach(e=>{e in t&&(r[e]=t[e])}),r}class Z extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class U{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,r]of t)this.bindings[e]=r}concat(e){return new U(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const V={kind:"null"},B={kind:"number"},J={kind:"string"},H={kind:"boolean"},W={kind:"color"},X={kind:"projectionDefinition"},Y={kind:"object"},K={kind:"value"},Q={kind:"collator"},ee={kind:"formatted"},te={kind:"padding"},re={kind:"colorArray"},ne={kind:"numberArray"},oe={kind:"resolvedImage"},ae={kind:"variableAnchorOffsetCollection"};function ie(e,t){return{kind:"array",itemType:e,N:t}}function se(e){if("array"===e.kind){const t=se(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const le=[V,B,J,H,W,X,ee,Y,ie(K),te,ne,re,oe,ae];function ue(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!ue(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of le)if(!ue(e,t))return null}return`Expected ${se(e)} but found ${se(t)} instead.`}function pe(e,t){return t.some(t=>t.kind===e.kind)}function ce(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function fe(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const de=.96422,me=.82521,ye=4/29,he=6/29,ge=3*he*he,ve=he*he*he,be=Math.PI/180,xe=180/Math.PI;function we(e){return(e%=360)<0&&(e+=360),e}function ke([e,t,r,n]){let o,a;const i=Me((.2225045*(e=ze(e))+.7168786*(t=ze(t))+.0606169*(r=ze(r)))/1);e===t&&t===r?o=a=i:(o=Me((.4360747*e+.3850649*t+.1430804*r)/de),a=Me((.0139322*e+.0971045*t+.7141733*r)/me));const s=116*i-16;return[s<0?0:s,500*(o-i),200*(i-a),n]}function ze(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Me(e){return e>ve?Math.pow(e,1/3):e/ge+ye}function Se([e,t,r,n]){let o=(e+16)/116,a=isNaN(t)?o:o+t/500,i=isNaN(r)?o:o-r/200;return o=1*_e(o),a=de*_e(a),i=me*_e(i),[Ae(3.1338561*a-1.6168667*o-.4906146*i),Ae(-.9787684*a+1.9161415*o+.033454*i),Ae(.0719453*a-.2289914*o+1.4052427*i),n]}function Ae(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function _e(e){return e>he?e*e*e:ge*(e-ye)}const je=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Ee(e,t){return je(e,t)?e[t]:void 0}function Ce(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=Ee(Oe,e);if(t){const[e,r,n]=t;return[e/255,r/255,n/255,1]}if(e.startsWith("#")){if(/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let r=1;return[$e(e.slice(r,r+=t)),$e(e.slice(r,r+=t)),$e(e.slice(r,r+=t)),$e(e.slice(r,r+t)||"ff")]}}if(e.startsWith("rgb")){const t=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,r=e.match(t);if(r){const[e,t,n,o,a,i,s,l,u,p,c,f]=r,d=[o||" ",s||" ",p].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){const e=[n,i,u].join(""),r="%%%"===e?100:""===e?255:0;if(r){const e=[Ie(+t/r,0,1),Ie(+a/r,0,1),Ie(+l/r,0,1),c?qe(+c,f):1];if(Pe(e))return e}}return}}const r=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){const[e,t,n,o,a,i,s,l,u]=r,p=[n||" ",a||" ",s].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const e=[+t,Ie(+o,0,100),Ie(+i,0,100),l?qe(+l,u):1];if(Pe(e))return function([e,t,r,n]){function o(n){const o=(n+e/30)%12,a=t*Math.min(r,1-r);return r-a*Math.max(-1,Math.min(o-3,9-o,1))}return e=we(e),t/=100,r/=100,[o(0),o(8),o(4),n]}(e)}}}function $e(e){return parseInt(e.padEnd(2,e),16)/255}function qe(e,t){return Ie(t?e/100:e,0,1)}function Ie(e,t,r){return Math.min(Math.max(t,e),r)}function Pe(e){return!e.some(Number.isNaN)}const Oe={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 Te(e,t,r){return e+r*(t-e)}function Ne(e,t,r){return e.map((e,n)=>Te(e,t[n],r))}class De{constructor(e,t,r,n=1,o=!0){this.r=e,this.g=t,this.b=r,this.a=n,o||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,t,r,n]))}static parse(e){if(e instanceof De)return e;if("string"!=typeof e)return;const t=Ce(e);return t?new De(...t,!1):void 0}get rgb(){const{r:e,g:t,b:r,a:n}=this,o=n||1/0;return this.overwriteGetter("rgb",[e/o,t/o,r/o,n])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,r,n,o]=ke(e),a=Math.sqrt(r*r+n*n);return[Math.round(1e4*a)?we(Math.atan2(n,r)*xe):NaN,a,t,o]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ke(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,r,n]=this.rgb;return`rgba(${[e,t,r].map(e=>Math.round(255*e)).join(",")},${n})`}static interpolate(e,t,r,n="rgb"){switch(n){case"rgb":{const[n,o,a,i]=Ne(e.rgb,t.rgb,r);return new De(n,o,a,i,!1)}case"hcl":{const[n,o,a,i]=e.hcl,[s,l,u,p]=t.hcl;let c,f;if(isNaN(n)||isNaN(s))isNaN(n)?isNaN(s)?c=NaN:(c=s,1!==a&&0!==a||(f=l)):(c=n,1!==u&&0!==u||(f=o));else{let e=s-n;s>n&&e>180?e-=360:s<n&&n-s>180&&(e+=360),c=n+r*e}const[d,m,y,h]=function([e,t,r,n]){return e=isNaN(e)?0:e*be,Se([r,Math.cos(e)*t,Math.sin(e)*t,n])}([c,null!=f?f:Te(o,l,r),Te(a,u,r),Te(i,p,r)]);return new De(d,m,y,h,!1)}case"lab":{const[n,o,a,i]=Se(Ne(e.lab,t.lab,r));return new De(n,o,a,i,!1)}}}}De.black=new De(0,0,0,1),De.white=new De(1,1,1,1),De.transparent=new De(0,0,0,0),De.red=new De(1,0,0,1);class Fe{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Le=["bottom","center","top"];class Re{constructor(e,t,r,n,o,a){this.text=e,this.image=t,this.scale=r,this.fontStack=n,this.textColor=o,this.verticalAlign=a}}class Ge{constructor(e){this.sections=e}static fromString(e){return new Ge([new Re(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(e){return e instanceof Ge?e:Ge.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}}class Ze{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ze)return e;if("number"==typeof e)return new Ze([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Ze(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new Ze(Ne(e.values,t.values,r))}}class Ue{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ue)return e;if("number"==typeof e)return new Ue([e]);if(Array.isArray(e)){for(const t of e)if("number"!=typeof t)return;return new Ue(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new Ue(Ne(e.values,t.values,r))}}class Ve{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ve)return e;if("string"==typeof e){const t=De.parse(e);if(!t)return;return new Ve([t])}if(!Array.isArray(e))return;const t=[];for(const r of e){if("string"!=typeof r)return;const e=De.parse(r);if(!e)return;t.push(e)}return new Ve(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r,n="rgb"){const o=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let a=0;a<e.values.length;a++)o.push(De.interpolate(e.values[a],t.values[a],r,n));return new Ve(o)}}class Be extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Je=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class He{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof He)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){const r=e[t],n=e[t+1];if("string"!=typeof r||!Je.has(r))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new He(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){const n=e.values,o=t.values;if(n.length!==o.length)throw new Be(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const a=[];for(let e=0;e<n.length;e+=2){if(n[e]!==o[e])throw new Be(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${n[e]}, to[${e}]: ${o[e]}`);a.push(n[e]);const[t,i]=n[e+1],[s,l]=o[e+1];a.push([Te(t,s,r),Te(i,l,r)])}return new He(a)}}class We{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new We({name:e,available:!1}):null}}class Xe{constructor(e,t,r){this.from=e,this.to=t,this.transition=r}static interpolate(e,t,r){return new Xe(e,t,r)}static parse(e){return e instanceof Xe?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new Xe(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new Xe(e.from,e.to,e.transition):"string"==typeof e?new Xe(e,e,1):void 0}}function Ye(e,t,r,n){if(!("number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255)){return`Invalid rgba value [${("number"==typeof n?[e,t,r,n]:[e,t,r]).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 [${[e,t,r,n].join(", ")}]: 'a' must be between 0 and 1.`}function Ke(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof Xe||e instanceof De||e instanceof Fe||e instanceof Ge||e instanceof Ze||e instanceof Ue||e instanceof Ve||e instanceof He||e instanceof We)return!0;if(Array.isArray(e)){for(const t of e)if(!Ke(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Ke(e[t]))return!1;return!0}return!1}function Qe(e){if(null===e)return V;if("string"==typeof e)return J;if("boolean"==typeof e)return H;if("number"==typeof e)return B;if(e instanceof De)return W;if(e instanceof Xe)return X;if(e instanceof Fe)return Q;if(e instanceof Ge)return ee;if(e instanceof Ze)return te;if(e instanceof Ue)return ne;if(e instanceof Ve)return re;if(e instanceof He)return ae;if(e instanceof We)return oe;if(Array.isArray(e)){const t=e.length;let r;for(const t of e){const e=Qe(t);if(r){if(r===e)continue;r=K;break}r=e}return ie(r||K,t)}return Y}function et(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof De||e instanceof Xe||e instanceof Ge||e instanceof Ze||e instanceof Ue||e instanceof Ve||e instanceof He||e instanceof We?e.toString():JSON.stringify(e)}class tt{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ke(e[1]))return t.error("invalid value");const r=e[1];let n=Qe(r);const o=t.expectedType;return"array"!==n.kind||0!==n.N||!o||"array"!==o.kind||"number"==typeof o.N&&0!==o.N||(n=o),new tt(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const rt={string:J,number:B,boolean:H,object:Y};class nt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r,n=1;const o=e[0];if("array"===o){let o,a;if(e.length>2){const r=e[1];if("string"!=typeof r||!(r in rt)||"object"===r)return t.error('The item type argument of "array" must be one of string, number, boolean',1);o=rt[r],n++}else o=K;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);a=e[2],n++}r=ie(o,a)}else{if(!rt[o])throw new Error(`Types doesn't contain name = ${o}`);r=rt[o]}const a=[];for(;n<e.length;n++){const r=t.parse(e[n],n,K);if(!r)return null;a.push(r)}return new nt(r,a)}evaluate(e){for(let t=0;t<this.args.length;t++){const r=this.args[t].evaluate(e);if(!ue(this.type,Qe(r)))return r;if(t===this.args.length-1)throw new Be(`Expected value to be of type ${se(this.type)}, but found ${se(Qe(r))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const ot={"to-boolean":H,"to-color":W,"to-number":B,"to-string":J};class at{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[0];if(!ot[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return t.error("Expected one argument.");const n=ot[r],o=[];for(let r=1;r<e.length;r++){const n=t.parse(e[r],r,K);if(!n)return null;o.push(n)}return new at(n,o)}evaluate(e){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(e));case"color":{let t,r;for(const n of this.args){if(t=n.evaluate(e),r=null,t instanceof De)return t;if("string"==typeof t){const r=e.parseColor(t);if(r)return r}else if(Array.isArray(t)&&(r=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Ye(t[0],t[1],t[2],t[3]),!r))return new De(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Be(r||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const r of this.args){t=r.evaluate(e);const n=Ze.parse(t);if(n)return n}throw new Be(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const r of this.args){t=r.evaluate(e);const n=Ue.parse(t);if(n)return n}throw new Be(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const r of this.args){t=r.evaluate(e);const n=Ve.parse(t);if(n)return n}throw new Be(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const r of this.args){t=r.evaluate(e);const n=He.parse(t);if(n)return n}throw new Be(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const r of this.args){if(t=r.evaluate(e),null===t)return 0;const n=Number(t);if(!isNaN(n))return n}throw new Be(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Ge.fromString(et(this.args[0].evaluate(e)));case"resolvedImage":return We.fromString(et(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return et(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const it=["Unknown","Point","LineString","Polygon"];class st{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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?it[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(e){let t=this._parseColorCache.get(e);return t||(t=De.parse(e),this._parseColorCache.set(e,t)),t}}class lt{constructor(e,t,r=[],n,o=new U,a=[]){this.registry=e,this.path=r,this.key=r.map(e=>`[${e}]`).join(""),this.scope=o,this.errors=a,this.expectedType=n,this._isConstant=t}parse(e,t,r,n,o={}){return t?this.concat(t,r,n)._parse(e,o):this._parse(e,o)}_parse(e,t){function r(e,t,r){return"assert"===r?new nt(t,[e]):"coerce"===r?new at(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=e[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 o=this.registry[n];if(o){let n=o.parse(e,this);if(!n)return null;if(this.expectedType){const e=this.expectedType,o=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==o.kind){if("projectionDefinition"===e.kind&&["string","array"].includes(o.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(o.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(o.kind)||"colorArray"===e.kind&&["value","string","array"].includes(o.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(o.kind))n=r(n,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,o))return null}else n=r(n,e,t.typeAnnotation||"assert")}if(!(n instanceof tt)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const e=new st;try{n=new tt(n.type,n.evaluate(e))}catch(e){return this.error(e.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===e?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,r){const n="number"==typeof e?this.path.concat(e):this.path,o=r?this.scope.concat(r):this.scope;return new lt(this.registry,this._isConstant,n,t||null,o,this.errors)}error(e,...t){const r=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new Z(r,e))}checkSubtype(e,t){const r=ue(e,t);return r&&this.error(r),r}}class ut{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const r=[];for(let n=1;n<e.length-1;n+=2){const o=e[n];if("string"!=typeof o)return t.error(`Expected string, but found ${typeof o} instead.`,n);if(/[^a-zA-Z0-9_]/.test(o))return t.error("Variable names must contain only alphanumeric characters or '_'.",n);const a=t.parse(e[n+1],n+1);if(!a)return null;r.push([o,a])}const n=t.parse(e[e.length-1],e.length-1,t.expectedType,r);return n?new ut(r,n):null}outputDefined(){return this.result.outputDefined()}}class pt{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const r=e[1];return t.scope.has(r)?new pt(r,t.scope.get(r)):t.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class ct{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,B),n=t.parse(e[2],2,ie(t.expectedType||K));if(!r||!n)return null;const o=n.type;return new ct(o.itemType,r,n)}evaluate(e){const t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new Be(`Array index out of bounds: ${t} < 0.`);if(t>=r.length)throw new Be(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t!==Math.floor(t))throw new Be(`Array index must be an integer, but found ${t} instead.`);return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class ft{constructor(e,t){this.type=H,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,K),n=t.parse(e[2],2,K);return r&&n?pe(r.type,[H,J,B,V,K])?new ft(r,n):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${se(r.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!r)return!1;if(!ce(t,["boolean","string","number","null"]))throw new Be(`Expected first argument to be of type boolean, string, number or null, but found ${se(Qe(t))} instead.`);if(!ce(r,["string","array"]))throw new Be(`Expected second argument to be of type array or string, but found ${se(Qe(r))} instead.`);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class dt{constructor(e,t,r){this.type=B,this.needle=e,this.haystack=t,this.fromIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,K),n=t.parse(e[2],2,K);if(!r||!n)return null;if(!pe(r.type,[H,J,B,V,K]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${se(r.type)} instead`);if(4===e.length){const o=t.parse(e[3],3,B);return o?new dt(r,n,o):null}return new dt(r,n)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!ce(t,["boolean","string","number","null"]))throw new Be(`Expected first argument to be of type boolean, string, number or null, but found ${se(Qe(t))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),ce(r,["string"])){const e=r.indexOf(t,n);return-1===e?-1:[...r.slice(0,e)].length}if(ce(r,["array"]))return r.indexOf(t,n);throw new Be(`Expected second argument to be of type array or string, but found ${se(Qe(r))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class mt{constructor(e,t,r,n,o,a){this.inputType=e,this.type=t,this.input=r,this.cases=n,this.outputs=o,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let r,n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const o={},a=[];for(let i=2;i<e.length-1;i+=2){let s=e[i];const l=e[i+1];Array.isArray(s)||(s=[s]);const u=t.concat(i);if(0===s.length)return u.error("Expected at least one branch label.");for(const e of s){if("number"!=typeof e&&"string"!=typeof e)return u.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,Qe(e)))return null}else r=Qe(e);if(void 0!==o[String(e)])return u.error("Branch labels must be unique.");o[String(e)]=a.length}const p=t.parse(l,i,n);if(!p)return null;n=n||p.type,a.push(p)}const i=t.parse(e[1],1,K);if(!i)return null;const s=t.parse(e[e.length-1],e.length-1,n);return s?"value"!==i.type.kind&&t.concat(1).checkSubtype(r,i.type)?null:new mt(r,n,i,o,a,s):null}evaluate(e){const t=this.input.evaluate(e);return(Qe(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class yt{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n=[];for(let o=1;o<e.length-1;o+=2){const a=t.parse(e[o],o,H);if(!a)return null;const i=t.parse(e[o+1],o+1,r);if(!i)return null;n.push([a,i]),r=r||i.type}const o=t.parse(e[e.length-1],e.length-1,r);if(!o)return null;if(!r)throw new Error("Can't infer output type");return new yt(r,n,o)}evaluate(e){for(const[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class ht{constructor(e,t,r,n){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,K),n=t.parse(e[2],2,B);if(!r||!n)return null;if(!pe(r.type,[ie(K),J,K]))return t.error(`Expected first argument to be of type array or string, but found ${se(r.type)} instead`);if(4===e.length){const o=t.parse(e[3],3,B);return o?new ht(r.type,r,n,o):null}return new ht(r.type,r,n)}evaluate(e){const t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);let n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),ce(t,["string"]))return[...t].slice(r,n).join("");if(ce(t,["array"]))return t.slice(r,n);throw new Be(`Expected first argument to be of type array or string, but found ${se(Qe(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function gt(e,t){const r=e.length-1;let n,o,a=0,i=r,s=0;for(;a<=i;)if(s=Math.floor((a+i)/2),n=e[s],o=e[s+1],n<=t){if(s===r||t<o)return s;a=s+1}else{if(!(n>t))throw new Be("Input is not a number.");i=s-1}return 0}class vt{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of r)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const r=t.parse(e[1],1,B);if(!r)return null;const n=[];let o=null;t.expectedType&&"value"!==t.expectedType.kind&&(o=t.expectedType);for(let r=1;r<e.length;r+=2){const a=1===r?-1/0:e[r],i=e[r+1],s=r,l=r+1;if("number"!=typeof a)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(n.length&&n[n.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const u=t.parse(i,l,o);if(!u)return null;o=o||u.type,n.push([a,u])}return new vt(o,r,n)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);const o=t.length;if(n>=t[o-1])return r[o-1].evaluate(e);return r[gt(t,n)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xt,wt;var kt=function(){if(wt)return xt;function e(e,t,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=n}return wt=1,xt=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var o=this.sampleCurveX(r)-e;if(Math.abs(o)<t)return r;var a=this.sampleCurveDerivativeX(r);if(Math.abs(a)<1e-6)break;r-=o/a}var i=0,s=1;for(r=e,n=0;n<20&&(o=this.sampleCurveX(r),!(Math.abs(o-e)<t));n++)e>o?i=r:s=r,r=.5*(s-i)+i;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},xt}(),zt=bt(kt);class Mt{constructor(e,t,r,n,o){this.type=e,this.operator=t,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[e,t]of o)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,r,n){let o=0;if("exponential"===e.name)o=St(t,e.base,r,n);else if("linear"===e.name)o=St(t,1,r,n);else if("cubic-bezier"===e.name){const a=e.controlPoints;o=new zt(a[0],a[1],a[2],a[3]).solve(St(t,1,r,n))}return o}static parse(e,t){let[r,n,o,...a]=e;if(!Array.isArray(n)||0===n.length)return t.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const e=n[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:e}}else{if("cubic-bezier"!==n[0])return t.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const e=n.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,B),!o)return null;const i=[];let s=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||t.expectedType==re?t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType):s=W;for(let e=0;e<a.length;e+=2){const r=a[e],n=a[e+1],o=e+3,l=e+4;if("number"!=typeof r)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(i.length&&i[i.length-1][0]>=r)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);const u=t.parse(n,l,s);if(!u)return null;s=s||u.type,i.push([r,u])}return fe(s,B)||fe(s,X)||fe(s,W)||fe(s,te)||fe(s,ne)||fe(s,re)||fe(s,ae)||fe(s,ie(B))?new Mt(s,r,n,o,i):t.error(`Type ${se(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);const o=t.length;if(n>=t[o-1])return r[o-1].evaluate(e);const a=gt(t,n),i=t[a],s=t[a+1],l=Mt.interpolationFactor(this.interpolation,n,i,s),u=r[a].evaluate(e),p=r[a+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Te(u,p,l);case"color":return De.interpolate(u,p,l);case"padding":return Ze.interpolate(u,p,l);case"colorArray":return Ve.interpolate(u,p,l);case"numberArray":return Ue.interpolate(u,p,l);case"variableAnchorOffsetCollection":return He.interpolate(u,p,l);case"array":return Ne(u,p,l);case"projectionDefinition":return Xe.interpolate(u,p,l)}case"interpolate-hcl":switch(this.type.kind){case"color":return De.interpolate(u,p,l,"hcl");case"colorArray":return Ve.interpolate(u,p,l,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return De.interpolate(u,p,l,"lab");case"colorArray":return Ve.interpolate(u,p,l,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function St(e,t,r,n){const o=n-r,a=e-r;return 0===o?0:1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1)}class At{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r=null;const n=t.expectedType;n&&"value"!==n.kind&&(r=n);const o=[];for(const n of e.slice(1)){const e=t.parse(n,1+o.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,o.push(e)}if(!r)throw new Error("No output type");const a=n&&o.some(e=>ue(n,e.type));return new At(a?K:r,o)}evaluate(e){let t,r=null,n=0;for(const o of this.args)if(n++,r=o.evaluate(e),r&&r instanceof We&&!r.available&&(t||(t=r.name),r=null,n===this.args.length&&(r=t)),null!==r)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function _t(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function jt(e,t,r,n){return 0===n.compare(t,r)}function Et(e,t,r){const n="=="!==e&&"!="!==e;return class o{constructor(e,t,r){this.type=H,this.lhs=e,this.rhs=t,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const r=e[0];let a=t.parse(e[1],1,K);if(!a)return null;if(!_t(r,a.type))return t.concat(1).error(`"${r}" comparisons are not supported for type '${se(a.type)}'.`);let i=t.parse(e[2],2,K);if(!i)return null;if(!_t(r,i.type))return t.concat(2).error(`"${r}" comparisons are not supported for type '${se(i.type)}'.`);if(a.type.kind!==i.type.kind&&"value"!==a.type.kind&&"value"!==i.type.kind)return t.error(`Cannot compare types '${se(a.type)}' and '${se(i.type)}'.`);n&&("value"===a.type.kind&&"value"!==i.type.kind?a=new nt(i.type,[a]):"value"!==a.type.kind&&"value"===i.type.kind&&(i=new nt(a.type,[i])));let s=null;if(4===e.length){if("string"!==a.type.kind&&"string"!==i.type.kind&&"value"!==a.type.kind&&"value"!==i.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,Q),!s)return null}return new o(a,i,s)}evaluate(o){const a=this.lhs.evaluate(o),i=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){const t=Qe(a),r=Qe(i);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new Be(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const e=Qe(a),r=Qe(i);if("string"!==e.kind||"string"!==r.kind)return t(o,a,i)}return this.collator?r(o,a,i,this.collator.evaluate(o)):t(o,a,i)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const Ct=Et("==",function(e,t,r){return t===r},jt),$t=Et("!=",function(e,t,r){return t!==r},function(e,t,r,n){return!jt(0,t,r,n)}),qt=Et("<",function(e,t,r){return t<r},function(e,t,r,n){return n.compare(t,r)<0}),It=Et(">",function(e,t,r){return t>r},function(e,t,r,n){return n.compare(t,r)>0}),Pt=Et("<=",function(e,t,r){return t<=r},function(e,t,r,n){return n.compare(t,r)<=0}),Ot=Et(">=",function(e,t,r){return t>=r},function(e,t,r,n){return n.compare(t,r)>=0});class Tt{constructor(e,t,r){this.type=Q,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const r=e[1];if("object"!=typeof r||Array.isArray(r))return t.error("Collator options argument must be an object.");const n=t.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,H);if(!n)return null;const o=t.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,H);if(!o)return null;let a=null;return r.locale&&(a=t.parse(r.locale,1,J),!a)?null:new Tt(n,o,a)}evaluate(e){return new Fe(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Nt{constructor(e,t,r,n,o,a){this.type=J,this.number=e,this.locale=t,this.currency=r,this.unit=n,this.minFractionDigits=o,this.maxFractionDigits=a}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const r=t.parse(e[1],1,B);if(!r)return null;const n=e[2];if("object"!=typeof n||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let o=null;if(n.locale&&(o=t.parse(n.locale,1,J),!o))return null;let a=null;if(n.currency&&(a=t.parse(n.currency,1,J),!a))return null;let i=null;if(n.unit&&(i=t.parse(n.unit,1,J),!i))return null;if(a&&i)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let s=null;if(n["min-fraction-digits"]&&(s=t.parse(n["min-fraction-digits"],1,B),!s))return null;let l=null;return n["max-fraction-digits"]&&(l=t.parse(n["max-fraction-digits"],1,B),!l)?null:new Nt(r,o,a,i,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Dt{constructor(e){this.type=ee,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return t.error("First argument must be an image or text section.");const n=[];let o=!1;for(let r=1;r<=e.length-1;++r){const a=e[r];if(o&&"object"==typeof a&&!Array.isArray(a)){o=!1;let e=null;if(a["font-scale"]&&(e=t.parse(a["font-scale"],1,B),!e))return null;let r=null;if(a["text-font"]&&(r=t.parse(a["text-font"],1,ie(J)),!r))return null;let i=null;if(a["text-color"]&&(i=t.parse(a["text-color"],1,W),!i))return null;let s=null;if(a["vertical-align"]){if("string"==typeof a["vertical-align"]&&!Le.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(s=t.parse(a["vertical-align"],1,J),!s)return null}const l=n[n.length-1];l.scale=e,l.font=r,l.textColor=i,l.verticalAlign=s}else{const a=t.parse(e[r],1,K);if(!a)return null;const i=a.type.kind;if("string"!==i&&"value"!==i&&"null"!==i&&"resolvedImage"!==i)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,n.push({content:a,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Dt(n)}evaluate(e){return new Ge(this.sections.map(t=>{const r=t.content.evaluate(e);return Qe(r)===oe?new Re("",r,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new Re(et(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class Ft{constructor(e){this.type=oe,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const r=t.parse(e[1],1,J);return r?new Ft(r):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),r=We.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r}eachChild(e){e(this.input)}outputDefined(){return!1}}class Lt{constructor(e){this.type=B,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=t.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?t.error(`Expected argument of type string or array, but found ${se(r.type)} instead.`):new Lt(r):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new Be(`Expected value to be of type string or array, but found ${se(Qe(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Rt=8192;function Gt(e,t){const r=(180+e[0])/360;const n=(o=e[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360);var o;const a=Math.pow(2,t.z);return[Math.round(r*a*Rt),Math.round(n*a*Rt)]}function Zt(e,t){const r=Math.pow(2,t.z),n=(e[0]/Rt+t.x)/r,o=(e[1]/Rt+t.y)/r;return[(i=n,360*i-180),(a=o,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,i}function Ut(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Vt(e,t){return!(e[0]<=t[0])&&(!(e[2]>=t[2])&&(!(e[1]<=t[1])&&!(e[3]>=t[3])))}function Bt(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Jt(e,t,r){const n=e[0]-t[0],o=e[1]-t[1],a=e[0]-r[0],i=e[1]-r[1];return n*i-a*o===0&&n*a<=0&&o*i<=0}function Ht(e,t,r,n){const o=[t[0]-e[0],t[1]-e[1]],a=[n[0]-r[0],n[1]-r[1]];return 0!==(i=a)[0]*(s=o)[1]-i[1]*s[0]&&!(!er(e,t,r,n)||!er(r,n,e,t));var i,s}function Wt(e,t,r){for(const n of r)for(let r=0;r<n.length-1;++r)if(Ht(e,t,n[r],n[r+1]))return!0;return!1}function Xt(e,t,r=!1){let n=!1;for(const o of t)for(let t=0;t<o.length-1;t++){if(Jt(e,o[t],o[t+1]))return r;Bt(e,o[t],o[t+1])&&(n=!n)}return n}function Yt(e,t){for(const r of t)if(Xt(e,r))return!0;return!1}function Kt(e,t){for(const r of e)if(!Xt(r,t))return!1;for(let r=0;r<e.length-1;++r)if(Wt(e[r],e[r+1],t))return!1;return!0}function Qt(e,t){for(const r of t)if(Kt(e,r))return!0;return!1}function er(e,t,r,n){const o=e[0]-r[0],a=e[1]-r[1],i=t[0]-r[0],s=t[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],p=o*u-l*a,c=i*u-l*s;return p>0&&c<0||p<0&&c>0}function tr(e,t,r){const n=[];for(let o=0;o<e.length;o++){const a=[];for(let n=0;n<e[o].length;n++){const i=Gt(e[o][n],r);Ut(t,i),a.push(i)}n.push(a)}return n}function rr(e,t,r){const n=[];for(let o=0;o<e.length;o++){const a=tr(e[o],t,r);n.push(a)}return n}function nr(e,t,r,n){if(e[0]<r[0]||e[0]>r[2]){const t=.5*n;let o=e[0]-r[0]>t?-n:r[0]-e[0]>t?n:0;0===o&&(o=e[0]-r[2]>t?-n:r[2]-e[0]>t?n:0),e[0]+=o}Ut(t,e)}function or(e,t,r,n){const o=Math.pow(2,n.z)*Rt,a=[n.x*Rt,n.y*Rt],i=[];for(const n of e)for(const e of n){const n=[e.x+a[0],e.y+a[1]];nr(n,t,r,o),i.push(n)}return i}function ar(e,t,r,n){const o=Math.pow(2,n.z)*Rt,a=[n.x*Rt,n.y*Rt],i=[];for(const r of e){const e=[];for(const n of r){const r=[n.x+a[0],n.y+a[1]];Ut(t,r),e.push(r)}i.push(e)}if(t[2]-t[0]<=o/2){!function(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}(t);for(const e of i)for(const n of e)nr(n,t,r,o)}return i}class ir{constructor(e,t){this.type=H,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ke(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const r of t.features){const{type:t,coordinates:n}=r.geometry;"Polygon"===t&&e.push(n),"MultiPolygon"===t&&e.push(...n)}if(e.length){return new ir(t,{type:"MultiPolygon",coordinates:e})}}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new ir(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new ir(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=e.canonicalID();if("Polygon"===t.type){const a=tr(t.coordinates,n,o),i=or(e.geometry(),r,n,o);if(!Vt(r,n))return!1;for(const e of i)if(!Xt(e,a))return!1}if("MultiPolygon"===t.type){const a=rr(t.coordinates,n,o),i=or(e.geometry(),r,n,o);if(!Vt(r,n))return!1;for(const e of i)if(!Yt(e,a))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=e.canonicalID();if("Polygon"===t.type){const a=tr(t.coordinates,n,o),i=ar(e.geometry(),r,n,o);if(!Vt(r,n))return!1;for(const e of i)if(!Kt(e,a))return!1}if("MultiPolygon"===t.type){const a=rr(t.coordinates,n,o),i=ar(e.geometry(),r,n,o);if(!Vt(r,n))return!1;for(const e of i)if(!Qt(e,a))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class sr{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,n=t[e];for(;e>0;){const o=e-1>>1,a=t[o];if(r(n,a)>=0)break;t[e]=a,e=o}t[e]=n}_down(e){const{data:t,compare:r}=this,n=this.length>>1,o=t[e];for(;e<n;){let n=1+(e<<1);const a=n+1;if(a<this.length&&r(t[a],t[n])<0&&(n=a),r(t[n],o)>=0)break;t[e]=t[n],e=n}t[e]=o}}function lr(e){let t=0;for(let r,n,o=0,a=e.length,i=a-1;o<a;i=o++)r=e[o],n=e[i],t+=(n.x-r.x)*(r.y+n.y);return t}const ur=1/298.257223563,pr=ur*(2-ur),cr=Math.PI/180;class fr{constructor(e){const t=6378.137*cr*1e3,r=Math.cos(e*cr),n=1/(1-pr*(1-r*r)),o=Math.sqrt(n);this.kx=t*o*r,this.ky=t*o*n*(1-pr)}distance(e,t){const r=this.wrap(e[0]-t[0])*this.kx,n=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+n*n)}pointOnLine(e,t){let r,n,o,a,i=1/0;for(let s=0;s<e.length-1;s++){let l=e[s][0],u=e[s][1],p=this.wrap(e[s+1][0]-l)*this.kx,c=(e[s+1][1]-u)*this.ky,f=0;0===p&&0===c||(f=(this.wrap(t[0]-l)*this.kx*p+(t[1]-u)*this.ky*c)/(p*p+c*c),f>1?(l=e[s+1][0],u=e[s+1][1]):f>0&&(l+=p/this.kx*f,u+=c/this.ky*f)),p=this.wrap(t[0]-l)*this.kx,c=(t[1]-u)*this.ky;const d=p*p+c*c;d<i&&(i=d,r=l,n=u,o=s,a=f)}return{point:[r,n],index:o,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function dr(e,t){return t[0]-e[0]}function mr(e){return e[1]-e[0]+1}function yr(e,t){return e[1]>=e[0]&&e[1]<t}function hr(e,t){if(e[0]>e[1])return[null,null];const r=mr(e);if(t){if(2===r)return[e,null];const t=Math.floor(r/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===r)return[e,null];const n=Math.floor(r/2)-1;return[[e[0],e[0]+n],[e[0]+n+1,e[1]]]}function gr(e,t){if(!yr(t,e.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let n=t[0];n<=t[1];++n)Ut(r,e[n]);return r}function vr(e){const t=[1/0,1/0,-1/0,-1/0];for(const r of e)for(const e of r)Ut(t,e);return t}function br(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function xr(e,t,r){if(!br(e)||!br(t))return NaN;let n=0,o=0;return e[2]<t[0]&&(n=t[0]-e[2]),e[0]>t[2]&&(n=e[0]-t[2]),e[1]>t[3]&&(o=e[1]-t[3]),e[3]<t[1]&&(o=t[1]-e[3]),r.distance([0,0],[n,o])}function wr(e,t,r){const n=r.pointOnLine(t,e);return r.distance(e,n.point)}function kr(e,t,r,n,o){const a=Math.min(wr(e,[r,n],o),wr(t,[r,n],o)),i=Math.min(wr(r,[e,t],o),wr(n,[e,t],o));return Math.min(a,i)}function zr(e,t,r,n,o){if(!(yr(t,e.length)&&yr(n,r.length)))return 1/0;let a=1/0;for(let i=t[0];i<t[1];++i){const t=e[i],s=e[i+1];for(let e=n[0];e<n[1];++e){const n=r[e],i=r[e+1];if(Ht(t,s,n,i))return 0;a=Math.min(a,kr(t,s,n,i,o))}}return a}function Mr(e,t,r,n,o){if(!(yr(t,e.length)&&yr(n,r.length)))return NaN;let a=1/0;for(let i=t[0];i<=t[1];++i)for(let t=n[0];t<=n[1];++t)if(a=Math.min(a,o.distance(e[i],r[t])),0===a)return a;return a}function Sr(e,t,r){if(Xt(e,t,!0))return 0;let n=1/0;for(const o of t){const t=o[0],a=o[o.length-1];if(t!==a&&(n=Math.min(n,wr(e,[a,t],r)),0===n))return n;const i=r.pointOnLine(o,e);if(n=Math.min(n,r.distance(e,i.point)),0===n)return n}return n}function Ar(e,t,r,n){if(!yr(t,e.length))return NaN;for(let n=t[0];n<=t[1];++n)if(Xt(e[n],r,!0))return 0;let o=1/0;for(let a=t[0];a<t[1];++a){const t=e[a],i=e[a+1];for(const e of r)for(let r=0,a=e.length,s=a-1;r<a;s=r++){const a=e[s],l=e[r];if(Ht(t,i,a,l))return 0;o=Math.min(o,kr(t,i,a,l,n))}}return o}function _r(e,t){for(const r of e)for(const e of r)if(Xt(e,t,!0))return!0;return!1}function jr(e,t,r,n=1/0){const o=vr(e),a=vr(t);if(n!==1/0&&xr(o,a,r)>=n)return n;if(Vt(o,a)){if(_r(e,t))return 0}else if(_r(t,e))return 0;let i=1/0;for(const n of e)for(let e=0,o=n.length,a=o-1;e<o;a=e++){const o=n[a],s=n[e];for(const e of t)for(let t=0,n=e.length,a=n-1;t<n;a=t++){const n=e[a],l=e[t];if(Ht(o,s,n,l))return 0;i=Math.min(i,kr(o,s,n,l,r))}}return i}function Er(e,t,r,n,o,a){if(!a)return;const i=xr(gr(n,a),o,r);i<t&&e.push([i,a,[0,0]])}function Cr(e,t,r,n,o,a,i){if(!a||!i)return;const s=xr(gr(n,a),gr(o,i),r);s<t&&e.push([s,a,i])}function $r(e,t,r,n,o=1/0){let a=Math.min(n.distance(e[0],r[0][0]),o);if(0===a)return a;const i=new sr([[0,[0,e.length-1],[0,0]]],dr),s=vr(r);for(;i.length>0;){const o=i.pop();if(o[0]>=a)continue;const l=o[1],u=t?50:100;if(mr(l)<=u){if(!yr(l,e.length))return NaN;if(t){const t=Ar(e,l,r,n);if(isNaN(t)||0===t)return t;a=Math.min(a,t)}else for(let t=l[0];t<=l[1];++t){const o=Sr(e[t],r,n);if(a=Math.min(a,o),0===a)return 0}}else{const r=hr(l,t);Er(i,a,n,e,s,r[0]),Er(i,a,n,e,s,r[1])}}return a}function qr(e,t,r,n,o,a=1/0){let i=Math.min(a,o.distance(e[0],r[0]));if(0===i)return i;const s=new sr([[0,[0,e.length-1],[0,r.length-1]]],dr);for(;s.length>0;){const a=s.pop();if(a[0]>=i)continue;const l=a[1],u=a[2],p=t?50:100,c=n?50:100;if(mr(l)<=p&&mr(u)<=c){if(!yr(l,e.length)&&yr(u,r.length))return NaN;let a;if(t&&n)a=zr(e,l,r,u,o),i=Math.min(i,a);else if(t&&!n){const t=e.slice(l[0],l[1]+1);for(let e=u[0];e<=u[1];++e)if(a=wr(r[e],t,o),i=Math.min(i,a),0===i)return i}else if(!t&&n){const t=r.slice(u[0],u[1]+1);for(let r=l[0];r<=l[1];++r)if(a=wr(e[r],t,o),i=Math.min(i,a),0===i)return i}else a=Mr(e,l,r,u,o),i=Math.min(i,a)}else{const a=hr(l,t),p=hr(u,n);Cr(s,i,o,e,r,a[0],p[0]),Cr(s,i,o,e,r,a[0],p[1]),Cr(s,i,o,e,r,a[1],p[0]),Cr(s,i,o,e,r,a[1],p[1])}}return i}function Ir(e,t){const r=e.geometry();if(0===r.length||0===r[0].length)return NaN;const n=function(e){if(e.length<=1)return[e];const t=[];let r,n;for(const o of e){const e=lr(o);0!==e&&(o.area=Math.abs(e),void 0===n&&(n=e<0),n===e<0?(r&&t.push(r),r=[o]):r.push(o))}return r&&t.push(r),t}(r).map(t=>t.map(t=>t.map(t=>Zt([t.x,t.y],e.canonical)))),o=new fr(n[0][0][0][1]);let a=1/0;for(const e of t)for(const t of n){switch(e.type){case"Point":a=Math.min(a,$r([e.coordinates],!1,t,o,a));break;case"LineString":a=Math.min(a,$r(e.coordinates,!0,t,o,a));break;case"Polygon":a=Math.min(a,jr(t,e.coordinates,o,a))}if(0===a)return a}return a}function Pr(e){return"MultiPolygon"===e.type?e.coordinates.map(e=>({type:"Polygon",coordinates:e})):"MultiLineString"===e.type?e.coordinates.map(e=>({type:"LineString",coordinates:e})):"MultiPoint"===e.type?e.coordinates.map(e=>({type:"Point",coordinates:e})):[e]}class Or{constructor(e,t){this.type=B,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ke(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new Or(t,t.features.map(e=>Pr(e.geometry)).flat());if("Feature"===t.type)return new Or(t,Pr(t.geometry));if("type"in t&&"coordinates"in t)return new Or(t,Pr(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const r=e.geometry(),n=r.flat().map(t=>Zt([t.x,t.y],e.canonical));if(0===r.length)return NaN;const o=new fr(n[0][1]);let a=1/0;for(const e of t){switch(e.type){case"Point":a=Math.min(a,qr(n,!1,[e.coordinates],!1,o,a));break;case"LineString":a=Math.min(a,qr(n,!1,e.coordinates,!0,o,a));break;case"Polygon":a=Math.min(a,$r(n,!1,e.coordinates,o,a))}if(0===a)return a}return a}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const r=e.geometry(),n=r.flat().map(t=>Zt([t.x,t.y],e.canonical));if(0===r.length)return NaN;const o=new fr(n[0][1]);let a=1/0;for(const e of t){switch(e.type){case"Point":a=Math.min(a,qr(n,!0,[e.coordinates],!1,o,a));break;case"LineString":a=Math.min(a,qr(n,!0,e.coordinates,!0,o,a));break;case"Polygon":a=Math.min(a,$r(n,!0,e.coordinates,o,a))}if(0===a)return a}return a}(e,this.geometries);if("Polygon"===e.geometryType())return Ir(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Tr{constructor(e){this.type=K,this.key=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=e[1];return null==r?t.error("Global state property must be defined."):"string"!=typeof r?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new Tr(r)}evaluate(e){var t;const r=null===(t=e.globals)||void 0===t?void 0:t.globalState;return r&&0!==Object.keys(r).length?Ee(r,this.key):null}eachChild(){}outputDefined(){return!1}}const Nr={"==":Ct,"!=":$t,">":It,"<":qt,">=":Ot,"<=":Pt,array:nt,at:ct,boolean:nt,case:yt,coalesce:At,collator:Tt,format:Dt,image:Ft,in:ft,"index-of":dt,interpolate:Mt,"interpolate-hcl":Mt,"interpolate-lab":Mt,length:Lt,let:ut,literal:tt,match:mt,number:nt,"number-format":Nt,object:nt,slice:ht,step:vt,string:nt,"to-boolean":at,"to-color":at,"to-number":at,"to-string":at,var:pt,within:ir,distance:Or,"global-state":Tr};class Dr{constructor(e,t,r,n){this.name=e,this.type=t,this._evaluate=r,this.args=n}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const r=e[0],n=Dr.definitions[r];if(!n)return t.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(n)?n[0]:n.type,a=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,i=a.filter(([t])=>!Array.isArray(t)||t.length===e.length-1);let s=null;for(const[n,a]of i){s=new lt(t.registry,Zr,t.path,null,t.scope);const i=[];let l=!1;for(let t=1;t<e.length;t++){const r=e[t],o=Array.isArray(n)?n[t-1]:n.type,a=s.parse(r,1+i.length,o);if(!a){l=!0;break}i.push(a)}if(!l)if(Array.isArray(n)&&n.length!==i.length)s.error(`Expected ${n.length} arguments, but found ${i.length} instead.`);else{for(let e=0;e<i.length;e++){const t=Array.isArray(n)?n[e]:n.type,r=i[e];s.concat(e+1).checkSubtype(t,r.type)}if(0===s.errors.length)return new Dr(r,o,a,i)}}if(1===i.length)t.errors.push(...s.errors);else{const r=(i.length?i:a).map(([e])=>{return t=e,Array.isArray(t)?`(${t.map(se).join(", ")})`:`(${se(t.type)}...)`;var t}).join(" | "),n=[];for(let r=1;r<e.length;r++){const o=t.parse(e[r],1+n.length);if(!o)return null;n.push(se(o.type))}t.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(e,t){Dr.definitions=t;for(const r in t)e[r]=Dr}}function Fr(e,[t,r,n,o]){t=t.evaluate(e),r=r.evaluate(e),n=n.evaluate(e);const a=o?o.evaluate(e):1,i=Ye(t,r,n,a);if(i)throw new Be(i);return new De(t/255,r/255,n/255,a,!1)}function Lr(e,t){return e in t}function Rr(e,t){const r=t[e];return void 0===r?null:r}function Gr(e){return{type:e}}function Zr(e){if(e instanceof pt)return Zr(e.boundExpression);if(e instanceof Dr&&"error"===e.name)return!1;if(e instanceof Tt)return!1;if(e instanceof ir)return!1;if(e instanceof Or)return!1;if(e instanceof Tr)return!1;const t=e instanceof at||e instanceof nt;let r=!0;return e.eachChild(e=>{r=t?r&&Zr(e):r&&e instanceof tt}),!!r&&(Ur(e)&&Br(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]))}function Ur(e){if(e instanceof Dr){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof ir)return!1;if(e instanceof Or)return!1;let t=!0;return e.eachChild(e=>{t&&!Ur(e)&&(t=!1)}),t}function Vr(e){if(e instanceof Dr&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!Vr(e)&&(t=!1)}),t}function Br(e,t){if(e instanceof Dr&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!Br(e,t)&&(r=!1)}),r}function Jr(e){return{result:"success",value:e}}function Hr(e){return{result:"error",value:e}}function Wr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&Qe(e)===Y}Dr.register(Nr,{error:[{kind:"error"},[J],(e,[t])=>{throw new Be(t.evaluate(e))}],typeof:[J,[K],(e,[t])=>se(Qe(t.evaluate(e)))],"to-rgba":[ie(B,4),[W],(e,[t])=>{const[r,n,o,a]=t.evaluate(e).rgb;return[255*r,255*n,255*o,a]}],rgb:[W,[B,B,B],Fr],rgba:[W,[B,B,B,B],Fr],has:{type:H,overloads:[[[J],(e,[t])=>Lr(t.evaluate(e),e.properties())],[[J,Y],(e,[t,r])=>Lr(t.evaluate(e),r.evaluate(e))]]},get:{type:K,overloads:[[[J],(e,[t])=>Rr(t.evaluate(e),e.properties())],[[J,Y],(e,[t,r])=>Rr(t.evaluate(e),r.evaluate(e))]]},"feature-state":[K,[J],(e,[t])=>Rr(t.evaluate(e),e.featureState||{})],properties:[Y,[],e=>e.properties()],"geometry-type":[J,[],e=>e.geometryType()],id:[K,[],e=>e.id()],zoom:[B,[],e=>e.globals.zoom],"heatmap-density":[B,[],e=>e.globals.heatmapDensity||0],elevation:[B,[],e=>e.globals.elevation||0],"line-progress":[B,[],e=>e.globals.lineProgress||0],accumulated:[K,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[B,Gr(B),(e,t)=>{let r=0;for(const n of t)r+=n.evaluate(e);return r}],"*":[B,Gr(B),(e,t)=>{let r=1;for(const n of t)r*=n.evaluate(e);return r}],"-":{type:B,overloads:[[[B,B],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[B],(e,[t])=>-t.evaluate(e)]]},"/":[B,[B,B],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[B,[B,B],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[B,[],()=>Math.LN2],pi:[B,[],()=>Math.PI],e:[B,[],()=>Math.E],"^":[B,[B,B],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[B,[B],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[B,[B],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[B,[B],(e,[t])=>Math.log(t.evaluate(e))],log2:[B,[B],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[B,[B],(e,[t])=>Math.sin(t.evaluate(e))],cos:[B,[B],(e,[t])=>Math.cos(t.evaluate(e))],tan:[B,[B],(e,[t])=>Math.tan(t.evaluate(e))],asin:[B,[B],(e,[t])=>Math.asin(t.evaluate(e))],acos:[B,[B],(e,[t])=>Math.acos(t.evaluate(e))],atan:[B,[B],(e,[t])=>Math.atan(t.evaluate(e))],min:[B,Gr(B),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[B,Gr(B),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[B,[B],(e,[t])=>Math.abs(t.evaluate(e))],round:[B,[B],(e,[t])=>{const r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[B,[B],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[B,[B],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[H,[J,K],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[H,[K],(e,[t])=>e.id()===t.value],"filter-type-==":[H,[J],(e,[t])=>e.geometryType()===t.value],"filter-<":[H,[J,K],(e,[t,r])=>{const n=e.properties()[t.value],o=r.value;return typeof n==typeof o&&n<o}],"filter-id-<":[H,[K],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r<n}],"filter->":[H,[J,K],(e,[t,r])=>{const n=e.properties()[t.value],o=r.value;return typeof n==typeof o&&n>o}],"filter-id->":[H,[K],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r>n}],"filter-<=":[H,[J,K],(e,[t,r])=>{const n=e.properties()[t.value],o=r.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[H,[K],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r<=n}],"filter->=":[H,[J,K],(e,[t,r])=>{const n=e.properties()[t.value],o=r.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[H,[K],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r>=n}],"filter-has":[H,[K],(e,[t])=>t.value in e.properties()],"filter-has-id":[H,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[H,[ie(J)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[H,[ie(K)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[H,[J,ie(K)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[H,[J,ie(K)],(e,[t,r])=>function(e,t,r,n){for(;r<=n;){const o=r+n>>1;if(t[o]===e)return!0;t[o]>e?n=o-1:r=o+1}return!1}(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:H,overloads:[[[H,H],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Gr(H),(e,t)=>{for(const r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:H,overloads:[[[H,H],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Gr(H),(e,t)=>{for(const r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[H,[H],(e,[t])=>!t.evaluate(e)],"is-supported-script":[H,[J],(e,[t])=>{const r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[J,[J],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[J,[J],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[J,Gr(K),(e,t)=>t.map(t=>et(t.evaluate(e))).join("")],split:[ie(J),[J,J],(e,[t,r])=>t.evaluate(e).split(r.evaluate(e))],join:[J,[ie(J),J],(e,[t,r])=>t.evaluate(e).join(r.evaluate(e))],"resolved-locale":[J,[Q],(e,[t])=>t.evaluate(e).resolvedLocale()]});class Xr{constructor(e,t,r){this.expression=e,this._warningHistory={},this._evaluator=new st,this._defaultValue=t?function(e){if("color"===e.type&&Wr(e.default))return new De(0,0,0,0);switch(e.type){case"color":return De.parse(e.default)||null;case"padding":return Ze.parse(e.default)||null;case"numberArray":return Ue.parse(e.default)||null;case"colorArray":return Ve.parse(e.default)||null;case"variableAnchorOffsetCollection":return He.parse(e.default)||null;case"projectionDefinition":return Xe.parse(e.default)||null;default:return void 0===e.default?null:e.default}}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this._globalState=r}evaluateWithoutErrorHandling(e,t,r,n,o,a){return this._globalState&&(e=on(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,n,o,a){this._globalState&&(e=on(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Be(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function Yr(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Nr}function Kr(e,t,r){const n=new lt(Nr,Zr,[],t?function(e){const t={color:W,string:J,number:B,enum:J,boolean:H,formatted:ee,padding:te,numberArray:ne,colorArray:re,projectionDefinition:X,resolvedImage:oe,variableAnchorOffsetCollection:ae};if("array"===e.type)return ie(t[e.value]||K,e.length);return t[e.type]}(t):void 0),o=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return o?Jr(new Xr(o,t,r)):Hr(n.errors)}class Qr{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!Vr(t.expression),this.globalStateRefs=nn(t.expression),this._globalState=r}evaluateWithoutErrorHandling(e,t,r,n,o,a){return this._globalState&&(e=on(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,o,a)}evaluate(e,t,r,n,o,a){return this._globalState&&(e=on(e,this._globalState)),this._styleExpression.evaluate(e,t,r,n,o,a)}}class en{constructor(e,t,r,n,o){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Vr(t.expression),this.globalStateRefs=nn(t.expression),this.interpolationType=n,this._globalState=o}evaluateWithoutErrorHandling(e,t,r,n,o,a){return this._globalState&&(e=on(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,o,a)}evaluate(e,t,r,n,o,a){return this._globalState&&(e=on(e,this._globalState)),this._styleExpression.evaluate(e,t,r,n,o,a)}interpolationFactor(e,t,r){return this.interpolationType?Mt.interpolationFactor(this.interpolationType,e,t,r):0}}function tn(e,t,r){const n=Kr(e,t,r);if("error"===n.result)return n;const o=n.value.expression,a=Ur(o);if(!a&&("data-driven"!==(i=t)["property-type"]&&"cross-faded-data-driven"!==i["property-type"]))return Hr([new Z("","data expressions not supported")]);var i;const s=Br(o,["zoom"]);if(!s&&!function(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}(t))return Hr([new Z("","zoom expressions not supported")]);const l=rn(o);if(!l&&!s)return Hr([new Z("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(l instanceof Z)return Hr([l]);if(l instanceof Mt&&!function(e){return!!e.expression&&e.expression.interpolated}(t))return Hr([new Z("",'"interpolate" expressions cannot be used with this property')]);if(!l)return Jr(new Qr(a?"constant":"source",n.value,r));const u=l instanceof Mt?l.interpolation:void 0;return Jr(new en(a?"camera":"composite",n.value,l.labels,u,r))}function rn(e){let t=null;if(e instanceof ut)t=rn(e.result);else if(e instanceof At){for(const r of e.args)if(t=rn(r),t)break}else(e instanceof vt||e instanceof Mt)&&e.input instanceof Dr&&"zoom"===e.input.name&&(t=e);return t instanceof Z||e.eachChild(e=>{const r=rn(e);r instanceof Z?t=r:!t&&r?t=new Z("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new Z("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function nn(e,t=new Set){return e instanceof Tr&&t.add(e.key),e.eachChild(e=>{nn(e,t)}),t}function on(e,t){const{zoom:r,heatmapDensity:n,elevation:o,lineProgress:a,isSupportedScript:i,accumulated:s}=null!=e?e:{};return{zoom:r,heatmapDensity:n,elevation:o,lineProgress:a,isSupportedScript:i,accumulated:s,globalState:t}}function an(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!an(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}const sn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ln(e,t){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};an(e)||(e=cn(e));const r=Kr(e,sn,t);if("error"===r.result)throw new Error(r.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,t,n)=>r.value.evaluate(e,t,{},n),needGeometry:pn(e),getGlobalStateRefs:()=>nn(r.value.expression)}}function un(e,t){return e<t?-1:e>t?1:0}function pn(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(pn(e[t]))return!0;return!1}function cn(e){if(!e)return!0;const t=e[0];if(e.length<=1)return"any"!==t;var r;return"=="===t?fn(e[1],e[2],"=="):"!="===t?yn(fn(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?fn(e[1],e[2],t):"any"===t?(r=e.slice(1),["any"].concat(r.map(cn))):"all"===t?["all"].concat(e.slice(1).map(cn)):"none"===t?["all"].concat(e.slice(1).map(cn).map(yn)):"in"===t?dn(e[1],e.slice(2)):"!in"===t?yn(dn(e[1],e.slice(2))):"has"===t?mn(e[1]):"!has"!==t||yn(mn(e[1]))}function fn(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function dn(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(un)]]:["filter-in-small",e,["literal",t]]}}function mn(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function yn(e){return["!",e]}function hn(e){return"object"==typeof e?["literal",e]:e}function gn(e,t){let r=e.stops;if(!r)return function(e,t){const r=["get",e.property];if(void 0===e.default)return"string"===t.type?["string",r]:r;if("enum"===t.type)return["match",r,Object.keys(t.values),r,e.default];{const n=["color"===t.type?"to-color":t.type,r,hn(e.default)];return"array"===t.type&&n.splice(1,0,t.value,t.length||null),n}}(e,t);const n=r&&"object"==typeof r[0][0],o=n||void 0!==e.property,a=n||!o;return r=r.map(e=>!o&&t.tokens&&"string"==typeof e[1]?[e[0],Mn(e[1])]:[e[0],hn(e[1])]),n?function(e,t,r){const n={},o={},a=[];for(let t=0;t<r.length;t++){const i=r[t],s=i[0].zoom;void 0===n[s]&&(n[s]={zoom:s,type:e.type,property:e.property,default:e.default},o[s]=[],a.push(s)),o[s].push([i[0].value,i[1]])}const i=zn({},t);if("exponential"===i){const r=[vn(e),["linear"],["zoom"]];for(const e of a){kn(r,e,xn(n[e],t,o[e]),!1)}return r}{const e=["step",["zoom"]];for(const r of a){kn(e,r,xn(n[r],t,o[r]),!0)}return wn(e),e}}(e,t,r):a?function(e,t,r,n=["zoom"]){const o=zn(e,t);let a,i=!1;if("interval"===o)a=["step",n],i=!0;else{if("exponential"!==o)throw new Error(`Unknown zoom function type "${o}"`);{const t=void 0!==e.base?e.base:1;a=[vn(e),1===t?["linear"]:["exponential",t],n]}}for(const e of r)kn(a,e[0],e[1],i);return wn(a),a}(e,t,r):xn(e,t,r)}function vn(e){switch(e.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function bn(e,t){const r=hn((n=e.default,o=t.default,void 0!==n?n:void 0!==o?o:void 0));var n,o;return void 0===r&&"resolvedImage"===t.type?"":r}function xn(e,t,r){const n=zn(e,t),o=["get",e.property];if("categorical"===n&&"boolean"==typeof r[0][0]){const n=["case"];for(const e of r)n.push(["==",o,e[0]],e[1]);return n.push(bn(e,t)),n}if("categorical"===n){const n=["match",o];for(const e of r)kn(n,e[0],e[1],!1);return n.push(bn(e,t)),n}if("interval"===n){const t=["step",["number",o]];for(const e of r)kn(t,e[0],e[1],!0);return wn(t),void 0===e.default?t:["case",["==",["typeof",o],"number"],t,hn(e.default)]}if("exponential"===n){const t=void 0!==e.base?e.base:1,n=[vn(e),1===t?["linear"]:["exponential",t],["number",o]];for(const e of r)kn(n,e[0],e[1],!1);return void 0===e.default?n:["case",["==",["typeof",o],"number"],n,hn(e.default)]}throw new Error(`Unknown property function type ${n}`)}function wn(e){"step"===e[0]&&3===e.length&&(e.push(0),e.push(e[3]))}function kn(e,t,r,n){e.length>3&&t===e[e.length-2]||(n&&2===e.length||e.push(t),e.push(r))}function zn(e,t){return e.type?e.type:t.expression.interpolated?"exponential":"interval"}function Mn(e){const t=["concat"],r=/{([^{}]+)}/g;let n=0;for(let o=r.exec(e);null!==o;o=r.exec(e)){const a=e.slice(n,r.lastIndex-o[0].length);n=r.lastIndex,a.length>0&&t.push(a),t.push(["get",o[1]])}if(1===t.length)return e;if(n<e.length)t.push(e.slice(n));else if(2===t.length)return["to-string",t[1]];return t}const Sn=L;function An(e,t){const r=t[0].evaluate(e),n=t[1].evaluate(e),o=t[2].evaluate(e),a=t[3]?t[3].evaluate(e):1;return De.parse(`hsla(${r}, ${n}%, ${o}%, ${a})`)}function _n(e){if(Array.isArray(e)){if(0===e.length)return e;const t=e[0];if("literal"===t)return e;if("image"===t&&3===e.length&&"object"==typeof e[2]&&null!==e[2]&&!Array.isArray(e[2])){return["image-config",_n(e[1]),["literal",e[2]]]}const r=e.length;for(let n=1;n<r;++n){const o=e[n],a=_n(o);if(a!==o){const o=[t];for(let t=1;t<n;++t)o.push(e[t]);o.push(a);for(let t=n+1;t<r;++t)o.push(_n(e[t]));return o}}}return e}const jn={},En={zoom:0,distanceFromCenter:0};Dr.register(Nr,{...Dr.definitions,pitch:[{kind:"number"},[],e=>En.pitch||0],"distance-from-center":[{kind:"number"},[],e=>En.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(e,[t])=>function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,o=e[3],a=Math.max(t,r,n),i=Math.min(t,r,n),s=(a+i)/2;let l,u;if(a===i)l=0,u=0;else{const e=a-i;switch(u=s>.5?e/(2-a-i):e/(a+i),a){case t:l=(r-n)/e+(r<n?6:0);break;case r:l=(n-t)/e+2;break;case n:l=(t-r)/e+4;break;default:l=0}l/=6}return[360*l,100*u,100*s,o]}(A(t.evaluate(e)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],An],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],An],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(e,[t,r])=>t.evaluate(e)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(e,[t])=>{const r=jn[t.evaluate(e)];return void 0===r?{}:r}]});var Cn={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},$n=" ",qn=/(italic|oblique)$/i,In={};function Pn(e,t,r){var n=In[e];if(!n){Array.isArray(e)||(e=[e]);for(var o,a,i=400,s="normal",l=[],u=0,p=e.length;u<p;++u){var c=e[u].split(" "),f=c[c.length-1].toLowerCase();for(var d in"normal"==f||"italic"==f||"oblique"==f?(s=a?s:f,a=!0,c.pop(),f=c[c.length-1].toLowerCase()):qn.test(f)&&(f=f.replace(qn,""),s=a?s:c[c.length-1].replace(f,""),a=!0),Cn){var m=c.length>1?c[c.length-2].toLowerCase():"";if(f==d||f==d.replace("-","")||m+"-"+f==d){i=o?i:Cn[d],c.pop(),m&&d.startsWith(m)&&c.pop();break}}o||"number"!=typeof f||(i=f,o=!0);var y=c.join($n).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==y.indexOf($n)&&(y='"'+y+'"'),l.push(y)}n=In[e]=[s,i,l]}return n[0]+$n+n[1]+$n+t+"px"+(r?"/"+r:"")+$n+n[2]}const On=Object.freeze({}),Tn={},Nn={};let Dn=0;function Fn(e){return e.id||(e.id=Dn++),e.id}function Ln(e){return e*Math.PI/180}const Rn=function(){const e=[];for(let t=78271.51696402048;e.length<=24;t/=2)e.push(t);return e}();function Gn(e,t){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(e,t);const r=document.createElement("canvas");return r.width=e,r.height=t,r}function Zn(e,t,r,n){const o=[2*r*t.pixelRatio+t.width,2*r*t.pixelRatio+t.height],a=Gn(o[0],o[1]),i=a.getContext("2d");i.drawImage(e,t.x,t.y,t.width,t.height,r*t.pixelRatio,r*t.pixelRatio,t.width,t.height);const s=i.getImageData(0,0,o[0],o[1]);i.globalCompositeOperation="destination-over",i.fillStyle=`rgba(${255*n.r},${255*n.g},${255*n.b},${n.a})`;const l=s.data;for(let e=0,n=s.width;e<n;++e)for(let o=0,a=s.height;o<a;++o){l[4*(o*n+e)+3]>0&&i.arc(e,o,r*t.pixelRatio,0,2*Math.PI)}return i.fill(),a}function Un(e,t,r){const n=Math.max(0,Math.min(1,(r-e)/(t-e)));return n*n*(3-2*n)}function Vn(e,t,r){const n=Gn(t.width,t.height),o=n.getContext("2d");o.drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height);const a=o.getImageData(0,0,t.width,t.height),i=a.data;for(let e=0,t=a.width;e<t;++e)for(let n=0,o=a.height;n<o;++n){const o=4*(n*t+e),a=.75,s=.1,l=Un(a-s,a+s,i[o+3]/255);l>0?(i[o+0]=Math.round(255*r.r*l),i[o+1]=Math.round(255*r.g*l),i[o+2]=Math.round(255*r.b*l),i[o+3]=Math.round(255*l)):i[o+3]=0}return o.putImageData(a,0,0),n}const Bn=Array(256).join(" ");function Jn(e,t){if(t>=.05){let r="";const n=e.split("\n"),o=Bn.slice(0,Math.round(t/.1));for(let e=0,t=n.length;e<t;++e)e>0&&(r+="\n"),r+=n[e].split("").join(o);return r}return e}let Hn;function Wn(){return Hn||(Hn=Gn(1,1).getContext("2d")),Hn}function Xn(e,t){return Wn().measureText(e).width+(e.length-1)*t}const Yn={};function Kn(e,t,r,n){if(-1!==e.indexOf("\n")){const o=e.split("\n"),a=[];for(let e=0,i=o.length;e<i;++e)a.push(Kn(o[e],t,r,n));return a.join("\n")}const o=r+","+t+","+e+","+n;let a=Yn[o];if(!a){const i=e.split(" ");if(i.length>1){const e=Wn();e.font=t;const o=e.measureText("M").width*r;let s="";const l=[];for(let e=0,t=i.length;e<t;++e){const t=i[e],r=s+(s?" ":"")+t;Xn(r,n)<=o?s=r:(s&&l.push(s),s=t)}s&&l.push(s);for(let e=0,t=l.length;e<t&&t>1;++e){const r=l[e];if(Xn(r,n)<.35*o){const o=e>0?Xn(l[e-1],n):1/0,a=e<t-1?Xn(l[e+1],n):1/0;l.splice(e,1),t-=1,o<a?(l[e-1]+=" "+r,e-=1):l[e]=r+" "+l[e]}}for(let e=0,t=l.length-1;e<t;++e){const r=l[e],a=l[e+1];if(Xn(r,n)>.7*o&&Xn(a,n)<.6*o){const i=r.split(" "),s=i.pop();Xn(s,n)<.2*o&&(l[e]=i.join(" "),l[e+1]=s+" "+a),t-=1}}a=l.join("\n")}else a=e;a=Jn(a,n),Yn[o]=a}return a}_.on("propertychange",()=>{for(const e in Yn)delete Yn[e]});const Qn={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},eo={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]},to=function(e,t){let r=tn(e,t);if("error"===r.result){const n=_n(e);n!==e&&(r=tn(n,t))}if("error"===r.result){const n=r.value[0];return console.error("Error parsing expression:",e,n.key,n.message),{evaluate:()=>t.default}}return r.value};let ro,no;function oo(e,t,r,n,o,a){const i=e.id;o||(o={},console.warn("No functionCache provided to getValue()")),o[i]||(o[i]={});const s=o[i];if(!s[r]){let n=(e[t]||On)[r];const o=Sn[`${t}_${e.type}`]&&Sn[`${t}_${e.type}`][r];void 0===n&&o&&(n=o.default);let a=Yr(n);if(!a&&Wr(n)&&(n=gn(n,o),a=!0),a){const e=to(n,o);s[r]=e.evaluate.bind(e)}else{const e=o?o.type:typeof n;"color"!==e&&"colorArray"!==e||(n=De.parse(n));let t=!1;if("array"===e)for(let e=0;e<n.length;++e){const r=n[e];if(Yr(r)||Wr(r)){t=!0;break}}if(t){const e=Object.assign({},o,{type:o.value}),t=[];for(let r=0;r<n.length;++r){let o=n[r];if(!Yr(o)&&Wr(o)&&(o=gn(o,e)),Yr(o)){const r=to(o,e);t.push(r.evaluate.bind(r))}else t.push(function(){return o})}s[r]=function(e,r,n){const o=[];for(let a=0;a<t.length;++a)o[a]=t[a](e,r,n);return o}}else s[r]=function(){return n}}}return s[r](En,n,a)}function ao(e,t,r,n){if(!oo(e,"layout",`${r}-allow-overlap`,t,n))return"declutter";return oo(e,"layout",`${r}-ignore-placement`,t,n)?"none":"obstacle"}function io(e,t,r,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(e in n))try{n[e]=ln(t).filter}catch(t){console.warn("Filter will evaluate to false: "+t.message),n[e]=function(){return!1}}return n[e](En,r)}function so(e,t){if(e){if(0===e.a||0===t)return;const r=e.a;return t=void 0===t?1:t,0===r?"transparent":"rgba("+Math.round(255*e.r/r)+","+Math.round(255*e.g/r)+","+Math.round(255*e.b/r)+","+r*t+")"}return e}const lo=/\{[^{}}]*\}/g;function uo(e,t){return e.replace(lo,function(e){return t[e.slice(1,-1)]||""})}function po(e,t){let r=e.split(":")[0];return r===e&&(r="default"),t[r]}const co={};function fo(t,n,o,a=Rn,i=void 0,s=void 0,l=void 0,v=void 0){if("string"==typeof n&&(n=JSON.parse(n)),n.schema)for(const e in n.schema){const t=n.schema[e];"default"in t&&(jn[e]=t.default)}if(8!=n.version)throw new Error("glStyle version 8 required.");co[function(e,t){return Fn(e)+"."+j(t)}(n,t)]=Array.from(arguments);const b={};("string"==typeof s||s instanceof Request||s instanceof Response||s instanceof Promise)&&(s={default:s});for(const e in s){const r=s[e];p(()=>r).then(async r=>{let n;if("undefined"!=typeof Image){const o=new Image;if("string"==typeof r)o.crossOrigin="anonymous",o.src=r;else{let e;r instanceof Request?e=await fetch(r):r instanceof Response&&(e=r);const t=await e.blob();n=URL.createObjectURL(t),o.src=n}o.addEventListener("load",function r(){o.removeEventListener("load",r),b[e]={image:o,size:[o.width,o.height]},t.changed(),n&&URL.revokeObjectURL(n)}),o.addEventListener("error",function e(){URL.revokeObjectURL(n),o.removeEventListener("error",e)})}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:r}),t.addEventListener("message",function(t){"imageLoaded"===t.data.action&&t.data.src===r&&(b[e]={image:t.data.image,size:[t.data.image.width,t.data.image.height]})})}})}const x=function(e){e=e.slice();const t=Object.create(null);for(let r=0;r<e.length;r++)t[e[r].id]=e[r];for(let r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=G(e[r],t[e[r].ref]));return e}(n.layers),w={},k=[],z={},M={},S=function(e){let t=Tn[e.id];return t||(t={},Tn[Fn(e)]=t),t}(n),A=function(e){let t=Nn[e.id];return t||(t={},Nn[Fn(e)]=t),t}(n);let _;for(let e=0,t=x.length;e<t;++e){const t=x[e],r=t.id;if("string"==typeof o&&t.source==o||Array.isArray(o)&&-1!==o.indexOf(r)){const o=t["source-layer"];if(_){if(t.source!==_)throw new Error(`Layer "${r}" does not use source "${_}`)}else{_=t.source;const e=n.sources[_];if(!e)throw new Error(`Source "${_}" is not defined`);const r=e.type;if("vector"!==r&&"geojson"!==r)throw new Error(`Source "${_}" is not of type "vector" or "geojson", but "${r}"`)}let a=w[o];a||(a=[],w[o]=a),a.push({layer:t,index:e}),k.push(r)}}const E=[],C=function(o,s,p){const x=t.getSource?.()?.format_?.layerName_??"mvt:layer",k=o.getProperties(),_=w[k[x]];if(!_)return;let j=a.indexOf(s);-1==j&&(j=function(e,t){let r=0;const n=t.length;for(;r<n;++r)if(t[r]<e&&r+1<n){const n=t[r]/t[r+1];return r+Math.log(t[r]/e)/Math.log(n)}return n-1}(s,a)),En.zoom=j,En.distanceFromCenter=0;const C=o.getGeometry(),$=Qn[C.getType()],q=t.get("map");if(q&&q instanceof e&&1===$){const e=q.getSize();if(e){const t=q.getView().getCenter(),n=r(C.getExtent());En.distanceFromCenter=u(t,n)/s/e[1]}}const I={id:o.getId(),properties:k,type:$},P=t.get("mapbox-featurestate")[o.getId()];let O=-1;for(let e=0,r=_.length;e<r;++e){const r=_[e],a=r.layer,u=a.id;if(void 0!==p&&p!==u)continue;const x=a.layout||On,w=a.paint||On;if("none"===oo(a,"layout","visibility",I,S,P)||"minzoom"in a&&j<a.minzoom||"maxzoom"in a&&j>=a.maxzoom)continue;const C=a.filter;if(!C||io(u,C,I,A)){let e,u,p,A,_,j;const C=r.index;if(3==$&&("fill"==a.type||"fill-extrusion"==a.type))if(u=oo(a,"paint",a.type+"-opacity",I,S,P),a.type+"-pattern"in w){const e=oo(a,"paint",a.type+"-pattern",I,S,P);if(e){const t="string"==typeof e?uo(e,k):e.toString(),r=po(t,b);if(i&&i[t]&&r){++O,j=E[O],j&&j.getFill()&&!j.getStroke()&&!j.getText()||(j=new h({fill:new d}),E[O]=j),p=j.getFill(),j.setZIndex(C);const e=t+"."+u;let n=M[e];if(!n){const o=i[t],a=Gn(o.width,o.height),s=a.getContext("2d");s.globalAlpha=u,s.drawImage(r.image,o.x,o.y,o.width,o.height,0,0,o.width,o.height),n=s.createPattern(a,"repeat"),M[e]=n}p.setColor(n)}}}else if(e=so(oo(a,"paint",a.type+"-color",I,S,P),u),a.type+"-outline-color"in w&&(_=so(oo(a,"paint",a.type+"-outline-color",I,S,P),u)),_||(_=e),e||_){if(++O,j=E[O],(!j||e&&!j.getFill()||!e&&j.getFill()||_&&!j.getStroke()||!_&&j.getStroke()||j.getText())&&(j=new h({fill:e?new d:void 0,stroke:_?new y:void 0}),E[O]=j),e&&(p=j.getFill(),p.setColor(e)),"fill-extrusion"===a.type){const e=oo(a,"paint","fill-extrusion-height",I,S,P);if(e>0){const t=Math.max(.1,.9-Math.min(e,225)/280);if(_&&"transparent"!==_){const e=De.parse(_);_=`rgba(${Math.round(255*e.r*t)},${Math.round(255*e.g*t)},${Math.round(255*e.b*t)},${e.a})`}}}_&&(A=j.getStroke(),A.setColor(_),A.setWidth(.5)),j.setZIndex(C)}if(1!=$&&"line"==a.type){e="line-pattern"in w?void 0:so(oo(a,"paint","line-color",I,S,P),oo(a,"paint","line-opacity",I,S,P));const t=oo(a,"paint","line-width",I,S,P);e&&t>0&&(++O,j=E[O],j&&j.getStroke()&&!j.getFill()&&!j.getText()||(j=new h({stroke:new y}),E[O]=j),A=j.getStroke(),A.setLineCap(oo(a,"layout","line-cap",I,S,P)),A.setLineJoin(oo(a,"layout","line-join",I,S,P)),A.setMiterLimit(oo(a,"layout","line-miter-limit",I,S,P)),A.setColor(e),A.setWidth(t),A.setLineDash(w["line-dasharray"]?oo(a,"paint","line-dasharray",I,S,P).map(function(e){return e*t}):null),"function"==typeof A.setOffset&&A.setOffset(oo(a,"paint","line-offset",I,S,P)),j.setZIndex(C))}let q,T,N,D,F,L,R,G,Z,U=!1,V=null,B=0;if((1==$||2==$)&&"icon-image"in x){const e=oo(a,"layout","icon-image",I,S,P);if(e){let r;q="string"==typeof e?uo(e,k):e.toString();const n=v?v(t,q):void 0,l=po(q,b);if(i&&i[q]&&l||n){const e=oo(a,"layout","icon-rotation-alignment",I,S,P);if(2==$){const t=o.getGeometry();if(t.getFlatMidpoint||t.getFlatMidpoints){const n=t.getExtent();if(Math.sqrt(Math.max(Math.pow((n[2]-n[0])/s,2),Math.pow((n[3]-n[1])/s,2)))>150){const n="MultiLineString"===t.getType()?t.getFlatMidpoints():t.getFlatMidpoint();no||(ro=[NaN,NaN],no=new c("Point",ro,[],2,{},void 0)),r=no,ro[0]=n[0],ro[1]=n[1];if("line"===oo(a,"layout","symbol-placement",I,S,P)&&"map"===e){const e=t.getStride(),r=t.getFlatCoordinates();for(let t=0,o=r.length-e;t<o;t+=e){const o=r[t],a=r[t+1],i=r[t+e],s=r[t+e+1],l=Math.min(o,i),u=Math.max(o,i),p=n[0],c=(s-a)*(p-o)-(i-o)*(n[1]-a);if(Math.abs(c)<.001&&p<=u&&p>=l){B=Math.atan2(a-s,i-o);break}}}}}}if(2!==$||r){const t=oo(a,"layout","icon-size",I,S,P),o=void 0!==w["icon-color"]?oo(a,"paint","icon-color",I,S,P):null;if(!o||0!==o.a){const r=oo(a,"paint","icon-halo-color",I,S,P),s=oo(a,"paint","icon-halo-width",I,S,P);let u=`${q}.${t}.${s}.${r}`;if(null!==o&&(u+=`.${o}`),T=z[u],!T){const p=ao(a,I,"icon",S);let c;"icon-offset"in x&&(c=oo(a,"layout","icon-offset",I,S,P).slice(0),c[0]*=t,c[1]*=-t);let f=o?[255*o.r,255*o.g,255*o.b,o.a]:void 0;if(n){const r={color:f,rotateWithView:"map"===e,displacement:c,declutterMode:p,scale:t};"string"==typeof n?r.src=n:(r.img=n,r.imgSize=[n.width,n.height]),T=new m(r)}else{const n=i[q];let a,u,d;if(s)n.sdf?(a=Zn(Vn(l.image,n,o||[0,0,0,1]),{x:0,y:0,width:n.width,height:n.height,pixelRatio:n.pixelRatio},s,r),f=void 0):a=Zn(l.image,n,s,r);else{if(n.sdf&&!l.unSDFed){const e=Vn(l.image,{x:0,y:0,width:l.size[0],height:l.size[1]},{r:1,g:1,b:1});l.image=e,l.unSDFed=!0}a=l.image,u=[n.width,n.height],d=[n.x,n.y]}T=new m({color:f,img:a,imgSize:l.size,size:u,offset:d,rotateWithView:"map"===e,scale:t/n.pixelRatio,displacement:c,declutterMode:p})}z[u]=T}}T&&(++O,j=E[O],j&&j.getImage()&&!j.getFill()&&!j.getStroke()||(j=new h,E[O]=j),j.setGeometry(r),T.setRotation(B+Ln(oo(a,"layout","icon-rotate",I,S,P))),T.setOpacity(oo(a,"paint","icon-opacity",I,S,P)),T.setAnchor(eo[oo(a,"layout","icon-anchor",I,S,P)]),j.setImage(T),V=j.getText(),j.setText(void 0),j.setZIndex(C),U=!0,N=!1)}else N=!0}}}if(1==$&&"circle"===a.type){++O,j=E[O],j&&j.getImage()&&!j.getFill()&&!j.getStroke()||(j=new h,E[O]=j);const e="circle-radius"in w?oo(a,"paint","circle-radius",I,S,P):5,t=so(oo(a,"paint","circle-stroke-color",I,S,P),oo(a,"paint","circle-stroke-opacity",I,S,P)),r=oo(a,"paint","circle-translate",I,S,P),n=so(oo(a,"paint","circle-color",I,S,P),oo(a,"paint","circle-opacity",I,S,P)),o=oo(a,"paint","circle-stroke-width",I,S,P),i=e+"."+t+"."+n+"."+o+"."+r[0]+"."+r[1];T=z[i],T||(T=new f({radius:e,displacement:[r[0],-r[1]],stroke:t&&o>0?new y({width:o,color:t}):void 0,fill:n?new d({color:n}):void 0,declutterMode:"none"}),z[i]=T),j.setImage(T),V=j.getText(),j.setText(void 0),j.setGeometry(void 0),j.setZIndex(C),U=!0}if("text-field"in x){R=Math.round(oo(a,"layout","text-size",I,S,P));const e=oo(a,"layout","text-font",I,S,P);L=oo(a,"layout","text-line-height",I,S,P),F=Pn(l?l(e,n.metadata?n.metadata["ol:webfonts"]:void 0):e,R,L),F.includes("sans-serif")||(F+=",sans-serif"),G=oo(a,"layout","text-letter-spacing",I,S,P),Z=oo(a,"layout","text-max-width",I,S,P);const t=oo(a,"layout","text-field",I,S,P);D="object"==typeof t&&t.sections?1===t.sections.length?t.toString():t.sections.reduce((t,r,n)=>{const o=r.fontStack?r.fontStack.split(","):e,a=Pn(l?l(o):o,R*(r.scale||1),L);let i=r.text;if("\n"===i)return t.push("\n",""),t;if(2==$)return t.push(Jn(i,G),a),t;i=Kn(i,a,Z,G).split("\n");for(let e=0,r=i.length;e<r;++e)e>0&&t.push("\n",""),t.push(i[e],a);return t},[]):uo(t,k).trim(),u=oo(a,"paint","text-opacity",I,S,P)}if(D&&u&&!N){U||(++O,j=E[O],j&&j.getText()&&!j.getFill()&&!j.getStroke()||(j=new h,E[O]=j),j.setImage(void 0),j.setGeometry(void 0));const e=ao(a,I,"text",S);j.getText()||j.setText(V),V=j.getText(),(!V||"getDeclutterMode"in V&&V.getDeclutterMode()!==e)&&(V=new g({padding:[2,2,2,2],declutterMode:e}),j.setText(V));const t=oo(a,"layout","text-transform",I,S,P);"uppercase"==t?D=Array.isArray(D)?D.map((e,t)=>t%2?e:e.toUpperCase()):D.toUpperCase():"lowercase"==t&&(D=Array.isArray(D)?D.map((e,t)=>t%2?e:e.toLowerCase()):D.toLowerCase());const r=Array.isArray(D)?D:2==$?Jn(D,G):Kn(D,F,Z,G);if(V.setText(r),V.setFont(F),V.setRotation(Ln(oo(a,"layout","text-rotate",I,S,P))),"function"==typeof V.setKeepUpright){const e=oo(a,"layout","text-keep-upright",I,S,P);V.setKeepUpright(e)}const n=oo(a,"layout","text-anchor",I,S,P),o=U||1==$?"point":oo(a,"layout","symbol-placement",I,S,P);let i;if("line-center"===o?(V.setPlacement("line"),i="center"):V.setPlacement(o),"line"===o&&"function"==typeof V.setRepeat){const e=oo(a,"layout","symbol-spacing",I,S,P);V.setRepeat(2*e)}V.setOverflow("point"===o);let s=oo(a,"paint","text-halo-width",I,S,P);const l=oo(a,"layout","text-offset",I,S,P),p=oo(a,"paint","text-translate",I,S,P);let c=0,f=0;if("point"==o){i="center",-1!==n.indexOf("left")?(i="left",f=s):-1!==n.indexOf("right")&&(i="right",f=-s);const e=oo(a,"layout","text-rotation-alignment",I,S,P);V.setRotateWithView("map"==e)}else V.setMaxAngle(Ln(oo(a,"layout","text-max-angle",I,S,P))*D.length/r.length),V.setRotateWithView(!1);V.setTextAlign(i);let m="middle";0==n.indexOf("bottom")?(m="bottom",c=-s-.5*(L-1)*R):0==n.indexOf("top")&&(m="top",c=s+.5*(L-1)*R),V.setTextBaseline(m);const v=oo(a,"layout","text-justify",I,S,P);V.setJustify("auto"===v?void 0:v),V.setOffsetX(l[0]*R+f+p[0]),V.setOffsetY(l[1]*R+c+p[1]);const b=V.getFill()||new d;b.setColor(so(oo(a,"paint","text-color",I,S,P),u)),V.setFill(b);const x=so(oo(a,"paint","text-halo-color",I,S,P),u);if(x&&s>0){const e=V.getStroke()||new y;e.setColor(x),s*=2;const t=.5*R;e.setWidth(s<=t?s:t),V.setStroke(e)}else V.setStroke(void 0);const w=oo(a,"layout","text-padding",I,S,P),k=V.getPadding();w!==k[0]&&(k[0]=w,k[1]=w,k[2]=w,k[3]=w),j.setZIndex(C)}}}return O>-1?(E.length=O+1,E):void 0};return t.setStyle(C),t.set("mapbox-layers",k),t.set("mapbox-source",_),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),C}function mo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function yo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mo(Object(r),!0).forEach(function(t){k(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mo(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}De.parse("#000000"),De.parse("#FFFFFF"),De.parse("#000000");var ho="EPSG:27700";function go(e,t,r){var n=r&&r(e,t)||{};return fetch(n.url||e,{headers:n.headers||{}})}var vo=e=>(t,r)=>{var n=e(r,"Tile")||{},o=n.url||r,a=n.headers||{};fetch(o,{headers:a}).then(e=>e.blob()).then(e=>{t.getImage().src=URL.createObjectURL(e)}).catch(()=>t.setState(S.ERROR))};function bo(e,t){var r=new l({resolutions:E,origin:$,tileSize:256});return new z({projection:ho,tileGrid:r,tileUrlFunction:t=>{var[r,n,o]=t;return e.replace("{z}",r).replace("{x}",n).replace("{y}",o)},tileLoadFunction:t?vo(t):void 0})}function xo(e,t){var r=e.indexOf("?"),[n,o]=r>=0?[e.slice(0,r),e.slice(r)]:[e,""],a="".concat(n,".json").concat(o),i="".concat(n,".png").concat(o);return{jsonUrl:a,pngUrl:i,fetch:()=>go(a,"SpriteJSON",t).then(e=>e.json())}}function wo(e,t){return ko.apply(this,arguments)}function ko(){return ko=v(function*(e,t){var{renderMode:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=yield go(e,"Style",t).then(e=>e.json()),i=Object.keys(o.sources)[0],u=o.sources[i].url,p=yield go(u,"Source",t).then(e=>e.json()),c=[p.fullExtent.xmin,p.fullExtent.ymin,p.fullExtent.xmax,p.fullExtent.ymax],f=[p.tileInfo.origin.x,p.tileInfo.origin.y],d=p.tileInfo.lods.map(e=>e.resolution).slice(0,16),m=p.tileInfo.rows,y=p.tiles[0],h=xo(o.sprite,t),g=yield h.fetch();!function(e){e.layers.forEach(e=>{var t;null!==(t=e.paint)&&void 0!==t&&t["icon-color"]&&(e.paint["icon-color"]=e.paint["icon-color"].replace(",0)",",1)"))})}(o);var v=new l({extent:c,origin:f,resolutions:d,tileSize:m}),b=new s({format:new n,url:y,projection:ho,tileGrid:v}),x=new a(yo({source:b,declutter:!0},r&&{renderMode:r}));return fo(x,o,i,d,g,h.pngUrl),{layer:x,source:b}}),ko.apply(this,arguments)}function zo(e,t){return Mo.apply(this,arguments)}function Mo(){return Mo=v(function*(e,t){var r,{renderMode:o}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=yield go(e,"Style",t).then(e=>e.json()),s=Object.keys(i.sources)[0],u=i.sources[s].url,p=xo(i.sprite,t),c=null===(r=(yield go(u,"Source",t).then(e=>e.json())).links)||void 0===r?void 0:r.find(e=>"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===e.rel),[f,d]=yield Promise.all([go(c.href,"Source",t).then(e=>e.json()),p.fetch()]),m=f.tileMatrices.map(e=>e.cellSize),y=f.tileMatrices[0].pointOfOrigin,h=[f.tileMatrices[0].tileHeight,f.tileMatrices[0].tileWidth],g=new n;g.supportedMediaTypes.push("application/octet-stream");var v=new l({resolutions:m,origin:y,tileSize:h}),b=new M({url:u,format:g,tileGrid:v,projection:ho}),x=new a(yo({source:b,declutter:!0},o&&{renderMode:o}));return fo(x,i,s,m,d,p.pngUrl),{layer:x,source:b}}),Mo.apply(this,arguments)}function So(e,t,r){if(null!==e)for(var n,o,a,i,s,l,u,p,c=0,f=0,d=e.type,m="FeatureCollection"===d,y="Feature"===d,h=m?e.features.length:1,g=0;g<h;g++){s=(p=!!(u=m?e.features[g].geometry:y?e.geometry:e)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var v=0;v<s;v++){var b=0,x=0;if(null!==(i=p?u.geometries[v]:u)){l=i.coordinates;var w=i.type;switch(c=0,w){case null:break;case"Point":if(!1===t(l,f,g,b,x))return!1;f++,b++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===t(l[n],f,g,b,x))return!1;f++,"MultiPoint"===w&&b++}"LineString"===w&&b++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(o=0;o<l[n].length-c;o++){if(!1===t(l[n][o],f,g,b,x))return!1;f++}"MultiLineString"===w&&b++,"Polygon"===w&&x++}"Polygon"===w&&b++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(x=0,o=0;o<l[n].length;o++){for(a=0;a<l[n][o].length-c;a++){if(!1===t(l[n][o][a],f,g,b,x))return!1;f++}x++}b++}break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)if(!1===So(i.geometries[n],t))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var Ao=function(e,t={}){if(null!=e.bbox&&!0!==t.recompute)return e.bbox;const r=[1/0,1/0,-1/0,-1/0];return So(e,e=>{r[0]>e[0]&&(r[0]=e[0]),r[1]>e[1]&&(r[1]=e[1]),r[2]<e[0]&&(r[2]=e[0]),r[3]<e[1]&&(r[3]=e[1])}),r},_o=e=>{var t=e/1609.344;if(t<.5)return"".concat(Math.round(e),"m");if(t<10){var r=Number.parseFloat(t.toFixed(1)),n=1===r?"mile":"miles";return"".concat(r," ").concat(n)}var o=Math.round(t);return"".concat(o," miles")},jo=(e,t,r)=>{var n=r.getTargetElement().getBoundingClientRect();if(!n.width||!n.height)return!1;var o=r.getViewport().getBoundingClientRect(),a=o.width/n.width,i=o.height/n.height,[s,l,u,p]=(e=>Ao(e))(e),c=[[s,l],[s,p],[u,l],[u,p]].map(e=>r.getPixelFromCoordinate(e)).filter(Boolean);if(!c.length)return!1;var f=n.left+Math.min(...c.map(e=>e[0]))*a,d=n.left+Math.max(...c.map(e=>e[0]))*a,m=n.top+Math.min(...c.map(e=>e[1]))*i,y=n.top+Math.max(...c.map(e=>e[1]))*i;return f<t.right&&d>t.left&&m<t.bottom&&y>t.top},Eo="EPSG:27700",Co=e=>{if(e){var{top:t=0,right:r=0,bottom:n=0,left:o=0}=e;return[t,r,n,o]}};x.defs(Eo,"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs"),w(x);class $o{constructor(e){var{mapProviderConfig:t={},events:r,eventBus:n}=e;this.events=r,this.eventBus=n,this.capabilities={supportedShortcuts:P,supportsMapSizes:!0},Object.assign(this,t)}initMap(r){var n=this;return v(function*(){var a,i,{container:s,padding:l,mapStyle:u,mapSize:p,center:c,zoom:f,bounds:d,minZoom:m,maxZoom:y,transformRequest:h,pixelRatio:g}=r;n.mapStyleId=null==u?void 0:u.id,n.mapSize=p;var x,w,{events:k,eventBus:z}=n;if("raster"===u.type)w=bo(u.url,h),x=new o({source:w});else if("ogc-vt"===u.type){var M=yield zo(u.url,h,u);x=M.layer,w=M.source}else{var S=yield wo(u.url,h,u);x=S.layer,w=S.source}var A=(null!==(a=n.zoomAlignment)&&void 0!==a?a:O)===T?{resolutions:C,defaultMinZoom:6,maxZoom:20}:{resolutions:E,defaultMinZoom:0,maxZoom:E.length-1},_=new t({projection:Eo,center:c,zoom:null!=f?f:A.defaultMinZoom,minZoom:Math.max(null!=m?m:A.defaultMinZoom,A.defaultMinZoom),maxZoom:null!=y?y:A.maxZoom,resolutions:A.resolutions,constrainResolution:!1,padding:Co(l)}),j=new e({target:s,layers:[x],view:_,controls:[],interactions:b({doubleClickZoom:!1}),pixelRatio:g});d&&j.once("rendercomplete",()=>{_.fit(d,{size:j.getSize(),duration:0})}),n.mapEventHandles=F({map:j,source:w,events:k,eventBus:z,getZoom:n.getZoom.bind(n),getCenter:n.getCenter.bind(n),getBounds:n.getBounds.bind(n),getResolution:n.getResolution.bind(n)}),n.appEventHandles=function(e){var{mapProvider:t,layer:r,layerType:n,transformRequest:o,events:a,eventBus:i,map:s}=e,l=function(){var e=v(function*(e){if("raster"===n){var t=bo(e.url,o);r.setSource(t)}else if("ogc-vt"===e.type){var{layer:l}=yield zo(e.url,o,e);s.getLayers().setAt(0,l)}else{var{layer:u}=yield wo(e.url,o,e);s.getLayers().setAt(0,u)}i.emit(a.MAP_STYLE_CHANGE,{mapStyleId:e.id})});return function(t){return e.apply(this,arguments)}}(),u=e=>{s.setPixelRatio(e)},p=e=>{var{mapSize:r}=e;t.mapSize=r};return i.on(a.MAP_SET_STYLE,l),i.on(a.MAP_SET_PIXEL_RATIO,u),i.on(a.MAP_SIZE_CHANGE,p),{remove(){i.off(a.MAP_SET_STYLE,l),i.off(a.MAP_SET_PIXEL_RATIO,u),i.off(a.MAP_SIZE_CHANGE,p)}}}({mapProvider:n,layer:x,layerType:null!==(i=u.type)&&void 0!==i?i:"vector",transformRequest:h,events:k,eventBus:z,map:j})||[],n.map=j,n.view=_,n.tileLayer=x,n.source=w,z.emit(k.MAP_READY,{map:n.map,mapStyleId:n.mapStyleId,mapSize:n.mapSize,crs:n.crs})})()}destroyMap(){var e,t;null===(e=this.mapEventHandles)||void 0===e||e.remove(),null===(t=this.appEventHandles)||void 0===t||t.remove(),this.mapEventHandles=null,this.appEventHandles=null,this.map&&(this.map.setTarget(null),this.map=null),this.view=null,this.tileLayer=null,this.source=null}setView(e){var{center:t,zoom:r}=e;this.view.animate({center:null!=t?t:this.view.getCenter(),zoom:null!=r?r:this.view.getZoom(),duration:q})}zoomIn(e){this.view.animate({zoom:this.view.getZoom()+e,duration:q})}zoomOut(e){this.view.animate({zoom:this.view.getZoom()-e,duration:q})}panBy(e){var t=this.view.getCenter(),r=this.view.getResolution();this.view.animate({center:[t[0]+e[0]*r,t[1]-e[1]*r],duration:q})}fitToBounds(e){var t,r=Array.isArray(e)?e:(t=Ao(e),i(t,"EPSG:4326","EPSG:27700"));this.view.fit(r,{duration:q})}setPadding(e){this.view.padding=Co(e)}getCenter(){var e=this.view.getCenter(),t=I;return[Math.round(e[0]*Math.pow(10,t))/Math.pow(10,t),Math.round(e[1]*Math.pow(10,t))/Math.pow(10,t)]}getZoom(){return this.view.getZoom()}getBounds(){return this.view.calculateExtent(this.map.getSize()).map(e=>Math.round(100*e)/100)}getFeaturesAtPoint(e,t){return[]}getVisibleFeatures(e){return[]}getAreaDimensions(){return(e=>{if(!e)return"";var[t,r,n,o]=e,a=n-t;return"".concat(_o(o-r)," by ").concat(_o(a))})((e=>{var t=e.getSize(),r=e.getView().padding||[0,0,0,0],[n,o,a,i]=r,s=[i,t[1]-a],l=[t[0]-o,n],u=e.getCoordinateFromPixel(s),p=e.getCoordinateFromPixel(l);return u&&p?[u[0],u[1],p[0],p[1]]:null})(this.map))}getCardinalMove(e,t){return((e,t)=>{var r=t[0]-e[0],n=t[1]-e[1],o=[];return Math.abs(n)>1&&o.push("".concat(n>0?"north":"south"," ").concat(_o(Math.abs(n)))),Math.abs(r)>1&&o.push("".concat(r>0?"east":"west"," ").concat(_o(Math.abs(r)))),o.join(", ")})(e,t)}getResolution(){return this.view.getResolution()}mapToScreen(e){if(!this.map)return{x:0,y:0};var t=this.map.getPixelFromCoordinate(e);return t?{x:t[0],y:t[1]}:{x:0,y:0}}screenToMap(e){return this.map.getCoordinateFromPixel([e.x,e.y])}isGeometryObscured(e,t){return jo(e,t,this.map)}}export{$o as default};