maplibre-gl 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maplibre-gl-csp-worker.js +1 -1
- package/dist/maplibre-gl-csp-worker.js.map +1 -1
- package/dist/maplibre-gl-csp.js +1 -1
- package/dist/maplibre-gl-csp.js.map +1 -1
- package/dist/maplibre-gl-dev.js +263 -64
- package/dist/maplibre-gl-dev.js.map +1 -1
- package/dist/maplibre-gl.d.ts +12 -3
- package/dist/maplibre-gl.js +4 -4
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +15 -15
- package/src/render/glyph_manager.test.ts +10 -9
- package/src/render/glyph_manager.ts +17 -10
- package/src/source/raster_dem_tile_source.ts +21 -9
- package/src/source/raster_dem_tile_worker_source.ts +7 -24
- package/src/source/raster_tile_source.test.ts +11 -0
- package/src/source/raster_tile_source.ts +24 -0
- package/src/style/style.ts +3 -0
- package/src/style/style_glyph.ts +4 -3
- package/src/symbol/quads.ts +4 -2
- package/src/ui/map.test.ts +17 -0
- package/src/util/offscreen_canvas_distorted.test.ts +13 -0
- package/src/util/offscreen_canvas_distorted.ts +39 -0
- package/src/util/util.test.ts +171 -1
- package/src/util/util.ts +150 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var maplibregl=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=r;function r(t,e){this.x=t,this.y=e}r.prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t};var n=t(e),i=s;function s(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}s.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<1e-6)break;r-=i/s}var a=0,o=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:o=r,r=.5*(o-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var a=t(i);function o(t,e,r){return Math.min(r,Math.max(e,t))}function l(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}function u(t,e,r){const n={};for(const i in t)n[i]=e.call(r||this,t[i],i,t);return n}function c(t){return Array.isArray(t)?t.map(c):"object"==typeof t&&t?u(t,c):t}new a(.25,.1,.25,1);const h={};function p(t){h[t]||("undefined"!=typeof console&&console.warn(t),h[t]=!0)}function f(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function d(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i<s;a=i++)r=t[i],n=t[a],e+=(n.x-r.x)*(r.y+n.y);return e}function y(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}let m=null;function g(t){if(null==m){const e=t.navigator?t.navigator.userAgent:null;m=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return m}function x(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}class v{constructor(t,e,r){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(let t=0;t<this.d*this.d;t++){const e=i[3+t],r=i[3+t+1];n.push(e===r?null:i.subarray(e,r))}const s=i[3+n.length+1];this.keys=i.subarray(i[3+n.length],s),this.bboxes=i.subarray(s),this.insert=this._insertReadonly}else{this.d=e+2*r;for(let t=0;t<this.d*this.d;t++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;const i=r/e*t;this.min=-i,this.max=t+i}insert(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,r,n,i,s){this.cells[i].push(s)}query(t,e,r,n,i){const s=this.min,a=this.max;if(t<=s&&e<=s&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);{const s=[];return this._forEachCell(t,e,r,n,this._queryCell,s,{},i),s}}_queryCell(t,e,r,n,i,s,a,o){const l=this.cells[i];if(null!==l){const i=this.keys,u=this.bboxes;for(let c=0;c<l.length;c++){const h=l[c];if(void 0===a[h]){const l=4*h;(o?o(u[l+0],u[l+1],u[l+2],u[l+3]):t<=u[l+2]&&e<=u[l+3]&&r>=u[l+0]&&n>=u[l+1])?(a[h]=!0,s.push(i[h])):a[h]=!1}}}}_forEachCell(t,e,r,n,i,s,a,o){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,t,e,r,n,u,s,a,o))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let r=0;for(let t=0;t<this.cells.length;t++)r+=this.cells[t].length;const n=new Int32Array(e+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let i=e;for(let e=0;e<t.length;e++){const r=t[e];n[3+e]=i,n.set(r,i),i+=r.length}return n[3+t.length]=i,n.set(this.keys,i),i+=this.keys.length,n[3+t.length+1]=i,n.set(this.bboxes,i),i+=this.bboxes.length,n.buffer}static serialize(t,e){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}}static deserialize(t){return new v(t.buffer)}}var b={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const w=["type","source","source-layer","minzoom","maxzoom","filter","layout"];class _{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function S(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}class k extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class A{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new A(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const I={kind:"null"},z={kind:"number"},M={kind:"string"},C={kind:"boolean"},P={kind:"color"},B={kind:"object"},V={kind:"value"},E={kind:"collator"},F={kind:"formatted"},T={kind:"padding"},D={kind:"resolvedImage"},$={kind:"variableAnchorOffsetCollection"};function L(t,e){return{kind:"array",itemType:t,N:e}}function O(t){if("array"===t.kind){const e=O(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const U=[I,z,M,C,P,F,B,L(V),T,D,$];function q(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!q(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of U)if(!q(t,e))return null}return`Expected ${O(t)} but found ${O(e)} instead.`}function j(t,e){return e.some((e=>e.kind===t.kind))}function R(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function N(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Z=.96422,J=.82521,G=4/29,K=6/29,X=3*K*K,Y=K*K*K,H=Math.PI/180,W=180/Math.PI;function Q(t){return(t%=360)<0&&(t+=360),t}function tt([t,e,r,n]){let i,s;const a=rt((.2225045*(t=et(t))+.7168786*(e=et(e))+.0606169*(r=et(r)))/1);t===e&&e===r?i=s=a:(i=rt((.4360747*t+.3850649*e+.1430804*r)/Z),s=rt((.0139322*t+.0971045*e+.7141733*r)/J));const o=116*a-16;return[o<0?0:o,500*(i-a),200*(a-s),n]}function et(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function rt(t){return t>Y?Math.pow(t,1/3):t/X+G}function nt([t,e,r,n]){let i=(t+16)/116,s=isNaN(e)?i:i+e/500,a=isNaN(r)?i:i-r/200;return i=1*st(i),s=Z*st(s),a=J*st(a),[it(3.1338561*s-1.6168667*i-.4906146*a),it(-.9787684*s+1.9161415*i+.033454*a),it(.0719453*s-.2289914*i+1.4052427*a),n]}function it(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function st(t){return t>K?t*t*t:X*(t-G)}function at(t){return parseInt(t.padEnd(2,t),16)/255}function ot(t,e){return lt(e?t/100:t,0,1)}function lt(t,e,r){return Math.min(Math.max(e,t),r)}function ut(t){return!t.some(Number.isNaN)}const ct={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]};class ht{constructor(t,e,r,n=1,i=!0){this.r=t,this.g=e,this.b=r,this.a=n,i||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,e,r,n]))}static parse(t){if(t instanceof ht)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=ct[t];if(e){const[t,r,n]=e;return[t/255,r/255,n/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let r=1;return[at(t.slice(r,r+=e)),at(t.slice(r,r+=e)),at(t.slice(r,r+=e)),at(t.slice(r,r+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,r,n,i,s,a,o,l,u,c,h,p]=e,f=[i||" ",o||" ",c].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){const t=[n,a,u].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[lt(+r/e,0,1),lt(+s/e,0,1),lt(+l/e,0,1),h?ot(+h,p):1];if(ut(t))return t}}return}}const r=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){const[t,e,n,i,s,a,o,l,u]=r,c=[n||" ",s||" ",o].join("");if(" "===c||" /"===c||",,"===c||",,,"===c){const t=[+e,lt(+i,0,100),lt(+a,0,100),l?ot(+l,u):1];if(ut(t))return function([t,e,r,n]){function i(n){const i=(n+t/30)%12,s=e*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(i-3,9-i,1))}return t=Q(t),e/=100,r/=100,[i(0),i(8),i(4),n]}(t)}}}(t);return e?new ht(...e,!1):void 0}get rgb(){const{r:t,g:e,b:r,a:n}=this,i=n||1/0;return this.overwriteGetter("rgb",[t/i,e/i,r/i,n])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,r,n,i]=tt(t),s=Math.sqrt(r*r+n*n);return[Math.round(1e4*s)?Q(Math.atan2(n,r)*W):NaN,s,e,i]}(this.rgb))}get lab(){return this.overwriteGetter("lab",tt(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,r,n]=this.rgb;return`rgba(${[t,e,r].map((t=>Math.round(255*t))).join(",")},${n})`}}ht.black=new ht(0,0,0,1),ht.white=new ht(1,1,1,1),ht.transparent=new ht(0,0,0,0),ht.red=new ht(1,0,0,1);class pt{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ft{constructor(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i}}class dt{constructor(t){this.sections=t}static fromString(t){return new dt([new ft(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof dt?t:dt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class yt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof yt)return t;if("number"==typeof t)return new yt([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new yt(t)}}toString(){return JSON.stringify(this.values)}}const mt=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class gt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof gt)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const r=t[e],n=t[e+1];if("string"!=typeof r||!mt.has(r))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new gt(t)}}toString(){return JSON.stringify(this.values)}}class xt{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new xt({name:t,available:!1}):null}}function vt(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function bt(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof ht||t instanceof pt||t instanceof dt||t instanceof yt||t instanceof gt||t instanceof xt)return!0;if(Array.isArray(t)){for(const e of t)if(!bt(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!bt(t[e]))return!1;return!0}return!1}function wt(t){if(null===t)return I;if("string"==typeof t)return M;if("boolean"==typeof t)return C;if("number"==typeof t)return z;if(t instanceof ht)return P;if(t instanceof pt)return E;if(t instanceof dt)return F;if(t instanceof yt)return T;if(t instanceof gt)return $;if(t instanceof xt)return D;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=wt(e);if(r){if(r===t)continue;r=V;break}r=t}return L(r||V,e)}return B}function _t(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof ht||t instanceof dt||t instanceof yt||t instanceof gt||t instanceof xt?t.toString():JSON.stringify(t)}class St{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!bt(t[1]))return e.error("invalid value");const r=t[1];let n=wt(r);const i=e.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new St(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class kt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const At={string:M,number:z,boolean:C,object:B};class It{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in At)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=At[r],n++}else i=V;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=L(i,s)}else{if(!At[i])throw new Error(`Types doesn't contain name = ${i}`);r=At[i]}const s=[];for(;n<t.length;n++){const r=e.parse(t[n],n,V);if(!r)return null;s.push(r)}return new It(r,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!q(this.type,wt(r)))return r;if(e===this.args.length-1)throw new kt(`Expected value to be of type ${O(this.type)}, but found ${O(wt(r))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const zt={"to-boolean":C,"to-color":P,"to-number":z,"to-string":M};class Mt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0];if(!zt[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!==t.length)return e.error("Expected one argument.");const n=zt[r],i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],r,V);if(!n)return null;i.push(n)}return new Mt(n,i)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,r;for(const n of this.args){if(e=n.evaluate(t),r=null,e instanceof ht)return e;if("string"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:vt(e[0],e[1],e[2],e[3]),!r))return new ht(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new kt(r||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const r of this.args){e=r.evaluate(t);const n=yt.parse(e);if(n)return n}throw new kt(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const r of this.args){e=r.evaluate(t);const n=gt.parse(e);if(n)return n}throw new kt(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new kt(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return dt.fromString(_t(this.args[0].evaluate(t)));case"resolvedImage":return xt.fromString(_t(this.args[0].evaluate(t)));default:return _t(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Ct=["Unknown","Point","LineString","Polygon"];class Pt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ct[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=ht.parse(t)),e}}class Bt{constructor(t,e,r=[],n,i=new A,s=[]){this.registry=t,this.path=r,this.key=r.map((t=>`[${t}]`)).join(""),this.scope=i,this.errors=s,this.expectedType=n,this._isConstant=e}parse(t,e,r,n,i={}){return e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)}_parse(t,e){function r(t,e,r){return"assert"===r?new It(e,[t]):"coerce"===r?new Mt(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const i=this.registry[n];if(i){let n=i.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,i=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind)if("padding"!==t.kind||"value"!==i.kind&&"number"!==i.kind&&"array"!==i.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==i.kind&&"array"!==i.kind){if(this.checkSubtype(t,i))return null}else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"assert")}if(!(n instanceof St)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const t=new Pt;try{n=new St(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new Bt(this.registry,this._isConstant,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new k(r,t))}checkSubtype(t,e){const r=q(t,e);return r&&this.error(r),r}}class Vt{constructor(t,e,r){this.type=E,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,C);if(!n)return null;const i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,C);if(!i)return null;let s=null;return r.locale&&(s=e.parse(r.locale,1,M),!s)?null:new Vt(n,i,s)}evaluate(t){return new pt(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}const Et=8192;function Ft(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Tt(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Dt(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*Et),Math.round(n*i*Et)]}function $t(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],a=t[1]-r[1];return n*a-s*i==0&&n*s<=0&&i*a<=0}function Lt(t,e){let r=!1;for(let a=0,o=e.length;a<o;a++){const o=e[a];for(let e=0,a=o.length;e<a-1;e++){if($t(t,o[e],o[e+1]))return!1;(i=o[e])[1]>(n=t)[1]!=(s=o[e+1])[1]>n[1]&&n[0]<(s[0]-i[0])*(n[1]-i[1])/(s[1]-i[1])+i[0]&&(r=!r)}}var n,i,s;return r}function Ot(t,e){for(let r=0;r<e.length;r++)if(Lt(t,e[r]))return!0;return!1}function Ut(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],a=(t[0]-r[0])*s-i*(t[1]-r[1]),o=(e[0]-r[0])*s-i*(e[1]-r[1]);return a>0&&o<0||a<0&&o>0}function qt(t,e,r){for(const u of r)for(let r=0;r<u.length-1;++r)if(0!=(o=[(a=u[r+1])[0]-(s=u[r])[0],a[1]-s[1]])[0]*(l=[(i=e)[0]-(n=t)[0],i[1]-n[1]])[1]-o[1]*l[0]&&Ut(n,i,s,a)&&Ut(s,a,n,i))return!0;var n,i,s,a,o,l;return!1}function jt(t,e){for(let r=0;r<t.length;++r)if(!Lt(t[r],e))return!1;for(let r=0;r<t.length-1;++r)if(qt(t[r],t[r+1],e))return!1;return!0}function Rt(t,e){for(let r=0;r<e.length;r++)if(jt(t,e[r]))return!0;return!1}function Nt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=[];for(let n=0;n<t[i].length;n++){const a=Dt(t[i][n],r);Ft(e,a),s.push(a)}n.push(s)}return n}function Zt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=Nt(t[i],e,r);n.push(s)}return n}function Jt(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i}Ft(e,t)}function Gt(t,e,r,n){const i=Math.pow(2,n.z)*Et,s=[n.x*Et,n.y*Et],a=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];Jt(n,e,r,i),a.push(n)}return a}function Kt(t,e,r,n){const i=Math.pow(2,n.z)*Et,s=[n.x*Et,n.y*Et],a=[];for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];Ft(e,r),t.push(r)}a.push(t)}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of a)for(const n of t)Jt(n,e,r,i)}var o;return a}class Xt{constructor(t,e){this.type=C,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(bt(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const r=e.features[t].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new Xt(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Xt(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Xt(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=Nt(e.coordinates,n,i),a=Gt(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of a)if(!Lt(t,s))return!1}if("MultiPolygon"===e.type){const s=Zt(e.coordinates,n,i),a=Gt(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of a)if(!Ot(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=Nt(e.coordinates,n,i),a=Kt(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of a)if(!jt(t,s))return!1}if("MultiPolygon"===e.type){const s=Zt(e.coordinates,n,i),a=Kt(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of a)if(!Rt(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Yt{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new Yt(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ht{constructor(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const r=t[0],n=Ht.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let o=null;for(const[n,s]of a){o=new Bt(e.registry,Wt,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const r=t[e],i=Array.isArray(n)?n[e-1]:n.type,s=o.parse(r,1+a.length,i);if(!s){l=!0;break}a.push(s)}if(!l)if(Array.isArray(n)&&n.length!==a.length)o.error(`Expected ${n.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=a[t];o.concat(t+1).checkSubtype(e,r.type)}if(0===o.errors.length)return new Ht(r,i,s,a)}}if(1===a.length)e.errors.push(...o.errors);else{const r=(a.length?a:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(O).join(", ")})`:`(${O(e.type)}...)`;var e})).join(" | "),n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],1+n.length);if(!i)return null;n.push(O(i.type))}e.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){Ht.definitions=e;for(const r in e)t[r]=Ht}}function Wt(t){if(t instanceof Yt)return Wt(t.boundExpression);if(t instanceof Ht&&"error"===t.name)return!1;if(t instanceof Vt)return!1;if(t instanceof Xt)return!1;const e=t instanceof Mt||t instanceof It;let r=!0;return t.eachChild((t=>{r=e?r&&Wt(t):r&&t instanceof St})),!!r&&Qt(t)&&ee(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Qt(t){if(t instanceof Ht){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Xt)return!1;let e=!0;return t.eachChild((t=>{e&&!Qt(t)&&(e=!1)})),e}function te(t){if(t instanceof Ht&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!te(t)&&(e=!1)})),e}function ee(t,e){if(t instanceof Ht&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!ee(t,e)&&(r=!1)})),r}function re(t,e){const r=t.length-1;let n,i,s=0,a=r,o=0;for(;s<=a;)if(o=Math.floor((s+a)/2),n=t[o],i=t[o+1],n<=e){if(o===r||e<i)return o;s=o+1}else{if(!(n>e))throw new kt("Input is not a number.");a=o-1}return 0}class ne{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,z);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r<t.length;r+=2){const s=1===r?-1/0:t[r],a=t[r+1],o=r,l=r+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,n.push([s,u])}return new ne(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[re(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function ie(t,e,r){return t+r*(e-t)}function se(t,e,r){return t.map(((t,n)=>ie(t,e[n],r)))}const ae={number:ie,color:function(t,e,r,n="rgb"){switch(n){case"rgb":{const[n,i,s,a]=se(t.rgb,e.rgb,r);return new ht(n,i,s,a,!1)}case"hcl":{const[n,i,s,a]=t.hcl,[o,l,u,c]=e.hcl;let h,p;if(isNaN(n)||isNaN(o))isNaN(n)?isNaN(o)?h=NaN:(h=o,1!==s&&0!==s||(p=l)):(h=n,1!==u&&0!==u||(p=i));else{let t=o-n;o>n&&t>180?t-=360:o<n&&n-o>180&&(t+=360),h=n+r*t}const[f,d,y,m]=function([t,e,r,n]){return t=isNaN(t)?0:t*H,nt([r,Math.cos(t)*e,Math.sin(t)*e,n])}([h,null!=p?p:ie(i,l,r),ie(s,u,r),ie(a,c,r)]);return new ht(f,d,y,m,!1)}case"lab":{const[n,i,s,a]=nt(se(t.lab,e.lab,r));return new ht(n,i,s,a,!1)}}},array:se,padding:function(t,e,r){return new yt(se(t.values,e.values,r))},variableAnchorOffsetCollection:function(t,e,r){const n=t.values,i=e.values;if(n.length!==i.length)throw new kt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const s=[];for(let t=0;t<n.length;t+=2){if(n[t]!==i[t])throw new kt(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${n[t]}, to[${t}]: ${i[t]}`);s.push(n[t]);const[e,a]=n[t+1],[o,l]=i[t+1];s.push([ie(e,o,r),ie(a,l,r)])}return new gt(s)}};class oe{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,r,n){let i=0;if("exponential"===t.name)i=le(e,t.base,r,n);else if("linear"===t.name)i=le(e,1,r,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;i=new a(s[0],s[1],s[2],s[3]).solve(le(e,1,r,n))}return i}static parse(t,e){let[r,n,i,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,z),!i)return null;const a=[];let o=null;"interpolate-hcl"===r||"interpolate-lab"===r?o=P:e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t<s.length;t+=2){const r=s[t],n=s[t+1],i=t+3,l=t+4;if("number"!=typeof r)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,a.push([r,u])}return N(o,z)||N(o,P)||N(o,T)||N(o,$)||N(o,L(z))?new oe(o,r,n,i,a):e.error(`Type ${O(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=re(e,n),a=oe.interpolationFactor(this.interpolation,n,e[s],e[s+1]),o=r[s].evaluate(t),l=r[s+1].evaluate(t);switch(this.operator){case"interpolate":return ae[this.type.kind](o,l,a);case"interpolate-hcl":return ae.color(o,l,a,"hcl");case"interpolate-lab":return ae.color(o,l,a,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function le(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}class ue{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let r=null;const n=e.expectedType;n&&"value"!==n.kind&&(r=n);const i=[];for(const n of t.slice(1)){const t=e.parse(n,1+i.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,i.push(t)}if(!r)throw new Error("No output type");const s=n&&i.some((t=>q(n,t.type)));return new ue(s?V:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args)if(n++,r=i.evaluate(t),r&&r instanceof xt&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null!==r)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class ce{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n<t.length-1;n+=2){const i=t[n];if("string"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;r.push([i,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return n?new ce(r,n):null}outputDefined(){return this.result.outputDefined()}}class he{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,z),n=e.parse(t[2],2,L(e.expectedType||V));return r&&n?new he(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new kt(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new kt(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new kt(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class pe{constructor(t,e){this.type=C,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,V),n=e.parse(t[2],2,V);return r&&n?j(r.type,[C,M,z,I,V])?new pe(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${O(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!R(e,["boolean","string","number","null"]))throw new kt(`Expected first argument to be of type boolean, string, number or null, but found ${O(wt(e))} instead.`);if(!R(r,["string","array"]))throw new kt(`Expected second argument to be of type array or string, but found ${O(wt(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class fe{constructor(t,e,r){this.type=z,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,V),n=e.parse(t[2],2,V);if(!r||!n)return null;if(!j(r.type,[C,M,z,I,V]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${O(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,z);return i?new fe(r,n,i):null}return new fe(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!R(e,["boolean","string","number","null"]))throw new kt(`Expected first argument to be of type boolean, string, number or null, but found ${O(wt(e))} instead.`);if(!R(r,["string","array"]))throw new kt(`Expected second argument to be of type array or string, but found ${O(wt(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class de{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let a=2;a<t.length-1;a+=2){let o=t[a];const l=t[a+1];Array.isArray(o)||(o=[o]);const u=e.concat(a);if(0===o.length)return u.error("Expected at least one branch label.");for(const t of o){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,wt(t)))return null}else r=wt(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,s.push(c)}const a=e.parse(t[1],1,V);if(!a)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new de(r,n,a,i,s,o):null}evaluate(t){const e=this.input.evaluate(t);return(wt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class ye{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;i<t.length-1;i+=2){const s=e.parse(t[i],i,C);if(!s)return null;const a=e.parse(t[i+1],i+1,r);if(!a)return null;n.push([s,a]),r=r||a.type}const i=e.parse(t[t.length-1],t.length-1,r);if(!i)return null;if(!r)throw new Error("Can't infer output type");return new ye(r,n,i)}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class me{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,V),n=e.parse(t[2],2,z);if(!r||!n)return null;if(!j(r.type,[L(V),M,V]))return e.error(`Expected first argument to be of type array or string, but found ${O(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,z);return i?new me(r.type,r,n,i):null}return new me(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!R(e,["string","array"]))throw new kt(`Expected first argument to be of type array or string, but found ${O(wt(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ge(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function xe(t,e,r,n){return 0===n.compare(e,r)}function ve(t,e,r){const n="=="!==t&&"!="!==t;return class i{constructor(t,e,r){this.type=C,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let s=e.parse(t[1],1,V);if(!s)return null;if(!ge(r,s.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${O(s.type)}'.`);let a=e.parse(t[2],2,V);if(!a)return null;if(!ge(r,a.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${O(a.type)}'.`);if(s.type.kind!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${O(s.type)}' and '${O(a.type)}'.`);n&&("value"===s.type.kind&&"value"!==a.type.kind?s=new It(a.type,[s]):"value"!==s.type.kind&&"value"===a.type.kind&&(a=new It(s.type,[a])));let o=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(o=e.parse(t[3],3,E),!o)return null}return new i(s,a,o)}evaluate(i){const s=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=wt(s),r=wt(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new kt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=wt(s),r=wt(a);if("string"!==t.kind||"string"!==r.kind)return e(i,s,a)}return this.collator?r(i,s,a,this.collator.evaluate(i)):e(i,s,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const be=ve("==",(function(t,e,r){return e===r}),xe),we=ve("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!xe(0,e,r,n)})),_e=ve("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),Se=ve(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),ke=ve("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Ae=ve(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class Ie{constructor(t,e,r,n,i){this.type=M,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,z);if(!r)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=e.parse(n.locale,1,M),!i))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,M),!s))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,z),!a))return null;let o=null;return n["max-fraction-digits"]&&(o=e.parse(n["max-fraction-digits"],1,z),!o)?null:new Ie(r,i,s,a,o)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class ze{constructor(t){this.type=F,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const s=t[r];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,z),!t))return null;let r=null;if(s["text-font"]&&(r=e.parse(s["text-font"],1,L(M)),!r))return null;let a=null;if(s["text-color"]&&(a=e.parse(s["text-color"],1,P),!a))return null;const o=n[n.length-1];o.scale=t,o.font=r,o.textColor=a}else{const s=e.parse(t[r],1,V);if(!s)return null;const a=s.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new ze(n)}evaluate(t){return new dt(this.sections.map((e=>{const r=e.content.evaluate(t);return wt(r)===D?new ft("",r,null,null,null):new ft(_t(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}}class Me{constructor(t){this.type=D,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,M);return r?new Me(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=xt.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}}class Ce{constructor(t){this.type=z,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${O(r.type)} instead.`):new Ce(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new kt(`Expected value to be of type string or array, but found ${O(wt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Pe={"==":be,"!=":we,">":Se,"<":_e,">=":Ae,"<=":ke,array:It,at:he,boolean:It,case:ye,coalesce:ue,collator:Vt,format:ze,image:Me,in:pe,"index-of":fe,interpolate:oe,"interpolate-hcl":oe,"interpolate-lab":oe,length:Ce,let:ce,literal:St,match:de,number:It,"number-format":Ie,object:It,slice:me,step:ne,string:It,"to-boolean":Mt,"to-color":Mt,"to-number":Mt,"to-string":Mt,var:Yt,within:Xt};function Be(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=vt(e,r,n,s);if(a)throw new kt(a);return new ht(e/255,r/255,n/255,s,!1)}function Ve(t,e){return t in e}function Ee(t,e){const r=e[t];return void 0===r?null:r}function Fe(t){return{type:t}}function Te(t){return{result:"success",value:t}}function De(t){return{result:"error",value:t}}function $e(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Le(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Oe(t){return!!t.expression&&t.expression.interpolated}function Ue(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function qe(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function je(t){return t}function Re(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(Oe(e)?"exponential":"interval");if(r||"padding"===e.type){const n=r?ht.parse:yt.parse;(t=S({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],n(t[1])]))),t.default=n(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(a=t.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${t.colorSpace}"`);var a;let o,l,u;if("exponential"===s)o=Ge;else if("interval"===s)o=Je;else if("categorical"===s){o=Ze,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];u=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);o=Ke}if(n){const r={},n=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],s=i[0].zoom;void 0===r[s]&&(r[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},n.push(s)),r[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of n)i.push([r[t].zoom,Re(r[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:oe.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>Ge({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:oe.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>o(t,e,r,l,u)}}return{kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?Ne(t.default,e.default):o(t,e,i,l,u)}}}function Ne(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Ze(t,e,r,n,i){return Ne(typeof r===i?n[r]:void 0,t.default,e.default)}function Je(t,e,r){if("number"!==Ue(r))return Ne(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=re(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function Ge(t,e,r){const n=void 0!==t.base?t.base:1;if("number"!==Ue(r))return Ne(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const s=re(t.stops.map((t=>t[0])),r),a=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),o=t.stops[s][1],l=t.stops[s+1][1],u=ae[e.type]||je;return"function"==typeof o.evaluate?{evaluate(...e){const r=o.evaluate.apply(void 0,e),n=l.evaluate.apply(void 0,e);if(void 0!==r&&void 0!==n)return u(r,n,a,t.colorSpace)}}:u(o,l,a,t.colorSpace)}function Ke(t,e,r){switch(e.type){case"color":r=ht.parse(r);break;case"formatted":r=dt.fromString(r.toString());break;case"resolvedImage":r=xt.fromString(r.toString());break;case"padding":r=yt.parse(r);break;default:Ue(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0)}return Ne(r,t.default,e.default)}Ht.register(Pe,{error:[{kind:"error"},[M],(t,[e])=>{throw new kt(e.evaluate(t))}],typeof:[M,[V],(t,[e])=>O(wt(e.evaluate(t)))],"to-rgba":[L(z,4),[P],(t,[e])=>{const[r,n,i,s]=e.evaluate(t).rgb;return[255*r,255*n,255*i,s]}],rgb:[P,[z,z,z],Be],rgba:[P,[z,z,z,z],Be],has:{type:C,overloads:[[[M],(t,[e])=>Ve(e.evaluate(t),t.properties())],[[M,B],(t,[e,r])=>Ve(e.evaluate(t),r.evaluate(t))]]},get:{type:V,overloads:[[[M],(t,[e])=>Ee(e.evaluate(t),t.properties())],[[M,B],(t,[e,r])=>Ee(e.evaluate(t),r.evaluate(t))]]},"feature-state":[V,[M],(t,[e])=>Ee(e.evaluate(t),t.featureState||{})],properties:[B,[],t=>t.properties()],"geometry-type":[M,[],t=>t.geometryType()],id:[V,[],t=>t.id()],zoom:[z,[],t=>t.globals.zoom],"heatmap-density":[z,[],t=>t.globals.heatmapDensity||0],"line-progress":[z,[],t=>t.globals.lineProgress||0],accumulated:[V,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[z,Fe(z),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[z,Fe(z),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:z,overloads:[[[z,z],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[z],(t,[e])=>-e.evaluate(t)]]},"/":[z,[z,z],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[z,[z,z],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[z,[],()=>Math.LN2],pi:[z,[],()=>Math.PI],e:[z,[],()=>Math.E],"^":[z,[z,z],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[z,[z],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[z,[z],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[z,[z],(t,[e])=>Math.log(e.evaluate(t))],log2:[z,[z],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[z,[z],(t,[e])=>Math.sin(e.evaluate(t))],cos:[z,[z],(t,[e])=>Math.cos(e.evaluate(t))],tan:[z,[z],(t,[e])=>Math.tan(e.evaluate(t))],asin:[z,[z],(t,[e])=>Math.asin(e.evaluate(t))],acos:[z,[z],(t,[e])=>Math.acos(e.evaluate(t))],atan:[z,[z],(t,[e])=>Math.atan(e.evaluate(t))],min:[z,Fe(z),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[z,Fe(z),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[z,[z],(t,[e])=>Math.abs(e.evaluate(t))],round:[z,[z],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[z,[z],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[z,[z],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[C,[M,V],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[C,[V],(t,[e])=>t.id()===e.value],"filter-type-==":[C,[M],(t,[e])=>t.geometryType()===e.value],"filter-<":[C,[M,V],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[C,[V],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[C,[M,V],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[C,[V],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[C,[M,V],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[C,[V],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[C,[M,V],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[C,[V],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[C,[V],(t,[e])=>e.value in t.properties()],"filter-has-id":[C,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[C,[L(M)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[C,[L(V)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[C,[M,L(V)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[C,[M,L(V)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:C,overloads:[[[C,C],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Fe(C),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:C,overloads:[[[C,C],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Fe(C),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[C,[C],(t,[e])=>!e.evaluate(t)],"is-supported-script":[C,[M],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[M,[M],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[M,[M],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[M,Fe(V),(t,e)=>e.map((e=>_t(e.evaluate(t)))).join("")],"resolved-locale":[M,[E],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Xe{constructor(t,e){var r;this.expression=t,this._warningHistory={},this._evaluator=new Pt,this._defaultValue=e?"color"===(r=e).type&&qe(r.default)?new ht(0,0,0,0):"color"===r.type?ht.parse(r.default)||null:"padding"===r.type?yt.parse(r.default)||null:"variableAnchorOffsetCollection"===r.type?gt.parse(r.default)||null:void 0===r.default?null:r.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new kt(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Ye(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Pe}function He(t,e){const r=new Bt(Pe,Wt,[],e?function(t){const e={color:P,string:M,number:z,enum:M,boolean:C,formatted:F,padding:T,resolvedImage:D,variableAnchorOffsetCollection:$};return"array"===t.type?L(e[t.value]||V,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Te(new Xe(n,e)):De(r.errors)}class We{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!te(e.expression)}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}}class Qe{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!te(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?oe.interpolationFactor(this.interpolationType,t,e,r):0}}function tr(t,e){const r=He(t,e);if("error"===r.result)return r;const n=r.value.expression,i=Qt(n);if(!i&&!$e(e))return De([new k("","data expressions not supported")]);const s=ee(n,["zoom"]);if(!s&&!Le(e))return De([new k("","zoom expressions not supported")]);const a=rr(n);return a||s?a instanceof k?De([a]):a instanceof oe&&!Oe(e)?De([new k("",'"interpolate" expressions cannot be used with this property')]):Te(a?new Qe(i?"camera":"composite",r.value,a.labels,a instanceof oe?a.interpolation:void 0):new We(i?"constant":"source",r.value)):De([new k("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class er{constructor(t,e){this._parameters=t,this._specification=e,S(this,Re(this._parameters,this._specification))}static deserialize(t){return new er(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function rr(t){let e=null;if(t instanceof ce)e=rr(t.result);else if(t instanceof ue){for(const r of t.args)if(e=rr(r),e)break}else(t instanceof ne||t instanceof oe)&&t.input instanceof Ht&&"zoom"===t.input.name&&(e=t);return e instanceof k||t.eachChild((t=>{const r=rr(t);r instanceof k?e=r:!e&&r?e=new k("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new k("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function nr(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!nr(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const ir={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function sr(t){if(null==t)return{filter:()=>!0,needGeometry:!1};nr(t)||(t=lr(t));const e=He(t,ir);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,r,n)=>e.value.evaluate(t,r,{},n),needGeometry:or(t)}}function ar(t,e){return t<e?-1:t>e?1:0}function or(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(or(t[e]))return!0;return!1}function lr(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?ur(t[1],t[2],"=="):"!="===e?pr(ur(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?ur(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(lr))):"all"===e?["all"].concat(t.slice(1).map(lr)):"none"===e?["all"].concat(t.slice(1).map(lr).map(pr)):"in"===e?cr(t[1],t.slice(2)):"!in"===e?pr(cr(t[1],t.slice(2))):"has"===e?hr(t[1]):"!has"===e?pr(hr(t[1])):"within"!==e||t;var r}function ur(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function cr(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(ar)]]:["filter-in-small",t,["literal",e]]}}function hr(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function pr(t){return["!",t]}function fr(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const r of t)e+=`${fr(r)},`;return`${e}]`}const r=Object.keys(t).sort();let n="{";for(let e=0;e<r.length;e++)n+=`${JSON.stringify(r[e])}:${fr(t[r[e]])},`;return`${n}}`}function dr(t){let e="";for(const r of w)e+=`/${fr(t[r])}`;return e}function yr(t){const e=t.value;return e?[new _(t.key,e,"constants have been deprecated as of v8")]:[]}function mr(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function gr(t){if(Array.isArray(t))return t.map(gr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=gr(t[r]);return e}return mr(t)}function xr(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,a=t.styleSpec,o=t.validateSpec;let l=[];const u=Ue(r);if("object"!==u)return[new _(e,r,`object expected, ${u} found`)];for(const t in r){const u=t.split(".")[0],c=n[u]||n["*"];let h;if(i[u])h=i[u];else if(n[u])h=o;else if(i["*"])h=i["*"];else{if(!n["*"]){l.push(new _(e,r[t],`unknown property "${t}"`));continue}h=o}l=l.concat(h({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:c,style:s,styleSpec:a,object:r,objectKey:t,validateSpec:o},r))}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&l.push(new _(e,r,`missing required property "${t}"`));return l}function vr(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,s=t.key,a=t.arrayElementValidator||t.validateSpec;if("array"!==Ue(e))return[new _(s,e,`array expected, ${Ue(e)} found`)];if(r.length&&e.length!==r.length)return[new _(s,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new _(s,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let o={type:r.value,values:r.values};i.$version<7&&(o.function=r.function),"object"===Ue(r.value)&&(o=r.value);let l=[];for(let r=0;r<e.length;r++)l=l.concat(a({array:e,arrayIndex:r,value:e[r],valueSpec:o,validateSpec:t.validateSpec,style:n,styleSpec:i,key:`${s}[${r}]`}));return l}function br(t){const e=t.key,r=t.value,n=t.valueSpec;let i=Ue(r);return"number"===i&&r!=r&&(i="NaN"),"number"!==i?[new _(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new _(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new _(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function wr(t){const e=t.valueSpec,r=mr(t.value.type);let n,i,s,a={};const o="categorical"!==r&&void 0===t.value.property,l=!o,u="array"===Ue(t.value.stops)&&"array"===Ue(t.value.stops[0])&&"object"===Ue(t.value.stops[0][0]),c=xr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new _(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(vr({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Ue(n)&&0===n.length&&e.push(new _(t.key,n,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&o&&c.push(new _(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||c.push(new _(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!Oe(t.valueSpec)&&c.push(new _(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!$e(t.valueSpec)?c.push(new _(t.key,t.value,"property functions not supported")):o&&!Le(t.valueSpec)&&c.push(new _(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||c.push(new _(t.key,t.value,'"property" property is required')),c;function h(t){let r=[];const n=t.value,o=t.key;if("array"!==Ue(n))return[new _(o,n,`array expected, ${Ue(n)} found`)];if(2!==n.length)return[new _(o,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==Ue(n[0]))return[new _(o,n,`object expected, ${Ue(n[0])} found`)];if(void 0===n[0].zoom)return[new _(o,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new _(o,n,"object stop key must have value")];if(s&&s>mr(n[0].zoom))return[new _(o,n[0].zoom,"stop zoom values must appear in ascending order")];mr(n[0].zoom)!==s&&(s=mr(n[0].zoom),i=void 0,a={}),r=r.concat(xr({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:br,value:p}}))}else r=r.concat(p({key:`${o}[0]`,value:n[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return Ye(gr(n[1]))?r.concat([new _(`${o}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(t.validateSpec({key:`${o}[1]`,value:n[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const o=Ue(t.value),l=mr(t.value),u=null!==t.value?t.value:s;if(n){if(o!==n)return[new _(t.key,u,`${o} stop domain type must match previous stop domain type ${n}`)]}else n=o;if("number"!==o&&"string"!==o&&"boolean"!==o)return[new _(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==r){let n=`number expected, ${o} found`;return $e(e)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new _(t.key,u,n)]}return"categorical"!==r||"number"!==o||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===o&&void 0!==i&&l<i?[new _(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===r&&l in a?[new _(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new _(t.key,u,`integer expected, found ${l}`)]}}function _r(t){const e=("property"===t.expressionContext?tr:He)(gr(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new _(`${t.key}${e.key}`,t.value,e.message)));const r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new _(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!te(r))return[new _(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!te(r))return[new _(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!ee(r,["zoom","feature-state"]))return[new _(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Qt(r))return[new _(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Sr(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(mr(r))&&i.push(new _(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(mr(r))&&i.push(new _(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function kr(t){return nr(gr(t.value))?_r(S({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ar(t)}function Ar(t){const e=t.value,r=t.key;if("array"!==Ue(e))return[new _(r,e,`array expected, ${Ue(e)} found`)];const n=t.styleSpec;let i,s=[];if(e.length<1)return[new _(r,e,"filter array must have at least 1 element")];switch(s=s.concat(Sr({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),mr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===mr(e[1])&&s.push(new _(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new _(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=Ue(e[1]),"string"!==i&&s.push(new _(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=Ue(e[a]),"$type"===mr(e[1])?s=s.concat(Sr({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new _(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(Ar({key:`${r}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=Ue(e[1]),2!==e.length?s.push(new _(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new _(`${r}[1]`,e[1],`string expected, ${i} found`));break;case"within":i=Ue(e[1]),2!==e.length?s.push(new _(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==i&&s.push(new _(`${r}[1]`,e[1],`object expected, ${i} found`))}return s}function Ir(t,e){const r=t.key,n=t.validateSpec,i=t.style,s=t.styleSpec,a=t.value,o=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return[];const u=o.match(/^(.*)-transition$/);if("paint"===e&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:s.transition,style:i,styleSpec:s});const c=t.valueSpec||l[o];if(!c)return[new _(r,a,`unknown property "${o}"`)];let h;if("string"===Ue(a)&&$e(c)&&!c.tokens&&(h=/^{([^}]+)}$/.exec(a)))return[new _(r,a,`"${o}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const p=[];return"symbol"===t.layerType&&("text-field"===o&&i&&!i.glyphs&&p.push(new _(r,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&qe(gr(a))&&"identity"===mr(a.type)&&p.push(new _(r,a,'"text-font" does not support identity functions'))),p.concat(n({key:t.key,value:a,valueSpec:c,style:i,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:o}))}function zr(t){return Ir(t,"paint")}function Mr(t){return Ir(t,"layout")}function Cr(t){let e=[];const r=t.value,n=t.key,i=t.style,s=t.styleSpec;r.type||r.ref||e.push(new _(n,r,'either "type" or "ref" is required'));let a=mr(r.type);const o=mr(r.ref);if(r.id){const s=mr(r.id);for(let a=0;a<t.arrayIndex;a++){const t=i.layers[a];mr(t.id)===s&&e.push(new _(n,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in r&&e.push(new _(n,r[t],`"${t}" is prohibited for ref layers`))})),i.layers.forEach((e=>{mr(e.id)===o&&(t=e)})),t?t.ref?e.push(new _(n,r.ref,"ref cannot reference another ref layer")):a=mr(t.type):e.push(new _(n,r.ref,`ref layer "${o}" not found`))}else if("background"!==a)if(r.source){const t=i.sources&&i.sources[r.source],s=t&&mr(t.type);t?"vector"===s&&"raster"===a?e.push(new _(n,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==s&&"hillshade"===a?e.push(new _(n,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===s&&"raster"!==a?e.push(new _(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==a?e.push(new _(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!r.paint||!r.paint["line-gradient"]||"geojson"===s&&t.lineMetrics||e.push(new _(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new _(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new _(n,r.source,`source "${r.source}" not found`))}else e.push(new _(n,r,'missing required property "source"'));return e=e.concat(xr({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"}),filter:kr,layout:t=>xr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Mr(S({layerType:a},t))}}),paint:t=>xr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>zr(S({layerType:a},t))}})}})),e}function Pr(t){const e=t.value,r=t.key,n=Ue(e);return"string"!==n?[new _(r,e,`string expected, ${n} found`)]:[]}const Br={promoteId:function({key:t,value:e}){if("string"===Ue(e))return Pr({key:t,value:e});{const r=[];for(const n in e)r.push(...Pr({key:`${t}.${n}`,value:e[n]}));return r}}};function Vr(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style,s=t.validateSpec;if(!e.type)return[new _(r,e,'"type" is required')];const a=mr(e.type);let o;switch(a){case"vector":case"raster":return o=xr({key:r,value:e,valueSpec:n[`source_${a.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:Br,validateSpec:s}),o;case"raster-dem":return o=function(t){var e;const r=null!==(e=t.sourceName)&&void 0!==e?e:"",n=t.value,i=t.styleSpec,s=i.source_raster_dem,a=t.style;let o=[];const l=Ue(n);if(void 0===n)return o;if("object"!==l)return o.push(new _("source_raster_dem",n,`object expected, ${l} found`)),o;const u="custom"===mr(n.encoding),c=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in n)!u&&c.includes(e)?o.push(new _(e,n[e],`In "${r}": "${e}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):s[e]?o=o.concat(t.validateSpec({key:e,value:n[e],valueSpec:s[e],validateSpec:t.validateSpec,style:a,styleSpec:i})):o.push(new _(e,n[e],`unknown property "${e}"`));return o}({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:s}),o;case"geojson":if(o=xr({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:s,objectElementValidators:Br}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],a="string"==typeof n?[n,["accumulated"],["get",t]]:n;o.push(..._r({key:`${r}.${t}.map`,value:i,validateSpec:s,expressionContext:"cluster-map"})),o.push(..._r({key:`${r}.${t}.reduce`,value:a,validateSpec:s,expressionContext:"cluster-reduce"}))}return o;case"video":return xr({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:s,styleSpec:n});case"image":return xr({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:s,styleSpec:n});case"canvas":return[new _(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Sr({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:s,styleSpec:n})}}function Er(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let s=[];const a=Ue(e);if(void 0===e)return s;if("object"!==a)return s=s.concat([new _("light",e,`object expected, ${a} found`)]),s;for(const a in e){const o=a.match(/^(.*)-transition$/);s=s.concat(o&&n[o[1]]&&n[o[1]].transition?t.validateSpec({key:a,value:e[a],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r}):n[a]?t.validateSpec({key:a,value:e[a],valueSpec:n[a],validateSpec:t.validateSpec,style:i,styleSpec:r}):[new _(a,e[a],`unknown property "${a}"`)])}return s}function Fr(t){const e=t.value,r=t.styleSpec,n=r.terrain,i=t.style;let s=[];const a=Ue(e);if(void 0===e)return s;if("object"!==a)return s=s.concat([new _("terrain",e,`object expected, ${a} found`)]),s;for(const a in e)s=s.concat(n[a]?t.validateSpec({key:a,value:e[a],valueSpec:n[a],validateSpec:t.validateSpec,style:i,styleSpec:r}):[new _(a,e[a],`unknown property "${a}"`)]);return s}function Tr(t){let e=[];const r=t.value,n=t.key;if(Array.isArray(r)){const i=[],s=[];for(const a in r)r[a].id&&i.includes(r[a].id)&&e.push(new _(n,r,`all the sprites' ids must be unique, but ${r[a].id} is duplicated`)),i.push(r[a].id),r[a].url&&s.includes(r[a].url)&&e.push(new _(n,r,`all the sprites' URLs must be unique, but ${r[a].url} is duplicated`)),s.push(r[a].url),e=e.concat(xr({key:`${n}[${a}]`,value:r[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return Pr({key:n,value:r})}const Dr={"*":()=>[],array:vr,boolean:function(t){const e=t.value,r=t.key,n=Ue(e);return"boolean"!==n?[new _(r,e,`boolean expected, ${n} found`)]:[]},number:br,color:function(t){const e=t.key,r=t.value,n=Ue(r);return"string"!==n?[new _(e,r,`color expected, ${n} found`)]:ht.parse(String(r))?[]:[new _(e,r,`color expected, "${r}" found`)]},constants:yr,enum:Sr,filter:kr,function:wr,layer:Cr,object:xr,source:Vr,light:Er,terrain:Fr,string:Pr,formatted:function(t){return 0===Pr(t).length?[]:_r(t)},resolvedImage:function(t){return 0===Pr(t).length?[]:_r(t)},padding:function(t){const e=t.key,r=t.value;if("array"===Ue(r)){if(r.length<1||r.length>4)return[new _(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const n={type:"number"};let i=[];for(let s=0;s<r.length;s++)i=i.concat(t.validateSpec({key:`${e}[${s}]`,value:r[s],validateSpec:t.validateSpec,valueSpec:n}));return i}return br({key:e,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(t){const e=t.key,r=t.value,n=Ue(r),i=t.styleSpec;if("array"!==n||r.length<1||r.length%2!=0)return[new _(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let n=0;n<r.length;n+=2)s=s.concat(Sr({key:`${e}[${n}]`,value:r[n],valueSpec:i.layout_symbol["text-anchor"]})),s=s.concat(vr({key:`${e}[${n+1}]`,value:r[n+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return s},sprite:Tr};function $r(t){const e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=$r,r.expression&&qe(mr(e))?wr(t):r.expression&&Ye(gr(e))?_r(t):r.type&&Dr[r.type]?Dr[r.type](t):xr(S({},t,{valueSpec:r.type?n[r.type]:r}))}function Lr(t){const e=t.value,r=t.key,n=Pr(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new _(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new _(r,e,'"glyphs" url must include a "{range}" token'))),n}function Or(t,e=b){let r=[];return r=r.concat($r({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:$r,objectElementValidators:{glyphs:Lr,"*":()=>[]}})),t.constants&&(r=r.concat(yr({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:$r}))),qr(r)}function Ur(t){return function(e){return t({...e,validateSpec:$r})}}function qr(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function jr(t){return function(...e){return qr(t.apply(this,e))}}Or.source=jr(Ur(Vr)),Or.sprite=jr(Ur(Tr)),Or.glyphs=jr(Ur(Lr)),Or.light=jr(Ur(Er)),Or.terrain=jr(Ur(Fr)),Or.layer=jr(Ur(Cr)),Or.filter=jr(Ur(kr)),Or.paintProperty=jr(Ur(zr)),Or.layoutProperty=jr(Ur(Mr));const Rr={};class Nr extends Error{constructor(t,e,r,n){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=n}}const Zr=y()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function Jr(t,e){const r=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:Zr(),signal:r.signal});let i=!1,s=!1;"json"===t.type&&n.headers.set("Accept","application/json");return s||fetch(n).then((r=>r.ok?(r=>{("arrayBuffer"===t.type||"image"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{s||(i=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((t=>{s||e(new Error(t.message))}))})(r):r.blob().then((n=>e(new Nr(r.status,r.statusText,t.url,n)))))).catch((t=>{20!==t.code&&e(new Error(t.message))})),{cancel:()=>{s=!0,i||r.abort()}}}const Gr=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(y()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!y())return(Rr[(r=t.url).substring(0,r.indexOf("://"))]||Jr)(t,e)}var r;if(!(t=>/^file:/.test(t)||/^file:/.test(Zr())&&!/^\w+:/.test(t))(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Jr(t,e);if(y()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}return function(t,e){const r=new XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{e(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else{const n=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});e(new Nr(r.status,r.statusText,t.url,n))}},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},Kr={};function Xr(t,e,r={}){if(Kr[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Kr[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Xr("Object",Object),Xr("TransferableGridIndex",v),Xr("Color",ht),Xr("Error",Error),Xr("AJAXError",Nr),Xr("ResolvedImage",xt),Xr("StylePropertyFunction",er),Xr("StyleExpression",Xe,{omit:["_evaluator"]}),Xr("ZoomDependentExpression",Qe),Xr("ZoomConstantExpression",We),Xr("CompoundExpression",Ht,{omit:["_evaluate"]});for(const t in Pe)Pe[t]._classRegistryKey||Xr(`Expression_${t}`,Pe[t]);function Yr(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Hr(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(Yr(t))return e&&e.push(t),t;if(x(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const r=t;return e&&e.push(r.buffer),r}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(Hr(n,e));return r}if("object"==typeof t){const r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error("can't serialize object of unregistered class");if(!Kr[n])throw new Error(`${n} is not registered.`);const i=r.serialize?r.serialize(t,e):{};if(r.serialize){if(e&&i===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const r in t){if(!t.hasOwnProperty(r))continue;if(Kr[n].omit.indexOf(r)>=0)continue;const s=t[r];i[r]=Kr[n].shallow.indexOf(r)>=0?s:Hr(s,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(i.$name=n),i}throw new Error("can't serialize object of type "+typeof t)}function Wr(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||Yr(t)||x(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Wr);if("object"==typeof t){const e=t.$name||"Object";if(!Kr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Kr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const r of Object.keys(t)){if("$name"===r)continue;const i=t[r];n[r]=Kr[e].shallow.indexOf(r)>=0?i:Wr(i)}return n}throw new Error("can't deserialize object of type "+typeof t)}class Qr{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){delete this._channel,this._callback=()=>{}}}class tn{constructor(t,e,r){this.receive=t=>{const e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[r];const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t()}else y()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},this.process=()=>{if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)},this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new Qr(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=y()?t:window}send(t,e,r,n,i=!1){const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[s]=r);const a=g(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:Hr(e,a)},a),{cancel:()=>{r&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}processTask(t,e){if("<response>"===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(Wr(e.error)):r(null,Wr(e.data)))}else{let r=!1;const n=g(this.globalScope)?void 0:[],i=e.hasCallback?(e,i)=>{r=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?Hr(e):null,data:Hr(i,n)},n)}:t=>{r=!0};let s=null;const a=Wr(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,a,i);else if(this.parent.getWorkerSource){const t=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,t[0],a.source)[t[1]](a,i)}else i(new Error(`Could not find function ${e.type}`));!r&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}}function en(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function rn(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}class nn{constructor(t,e={}){l(this,e),this.type=t}}class sn extends nn{constructor(t,e={}){super("error",l({error:t},e))}}class an{on(t,e){return this._listeners=this._listeners||{},en(t,e,this._listeners),this}off(t,e){return rn(t,e,this._listeners),rn(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},en(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new nn(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of n)rn(r,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(l(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t))}else t instanceof sn&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}const on=Or,ln=on.paintProperty,un=on.layoutProperty;class cn{constructor(){this.first=!0}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}}const hn={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function pn(t){for(const e of t)if(yn(e.charCodeAt(0)))return!0;return!1}function fn(t){for(const e of t)if(!dn(e.charCodeAt(0)))return!1;return!0}function dn(t){return!(hn.Arabic(t)||hn["Arabic Supplement"](t)||hn["Arabic Extended-A"](t)||hn["Arabic Presentation Forms-A"](t)||hn["Arabic Presentation Forms-B"](t))}function yn(t){return!(746!==t&&747!==t&&(t<4352||!(hn["Bopomofo Extended"](t)||hn.Bopomofo(t)||hn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||hn["CJK Compatibility Ideographs"](t)||hn["CJK Compatibility"](t)||hn["CJK Radicals Supplement"](t)||hn["CJK Strokes"](t)||!(!hn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||hn["CJK Unified Ideographs Extension A"](t)||hn["CJK Unified Ideographs"](t)||hn["Enclosed CJK Letters and Months"](t)||hn["Hangul Compatibility Jamo"](t)||hn["Hangul Jamo Extended-A"](t)||hn["Hangul Jamo Extended-B"](t)||hn["Hangul Jamo"](t)||hn["Hangul Syllables"](t)||hn.Hiragana(t)||hn["Ideographic Description Characters"](t)||hn.Kanbun(t)||hn["Kangxi Radicals"](t)||hn["Katakana Phonetic Extensions"](t)||hn.Katakana(t)&&12540!==t||!(!hn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!hn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||hn["Unified Canadian Aboriginal Syllabics"](t)||hn["Unified Canadian Aboriginal Syllabics Extended"](t)||hn["Vertical Forms"](t)||hn["Yijing Hexagram Symbols"](t)||hn["Yi Syllables"](t)||hn["Yi Radicals"](t))))}function mn(t){return!(yn(t)||function(t){return!!(hn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||hn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||hn["Letterlike Symbols"](t)||hn["Number Forms"](t)||hn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||hn["Control Pictures"](t)&&9251!==t||hn["Optical Character Recognition"](t)||hn["Enclosed Alphanumerics"](t)||hn["Geometric Shapes"](t)||hn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||hn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||hn["CJK Symbols and Punctuation"](t)||hn.Katakana(t)||hn["Private Use Area"](t)||hn["CJK Compatibility Forms"](t)||hn["Small Form Variants"](t)||hn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function gn(t){return t>=1424&&t<=2303||hn["Arabic Presentation Forms-A"](t)||hn["Arabic Presentation Forms-B"](t)}function xn(t,e){return!(!e&&gn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||hn.Khmer(t))}function vn(t){for(const e of t)if(gn(e.charCodeAt(0)))return!0;return!1}"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date);let bn="unavailable",wn=null;const _n={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>"loaded"===bn||null!=_n.applyArabicShaping,isLoading:()=>"loading"===bn,setState(t){if(!y())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");bn=t.pluginStatus,wn=t.pluginURL},isParsed(){if(!y())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=_n.applyArabicShaping&&null!=_n.processBidirectionalText&&null!=_n.processStyledBidirectionalText},getPluginURL(){if(!y())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return wn}};class Sn{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new cn,this.transition={})}isSupportedScript(t){return function(t,e){for(const r of t)if(!xn(r.charCodeAt(0),e))return!1;return!0}(t,_n.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}class kn{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(qe(t))return new er(t,e);if(Ye(t)){const r=tr(t,e);if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return r.value}{let r=t;return"color"===e.type&&"string"==typeof t?r=ht.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)&&(r=gt.parse(t)):r=yt.parse(t),{kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class An{constructor(t){this.property=t,this.value=new kn(t,void 0)}transitioned(t,e){return new zn(this.property,this.value,e,l({},t.transition,this.transition),t.now)}untransitioned(){return new zn(this.property,this.value,null,{},0)}}class In{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return c(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new An(this._values[t].property)),this._values[t].value=new kn(this._values[t].property,null===e?void 0:c(e))}getTransition(t){return c(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new An(this._values[t].property)),this._values[t].transition=c(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n)}return t}transitioned(t,e){const r=new Mn(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new Mn(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class zn{constructor(t,e,r,n,i){this.property=t,this.value=e,this.begin=i+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return s.possiblyEvaluate(t,e,r);{const a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,r),i,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}}return i}}class Mn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const n=new Bn(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Cn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return c(this._values[t].value)}setValue(t,e){this._values[t]=new kn(this._values[t].property,null===e?void 0:c(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){const n=new Bn(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class Pn{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)}}class Bn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Vn{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,r){const n=ae[this.specification.type];return n?n(t,e,r):t}}class En{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,n){return new Pn(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Pn(this,{kind:"constant",value:void 0},t.parameters);const n=ae[this.specification.type];if(n){const i=n(t.value.value,e.value.value,r);return new Pn(this,{kind:"constant",value:i},t.parameters)}return t}evaluate(t,e,r,n,i,s){return"constant"===t.kind?t.value:t.evaluate(e,r,n,i,s)}}class Fn extends En{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new Pn(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),s="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,a=this._calculate(s,s,s,e);return new Pn(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Pn(this,{kind:"constant",value:r},e)}return new Pn(this,t.expression,e)}evaluate(t,e,r,n,i,s){if("source"===t.kind){const a=t.evaluate(e,r,n,i,s);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class Tn{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new Sn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Sn(Math.floor(e.zoom),e)),t.expression.evaluate(new Sn(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class Dn{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)}interpolate(){return!1}}class $n{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new kn(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new An(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}Xr("DataDrivenProperty",En),Xr("DataConstantProperty",Vn),Xr("CrossFadedDataDrivenProperty",Fn),Xr("CrossFadedProperty",Tn),Xr("ColorRampProperty",Dn);const Ln="-transition";class On extends an{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new Cn(e.layout)),e.paint)){this._transitionablePaint=new In(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Bn(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(un,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(Ln)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(ln,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith(Ln))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const r=this._transitionablePaint._values[t],n="cross-faded-data-driven"===r.property.specification["property-type"],i=r.value.isDataDriven(),s=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,s,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),function(t,e,r){const n={};for(const r in t)e.call(this,t[r],r,t)&&(n[r]=t[r]);return n}(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,r,n,i={}){return(!i||!1!==i.validate)&&function(t,e){let r=!1;if(e&&e.length)for(const n of e)t.fire(new sn(new Error(n.message))),r=!0;return r}(this,t.call(on,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:b,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Pn&&$e(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const Un={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class qn{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class jn{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Rn(t,e=1){let r=0,n=0;return{members:t.map((t=>{const i=Un[t.type].BYTES_PER_ELEMENT,s=r=Nn(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:s}})),size:Nn(r,Math.max(n,e)),alignment:e}}function Nn(t,e){return Math.ceil(t/e)*e}class Zn extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}Zn.prototype.bytesPerElement=4,Xr("StructArrayLayout2i4",Zn);class Jn extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}Jn.prototype.bytesPerElement=6,Xr("StructArrayLayout3i6",Jn);class Gn extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,t}}Gn.prototype.bytesPerElement=8,Xr("StructArrayLayout4i8",Gn);class Kn extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}Kn.prototype.bytesPerElement=12,Xr("StructArrayLayout2i4i12",Kn);class Xn extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=4*t,l=8*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=s,this.uint8[l+7]=a,t}}Xn.prototype.bytesPerElement=8,Xr("StructArrayLayout2i4ub8",Xn);class Yn extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}Yn.prototype.bytesPerElement=8,Xr("StructArrayLayout2f8",Yn);class Hn extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,s,a,o,l,u)}emplace(t,e,r,n,i,s,a,o,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=s,this.uint16[h+5]=a,this.uint16[h+6]=o,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}Hn.prototype.bytesPerElement=20,Xr("StructArrayLayout10ui20",Hn);class Wn extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,a,o,l,u,c,h)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=s,this.uint16[f+5]=a,this.uint16[f+6]=o,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t}}Wn.prototype.bytesPerElement=24,Xr("StructArrayLayout4i4ui4i24",Wn);class Qn extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}Qn.prototype.bytesPerElement=12,Xr("StructArrayLayout3f12",Qn);class ti extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}ti.prototype.bytesPerElement=4,Xr("StructArrayLayout1ul4",ti);class ei extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,s,a,o,l)}emplace(t,e,r,n,i,s,a,o,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=s,this.int16[c+5]=a,this.uint32[h+3]=o,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}ei.prototype.bytesPerElement=20,Xr("StructArrayLayout6i1ul2ui20",ei);class ri extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}ri.prototype.bytesPerElement=12,Xr("StructArrayLayout2i2i2i12",ri);class ni extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=4*t,o=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[o+6]=i,this.int16[o+7]=s,t}}ni.prototype.bytesPerElement=16,Xr("StructArrayLayout2f1f2i16",ni);class ii extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=12*t,a=3*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t}}ii.prototype.bytesPerElement=12,Xr("StructArrayLayout2ub2f12",ii);class si extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}si.prototype.bytesPerElement=6,Xr("StructArrayLayout3ui6",si);class ai extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g){const x=24*t,v=12*t,b=48*t;return this.int16[x+0]=e,this.int16[x+1]=r,this.uint16[x+2]=n,this.uint16[x+3]=i,this.uint32[v+2]=s,this.uint32[v+3]=a,this.uint32[v+4]=o,this.uint16[x+10]=l,this.uint16[x+11]=u,this.uint16[x+12]=c,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=d,this.uint8[b+38]=y,this.uint32[v+10]=m,this.int16[x+22]=g,t}}ai.prototype.bytesPerElement=48,Xr("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ai);class oi extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,k,A,I,z){const M=this.length;return this.resize(M+1),this.emplace(M,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,k,A,I,z)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,k,A,I,z,M){const C=32*t,P=16*t;return this.int16[C+0]=e,this.int16[C+1]=r,this.int16[C+2]=n,this.int16[C+3]=i,this.int16[C+4]=s,this.int16[C+5]=a,this.int16[C+6]=o,this.int16[C+7]=l,this.uint16[C+8]=u,this.uint16[C+9]=c,this.uint16[C+10]=h,this.uint16[C+11]=p,this.uint16[C+12]=f,this.uint16[C+13]=d,this.uint16[C+14]=y,this.uint16[C+15]=m,this.uint16[C+16]=g,this.uint16[C+17]=x,this.uint16[C+18]=v,this.uint16[C+19]=b,this.uint16[C+20]=w,this.uint16[C+21]=_,this.uint16[C+22]=S,this.uint32[P+12]=k,this.float32[P+13]=A,this.float32[P+14]=I,this.uint16[C+30]=z,this.uint16[C+31]=M,t}}oi.prototype.bytesPerElement=64,Xr("StructArrayLayout8i15ui1ul2f2ui64",oi);class li extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}li.prototype.bytesPerElement=4,Xr("StructArrayLayout1f4",li);class ui extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[6*t+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}ui.prototype.bytesPerElement=12,Xr("StructArrayLayout1ui2f12",ui);class ci extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t}}ci.prototype.bytesPerElement=8,Xr("StructArrayLayout1ul2ui8",ci);class hi extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}hi.prototype.bytesPerElement=4,Xr("StructArrayLayout2ui4",hi);class pi extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}pi.prototype.bytesPerElement=2,Xr("StructArrayLayout1ui2",pi);class fi extends jn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,t}}fi.prototype.bytesPerElement=16,Xr("StructArrayLayout4f16",fi);class di extends qn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new n(this.anchorPointX,this.anchorPointY)}}di.prototype.size=20;class yi extends ei{get(t){return new di(this,t)}}Xr("CollisionBoxArray",yi);class mi extends qn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}mi.prototype.size=48;class gi extends ai{get(t){return new mi(this,t)}}Xr("PlacedSymbolArray",gi);class xi extends qn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}xi.prototype.size=64;class vi extends oi{get(t){return new xi(this,t)}}Xr("SymbolInstanceArray",vi);class bi extends li{getoffsetX(t){return this.float32[1*t+0]}}Xr("GlyphOffsetArray",bi);class wi extends Jn{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Xr("SymbolLineVertexArray",wi);class _i extends qn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}_i.prototype.size=12;class Si extends ui{get(t){return new _i(this,t)}}Xr("TextAnchorOffsetArray",Si);class ki extends qn{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}ki.prototype.size=8;class Ai extends ci{get(t){return new ki(this,t)}}Xr("FeatureIndexArray",Ai);class Ii extends Zn{}class zi extends Zn{}class Mi extends Zn{}class Ci extends Kn{}class Pi extends Xn{}class Bi extends Yn{}class Vi extends Hn{}class Ei extends Wn{}class Fi extends Qn{}class Ti extends ti{}class Di extends ri{}class $i extends ii{}class Li extends si{}class Oi extends hi{}const Ui=Rn([{name:"a_pos",components:2,type:"Int16"}],4),{members:qi}=Ui;class ji{constructor(t=[]){this.segments=t}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>ji.MAX_VERTEX_ARRAY_LENGTH&&p(`Max vertices per segment is ${ji.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>ji.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,n){return new ji([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function Ri(t,e){return 256*(t=o(Math.floor(t),0,255))+o(Math.floor(e),0,255)}ji.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Xr("SegmentVector",ji);const Ni=Rn([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Zi={exports:{}},Ji={exports:{}};Ji.exports=function(t,e){var r,n,i,s,a,o,l,u;for(n=t.length-(r=3&t.length),i=e,a=3432918353,o=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var Gi=Ji.exports,Ki={exports:{}};Ki.exports=function(t,e){for(var r,n=t.length,i=e^n,s=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var Xi=Gi,Yi=Ki.exports;Zi.exports=Xi,Zi.exports.murmur3=Xi,Zi.exports.murmur2=Yi;var Hi=t(Zi.exports);class Wi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,n){this.ids.push(Qi(t)),this.positions.push(e,r,n)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=Qi(t);let r=0,n=this.ids.length-1;for(;r<n;){const t=r+n>>1;this.ids[t]>=e?n=t:r=t+1}const i=[];for(;this.ids[r]===e;)i.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return i}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return ts(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new Wi;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Qi(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Hi(String(t))}function ts(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let s=r-1,a=n+1;for(;;){do{s++}while(t[s]<i);do{a--}while(t[a]>i);if(s>=a)break;es(t,s,a),es(e,3*s,3*a),es(e,3*s+1,3*a+1),es(e,3*s+2,3*a+2)}a-r<n-a?(ts(t,e,r,a),r=a+1):(ts(t,e,a+1,n),n=a)}}function es(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}Xr("FeaturePositionMap",Wi);class rs{constructor(t,e){this.gl=t.gl,this.location=e}}class ns extends rs{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class is extends rs{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class ss extends rs{constructor(t,e){super(t,e),this.current=ht.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}function as(t){return[Ri(255*t.r,255*t.g),Ri(255*t.b,255*t.a)]}class os{constructor(t,e,r){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return"color"===this.type?new ss(t,e):new ns(t,e)}}class ls{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,r,n){const i="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;i&&t.set(i)}getBinding(t,e,r){return"u_pattern"===r.substr(0,9)?new is(t,e):new ns(t,e)}}class us{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(t,e,r,n,i){const s=this.paintVertexArray.length,a=this.expression.evaluate(new Sn(0),e,{},n,[],i);this.paintVertexArray.resize(t),this._setPaintValue(s,t,a)}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:0},r,n);this._setPaintValue(t,e,i)}_setPaintValue(t,e,r){if("color"===this.type){const n=as(r);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class cs{constructor(t,e,r,n,i,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,r,n,i){const s=this.expression.evaluate(new Sn(this.zoom),e,{},n,[],i),a=this.expression.evaluate(new Sn(this.zoom+1),e,{},n,[],i),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,s,a)}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:this.zoom},r,n),s=this.expression.evaluate({zoom:this.zoom+1},r,n);this._setPaintValue(t,e,i,s)}_setPaintValue(t,e,r,n){if("color"===this.type){const i=as(r),s=as(n);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i[0],i[1],s[0],s[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,n=o(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(n)}getBinding(t,e,r){return new ns(t,e)}}class hs{constructor(t,e,r,n,i,s){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=n,this.layerId=s,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i}populatePaintArray(t,e,r){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],r)}updatePaintArray(t,e,r,n,i){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],i)}_setPaintValues(t,e,r,n){if(!n||!r)return;const{min:i,mid:s,max:a}=r,o=n[i],l=n[s],u=n[a];if(o&&l&&u)for(let r=t;r<e;r++)this.zoomInPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],o.tl[0],o.tl[1],o.br[0],o.br[1],l.pixelRatio,o.pixelRatio),this.zoomOutPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Ni.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Ni.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ps{constructor(t,e,r){this.binders={},this._buffers=[];const n=[];for(const i in t.paint._values){if(!r(i))continue;const s=t.paint.get(i);if(!(s instanceof Pn&&$e(s.property.specification)))continue;const a=ds(i,t.type),o=s.value,l=s.property.specification.type,u=s.property.useIntegerZoom,c=s.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===o.kind)this.binders[i]=h?new ls(o.value,a):new os(o.value,a,l),n.push(`/u_${i}`);else if("source"===o.kind||h){const r=ys(i,l,"source");this.binders[i]=h?new hs(o,l,u,e,r,t.id):new us(o,a,l,r),n.push(`/a_${i}`)}else{const t=ys(i,l,"composite");this.binders[i]=new cs(o,a,l,u,e,t),n.push(`/z_${i}`)}}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof us||e instanceof cs?e.maxValue:0}populatePaintArrays(t,e,r,n,i){for(const s in this.binders){const a=this.binders[s];(a instanceof us||a instanceof cs||a instanceof hs)&&a.populatePaintArray(t,e,r,n,i)}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof ls&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,n,i){let s=!1;for(const a in t){const o=e.getPositions(a);for(const e of o){const o=r.feature(e.index);for(const r in this.binders){const l=this.binders[r];if((l instanceof us||l instanceof cs||l instanceof hs)&&!0===l.expression.isStateDependent){const u=n.paint.get(r);l.expression=u.value,l.updatePaintArray(e.start,e.end,o,t[a],i),s=!0}}}}return s}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof os||r instanceof ls)&&t.push(...r.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof us||r instanceof cs)for(let e=0;e<r.paintVertexAttributes.length;e++)t.push(r.paintVertexAttributes[e].name);else if(r instanceof hs)for(let e=0;e<Ni.members.length;e++)t.push(Ni.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof os||r instanceof ls||r instanceof cs)for(const e of r.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const r=[];for(const n in this.binders){const i=this.binders[n];if(i instanceof os||i instanceof ls||i instanceof cs)for(const s of i.uniformNames)if(e[s]){const a=i.getBinding(t,e[s],s);r.push({name:s,property:n,binding:a})}}return r}setUniforms(t,e,r,n){for(const{name:t,property:i,binding:s}of e)this.binders[i].setUniform(s,n,r.get(i),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof hs){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof us||r instanceof cs)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof us||r instanceof cs||r instanceof hs)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof us||e instanceof cs||e instanceof hs)&&e.destroy()}}}class fs{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new ps(n,e,r);this.needsUpload=!1,this._featureMap=new Wi,this._bufferOffset=0}populatePaintArrays(t,e,r,n,i,s){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,n){for(const i of r)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(t,this._featureMap,e,i,n)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function ds(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function ys(t,e,r){const n={color:{source:Yn,composite:fi},number:{source:li,composite:Yn}},i=function(t){return{"line-pattern":{source:Vi,composite:Vi},"fill-pattern":{source:Vi,composite:Vi},"fill-extrusion-pattern":{source:Vi,composite:Vi}}[t]}(t);return i&&i[r]||n[e][r]}Xr("ConstantBinder",os),Xr("CrossFadedConstantBinder",ls),Xr("SourceExpressionBinder",us),Xr("CrossFadedCompositeBinder",hs),Xr("CompositeExpressionBinder",cs),Xr("ProgramConfiguration",ps,{omit:["_buffers"]}),Xr("ProgramConfigurationSet",fs);const ms=8192,gs=Math.pow(2,14)-1,xs=-gs-1;function vs(t){const e=ms/t.extent,r=t.loadGeometry();for(let t=0;t<r.length;t++){const n=r[t];for(let t=0;t<n.length;t++){const r=n[t],i=Math.round(r.x*e),s=Math.round(r.y*e);r.x=o(i,xs,gs),r.y=o(s,xs,gs),(i<r.x||i>r.x+1||s<r.y||s>r.y+1)&&p("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function bs(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?vs(t):[]}}function ws(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}class _s{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new zi,this.indexArray=new Li,this.segments=new ji,this.programConfigurations=new fs(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){const n=this.layers[0],i=[];let s=null,a=!1;"circle"===n.type&&(s=n.layout.get("circle-sort-key"),a=!s.isConstant());for(const{feature:e,id:n,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=bs(e,t);if(!this.layers[0]._featureFilter.filter(new Sn(this.zoom),u,r))continue;const c=a?s.evaluate(u,{},r):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:vs(e),patterns:{},sortKey:c};i.push(h)}a&&i.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of i){const{geometry:i,index:s,sourceLayerIndex:a}=n,o=t[s].feature;this.addFeature(n,i,s,r),e.featureIndex.insert(o,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,qi),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,n){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=ms||n<0||n>=ms)continue;const i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),s=i.vertexLength;ws(this.layoutVertexArray,r,n,-1,-1),ws(this.layoutVertexArray,r,n,1,-1),ws(this.layoutVertexArray,r,n,1,1),ws(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+3,s+2),i.vertexLength+=4,i.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n)}}function Ss(t,e){for(let r=0;r<t.length;r++)if(Vs(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Vs(t,e[r]))return!0;return!!zs(t,e)}function ks(t,e,r){return!!Vs(t,e)||!!Cs(e,t,r)}function As(t,e){if(1===t.length)return Bs(e,t[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++)if(Vs(t,n[e]))return!0}for(let r=0;r<t.length;r++)if(Bs(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(zs(t,e[r]))return!0;return!1}function Is(t,e,r){if(t.length>1){if(zs(t,e))return!0;for(let n=0;n<e.length;n++)if(Cs(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(Cs(t[n],e,r))return!0;return!1}function zs(t,e){if(0===t.length||0===e.length)return!1;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)if(Ms(n,i,e[t],e[t+1]))return!0}return!1}function Ms(t,e,r,n){return f(t,r,n)!==f(e,r,n)&&f(t,e,r)!==f(t,e,n)}function Cs(t,e,r){const n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(let r=1;r<e.length;r++)if(Ps(t,e[r-1],e[r])<n)return!0;return!1}function Ps(t,e,r){const n=e.distSqr(r);if(0===n)return t.distSqr(e);const i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return t.distSqr(i<0?e:i>1?r:r.sub(e)._mult(i)._add(e))}function Bs(t,e){let r,n,i,s=!1;for(let a=0;a<t.length;a++){r=t[a];for(let t=0,a=r.length-1;t<r.length;a=t++)n=r[t],i=r[a],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s)}return s}function Vs(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const s=t[n],a=t[i];s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function Es(t,e,r){const n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;const s=f(t,e,r[0]);return s!==f(t,e,r[1])||s!==f(t,e,r[2])||s!==f(t,e,r[3])}function Fs(t,e,r){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ts(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ds(t,e,r,i,s){if(!e[0]&&!e[1])return t;const a=n.convert(e)._mult(s);"viewport"===r&&a._rotate(-i);const o=[];for(let e=0;e<t.length;e++)o.push(t[e].sub(a));return o}let $s,Ls;Xr("CircleBucket",_s,{omit:["layers"]});var Os,Us={get paint(){return Ls=Ls||new $n({"circle-radius":new En(b.paint_circle["circle-radius"]),"circle-color":new En(b.paint_circle["circle-color"]),"circle-blur":new En(b.paint_circle["circle-blur"]),"circle-opacity":new En(b.paint_circle["circle-opacity"]),"circle-translate":new Vn(b.paint_circle["circle-translate"]),"circle-translate-anchor":new Vn(b.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Vn(b.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Vn(b.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new En(b.paint_circle["circle-stroke-width"]),"circle-stroke-color":new En(b.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new En(b.paint_circle["circle-stroke-opacity"])})},get layout(){return $s=$s||new $n({"circle-sort-key":new En(b.layout_circle["circle-sort-key"])})}},qs="undefined"!=typeof Float32Array?Float32Array:Array;function js(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Rs(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),Os=new qs(4),qs!=Float32Array&&(Os[0]=0,Os[1]=0,Os[2]=0,Os[3]=0);class Ns extends On{constructor(t){super(t,Us)}createBucket(t){return new _s(t)}queryRadius(t){const e=t;return Fs("circle-radius",this,e)+Fs("circle-stroke-width",this,e)+Ts(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=Ds(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,a),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c="map"===this.paint.get("circle-pitch-alignment"),h=c?l:function(t,e){return t.map((t=>Zs(t,e)))}(l,o),p=c?u*a:u;for(const t of n)for(const e of t){const t=c?e:Zs(e,o);let r=p;const n=Rs([],[e.x,e.y,0,1],o);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?r*=n[3]/s.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(r*=s.cameraToCenterDistance/n[3]),ks(h,t,r))return!0}return!1}}function Zs(t,e){const r=Rs([],[t.x,t.y,0,1],e);return new n(r[0]/r[3],r[1]/r[3])}class Js extends _s{}let Gs;Xr("HeatmapBucket",Js,{omit:["layers"]});var Ks={get paint(){return Gs=Gs||new $n({"heatmap-radius":new En(b.paint_heatmap["heatmap-radius"]),"heatmap-weight":new En(b.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Vn(b.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Dn(b.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Vn(b.paint_heatmap["heatmap-opacity"])})}};function Xs(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*r*n}`)}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function Ys(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;const i=Xs({},{width:e,height:r},n);Hs(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function Hs(t,e,r,n,i,s){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,o=e.data;if(a===o)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){const u=((r.y+l)*t.width+r.x)*s,c=((n.y+l)*e.width+n.x)*s;for(let t=0;t<i.width*s;t++)o[c+t]=a[u+t]}return e}class Ws{constructor(t,e){Xs(this,t,1,e)}resize(t){Ys(this,t,1)}clone(){return new Ws({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){Hs(t,e,r,n,i,1)}}class Qs{constructor(t,e){Xs(this,t,4,e)}resize(t){Ys(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Qs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){Hs(t,e,r,n,i,4)}}Xr("AlphaImage",Ws),Xr("RGBAImage",Qs);class ta extends On{createBucket(t){return new Js(t)}constructor(t){super(t,Ks),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=function(t){const e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new Qs({width:r,height:n});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const s=(r,n,s)=>{e[t.evaluationKey]=s;const a=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*a.r/a.a),i.data[r+n+1]=Math.floor(255*a.g/a.a),i.data[r+n+2]=Math.floor(255*a.b/a.a),i.data[r+n+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,a=0;n<r;n++,a+=4){const o=n/(r-1),{start:l,end:u}=t.clips[e];s(i,a,l*(1-o)+u*o)}else for(let t=0,e=0;t<r;t++,e+=4)s(0,e,t/(r-1));return i}({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let ea;var ra={get paint(){return ea=ea||new $n({"hillshade-illumination-direction":new Vn(b.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Vn(b.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Vn(b.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Vn(b.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Vn(b.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Vn(b.paint_hillshade["hillshade-accent-color"])})}};class na extends On{constructor(t){super(t,ra)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}const ia=Rn([{name:"a_pos",components:2,type:"Int16"}],4),{members:sa}=ia;var aa={exports:{}};function oa(t,e,r){r=r||2;var n,i,s,a,o,l,u,c=e&&e.length,h=c?e[0]*r:t.length,p=la(t,0,h,r,!0),f=[];if(!p||p.next===p.prev)return f;if(c&&(p=function(t,e,r,n){var i,s,a,o=[];for(i=0,s=e.length;i<s;i++)(a=la(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),o.push(va(a));for(o.sort(ya),i=0;i<o.length;i++)r=ma(o[i],r);return r}(t,e,p,r)),t.length>80*r){n=s=t[0],i=a=t[1];for(var d=r;d<h;d+=r)(o=t[d])<n&&(n=o),(l=t[d+1])<i&&(i=l),o>s&&(s=o),l>a&&(a=l);u=0!==(u=Math.max(s-n,a-i))?32767/u:0}return ca(p,f,r,n,i,u,0),f}function la(t,e,r,n,i){var s,a;if(i===Va(t,e,r,n)>0)for(s=e;s<r;s+=n)a=Ca(s,t[s],t[s+1],a);else for(s=r-n;s>=e;s-=n)a=Ca(s,t[s],t[s+1],a);return a&&Sa(a,a.next)&&(Pa(a),a=a.next),a}function ua(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Sa(n,n.next)&&0!==_a(n.prev,n,n.next))n=n.next;else{if(Pa(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function ca(t,e,r,n,i,s,a){if(t){!a&&s&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=xa(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,s,a,o,l,u=1;do{for(r=t,t=null,s=null,a=0;r;){for(a++,n=r,o=0,e=0;e<u&&(o++,n=n.nextZ);e++);for(l=u;o>0||l>0&&n;)0!==o&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=n}s.nextZ=null,u*=2}while(a>1)}(i)}(t,n,i,s);for(var o,l,u=t;t.prev!==t.next;)if(o=t.prev,l=t.next,s?pa(t,n,i,s):ha(t))e.push(o.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),Pa(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?ca(t=fa(ua(t),e,r),e,r,n,i,s,2):2===a&&da(t,e,r,n,i,s):ca(ua(t),e,r,n,i,s,1);break}}}function ha(t){var e=t.prev,r=t,n=t.next;if(_a(e,r,n)>=0)return!1;for(var i=e.x,s=r.x,a=n.x,o=e.y,l=r.y,u=n.y,c=i<s?i<a?i:a:s<a?s:a,h=o<l?o<u?o:u:l<u?l:u,p=i>s?i>a?i:a:s>a?s:a,f=o>l?o>u?o:u:l>u?l:u,d=n.next;d!==e;){if(d.x>=c&&d.x<=p&&d.y>=h&&d.y<=f&&ba(i,o,s,l,a,u,d.x,d.y)&&_a(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function pa(t,e,r,n){var i=t.prev,s=t,a=t.next;if(_a(i,s,a)>=0)return!1;for(var o=i.x,l=s.x,u=a.x,c=i.y,h=s.y,p=a.y,f=o<l?o<u?o:u:l<u?l:u,d=c<h?c<p?c:p:h<p?h:p,y=o>l?o>u?o:u:l>u?l:u,m=c>h?c>p?c:p:h>p?h:p,g=xa(f,d,e,r,n),x=xa(y,m,e,r,n),v=t.prevZ,b=t.nextZ;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==a&&ba(o,c,l,h,u,p,v.x,v.y)&&_a(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==a&&ba(o,c,l,h,u,p,b.x,b.y)&&_a(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==a&&ba(o,c,l,h,u,p,v.x,v.y)&&_a(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==a&&ba(o,c,l,h,u,p,b.x,b.y)&&_a(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function fa(t,e,r){var n=t;do{var i=n.prev,s=n.next.next;!Sa(i,s)&&ka(i,n,n.next,s)&&za(i,s)&&za(s,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(s.i/r|0),Pa(n),Pa(n.next),n=t=s),n=n.next}while(n!==t);return ua(n)}function da(t,e,r,n,i,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&wa(a,o)){var l=Ma(a,o);return a=ua(a,a.next),l=ua(l,l.next),ca(a,e,r,n,i,s,0),void ca(l,e,r,n,i,s,0)}o=o.next}a=a.next}while(a!==t)}function ya(t,e){return t.x-e.x}function ma(t,e){var r=function(t,e){var r,n=e,i=t.x,s=t.y,a=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var o=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(o<=i&&o>a&&(a=o,r=n.x<n.next.x?n:n.next,o===i))return r}n=n.next}while(n!==e);if(!r)return null;var l,u=r,c=r.x,h=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&ba(s<h?i:a,s,c,h,s<h?a:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),za(n,t)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&ga(r,n)))&&(r=n,p=l)),n=n.next}while(n!==u);return r}(t,e);if(!r)return e;var n=Ma(r,t);return ua(n,n.next),ua(r,r.next)}function ga(t,e){return _a(t.prev,t,e.prev)<0&&_a(e.next,t,t.next)<0}function xa(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function va(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function ba(t,e,r,n,i,s,a,o){return(i-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(n-o)>=(r-a)*(e-o)&&(r-a)*(s-o)>=(i-a)*(n-o)}function wa(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&ka(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(za(t,e)&&za(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(_a(t.prev,t,e.prev)||_a(t,e.prev,e))||Sa(t,e)&&_a(t.prev,t,t.next)>0&&_a(e.prev,e,e.next)>0)}function _a(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Sa(t,e){return t.x===e.x&&t.y===e.y}function ka(t,e,r,n){var i=Ia(_a(t,e,r)),s=Ia(_a(t,e,n)),a=Ia(_a(r,n,t)),o=Ia(_a(r,n,e));return i!==s&&a!==o||!(0!==i||!Aa(t,r,e))||!(0!==s||!Aa(t,n,e))||!(0!==a||!Aa(r,t,n))||!(0!==o||!Aa(r,e,n))}function Aa(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Ia(t){return t>0?1:t<0?-1:0}function za(t,e){return _a(t.prev,t,t.next)<0?_a(t,e,t.next)>=0&&_a(t,t.prev,e)>=0:_a(t,e,t.prev)<0||_a(t,t.next,e)<0}function Ma(t,e){var r=new Ba(t.i,t.x,t.y),n=new Ba(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function Ca(t,e,r,n){var i=new Ba(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Pa(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ba(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Va(t,e,r,n){for(var i=0,s=e,a=r-n;s<r;s+=n)i+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return i}aa.exports=oa,aa.exports.default=oa,oa.deviation=function(t,e,r,n){var i=e&&e.length,s=Math.abs(Va(t,0,i?e[0]*r:t.length,r));if(i)for(var a=0,o=e.length;a<o;a++)s-=Math.abs(Va(t,e[a]*r,a<o-1?e[a+1]*r:t.length,r));var l=0;for(a=0;a<n.length;a+=3){var u=n[a]*r,c=n[a+1]*r,h=n[a+2]*r;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},oa.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var a=0;a<e;a++)r.vertices.push(t[i][s][a]);i>0&&r.holes.push(n+=t[i-1].length)}return r};var Ea=t(aa.exports);function Fa(t,e,r,n,i){Ta(t,e,r||0,n||t.length-1,i||$a)}function Ta(t,e,r,n,i){for(;n>r;){if(n-r>600){var s=n-r+1,a=e-r+1,o=Math.log(s),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(s-l)/s)*(a-s/2<0?-1:1);Ta(t,e,Math.max(r,Math.floor(e-a*l/s+u)),Math.min(n,Math.floor(e+(s-a)*l/s+u)),i)}var c=t[e],h=r,p=n;for(Da(t,r,e),i(t[n],c)>0&&Da(t,r,n);h<p;){for(Da(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--}0===i(t[r],c)?Da(t,r,p):Da(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1)}}function Da(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function $a(t,e){return t<e?-1:t>e?1:0}function La(t,e){const r=t.length;if(r<=1)return[t];const n=[];let i,s;for(let e=0;e<r;e++){const r=d(t[e]);0!==r&&(t[e].area=Math.abs(r),void 0===s&&(s=r<0),s===r<0?(i&&n.push(i),i=[t[e]]):i.push(t[e]))}if(i&&n.push(i),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(Fa(n[t],e,1,n[t].length-1,Oa),n[t]=n[t].slice(0,e));return n}function Oa(t,e){return e.area-t.area}function Ua(t,e,r){const n=r.patternDependencies;let i=!1;for(const r of e){const e=r.paint.get(`${t}-pattern`);e.isConstant()||(i=!0);const s=e.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function qa(t,e,r,n,i){const s=i.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},r,{},i.availableImages),o=e.evaluate({zoom:n},r,{},i.availableImages),l=e.evaluate({zoom:n+1},r,{},i.availableImages);t=t&&t.name?t.name:t,o=o&&o.name?o.name:o,l=l&&l.name?l.name:l,s[t]=!0,s[o]=!0,s[l]=!0,r.patterns[a.id]={min:t,mid:o,max:l}}}return r}class ja{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Mi,this.indexArray=new Li,this.indexArray2=new Oi,this.programConfigurations=new fs(t.layers,t.zoom),this.segments=new ji,this.segments2=new ji,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasPattern=Ua("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),s=[];for(const{feature:a,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=bs(a,t);if(!this.layers[0]._featureFilter.filter(new Sn(this.zoom),c,r))continue;const h=i?n.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:vs(a),patterns:{},sortKey:h};s.push(p)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=qa("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,sa),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,n,i){for(const t of La(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),i.push(e[t].x),i.push(e[t].y);r.vertexLength+=e.length,r.primitiveLength+=e.length}const a=Ea(i,s);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(n+a[t],n+a[t+1],n+a[t+2]);r.vertexLength+=e,r.primitiveLength+=a.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}}let Ra,Na;Xr("FillBucket",ja,{omit:["layers","patternFeatures"]});var Za={get paint(){return Na=Na||new $n({"fill-antialias":new Vn(b.paint_fill["fill-antialias"]),"fill-opacity":new En(b.paint_fill["fill-opacity"]),"fill-color":new En(b.paint_fill["fill-color"]),"fill-outline-color":new En(b.paint_fill["fill-outline-color"]),"fill-translate":new Vn(b.paint_fill["fill-translate"]),"fill-translate-anchor":new Vn(b.paint_fill["fill-translate-anchor"]),"fill-pattern":new Fn(b.paint_fill["fill-pattern"])})},get layout(){return Ra=Ra||new $n({"fill-sort-key":new En(b.layout_fill["fill-sort-key"])})}};class Ja extends On{constructor(t){super(t,Za)}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new ja(t)}queryRadius(){return Ts(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a){return As(Ds(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,a),n)}isTileClipped(){return!0}}const Ga=Rn([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ka=Rn([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Xa}=Ga;var Ya={},Ha=e,Wa=Qa;function Qa(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(to,this,e)}function to(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function eo(t){for(var e,r,n=0,i=0,s=t.length,a=s-1;i<s;a=i++)n+=((r=t[a]).x-(e=t[i]).x)*(e.y+r.y);return n}Qa.types=["Unknown","Point","LineString","Polygon"],Qa.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,i=0,s=0,a=0,o=[];t.pos<r;){if(i<=0){var l=t.readVarint();n=7&l,i=l>>3}if(i--,1===n||2===n)s+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&o.push(e),e=[]),e.push(new Ha(s,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&o.push(e),o},Qa.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<a&&(a=i),i>o&&(o=i),(s+=t.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,o,u]},Qa.prototype.toGeoJSON=function(t,e,r){var n,i,s=this.extent*Math.pow(2,r),a=this.extent*t,o=this.extent*e,l=this.loadGeometry(),u=Qa.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+a)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+o)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],s=0;s<e;s++){var a=eo(t[s]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(r&&i.push(r),r=[t[s]]):r.push(t[s]))}return r&&i.push(r),i}(l),n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)c(l[n][i])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var ro=Wa,no=io;function io(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(so,this,e),this.length=this._features.length}function so(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}io.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new ro(this._pbf,e,this.extent,this._keys,this._values)};var ao=no;function oo(t,e,r){if(3===t){var n=new ao(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}Ya.VectorTile=function(t,e){this.layers=t.readFields(oo,{},e)},Ya.VectorTileFeature=Wa,Ya.VectorTileLayer=no;const lo=Ya.VectorTileFeature.types,uo=Math.pow(2,13);function co(t,e,r,n,i,s,a,o){t.emplaceBack(e,r,2*Math.floor(n*uo)+a,i*uo*2,s*uo*2,Math.round(o))}class ho{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ci,this.centroidVertexArray=new Ii,this.indexArray=new Li,this.programConfigurations=new fs(t.layers,t.zoom),this.segments=new ji,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.features=[],this.hasPattern=Ua("fill-extrusion",this.layers,e);for(const{feature:n,id:i,index:s,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,o=bs(n,t);if(!this.layers[0]._featureFilter.filter(new Sn(this.zoom),o,r))continue;const l={id:i,sourceLayerIndex:a,index:s,geometry:t?o.geometry:vs(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(qa("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,s,r,{}),e.featureIndex.insert(n,l.geometry,s,a,this.index,!0)}}addFeatures(t,e,r){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,r)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Xa),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ka.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,n,i){const s={x:0,y:0,vertexCount:0};for(const r of La(e,500)){let e=0;for(const t of r)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of r){if(0===t.length)continue;if(fo(t))continue;let e=0;for(let r=0;r<t.length;r++){const i=t[r];if(r>=1){const a=t[r-1];if(!po(i,a)){n.vertexLength+4>ji.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=i.sub(a)._perp()._unit(),r=a.dist(i);e+r>32768&&(e=0),co(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,0,e),co(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,1,e),s.x+=2*i.x,s.y+=2*i.y,s.vertexCount+=2,e+=r,co(this.layoutVertexArray,a.x,a.y,t.x,t.y,0,0,e),co(this.layoutVertexArray,a.x,a.y,t.x,t.y,0,1,e),s.x+=2*a.x,s.y+=2*a.y,s.vertexCount+=2;const o=n.vertexLength;this.indexArray.emplaceBack(o,o+2,o+1),this.indexArray.emplaceBack(o+1,o+2,o+3),n.vertexLength+=4,n.primitiveLength+=2}}}}if(n.vertexLength+e>ji.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==lo[t.type])continue;const i=[],a=[],o=n.vertexLength;for(const t of r)if(0!==t.length){t!==r[0]&&a.push(i.length/2);for(let e=0;e<t.length;e++){const r=t[e];co(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),s.x+=r.x,s.y+=r.y,s.vertexCount+=1,i.push(r.x),i.push(r.y)}}const l=Ea(i,a);for(let t=0;t<l.length;t+=3)this.indexArray.emplaceBack(o+l[t],o+l[t+2],o+l[t+1]);n.primitiveLength+=l.length/3,n.vertexLength+=e}for(let t=0;t<s.vertexCount;t++)this.centroidVertexArray.emplaceBack(Math.floor(s.x/s.vertexCount),Math.floor(s.y/s.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}}function po(t,e){return t.x===e.x&&(t.x<0||t.x>ms)||t.y===e.y&&(t.y<0||t.y>ms)}function fo(t){return t.every((t=>t.x<0))||t.every((t=>t.x>ms))||t.every((t=>t.y<0))||t.every((t=>t.y>ms))}let yo;Xr("FillExtrusionBucket",ho,{omit:["layers","features"]});var mo={get paint(){return yo=yo||new $n({"fill-extrusion-opacity":new Vn(b["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new En(b["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Vn(b["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Vn(b["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Fn(b["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new En(b["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new En(b["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Vn(b["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class go extends On{constructor(t){super(t,mo)}createBucket(t){return new ho(t)}queryRadius(){return Ts(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,r,i,s,a,o,l){const u=Ds(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,o),c=this.paint.get("fill-extrusion-height").evaluate(e,r),h=this.paint.get("fill-extrusion-base").evaluate(e,r),p=function(t,e,r,i){const s=[];for(const r of t){const t=[r.x,r.y,0,1];Rs(t,t,e),s.push(new n(t[0]/t[3],t[1]/t[3]))}return s}(u,l),f=function(t,e,r,i){const s=[],a=[],o=i[8]*e,l=i[9]*e,u=i[10]*e,c=i[11]*e,h=i[8]*r,p=i[9]*r,f=i[10]*r,d=i[11]*r;for(const e of t){const t=[],r=[];for(const s of e){const e=s.x,a=s.y,y=i[0]*e+i[4]*a+i[12],m=i[1]*e+i[5]*a+i[13],g=i[2]*e+i[6]*a+i[14],x=i[3]*e+i[7]*a+i[15],v=g+u,b=x+c,w=y+h,_=m+p,S=g+f,k=x+d,A=new n((y+o)/b,(m+l)/b);A.z=v/b,t.push(A);const I=new n(w/k,_/k);I.z=S/k,r.push(I)}s.push(t),a.push(r)}return[s,a]}(i,h,c,l);return function(t,e,r){let n=1/0;As(r,e)&&(n=vo(r,e[0]));for(let i=0;i<e.length;i++){const s=e[i],a=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],a[t+1],a[t],e];Ss(r,i)&&(n=Math.min(n,vo(r,i)))}}return n!==1/0&&n}(f[0],f[1],p)}}function xo(t,e){return t.x*e.x+t.y*e.y}function vo(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){const s=e[r],a=t[0],o=i.sub(n),l=s.sub(n),u=a.sub(n),c=xo(o,o),h=xo(o,l),p=xo(l,l),f=xo(u,o),d=xo(u,l),y=c*p-h*h,m=(p*f-h*d)/y,g=(c*d-h*f)/y,x=n.z*(1-m-g)+i.z*m+s.z*g;if(isFinite(x))return x}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}const bo=Rn([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:wo}=bo,_o=Rn([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:So}=_o,ko=Ya.VectorTileFeature.types,Ao=Math.cos(Math.PI/180*37.5),Io=Math.pow(2,14)/.5;class zo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new Pi,this.layoutVertexArray2=new Bi,this.indexArray=new Li,this.programConfigurations=new fs(t.layers,t.zoom),this.segments=new ji,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasPattern=Ua("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),i=!n.isConstant(),s=[];for(const{feature:e,id:a,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=bs(e,t);if(!this.layers[0]._featureFilter.filter(new Sn(this.zoom),u,r))continue;const c=i?n.evaluate(u,{},r):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:vs(e),patterns:{},sortKey:c};s.push(h)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=qa("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,So)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,wo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,n,i){const s=this.layers[0].layout,a=s.get("line-join").evaluate(t,{}),o=s.get("line-cap"),l=s.get("line-miter-limit"),u=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,a,o,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}addLine(t,e,r,n,i,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const a="Polygon"===ko[e.type];let o=t.length;for(;o>=2&&t[o-1].equals(t[o-2]);)o--;let l=0;for(;l<o-1&&t[l].equals(t[l+1]);)l++;if(o<(a?3:2))return;"bevel"===r&&(i=1.05);const u=this.overscaling<=16?15*ms/(512*this.overscaling):0,c=this.segments.prepareSegment(10*o,this.layoutVertexArray,this.indexArray);let h,p,f,d,y;this.e1=this.e2=-1,a&&(h=t[o-2],y=t[l].sub(h)._unit()._perp());for(let e=l;e<o;e++){if(f=e===o-1?a?t[l+1]:void 0:t[e+1],f&&t[e].equals(f))continue;y&&(d=y),h&&(p=h),h=t[e],y=f?f.sub(h)._unit()._perp():d,d=d||y;let m=d.add(y);0===m.x&&0===m.y||m._unit();const g=d.x*y.x+d.y*y.y,x=m.x*y.x+m.y*y.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<Ao&&p&&f,_=d.x*y.y-d.y*y.x>0;if(w&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,d,0,0,c),p=e}}const S=p&&f;let k=S?r:a?"butt":n;if(S&&"round"===k&&(v<s?k="miter":v<=2&&(k="fakeround")),"miter"===k&&v>i&&(k="bevel"),"bevel"===k&&(v>2&&(k="flipbevel"),v<i&&(k="miter")),p&&this.updateDistance(p,h),"miter"===k)m._mult(v),this.addCurrentVertex(h,m,0,0,c);else if("flipbevel"===k){if(v>100)m=y.mult(-1);else{const t=v*d.add(y).mag()/d.sub(y).mag();m._perp()._mult(t*(_?-1:1))}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c)}else if("bevel"===k||"fakeround"===k){const t=-Math.sqrt(v*v-1),e=_?t:0,r=_?0:t;if(p&&this.addCurrentVertex(h,d,e,r,c),"fakeround"===k){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const n=y.sub(d)._mult(r)._add(d)._unit()._mult(_?-1:1);this.addHalfVertex(h,n.x,n.y,!1,_,0,c)}}f&&this.addCurrentVertex(h,y,-e,-r,c)}else if("butt"===k)this.addCurrentVertex(h,m,0,0,c);else if("square"===k){const t=p?1:-1;this.addCurrentVertex(h,m,t,t,c)}else"round"===k&&(p&&(this.addCurrentVertex(h,d,0,0,c),this.addCurrentVertex(h,d,1,1,c,!0)),f&&(this.addCurrentVertex(h,y,-1,-1,c,!0),this.addCurrentVertex(h,y,0,0,c)));if(w&&e<o-1){const t=h.dist(f);if(t>2*u){const e=h.add(f.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e}}}}addCurrentVertex(t,e,r,n,i,s=!1){const a=e.y*n-e.x,o=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,s,!1,r,i),this.addHalfVertex(t,a,o,s,!0,-n,i),this.distance>Io/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,n,i,s))}addHalfVertex({x:t,y:e},r,n,i,s,a,o){const l=.5*(this.lineClips?this.scaledDistance*(Io-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),s?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let Mo,Co;Xr("LineBucket",zo,{omit:["layers","patternFeatures"]});var Po={get paint(){return Co=Co||new $n({"line-opacity":new En(b.paint_line["line-opacity"]),"line-color":new En(b.paint_line["line-color"]),"line-translate":new Vn(b.paint_line["line-translate"]),"line-translate-anchor":new Vn(b.paint_line["line-translate-anchor"]),"line-width":new En(b.paint_line["line-width"]),"line-gap-width":new En(b.paint_line["line-gap-width"]),"line-offset":new En(b.paint_line["line-offset"]),"line-blur":new En(b.paint_line["line-blur"]),"line-dasharray":new Tn(b.paint_line["line-dasharray"]),"line-pattern":new Fn(b.paint_line["line-pattern"]),"line-gradient":new Dn(b.paint_line["line-gradient"])})},get layout(){return Mo=Mo||new $n({"line-cap":new Vn(b.layout_line["line-cap"]),"line-join":new En(b.layout_line["line-join"]),"line-miter-limit":new Vn(b.layout_line["line-miter-limit"]),"line-round-limit":new Vn(b.layout_line["line-round-limit"]),"line-sort-key":new En(b.layout_line["line-sort-key"])})}};class Bo extends En{possiblyEvaluate(t,e){return e=new Sn(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,n){return e=l({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}let Vo;class Eo extends On{constructor(t){super(t,Po),this.gradientVersion=0,Vo||(Vo=new Bo(Po.paint.properties["line-width"].specification),Vo.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof ne,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Vo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new zo(t)}queryRadius(t){const e=t,r=Fo(Fs("line-width",this,e),Fs("line-gap-width",this,e)),n=Fs("line-offset",this,e);return r/2+Math.abs(n)+Ts(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,r,i,s,a,o){const l=Ds(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,o),u=o/2*Fo(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),c=this.paint.get("line-offset").evaluate(e,r);return c&&(i=function(t,e){const r=[];for(let i=0;i<t.length;i++){const s=t[i],a=[];for(let t=0;t<s.length;t++){const r=s[t-1],i=s[t],o=s[t+1],l=0===t?new n(0,0):i.sub(r)._unit()._perp(),u=t===s.length-1?new n(0,0):o.sub(i)._unit()._perp(),c=l._add(u)._unit(),h=c.x*u.x+c.y*u.y;0!==h&&c._mult(1/h),a.push(c._mult(e)._add(i))}r.push(a)}return r}(i,c*o)),function(t,e,r){for(let n=0;n<e.length;n++){const i=e[n];if(t.length>=3)for(let e=0;e<i.length;e++)if(Vs(t,i[e]))return!0;if(Is(t,i,r))return!0}return!1}(l,i,u)}isTileClipped(){return!0}}function Fo(t,e){return e>0?e+2*t:t}const To=Rn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Do=Rn([{name:"a_projected_pos",components:3,type:"Float32"}],4);Rn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const $o=Rn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Rn([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Lo=Rn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function Oo(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),_n.applyArabicShaping&&(t=_n.applyArabicShaping(t)),t}(t.text,e,r)})),t}Rn([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Rn([{name:"triangle",components:3,type:"Uint16"}]),Rn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Rn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Rn([{type:"Float32",name:"offsetX"}]),Rn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Rn([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Uo={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var qo=24,jo=Zo,Ro=function(t,e,r,n,i){var s,a,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,s=f&(1<<-c)-1,f>>=-c,c+=o;c>0;s=256*s+t[e+h],h+=p,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===s)s=1-u;else{if(s===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),s-=u}return(f?-1:1)*a*Math.pow(2,s-n)},No=function(t,e,r,n,i,s){var a,o,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*l-1)*Math.pow(2,i),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&o,f+=d,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*y};function Zo(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Zo.Varint=0,Zo.Fixed64=1,Zo.Bytes=2,Zo.Fixed32=5;var Jo=4294967296,Go=1/Jo,Ko="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Xo(t){return t.type===Zo.Bytes?t.readVarint()+t.pos:t.pos+1}function Yo(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ho(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Wo(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function Qo(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function tl(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function el(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function rl(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function nl(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function il(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function sl(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function al(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function ol(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function ll(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function ul(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Zo.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,s=this.pos;this.type=7&n,t(i,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=ol(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=ul(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=ol(this.buf,this.pos)+ol(this.buf,this.pos+4)*Jo;return this.pos+=8,t},readSFixed64:function(){var t=ol(this.buf,this.pos)+ul(this.buf,this.pos+4)*Jo;return this.pos+=8,t},readFloat:function(){var t=Ro(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Ro(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,s=r.buf;if(n=(112&(i=s[r.pos++]))>>4,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<3,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<10,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<17,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<24,i<128)return Yo(t,n,e);if(n|=(1&(i=s[r.pos++]))<<31,i<128)return Yo(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ko?function(t,e,r){return Ko.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i<r;){var s,a,o,l=t[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(a=t[i+2],128==(192&(s=t[i+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&s)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[i+2],o=t[i+3],128==(192&(s=t[i+1]))&&128==(192&a)&&128==(192&o)&&((u=(15&l)<<18|(63&s)<<12|(63&a)<<6|63&o)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Zo.Bytes)return t.push(this.readVarint(e));var r=Xo(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Zo.Bytes)return t.push(this.readSVarint());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Zo.Bytes)return t.push(this.readBoolean());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Zo.Bytes)return t.push(this.readFloat());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Zo.Bytes)return t.push(this.readDouble());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Zo.Bytes)return t.push(this.readFixed32());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Zo.Bytes)return t.push(this.readSFixed32());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Zo.Bytes)return t.push(this.readFixed64());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Zo.Bytes)return t.push(this.readSFixed64());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Zo.Varint)for(;this.buf[this.pos++]>127;);else if(e===Zo.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Zo.Fixed32)this.pos+=4;else{if(e!==Zo.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),ll(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),ll(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),ll(this.buf,-1&t,this.pos),ll(this.buf,Math.floor(t*Go),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),ll(this.buf,-1&t,this.pos),ll(this.buf,Math.floor(t*Go),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,s=0;s<e.length;s++){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){n>56319||s+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Ho(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),No(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),No(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&Ho(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Zo.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Wo,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Qo,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,il,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,sl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,al,e)},writeBytesField:function(t,e){this.writeTag(t,Zo.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Zo.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Zo.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Zo.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Zo.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Zo.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Zo.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Zo.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Zo.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Zo.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var cl=t(jo);const hl=3;function pl(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:i,h:s,fill:e/(i*s)||0}}const fl=1;class dl{constructor(t,{pixelRatio:e,version:r,stretchX:n,stretchY:i,content:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=i,this.content=s,this.version=r}get tl(){return[this.paddedRect.x+fl,this.paddedRect.y+fl]}get br(){return[this.paddedRect.x+this.paddedRect.w-fl,this.paddedRect.y+this.paddedRect.h-fl]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*fl)/this.pixelRatio,(this.paddedRect.h-2*fl)/this.pixelRatio]}}class yl{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:s,h:a}=pl(i),o=new Qs({width:s||1,height:a||1});for(const e in t){const n=t[e],i=r[e].paddedRect;Qs.copy(n.data,o,{x:0,y:0},{x:i.x+fl,y:i.y+fl},n.data)}for(const t in e){const r=e[t],i=n[t].paddedRect,s=i.x+fl,a=i.y+fl,l=r.data.width,u=r.data.height;Qs.copy(r.data,o,{x:0,y:0},{x:s,y:a},r.data),Qs.copy(r.data,o,{x:0,y:u-1},{x:s,y:a-1},{width:l,height:1}),Qs.copy(r.data,o,{x:0,y:0},{x:s,y:a+u},{width:l,height:1}),Qs.copy(r.data,o,{x:l-1,y:0},{x:s-1,y:a},{width:1,height:u}),Qs.copy(r.data,o,{x:0,y:0},{x:s+l,y:a},{width:1,height:u})}this.image=o,this.iconPositions=r,this.patternPositions=n}addImages(t,e,r){for(const n in t){const i=t[n],s={x:0,y:0,w:i.data.width+2*fl,h:i.data.height+2*fl};r.push(s),e[n]=new dl(s,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,i]=t.tl;r.update(e.data,void 0,{x:n,y:i})}}var ml;Xr("ImagePosition",dl),Xr("ImageAtlas",yl),function(t){t[t.none=0]="none",t[t.horizontal=1]="horizontal",t[t.vertical=2]="vertical",t[t.horizontalOnly=3]="horizontalOnly"}(ml||(ml={}));const gl=-17;class xl{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const r=new xl;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new xl;return e.imageName=t,e}}class vl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const r=new vl;for(let n=0;n<t.sections.length;n++){const i=t.sections[n];i.image?r.addImageSection(i):r.addTextSection(i,e)}return r}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let r=0;r<t.length;r++){const n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;e+=n&&mn(n)&&!Uo[t[r+1]]||i&&mn(i)&&!Uo[t[r-1]]||!Uo[t[r]]?t[r]:Uo[t[r]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&wl[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&wl[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const r=new vl;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(xl.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(r)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void p("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(xl.forImage(e)),this.sectionIndex.push(this.sections.length-1)):p("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function bl(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y){const m=vl.fromFeature(t,i);let g;h===ml.vertical&&m.verticalizePunctuation();const{processBidirectionalText:x,processStyledBidirectionalText:v}=_n;if(x&&1===m.sections.length){g=[];const t=x(m.toString(),Ml(m,u,s,e,n,f,d));for(const e of t){const t=new vl;t.text=e,t.sections=m.sections;for(let r=0;r<e.length;r++)t.sectionIndex.push(0);g.push(t)}}else if(v){g=[];const t=v(m.text,m.sectionIndex,Ml(m,u,s,e,n,f,d));for(const e of t){const t=new vl;t.text=e[0],t.sectionIndex=e[1],t.sections=m.sections,g.push(t)}}else g=function(t,e){const r=[],n=t.text;let i=0;for(const n of e)r.push(t.substring(i,n)),i=n;return i<n.length&&r.push(t.substring(i,n.length)),r}(m,Ml(m,u,s,e,n,f,d));const b=[],w={positionedLines:b,text:m.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1};return function(t,e,r,n,i,s,a,o,l,u,c,h){let p=0,f=gl,d=0,y=0;const m="right"===o?1:"left"===o?0:.5;let g=0;for(const a of i){a.trim();const i=a.getMaxScale(),o=(i-1)*qo,v={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=v;const b=v.positionedGlyphs;let w=0;if(!a.length()){f+=s,++g;continue}for(let s=0;s<a.length();s++){const d=a.getSection(s),y=a.getSectionIndex(s),m=a.getCharCode(s);let g=0,v=null,_=null,S=null,k=qo;const A=!(l===ml.horizontal||!c&&!yn(m)||c&&(wl[m]||(x=m,hn.Arabic(x)||hn["Arabic Supplement"](x)||hn["Arabic Extended-A"](x)||hn["Arabic Presentation Forms-A"](x)||hn["Arabic Presentation Forms-B"](x))));if(d.imageName){const e=n[d.imageName];if(!e)continue;S=d.imageName,t.iconsInText=t.iconsInText||!0,_=e.paddedRect;const r=e.displaySize;d.scale=d.scale*qo/h,v={width:r[0],height:r[1],left:fl,top:-hl,advance:A?r[1]:r[0]},g=o+(qo-r[1]*d.scale),k=v.advance;const s=A?r[0]*d.scale-qo*i:r[1]*d.scale-qo*i;s>0&&s>w&&(w=s)}else{const t=r[d.fontStack],n=t&&t[m];if(n&&n.rect)_=n.rect,v=n.metrics;else{const t=e[d.fontStack],r=t&&t[m];if(!r)continue;v=r.metrics}g=(i-d.scale)*qo}A?(t.verticalizable=!0,b.push({glyph:m,imageName:S,x:p,y:f+g,vertical:A,scale:d.scale,fontStack:d.fontStack,sectionIndex:y,metrics:v,rect:_}),p+=k*d.scale+u):(b.push({glyph:m,imageName:S,x:p,y:f+g,vertical:A,scale:d.scale,fontStack:d.fontStack,sectionIndex:y,metrics:v,rect:_}),p+=v.advance*d.scale+u)}0!==b.length&&(d=Math.max(p-u,d),Pl(b,0,b.length-1,m,w)),p=0;const _=s*i+w;v.lineOffset=Math.max(w,o),f+=_,y=Math.max(_,y),++g}var x;const v=f-gl,{horizontalAlign:b,verticalAlign:w}=Cl(a);(function(t,e,r,n,i,s,a,o,l){const u=(e-r)*i;let c=0;c=s!==a?-o*n-gl:(-n*l+.5)*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c})(t.positionedLines,m,b,w,d,y,s,v,i.length),t.top+=-w*v,t.bottom=t.top+v,t.left+=-b*d,t.right=t.left+d}(w,e,r,n,g,a,o,l,h,u,p,y),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const wl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},_l={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Sl(t,e,r,n,i,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*qo/s+i:0}{const n=r[e.fontStack],s=n&&n[t];return s?s.metrics.advance*e.scale+i:0}}function kl(t,e,r,n){const i=Math.pow(t-e,2);return n?t<e?i/2:2*i:i+Math.abs(r)*r}function Al(t,e,r){let n=0;return 10===t&&(n-=1e4),r&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Il(t,e,r,n,i,s){let a=null,o=kl(e,r,i,s);for(const t of n){const n=kl(e-t.x,r,i,s)+t.badness;n<=o&&(a=t,o=n)}return{index:t,x:e,priorBreak:a,badness:o}}function zl(t){return t?zl(t.priorBreak).concat(t.index):[]}function Ml(t,e,r,n,i,s,a){if("point"!==s)return[];if(!t)return[];const o=[],l=function(t,e,r,n,i,s){let a=0;for(let r=0;r<t.length();r++){const o=t.getSection(r);a+=Sl(t.getCharCode(r),o,n,i,e,s)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,n,i,a),u=t.text.indexOf("")>=0;let c=0;for(let r=0;r<t.length();r++){const s=t.getSection(r),p=t.getCharCode(r);if(wl[p]||(c+=Sl(p,s,n,i,e,a)),r<t.length()-1){const e=!((h=p)<11904||!(hn["Bopomofo Extended"](h)||hn.Bopomofo(h)||hn["CJK Compatibility Forms"](h)||hn["CJK Compatibility Ideographs"](h)||hn["CJK Compatibility"](h)||hn["CJK Radicals Supplement"](h)||hn["CJK Strokes"](h)||hn["CJK Symbols and Punctuation"](h)||hn["CJK Unified Ideographs Extension A"](h)||hn["CJK Unified Ideographs"](h)||hn["Enclosed CJK Letters and Months"](h)||hn["Halfwidth and Fullwidth Forms"](h)||hn.Hiragana(h)||hn["Ideographic Description Characters"](h)||hn["Kangxi Radicals"](h)||hn["Katakana Phonetic Extensions"](h)||hn.Katakana(h)||hn["Vertical Forms"](h)||hn["Yi Radicals"](h)||hn["Yi Syllables"](h)));(_l[p]||e||s.imageName)&&o.push(Il(r+1,c,l,o,Al(p,t.getCharCode(r+1),e&&u),!1))}}var h;return zl(Il(t.length(),c,l,o,0,!0))}function Cl(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Pl(t,e,r,n,i){if(!n&&!i)return;const s=t[r],a=(t[r].x+s.metrics.advance*s.scale)*n;for(let n=e;n<=r;n++)t[n].x-=a,t[n].y+=i}function Bl(t,e,r){const{horizontalAlign:n,verticalAlign:i}=Cl(r),s=e[0]-t.displaySize[0]*n,a=e[1]-t.displaySize[1]*i;return{image:t,top:a,bottom:a+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function Vl(t,e,r,n,i,s){const a=t.image;let o;if(a.content){const t=a.content,e=a.pixelRatio||1;o=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*s,u=e.right*s;let c,h,p,f;"width"===r||"both"===r?(f=i[0]+l-n[3],h=i[0]+u+n[1]):(f=i[0]+(l+u-a.displaySize[0])/2,h=f+a.displaySize[0]);const d=e.top*s,y=e.bottom*s;return"height"===r||"both"===r?(c=i[1]+d-n[0],p=i[1]+y+n[2]):(c=i[1]+(d+y-a.displaySize[1])/2,p=c+a.displaySize[1]),{image:a,top:c,right:h,bottom:p,left:f,collisionPadding:o}}const El=255,Fl=128,Tl=El*Fl;function Dl(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Sn(t+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=r;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let s=i;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const a=e[i],o=e[s];return"composite"===r.kind?{kind:"composite",minZoom:a,maxZoom:o,interpolationType:n}:{kind:"camera",minZoom:a,maxZoom:o,minSize:r.evaluate(new Sn(a)),maxSize:r.evaluate(new Sn(o)),interpolationType:n}}}function $l(t,e,r){let n="never";const i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}const Ll=Ya.VectorTileFeature.types,Ol=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ul(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=o?Math.min(Tl,Math.round(o[0])):0,d=o?Math.min(Tl,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),s,a,(f<<1)+(l?1:0),d,16*u,16*c,256*h,256*p)}function ql(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function jl(t){for(const e of t.sections)if(vn(e.text))return!0;return!1}class Rl{constructor(t){this.layoutVertexArray=new Ei,this.indexArray=new Li,this.programConfigurations=t,this.segments=new ji,this.dynamicLayoutVertexArray=new Fi,this.opacityVertexArray=new Ti,this.hasVisibleVertices=!1,this.placedSymbolArray=new gi}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,r,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,To.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Do.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Ol,!0),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Xr("SymbolBuffers",Rl);class Nl{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new ji,this.collisionVertexArray=new $i}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,$o.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Xr("CollisionBuffers",Nl);class Zl{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=js([]),this.placementViewportMatrix=js([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Dl(this.zoom,e["text-size"]),this.iconSizeData=Dl(this.zoom,e["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.canOverlap="never"!==$l(r,"text-overlap","text-allow-overlap")||"never"!==$l(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((t=>ml[t]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID}createArrays(){this.text=new Rl(new fs(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Rl(new fs(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new bi,this.lineVertexArray=new wi,this.symbolInstances=new vi,this.textAnchorOffsets=new Si}calculateGlyphDependencies(t,e,r,n,i){for(let s=0;s<t.length;s++)if(e[t.charCodeAt(s)]=!0,(r||n)&&i){const r=Uo[t.charAt(s)];r&&(e[r.charCodeAt(0)]=!0)}}populate(t,e,r){const n=this.layers[0],i=n.layout,s=i.get("text-font"),a=i.get("text-field"),o=i.get("icon-image"),l=("constant"!==a.value.kind||a.value.value instanceof dt&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),u="constant"!==o.value.kind||!!o.value.value||Object.keys(o.parameters).length>0,c=i.get("symbol-sort-key");if(this.features=[],!l&&!u)return;const h=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new Sn(this.zoom);for(const{feature:e,id:a,index:o,sourceLayerIndex:y}of t){const t=n._featureFilter.needGeometry,m=bs(e,t);if(!n._featureFilter.filter(d,m,r))continue;let g,x;if(t||(m.geometry=vs(e)),l){const t=n.getValueAndResolveTokens("text-field",m,r,f),e=dt.factory(t);jl(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===bn||this.hasRTLText&&_n.isParsed())&&(g=Oo(e,n,m))}if(u){const t=n.getValueAndResolveTokens("icon-image",m,r,f);x=t instanceof xt?t:xt.fromString(t)}if(!g&&!x)continue;const v=this.sortFeaturesByKey?c.evaluate(m,{},r):void 0;if(this.features.push({id:a,text:g,icon:x,index:o,sourceLayerIndex:y,geometry:m.geometry,properties:e.properties,type:Ll[e.type],sortKey:v}),x&&(h[x.name]=!0),g){const t=s.evaluate(m,{},r).join(","),e="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(ml.vertical)>=0;for(const r of g.sections)if(r.image)h[r.image.name]=!0;else{const n=pn(g.toString()),i=r.fontStack||t,s=p[i]=p[i]||{};this.calculateGlyphDependencies(r.text,s,e,this.allowVerticalPlacement,n)}}}"line"===i.get("symbol-placement")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++}function a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const f=l(p,h),d=l(p,h,!0);if(f in r&&d in e&&r[f]!==e[d]){const t=o(f,d,h),i=a(f,d,n[t].geometry);delete e[f],delete r[d],r[l(p,n[i].geometry,!0)]=i,n[t].geometry=null}else f in r?a(f,d,h):d in e?o(f,d,h):(s(u),e[f]=i-1,r[d]=i-1)}return n.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const i={};for(let n=t.segment+1;n<e.length;n++)i[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:r},n<e.length-1&&(r+=e[n+1].dist(e[n]));for(let r=t.segment||0;r>=0;r--)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r>0&&(n+=e[r-1].dist(e[r]));for(let t=0;t<e.length;t++){const e=i[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,a,o,l,u,c,h){const p=t.indexArray,f=t.layoutVertexArray,d=t.segments.prepareSegment(4*e.length,f,p,this.canOverlap?s.sortKey:void 0),y=this.glyphOffsetArray.length,m=d.vertexLength,g=this.allowVerticalPlacement&&a===ml.vertical?Math.PI/2:0,x=s.text&&s.text.sections;for(let n=0;n<e.length;n++){const{tl:i,tr:a,bl:l,br:u,tex:c,pixelOffsetTL:y,pixelOffsetBR:m,minFontScaleX:v,minFontScaleY:b,glyphOffset:w,isSDF:_,sectionIndex:S}=e[n],k=d.vertexLength,A=w[1];Ul(f,o.x,o.y,i.x,A+i.y,c.x,c.y,r,_,y.x,y.y,v,b),Ul(f,o.x,o.y,a.x,A+a.y,c.x+c.w,c.y,r,_,m.x,y.y,v,b),Ul(f,o.x,o.y,l.x,A+l.y,c.x,c.y+c.h,r,_,y.x,m.y,v,b),Ul(f,o.x,o.y,u.x,A+u.y,c.x+c.w,c.y+c.h,r,_,m.x,m.y,v,b),ql(t.dynamicLayoutVertexArray,o,g),p.emplaceBack(k,k+1,k+2),p.emplaceBack(k+1,k+2,k+3),d.vertexLength+=4,d.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(w[0]),n!==e.length-1&&S===e[n+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,s,s.index,{},h,x&&x[S])}t.placedSymbolArray.emplaceBack(o.x,o.y,y,this.glyphOffsetArray.length-y,m,l,u,o.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,c)}_addCollisionDebugVertex(t,e,r,n,i,s){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,n,i,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(t,e,r,i,s,a,o){const l=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),u=l.vertexLength,c=s.layoutVertexArray,h=s.collisionVertexArray,p=o.anchorX,f=o.anchorY;this._addCollisionDebugVertex(c,h,a,p,f,new n(t,e)),this._addCollisionDebugVertex(c,h,a,p,f,new n(r,e)),this._addCollisionDebugVertex(c,h,a,p,f,new n(r,i)),this._addCollisionDebugVertex(c,h,a,p,f,new n(t,i)),l.vertexLength+=4;const d=s.indexArray;d.emplaceBack(u,u+1),d.emplaceBack(u+1,u+2),d.emplaceBack(u+2,u+3),d.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,n){for(let i=t;i<e;i++){const t=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,n?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Nl(Di,Lo.members,Oi),this.iconCollisionBox=new Nl(Di,Lo.members,Oi);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,n,i,s,a,o,l){const u={};for(let n=e;n<r;n++){const e=t.get(n);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},u.textFeatureIndex=e.featureIndex;break}for(let e=n;e<i;e++){const r=t.get(e);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let e=s;e<a;e++){const r=t.get(e);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.iconFeatureIndex=r.featureIndex;break}for(let e=o;e<l;e++){const r=t.get(e);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),n=[],i=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);const a=this.symbolInstances.get(t);n.push(0|Math.round(e*a.anchorX+r*a.anchorY)),i.push(a.featureIndex)}return s.sort(((t,e)=>n[t]-n[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Jl,Gl;Xr("SymbolBucket",Zl,{omit:["layers","collisionBoxArray","features","compareText"]}),Zl.MAX_GLYPHS=65535,Zl.addDynamicAttributes=ql;var Kl={get paint(){return Gl=Gl||new $n({"icon-opacity":new En(b.paint_symbol["icon-opacity"]),"icon-color":new En(b.paint_symbol["icon-color"]),"icon-halo-color":new En(b.paint_symbol["icon-halo-color"]),"icon-halo-width":new En(b.paint_symbol["icon-halo-width"]),"icon-halo-blur":new En(b.paint_symbol["icon-halo-blur"]),"icon-translate":new Vn(b.paint_symbol["icon-translate"]),"icon-translate-anchor":new Vn(b.paint_symbol["icon-translate-anchor"]),"text-opacity":new En(b.paint_symbol["text-opacity"]),"text-color":new En(b.paint_symbol["text-color"],{runtimeType:P,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new En(b.paint_symbol["text-halo-color"]),"text-halo-width":new En(b.paint_symbol["text-halo-width"]),"text-halo-blur":new En(b.paint_symbol["text-halo-blur"]),"text-translate":new Vn(b.paint_symbol["text-translate"]),"text-translate-anchor":new Vn(b.paint_symbol["text-translate-anchor"])})},get layout(){return Jl=Jl||new $n({"symbol-placement":new Vn(b.layout_symbol["symbol-placement"]),"symbol-spacing":new Vn(b.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Vn(b.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new En(b.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Vn(b.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Vn(b.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Vn(b.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Vn(b.layout_symbol["icon-ignore-placement"]),"icon-optional":new Vn(b.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Vn(b.layout_symbol["icon-rotation-alignment"]),"icon-size":new En(b.layout_symbol["icon-size"]),"icon-text-fit":new Vn(b.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Vn(b.layout_symbol["icon-text-fit-padding"]),"icon-image":new En(b.layout_symbol["icon-image"]),"icon-rotate":new En(b.layout_symbol["icon-rotate"]),"icon-padding":new En(b.layout_symbol["icon-padding"]),"icon-keep-upright":new Vn(b.layout_symbol["icon-keep-upright"]),"icon-offset":new En(b.layout_symbol["icon-offset"]),"icon-anchor":new En(b.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Vn(b.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Vn(b.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Vn(b.layout_symbol["text-rotation-alignment"]),"text-field":new En(b.layout_symbol["text-field"]),"text-font":new En(b.layout_symbol["text-font"]),"text-size":new En(b.layout_symbol["text-size"]),"text-max-width":new En(b.layout_symbol["text-max-width"]),"text-line-height":new Vn(b.layout_symbol["text-line-height"]),"text-letter-spacing":new En(b.layout_symbol["text-letter-spacing"]),"text-justify":new En(b.layout_symbol["text-justify"]),"text-radial-offset":new En(b.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Vn(b.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new En(b.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new En(b.layout_symbol["text-anchor"]),"text-max-angle":new Vn(b.layout_symbol["text-max-angle"]),"text-writing-mode":new Vn(b.layout_symbol["text-writing-mode"]),"text-rotate":new En(b.layout_symbol["text-rotate"]),"text-padding":new Vn(b.layout_symbol["text-padding"]),"text-keep-upright":new Vn(b.layout_symbol["text-keep-upright"]),"text-transform":new En(b.layout_symbol["text-transform"]),"text-offset":new En(b.layout_symbol["text-offset"]),"text-allow-overlap":new Vn(b.layout_symbol["text-allow-overlap"]),"text-overlap":new Vn(b.layout_symbol["text-overlap"]),"text-ignore-placement":new Vn(b.layout_symbol["text-ignore-placement"]),"text-optional":new Vn(b.layout_symbol["text-optional"])})}};class Xl{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:I,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Xr("FormatSectionOverride",Xl,{omit:["defaultValue"]});class Yl extends On{constructor(t){super(t,Kl)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||Ye(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):""))}(e.properties,i)}createBucket(t){return new Zl(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Kl.paint.overridableProperties){if(!Yl.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new Xl(e),n=new Xe(r,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new We("source",n):new Qe("composite",n,e.value.zoomStops),this.paint._values[t]=new Pn(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&Yl.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=Kl.paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof dt)s(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof St&&wt(e.value)===F?s(e.value.sections):e instanceof ze?s(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return i}}let Hl;var Wl={get paint(){return Hl=Hl||new $n({"background-color":new Vn(b.paint_background["background-color"]),"background-pattern":new Tn(b.paint_background["background-pattern"]),"background-opacity":new Vn(b.paint_background["background-opacity"])})}};class Ql extends On{constructor(t){super(t,Wl)}}let tu;var eu={get paint(){return tu=tu||new $n({"raster-opacity":new Vn(b.paint_raster["raster-opacity"]),"raster-hue-rotate":new Vn(b.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Vn(b.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Vn(b.paint_raster["raster-brightness-max"]),"raster-saturation":new Vn(b.paint_raster["raster-saturation"]),"raster-contrast":new Vn(b.paint_raster["raster-contrast"]),"raster-resampling":new Vn(b.paint_raster["raster-resampling"]),"raster-fade-duration":new Vn(b.paint_raster["raster-fade-duration"])})}};class ru extends On{constructor(t){super(t,eu)}}class nu extends On{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}function iu(t){if("custom"===t.type)return new nu(t);switch(t.type){case"background":return new Ql(t);case"circle":return new Ns(t);case"fill":return new Ja(t);case"fill-extrusion":return new go(t);case"heatmap":return new ta(t);case"hillshade":return new na(t);case"line":return new Eo(t);case"raster":return new ru(t);case"symbol":return new Yl(t)}}class su{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(t,e){for(const e of t){this._layerConfigs[e.id]=e;const t=this._layers[e.id]=iu(e);t._featureFilter=sr(t.filter),this.keyCache[e.id]&&delete this.keyCache[e.id]}for(const t of e)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=function(t,e){const r={};for(let n=0;n<t.length;n++){const i=e&&e[t[n].id]||dr(t[n]);e&&(e[t[n].id]=i);let s=r[i];s||(s=r[i]=[]),s.push(t[n])}const n=[];for(const t in r)n.push(r[t]);return n}(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map((t=>this._layers[t.id])),r=e[0];if("none"===r.visibility)continue;const n=r.source||"";let i=this.familiesBySource[n];i||(i=this.familiesBySource[n]={});const s=r.sourceLayer||"_geojsonTileLayer";let a=i[s];a||(a=i[s]=[]),a.push(e)}}}class au{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class ou{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class lu{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new v(ms,16,0),this.grid3D=new v(ms,16,0),this.featureIndexArray=new Ai,this.promoteId=e}insert(t,e,r,n,i,s){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);const o=s?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const r=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){const e=r[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}n[0]<ms&&n[1]<ms&&n[2]>=0&&n[3]>=0&&o.insert(a,n[0],n[1],n[2],n[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ya.VectorTile(new cl(this.rawTileData)).layers,this.sourceLayerCoder=new au(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();const s=t.params||{},a=ms/t.tileSize/t.scale,o=sr(s.filter),l=t.queryGeometry,u=t.queryPadding*a,c=cu(l),h=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),p=cu(t.cameraQueryGeometry),f=this.grid3D.query(p.minX-u,p.minY-u,p.maxX+u,p.maxY+u,((e,r,i,s)=>function(t,e,r,i,s){for(const n of t)if(e<=n.x&&r<=n.y&&i>=n.x&&s>=n.y)return!0;const a=[new n(e,r),new n(e,s),new n(i,s),new n(i,r)];if(t.length>2)for(const e of a)if(Vs(t,e))return!0;for(let e=0;e<t.length-1;e++)if(Es(t[e],t[e+1],a))return!0;return!1}(t.cameraQueryGeometry,e-u,r-u,i+u,s+u)));for(const t of f)h.push(t);h.sort(hu);const d={};let y;for(let n=0;n<h.length;n++){const u=h[n];if(u===y)continue;y=u;const c=this.featureIndexArray.get(u);let p=null;this.loadMatchingFeature(d,c.bucketIndex,c.sourceLayerIndex,c.featureIndex,o,s.layers,s.availableImages,e,r,i,((e,r,n)=>(p||(p=vs(e)),r.queryIntersectsFeature(l,e,n,p,this.z,t.transform,a,t.pixelPosMatrix))))}return d}loadMatchingFeature(t,e,r,n,i,s,a,o,u,c,h){const p=this.bucketLayerIDs[e];if(s&&!function(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}(s,p))return;const f=this.sourceLayerCoder.decode(r),d=this.vtLayers[f].feature(n);if(i.needGeometry){const t=bs(d,!0);if(!i.filter(new Sn(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!i.filter(new Sn(this.tileID.overscaledZ),d))return;const y=this.getId(d,f);for(let e=0;e<p.length;e++){const r=p[e];if(s&&s.indexOf(r)<0)continue;const i=o[r];if(!i)continue;let f={};y&&c&&(f=c.getState(i.sourceLayer||"_geojsonTileLayer",y));const m=l({},u[r]);m.paint=uu(m.paint,i.paint,d,f,a),m.layout=uu(m.layout,i.layout,d,f,a);const g=!h||h(d,i,f);if(!g)continue;const x=new ou(d,this.z,this.x,this.y,y);x.layer=m;let v=t[r];void 0===v&&(v=t[r]=[]),v.push({featureIndex:n,feature:x,intersectionZ:g})}}lookupSymbolFeatures(t,e,r,n,i,s,a,o){const l={};this.loadVTLayers();const u=sr(i);for(const i of t)this.loadMatchingFeature(l,r,n,i,u,s,a,o,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;return this.promoteId&&(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof r&&(r=Number(r))),r}}function uu(t,e,r,n,i){return u(t,((t,s)=>{const a=e instanceof Bn?e.get(s):null;return a&&a.evaluate?a.evaluate(r,n,i):a}))}function cu(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);return{minX:e,minY:r,maxX:n,maxY:i}}function hu(t,e){return e-t}Xr("FeatureIndex",lu,{omit:["rawTileData","sourceLayerCoder"]});class pu extends n{constructor(t,e,r,n){super(t,e),this.angle=r,void 0!==n&&(this.segment=n)}clone(){return new pu(this.x,this.y,this.angle,this.segment)}}function fu(t,e,r,n,i){if(void 0===e.segment||0===r)return!0;let s=e,a=e.segment+1,o=0;for(;o>-r/2;){if(a--,a<0)return!1;o-=t[a].dist(s),s=t[a]}o+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;o<r/2;){const e=t[a],r=t[a+1];if(!r)return!1;let s=t[a-1].angleTo(e)-e.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:s}),u+=s;o-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,o+=e.dist(r)}return!0}function du(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function yu(t,e,r){return t?.6*e*r:0}function mu(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function gu(t,e,r,n,i,s){const a=yu(r,i,s),o=mu(r,n)*s;let l=0;const u=du(t)/2;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1],s=n.dist(i);if(l+s>u){const c=(u-l)/s,h=ae.number(n.x,i.x,c),p=ae.number(n.y,i.y,c),f=new pu(h,p,i.angleTo(n),r);return f._round(),!a||fu(t,f,o,a,e)?f:void 0}l+=s}}function xu(t,e,r,n,i,s,a,o,l){const u=yu(n,s,a),c=mu(n,i),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),vu(t,p?e/2*o%e:(c/2+2*s)*a*o%e,e,u,r,h,p,!1,l)}function vu(t,e,r,n,i,s,a,o,l){const u=s/2,c=du(t);let h=0,p=e-r,f=[];for(let e=0;e<t.length-1;e++){const a=t[e],o=t[e+1],d=a.dist(o),y=o.angleTo(a);for(;p+r<h+d;){p+=r;const m=(p-h)/d,g=ae.number(a.x,o.x,m),x=ae.number(a.y,o.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new pu(g,x,y,e);r._round(),n&&!fu(t,r,s,n,i)||f.push(r)}}h+=d}return o||f.length||a||(f=vu(t,h/2,r,n,i,s,a,!0,l)),f}Xr("Anchor",pu);const bu=fl;function wu(t,e,r,i){const s=[],a=t.image,o=a.pixelRatio,l=a.paddedRect.w-2*bu,u=a.paddedRect.h-2*bu,c=t.right-t.left,h=t.bottom-t.top,p=a.stretchX||[[0,l]],f=a.stretchY||[[0,u]],d=(t,e)=>t+e[1]-e[0],y=p.reduce(d,0),m=f.reduce(d,0),g=l-y,x=u-m;let v=0,b=y,w=0,_=m,S=0,k=g,A=0,I=x;if(a.content&&i){const t=a.content;v=_u(p,0,t[0]),w=_u(f,0,t[1]),b=_u(p,t[0],t[2]),_=_u(f,t[1],t[3]),S=t[0]-v,A=t[1]-w,k=t[2]-t[0]-b,I=t[3]-t[1]-_}const z=(i,s,l,u)=>{const p=ku(i.stretch-v,b,c,t.left),f=Au(i.fixed-S,k,i.stretch,y),d=ku(s.stretch-w,_,h,t.top),g=Au(s.fixed-A,I,s.stretch,m),x=ku(l.stretch-v,b,c,t.left),z=Au(l.fixed-S,k,l.stretch,y),M=ku(u.stretch-w,_,h,t.top),C=Au(u.fixed-A,I,u.stretch,m),P=new n(p,d),B=new n(x,d),V=new n(x,M),E=new n(p,M),F=new n(f/o,g/o),T=new n(z/o,C/o),D=e*Math.PI/180;if(D){const t=Math.sin(D),e=Math.cos(D),r=[e,-t,t,e];P._matMult(r),B._matMult(r),E._matMult(r),V._matMult(r)}const $=i.stretch+i.fixed,L=s.stretch+s.fixed;return{tl:P,tr:B,bl:E,br:V,tex:{x:a.paddedRect.x+bu+$,y:a.paddedRect.y+bu+L,w:l.stretch+l.fixed-$,h:u.stretch+u.fixed-L},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:T,minFontScaleX:k/o/c,minFontScaleY:I/o/h,isSDF:r}};if(i&&(a.stretchX||a.stretchY)){const t=Su(p,g,y),e=Su(f,x,m);for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)s.push(z(n,e[t],i,e[t+1]))}}else s.push(z({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return s}function _u(t,e,r){let n=0;for(const i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function Su(t,e,r){const n=[{fixed:-bu,stretch:0}];for(const[e,r]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(r-e)})}return n.push({fixed:e+bu,stretch:r}),n}function ku(t,e,r,n){return t/e*r+n}function Au(t,e,r,n){return t-e*r/n}class Iu{constructor(t,e,r,i,s,a,o,l,u,c){if(this.boxStartIndex=t.length,u){let t=a.top,e=a.bottom;const r=a.collisionPadding;r&&(t-=r[1],e+=r[3]);let n=e-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{let u=a.top*o-l[0],h=a.bottom*o+l[2],p=a.left*o-l[3],f=a.right*o+l[1];const d=a.collisionPadding;if(d&&(p-=d[0]*o,u-=d[1]*o,f+=d[2]*o,h+=d[3]*o),c){const t=new n(p,u),e=new n(f,u),r=new n(p,h),i=new n(f,h),s=c*Math.PI/180;t._rotate(s),e._rotate(s),r._rotate(s),i._rotate(s),p=Math.min(t.x,e.x,r.x,i.x),f=Math.max(t.x,e.x,r.x,i.x),u=Math.min(t.y,e.y,r.y,i.y),h=Math.max(t.y,e.y,r.y,i.y)}t.emplaceBack(e.x,e.y,p,u,f,h,r,i,s)}this.boxEndIndex=t.length}}class zu{constructor(t=[],e=Mu){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t<n;){let n=1+(t<<1),s=e[n];const a=n+1;if(a<this.length&&r(e[a],s)<0&&(n=a,s=e[a]),r(s,i)>=0)break;e[t]=s,t=n}e[t]=i}}function Mu(t,e){return t<e?-1:t>e?1:0}function Cu(t,e=1,r=!1){let i=1/0,s=1/0,a=-1/0,o=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<i)&&(i=e.x),(!t||e.y<s)&&(s=e.y),(!t||e.x>a)&&(a=e.x),(!t||e.y>o)&&(o=e.y)}const u=Math.min(a-i,o-s);let c=u/2;const h=new zu([],Pu);if(0===u)return new n(i,s);for(let e=i;e<a;e+=u)for(let r=s;r<o;r+=u)h.push(new Bu(e+c,r+c,c,t));let p=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,s=i.length,a=s-1;t<s;a=t++){const s=i[t],o=i[a],l=s.x*o.y-o.x*s.y;r+=(s.x+o.x)*l,n+=(s.y+o.y)*l,e+=3*l}return new Bu(r/e,n/e,0,t)}(t),f=h.length;for(;h.length;){const n=h.pop();(n.d>p.d||!p.d)&&(p=n,r&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,f)),n.max-p.d<=e||(c=n.h/2,h.push(new Bu(n.p.x-c,n.p.y-c,c,t)),h.push(new Bu(n.p.x+c,n.p.y-c,c,t)),h.push(new Bu(n.p.x-c,n.p.y+c,c,t)),h.push(new Bu(n.p.x+c,n.p.y+c,c,t)),f+=4)}return r&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function Pu(t,e){return e.max-t.max}function Bu(t,e,r,i){this.p=new n(t,e),this.h=r,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){const s=e[i];for(let e=0,i=s.length,a=i-1;e<i;a=e++){const i=s[e],o=s[a];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,Ps(t,i,o))}}return(r?1:-1)*Math.sqrt(n)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}var Vu;!function(t){t[t.center=1]="center",t[t.left=2]="left",t[t.right=3]="right",t[t.top=4]="top",t[t.bottom=5]="bottom",t[t["top-left"]=6]="top-left",t[t["top-right"]=7]="top-right",t[t["bottom-left"]=8]="bottom-left",t[t["bottom-right"]=9]="bottom-right"}(Vu||(Vu={}));const Eu=7,Fu=Number.POSITIVE_INFINITY;function Tu(t,e){return e[1]!==Fu?function(t,e,r){let n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-Eu;break;case"bottom-right":case"bottom-left":case"bottom":i=-r+Eu}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(t,e[0],e[1]):function(t,e){let r=0,n=0;e<0&&(e=0);const i=e/Math.SQRT2;switch(t){case"top-right":case"top-left":n=i-Eu;break;case"bottom-right":case"bottom-left":n=-i+Eu;break;case"bottom":n=-e+Eu;break;case"top":n=e-Eu}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(t,e[0])}function Du(t,e,r){var n;const i=t.layout,s=null===(n=i.get("text-variable-anchor-offset"))||void 0===n?void 0:n.evaluate(e,{},r);if(s){const t=s.values,e=[];for(let r=0;r<t.length;r+=2){const n=e[r]=t[r],i=t[r+1].map((t=>t*qo));n.startsWith("top")?i[1]-=Eu:n.startsWith("bottom")&&(i[1]+=Eu),e[r+1]=i}return new gt(e)}const a=i.get("text-variable-anchor");if(a){let n;n=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[i.get("text-radial-offset").evaluate(e,{},r)*qo,Fu]:i.get("text-offset").evaluate(e,{},r).map((t=>t*qo));const s=[];for(const t of a)s.push(t,Tu(t,n));return new gt(s)}return null}function $u(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=ms/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;const e=t.bucket.layers[0],r=e.layout,n=e._unevaluatedLayout._values,i={layoutIconSize:n["icon-size"].possiblyEvaluate(new Sn(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new Sn(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new Sn(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.bucket.textSizeData;i.compositeTextSizes=[n["text-size"].possiblyEvaluate(new Sn(e),t.canonical),n["text-size"].possiblyEvaluate(new Sn(r),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.bucket.iconSizeData;i.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new Sn(e),t.canonical),n["icon-size"].possiblyEvaluate(new Sn(r),t.canonical)]}const s=r.get("text-line-height")*qo,a="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement"),o=r.get("text-keep-upright"),l=r.get("text-size");for(const n of t.bucket.features){const u=r.get("text-font").evaluate(n,{},t.canonical).join(","),c=l.evaluate(n,{},t.canonical),h=i.layoutTextSize.evaluate(n,{},t.canonical),f=i.layoutIconSize.evaluate(n,{},t.canonical),d={horizontal:{},vertical:void 0},y=n.text;let m,g=[0,0];if(y){const i=y.toString(),l=r.get("text-letter-spacing").evaluate(n,{},t.canonical)*qo,p=fn(i)?l:0,f=r.get("text-anchor").evaluate(n,{},t.canonical),m=Du(e,n,t.canonical);if(!m){const e=r.get("text-radial-offset").evaluate(n,{},t.canonical);g=e?Tu(f,[e*qo,Fu]):r.get("text-offset").evaluate(n,{},t.canonical).map((t=>t*qo))}let x=a?"center":r.get("text-justify").evaluate(n,{},t.canonical);const v=r.get("symbol-placement"),b="point"===v?r.get("text-max-width").evaluate(n,{},t.canonical)*qo:0,w=()=>{t.bucket.allowVerticalPlacement&&pn(i)&&(d.vertical=bl(y,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,s,f,"left",p,g,ml.vertical,!0,v,h,c))};if(!a&&m){const e=new Set;if("auto"===x)for(let t=0;t<m.values.length;t+=2)e.add(Lu(m.values[t]));else e.add(x);let r=!1;for(const n of e)if(!d.horizontal[n])if(r)d.horizontal[n]=d.horizontal[0];else{const e=bl(y,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,s,"center",n,p,g,ml.horizontal,!1,v,h,c);e&&(d.horizontal[n]=e,r=1===e.positionedLines.length)}w()}else{"auto"===x&&(x=Lu(f));const e=bl(y,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,s,f,x,p,g,ml.horizontal,!1,v,h,c);e&&(d.horizontal[x]=e),w(),pn(i)&&a&&o&&(d.vertical=bl(y,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,s,f,x,p,g,ml.vertical,!1,v,h,c))}}let x=!1;if(n.icon&&n.icon.name){const e=t.imageMap[n.icon.name];e&&(m=Bl(t.imagePositions[n.icon.name],r.get("icon-offset").evaluate(n,{},t.canonical),r.get("icon-anchor").evaluate(n,{},t.canonical)),x=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=x:t.bucket.sdfIcons!==x&&p("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==r.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const v=qu(d.horizontal)||d.vertical;t.bucket.iconsInText=!!v&&v.iconsInText,(v||m)&&Ou(t.bucket,n,d,m,t.imageMap,i,h,f,g,x,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function Lu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Ou(t,e,r,i,s,a,o,l,u,c,h){let f=a.textMaxSize.evaluate(e,{});void 0===f&&(f=o);const d=t.layers[0].layout,y=d.get("icon-offset").evaluate(e,{},h),m=qu(r.horizontal),g=o/24,x=t.tilePixelRatio*g,v=t.tilePixelRatio*f/24,b=t.tilePixelRatio*l,w=t.tilePixelRatio*d.get("symbol-spacing"),_=d.get("text-padding")*t.tilePixelRatio,S=function(t,e,r,n=1){const i=t.get("icon-padding").evaluate(e,{},r),s=i&&i.values;return[s[0]*n,s[1]*n,s[2]*n,s[3]*n]}(d,e,h,t.tilePixelRatio),k=d.get("text-max-angle")/180*Math.PI,A="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),I="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),z=d.get("symbol-placement"),M=w/2,C=d.get("icon-text-fit");let P;i&&"none"!==C&&(t.allowVerticalPlacement&&r.vertical&&(P=Vl(i,r.vertical,C,d.get("icon-text-fit-padding"),y,g)),m&&(i=Vl(i,m,C,d.get("icon-text-fit-padding"),y,g)));const B=(n,l)=>{l.x<0||l.x>=ms||l.y<0||l.y>=ms||function(t,e,r,n,i,s,a,o,l,u,c,h,f,d,y,m,g,x,v,b,w,_,S,k,A){const I=t.addToLineVertexArray(e,r);let z,M,C,P,B=0,V=0,E=0,F=0,T=-1,D=-1;const $={};let L=Hi("");if(t.allowVerticalPlacement&&n.vertical){const t=o.layout.get("text-rotate").evaluate(w,{},k)+90;C=new Iu(l,e,u,c,h,n.vertical,f,d,y,t),a&&(P=new Iu(l,e,u,c,h,a,g,x,y,t))}if(i){const r=o.layout.get("icon-rotate").evaluate(w,{}),n="none"!==o.layout.get("icon-text-fit"),s=wu(i,r,S,n),f=a?wu(a,r,S,n):void 0;M=new Iu(l,e,u,c,h,i,g,x,!1,r),B=4*s.length;const d=t.iconSizeData;let y=null;"source"===d.kind?(y=[Fl*o.layout.get("icon-size").evaluate(w,{})],y[0]>Tl&&p(`${t.layerIds[0]}: Value for "icon-size" is >= ${El}. Reduce your "icon-size".`)):"composite"===d.kind&&(y=[Fl*_.compositeIconSizes[0].evaluate(w,{},k),Fl*_.compositeIconSizes[1].evaluate(w,{},k)],(y[0]>Tl||y[1]>Tl)&&p(`${t.layerIds[0]}: Value for "icon-size" is >= ${El}. Reduce your "icon-size".`)),t.addSymbols(t.icon,s,y,b,v,w,ml.none,e,I.lineStartIndex,I.lineLength,-1,k),T=t.icon.placedSymbolArray.length-1,f&&(V=4*f.length,t.addSymbols(t.icon,f,y,b,v,w,ml.vertical,e,I.lineStartIndex,I.lineLength,-1,k),D=t.icon.placedSymbolArray.length-1)}const O=Object.keys(n.horizontal);for(const r of O){const i=n.horizontal[r];if(!z){L=Hi(i.text);const t=o.layout.get("text-rotate").evaluate(w,{},k);z=new Iu(l,e,u,c,h,i,f,d,y,t)}const a=1===i.positionedLines.length;if(E+=Uu(t,e,i,s,o,y,w,m,I,n.vertical?ml.horizontal:ml.horizontalOnly,a?O:[r],$,T,_,k),a)break}n.vertical&&(F+=Uu(t,e,n.vertical,s,o,y,w,m,I,ml.vertical,["vertical"],$,D,_,k));const U=z?z.boxStartIndex:t.collisionBoxArray.length,q=z?z.boxEndIndex:t.collisionBoxArray.length,j=C?C.boxStartIndex:t.collisionBoxArray.length,R=C?C.boxEndIndex:t.collisionBoxArray.length,N=M?M.boxStartIndex:t.collisionBoxArray.length,Z=M?M.boxEndIndex:t.collisionBoxArray.length,J=P?P.boxStartIndex:t.collisionBoxArray.length,G=P?P.boxEndIndex:t.collisionBoxArray.length;let K=-1;const X=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;K=X(z,K),K=X(C,K),K=X(M,K),K=X(P,K);const Y=K>-1?1:0;Y&&(K*=A/qo),t.glyphOffsetArray.length>=Zl.MAX_GLYPHS&&p("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,w.sortKey);const H=Du(o,w,k),[W,Q]=function(t,e){const r=t.length,n=null==e?void 0:e.values;if((null==n?void 0:n.length)>0)for(let e=0;e<n.length;e+=2){const r=n[e+1];t.emplaceBack(Vu[n[e]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,H);t.symbolInstances.emplaceBack(e.x,e.y,$.right>=0?$.right:-1,$.center>=0?$.center:-1,$.left>=0?$.left:-1,$.vertical||-1,T,D,L,U,q,j,R,N,Z,J,G,u,E,F,B,V,Y,0,f,K,W,Q)}(t,l,n,r,i,s,P,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,x,[_,_,_,_],A,u,b,S,I,y,e,a,c,h,o)};if("line"===z)for(const s of function(t,e,r,i,s){const a=[];for(let e=0;e<t.length;e++){const r=t[e];let o;for(let t=0;t<r.length-1;t++){let e=r[t],l=r[t+1];e.x<0&&l.x<0||(e.x<0?e=new n(0,e.y+(0-e.x)/(l.x-e.x)*(l.y-e.y))._round():l.x<0&&(l=new n(0,e.y+(0-e.x)/(l.x-e.x)*(l.y-e.y))._round()),e.y<0&&l.y<0||(e.y<0?e=new n(e.x+(0-e.y)/(l.y-e.y)*(l.x-e.x),0)._round():l.y<0&&(l=new n(e.x+(0-e.y)/(l.y-e.y)*(l.x-e.x),0)._round()),e.x>=i&&l.x>=i||(e.x>=i?e=new n(i,e.y+(i-e.x)/(l.x-e.x)*(l.y-e.y))._round():l.x>=i&&(l=new n(i,e.y+(i-e.x)/(l.x-e.x)*(l.y-e.y))._round()),e.y>=s&&l.y>=s||(e.y>=s?e=new n(e.x+(s-e.y)/(l.y-e.y)*(l.x-e.x),s)._round():l.y>=s&&(l=new n(e.x+(s-e.y)/(l.y-e.y)*(l.x-e.x),s)._round()),o&&e.equals(o[o.length-1])||(o=[e],a.push(o)),o.push(l)))))}}return a}(e.geometry,0,0,ms,ms)){const e=xu(s,w,k,r.vertical||m,i,24,v,t.overscaling,ms);for(const r of e)m&&ju(t,m.text,M,r)||B(s,r)}else if("line-center"===z){for(const t of e.geometry)if(t.length>1){const e=gu(t,k,r.vertical||m,i,24,v);e&&B(t,e)}}else if("Polygon"===e.type)for(const t of La(e.geometry,0)){const e=Cu(t,16);B(t[0],new pu(e.x,e.y,0))}else if("LineString"===e.type)for(const t of e.geometry)B(t,new pu(t[0].x,t[0].y,0));else if("Point"===e.type)for(const t of e.geometry)for(const e of t)B([e],new pu(e.x,e.y,0))}function Uu(t,e,r,i,s,a,o,l,u,c,h,f,d,y,m){const g=function(t,e,r,i,s,a,o,l){const u=i.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,c=[];for(const t of e.positionedLines)for(const i of t.positionedGlyphs){if(!i.rect)continue;const a=i.rect||{};let h=hl+1,p=!0,f=1,d=0;const y=(s||l)&&i.vertical,m=i.metrics.advance*i.scale/2;if(l&&e.verticalizable&&(d=t.lineOffset/2-(i.imageName?-(qo-i.metrics.width*i.scale)/2:(i.scale-1)*qo)),i.imageName){const t=o[i.imageName];p=t.sdf,f=t.pixelRatio,h=fl/f}const g=s?[i.x+m,i.y]:[0,0];let x=s?[0,0]:[i.x+m+r[0],i.y+r[1]-d],v=[0,0];y&&(v=x,x=[0,0]);const b=(i.metrics.left-h)*i.scale-m+x[0],w=(-i.metrics.top-h)*i.scale+x[1],_=b+a.w*i.scale/f,S=w+a.h*i.scale/f,k=new n(b,w),A=new n(_,w),I=new n(b,S),z=new n(_,S);if(y){const t=new n(-m,m-gl),e=-Math.PI/2,r=qo/2-m,s=new n(5-gl-r,-(i.imageName?r:0)),a=new n(...v);k._rotateAround(e,t)._add(s)._add(a),A._rotateAround(e,t)._add(s)._add(a),I._rotateAround(e,t)._add(s)._add(a),z._rotateAround(e,t)._add(s)._add(a)}if(u){const t=Math.sin(u),e=Math.cos(u),r=[e,-t,t,e];k._matMult(r),A._matMult(r),I._matMult(r),z._matMult(r)}const M=new n(0,0),C=new n(0,0);c.push({tl:k,tr:A,bl:I,br:z,tex:a,writingMode:e.writingMode,glyphOffset:g,sectionIndex:i.sectionIndex,isSDF:p,pixelOffsetTL:M,pixelOffsetBR:C,minFontScaleX:0,minFontScaleY:0})}return c}(0,r,l,s,a,o,i,t.allowVerticalPlacement),x=t.textSizeData;let v=null;"source"===x.kind?(v=[Fl*s.layout.get("text-size").evaluate(o,{})],v[0]>Tl&&p(`${t.layerIds[0]}: Value for "text-size" is >= ${El}. Reduce your "text-size".`)):"composite"===x.kind&&(v=[Fl*y.compositeTextSizes[0].evaluate(o,{},m),Fl*y.compositeTextSizes[1].evaluate(o,{},m)],(v[0]>Tl||v[1]>Tl)&&p(`${t.layerIds[0]}: Value for "text-size" is >= ${El}. Reduce your "text-size".`)),t.addSymbols(t.text,g,v,l,a,o,c,e,u.lineStartIndex,u.lineLength,d,m);for(const e of h)f[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function qu(t){for(const e in t)return t[e];return null}function ju(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<r)return!0}else i[e]=[];return i[e].push(n),!1}class Ru{constructor(t){const e={},r=[];for(const n in t){const i=t[n],s=e[n]={};for(const t in i){const e=i[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const n={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};r.push(n),s[t]={rect:n,metrics:e.metrics}}}const{w:n,h:i}=pl(r),s=new Ws({width:n||1,height:i||1});for(const r in t){const n=t[r];for(const t in n){const i=n[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const a=e[r][t].rect;Ws.copy(i.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},i.bitmap)}}this.image=s,this.positions=e}}function Nu(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}Xr("GlyphAtlas",Ru);const Zu=6371008.8;class Ju{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ju(function(t,e,r){const n=((t-e)%360+360)%360+e;return n===e?180:n}(this.lng,-180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Zu*Math.acos(Math.min(i,1))}static convert(t){if(t instanceof Ju)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Ju(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Ju(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Gu=2*Math.PI*Zu;function Ku(t){return Gu*Math.cos(t*Math.PI/180)}function Xu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class Yu{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){const r=Ju.convert(t);return new Yu((180+r.lng)/360,(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r.lat*Math.PI/360)))/360,function(t,e){return t/Ku(e)}(e,r.lat))}toLngLat(){return new Ju(360*this.x-180,Xu(this.y))}toAltitude(){return this.z*Ku(Xu(this.y))}meterInMercatorCoordinateUnits(){return 1/Gu*(t=Xu(this.y),1/Math.cos(t*Math.PI/180));var t}}class Hu{constructor(t,e,r){if(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=tc(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){const n=(s=this.y,a=this.z,o=Nu(256*(i=this.x),256*(s=Math.pow(2,a)-s-1),a),l=Nu(256*(i+1),256*(s+1),a),o[0]+","+o[1]+","+l[0]+","+l[1]);var i,s,a,o,l;const u=function(t,e,r){let n,i="";for(let s=t;s>0;s--)n=1<<s-1,i+=(e&n?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,n)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new n((t.x*e-this.x)*ms,(t.y*e-this.y)*ms)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Wu{constructor(t,e){this.wrap=t,this.canonical=e,this.key=tc(t,e.z,e.z,e.x,e.y)}}class Qu{constructor(t,e,r,n,i){if(t<r)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Hu(r,+n,+i),this.key=tc(e,t,r,n,i)}clone(){return new Qu(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new Qu(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Qu(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?tc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):tc(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Qu(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Qu(e,this.wrap,e,r,n),new Qu(e,this.wrap,e,r+1,n),new Qu(e,this.wrap,e,r,n+1),new Qu(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Qu(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Qu(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Wu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Yu(t.x-this.wrap,t.y))}}function tc(t,e,r,n,i){(t*=2)<0&&(t=-1*t-1);const s=1<<r;return(s*s*t+s*i+n).toString(36)+r.toString(36)+e.toString(36)}Xr("CanonicalTileID",Hu),Xr("OverscaledTileID",Qu,{omit:["posMatrix"]});class ec{constructor(t){this.tileID=new Qu(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(t,e,r,n,i){this.status="parsing",this.data=t,this.collisionBoxArray=new yi;const s=new au(Object.keys(t.layers).sort()),a=new lu(this.tileID,this.promoteId);a.bucketLayerIDs=[];const o={},l={featureIndex:a,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:r},c=e.familiesBySource[this.source];for(const e in c){const n=t.layers[e];if(!n)continue;1===n.version&&p(`Vector tile source "${this.source}" layer "${e}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const i=s.encode(e),u=[];for(let t=0;t<n.length;t++){const r=n.feature(t),s=a.getId(r,e);u.push({feature:r,id:s,index:t,sourceLayerIndex:i})}for(const t of c[e]){const e=t[0];e.source!==this.source&&p(`layer.source = ${e.source} does not equal this.source = ${this.source}`),e.minzoom&&this.zoom<Math.floor(e.minzoom)||e.maxzoom&&this.zoom>=e.maxzoom||"none"!==e.visibility&&(rc(t,this.zoom,r),(o[e.id]=e.createBucket({index:a.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:i,sourceID:this.source})).populate(u,l,this.tileID.canonical),a.bucketLayerIDs.push(t.map((t=>t.id))))}}let h,f,d,y;const m=u(l.glyphDependencies,(t=>Object.keys(t).map(Number)));this.inFlightDependencies.forEach((t=>null==t?void 0:t.cancel())),this.inFlightDependencies=[];const g=++this.dependencySentinel;Object.keys(m).length?this.inFlightDependencies.push(n.send("getGlyphs",{uid:this.uid,stacks:m,source:this.source,tileID:this.tileID,type:"glyphs"},((t,e)=>{g===this.dependencySentinel&&(h||(h=t,f=e,b.call(this)))}))):f={};const x=Object.keys(l.iconDependencies);x.length?this.inFlightDependencies.push(n.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{g===this.dependencySentinel&&(h||(h=t,d=e,b.call(this)))}))):d={};const v=Object.keys(l.patternDependencies);function b(){if(h)return i(h);if(f&&d&&y){const t=new Ru(f),e=new yl(d,y);for(const n in o){const i=o[n];i instanceof Zl?(rc(i.layers,this.zoom,r),$u({bucket:i,glyphMap:f,glyphPositions:t.positions,imageMap:d,imagePositions:e.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):i.hasPattern&&(i instanceof zo||i instanceof ja||i instanceof ho)&&(rc(i.layers,this.zoom,r),i.addFeatures(l,this.tileID.canonical,e.patternPositions))}this.status="done",i(null,{buckets:Object.values(o).filter((t=>!t.isEmpty())),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:e,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?d:null,glyphPositions:this.returnDependencies?t.positions:null})}}v.length?this.inFlightDependencies.push(n.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{g===this.dependencySentinel&&(h||(h=t,y=e,b.call(this)))}))):y={},b.call(this)}}function rc(t,e,r){const n=new Sn(e);for(const e of t)e.recalculate(n,r)}var nc;!function(t){t.create="create",t.load="load",t.fullLoad="fullLoad"}(nc||(nc={}));class ic{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}}function sc(t,e){const r=function(t,e){return Gr(l(t,{type:"arrayBuffer"}),e)}(t.request,((r,n,i,s)=>{if(r)e(r);else if(n)try{const t=new Ya.VectorTile(new cl(n));e(null,{vectorTile:t,rawData:n,cacheControl:i,expires:s})}catch(r){const i=new Uint8Array(n);let s=`Unable to parse the tile at ${t.request.url}, `;s+=31===i[0]&&139===i[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${r.messge}`,e(new Error(s))}}));return()=>{r.cancel(),e()}}class ac{constructor(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||sc,this.fetching={},this.loading={},this.loaded={}}loadTile(t,e){const r=t.uid;this.loading||(this.loading={});const n=!!(t&&t.request&&t.request.collectResourceTiming)&&new ic(t.request),i=this.loading[r]=new ec(t);i.abort=this.loadVectorData(t,((t,s)=>{if(delete this.loading[r],t||!s)return i.status="done",this.loaded[r]=i,e(t);const a=s.rawData,o={};s.expires&&(o.expires=s.expires),s.cacheControl&&(o.cacheControl=s.cacheControl);const u={};if(n){const t=n.finish();t&&(u.resourceTiming=JSON.parse(JSON.stringify(t)))}i.vectorTile=s.vectorTile,i.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,n)=>{if(delete this.fetching[r],t||!n)return e(t);e(null,l({rawTileData:a.slice(0)},n,o,u))})),this.loaded=this.loaded||{},this.loaded[r]=i,this.fetching[r]={rawTileData:a,cacheControl:o,resourceTiming:u}}))}reloadTile(t,e){const r=this.loaded,n=t.uid;if(r&&r[n]){const i=r[n];i.showCollisionBoxes=t.showCollisionBoxes,"parsing"===i.status?i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,r)=>{if(t||!r)return e(t,r);let i;if(this.fetching[n]){const{rawTileData:t,cacheControl:e,resourceTiming:s}=this.fetching[n];delete this.fetching[n],i=l({rawTileData:t.slice(0)},r,e,s)}else i=r;e(null,i)})):"done"===i.status&&(i.vectorTile?i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,e):e())}}abortTile(t,e){const r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()}removeTile(t,e){const r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()}}class oc{constructor(t,e,r,n=1,i=1,s=1,a=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r))return void p(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const o=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=i,this.blueFactor=s,this.baseShift=a;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=0;t<o;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(o,t)]=this.data[this._idx(o-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,o)]=this.data[this._idx(t,o-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(o,-1)]=this.data[this._idx(o-1,0)],this.data[this._idx(-1,o)]=this.data[this._idx(0,o-1)],this.data[this._idx(o,o)]=this.data[this._idx(o-1,o-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<o;t++)for(let e=0;e<o;e++){const r=this.get(t,e);r>this.max&&(this.max=r),r<this.min&&(this.min=r)}}get(t,e){const r=new Uint8Array(this.data.buffer),n=4*this._idx(t,e);return this.unpack(r[n],r[n+1],r[n+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}unpack(t,e,r){return t*this.redFactor+e*this.greenFactor+r*this.blueFactor-this.baseShift}getPixels(){return new Qs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=a-1;break;case 1:a=s+1}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e<a;e++)for(let r=n;r<i;r++)this.data[this._idx(r,e)]=t.data[this._idx(r+o,e+l)]}}Xr("DEMData",oc);class lc{constructor(){this.loaded={}}loadTile(t,e){const{uid:r,encoding:n,rawImageData:i,redFactor:s,greenFactor:a,blueFactor:o,baseShift:l}=t,u=x(i)?this.getImageData(i):i,c=new oc(r,u,n,s,a,o,l);this.loaded=this.loaded||{},this.loaded[r]=c,e(null,c)}getImageData(t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);const e=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new Qs({width:e.width,height:e.height},e.data)}removeTile(t){const e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]}}function uc(t,e){if(0!==t.length){cc(t[0],e);for(var r=1;r<t.length;r++)cc(t[r],!e)}}function cc(t,e){for(var r=0,n=0,i=0,s=t.length,a=s-1;i<s;a=i++){var o=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+o;n+=Math.abs(r)>=Math.abs(o)?r-l+o:o-l+r,r=l}r+n>=0!=!!e&&t.reverse()}var hc=t((function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n<e.features.length;n++)t(e.features[n],r);else if("GeometryCollection"===i)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],r);else if("Feature"===i)t(e.geometry,r);else if("Polygon"===i)uc(e.coordinates,r);else if("MultiPolygon"===i)for(n=0;n<e.coordinates.length;n++)uc(e.coordinates[n],r);return e}));const pc=Ya.VectorTileFeature.prototype.toGeoJSON;var fc={exports:{}},dc=e,yc=Ya.VectorTileFeature,mc=gc;function gc(t,e){this.options=e||{},this.features=t,this.length=t.length}function xc(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}gc.prototype.feature=function(t){return new xc(this.features[t],this.options.extent)},xc.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new dc(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry},xc.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,s=0;s<t.length;s++)for(var a=t[s],o=0;o<a.length;o++){var l=a[o];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},xc.prototype.toGeoJSON=yc.prototype.toGeoJSON;var vc=jo,bc=mc;function wc(t){var e=new vc;return function(t,e){for(var r in t.layers)e.writeMessage(3,_c,t.layers[r])}(t,e),e.finish()}function _c(t,e){var r;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,Sc,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var s=n.values;for(r=0;r<s.length;r++)e.writeMessage(4,Mc,s[r])}function Sc(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,kc,t),e.writeVarintField(3,r.type),e.writeMessage(4,zc,r)}function kc(t,e){var r=t.feature,n=t.keys,i=t.values,s=t.keycache,a=t.valuecache;for(var o in r.properties){var l=r.properties[o],u=s[o];if(null!==l){void 0===u&&(n.push(o),s[o]=u=n.length-1),e.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=a[h];void 0===p&&(i.push(l),a[h]=p=i.length-1),e.writeVarint(p)}}}function Ac(t,e){return(e<<3)+(7&t)}function Ic(t){return t<<1^t>>31}function zc(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,s=0,a=r.length,o=0;o<a;o++){var l=r[o],u=1;1===n&&(u=l.length),e.writeVarint(Ac(1,u));for(var c=3===n?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==n&&e.writeVarint(Ac(2,c-1));var p=l[h].x-i,f=l[h].y-s;e.writeVarint(Ic(p)),e.writeVarint(Ic(f)),i+=p,s+=f}3===n&&e.writeVarint(Ac(7,1))}}function Mc(t,e){var r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}fc.exports=wc,fc.exports.fromVectorTileJs=wc,fc.exports.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var n in t)r[n]=new bc(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return wc({layers:r})},fc.exports.GeoJSONWrapper=bc;var Cc=t(fc.exports);const Pc=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Bc{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,r]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const n=r>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const i=Pc[15&r];if(!i)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new Bc(a,s,i,t)}constructor(t,e=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Pc.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,o=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+a+o),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Vc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:s,nodeSize:a}=this,o=[0,i.length-1,0],l=[];for(;o.length;){const u=o.pop()||0,c=o.pop()||0,h=o.pop()||0;if(c-h<=a){for(let a=h;a<=c;a++){const o=s[2*a],u=s[2*a+1];o>=t&&o<=r&&u>=e&&u<=n&&l.push(i[a])}continue}const p=h+c>>1,f=s[2*p],d=s[2*p+1];f>=t&&f<=r&&d>=e&&d<=n&&l.push(i[p]),(0===u?t<=f:e<=d)&&(o.push(h),o.push(p-1),o.push(1-u)),(0===u?r>=f:n>=d)&&(o.push(p+1),o.push(c),o.push(1-u))}return l}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:i,nodeSize:s}=this,a=[0,n.length-1,0],o=[],l=r*r;for(;a.length;){const u=a.pop()||0,c=a.pop()||0,h=a.pop()||0;if(c-h<=s){for(let r=h;r<=c;r++)Dc(i[2*r],i[2*r+1],t,e)<=l&&o.push(n[r]);continue}const p=h+c>>1,f=i[2*p],d=i[2*p+1];Dc(f,d,t,e)<=l&&o.push(n[p]),(0===u?t-r<=f:e-r<=d)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?t+r>=f:e+r>=d)&&(a.push(p+1),a.push(c),a.push(1-u))}return o}}function Vc(t,e,r,n,i,s){if(i-n<=r)return;const a=n+i>>1;Ec(t,e,a,n,i,s),Vc(t,e,r,n,a-1,1-s),Vc(t,e,r,a+1,i,1-s)}function Ec(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const a=i-n+1,o=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(o-a/2<0?-1:1);Ec(t,e,r,Math.max(n,Math.floor(r-o*u/a+c)),Math.min(i,Math.floor(r+(a-o)*u/a+c)),s)}const a=e[2*r+s];let o=n,l=i;for(Fc(t,e,n,r),e[2*i+s]>a&&Fc(t,e,n,i);o<l;){for(Fc(t,e,o,l),o++,l--;e[2*o+s]<a;)o++;for(;e[2*l+s]>a;)l--}e[2*n+s]===a?Fc(t,e,n,l):(l++,Fc(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Fc(t,e,r,n){Tc(t,r,n),Tc(e,2*r,2*n),Tc(e,2*r+1,2*n+1)}function Tc(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function Dc(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}const $c={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Lc=Math.fround||(Oc=new Float32Array(1),t=>(Oc[0]=+t,Oc[0]));var Oc;const Uc=3,qc=5,jc=6;class Rc{constructor(t){this.options=Object.assign(Object.create($c),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:r,maxZoom:n}=this.options;e&&console.time("total time");const i=`prepare ${t.length} points`;e&&console.time(i),this.points=t;const s=[];for(let e=0;e<t.length;e++){const r=t[e];if(!r.geometry)continue;const[n,i]=r.geometry.coordinates,a=Lc(Jc(n)),o=Lc(Gc(i));s.push(a,o,1/0,e,-1,1),this.options.reduce&&s.push(0)}let a=this.trees[n+1]=this._createTree(s);e&&console.timeEnd(i);for(let t=n;t>=r;t--){const r=+Date.now();a=this.trees[t]=this._createTree(this._cluster(a,t)),e&&console.log("z%d: %d clusters in %dms",t,a.numItems,+Date.now()-r)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let i=180===t[2]?180:((t[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){const t=this.getClusters([r,n,180,s],e),a=this.getClusters([-180,n,i,s],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],o=a.range(Jc(r),Gc(s),Jc(i),Gc(n)),l=a.data,u=[];for(const t of o){const e=this.stride*t;u.push(l[e+qc]>1?Nc(l,e,this.clusterProps):this.points[l[e+Uc]])}return u}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",i=this.trees[r];if(!i)throw new Error(n);const s=i.data;if(e*this.stride>=s.length)throw new Error(n);const a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),o=i.within(s[e*this.stride],s[e*this.stride+1],a),l=[];for(const e of o){const r=e*this.stride;s[r+4]===t&&l.push(s[r+qc]>1?Nc(s,r,this.clusterProps):this.points[s[r+Uc]])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,r){const n=[];return this._appendLeaves(n,t,e=e||10,r=r||0,0),n}getTile(t,e,r){const n=this.trees[this._limitZoom(t)],i=Math.pow(2,t),{extent:s,radius:a}=this.options,o=a/s,l=(r-o)/i,u=(r+1+o)/i,c={features:[]};return this._addTileFeatures(n.range((e-o)/i,l,(e+1+o)/i,u),n.data,e,r,i,c),0===e&&this._addTileFeatures(n.range(1-o/i,l,1,u),n.data,i,r,i,c),e===i-1&&this._addTileFeatures(n.range(0,l,o/i,u),n.data,-1,r,i,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,n,i){const s=this.getChildren(e);for(const e of s){const s=e.properties;if(s&&s.cluster?i+s.point_count<=n?i+=s.point_count:i=this._appendLeaves(t,s.cluster_id,r,n,i):i<n?i++:t.push(e),t.length===r)break}return i}_createTree(t){const e=new Bc(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<t.length;r+=this.stride)e.add(t[r],t[r+1]);return e.finish(),e.data=t,e}_addTileFeatures(t,e,r,n,i,s){for(const a of t){const t=a*this.stride,o=e[t+qc]>1;let l,u,c;if(o)l=Zc(e,t,this.clusterProps),u=e[t],c=e[t+1];else{const r=this.points[e[t+Uc]];l=r.properties;const[n,i]=r.geometry.coordinates;u=Jc(n),c=Gc(i)}const h={type:1,geometry:[[Math.round(this.options.extent*(u*i-r)),Math.round(this.options.extent*(c*i-n))]],tags:l};let p;p=o||this.options.generateId?e[t+Uc]:this.points[e[t+Uc]].id,void 0!==p&&(h.id=p),s.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:r,extent:n,reduce:i,minPoints:s}=this.options,a=r/(n*Math.pow(2,e)),o=t.data,l=[],u=this.stride;for(let r=0;r<o.length;r+=u){if(o[r+2]<=e)continue;o[r+2]=e;const n=o[r],c=o[r+1],h=t.within(o[r],o[r+1],a),p=o[r+qc];let f=p;for(const t of h){const r=t*u;o[r+2]>e&&(f+=o[r+qc])}if(f>p&&f>=s){let t,s=n*p,a=c*p,d=-1;const y=((r/u|0)<<5)+(e+1)+this.points.length;for(const n of h){const l=n*u;if(o[l+2]<=e)continue;o[l+2]=e;const c=o[l+qc];s+=o[l]*c,a+=o[l+1]*c,o[l+4]=y,i&&(t||(t=this._map(o,r,!0),d=this.clusterProps.length,this.clusterProps.push(t)),i(t,this._map(o,l)))}o[r+4]=y,l.push(s/f,a/f,1/0,y,-1,f),i&&l.push(d)}else{for(let t=0;t<u;t++)l.push(o[r+t]);if(f>1)for(const t of h){const r=t*u;if(!(o[r+2]<=e)){o[r+2]=e;for(let t=0;t<u;t++)l.push(o[r+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,r){if(t[e+qc]>1){const n=this.clusterProps[t[e+jc]];return r?Object.assign({},n):n}const n=this.points[t[e+Uc]].properties,i=this.options.map(n);return r&&i===n?Object.assign({},i):i}}function Nc(t,e,r){return{type:"Feature",id:t[e+Uc],properties:Zc(t,e,r),geometry:{type:"Point",coordinates:[(n=t[e],360*(n-.5)),Kc(t[e+1])]}};var n}function Zc(t,e,r){const n=t[e+qc],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,s=t[e+jc],a=-1===s?{}:Object.assign({},r[s]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Uc],point_count:n,point_count_abbreviated:i})}function Jc(t){return t/360+.5}function Gc(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Kc(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Xc(t,e,r,n){for(var i,s=n,a=r-e>>1,o=r-e,l=t[e],u=t[e+1],c=t[r],h=t[r+1],p=e+3;p<r;p+=3){var f=Yc(t[p],t[p+1],l,u,c,h);if(f>s)i=p,s=f;else if(f===s){var d=Math.abs(p-a);d<o&&(i=p,o=d)}}s>n&&(i-e>3&&Xc(t,e,i,n),t[i+2]=s,r-i>3&&Xc(t,i,r,n))}function Yc(t,e,r,n,i,s){var a=i-r,o=s-n;if(0!==a||0!==o){var l=((t-r)*a+(e-n)*o)/(a*a+o*o);l>1?(r=i,n=s):l>0&&(r+=a*l,n+=o*l)}return(a=t-r)*a+(o=e-n)*o}function Hc(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)Wc(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<e.length;n++)Wc(t,e[n]);else if("MultiPolygon"===r)for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)Wc(t,e[n][i])}(i),i}function Wc(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function Qc(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,s=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),o=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),"Point"===s)th(i,o);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)th(i[u],o);else if("LineString"===s)eh(i,o,a,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(u=0;u<i.length;u++)eh(i[u],o=[],a,!1),t.push(Hc(l,"LineString",o,e.properties));return}rh(i,o,a,!1)}else if("Polygon"===s)rh(i,o,a,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<e.geometry.geometries.length;u++)Qc(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<i.length;u++){var c=[];rh(i[u],c,a,!0),o.push(c)}}t.push(Hc(l,s,o,e.properties))}}function th(t,e){e.push(nh(t[0])),e.push(ih(t[1])),e.push(0)}function eh(t,e,r,n){for(var i,s,a=0,o=0;o<t.length;o++){var l=nh(t[o][0]),u=ih(t[o][1]);e.push(l),e.push(u),e.push(0),o>0&&(a+=n?(i*u-l*s)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-s,2))),i=l,s=u}var c=e.length-3;e[2]=1,Xc(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function rh(t,e,r,n){for(var i=0;i<t.length;i++){var s=[];eh(t[i],s,r,n),e.push(s)}}function nh(t){return t/360+.5}function ih(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function sh(t,e,r,n,i,s,a,o){if(n/=e,s>=(r/=e)&&a<n)return t;if(a<r||s>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,f=0===i?c.minX:c.minY,d=0===i?c.maxX:c.maxY;if(f>=r&&d<n)l.push(c);else if(!(d<r||f>=n)){var y=[];if("Point"===p||"MultiPoint"===p)ah(h,y,r,n,i);else if("LineString"===p)oh(h,y,r,n,i,!1,o.lineMetrics);else if("MultiLineString"===p)uh(h,y,r,n,i,!1);else if("Polygon"===p)uh(h,y,r,n,i,!0);else if("MultiPolygon"===p)for(var m=0;m<h.length;m++){var g=[];uh(h[m],g,r,n,i,!0),g.length&&y.push(g)}if(y.length){if(o.lineMetrics&&"LineString"===p){for(m=0;m<y.length;m++)l.push(Hc(c.id,p,y[m],c.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===y.length?(p="LineString",y=y[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===y.length?"Point":"MultiPoint"),l.push(Hc(c.id,p,y,c.tags))}}}return l.length?l:null}function ah(t,e,r,n,i){for(var s=0;s<t.length;s+=3){var a=t[s+i];a>=r&&a<=n&&(e.push(t[s]),e.push(t[s+1]),e.push(t[s+2]))}}function oh(t,e,r,n,i,s,a){for(var o,l,u=lh(t),c=0===i?hh:ph,h=t.start,p=0;p<t.length-3;p+=3){var f=t[p],d=t[p+1],y=t[p+2],m=t[p+3],g=t[p+4],x=0===i?f:d,v=0===i?m:g,b=!1;a&&(o=Math.sqrt(Math.pow(f-m,2)+Math.pow(d-g,2))),x<r?v>r&&(l=c(u,f,d,m,g,r),a&&(u.start=h+o*l)):x>n?v<n&&(l=c(u,f,d,m,g,n),a&&(u.start=h+o*l)):ch(u,f,d,y),v<r&&x>=r&&(l=c(u,f,d,m,g,r),b=!0),v>n&&x<=n&&(l=c(u,f,d,m,g,n),b=!0),!s&&b&&(a&&(u.end=h+o*l),e.push(u),u=lh(t)),a&&(h+=o)}var w=t.length-3;f=t[w],d=t[w+1],y=t[w+2],(x=0===i?f:d)>=r&&x<=n&&ch(u,f,d,y),w=u.length-3,s&&w>=3&&(u[w]!==u[0]||u[w+1]!==u[1])&&ch(u,u[0],u[1],u[2]),u.length&&e.push(u)}function lh(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function uh(t,e,r,n,i,s){for(var a=0;a<t.length;a++)oh(t[a],e,r,n,i,s,!1)}function ch(t,e,r,n){t.push(e),t.push(r),t.push(n)}function hh(t,e,r,n,i,s){var a=(s-e)/(n-e);return t.push(s),t.push(r+(i-r)*a),t.push(1),a}function ph(t,e,r,n,i,s){var a=(s-r)/(i-r);return t.push(e+(n-e)*a),t.push(s),t.push(1),a}function fh(t,e){for(var r=[],n=0;n<t.length;n++){var i,s=t[n],a=s.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)i=dh(s.geometry,e);else if("MultiLineString"===a||"Polygon"===a){i=[];for(var o=0;o<s.geometry.length;o++)i.push(dh(s.geometry[o],e))}else if("MultiPolygon"===a)for(i=[],o=0;o<s.geometry.length;o++){for(var l=[],u=0;u<s.geometry[o].length;u++)l.push(dh(s.geometry[o][u],e));i.push(l)}r.push(Hc(s.id,a,i,s.tags))}return r}function dh(t,e){var r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function yh(t,e){if(t.transformed)return t;var r,n,i,s=1<<t.z,a=t.x,o=t.y;for(r=0;r<t.features.length;r++){var l=t.features[r],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(mh(u[n],u[n+1],e,s,a,o));else for(n=0;n<u.length;n++){var h=[];for(i=0;i<u[n].length;i+=2)h.push(mh(u[n][i],u[n][i+1],e,s,a,o));l.geometry.push(h)}}return t.transformed=!0,t}function mh(t,e,r,n,i,s){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-s))]}function gh(t,e,r,n,i){for(var s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},o=0;o<t.length;o++){a.numFeatures++,xh(a,t[o],s,i);var l=t[o].minX,u=t[o].minY,c=t[o].maxX,h=t[o].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function xh(t,e,r,n){var i=e.geometry,s=e.type,a=[];if("Point"===s||"MultiPoint"===s)for(var o=0;o<i.length;o+=3)a.push(i[o]),a.push(i[o+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)vh(a,i,t,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(o=0;o<i.length;o++)vh(a,i[o],t,r,"Polygon"===s,0===o);else if("MultiPolygon"===s)for(var l=0;l<i.length;l++){var u=i[l];for(o=0;o<u.length;o++)vh(a,u[o],t,r,!0,0===o)}if(a.length){var c=e.tags||null;if("LineString"===s&&n.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var p={geometry:a,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function vh(t,e,r,n,i,s){var a=n*n;if(n>0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var o=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>a)&&(r.numSimplified++,o.push(e[l]),o.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,s=i-2;n<i;s=n,n+=2)r+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var a=t[n],o=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=o}}(o,s),t.push(o)}}function bh(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)Qc(r,t.features[n],e,n);else Qc(r,"Feature"===t.type?t:{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=function(t,e){var r=e.buffer/e.extent,n=t,i=sh(t,1,-1-r,r,0,-1,2,e),s=sh(t,1,1-r,2+r,0,-1,2,e);return(i||s)&&(n=sh(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=fh(i,1).concat(n)),s&&(n=n.concat(fh(s,-1)))),n}(n,e),n.length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function wh(t,e,r){return 32*((1<<t)*r+e)+t}function _h(t,e){return e?t.properties[e]:t.id}function Sh(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=_h(t,e);if("FeatureCollection"===t.type){const r=new Set;for(const n of t.features){const t=_h(n,e);if(null==t)return!1;if(r.has(t))return!1;r.add(t)}return!0}return!1}function kh(t,e){const r=new Map;if(null==t);else if("Feature"===t.type)r.set(_h(t,e),t);else for(const n of t.features)r.set(_h(n,e),n);return r}function Ah(t,e){const r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);const i=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!i)return e(null,null);const s=new class{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=ms,this.length=t.length,this._features=t}feature(t){return new class{constructor(t){this._feature=t,this.extent=ms,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const e of this._feature.geometry)t.push([new n(e[0],e[1])]);return t}{const t=[];for(const e of this._feature.geometry){const r=[];for(const t of e)r.push(new n(t[0],t[1]));t.push(r)}return t}}toGeoJSON(t,e,r){return pc.call(this,t,e,r)}}(this._features[t])}}(i.features);let a=Cc(s);0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),e(null,{vectorTile:s,rawData:a.buffer})}bh.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},bh.prototype.splitTile=function(t,e,r,n,i,s,a){for(var o=[t,e,r,n],l=this.options,u=l.debug;o.length;){n=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();var c=1<<e,h=wh(e,r,n),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=gh(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<<i-e;if(r!==Math.floor(s/d)||n!==Math.floor(a/d))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){u>1&&console.time("clipping");var y,m,g,x,v,b,w=.5*l.buffer/l.extent,_=.5-w,S=.5+w,k=1+w;y=m=g=x=null,v=sh(t,c,r-w,r+S,0,p.minX,p.maxX,l),b=sh(t,c,r+_,r+k,0,p.minX,p.maxX,l),t=null,v&&(y=sh(v,c,n-w,n+S,1,p.minY,p.maxY,l),m=sh(v,c,n+_,n+k,1,p.minY,p.maxY,l),v=null),b&&(g=sh(b,c,n-w,n+S,1,p.minY,p.maxY,l),x=sh(b,c,n+_,n+k,1,p.minY,p.maxY,l),b=null),u>1&&console.timeEnd("clipping"),o.push(y||[],e+1,2*r,2*n),o.push(m||[],e+1,2*r,2*n+1),o.push(g||[],e+1,2*r+1,2*n),o.push(x||[],e+1,2*r+1,2*n+1)}}},bh.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,s=n.debug;if(t<0||t>24)return null;var a=1<<t,o=wh(t,e=(e%a+a)%a,r);if(this.tiles[o])return yh(this.tiles[o],i);s>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[wh(u,c,h)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,c,h),s>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,r),s>1&&console.timeEnd("drilling down"),this.tiles[o]?yh(this.tiles[o],i):null):null};class Ih extends ac{constructor(t,e,r,n){super(t,e,r,Ah),this._dataUpdateable=new Map,this.loadGeoJSON=(t,e)=>{const{promoteId:r}=t;if(t.request)return function(t,e){return Gr(l(t,{type:"json"}),e)}(t.request,((t,n,i,s)=>{this._dataUpdateable=Sh(n,r)?kh(n,r):void 0,e(t,n,i,s)}));if("string"==typeof t.data)try{const n=JSON.parse(t.data);this._dataUpdateable=Sh(n,r)?kh(n,r):void 0,e(null,n)}catch(r){e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}else t.dataDiff?this._dataUpdateable?(function(t,e,r){var n,i,s,a;if(e.removeAll&&t.clear(),e.remove)for(const r of e.remove)t.delete(r);if(e.add)for(const n of e.add){const e=_h(n,r);null!=e&&t.set(e,n)}if(e.update)for(const r of e.update){let e=t.get(r.id);if(null==e)continue;const o=!r.removeAllProperties&&((null===(n=r.removeProperties)||void 0===n?void 0:n.length)>0||(null===(i=r.addOrUpdateProperties)||void 0===i?void 0:i.length)>0);if((r.newGeometry||r.removeAllProperties||o)&&(e={...e},t.set(r.id,e),o&&(e.properties={...e.properties})),r.newGeometry&&(e.geometry=r.newGeometry),r.removeAllProperties)e.properties={};else if((null===(s=r.removeProperties)||void 0===s?void 0:s.length)>0)for(const t of r.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(a=r.addOrUpdateProperties)||void 0===a?void 0:a.length)>0)for(const{key:t,value:n}of r.addOrUpdateProperties)e.properties[t]=n}}(this._dataUpdateable,t.dataDiff,r),e(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):e(new Error(`Cannot update existing geojson data in ${t.source}`)):e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},n&&(this.loadGeoJSON=n)}loadData(t,e){var r;null===(r=this._pendingRequest)||void 0===r||r.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const n=!!(t&&t.request&&t.request.collectResourceTiming)&&new ic(t.request);this._pendingCallback=e,this._pendingRequest=this.loadGeoJSON(t,((r,i)=>{if(delete this._pendingCallback,delete this._pendingRequest,r||!i)return e(r);if("object"!=typeof i)return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{hc(i,!0);try{if(t.filter){const e=He(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const r=i.features.filter((t=>e.value.evaluate({zoom:0},t)));i={type:"FeatureCollection",features:r}}this._geoJSONIndex=t.cluster?new Rc(function({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;const r={},n={},i={accumulated:null,zoom:0},s={properties:null},a=Object.keys(e);for(const t of a){const[i,s]=e[t],a=He(s),o=He("string"==typeof i?[i,["accumulated"],["get",t]]:i);r[t]=a.value,n[t]=o.value}return t.map=t=>{s.properties=t;const e={};for(const t of a)e[t]=r[t].evaluate(i,s);return e},t.reduce=(t,e)=>{s.properties=e;for(const e of a)i.accumulated=t[e],t[e]=n[e].evaluate(i,s)},t}(t)).load(i.features):function(t,e){return new bh(t,e)}(i,t.geojsonVtOptions)}catch(r){return e(r)}this.loaded={};const s={};if(n){const e=n.finish();e&&(s.resourceTiming={},s.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}e(null,s)}}))}reloadTile(t,e){const r=this.loaded;return r&&r[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class zh{constructor(t){this.self=t,this.actor=new tn(t,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:ac,geojson:Ih},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=t=>{if(_n.isParsed())throw new Error("RTL text plugin already registered.");_n.applyArabicShaping=t.applyArabicShaping,_n.processBidirectionalText=t.processBidirectionalText,_n.processStyledBidirectionalText=t.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,r){this.availableImages[t]=e;for(const r in this.workerSources[t]){const n=this.workerSources[t][r];for(const t in n)n[t].availableImages=e}r()}setLayers(t,e,r){this.getLayerIndex(t).replace(e),r()}updateLayers(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()}loadTile(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)}loadDEMTile(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)}reloadTile(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)}abortTile(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)}removeTile(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,r){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}loadWorkerSource(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}}syncRTLPluginState(t,e,r){try{_n.setState(e);const t=_n.getPluginURL();if(_n.isLoaded()&&!_n.isParsed()&&null!=t){this.self.importScripts(t);const e=_n.isParsed();r(e?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),e)}}catch(t){r(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new su),e}getWorkerSource(t,e,r){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){const n={send:(e,r,n)=>{this.actor.send(e,r,n,t)}};this.workerSources[t][e][r]=new this.workerSourceTypes[e](n,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][e][r]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new lc),this.demWorkerSources[t][e]}}return y()&&(self.worker=new zh(self)),zh}();
|
|
1
|
+
var maplibregl=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=r;function r(t,e){this.x=t,this.y=e}r.prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t};var n=t(e),i=s;function s(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}s.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<1e-6)break;r-=i/s}var a=0,o=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:o=r,r=.5*(o-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var a=t(i);let o,l;function u(t,e,r){return Math.min(r,Math.max(e,t))}function c(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}function h(t,e,r){const n={};for(const i in t)n[i]=e.call(r||this,t[i],i,t);return n}function p(t){return Array.isArray(t)?t.map(p):"object"==typeof t&&t?h(t,p):t}new a(.25,.1,.25,1);const f={};function d(t){f[t]||("undefined"!=typeof console&&console.warn(t),f[t]=!0)}function y(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function m(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i<s;a=i++)r=t[i],n=t[a],e+=(n.x-r.x)*(r.y+n.y);return e}function g(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}let x,v,b=null;function w(t){if(null==b){const e=t.navigator?t.navigator.userAgent:null;b=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return b}function _(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}class S{constructor(t,e,r){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(let t=0;t<this.d*this.d;t++){const e=i[3+t],r=i[3+t+1];n.push(e===r?null:i.subarray(e,r))}const s=i[3+n.length+1];this.keys=i.subarray(i[3+n.length],s),this.bboxes=i.subarray(s),this.insert=this._insertReadonly}else{this.d=e+2*r;for(let t=0;t<this.d*this.d;t++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;const i=r/e*t;this.min=-i,this.max=t+i}insert(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,r,n,i,s){this.cells[i].push(s)}query(t,e,r,n,i){const s=this.min,a=this.max;if(t<=s&&e<=s&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);{const s=[];return this._forEachCell(t,e,r,n,this._queryCell,s,{},i),s}}_queryCell(t,e,r,n,i,s,a,o){const l=this.cells[i];if(null!==l){const i=this.keys,u=this.bboxes;for(let c=0;c<l.length;c++){const h=l[c];if(void 0===a[h]){const l=4*h;(o?o(u[l+0],u[l+1],u[l+2],u[l+3]):t<=u[l+2]&&e<=u[l+3]&&r>=u[l+0]&&n>=u[l+1])?(a[h]=!0,s.push(i[h])):a[h]=!1}}}}_forEachCell(t,e,r,n,i,s,a,o){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,t,e,r,n,u,s,a,o))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let r=0;for(let t=0;t<this.cells.length;t++)r+=this.cells[t].length;const n=new Int32Array(e+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let i=e;for(let e=0;e<t.length;e++){const r=t[e];n[3+e]=i,n.set(r,i),i+=r.length}return n[3+t.length]=i,n.set(this.keys,i),i+=this.keys.length,n[3+t.length+1]=i,n.set(this.bboxes,i),i+=this.bboxes.length,n.buffer}static serialize(t,e){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}}static deserialize(t){return new S(t.buffer)}}var k={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const A=["type","source","source-layer","minzoom","maxzoom","filter","layout"];class I{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function z(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}class M extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class P{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new P(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const C={kind:"null"},B={kind:"number"},V={kind:"string"},E={kind:"boolean"},F={kind:"color"},T={kind:"object"},D={kind:"value"},$={kind:"collator"},L={kind:"formatted"},O={kind:"padding"},U={kind:"resolvedImage"},q={kind:"variableAnchorOffsetCollection"};function R(t,e){return{kind:"array",itemType:t,N:e}}function j(t){if("array"===t.kind){const e=j(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const N=[C,B,V,E,F,L,T,R(D),O,U,q];function Z(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Z(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of N)if(!Z(t,e))return null}return`Expected ${j(t)} but found ${j(e)} instead.`}function G(t,e){return e.some((e=>e.kind===t.kind))}function J(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function K(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const X=.96422,Y=.82521,H=4/29,W=6/29,Q=3*W*W,tt=W*W*W,et=Math.PI/180,rt=180/Math.PI;function nt(t){return(t%=360)<0&&(t+=360),t}function it([t,e,r,n]){let i,s;const a=at((.2225045*(t=st(t))+.7168786*(e=st(e))+.0606169*(r=st(r)))/1);t===e&&e===r?i=s=a:(i=at((.4360747*t+.3850649*e+.1430804*r)/X),s=at((.0139322*t+.0971045*e+.7141733*r)/Y));const o=116*a-16;return[o<0?0:o,500*(i-a),200*(a-s),n]}function st(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function at(t){return t>tt?Math.pow(t,1/3):t/Q+H}function ot([t,e,r,n]){let i=(t+16)/116,s=isNaN(e)?i:i+e/500,a=isNaN(r)?i:i-r/200;return i=1*ut(i),s=X*ut(s),a=Y*ut(a),[lt(3.1338561*s-1.6168667*i-.4906146*a),lt(-.9787684*s+1.9161415*i+.033454*a),lt(.0719453*s-.2289914*i+1.4052427*a),n]}function lt(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function ut(t){return t>W?t*t*t:Q*(t-H)}function ct(t){return parseInt(t.padEnd(2,t),16)/255}function ht(t,e){return pt(e?t/100:t,0,1)}function pt(t,e,r){return Math.min(Math.max(e,t),r)}function ft(t){return!t.some(Number.isNaN)}const dt={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]};class yt{constructor(t,e,r,n=1,i=!0){this.r=t,this.g=e,this.b=r,this.a=n,i||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,e,r,n]))}static parse(t){if(t instanceof yt)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=dt[t];if(e){const[t,r,n]=e;return[t/255,r/255,n/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let r=1;return[ct(t.slice(r,r+=e)),ct(t.slice(r,r+=e)),ct(t.slice(r,r+=e)),ct(t.slice(r,r+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,r,n,i,s,a,o,l,u,c,h,p]=e,f=[i||" ",o||" ",c].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){const t=[n,a,u].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[pt(+r/e,0,1),pt(+s/e,0,1),pt(+l/e,0,1),h?ht(+h,p):1];if(ft(t))return t}}return}}const r=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){const[t,e,n,i,s,a,o,l,u]=r,c=[n||" ",s||" ",o].join("");if(" "===c||" /"===c||",,"===c||",,,"===c){const t=[+e,pt(+i,0,100),pt(+a,0,100),l?ht(+l,u):1];if(ft(t))return function([t,e,r,n]){function i(n){const i=(n+t/30)%12,s=e*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(i-3,9-i,1))}return t=nt(t),e/=100,r/=100,[i(0),i(8),i(4),n]}(t)}}}(t);return e?new yt(...e,!1):void 0}get rgb(){const{r:t,g:e,b:r,a:n}=this,i=n||1/0;return this.overwriteGetter("rgb",[t/i,e/i,r/i,n])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,r,n,i]=it(t),s=Math.sqrt(r*r+n*n);return[Math.round(1e4*s)?nt(Math.atan2(n,r)*rt):NaN,s,e,i]}(this.rgb))}get lab(){return this.overwriteGetter("lab",it(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,r,n]=this.rgb;return`rgba(${[t,e,r].map((t=>Math.round(255*t))).join(",")},${n})`}}yt.black=new yt(0,0,0,1),yt.white=new yt(1,1,1,1),yt.transparent=new yt(0,0,0,0),yt.red=new yt(1,0,0,1);class mt{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class gt{constructor(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i}}class xt{constructor(t){this.sections=t}static fromString(t){return new xt([new gt(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof xt?t:xt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class vt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof vt)return t;if("number"==typeof t)return new vt([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new vt(t)}}toString(){return JSON.stringify(this.values)}}const bt=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class wt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof wt)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const r=t[e],n=t[e+1];if("string"!=typeof r||!bt.has(r))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new wt(t)}}toString(){return JSON.stringify(this.values)}}class _t{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new _t({name:t,available:!1}):null}}function St(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function kt(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof yt||t instanceof mt||t instanceof xt||t instanceof vt||t instanceof wt||t instanceof _t)return!0;if(Array.isArray(t)){for(const e of t)if(!kt(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!kt(t[e]))return!1;return!0}return!1}function At(t){if(null===t)return C;if("string"==typeof t)return V;if("boolean"==typeof t)return E;if("number"==typeof t)return B;if(t instanceof yt)return F;if(t instanceof mt)return $;if(t instanceof xt)return L;if(t instanceof vt)return O;if(t instanceof wt)return q;if(t instanceof _t)return U;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=At(e);if(r){if(r===t)continue;r=D;break}r=t}return R(r||D,e)}return T}function It(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof yt||t instanceof xt||t instanceof vt||t instanceof wt||t instanceof _t?t.toString():JSON.stringify(t)}class zt{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!kt(t[1]))return e.error("invalid value");const r=t[1];let n=At(r);const i=e.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new zt(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Mt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Pt={string:V,number:B,boolean:E,object:T};class Ct{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in Pt)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=Pt[r],n++}else i=D;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=R(i,s)}else{if(!Pt[i])throw new Error(`Types doesn't contain name = ${i}`);r=Pt[i]}const s=[];for(;n<t.length;n++){const r=e.parse(t[n],n,D);if(!r)return null;s.push(r)}return new Ct(r,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!Z(this.type,At(r)))return r;if(e===this.args.length-1)throw new Mt(`Expected value to be of type ${j(this.type)}, but found ${j(At(r))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Bt={"to-boolean":E,"to-color":F,"to-number":B,"to-string":V};class Vt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0];if(!Bt[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!==t.length)return e.error("Expected one argument.");const n=Bt[r],i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],r,D);if(!n)return null;i.push(n)}return new Vt(n,i)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,r;for(const n of this.args){if(e=n.evaluate(t),r=null,e instanceof yt)return e;if("string"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:St(e[0],e[1],e[2],e[3]),!r))return new yt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Mt(r||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const r of this.args){e=r.evaluate(t);const n=vt.parse(e);if(n)return n}throw new Mt(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const r of this.args){e=r.evaluate(t);const n=wt.parse(e);if(n)return n}throw new Mt(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new Mt(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return xt.fromString(It(this.args[0].evaluate(t)));case"resolvedImage":return _t.fromString(It(this.args[0].evaluate(t)));default:return It(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Et=["Unknown","Point","LineString","Polygon"];class Ft{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Et[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=yt.parse(t)),e}}class Tt{constructor(t,e,r=[],n,i=new P,s=[]){this.registry=t,this.path=r,this.key=r.map((t=>`[${t}]`)).join(""),this.scope=i,this.errors=s,this.expectedType=n,this._isConstant=e}parse(t,e,r,n,i={}){return e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)}_parse(t,e){function r(t,e,r){return"assert"===r?new Ct(e,[t]):"coerce"===r?new Vt(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const i=this.registry[n];if(i){let n=i.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,i=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind)if("padding"!==t.kind||"value"!==i.kind&&"number"!==i.kind&&"array"!==i.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==i.kind&&"array"!==i.kind){if(this.checkSubtype(t,i))return null}else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"assert")}if(!(n instanceof zt)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const t=new Ft;try{n=new zt(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new Tt(this.registry,this._isConstant,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new M(r,t))}checkSubtype(t,e){const r=Z(t,e);return r&&this.error(r),r}}class Dt{constructor(t,e,r){this.type=$,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,E);if(!n)return null;const i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,E);if(!i)return null;let s=null;return r.locale&&(s=e.parse(r.locale,1,V),!s)?null:new Dt(n,i,s)}evaluate(t){return new mt(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}const $t=8192;function Lt(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Ot(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Ut(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*$t),Math.round(n*i*$t)]}function qt(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],a=t[1]-r[1];return n*a-s*i==0&&n*s<=0&&i*a<=0}function Rt(t,e){let r=!1;for(let a=0,o=e.length;a<o;a++){const o=e[a];for(let e=0,a=o.length;e<a-1;e++){if(qt(t,o[e],o[e+1]))return!1;(i=o[e])[1]>(n=t)[1]!=(s=o[e+1])[1]>n[1]&&n[0]<(s[0]-i[0])*(n[1]-i[1])/(s[1]-i[1])+i[0]&&(r=!r)}}var n,i,s;return r}function jt(t,e){for(let r=0;r<e.length;r++)if(Rt(t,e[r]))return!0;return!1}function Nt(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],a=(t[0]-r[0])*s-i*(t[1]-r[1]),o=(e[0]-r[0])*s-i*(e[1]-r[1]);return a>0&&o<0||a<0&&o>0}function Zt(t,e,r){for(const u of r)for(let r=0;r<u.length-1;++r)if(0!=(o=[(a=u[r+1])[0]-(s=u[r])[0],a[1]-s[1]])[0]*(l=[(i=e)[0]-(n=t)[0],i[1]-n[1]])[1]-o[1]*l[0]&&Nt(n,i,s,a)&&Nt(s,a,n,i))return!0;var n,i,s,a,o,l;return!1}function Gt(t,e){for(let r=0;r<t.length;++r)if(!Rt(t[r],e))return!1;for(let r=0;r<t.length-1;++r)if(Zt(t[r],t[r+1],e))return!1;return!0}function Jt(t,e){for(let r=0;r<e.length;r++)if(Gt(t,e[r]))return!0;return!1}function Kt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=[];for(let n=0;n<t[i].length;n++){const a=Ut(t[i][n],r);Lt(e,a),s.push(a)}n.push(s)}return n}function Xt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=Kt(t[i],e,r);n.push(s)}return n}function Yt(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i}Lt(e,t)}function Ht(t,e,r,n){const i=Math.pow(2,n.z)*$t,s=[n.x*$t,n.y*$t],a=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];Yt(n,e,r,i),a.push(n)}return a}function Wt(t,e,r,n){const i=Math.pow(2,n.z)*$t,s=[n.x*$t,n.y*$t],a=[];for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];Lt(e,r),t.push(r)}a.push(t)}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of a)for(const n of t)Yt(n,e,r,i)}var o;return a}class Qt{constructor(t,e){this.type=E,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(kt(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const r=e.features[t].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new Qt(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Qt(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Qt(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=Kt(e.coordinates,n,i),a=Ht(t.geometry(),r,n,i);if(!Ot(r,n))return!1;for(const t of a)if(!Rt(t,s))return!1}if("MultiPolygon"===e.type){const s=Xt(e.coordinates,n,i),a=Ht(t.geometry(),r,n,i);if(!Ot(r,n))return!1;for(const t of a)if(!jt(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=Kt(e.coordinates,n,i),a=Wt(t.geometry(),r,n,i);if(!Ot(r,n))return!1;for(const t of a)if(!Gt(t,s))return!1}if("MultiPolygon"===e.type){const s=Xt(e.coordinates,n,i),a=Wt(t.geometry(),r,n,i);if(!Ot(r,n))return!1;for(const t of a)if(!Jt(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class te{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new te(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class ee{constructor(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const r=t[0],n=ee.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let o=null;for(const[n,s]of a){o=new Tt(e.registry,re,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const r=t[e],i=Array.isArray(n)?n[e-1]:n.type,s=o.parse(r,1+a.length,i);if(!s){l=!0;break}a.push(s)}if(!l)if(Array.isArray(n)&&n.length!==a.length)o.error(`Expected ${n.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=a[t];o.concat(t+1).checkSubtype(e,r.type)}if(0===o.errors.length)return new ee(r,i,s,a)}}if(1===a.length)e.errors.push(...o.errors);else{const r=(a.length?a:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(j).join(", ")})`:`(${j(e.type)}...)`;var e})).join(" | "),n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],1+n.length);if(!i)return null;n.push(j(i.type))}e.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){ee.definitions=e;for(const r in e)t[r]=ee}}function re(t){if(t instanceof te)return re(t.boundExpression);if(t instanceof ee&&"error"===t.name)return!1;if(t instanceof Dt)return!1;if(t instanceof Qt)return!1;const e=t instanceof Vt||t instanceof Ct;let r=!0;return t.eachChild((t=>{r=e?r&&re(t):r&&t instanceof zt})),!!r&&ne(t)&&se(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ne(t){if(t instanceof ee){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Qt)return!1;let e=!0;return t.eachChild((t=>{e&&!ne(t)&&(e=!1)})),e}function ie(t){if(t instanceof ee&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!ie(t)&&(e=!1)})),e}function se(t,e){if(t instanceof ee&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!se(t,e)&&(r=!1)})),r}function ae(t,e){const r=t.length-1;let n,i,s=0,a=r,o=0;for(;s<=a;)if(o=Math.floor((s+a)/2),n=t[o],i=t[o+1],n<=e){if(o===r||e<i)return o;s=o+1}else{if(!(n>e))throw new Mt("Input is not a number.");a=o-1}return 0}class oe{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,B);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r<t.length;r+=2){const s=1===r?-1/0:t[r],a=t[r+1],o=r,l=r+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,n.push([s,u])}return new oe(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[ae(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function le(t,e,r){return t+r*(e-t)}function ue(t,e,r){return t.map(((t,n)=>le(t,e[n],r)))}const ce={number:le,color:function(t,e,r,n="rgb"){switch(n){case"rgb":{const[n,i,s,a]=ue(t.rgb,e.rgb,r);return new yt(n,i,s,a,!1)}case"hcl":{const[n,i,s,a]=t.hcl,[o,l,u,c]=e.hcl;let h,p;if(isNaN(n)||isNaN(o))isNaN(n)?isNaN(o)?h=NaN:(h=o,1!==s&&0!==s||(p=l)):(h=n,1!==u&&0!==u||(p=i));else{let t=o-n;o>n&&t>180?t-=360:o<n&&n-o>180&&(t+=360),h=n+r*t}const[f,d,y,m]=function([t,e,r,n]){return t=isNaN(t)?0:t*et,ot([r,Math.cos(t)*e,Math.sin(t)*e,n])}([h,null!=p?p:le(i,l,r),le(s,u,r),le(a,c,r)]);return new yt(f,d,y,m,!1)}case"lab":{const[n,i,s,a]=ot(ue(t.lab,e.lab,r));return new yt(n,i,s,a,!1)}}},array:ue,padding:function(t,e,r){return new vt(ue(t.values,e.values,r))},variableAnchorOffsetCollection:function(t,e,r){const n=t.values,i=e.values;if(n.length!==i.length)throw new Mt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const s=[];for(let t=0;t<n.length;t+=2){if(n[t]!==i[t])throw new Mt(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${n[t]}, to[${t}]: ${i[t]}`);s.push(n[t]);const[e,a]=n[t+1],[o,l]=i[t+1];s.push([le(e,o,r),le(a,l,r)])}return new wt(s)}};class he{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,r,n){let i=0;if("exponential"===t.name)i=pe(e,t.base,r,n);else if("linear"===t.name)i=pe(e,1,r,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;i=new a(s[0],s[1],s[2],s[3]).solve(pe(e,1,r,n))}return i}static parse(t,e){let[r,n,i,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,B),!i)return null;const a=[];let o=null;"interpolate-hcl"===r||"interpolate-lab"===r?o=F:e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t<s.length;t+=2){const r=s[t],n=s[t+1],i=t+3,l=t+4;if("number"!=typeof r)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,a.push([r,u])}return K(o,B)||K(o,F)||K(o,O)||K(o,q)||K(o,R(B))?new he(o,r,n,i,a):e.error(`Type ${j(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=ae(e,n),a=he.interpolationFactor(this.interpolation,n,e[s],e[s+1]),o=r[s].evaluate(t),l=r[s+1].evaluate(t);switch(this.operator){case"interpolate":return ce[this.type.kind](o,l,a);case"interpolate-hcl":return ce.color(o,l,a,"hcl");case"interpolate-lab":return ce.color(o,l,a,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function pe(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}class fe{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let r=null;const n=e.expectedType;n&&"value"!==n.kind&&(r=n);const i=[];for(const n of t.slice(1)){const t=e.parse(n,1+i.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,i.push(t)}if(!r)throw new Error("No output type");const s=n&&i.some((t=>Z(n,t.type)));return new fe(s?D:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args)if(n++,r=i.evaluate(t),r&&r instanceof _t&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null!==r)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class de{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n<t.length-1;n+=2){const i=t[n];if("string"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;r.push([i,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return n?new de(r,n):null}outputDefined(){return this.result.outputDefined()}}class ye{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,B),n=e.parse(t[2],2,R(e.expectedType||D));return r&&n?new ye(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new Mt(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new Mt(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new Mt(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class me{constructor(t,e){this.type=E,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,D),n=e.parse(t[2],2,D);return r&&n?G(r.type,[E,V,B,C,D])?new me(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${j(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!J(e,["boolean","string","number","null"]))throw new Mt(`Expected first argument to be of type boolean, string, number or null, but found ${j(At(e))} instead.`);if(!J(r,["string","array"]))throw new Mt(`Expected second argument to be of type array or string, but found ${j(At(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class ge{constructor(t,e,r){this.type=B,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,D),n=e.parse(t[2],2,D);if(!r||!n)return null;if(!G(r.type,[E,V,B,C,D]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${j(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,B);return i?new ge(r,n,i):null}return new ge(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!J(e,["boolean","string","number","null"]))throw new Mt(`Expected first argument to be of type boolean, string, number or null, but found ${j(At(e))} instead.`);if(!J(r,["string","array"]))throw new Mt(`Expected second argument to be of type array or string, but found ${j(At(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class xe{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let a=2;a<t.length-1;a+=2){let o=t[a];const l=t[a+1];Array.isArray(o)||(o=[o]);const u=e.concat(a);if(0===o.length)return u.error("Expected at least one branch label.");for(const t of o){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,At(t)))return null}else r=At(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,s.push(c)}const a=e.parse(t[1],1,D);if(!a)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new xe(r,n,a,i,s,o):null}evaluate(t){const e=this.input.evaluate(t);return(At(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class ve{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;i<t.length-1;i+=2){const s=e.parse(t[i],i,E);if(!s)return null;const a=e.parse(t[i+1],i+1,r);if(!a)return null;n.push([s,a]),r=r||a.type}const i=e.parse(t[t.length-1],t.length-1,r);if(!i)return null;if(!r)throw new Error("Can't infer output type");return new ve(r,n,i)}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class be{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,D),n=e.parse(t[2],2,B);if(!r||!n)return null;if(!G(r.type,[R(D),V,D]))return e.error(`Expected first argument to be of type array or string, but found ${j(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,B);return i?new be(r.type,r,n,i):null}return new be(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!J(e,["string","array"]))throw new Mt(`Expected first argument to be of type array or string, but found ${j(At(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function we(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function _e(t,e,r,n){return 0===n.compare(e,r)}function Se(t,e,r){const n="=="!==t&&"!="!==t;return class i{constructor(t,e,r){this.type=E,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let s=e.parse(t[1],1,D);if(!s)return null;if(!we(r,s.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${j(s.type)}'.`);let a=e.parse(t[2],2,D);if(!a)return null;if(!we(r,a.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${j(a.type)}'.`);if(s.type.kind!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${j(s.type)}' and '${j(a.type)}'.`);n&&("value"===s.type.kind&&"value"!==a.type.kind?s=new Ct(a.type,[s]):"value"!==s.type.kind&&"value"===a.type.kind&&(a=new Ct(s.type,[a])));let o=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(o=e.parse(t[3],3,$),!o)return null}return new i(s,a,o)}evaluate(i){const s=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=At(s),r=At(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new Mt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=At(s),r=At(a);if("string"!==t.kind||"string"!==r.kind)return e(i,s,a)}return this.collator?r(i,s,a,this.collator.evaluate(i)):e(i,s,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const ke=Se("==",(function(t,e,r){return e===r}),_e),Ae=Se("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!_e(0,e,r,n)})),Ie=Se("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),ze=Se(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),Me=Se("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Pe=Se(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class Ce{constructor(t,e,r,n,i){this.type=V,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,B);if(!r)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=e.parse(n.locale,1,V),!i))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,V),!s))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,B),!a))return null;let o=null;return n["max-fraction-digits"]&&(o=e.parse(n["max-fraction-digits"],1,B),!o)?null:new Ce(r,i,s,a,o)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Be{constructor(t){this.type=L,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const s=t[r];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,B),!t))return null;let r=null;if(s["text-font"]&&(r=e.parse(s["text-font"],1,R(V)),!r))return null;let a=null;if(s["text-color"]&&(a=e.parse(s["text-color"],1,F),!a))return null;const o=n[n.length-1];o.scale=t,o.font=r,o.textColor=a}else{const s=e.parse(t[r],1,D);if(!s)return null;const a=s.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new Be(n)}evaluate(t){return new xt(this.sections.map((e=>{const r=e.content.evaluate(t);return At(r)===U?new gt("",r,null,null,null):new gt(It(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}}class Ve{constructor(t){this.type=U,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,V);return r?new Ve(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=_t.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}}class Ee{constructor(t){this.type=B,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${j(r.type)} instead.`):new Ee(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new Mt(`Expected value to be of type string or array, but found ${j(At(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Fe={"==":ke,"!=":Ae,">":ze,"<":Ie,">=":Pe,"<=":Me,array:Ct,at:ye,boolean:Ct,case:ve,coalesce:fe,collator:Dt,format:Be,image:Ve,in:me,"index-of":ge,interpolate:he,"interpolate-hcl":he,"interpolate-lab":he,length:Ee,let:de,literal:zt,match:xe,number:Ct,"number-format":Ce,object:Ct,slice:be,step:oe,string:Ct,"to-boolean":Vt,"to-color":Vt,"to-number":Vt,"to-string":Vt,var:te,within:Qt};function Te(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=St(e,r,n,s);if(a)throw new Mt(a);return new yt(e/255,r/255,n/255,s,!1)}function De(t,e){return t in e}function $e(t,e){const r=e[t];return void 0===r?null:r}function Le(t){return{type:t}}function Oe(t){return{result:"success",value:t}}function Ue(t){return{result:"error",value:t}}function qe(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Re(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function je(t){return!!t.expression&&t.expression.interpolated}function Ne(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Ze(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Ge(t){return t}function Je(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(je(e)?"exponential":"interval");if(r||"padding"===e.type){const n=r?yt.parse:vt.parse;(t=z({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],n(t[1])]))),t.default=n(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(a=t.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${t.colorSpace}"`);var a;let o,l,u;if("exponential"===s)o=He;else if("interval"===s)o=Ye;else if("categorical"===s){o=Xe,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];u=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);o=We}if(n){const r={},n=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],s=i[0].zoom;void 0===r[s]&&(r[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},n.push(s)),r[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of n)i.push([r[t].zoom,Je(r[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:he.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>He({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:he.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>o(t,e,r,l,u)}}return{kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?Ke(t.default,e.default):o(t,e,i,l,u)}}}function Ke(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Xe(t,e,r,n,i){return Ke(typeof r===i?n[r]:void 0,t.default,e.default)}function Ye(t,e,r){if("number"!==Ne(r))return Ke(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=ae(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function He(t,e,r){const n=void 0!==t.base?t.base:1;if("number"!==Ne(r))return Ke(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const s=ae(t.stops.map((t=>t[0])),r),a=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),o=t.stops[s][1],l=t.stops[s+1][1],u=ce[e.type]||Ge;return"function"==typeof o.evaluate?{evaluate(...e){const r=o.evaluate.apply(void 0,e),n=l.evaluate.apply(void 0,e);if(void 0!==r&&void 0!==n)return u(r,n,a,t.colorSpace)}}:u(o,l,a,t.colorSpace)}function We(t,e,r){switch(e.type){case"color":r=yt.parse(r);break;case"formatted":r=xt.fromString(r.toString());break;case"resolvedImage":r=_t.fromString(r.toString());break;case"padding":r=vt.parse(r);break;default:Ne(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0)}return Ke(r,t.default,e.default)}ee.register(Fe,{error:[{kind:"error"},[V],(t,[e])=>{throw new Mt(e.evaluate(t))}],typeof:[V,[D],(t,[e])=>j(At(e.evaluate(t)))],"to-rgba":[R(B,4),[F],(t,[e])=>{const[r,n,i,s]=e.evaluate(t).rgb;return[255*r,255*n,255*i,s]}],rgb:[F,[B,B,B],Te],rgba:[F,[B,B,B,B],Te],has:{type:E,overloads:[[[V],(t,[e])=>De(e.evaluate(t),t.properties())],[[V,T],(t,[e,r])=>De(e.evaluate(t),r.evaluate(t))]]},get:{type:D,overloads:[[[V],(t,[e])=>$e(e.evaluate(t),t.properties())],[[V,T],(t,[e,r])=>$e(e.evaluate(t),r.evaluate(t))]]},"feature-state":[D,[V],(t,[e])=>$e(e.evaluate(t),t.featureState||{})],properties:[T,[],t=>t.properties()],"geometry-type":[V,[],t=>t.geometryType()],id:[D,[],t=>t.id()],zoom:[B,[],t=>t.globals.zoom],"heatmap-density":[B,[],t=>t.globals.heatmapDensity||0],"line-progress":[B,[],t=>t.globals.lineProgress||0],accumulated:[D,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[B,Le(B),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[B,Le(B),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:B,overloads:[[[B,B],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[B],(t,[e])=>-e.evaluate(t)]]},"/":[B,[B,B],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[B,[B,B],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[B,[],()=>Math.LN2],pi:[B,[],()=>Math.PI],e:[B,[],()=>Math.E],"^":[B,[B,B],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[B,[B],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[B,[B],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[B,[B],(t,[e])=>Math.log(e.evaluate(t))],log2:[B,[B],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[B,[B],(t,[e])=>Math.sin(e.evaluate(t))],cos:[B,[B],(t,[e])=>Math.cos(e.evaluate(t))],tan:[B,[B],(t,[e])=>Math.tan(e.evaluate(t))],asin:[B,[B],(t,[e])=>Math.asin(e.evaluate(t))],acos:[B,[B],(t,[e])=>Math.acos(e.evaluate(t))],atan:[B,[B],(t,[e])=>Math.atan(e.evaluate(t))],min:[B,Le(B),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[B,Le(B),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[B,[B],(t,[e])=>Math.abs(e.evaluate(t))],round:[B,[B],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[B,[B],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[B,[B],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[E,[V,D],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[E,[D],(t,[e])=>t.id()===e.value],"filter-type-==":[E,[V],(t,[e])=>t.geometryType()===e.value],"filter-<":[E,[V,D],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[E,[D],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[E,[V,D],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[E,[D],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[E,[V,D],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[E,[D],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[E,[V,D],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[E,[D],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[E,[D],(t,[e])=>e.value in t.properties()],"filter-has-id":[E,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[E,[R(V)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[E,[R(D)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[E,[V,R(D)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[E,[V,R(D)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:E,overloads:[[[E,E],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Le(E),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:E,overloads:[[[E,E],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Le(E),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[E,[E],(t,[e])=>!e.evaluate(t)],"is-supported-script":[E,[V],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[V,[V],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[V,[V],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[V,Le(D),(t,e)=>e.map((e=>It(e.evaluate(t)))).join("")],"resolved-locale":[V,[$],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Qe{constructor(t,e){var r;this.expression=t,this._warningHistory={},this._evaluator=new Ft,this._defaultValue=e?"color"===(r=e).type&&Ze(r.default)?new yt(0,0,0,0):"color"===r.type?yt.parse(r.default)||null:"padding"===r.type?vt.parse(r.default)||null:"variableAnchorOffsetCollection"===r.type?wt.parse(r.default)||null:void 0===r.default?null:r.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Mt(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function tr(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Fe}function er(t,e){const r=new Tt(Fe,re,[],e?function(t){const e={color:F,string:V,number:B,enum:V,boolean:E,formatted:L,padding:O,resolvedImage:U,variableAnchorOffsetCollection:q};return"array"===t.type?R(e[t.value]||D,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Oe(new Qe(n,e)):Ue(r.errors)}class rr{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!ie(e.expression)}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}}class nr{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!ie(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?he.interpolationFactor(this.interpolationType,t,e,r):0}}function ir(t,e){const r=er(t,e);if("error"===r.result)return r;const n=r.value.expression,i=ne(n);if(!i&&!qe(e))return Ue([new M("","data expressions not supported")]);const s=se(n,["zoom"]);if(!s&&!Re(e))return Ue([new M("","zoom expressions not supported")]);const a=ar(n);return a||s?a instanceof M?Ue([a]):a instanceof he&&!je(e)?Ue([new M("",'"interpolate" expressions cannot be used with this property')]):Oe(a?new nr(i?"camera":"composite",r.value,a.labels,a instanceof he?a.interpolation:void 0):new rr(i?"constant":"source",r.value)):Ue([new M("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class sr{constructor(t,e){this._parameters=t,this._specification=e,z(this,Je(this._parameters,this._specification))}static deserialize(t){return new sr(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function ar(t){let e=null;if(t instanceof de)e=ar(t.result);else if(t instanceof fe){for(const r of t.args)if(e=ar(r),e)break}else(t instanceof oe||t instanceof he)&&t.input instanceof ee&&"zoom"===t.input.name&&(e=t);return e instanceof M||t.eachChild((t=>{const r=ar(t);r instanceof M?e=r:!e&&r?e=new M("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new M("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function or(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!or(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const lr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ur(t){if(null==t)return{filter:()=>!0,needGeometry:!1};or(t)||(t=pr(t));const e=er(t,lr);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,r,n)=>e.value.evaluate(t,r,{},n),needGeometry:hr(t)}}function cr(t,e){return t<e?-1:t>e?1:0}function hr(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(hr(t[e]))return!0;return!1}function pr(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?fr(t[1],t[2],"=="):"!="===e?mr(fr(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?fr(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(pr))):"all"===e?["all"].concat(t.slice(1).map(pr)):"none"===e?["all"].concat(t.slice(1).map(pr).map(mr)):"in"===e?dr(t[1],t.slice(2)):"!in"===e?mr(dr(t[1],t.slice(2))):"has"===e?yr(t[1]):"!has"===e?mr(yr(t[1])):"within"!==e||t;var r}function fr(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function dr(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(cr)]]:["filter-in-small",t,["literal",e]]}}function yr(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function mr(t){return["!",t]}function gr(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const r of t)e+=`${gr(r)},`;return`${e}]`}const r=Object.keys(t).sort();let n="{";for(let e=0;e<r.length;e++)n+=`${JSON.stringify(r[e])}:${gr(t[r[e]])},`;return`${n}}`}function xr(t){let e="";for(const r of A)e+=`/${gr(t[r])}`;return e}function vr(t){const e=t.value;return e?[new I(t.key,e,"constants have been deprecated as of v8")]:[]}function br(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function wr(t){if(Array.isArray(t))return t.map(wr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=wr(t[r]);return e}return br(t)}function _r(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,a=t.styleSpec,o=t.validateSpec;let l=[];const u=Ne(r);if("object"!==u)return[new I(e,r,`object expected, ${u} found`)];for(const t in r){const u=t.split(".")[0],c=n[u]||n["*"];let h;if(i[u])h=i[u];else if(n[u])h=o;else if(i["*"])h=i["*"];else{if(!n["*"]){l.push(new I(e,r[t],`unknown property "${t}"`));continue}h=o}l=l.concat(h({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:c,style:s,styleSpec:a,object:r,objectKey:t,validateSpec:o},r))}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&l.push(new I(e,r,`missing required property "${t}"`));return l}function Sr(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,s=t.key,a=t.arrayElementValidator||t.validateSpec;if("array"!==Ne(e))return[new I(s,e,`array expected, ${Ne(e)} found`)];if(r.length&&e.length!==r.length)return[new I(s,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new I(s,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let o={type:r.value,values:r.values};i.$version<7&&(o.function=r.function),"object"===Ne(r.value)&&(o=r.value);let l=[];for(let r=0;r<e.length;r++)l=l.concat(a({array:e,arrayIndex:r,value:e[r],valueSpec:o,validateSpec:t.validateSpec,style:n,styleSpec:i,key:`${s}[${r}]`}));return l}function kr(t){const e=t.key,r=t.value,n=t.valueSpec;let i=Ne(r);return"number"===i&&r!=r&&(i="NaN"),"number"!==i?[new I(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new I(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new I(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Ar(t){const e=t.valueSpec,r=br(t.value.type);let n,i,s,a={};const o="categorical"!==r&&void 0===t.value.property,l=!o,u="array"===Ne(t.value.stops)&&"array"===Ne(t.value.stops[0])&&"object"===Ne(t.value.stops[0][0]),c=_r({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new I(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Sr({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Ne(n)&&0===n.length&&e.push(new I(t.key,n,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&o&&c.push(new I(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||c.push(new I(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!je(t.valueSpec)&&c.push(new I(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!qe(t.valueSpec)?c.push(new I(t.key,t.value,"property functions not supported")):o&&!Re(t.valueSpec)&&c.push(new I(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||c.push(new I(t.key,t.value,'"property" property is required')),c;function h(t){let r=[];const n=t.value,o=t.key;if("array"!==Ne(n))return[new I(o,n,`array expected, ${Ne(n)} found`)];if(2!==n.length)return[new I(o,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==Ne(n[0]))return[new I(o,n,`object expected, ${Ne(n[0])} found`)];if(void 0===n[0].zoom)return[new I(o,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new I(o,n,"object stop key must have value")];if(s&&s>br(n[0].zoom))return[new I(o,n[0].zoom,"stop zoom values must appear in ascending order")];br(n[0].zoom)!==s&&(s=br(n[0].zoom),i=void 0,a={}),r=r.concat(_r({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:kr,value:p}}))}else r=r.concat(p({key:`${o}[0]`,value:n[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return tr(wr(n[1]))?r.concat([new I(`${o}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(t.validateSpec({key:`${o}[1]`,value:n[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const o=Ne(t.value),l=br(t.value),u=null!==t.value?t.value:s;if(n){if(o!==n)return[new I(t.key,u,`${o} stop domain type must match previous stop domain type ${n}`)]}else n=o;if("number"!==o&&"string"!==o&&"boolean"!==o)return[new I(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==r){let n=`number expected, ${o} found`;return qe(e)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new I(t.key,u,n)]}return"categorical"!==r||"number"!==o||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===o&&void 0!==i&&l<i?[new I(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===r&&l in a?[new I(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new I(t.key,u,`integer expected, found ${l}`)]}}function Ir(t){const e=("property"===t.expressionContext?ir:er)(wr(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new I(`${t.key}${e.key}`,t.value,e.message)));const r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new I(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!ie(r))return[new I(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!ie(r))return[new I(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!se(r,["zoom","feature-state"]))return[new I(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!ne(r))return[new I(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function zr(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(br(r))&&i.push(new I(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(br(r))&&i.push(new I(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Mr(t){return or(wr(t.value))?Ir(z({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Pr(t)}function Pr(t){const e=t.value,r=t.key;if("array"!==Ne(e))return[new I(r,e,`array expected, ${Ne(e)} found`)];const n=t.styleSpec;let i,s=[];if(e.length<1)return[new I(r,e,"filter array must have at least 1 element")];switch(s=s.concat(zr({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),br(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===br(e[1])&&s.push(new I(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new I(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=Ne(e[1]),"string"!==i&&s.push(new I(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=Ne(e[a]),"$type"===br(e[1])?s=s.concat(zr({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new I(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(Pr({key:`${r}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=Ne(e[1]),2!==e.length?s.push(new I(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new I(`${r}[1]`,e[1],`string expected, ${i} found`));break;case"within":i=Ne(e[1]),2!==e.length?s.push(new I(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==i&&s.push(new I(`${r}[1]`,e[1],`object expected, ${i} found`))}return s}function Cr(t,e){const r=t.key,n=t.validateSpec,i=t.style,s=t.styleSpec,a=t.value,o=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return[];const u=o.match(/^(.*)-transition$/);if("paint"===e&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:s.transition,style:i,styleSpec:s});const c=t.valueSpec||l[o];if(!c)return[new I(r,a,`unknown property "${o}"`)];let h;if("string"===Ne(a)&&qe(c)&&!c.tokens&&(h=/^{([^}]+)}$/.exec(a)))return[new I(r,a,`"${o}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const p=[];return"symbol"===t.layerType&&("text-field"===o&&i&&!i.glyphs&&p.push(new I(r,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&Ze(wr(a))&&"identity"===br(a.type)&&p.push(new I(r,a,'"text-font" does not support identity functions'))),p.concat(n({key:t.key,value:a,valueSpec:c,style:i,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:o}))}function Br(t){return Cr(t,"paint")}function Vr(t){return Cr(t,"layout")}function Er(t){let e=[];const r=t.value,n=t.key,i=t.style,s=t.styleSpec;r.type||r.ref||e.push(new I(n,r,'either "type" or "ref" is required'));let a=br(r.type);const o=br(r.ref);if(r.id){const s=br(r.id);for(let a=0;a<t.arrayIndex;a++){const t=i.layers[a];br(t.id)===s&&e.push(new I(n,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in r&&e.push(new I(n,r[t],`"${t}" is prohibited for ref layers`))})),i.layers.forEach((e=>{br(e.id)===o&&(t=e)})),t?t.ref?e.push(new I(n,r.ref,"ref cannot reference another ref layer")):a=br(t.type):e.push(new I(n,r.ref,`ref layer "${o}" not found`))}else if("background"!==a)if(r.source){const t=i.sources&&i.sources[r.source],s=t&&br(t.type);t?"vector"===s&&"raster"===a?e.push(new I(n,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==s&&"hillshade"===a?e.push(new I(n,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===s&&"raster"!==a?e.push(new I(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==a?e.push(new I(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!r.paint||!r.paint["line-gradient"]||"geojson"===s&&t.lineMetrics||e.push(new I(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new I(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new I(n,r.source,`source "${r.source}" not found`))}else e.push(new I(n,r,'missing required property "source"'));return e=e.concat(_r({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"}),filter:Mr,layout:t=>_r({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Vr(z({layerType:a},t))}}),paint:t=>_r({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Br(z({layerType:a},t))}})}})),e}function Fr(t){const e=t.value,r=t.key,n=Ne(e);return"string"!==n?[new I(r,e,`string expected, ${n} found`)]:[]}const Tr={promoteId:function({key:t,value:e}){if("string"===Ne(e))return Fr({key:t,value:e});{const r=[];for(const n in e)r.push(...Fr({key:`${t}.${n}`,value:e[n]}));return r}}};function Dr(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style,s=t.validateSpec;if(!e.type)return[new I(r,e,'"type" is required')];const a=br(e.type);let o;switch(a){case"vector":case"raster":return o=_r({key:r,value:e,valueSpec:n[`source_${a.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:Tr,validateSpec:s}),o;case"raster-dem":return o=function(t){var e;const r=null!==(e=t.sourceName)&&void 0!==e?e:"",n=t.value,i=t.styleSpec,s=i.source_raster_dem,a=t.style;let o=[];const l=Ne(n);if(void 0===n)return o;if("object"!==l)return o.push(new I("source_raster_dem",n,`object expected, ${l} found`)),o;const u="custom"===br(n.encoding),c=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in n)!u&&c.includes(e)?o.push(new I(e,n[e],`In "${r}": "${e}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):s[e]?o=o.concat(t.validateSpec({key:e,value:n[e],valueSpec:s[e],validateSpec:t.validateSpec,style:a,styleSpec:i})):o.push(new I(e,n[e],`unknown property "${e}"`));return o}({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:s}),o;case"geojson":if(o=_r({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:s,objectElementValidators:Tr}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],a="string"==typeof n?[n,["accumulated"],["get",t]]:n;o.push(...Ir({key:`${r}.${t}.map`,value:i,validateSpec:s,expressionContext:"cluster-map"})),o.push(...Ir({key:`${r}.${t}.reduce`,value:a,validateSpec:s,expressionContext:"cluster-reduce"}))}return o;case"video":return _r({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:s,styleSpec:n});case"image":return _r({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:s,styleSpec:n});case"canvas":return[new I(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return zr({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:s,styleSpec:n})}}function $r(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let s=[];const a=Ne(e);if(void 0===e)return s;if("object"!==a)return s=s.concat([new I("light",e,`object expected, ${a} found`)]),s;for(const a in e){const o=a.match(/^(.*)-transition$/);s=s.concat(o&&n[o[1]]&&n[o[1]].transition?t.validateSpec({key:a,value:e[a],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r}):n[a]?t.validateSpec({key:a,value:e[a],valueSpec:n[a],validateSpec:t.validateSpec,style:i,styleSpec:r}):[new I(a,e[a],`unknown property "${a}"`)])}return s}function Lr(t){const e=t.value,r=t.styleSpec,n=r.terrain,i=t.style;let s=[];const a=Ne(e);if(void 0===e)return s;if("object"!==a)return s=s.concat([new I("terrain",e,`object expected, ${a} found`)]),s;for(const a in e)s=s.concat(n[a]?t.validateSpec({key:a,value:e[a],valueSpec:n[a],validateSpec:t.validateSpec,style:i,styleSpec:r}):[new I(a,e[a],`unknown property "${a}"`)]);return s}function Or(t){let e=[];const r=t.value,n=t.key;if(Array.isArray(r)){const i=[],s=[];for(const a in r)r[a].id&&i.includes(r[a].id)&&e.push(new I(n,r,`all the sprites' ids must be unique, but ${r[a].id} is duplicated`)),i.push(r[a].id),r[a].url&&s.includes(r[a].url)&&e.push(new I(n,r,`all the sprites' URLs must be unique, but ${r[a].url} is duplicated`)),s.push(r[a].url),e=e.concat(_r({key:`${n}[${a}]`,value:r[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return Fr({key:n,value:r})}const Ur={"*":()=>[],array:Sr,boolean:function(t){const e=t.value,r=t.key,n=Ne(e);return"boolean"!==n?[new I(r,e,`boolean expected, ${n} found`)]:[]},number:kr,color:function(t){const e=t.key,r=t.value,n=Ne(r);return"string"!==n?[new I(e,r,`color expected, ${n} found`)]:yt.parse(String(r))?[]:[new I(e,r,`color expected, "${r}" found`)]},constants:vr,enum:zr,filter:Mr,function:Ar,layer:Er,object:_r,source:Dr,light:$r,terrain:Lr,string:Fr,formatted:function(t){return 0===Fr(t).length?[]:Ir(t)},resolvedImage:function(t){return 0===Fr(t).length?[]:Ir(t)},padding:function(t){const e=t.key,r=t.value;if("array"===Ne(r)){if(r.length<1||r.length>4)return[new I(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const n={type:"number"};let i=[];for(let s=0;s<r.length;s++)i=i.concat(t.validateSpec({key:`${e}[${s}]`,value:r[s],validateSpec:t.validateSpec,valueSpec:n}));return i}return kr({key:e,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(t){const e=t.key,r=t.value,n=Ne(r),i=t.styleSpec;if("array"!==n||r.length<1||r.length%2!=0)return[new I(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let n=0;n<r.length;n+=2)s=s.concat(zr({key:`${e}[${n}]`,value:r[n],valueSpec:i.layout_symbol["text-anchor"]})),s=s.concat(Sr({key:`${e}[${n+1}]`,value:r[n+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return s},sprite:Or};function qr(t){const e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=qr,r.expression&&Ze(br(e))?Ar(t):r.expression&&tr(wr(e))?Ir(t):r.type&&Ur[r.type]?Ur[r.type](t):_r(z({},t,{valueSpec:r.type?n[r.type]:r}))}function Rr(t){const e=t.value,r=t.key,n=Fr(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new I(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new I(r,e,'"glyphs" url must include a "{range}" token'))),n}function jr(t,e=k){let r=[];return r=r.concat(qr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:qr,objectElementValidators:{glyphs:Rr,"*":()=>[]}})),t.constants&&(r=r.concat(vr({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:qr}))),Zr(r)}function Nr(t){return function(e){return t({...e,validateSpec:qr})}}function Zr(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function Gr(t){return function(...e){return Zr(t.apply(this,e))}}jr.source=Gr(Nr(Dr)),jr.sprite=Gr(Nr(Or)),jr.glyphs=Gr(Nr(Rr)),jr.light=Gr(Nr($r)),jr.terrain=Gr(Nr(Lr)),jr.layer=Gr(Nr(Er)),jr.filter=Gr(Nr(Mr)),jr.paintProperty=Gr(Nr(Br)),jr.layoutProperty=Gr(Nr(Vr));const Jr={};class Kr extends Error{constructor(t,e,r,n){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=n}}const Xr=g()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function Yr(t,e){const r=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:Xr(),signal:r.signal});let i=!1,s=!1;"json"===t.type&&n.headers.set("Accept","application/json");return s||fetch(n).then((r=>r.ok?(r=>{("arrayBuffer"===t.type||"image"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{s||(i=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((t=>{s||e(new Error(t.message))}))})(r):r.blob().then((n=>e(new Kr(r.status,r.statusText,t.url,n)))))).catch((t=>{20!==t.code&&e(new Error(t.message))})),{cancel:()=>{s=!0,i||r.abort()}}}const Hr=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(g()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!g())return(Jr[(r=t.url).substring(0,r.indexOf("://"))]||Yr)(t,e)}var r;if(!(t=>/^file:/.test(t)||/^file:/.test(Xr())&&!/^\w+:/.test(t))(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Yr(t,e);if(g()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}return function(t,e){const r=new XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{e(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else{const n=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});e(new Kr(r.status,r.statusText,t.url,n))}},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},Wr={};function Qr(t,e,r={}){if(Wr[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Wr[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Qr("Object",Object),Qr("TransferableGridIndex",S),Qr("Color",yt),Qr("Error",Error),Qr("AJAXError",Kr),Qr("ResolvedImage",_t),Qr("StylePropertyFunction",sr),Qr("StyleExpression",Qe,{omit:["_evaluator"]}),Qr("ZoomDependentExpression",nr),Qr("ZoomConstantExpression",rr),Qr("CompoundExpression",ee,{omit:["_evaluate"]});for(const t in Fe)Fe[t]._classRegistryKey||Qr(`Expression_${t}`,Fe[t]);function tn(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function en(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(tn(t))return e&&e.push(t),t;if(_(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const r=t;return e&&e.push(r.buffer),r}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(en(n,e));return r}if("object"==typeof t){const r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error("can't serialize object of unregistered class");if(!Wr[n])throw new Error(`${n} is not registered.`);const i=r.serialize?r.serialize(t,e):{};if(r.serialize){if(e&&i===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const r in t){if(!t.hasOwnProperty(r))continue;if(Wr[n].omit.indexOf(r)>=0)continue;const s=t[r];i[r]=Wr[n].shallow.indexOf(r)>=0?s:en(s,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(i.$name=n),i}throw new Error("can't serialize object of type "+typeof t)}function rn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||tn(t)||_(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(rn);if("object"==typeof t){const e=t.$name||"Object";if(!Wr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Wr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const r of Object.keys(t)){if("$name"===r)continue;const i=t[r];n[r]=Wr[e].shallow.indexOf(r)>=0?i:rn(i)}return n}throw new Error("can't deserialize object of type "+typeof t)}class nn{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){delete this._channel,this._callback=()=>{}}}class sn{constructor(t,e,r){this.receive=t=>{const e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[r];const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t()}else g()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},this.process=()=>{if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)},this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new nn(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=g()?t:window}send(t,e,r,n,i=!1){const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[s]=r);const a=w(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:en(e,a)},a),{cancel:()=>{r&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}processTask(t,e){if("<response>"===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(rn(e.error)):r(null,rn(e.data)))}else{let r=!1;const n=w(this.globalScope)?void 0:[],i=e.hasCallback?(e,i)=>{r=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?en(e):null,data:en(i,n)},n)}:t=>{r=!0};let s=null;const a=rn(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,a,i);else if(this.parent.getWorkerSource){const t=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,t[0],a.source)[t[1]](a,i)}else i(new Error(`Could not find function ${e.type}`));!r&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}}function an(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function on(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}class ln{constructor(t,e={}){c(this,e),this.type=t}}class un extends ln{constructor(t,e={}){super("error",c({error:t},e))}}class cn{on(t,e){return this._listeners=this._listeners||{},an(t,e,this._listeners),this}off(t,e){return on(t,e,this._listeners),on(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},an(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new ln(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of n)on(r,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(c(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t))}else t instanceof un&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}const hn=jr,pn=hn.paintProperty,fn=hn.layoutProperty;class dn{constructor(){this.first=!0}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}}const yn={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function mn(t){for(const e of t)if(vn(e.charCodeAt(0)))return!0;return!1}function gn(t){for(const e of t)if(!xn(e.charCodeAt(0)))return!1;return!0}function xn(t){return!(yn.Arabic(t)||yn["Arabic Supplement"](t)||yn["Arabic Extended-A"](t)||yn["Arabic Presentation Forms-A"](t)||yn["Arabic Presentation Forms-B"](t))}function vn(t){return!(746!==t&&747!==t&&(t<4352||!(yn["Bopomofo Extended"](t)||yn.Bopomofo(t)||yn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||yn["CJK Compatibility Ideographs"](t)||yn["CJK Compatibility"](t)||yn["CJK Radicals Supplement"](t)||yn["CJK Strokes"](t)||!(!yn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||yn["CJK Unified Ideographs Extension A"](t)||yn["CJK Unified Ideographs"](t)||yn["Enclosed CJK Letters and Months"](t)||yn["Hangul Compatibility Jamo"](t)||yn["Hangul Jamo Extended-A"](t)||yn["Hangul Jamo Extended-B"](t)||yn["Hangul Jamo"](t)||yn["Hangul Syllables"](t)||yn.Hiragana(t)||yn["Ideographic Description Characters"](t)||yn.Kanbun(t)||yn["Kangxi Radicals"](t)||yn["Katakana Phonetic Extensions"](t)||yn.Katakana(t)&&12540!==t||!(!yn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!yn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||yn["Unified Canadian Aboriginal Syllabics"](t)||yn["Unified Canadian Aboriginal Syllabics Extended"](t)||yn["Vertical Forms"](t)||yn["Yijing Hexagram Symbols"](t)||yn["Yi Syllables"](t)||yn["Yi Radicals"](t))))}function bn(t){return!(vn(t)||function(t){return!!(yn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||yn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||yn["Letterlike Symbols"](t)||yn["Number Forms"](t)||yn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||yn["Control Pictures"](t)&&9251!==t||yn["Optical Character Recognition"](t)||yn["Enclosed Alphanumerics"](t)||yn["Geometric Shapes"](t)||yn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||yn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||yn["CJK Symbols and Punctuation"](t)||yn.Katakana(t)||yn["Private Use Area"](t)||yn["CJK Compatibility Forms"](t)||yn["Small Form Variants"](t)||yn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function wn(t){return t>=1424&&t<=2303||yn["Arabic Presentation Forms-A"](t)||yn["Arabic Presentation Forms-B"](t)}function _n(t,e){return!(!e&&wn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||yn.Khmer(t))}function Sn(t){for(const e of t)if(wn(e.charCodeAt(0)))return!0;return!1}"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date);let kn="unavailable",An=null;const In={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>"loaded"===kn||null!=In.applyArabicShaping,isLoading:()=>"loading"===kn,setState(t){if(!g())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");kn=t.pluginStatus,An=t.pluginURL},isParsed(){if(!g())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=In.applyArabicShaping&&null!=In.processBidirectionalText&&null!=In.processStyledBidirectionalText},getPluginURL(){if(!g())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return An}};class zn{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new dn,this.transition={})}isSupportedScript(t){return function(t,e){for(const r of t)if(!_n(r.charCodeAt(0),e))return!1;return!0}(t,In.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}class Mn{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Ze(t))return new sr(t,e);if(tr(t)){const r=ir(t,e);if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return r.value}{let r=t;return"color"===e.type&&"string"==typeof t?r=yt.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)&&(r=wt.parse(t)):r=vt.parse(t),{kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class Pn{constructor(t){this.property=t,this.value=new Mn(t,void 0)}transitioned(t,e){return new Bn(this.property,this.value,e,c({},t.transition,this.transition),t.now)}untransitioned(){return new Bn(this.property,this.value,null,{},0)}}class Cn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return p(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Pn(this._values[t].property)),this._values[t].value=new Mn(this._values[t].property,null===e?void 0:p(e))}getTransition(t){return p(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Pn(this._values[t].property)),this._values[t].transition=p(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n)}return t}transitioned(t,e){const r=new Vn(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new Vn(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class Bn{constructor(t,e,r,n,i){this.property=t,this.value=e,this.begin=i+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return s.possiblyEvaluate(t,e,r);{const a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,r),i,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}}return i}}class Vn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const n=new Tn(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class En{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return p(this._values[t].value)}setValue(t,e){this._values[t]=new Mn(this._values[t].property,null===e?void 0:p(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){const n=new Tn(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class Fn{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)}}class Tn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Dn{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,r){const n=ce[this.specification.type];return n?n(t,e,r):t}}class $n{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,n){return new Fn(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Fn(this,{kind:"constant",value:void 0},t.parameters);const n=ce[this.specification.type];if(n){const i=n(t.value.value,e.value.value,r);return new Fn(this,{kind:"constant",value:i},t.parameters)}return t}evaluate(t,e,r,n,i,s){return"constant"===t.kind?t.value:t.evaluate(e,r,n,i,s)}}class Ln extends $n{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new Fn(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),s="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,a=this._calculate(s,s,s,e);return new Fn(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Fn(this,{kind:"constant",value:r},e)}return new Fn(this,t.expression,e)}evaluate(t,e,r,n,i,s){if("source"===t.kind){const a=t.evaluate(e,r,n,i,s);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class On{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new zn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new zn(Math.floor(e.zoom),e)),t.expression.evaluate(new zn(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class Un{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)}interpolate(){return!1}}class qn{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new Mn(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new Pn(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}Qr("DataDrivenProperty",$n),Qr("DataConstantProperty",Dn),Qr("CrossFadedDataDrivenProperty",Ln),Qr("CrossFadedProperty",On),Qr("ColorRampProperty",Un);const Rn="-transition";class jn extends cn{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new En(e.layout)),e.paint)){this._transitionablePaint=new Cn(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Tn(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(fn,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(Rn)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(pn,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith(Rn))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const r=this._transitionablePaint._values[t],n="cross-faded-data-driven"===r.property.specification["property-type"],i=r.value.isDataDriven(),s=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,s,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),function(t,e,r){const n={};for(const r in t)e.call(this,t[r],r,t)&&(n[r]=t[r]);return n}(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,r,n,i={}){return(!i||!1!==i.validate)&&function(t,e){let r=!1;if(e&&e.length)for(const n of e)t.fire(new un(new Error(n.message))),r=!0;return r}(this,t.call(hn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:k,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Fn&&qe(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const Nn={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Zn{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Gn{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Jn(t,e=1){let r=0,n=0;return{members:t.map((t=>{const i=Nn[t.type].BYTES_PER_ELEMENT,s=r=Kn(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:s}})),size:Kn(r,Math.max(n,e)),alignment:e}}function Kn(t,e){return Math.ceil(t/e)*e}class Xn extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}Xn.prototype.bytesPerElement=4,Qr("StructArrayLayout2i4",Xn);class Yn extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}Yn.prototype.bytesPerElement=6,Qr("StructArrayLayout3i6",Yn);class Hn extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,t}}Hn.prototype.bytesPerElement=8,Qr("StructArrayLayout4i8",Hn);class Wn extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}Wn.prototype.bytesPerElement=12,Qr("StructArrayLayout2i4i12",Wn);class Qn extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=4*t,l=8*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=s,this.uint8[l+7]=a,t}}Qn.prototype.bytesPerElement=8,Qr("StructArrayLayout2i4ub8",Qn);class ti extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}ti.prototype.bytesPerElement=8,Qr("StructArrayLayout2f8",ti);class ei extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,s,a,o,l,u)}emplace(t,e,r,n,i,s,a,o,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=s,this.uint16[h+5]=a,this.uint16[h+6]=o,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}ei.prototype.bytesPerElement=20,Qr("StructArrayLayout10ui20",ei);class ri extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,a,o,l,u,c,h)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=s,this.uint16[f+5]=a,this.uint16[f+6]=o,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t}}ri.prototype.bytesPerElement=24,Qr("StructArrayLayout4i4ui4i24",ri);class ni extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}ni.prototype.bytesPerElement=12,Qr("StructArrayLayout3f12",ni);class ii extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}ii.prototype.bytesPerElement=4,Qr("StructArrayLayout1ul4",ii);class si extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,s,a,o,l)}emplace(t,e,r,n,i,s,a,o,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=s,this.int16[c+5]=a,this.uint32[h+3]=o,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}si.prototype.bytesPerElement=20,Qr("StructArrayLayout6i1ul2ui20",si);class ai extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}ai.prototype.bytesPerElement=12,Qr("StructArrayLayout2i2i2i12",ai);class oi extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=4*t,o=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[o+6]=i,this.int16[o+7]=s,t}}oi.prototype.bytesPerElement=16,Qr("StructArrayLayout2f1f2i16",oi);class li extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=12*t,a=3*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t}}li.prototype.bytesPerElement=12,Qr("StructArrayLayout2ub2f12",li);class ui extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}ui.prototype.bytesPerElement=6,Qr("StructArrayLayout3ui6",ui);class ci extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g){const x=24*t,v=12*t,b=48*t;return this.int16[x+0]=e,this.int16[x+1]=r,this.uint16[x+2]=n,this.uint16[x+3]=i,this.uint32[v+2]=s,this.uint32[v+3]=a,this.uint32[v+4]=o,this.uint16[x+10]=l,this.uint16[x+11]=u,this.uint16[x+12]=c,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=d,this.uint8[b+38]=y,this.uint32[v+10]=m,this.int16[x+22]=g,t}}ci.prototype.bytesPerElement=48,Qr("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ci);class hi extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,k,A,I,z){const M=this.length;return this.resize(M+1),this.emplace(M,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,k,A,I,z)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,k,A,I,z,M){const P=32*t,C=16*t;return this.int16[P+0]=e,this.int16[P+1]=r,this.int16[P+2]=n,this.int16[P+3]=i,this.int16[P+4]=s,this.int16[P+5]=a,this.int16[P+6]=o,this.int16[P+7]=l,this.uint16[P+8]=u,this.uint16[P+9]=c,this.uint16[P+10]=h,this.uint16[P+11]=p,this.uint16[P+12]=f,this.uint16[P+13]=d,this.uint16[P+14]=y,this.uint16[P+15]=m,this.uint16[P+16]=g,this.uint16[P+17]=x,this.uint16[P+18]=v,this.uint16[P+19]=b,this.uint16[P+20]=w,this.uint16[P+21]=_,this.uint16[P+22]=S,this.uint32[C+12]=k,this.float32[C+13]=A,this.float32[C+14]=I,this.uint16[P+30]=z,this.uint16[P+31]=M,t}}hi.prototype.bytesPerElement=64,Qr("StructArrayLayout8i15ui1ul2f2ui64",hi);class pi extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}pi.prototype.bytesPerElement=4,Qr("StructArrayLayout1f4",pi);class fi extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[6*t+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}fi.prototype.bytesPerElement=12,Qr("StructArrayLayout1ui2f12",fi);class di extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t}}di.prototype.bytesPerElement=8,Qr("StructArrayLayout1ul2ui8",di);class yi extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}yi.prototype.bytesPerElement=4,Qr("StructArrayLayout2ui4",yi);class mi extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}mi.prototype.bytesPerElement=2,Qr("StructArrayLayout1ui2",mi);class gi extends Gn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,t}}gi.prototype.bytesPerElement=16,Qr("StructArrayLayout4f16",gi);class xi extends Zn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new n(this.anchorPointX,this.anchorPointY)}}xi.prototype.size=20;class vi extends si{get(t){return new xi(this,t)}}Qr("CollisionBoxArray",vi);class bi extends Zn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}bi.prototype.size=48;class wi extends ci{get(t){return new bi(this,t)}}Qr("PlacedSymbolArray",wi);class _i extends Zn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}_i.prototype.size=64;class Si extends hi{get(t){return new _i(this,t)}}Qr("SymbolInstanceArray",Si);class ki extends pi{getoffsetX(t){return this.float32[1*t+0]}}Qr("GlyphOffsetArray",ki);class Ai extends Yn{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Qr("SymbolLineVertexArray",Ai);class Ii extends Zn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Ii.prototype.size=12;class zi extends fi{get(t){return new Ii(this,t)}}Qr("TextAnchorOffsetArray",zi);class Mi extends Zn{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Mi.prototype.size=8;class Pi extends di{get(t){return new Mi(this,t)}}Qr("FeatureIndexArray",Pi);class Ci extends Xn{}class Bi extends Xn{}class Vi extends Xn{}class Ei extends Wn{}class Fi extends Qn{}class Ti extends ti{}class Di extends ei{}class $i extends ri{}class Li extends ni{}class Oi extends ii{}class Ui extends ai{}class qi extends li{}class Ri extends ui{}class ji extends yi{}const Ni=Jn([{name:"a_pos",components:2,type:"Int16"}],4),{members:Zi}=Ni;class Gi{constructor(t=[]){this.segments=t}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>Gi.MAX_VERTEX_ARRAY_LENGTH&&d(`Max vertices per segment is ${Gi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>Gi.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,n){return new Gi([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function Ji(t,e){return 256*(t=u(Math.floor(t),0,255))+u(Math.floor(e),0,255)}Gi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Qr("SegmentVector",Gi);const Ki=Jn([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Xi={exports:{}},Yi={exports:{}};Yi.exports=function(t,e){var r,n,i,s,a,o,l,u;for(n=t.length-(r=3&t.length),i=e,a=3432918353,o=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var Hi=Yi.exports,Wi={exports:{}};Wi.exports=function(t,e){for(var r,n=t.length,i=e^n,s=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var Qi=Hi,ts=Wi.exports;Xi.exports=Qi,Xi.exports.murmur3=Qi,Xi.exports.murmur2=ts;var es=t(Xi.exports);class rs{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,n){this.ids.push(ns(t)),this.positions.push(e,r,n)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=ns(t);let r=0,n=this.ids.length-1;for(;r<n;){const t=r+n>>1;this.ids[t]>=e?n=t:r=t+1}const i=[];for(;this.ids[r]===e;)i.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return i}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return is(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new rs;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function ns(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:es(String(t))}function is(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let s=r-1,a=n+1;for(;;){do{s++}while(t[s]<i);do{a--}while(t[a]>i);if(s>=a)break;ss(t,s,a),ss(e,3*s,3*a),ss(e,3*s+1,3*a+1),ss(e,3*s+2,3*a+2)}a-r<n-a?(is(t,e,r,a),r=a+1):(is(t,e,a+1,n),n=a)}}function ss(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}Qr("FeaturePositionMap",rs);class as{constructor(t,e){this.gl=t.gl,this.location=e}}class os extends as{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class ls extends as{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class us extends as{constructor(t,e){super(t,e),this.current=yt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}function cs(t){return[Ji(255*t.r,255*t.g),Ji(255*t.b,255*t.a)]}class hs{constructor(t,e,r){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return"color"===this.type?new us(t,e):new os(t,e)}}class ps{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,r,n){const i="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;i&&t.set(i)}getBinding(t,e,r){return"u_pattern"===r.substr(0,9)?new ls(t,e):new os(t,e)}}class fs{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(t,e,r,n,i){const s=this.paintVertexArray.length,a=this.expression.evaluate(new zn(0),e,{},n,[],i);this.paintVertexArray.resize(t),this._setPaintValue(s,t,a)}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:0},r,n);this._setPaintValue(t,e,i)}_setPaintValue(t,e,r){if("color"===this.type){const n=cs(r);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ds{constructor(t,e,r,n,i,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,r,n,i){const s=this.expression.evaluate(new zn(this.zoom),e,{},n,[],i),a=this.expression.evaluate(new zn(this.zoom+1),e,{},n,[],i),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,s,a)}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:this.zoom},r,n),s=this.expression.evaluate({zoom:this.zoom+1},r,n);this._setPaintValue(t,e,i,s)}_setPaintValue(t,e,r,n){if("color"===this.type){const i=cs(r),s=cs(n);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i[0],i[1],s[0],s[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,n=u(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(n)}getBinding(t,e,r){return new os(t,e)}}class ys{constructor(t,e,r,n,i,s){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=n,this.layerId=s,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i}populatePaintArray(t,e,r){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],r)}updatePaintArray(t,e,r,n,i){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],i)}_setPaintValues(t,e,r,n){if(!n||!r)return;const{min:i,mid:s,max:a}=r,o=n[i],l=n[s],u=n[a];if(o&&l&&u)for(let r=t;r<e;r++)this.zoomInPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],o.tl[0],o.tl[1],o.br[0],o.br[1],l.pixelRatio,o.pixelRatio),this.zoomOutPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Ki.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Ki.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ms{constructor(t,e,r){this.binders={},this._buffers=[];const n=[];for(const i in t.paint._values){if(!r(i))continue;const s=t.paint.get(i);if(!(s instanceof Fn&&qe(s.property.specification)))continue;const a=xs(i,t.type),o=s.value,l=s.property.specification.type,u=s.property.useIntegerZoom,c=s.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===o.kind)this.binders[i]=h?new ps(o.value,a):new hs(o.value,a,l),n.push(`/u_${i}`);else if("source"===o.kind||h){const r=vs(i,l,"source");this.binders[i]=h?new ys(o,l,u,e,r,t.id):new fs(o,a,l,r),n.push(`/a_${i}`)}else{const t=vs(i,l,"composite");this.binders[i]=new ds(o,a,l,u,e,t),n.push(`/z_${i}`)}}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof fs||e instanceof ds?e.maxValue:0}populatePaintArrays(t,e,r,n,i){for(const s in this.binders){const a=this.binders[s];(a instanceof fs||a instanceof ds||a instanceof ys)&&a.populatePaintArray(t,e,r,n,i)}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof ps&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,n,i){let s=!1;for(const a in t){const o=e.getPositions(a);for(const e of o){const o=r.feature(e.index);for(const r in this.binders){const l=this.binders[r];if((l instanceof fs||l instanceof ds||l instanceof ys)&&!0===l.expression.isStateDependent){const u=n.paint.get(r);l.expression=u.value,l.updatePaintArray(e.start,e.end,o,t[a],i),s=!0}}}}return s}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof hs||r instanceof ps)&&t.push(...r.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof fs||r instanceof ds)for(let e=0;e<r.paintVertexAttributes.length;e++)t.push(r.paintVertexAttributes[e].name);else if(r instanceof ys)for(let e=0;e<Ki.members.length;e++)t.push(Ki.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof hs||r instanceof ps||r instanceof ds)for(const e of r.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const r=[];for(const n in this.binders){const i=this.binders[n];if(i instanceof hs||i instanceof ps||i instanceof ds)for(const s of i.uniformNames)if(e[s]){const a=i.getBinding(t,e[s],s);r.push({name:s,property:n,binding:a})}}return r}setUniforms(t,e,r,n){for(const{name:t,property:i,binding:s}of e)this.binders[i].setUniform(s,n,r.get(i),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof ys){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof fs||r instanceof ds)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof fs||r instanceof ds||r instanceof ys)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof fs||e instanceof ds||e instanceof ys)&&e.destroy()}}}class gs{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new ms(n,e,r);this.needsUpload=!1,this._featureMap=new rs,this._bufferOffset=0}populatePaintArrays(t,e,r,n,i,s){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,n){for(const i of r)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(t,this._featureMap,e,i,n)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function xs(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function vs(t,e,r){const n={color:{source:ti,composite:gi},number:{source:pi,composite:ti}},i=function(t){return{"line-pattern":{source:Di,composite:Di},"fill-pattern":{source:Di,composite:Di},"fill-extrusion-pattern":{source:Di,composite:Di}}[t]}(t);return i&&i[r]||n[e][r]}Qr("ConstantBinder",hs),Qr("CrossFadedConstantBinder",ps),Qr("SourceExpressionBinder",fs),Qr("CrossFadedCompositeBinder",ys),Qr("CompositeExpressionBinder",ds),Qr("ProgramConfiguration",ms,{omit:["_buffers"]}),Qr("ProgramConfigurationSet",gs);const bs=8192,ws=Math.pow(2,14)-1,_s=-ws-1;function Ss(t){const e=bs/t.extent,r=t.loadGeometry();for(let t=0;t<r.length;t++){const n=r[t];for(let t=0;t<n.length;t++){const r=n[t],i=Math.round(r.x*e),s=Math.round(r.y*e);r.x=u(i,_s,ws),r.y=u(s,_s,ws),(i<r.x||i>r.x+1||s<r.y||s>r.y+1)&&d("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function ks(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Ss(t):[]}}function As(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}class Is{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Bi,this.indexArray=new Ri,this.segments=new Gi,this.programConfigurations=new gs(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){const n=this.layers[0],i=[];let s=null,a=!1;"circle"===n.type&&(s=n.layout.get("circle-sort-key"),a=!s.isConstant());for(const{feature:e,id:n,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=ks(e,t);if(!this.layers[0]._featureFilter.filter(new zn(this.zoom),u,r))continue;const c=a?s.evaluate(u,{},r):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Ss(e),patterns:{},sortKey:c};i.push(h)}a&&i.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of i){const{geometry:i,index:s,sourceLayerIndex:a}=n,o=t[s].feature;this.addFeature(n,i,s,r),e.featureIndex.insert(o,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Zi),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,n){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=bs||n<0||n>=bs)continue;const i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),s=i.vertexLength;As(this.layoutVertexArray,r,n,-1,-1),As(this.layoutVertexArray,r,n,1,-1),As(this.layoutVertexArray,r,n,1,1),As(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+3,s+2),i.vertexLength+=4,i.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n)}}function zs(t,e){for(let r=0;r<t.length;r++)if(Ds(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Ds(t,e[r]))return!0;return!!Bs(t,e)}function Ms(t,e,r){return!!Ds(t,e)||!!Es(e,t,r)}function Ps(t,e){if(1===t.length)return Ts(e,t[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++)if(Ds(t,n[e]))return!0}for(let r=0;r<t.length;r++)if(Ts(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Bs(t,e[r]))return!0;return!1}function Cs(t,e,r){if(t.length>1){if(Bs(t,e))return!0;for(let n=0;n<e.length;n++)if(Es(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(Es(t[n],e,r))return!0;return!1}function Bs(t,e){if(0===t.length||0===e.length)return!1;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)if(Vs(n,i,e[t],e[t+1]))return!0}return!1}function Vs(t,e,r,n){return y(t,r,n)!==y(e,r,n)&&y(t,e,r)!==y(t,e,n)}function Es(t,e,r){const n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(let r=1;r<e.length;r++)if(Fs(t,e[r-1],e[r])<n)return!0;return!1}function Fs(t,e,r){const n=e.distSqr(r);if(0===n)return t.distSqr(e);const i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return t.distSqr(i<0?e:i>1?r:r.sub(e)._mult(i)._add(e))}function Ts(t,e){let r,n,i,s=!1;for(let a=0;a<t.length;a++){r=t[a];for(let t=0,a=r.length-1;t<r.length;a=t++)n=r[t],i=r[a],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s)}return s}function Ds(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const s=t[n],a=t[i];s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function $s(t,e,r){const n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;const s=y(t,e,r[0]);return s!==y(t,e,r[1])||s!==y(t,e,r[2])||s!==y(t,e,r[3])}function Ls(t,e,r){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Os(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Us(t,e,r,i,s){if(!e[0]&&!e[1])return t;const a=n.convert(e)._mult(s);"viewport"===r&&a._rotate(-i);const o=[];for(let e=0;e<t.length;e++)o.push(t[e].sub(a));return o}let qs,Rs;Qr("CircleBucket",Is,{omit:["layers"]});var js,Ns={get paint(){return Rs=Rs||new qn({"circle-radius":new $n(k.paint_circle["circle-radius"]),"circle-color":new $n(k.paint_circle["circle-color"]),"circle-blur":new $n(k.paint_circle["circle-blur"]),"circle-opacity":new $n(k.paint_circle["circle-opacity"]),"circle-translate":new Dn(k.paint_circle["circle-translate"]),"circle-translate-anchor":new Dn(k.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Dn(k.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Dn(k.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new $n(k.paint_circle["circle-stroke-width"]),"circle-stroke-color":new $n(k.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new $n(k.paint_circle["circle-stroke-opacity"])})},get layout(){return qs=qs||new qn({"circle-sort-key":new $n(k.layout_circle["circle-sort-key"])})}},Zs="undefined"!=typeof Float32Array?Float32Array:Array;function Gs(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Js(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),js=new Zs(4),Zs!=Float32Array&&(js[0]=0,js[1]=0,js[2]=0,js[3]=0);class Ks extends jn{constructor(t){super(t,Ns)}createBucket(t){return new Is(t)}queryRadius(t){const e=t;return Ls("circle-radius",this,e)+Ls("circle-stroke-width",this,e)+Os(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=Us(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,a),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c="map"===this.paint.get("circle-pitch-alignment"),h=c?l:function(t,e){return t.map((t=>Xs(t,e)))}(l,o),p=c?u*a:u;for(const t of n)for(const e of t){const t=c?e:Xs(e,o);let r=p;const n=Js([],[e.x,e.y,0,1],o);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?r*=n[3]/s.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(r*=s.cameraToCenterDistance/n[3]),Ms(h,t,r))return!0}return!1}}function Xs(t,e){const r=Js([],[t.x,t.y,0,1],e);return new n(r[0]/r[3],r[1]/r[3])}class Ys extends Is{}let Hs;Qr("HeatmapBucket",Ys,{omit:["layers"]});var Ws={get paint(){return Hs=Hs||new qn({"heatmap-radius":new $n(k.paint_heatmap["heatmap-radius"]),"heatmap-weight":new $n(k.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Dn(k.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Un(k.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Dn(k.paint_heatmap["heatmap-opacity"])})}};function Qs(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*r*n}`)}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function ta(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;const i=Qs({},{width:e,height:r},n);ea(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function ea(t,e,r,n,i,s){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,o=e.data;if(a===o)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){const u=((r.y+l)*t.width+r.x)*s,c=((n.y+l)*e.width+n.x)*s;for(let t=0;t<i.width*s;t++)o[c+t]=a[u+t]}return e}class ra{constructor(t,e){Qs(this,t,1,e)}resize(t){ta(this,t,1)}clone(){return new ra({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){ea(t,e,r,n,i,1)}}class na{constructor(t,e){Qs(this,t,4,e)}resize(t){ta(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new na({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){ea(t,e,r,n,i,4)}}Qr("AlphaImage",ra),Qr("RGBAImage",na);class ia extends jn{createBucket(t){return new Ys(t)}constructor(t){super(t,Ws),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=function(t){const e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new na({width:r,height:n});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const s=(r,n,s)=>{e[t.evaluationKey]=s;const a=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*a.r/a.a),i.data[r+n+1]=Math.floor(255*a.g/a.a),i.data[r+n+2]=Math.floor(255*a.b/a.a),i.data[r+n+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,a=0;n<r;n++,a+=4){const o=n/(r-1),{start:l,end:u}=t.clips[e];s(i,a,l*(1-o)+u*o)}else for(let t=0,e=0;t<r;t++,e+=4)s(0,e,t/(r-1));return i}({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let sa;var aa={get paint(){return sa=sa||new qn({"hillshade-illumination-direction":new Dn(k.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Dn(k.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Dn(k.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Dn(k.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Dn(k.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Dn(k.paint_hillshade["hillshade-accent-color"])})}};class oa extends jn{constructor(t){super(t,aa)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}const la=Jn([{name:"a_pos",components:2,type:"Int16"}],4),{members:ua}=la;var ca={exports:{}};function ha(t,e,r){r=r||2;var n,i,s,a,o,l,u,c=e&&e.length,h=c?e[0]*r:t.length,p=pa(t,0,h,r,!0),f=[];if(!p||p.next===p.prev)return f;if(c&&(p=function(t,e,r,n){var i,s,a,o=[];for(i=0,s=e.length;i<s;i++)(a=pa(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),o.push(Sa(a));for(o.sort(va),i=0;i<o.length;i++)r=ba(o[i],r);return r}(t,e,p,r)),t.length>80*r){n=s=t[0],i=a=t[1];for(var d=r;d<h;d+=r)(o=t[d])<n&&(n=o),(l=t[d+1])<i&&(i=l),o>s&&(s=o),l>a&&(a=l);u=0!==(u=Math.max(s-n,a-i))?32767/u:0}return da(p,f,r,n,i,u,0),f}function pa(t,e,r,n,i){var s,a;if(i===Da(t,e,r,n)>0)for(s=e;s<r;s+=n)a=Ea(s,t[s],t[s+1],a);else for(s=r-n;s>=e;s-=n)a=Ea(s,t[s],t[s+1],a);return a&&za(a,a.next)&&(Fa(a),a=a.next),a}function fa(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!za(n,n.next)&&0!==Ia(n.prev,n,n.next))n=n.next;else{if(Fa(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function da(t,e,r,n,i,s,a){if(t){!a&&s&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=_a(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,s,a,o,l,u=1;do{for(r=t,t=null,s=null,a=0;r;){for(a++,n=r,o=0,e=0;e<u&&(o++,n=n.nextZ);e++);for(l=u;o>0||l>0&&n;)0!==o&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=n}s.nextZ=null,u*=2}while(a>1)}(i)}(t,n,i,s);for(var o,l,u=t;t.prev!==t.next;)if(o=t.prev,l=t.next,s?ma(t,n,i,s):ya(t))e.push(o.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),Fa(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?da(t=ga(fa(t),e,r),e,r,n,i,s,2):2===a&&xa(t,e,r,n,i,s):da(fa(t),e,r,n,i,s,1);break}}}function ya(t){var e=t.prev,r=t,n=t.next;if(Ia(e,r,n)>=0)return!1;for(var i=e.x,s=r.x,a=n.x,o=e.y,l=r.y,u=n.y,c=i<s?i<a?i:a:s<a?s:a,h=o<l?o<u?o:u:l<u?l:u,p=i>s?i>a?i:a:s>a?s:a,f=o>l?o>u?o:u:l>u?l:u,d=n.next;d!==e;){if(d.x>=c&&d.x<=p&&d.y>=h&&d.y<=f&&ka(i,o,s,l,a,u,d.x,d.y)&&Ia(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function ma(t,e,r,n){var i=t.prev,s=t,a=t.next;if(Ia(i,s,a)>=0)return!1;for(var o=i.x,l=s.x,u=a.x,c=i.y,h=s.y,p=a.y,f=o<l?o<u?o:u:l<u?l:u,d=c<h?c<p?c:p:h<p?h:p,y=o>l?o>u?o:u:l>u?l:u,m=c>h?c>p?c:p:h>p?h:p,g=_a(f,d,e,r,n),x=_a(y,m,e,r,n),v=t.prevZ,b=t.nextZ;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==a&&ka(o,c,l,h,u,p,v.x,v.y)&&Ia(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==a&&ka(o,c,l,h,u,p,b.x,b.y)&&Ia(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==a&&ka(o,c,l,h,u,p,v.x,v.y)&&Ia(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==a&&ka(o,c,l,h,u,p,b.x,b.y)&&Ia(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function ga(t,e,r){var n=t;do{var i=n.prev,s=n.next.next;!za(i,s)&&Ma(i,n,n.next,s)&&Ba(i,s)&&Ba(s,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(s.i/r|0),Fa(n),Fa(n.next),n=t=s),n=n.next}while(n!==t);return fa(n)}function xa(t,e,r,n,i,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&Aa(a,o)){var l=Va(a,o);return a=fa(a,a.next),l=fa(l,l.next),da(a,e,r,n,i,s,0),void da(l,e,r,n,i,s,0)}o=o.next}a=a.next}while(a!==t)}function va(t,e){return t.x-e.x}function ba(t,e){var r=function(t,e){var r,n=e,i=t.x,s=t.y,a=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var o=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(o<=i&&o>a&&(a=o,r=n.x<n.next.x?n:n.next,o===i))return r}n=n.next}while(n!==e);if(!r)return null;var l,u=r,c=r.x,h=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&ka(s<h?i:a,s,c,h,s<h?a:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),Ba(n,t)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&wa(r,n)))&&(r=n,p=l)),n=n.next}while(n!==u);return r}(t,e);if(!r)return e;var n=Va(r,t);return fa(n,n.next),fa(r,r.next)}function wa(t,e){return Ia(t.prev,t,e.prev)<0&&Ia(e.next,t,t.next)<0}function _a(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Sa(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function ka(t,e,r,n,i,s,a,o){return(i-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(n-o)>=(r-a)*(e-o)&&(r-a)*(s-o)>=(i-a)*(n-o)}function Aa(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Ma(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Ba(t,e)&&Ba(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Ia(t.prev,t,e.prev)||Ia(t,e.prev,e))||za(t,e)&&Ia(t.prev,t,t.next)>0&&Ia(e.prev,e,e.next)>0)}function Ia(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function za(t,e){return t.x===e.x&&t.y===e.y}function Ma(t,e,r,n){var i=Ca(Ia(t,e,r)),s=Ca(Ia(t,e,n)),a=Ca(Ia(r,n,t)),o=Ca(Ia(r,n,e));return i!==s&&a!==o||!(0!==i||!Pa(t,r,e))||!(0!==s||!Pa(t,n,e))||!(0!==a||!Pa(r,t,n))||!(0!==o||!Pa(r,e,n))}function Pa(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Ca(t){return t>0?1:t<0?-1:0}function Ba(t,e){return Ia(t.prev,t,t.next)<0?Ia(t,e,t.next)>=0&&Ia(t,t.prev,e)>=0:Ia(t,e,t.prev)<0||Ia(t,t.next,e)<0}function Va(t,e){var r=new Ta(t.i,t.x,t.y),n=new Ta(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function Ea(t,e,r,n){var i=new Ta(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Fa(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ta(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Da(t,e,r,n){for(var i=0,s=e,a=r-n;s<r;s+=n)i+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return i}ca.exports=ha,ca.exports.default=ha,ha.deviation=function(t,e,r,n){var i=e&&e.length,s=Math.abs(Da(t,0,i?e[0]*r:t.length,r));if(i)for(var a=0,o=e.length;a<o;a++)s-=Math.abs(Da(t,e[a]*r,a<o-1?e[a+1]*r:t.length,r));var l=0;for(a=0;a<n.length;a+=3){var u=n[a]*r,c=n[a+1]*r,h=n[a+2]*r;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},ha.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var a=0;a<e;a++)r.vertices.push(t[i][s][a]);i>0&&r.holes.push(n+=t[i-1].length)}return r};var $a=t(ca.exports);function La(t,e,r,n,i){Oa(t,e,r||0,n||t.length-1,i||qa)}function Oa(t,e,r,n,i){for(;n>r;){if(n-r>600){var s=n-r+1,a=e-r+1,o=Math.log(s),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(s-l)/s)*(a-s/2<0?-1:1);Oa(t,e,Math.max(r,Math.floor(e-a*l/s+u)),Math.min(n,Math.floor(e+(s-a)*l/s+u)),i)}var c=t[e],h=r,p=n;for(Ua(t,r,e),i(t[n],c)>0&&Ua(t,r,n);h<p;){for(Ua(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--}0===i(t[r],c)?Ua(t,r,p):Ua(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1)}}function Ua(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function qa(t,e){return t<e?-1:t>e?1:0}function Ra(t,e){const r=t.length;if(r<=1)return[t];const n=[];let i,s;for(let e=0;e<r;e++){const r=m(t[e]);0!==r&&(t[e].area=Math.abs(r),void 0===s&&(s=r<0),s===r<0?(i&&n.push(i),i=[t[e]]):i.push(t[e]))}if(i&&n.push(i),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(La(n[t],e,1,n[t].length-1,ja),n[t]=n[t].slice(0,e));return n}function ja(t,e){return e.area-t.area}function Na(t,e,r){const n=r.patternDependencies;let i=!1;for(const r of e){const e=r.paint.get(`${t}-pattern`);e.isConstant()||(i=!0);const s=e.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Za(t,e,r,n,i){const s=i.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},r,{},i.availableImages),o=e.evaluate({zoom:n},r,{},i.availableImages),l=e.evaluate({zoom:n+1},r,{},i.availableImages);t=t&&t.name?t.name:t,o=o&&o.name?o.name:o,l=l&&l.name?l.name:l,s[t]=!0,s[o]=!0,s[l]=!0,r.patterns[a.id]={min:t,mid:o,max:l}}}return r}class Ga{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Vi,this.indexArray=new Ri,this.indexArray2=new ji,this.programConfigurations=new gs(t.layers,t.zoom),this.segments=new Gi,this.segments2=new Gi,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasPattern=Na("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),s=[];for(const{feature:a,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=ks(a,t);if(!this.layers[0]._featureFilter.filter(new zn(this.zoom),c,r))continue;const h=i?n.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Ss(a),patterns:{},sortKey:h};s.push(p)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Za("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ua),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,n,i){for(const t of Ra(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),i.push(e[t].x),i.push(e[t].y);r.vertexLength+=e.length,r.primitiveLength+=e.length}const a=$a(i,s);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(n+a[t],n+a[t+1],n+a[t+2]);r.vertexLength+=e,r.primitiveLength+=a.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}}let Ja,Ka;Qr("FillBucket",Ga,{omit:["layers","patternFeatures"]});var Xa={get paint(){return Ka=Ka||new qn({"fill-antialias":new Dn(k.paint_fill["fill-antialias"]),"fill-opacity":new $n(k.paint_fill["fill-opacity"]),"fill-color":new $n(k.paint_fill["fill-color"]),"fill-outline-color":new $n(k.paint_fill["fill-outline-color"]),"fill-translate":new Dn(k.paint_fill["fill-translate"]),"fill-translate-anchor":new Dn(k.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ln(k.paint_fill["fill-pattern"])})},get layout(){return Ja=Ja||new qn({"fill-sort-key":new $n(k.layout_fill["fill-sort-key"])})}};class Ya extends jn{constructor(t){super(t,Xa)}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Ga(t)}queryRadius(){return Os(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a){return Ps(Us(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,a),n)}isTileClipped(){return!0}}const Ha=Jn([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Wa=Jn([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Qa}=Ha;var to={},eo=e,ro=no;function no(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(io,this,e)}function io(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function so(t){for(var e,r,n=0,i=0,s=t.length,a=s-1;i<s;a=i++)n+=((r=t[a]).x-(e=t[i]).x)*(e.y+r.y);return n}no.types=["Unknown","Point","LineString","Polygon"],no.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,i=0,s=0,a=0,o=[];t.pos<r;){if(i<=0){var l=t.readVarint();n=7&l,i=l>>3}if(i--,1===n||2===n)s+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&o.push(e),e=[]),e.push(new eo(s,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&o.push(e),o},no.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<a&&(a=i),i>o&&(o=i),(s+=t.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,o,u]},no.prototype.toGeoJSON=function(t,e,r){var n,i,s=this.extent*Math.pow(2,r),a=this.extent*t,o=this.extent*e,l=this.loadGeometry(),u=no.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+a)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+o)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],s=0;s<e;s++){var a=so(t[s]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(r&&i.push(r),r=[t[s]]):r.push(t[s]))}return r&&i.push(r),i}(l),n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)c(l[n][i])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var ao=ro,oo=lo;function lo(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(uo,this,e),this.length=this._features.length}function uo(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}lo.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new ao(this._pbf,e,this.extent,this._keys,this._values)};var co=oo;function ho(t,e,r){if(3===t){var n=new co(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}to.VectorTile=function(t,e){this.layers=t.readFields(ho,{},e)},to.VectorTileFeature=ro,to.VectorTileLayer=oo;const po=to.VectorTileFeature.types,fo=Math.pow(2,13);function yo(t,e,r,n,i,s,a,o){t.emplaceBack(e,r,2*Math.floor(n*fo)+a,i*fo*2,s*fo*2,Math.round(o))}class mo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ei,this.centroidVertexArray=new Ci,this.indexArray=new Ri,this.programConfigurations=new gs(t.layers,t.zoom),this.segments=new Gi,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.features=[],this.hasPattern=Na("fill-extrusion",this.layers,e);for(const{feature:n,id:i,index:s,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,o=ks(n,t);if(!this.layers[0]._featureFilter.filter(new zn(this.zoom),o,r))continue;const l={id:i,sourceLayerIndex:a,index:s,geometry:t?o.geometry:Ss(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(Za("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,s,r,{}),e.featureIndex.insert(n,l.geometry,s,a,this.index,!0)}}addFeatures(t,e,r){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,r)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Qa),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Wa.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,n,i){const s={x:0,y:0,vertexCount:0};for(const r of Ra(e,500)){let e=0;for(const t of r)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of r){if(0===t.length)continue;if(xo(t))continue;let e=0;for(let r=0;r<t.length;r++){const i=t[r];if(r>=1){const a=t[r-1];if(!go(i,a)){n.vertexLength+4>Gi.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=i.sub(a)._perp()._unit(),r=a.dist(i);e+r>32768&&(e=0),yo(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,0,e),yo(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,1,e),s.x+=2*i.x,s.y+=2*i.y,s.vertexCount+=2,e+=r,yo(this.layoutVertexArray,a.x,a.y,t.x,t.y,0,0,e),yo(this.layoutVertexArray,a.x,a.y,t.x,t.y,0,1,e),s.x+=2*a.x,s.y+=2*a.y,s.vertexCount+=2;const o=n.vertexLength;this.indexArray.emplaceBack(o,o+2,o+1),this.indexArray.emplaceBack(o+1,o+2,o+3),n.vertexLength+=4,n.primitiveLength+=2}}}}if(n.vertexLength+e>Gi.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==po[t.type])continue;const i=[],a=[],o=n.vertexLength;for(const t of r)if(0!==t.length){t!==r[0]&&a.push(i.length/2);for(let e=0;e<t.length;e++){const r=t[e];yo(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),s.x+=r.x,s.y+=r.y,s.vertexCount+=1,i.push(r.x),i.push(r.y)}}const l=$a(i,a);for(let t=0;t<l.length;t+=3)this.indexArray.emplaceBack(o+l[t],o+l[t+2],o+l[t+1]);n.primitiveLength+=l.length/3,n.vertexLength+=e}for(let t=0;t<s.vertexCount;t++)this.centroidVertexArray.emplaceBack(Math.floor(s.x/s.vertexCount),Math.floor(s.y/s.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}}function go(t,e){return t.x===e.x&&(t.x<0||t.x>bs)||t.y===e.y&&(t.y<0||t.y>bs)}function xo(t){return t.every((t=>t.x<0))||t.every((t=>t.x>bs))||t.every((t=>t.y<0))||t.every((t=>t.y>bs))}let vo;Qr("FillExtrusionBucket",mo,{omit:["layers","features"]});var bo={get paint(){return vo=vo||new qn({"fill-extrusion-opacity":new Dn(k["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new $n(k["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Dn(k["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Dn(k["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ln(k["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new $n(k["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new $n(k["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Dn(k["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class wo extends jn{constructor(t){super(t,bo)}createBucket(t){return new mo(t)}queryRadius(){return Os(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,r,i,s,a,o,l){const u=Us(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,o),c=this.paint.get("fill-extrusion-height").evaluate(e,r),h=this.paint.get("fill-extrusion-base").evaluate(e,r),p=function(t,e,r,i){const s=[];for(const r of t){const t=[r.x,r.y,0,1];Js(t,t,e),s.push(new n(t[0]/t[3],t[1]/t[3]))}return s}(u,l),f=function(t,e,r,i){const s=[],a=[],o=i[8]*e,l=i[9]*e,u=i[10]*e,c=i[11]*e,h=i[8]*r,p=i[9]*r,f=i[10]*r,d=i[11]*r;for(const e of t){const t=[],r=[];for(const s of e){const e=s.x,a=s.y,y=i[0]*e+i[4]*a+i[12],m=i[1]*e+i[5]*a+i[13],g=i[2]*e+i[6]*a+i[14],x=i[3]*e+i[7]*a+i[15],v=g+u,b=x+c,w=y+h,_=m+p,S=g+f,k=x+d,A=new n((y+o)/b,(m+l)/b);A.z=v/b,t.push(A);const I=new n(w/k,_/k);I.z=S/k,r.push(I)}s.push(t),a.push(r)}return[s,a]}(i,h,c,l);return function(t,e,r){let n=1/0;Ps(r,e)&&(n=So(r,e[0]));for(let i=0;i<e.length;i++){const s=e[i],a=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],a[t+1],a[t],e];zs(r,i)&&(n=Math.min(n,So(r,i)))}}return n!==1/0&&n}(f[0],f[1],p)}}function _o(t,e){return t.x*e.x+t.y*e.y}function So(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){const s=e[r],a=t[0],o=i.sub(n),l=s.sub(n),u=a.sub(n),c=_o(o,o),h=_o(o,l),p=_o(l,l),f=_o(u,o),d=_o(u,l),y=c*p-h*h,m=(p*f-h*d)/y,g=(c*d-h*f)/y,x=n.z*(1-m-g)+i.z*m+s.z*g;if(isFinite(x))return x}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}const ko=Jn([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Ao}=ko,Io=Jn([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:zo}=Io,Mo=to.VectorTileFeature.types,Po=Math.cos(Math.PI/180*37.5),Co=Math.pow(2,14)/.5;class Bo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new Fi,this.layoutVertexArray2=new Ti,this.indexArray=new Ri,this.programConfigurations=new gs(t.layers,t.zoom),this.segments=new Gi,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasPattern=Na("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),i=!n.isConstant(),s=[];for(const{feature:e,id:a,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=ks(e,t);if(!this.layers[0]._featureFilter.filter(new zn(this.zoom),u,r))continue;const c=i?n.evaluate(u,{},r):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Ss(e),patterns:{},sortKey:c};s.push(h)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Za("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,zo)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ao),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,n,i){const s=this.layers[0].layout,a=s.get("line-join").evaluate(t,{}),o=s.get("line-cap"),l=s.get("line-miter-limit"),u=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,a,o,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}addLine(t,e,r,n,i,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const a="Polygon"===Mo[e.type];let o=t.length;for(;o>=2&&t[o-1].equals(t[o-2]);)o--;let l=0;for(;l<o-1&&t[l].equals(t[l+1]);)l++;if(o<(a?3:2))return;"bevel"===r&&(i=1.05);const u=this.overscaling<=16?15*bs/(512*this.overscaling):0,c=this.segments.prepareSegment(10*o,this.layoutVertexArray,this.indexArray);let h,p,f,d,y;this.e1=this.e2=-1,a&&(h=t[o-2],y=t[l].sub(h)._unit()._perp());for(let e=l;e<o;e++){if(f=e===o-1?a?t[l+1]:void 0:t[e+1],f&&t[e].equals(f))continue;y&&(d=y),h&&(p=h),h=t[e],y=f?f.sub(h)._unit()._perp():d,d=d||y;let m=d.add(y);0===m.x&&0===m.y||m._unit();const g=d.x*y.x+d.y*y.y,x=m.x*y.x+m.y*y.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<Po&&p&&f,_=d.x*y.y-d.y*y.x>0;if(w&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,d,0,0,c),p=e}}const S=p&&f;let k=S?r:a?"butt":n;if(S&&"round"===k&&(v<s?k="miter":v<=2&&(k="fakeround")),"miter"===k&&v>i&&(k="bevel"),"bevel"===k&&(v>2&&(k="flipbevel"),v<i&&(k="miter")),p&&this.updateDistance(p,h),"miter"===k)m._mult(v),this.addCurrentVertex(h,m,0,0,c);else if("flipbevel"===k){if(v>100)m=y.mult(-1);else{const t=v*d.add(y).mag()/d.sub(y).mag();m._perp()._mult(t*(_?-1:1))}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c)}else if("bevel"===k||"fakeround"===k){const t=-Math.sqrt(v*v-1),e=_?t:0,r=_?0:t;if(p&&this.addCurrentVertex(h,d,e,r,c),"fakeround"===k){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const n=y.sub(d)._mult(r)._add(d)._unit()._mult(_?-1:1);this.addHalfVertex(h,n.x,n.y,!1,_,0,c)}}f&&this.addCurrentVertex(h,y,-e,-r,c)}else if("butt"===k)this.addCurrentVertex(h,m,0,0,c);else if("square"===k){const t=p?1:-1;this.addCurrentVertex(h,m,t,t,c)}else"round"===k&&(p&&(this.addCurrentVertex(h,d,0,0,c),this.addCurrentVertex(h,d,1,1,c,!0)),f&&(this.addCurrentVertex(h,y,-1,-1,c,!0),this.addCurrentVertex(h,y,0,0,c)));if(w&&e<o-1){const t=h.dist(f);if(t>2*u){const e=h.add(f.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e}}}}addCurrentVertex(t,e,r,n,i,s=!1){const a=e.y*n-e.x,o=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,s,!1,r,i),this.addHalfVertex(t,a,o,s,!0,-n,i),this.distance>Co/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,n,i,s))}addHalfVertex({x:t,y:e},r,n,i,s,a,o){const l=.5*(this.lineClips?this.scaledDistance*(Co-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),s?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let Vo,Eo;Qr("LineBucket",Bo,{omit:["layers","patternFeatures"]});var Fo={get paint(){return Eo=Eo||new qn({"line-opacity":new $n(k.paint_line["line-opacity"]),"line-color":new $n(k.paint_line["line-color"]),"line-translate":new Dn(k.paint_line["line-translate"]),"line-translate-anchor":new Dn(k.paint_line["line-translate-anchor"]),"line-width":new $n(k.paint_line["line-width"]),"line-gap-width":new $n(k.paint_line["line-gap-width"]),"line-offset":new $n(k.paint_line["line-offset"]),"line-blur":new $n(k.paint_line["line-blur"]),"line-dasharray":new On(k.paint_line["line-dasharray"]),"line-pattern":new Ln(k.paint_line["line-pattern"]),"line-gradient":new Un(k.paint_line["line-gradient"])})},get layout(){return Vo=Vo||new qn({"line-cap":new Dn(k.layout_line["line-cap"]),"line-join":new $n(k.layout_line["line-join"]),"line-miter-limit":new Dn(k.layout_line["line-miter-limit"]),"line-round-limit":new Dn(k.layout_line["line-round-limit"]),"line-sort-key":new $n(k.layout_line["line-sort-key"])})}};class To extends $n{possiblyEvaluate(t,e){return e=new zn(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,n){return e=c({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}let Do;class $o extends jn{constructor(t){super(t,Fo),this.gradientVersion=0,Do||(Do=new To(Fo.paint.properties["line-width"].specification),Do.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof oe,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Do.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Bo(t)}queryRadius(t){const e=t,r=Lo(Ls("line-width",this,e),Ls("line-gap-width",this,e)),n=Ls("line-offset",this,e);return r/2+Math.abs(n)+Os(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,r,i,s,a,o){const l=Us(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,o),u=o/2*Lo(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),c=this.paint.get("line-offset").evaluate(e,r);return c&&(i=function(t,e){const r=[];for(let i=0;i<t.length;i++){const s=t[i],a=[];for(let t=0;t<s.length;t++){const r=s[t-1],i=s[t],o=s[t+1],l=0===t?new n(0,0):i.sub(r)._unit()._perp(),u=t===s.length-1?new n(0,0):o.sub(i)._unit()._perp(),c=l._add(u)._unit(),h=c.x*u.x+c.y*u.y;0!==h&&c._mult(1/h),a.push(c._mult(e)._add(i))}r.push(a)}return r}(i,c*o)),function(t,e,r){for(let n=0;n<e.length;n++){const i=e[n];if(t.length>=3)for(let e=0;e<i.length;e++)if(Ds(t,i[e]))return!0;if(Cs(t,i,r))return!0}return!1}(l,i,u)}isTileClipped(){return!0}}function Lo(t,e){return e>0?e+2*t:t}const Oo=Jn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Uo=Jn([{name:"a_projected_pos",components:3,type:"Float32"}],4);Jn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const qo=Jn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Jn([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ro=Jn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function jo(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),In.applyArabicShaping&&(t=In.applyArabicShaping(t)),t}(t.text,e,r)})),t}Jn([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Jn([{name:"triangle",components:3,type:"Uint16"}]),Jn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Jn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Jn([{type:"Float32",name:"offsetX"}]),Jn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Jn([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const No={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Zo=24,Go=Xo,Jo=function(t,e,r,n,i){var s,a,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,s=f&(1<<-c)-1,f>>=-c,c+=o;c>0;s=256*s+t[e+h],h+=p,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===s)s=1-u;else{if(s===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),s-=u}return(f?-1:1)*a*Math.pow(2,s-n)},Ko=function(t,e,r,n,i,s){var a,o,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*l-1)*Math.pow(2,i),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&o,f+=d,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*y};function Xo(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Xo.Varint=0,Xo.Fixed64=1,Xo.Bytes=2,Xo.Fixed32=5;var Yo=4294967296,Ho=1/Yo,Wo="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Qo(t){return t.type===Xo.Bytes?t.readVarint()+t.pos:t.pos+1}function tl(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function el(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function rl(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function nl(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function il(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function sl(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function al(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function ol(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function ll(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function ul(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function cl(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function hl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function pl(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function fl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Xo.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,s=this.pos;this.type=7&n,t(i,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=hl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=fl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=hl(this.buf,this.pos)+hl(this.buf,this.pos+4)*Yo;return this.pos+=8,t},readSFixed64:function(){var t=hl(this.buf,this.pos)+fl(this.buf,this.pos+4)*Yo;return this.pos+=8,t},readFloat:function(){var t=Jo(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Jo(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,s=r.buf;if(n=(112&(i=s[r.pos++]))>>4,i<128)return tl(t,n,e);if(n|=(127&(i=s[r.pos++]))<<3,i<128)return tl(t,n,e);if(n|=(127&(i=s[r.pos++]))<<10,i<128)return tl(t,n,e);if(n|=(127&(i=s[r.pos++]))<<17,i<128)return tl(t,n,e);if(n|=(127&(i=s[r.pos++]))<<24,i<128)return tl(t,n,e);if(n|=(1&(i=s[r.pos++]))<<31,i<128)return tl(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Wo?function(t,e,r){return Wo.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i<r;){var s,a,o,l=t[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(a=t[i+2],128==(192&(s=t[i+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&s)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[i+2],o=t[i+3],128==(192&(s=t[i+1]))&&128==(192&a)&&128==(192&o)&&((u=(15&l)<<18|(63&s)<<12|(63&a)<<6|63&o)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Xo.Bytes)return t.push(this.readVarint(e));var r=Qo(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Xo.Bytes)return t.push(this.readSVarint());var e=Qo(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Xo.Bytes)return t.push(this.readBoolean());var e=Qo(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Xo.Bytes)return t.push(this.readFloat());var e=Qo(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Xo.Bytes)return t.push(this.readDouble());var e=Qo(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Xo.Bytes)return t.push(this.readFixed32());var e=Qo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Xo.Bytes)return t.push(this.readSFixed32());var e=Qo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Xo.Bytes)return t.push(this.readFixed64());var e=Qo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Xo.Bytes)return t.push(this.readSFixed64());var e=Qo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Xo.Varint)for(;this.buf[this.pos++]>127;);else if(e===Xo.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Xo.Fixed32)this.pos+=4;else{if(e!==Xo.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),pl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),pl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),pl(this.buf,-1&t,this.pos),pl(this.buf,Math.floor(t*Ho),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),pl(this.buf,-1&t,this.pos),pl(this.buf,Math.floor(t*Ho),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,s=0;s<e.length;s++){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){n>56319||s+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&el(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Ko(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Ko(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&el(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Xo.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,al,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,il,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,sl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ol,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,ll,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,ul,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,cl,e)},writeBytesField:function(t,e){this.writeTag(t,Xo.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Xo.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Xo.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Xo.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Xo.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Xo.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Xo.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Xo.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Xo.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Xo.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var dl=t(Go);const yl=3;function ml(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:i,h:s,fill:e/(i*s)||0}}const gl=1;class xl{constructor(t,{pixelRatio:e,version:r,stretchX:n,stretchY:i,content:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=i,this.content=s,this.version=r}get tl(){return[this.paddedRect.x+gl,this.paddedRect.y+gl]}get br(){return[this.paddedRect.x+this.paddedRect.w-gl,this.paddedRect.y+this.paddedRect.h-gl]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*gl)/this.pixelRatio,(this.paddedRect.h-2*gl)/this.pixelRatio]}}class vl{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:s,h:a}=ml(i),o=new na({width:s||1,height:a||1});for(const e in t){const n=t[e],i=r[e].paddedRect;na.copy(n.data,o,{x:0,y:0},{x:i.x+gl,y:i.y+gl},n.data)}for(const t in e){const r=e[t],i=n[t].paddedRect,s=i.x+gl,a=i.y+gl,l=r.data.width,u=r.data.height;na.copy(r.data,o,{x:0,y:0},{x:s,y:a},r.data),na.copy(r.data,o,{x:0,y:u-1},{x:s,y:a-1},{width:l,height:1}),na.copy(r.data,o,{x:0,y:0},{x:s,y:a+u},{width:l,height:1}),na.copy(r.data,o,{x:l-1,y:0},{x:s-1,y:a},{width:1,height:u}),na.copy(r.data,o,{x:0,y:0},{x:s+l,y:a},{width:1,height:u})}this.image=o,this.iconPositions=r,this.patternPositions=n}addImages(t,e,r){for(const n in t){const i=t[n],s={x:0,y:0,w:i.data.width+2*gl,h:i.data.height+2*gl};r.push(s),e[n]=new xl(s,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,i]=t.tl;r.update(e.data,void 0,{x:n,y:i})}}var bl;Qr("ImagePosition",xl),Qr("ImageAtlas",vl),function(t){t[t.none=0]="none",t[t.horizontal=1]="horizontal",t[t.vertical=2]="vertical",t[t.horizontalOnly=3]="horizontalOnly"}(bl||(bl={}));const wl=-17;class _l{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const r=new _l;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new _l;return e.imageName=t,e}}class Sl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const r=new Sl;for(let n=0;n<t.sections.length;n++){const i=t.sections[n];i.image?r.addImageSection(i):r.addTextSection(i,e)}return r}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let r=0;r<t.length;r++){const n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;e+=n&&bn(n)&&!No[t[r+1]]||i&&bn(i)&&!No[t[r-1]]||!No[t[r]]?t[r]:No[t[r]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&Al[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&Al[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const r=new Sl;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(_l.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(r)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void d("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(_l.forImage(e)),this.sectionIndex.push(this.sections.length-1)):d("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function kl(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y){const m=Sl.fromFeature(t,i);let g;h===bl.vertical&&m.verticalizePunctuation();const{processBidirectionalText:x,processStyledBidirectionalText:v}=In;if(x&&1===m.sections.length){g=[];const t=x(m.toString(),Vl(m,u,s,e,n,f,d));for(const e of t){const t=new Sl;t.text=e,t.sections=m.sections;for(let r=0;r<e.length;r++)t.sectionIndex.push(0);g.push(t)}}else if(v){g=[];const t=v(m.text,m.sectionIndex,Vl(m,u,s,e,n,f,d));for(const e of t){const t=new Sl;t.text=e[0],t.sectionIndex=e[1],t.sections=m.sections,g.push(t)}}else g=function(t,e){const r=[],n=t.text;let i=0;for(const n of e)r.push(t.substring(i,n)),i=n;return i<n.length&&r.push(t.substring(i,n.length)),r}(m,Vl(m,u,s,e,n,f,d));const b=[],w={positionedLines:b,text:m.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1};return function(t,e,r,n,i,s,a,o,l,u,c,h){let p=0,f=wl,d=0,y=0;const m="right"===o?1:"left"===o?0:.5;let g=0;for(const a of i){a.trim();const i=a.getMaxScale(),o=(i-1)*Zo,v={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=v;const b=v.positionedGlyphs;let w=0;if(!a.length()){f+=s,++g;continue}for(let s=0;s<a.length();s++){const d=a.getSection(s),y=a.getSectionIndex(s),m=a.getCharCode(s);let g=0,v=null,_=null,S=null,k=Zo;const A=!(l===bl.horizontal||!c&&!vn(m)||c&&(Al[m]||(x=m,yn.Arabic(x)||yn["Arabic Supplement"](x)||yn["Arabic Extended-A"](x)||yn["Arabic Presentation Forms-A"](x)||yn["Arabic Presentation Forms-B"](x))));if(d.imageName){const e=n[d.imageName];if(!e)continue;S=d.imageName,t.iconsInText=t.iconsInText||!0,_=e.paddedRect;const r=e.displaySize;d.scale=d.scale*Zo/h,v={width:r[0],height:r[1],left:gl,top:-yl,advance:A?r[1]:r[0]},g=o+(Zo-r[1]*d.scale),k=v.advance;const s=A?r[0]*d.scale-Zo*i:r[1]*d.scale-Zo*i;s>0&&s>w&&(w=s)}else{const t=r[d.fontStack],n=t&&t[m];if(n&&n.rect)_=n.rect,v=n.metrics;else{const t=e[d.fontStack],r=t&&t[m];if(!r)continue;v=r.metrics}g=(i-d.scale)*Zo}A?(t.verticalizable=!0,b.push({glyph:m,imageName:S,x:p,y:f+g,vertical:A,scale:d.scale,fontStack:d.fontStack,sectionIndex:y,metrics:v,rect:_}),p+=k*d.scale+u):(b.push({glyph:m,imageName:S,x:p,y:f+g,vertical:A,scale:d.scale,fontStack:d.fontStack,sectionIndex:y,metrics:v,rect:_}),p+=v.advance*d.scale+u)}0!==b.length&&(d=Math.max(p-u,d),Fl(b,0,b.length-1,m,w)),p=0;const _=s*i+w;v.lineOffset=Math.max(w,o),f+=_,y=Math.max(_,y),++g}var x;const v=f-wl,{horizontalAlign:b,verticalAlign:w}=El(a);(function(t,e,r,n,i,s,a,o,l){const u=(e-r)*i;let c=0;c=s!==a?-o*n-wl:(-n*l+.5)*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c})(t.positionedLines,m,b,w,d,y,s,v,i.length),t.top+=-w*v,t.bottom=t.top+v,t.left+=-b*d,t.right=t.left+d}(w,e,r,n,g,a,o,l,h,u,p,y),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const Al={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Il={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function zl(t,e,r,n,i,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*Zo/s+i:0}{const n=r[e.fontStack],s=n&&n[t];return s?s.metrics.advance*e.scale+i:0}}function Ml(t,e,r,n){const i=Math.pow(t-e,2);return n?t<e?i/2:2*i:i+Math.abs(r)*r}function Pl(t,e,r){let n=0;return 10===t&&(n-=1e4),r&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Cl(t,e,r,n,i,s){let a=null,o=Ml(e,r,i,s);for(const t of n){const n=Ml(e-t.x,r,i,s)+t.badness;n<=o&&(a=t,o=n)}return{index:t,x:e,priorBreak:a,badness:o}}function Bl(t){return t?Bl(t.priorBreak).concat(t.index):[]}function Vl(t,e,r,n,i,s,a){if("point"!==s)return[];if(!t)return[];const o=[],l=function(t,e,r,n,i,s){let a=0;for(let r=0;r<t.length();r++){const o=t.getSection(r);a+=zl(t.getCharCode(r),o,n,i,e,s)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,n,i,a),u=t.text.indexOf("")>=0;let c=0;for(let r=0;r<t.length();r++){const s=t.getSection(r),p=t.getCharCode(r);if(Al[p]||(c+=zl(p,s,n,i,e,a)),r<t.length()-1){const e=!((h=p)<11904||!(yn["Bopomofo Extended"](h)||yn.Bopomofo(h)||yn["CJK Compatibility Forms"](h)||yn["CJK Compatibility Ideographs"](h)||yn["CJK Compatibility"](h)||yn["CJK Radicals Supplement"](h)||yn["CJK Strokes"](h)||yn["CJK Symbols and Punctuation"](h)||yn["CJK Unified Ideographs Extension A"](h)||yn["CJK Unified Ideographs"](h)||yn["Enclosed CJK Letters and Months"](h)||yn["Halfwidth and Fullwidth Forms"](h)||yn.Hiragana(h)||yn["Ideographic Description Characters"](h)||yn["Kangxi Radicals"](h)||yn["Katakana Phonetic Extensions"](h)||yn.Katakana(h)||yn["Vertical Forms"](h)||yn["Yi Radicals"](h)||yn["Yi Syllables"](h)));(Il[p]||e||s.imageName)&&o.push(Cl(r+1,c,l,o,Pl(p,t.getCharCode(r+1),e&&u),!1))}}var h;return Bl(Cl(t.length(),c,l,o,0,!0))}function El(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Fl(t,e,r,n,i){if(!n&&!i)return;const s=t[r],a=(t[r].x+s.metrics.advance*s.scale)*n;for(let n=e;n<=r;n++)t[n].x-=a,t[n].y+=i}function Tl(t,e,r){const{horizontalAlign:n,verticalAlign:i}=El(r),s=e[0]-t.displaySize[0]*n,a=e[1]-t.displaySize[1]*i;return{image:t,top:a,bottom:a+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function Dl(t,e,r,n,i,s){const a=t.image;let o;if(a.content){const t=a.content,e=a.pixelRatio||1;o=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*s,u=e.right*s;let c,h,p,f;"width"===r||"both"===r?(f=i[0]+l-n[3],h=i[0]+u+n[1]):(f=i[0]+(l+u-a.displaySize[0])/2,h=f+a.displaySize[0]);const d=e.top*s,y=e.bottom*s;return"height"===r||"both"===r?(c=i[1]+d-n[0],p=i[1]+y+n[2]):(c=i[1]+(d+y-a.displaySize[1])/2,p=c+a.displaySize[1]),{image:a,top:c,right:h,bottom:p,left:f,collisionPadding:o}}const $l=255,Ll=128,Ol=$l*Ll;function Ul(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new zn(t+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=r;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let s=i;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const a=e[i],o=e[s];return"composite"===r.kind?{kind:"composite",minZoom:a,maxZoom:o,interpolationType:n}:{kind:"camera",minZoom:a,maxZoom:o,minSize:r.evaluate(new zn(a)),maxSize:r.evaluate(new zn(o)),interpolationType:n}}}function ql(t,e,r){let n="never";const i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}const Rl=to.VectorTileFeature.types,jl=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Nl(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=o?Math.min(Ol,Math.round(o[0])):0,d=o?Math.min(Ol,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),s,a,(f<<1)+(l?1:0),d,16*u,16*c,256*h,256*p)}function Zl(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function Gl(t){for(const e of t.sections)if(Sn(e.text))return!0;return!1}class Jl{constructor(t){this.layoutVertexArray=new $i,this.indexArray=new Ri,this.programConfigurations=t,this.segments=new Gi,this.dynamicLayoutVertexArray=new Li,this.opacityVertexArray=new Oi,this.hasVisibleVertices=!1,this.placedSymbolArray=new wi}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,r,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Oo.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Uo.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,jl,!0),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Qr("SymbolBuffers",Jl);class Kl{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new Gi,this.collisionVertexArray=new qi}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,qo.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Qr("CollisionBuffers",Kl);class Xl{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Gs([]),this.placementViewportMatrix=Gs([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ul(this.zoom,e["text-size"]),this.iconSizeData=Ul(this.zoom,e["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.canOverlap="never"!==ql(r,"text-overlap","text-allow-overlap")||"never"!==ql(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((t=>bl[t]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID}createArrays(){this.text=new Jl(new gs(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Jl(new gs(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new ki,this.lineVertexArray=new Ai,this.symbolInstances=new Si,this.textAnchorOffsets=new zi}calculateGlyphDependencies(t,e,r,n,i){for(let s=0;s<t.length;s++)if(e[t.charCodeAt(s)]=!0,(r||n)&&i){const r=No[t.charAt(s)];r&&(e[r.charCodeAt(0)]=!0)}}populate(t,e,r){const n=this.layers[0],i=n.layout,s=i.get("text-font"),a=i.get("text-field"),o=i.get("icon-image"),l=("constant"!==a.value.kind||a.value.value instanceof xt&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),u="constant"!==o.value.kind||!!o.value.value||Object.keys(o.parameters).length>0,c=i.get("symbol-sort-key");if(this.features=[],!l&&!u)return;const h=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new zn(this.zoom);for(const{feature:e,id:a,index:o,sourceLayerIndex:y}of t){const t=n._featureFilter.needGeometry,m=ks(e,t);if(!n._featureFilter.filter(d,m,r))continue;let g,x;if(t||(m.geometry=Ss(e)),l){const t=n.getValueAndResolveTokens("text-field",m,r,f),e=xt.factory(t);Gl(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===kn||this.hasRTLText&&In.isParsed())&&(g=jo(e,n,m))}if(u){const t=n.getValueAndResolveTokens("icon-image",m,r,f);x=t instanceof _t?t:_t.fromString(t)}if(!g&&!x)continue;const v=this.sortFeaturesByKey?c.evaluate(m,{},r):void 0;if(this.features.push({id:a,text:g,icon:x,index:o,sourceLayerIndex:y,geometry:m.geometry,properties:e.properties,type:Rl[e.type],sortKey:v}),x&&(h[x.name]=!0),g){const t=s.evaluate(m,{},r).join(","),e="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(bl.vertical)>=0;for(const r of g.sections)if(r.image)h[r.image.name]=!0;else{const n=mn(g.toString()),i=r.fontStack||t,s=p[i]=p[i]||{};this.calculateGlyphDependencies(r.text,s,e,this.allowVerticalPlacement,n)}}}"line"===i.get("symbol-placement")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++}function a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const f=l(p,h),d=l(p,h,!0);if(f in r&&d in e&&r[f]!==e[d]){const t=o(f,d,h),i=a(f,d,n[t].geometry);delete e[f],delete r[d],r[l(p,n[i].geometry,!0)]=i,n[t].geometry=null}else f in r?a(f,d,h):d in e?o(f,d,h):(s(u),e[f]=i-1,r[d]=i-1)}return n.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const i={};for(let n=t.segment+1;n<e.length;n++)i[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:r},n<e.length-1&&(r+=e[n+1].dist(e[n]));for(let r=t.segment||0;r>=0;r--)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r>0&&(n+=e[r-1].dist(e[r]));for(let t=0;t<e.length;t++){const e=i[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,a,o,l,u,c,h){const p=t.indexArray,f=t.layoutVertexArray,d=t.segments.prepareSegment(4*e.length,f,p,this.canOverlap?s.sortKey:void 0),y=this.glyphOffsetArray.length,m=d.vertexLength,g=this.allowVerticalPlacement&&a===bl.vertical?Math.PI/2:0,x=s.text&&s.text.sections;for(let n=0;n<e.length;n++){const{tl:i,tr:a,bl:l,br:u,tex:c,pixelOffsetTL:y,pixelOffsetBR:m,minFontScaleX:v,minFontScaleY:b,glyphOffset:w,isSDF:_,sectionIndex:S}=e[n],k=d.vertexLength,A=w[1];Nl(f,o.x,o.y,i.x,A+i.y,c.x,c.y,r,_,y.x,y.y,v,b),Nl(f,o.x,o.y,a.x,A+a.y,c.x+c.w,c.y,r,_,m.x,y.y,v,b),Nl(f,o.x,o.y,l.x,A+l.y,c.x,c.y+c.h,r,_,y.x,m.y,v,b),Nl(f,o.x,o.y,u.x,A+u.y,c.x+c.w,c.y+c.h,r,_,m.x,m.y,v,b),Zl(t.dynamicLayoutVertexArray,o,g),p.emplaceBack(k,k+1,k+2),p.emplaceBack(k+1,k+2,k+3),d.vertexLength+=4,d.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(w[0]),n!==e.length-1&&S===e[n+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,s,s.index,{},h,x&&x[S])}t.placedSymbolArray.emplaceBack(o.x,o.y,y,this.glyphOffsetArray.length-y,m,l,u,o.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,c)}_addCollisionDebugVertex(t,e,r,n,i,s){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,n,i,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(t,e,r,i,s,a,o){const l=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),u=l.vertexLength,c=s.layoutVertexArray,h=s.collisionVertexArray,p=o.anchorX,f=o.anchorY;this._addCollisionDebugVertex(c,h,a,p,f,new n(t,e)),this._addCollisionDebugVertex(c,h,a,p,f,new n(r,e)),this._addCollisionDebugVertex(c,h,a,p,f,new n(r,i)),this._addCollisionDebugVertex(c,h,a,p,f,new n(t,i)),l.vertexLength+=4;const d=s.indexArray;d.emplaceBack(u,u+1),d.emplaceBack(u+1,u+2),d.emplaceBack(u+2,u+3),d.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,n){for(let i=t;i<e;i++){const t=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,n?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Kl(Ui,Ro.members,ji),this.iconCollisionBox=new Kl(Ui,Ro.members,ji);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,n,i,s,a,o,l){const u={};for(let n=e;n<r;n++){const e=t.get(n);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},u.textFeatureIndex=e.featureIndex;break}for(let e=n;e<i;e++){const r=t.get(e);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let e=s;e<a;e++){const r=t.get(e);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.iconFeatureIndex=r.featureIndex;break}for(let e=o;e<l;e++){const r=t.get(e);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),n=[],i=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);const a=this.symbolInstances.get(t);n.push(0|Math.round(e*a.anchorX+r*a.anchorY)),i.push(a.featureIndex)}return s.sort(((t,e)=>n[t]-n[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Yl,Hl;Qr("SymbolBucket",Xl,{omit:["layers","collisionBoxArray","features","compareText"]}),Xl.MAX_GLYPHS=65535,Xl.addDynamicAttributes=Zl;var Wl={get paint(){return Hl=Hl||new qn({"icon-opacity":new $n(k.paint_symbol["icon-opacity"]),"icon-color":new $n(k.paint_symbol["icon-color"]),"icon-halo-color":new $n(k.paint_symbol["icon-halo-color"]),"icon-halo-width":new $n(k.paint_symbol["icon-halo-width"]),"icon-halo-blur":new $n(k.paint_symbol["icon-halo-blur"]),"icon-translate":new Dn(k.paint_symbol["icon-translate"]),"icon-translate-anchor":new Dn(k.paint_symbol["icon-translate-anchor"]),"text-opacity":new $n(k.paint_symbol["text-opacity"]),"text-color":new $n(k.paint_symbol["text-color"],{runtimeType:F,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new $n(k.paint_symbol["text-halo-color"]),"text-halo-width":new $n(k.paint_symbol["text-halo-width"]),"text-halo-blur":new $n(k.paint_symbol["text-halo-blur"]),"text-translate":new Dn(k.paint_symbol["text-translate"]),"text-translate-anchor":new Dn(k.paint_symbol["text-translate-anchor"])})},get layout(){return Yl=Yl||new qn({"symbol-placement":new Dn(k.layout_symbol["symbol-placement"]),"symbol-spacing":new Dn(k.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Dn(k.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new $n(k.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Dn(k.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Dn(k.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Dn(k.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Dn(k.layout_symbol["icon-ignore-placement"]),"icon-optional":new Dn(k.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Dn(k.layout_symbol["icon-rotation-alignment"]),"icon-size":new $n(k.layout_symbol["icon-size"]),"icon-text-fit":new Dn(k.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Dn(k.layout_symbol["icon-text-fit-padding"]),"icon-image":new $n(k.layout_symbol["icon-image"]),"icon-rotate":new $n(k.layout_symbol["icon-rotate"]),"icon-padding":new $n(k.layout_symbol["icon-padding"]),"icon-keep-upright":new Dn(k.layout_symbol["icon-keep-upright"]),"icon-offset":new $n(k.layout_symbol["icon-offset"]),"icon-anchor":new $n(k.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Dn(k.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Dn(k.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Dn(k.layout_symbol["text-rotation-alignment"]),"text-field":new $n(k.layout_symbol["text-field"]),"text-font":new $n(k.layout_symbol["text-font"]),"text-size":new $n(k.layout_symbol["text-size"]),"text-max-width":new $n(k.layout_symbol["text-max-width"]),"text-line-height":new Dn(k.layout_symbol["text-line-height"]),"text-letter-spacing":new $n(k.layout_symbol["text-letter-spacing"]),"text-justify":new $n(k.layout_symbol["text-justify"]),"text-radial-offset":new $n(k.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Dn(k.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new $n(k.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new $n(k.layout_symbol["text-anchor"]),"text-max-angle":new Dn(k.layout_symbol["text-max-angle"]),"text-writing-mode":new Dn(k.layout_symbol["text-writing-mode"]),"text-rotate":new $n(k.layout_symbol["text-rotate"]),"text-padding":new Dn(k.layout_symbol["text-padding"]),"text-keep-upright":new Dn(k.layout_symbol["text-keep-upright"]),"text-transform":new $n(k.layout_symbol["text-transform"]),"text-offset":new $n(k.layout_symbol["text-offset"]),"text-allow-overlap":new Dn(k.layout_symbol["text-allow-overlap"]),"text-overlap":new Dn(k.layout_symbol["text-overlap"]),"text-ignore-placement":new Dn(k.layout_symbol["text-ignore-placement"]),"text-optional":new Dn(k.layout_symbol["text-optional"])})}};class Ql{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:C,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Qr("FormatSectionOverride",Ql,{omit:["defaultValue"]});class tu extends jn{constructor(t){super(t,Wl)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||tr(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):""))}(e.properties,i)}createBucket(t){return new Xl(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Wl.paint.overridableProperties){if(!tu.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new Ql(e),n=new Qe(r,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new rr("source",n):new nr("composite",n,e.value.zoomStops),this.paint._values[t]=new Fn(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&tu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=Wl.paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof xt)s(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof zt&&At(e.value)===L?s(e.value.sections):e instanceof Be?s(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return i}}let eu;var ru={get paint(){return eu=eu||new qn({"background-color":new Dn(k.paint_background["background-color"]),"background-pattern":new On(k.paint_background["background-pattern"]),"background-opacity":new Dn(k.paint_background["background-opacity"])})}};class nu extends jn{constructor(t){super(t,ru)}}let iu;var su={get paint(){return iu=iu||new qn({"raster-opacity":new Dn(k.paint_raster["raster-opacity"]),"raster-hue-rotate":new Dn(k.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Dn(k.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Dn(k.paint_raster["raster-brightness-max"]),"raster-saturation":new Dn(k.paint_raster["raster-saturation"]),"raster-contrast":new Dn(k.paint_raster["raster-contrast"]),"raster-resampling":new Dn(k.paint_raster["raster-resampling"]),"raster-fade-duration":new Dn(k.paint_raster["raster-fade-duration"])})}};class au extends jn{constructor(t){super(t,su)}}class ou extends jn{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}function lu(t){if("custom"===t.type)return new ou(t);switch(t.type){case"background":return new nu(t);case"circle":return new Ks(t);case"fill":return new Ya(t);case"fill-extrusion":return new wo(t);case"heatmap":return new ia(t);case"hillshade":return new oa(t);case"line":return new $o(t);case"raster":return new au(t);case"symbol":return new tu(t)}}class uu{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(t,e){for(const e of t){this._layerConfigs[e.id]=e;const t=this._layers[e.id]=lu(e);t._featureFilter=ur(t.filter),this.keyCache[e.id]&&delete this.keyCache[e.id]}for(const t of e)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=function(t,e){const r={};for(let n=0;n<t.length;n++){const i=e&&e[t[n].id]||xr(t[n]);e&&(e[t[n].id]=i);let s=r[i];s||(s=r[i]=[]),s.push(t[n])}const n=[];for(const t in r)n.push(r[t]);return n}(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map((t=>this._layers[t.id])),r=e[0];if("none"===r.visibility)continue;const n=r.source||"";let i=this.familiesBySource[n];i||(i=this.familiesBySource[n]={});const s=r.sourceLayer||"_geojsonTileLayer";let a=i[s];a||(a=i[s]=[]),a.push(e)}}}class cu{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class hu{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class pu{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new S(bs,16,0),this.grid3D=new S(bs,16,0),this.featureIndexArray=new Pi,this.promoteId=e}insert(t,e,r,n,i,s){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);const o=s?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const r=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){const e=r[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}n[0]<bs&&n[1]<bs&&n[2]>=0&&n[3]>=0&&o.insert(a,n[0],n[1],n[2],n[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new to.VectorTile(new dl(this.rawTileData)).layers,this.sourceLayerCoder=new cu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();const s=t.params||{},a=bs/t.tileSize/t.scale,o=ur(s.filter),l=t.queryGeometry,u=t.queryPadding*a,c=du(l),h=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),p=du(t.cameraQueryGeometry),f=this.grid3D.query(p.minX-u,p.minY-u,p.maxX+u,p.maxY+u,((e,r,i,s)=>function(t,e,r,i,s){for(const n of t)if(e<=n.x&&r<=n.y&&i>=n.x&&s>=n.y)return!0;const a=[new n(e,r),new n(e,s),new n(i,s),new n(i,r)];if(t.length>2)for(const e of a)if(Ds(t,e))return!0;for(let e=0;e<t.length-1;e++)if($s(t[e],t[e+1],a))return!0;return!1}(t.cameraQueryGeometry,e-u,r-u,i+u,s+u)));for(const t of f)h.push(t);h.sort(yu);const d={};let y;for(let n=0;n<h.length;n++){const u=h[n];if(u===y)continue;y=u;const c=this.featureIndexArray.get(u);let p=null;this.loadMatchingFeature(d,c.bucketIndex,c.sourceLayerIndex,c.featureIndex,o,s.layers,s.availableImages,e,r,i,((e,r,n)=>(p||(p=Ss(e)),r.queryIntersectsFeature(l,e,n,p,this.z,t.transform,a,t.pixelPosMatrix))))}return d}loadMatchingFeature(t,e,r,n,i,s,a,o,l,u,h){const p=this.bucketLayerIDs[e];if(s&&!function(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}(s,p))return;const f=this.sourceLayerCoder.decode(r),d=this.vtLayers[f].feature(n);if(i.needGeometry){const t=ks(d,!0);if(!i.filter(new zn(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!i.filter(new zn(this.tileID.overscaledZ),d))return;const y=this.getId(d,f);for(let e=0;e<p.length;e++){const r=p[e];if(s&&s.indexOf(r)<0)continue;const i=o[r];if(!i)continue;let f={};y&&u&&(f=u.getState(i.sourceLayer||"_geojsonTileLayer",y));const m=c({},l[r]);m.paint=fu(m.paint,i.paint,d,f,a),m.layout=fu(m.layout,i.layout,d,f,a);const g=!h||h(d,i,f);if(!g)continue;const x=new hu(d,this.z,this.x,this.y,y);x.layer=m;let v=t[r];void 0===v&&(v=t[r]=[]),v.push({featureIndex:n,feature:x,intersectionZ:g})}}lookupSymbolFeatures(t,e,r,n,i,s,a,o){const l={};this.loadVTLayers();const u=ur(i);for(const i of t)this.loadMatchingFeature(l,r,n,i,u,s,a,o,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;return this.promoteId&&(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof r&&(r=Number(r))),r}}function fu(t,e,r,n,i){return h(t,((t,s)=>{const a=e instanceof Tn?e.get(s):null;return a&&a.evaluate?a.evaluate(r,n,i):a}))}function du(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);return{minX:e,minY:r,maxX:n,maxY:i}}function yu(t,e){return e-t}Qr("FeatureIndex",pu,{omit:["rawTileData","sourceLayerCoder"]});class mu extends n{constructor(t,e,r,n){super(t,e),this.angle=r,void 0!==n&&(this.segment=n)}clone(){return new mu(this.x,this.y,this.angle,this.segment)}}function gu(t,e,r,n,i){if(void 0===e.segment||0===r)return!0;let s=e,a=e.segment+1,o=0;for(;o>-r/2;){if(a--,a<0)return!1;o-=t[a].dist(s),s=t[a]}o+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;o<r/2;){const e=t[a],r=t[a+1];if(!r)return!1;let s=t[a-1].angleTo(e)-e.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:s}),u+=s;o-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,o+=e.dist(r)}return!0}function xu(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function vu(t,e,r){return t?.6*e*r:0}function bu(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function wu(t,e,r,n,i,s){const a=vu(r,i,s),o=bu(r,n)*s;let l=0;const u=xu(t)/2;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1],s=n.dist(i);if(l+s>u){const c=(u-l)/s,h=ce.number(n.x,i.x,c),p=ce.number(n.y,i.y,c),f=new mu(h,p,i.angleTo(n),r);return f._round(),!a||gu(t,f,o,a,e)?f:void 0}l+=s}}function _u(t,e,r,n,i,s,a,o,l){const u=vu(n,s,a),c=bu(n,i),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),Su(t,p?e/2*o%e:(c/2+2*s)*a*o%e,e,u,r,h,p,!1,l)}function Su(t,e,r,n,i,s,a,o,l){const u=s/2,c=xu(t);let h=0,p=e-r,f=[];for(let e=0;e<t.length-1;e++){const a=t[e],o=t[e+1],d=a.dist(o),y=o.angleTo(a);for(;p+r<h+d;){p+=r;const m=(p-h)/d,g=ce.number(a.x,o.x,m),x=ce.number(a.y,o.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new mu(g,x,y,e);r._round(),n&&!gu(t,r,s,n,i)||f.push(r)}}h+=d}return o||f.length||a||(f=Su(t,h/2,r,n,i,s,a,!0,l)),f}Qr("Anchor",mu);const ku=gl;function Au(t,e,r,i){const s=[],a=t.image,o=a.pixelRatio,l=a.paddedRect.w-2*ku,u=a.paddedRect.h-2*ku,c=t.right-t.left,h=t.bottom-t.top,p=a.stretchX||[[0,l]],f=a.stretchY||[[0,u]],d=(t,e)=>t+e[1]-e[0],y=p.reduce(d,0),m=f.reduce(d,0),g=l-y,x=u-m;let v=0,b=y,w=0,_=m,S=0,k=g,A=0,I=x;if(a.content&&i){const t=a.content;v=Iu(p,0,t[0]),w=Iu(f,0,t[1]),b=Iu(p,t[0],t[2]),_=Iu(f,t[1],t[3]),S=t[0]-v,A=t[1]-w,k=t[2]-t[0]-b,I=t[3]-t[1]-_}const z=(i,s,l,u)=>{const p=Mu(i.stretch-v,b,c,t.left),f=Pu(i.fixed-S,k,i.stretch,y),d=Mu(s.stretch-w,_,h,t.top),g=Pu(s.fixed-A,I,s.stretch,m),x=Mu(l.stretch-v,b,c,t.left),z=Pu(l.fixed-S,k,l.stretch,y),M=Mu(u.stretch-w,_,h,t.top),P=Pu(u.fixed-A,I,u.stretch,m),C=new n(p,d),B=new n(x,d),V=new n(x,M),E=new n(p,M),F=new n(f/o,g/o),T=new n(z/o,P/o),D=e*Math.PI/180;if(D){const t=Math.sin(D),e=Math.cos(D),r=[e,-t,t,e];C._matMult(r),B._matMult(r),E._matMult(r),V._matMult(r)}const $=i.stretch+i.fixed,L=s.stretch+s.fixed;return{tl:C,tr:B,bl:E,br:V,tex:{x:a.paddedRect.x+ku+$,y:a.paddedRect.y+ku+L,w:l.stretch+l.fixed-$,h:u.stretch+u.fixed-L},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:T,minFontScaleX:k/o/c,minFontScaleY:I/o/h,isSDF:r}};if(i&&(a.stretchX||a.stretchY)){const t=zu(p,g,y),e=zu(f,x,m);for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)s.push(z(n,e[t],i,e[t+1]))}}else s.push(z({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return s}function Iu(t,e,r){let n=0;for(const i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function zu(t,e,r){const n=[{fixed:-ku,stretch:0}];for(const[e,r]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(r-e)})}return n.push({fixed:e+ku,stretch:r}),n}function Mu(t,e,r,n){return t/e*r+n}function Pu(t,e,r,n){return t-e*r/n}class Cu{constructor(t,e,r,i,s,a,o,l,u,c){if(this.boxStartIndex=t.length,u){let t=a.top,e=a.bottom;const r=a.collisionPadding;r&&(t-=r[1],e+=r[3]);let n=e-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{let u=a.top*o-l[0],h=a.bottom*o+l[2],p=a.left*o-l[3],f=a.right*o+l[1];const d=a.collisionPadding;if(d&&(p-=d[0]*o,u-=d[1]*o,f+=d[2]*o,h+=d[3]*o),c){const t=new n(p,u),e=new n(f,u),r=new n(p,h),i=new n(f,h),s=c*Math.PI/180;t._rotate(s),e._rotate(s),r._rotate(s),i._rotate(s),p=Math.min(t.x,e.x,r.x,i.x),f=Math.max(t.x,e.x,r.x,i.x),u=Math.min(t.y,e.y,r.y,i.y),h=Math.max(t.y,e.y,r.y,i.y)}t.emplaceBack(e.x,e.y,p,u,f,h,r,i,s)}this.boxEndIndex=t.length}}class Bu{constructor(t=[],e=Vu){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t<n;){let n=1+(t<<1),s=e[n];const a=n+1;if(a<this.length&&r(e[a],s)<0&&(n=a,s=e[a]),r(s,i)>=0)break;e[t]=s,t=n}e[t]=i}}function Vu(t,e){return t<e?-1:t>e?1:0}function Eu(t,e=1,r=!1){let i=1/0,s=1/0,a=-1/0,o=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<i)&&(i=e.x),(!t||e.y<s)&&(s=e.y),(!t||e.x>a)&&(a=e.x),(!t||e.y>o)&&(o=e.y)}const u=Math.min(a-i,o-s);let c=u/2;const h=new Bu([],Fu);if(0===u)return new n(i,s);for(let e=i;e<a;e+=u)for(let r=s;r<o;r+=u)h.push(new Tu(e+c,r+c,c,t));let p=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,s=i.length,a=s-1;t<s;a=t++){const s=i[t],o=i[a],l=s.x*o.y-o.x*s.y;r+=(s.x+o.x)*l,n+=(s.y+o.y)*l,e+=3*l}return new Tu(r/e,n/e,0,t)}(t),f=h.length;for(;h.length;){const n=h.pop();(n.d>p.d||!p.d)&&(p=n,r&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,f)),n.max-p.d<=e||(c=n.h/2,h.push(new Tu(n.p.x-c,n.p.y-c,c,t)),h.push(new Tu(n.p.x+c,n.p.y-c,c,t)),h.push(new Tu(n.p.x-c,n.p.y+c,c,t)),h.push(new Tu(n.p.x+c,n.p.y+c,c,t)),f+=4)}return r&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function Fu(t,e){return e.max-t.max}function Tu(t,e,r,i){this.p=new n(t,e),this.h=r,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){const s=e[i];for(let e=0,i=s.length,a=i-1;e<i;a=e++){const i=s[e],o=s[a];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,Fs(t,i,o))}}return(r?1:-1)*Math.sqrt(n)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}var Du;!function(t){t[t.center=1]="center",t[t.left=2]="left",t[t.right=3]="right",t[t.top=4]="top",t[t.bottom=5]="bottom",t[t["top-left"]=6]="top-left",t[t["top-right"]=7]="top-right",t[t["bottom-left"]=8]="bottom-left",t[t["bottom-right"]=9]="bottom-right"}(Du||(Du={}));const $u=7,Lu=Number.POSITIVE_INFINITY;function Ou(t,e){return e[1]!==Lu?function(t,e,r){let n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-$u;break;case"bottom-right":case"bottom-left":case"bottom":i=-r+$u}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(t,e[0],e[1]):function(t,e){let r=0,n=0;e<0&&(e=0);const i=e/Math.SQRT2;switch(t){case"top-right":case"top-left":n=i-$u;break;case"bottom-right":case"bottom-left":n=-i+$u;break;case"bottom":n=-e+$u;break;case"top":n=e-$u}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(t,e[0])}function Uu(t,e,r){var n;const i=t.layout,s=null===(n=i.get("text-variable-anchor-offset"))||void 0===n?void 0:n.evaluate(e,{},r);if(s){const t=s.values,e=[];for(let r=0;r<t.length;r+=2){const n=e[r]=t[r],i=t[r+1].map((t=>t*Zo));n.startsWith("top")?i[1]-=$u:n.startsWith("bottom")&&(i[1]+=$u),e[r+1]=i}return new wt(e)}const a=i.get("text-variable-anchor");if(a){let n;n=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[i.get("text-radial-offset").evaluate(e,{},r)*Zo,Lu]:i.get("text-offset").evaluate(e,{},r).map((t=>t*Zo));const s=[];for(const t of a)s.push(t,Ou(t,n));return new wt(s)}return null}function qu(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=bs/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;const e=t.bucket.layers[0],r=e.layout,n=e._unevaluatedLayout._values,i={layoutIconSize:n["icon-size"].possiblyEvaluate(new zn(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new zn(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new zn(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.bucket.textSizeData;i.compositeTextSizes=[n["text-size"].possiblyEvaluate(new zn(e),t.canonical),n["text-size"].possiblyEvaluate(new zn(r),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.bucket.iconSizeData;i.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new zn(e),t.canonical),n["icon-size"].possiblyEvaluate(new zn(r),t.canonical)]}const s=r.get("text-line-height")*Zo,a="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement"),o=r.get("text-keep-upright"),l=r.get("text-size");for(const n of t.bucket.features){const u=r.get("text-font").evaluate(n,{},t.canonical).join(","),c=l.evaluate(n,{},t.canonical),h=i.layoutTextSize.evaluate(n,{},t.canonical),p=i.layoutIconSize.evaluate(n,{},t.canonical),f={horizontal:{},vertical:void 0},y=n.text;let m,g=[0,0];if(y){const i=y.toString(),l=r.get("text-letter-spacing").evaluate(n,{},t.canonical)*Zo,p=gn(i)?l:0,d=r.get("text-anchor").evaluate(n,{},t.canonical),m=Uu(e,n,t.canonical);if(!m){const e=r.get("text-radial-offset").evaluate(n,{},t.canonical);g=e?Ou(d,[e*Zo,Lu]):r.get("text-offset").evaluate(n,{},t.canonical).map((t=>t*Zo))}let x=a?"center":r.get("text-justify").evaluate(n,{},t.canonical);const v=r.get("symbol-placement"),b="point"===v?r.get("text-max-width").evaluate(n,{},t.canonical)*Zo:0,w=()=>{t.bucket.allowVerticalPlacement&&mn(i)&&(f.vertical=kl(y,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,s,d,"left",p,g,bl.vertical,!0,v,h,c))};if(!a&&m){const e=new Set;if("auto"===x)for(let t=0;t<m.values.length;t+=2)e.add(Ru(m.values[t]));else e.add(x);let r=!1;for(const n of e)if(!f.horizontal[n])if(r)f.horizontal[n]=f.horizontal[0];else{const e=kl(y,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,s,"center",n,p,g,bl.horizontal,!1,v,h,c);e&&(f.horizontal[n]=e,r=1===e.positionedLines.length)}w()}else{"auto"===x&&(x=Ru(d));const e=kl(y,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,s,d,x,p,g,bl.horizontal,!1,v,h,c);e&&(f.horizontal[x]=e),w(),mn(i)&&a&&o&&(f.vertical=kl(y,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,s,d,x,p,g,bl.vertical,!1,v,h,c))}}let x=!1;if(n.icon&&n.icon.name){const e=t.imageMap[n.icon.name];e&&(m=Tl(t.imagePositions[n.icon.name],r.get("icon-offset").evaluate(n,{},t.canonical),r.get("icon-anchor").evaluate(n,{},t.canonical)),x=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=x:t.bucket.sdfIcons!==x&&d("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==r.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const v=Zu(f.horizontal)||f.vertical;t.bucket.iconsInText=!!v&&v.iconsInText,(v||m)&&ju(t.bucket,n,f,m,t.imageMap,i,h,p,g,x,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function Ru(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function ju(t,e,r,i,s,a,o,l,u,c,h){let p=a.textMaxSize.evaluate(e,{});void 0===p&&(p=o);const f=t.layers[0].layout,y=f.get("icon-offset").evaluate(e,{},h),m=Zu(r.horizontal),g=o/24,x=t.tilePixelRatio*g,v=t.tilePixelRatio*p/24,b=t.tilePixelRatio*l,w=t.tilePixelRatio*f.get("symbol-spacing"),_=f.get("text-padding")*t.tilePixelRatio,S=function(t,e,r,n=1){const i=t.get("icon-padding").evaluate(e,{},r),s=i&&i.values;return[s[0]*n,s[1]*n,s[2]*n,s[3]*n]}(f,e,h,t.tilePixelRatio),k=f.get("text-max-angle")/180*Math.PI,A="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),I="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),z=f.get("symbol-placement"),M=w/2,P=f.get("icon-text-fit");let C;i&&"none"!==P&&(t.allowVerticalPlacement&&r.vertical&&(C=Dl(i,r.vertical,P,f.get("icon-text-fit-padding"),y,g)),m&&(i=Dl(i,m,P,f.get("icon-text-fit-padding"),y,g)));const B=(n,l)=>{l.x<0||l.x>=bs||l.y<0||l.y>=bs||function(t,e,r,n,i,s,a,o,l,u,c,h,p,f,y,m,g,x,v,b,w,_,S,k,A){const I=t.addToLineVertexArray(e,r);let z,M,P,C,B=0,V=0,E=0,F=0,T=-1,D=-1;const $={};let L=es("");if(t.allowVerticalPlacement&&n.vertical){const t=o.layout.get("text-rotate").evaluate(w,{},k)+90;P=new Cu(l,e,u,c,h,n.vertical,p,f,y,t),a&&(C=new Cu(l,e,u,c,h,a,g,x,y,t))}if(i){const r=o.layout.get("icon-rotate").evaluate(w,{}),n="none"!==o.layout.get("icon-text-fit"),s=Au(i,r,S,n),p=a?Au(a,r,S,n):void 0;M=new Cu(l,e,u,c,h,i,g,x,!1,r),B=4*s.length;const f=t.iconSizeData;let y=null;"source"===f.kind?(y=[Ll*o.layout.get("icon-size").evaluate(w,{})],y[0]>Ol&&d(`${t.layerIds[0]}: Value for "icon-size" is >= ${$l}. Reduce your "icon-size".`)):"composite"===f.kind&&(y=[Ll*_.compositeIconSizes[0].evaluate(w,{},k),Ll*_.compositeIconSizes[1].evaluate(w,{},k)],(y[0]>Ol||y[1]>Ol)&&d(`${t.layerIds[0]}: Value for "icon-size" is >= ${$l}. Reduce your "icon-size".`)),t.addSymbols(t.icon,s,y,b,v,w,bl.none,e,I.lineStartIndex,I.lineLength,-1,k),T=t.icon.placedSymbolArray.length-1,p&&(V=4*p.length,t.addSymbols(t.icon,p,y,b,v,w,bl.vertical,e,I.lineStartIndex,I.lineLength,-1,k),D=t.icon.placedSymbolArray.length-1)}const O=Object.keys(n.horizontal);for(const r of O){const i=n.horizontal[r];if(!z){L=es(i.text);const t=o.layout.get("text-rotate").evaluate(w,{},k);z=new Cu(l,e,u,c,h,i,p,f,y,t)}const a=1===i.positionedLines.length;if(E+=Nu(t,e,i,s,o,y,w,m,I,n.vertical?bl.horizontal:bl.horizontalOnly,a?O:[r],$,T,_,k),a)break}n.vertical&&(F+=Nu(t,e,n.vertical,s,o,y,w,m,I,bl.vertical,["vertical"],$,D,_,k));const U=z?z.boxStartIndex:t.collisionBoxArray.length,q=z?z.boxEndIndex:t.collisionBoxArray.length,R=P?P.boxStartIndex:t.collisionBoxArray.length,j=P?P.boxEndIndex:t.collisionBoxArray.length,N=M?M.boxStartIndex:t.collisionBoxArray.length,Z=M?M.boxEndIndex:t.collisionBoxArray.length,G=C?C.boxStartIndex:t.collisionBoxArray.length,J=C?C.boxEndIndex:t.collisionBoxArray.length;let K=-1;const X=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;K=X(z,K),K=X(P,K),K=X(M,K),K=X(C,K);const Y=K>-1?1:0;Y&&(K*=A/Zo),t.glyphOffsetArray.length>=Xl.MAX_GLYPHS&&d("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,w.sortKey);const H=Uu(o,w,k),[W,Q]=function(t,e){const r=t.length,n=null==e?void 0:e.values;if((null==n?void 0:n.length)>0)for(let e=0;e<n.length;e+=2){const r=n[e+1];t.emplaceBack(Du[n[e]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,H);t.symbolInstances.emplaceBack(e.x,e.y,$.right>=0?$.right:-1,$.center>=0?$.center:-1,$.left>=0?$.left:-1,$.vertical||-1,T,D,L,U,q,R,j,N,Z,G,J,u,E,F,B,V,Y,0,p,K,W,Q)}(t,l,n,r,i,s,C,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,x,[_,_,_,_],A,u,b,S,I,y,e,a,c,h,o)};if("line"===z)for(const s of function(t,e,r,i,s){const a=[];for(let e=0;e<t.length;e++){const r=t[e];let o;for(let t=0;t<r.length-1;t++){let e=r[t],l=r[t+1];e.x<0&&l.x<0||(e.x<0?e=new n(0,e.y+(0-e.x)/(l.x-e.x)*(l.y-e.y))._round():l.x<0&&(l=new n(0,e.y+(0-e.x)/(l.x-e.x)*(l.y-e.y))._round()),e.y<0&&l.y<0||(e.y<0?e=new n(e.x+(0-e.y)/(l.y-e.y)*(l.x-e.x),0)._round():l.y<0&&(l=new n(e.x+(0-e.y)/(l.y-e.y)*(l.x-e.x),0)._round()),e.x>=i&&l.x>=i||(e.x>=i?e=new n(i,e.y+(i-e.x)/(l.x-e.x)*(l.y-e.y))._round():l.x>=i&&(l=new n(i,e.y+(i-e.x)/(l.x-e.x)*(l.y-e.y))._round()),e.y>=s&&l.y>=s||(e.y>=s?e=new n(e.x+(s-e.y)/(l.y-e.y)*(l.x-e.x),s)._round():l.y>=s&&(l=new n(e.x+(s-e.y)/(l.y-e.y)*(l.x-e.x),s)._round()),o&&e.equals(o[o.length-1])||(o=[e],a.push(o)),o.push(l)))))}}return a}(e.geometry,0,0,bs,bs)){const e=_u(s,w,k,r.vertical||m,i,24,v,t.overscaling,bs);for(const r of e)m&&Gu(t,m.text,M,r)||B(s,r)}else if("line-center"===z){for(const t of e.geometry)if(t.length>1){const e=wu(t,k,r.vertical||m,i,24,v);e&&B(t,e)}}else if("Polygon"===e.type)for(const t of Ra(e.geometry,0)){const e=Eu(t,16);B(t[0],new mu(e.x,e.y,0))}else if("LineString"===e.type)for(const t of e.geometry)B(t,new mu(t[0].x,t[0].y,0));else if("Point"===e.type)for(const t of e.geometry)for(const e of t)B([e],new mu(e.x,e.y,0))}function Nu(t,e,r,i,s,a,o,l,u,c,h,p,f,y,m){const g=function(t,e,r,i,s,a,o,l){const u=i.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,c=[];for(const t of e.positionedLines)for(const i of t.positionedGlyphs){if(!i.rect)continue;const a=i.rect||{};let h=yl+1,p=!0,f=1,d=0;const y=(s||l)&&i.vertical,m=i.metrics.advance*i.scale/2;if(l&&e.verticalizable&&(d=t.lineOffset/2-(i.imageName?-(Zo-i.metrics.width*i.scale)/2:(i.scale-1)*Zo)),i.imageName){const t=o[i.imageName];p=t.sdf,f=t.pixelRatio,h=gl/f}const g=s?[i.x+m,i.y]:[0,0];let x=s?[0,0]:[i.x+m+r[0],i.y+r[1]-d],v=[0,0];y&&(v=x,x=[0,0]);const b=i.metrics.isDoubleResolution?2:1,w=(i.metrics.left-h)*i.scale-m+x[0],_=(-i.metrics.top-h)*i.scale+x[1],S=w+a.w/b*i.scale/f,k=_+a.h/b*i.scale/f,A=new n(w,_),I=new n(S,_),z=new n(w,k),M=new n(S,k);if(y){const t=new n(-m,m-wl),e=-Math.PI/2,r=Zo/2-m,s=new n(5-wl-r,-(i.imageName?r:0)),a=new n(...v);A._rotateAround(e,t)._add(s)._add(a),I._rotateAround(e,t)._add(s)._add(a),z._rotateAround(e,t)._add(s)._add(a),M._rotateAround(e,t)._add(s)._add(a)}if(u){const t=Math.sin(u),e=Math.cos(u),r=[e,-t,t,e];A._matMult(r),I._matMult(r),z._matMult(r),M._matMult(r)}const P=new n(0,0),C=new n(0,0);c.push({tl:A,tr:I,bl:z,br:M,tex:a,writingMode:e.writingMode,glyphOffset:g,sectionIndex:i.sectionIndex,isSDF:p,pixelOffsetTL:P,pixelOffsetBR:C,minFontScaleX:0,minFontScaleY:0})}return c}(0,r,l,s,a,o,i,t.allowVerticalPlacement),x=t.textSizeData;let v=null;"source"===x.kind?(v=[Ll*s.layout.get("text-size").evaluate(o,{})],v[0]>Ol&&d(`${t.layerIds[0]}: Value for "text-size" is >= ${$l}. Reduce your "text-size".`)):"composite"===x.kind&&(v=[Ll*y.compositeTextSizes[0].evaluate(o,{},m),Ll*y.compositeTextSizes[1].evaluate(o,{},m)],(v[0]>Ol||v[1]>Ol)&&d(`${t.layerIds[0]}: Value for "text-size" is >= ${$l}. Reduce your "text-size".`)),t.addSymbols(t.text,g,v,l,a,o,c,e,u.lineStartIndex,u.lineLength,f,m);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function Zu(t){for(const e in t)return t[e];return null}function Gu(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<r)return!0}else i[e]=[];return i[e].push(n),!1}class Ju{constructor(t){const e={},r=[];for(const n in t){const i=t[n],s=e[n]={};for(const t in i){const e=i[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const n={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};r.push(n),s[t]={rect:n,metrics:e.metrics}}}const{w:n,h:i}=ml(r),s=new ra({width:n||1,height:i||1});for(const r in t){const n=t[r];for(const t in n){const i=n[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const a=e[r][t].rect;ra.copy(i.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},i.bitmap)}}this.image=s,this.positions=e}}function Ku(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}Qr("GlyphAtlas",Ju);const Xu=6371008.8;class Yu{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Yu(function(t,e,r){const n=((t-e)%360+360)%360+e;return n===e?180:n}(this.lng,-180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Xu*Math.acos(Math.min(i,1))}static convert(t){if(t instanceof Yu)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Yu(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Yu(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Hu=2*Math.PI*Xu;function Wu(t){return Hu*Math.cos(t*Math.PI/180)}function Qu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class tc{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){const r=Yu.convert(t);return new tc((180+r.lng)/360,(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r.lat*Math.PI/360)))/360,function(t,e){return t/Wu(e)}(e,r.lat))}toLngLat(){return new Yu(360*this.x-180,Qu(this.y))}toAltitude(){return this.z*Wu(Qu(this.y))}meterInMercatorCoordinateUnits(){return 1/Hu*(t=Qu(this.y),1/Math.cos(t*Math.PI/180));var t}}class ec{constructor(t,e,r){if(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=ic(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){const n=(s=this.y,a=this.z,o=Ku(256*(i=this.x),256*(s=Math.pow(2,a)-s-1),a),l=Ku(256*(i+1),256*(s+1),a),o[0]+","+o[1]+","+l[0]+","+l[1]);var i,s,a,o,l;const u=function(t,e,r){let n,i="";for(let s=t;s>0;s--)n=1<<s-1,i+=(e&n?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,n)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new n((t.x*e-this.x)*bs,(t.y*e-this.y)*bs)}toString(){return`${this.z}/${this.x}/${this.y}`}}class rc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=ic(t,e.z,e.z,e.x,e.y)}}class nc{constructor(t,e,r,n,i){if(t<r)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=e,this.canonical=new ec(r,+n,+i),this.key=ic(e,t,r,n,i)}clone(){return new nc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new nc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new nc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?ic(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):ic(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new nc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new nc(e,this.wrap,e,r,n),new nc(e,this.wrap,e,r+1,n),new nc(e,this.wrap,e,r,n+1),new nc(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new nc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new nc(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new rc(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new tc(t.x-this.wrap,t.y))}}function ic(t,e,r,n,i){(t*=2)<0&&(t=-1*t-1);const s=1<<r;return(s*s*t+s*i+n).toString(36)+r.toString(36)+e.toString(36)}Qr("CanonicalTileID",ec),Qr("OverscaledTileID",nc,{omit:["posMatrix"]});class sc{constructor(t){this.tileID=new nc(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(t,e,r,n,i){this.status="parsing",this.data=t,this.collisionBoxArray=new vi;const s=new cu(Object.keys(t.layers).sort()),a=new pu(this.tileID,this.promoteId);a.bucketLayerIDs=[];const o={},l={featureIndex:a,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:r},u=e.familiesBySource[this.source];for(const e in u){const n=t.layers[e];if(!n)continue;1===n.version&&d(`Vector tile source "${this.source}" layer "${e}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const i=s.encode(e),c=[];for(let t=0;t<n.length;t++){const r=n.feature(t),s=a.getId(r,e);c.push({feature:r,id:s,index:t,sourceLayerIndex:i})}for(const t of u[e]){const e=t[0];e.source!==this.source&&d(`layer.source = ${e.source} does not equal this.source = ${this.source}`),e.minzoom&&this.zoom<Math.floor(e.minzoom)||e.maxzoom&&this.zoom>=e.maxzoom||"none"!==e.visibility&&(ac(t,this.zoom,r),(o[e.id]=e.createBucket({index:a.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:i,sourceID:this.source})).populate(c,l,this.tileID.canonical),a.bucketLayerIDs.push(t.map((t=>t.id))))}}let c,p,f,y;const m=h(l.glyphDependencies,(t=>Object.keys(t).map(Number)));this.inFlightDependencies.forEach((t=>null==t?void 0:t.cancel())),this.inFlightDependencies=[];const g=++this.dependencySentinel;Object.keys(m).length?this.inFlightDependencies.push(n.send("getGlyphs",{uid:this.uid,stacks:m,source:this.source,tileID:this.tileID,type:"glyphs"},((t,e)=>{g===this.dependencySentinel&&(c||(c=t,p=e,b.call(this)))}))):p={};const x=Object.keys(l.iconDependencies);x.length?this.inFlightDependencies.push(n.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{g===this.dependencySentinel&&(c||(c=t,f=e,b.call(this)))}))):f={};const v=Object.keys(l.patternDependencies);function b(){if(c)return i(c);if(p&&f&&y){const t=new Ju(p),e=new vl(f,y);for(const n in o){const i=o[n];i instanceof Xl?(ac(i.layers,this.zoom,r),qu({bucket:i,glyphMap:p,glyphPositions:t.positions,imageMap:f,imagePositions:e.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):i.hasPattern&&(i instanceof Bo||i instanceof Ga||i instanceof mo)&&(ac(i.layers,this.zoom,r),i.addFeatures(l,this.tileID.canonical,e.patternPositions))}this.status="done",i(null,{buckets:Object.values(o).filter((t=>!t.isEmpty())),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:e,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?t.positions:null})}}v.length?this.inFlightDependencies.push(n.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{g===this.dependencySentinel&&(c||(c=t,y=e,b.call(this)))}))):y={},b.call(this)}}function ac(t,e,r){const n=new zn(e);for(const e of t)e.recalculate(n,r)}var oc;!function(t){t.create="create",t.load="load",t.fullLoad="fullLoad"}(oc||(oc={}));class lc{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}}function uc(t,e){const r=function(t,e){return Hr(c(t,{type:"arrayBuffer"}),e)}(t.request,((r,n,i,s)=>{if(r)e(r);else if(n)try{const t=new to.VectorTile(new dl(n));e(null,{vectorTile:t,rawData:n,cacheControl:i,expires:s})}catch(r){const i=new Uint8Array(n);let s=`Unable to parse the tile at ${t.request.url}, `;s+=31===i[0]&&139===i[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${r.messge}`,e(new Error(s))}}));return()=>{r.cancel(),e()}}class cc{constructor(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||uc,this.fetching={},this.loading={},this.loaded={}}loadTile(t,e){const r=t.uid;this.loading||(this.loading={});const n=!!(t&&t.request&&t.request.collectResourceTiming)&&new lc(t.request),i=this.loading[r]=new sc(t);i.abort=this.loadVectorData(t,((t,s)=>{if(delete this.loading[r],t||!s)return i.status="done",this.loaded[r]=i,e(t);const a=s.rawData,o={};s.expires&&(o.expires=s.expires),s.cacheControl&&(o.cacheControl=s.cacheControl);const l={};if(n){const t=n.finish();t&&(l.resourceTiming=JSON.parse(JSON.stringify(t)))}i.vectorTile=s.vectorTile,i.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,n)=>{if(delete this.fetching[r],t||!n)return e(t);e(null,c({rawTileData:a.slice(0)},n,o,l))})),this.loaded=this.loaded||{},this.loaded[r]=i,this.fetching[r]={rawTileData:a,cacheControl:o,resourceTiming:l}}))}reloadTile(t,e){const r=this.loaded,n=t.uid;if(r&&r[n]){const i=r[n];i.showCollisionBoxes=t.showCollisionBoxes,"parsing"===i.status?i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,r)=>{if(t||!r)return e(t,r);let i;if(this.fetching[n]){const{rawTileData:t,cacheControl:e,resourceTiming:s}=this.fetching[n];delete this.fetching[n],i=c({rawTileData:t.slice(0)},r,e,s)}else i=r;e(null,i)})):"done"===i.status&&(i.vectorTile?i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,e):e())}}abortTile(t,e){const r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()}removeTile(t,e){const r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()}}class hc{constructor(t,e,r,n=1,i=1,s=1,a=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r))return void d(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const o=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=i,this.blueFactor=s,this.baseShift=a;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=0;t<o;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(o,t)]=this.data[this._idx(o-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,o)]=this.data[this._idx(t,o-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(o,-1)]=this.data[this._idx(o-1,0)],this.data[this._idx(-1,o)]=this.data[this._idx(0,o-1)],this.data[this._idx(o,o)]=this.data[this._idx(o-1,o-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<o;t++)for(let e=0;e<o;e++){const r=this.get(t,e);r>this.max&&(this.max=r),r<this.min&&(this.min=r)}}get(t,e){const r=new Uint8Array(this.data.buffer),n=4*this._idx(t,e);return this.unpack(r[n],r[n+1],r[n+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}unpack(t,e,r){return t*this.redFactor+e*this.greenFactor+r*this.blueFactor-this.baseShift}getPixels(){return new na({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=a-1;break;case 1:a=s+1}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e<a;e++)for(let r=n;r<i;r++)this.data[this._idx(r,e)]=t.data[this._idx(r+o,e+l)]}}Qr("DEMData",hc);class pc{constructor(){this.loaded={}}async loadTile(t,e){const{uid:r,encoding:n,rawImageData:i,redFactor:s,greenFactor:a,blueFactor:u,baseShift:c}=t,h=i.width+2,p=i.height+2,f=_(i)?new na({width:h,height:p},await async function(t,e,r,n,i){if(function(){if(null==l&&(l=!1,null==o&&(o="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),o)){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let r=0;r<t*t;r++){const n=4*r;e.fillStyle=`rgb(${n},${n+1},${n+2})`,e.fillRect(r%t,Math.floor(r/t),1,1)}const r=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&r[e]!==e){l=!0;break}}}return l||!1}())try{return await async function(t,e,r,n,i){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const s=new VideoFrame(t,{timestamp:0});try{const a=null==s?void 0:s.format;if(!a||!a.startsWith("BGR")&&!a.startsWith("RGB"))throw new Error(`Unrecognized format ${a}`);const o=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await s.copyTo(l,function(t,e,r,n,i){const s=4*Math.max(-e,0),a=(Math.max(0,r)-r)*n*4+s,o=4*n,l=Math.max(0,e),u=Math.max(0,r);return{rect:{x:l,y:u,width:Math.min(t.width,e+n)-l,height:Math.min(t.height,r+i)-u},layout:[{offset:a,stride:o}]}}(t,e,r,n,i)),o)for(let t=0;t<l.length;t+=4){const e=l[t];l[t]=l[t+2],l[t+2]=e}return l}finally{s.close()}}(t,e,r,n,i)}catch(t){}return function(t,e,r,n,i){const s=t.width,a=t.height;x&&v||(x=new OffscreenCanvas(s,a),v=x.getContext("2d",{willReadFrequently:!0})),x.width=s,x.height=a,v.drawImage(t,0,0,s,a);const o=v.getImageData(e,r,n,i);return v.clearRect(0,0,s,a),o.data}(t,e,r,n,i)}(i,-1,-1,h,p)):i,d=new hc(r,f,n,s,a,u,c);this.loaded=this.loaded||{},this.loaded[r]=d,e(null,d)}removeTile(t){const e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]}}function fc(t,e){if(0!==t.length){dc(t[0],e);for(var r=1;r<t.length;r++)dc(t[r],!e)}}function dc(t,e){for(var r=0,n=0,i=0,s=t.length,a=s-1;i<s;a=i++){var o=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+o;n+=Math.abs(r)>=Math.abs(o)?r-l+o:o-l+r,r=l}r+n>=0!=!!e&&t.reverse()}var yc=t((function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n<e.features.length;n++)t(e.features[n],r);else if("GeometryCollection"===i)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],r);else if("Feature"===i)t(e.geometry,r);else if("Polygon"===i)fc(e.coordinates,r);else if("MultiPolygon"===i)for(n=0;n<e.coordinates.length;n++)fc(e.coordinates[n],r);return e}));const mc=to.VectorTileFeature.prototype.toGeoJSON;var gc={exports:{}},xc=e,vc=to.VectorTileFeature,bc=wc;function wc(t,e){this.options=e||{},this.features=t,this.length=t.length}function _c(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}wc.prototype.feature=function(t){return new _c(this.features[t],this.options.extent)},_c.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new xc(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry},_c.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,s=0;s<t.length;s++)for(var a=t[s],o=0;o<a.length;o++){var l=a[o];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},_c.prototype.toGeoJSON=vc.prototype.toGeoJSON;var Sc=Go,kc=bc;function Ac(t){var e=new Sc;return function(t,e){for(var r in t.layers)e.writeMessage(3,Ic,t.layers[r])}(t,e),e.finish()}function Ic(t,e){var r;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,zc,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var s=n.values;for(r=0;r<s.length;r++)e.writeMessage(4,Vc,s[r])}function zc(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,Mc,t),e.writeVarintField(3,r.type),e.writeMessage(4,Bc,r)}function Mc(t,e){var r=t.feature,n=t.keys,i=t.values,s=t.keycache,a=t.valuecache;for(var o in r.properties){var l=r.properties[o],u=s[o];if(null!==l){void 0===u&&(n.push(o),s[o]=u=n.length-1),e.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=a[h];void 0===p&&(i.push(l),a[h]=p=i.length-1),e.writeVarint(p)}}}function Pc(t,e){return(e<<3)+(7&t)}function Cc(t){return t<<1^t>>31}function Bc(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,s=0,a=r.length,o=0;o<a;o++){var l=r[o],u=1;1===n&&(u=l.length),e.writeVarint(Pc(1,u));for(var c=3===n?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==n&&e.writeVarint(Pc(2,c-1));var p=l[h].x-i,f=l[h].y-s;e.writeVarint(Cc(p)),e.writeVarint(Cc(f)),i+=p,s+=f}3===n&&e.writeVarint(Pc(7,1))}}function Vc(t,e){var r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}gc.exports=Ac,gc.exports.fromVectorTileJs=Ac,gc.exports.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var n in t)r[n]=new kc(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Ac({layers:r})},gc.exports.GeoJSONWrapper=kc;var Ec=t(gc.exports);const Fc=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Tc{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,r]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const n=r>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const i=Fc[15&r];if(!i)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new Tc(a,s,i,t)}constructor(t,e=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Fc.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,o=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+a+o),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Dc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:s,nodeSize:a}=this,o=[0,i.length-1,0],l=[];for(;o.length;){const u=o.pop()||0,c=o.pop()||0,h=o.pop()||0;if(c-h<=a){for(let a=h;a<=c;a++){const o=s[2*a],u=s[2*a+1];o>=t&&o<=r&&u>=e&&u<=n&&l.push(i[a])}continue}const p=h+c>>1,f=s[2*p],d=s[2*p+1];f>=t&&f<=r&&d>=e&&d<=n&&l.push(i[p]),(0===u?t<=f:e<=d)&&(o.push(h),o.push(p-1),o.push(1-u)),(0===u?r>=f:n>=d)&&(o.push(p+1),o.push(c),o.push(1-u))}return l}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:i,nodeSize:s}=this,a=[0,n.length-1,0],o=[],l=r*r;for(;a.length;){const u=a.pop()||0,c=a.pop()||0,h=a.pop()||0;if(c-h<=s){for(let r=h;r<=c;r++)Uc(i[2*r],i[2*r+1],t,e)<=l&&o.push(n[r]);continue}const p=h+c>>1,f=i[2*p],d=i[2*p+1];Uc(f,d,t,e)<=l&&o.push(n[p]),(0===u?t-r<=f:e-r<=d)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?t+r>=f:e+r>=d)&&(a.push(p+1),a.push(c),a.push(1-u))}return o}}function Dc(t,e,r,n,i,s){if(i-n<=r)return;const a=n+i>>1;$c(t,e,a,n,i,s),Dc(t,e,r,n,a-1,1-s),Dc(t,e,r,a+1,i,1-s)}function $c(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const a=i-n+1,o=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(o-a/2<0?-1:1);$c(t,e,r,Math.max(n,Math.floor(r-o*u/a+c)),Math.min(i,Math.floor(r+(a-o)*u/a+c)),s)}const a=e[2*r+s];let o=n,l=i;for(Lc(t,e,n,r),e[2*i+s]>a&&Lc(t,e,n,i);o<l;){for(Lc(t,e,o,l),o++,l--;e[2*o+s]<a;)o++;for(;e[2*l+s]>a;)l--}e[2*n+s]===a?Lc(t,e,n,l):(l++,Lc(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Lc(t,e,r,n){Oc(t,r,n),Oc(e,2*r,2*n),Oc(e,2*r+1,2*n+1)}function Oc(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function Uc(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}const qc={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Rc=Math.fround||(jc=new Float32Array(1),t=>(jc[0]=+t,jc[0]));var jc;const Nc=3,Zc=5,Gc=6;class Jc{constructor(t){this.options=Object.assign(Object.create(qc),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:r,maxZoom:n}=this.options;e&&console.time("total time");const i=`prepare ${t.length} points`;e&&console.time(i),this.points=t;const s=[];for(let e=0;e<t.length;e++){const r=t[e];if(!r.geometry)continue;const[n,i]=r.geometry.coordinates,a=Rc(Yc(n)),o=Rc(Hc(i));s.push(a,o,1/0,e,-1,1),this.options.reduce&&s.push(0)}let a=this.trees[n+1]=this._createTree(s);e&&console.timeEnd(i);for(let t=n;t>=r;t--){const r=+Date.now();a=this.trees[t]=this._createTree(this._cluster(a,t)),e&&console.log("z%d: %d clusters in %dms",t,a.numItems,+Date.now()-r)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let i=180===t[2]?180:((t[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){const t=this.getClusters([r,n,180,s],e),a=this.getClusters([-180,n,i,s],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],o=a.range(Yc(r),Hc(s),Yc(i),Hc(n)),l=a.data,u=[];for(const t of o){const e=this.stride*t;u.push(l[e+Zc]>1?Kc(l,e,this.clusterProps):this.points[l[e+Nc]])}return u}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",i=this.trees[r];if(!i)throw new Error(n);const s=i.data;if(e*this.stride>=s.length)throw new Error(n);const a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),o=i.within(s[e*this.stride],s[e*this.stride+1],a),l=[];for(const e of o){const r=e*this.stride;s[r+4]===t&&l.push(s[r+Zc]>1?Kc(s,r,this.clusterProps):this.points[s[r+Nc]])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,r){const n=[];return this._appendLeaves(n,t,e=e||10,r=r||0,0),n}getTile(t,e,r){const n=this.trees[this._limitZoom(t)],i=Math.pow(2,t),{extent:s,radius:a}=this.options,o=a/s,l=(r-o)/i,u=(r+1+o)/i,c={features:[]};return this._addTileFeatures(n.range((e-o)/i,l,(e+1+o)/i,u),n.data,e,r,i,c),0===e&&this._addTileFeatures(n.range(1-o/i,l,1,u),n.data,i,r,i,c),e===i-1&&this._addTileFeatures(n.range(0,l,o/i,u),n.data,-1,r,i,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,n,i){const s=this.getChildren(e);for(const e of s){const s=e.properties;if(s&&s.cluster?i+s.point_count<=n?i+=s.point_count:i=this._appendLeaves(t,s.cluster_id,r,n,i):i<n?i++:t.push(e),t.length===r)break}return i}_createTree(t){const e=new Tc(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<t.length;r+=this.stride)e.add(t[r],t[r+1]);return e.finish(),e.data=t,e}_addTileFeatures(t,e,r,n,i,s){for(const a of t){const t=a*this.stride,o=e[t+Zc]>1;let l,u,c;if(o)l=Xc(e,t,this.clusterProps),u=e[t],c=e[t+1];else{const r=this.points[e[t+Nc]];l=r.properties;const[n,i]=r.geometry.coordinates;u=Yc(n),c=Hc(i)}const h={type:1,geometry:[[Math.round(this.options.extent*(u*i-r)),Math.round(this.options.extent*(c*i-n))]],tags:l};let p;p=o||this.options.generateId?e[t+Nc]:this.points[e[t+Nc]].id,void 0!==p&&(h.id=p),s.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:r,extent:n,reduce:i,minPoints:s}=this.options,a=r/(n*Math.pow(2,e)),o=t.data,l=[],u=this.stride;for(let r=0;r<o.length;r+=u){if(o[r+2]<=e)continue;o[r+2]=e;const n=o[r],c=o[r+1],h=t.within(o[r],o[r+1],a),p=o[r+Zc];let f=p;for(const t of h){const r=t*u;o[r+2]>e&&(f+=o[r+Zc])}if(f>p&&f>=s){let t,s=n*p,a=c*p,d=-1;const y=((r/u|0)<<5)+(e+1)+this.points.length;for(const n of h){const l=n*u;if(o[l+2]<=e)continue;o[l+2]=e;const c=o[l+Zc];s+=o[l]*c,a+=o[l+1]*c,o[l+4]=y,i&&(t||(t=this._map(o,r,!0),d=this.clusterProps.length,this.clusterProps.push(t)),i(t,this._map(o,l)))}o[r+4]=y,l.push(s/f,a/f,1/0,y,-1,f),i&&l.push(d)}else{for(let t=0;t<u;t++)l.push(o[r+t]);if(f>1)for(const t of h){const r=t*u;if(!(o[r+2]<=e)){o[r+2]=e;for(let t=0;t<u;t++)l.push(o[r+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,r){if(t[e+Zc]>1){const n=this.clusterProps[t[e+Gc]];return r?Object.assign({},n):n}const n=this.points[t[e+Nc]].properties,i=this.options.map(n);return r&&i===n?Object.assign({},i):i}}function Kc(t,e,r){return{type:"Feature",id:t[e+Nc],properties:Xc(t,e,r),geometry:{type:"Point",coordinates:[(n=t[e],360*(n-.5)),Wc(t[e+1])]}};var n}function Xc(t,e,r){const n=t[e+Zc],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,s=t[e+Gc],a=-1===s?{}:Object.assign({},r[s]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Nc],point_count:n,point_count_abbreviated:i})}function Yc(t){return t/360+.5}function Hc(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Wc(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Qc(t,e,r,n){for(var i,s=n,a=r-e>>1,o=r-e,l=t[e],u=t[e+1],c=t[r],h=t[r+1],p=e+3;p<r;p+=3){var f=th(t[p],t[p+1],l,u,c,h);if(f>s)i=p,s=f;else if(f===s){var d=Math.abs(p-a);d<o&&(i=p,o=d)}}s>n&&(i-e>3&&Qc(t,e,i,n),t[i+2]=s,r-i>3&&Qc(t,i,r,n))}function th(t,e,r,n,i,s){var a=i-r,o=s-n;if(0!==a||0!==o){var l=((t-r)*a+(e-n)*o)/(a*a+o*o);l>1?(r=i,n=s):l>0&&(r+=a*l,n+=o*l)}return(a=t-r)*a+(o=e-n)*o}function eh(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)rh(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<e.length;n++)rh(t,e[n]);else if("MultiPolygon"===r)for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)rh(t,e[n][i])}(i),i}function rh(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function nh(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,s=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),o=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),"Point"===s)ih(i,o);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)ih(i[u],o);else if("LineString"===s)sh(i,o,a,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(u=0;u<i.length;u++)sh(i[u],o=[],a,!1),t.push(eh(l,"LineString",o,e.properties));return}ah(i,o,a,!1)}else if("Polygon"===s)ah(i,o,a,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<e.geometry.geometries.length;u++)nh(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<i.length;u++){var c=[];ah(i[u],c,a,!0),o.push(c)}}t.push(eh(l,s,o,e.properties))}}function ih(t,e){e.push(oh(t[0])),e.push(lh(t[1])),e.push(0)}function sh(t,e,r,n){for(var i,s,a=0,o=0;o<t.length;o++){var l=oh(t[o][0]),u=lh(t[o][1]);e.push(l),e.push(u),e.push(0),o>0&&(a+=n?(i*u-l*s)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-s,2))),i=l,s=u}var c=e.length-3;e[2]=1,Qc(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function ah(t,e,r,n){for(var i=0;i<t.length;i++){var s=[];sh(t[i],s,r,n),e.push(s)}}function oh(t){return t/360+.5}function lh(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function uh(t,e,r,n,i,s,a,o){if(n/=e,s>=(r/=e)&&a<n)return t;if(a<r||s>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,f=0===i?c.minX:c.minY,d=0===i?c.maxX:c.maxY;if(f>=r&&d<n)l.push(c);else if(!(d<r||f>=n)){var y=[];if("Point"===p||"MultiPoint"===p)ch(h,y,r,n,i);else if("LineString"===p)hh(h,y,r,n,i,!1,o.lineMetrics);else if("MultiLineString"===p)fh(h,y,r,n,i,!1);else if("Polygon"===p)fh(h,y,r,n,i,!0);else if("MultiPolygon"===p)for(var m=0;m<h.length;m++){var g=[];fh(h[m],g,r,n,i,!0),g.length&&y.push(g)}if(y.length){if(o.lineMetrics&&"LineString"===p){for(m=0;m<y.length;m++)l.push(eh(c.id,p,y[m],c.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===y.length?(p="LineString",y=y[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===y.length?"Point":"MultiPoint"),l.push(eh(c.id,p,y,c.tags))}}}return l.length?l:null}function ch(t,e,r,n,i){for(var s=0;s<t.length;s+=3){var a=t[s+i];a>=r&&a<=n&&(e.push(t[s]),e.push(t[s+1]),e.push(t[s+2]))}}function hh(t,e,r,n,i,s,a){for(var o,l,u=ph(t),c=0===i?yh:mh,h=t.start,p=0;p<t.length-3;p+=3){var f=t[p],d=t[p+1],y=t[p+2],m=t[p+3],g=t[p+4],x=0===i?f:d,v=0===i?m:g,b=!1;a&&(o=Math.sqrt(Math.pow(f-m,2)+Math.pow(d-g,2))),x<r?v>r&&(l=c(u,f,d,m,g,r),a&&(u.start=h+o*l)):x>n?v<n&&(l=c(u,f,d,m,g,n),a&&(u.start=h+o*l)):dh(u,f,d,y),v<r&&x>=r&&(l=c(u,f,d,m,g,r),b=!0),v>n&&x<=n&&(l=c(u,f,d,m,g,n),b=!0),!s&&b&&(a&&(u.end=h+o*l),e.push(u),u=ph(t)),a&&(h+=o)}var w=t.length-3;f=t[w],d=t[w+1],y=t[w+2],(x=0===i?f:d)>=r&&x<=n&&dh(u,f,d,y),w=u.length-3,s&&w>=3&&(u[w]!==u[0]||u[w+1]!==u[1])&&dh(u,u[0],u[1],u[2]),u.length&&e.push(u)}function ph(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function fh(t,e,r,n,i,s){for(var a=0;a<t.length;a++)hh(t[a],e,r,n,i,s,!1)}function dh(t,e,r,n){t.push(e),t.push(r),t.push(n)}function yh(t,e,r,n,i,s){var a=(s-e)/(n-e);return t.push(s),t.push(r+(i-r)*a),t.push(1),a}function mh(t,e,r,n,i,s){var a=(s-r)/(i-r);return t.push(e+(n-e)*a),t.push(s),t.push(1),a}function gh(t,e){for(var r=[],n=0;n<t.length;n++){var i,s=t[n],a=s.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)i=xh(s.geometry,e);else if("MultiLineString"===a||"Polygon"===a){i=[];for(var o=0;o<s.geometry.length;o++)i.push(xh(s.geometry[o],e))}else if("MultiPolygon"===a)for(i=[],o=0;o<s.geometry.length;o++){for(var l=[],u=0;u<s.geometry[o].length;u++)l.push(xh(s.geometry[o][u],e));i.push(l)}r.push(eh(s.id,a,i,s.tags))}return r}function xh(t,e){var r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function vh(t,e){if(t.transformed)return t;var r,n,i,s=1<<t.z,a=t.x,o=t.y;for(r=0;r<t.features.length;r++){var l=t.features[r],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(bh(u[n],u[n+1],e,s,a,o));else for(n=0;n<u.length;n++){var h=[];for(i=0;i<u[n].length;i+=2)h.push(bh(u[n][i],u[n][i+1],e,s,a,o));l.geometry.push(h)}}return t.transformed=!0,t}function bh(t,e,r,n,i,s){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-s))]}function wh(t,e,r,n,i){for(var s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},o=0;o<t.length;o++){a.numFeatures++,_h(a,t[o],s,i);var l=t[o].minX,u=t[o].minY,c=t[o].maxX,h=t[o].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function _h(t,e,r,n){var i=e.geometry,s=e.type,a=[];if("Point"===s||"MultiPoint"===s)for(var o=0;o<i.length;o+=3)a.push(i[o]),a.push(i[o+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)Sh(a,i,t,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(o=0;o<i.length;o++)Sh(a,i[o],t,r,"Polygon"===s,0===o);else if("MultiPolygon"===s)for(var l=0;l<i.length;l++){var u=i[l];for(o=0;o<u.length;o++)Sh(a,u[o],t,r,!0,0===o)}if(a.length){var c=e.tags||null;if("LineString"===s&&n.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var p={geometry:a,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function Sh(t,e,r,n,i,s){var a=n*n;if(n>0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var o=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>a)&&(r.numSimplified++,o.push(e[l]),o.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,s=i-2;n<i;s=n,n+=2)r+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var a=t[n],o=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=o}}(o,s),t.push(o)}}function kh(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)nh(r,t.features[n],e,n);else nh(r,"Feature"===t.type?t:{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=function(t,e){var r=e.buffer/e.extent,n=t,i=uh(t,1,-1-r,r,0,-1,2,e),s=uh(t,1,1-r,2+r,0,-1,2,e);return(i||s)&&(n=uh(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=gh(i,1).concat(n)),s&&(n=n.concat(gh(s,-1)))),n}(n,e),n.length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Ah(t,e,r){return 32*((1<<t)*r+e)+t}function Ih(t,e){return e?t.properties[e]:t.id}function zh(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=Ih(t,e);if("FeatureCollection"===t.type){const r=new Set;for(const n of t.features){const t=Ih(n,e);if(null==t)return!1;if(r.has(t))return!1;r.add(t)}return!0}return!1}function Mh(t,e){const r=new Map;if(null==t);else if("Feature"===t.type)r.set(Ih(t,e),t);else for(const n of t.features)r.set(Ih(n,e),n);return r}function Ph(t,e){const r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);const i=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!i)return e(null,null);const s=new class{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=bs,this.length=t.length,this._features=t}feature(t){return new class{constructor(t){this._feature=t,this.extent=bs,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const e of this._feature.geometry)t.push([new n(e[0],e[1])]);return t}{const t=[];for(const e of this._feature.geometry){const r=[];for(const t of e)r.push(new n(t[0],t[1]));t.push(r)}return t}}toGeoJSON(t,e,r){return mc.call(this,t,e,r)}}(this._features[t])}}(i.features);let a=Ec(s);0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),e(null,{vectorTile:s,rawData:a.buffer})}kh.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},kh.prototype.splitTile=function(t,e,r,n,i,s,a){for(var o=[t,e,r,n],l=this.options,u=l.debug;o.length;){n=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();var c=1<<e,h=Ah(e,r,n),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=wh(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<<i-e;if(r!==Math.floor(s/d)||n!==Math.floor(a/d))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){u>1&&console.time("clipping");var y,m,g,x,v,b,w=.5*l.buffer/l.extent,_=.5-w,S=.5+w,k=1+w;y=m=g=x=null,v=uh(t,c,r-w,r+S,0,p.minX,p.maxX,l),b=uh(t,c,r+_,r+k,0,p.minX,p.maxX,l),t=null,v&&(y=uh(v,c,n-w,n+S,1,p.minY,p.maxY,l),m=uh(v,c,n+_,n+k,1,p.minY,p.maxY,l),v=null),b&&(g=uh(b,c,n-w,n+S,1,p.minY,p.maxY,l),x=uh(b,c,n+_,n+k,1,p.minY,p.maxY,l),b=null),u>1&&console.timeEnd("clipping"),o.push(y||[],e+1,2*r,2*n),o.push(m||[],e+1,2*r,2*n+1),o.push(g||[],e+1,2*r+1,2*n),o.push(x||[],e+1,2*r+1,2*n+1)}}},kh.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,s=n.debug;if(t<0||t>24)return null;var a=1<<t,o=Ah(t,e=(e%a+a)%a,r);if(this.tiles[o])return vh(this.tiles[o],i);s>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Ah(u,c,h)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,c,h),s>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,r),s>1&&console.timeEnd("drilling down"),this.tiles[o]?vh(this.tiles[o],i):null):null};class Ch extends cc{constructor(t,e,r,n){super(t,e,r,Ph),this._dataUpdateable=new Map,this.loadGeoJSON=(t,e)=>{const{promoteId:r}=t;if(t.request)return function(t,e){return Hr(c(t,{type:"json"}),e)}(t.request,((t,n,i,s)=>{this._dataUpdateable=zh(n,r)?Mh(n,r):void 0,e(t,n,i,s)}));if("string"==typeof t.data)try{const n=JSON.parse(t.data);this._dataUpdateable=zh(n,r)?Mh(n,r):void 0,e(null,n)}catch(r){e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}else t.dataDiff?this._dataUpdateable?(function(t,e,r){var n,i,s,a;if(e.removeAll&&t.clear(),e.remove)for(const r of e.remove)t.delete(r);if(e.add)for(const n of e.add){const e=Ih(n,r);null!=e&&t.set(e,n)}if(e.update)for(const r of e.update){let e=t.get(r.id);if(null==e)continue;const o=!r.removeAllProperties&&((null===(n=r.removeProperties)||void 0===n?void 0:n.length)>0||(null===(i=r.addOrUpdateProperties)||void 0===i?void 0:i.length)>0);if((r.newGeometry||r.removeAllProperties||o)&&(e={...e},t.set(r.id,e),o&&(e.properties={...e.properties})),r.newGeometry&&(e.geometry=r.newGeometry),r.removeAllProperties)e.properties={};else if((null===(s=r.removeProperties)||void 0===s?void 0:s.length)>0)for(const t of r.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(a=r.addOrUpdateProperties)||void 0===a?void 0:a.length)>0)for(const{key:t,value:n}of r.addOrUpdateProperties)e.properties[t]=n}}(this._dataUpdateable,t.dataDiff,r),e(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):e(new Error(`Cannot update existing geojson data in ${t.source}`)):e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},n&&(this.loadGeoJSON=n)}loadData(t,e){var r;null===(r=this._pendingRequest)||void 0===r||r.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const n=!!(t&&t.request&&t.request.collectResourceTiming)&&new lc(t.request);this._pendingCallback=e,this._pendingRequest=this.loadGeoJSON(t,((r,i)=>{if(delete this._pendingCallback,delete this._pendingRequest,r||!i)return e(r);if("object"!=typeof i)return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{yc(i,!0);try{if(t.filter){const e=er(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const r=i.features.filter((t=>e.value.evaluate({zoom:0},t)));i={type:"FeatureCollection",features:r}}this._geoJSONIndex=t.cluster?new Jc(function({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;const r={},n={},i={accumulated:null,zoom:0},s={properties:null},a=Object.keys(e);for(const t of a){const[i,s]=e[t],a=er(s),o=er("string"==typeof i?[i,["accumulated"],["get",t]]:i);r[t]=a.value,n[t]=o.value}return t.map=t=>{s.properties=t;const e={};for(const t of a)e[t]=r[t].evaluate(i,s);return e},t.reduce=(t,e)=>{s.properties=e;for(const e of a)i.accumulated=t[e],t[e]=n[e].evaluate(i,s)},t}(t)).load(i.features):function(t,e){return new kh(t,e)}(i,t.geojsonVtOptions)}catch(r){return e(r)}this.loaded={};const s={};if(n){const e=n.finish();e&&(s.resourceTiming={},s.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}e(null,s)}}))}reloadTile(t,e){const r=this.loaded;return r&&r[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class Bh{constructor(t){this.self=t,this.actor=new sn(t,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:cc,geojson:Ch},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=t=>{if(In.isParsed())throw new Error("RTL text plugin already registered.");In.applyArabicShaping=t.applyArabicShaping,In.processBidirectionalText=t.processBidirectionalText,In.processStyledBidirectionalText=t.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,r){this.availableImages[t]=e;for(const r in this.workerSources[t]){const n=this.workerSources[t][r];for(const t in n)n[t].availableImages=e}r()}setLayers(t,e,r){this.getLayerIndex(t).replace(e),r()}updateLayers(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()}loadTile(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)}loadDEMTile(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)}reloadTile(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)}abortTile(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)}removeTile(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,r){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}loadWorkerSource(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}}syncRTLPluginState(t,e,r){try{In.setState(e);const t=In.getPluginURL();if(In.isLoaded()&&!In.isParsed()&&null!=t){this.self.importScripts(t);const e=In.isParsed();r(e?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),e)}}catch(t){r(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new uu),e}getWorkerSource(t,e,r){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){const n={send:(e,r,n)=>{this.actor.send(e,r,n,t)}};this.workerSources[t][e][r]=new this.workerSourceTypes[e](n,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][e][r]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new pc),this.demWorkerSources[t][e]}}return g()&&(self.worker=new Bh(self)),Bh}();
|
|
2
2
|
//# sourceMappingURL=maplibre-gl-csp-worker.js.map
|