7 lines
447 KiB
JavaScript
7 lines
447 KiB
JavaScript
/**
|
||
* MapLibre GL JS
|
||
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.24.0/LICENSE.txt
|
||
*/
|
||
var maplibregl=function(){"use strict";function t(t,e,r,n){return new(r||(r=Promise))((function(i,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))}function e(t,e){this.x=t,this.y=e}function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var n,i;"function"==typeof SuppressedError&&SuppressedError,e.prototype={clone(){return new e(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){const e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){const 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(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){const t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){const 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(t,e){const 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(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:e},e.convert=function(t){if(t instanceof e)return t;if(Array.isArray(t))return new e(+t[0],+t[1]);if(void 0!==t.x&&void 0!==t.y)return new e(+t.x,+t.y);throw new Error("Expected [x, y] or {x, y} point format")};var s=function(){if(i)return n;function t(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}return i=1,n=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var 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 o=0,a=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?o=r:a=r,r=.5*(a-o)+o;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},n}(),o=r(s);let a,l;var u,c="undefined"!=typeof Float32Array?Float32Array:Array;function h(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*o,t}u=new c(4),c!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0,u[3]=0);const p=8192;function f(t){return t instanceof Error?t:new Error("string"==typeof t?t:String(t))}function d(t,e,r){return Math.min(r,Math.max(e,t))}function y(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}function m(t,e,r){const n={};for(const r in t)n[r]=e.call(this,t[r],r,t);return n}function g(t){return Array.isArray(t)?t.map(g):"object"==typeof t&&t?m(t,g):t}new o(.25,.1,.25,1);const x={};function v(t){x[t]||("undefined"!=typeof console&&console.warn(t),x[t]=!0)}function b(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function w(t){return"undefined"!=typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}function _(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}let S,A;function I(t,e,r,n){return t.addEventListener(e,r,n),{unsubscribe:()=>{t.removeEventListener(e,r,n)}}}function k(t){return t*Math.PI/180}class T{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,o=this.max;if(t<=s&&e<=s&&o<=r&&o<=n&&!i)return[...this.keys];{const s=[];return this._forEachCell(t,e,r,n,this._queryCell,s,{},i),s}}_queryCell(t,e,r,n,i,s,o,a){const l=this.cells[i];if(null!==l){const i=this.keys,u=this.bboxes;for(const c of l)if(void 0===o[c]){const l=4*c;(a?a(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])?(o[c]=!0,s.push(i[c])):o[c]=!1}}}_forEachCell(t,e,r,n,i,s,o,a){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((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,t,e,r,n,u,s,o,a))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(const t of this.cells)r+=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 T(t.buffer)}}var E={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const M=["type","source","source-layer","minzoom","maxzoom","filter","layout"];class P{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function D(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}class F extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class z{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new z(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 B={kind:"null"},C={kind:"number"},V={kind:"string"},L={kind:"boolean"},O={kind:"color"},$={kind:"projectionDefinition"},R={kind:"object"},N={kind:"value"},U={kind:"collator"},q={kind:"formatted"},j={kind:"padding"},G={kind:"colorArray"},X={kind:"numberArray"},Y={kind:"resolvedImage"},Z={kind:"variableAnchorOffsetCollection"};function W(t,e){return{kind:"array",itemType:t,N:e}}function H(t){if("array"===t.kind){const e=H(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const J=[B,C,V,L,O,$,q,R,W(N),j,X,G,Y,Z];function K(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!K(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 J)if(!K(t,e))return null}return`Expected ${H(t)} but found ${H(e)} instead.`}function Q(t,e){return e.some((e=>e.kind===t.kind))}function tt(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 et(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const rt=.96422,nt=.82521,it=4/29,st=6/29,ot=3*st*st,at=st*st*st,lt=Math.PI/180,ut=180/Math.PI;function ct(t){return(t%=360)<0&&(t+=360),t}function ht([t,e,r,n]){let i,s;const o=ft((.2225045*(t=pt(t))+.7168786*(e=pt(e))+.0606169*(r=pt(r)))/1);t===e&&e===r?i=s=o:(i=ft((.4360747*t+.3850649*e+.1430804*r)/rt),s=ft((.0139322*t+.0971045*e+.7141733*r)/nt));const a=116*o-16;return[a<0?0:a,500*(i-o),200*(o-s),n]}function pt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ft(t){return t>at?Math.pow(t,1/3):t/ot+it}function dt([t,e,r,n]){let i=(t+16)/116,s=isNaN(e)?i:i+e/500,o=isNaN(r)?i:i-r/200;return i=1*mt(i),s=rt*mt(s),o=nt*mt(o),[yt(3.1338561*s-1.6168667*i-.4906146*o),yt(-.9787684*s+1.9161415*i+.033454*o),yt(.0719453*s-.2289914*i+1.4052427*o),n]}function yt(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function mt(t){return t>st?t*t*t:ot*(t-it)}const gt=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function xt(t,e){return gt(t,e)?t[e]:void 0}function vt(t){return parseInt(t.padEnd(2,t),16)/255}function bt(t,e){return wt(e?t/100:t,0,1)}function wt(t,e,r){return Math.min(Math.max(e,t),r)}function _t(t){return!t.some(Number.isNaN)}const St={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function At(t,e,r){return t+r*(e-t)}function It(t,e,r){return t.map(((t,n)=>At(t,e[n],r)))}class kt{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 kt)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=xt(St,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[vt(t.slice(r,r+=e)),vt(t.slice(r,r+=e)),vt(t.slice(r,r+=e)),vt(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,o,a,l,u,c,h,p]=e,f=[i||" ",a||" ",c].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){const t=[n,o,u].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[wt(+r/e,0,1),wt(+s/e,0,1),wt(+l/e,0,1),h?bt(+h,p):1];if(_t(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,o,a,l,u]=r,c=[n||" ",s||" ",a].join("");if(" "===c||" /"===c||",,"===c||",,,"===c){const t=[+e,wt(+i,0,100),wt(+o,0,100),l?bt(+l,u):1];if(_t(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=ct(t),e/=100,r/=100,[i(0),i(8),i(4),n]}(t)}}}(t);return e?new kt(...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]=ht(t),s=Math.sqrt(r*r+n*n);return[Math.round(1e4*s)?ct(Math.atan2(n,r)*ut):NaN,s,e,i]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ht(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})`}static interpolate(t,e,r,n="rgb"){switch(n){case"rgb":{const[n,i,s,o]=It(t.rgb,e.rgb,r);return new kt(n,i,s,o,!1)}case"hcl":{const[n,i,s,o]=t.hcl,[a,l,u,c]=e.hcl;let h,p;if(isNaN(n)||isNaN(a))isNaN(n)?isNaN(a)?h=NaN:(h=a,1!==s&&0!==s||(p=l)):(h=n,1!==u&&0!==u||(p=i));else{let t=a-n;a>n&&t>180?t-=360:a<n&&n-a>180&&(t+=360),h=n+r*t}const[f,d,y,m]=function([t,e,r,n]){return t=isNaN(t)?0:t*lt,dt([r,Math.cos(t)*e,Math.sin(t)*e,n])}([h,null!=p?p:At(i,l,r),At(s,u,r),At(o,c,r)]);return new kt(f,d,y,m,!1)}case"lab":{const[n,i,s,o]=dt(It(t.lab,e.lab,r));return new kt(n,i,s,o,!1)}}}}kt.black=new kt(0,0,0,1),kt.white=new kt(1,1,1,1),kt.transparent=new kt(0,0,0,0),kt.red=new kt(1,0,0,1);class Tt{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}}const Et=["bottom","center","top"];class Mt{constructor(t,e,r,n,i,s){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i,this.verticalAlign=s}}class Pt{constructor(t){this.sections=t}static fromString(t){return new Pt([new Mt(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Pt?t:Pt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class Dt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Dt)return t;if("number"==typeof t)return new Dt([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 Dt(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){return new Dt(It(t.values,e.values,r))}}class Ft{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ft)return t;if("number"==typeof t)return new Ft([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new Ft(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){return new Ft(It(t.values,e.values,r))}}class zt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof zt)return t;if("string"==typeof t){const e=kt.parse(t);if(!e)return;return new zt([e])}if(!Array.isArray(t))return;const e=[];for(const r of t){if("string"!=typeof r)return;const t=kt.parse(r);if(!t)return;e.push(t)}return new zt(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r,n="rgb"){const i=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)i.push(kt.interpolate(t.values[s],e.values[s],r,n));return new zt(i)}}class Bt extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const Ct=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Vt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Vt)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||!Ct.has(r))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new Vt(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){const n=t.values,i=e.values;if(n.length!==i.length)throw new Bt(`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 Bt(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${n[t]}, to[${t}]: ${i[t]}`);s.push(n[t]);const[e,o]=n[t+1],[a,l]=i[t+1];s.push([At(e,a,r),At(o,l,r)])}return new Vt(s)}}class Lt{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Lt({name:t,available:!1}):null}}class Ot{constructor(t,e,r){this.from=t,this.to=e,this.transition=r}static interpolate(t,e,r){return new Ot(t,e,r)}static parse(t){return t instanceof Ot?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new Ot(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new Ot(t.from,t.to,t.transition):"string"==typeof t?new Ot(t,t,1):void 0}}function $t(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 Rt(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Ot||t instanceof kt||t instanceof Tt||t instanceof Pt||t instanceof Dt||t instanceof Ft||t instanceof zt||t instanceof Vt||t instanceof Lt)return!0;if(Array.isArray(t)){for(const e of t)if(!Rt(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Rt(t[e]))return!1;return!0}return!1}function Nt(t){if(null===t)return B;if("string"==typeof t)return V;if("boolean"==typeof t)return L;if("number"==typeof t)return C;if(t instanceof kt)return O;if(t instanceof Ot)return $;if(t instanceof Tt)return U;if(t instanceof Pt)return q;if(t instanceof Dt)return j;if(t instanceof Ft)return X;if(t instanceof zt)return G;if(t instanceof Vt)return Z;if(t instanceof Lt)return Y;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=Nt(e);if(r){if(r===t)continue;r=N;break}r=t}return W(r||N,e)}return R}function Ut(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof kt||t instanceof Ot||t instanceof Pt||t instanceof Dt||t instanceof Ft||t instanceof zt||t instanceof Vt||t instanceof Lt?t.toString():JSON.stringify(t)}class qt{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(!Rt(t[1]))return e.error("invalid value");const r=t[1];let n=Nt(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 qt(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const jt={string:V,number:C,boolean:L,object:R};class Gt{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 jt)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=jt[r],n++}else i=N;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=W(i,s)}else{if(!jt[i])throw new Error(`Types doesn't contain name = ${i}`);r=jt[i]}const s=[];for(;n<t.length;n++){const r=e.parse(t[n],n,N);if(!r)return null;s.push(r)}return new Gt(r,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!K(this.type,Nt(r)))return r;if(e===this.args.length-1)throw new Bt(`Expected value to be of type ${H(this.type)}, but found ${H(Nt(r))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Xt={"to-boolean":L,"to-color":O,"to-number":C,"to-string":V};class Yt{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(!Xt[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=Xt[r],i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],r,N);if(!n)return null;i.push(n)}return new Yt(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 kt)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 rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:$t(e[0],e[1],e[2],e[3]),!r))return new kt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Bt(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=Dt.parse(e);if(n)return n}throw new Bt(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const r of this.args){e=r.evaluate(t);const n=Ft.parse(e);if(n)return n}throw new Bt(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const r of this.args){e=r.evaluate(t);const n=zt.parse(e);if(n)return n}throw new Bt(`Could not parse colorArray 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=Vt.parse(e);if(n)return n}throw new Bt(`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 Bt(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return Pt.fromString(Ut(this.args[0].evaluate(t)));case"resolvedImage":return Lt.fromString(Ut(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Ut(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Zt=["Unknown","Point","LineString","Polygon"];class Wt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Zt[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.get(t);return e||(e=kt.parse(t),this._parseColorCache.set(t,e)),e}}class Ht{constructor(t,e,r=[],n,i=new z,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 Gt(e,[t]):"coerce"===r?new Yt(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("projectionDefinition"===t.kind&&["string","array"].includes(i.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(i.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(i.kind)||"colorArray"===t.kind&&["value","string","array"].includes(i.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(i.kind))n=r(n,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,i))return null}else n=r(n,t,e.typeAnnotation||"assert")}if(!(n instanceof qt)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const t=new Wt;try{n=new qt(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 Ht(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 F(r,t))}checkSubtype(t,e){const r=K(t,e);return r&&this.error(r),r}}class Jt{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 Jt(r,n):null}outputDefined(){return this.result.outputDefined()}}class Kt{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 Kt(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 Qt{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,C),n=e.parse(t[2],2,W(e.expectedType||N));return r&&n?new Qt(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new Bt(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new Bt(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new Bt(`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 te{constructor(t,e){this.type=L,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,N),n=e.parse(t[2],2,N);return r&&n?Q(r.type,[L,V,C,B,N])?new te(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${H(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!tt(e,["boolean","string","number","null"]))throw new Bt(`Expected first argument to be of type boolean, string, number or null, but found ${H(Nt(e))} instead.`);if(!tt(r,["string","array"]))throw new Bt(`Expected second argument to be of type array or string, but found ${H(Nt(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class ee{constructor(t,e,r){this.type=C,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,N),n=e.parse(t[2],2,N);if(!r||!n)return null;if(!Q(r.type,[L,V,C,B,N]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${H(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,C);return i?new ee(r,n,i):null}return new ee(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!tt(e,["boolean","string","number","null"]))throw new Bt(`Expected first argument to be of type boolean, string, number or null, but found ${H(Nt(e))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),tt(r,["string"])){const t=r.indexOf(e,n);return-1===t?-1:[...r.slice(0,t)].length}if(tt(r,["array"]))return r.indexOf(e,n);throw new Bt(`Expected second argument to be of type array or string, but found ${H(Nt(r))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class re{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 o=2;o<t.length-1;o+=2){let a=t[o];const l=t[o+1];Array.isArray(a)||(a=[a]);const u=e.concat(o);if(0===a.length)return u.error("Expected at least one branch label.");for(const t of a){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,Nt(t)))return null}else r=Nt(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,o,n);if(!c)return null;n=n||c.type,s.push(c)}const o=e.parse(t[1],1,N);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(r,o.type)?null:new re(r,n,o,i,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(Nt(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 ne{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,L);if(!s)return null;const o=e.parse(t[i+1],i+1,r);if(!o)return null;n.push([s,o]),r=r||o.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 ne(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 ie{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 2 or 3 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,N),n=e.parse(t[2],2,C);if(!r||!n)return null;if(!Q(r.type,[W(N),V,N]))return e.error(`Expected first argument to be of type array or string, but found ${H(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,C);return i?new ie(r.type,r,n,i):null}return new ie(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);let n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),tt(e,["string"]))return[...e].slice(r,n).join("");if(tt(e,["array"]))return e.slice(r,n);throw new Bt(`Expected first argument to be of type array or string, but found ${H(Nt(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function se(t,e){const r=t.length-1;let n,i,s=0,o=r,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],i=t[a+1],n<=e){if(a===r||e<i)return a;s=a+1}else{if(!(n>e))throw new Bt("Input is not a number.");o=a-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,C);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],o=t[r+1],a=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.',a);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.',a);const u=e.parse(o,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[se(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 ae(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var le,ue,ce=function(){if(ue)return le;function t(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}return ue=1,le=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var 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 o=0,a=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?o=r:a=r,r=.5*(a-o)+o;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},le}(),he=ae(ce);class pe{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=fe(e,t.base,r,n);else if("linear"===t.name)i=fe(e,1,r,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;i=new he(s[0],s[1],s[2],s[3]).solve(fe(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,C),!i)return null;const o=[];let a=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||e.expectedType==G?e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType):a=O;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(o.length&&o[o.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,a);if(!u)return null;a=a||u.type,o.push([r,u])}return et(a,C)||et(a,$)||et(a,O)||et(a,j)||et(a,X)||et(a,G)||et(a,Z)||et(a,W(C))?new pe(a,r,n,i,o):e.error(`Type ${H(a)} 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=se(e,n),o=pe.interpolationFactor(this.interpolation,n,e[s],e[s+1]),a=r[s].evaluate(t),l=r[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return At(a,l,o);case"color":return kt.interpolate(a,l,o);case"padding":return Dt.interpolate(a,l,o);case"colorArray":return zt.interpolate(a,l,o);case"numberArray":return Ft.interpolate(a,l,o);case"variableAnchorOffsetCollection":return Vt.interpolate(a,l,o);case"array":return It(a,l,o);case"projectionDefinition":return Ot.interpolate(a,l,o)}case"interpolate-hcl":switch(this.type.kind){case"color":return kt.interpolate(a,l,o,"hcl");case"colorArray":return zt.interpolate(a,l,o,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return kt.interpolate(a,l,o,"lab");case"colorArray":return zt.interpolate(a,l,o,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function fe(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)}const de={color:kt.interpolate,number:At,padding:Dt.interpolate,numberArray:Ft.interpolate,colorArray:zt.interpolate,variableAnchorOffsetCollection:Vt.interpolate,array:It};class ye{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=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=>K(n,t.type)));return new ye(s?N: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 Lt&&!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()))}}function me(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 ge(t,e,r,n){return 0===n.compare(e,r)}function xe(t,e,r){const n="=="!==t&&"!="!==t;return class i{constructor(t,e,r){this.type=L,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,N);if(!s)return null;if(!me(r,s.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${H(s.type)}'.`);let o=e.parse(t[2],2,N);if(!o)return null;if(!me(r,o.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${H(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${H(s.type)}' and '${H(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Gt(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Gt(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,U),!a)return null}return new i(s,o,a)}evaluate(i){const s=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=Nt(s),r=Nt(o);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new Bt(`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=Nt(s),r=Nt(o);if("string"!==t.kind||"string"!==r.kind)return e(i,s,o)}return this.collator?r(i,s,o,this.collator.evaluate(i)):e(i,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const ve=xe("==",(function(t,e,r){return e===r}),ge),be=xe("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!ge(0,e,r,n)})),we=xe("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),_e=xe(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),Se=xe("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Ae=xe(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class Ie{constructor(t,e,r){this.type=U,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,L);if(!n)return null;const i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,L);if(!i)return null;let s=null;return r.locale&&(s=e.parse(r.locale,1,V),!s)?null:new Ie(n,i,s)}evaluate(t){return new Tt(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class ke{constructor(t,e,r,n,i,s){this.type=V,this.number=t,this.locale=e,this.currency=r,this.unit=n,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,C);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 o=null;if(n.unit&&(o=e.parse(n.unit,1,V),!o))return null;if(s&&o)return e.error("NumberFormat options `currency` and `unit` are mutually exclusive");let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,C),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,C),!l)?null:new ke(r,i,s,o,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.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.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Te{constructor(t){this.type=q,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,C),!t))return null;let r=null;if(s["text-font"]&&(r=e.parse(s["text-font"],1,W(V)),!r))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,O),!o))return null;let a=null;if(s["vertical-align"]){if("string"==typeof s["vertical-align"]&&!Et.includes(s["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(a=e.parse(s["vertical-align"],1,V),!a)return null}const l=n[n.length-1];l.scale=t,l.font=r,l.textColor=o,l.verticalAlign=a}else{const s=e.parse(t[r],1,N);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Te(n)}evaluate(t){return new Pt(this.sections.map((e=>{const r=e.content.evaluate(t);return Nt(r)===Y?new Mt("",r,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new Mt(Ut(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class Ee{constructor(t){this.type=Y,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 Ee(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=Lt.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}}class Me{constructor(t){this.type=C,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 ${H(r.type)} instead.`):new Me(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 Bt(`Expected value to be of type string or array, but found ${H(Nt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Pe=8192;function De(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*Pe),Math.round(n*i*Pe)]}function Fe(t,e){const r=Math.pow(2,e.z);return[(i=(t[0]/Pe+e.x)/r,360*i-180),(n=(t[1]/Pe+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90)];var n,i}function ze(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 Be(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Ce(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],o=t[1]-r[1];return n*o-s*i==0&&n*s<=0&&i*o<=0}function Ve(t,e,r,n){return 0!=(i=[n[0]-r[0],n[1]-r[1]])[0]*(s=[e[0]-t[0],e[1]-t[1]])[1]-i[1]*s[0]&&!(!Ue(t,e,r,n)||!Ue(r,n,t,e));var i,s}function Le(t,e,r){for(const n of r)for(let r=0;r<n.length-1;++r)if(Ve(t,e,n[r],n[r+1]))return!0;return!1}function Oe(t,e,r=!1){let n=!1;for(const a of e)for(let e=0;e<a.length-1;e++){if(Ce(t,a[e],a[e+1]))return r;(s=a[e])[1]>(i=t)[1]!=(o=a[e+1])[1]>i[1]&&i[0]<(o[0]-s[0])*(i[1]-s[1])/(o[1]-s[1])+s[0]&&(n=!n)}var i,s,o;return n}function $e(t,e){for(const r of e)if(Oe(t,r))return!0;return!1}function Re(t,e){for(const r of t)if(!Oe(r,e))return!1;for(let r=0;r<t.length-1;++r)if(Le(t[r],t[r+1],e))return!1;return!0}function Ne(t,e){for(const r of e)if(Re(t,r))return!0;return!1}function Ue(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],o=(t[0]-r[0])*s-i*(t[1]-r[1]),a=(e[0]-r[0])*s-i*(e[1]-r[1]);return o>0&&a<0||o<0&&a>0}function qe(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 o=De(t[i][n],r);ze(e,o),s.push(o)}n.push(s)}return n}function je(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=qe(t[i],e,r);n.push(s)}return n}function Ge(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}ze(e,t)}function Xe(t,e,r,n){const i=Math.pow(2,n.z)*Pe,s=[n.x*Pe,n.y*Pe],o=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];Ge(n,e,r,i),o.push(n)}return o}function Ye(t,e,r,n){const i=Math.pow(2,n.z)*Pe,s=[n.x*Pe,n.y*Pe],o=[];for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];ze(e,r),t.push(r)}o.push(t)}if(e[2]-e[0]<=i/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const n of t)Ge(n,e,r,i)}var a;return o}class Ze{constructor(t,e){this.type=L,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(Rt(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const r of e.features){const{type:e,coordinates:n}=r.geometry;"Polygon"===e&&t.push(n),"MultiPolygon"===e&&t.push(...n)}if(t.length)return new Ze(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Ze(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Ze(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=qe(e.coordinates,n,i),o=Xe(t.geometry(),r,n,i);if(!Be(r,n))return!1;for(const t of o)if(!Oe(t,s))return!1}if("MultiPolygon"===e.type){const s=je(e.coordinates,n,i),o=Xe(t.geometry(),r,n,i);if(!Be(r,n))return!1;for(const t of o)if(!$e(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=qe(e.coordinates,n,i),o=Ye(t.geometry(),r,n,i);if(!Be(r,n))return!1;for(const t of o)if(!Re(t,s))return!1}if("MultiPolygon"===e.type){const s=je(e.coordinates,n,i),o=Ye(t.geometry(),r,n,i);if(!Be(r,n))return!1;for(const t of o)if(!Ne(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let We=class{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare: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);const s=n+1;if(s<this.length&&r(e[s],e[n])<0&&(n=s),r(e[n],i)>=0)break;e[t]=e[n],t=n}e[t]=i}};function He(t,e,r=0,n=t.length-1,i=Ke){for(;n>r;){if(n-r>600){const s=n-r+1,o=e-r+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);He(t,e,Math.max(r,Math.floor(e-o*l/s+u)),Math.min(n,Math.floor(e+(s-o)*l/s+u)),i)}const s=t[e];let o=r,a=n;for(Je(t,r,e),i(t[n],s)>0&&Je(t,r,n);o<a;){for(Je(t,o,a),o++,a--;i(t[o],s)<0;)o++;for(;i(t[a],s)>0;)a--}0===i(t[r],s)?Je(t,r,a):(a++,Je(t,a,n)),a<=e&&(r=a+1),e<=a&&(n=a-1)}}function Je(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function Ke(t,e){return t<e?-1:t>e?1:0}function Qe(t,e){if(t.length<=1)return[t];const r=[];let n,i;for(const e of t){const t=er(e);0!==t&&(e.area=Math.abs(t),void 0===i&&(i=t<0),i===t<0?(n&&r.push(n),n=[e]):n.push(e))}if(n&&r.push(n),e>1)for(let t=0;t<r.length;t++)r[t].length<=e||(He(r[t],e,1,r[t].length-1,tr),r[t]=r[t].slice(0,e));return r}function tr(t,e){return e.area-t.area}function er(t){let e=0;for(let r,n,i=0,s=t.length,o=s-1;i<s;o=i++)r=t[i],n=t[o],e+=(n.x-r.x)*(r.y+n.y);return e}const rr=1/298.257223563,nr=rr*(2-rr),ir=Math.PI/180;class sr{constructor(t){const e=6378.137*ir*1e3,r=Math.cos(t*ir),n=1/(1-nr*(1-r*r)),i=Math.sqrt(n);this.kx=e*i*r,this.ky=e*i*n*(1-nr)}distance(t,e){const r=this.wrap(t[0]-e[0])*this.kx,n=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+n*n)}pointOnLine(t,e){let r,n,i,s,o=1/0;for(let a=0;a<t.length-1;a++){let l=t[a][0],u=t[a][1],c=this.wrap(t[a+1][0]-l)*this.kx,h=(t[a+1][1]-u)*this.ky,p=0;0===c&&0===h||(p=(this.wrap(e[0]-l)*this.kx*c+(e[1]-u)*this.ky*h)/(c*c+h*h),p>1?(l=t[a+1][0],u=t[a+1][1]):p>0&&(l+=c/this.kx*p,u+=h/this.ky*p)),c=this.wrap(e[0]-l)*this.kx,h=(e[1]-u)*this.ky;const f=c*c+h*h;f<o&&(o=f,r=l,n=u,i=a,s=p)}return{point:[r,n],index:i,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function or(t,e){return e[0]-t[0]}function ar(t){return t[1]-t[0]+1}function lr(t,e){return t[1]>=t[0]&&t[1]<e}function ur(t,e){if(t[0]>t[1])return[null,null];const r=ar(t);if(e){if(2===r)return[t,null];const e=Math.floor(r/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===r)return[t,null];const n=Math.floor(r/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function cr(t,e){if(!lr(e,t.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)ze(r,t[n]);return r}function hr(t){const e=[1/0,1/0,-1/0,-1/0];for(const r of t)for(const t of r)ze(e,t);return e}function pr(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function fr(t,e,r){if(!pr(t)||!pr(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function dr(t,e,r){const n=r.pointOnLine(e,t);return r.distance(t,n.point)}function yr(t,e,r,n,i){const s=Math.min(dr(t,[r,n],i),dr(e,[r,n],i)),o=Math.min(dr(r,[t,e],i),dr(n,[t,e],i));return Math.min(s,o)}function mr(t,e,r,n,i){if(!lr(e,t.length)||!lr(n,r.length))return 1/0;let s=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(let t=n[0];t<n[1];++t){const n=r[t],o=r[t+1];if(Ve(e,a,n,o))return 0;s=Math.min(s,yr(e,a,n,o,i))}}return s}function gr(t,e,r,n,i){if(!lr(e,t.length)||!lr(n,r.length))return NaN;let s=1/0;for(let o=e[0];o<=e[1];++o)for(let e=n[0];e<=n[1];++e)if(s=Math.min(s,i.distance(t[o],r[e])),0===s)return s;return s}function xr(t,e,r){if(Oe(t,e,!0))return 0;let n=1/0;for(const i of e){const e=i[0],s=i[i.length-1];if(e!==s&&(n=Math.min(n,dr(t,[s,e],r)),0===n))return n;const o=r.pointOnLine(i,t);if(n=Math.min(n,r.distance(t,o.point)),0===n)return n}return n}function vr(t,e,r,n){if(!lr(e,t.length))return NaN;for(let n=e[0];n<=e[1];++n)if(Oe(t[n],r,!0))return 0;let i=1/0;for(let s=e[0];s<e[1];++s){const e=t[s],o=t[s+1];for(const t of r)for(let r=0,s=t.length,a=s-1;r<s;a=r++){const s=t[a],l=t[r];if(Ve(e,o,s,l))return 0;i=Math.min(i,yr(e,o,s,l,n))}}return i}function br(t,e){for(const r of t)for(const t of r)if(Oe(t,e,!0))return!0;return!1}function wr(t,e,r,n=1/0){const i=hr(t),s=hr(e);if(n!==1/0&&fr(i,s,r)>=n)return n;if(Be(i,s)){if(br(t,e))return 0}else if(br(e,t))return 0;let o=1/0;for(const n of t)for(let t=0,i=n.length,s=i-1;t<i;s=t++){const i=n[s],a=n[t];for(const t of e)for(let e=0,n=t.length,s=n-1;e<n;s=e++){const n=t[s],l=t[e];if(Ve(i,a,n,l))return 0;o=Math.min(o,yr(i,a,n,l,r))}}return o}function _r(t,e,r,n,i,s){if(!s)return;const o=fr(cr(n,s),i,r);o<e&&t.push([o,s,[0,0]])}function Sr(t,e,r,n,i,s,o){if(!s||!o)return;const a=fr(cr(n,s),cr(i,o),r);a<e&&t.push([a,s,o])}function Ar(t,e,r,n,i=1/0){let s=Math.min(n.distance(t[0],r[0][0]),i);if(0===s)return s;const o=new We([[0,[0,t.length-1],[0,0]]],or),a=hr(r);for(;o.length>0;){const i=o.pop();if(i[0]>=s)continue;const l=i[1],u=e?50:100;if(ar(l)<=u){if(!lr(l,t.length))return NaN;if(e){const e=vr(t,l,r,n);if(isNaN(e)||0===e)return e;s=Math.min(s,e)}else for(let e=l[0];e<=l[1];++e){const i=xr(t[e],r,n);if(s=Math.min(s,i),0===s)return 0}}else{const r=ur(l,e);_r(o,s,n,t,a,r[0]),_r(o,s,n,t,a,r[1])}}return s}function Ir(t,e,r,n,i,s=1/0){let o=Math.min(s,i.distance(t[0],r[0]));if(0===o)return o;const a=new We([[0,[0,t.length-1],[0,r.length-1]]],or);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],u=s[2],c=e?50:100,h=n?50:100;if(ar(l)<=c&&ar(u)<=h){if(!lr(l,t.length)&&lr(u,r.length))return NaN;let s;if(e&&n)s=mr(t,l,r,u,i),o=Math.min(o,s);else if(e&&!n){const e=t.slice(l[0],l[1]+1);for(let t=u[0];t<=u[1];++t)if(s=dr(r[t],e,i),o=Math.min(o,s),0===o)return o}else if(!e&&n){const e=r.slice(u[0],u[1]+1);for(let r=l[0];r<=l[1];++r)if(s=dr(t[r],e,i),o=Math.min(o,s),0===o)return o}else s=gr(t,l,r,u,i),o=Math.min(o,s)}else{const s=ur(l,e),c=ur(u,n);Sr(a,o,i,t,r,s[0],c[0]),Sr(a,o,i,t,r,s[0],c[1]),Sr(a,o,i,t,r,s[1],c[0]),Sr(a,o,i,t,r,s[1],c[1])}}return o}function kr(t){return"MultiPolygon"===t.type?t.coordinates.map((t=>({type:"Polygon",coordinates:t}))):"MultiLineString"===t.type?t.coordinates.map((t=>({type:"LineString",coordinates:t}))):"MultiPoint"===t.type?t.coordinates.map((t=>({type:"Point",coordinates:t}))):[t]}class Tr{constructor(t,e){this.type=C,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Rt(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new Tr(e,e.features.map((t=>kr(t.geometry))).flat());if("Feature"===e.type)return new Tr(e,kr(e.geometry));if("type"in e&&"coordinates"in e)return new Tr(e,kr(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=t.geometry(),n=r.flat().map((e=>Fe([e.x,e.y],t.canonical)));if(0===r.length)return NaN;const i=new sr(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,Ir(n,!1,[t.coordinates],!1,i,s));break;case"LineString":s=Math.min(s,Ir(n,!1,t.coordinates,!0,i,s));break;case"Polygon":s=Math.min(s,Ar(n,!1,t.coordinates,i,s))}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=t.geometry(),n=r.flat().map((e=>Fe([e.x,e.y],t.canonical)));if(0===r.length)return NaN;const i=new sr(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,Ir(n,!0,[t.coordinates],!1,i,s));break;case"LineString":s=Math.min(s,Ir(n,!0,t.coordinates,!0,i,s));break;case"Polygon":s=Math.min(s,Ar(n,!0,t.coordinates,i,s))}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const r=t.geometry();if(0===r.length||0===r[0].length)return NaN;const n=Qe(r,0).map((e=>e.map((e=>e.map((e=>Fe([e.x,e.y],t.canonical))))))),i=new sr(n[0][0][0][1]);let s=1/0;for(const t of e)for(const e of n){switch(t.type){case"Point":s=Math.min(s,Ar([t.coordinates],!1,e,i,s));break;case"LineString":s=Math.min(s,Ar(t.coordinates,!0,e,i,s));break;case"Polygon":s=Math.min(s,wr(e,t.coordinates,i,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Er{constructor(t){this.type=N,this.key=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=t[1];return null==r?e.error("Global state property must be defined."):"string"!=typeof r?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Er(r)}evaluate(t){var e;const r=null===(e=t.globals)||void 0===e?void 0:e.globalState;return r&&0!==Object.keys(r).length?xt(r,this.key):null}eachChild(){}outputDefined(){return!1}}const Mr={"==":ve,"!=":be,">":_e,"<":we,">=":Ae,"<=":Se,array:Gt,at:Qt,boolean:Gt,case:ne,coalesce:ye,collator:Ie,format:Te,image:Ee,in:te,"index-of":ee,interpolate:pe,"interpolate-hcl":pe,"interpolate-lab":pe,length:Me,let:Jt,literal:qt,match:re,number:Gt,"number-format":ke,object:Gt,slice:ie,step:oe,string:Gt,"to-boolean":Yt,"to-color":Yt,"to-number":Yt,"to-string":Yt,var:Kt,within:Ze,distance:Tr,"global-state":Er};class Pr{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=Pr.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,o=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,s]of o){a=new Ht(e.registry,Cr,e.path,null,e.scope);const o=[];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=a.parse(r,1+o.length,i);if(!s){l=!0;break}o.push(s)}if(!l)if(Array.isArray(n)&&n.length!==o.length)a.error(`Expected ${n.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=o[t];a.concat(t+1).checkSubtype(e,r.type)}if(0===a.errors.length)return new Pr(r,i,s,o)}}if(1===o.length)e.errors.push(...a.errors);else{const r=(o.length?o:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(H).join(", ")})`:`(${H(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(H(i.type))}e.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){Pr.definitions=e;for(const r in e)t[r]=Pr}}function Dr(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,o=$t(e,r,n,s);if(o)throw new Bt(o);return new kt(e/255,r/255,n/255,s,!1)}function Fr(t,e){return t in e}function zr(t,e){const r=e[t];return void 0===r?null:r}function Br(t){return{type:t}}function Cr(t){if(t instanceof Kt)return Cr(t.boundExpression);if(t instanceof Pr&&"error"===t.name)return!1;if(t instanceof Ie)return!1;if(t instanceof Ze)return!1;if(t instanceof Tr)return!1;if(t instanceof Er)return!1;const e=t instanceof Yt||t instanceof Gt;let r=!0;return t.eachChild((t=>{r=e?r&&Cr(t):r&&t instanceof qt})),!!r&&Vr(t)&&Or(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Vr(t){if(t instanceof Pr){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 Ze)return!1;if(t instanceof Tr)return!1;let e=!0;return t.eachChild((t=>{e&&!Vr(t)&&(e=!1)})),e}function Lr(t){if(t instanceof Pr&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Lr(t)&&(e=!1)})),e}function Or(t,e){if(t instanceof Pr&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!Or(t,e)&&(r=!1)})),r}function $r(t){return{result:"success",value:t}}function Rr(t){return{result:"error",value:t}}function Nr(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Ur(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function qr(t){return!!t.expression&&t.expression.interpolated}function jr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Gr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&Nt(t)===R}function Xr(t){return t}function Yr(t,e){const r=t.stops&&"object"==typeof t.stops[0][0],n=r||!(r||void 0!==t.property),i=t.type||(qr(e)?"exponential":"interval"),s=function(t){switch(t.type){case"color":return kt.parse;case"padding":return Dt.parse;case"numberArray":return Ft.parse;case"colorArray":return zt.parse;default:return null}}(e);if(s&&((t=D({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],s(t[1])]))),t.default=s(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==(o=t.colorSpace)&&"hcl"!==o&&"lab"!==o)throw new Error(`Unknown color space: "${t.colorSpace}"`);var o;const a=function(t){switch(t){case"exponential":return Jr;case"interval":return Hr;case"categorical":return Wr;case"identity":return Kr;default:throw new Error(`Unknown function type "${t}"`)}}(i);let l,u;if("categorical"===i){l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];u=typeof t.stops[0][0]}if(r){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,Yr(r[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:pe.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>Jr({stops:i,base:t.base},e,r).evaluate(r,n)}}if(n){const r="exponential"===i?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:pe.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>a(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?Zr(t.default,e.default):a(t,e,i,l,u)}}}function Zr(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Wr(t,e,r,n,i){return Zr(typeof r===i?n[r]:void 0,t.default,e.default)}function Hr(t,e,r){if("number"!==jr(r))return Zr(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=se(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function Jr(t,e,r){const n=void 0!==t.base?t.base:1;if("number"!==jr(r))return Zr(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=se(t.stops.map((t=>t[0])),r),o=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]),a=t.stops[s][1],l=t.stops[s+1][1],u=de[e.type]||Xr;return"function"==typeof a.evaluate?{evaluate(...e){const r=a.evaluate.apply(void 0,e),n=l.evaluate.apply(void 0,e);if(void 0!==r&&void 0!==n)return u(r,n,o,t.colorSpace)}}:u(a,l,o,t.colorSpace)}function Kr(t,e,r){switch(e.type){case"color":r=kt.parse(r);break;case"formatted":r=Pt.fromString(r.toString());break;case"resolvedImage":r=Lt.fromString(r.toString());break;case"padding":r=Dt.parse(r);break;case"colorArray":r=zt.parse(r);break;case"numberArray":r=Ft.parse(r);break;default:jr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0)}return Zr(r,t.default,e.default)}Pr.register(Mr,{error:[{kind:"error"},[V],(t,[e])=>{throw new Bt(e.evaluate(t))}],typeof:[V,[N],(t,[e])=>H(Nt(e.evaluate(t)))],"to-rgba":[W(C,4),[O],(t,[e])=>{const[r,n,i,s]=e.evaluate(t).rgb;return[255*r,255*n,255*i,s]}],rgb:[O,[C,C,C],Dr],rgba:[O,[C,C,C,C],Dr],has:{type:L,overloads:[[[V],(t,[e])=>Fr(e.evaluate(t),t.properties())],[[V,R],(t,[e,r])=>Fr(e.evaluate(t),r.evaluate(t))]]},get:{type:N,overloads:[[[V],(t,[e])=>zr(e.evaluate(t),t.properties())],[[V,R],(t,[e,r])=>zr(e.evaluate(t),r.evaluate(t))]]},"feature-state":[N,[V],(t,[e])=>zr(e.evaluate(t),t.featureState||{})],properties:[R,[],t=>t.properties()],"geometry-type":[V,[],t=>t.geometryType()],id:[N,[],t=>t.id()],zoom:[C,[],t=>t.globals.zoom],"heatmap-density":[C,[],t=>t.globals.heatmapDensity||0],elevation:[C,[],t=>t.globals.elevation||0],"line-progress":[C,[],t=>t.globals.lineProgress||0],accumulated:[N,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[C,Br(C),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[C,Br(C),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:C,overloads:[[[C,C],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[C],(t,[e])=>-e.evaluate(t)]]},"/":[C,[C,C],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[C,[C,C],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[C,[],()=>Math.LN2],pi:[C,[],()=>Math.PI],e:[C,[],()=>Math.E],"^":[C,[C,C],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[C,[C],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[C,[C],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[C,[C],(t,[e])=>Math.log(e.evaluate(t))],log2:[C,[C],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[C,[C],(t,[e])=>Math.sin(e.evaluate(t))],cos:[C,[C],(t,[e])=>Math.cos(e.evaluate(t))],tan:[C,[C],(t,[e])=>Math.tan(e.evaluate(t))],asin:[C,[C],(t,[e])=>Math.asin(e.evaluate(t))],acos:[C,[C],(t,[e])=>Math.acos(e.evaluate(t))],atan:[C,[C],(t,[e])=>Math.atan(e.evaluate(t))],min:[C,Br(C),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[C,Br(C),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[C,[C],(t,[e])=>Math.abs(e.evaluate(t))],round:[C,[C],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[C,[C],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[C,[C],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[L,[V,N],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[L,[N],(t,[e])=>t.id()===e.value],"filter-type-==":[L,[V],(t,[e])=>t.geometryType()===e.value],"filter-<":[L,[V,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[L,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[L,[V,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[L,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[L,[V,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[L,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[L,[V,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[L,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[L,[N],(t,[e])=>e.value in t.properties()],"filter-has-id":[L,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[L,[W(V)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[L,[W(N)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[L,[V,W(N)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[L,[V,W(N)],(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:L,overloads:[[[L,L],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Br(L),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:L,overloads:[[[L,L],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Br(L),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[L,[L],(t,[e])=>!e.evaluate(t)],"is-supported-script":[L,[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,Br(N),(t,e)=>e.map((e=>Ut(e.evaluate(t)))).join("")],split:[W(V),[V,V],(t,[e,r])=>e.evaluate(t).split(r.evaluate(t))],join:[V,[W(V),V],(t,[e,r])=>e.evaluate(t).join(r.evaluate(t))],"resolved-locale":[V,[U],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Qr{constructor(t,e,r){this.expression=t,this._warningHistory={},this._evaluator=new Wt,this._defaultValue=e?function(t){if("color"===t.type&&Gr(t.default))return new kt(0,0,0,0);switch(t.type){case"color":return kt.parse(t.default)||null;case"padding":return Dt.parse(t.default)||null;case"numberArray":return Ft.parse(t.default)||null;case"colorArray":return zt.parse(t.default)||null;case"variableAnchorOffsetCollection":return Vt.parse(t.default)||null;case"projectionDefinition":return Ot.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null,this._globalState=r}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._globalState&&(t=un(t,this._globalState)),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._globalState&&(t=un(t,this._globalState)),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 Bt(`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 tn(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Mr}function en(t,e,r){const n=new Ht(Mr,Cr,[],e?function(t){const e={color:O,string:V,number:C,enum:V,boolean:L,formatted:q,padding:j,numberArray:X,colorArray:G,projectionDefinition:$,resolvedImage:Y,variableAnchorOffsetCollection:Z};return"array"===t.type?W(e[t.value]||N,t.length):e[t.type]}(e):void 0),i=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return i?$r(new Qr(i,e,r)):Rr(n.errors)}class rn{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Lr(e.expression),this.globalStateRefs=ln(e.expression),this._globalState=r}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._globalState&&(t=un(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._globalState&&(t=un(t,this._globalState)),this._styleExpression.evaluate(t,e,r,n,i,s)}}class nn{constructor(t,e,r,n,i){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Lr(e.expression),this.globalStateRefs=ln(e.expression),this.interpolationType=n,this._globalState=i}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._globalState&&(t=un(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._globalState&&(t=un(t,this._globalState)),this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?pe.interpolationFactor(this.interpolationType,t,e,r):0}}function sn(t,e,r){const n=en(t,e,r);if("error"===n.result)return n;const i=n.value.expression,s=Vr(i);if(!s&&!Nr(e))return Rr([new F("","data expressions not supported")]);const o=Or(i,["zoom"]);if(!o&&!Ur(e))return Rr([new F("","zoom expressions not supported")]);const a=an(i);return a||o?a instanceof F?Rr([a]):a instanceof pe&&!qr(e)?Rr([new F("",'"interpolate" expressions cannot be used with this property')]):$r(a?new nn(s?"camera":"composite",n.value,a.labels,a instanceof pe?a.interpolation:void 0,r):new rn(s?"constant":"source",n.value,r)):Rr([new F("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class on{constructor(t,e){this._parameters=t,this._specification=e,D(this,Yr(this._parameters,this._specification))}static deserialize(t){return new on(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function an(t){let e=null;if(t instanceof Jt)e=an(t.result);else if(t instanceof ye){for(const r of t.args)if(e=an(r),e)break}else(t instanceof oe||t instanceof pe)&&t.input instanceof Pr&&"zoom"===t.input.name&&(e=t);return e instanceof F||t.eachChild((t=>{const r=an(t);r instanceof F?e=r:!e&&r?e=new F("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new F("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function ln(t,e=new Set){return t instanceof Er&&e.add(t.key),t.eachChild((t=>{ln(t,e)})),e}function un(t,e){const{zoom:r,heatmapDensity:n,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a}=null!=t?t:{};return{zoom:r,heatmapDensity:n,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:e}}function cn(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(!cn(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const hn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function pn(t,e){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};cn(t)||(t=yn(t));const r=en(t,hn,e);if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,e,n)=>r.value.evaluate(t,e,{},n),needGeometry:dn(t),getGlobalStateRefs:()=>ln(r.value.expression)}}function fn(t,e){return t<e?-1:t>e?1:0}function dn(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(dn(t[e]))return!0;return!1}function yn(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?mn(t[1],t[2],"=="):"!="===e?vn(mn(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?mn(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(yn))):"all"===e?["all"].concat(t.slice(1).map(yn)):"none"===e?["all"].concat(t.slice(1).map(yn).map(vn)):"in"===e?gn(t[1],t.slice(2)):"!in"===e?vn(gn(t[1],t.slice(2))):"has"===e?xn(t[1]):"!has"!==e||vn(xn(t[1]));var r}function mn(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 gn(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(fn)]]:["filter-in-small",t,["literal",e]]}}function xn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function vn(t){return["!",t]}function bn(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+=`${bn(r)},`;return`${e}]`}const r=Object.keys(t).sort();let n="{";for(let e=0;e<r.length;e++)n+=`${JSON.stringify(r[e])}:${bn(t[r[e]])},`;return`${n}}`}function wn(t){let e="";for(const r of M)e+=`/${bn(t[r])}`;return e}function _n(t){const e=t.value;return e?[new P(t.key,e,"constants have been deprecated as of v8")]:[]}function Sn(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function An(t){if(Array.isArray(t))return t.map(An);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=An(t[r]);return e}return Sn(t)}function In(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,o=t.styleSpec,a=t.validateSpec;let l=[];const u=jr(r);if("object"!==u)return[new P(e,r,`object expected, ${u} found`)];for(const t in r){const u=t.split(".")[0],c=xt(n,u)||n["*"];let h;if(xt(i,u))h=i[u];else if(xt(n,u)){if(void 0===r[t])continue;h=a}else if(i["*"])h=i["*"];else{if(!n["*"]){l.push(new P(e,r[t],`unknown property "${t}"`));continue}h=a}l=l.concat(h({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:c,style:s,styleSpec:o,object:r,objectKey:t,validateSpec:a},r))}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&l.push(new P(e,r,`missing required property "${t}"`));return l}function kn(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,s=t.key,o=t.arrayElementValidator||t.validateSpec;if("array"!==jr(e))return[new P(s,e,`array expected, ${jr(e)} found`)];if(r.length&&e.length!==r.length)return[new P(s,e,`array length ${r.length} expected, length ${e.length} found`)];let a={type:r.value,values:r.values};i.$version<7&&(a.function=r.function),"object"===jr(r.value)&&(a=r.value);let l=[];for(let r=0;r<e.length;r++)l=l.concat(o({array:e,arrayIndex:r,value:e[r],valueSpec:a,validateSpec:t.validateSpec,style:n,styleSpec:i,key:`${s}[${r}]`}));return l}function Tn(t){const e=t.key,r=t.value,n=t.valueSpec;let i=jr(r);return"number"===i&&r!=r&&(i="NaN"),"number"!==i?[new P(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new P(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new P(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function En(t){const e=t.valueSpec,r=Sn(t.value.type);let n,i,s,o={};const a="categorical"!==r&&void 0===t.value.property,l=!a,u="array"===jr(t.value.stops)&&"array"===jr(t.value.stops[0])&&"object"===jr(t.value.stops[0][0]),c=In({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 P(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(kn({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===jr(n)&&0===n.length&&e.push(new P(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&&a&&c.push(new P(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||c.push(new P(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!qr(t.valueSpec)&&c.push(new P(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Nr(t.valueSpec)?c.push(new P(t.key,t.value,"property functions not supported")):a&&!Ur(t.valueSpec)&&c.push(new P(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||c.push(new P(t.key,t.value,'"property" property is required')),c;function h(t){let r=[];const n=t.value,a=t.key;if("array"!==jr(n))return[new P(a,n,`array expected, ${jr(n)} found`)];if(2!==n.length)return[new P(a,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==jr(n[0]))return[new P(a,n,`object expected, ${jr(n[0])} found`)];if(void 0===n[0].zoom)return[new P(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new P(a,n,"object stop key must have value")];if(s&&s>Sn(n[0].zoom))return[new P(a,n[0].zoom,"stop zoom values must appear in ascending order")];Sn(n[0].zoom)!==s&&(s=Sn(n[0].zoom),i=void 0,o={}),r=r.concat(In({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Tn,value:p}}))}else r=r.concat(p({key:`${a}[0]`,value:n[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return tn(An(n[1]))?r.concat([new P(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(t.validateSpec({key:`${a}[1]`,value:n[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const a=jr(t.value),l=Sn(t.value),u=null!==t.value?t.value:s;if(n){if(a!==n)return[new P(t.key,u,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new P(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==r){let n=`number expected, ${a} found`;return Nr(e)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new P(t.key,u,n)]}return"categorical"!==r||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===a&&void 0!==i&&l<i?[new P(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===r&&l in o?[new P(t.key,u,"stop domain values must be unique")]:(o[l]=!0,[])):[new P(t.key,u,`integer expected, found ${l}`)]}}function Mn(t){const e=("property"===t.expressionContext?sn:en)(An(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new P(`${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 P(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&&!Lr(r))return[new P(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Lr(r))return[new P(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Or(r,["zoom","feature-state"]))return[new P(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Vr(r))return[new P(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Pn(t){const e=t.key,r=t.value,n=jr(r);return"string"!==n?[new P(e,r,`color expected, ${n} found`)]:kt.parse(String(r))?[]:[new P(e,r,`color expected, "${r}" found`)]}function Dn(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(Sn(r))&&i.push(new P(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(Sn(r))&&i.push(new P(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Fn(t){return cn(An(t.value))?Mn(D({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):zn(t)}function zn(t){const e=t.value,r=t.key;if("array"!==jr(e))return[new P(r,e,`array expected, ${jr(e)} found`)];const n=t.styleSpec;let i,s=[];if(e.length<1)return[new P(r,e,"filter array must have at least 1 element")];switch(s=s.concat(Dn({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Sn(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Sn(e[1])&&s.push(new P(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new P(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=jr(e[1]),"string"!==i&&s.push(new P(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let o=2;o<e.length;o++)i=jr(e[o]),"$type"===Sn(e[1])?s=s.concat(Dn({key:`${r}[${o}]`,value:e[o],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new P(`${r}[${o}]`,e[o],`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(zn({key:`${r}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=jr(e[1]),2!==e.length?s.push(new P(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new P(`${r}[1]`,e[1],`string expected, ${i} found`))}return s}function Bn(t,e){const r=t.key,n=t.validateSpec,i=t.style,s=t.styleSpec,o=t.value,a=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return[];const u=a.match(/^(.*)-transition$/);if("paint"===e&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:o,valueSpec:s.transition,style:i,styleSpec:s});const c=t.valueSpec||l[a];if(!c)return[new P(r,o,`unknown property "${a}"`)];let h;if("string"===jr(o)&&Nr(c)&&!c.tokens&&(h=/^{([^}]+)}$/.exec(o)))return[new P(r,o,`"${a}" 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-font"===a&&Gr(An(o))&&"identity"===Sn(o.type)&&p.push(new P(r,o,'"text-font" does not support identity functions')),p.concat(n({key:t.key,value:o,valueSpec:c,style:i,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:a}))}function Cn(t){return Bn(t,"paint")}function Vn(t){return Bn(t,"layout")}function Ln(t){var e,r;let n=[];const i=t.value,s=t.key,o=t.style,a=t.styleSpec;if("object"!==jr(i))return[new P(s,i,`object expected, ${jr(i)} found`)];i.type||i.ref||n.push(new P(s,i,'either "type" or "ref" is required'));let l=Sn(i.type);const u=Sn(i.ref);if(i.id){const e=Sn(i.id);for(let r=0;r<t.arrayIndex;r++){const t=o.layers[r];Sn(t.id)===e&&n.push(new P(s,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in i&&n.push(new P(s,i[t],`"${t}" is prohibited for ref layers`))})),o.layers.forEach((e=>{Sn(e.id)===u&&(t=e)})),t?t.ref?n.push(new P(s,i.ref,"ref cannot reference another ref layer")):l=Sn(t.type):n.push(new P(s,i.ref,`ref layer "${u}" not found`))}else if("background"!==l)if(i.source){const t=o.sources&&o.sources[i.source],e=t&&Sn(t.type);t?"vector"===e&&"raster"===l?n.push(new P(s,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==e&&"hillshade"===l||"raster-dem"!==e&&"color-relief"===l?n.push(new P(s,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===e&&"raster"!==l?n.push(new P(s,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==e||i["source-layer"]?"raster-dem"===e&&"hillshade"!==l&&"color-relief"!==l?n.push(new P(s,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==l||!i.paint||!i.paint["line-gradient"]||"geojson"===e&&t.lineMetrics||n.push(new P(s,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new P(s,i,`layer "${i.id}" must specify a "source-layer"`)):n.push(new P(s,i.source,`source "${i.source}" not found`))}else n.push(new P(s,i,'missing required property "source"'));return"raster"===l&&(null===(e=i.paint)||void 0===e?void 0:e.resampling)&&(null===(r=i.paint)||void 0===r?void 0:r["raster-resampling"])&&n.push(new P(s,i.paint,`layer "${i.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),n=n.concat(In({key:s,value:i,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${s}.type`,value:i.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:Fn,layout:t=>In({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Vn(D({layerType:l},t))}}),paint:t=>In({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Cn(D({layerType:l},t))}})}})),n}function On(t){const e=t.value,r=t.key,n=jr(e);return"string"!==n?[new P(r,e,`string expected, ${n} found`)]:[]}const $n={promoteId:function({key:t,value:e}){if("string"===jr(e))return On({key:t,value:e});{const r=[];for(const n in e)r.push(...On({key:`${t}.${n}`,value:e[n]}));return r}}};function Rn(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style,s=t.validateSpec;if(!e.type)return[new P(r,e,'"type" is required')];const o=Sn(e.type);let a;switch(o){case"vector":case"raster":return a=In({key:r,value:e,valueSpec:n[`source_${o.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:$n,validateSpec:s}),a;case"raster-dem":return a=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,o=t.style;let a=[];const l=jr(n);if(void 0===n)return a;if("object"!==l)return a.push(new P("source_raster_dem",n,`object expected, ${l} found`)),a;const u="custom"===Sn(n.encoding),c=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in n)!u&&c.includes(e)?a.push(new P(e,n[e],`In "${r}": "${e}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):s[e]?a=a.concat(t.validateSpec({key:e,value:n[e],valueSpec:s[e],validateSpec:t.validateSpec,style:o,styleSpec:i})):a.push(new P(e,n[e],`unknown property "${e}"`));return a}({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:s}),a;case"geojson":if(a=In({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:s,objectElementValidators:$n}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...Mn({key:`${r}.${t}.map`,value:i,expressionContext:"cluster-map"})),a.push(...Mn({key:`${r}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return a;case"video":return In({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:s,styleSpec:n});case"image":return In({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:s,styleSpec:n});case"canvas":return[new P(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Dn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Nn(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let s=[];const o=jr(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new P("light",e,`object expected, ${o} found`)]),s;for(const o in e){const a=o.match(/^(.*)-transition$/);s=s.concat(a&&n[a[1]]&&n[a[1]].transition?t.validateSpec({key:o,value:e[o],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r}):n[o]?t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:i,styleSpec:r}):[new P(o,e[o],`unknown property "${o}"`)])}return s}function Un(t){const e=t.value,r=t.styleSpec,n=r.sky,i=t.style,s=jr(e);if(void 0===e)return[];if("object"!==s)return[new P("sky",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=o.concat(n[s]?t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r}):[new P(s,e[s],`unknown property "${s}"`)]);return o}function qn(t){const e=t.value,r=t.styleSpec,n=r.terrain,i=t.style;let s=[];const o=jr(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new P("terrain",e,`object expected, ${o} found`)]),s;for(const o in e)s=s.concat(n[o]?t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:i,styleSpec:r}):[new P(o,e[o],`unknown property "${o}"`)]);return s}function jn(t){let e=[];const r=t.value,n=t.key;if(Array.isArray(r)){const i=[],s=[];for(const o in r)r[o].id&&i.includes(r[o].id)&&e.push(new P(n,r,`all the sprites' ids must be unique, but ${r[o].id} is duplicated`)),i.push(r[o].id),r[o].url&&s.includes(r[o].url)&&e.push(new P(n,r,`all the sprites' URLs must be unique, but ${r[o].url} is duplicated`)),s.push(r[o].url),e=e.concat(In({key:`${n}[${o}]`,value:r[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return On({key:n,value:r})}function Gn(t){return Boolean(t)&&t.constructor===Object}function Xn(t){return Gn(t.value)?[]:[new P(t.key,t.value,`object expected, ${jr(t.value)} found`)]}const Yn={"*":()=>[],array:kn,boolean:function(t){const e=t.value,r=t.key,n=jr(e);return"boolean"!==n?[new P(r,e,`boolean expected, ${n} found`)]:[]},number:Tn,color:Pn,constants:_n,enum:Dn,filter:Fn,function:En,layer:Ln,object:In,source:Rn,light:Nn,sky:Un,terrain:qn,projection:function(t){const e=t.value,r=t.styleSpec,n=r.projection,i=t.style,s=jr(e);if(void 0===e)return[];if("object"!==s)return[new P("projection",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=o.concat(n[s]?t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r}):[new P(s,e[s],`unknown property "${s}"`)]);return o},projectionDefinition:function(t){const e=t.key;let r=t.value;r=r instanceof String?r.valueOf():r;const n=jr(r);return"array"!==n||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(r)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(r)?["array","string"].includes(n)?[]:[new P(e,r,`projection expected, invalid type "${n}" found`)]:[new P(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:On,formatted:function(t){return 0===On(t).length?[]:Mn(t)},resolvedImage:function(t){return 0===On(t).length?[]:Mn(t)},padding:function(t){const e=t.key,r=t.value;if("array"===jr(r)){if(r.length<1||r.length>4)return[new P(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 Tn({key:e,value:r,valueSpec:{}})},numberArray:function(t){const e=t.key,r=t.value;if("array"===jr(r)){const n={type:"number"};if(r.length<1)return[new P(e,r,"array length at least 1 expected, length 0 found")];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 Tn({key:e,value:r,valueSpec:{}})},colorArray:function(t){const e=t.key,r=t.value;if("array"===jr(r)){if(r.length<1)return[new P(e,r,"array length at least 1 expected, length 0 found")];let t=[];for(let n=0;n<r.length;n++)t=t.concat(Pn({key:`${e}[${n}]`,value:r[n]}));return t}return Pn({key:e,value:r})},variableAnchorOffsetCollection:function(t){const e=t.key,r=t.value,n=jr(r),i=t.styleSpec;if("array"!==n||r.length<1||r.length%2!=0)return[new P(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(Dn({key:`${e}[${n}]`,value:r[n],valueSpec:i.layout_symbol["text-anchor"]})),s=s.concat(kn({key:`${e}[${n+1}]`,value:r[n+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return s},sprite:jn,state:Xn,fontFaces:function(t){const e=t.key,r=t.value,n=t.validateSpec,i=t.styleSpec,s=t.style;if(!Gn(r))return[new P(e,r,`object expected, ${jr(r)} found`)];const o=[];for(const t in r){const a=r[t],l=jr(a);if("string"===l)o.push(...On({key:`${e}.${t}`,value:a}));else if("array"===l){const r={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,u]of a.entries())o.push(...In({key:`${e}.${t}[${l}]`,value:u,valueSpec:r,styleSpec:i,style:s,validateSpec:n}))}else o.push(new P(`${e}.${t}`,a,`string or array expected, ${l} found`))}return o}};function Zn(t){const e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=Zn,r.expression&&Gr(Sn(e))?En(t):r.expression&&tn(An(e))?Mn(t):r.type&&Yn[r.type]?Yn[r.type](t):In(D({},t,{valueSpec:r.type?n[r.type]:r}))}function Wn(t){const e=t.value,r=t.key,n=On(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new P(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new P(r,e,'"glyphs" url must include a "{range}" token'))),n}function Hn(t,e=E){let r=[];return r=r.concat(Zn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Zn,objectElementValidators:{glyphs:Wn,"*":()=>[]}})),t.constants&&(r=r.concat(_n({key:"constants",value:t.constants}))),Kn(r)}function Jn(t){return function(e){return t(Object.assign({},e,{validateSpec:Zn}))}}function Kn(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function Qn(t){return function(...e){return Kn(t.apply(this,e))}}Hn.source=Qn(Jn(Rn)),Hn.sprite=Qn(Jn(jn)),Hn.glyphs=Qn(Jn(Wn)),Hn.light=Qn(Jn(Nn)),Hn.sky=Qn(Jn(Un)),Hn.terrain=Qn(Jn(qn)),Hn.state=Qn(Jn(Xn)),Hn.layer=Qn(Jn(Ln)),Hn.filter=Qn(Jn(Fn)),Hn.paintProperty=Qn(Jn(Cn)),Hn.layoutProperty=Qn(Jn(Vn));const ti={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class ei{constructor(t,e){this._globalState=e,this.setValue(t)}evaluate(){var t;return null!==(t=this._literalValue)&&void 0!==t?t:this._compiledValue.evaluate({})}setValue(t){if(null==t||"visible"===t||"none"===t)return this._literalValue="none"===t?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const e=en(t,ti,this._globalState);if("error"===e.result)throw this._literalValue="visible",this._compiledValue=void 0,new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=ln(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const ri="AbortError";class ni extends Error{constructor(t=ri){super(t instanceof Error?t.message:t),this.name=ri,t instanceof Error&&t.stack&&(this.stack=t.stack)}}function ii(t){return t instanceof Error&&t.name===ri}const si={REGISTERED_PROTOCOLS:{}};function oi(t,e){si.REGISTERED_PROTOCOLS[t]=e}function ai(t){delete si.REGISTERED_PROTOCOLS[t]}const li="global-dispatcher";class ui 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 ci=()=>{var t;return w(self)?null===(t=self.worker)||void 0===t?void 0:t.referrer:("blob:"===window.location.protocol?window.parent:window).location.href},hi=function(e,r){return t(this,void 0,void 0,(function*(){var n,i,s;if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){const t=si.REGISTERED_PROTOCOLS[(s=e.url).substring(0,s.indexOf("://"))];if(t){const n=yield t(e,r);return n.data||"arrayBuffer"!==e.type?n:y(n,{data:new ArrayBuffer(0)})}if(w(self)&&(null===(n=self.worker)||void 0===n?void 0:n.actor))return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:li},r)}if(!(t=>{var e;return t.startsWith("file:")||(null===(e=ci())||void 0===e?void 0:e.startsWith("file:"))&&!/^\w+:/.test(t)})(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return function(e,r){return t(this,void 0,void 0,(function*(){const t=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:ci(),referrerPolicy:e.referrerPolicy,signal:r.signal});let n,i;"json"!==e.type||t.headers.has("Accept")||t.headers.set("Accept","application/json");try{n=yield fetch(t)}catch(t){if(ii(t))throw t;throw new ui(0,f(t).message,e.url,new Blob)}if(!n.ok){const t=yield n.blob();throw new ui(n.status,n.statusText,e.url,t)}i="arrayBuffer"===e.type||"image"===e.type?n.arrayBuffer():"json"===e.type?n.json():n.text();const s=yield i;return function(t){if(t.aborted)throw new ni(t.reason)}(r.signal),{data:s,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires"),etag:n.headers.get("ETag")}}))}(e,r);if(w(self)&&(null===(i=self.worker)||void 0===i?void 0:i.actor))return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:li},r)}return function(t,e){return new Promise(((r,n)=>{var i;const s=new XMLHttpRequest;s.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(s.responseType="arraybuffer");for(const e in t.headers)s.setRequestHeader(e,t.headers[e]);"json"===t.type&&(s.responseType="text",(null===(i=t.headers)||void 0===i?void 0:i.Accept)||s.setRequestHeader("Accept","application/json")),s.withCredentials="include"===t.credentials,s.onerror=()=>{n(new Error(s.statusText))},s.onload=()=>{if(!e.signal.aborted)if((s.status>=200&&s.status<300||0===s.status)&&null!==s.response){let e=s.response;if("json"===t.type)try{e=JSON.parse(s.response)}catch(t){return void n(t)}r({data:e,cacheControl:s.getResponseHeader("Cache-Control"),expires:s.getResponseHeader("Expires"),etag:s.getResponseHeader("ETag")})}else{const e=new Blob([s.response],{type:s.getResponseHeader("Content-Type")});n(new ui(s.status,s.statusText,t.url,e))}},e.signal.addEventListener("abort",(()=>{s.abort(),n(new ni(e.signal.reason))})),s.send(t.body)}))}(e,r)}))},pi={};function fi(t,e,r={}){if(pi[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),pi[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}fi("Object",Object),fi("Set",Set),fi("TransferableGridIndex",T),fi("Color",kt),fi("Error",Error),fi("AJAXError",ui),fi("ResolvedImage",Lt),fi("StylePropertyFunction",on),fi("StyleExpression",Qr,{omit:["_evaluator"]}),fi("ZoomDependentExpression",nn),fi("ZoomConstantExpression",rn),fi("CompoundExpression",Pr,{omit:["_evaluate"]});for(const t in Mr)Mr[t]._classRegistryKey||fi(`Expression_${t}`,Mr[t]);function di(t){var e;return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||"ArrayBuffer"===(null===(e=t.constructor)||void 0===e?void 0:e.name))}function yi(t){return t.$name||t.constructor._classRegistryKey}function mi(t){return!function(t){if(null===t||"object"!=typeof t)return!1;const e=yi(t);return e&&"Object"!==e}(t)&&(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||t instanceof Error||di(t)||_(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function gi(t,e){if(mi(t))return(di(t)||_(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(gi(n,e));return r}if("object"!=typeof t)throw new Error("can't serialize object of type "+typeof t);const r=yi(t);if(!r)throw new Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!pi[r])throw new Error(`${r} is not registered.`);const{klass:n}=pi[r],i=n.serialize?n.serialize(t,e):{};if(n.serialize){if(i===(null==e?void 0:e[e.length-1]))throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const n in t){if(!t.hasOwnProperty(n))continue;if(pi[r].omit.includes(n))continue;const s=t[n];i[n]=pi[r].shallow.includes(n)?s:gi(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"!==r&&(i.$name=r),i}function xi(t){if(mi(t))return t;if(Array.isArray(t))return t.map(xi);if("object"!=typeof t)throw new Error("can't deserialize object of type "+typeof t);const e=yi(t)||"Object";if(!pi[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=pi[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]=pi[e].shallow.includes(r)?i:xi(i)}return n}class vi{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var t;this._triggered||(this._triggered=!0,null===(t=this._channel)||void 0===t||t.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const bi={once:!0};class wi{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new vi((()=>this.process())),this.subscription=I(this.target,"message",(t=>this.receive(t)),!1),this.globalScope=w(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise(((r,n)=>{const i=Math.round(1e18*Math.random()).toString(36).substring(0,10),s=e?I(e.signal,"abort",(()=>{null==s||s.unsubscribe(),delete this.resolveRejects[i];const e={id:i,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(e)}),bi):null;this.resolveRejects[i]={resolve:t=>{null==s||s.unsubscribe(),r(t)},reject:t=>{null==s||s.unsubscribe(),n(t)}};const o=[],a=Object.assign(Object.assign({},t),{id:i,sourceMapId:this.mapId,origin:location.origin,data:gi(t.data,o)});this.target.postMessage(a,{transfer:o})}))}receive(t){const e=t.data,r=e.id,n=["file://","resource://android","null"],i=[e.origin,location.origin],s=e.origin===location.origin,o=i.some((t=>n.includes(t)));if((s||o)&&(!e.targetMapId||this.mapId===e.targetMapId)){if("<cancel>"===e.type){delete this.tasks[r];const t=this.abortControllers[r];return delete this.abortControllers[r],void(t&&t.abort())}if(w(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(0===this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(e,r){return t(this,void 0,void 0,(function*(){if("<response>"===r.type){const t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;return void(r.error?t.reject(f(xi(r.error))):t.resolve(xi(r.data)))}if(!this.messageHandlers[r.type])return void this.completeTask(e,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const t=xi(r.data),n=new AbortController;this.abortControllers[e]=n;try{const i=yield this.messageHandlers[r.type](r.sourceMapId,t,n);this.completeTask(e,null,i)}catch(t){this.completeTask(e,f(t))}}))}completeTask(t,e,r){const n=[];delete this.abortControllers[t];const i={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?gi(e):null,data:gi(r,n)};this.target.postMessage(i,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}}function _i(t,e,r){var n;(null===(n=r[t])||void 0===n?void 0:n.includes(e))||(r[t]||(r[t]=[]),r[t].push(e))}function Si(t,e,r){if(null==r?void 0:r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}class Ai{constructor(t,e={}){y(this,e),this.type=t}}class Ii extends Ai{constructor(t,e={}){super("error",y({error:t},e))}}class ki{on(t,e){return this._listeners||(this._listeners={}),_i(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return Si(t,e,this._listeners),Si(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||(this._oneTimeListeners={}),_i(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){var r,n;"string"==typeof t&&(t=new Ai(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=(null===(r=this._listeners)||void 0===r?void 0:r[i])?this._listeners[i].slice():[];for(const r of e)r.call(this,t);const s=(null===(n=this._oneTimeListeners)||void 0===n?void 0:n[i])?this._oneTimeListeners[i].slice():[];for(const e of s)Si(i,e,this._oneTimeListeners),e.call(this,t);const o=this._eventedParent;o&&(y(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),o.fire(t))}else t instanceof Ii&&console.error(t.error);return this}listens(t){var e,r,n,i,s;return(null===(r=null===(e=this._listeners)||void 0===e?void 0:e[t])||void 0===r?void 0:r.length)>0||(null===(i=null===(n=this._oneTimeListeners)||void 0===n?void 0:n[t])||void 0===i?void 0:i.length)>0||(null===(s=this._eventedParent)||void 0===s?void 0:s.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}const Ti=Hn,Ei=Ti.paintProperty,Mi=Ti.layoutProperty;class Pi{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))}}function Di(t){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}function Fi(t){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}function zi(t){return/\s/u.test(String.fromCodePoint(t))}function Bi(t){for(const e of t)if(Fi(e.codePointAt(0)))return!0;return!1}function Ci(t){for(const e of t)if(!Oi(e.codePointAt(0)))return!1;return!0}function Vi(t){const e=t.map((t=>{try{return new RegExp(`\\p{sc=${t}}`,"u").source}catch(t){return null}})).filter((t=>t));return new RegExp(e.join("|"),"u")}const Li=Vi(["Arab","Dupl","Mong","Ougr","Syrc"]);function Oi(t){return!Li.test(String.fromCodePoint(t))}function $i(t){return!(Fi(t)||(e=t,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))));var e}const Ri=Vi(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Ni(t){return Ri.test(String.fromCodePoint(t))}function Ui(t,e){return!(!e&&Ni(t)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(t)))}function qi(t){for(const e of t)if(Ni(e.codePointAt(0)))return!0;return!1}const ji=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(ji.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,r){return t(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;const t=e.pluginURL,n=new Promise((t=>{this.loadScriptResolve=t}));r(t);const i=new Promise((t=>setTimeout((()=>t()),this.TIMEOUT)));if(yield Promise.race([n,i]),this.isParsed()){const e={pluginStatus:"loaded",pluginURL:t};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${t}`)}))}};class Gi{constructor(t,e){this.isSupportedScript=Xi,this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new Pi,this.transition=e.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Pi,this.transition={})}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}}}function Xi(t){return function(t,e){for(const r of t)if(!Ui(r.codePointAt(0),e))return!1;return!0}(t,"loaded"===ji.getRTLTextPluginStatus())}const Yi="-transition";class Zi{constructor(t,e,r){this.property=t,this.value=e,this.expression=function(t,e,r){if(Gr(t))return new on(t,e);if(tn(t)){const n=sn(t,e,r);if("error"===n.result)throw new Error(n.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return n.value}{let r=t;return"color"===e.type&&"string"==typeof t?r=kt.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"numberArray"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"colorArray"!==e.type||"string"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)?r=Vt.parse(t):"projectionDefinition"===e.type&&"string"==typeof t&&(r=Ot.parse(t)):r=zt.parse(t):r=Ft.parse(t):r=Dt.parse(t),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification,r)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class Wi{constructor(t,e){this.property=t,this.value=new Zi(t,void 0,e)}transitioned(t,e){return new Ji(this.property,this.value,e,y({},t.transition,this.transition),t.now)}untransitioned(){return new Ji(this.property,this.value,null,{},0)}}class Hi{constructor(t,e){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=e}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return g(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new Wi(this._values[t].property,this._globalState)),this._values[t].value=new Zi(this._values[t].property,null===e?void 0:g(e),this._globalState)}getTransition(t){return g(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new Wi(this._values[t].property,this._globalState)),this._values[t].transition=g(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}${Yi}`]=n)}return t}transitioned(t,e){const r=new Ki(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 Ki(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class Ji{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 o=(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)}(o))}}return i}}class Ki{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const n=new es(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 Qi{constructor(t,e){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=e}hasValue(t){return void 0!==this._values[t].value}hasProperty(t){return t in this._properties.defaultPropertyValues}getValue(t){return g(this._values[t].value)}setValue(t,e){this._values[t]=new Zi(this._values[t].property,null===e?void 0:g(e),this._globalState)}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 es(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class ts{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 es{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class rs{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=de[this.specification.type];return n?n(t,e,r):t}}class ns{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,n){return new ts(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 ts(this,{kind:"constant",value:void 0},t.parameters);const n=de[this.specification.type];if(n){const i=n(t.value.value,e.value.value,r);return new ts(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 is extends ns{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new ts(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,o=this._calculate(s,s,s,e);return new ts(this,{kind:"constant",value:o},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 ts(this,{kind:"constant",value:r},e)}return new ts(this,t.expression,e)}evaluate(t,e,r,n,i,s){if("source"===t.kind){const o=t.evaluate(e,r,n,i,s);return this._calculate(o,o,o,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 ss{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 Gi(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Gi(Math.floor(e.zoom),e)),t.expression.evaluate(new Gi(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 os{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)}interpolate(){return!1}}class as{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 Zi(r,void 0,void 0),i=this.defaultTransitionablePropertyValues[e]=new Wi(r,void 0);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}fi("DataDrivenProperty",ns),fi("DataConstantProperty",rs),fi("CrossFadedDataDrivenProperty",is),fi("CrossFadedProperty",ss),fi("ColorRampProperty",os);const ls=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",us=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class cs extends ki{constructor(t,e,r){if(super(),this.id=t.id,this.type=t.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(t,e){return new ei(t,e)}(this.visibility,r),"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,this._featureFilter=pn(t.filter,r)),e.layout&&(this._unevaluatedLayout=new Qi(e.layout,r)),e.paint)){this._transitionablePaint=new Hi(e.paint,r);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 es(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=pn(t,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){var e;if("visibility"===t)return this.visibility;if(null===(e=this._transitionablePaint)||void 0===e?void 0:e.hasProperty(t))throw new Error(t+ls);if(!this._unevaluatedLayout)throw new Error(`Cannot get layout property "${t}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;for(const e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(const e in this._unevaluatedLayout._values){const r=this._unevaluatedLayout._values[e];for(const e of r.getGlobalStateRefs())t.add(e)}for(const e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){var t;const e=new globalThis.Map;if(this._transitionablePaint)for(const r in this._transitionablePaint._values){const n=this._transitionablePaint._values[r].value;for(const i of n.getGlobalStateRefs()){const s=null!==(t=e.get(i))&&void 0!==t?t:[];s.push({name:r,value:n.value}),e.set(i,s)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,r={}){var n;if("visibility"===t)return this.visibility=e,this._visibilityExpression.setValue(e),void this.recalculateVisibility();(null===(n=this._transitionablePaint)||void 0===n?void 0:n.hasProperty(t))?this.fire(new Ii(new Error(t+ls))):null!=e&&this._validate(Mi,`layers.${this.id}.layout.${t}`,t,e,r)||this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){var e,r;if(t.endsWith(Yi)){const r=t.slice(0,-11);if("visibility"===r||(null===(e=this._unevaluatedLayout)||void 0===e?void 0:e.hasProperty(r)))throw new Error(t+us);return this._transitionablePaint.getTransition(r)}if("visibility"===t||(null===(r=this._unevaluatedLayout)||void 0===r?void 0:r.hasProperty(t)))throw new Error(t+us);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){var n;if("visibility"===t||(null===(n=this._unevaluatedLayout)||void 0===n?void 0:n.hasProperty(t)))return this.fire(new Ii(new Error(t+us))),!1;if(null!=e&&this._validate(Ei,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith(Yi))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 o=this._transitionablePaint._values[t].value;return o.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,s,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t=this.minzoom,e=!1){return!!(this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}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(){var t,e;const r={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:null===(t=this._unevaluatedLayout)||void 0===t?void 0:t.serialize(),paint:null===(e=this._transitionablePaint)||void 0===e?void 0:e.serialize()};return this.visibility&&(r.layout||(r.layout={}),r.layout.visibility=this.visibility),function(t,e){const r={};for(const n in t)e.call(this,t[n],n,t)&&(r[n]=t[n]);return r}(r,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,r,n,i={}){return!1!==(null==i?void 0:i.validate)&&function(t,e){let r=!1;if(null==e?void 0:e.length)for(const n of e)t.fire(new Ii(new Error(n.message))),r=!0;return r}(this,t.call(Ti,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:E,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 ts&&Nr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const hs={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ps{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 fs{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")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function ds(t,e=1){let r=0,n=0;return{members:t.map((t=>{const i=hs[t.type].BYTES_PER_ELEMENT,s=r=ys(r,Math.max(e,i)),o=t.components||1;return n=Math.max(n,i),r+=i*o,{name:t.name,type:t.type,components:o,offset:s}})),size:ys(r,Math.max(n,e)),alignment:e}}function ys(t,e){return Math.ceil(t/e)*e}class ms extends fs{_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}}ms.prototype.bytesPerElement=4,fi("StructArrayLayout2i4",ms);class gs extends fs{_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}}gs.prototype.bytesPerElement=6,fi("StructArrayLayout3i6",gs);class xs extends fs{_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}}xs.prototype.bytesPerElement=8,fi("StructArrayLayout4i8",xs);class vs extends fs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,this.int16[a+4]=s,this.int16[a+5]=o,t}}vs.prototype.bytesPerElement=12,fi("StructArrayLayout2i4i12",vs);class bs extends fs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,o){const a=4*t,l=8*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=s,this.uint8[l+7]=o,t}}bs.prototype.bytesPerElement=8,fi("StructArrayLayout2i4ub8",bs);class ws extends fs{_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}}ws.prototype.bytesPerElement=8,fi("StructArrayLayout2f8",ws);class _s extends fs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,s,o,a,l,u)}emplace(t,e,r,n,i,s,o,a,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]=o,this.uint16[h+6]=a,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}_s.prototype.bytesPerElement=20,fi("StructArrayLayout10ui20",_s);class Ss extends fs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,n,i,s,o,a)}emplace(t,e,r,n,i,s,o,a,l){const u=8*t;return this.uint16[u+0]=e,this.uint16[u+1]=r,this.uint16[u+2]=n,this.uint16[u+3]=i,this.uint16[u+4]=s,this.uint16[u+5]=o,this.uint16[u+6]=a,this.uint16[u+7]=l,t}}Ss.prototype.bytesPerElement=16,fi("StructArrayLayout8ui16",Ss);class As extends fs{_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,o,a,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,o,a,l,u,c,h)}emplace(t,e,r,n,i,s,o,a,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]=o,this.uint16[f+6]=a,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}}As.prototype.bytesPerElement=24,fi("StructArrayLayout4i4ui4i24",As);class Is extends fs{_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}}Is.prototype.bytesPerElement=12,fi("StructArrayLayout3f12",Is);class ks extends fs{_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}}ks.prototype.bytesPerElement=4,fi("StructArrayLayout1ul4",ks);class Ts extends fs{_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,o,a,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,s,o,a,l)}emplace(t,e,r,n,i,s,o,a,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]=o,this.uint32[h+3]=a,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}Ts.prototype.bytesPerElement=20,fi("StructArrayLayout6i1ul2ui20",Ts);class Es extends fs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,this.int16[a+4]=s,this.int16[a+5]=o,t}}Es.prototype.bytesPerElement=12,fi("StructArrayLayout2i2i2i12",Es);class Ms extends fs{_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 o=4*t,a=8*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.int16[a+6]=i,this.int16[a+7]=s,t}}Ms.prototype.bytesPerElement=16,fi("StructArrayLayout2f1f2i16",Ms);class Ps extends fs{_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,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,o){const a=16*t,l=4*t,u=8*t;return this.uint8[a+0]=e,this.uint8[a+1]=r,this.float32[l+1]=n,this.float32[l+2]=i,this.int16[u+6]=s,this.int16[u+7]=o,t}}Ps.prototype.bytesPerElement=16,fi("StructArrayLayout2ub2f2i16",Ps);class Ds extends fs{_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}}Ds.prototype.bytesPerElement=6,fi("StructArrayLayout3ui6",Ds);class Fs extends fs{_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,o,a,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,o,a,l,u,c,h,p,f,d,y,m)}emplace(t,e,r,n,i,s,o,a,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]=o,this.uint32[v+4]=a,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}}Fs.prototype.bytesPerElement=48,fi("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Fs);class zs extends fs{_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,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,A,I,k,T){const E=this.length;return this.resize(E+1),this.emplace(E,t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,A,I,k,T)}emplace(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,A,I,k,T,E){const M=32*t,P=16*t;return this.int16[M+0]=e,this.int16[M+1]=r,this.int16[M+2]=n,this.int16[M+3]=i,this.int16[M+4]=s,this.int16[M+5]=o,this.int16[M+6]=a,this.int16[M+7]=l,this.uint16[M+8]=u,this.uint16[M+9]=c,this.uint16[M+10]=h,this.uint16[M+11]=p,this.uint16[M+12]=f,this.uint16[M+13]=d,this.uint16[M+14]=y,this.uint16[M+15]=m,this.uint16[M+16]=g,this.uint16[M+17]=x,this.uint16[M+18]=v,this.uint16[M+19]=b,this.uint16[M+20]=w,this.uint16[M+21]=_,this.uint16[M+22]=S,this.uint32[P+12]=A,this.float32[P+13]=I,this.float32[P+14]=k,this.uint16[M+30]=T,this.uint16[M+31]=E,t}}zs.prototype.bytesPerElement=64,fi("StructArrayLayout8i15ui1ul2f2ui64",zs);class Bs extends fs{_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}}Bs.prototype.bytesPerElement=4,fi("StructArrayLayout1f4",Bs);class Cs extends fs{_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}}Cs.prototype.bytesPerElement=12,fi("StructArrayLayout1ui2f12",Cs);class Vs extends fs{_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}}Vs.prototype.bytesPerElement=8,fi("StructArrayLayout1ul2ui8",Vs);class Ls extends fs{_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}}Ls.prototype.bytesPerElement=4,fi("StructArrayLayout2ui4",Ls);class Os extends fs{_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}}Os.prototype.bytesPerElement=2,fi("StructArrayLayout1ui2",Os);class $s extends fs{_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}}$s.prototype.bytesPerElement=16,fi("StructArrayLayout4f16",$s);class Rs extends ps{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 e(this.anchorPointX,this.anchorPointY)}}Rs.prototype.size=20;class Ns extends Ts{get(t){return new Rs(this,t)}}fi("CollisionBoxArray",Ns);class Us extends ps{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]}}Us.prototype.size=48;class qs extends Fs{get(t){return new Us(this,t)}}fi("PlacedSymbolArray",qs);class js extends ps{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]}}js.prototype.size=64;class Gs extends zs{get(t){return new js(this,t)}}fi("SymbolInstanceArray",Gs);class Xs extends Bs{getoffsetX(t){return this.float32[1*t+0]}}fi("GlyphOffsetArray",Xs);class Ys extends gs{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}fi("SymbolLineVertexArray",Ys);class Zs extends ps{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]}}Zs.prototype.size=12;class Ws extends Cs{get(t){return new Zs(this,t)}}fi("TextAnchorOffsetArray",Ws);class Hs extends ps{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]}}Hs.prototype.size=8;class Js extends Vs{get(t){return new Hs(this,t)}}fi("FeatureIndexArray",Js);class Ks extends ms{}class Qs extends ms{}class to extends ms{}class eo extends vs{}class ro extends bs{}class no extends ws{}class io extends _s{}class so extends Ss{}class oo extends As{}class ao extends Is{}class lo extends ks{}class uo extends Es{}class co extends Ps{}class ho extends Ds{}class po extends Ls{}const fo=ds([{name:"a_pos",components:2,type:"Int16"}],4),{members:yo}=fo;class mo{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,e,r,n){const i=this.segments[this.segments.length-1];return t>mo.MAX_VERTEX_ARRAY_LENGTH&&v(`Max vertices per segment is ${mo.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${mo.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!i||i.vertexLength+t>mo.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n?this.createNewSegment(e,r,n):i}createNewSegment(t,e,r){const n={vertexOffset:t.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==r&&(n.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(t,e,r){return this.prepareSegment(0,t,e,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}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 mo([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function go(t,e){return 256*(t=d(Math.floor(t),0,255))+d(Math.floor(e),0,255)}mo.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,fi("SegmentVector",mo);const xo=ds([{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"}]),vo=ds([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var bo,wo,_o,So={exports:{}},Ao={exports:{}},Io={exports:{}},ko=function(){if(_o)return So.exports;_o=1;var t=(bo||(bo=1,Ao.exports=function(t,e){var r,n,i,s,o,a,l,u;for(n=t.length-(r=3&t.length),i=e,o=3432918353,a=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)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&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)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&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}),Ao.exports),e=(wo||(wo=1,Io.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}),Io.exports);return So.exports=t,So.exports.murmur3=t,So.exports.murmur2=e,So.exports}(),To=r(ko);class Eo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,n){this.ids.push(Mo(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=Mo(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 Po(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new Eo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Mo(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:To(String(t))}function Po(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let s=r-1,o=n+1;for(;;){do{s++}while(t[s]<i);do{o--}while(t[o]>i);if(s>=o)break;Do(t,s,o),Do(e,3*s,3*o),Do(e,3*s+1,3*o+1),Do(e,3*s+2,3*o+2)}o-r<n-o?(Po(t,e,r,o),r=o+1):(Po(t,e,o+1,n),n=o)}}function Do(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}fi("FeaturePositionMap",Eo);class Fo{constructor(t,e){this.gl=t.gl,this.location=e}}class zo extends Fo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Bo extends Fo{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 Co extends Fo{constructor(t,e){super(t,e),this.current=kt.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 Vo(t){return[go(255*t.r,255*t.g),go(255*t.b,255*t.a)]}class Lo{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 Co(t,e):new zo(t,e)}}class Oo{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}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,r,n){let i=null;"u_pattern_to"===n?i=this.patternTo:"u_pattern_from"===n?i=this.patternFrom:"u_dasharray_to"===n?i=this.dashTo:"u_dasharray_from"===n?i=this.dashFrom:"u_pixel_ratio_to"===n?i=this.pixelRatioTo:"u_pixel_ratio_from"===n&&(i=this.pixelRatioFrom),null!==i&&t.set(i)}getBinding(t,e,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new Bo(t,e):new zo(t,e)}}class $o{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){const n=this.paintVertexArray.length,i=this.expression.evaluate(new Gi(0,r),e,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(n,t,i)}updatePaintArray(t,e,r,n,i){const s=this.expression.evaluate(new Gi(0,i),r,n);this._setPaintValue(t,e,s)}_setPaintValue(t,e,r){if("color"===this.type){const n=Vo(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){var e,r;(null===(e=this.paintVertexArray)||void 0===e?void 0:e.arrayBuffer.byteLength)&&((null===(r=this.paintVertexBuffer)||void 0===r?void 0:r.buffer)?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ro{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){const n=this.expression.evaluate(new Gi(this.zoom,r),e,{},r.canonical,[],r.formattedSection),i=this.expression.evaluate(new Gi(this.zoom+1,r),e,{},r.canonical,[],r.formattedSection),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,n,i)}updatePaintArray(t,e,r,n,i){const s=this.expression.evaluate(new Gi(this.zoom,i),r,n),o=this.expression.evaluate(new Gi(this.zoom+1,i),r,n);this._setPaintValue(t,e,s,o)}_setPaintValue(t,e,r,n){if("color"===this.type){const i=Vo(r),s=Vo(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){var e,r;(null===(e=this.paintVertexArray)||void 0===e?void 0:e.arrayBuffer.byteLength)&&((null===(r=this.paintVertexBuffer)||void 0===r?void 0:r.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=d(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(n)}getBinding(t,e,r){return new zo(t,e)}}class No{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,this.getPositionIds(e),r)}updatePaintArray(t,e,r,n,i){this._setPaintValues(t,e,this.getPositionIds(r),i)}_setPaintValues(t,e,r,n){const i=this.getPositions(n);if(!i||!r)return;const s=i[r.min],o=i[r.mid],a=i[r.max];if(s&&o&&a)for(let r=t;r<e;r++)this.emplace(this.zoomInPaintVertexArray,r,o,s),this.emplace(this.zoomOutPaintVertexArray,r,o,a)}upload(t){var e,r;if((null===(e=this.zoomInPaintVertexArray)||void 0===e?void 0:e.arrayBuffer.byteLength)&&(null===(r=this.zoomOutPaintVertexArray)||void 0===r?void 0:r.arrayBuffer.byteLength)){const e=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,e,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,e,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Uo extends No{getPositions(t){return t.imagePositions}getPositionIds(t){var e;return null===(e=t.patterns)||void 0===e?void 0:e[this.layerId]}getVertexAttributes(){return xo.members}emplace(t,e,r,n){t.emplace(e,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],n.tlbr[0],n.tlbr[1],n.tlbr[2],n.tlbr[3],r.pixelRatio,n.pixelRatio)}}class qo extends No{getPositions(t){return t.dashPositions}getPositionIds(t){var e;return null===(e=t.dashes)||void 0===e?void 0:e[this.layerId]}getVertexAttributes(){return vo.members}emplace(t,e,r,n){t.emplace(e,0,r.y,r.height,r.width,0,n.y,n.height,n.width)}}class jo{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 ts&&Nr(s.property.specification)))continue;const o=Xo(i,t.type),a=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"===a.kind)this.binders[i]=h?new Oo(a.value,o):new Lo(a.value,o,l),n.push(`/u_${i}`);else if("source"===a.kind||h){const r=Yo(i,l,"source");this.binders[i]=h?"line-dasharray"===i?new qo(a,l,u,e,r,t.id):new Uo(a,l,u,e,r,t.id):new $o(a,o,l,r),n.push(`/a_${i}`)}else{const t=Yo(i,l,"composite");this.binders[i]=new Ro(a,o,l,u,e,t),n.push(`/z_${i}`)}}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof $o||e instanceof Ro?e.maxValue:0}populatePaintArrays(t,e,r){for(const n in this.binders){const i=this.binders[n];(i instanceof $o||i instanceof Ro||i instanceof No)&&i.populatePaintArray(t,e,r)}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof Oo&&n.setConstantPatternPositions(t,e)}}setConstantDashPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof Oo&&n.setConstantDashPositions(t,e)}}updatePaintArrays(t,e,r,n,i){let s=!1;for(const o in t){const a=e.getPositions(o);for(const e of a){const a=r.feature(e.index);for(const r in this.binders){const l=this.binders[r];if((l instanceof $o||l instanceof Ro||l instanceof No)&&!0===l.expression.isStateDependent){const u=n.paint.get(r);l.expression=u.value,l.updatePaintArray(e.start,e.end,a,t[o],i),s=!0}}}}return s}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof Lo||r instanceof Oo)&&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 $o||r instanceof Ro)for(const e of r.paintVertexAttributes)t.push(e.name);else if(r instanceof No){const e=r.getVertexAttributes();for(const r of e)t.push(r.name)}}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Lo||r instanceof Oo||r instanceof Ro)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 Lo||i instanceof Oo||i instanceof Ro)for(const s of i.uniformNames)if(e[s]){const o=i.getBinding(t,e[s],s);r.push({name:s,property:n,binding:o})}}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 No){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof $o||r instanceof Ro)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof $o||r instanceof Ro||r instanceof No)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof $o||e instanceof Ro||e instanceof No)&&e.destroy()}}}class Go{constructor(t,e,r=()=>!0){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new jo(n,e,r);this.needsUpload=!1,this._featureMap=new Eo,this._bufferOffset=0}populatePaintArrays(t,e,r,n){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n);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 Xo(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-dasharray":["dasharray_to","dasharray_from"],"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 Yo(t,e,r){const n={color:{source:ws,composite:$s},number:{source:Bs,composite:ws}},i=function(t){return{"line-pattern":{source:io,composite:io},"fill-pattern":{source:io,composite:io},"fill-extrusion-pattern":{source:io,composite:io},"line-dasharray":{source:so,composite:so}}[t]}(t);return(null==i?void 0:i[r])||n[e][r]}fi("ConstantBinder",Lo),fi("CrossFadedConstantBinder",Oo),fi("SourceExpressionBinder",$o),fi("CrossFadedPatternBinder",Uo),fi("CrossFadedDasharrayBinder",qo),fi("CompositeExpressionBinder",Ro),fi("ProgramConfiguration",jo,{omit:["_buffers"]}),fi("ProgramConfigurationSet",Go);const Zo=Math.pow(2,14)-1,Wo=-Zo-1;function Ho(t){const e=p/t.extent,r=t.loadGeometry();for(const t of r)for(const r of t){const t=Math.round(r.x*e),n=Math.round(r.y*e);r.x=d(t,Wo,Zo),r.y=d(n,Wo,Zo),(t<r.x||t>r.x+1||n<r.y||n>r.y+1)&&v("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function Jo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Ho(t):[]}}const Ko=-32768;function Qo(t,e,r,n,i){t.emplaceBack(Ko+8*e+n,Ko+8*r+i)}class ta{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.hasDependencies=!1,this.layoutVertexArray=new Qs,this.indexArray=new ho,this.segments=new mo,this.programConfigurations=new Go(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,o=!1,a="heatmap"===n.type;if("circle"===n.type){const t=n;s=t.layout.get("circle-sort-key"),o=!s.isConstant(),a||(a="map"===t.paint.get("circle-pitch-alignment"))}const l=a?e.subdivisionGranularity.circle:1;for(const{feature:e,id:n,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Jo(e,t);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),u,r))continue;const c=o?s.evaluate(u,{},r):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?u.geometry:Ho(e),patterns:{},sortKey:c};i.push(h)}o&&i.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of i){const{geometry:i,index:s,sourceLayerIndex:o}=n,a=t[s].feature;this.addFeature(n,i,s,r,l),e.featureIndex.insert(a,i,s,o,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,yo),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,i=1){let s;switch(i){case 1:s=[0,7];break;case 3:s=[0,2,5,7];break;case 5:s=[0,1,3,4,6,7];break;case 7:s=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${i}; valid values are 1, 3, 5, 7.`)}const o=s.length;for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=p||n<0||n>=p)continue;const i=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,t.sortKey),a=i.vertexLength;for(let t=0;t<o;t++)for(let e=0;e<o;e++)Qo(this.layoutVertexArray,r,n,s[e],s[t]);for(let t=0;t<o-1;t++)for(let e=0;e<o-1;e++){const r=a+t*o+e,n=a+(t+1)*o+e;this.indexArray.emplaceBack(r,n+1,r+1),this.indexArray.emplaceBack(r,n,n+1)}i.vertexLength+=o*o,i.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:{},canonical:n})}}function ea(t,e){for(const r of t)if(ca(e,r))return!0;for(const r of e)if(ca(t,r))return!0;return sa(t,e)}function ra(t,e,r){return!!ca(t,e)||aa(e,t,r)}function na(t,e){if(1===t.length)return ua(e,t[0]);for(const r of e)for(const e of r)if(ca(t,e))return!0;for(const r of t)if(ua(e,r))return!0;for(const r of e)if(sa(t,r))return!0;return!1}function ia(t,e,r){if(t.length>1){if(sa(t,e))return!0;for(const n of e)if(aa(n,t,r))return!0}for(const n of t)if(aa(n,e,r))return!0;return!1}function sa(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(oa(n,i,e[t],e[t+1]))return!0}return!1}function oa(t,e,r,n){return b(t,r,n)!==b(e,r,n)&&b(t,e,r)!==b(t,e,n)}function aa(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(la(t,e[r-1],e[r])<n)return!0;return!1}function la(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 ua(t,e){let r,n,i,s=!1;for(const o of t){r=o;for(let t=0,o=r.length-1;t<r.length;o=t++)n=r[t],i=r[o],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 ca(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const s=t[n],o=t[i];s.y>e.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(r=!r)}return r}function ha(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=b(t,e,r[0]);return s!==b(t,e,r[1])||s!==b(t,e,r[2])||s!==b(t,e,r[3])}function pa(t,e,r){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function fa(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function da(t,r,n,i,s){if(!r[0]&&!r[1])return t;const o=e.convert(r)._mult(s);"viewport"===n&&o._rotate(-i);const a=[];for(const e of t)a.push(e.sub(o));return a}function ya(t){const e=[];for(let r=0;r<t.length;r++){const n=t[r],i=e.at(-1);(0===r||i&&!n.equals(i))&&e.push(n)}return e}function ma({queryGeometry:t,size:e},r){return ra(t,r,e)}function ga({queryGeometry:t,size:e,transform:r,unwrappedTileID:n,getElevation:i},s){return ra(t,s,e*(r.projectTileCoordinates(s.x,s.y,n,i).signedDistanceFromCamera/r.cameraToCenterDistance))}function xa({queryGeometry:t,size:e,transform:r,unwrappedTileID:n,getElevation:i},s){const o=r.projectTileCoordinates(s.x,s.y,n,i).signedDistanceFromCamera,a=e*(r.cameraToCenterDistance/o);return ra(t,wa(s,r,n,i),a)}function va({queryGeometry:t,size:e,transform:r,unwrappedTileID:n,getElevation:i},s){return ra(t,wa(s,r,n,i),e)}function ba({queryGeometry:t,size:e,transform:r,unwrappedTileID:n,getElevation:i,pitchAlignment:s="map",pitchScale:o="map"},a){const l="map"===s?"map"===o?ma:ga:"map"===o?xa:va,u={queryGeometry:t,size:e,transform:r,unwrappedTileID:n,getElevation:i};for(const t of a)for(const e of t)if(l(u,e))return!0;return!1}function wa(t,r,n,i){const s=r.projectTileCoordinates(t.x,t.y,n,i).point;return new e((.5*s.x+.5)*r.width,(.5*-s.y+.5)*r.height)}let _a,Sa;fi("CircleBucket",ta,{omit:["layers"]});var Aa={get paint(){return Sa=Sa||new as({"circle-radius":new ns(E.paint_circle["circle-radius"]),"circle-color":new ns(E.paint_circle["circle-color"]),"circle-blur":new ns(E.paint_circle["circle-blur"]),"circle-opacity":new ns(E.paint_circle["circle-opacity"]),"circle-translate":new rs(E.paint_circle["circle-translate"]),"circle-translate-anchor":new rs(E.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new rs(E.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new rs(E.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ns(E.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ns(E.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ns(E.paint_circle["circle-stroke-opacity"])})},get layout(){return _a=_a||new as({"circle-sort-key":new ns(E.layout_circle["circle-sort-key"])})}};class Ia extends cs{constructor(t,e){super(t,Aa,e)}createBucket(t){return new ta(t)}queryRadius(t){const e=t;return pa("circle-radius",this,e)+pa("circle-stroke-width",this,e)+fa(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:n,transform:i,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:a}){const l=da(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-i.bearingInRadians,s),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c=this.paint.get("circle-pitch-scale"),h=this.paint.get("circle-pitch-alignment");let p,f;return"map"===h?(p=l,f=u*s):(p=function(t,e,r,n){return t.map((t=>wa(t,e,r,n)))}(l,i,o,a),f=u),ba({queryGeometry:p,size:f,transform:i,unwrappedTileID:o,getElevation:a,pitchAlignment:h,pitchScale:c},n)}}class ka extends ta{}let Ta;fi("HeatmapBucket",ka,{omit:["layers"]});var Ea={get paint(){return Ta=Ta||new as({"heatmap-radius":new ns(E.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ns(E.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new rs(E.paint_heatmap["heatmap-intensity"]),"heatmap-color":new os(E.paint_heatmap["heatmap-color"]),"heatmap-opacity":new rs(E.paint_heatmap["heatmap-opacity"])})}};function Ma(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 Pa(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;const i=Ma({},{width:e,height:r},n);Da(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 Da(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 o=t.data,a=e.data;if(o===a)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++)a[c+t]=o[u+t]}return e}class Fa{constructor(t,e){Ma(this,t,1,e)}resize(t){Pa(this,t,1)}clone(){return new Fa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){Da(t,e,r,n,i,1)}}class za{constructor(t,e){Ma(this,t,4,e)}resize(t){Pa(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new za({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){Da(t,e,r,n,i,4)}setPixel(t,e,r){const n=4*(t*this.width+e);this.data[n+0]=Math.round(255*r.r/r.a),this.data[n+1]=Math.round(255*r.g/r.a),this.data[n+2]=Math.round(255*r.b/r.a),this.data[n+3]=Math.round(255*r.a)}}function Ba(t){const e=new Uint8Array(t.length);for(let r=0;r<t.length;r+=4){const n=t[r+3];e[r+0]=Math.round(t[r+0]*n/255),e[r+1]=Math.round(t[r+1]*n/255),e[r+2]=Math.round(t[r+2]*n/255),e[r+3]=n}return e}fi("AlphaImage",Fa),fi("RGBAImage",za);const Ca="big-fb";class Va extends cs{createBucket(t){return new ka(t)}constructor(t,e){super(t,Ea,e),this.heatmapFbos=new Map,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 za({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=(n,s,o)=>{e[t.evaluationKey]=o;const a=t.expression.evaluate(e);i.setPixel(n/4/r,s/4,a)};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,o=0;n<r;n++,o+=4){const a=n/(r-1),{start:l,end:u}=t.clips[e];s(i,o,l*(1-a)+u*a)}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.heatmapFbos.has(Ca)&&this.heatmapFbos.delete(Ca)}queryRadius(t){return pa("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:n,transform:i,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:a}){return ba({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(e,r)*s,transform:i,unwrappedTileID:o,getElevation:a},n)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}}let La;var Oa={get paint(){return La=La||new as({"hillshade-illumination-direction":new rs(E.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new rs(E.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new rs(E.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new rs(E.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new rs(E.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new rs(E.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new rs(E.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new rs(E.paint_hillshade["hillshade-method"]),resampling:new rs(E.paint_hillshade.resampling)})}};class $a extends cs{constructor(t,e){super(t,Oa,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,n=this.paint.get("hillshade-shadow-color").values;const i=Math.max(t.length,e.length,r.length,n.length);t=t.concat(Array(i-t.length).fill(t.at(-1))),e=e.concat(Array(i-e.length).fill(e.at(-1))),r=r.concat(Array(i-r.length).fill(r.at(-1))),n=n.concat(Array(i-n.length).fill(n.at(-1)));const s=e.map(k);return{directionRadians:t.map(k),altitudeRadians:s,shadowColor:n,highlightColor:r}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}}let Ra;var Na={get paint(){return Ra=Ra||new as({"color-relief-opacity":new rs(E["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new os(E["paint_color-relief"]["color-relief-color"]),resampling:new rs(E["paint_color-relief"].resampling)})}};function Ua(t){return"data"in t}class qa{constructor(t,e,r,n){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,n)}update(t,e,r){var n;const{width:i,height:s}=t,o=((null===(n=this.size)||void 0===n?void 0:n[0])!==i||this.size[1]!==s)&&!r,{context:a}=this,{gl:l}=a;this.useMipmap=Boolean(null==e?void 0:e.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1);const u=this.format===l.RGBA&&!1!==(null==e?void 0:e.premultiply);if(o)this.size=[i,s],Ua(t)?(a.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,u,i,s,l)):(a.pixelStoreUnpackPremultiplyAlpha.set(u),this._uploadDomImage(t,l));else{const{x:e,y:n}=r||{x:0,y:0};Ua(t)?(a.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,u,e,n,i,s,l)):(a.pixelStoreUnpackPremultiplyAlpha.set(u),this._updateDomImage(t,e,n,l))}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,r,n,i){let{data:s}=t;e&&s&&(s=Ba(s)),i.texImage2D(i.TEXTURE_2D,0,this.format,r,n,0,this.format,i.UNSIGNED_BYTE,s)}_updateDomImage(t,e,r,n){n.texSubImage2D(n.TEXTURE_2D,0,e,r,n.RGBA,n.UNSIGNED_BYTE,t)}_updateRawData(t,e,r,n,i,s,o){let{data:a}=t;e&&a&&(a=Ba(a)),o.texSubImage2D(o.TEXTURE_2D,0,r,n,i,s,o.RGBA,o.UNSIGNED_BYTE,a)}bind(t,e,r){const{context:n}=this,{gl:i}=n;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),i.bindTexture(i.TEXTURE_2D,this.texture),r!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=i.LINEAR),t!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class ja{constructor(t,e,r,n=1,i=1,s=1,o=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 v(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const a=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=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=0;t<a;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(a,t)]=this.data[this._idx(a-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,a)]=this.data[this._idx(t,a-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(a,-1)]=this.data[this._idx(a-1,0)],this.data[this._idx(-1,a)]=this.data[this._idx(0,a-1)],this.data[this._idx(a,a)]=this.data[this._idx(a-1,a-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<a;t++)for(let e=0;e<a;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. x: ${t}, y: ${e}, dim: ${this.dim}`);return(e+1)*this.stride+(t+1)}unpack(t,e,r){return t*this.redFactor+e*this.greenFactor+r*this.blueFactor-this.baseShift}pack(t){return Ga(t,this.getUnpackVector())}getPixels(){return new za({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,o=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=o-1;break;case 1:o=s+1}const a=-e*this.dim,l=-r*this.dim;for(let e=s;e<o;e++)for(let r=n;r<i;r++)this.data[this._idx(r,e)]=t.data[this._idx(r+a,e+l)]}}function Ga(t,e){const r=e[0],n=e[1],i=e[2],s=e[3],o=Math.min(r,n,i),a=Math.round((t+s)/o);return{r:Math.floor(a*o/r)%256,g:Math.floor(a*o/n)%256,b:Math.floor(a*o/i)%256}}fi("DEMData",ja);class Xa extends cs{constructor(t,e){super(t,Na,e)}_createColorRamp(t){const e={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof rn&&r._styleExpression.expression instanceof pe){this.colorRampExpression=r;const t=r._styleExpression.expression;e.elevationStops=t.labels,e.colorStops=[];for(const r of e.elevationStops)e.colorStops.push(t.evaluate({globals:{elevation:r}}))}if(e.elevationStops.length<1&&(e.elevationStops=[0],e.colorStops=[kt.transparent]),e.elevationStops.length<2&&(e.elevationStops.push(e.elevationStops[0]+1),e.colorStops.push(e.colorStops[0])),e.elevationStops.length<=t)return e;const n={elevationStops:[],colorStops:[]},i=(e.elevationStops.length-1)/(t-1);for(let t=0;t<e.elevationStops.length-.5;t+=i)n.elevationStops.push(e.elevationStops[Math.round(t)]),n.colorStops.push(e.colorStops[Math.round(t)]);return v(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${e.elevationStops.length}`),n}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,e,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const n=this._createColorRamp(e),i=new za({width:n.colorStops.length,height:1}),s=new za({width:n.colorStops.length,height:1});for(let t=0;t<n.elevationStops.length;t++){const e=Ga(n.elevationStops[t],r);s.setPixel(0,t,new kt(e.r/255,e.g/255,e.b/255,1)),i.setPixel(0,t,n.colorStops[t])}return this.colorRampTextures={elevationTexture:new qa(t,s,t.gl.RGBA),colorTexture:new qa(t,i,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const Ya=ds([{name:"a_pos",components:2,type:"Int16"}],4),{members:Za}=Ya;function Wa(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 Ha(t,e,r,n,i){const{zoom:s}=n,o=i.patternDependencies;for(const n of e){const e=n.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:s-1},r,{},i.availableImages),a=e.evaluate({zoom:s},r,{},i.availableImages),l=e.evaluate({zoom:s+1},r,{},i.availableImages);t=(null==t?void 0:t.name)?t.name:t,a=(null==a?void 0:a.name)?a.name:a,l=(null==l?void 0:l.name)?l.name:l,o[t]=!0,o[a]=!0,o[l]=!0,r.patterns[n.id]={min:t,mid:a,max:l}}}return r}function Ja(t,e,r,n,i){let s;if(i===function(t,e,r,n){let i=0;for(let s=e,o=r-n;s<r;s+=n)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}(t,e,r,n)>0)for(let i=e;i<r;i+=n)s=vl(i/n|0,t[i],t[i+1],s);else for(let i=r-n;i>=e;i-=n)s=vl(i/n|0,t[i],t[i+1],s);return s&&fl(s,s.next)&&(bl(s),s=s.next),s}function Ka(t,e){if(!t)return t;e||(e=t);let r,n=t;do{if(r=!1,n.steiner||!fl(n,n.next)&&0!==pl(n.prev,n,n.next))n=n.next;else{if(bl(n),n=e=n.prev,n===n.next)break;r=!0}}while(r||n!==e);return e}function Qa(t,e,r,n,i,s,o){if(!t)return;!o&&s&&function(t,e,r,n){let i=t;do{0===i.z&&(i.z=al(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){let e,r=1;do{let n,i=t;t=null;let s=null;for(e=0;i;){e++;let o=i,a=0;for(let t=0;t<r&&(a++,o=o.nextZ,o);t++);let l=r;for(;a>0||l>0&&o;)0!==a&&(0===l||!o||i.z<=o.z)?(n=i,i=i.nextZ,a--):(n=o,o=o.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=o}s.nextZ=null,r*=2}while(e>1)}(i)}(t,n,i,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,u=t.next;if(s?el(t,n,i,s):tl(t))e.push(l.i,t.i,u.i),bl(t),t=u.next,a=u.next;else if((t=u)===a){o?1===o?Qa(t=rl(Ka(t),e),e,r,n,i,s,2):2===o&&nl(t,e,r,n,i,s):Qa(Ka(t),e,r,n,i,s,1);break}}}function tl(t){const e=t.prev,r=t,n=t.next;if(pl(e,r,n)>=0)return!1;const i=e.x,s=r.x,o=n.x,a=e.y,l=r.y,u=n.y,c=Math.min(i,s,o),h=Math.min(a,l,u),p=Math.max(i,s,o),f=Math.max(a,l,u);let d=n.next;for(;d!==e;){if(d.x>=c&&d.x<=p&&d.y>=h&&d.y<=f&&cl(i,a,s,l,o,u,d.x,d.y)&&pl(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function el(t,e,r,n){const i=t.prev,s=t,o=t.next;if(pl(i,s,o)>=0)return!1;const a=i.x,l=s.x,u=o.x,c=i.y,h=s.y,p=o.y,f=Math.min(a,l,u),d=Math.min(c,h,p),y=Math.max(a,l,u),m=Math.max(c,h,p),g=al(f,d,e,r,n),x=al(y,m,e,r,n);let v=t.prevZ,b=t.nextZ;for(;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==o&&cl(a,c,l,h,u,p,v.x,v.y)&&pl(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!==o&&cl(a,c,l,h,u,p,b.x,b.y)&&pl(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!==o&&cl(a,c,l,h,u,p,v.x,v.y)&&pl(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!==o&&cl(a,c,l,h,u,p,b.x,b.y)&&pl(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function rl(t,e){let r=t;do{const n=r.prev,i=r.next.next;!fl(n,i)&&dl(n,r,r.next,i)&&gl(n,i)&&gl(i,n)&&(e.push(n.i,r.i,i.i),bl(r),bl(r.next),r=t=i),r=r.next}while(r!==t);return Ka(r)}function nl(t,e,r,n,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&hl(o,t)){let a=xl(o,t);return o=Ka(o,o.next),a=Ka(a,a.next),Qa(o,e,r,n,i,s,0),void Qa(a,e,r,n,i,s,0)}t=t.next}o=o.next}while(o!==t)}function il(t,e){let r=t.x-e.x;return 0===r&&(r=t.y-e.y,0===r)&&(r=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),r}function sl(t,e){const r=function(t,e){let r=e;const n=t.x,i=t.y;let s,o=-1/0;if(fl(t,r))return r;do{if(fl(t,r.next))return r.next;if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){const t=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(t<=n&&t>o&&(o=t,s=r.x<r.next.x?r:r.next,t===n))return s}r=r.next}while(r!==e);if(!s)return null;const a=s,l=s.x,u=s.y;let c=1/0;r=s;do{if(n>=r.x&&r.x>=l&&n!==r.x&&ul(i<u?n:o,i,l,u,i<u?o:n,i,r.x,r.y)){const e=Math.abs(i-r.y)/(n-r.x);gl(r,t)&&(e<c||e===c&&(r.x>s.x||r.x===s.x&&ol(s,r)))&&(s=r,c=e)}r=r.next}while(r!==a);return s}(t,e);if(!r)return e;const n=xl(r,t);return Ka(n,n.next),Ka(r,r.next)}function ol(t,e){return pl(t.prev,t,e.prev)<0&&pl(e.next,t,t.next)<0}function al(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 ll(t){let 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 ul(t,e,r,n,i,s,o,a){return(i-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(n-a)>=(r-o)*(e-a)&&(r-o)*(s-a)>=(i-o)*(n-a)}function cl(t,e,r,n,i,s,o,a){return!(t===o&&e===a)&&ul(t,e,r,n,i,s,o,a)}function hl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&dl(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(gl(t,e)&&gl(e,t)&&function(t,e){let r=t,n=!1;const 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)&&(pl(t.prev,t,e.prev)||pl(t,e.prev,e))||fl(t,e)&&pl(t.prev,t,t.next)>0&&pl(e.prev,e,e.next)>0)}function pl(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function fl(t,e){return t.x===e.x&&t.y===e.y}function dl(t,e,r,n){const i=ml(pl(t,e,r)),s=ml(pl(t,e,n)),o=ml(pl(r,n,t)),a=ml(pl(r,n,e));return i!==s&&o!==a||!(0!==i||!yl(t,r,e))||!(0!==s||!yl(t,n,e))||!(0!==o||!yl(r,t,n))||!(0!==a||!yl(r,e,n))}function yl(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 ml(t){return t>0?1:t<0?-1:0}function gl(t,e){return pl(t.prev,t,t.next)<0?pl(t,e,t.next)>=0&&pl(t,t.prev,e)>=0:pl(t,e,t.prev)<0||pl(t,t.next,e)<0}function xl(t,e){const r=wl(t.i,t.x,t.y),n=wl(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 vl(t,e,r,n){const i=wl(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 bl(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 wl(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class _l{constructor(t,e){if(e>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Sl{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Sl.noSubdivision=new Sl({fill:new _l(0,0),line:new _l(0,0),tile:new _l(0,0),stencil:new _l(0,0),circle:1}),fi("SubdivisionGranularityExpression",_l),fi("SubdivisionGranularitySetting",Sl);const Al=-32768,Il=32767;class kl{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=p/t,this._canonical=e}_getKey(t,e){return(t+=32768)<<16|e+32768}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const r=0|Math.round(t),n=0|Math.round(e),i=this._getKey(r,n);if(this._vertexDictionary.has(i))return this._vertexDictionary.get(i);const s=this._vertexBuffer.length/2;return this._vertexDictionary.set(i,s),this._vertexBuffer.push(r,n),s}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(t,e){const r=[];for(let n=0;n<e.length;n+=3){const i=e[n],s=e[n+1],o=e[n+2],a=t[2*i],l=t[2*i+1];(t[2*s]-a)*(t[2*o+1]-l)-(t[2*s+1]-l)*(t[2*o]-a)>0?(r.push(i),r.push(o),r.push(s)):(r.push(i),r.push(s),r.push(o))}return r}(this._vertexBuffer,t);const e=[],r=t.length;for(let n=0;n<r;n+=3){const r=[t[n+0],t[n+1],t[n+2]],i=[this._vertexBuffer[2*t[n+0]+0],this._vertexBuffer[2*t[n+0]+1],this._vertexBuffer[2*t[n+1]+0],this._vertexBuffer[2*t[n+1]+1],this._vertexBuffer[2*t[n+2]+0],this._vertexBuffer[2*t[n+2]+1]];let s=1/0,o=1/0,a=-1/0,l=-1/0;for(let t=0;t<3;t++){const e=i[2*t],r=i[2*t+1];s=Math.min(s,e),a=Math.max(a,e),o=Math.min(o,r),l=Math.max(l,r)}if(s===a||o===l)continue;const u=Math.floor(s/this._granularityCellSize),c=Math.ceil(a/this._granularityCellSize),h=Math.floor(o/this._granularityCellSize),p=Math.ceil(l/this._granularityCellSize);if(u!==c||h!==p)for(let t=h;t<p;t++){const n=this._scanlineGenerateVertexRingForCellRow(t,i,r);Ml(this._vertexBuffer,n,e)}else e.push(...r)}return e}_scanlineGenerateVertexRingForCellRow(t,e,r){const n=t*this._granularityCellSize,i=n+this._granularityCellSize,s=[];for(let t=0;t<3;t++){const o=e[2*t],a=e[2*t+1],l=e[2*(t+1)%6],u=e[(2*(t+1)+1)%6],c=e[2*(t+2)%6],h=e[(2*(t+2)+1)%6],p=l-o,f=u-a,d=0===p,y=0===f,m=(n-a)/f,g=(i-a)/f,x=Math.min(m,g),v=Math.max(m,g);if(!y&&(x>=1||v<=0)||y&&(a<n||a>i)){u>=n&&u<=i&&s.push(r[(t+1)%3]);continue}!y&&x>0&&s.push(this._vertexToIndex(o+p*x,a+f*x));const b=o+p*Math.max(x,0),w=o+p*Math.min(v,1);d||this._generateIntraEdgeVertices(s,o,a,l,u,b,w),!y&&v<1&&s.push(this._vertexToIndex(o+p*v,a+f*v)),(y||u>=n&&u<=i)&&s.push(r[(t+1)%3]),!y&&(u<=n||u>=i)&&this._generateInterEdgeVertices(s,o,a,l,u,c,h,w,n,i)}return s}_generateIntraEdgeVertices(t,e,r,n,i,s,o){const a=n-e,l=i-r,u=0===l,c=u?Math.min(e,n):Math.min(s,o),h=u?Math.max(e,n):Math.max(s,o),p=Math.floor(c/this._granularityCellSize)+1,f=Math.ceil(h/this._granularityCellSize)-1;if(u?e<n:s<o)for(let n=p;n<=f;n++){const i=n*this._granularityCellSize;t.push(this._vertexToIndex(i,r+l*(i-e)/a))}else for(let n=f;n>=p;n--){const i=n*this._granularityCellSize;t.push(this._vertexToIndex(i,r+l*(i-e)/a))}}_generateInterEdgeVertices(t,e,r,n,i,s,o,a,l,u){const c=i-r,h=s-n,p=o-i,f=(l-i)/p,d=(u-i)/p,y=Math.min(f,d),m=Math.max(f,d),g=n+h*y;let x=Math.floor(Math.min(g,a)/this._granularityCellSize)+1,v=Math.ceil(Math.max(g,a)/this._granularityCellSize)-1,b=a<g;const w=0===p;if(w&&(o===l||o===u))return;if(w||y>=1||m<=0){const t=r-o,n=s+(e-s)*Math.min((l-o)/t,(u-o)/t);x=Math.floor(Math.min(n,a)/this._granularityCellSize)+1,v=Math.ceil(Math.max(n,a)/this._granularityCellSize)-1,b=a<n}const _=c>0?u:l;if(b)for(let e=x;e<=v;e++)t.push(this._vertexToIndex(e*this._granularityCellSize,_));else for(let e=v;e>=x;e--)t.push(this._vertexToIndex(e*this._granularityCellSize,_))}_generateOutline(t){const e=[];for(const r of t){const t=El(r,this._granularity,!0),n=this._pointArrayToIndices(t),i=[];for(let t=1;t<n.length;t++)i.push(n[t-1]),i.push(n[t]);e.push(i)}return e}_handlePoles(t){let e=!1,r=!1;this._canonical&&(0===this._canonical.y&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(e||r)&&this._fillPoles(t,e,r)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){const r=t[e+1];r===Al&&(t[e+1]=-32767),r===Il&&(t[e+1]=32766)}}_generatePoleQuad(t,e,r,n,i,s){n>i!=(s===Al)?(t.push(e),t.push(r),t.push(this._vertexToIndex(n,s)),t.push(r),t.push(this._vertexToIndex(i,s)),t.push(this._vertexToIndex(n,s))):(t.push(r),t.push(e),t.push(this._vertexToIndex(n,s)),t.push(this._vertexToIndex(i,s)),t.push(r),t.push(this._vertexToIndex(n,s)))}_fillPoles(t,e,r){const n=this._vertexBuffer,i=p,s=t.length;for(let o=2;o<s;o+=3){const s=t[o-2],a=t[o-1],l=t[o],u=n[2*s],c=n[2*s+1],h=n[2*a],p=n[2*a+1],f=n[2*l],d=n[2*l+1];e&&(0===c&&0===p&&this._generatePoleQuad(t,s,a,u,h,Al),0===p&&0===d&&this._generatePoleQuad(t,a,l,h,f,Al),0===d&&0===c&&this._generatePoleQuad(t,l,s,f,u,Al)),r&&(c===i&&p===i&&this._generatePoleQuad(t,s,a,u,h,Il),p===i&&d===i&&this._generatePoleQuad(t,a,l,h,f,Il),d===i&&c===i&&this._generatePoleQuad(t,l,s,f,u,Il))}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1])}subdividePolygonInternal(t,e){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:r,holeIndices:n}=function(t){const e=[],r=[];for(const n of t)if(0!==n.length){n!==t[0]&&e.push(r.length/2);for(const t of n)r.push(t.x),r.push(t.y)}return{flattened:r,holeIndices:e}}(t);let i;this._initializeVertices(r);try{const t=function(t,e,r=2){const n=e&&e.length,i=n?e[0]*r:t.length;let s=Ja(t,0,i,r,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,u;if(n&&(s=function(t,e,r,n){const i=[];for(let r=0,s=e.length;r<s;r++){const o=Ja(t,e[r]*n,r<s-1?e[r+1]*n:t.length,n,!1);o===o.next&&(o.steiner=!0),i.push(ll(o))}i.sort(il);for(let t=0;t<i.length;t++)r=sl(i[t],r);return r}(t,e,s,r)),t.length>80*r){a=t[0],l=t[1];let e=a,n=l;for(let s=r;s<i;s+=r){const r=t[s],i=t[s+1];r<a&&(a=r),i<l&&(l=i),r>e&&(e=r),i>n&&(n=i)}u=Math.max(e-a,n-l),u=0!==u?32767/u:0}return Qa(s,o,r,a,l,u,0),o}(r,n),e=this._convertIndices(r,t);i=this._subdivideTrianglesScanline(e)}catch(t){console.error(t)}let s=[];return e&&(s=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(i),{verticesFlattened:this._vertexBuffer,indicesTriangles:i,indicesLineList:s}}_convertIndices(t,e){const r=[];for(const n of e)r.push(this._vertexToIndex(t[2*n],t[2*n+1]));return r}_pointArrayToIndices(t){const e=[];for(const r of t)e.push(this._vertexToIndex(r.x,r.y));return e}}function Tl(t,e,r,n=!0){return new kl(r,e).subdividePolygonInternal(t,n)}function El(t,r,n=!1){if(!t||t.length<1)return[];if(t.length<2)return[];const i=t[0],s=t[t.length-1],o=n&&(i.x!==s.x||i.y!==s.y);if(r<2)return o?[...t,t[0]]:[...t];const a=Math.floor(p/r),l=[];l.push(new e(t[0].x,t[0].y));const u=t.length,c=o?u:u-1;for(let r=0;r<c;r++){const n=t[r],i=r<u-1?t[r+1]:t[0],s=n.x,o=n.y,c=i.x,h=i.y,p=s!==c,f=o!==h;if(!p&&!f)continue;const d=c-s,y=h-o,m=Math.abs(d),g=Math.abs(y);let x=s,v=o;for(;;){const t=d>0?(Math.floor(x/a)+1)*a:(Math.ceil(x/a)-1)*a,r=y>0?(Math.floor(v/a)+1)*a:(Math.ceil(v/a)-1)*a,n=Math.abs(x-t),i=Math.abs(v-r),s=Math.abs(x-c),o=Math.abs(v-h),u=p?n/m:Number.POSITIVE_INFINITY,b=f?i/g:Number.POSITIVE_INFINITY;if((s<=n||!p)&&(o<=i||!f))break;if(u<b&&p||!f){x=t,v+=y*u;const r=new e(x,Math.round(v));l[l.length-1].x===r.x&&l[l.length-1].y===r.y||l.push(r)}else{x+=d*b,v=r;const t=new e(Math.round(x),v);l[l.length-1].x===t.x&&l[l.length-1].y===t.y||l.push(t)}}const b=new e(c,h);l[l.length-1].x===b.x&&l[l.length-1].y===b.y||l.push(b)}return l}function Ml(t,e,r){if(0===e.length)throw new Error("Subdivision vertex ring is empty.");let n=0,i=t[2*e[0]];for(let r=1;r<e.length;r++){const s=t[2*e[r]];s<i&&(i=s,n=r)}const s=e.length;let o=n,a=(o+1)%s;for(;;){const n=o-1>=0?o-1:s-1,i=(a+1)%s,l=t[2*e[n]],u=t[2*e[i]],c=t[2*e[o]],h=t[2*e[o]+1],p=t[2*e[a]+1];let f=!1;if(l<u)f=!0;else if(l>u)f=!1;else{const r=p-h,s=-(t[2*e[a]]-c),o=h<p?1:-1;((l-c)*r+(t[2*e[n]+1]-h)*s)*o>((u-c)*r+(t[2*e[i]+1]-h)*s)*o&&(f=!0)}if(f){const t=e[n],i=e[o],l=e[a];t!==i&&t!==l&&i!==l&&r.push(l,i,t),o--,o<0&&(o=s-1)}else{const t=e[i],n=e[o],l=e[a];t!==n&&t!==l&&n!==l&&r.push(l,n,t),a++,a>=s&&(a=0)}if(n===i)break}}function Pl(t,e,r,n,i,s,o,a,l){const u=i.length/2,c=o&&a&&l;if(u<mo.MAX_VERTEX_ARRAY_LENGTH){const h=e.prepareSegment(u,r,n),p=h.vertexLength;for(let t=0;t<s.length;t+=3)n.emplaceBack(p+s[t],p+s[t+1],p+s[t+2]);let f,d;h.vertexLength+=u,h.primitiveLength+=s.length/3,c&&(d=o.prepareSegment(u,r,a),f=d.vertexLength,d.vertexLength+=u);for(let e=0;e<i.length;e+=2)t(i[e],i[e+1]);if(c)for(const t of l){for(let e=1;e<t.length;e+=2)a.emplaceBack(f+t[e-1],f+t[e]);d.primitiveLength+=t.length/2}}else!function(t,e,r,n,i,s){const o=[];for(let t=0;t<n.length/2;t++)o.push(-1);const a={count:0};let l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(let h=2;h<i.length;h+=3){const p=i[h-2],f=i[h-1],d=i[h];let y=o[p]<l,m=o[f]<l,g=o[d]<l;u.vertexLength+((y?1:0)+(m?1:0)+(g?1:0))>mo.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=a.count,y=!0,m=!0,g=!0,c=0);const x=Dl(o,n,s,a,p,y,u),v=Dl(o,n,s,a,f,m,u),b=Dl(o,n,s,a,d,g,u);r.emplaceBack(c+x-l,c+v-l,c+b-l),u.primitiveLength++}}(e,r,n,i,s,t),c&&function(t,e,r,n,i,s){const o=[];for(let t=0;t<n.length/2;t++)o.push(-1);const a={count:0};let l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(const h of i)for(let i=1;i<h.length;i+=2){const p=h[i-1],f=h[i];let d=o[p]<l,y=o[f]<l;u.vertexLength+((d?1:0)+(y?1:0))>mo.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=a.count,d=!0,y=!0,c=0);const m=Dl(o,n,s,a,p,d,u),g=Dl(o,n,s,a,f,y,u);r.emplaceBack(c+m-l,c+g-l),u.primitiveLength++}}(o,r,a,i,l,t),e.forceNewSegmentOnNextPrepare(),null==o||o.forceNewSegmentOnNextPrepare()}function Dl(t,e,r,n,i,s,o){if(s){const s=n.count;return r(e[2*i],e[2*i+1]),t[i]=n.count,n.count++,o.vertexLength++,s}return t[i]}class Fl{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.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new to,this.indexArray=new ho,this.indexArray2=new po,this.programConfigurations=new Go(t.layers,t.zoom),this.segments=new mo,this.segments2=new mo,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasDependencies=Wa("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),s=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Jo(o,t);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),c,r))continue;const h=i?n.evaluate(c,{},r,e.availableImages):void 0,p={id:a,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Ho(o),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:o}=n;if(this.hasDependencies){const t=Ha("fill",this.layers,n,{zoom:this.zoom},e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{},e.subdivisionGranularity);e.featureIndex.insert(t[s].feature,i,s,o,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures(t,e,r){for(const n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Za),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,s){for(const t of Qe(e,500)){const e=Tl(t,n,s.fill.getGranularityForZoomLevel(n.z)),r=this.layoutVertexArray;Pl(((t,e)=>{r.emplaceBack(t,e)}),this.segments,this.layoutVertexArray,this.indexArray,e.verticesFlattened,e.indicesTriangles,this.segments2,this.indexArray2,e.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:i,canonical:n})}}let zl,Bl;fi("FillBucket",Fl,{omit:["layers","patternFeatures"]});var Cl={get paint(){return Bl=Bl||new as({"fill-antialias":new rs(E.paint_fill["fill-antialias"]),"fill-opacity":new ns(E.paint_fill["fill-opacity"]),"fill-color":new ns(E.paint_fill["fill-color"]),"fill-outline-color":new ns(E.paint_fill["fill-outline-color"]),"fill-translate":new rs(E.paint_fill["fill-translate"]),"fill-translate-anchor":new rs(E.paint_fill["fill-translate-anchor"]),"fill-pattern":new is(E.paint_fill["fill-pattern"])})},get layout(){return zl=zl||new as({"fill-sort-key":new ns(E.layout_fill["fill-sort-key"])})}};class Vl extends cs{constructor(t,e){super(t,Cl,e)}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 Fl(t)}queryRadius(){return fa(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:n}){return na(da(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,n),e)}isTileClipped(){return!0}}const Ll=ds([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ol=ds([{name:"a_centroid",components:2,type:"Int16"}],4),{members:$l}=Ll;class Rl{constructor(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(Nl,this,e)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const r=t.readVarint()+t.pos,n=[];let i,s=1,o=0,a=0,l=0;for(;t.pos<r;){if(o<=0){const e=t.readVarint();s=7&e,o=e>>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&(i&&n.push(i),i=[]),i&&i.push(new e(a,l));else{if(7!==s)throw new Error(`unknown command ${s}`);i&&i.push(i[0].clone())}}return i&&n.push(i),n}bbox(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos;let r=1,n=0,i=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;for(;t.pos<e;){if(n<=0){const e=t.readVarint();r=7&e,n=e>>3}if(n--,1===r||2===r)i+=t.readSVarint(),s+=t.readSVarint(),i<o&&(o=i),i>a&&(a=i),s<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error(`unknown command ${r}`)}return[o,l,a,u]}toGeoJSON(t,e,r){const n=this.extent*Math.pow(2,r),i=this.extent*t,s=this.extent*e,o=this.loadGeometry();function a(t){return[360*(t.x+i)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+s)/n)*Math.PI))-90]}function l(t){return t.map(a)}let u;if(1===this.type){const t=[];for(const e of o)t.push(e[0]);const e=l(t);u=1===t.length?{type:"Point",coordinates:e[0]}:{type:"MultiPoint",coordinates:e}}else if(2===this.type){const t=o.map(l);u=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}else{if(3!==this.type)throw new Error("unknown feature type");{const t=Ul(o),e=[];for(const r of t)e.push(r.map(l));u=1===e.length?{type:"Polygon",coordinates:e[0]}:{type:"MultiPolygon",coordinates:e}}}const c={type:"Feature",geometry:u,properties:this.properties};return null!=this.id&&(c.id=this.id),c}}function Nl(t,e,r){1===t?e.id=r.readVarint():2===t?function(t,e){const r=t.readVarint()+t.pos;for(;t.pos<r;){const r=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[r]=n}}(r,e):3===t?e.type=r.readVarint():4===t&&(e._geometry=r.pos)}function Ul(t){const e=t.length;if(e<=1)return[t];const r=[];let n,i;for(let s=0;s<e;s++){const e=ql(t[s]);0!==e&&(void 0===i&&(i=e<0),i===e<0?(n&&r.push(n),n=[t[s]]):n&&n.push(t[s]))}return n&&r.push(n),r}function ql(t){let e=0;for(let r,n,i=0,s=t.length,o=s-1;i<s;o=i++)r=t[i],n=t[o],e+=(n.x-r.x)*(r.y+n.y);return e}Rl.types=["Unknown","Point","LineString","Polygon"];class jl{constructor(t,e){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Gl,this,e),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const e=this._pbf.readVarint()+this._pbf.pos;return new Rl(this._pbf,e,this.extent,this._keys,this._values)}}function Gl(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){let e=null;const r=t.readVarint()+t.pos;for(;t.pos<r;){const r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}if(null==e)throw new Error("unknown feature value");return e}(r))}class Xl{constructor(t,e){this.layers=t.readFields(Yl,{},e)}}function Yl(t,e,r){if(3===t){const t=new jl(r,r.readVarint()+r.pos);t.length&&(e[t.name]=t)}}const Zl=Math.pow(2,13);function Wl(t,e,r,n,i,s,o,a){t.emplaceBack(e,r,2*Math.floor(n*Zl)+o,i*Zl*2,s*Zl*2,Math.round(a))}class Hl{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.hasDependencies=!1,this.layoutVertexArray=new eo,this.centroidVertexArray=new Ks,this.indexArray=new ho,this.programConfigurations=new Go(t.layers,t.zoom),this.segments=new mo,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.features=[],this.hasDependencies=Wa("fill-extrusion",this.layers,e);for(const{feature:n,id:i,index:s,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,a=Jo(n,t);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),a,r))continue;const l={id:i,sourceLayerIndex:o,index:s,geometry:t?a.geometry:Ho(n),properties:n.properties,type:n.type,patterns:{}};this.hasDependencies?this.features.push(Ha("fill-extrusion",this.layers,l,{zoom:this.zoom},e)):this.addFeature(l,l.geometry,s,r,{},e.subdivisionGranularity),e.featureIndex.insert(n,l.geometry,s,o,this.index,!0)}}addFeatures(t,e,r){for(const n of this.features){const{geometry:i}=n;this.addFeature(n,i,n.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions: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,$l),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ol.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,s){for(const r of Qe(e,500)){const e={x:0,y:0,sampleCount:0},i=this.layoutVertexArray.length;this.processPolygon(e,n,t,r,s);const o=this.layoutVertexArray.length-i,a=Math.floor(e.x/e.sampleCount),l=Math.floor(e.y/e.sampleCount);for(let t=0;t<o;t++)this.centroidVertexArray.emplaceBack(a,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:i,canonical:n})}processPolygon(t,e,r,n,i){if(n.length<1)return;if(Ql(n[0]))return;for(const e of n)0!==e.length&&Jl(t,e);const s={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=i.fill.getGranularityForZoomLevel(e.z),a="Polygon"===Rl.types[r.type];for(const t of n){if(0===t.length)continue;if(Ql(t))continue;const e=El(t,o,a);this._generateSideFaces(e,s)}if(!a)return;const l=Tl(n,e,o,!1),u=this.layoutVertexArray;Pl(((t,e)=>{Wl(u,t,e,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let n=1;n<t.length;n++){const i=t[n],s=t[n-1];if(Kl(i,s))continue;e.segment.vertexLength+4>mo.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const o=i.sub(s)._perp()._unit(),a=s.dist(i);r+a>32768&&(r=0),Wl(this.layoutVertexArray,i.x,i.y,o.x,o.y,0,0,r),Wl(this.layoutVertexArray,i.x,i.y,o.x,o.y,0,1,r),r+=a,Wl(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,0,r),Wl(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,1,r);const l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}}function Jl(t,e){for(let r=0;r<e.length;r++){const n=e[r];r===e.length-1&&e[0].x===n.x&&e[0].y===n.y||(t.x+=n.x,t.y+=n.y,t.sampleCount++)}}function Kl(t,e){return t.x===e.x&&(t.x<0||t.x>p)||t.y===e.y&&(t.y<0||t.y>p)}function Ql(t){return t.every((t=>t.x<0))||t.every((t=>t.x>p))||t.every((t=>t.y<0))||t.every((t=>t.y>p))}let tu;fi("FillExtrusionBucket",Hl,{omit:["layers","features"]});var eu={get paint(){return tu=tu||new as({"fill-extrusion-opacity":new rs(E["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ns(E["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new rs(E["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new rs(E["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new is(E["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ns(E["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ns(E["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new rs(E["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class ru extends cs{constructor(t,e){super(t,eu,e)}createBucket(t){return new Hl(t)}queryRadius(){return fa(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:n,geometry:i,transform:s,pixelsToTileUnits:o,pixelPosMatrix:a}){const l=da(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-s.bearingInRadians,o),u=this.paint.get("fill-extrusion-height").evaluate(r,n),c=this.paint.get("fill-extrusion-base").evaluate(r,n),p=function(t,r){const n=[];for(const i of t){const t=[i.x,i.y,0,1];h(t,t,r),n.push(new e(t[0]/t[3],t[1]/t[3]))}return n}(l,a),f=function(t,r,n,i){const s=[],o=[],a=i[8]*r,l=i[9]*r,u=i[10]*r,c=i[11]*r,h=i[8]*n,p=i[9]*n,f=i[10]*n,d=i[11]*n;for(const r of t){const t=[],n=[];for(const s of r){const r=s.x,o=s.y,y=i[0]*r+i[4]*o+i[12],m=i[1]*r+i[5]*o+i[13],g=i[2]*r+i[6]*o+i[14],x=i[3]*r+i[7]*o+i[15],v=g+u,b=x+c,w=y+h,_=m+p,S=g+f,A=x+d,I=new e((y+a)/b,(m+l)/b);I.z=v/b,t.push(I);const k=new e(w/A,_/A);k.z=S/A,n.push(k)}s.push(t),o.push(n)}return[s,o]}(i,c,u,a);return function(t,e,r){let n=1/0;na(r,e)&&(n=iu(r,e[0]));for(let i=0;i<e.length;i++){const s=e[i],o=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],o[t+1],o[t],e];ea(r,i)&&(n=Math.min(n,iu(r,i)))}}return n!==1/0&&n}(f[0],f[1],p)}}function nu(t,e){return t.x*e.x+t.y*e.y}function iu(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],o=t[0],a=i.sub(n),l=s.sub(n),u=o.sub(n),c=nu(a,a),h=nu(a,l),p=nu(l,l),f=nu(u,a),d=nu(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 su=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class ou{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=su[15&r];if(!i)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new ou(o,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=su.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,o=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-o%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+o+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+o+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,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 au(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:o}=this,a=[0,i.length-1,0],l=[];for(;a.length;){const u=a.pop()||0,c=a.pop()||0,h=a.pop()||0;if(c-h<=o){for(let o=h;o<=c;o++){const a=s[2*o],u=s[2*o+1];a>=t&&a<=r&&u>=e&&u<=n&&l.push(i[o])}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)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?r>=f:n>=d)&&(a.push(p+1),a.push(c),a.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,o=[0,n.length-1,0],a=[],l=r*r;for(;o.length;){const u=o.pop()||0,c=o.pop()||0,h=o.pop()||0;if(c-h<=s){for(let r=h;r<=c;r++)hu(i[2*r],i[2*r+1],t,e)<=l&&a.push(n[r]);continue}const p=h+c>>1,f=i[2*p],d=i[2*p+1];hu(f,d,t,e)<=l&&a.push(n[p]),(0===u?t-r<=f:e-r<=d)&&(o.push(h),o.push(p-1),o.push(1-u)),(0===u?t+r>=f:e+r>=d)&&(o.push(p+1),o.push(c),o.push(1-u))}return a}}function au(t,e,r,n,i,s){if(i-n<=r)return;const o=n+i>>1;lu(t,e,o,n,i,s),au(t,e,r,n,o-1,1-s),au(t,e,r,o+1,i,1-s)}function lu(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const o=i-n+1,a=r-n+1,l=Math.log(o),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(o-u)/o)*(a-o/2<0?-1:1);lu(t,e,r,Math.max(n,Math.floor(r-a*u/o+c)),Math.min(i,Math.floor(r+(o-a)*u/o+c)),s)}const o=e[2*r+s];let a=n,l=i;for(uu(t,e,n,r),e[2*i+s]>o&&uu(t,e,n,i);a<l;){for(uu(t,e,a,l),a++,l--;e[2*a+s]<o;)a++;for(;e[2*l+s]>o;)l--}e[2*n+s]===o?uu(t,e,n,l):(l++,uu(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function uu(t,e,r,n){cu(t,r,n),cu(e,2*r,2*n),cu(e,2*r+1,2*n+1)}function cu(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function hu(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}function pu(t,e,r,n){let i=n;const s=e+(r-e>>1);let o,a=r-e;const l=t[e],u=t[e+1],c=t[r],h=t[r+1];for(let n=e+3;n<r;n+=3){const e=fu(t[n],t[n+1],l,u,c,h);if(e>i)o=n,i=e;else if(e===i){const t=Math.abs(n-s);t<a&&(o=n,a=t)}}i>n&&(o-e>3&&pu(t,e,o,n),t[o+2]=i,r-o>3&&pu(t,o,r,n))}function fu(t,e,r,n,i,s){let o=i-r,a=s-n;if(0!==o||0!==a){const l=((t-r)*o+(e-n)*a)/(o*o+a*a);l>1?(r=i,n=s):l>0&&(r+=o*l,n+=a*l)}return o=t-r,a=e-n,o*o+a*a}function du(t,e,r,n){const i={type:e,geom:r},s={id:null==t?null:t,type:i.type,geometry:i.geom,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(i.type){case"Point":case"MultiPoint":mu(s,i.geom);break;case"LineString":mu(s,i.geom.points);break;case"Polygon":mu(s,i.geom[0].points);break;case"MultiLineString":for(const t of i.geom)mu(s,t.points);break;case"MultiPolygon":for(const t of i.geom)mu(s,t[0].points)}return s}function yu(t){t.points.length>64&&(t.points=new Float64Array(t.points))}function mu(t,e){for(let 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 gu(t,e){const r=[];switch(t.type){case"FeatureCollection":for(let n=0;n<t.features.length;n++)xu(r,t.features[n],e,n);break;case"Feature":xu(r,t,e);break;default:xu(r,{geometry:t,properties:void 0},e)}return r}function xu(t,e,r,n){if(!e.geometry)return;if("GeometryCollection"===e.geometry.type)return void function(t,e,r,n,i){for(const s of r.geometries)xu(t,{id:e.id,geometry:s,properties:e.properties},n,i)}(t,e,e.geometry,r,n);const i=e.geometry.coordinates;if(!i?.length)return;const s=function(t,e,r){return e.promoteId?t.properties?.[e.promoteId]:e.generateId?r||0:t.id}(e,r,n),o=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2);switch(e.geometry.type){case"Point":return void function(t,e,r,n){const i=[];i.push(wu(r.coordinates[0]),_u(r.coordinates[1]),0),t.push(du(e,"Point",i,n))}(t,s,e.geometry,e.properties);case"MultiPoint":return void function(t,e,r,n){const i=[];for(const t of r.coordinates)i.push(wu(t[0]),_u(t[1]),0);t.push(du(e,"MultiPoint",i,n))}(t,s,e.geometry,e.properties);case"LineString":return void function(t,e,r,n,i){const s={points:[]};vu(r.coordinates,s,n,!1),t.push(du(e,"LineString",s,i))}(t,s,e.geometry,o,e.properties);case"MultiLineString":return void function(t,e,r,n,i,s){if(i.lineMetrics)for(const i of r.coordinates){const r={points:[]};vu(i,r,n,!1),t.push(du(e,"LineString",r,s))}else{const i=[];bu(r.coordinates,i,n,!1),t.push(du(e,"MultiLineString",i,s))}}(t,s,e.geometry,o,r,e.properties);case"Polygon":return void function(t,e,r,n,i){const s=[];bu(r.coordinates,s,n,!0),t.push(du(e,"Polygon",s,i))}(t,s,e.geometry,o,e.properties);case"MultiPolygon":return void function(t,e,r,n,i){const s=[];for(const t of r.coordinates){const e=[];bu(t,e,n,!0),s.push(e)}t.push(du(e,"MultiPolygon",s,i))}(t,s,e.geometry,o,e.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function vu(t,e,r,n){let i,s,o=0;for(let r=0;r<t.length;r++){const a=wu(t[r][0]),l=_u(t[r][1]);e.points.push(a,l,0),r>0&&(o+=n?(i*l-a*s)/2:Math.sqrt(Math.pow(a-i,2)+Math.pow(l-s,2))),i=a,s=l}const a=e.points.length-3;e.points[2]=1,r>0&&pu(e.points,0,a,r),e.points[a+2]=1,yu(e),e.size=Math.abs(o),e.start=0,e.end=e.size}function bu(t,e,r,n){for(let i=0;i<t.length;i++){const s={points:[]};vu(t[i],s,r,n),e.push(s)}}function wu(t){return t/360+.5}function _u(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 Su(t){const e={type:"Feature",geometry:Au(t),properties:t.tags};return null!=t.id&&(e.id=t.id),e}function Au(t){const{type:e,geometry:r}=t;switch(e){case"Point":return{type:e,coordinates:ku(r[0],r[1])};case"MultiPoint":return{type:e,coordinates:Iu(r)};case"LineString":return{type:e,coordinates:Iu(r.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:r.map((t=>Iu(t.points)))};case"MultiPolygon":return{type:e,coordinates:r.map((t=>t.map((t=>Iu(t.points)))))}}}function Iu(t){const e=[];for(let r=0;r<t.length;r+=3)e.push(ku(t[r],t[r+1]));return e}function ku(t,e){return[Tu(t),Eu(e)]}function Tu(t){return 360*(t-.5)}function Eu(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var Mu;function Pu(t,e,r,n,i,s,o,a){if(n/=e,s>=(r/=e)&&o<n)return t;if(o<r||s>=n)return null;const l=[];for(const e of t){const t=i===Mu.X?e.minX:e.minY,s=i===Mu.X?e.maxX:e.maxY;if(t>=r&&s<n)l.push(e);else if(!(s<r||t>=n))switch(e.type){case"Point":case"MultiPoint":Du(e,l,r,n,i);continue;case"LineString":Fu(e,l,r,n,i,a);continue;case"MultiLineString":zu(e,l,r,n,i);continue;case"Polygon":Bu(e,l,r,n,i);continue;case"MultiPolygon":Cu(e,l,r,n,i);continue}}return l.length?l:null}function Du(t,e,r,n,i){const s=[];(function(t,e,r,n,i){for(let s=0;s<t.length;s+=3){const o=t[s+i];o>=r&&o<=n&&$u(e,t[s],t[s+1],t[s+2])}})(t.geometry,s,r,n,i),s.length&&e.push(du(t.id,3===s.length?"Point":"MultiPoint",s,t.tags))}function Fu(t,e,r,n,i,s){const o=[];if(Vu(t.geometry,o,r,n,i,!1,s.lineMetrics),o.length)if(s.lineMetrics)for(const r of o)e.push(du(t.id,"LineString",r,t.tags));else e.push(o.length>1?du(t.id,"MultiLineString",o,t.tags):du(t.id,"LineString",o[0],t.tags))}function zu(t,e,r,n,i){const s=[];Ou(t.geometry,s,r,n,i,!1),s.length&&e.push(1!==s.length?du(t.id,"MultiLineString",s,t.tags):du(t.id,"LineString",s[0],t.tags))}function Bu(t,e,r,n,i){const s=[];Ou(t.geometry,s,r,n,i,!0),s.length&&e.push(du(t.id,"Polygon",s,t.tags))}function Cu(t,e,r,n,i){const s=[];for(const e of t.geometry){const t=[];Ou(e,t,r,n,i,!0),t.length&&s.push(t)}s.length&&e.push(du(t.id,"MultiPolygon",s,t.tags))}function Vu(t,e,r,n,i,s,o){let a=Lu(t);const l=i===Mu.X?Ru:Nu;let u,c,h=t.start;for(let p=0;p<t.points.length-3;p+=3){const f=t.points[p],d=t.points[p+1],y=t.points[p+2],m=t.points[p+3],g=t.points[p+4],x=i===Mu.X?f:d,v=i===Mu.X?m:g;let b=!1;o&&(u=Math.sqrt(Math.pow(f-m,2)+Math.pow(d-g,2))),x<r?v>r&&(c=l(a,f,d,m,g,r),o&&(a.start=h+u*c)):x>n?v<n&&(c=l(a,f,d,m,g,n),o&&(a.start=h+u*c)):$u(a.points,f,d,y),v<r&&x>=r&&(c=l(a,f,d,m,g,r),b=!0),v>n&&x<=n&&(c=l(a,f,d,m,g,n),b=!0),!s&&b&&(o&&(a.end=h+u*c),e.push(a),a=Lu(t)),o&&(h+=u)}let p=t.points.length-3;const f=t.points[p],d=t.points[p+1],y=i===Mu.X?f:d;y>=r&&y<=n&&$u(a.points,f,d,t.points[p+2]),p=a.points.length-3,s&&p>=3&&(a.points[p]!==a.points[0]||a.points[p+1]!==a.points[1])&&$u(a.points,a.points[0],a.points[1],a.points[2]),a.points.length&&(yu(a),e.push(a))}function Lu(t){return{points:[],size:t.size,start:t.start,end:t.end}}function Ou(t,e,r,n,i,s){for(const o of t)Vu(o,e,r,n,i,s,!1)}function $u(t,e,r,n){t.push(e,r,n)}function Ru(t,e,r,n,i,s){const o=(s-e)/(n-e);return $u(t.points,s,r+(i-r)*o,1),o}function Nu(t,e,r,n,i,s){const o=(s-r)/(i-r);return $u(t.points,e+(n-e)*o,s,1),o}function Uu(t,e){const r=e.buffer/e.extent;let n=t;const i=Pu(t,1,-1-r,r,Mu.X,-1,2,e),s=Pu(t,1,1-r,2+r,Mu.X,-1,2,e);return i||s?(n=Pu(t,1,-r,1+r,Mu.X,-1,2,e)||[],i&&(n=qu(i,1).concat(n)),s&&(n=n.concat(qu(s,-1))),n):n}function qu(t,e){const r=[];for(const n of t)switch(n.type){case"Point":case"MultiPoint":{const t=ju(n.geometry,e);r.push(du(n.id,n.type,t,n.tags));continue}case"LineString":{const t=Gu(n.geometry,e);r.push(du(n.id,n.type,t,n.tags));continue}case"MultiLineString":case"Polygon":{const t=[];for(const r of n.geometry)t.push(Gu(r,e));r.push(du(n.id,n.type,t,n.tags));continue}case"MultiPolygon":{const t=[];for(const r of n.geometry){const n=[];for(const t of r)n.push(Gu(t,e));t.push(n)}r.push(du(n.id,n.type,t,n.tags));continue}}return r}function ju(t,e){const r=[];for(let n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function Gu(t,e){const r={points:[],size:t.size};void 0!==t.start&&(r.start=t.start,r.end=t.end);for(let n=0;n<t.points.length;n+=3)r.points.push(t.points[n]+e,t.points[n+1],t.points[n+2]);return yu(r),r}function Xu(t,e,r){const n=!!e.newGeometry,i=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(n){const n=t[0];let s=gu({type:"FeatureCollection",features:[{type:"Feature",id:n.id,geometry:e.newGeometry,properties:i?Yu(n.tags,e):n.tags}]},r);return s=Uu(s,r),s}if(i){const r=[];for(const n of t){const t={...n};t.tags=Yu(t.tags,e),r.push(t)}return r}return t}function Yu(t,e){if(e.removeAllProperties)return{};const r={...t||{}};if(e.removeProperties)for(const t of e.removeProperties)delete r[t];if(e.addOrUpdateProperties)for(const{key:t,value:n}of e.addOrUpdateProperties)r[t]=n;return r}!function(t){t[t.X=0]="X",t[t.Y=1]="Y"}(Mu||(Mu={}));const Zu={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t};class Wu{constructor(t){this.options=Object.assign(Object.create(Zu),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(t){const e=[];for(const r of t){if(!r.geometry)continue;const[t,n]=r.geometry.coordinates,[i,s]=[wu(t),_u(n)];e.push({id:r.id,type:"Point",geometry:[i,s],tags:r.properties})}this.createIndex(e)}initialize(t){const e=[];for(const r of t)"Point"===r.type&&e.push(r);this.createIndex(e)}updateIndex(t,e,r){this.options=Object.assign(Object.create(Zu),r.clusterOptions),this.initialize(t)}createIndex(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;let[n,i]=r.geometry;n=Math.fround(n),i=Math.fround(i),s.push(n,i,1/0,e,-1,1),this.options.reduce&&s.push(0)}let o=this.trees[n+1]=this.createTree(s);e&&console.timeEnd(i);for(let t=n;t>=r;t--){const r=Date.now();o=this.trees[t]=this.createTree(this.cluster(o,t)),e&&console.log("z%d: %d clusters in %dms",t,o.numItems,Date.now()-r)}e&&console.timeEnd("total time")}getClusters(t,e){return this.getClustersInternal(t,e).map((t=>Su(t)))}getClustersInternal(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.getClustersInternal([r,n,180,s],e),o=this.getClustersInternal([-180,n,i,s],e);return t.concat(o)}const o=this.trees[this.limitZoom(e)],a=o.range(wu(r),_u(s),wu(i),_u(n)),l=o.flatData,u=[];for(const t of a){const e=this.stride*t;u.push(l[e+5]>1?Hu(l,e,this.clusterProps):this.points[l[e+3]])}return u}getChildren(t){const e=this.getOriginId(t),r=this.getOriginZoom(t),n=new Error("No cluster with the specified id: "+t),i=this.trees[r];if(!i)throw n;const s=i.flatData;if(e*this.stride>=s.length)throw n;const o=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=i.within(s[e*this.stride],s[e*this.stride+1],o),l=[];for(const e of a){const r=e*this.stride;s[r+4]===t&&l.push(s[r+5]>1?Ju(s,r,this.clusterProps):Su(this.points[s[r+3]]))}if(0===l.length)throw 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)];if(!n)return null;const i=Math.pow(2,t),{extent:s,radius:o}=this.options,a=o/s,l=(r-a)/i,u=(r+1+a)/i,c={transformed:!0,features:[],source:null,x:e,y:r,z:t};return this.addTileFeatures(n.range((e-a)/i,l,(e+1+a)/i,u),n.flatData,e,r,i,c),0===e&&this.addTileFeatures(n.range(1-a/i,l,1,u),n.flatData,i,r,i,c),e===i-1&&this.addTileFeatures(n.range(0,l,a/i,u),n.flatData,-1,r,i,c),c}getClusterExpansionZoom(t){return this.getOriginZoom(t)}appendLeaves(t,e,r,n,i){const s=this.getChildren(e);for(const e of s){const s=e.properties;if(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 ou(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.flatData=t,e.data=null,e}addTileFeatures(t,e,r,n,i,s){for(const o of t){const t=o*this.stride,a=e[t+5]>1;let l,u,c;if(a)l=Ku(e,t,this.clusterProps),u=e[t],c=e[t+1];else{const r=this.points[e[t+3]];l=r.tags,[u,c]=r.geometry}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=a||this.options.generateId?e[t+3]:this.points[e[t+3]].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,o=r/(n*Math.pow(2,e)),a=t.flatData,l=[],u=this.stride;for(let r=0;r<a.length;r+=u){if(a[r+2]<=e)continue;a[r+2]=e;const n=a[r],c=a[r+1],h=t.within(a[r],a[r+1],o),p=a[r+5];let f=p;for(const t of h){const r=t*u;a[r+2]>e&&(f+=a[r+5])}if(f>p&&f>=s){let t,s=n*p,o=c*p,d=-1;const y=(r/u<<5)+(e+1)+this.points.length;for(const n of h){const l=n*u;if(a[l+2]<=e)continue;a[l+2]=e;const c=a[l+5];s+=a[l]*c,o+=a[l+1]*c,a[l+4]=y,i&&(t||(t=this.map(a,r,!0),d=this.clusterProps.length,this.clusterProps.push(t)),i(t,this.map(a,l)))}a[r+4]=y,l.push(s/f,o/f,1/0,y,-1,f),i&&l.push(d)}else{for(let t=0;t<u;t++)l.push(a[r+t]);if(f>1)for(const t of h){const r=t*u;if(!(a[r+2]<=e)){a[r+2]=e;for(let t=0;t<u;t++)l.push(a[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+5]>1){const n=this.clusterProps[t[e+6]];return r?Object.assign({},n):n}const n=this.points[t[e+3]].tags,i=this.options.map(n);return r&&i===n?Object.assign({},i):i}}function Hu(t,e,r){return{id:t[e+3],type:"Point",tags:Ku(t,e,r),geometry:[t[e],t[e+1]]}}function Ju(t,e,r){return{type:"Feature",id:t[e+3],properties:Ku(t,e,r),geometry:{type:"Point",coordinates:[Tu(t[e]),Eu(t[e+1])]}}}function Ku(t,e,r){const n=t[e+5],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,s=t[e+6],o=-1===s?{}:Object.assign({},r[s]);return Object.assign(o,{cluster:!0,cluster_id:t[e+3],point_count:n,point_count_abbreviated:i})}const Qu="geojsonvt_clip_start",tc="geojsonvt_clip_end";function ec(t,e,r,n,i){const s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),o={transformed:!1,features:[],source:null,x:r,y:n,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:t.length};for(const e of t)rc(o,e,s,i);return o}function rc(t,e,r,n){switch(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),e.type){case"Point":case"MultiPoint":return void function(t,e){const r=[];for(let n=0;n<e.geometry.length;n+=3)r.push(e.geometry[n],e.geometry[n+1]),t.numPoints++,t.numSimplified++;if(!r.length)return;const n={type:1,tags:e.tags||null,geometry:r};null!==e.id&&(n.id=e.id),t.features.push(n)}(t,e);case"LineString":return void function(t,e,r,n){const i=[];if(nc(i,e.geometry,t,r,!1,!1),!i.length)return;let s=e.tags||null;if(n.lineMetrics){s={};for(const t in e.tags)s[t]=e.tags[t];s[Qu]=e.geometry.start/e.geometry.size,s[tc]=e.geometry.end/e.geometry.size}const o={type:2,tags:s,geometry:i};null!==e.id&&(o.id=e.id),t.features.push(o)}(t,e,r,n);case"MultiLineString":case"Polygon":return void function(t,e,r){const n=[];for(let i=0;i<e.geometry.length;i++)nc(n,e.geometry[i],t,r,"Polygon"===e.type,0===i);if(!n.length)return;const i={type:"Polygon"===e.type?3:2,tags:e.tags||null,geometry:n};null!==e.id&&(i.id=e.id),t.features.push(i)}(t,e,r);case"MultiPolygon":return void function(t,e,r){const n=[];for(let i=0;i<e.geometry.length;i++){const s=e.geometry[i];for(let e=0;e<s.length;e++)nc(n,s[e],t,r,!0,0===e)}if(!n.length)return;const i={type:3,tags:e.tags||null,geometry:n};null!==e.id&&(i.id=e.id),t.features.push(i)}(t,e,r)}}function nc(t,e,r,n,i,s){const o=n*n;if(n>0&&e.size<(i?o:n))return void(r.numPoints+=e.points.length/3);const a=[];for(let t=0;t<e.points.length;t+=3)(0===n||e.points[t+2]>o)&&(r.numSimplified++,a.push(e.points[t],e.points[t+1])),r.numPoints++;i&&function(t,e){let r=0;for(let e=0,n=t.length,i=n-2;e<n;i=e,e+=2)r+=(t[e]-t[i])*(t[e+1]+t[i+1]);if(r>0===e)for(let e=0,r=t.length;e<r/2;e+=2){const n=t[e],i=t[e+1];t[e]=t[r-2-e],t[e+1]=t[r-1-e],t[r-2-e]=n,t[r-1-e]=i}}(a,s),t.push(a)}function ic(t,e){if(t.transformed)return t;const r=1<<t.z,n=t.x,i=t.y;for(const s of t.features)1===s.type?sc(s,e,r,n,i):oc(s,e,r,n,i);return t.transformed=!0,t}function sc(t,e,r,n,i){const s=t,o=t.geometry,a=[];for(let t=0;t<o.length;t+=2)a.push(ac(o[t],o[t+1],e,r,n,i));return s.geometry=a,s}function oc(t,e,r,n,i){const s=t,o=t.geometry,a=[];for(const t of o){const s=[];for(let o=0;o<t.length;o+=2)s.push(ac(t[o],t[o+1],e,r,n,i));a.push(s)}return s.geometry=a,s}function ac(t,e,r,n,i,s){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-s))]}class lc{constructor(t){this.options=t,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(t){this.splitTile(t,0,0,0),this.options.debug&&(t.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)))}updateIndex(t,e,r){r.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(e),r.debug>1&&console.timeEnd("invalidating");const[n,i,s]=[0,0,0],o=ec(t,n,i,s,r);o.source=t;const a=uc(n,i,s);if(this.tiles[a]=o,this.tileCoords.push({z:n,x:i,y:s,id:a}),r.debug){const t=`z${n}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}}getClusterExpansionZoom(t){return null}getChildren(t){return null}getLeaves(t,e,r){return null}getTile(t,e,r){const{extent:n,debug:i}=this.options,s=1<<t,o=uc(t,e=e+s&s-1,r);if(this.tiles[o])return ic(this.tiles[o],n);i>1&&console.log("drilling down to z%d-%d-%d",t,e,r);let a,l=t,u=e,c=r;for(;!a&&l>0;)l--,u>>=1,c>>=1,a=this.tiles[uc(l,u,c)];return a?.source?(i>1&&(console.log("found parent tile z%d-%d-%d",l,u,c),console.time("drilling down")),this.splitTile(a.source,l,u,c,t,e,r),i>1&&console.timeEnd("drilling down"),this.tiles[o]?ic(this.tiles[o],n):null):null}splitTile(t,e,r,n,i,s,o){const a=[t,e,r,n],l=this.options,u=l.debug;for(;a.length;){n=a.pop(),r=a.pop(),e=a.pop(),t=a.pop();const c=1<<e,h=uc(e,r,n);let p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=ec(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n,id:h}),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"));const t=`z${e}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(p.source=t,null==i){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===i)continue;if(null!=i){const t=i-e;if(r!==s>>t||n!==o>>t)continue}}if(p.source=null,!t.length)continue;u>1&&console.time("clipping");const f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f;let g=null,x=null,v=null,b=null;const w=Pu(t,c,r-f,r+y,Mu.X,p.minX,p.maxX,l),_=Pu(t,c,r+d,r+m,Mu.X,p.minX,p.maxX,l);w&&(g=Pu(w,c,n-f,n+y,Mu.Y,p.minY,p.maxY,l),x=Pu(w,c,n+d,n+m,Mu.Y,p.minY,p.maxY,l)),_&&(v=Pu(_,c,n-f,n+y,Mu.Y,p.minY,p.maxY,l),b=Pu(_,c,n+d,n+m,Mu.Y,p.minY,p.maxY,l)),u>1&&console.timeEnd("clipping"),a.push(g||[],e+1,2*r,2*n),a.push(x||[],e+1,2*r,2*n+1),a.push(v||[],e+1,2*r+1,2*n),a.push(b||[],e+1,2*r+1,2*n+1)}}invalidateTiles(t){if(!t.length)return;const e=this.options,{debug:r}=e;let n=1/0,i=-1/0,s=1/0,o=-1/0;for(const e of t)n=Math.min(n,e.minX),i=Math.max(i,e.maxX),s=Math.min(s,e.minY),o=Math.max(o,e.maxY);const a=e.buffer/e.extent,l=new Set;for(const e in this.tiles){const u=this.tiles[e],c=1<<u.z,h=(u.x-a)/c,p=(u.x+1+a)/c,f=(u.y-a)/c,d=(u.y+1+a)/c;if(i<h||n>=p||o<f||s>=d)continue;let y=!1;for(const e of t)if(e.maxX>=h&&e.minX<p&&e.maxY>=f&&e.minY<d){y=!0;break}if(y){if(r){r>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",u.z,u.x,u.y,u.numFeatures,u.numPoints,u.numSimplified);const t=`z${u.z}`;this.stats[t]=(this.stats[t]||0)-1,this.total--}delete this.tiles[e],l.add(e)}}l.size&&(this.tileCoords=this.tileCoords.filter((t=>!l.has(t.id))))}}function uc(t,e,r){return 32*((1<<t)*r+e)+t}const cc={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:Zu,debug:0};class hc{constructor(t,e){const r=(e=this.options=Object.assign({},cc,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.");let n=gu(t,e);r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),n=Uu(n,e),e.updateable&&(this.source=n),this.initializeIndex(n,e)}initializeIndex(t,e){this.tileIndex=e.cluster?new Wu(e.clusterOptions):new lc(e),t.length&&this.tileIndex.initialize(t)}getTile(t,e,r){return e=+e,r=+r,(t=+t)<0||t>24?null:this.tileIndex.getTile(t,e,r)}updateData(t,e){const r=this.options;if(!r.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:n,source:i}=function(t,e,r){const n=function(t,e){return t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map(t.add?.map((t=>[e.promoteId?t.properties[e.promoteId]:t.id,t]))),update:new Map(t.update?.map((t=>[t.id,t])))}:{remove:new Set,add:new Map,update:new Map}}(e,r);let i=[];if(n.removeAll&&(i=t,t=[]),n.remove.size||n.add.size){const e=[];for(const r of t)(n.remove.has(r.id)||n.add.has(r.id))&&e.push(r);if(e.length){i.push(...e);const r=new Set(e.map((t=>t.id)));t=t.filter((t=>!r.has(t.id)))}if(n.add.size){let e=gu({type:"FeatureCollection",features:Array.from(n.add.values())},r);e=Uu(e,r),i.push(...e),t.push(...e)}}if(n.update.size){const e=new Map,s=[];for(const r of t)n.update.has(r.id)?e.set(r.id,[...e.get(r.id)||[],r]):s.push(r);for(const[t,o]of n.update){const n=e.get(t);if(!n||0===n.length)continue;const a=Xu(n,o,r);i.push(...n,...a),s.push(...a)}t=s}return{affected:i,source:t}}(this.source,t,r);e&&({affected:n,source:i}=this.filterUpdate(i,n,e)),n.length&&(this.source=i,this.tileIndex.updateIndex(i,n,r))}filterUpdate(t,e,r){const n=new Set;for(const i of t)null!=i.id&&(r(Su(i))||(e.push(i),n.add(i.id)));return{affected:e,source:t=t.filter((t=>!n.has(t.id)))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map((t=>Su(t)))}}updateClusterOptions(t,e){const r=this.options.cluster;this.options.cluster=t,this.options.clusterOptions=e,r!=t?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(t){return this.tileIndex.getClusterExpansionZoom(t)}getClusterChildren(t){return this.tileIndex.getChildren(t)}getClusterLeaves(t,e,r){return this.tileIndex.getLeaves(t,e,r)}}const pc=ds([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:fc}=pc,dc=ds([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:yc}=dc,mc=Math.cos(Math.PI/180*37.5),gc=Math.pow(2,14)/.5;class xc{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.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(const t of this.layers)this.gradients[t.id]={};this.layoutVertexArray=new ro,this.layoutVertexArray2=new no,this.indexArray=new ho,this.programConfigurations=new Go(t.layers,t.zoom),this.segments=new mo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasDependencies=Wa("line",this.layers,e)||this.hasLineDasharray(this.layers);const n=this.layers[0].layout.get("line-sort-key"),i=!n.isConstant(),s=[];for(const{feature:e,id:o,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Jo(e,t);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),u,r))continue;const c=i?n.evaluate(u,{},r):void 0,h={id:o,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?u.geometry:Ho(e),patterns:{},dashes:{},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:o}=n;this.hasDependencies?(Wa("line",this.layers,e)?Ha("line",this.layers,n,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,n,this.zoom,e),this.patternFeatures.push(n)):this.addFeature(n,i,s,r,{},{},e.subdivisionGranularity),e.featureIndex.insert(t[s].feature,i,s,o,this.index)}}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,dashPositions:n})}addFeatures(t,e,r,n){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,n,t.subdivisionGranularity)}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,yc)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fc),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.hasOwn(t.properties,Qu)&&Object.hasOwn(t.properties,tc))return{start:+t.properties[Qu],end:+t.properties[tc]}}addFeature(t,e,r,n,i,s,o){const a=this.layers[0].layout,l=a.get("line-join").evaluate(t,{}),u=a.get("line-cap").evaluate(t,{}),c=a.get("line-miter-limit").evaluate(t,{}),h=a.get("line-round-limit").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,l,u,c,h,n,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:i,dashPositions:s,canonical:n})}addLine(t,e,r,n,i,s,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=El(t,o?a.line.getGranularityForZoomLevel(o.z):1),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 l="Polygon"===Rl.types[e.type];let u=t.length;for(;u>=2&&t[u-1].equals(t[u-2]);)u--;let c=0;for(;c<u-1&&t[c].equals(t[c+1]);)c++;if(u<(l?3:2))return;"bevel"===r&&(i=1.05);const h=this.overscaling<=16?122880/(512*this.overscaling):0,p=this.segments.prepareSegment(10*u,this.layoutVertexArray,this.indexArray);let f,d,y,m,g;this.e1=this.e2=-1,l&&(f=t[u-2],g=t[c].sub(f)._unit()._perp());for(let e=c;e<u;e++){if(y=e===u-1?l?t[c+1]:void 0:t[e+1],y&&t[e].equals(y))continue;g&&(m=g),f&&(d=f),f=t[e],g=y?y.sub(f)._unit()._perp():m,m||(m=g);let o=m.add(g);0===o.x&&0===o.y||o._unit();const a=m.x*g.x+m.y*g.y,x=o.x*g.x+o.y*g.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<mc&&d&&y,_=m.x*g.y-m.y*g.x>0;if(w&&e>c){const t=f.dist(d);if(t>2*h){const e=f.sub(f.sub(d)._mult(h/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,m,0,0,p),d=e}}const S=d&&y;let A=S?r:l?"butt":n;if(S&&"round"===A&&(v<s?A="miter":v<=2&&(A="fakeround")),"miter"===A&&v>i&&(A="bevel"),"bevel"===A&&(v>2&&(A="flipbevel"),v<i&&(A="miter")),d&&this.updateDistance(d,f),"miter"===A)o._mult(v),this.addCurrentVertex(f,o,0,0,p);else if("flipbevel"===A){if(v>100)o=g.mult(-1);else{const t=v*m.add(g).mag()/m.sub(g).mag();o._perp()._mult(t*(_?-1:1))}this.addCurrentVertex(f,o,0,0,p),this.addCurrentVertex(f,o.mult(-1),0,0,p)}else if("bevel"===A||"fakeround"===A){const t=-Math.sqrt(v*v-1),e=_?t:0,r=_?0:t;if(d&&this.addCurrentVertex(f,m,e,r,p),"fakeround"===A){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+a*(a*(3.55645-1.43519*a)-3.2452))*t*t+(.848013+a*(.215638*a-1.06021)))}const n=g.sub(m)._mult(r)._add(m)._unit()._mult(_?-1:1);this.addHalfVertex(f,n.x,n.y,!1,_,0,p)}}y&&this.addCurrentVertex(f,g,-e,-r,p)}else if("butt"===A)this.addCurrentVertex(f,o,0,0,p);else if("square"===A){const t=d?1:-1;this.addCurrentVertex(f,o,t,t,p)}else"round"===A&&(d&&(this.addCurrentVertex(f,m,0,0,p),this.addCurrentVertex(f,m,1,1,p,!0)),y&&(this.addCurrentVertex(f,g,-1,-1,p,!0),this.addCurrentVertex(f,g,0,0,p)));if(w&&e<u-1){const t=f.dist(y);if(t>2*h){const e=f.add(y.sub(f)._mult(h/t)._round());this.updateDistance(f,e),this.addCurrentVertex(e,g,0,0,p),f=e}}}}addCurrentVertex(t,e,r,n,i,s=!1){const o=e.y*n-e.x,a=-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,o,a,s,!0,-n,i),this.distance>gc/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,o,a){const l=.5*(this.lineClips?this.scaledDistance*(gc-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===o?0:o<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=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),a.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()}hasLineDasharray(t){for(const e of t){const t=e.paint.get("line-dasharray");if(t&&!t.isConstant())return!0}return!1}addLineDashDependencies(t,e,r,n){for(const i of t){const t=i.paint.get("line-dasharray");if(!t||"constant"===t.value.kind)continue;const s="round"===i.layout.get("line-cap").evaluate(e,{}),o={dasharray:t.value.evaluate({zoom:r-1},e,{}),round:s},a={dasharray:t.value.evaluate({zoom:r},e,{}),round:s},l={dasharray:t.value.evaluate({zoom:r+1},e,{}),round:s},u=`${o.dasharray.join(",")},${o.round}`,c=`${a.dasharray.join(",")},${a.round}`,h=`${l.dasharray.join(",")},${l.round}`;n.dashDependencies[u]=o,n.dashDependencies[c]=a,n.dashDependencies[h]=l,e.dashes[i.id]={min:u,mid:c,max:h}}}}let vc,bc;fi("LineBucket",xc,{omit:["layers","patternFeatures"]});var wc={get paint(){return bc=bc||new as({"line-opacity":new ns(E.paint_line["line-opacity"]),"line-color":new ns(E.paint_line["line-color"]),"line-translate":new rs(E.paint_line["line-translate"]),"line-translate-anchor":new rs(E.paint_line["line-translate-anchor"]),"line-width":new ns(E.paint_line["line-width"]),"line-gap-width":new ns(E.paint_line["line-gap-width"]),"line-offset":new ns(E.paint_line["line-offset"]),"line-blur":new ns(E.paint_line["line-blur"]),"line-dasharray":new is(E.paint_line["line-dasharray"]),"line-pattern":new is(E.paint_line["line-pattern"]),"line-gradient":new os(E.paint_line["line-gradient"])})},get layout(){return vc=vc||new as({"line-cap":new ns(E.layout_line["line-cap"]),"line-join":new ns(E.layout_line["line-join"]),"line-miter-limit":new ns(E.layout_line["line-miter-limit"]),"line-round-limit":new ns(E.layout_line["line-round-limit"]),"line-sort-key":new ns(E.layout_line["line-sort-key"])})}};class _c extends ns{possiblyEvaluate(t,e){return e=new Gi(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=y({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}let Sc;class Ac extends cs{constructor(t,e){super(t,wc,e),this.gradientVersion=0,Sc||(Sc=new _c(wc.paint.properties["line-width"].specification),Sc.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"]=Sc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new xc(t)}queryRadius(t){const e=t,r=Ic(pa("line-width",this,e),pa("line-gap-width",this,e)),n=pa("line-offset",this,e);return r/2+Math.abs(n)+fa(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:n,geometry:i,transform:s,pixelsToTileUnits:o}){const a=da(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-s.bearingInRadians,o),l=o/2*Ic(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),u=this.paint.get("line-offset").evaluate(r,n);return u&&(i=function(t,r){const n=[];for(const i of t){const t=ya(i),s=[];for(let n=0;n<t.length;n++){const i=t[n],o=t[n-1],a=t[n+1],l=0===n?new e(0,0):i.sub(o)._unit()._perp(),u=n===t.length-1?new e(0,0):a.sub(i)._unit()._perp(),c=l._add(u)._unit(),h=c.x*u.x+c.y*u.y;0!==h&&c._mult(1/h),s.push(c._mult(r)._add(i))}n.push(s)}return n}(i,u*o)),function(t,e,r){for(const n of e){if(t.length>=3)for(const e of n)if(ca(t,e))return!0;if(ia(t,n,r))return!0}return!1}(a,i,l)}isTileClipped(){return!0}}function Ic(t,e){return e>0?e+2*t:t}const kc=ds([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Tc=ds([{name:"a_projected_pos",components:3,type:"Float32"}],4);ds([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Ec=ds([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ds([{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 Mc=ds([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function Pc(t,e,r){const n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),ji.applyArabicShaping&&(t=ji.applyArabicShaping(t)),t}function Dc(t,e,r){for(const n of t.sections)n.text=Pc(n.text,e,r);return t}ds([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),ds([{name:"triangle",components:3,type:"Uint16"}]),ds([{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"}]),ds([{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"}]),ds([{type:"Float32",name:"offsetX"}]),ds([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ds([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Fc=24;const zc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Bc={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Cc={40:!0};function Vc(t,e,r,n,i,s){if("fontStack"in e){const n=r[e.fontStack],s=null==n?void 0:n[t];return s?s.metrics.advance*e.scale+i:0}{const t=n[e.imageName];return t?t.displaySize[0]*e.scale*Fc/s+i:0}}function Lc(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 Oc(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 $c(t,e,r,n,i,s){let o=null,a=Lc(e,r,i,s);for(const t of n){const n=Lc(e-t.x,r,i,s)+t.badness;n<=a&&(o=t,a=n)}return{index:t,x:e,priorBreak:o,badness:a}}function Rc(t){return t?Rc(t.priorBreak).concat(t.index):[]}class Nc{constructor(t="",e=[],r=[]){this.text=t,this.sections=e,this.sectionIndex=r,this.imageSectionID=null}static fromFeature(t,e){const r=new Nc;for(const n of t.sections)n.image?r.addImageSection(n):r.addTextSection(n,e);return r}length(){return[...this.text].length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=function(t){let e="",r={premature:!0,value:void 0};const n=t[Symbol.iterator]();let i=n.next();const s=t[Symbol.iterator]();s.next();let o=s.next();for(;!i.done;)e+=!o.done&&$i(o.value.codePointAt(0))&&!zc[o.value]||!r.premature&&$i(r.value.codePointAt(0))&&!zc[r.value]||!zc[i.value]?i.value:zc[i.value],r={value:i.value,premature:!1},i=n.next(),o=s.next();return e}(this.text)}hasZeroWidthSpaces(){return this.text.includes("")}trim(){const t=this.text.match(/^\s*/),e=t?t[0].length:0,r=this.text.match(/\S\s*$/),n=r?r[0].length-1:0;this.text=this.text.substring(e,this.text.length-n),this.sectionIndex=this.sectionIndex.slice(e,this.sectionIndex.length-n)}substring(t,e){const r=[...this.text].slice(t,e).join(""),n=this.sectionIndex.slice(t,e);return new Nc(r,this.sections,n)}toCodeUnitIndex(t){return[...this.text].slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}getMaxImageSize(t){let e=0,r=0;for(let n=0;n<this.length();n++){const i=this.getSection(n);if("imageName"in i){const n=t[i.imageName];if(!n)continue;const s=n.displaySize;e=Math.max(e,s[0]),r=Math.max(r,s[1])}}return{maxImageWidth:e,maxImageHeight:r}}addTextSection(t,e){this.text+=t.text,this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||e});const r=this.sections.length-1;this.sectionIndex.push(...[...t.text].map((()=>r)))}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void v("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:e}),this.sectionIndex.push(this.sections.length-1)):v("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,e,r,n,i){const s=[],o=this.determineAverageLineWidth(t,e,r,n,i),a=this.hasZeroWidthSpaces();let l=0,u=0;const c=this.text[Symbol.iterator]();let h=c.next();const p=this.text[Symbol.iterator]();p.next();let f=p.next();const d=this.text[Symbol.iterator]();d.next(),d.next();let y=d.next();for(;!h.done;){const e=this.getSection(u),m=h.value.codePointAt(0);if(zi(m)||(l+=Vc(m,e,r,n,t,i)),!f.done){const t=Di(m),r=f.value.codePointAt(0);(Bc[m]||t||"imageName"in e||!y.done&&Cc[r])&&s.push($c(u+1,l,o,s,Oc(m,r,t&&a),!1))}u++,h=c.next(),f=p.next(),y=d.next()}return Rc($c(this.length(),l,o,s,0,!0))}determineAverageLineWidth(t,e,r,n,i){let s=0,o=0;for(const e of this.text){const a=this.getSection(o);s+=Vc(e.codePointAt(0),a,r,n,t,i),o++}return s/Math.max(1,Math.ceil(s/e))}}const Uc=4294967296,qc=1/Uc,jc="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class Gc{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,r=this.length){for(;this.pos<r;){const r=this.readVarint(),n=r>>3,i=this.pos;this.type=7&r,t(n,e,this),this.pos===i&&this.skip(r)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Uc;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Uc;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let r,n;return n=e[this.pos++],r=127&n,n<128?r:(n=e[this.pos++],r|=(127&n)<<7,n<128?r:(n=e[this.pos++],r|=(127&n)<<14,n<128?r:(n=e[this.pos++],r|=(127&n)<<21,n<128?r:(n=e[this.pos],r|=(15&n)<<28,function(t,e,r){const n=r.buf;let i,s;if(s=n[r.pos++],i=(112&s)>>4,s<128)return Xc(t,i,e);if(s=n[r.pos++],i|=(127&s)<<3,s<128)return Xc(t,i,e);if(s=n[r.pos++],i|=(127&s)<<10,s<128)return Xc(t,i,e);if(s=n[r.pos++],i|=(127&s)<<17,s<128)return Xc(t,i,e);if(s=n[r.pos++],i|=(127&s)<<24,s<128)return Xc(t,i,e);if(s=n[r.pos++],i|=(1&s)<<31,s<128)return Xc(t,i,e);throw new Error("Expected varint not more than 10 bytes")}(r,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&jc?jc.decode(this.buf.subarray(e,t)):function(t,e,r){let n="",i=e;for(;i<r;){const e=t[i];let s,o,a,l=null,u=e>239?4:e>223?3:e>191?2:1;if(i+u>r)break;1===u?e<128&&(l=e):2===u?(s=t[i+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===u?(s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=u}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*qc),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*qc),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),4294967295^r?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){const 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(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,r){for(let n,i,s=0;s<e.length;s++){if(n=e.charCodeAt(s),n>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);const r=this.pos-e;r>=128&&Yc(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let r=0;r<e;r++)this.buf[this.pos++]=t[r]}writeRawMessage(t,e){this.pos++;const r=this.pos;t(e,this);const n=this.pos-r;n>=128&&Yc(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Zc,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Wc,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Kc,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Hc,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Jc,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Qc,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,th,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,eh,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,rh,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function Xc(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Yc(t,e,r){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(let e=r.pos-1;e>=t;e--)r.buf[e+n]=r.buf[e]}function Zc(t,e){for(let r=0;r<t.length;r++)e.writeVarint(t[r])}function Wc(t,e){for(let r=0;r<t.length;r++)e.writeSVarint(t[r])}function Hc(t,e){for(let r=0;r<t.length;r++)e.writeFloat(t[r])}function Jc(t,e){for(let r=0;r<t.length;r++)e.writeDouble(t[r])}function Kc(t,e){for(let r=0;r<t.length;r++)e.writeBoolean(t[r])}function Qc(t,e){for(let r=0;r<t.length;r++)e.writeFixed32(t[r])}function th(t,e){for(let r=0;r<t.length;r++)e.writeSFixed32(t[r])}function eh(t,e){for(let r=0;r<t.length;r++)e.writeFixed64(t[r])}function rh(t,e){for(let r=0;r<t.length;r++)e.writeSFixed64(t[r])}function nh(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();e&&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}}class ih{constructor(t,{pixelRatio:e,version:r,stretchX:n,stretchY:i,content:s,textFitWidth:o,textFitHeight:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=i,this.content=s,this.version=r,this.textFitWidth=o,this.textFitHeight=a}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class sh{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:s,h:o}=nh(i),a=new za({width:s||1,height:o||1});for(const e in t){const n=t[e],i=r[e].paddedRect;za.copy(n.data,a,{x:0,y:0},{x:i.x+1,y:i.y+1},n.data)}for(const t in e){const r=e[t],i=n[t].paddedRect,s=i.x+1,o=i.y+1,l=r.data.width,u=r.data.height;za.copy(r.data,a,{x:0,y:0},{x:s,y:o},r.data),za.copy(r.data,a,{x:0,y:u-1},{x:s,y:o-1},{width:l,height:1}),za.copy(r.data,a,{x:0,y:0},{x:s,y:o+u},{width:l,height:1}),za.copy(r.data,a,{x:l-1,y:0},{x:s-1,y:o},{width:1,height:u}),za.copy(r.data,a,{x:0,y:0},{x:s+l,y:o},{width:1,height:u})}this.image=a,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,h:i.data.height+2};r.push(s),e[n]=new ih(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 oh;function ah(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d){const y=Nc.fromFeature(t,i);let m;h===oh.vertical&&y.verticalizePunctuation();let g=y.determineLineBreaks(u,s,e,n,f);const{processBidirectionalText:x,processStyledBidirectionalText:v}=ji;if(x&&1===y.sections.length){m=[],g=g.map((t=>y.toCodeUnitIndex(t)));const t=x(y.toString(),g);for(const e of t){const t=[...e].map((()=>0));m.push(new Nc(e,y.sections,t))}}else if(v){m=[],g=g.map((t=>y.toCodeUnitIndex(t)));let t=0;const e=[];for(const r of y.text)e.push(...Array(r.length).fill(y.sectionIndex[t])),t++;const r=v(y.text,e,g);for(const t of r){const e=[];let r="";for(const n of t[0])e.push(t[1][r.length]),r+=n;m.push(new Nc(t[0],y.sections,e))}}else m=function(t,e){const r=[];let n=0;for(const i of e)r.push(t.substring(n,i)),n=i;return n<t.length()&&r.push(t.substring(n,t.length())),r}(y,g);const b=[],w={positionedLines:b,text:y.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,o,a,l,u,c,h){let p=0,f=0,d=0,y=0;const m="right"===a?1:"left"===a?0:.5,g=Fc/h;let x=0;for(const o of i){o.trim();const i=o.getMaxScale(),a={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=a;const h=a.positionedGlyphs;let v=0;if(!o.length()){f+=s,++x;continue}const b=uh(n,o,g);let w=0;for(const s of o.text){const a=o.getSection(w),d=s.codePointAt(0),y=hh(l,c,d),m={glyph:d,imageName:null,x:p,y:f+-17,vertical:y,scale:1,fontStack:"",sectionIndex:o.getSectionIndex(w),metrics:null,rect:null};let x;if("fontStack"in a){if(x=ph(a,d,y,b,e,r),!x)continue;m.fontStack=a.fontStack}else{if(t.iconsInText=!0,a.scale*=g,x=fh(a,y,i,b,n),!x)continue;v=Math.max(v,x.imageOffset),m.imageName=a.imageName}const{rect:_,metrics:S,baselineOffset:A}=x;m.y+=A,m.scale=a.scale,m.metrics=S,m.rect=_,h.push(m),y?(t.verticalizable=!0,p+=("imageName"in a?S.advance:Fc)*a.scale+u):p+=S.advance*a.scale+u,w++}0!==h.length&&(d=Math.max(p-u,d),dh(h,0,h.length-1,m)),p=0,a.lineOffset=Math.max(v,(i-1)*Fc);const _=s*i+v;f+=_,y=Math.max(_,y),++x}const{horizontalAlign:v,verticalAlign:b}=lh(o);(function(t,e,r,n,i,s,o,a,l){const u=(e-r)*i;let c=0;c=s!==o?-a*n- -17:-n*l*o+.5*o;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c})(t.positionedLines,m,v,b,d,y,s,f,i.length),t.top+=-b*f,t.bottom=t.top+f,t.left+=-v*d,t.right=t.left+d}(w,e,r,n,m,o,a,l,h,u,p,d),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}function lh(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 uh(t,e,r){const n=e.getMaxScale()*Fc,{maxImageWidth:i,maxImageHeight:s}=e.getMaxImageSize(t),o=Math.max(n,s*r);return{verticalLineContentWidth:Math.max(n,i*r),horizontalLineContentHeight:o}}function ch(t){switch(t){case"top":return 0;case"center":return.5;default:return 1}}function hh(t,e,r){return!(t===oh.horizontal||!e&&!Fi(r)||e&&(zi(r)||(n=r,/\p{sc=Arab}/u.test(String.fromCodePoint(n)))));var n}function ph(t,e,r,n,i,s){const o=s[t.fontStack],a=function(t,e,r,n){if(null==t?void 0:t.rect)return t;const i=e[r.fontStack],s=null==i?void 0:i[n];return s?{rect:null,metrics:s.metrics}:null}(null==o?void 0:o[e],i,t,e);if(null===a)return null;let l;if(r)l=n.verticalLineContentWidth-t.scale*Fc;else{const e=ch(t.verticalAlign);l=(n.horizontalLineContentHeight-t.scale*Fc)*e}return{rect:a.rect,metrics:a.metrics,baselineOffset:l}}function fh(t,e,r,n,i){const s=i[t.imageName];if(!s)return null;const o=s.paddedRect,a=s.displaySize,l={width:a[0],height:a[1],left:1,top:-3,advance:e?a[1]:a[0]};let u;if(e)u=n.verticalLineContentWidth-a[1]*t.scale;else{const e=ch(t.verticalAlign);u=(n.horizontalLineContentHeight-a[1]*t.scale)*e}return{rect:o,metrics:l,baselineOffset:u,imageOffset:(e?a[0]:a[1])*t.scale-Fc*r}}function dh(t,e,r,n){if(0===n)return;const i=t[r],s=(t[r].x+i.metrics.advance*i.scale)*n;for(let n=e;n<=r;n++)t[n].x-=s}function yh(t,e,r){const{horizontalAlign:n,verticalAlign:i}=lh(r),s=e[0]-t.displaySize[0]*n,o=e[1]-t.displaySize[1]*i;return{image:t,top:o,bottom:o+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function mh(t){var e,r;let n=t.left,i=t.top,s=t.right-n,o=t.bottom-i;const a=null!==(e=t.image.textFitWidth)&&void 0!==e?e:"stretchOrShrink",l=null!==(r=t.image.textFitHeight)&&void 0!==r?r:"stretchOrShrink",u=(t.image.content[2]-t.image.content[0])/(t.image.content[3]-t.image.content[1]);if("proportional"===l){if("stretchOnly"===a&&s/o<u||"proportional"===a){const t=Math.ceil(o*u);n*=t/s,s=t}}else if("proportional"===a&&"stretchOnly"===l&&0!==u&&s/o>u){const t=Math.ceil(s/u);i*=t/o,o=t}return{x1:n,y1:i,x2:n+s,y2:i+o}}function gh(t,e,r,n,i,s){const o=t.image;let a;if(o.content){const t=o.content,e=o.pixelRatio||1;a=[t[0]/e,t[1]/e,o.displaySize[0]-t[2]/e,o.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-o.displaySize[0])/2,h=f+o.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-o.displaySize[1])/2,p=c+o.displaySize[1]),{image:o,top:c,right:h,bottom:p,left:f,collisionPadding:a}}fi("ImagePosition",ih),fi("ImageAtlas",sh),function(t){t[t.none=0]="none",t[t.horizontal=1]="horizontal",t[t.vertical=2]="vertical",t[t.horizontalOnly=3]="horizontalOnly"}(oh||(oh={}));const xh=128,vh=32640;function bh(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Gi(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 o=e[i],a=e[s];return"composite"===r.kind?{kind:"composite",minZoom:o,maxZoom:a,interpolationType:n}:{kind:"camera",minZoom:o,maxZoom:a,minSize:r.evaluate(new Gi(o)),maxSize:r.evaluate(new Gi(a)),interpolationType:n}}}function wh(t,e,r){let n="never";const i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}const _h=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Sh(t,e,r,n,i,s,o,a,l,u,c,h,p){const f=a?Math.min(vh,Math.round(a[0])):0,d=a?Math.min(vh,Math.round(a[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),s,o,(f<<1)+(l?1:0),d,16*u,16*c,256*h,256*p)}function Ah(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 Ih(t){for(const e of t.sections)if(qi(e.text))return!0;return!1}class kh{constructor(t){this.layoutVertexArray=new oo,this.indexArray=new ho,this.programConfigurations=t,this.segments=new mo,this.dynamicLayoutVertexArray=new ao,this.opacityVertexArray=new lo,this.hasVisibleVertices=!1,this.placedSymbolArray=new qs}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,kc.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Tc.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,_h,!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())}}fi("SymbolBuffers",kh);class Th{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new mo,this.collisionVertexArray=new co}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Ec.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}fi("CollisionBuffers",Th);class Eh{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.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=bh(this.zoom,e["text-size"]),this.iconSizeData=bh(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"!==wh(r,"text-overlap","text-allow-overlap")||"never"!==wh(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=>oh[t]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID}createArrays(){this.text=new kh(new Go(this.layers,this.zoom,(t=>t.startsWith("text")))),this.icon=new kh(new Go(this.layers,this.zoom,(t=>t.startsWith("icon")))),this.glyphOffsetArray=new Xs,this.lineVertexArray=new Ys,this.symbolInstances=new Gs,this.textAnchorOffsets=new Ws}calculateGlyphDependencies(t,e,r,n,i){for(const s of t)if(e[s.codePointAt(0)]=!0,(r||n)&&i){const t=zc[s];t&&(e[t.codePointAt(0)]=!0)}}populate(t,e,r){var n;const i=this.layers[0],s=i.layout,o=s.get("text-font"),a=s.get("text-field"),l=s.get("icon-image"),u=("constant"!==a.value.kind||a.value.value instanceof Pt&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),c="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=s.get("symbol-sort-key");if(this.features=[],!u&&!c)return;const p=e.iconDependencies,f=e.glyphDependencies,d=e.availableImages,y=new Gi(this.zoom);for(const{feature:e,id:a,index:l,sourceLayerIndex:m}of t){const t=i._featureFilter.needGeometry,g=Jo(e,t);if(!i._featureFilter.filter(y,g,r))continue;let x,v;if(t||(g.geometry=Ho(e)),u){const t=i.getValueAndResolveTokens("text-field",g,r,d),e=Pt.factory(t);this.hasRTLText||(this.hasRTLText=Ih(e)),(!this.hasRTLText||"unavailable"===ji.getRTLTextPluginStatus()||this.hasRTLText&&ji.isParsed())&&(x=Dc(e,i,g))}if(c){const t=i.getValueAndResolveTokens("icon-image",g,r,d);v=t instanceof Lt?t:Lt.fromString(t)}if(!x&&!v)continue;const b=this.sortFeaturesByKey?h.evaluate(g,{},r):void 0;if(this.features.push({id:a,text:x,icon:v,index:l,sourceLayerIndex:m,geometry:g.geometry,properties:e.properties,type:Rl.types[e.type],sortKey:b}),v&&(p[v.name]=!0),x){const t=o.evaluate(g,{},r).join(","),e="viewport"!==s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=null===(n=this.writingModes)||void 0===n?void 0:n.includes(oh.vertical);for(const r of x.sections)if(r.image)p[r.image.name]=!0;else{const n=Bi(x.toString()),i=r.fontStack||t;f[i]||(f[i]={}),this.calculateGlyphDependencies(r.text,f[i],e,this.allowVerticalPlacement,n)}}}"line"===s.get("symbol-placement")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++}function o(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 a(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=a(f,d,h),i=o(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?o(f,d,h):d in e?a(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,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions: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,o,a,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&&o===oh.vertical?Math.PI/2:0,x=s.text&&s.text.sections;for(let n=0;n<e.length;n++){const{tl:i,tr:o,bl:l,br:u,tex:c,pixelOffsetTL:y,pixelOffsetBR:m,minFontScaleX:v,minFontScaleY:b,glyphOffset:w,isSDF:_,sectionIndex:S}=e[n],A=d.vertexLength,I=w[1];Sh(f,a.x,a.y,i.x,I+i.y,c.x,c.y,r,_,y.x,y.y,v,b),Sh(f,a.x,a.y,o.x,I+o.y,c.x+c.w,c.y,r,_,m.x,y.y,v,b),Sh(f,a.x,a.y,l.x,I+l.y,c.x,c.y+c.h,r,_,y.x,m.y,v,b),Sh(f,a.x,a.y,u.x,I+u.y,c.x+c.w,c.y+c.h,r,_,m.x,m.y,v,b),Ah(t.dynamicLayoutVertexArray,a,g),p.emplaceBack(A,A+2,A+1),p.emplaceBack(A+1,A+2,A+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,{imagePositions:{},canonical:h,formattedSection:null==x?void 0:x[S]})}t.placedSymbolArray.emplaceBack(a.x,a.y,y,this.glyphOffsetArray.length-y,m,l,u,a.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],o,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,r,n,i,s,o,a){const l=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),u=l.vertexLength,c=s.layoutVertexArray,h=s.collisionVertexArray,p=a.anchorX,f=a.anchorY;this._addCollisionDebugVertex(c,h,o,p,f,new e(t,r)),this._addCollisionDebugVertex(c,h,o,p,f,new e(n,r)),this._addCollisionDebugVertex(c,h,o,p,f,new e(n,i)),this._addCollisionDebugVertex(c,h,o,p,f,new e(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 Th(uo,Mc.members,po),this.iconCollisionBox=new Th(uo,Mc.members,po);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,o,a,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<o;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=a;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+2,e+1),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 o=this.symbolInstances.get(t);n.push(0|Math.round(e*o.anchorX+r*o.anchorY)),i.push(o.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];(null==r?void 0: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);const r=[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex];for(let t=0;t<r.length;t++){const e=r[t];e>=0&&r.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)}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 Mh,Ph;fi("SymbolBucket",Eh,{omit:["layers","collisionBoxArray","features","compareText"]}),Eh.MAX_GLYPHS=65535,Eh.addDynamicAttributes=Ah;var Dh={get paint(){return Ph=Ph||new as({"icon-opacity":new ns(E.paint_symbol["icon-opacity"]),"icon-color":new ns(E.paint_symbol["icon-color"]),"icon-halo-color":new ns(E.paint_symbol["icon-halo-color"]),"icon-halo-width":new ns(E.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ns(E.paint_symbol["icon-halo-blur"]),"icon-translate":new rs(E.paint_symbol["icon-translate"]),"icon-translate-anchor":new rs(E.paint_symbol["icon-translate-anchor"]),"text-opacity":new ns(E.paint_symbol["text-opacity"]),"text-color":new ns(E.paint_symbol["text-color"],{runtimeType:O,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new ns(E.paint_symbol["text-halo-color"]),"text-halo-width":new ns(E.paint_symbol["text-halo-width"]),"text-halo-blur":new ns(E.paint_symbol["text-halo-blur"]),"text-translate":new rs(E.paint_symbol["text-translate"]),"text-translate-anchor":new rs(E.paint_symbol["text-translate-anchor"])})},get layout(){return Mh=Mh||new as({"symbol-placement":new rs(E.layout_symbol["symbol-placement"]),"symbol-spacing":new rs(E.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new rs(E.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ns(E.layout_symbol["symbol-sort-key"]),"symbol-z-order":new rs(E.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new rs(E.layout_symbol["icon-allow-overlap"]),"icon-overlap":new rs(E.layout_symbol["icon-overlap"]),"icon-ignore-placement":new rs(E.layout_symbol["icon-ignore-placement"]),"icon-optional":new rs(E.layout_symbol["icon-optional"]),"icon-rotation-alignment":new rs(E.layout_symbol["icon-rotation-alignment"]),"icon-size":new ns(E.layout_symbol["icon-size"]),"icon-text-fit":new rs(E.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new rs(E.layout_symbol["icon-text-fit-padding"]),"icon-image":new ns(E.layout_symbol["icon-image"]),"icon-rotate":new ns(E.layout_symbol["icon-rotate"]),"icon-padding":new ns(E.layout_symbol["icon-padding"]),"icon-keep-upright":new rs(E.layout_symbol["icon-keep-upright"]),"icon-offset":new ns(E.layout_symbol["icon-offset"]),"icon-anchor":new ns(E.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new rs(E.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new rs(E.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new rs(E.layout_symbol["text-rotation-alignment"]),"text-field":new ns(E.layout_symbol["text-field"]),"text-font":new ns(E.layout_symbol["text-font"]),"text-size":new ns(E.layout_symbol["text-size"]),"text-max-width":new ns(E.layout_symbol["text-max-width"]),"text-line-height":new rs(E.layout_symbol["text-line-height"]),"text-letter-spacing":new ns(E.layout_symbol["text-letter-spacing"]),"text-justify":new ns(E.layout_symbol["text-justify"]),"text-radial-offset":new ns(E.layout_symbol["text-radial-offset"]),"text-variable-anchor":new rs(E.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ns(E.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ns(E.layout_symbol["text-anchor"]),"text-max-angle":new rs(E.layout_symbol["text-max-angle"]),"text-writing-mode":new rs(E.layout_symbol["text-writing-mode"]),"text-rotate":new ns(E.layout_symbol["text-rotate"]),"text-padding":new rs(E.layout_symbol["text-padding"]),"text-keep-upright":new rs(E.layout_symbol["text-keep-upright"]),"text-transform":new ns(E.layout_symbol["text-transform"]),"text-offset":new ns(E.layout_symbol["text-offset"]),"text-allow-overlap":new rs(E.layout_symbol["text-allow-overlap"]),"text-overlap":new rs(E.layout_symbol["text-overlap"]),"text-ignore-placement":new rs(E.layout_symbol["text-ignore-placement"]),"text-optional":new rs(E.layout_symbol["text-optional"])})}};class Fh{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:B,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(null==e?void 0: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}}fi("FormatSectionOverride",Fh,{omit:["defaultValue"]});class zh extends cs{constructor(t,e){super(t,Dh,e)}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.includes(r)||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()||tn(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>t&&r in t?String(t[r]):""))}(e.properties,i)}createBucket(t){return new Eh(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Dh.paint.overridableProperties){if(!zh.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new Fh(e),n=new Qr(r,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new rn("source",n):new nn("composite",n,e.value.zoomStops),this.paint._values[t]=new ts(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&zh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=Dh.paint.properties[e];let i=!1;const s=t=>{var e;for(const r of t)if(null===(e=n.overrides)||void 0===e?void 0:e.hasOverride(r))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof Pt)s(r.value.value.sections);else if("source"===r.value.kind||"composite"===r.value.kind){const t=e=>{i||(e instanceof qt&&Nt(e.value)===q?s(e.value.sections):e instanceof Te?s(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return i}}let Bh;var Ch={get paint(){return Bh=Bh||new as({"background-color":new rs(E.paint_background["background-color"]),"background-pattern":new ss(E.paint_background["background-pattern"]),"background-opacity":new rs(E.paint_background["background-opacity"])})}};class Vh extends cs{constructor(t,e){super(t,Ch,e)}}let Lh;var Oh,$h,Rh={get paint(){return Lh=Lh||new as({"raster-opacity":new rs(E.paint_raster["raster-opacity"]),"raster-hue-rotate":new rs(E.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new rs(E.paint_raster["raster-brightness-min"]),"raster-brightness-max":new rs(E.paint_raster["raster-brightness-max"]),"raster-saturation":new rs(E.paint_raster["raster-saturation"]),"raster-contrast":new rs(E.paint_raster["raster-contrast"]),resampling:new rs(E.paint_raster.resampling),"raster-resampling":new rs(E.paint_raster["raster-resampling"]),"raster-fade-duration":new rs(E.paint_raster["raster-fade-duration"])})}};class Nh extends cs{constructor(t,e){super(t,Rh,e)}}class Uh extends cs{constructor(t,e){super(t,{},e),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 qh(t,e){if("custom"===t.type)return new Uh(t,e);switch(t.type){case"background":return new Vh(t,e);case"circle":return new Ia(t,e);case"color-relief":return new Xa(t,e);case"fill":return new Vl(t,e);case"fill-extrusion":return new ru(t,e);case"heatmap":return new Va(t,e);case"hillshade":return new $a(t,e);case"line":return new Ac(t,e);case"raster":return new Nh(t,e);case"symbol":return new zh(t,e)}}class jh{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 Gh{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,this._x=r,this._y=n,this._z=e,this.properties=t.properties,this.id=i}projectPoint(t,e,r,n){return[360*(t.x+e)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+r)/n)*Math.PI))-90]}projectLine(t,e,r,n){return t.map((t=>this.projectPoint(t,e,r,n)))}get geometry(){if(this._geometry)return this._geometry;const t=this._vectorTileFeature,e=t.extent*Math.pow(2,this._z),r=t.extent*this._x,n=t.extent*this._y,i=t.loadGeometry();switch(t.type){case 1:{const t=[];for(const e of i)t.push(e[0]);const s=this.projectLine(t,r,n,e);this._geometry=1===t.length?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{const t=i.map((t=>this.projectLine(t,r,n,e)));this._geometry=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t};break}case 3:{const t=Ul(i),s=[];for(const i of t)s.push(i.map((t=>this.projectLine(t,r,n,e))));this._geometry=1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw new Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&"_x"!==e&&"_y"!==e&&"_z"!==e&&(t[e]=this[e]);return t}}class Xh{constructor(t,e,r){this._name=t,this.dataBuffer=e,"number"==typeof r?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer?.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Yh extends Xh{}class Zh extends Yh{getValueFromBuffer(t){return this.dataBuffer[t]}}class Wh extends Yh{getValueFromBuffer(t){return this.dataBuffer[t]}}class Hh extends Xh{constructor(t,e,r,n){super(t,e,n),this.delta=r}}class Jh extends Hh{constructor(t,e,r,n){super(t,Int32Array.of(e),r,n)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}}class Kh extends Xh{constructor(t,e,r,n){super(t,n?Int32Array.of(e):Uint32Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}}class Qh{constructor(t,e,r,n,i=4096){this._name=t,this._geometryVector=e,this._idVector=r,this._propertyVectors=n,this._extent=i}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((t=>[t.name,t])))),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const t=[],e=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let n;if(this.idVector){const t=this.idVector.getValue(r);n=this.containsMaxSafeIntegerValues(this.idVector)&&null!==t?Number(t):t}const i={coordinates:e[r],type:this.geometryVector.geometryType(r)},s={};for(const t of this.propertyVectors){if(!t)continue;const e=t.name,n=t.getValue(r);null!==n&&(s[e]=n)}t.push({id:n,geometry:i,properties:s})}return t}containsMaxSafeIntegerValues(t){return t instanceof Zh||t instanceof Kh||t instanceof Jh||t instanceof Wh}}class tp{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}}!function(t){t.NONE="NONE",t.DELTA="DELTA",t.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",t.RLE="RLE",t.MORTON="MORTON",t.PDE="PDE"}(Oh||(Oh={})),function(t){t.NONE="NONE",t.FAST_PFOR="FAST_PFOR",t.VARINT="VARINT",t.ALP="ALP"}($h||($h={}));const ep=new Uint32Array(33);ep[0]=0;for(let t=1;t<=32;t++)ep[t]=32===t?4294967295:4294967295>>>32-t;const rp=ep,np=256;function ip(t,e){return t-t%e}function sp(t){const e=t>>>0;return((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}const op=function(){if(!Number.isFinite(65536))return 65536;const t=ip(Math.floor(65536),np);return 0===t?np:t}(),ap=3*op/np+op|0;function lp(){const t=new Uint8Array(ap);return{dataToBePacked:new Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function up(t,e,r,n,i){switch(i){case 1:!function(t,e,r,n){let i=n,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0;r[i++]=e>>>0&1,r[i++]=e>>>1&1,r[i++]=e>>>2&1,r[i++]=e>>>3&1,r[i++]=e>>>4&1,r[i++]=e>>>5&1,r[i++]=e>>>6&1,r[i++]=e>>>7&1,r[i++]=e>>>8&1,r[i++]=e>>>9&1,r[i++]=e>>>10&1,r[i++]=e>>>11&1,r[i++]=e>>>12&1,r[i++]=e>>>13&1,r[i++]=e>>>14&1,r[i++]=e>>>15&1,r[i++]=e>>>16&1,r[i++]=e>>>17&1,r[i++]=e>>>18&1,r[i++]=e>>>19&1,r[i++]=e>>>20&1,r[i++]=e>>>21&1,r[i++]=e>>>22&1,r[i++]=e>>>23&1,r[i++]=e>>>24&1,r[i++]=e>>>25&1,r[i++]=e>>>26&1,r[i++]=e>>>27&1,r[i++]=e>>>28&1,r[i++]=e>>>29&1,r[i++]=e>>>30&1,r[i++]=e>>>31&1}}(t,e,r,n);break;case 2:!function(t,e,r,n){let i=n,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,n=t[s++]>>>0;r[i++]=e>>>0&3,r[i++]=e>>>2&3,r[i++]=e>>>4&3,r[i++]=e>>>6&3,r[i++]=e>>>8&3,r[i++]=e>>>10&3,r[i++]=e>>>12&3,r[i++]=e>>>14&3,r[i++]=e>>>16&3,r[i++]=e>>>18&3,r[i++]=e>>>20&3,r[i++]=e>>>22&3,r[i++]=e>>>24&3,r[i++]=e>>>26&3,r[i++]=e>>>28&3,r[i++]=e>>>30&3,r[i++]=n>>>0&3,r[i++]=n>>>2&3,r[i++]=n>>>4&3,r[i++]=n>>>6&3,r[i++]=n>>>8&3,r[i++]=n>>>10&3,r[i++]=n>>>12&3,r[i++]=n>>>14&3,r[i++]=n>>>16&3,r[i++]=n>>>18&3,r[i++]=n>>>20&3,r[i++]=n>>>22&3,r[i++]=n>>>24&3,r[i++]=n>>>26&3,r[i++]=n>>>28&3,r[i++]=n>>>30&3}}(t,e,r,n);break;case 3:!function(t,e,r,n){let i=n,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,n=t[s++]>>>0,o=t[s++]>>>0;r[i++]=e>>>0&7,r[i++]=e>>>3&7,r[i++]=e>>>6&7,r[i++]=e>>>9&7,r[i++]=e>>>12&7,r[i++]=e>>>15&7,r[i++]=e>>>18&7,r[i++]=e>>>21&7,r[i++]=e>>>24&7,r[i++]=e>>>27&7,r[i++]=7&(e>>>30|(1&n)<<2),r[i++]=n>>>1&7,r[i++]=n>>>4&7,r[i++]=n>>>7&7,r[i++]=n>>>10&7,r[i++]=n>>>13&7,r[i++]=n>>>16&7,r[i++]=n>>>19&7,r[i++]=n>>>22&7,r[i++]=n>>>25&7,r[i++]=n>>>28&7,r[i++]=7&(n>>>31|(3&o)<<1),r[i++]=o>>>2&7,r[i++]=o>>>5&7,r[i++]=o>>>8&7,r[i++]=o>>>11&7,r[i++]=o>>>14&7,r[i++]=o>>>17&7,r[i++]=o>>>20&7,r[i++]=o>>>23&7,r[i++]=o>>>26&7,r[i++]=o>>>29&7}}(t,e,r,n);break;case 4:!function(t,e,r,n){let i=n,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,n=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0;r[i++]=e>>>0&15,r[i++]=e>>>4&15,r[i++]=e>>>8&15,r[i++]=e>>>12&15,r[i++]=e>>>16&15,r[i++]=e>>>20&15,r[i++]=e>>>24&15,r[i++]=e>>>28&15,r[i++]=n>>>0&15,r[i++]=n>>>4&15,r[i++]=n>>>8&15,r[i++]=n>>>12&15,r[i++]=n>>>16&15,r[i++]=n>>>20&15,r[i++]=n>>>24&15,r[i++]=n>>>28&15,r[i++]=o>>>0&15,r[i++]=o>>>4&15,r[i++]=o>>>8&15,r[i++]=o>>>12&15,r[i++]=o>>>16&15,r[i++]=o>>>20&15,r[i++]=o>>>24&15,r[i++]=o>>>28&15,r[i++]=a>>>0&15,r[i++]=a>>>4&15,r[i++]=a>>>8&15,r[i++]=a>>>12&15,r[i++]=a>>>16&15,r[i++]=a>>>20&15,r[i++]=a>>>24&15,r[i++]=a>>>28&15}}(t,e,r,n);break;case 5:!function(t,e,r,n){let i=n,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,n=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0;r[i++]=e>>>0&31,r[i++]=e>>>5&31,r[i++]=e>>>10&31,r[i++]=e>>>15&31,r[i++]=e>>>20&31,r[i++]=e>>>25&31,r[i++]=31&(e>>>30|(7&n)<<2),r[i++]=n>>>3&31,r[i++]=n>>>8&31,r[i++]=n>>>13&31,r[i++]=n>>>18&31,r[i++]=n>>>23&31,r[i++]=31&(n>>>28|(1&o)<<4),r[i++]=o>>>1&31,r[i++]=o>>>6&31,r[i++]=o>>>11&31,r[i++]=o>>>16&31,r[i++]=o>>>21&31,r[i++]=o>>>26&31,r[i++]=31&(o>>>31|(15&a)<<1),r[i++]=a>>>4&31,r[i++]=a>>>9&31,r[i++]=a>>>14&31,r[i++]=a>>>19&31,r[i++]=a>>>24&31,r[i++]=31&(a>>>29|(3&l)<<3),r[i++]=l>>>2&31,r[i++]=l>>>7&31,r[i++]=l>>>12&31,r[i++]=l>>>17&31,r[i++]=l>>>22&31,r[i++]=l>>>27&31}}(t,e,r,n);break;case 6:!function(t,e,r,n){let i=n,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,n=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0,u=t[s++]>>>0;r[i++]=e>>>0&63,r[i++]=e>>>6&63,r[i++]=e>>>12&63,r[i++]=e>>>18&63,r[i++]=e>>>24&63,r[i++]=63&(e>>>30|(15&n)<<2),r[i++]=n>>>4&63,r[i++]=n>>>10&63,r[i++]=n>>>16&63,r[i++]=n>>>22&63,r[i++]=63&(n>>>28|(3&o)<<4),r[i++]=o>>>2&63,r[i++]=o>>>8&63,r[i++]=o>>>14&63,r[i++]=o>>>20&63,r[i++]=o>>>26&63,r[i++]=a>>>0&63,r[i++]=a>>>6&63,r[i++]=a>>>12&63,r[i++]=a>>>18&63,r[i++]=a>>>24&63,r[i++]=63&(a>>>30|(15&l)<<2),r[i++]=l>>>4&63,r[i++]=l>>>10&63,r[i++]=l>>>16&63,r[i++]=l>>>22&63,r[i++]=63&(l>>>28|(3&u)<<4),r[i++]=u>>>2&63,r[i++]=u>>>8&63,r[i++]=u>>>14&63,r[i++]=u>>>20&63,r[i++]=u>>>26&63}}(t,e,r,n);break;case 7:!function(t,e,r,n){let i=n,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,n=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0,u=t[s++]>>>0,c=t[s++]>>>0;r[i++]=e>>>0&127,r[i++]=e>>>7&127,r[i++]=e>>>14&127,r[i++]=e>>>21&127,r[i++]=127&(e>>>28|(7&n)<<4),r[i++]=n>>>3&127,r[i++]=n>>>10&127,r[i++]=n>>>17&127,r[i++]=n>>>24&127,r[i++]=127&(n>>>31|(63&o)<<1),r[i++]=o>>>6&127,r[i++]=o>>>13&127,r[i++]=o>>>20&127,r[i++]=127&(o>>>27|(3&a)<<5),r[i++]=a>>>2&127,r[i++]=a>>>9&127,r[i++]=a>>>16&127,r[i++]=a>>>23&127,r[i++]=127&(a>>>30|(31&l)<<2),r[i++]=l>>>5&127,r[i++]=l>>>12&127,r[i++]=l>>>19&127,r[i++]=127&(l>>>26|(1&u)<<6),r[i++]=u>>>1&127,r[i++]=u>>>8&127,r[i++]=u>>>15&127,r[i++]=u>>>22&127,r[i++]=127&(u>>>29|(15&c)<<3),r[i++]=c>>>4&127,r[i++]=c>>>11&127,r[i++]=c>>>18&127,r[i++]=c>>>25&127}}(t,e,r,n);break;case 8:!function(t,e,r,n){let i=n,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,n=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0,u=t[s++]>>>0,c=t[s++]>>>0,h=t[s++]>>>0;r[i++]=e>>>0&255,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=n>>>0&255,r[i++]=n>>>8&255,r[i++]=n>>>16&255,r[i++]=n>>>24&255,r[i++]=o>>>0&255,r[i++]=o>>>8&255,r[i++]=o>>>16&255,r[i++]=o>>>24&255,r[i++]=a>>>0&255,r[i++]=a>>>8&255,r[i++]=a>>>16&255,r[i++]=a>>>24&255,r[i++]=l>>>0&255,r[i++]=l>>>8&255,r[i++]=l>>>16&255,r[i++]=l>>>24&255,r[i++]=u>>>0&255,r[i++]=u>>>8&255,r[i++]=u>>>16&255,r[i++]=u>>>24&255,r[i++]=c>>>0&255,r[i++]=c>>>8&255,r[i++]=c>>>16&255,r[i++]=c>>>24&255,r[i++]=h>>>0&255,r[i++]=h>>>8&255,r[i++]=h>>>16&255,r[i++]=h>>>24&255}}(t,e,r,n);break;case 16:!function(t,e,r,n){let i=n,s=e;for(let e=0;e<128;e++){const e=t[s++]>>>0;r[i++]=65535&e,r[i++]=e>>>16&65535}}(t,e,r,n);break;default:!function(t,e,r,n,i){const s=rp[i]>>>0;let o=e,a=0,l=t[o]>>>0,u=n;for(let e=0;e<8;e++){for(let e=0;e<32;e++)if(a+i<=32)r[u+e]=l>>>a&s,a+=i,32===a&&(a=0,o++,31!==e&&(l=t[o]>>>0));else{const n=32-a,c=l>>>a;o++,l=t[o]>>>0;const h=i-n;r[u+e]=(c|(l&-1>>>32-h>>>0)<<n)&s,a=h}u+=32,a=0,e<7&&(l=t[o]>>>0)}}(t,e,r,n,i)}return e+(i<<3)|0}function cp(t,e,r,n){if(r+2>e)throw new Error(`FastPFOR decode: byteContainer underflow at block=${n} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${e})`);const i=t[r++],s=t[r++];if(i>32)throw new Error(`FastPFOR decode: invalid bitWidth=${i} at block=${n} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:i,exceptionCount:s,bytePosIn:r}}function hp(t,e,r,n,i,s,o,a,l){const{maxBits:u,exceptionBitWidth:c,bytePosIn:h}=function(t,e,r,n,i,s){if(r+1>e)throw new Error(`FastPFOR decode: exception header underflow at block=${s} (need 1 byte for maxBits, bytePos=${r}, byteSize=${e})`);const o=t[r++];if(o<n||o>32)throw new Error(`FastPFOR decode: invalid maxBits=${o} at block=${s} (bitWidth=${n}, expected ${n}..32)`);const a=o-n|0;if(a<1||a>32)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${a} at block=${s} (bitWidth=${n}, maxBits=${o})`);if(r+i>e)throw new Error(`FastPFOR decode: exception positions underflow at block=${s} (need=${i}, have=${e-r})`);return{maxBits:o,exceptionBitWidth:a,bytePosIn:r}}(i,s,o,r,n,l);if(o=h,1===c){const s=1<<r;for(let r=0;r<n;r=r+1|0)t[i[o++]+e|0]|=s;return o}const p=a.dataToBePacked[c];if(!p)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${c} (bitWidth=${r}, maxBits=${u}) at block ${l}`);const f=a.dataPointers;let d=0|f[c];const y=0|a.exceptionSizes[c];if(d+n>y)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${c} (ptr=${d}, need ${n}, size=${y}) at block ${l}`);for(let s=0;s<n;s=s+1|0){const n=i[o++],s=0|p[d++];t[n+e|0]|=s<<r}return f[c]=d,o}function pp(t,e,r,n,i,s){const o=0|r,a=0|t[o];if(a<=0||o+a>t.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${a} at pageStart=${o} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);const l=o+1|0,u=o+a|0,c=t[u]>>>0,h=c+3>>>2,p=u+1,f=p+h;if(f>=t.length)throw new Error(`FastPFOR decode: invalid byteSize=${c} (metaInts=${h}, pageStart=${o}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${t.length})`);const d=function(t,e,r,n){n.byteContainer.length<r&&(n.byteContainer=new Uint8Array(2*r),n.byteContainerI32=void 0);const i=n.byteContainer,s=r>>>2;if(3&i.byteOffset)for(let r=0;r<s;r=r+1|0){const n=0|t[e+r|0],s=r<<2;i[s]=255&n,i[s+1|0]=n>>>8&255,i[s+2|0]=n>>>16&255,i[s+3|0]=n>>>24&255}else{let r=n.byteContainerI32;(!r||r.buffer!==i.buffer||r.byteOffset!==i.byteOffset||r.length<s)&&(r=n.byteContainerI32=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>>2)),r.set(t.subarray(e,e+s))}const o=3&r;if(o>0){const r=0|t[e+s|0],n=s<<2;for(let t=0;t<o;t=t+1|0)i[n+t|0]=r>>>(t<<3)&255}return i}(t,p,c,s),y=c,m=function(t,e,r){const n=0|t[e++],i=r.dataToBePacked;for(let s=2;s<=32;s=s+1|0){if(!(n>>>s-1&1))continue;if(e>=t.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${s}, streamWordIndex=${e}, needWords=1, availableWords=${t.length-e}, encodedWords=${t.length})`);const o=t[e++]>>>0,a=ip(o+31,32),l=o*s+31>>>5;if(e+l>t.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${s}, size=${o}, streamWordIndex=${e}, needWords=${l}, availableWords=${t.length-e}, encodedWords=${t.length})`);let u=i[s];(!u||u.length<a)&&(u=i[s]=new Uint32Array(a));let c=0;for(;c<o;c=c+32|0)fp(t,e,u,c,s),e=e+s|0;e=e-((c-o|0)*s>>>5)|0,r.exceptionSizes[s]=o}return e}(t,f,s);return s.dataPointers.fill(0),function(t,e,r,n,i,s,o,a,l,u){let c=0|r,h=0;for(let e=0;e<o;e=e+1|0){const r=cp(a,l,h,e);h=r.bytePosIn;const n=r.bitWidth,o=r.exceptionCount,p=s+e*np|0;switch(n){case 0:i.fill(0,p,p+np);break;case 32:for(let e=0;e<np;e=e+1|0)i[p+e|0]=0|t[c+e|0];c=c+np|0;break;default:c=up(t,c,i,p,n)}o>0&&(h=hp(i,p,n,o,a,l,h,u,e))}if(c!==n)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${r}, consumedPackedEnd=${c}, expectedPackedEnd=${n}, packedWords=${n-r}, encoded.length=${t.length})`)}(t,o,l,u,e,0|n,i/np|0,d,y,s),m}function fp(t,e,r,n,i){switch(i){case 2:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0;r[i++]=s>>>0&3,r[i++]=s>>>2&3,r[i++]=s>>>4&3,r[i++]=s>>>6&3,r[i++]=s>>>8&3,r[i++]=s>>>10&3,r[i++]=s>>>12&3,r[i++]=s>>>14&3,r[i++]=s>>>16&3,r[i++]=s>>>18&3,r[i++]=s>>>20&3,r[i++]=s>>>22&3,r[i++]=s>>>24&3,r[i++]=s>>>26&3,r[i++]=s>>>28&3,r[i++]=s>>>30&3,r[i++]=o>>>0&3,r[i++]=o>>>2&3,r[i++]=o>>>4&3,r[i++]=o>>>6&3,r[i++]=o>>>8&3,r[i++]=o>>>10&3,r[i++]=o>>>12&3,r[i++]=o>>>14&3,r[i++]=o>>>16&3,r[i++]=o>>>18&3,r[i++]=o>>>20&3,r[i++]=o>>>22&3,r[i++]=o>>>24&3,r[i++]=o>>>26&3,r[i++]=o>>>28&3,r[i]=o>>>30&3}(t,e,r,n);case 3:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0;r[i++]=s>>>0&7,r[i++]=s>>>3&7,r[i++]=s>>>6&7,r[i++]=s>>>9&7,r[i++]=s>>>12&7,r[i++]=s>>>15&7,r[i++]=s>>>18&7,r[i++]=s>>>21&7,r[i++]=s>>>24&7,r[i++]=s>>>27&7,r[i++]=7&(s>>>30|(1&o)<<2),r[i++]=o>>>1&7,r[i++]=o>>>4&7,r[i++]=o>>>7&7,r[i++]=o>>>10&7,r[i++]=o>>>13&7,r[i++]=o>>>16&7,r[i++]=o>>>19&7,r[i++]=o>>>22&7,r[i++]=o>>>25&7,r[i++]=o>>>28&7,r[i++]=7&(o>>>31|(3&a)<<1),r[i++]=a>>>2&7,r[i++]=a>>>5&7,r[i++]=a>>>8&7,r[i++]=a>>>11&7,r[i++]=a>>>14&7,r[i++]=a>>>17&7,r[i++]=a>>>20&7,r[i++]=a>>>23&7,r[i++]=a>>>26&7,r[i]=a>>>29&7}(t,e,r,n);case 4:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0;r[i++]=s>>>0&15,r[i++]=s>>>4&15,r[i++]=s>>>8&15,r[i++]=s>>>12&15,r[i++]=s>>>16&15,r[i++]=s>>>20&15,r[i++]=s>>>24&15,r[i++]=s>>>28&15,r[i++]=o>>>0&15,r[i++]=o>>>4&15,r[i++]=o>>>8&15,r[i++]=o>>>12&15,r[i++]=o>>>16&15,r[i++]=o>>>20&15,r[i++]=o>>>24&15,r[i++]=o>>>28&15,r[i++]=a>>>0&15,r[i++]=a>>>4&15,r[i++]=a>>>8&15,r[i++]=a>>>12&15,r[i++]=a>>>16&15,r[i++]=a>>>20&15,r[i++]=a>>>24&15,r[i++]=a>>>28&15,r[i++]=l>>>0&15,r[i++]=l>>>4&15,r[i++]=l>>>8&15,r[i++]=l>>>12&15,r[i++]=l>>>16&15,r[i++]=l>>>20&15,r[i++]=l>>>24&15,r[i]=l>>>28&15}(t,e,r,n);case 5:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0;r[i++]=s>>>0&31,r[i++]=s>>>5&31,r[i++]=s>>>10&31,r[i++]=s>>>15&31,r[i++]=s>>>20&31,r[i++]=s>>>25&31,r[i++]=31&(s>>>30|(7&o)<<2),r[i++]=o>>>3&31,r[i++]=o>>>8&31,r[i++]=o>>>13&31,r[i++]=o>>>18&31,r[i++]=o>>>23&31,r[i++]=31&(o>>>28|(1&a)<<4),r[i++]=a>>>1&31,r[i++]=a>>>6&31,r[i++]=a>>>11&31,r[i++]=a>>>16&31,r[i++]=a>>>21&31,r[i++]=a>>>26&31,r[i++]=31&(a>>>31|(15&l)<<1),r[i++]=l>>>4&31,r[i++]=l>>>9&31,r[i++]=l>>>14&31,r[i++]=l>>>19&31,r[i++]=l>>>24&31,r[i++]=31&(l>>>29|(3&u)<<3),r[i++]=u>>>2&31,r[i++]=u>>>7&31,r[i++]=u>>>12&31,r[i++]=u>>>17&31,r[i++]=u>>>22&31,r[i]=u>>>27&31}(t,e,r,n);case 6:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0;r[i++]=s>>>0&63,r[i++]=s>>>6&63,r[i++]=s>>>12&63,r[i++]=s>>>18&63,r[i++]=s>>>24&63,r[i++]=63&(s>>>30|(15&o)<<2),r[i++]=o>>>4&63,r[i++]=o>>>10&63,r[i++]=o>>>16&63,r[i++]=o>>>22&63,r[i++]=63&(o>>>28|(3&a)<<4),r[i++]=a>>>2&63,r[i++]=a>>>8&63,r[i++]=a>>>14&63,r[i++]=a>>>20&63,r[i++]=a>>>26&63,r[i++]=l>>>0&63,r[i++]=l>>>6&63,r[i++]=l>>>12&63,r[i++]=l>>>18&63,r[i++]=l>>>24&63,r[i++]=63&(l>>>30|(15&u)<<2),r[i++]=u>>>4&63,r[i++]=u>>>10&63,r[i++]=u>>>16&63,r[i++]=u>>>22&63,r[i++]=63&(u>>>28|(3&c)<<4),r[i++]=c>>>2&63,r[i++]=c>>>8&63,r[i++]=c>>>14&63,r[i++]=c>>>20&63,r[i]=c>>>26&63}(t,e,r,n);case 7:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0;r[i++]=s>>>0&127,r[i++]=s>>>7&127,r[i++]=s>>>14&127,r[i++]=s>>>21&127,r[i++]=127&(s>>>28|(7&o)<<4),r[i++]=o>>>3&127,r[i++]=o>>>10&127,r[i++]=o>>>17&127,r[i++]=o>>>24&127,r[i++]=127&(o>>>31|(63&a)<<1),r[i++]=a>>>6&127,r[i++]=a>>>13&127,r[i++]=a>>>20&127,r[i++]=127&(a>>>27|(3&l)<<5),r[i++]=l>>>2&127,r[i++]=l>>>9&127,r[i++]=l>>>16&127,r[i++]=l>>>23&127,r[i++]=127&(l>>>30|(31&u)<<2),r[i++]=u>>>5&127,r[i++]=u>>>12&127,r[i++]=u>>>19&127,r[i++]=127&(u>>>26|(1&c)<<6),r[i++]=c>>>1&127,r[i++]=c>>>8&127,r[i++]=c>>>15&127,r[i++]=c>>>22&127,r[i++]=127&(c>>>29|(15&h)<<3),r[i++]=h>>>4&127,r[i++]=h>>>11&127,r[i++]=h>>>18&127,r[i]=h>>>25&127}(t,e,r,n);case 8:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0;r[i++]=s>>>0&255,r[i++]=s>>>8&255,r[i++]=s>>>16&255,r[i++]=s>>>24&255,r[i++]=o>>>0&255,r[i++]=o>>>8&255,r[i++]=o>>>16&255,r[i++]=o>>>24&255,r[i++]=a>>>0&255,r[i++]=a>>>8&255,r[i++]=a>>>16&255,r[i++]=a>>>24&255,r[i++]=l>>>0&255,r[i++]=l>>>8&255,r[i++]=l>>>16&255,r[i++]=l>>>24&255,r[i++]=u>>>0&255,r[i++]=u>>>8&255,r[i++]=u>>>16&255,r[i++]=u>>>24&255,r[i++]=c>>>0&255,r[i++]=c>>>8&255,r[i++]=c>>>16&255,r[i++]=c>>>24&255,r[i++]=h>>>0&255,r[i++]=h>>>8&255,r[i++]=h>>>16&255,r[i++]=h>>>24&255,r[i++]=p>>>0&255,r[i++]=p>>>8&255,r[i++]=p>>>16&255,r[i]=p>>>24&255}(t,e,r,n);case 9:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0;r[i++]=s>>>0&511,r[i++]=s>>>9&511,r[i++]=s>>>18&511,r[i++]=511&(s>>>27|(15&o)<<5),r[i++]=o>>>4&511,r[i++]=o>>>13&511,r[i++]=o>>>22&511,r[i++]=511&(o>>>31|(255&a)<<1),r[i++]=a>>>8&511,r[i++]=a>>>17&511,r[i++]=511&(a>>>26|(7&l)<<6),r[i++]=l>>>3&511,r[i++]=l>>>12&511,r[i++]=l>>>21&511,r[i++]=511&(l>>>30|(127&u)<<2),r[i++]=u>>>7&511,r[i++]=u>>>16&511,r[i++]=511&(u>>>25|(3&c)<<7),r[i++]=c>>>2&511,r[i++]=c>>>11&511,r[i++]=c>>>20&511,r[i++]=511&(c>>>29|(63&h)<<3),r[i++]=h>>>6&511,r[i++]=h>>>15&511,r[i++]=511&(h>>>24|(1&p)<<8),r[i++]=p>>>1&511,r[i++]=p>>>10&511,r[i++]=p>>>19&511,r[i++]=511&(p>>>28|(31&f)<<4),r[i++]=f>>>5&511,r[i++]=f>>>14&511,r[i]=f>>>23&511}(t,e,r,n);case 10:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0;r[i++]=s>>>0&1023,r[i++]=s>>>10&1023,r[i++]=s>>>20&1023,r[i++]=1023&(s>>>30|(255&o)<<2),r[i++]=o>>>8&1023,r[i++]=o>>>18&1023,r[i++]=1023&(o>>>28|(63&a)<<4),r[i++]=a>>>6&1023,r[i++]=a>>>16&1023,r[i++]=1023&(a>>>26|(15&l)<<6),r[i++]=l>>>4&1023,r[i++]=l>>>14&1023,r[i++]=1023&(l>>>24|(3&u)<<8),r[i++]=u>>>2&1023,r[i++]=u>>>12&1023,r[i++]=u>>>22&1023,r[i++]=c>>>0&1023,r[i++]=c>>>10&1023,r[i++]=c>>>20&1023,r[i++]=1023&(c>>>30|(255&h)<<2),r[i++]=h>>>8&1023,r[i++]=h>>>18&1023,r[i++]=1023&(h>>>28|(63&p)<<4),r[i++]=p>>>6&1023,r[i++]=p>>>16&1023,r[i++]=1023&(p>>>26|(15&f)<<6),r[i++]=f>>>4&1023,r[i++]=f>>>14&1023,r[i++]=1023&(f>>>24|(3&d)<<8),r[i++]=d>>>2&1023,r[i++]=d>>>12&1023,r[i]=d>>>22&1023}(t,e,r,n);case 11:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0;r[i++]=s>>>0&2047,r[i++]=s>>>11&2047,r[i++]=2047&(s>>>22|(1&o)<<10),r[i++]=o>>>1&2047,r[i++]=o>>>12&2047,r[i++]=2047&(o>>>23|(3&a)<<9),r[i++]=a>>>2&2047,r[i++]=a>>>13&2047,r[i++]=2047&(a>>>24|(7&l)<<8),r[i++]=l>>>3&2047,r[i++]=l>>>14&2047,r[i++]=2047&(l>>>25|(15&u)<<7),r[i++]=u>>>4&2047,r[i++]=u>>>15&2047,r[i++]=2047&(u>>>26|(31&c)<<6),r[i++]=c>>>5&2047,r[i++]=c>>>16&2047,r[i++]=2047&(c>>>27|(63&h)<<5),r[i++]=h>>>6&2047,r[i++]=h>>>17&2047,r[i++]=2047&(h>>>28|(127&p)<<4),r[i++]=p>>>7&2047,r[i++]=p>>>18&2047,r[i++]=2047&(p>>>29|(255&f)<<3),r[i++]=f>>>8&2047,r[i++]=f>>>19&2047,r[i++]=2047&(f>>>30|(511&d)<<2),r[i++]=d>>>9&2047,r[i++]=d>>>20&2047,r[i++]=2047&(d>>>31|(1023&y)<<1),r[i++]=y>>>10&2047,r[i]=y>>>21&2047}(t,e,r,n);case 12:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0;r[i++]=s>>>0&4095,r[i++]=s>>>12&4095,r[i++]=4095&(s>>>24|(15&o)<<8),r[i++]=o>>>4&4095,r[i++]=o>>>16&4095,r[i++]=4095&(o>>>28|(255&a)<<4),r[i++]=a>>>8&4095,r[i++]=a>>>20&4095,r[i++]=l>>>0&4095,r[i++]=l>>>12&4095,r[i++]=4095&(l>>>24|(15&u)<<8),r[i++]=u>>>4&4095,r[i++]=u>>>16&4095,r[i++]=4095&(u>>>28|(255&c)<<4),r[i++]=c>>>8&4095,r[i++]=c>>>20&4095,r[i++]=h>>>0&4095,r[i++]=h>>>12&4095,r[i++]=4095&(h>>>24|(15&p)<<8),r[i++]=p>>>4&4095,r[i++]=p>>>16&4095,r[i++]=4095&(p>>>28|(255&f)<<4),r[i++]=f>>>8&4095,r[i++]=f>>>20&4095,r[i++]=d>>>0&4095,r[i++]=d>>>12&4095,r[i++]=4095&(d>>>24|(15&y)<<8),r[i++]=y>>>4&4095,r[i++]=y>>>16&4095,r[i++]=4095&(y>>>28|(255&m)<<4),r[i++]=m>>>8&4095,r[i]=m>>>20&4095}(t,e,r,n);case 16:return void function(t,e,r,n){let i=n;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0,g=t[e+12]>>>0,x=t[e+13]>>>0,v=t[e+14]>>>0,b=t[e+15]>>>0;r[i++]=s>>>0&65535,r[i++]=s>>>16&65535,r[i++]=o>>>0&65535,r[i++]=o>>>16&65535,r[i++]=a>>>0&65535,r[i++]=a>>>16&65535,r[i++]=l>>>0&65535,r[i++]=l>>>16&65535,r[i++]=u>>>0&65535,r[i++]=u>>>16&65535,r[i++]=c>>>0&65535,r[i++]=c>>>16&65535,r[i++]=h>>>0&65535,r[i++]=h>>>16&65535,r[i++]=p>>>0&65535,r[i++]=p>>>16&65535,r[i++]=f>>>0&65535,r[i++]=f>>>16&65535,r[i++]=d>>>0&65535,r[i++]=d>>>16&65535,r[i++]=y>>>0&65535,r[i++]=y>>>16&65535,r[i++]=m>>>0&65535,r[i++]=m>>>16&65535,r[i++]=g>>>0&65535,r[i++]=g>>>16&65535,r[i++]=x>>>0&65535,r[i++]=x>>>16&65535,r[i++]=v>>>0&65535,r[i++]=v>>>16&65535,r[i++]=b>>>0&65535,r[i]=b>>>16&65535}(t,e,r,n);case 32:for(let i=0;i<32;i=i+1|0)r[n+i|0]=0|t[e+i|0];return}const s=rp[i]>>>0;let o=e,a=0,l=t[o]>>>0;for(let e=0;e<32;e++)if(a+i<=32)r[n+e]=l>>>a&s,a+=i,32===a&&(a=0,o++,31!==e&&(l=t[o]>>>0));else{const u=32-a,c=l>>>a;o++,l=t[o]>>>0,r[n+e]=(c|(l&rp[i-u]>>>0)<<u)&s,a=i-u}}function dp(t,e,r){const n=new Uint32Array(r);let i=0,s=e.get();for(let e=0;e<n.length;e++){let e=t[s++],r=127&e;e<128||(e=t[s++],r|=(127&e)<<7,e<128||(e=t[s++],r|=(127&e)<<14,e<128||(e=t[s++],r|=(127&e)<<21,e<128||(e=t[s++],r|=(15&e)<<28)))),n[i++]=r}return e.set(s),n}function yp(t,e,r){const n=new BigUint64Array(r);for(let r=0;r<n.length;r++)n[r]=mp(t,e);return n}function mp(t,e){let r=0n,n=0,i=e.get();for(;i<t.length;){const e=t[i++];if(r|=BigInt(127&e)<<BigInt(n),!(128&e))break;if(n+=7,n>=64)throw new Error("Varint too long")}return e.set(i),r}function gp(t,e){let r,n;return n=t[e.get()],e.increment(),r=127&n,n<128?r:(n=t[e.get()],e.increment(),r|=(127&n)<<7,n<128?r:(n=t[e.get()],e.increment(),r|=(127&n)<<14,n<128?r:(n=t[e.get()],e.increment(),r|=(127&n)<<21,n<128?r:(n=t[e.get()],r|=(15&n)<<28,function(t,e,r){let n,i;if(i=e[r.get()],r.increment(),n=(112&i)>>4,i<128)return 4294967296*n+(t>>>0);if(i=e[r.get()],r.increment(),n|=(127&i)<<3,i<128)return 4294967296*n+(t>>>0);if(i=e[r.get()],r.increment(),n|=(127&i)<<10,i<128)return 4294967296*n+(t>>>0);if(i=e[r.get()],r.increment(),n|=(127&i)<<17,i<128)return 4294967296*n+(t>>>0);if(i=e[r.get()],r.increment(),n|=(127&i)<<24,i<128)return 4294967296*n+(t>>>0);if(i=e[r.get()],r.increment(),n|=(1&i)<<31,i<128)return 4294967296*n+(t>>>0);throw new Error("Expected varint not more than 10 bytes")}(r,t,e)))))}function xp(t){return t>>>1^-(1&t)}function vp(t){return t>>1n^-(1n&t)}function bp(t){return t%2==1?(t+1)/-2:t/2}function wp(t,e,r){if(void 0===r){r=0;for(let n=0;n<e;n++)r+=t[n]}const n=new Uint32Array(r);let i=0;for(let r=0;r<e;r++){const s=t[r];n.fill(t[r+e],i,i+s),i+=s}return n}function _p(t,e,r){if(void 0===r){r=0;for(let n=0;n<e;n++)r+=Number(t[n])}const n=new BigUint64Array(r);let i=0;for(let r=0;r<e;r++){const s=Number(t[r]);n.fill(t[r+e],i,i+s),i+=s}return n}function Sp(t,e,r){const n=new Float64Array(r);let i=0;for(let r=0;r<e;r++){const s=t[r];n.fill(t[r+e],i,i+s),i+=s}return n}function Ap(t){const e=new Int32Array(t.length);e[0]=xp(t[0]);const r=t.length/4*4;let n=1;if(r>=4)for(;n<r-4;n+=4){const r=t[n+1],i=t[n+2],s=t[n+3];e[n]=xp(t[n])+e[n-1],e[n+1]=xp(r)+e[n],e[n+2]=xp(i)+e[n+1],e[n+3]=xp(s)+e[n+2]}for(;n!==t.length;++n)e[n]=xp(t[n])+e[n-1];return e}function Ip(t){const e=new BigInt64Array(t.length);e[0]=vp(t[0]);const r=t.length/4*4;let n=1;if(r>=4)for(;n<r-4;n+=4){const r=t[n+1],i=t[n+2],s=t[n+3];e[n]=vp(t[n])+e[n-1],e[n+1]=vp(r)+e[n],e[n+2]=vp(i)+e[n+1],e[n+3]=vp(s)+e[n+2]}for(;n!==e.length;++n)e[n]=vp(t[n])+e[n-1];return e}function kp(t){const e=t.length/4*4;let r=1;if(e>=4)for(let n=t[0];r<e-4;r+=4)n=t[r]+=n,n=t[r+1]+=n,n=t[r+2]+=n,n=t[r+3]+=n;for(;r!==t.length;)t[r]+=t[r-1],++r}var Tp,Ep,Mp,Pp,Dp,Fp,zp,Bp;function Cp(t,e){const r=function(t,e){const r=t[e.get()],n=Object.values(Tp)[r>>4];let i=null;switch(n){case Tp.DATA:i={dictionaryType:Object.values(Ep)[15&r]};break;case Tp.OFFSET:i={offsetType:Object.values(Mp)[15&r]};break;case Tp.LENGTH:i={lengthType:Object.values(Pp)[15&r]}}e.increment();const s=t[e.get()],o=Object.values(Oh)[s>>5],a=Object.values(Oh)[s>>2&7],l=Object.values($h)[3&s];e.increment();const u=dp(t,e,2),c=u[0];return{physicalStreamType:n,logicalStreamType:i,logicalLevelTechnique1:o,logicalLevelTechnique2:a,physicalLevelTechnique:l,numValues:c,byteLength:u[1],decompressedCount:c}}(t,e);return r.logicalLevelTechnique1===Oh.MORTON?function(t,e,r){const n=dp(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:n[0],coordinateShift:n[1]}}(r,t,e):Oh.RLE!==r.logicalLevelTechnique1&&Oh.RLE!==r.logicalLevelTechnique2||$h.NONE===r.physicalLevelTechnique?r:function(t,e,r){const n=dp(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:n[1],runs:n[0],numRleValues:n[1]}}(r,t,e)}!function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH"}(Tp||(Tp={})),function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST"}(Ep||(Ep={})),function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY"}(Mp||(Mp={})),function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY"}(Pp||(Pp={})),function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(Dp||(Dp={}));class Vp{constructor(t,e){this.values=t,this._size=e}get(t){const e=Math.floor(t/8);return 1==(this.values[e]>>t%8&1)}set(t,e){const r=Math.floor(t/8);this.values[r]=this.values[r]|(e?1:0)<<t%8}getInt(t){const e=Math.floor(t/8);return this.values[e]>>t%8&1}size(){return this._size}getBuffer(){return this.values}}function Lp(t,e,r){if(!e)return t;const n=e.size(),i=new(0,t.constructor)(n);let s=0;for(let o=0;o<n;o++)i[o]=e.get(o)?t[s++]:r;return i}function Op(t,e,r,n,i){return function(t,e,r,n){let i;switch(e.logicalLevelTechnique1){case Oh.DELTA:if(e.logicalLevelTechnique2===Oh.RLE){const r=e;if(!n)return function(t,e,r){const n=new Int32Array(r);let i=0,s=0;for(let r=0;r<e;r++){const o=t[r],a=xp(t[r+e]);for(let t=0;t<o;t++)s+=a,n[i++]=s}return n}(t,r.runs,r.numRleValues);i=Ap(t=wp(t,r.runs,r.numRleValues))}else i=Ap(t);break;case Oh.RLE:i=function(t,e,r){if(void 0===r){r=0;for(let n=0;n<e;n++)r+=t[n]}const n=new Int32Array(r);let i=0;for(let r=0;r<e;r++){const s=t[r];let o=t[r+e];o=xp(o),n.fill(o,i,i+s),i+=s}return n}(t,e.runs,e.numRleValues);break;case Oh.MORTON:kp(t),i=new Int32Array(t);break;case Oh.COMPONENTWISE_DELTA:i=function(t){if(t.length<2)return new Int32Array(t);const e=new Int32Array(t.length);e[0]=xp(t[0]),e[1]=xp(t[1]);const r=t.length/4*4;let n=2;if(r>=4)for(;n<r-4;n+=4){const r=t[n+1],i=t[n+2],s=t[n+3];e[n]=xp(t[n])+e[n-2],e[n+1]=xp(r)+e[n-1],e[n+2]=xp(i)+e[n],e[n+3]=xp(s)+e[n+1]}for(;n!==t.length;n+=2)e[n]=xp(t[n])+e[n-2],e[n+1]=xp(t[n+1])+e[n-1];return e}(t);break;case Oh.NONE:i=function(t){const e=new Int32Array(t.length);for(let r=0;r<t.length;r++)e[r]=xp(t[r]);return e}(t);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return n?Lp(i,n,0):i}(Np(t,e,r),r,0,i)}function $p(t,e,r,n,i){return function(t,e,r,n){let i;switch(e.logicalLevelTechnique1){case Oh.DELTA:i=function(t){const e=new Uint32Array(t.length);e[0]=xp(t[0])>>>0;for(let r=1;r<t.length;r++)e[r]=e[r-1]+xp(t[r])>>>0;return e}(e.logicalLevelTechnique2===Oh.RLE?wp(t,e.runs,e.numRleValues):t);break;case Oh.RLE:i=wp(t,e.runs,e.numRleValues);break;case Oh.MORTON:kp(t),i=t;break;case Oh.COMPONENTWISE_DELTA:i=function(t){if(t.length<2)return new Uint32Array(t);const e=new Uint32Array(t.length);e[0]=xp(t[0])>>>0,e[1]=xp(t[1])>>>0;for(let r=2;r<t.length;r+=2)e[r]=e[r-2]+xp(t[r])>>>0,e[r+1]=e[r-1]+xp(t[r+1])>>>0;return e}(t);break;case Oh.NONE:i=t;break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return n?Lp(i,n,0):i}(Np(t,e,r),r,0,i)}function Rp(t,e,r){return function(t,e){if(e.logicalLevelTechnique1===Oh.DELTA&&e.logicalLevelTechnique2===Oh.NONE)return function(t){const e=new Int32Array(t.length+1);e[0]=0,e[1]=xp(t[0]);let r=e[1];for(let n=2;n!==e.length;++n)r+=xp(t[n-1]),e[n]=e[n-1]+r;return new Uint32Array(e)}(t);if(e.logicalLevelTechnique1===Oh.RLE&&e.logicalLevelTechnique2===Oh.NONE)return function(t,e,r){const n=new Uint32Array(r+1);n[0]=0;let i=1,s=n[0];for(let r=0;r<e;r++){const o=t[r],a=t[r+e];for(let t=i;t<i+o;t++)n[t]=a+s,s=n[t];i+=o}return n}(t,e.runs,e.numRleValues);if(e.logicalLevelTechnique1===Oh.NONE&&e.logicalLevelTechnique2===Oh.NONE){!function(t){let e=0;for(let r=0;r<t.length;r++)t[r]+=e,e=t[r]}(t);const r=new Uint32Array(e.numValues+1);return r[0]=0,r.set(t,1),r}if(e.logicalLevelTechnique1===Oh.DELTA&&e.logicalLevelTechnique2===Oh.RLE){const r=function(t,e,r){const n=new Int32Array(r+1);n[0]=0;let i=1,s=n[0];for(let r=0;r<e;r++){const o=t[r];let a=t[r+e];a=xp(a);for(let t=i;t<i+o;t++)n[t]=a+s,s=n[t];i+=o}return n}(t,e.runs,e.numRleValues);return kp(r),new Uint32Array(r)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}(Np(t,e,r),r)}function Np(t,e,r){const n=r.physicalLevelTechnique;switch(n){case $h.FAST_PFOR:return function(t,e,r,n){return function(t,e,r,n,i){const s=n.get();if(3&r)throw new Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${s} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);const o=r>>>2,a=function(t,e){if(e<=t.encodedWords.length)return t.encodedWords;const r=new Uint32Array(Math.max(16,2*e));return t.encodedWords=r,r}(i,o);!function(t,e,r,n){if(e<0||r<0||e+r>t.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${r}, bytes.length=${t.length})`);const i=Math.floor(r/4),s=r%4!=0,o=s?i+1:i;if(n.length<o)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${n.length} < ${o}`);if(i>0){const r=t.byteOffset+e;if(3&r)for(let r=0;r<i;r++){const i=e+4*r;n[r]=t[i]<<24|t[i+1]<<16|t[i+2]<<8|t[i+3]}else{const e=new Uint32Array(t.buffer,r,i);for(let t=0;t<i;t++)n[t]=0|sp(e[t])}}if(s){const s=e+4*i,o=r-4*i;let a=0;for(let e=0;e<o;e++)a|=t[s+e]<<24-8*e;n[i]=0|a}}(t,s,r,a);const l=function(t,e,r){let n=0,i=0;const s=new Uint32Array(e),o=r??lp();if(t.length>0){const e=0|t[n];if(n=n+1|0,255&e)throw new Error(`FastPFOR decode: invalid alignedLength=${e} (expected multiple of 256)`);if(i+e>s.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${i}, alignedLength=${e}, out.length=${s.length})`);n=function(t,e,r,n,i,s){const o=n+ip(i,np);let a=n,l=r;for(;a!==o;){const r=Math.min(op,o-a);l=pp(t,e,l,a,r,s),a=a+r|0}return l}(t,s,n,i,e,o),i=i+e|0}return function(t,e,r,n,i,s){if(0===s)return e;let o=0,a=e;const l=e+r,u=i;let c=i;const h=i+s;let p=0,f=0;for(;a<l&&c<h;){const e=t[a]>>>o&255;if(o+=8,a+=o>>>5,o&=31,p|=(127&e)<<f,128&e)n[c++]=0|p,p=0,f=0;else if(f+=7,f>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${c-u}/${s}, inPos=${a}, inEnd=${l})`)}if(c!==h)throw new Error(`FastPFOR VByte: truncated stream (decoded=${c-u}, expected=${s}, consumedWords=${a-e}/${r}, vbyteStart=${e}, vbyteEnd=${l})`)}(t,n,t.length-n|0,s,i,e-i|0),s}(a.subarray(0,o),e,i.decoderWorkspace);return n.add(r),l}(t,e,r,n,function(t=16){if(t<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);const e=Math.max(16,0|t);return{encodedWords:new Uint32Array(e),decoderWorkspace:lp()}}(r>>>2))}(t,r.numValues,r.byteLength,e);case $h.VARINT:return dp(t,e,r.numValues);case $h.NONE:{const n=e.get();e.add(r.byteLength);const i=t.subarray(n,e.get());return new Uint32Array(i)}default:throw new Error(`Specified physicalLevelTechnique ${n} is not supported (yet).`)}}function Up(t,e,r){const n=Np(t,e,r);return 1===n.length?n[0]:function(t){return t[1]}(n)}function qp(t,e,r){return function(t){if(2===t.length){const e=xp(t[1]);return[e,e]}return[xp(t[2]),xp(t[3])]}(Np(t,e,r))}function jp(t,e,r){return function(t){if(2===t.length){const e=vp(t[1]);return[e,e]}return[vp(t[2]),vp(t[3])]}(yp(t,e,r.numValues))}function Gp(t,e,r,n){return function(t,e,r){let n;switch(e.logicalLevelTechnique1){case Oh.DELTA:n=function(t){const e=new BigUint64Array(t.length);e[0]=BigInt.asUintN(64,vp(t[0]));for(let r=1;r<t.length;r++)e[r]=BigInt.asUintN(64,e[r-1]+vp(t[r]));return e}(e.logicalLevelTechnique2===Oh.RLE?_p(t,e.runs,e.numRleValues):t);break;case Oh.RLE:n=_p(t,e.runs,e.numRleValues);break;case Oh.NONE:n=t;break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Lp(n,r,0n):n}(yp(t,e,r.numValues),r,n)}function Xp(t,e,r){const n=yp(t,e,r.numValues);return 1===n.length?n[0]:function(t){return t[1]}(n)}function Yp(t,e,r,n,i="int32"){const s=t.logicalLevelTechnique1;if(s===Oh.RLE)return 1===t.runs?Dp.CONST:Dp.FLAT;if(s!==Oh.DELTA||t.logicalLevelTechnique2!==Oh.RLE)return 1===t.numValues?Dp.CONST:Dp.FLAT;const o=e instanceof Vp?e.size():e;if(t.numRleValues!==o)return Dp.FLAT;if(1===t.runs)return Dp.SEQUENCE;if(2!==t.runs)return 1===t.numValues?Dp.CONST:Dp.FLAT;const a=n.get();if(t.physicalLevelTechnique===$h.VARINT)return function(t,e,r){const n=new tp(e.get());if("int64"===r){const e=yp(t,n,4);return 2n===e[2]&&2n===e[3]}const i=dp(t,n,4);return 2===i[2]&&2===i[3]}(r,n,i)?Dp.SEQUENCE:1===t.numValues?Dp.CONST:Dp.FLAT;const l=n.get(),u=new Int32Array(r.buffer,r.byteOffset+l,4);return n.set(a),2===u[2]&&2===u[3]?Dp.SEQUENCE:1===t.numValues?Dp.CONST:Dp.FLAT}class Zp extends Yh{getValueFromBuffer(t){return this.dataBuffer[t]}}class Wp extends Hh{constructor(t,e,r,n){super(t,BigInt64Array.of(e),r,n)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}}function Hp(t,e,r){return{x:Jp(t,e)-r,y:Jp(t>>1,e)-r}}function Jp(t,e){let r=0;for(let n=0;n<e;n++)r|=(t&1<<2*n)>>n;return r}function Kp(t,r,n,i,s,o,a){return t===Bp.MORTON?function(t,r,n,i,s,o){const a=new Array(s?i+1:i);for(let s=0;s<i;s++){const i=Hp(t[r[n+s]],o.numBits,o.coordinateShift);a[s]=new e(i.x,i.y)}return s&&(a[a.length-1]=a[0]),a}(r,n,i,s,o,a):function(t,r,n,i,s){const o=new Array(s?i+1:i);for(let s=0;s<2*i;s+=2){const i=2*r[n+s/2];o[s/2]=new e(t[i],t[i+1])}return s&&(o[o.length-1]=o[0]),o}(r,n,i,s,o)}function Qp(t,r,n,i){const s=new Array(i?n+1:n);for(let i=0;i<2*n;i+=2)s[i/2]=new e(t[r+i],t[r+i+1]);return i&&(s[s.length-1]=s[0]),s}!function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON"}(Fp||(Fp={})),function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON"}(zp||(zp={})),function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3"}(Bp||(Bp={}));class tf{constructor(t,e,r,n,i){this._vertexBufferType=t,this._topologyVector=e,this._vertexOffsets=r,this._vertexBuffer=n,this._mortonSettings=i}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(t){const e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){const e=Hp(this.vertexBuffer[this.vertexOffsets[t]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[e.x,e.y]}const e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getGeometries(){return function(t){const r=new Array(t.numGeometries);let n=1,i=1,s=1,o=0,a=0,l=0;const u=t.mortonSettings,c=t.topologyVector,h=c.geometryOffsets,p=c.partOffsets,f=c.ringOffsets,d=t.vertexOffsets,y=!d||0===d.length,m=t.containsPolygonGeometry(),g=t.vertexBuffer;for(let c=0;c<t.numGeometries;c++)switch(t.geometryType(c)){case Fp.POINT:{let c,m;if(y)c=g[a++],m=g[a++];else if(t.vertexBufferType===Bp.MORTON){const t=Hp(g[d[l++]],u.numBits,u.coordinateShift);c=t.x,m=t.y}else{const t=2*d[l++];c=g[t],m=g[t+1]}r[o++]=[[new e(c,m)]],h&&s++,p&&n++,f&&i++}break;case Fp.MULTIPOINT:{const t=h[s]-h[s-1];s++;const u=new Array(t);if(y)for(let r=0;r<t;r++){const t=g[a++],n=g[a++];u[r]=new e(t,n)}else for(let r=0;r<t;r++){const t=2*d[l++];u[r]=new e(g[t],g[t+1])}r[o++]=u.map((t=>[t])),n+=t,i+=t}break;case Fp.LINESTRING:{let e,c;m?(e=f[i]-f[i-1],i++):e=p[n]-p[n-1],n++,y?(c=Qp(g,a,e,!1),a+=2*e):(c=Kp(t.vertexBufferType,g,d,l,e,!1,u),l+=e),r[o++]=[c],h&&s++}break;case Fp.POLYGON:{const e=p[n]-p[n-1];n++;const c=new Array(e-1);let m,x=f[i]-f[i-1];if(i++,y){m=Qp(g,a,x,!0),a+=2*x;for(let t=0;t<c.length;t++)x=f[i]-f[i-1],i++,c[t]=Qp(g,a,x,!0),a+=2*x}else{m=Kp(t.vertexBufferType,g,d,l,x,!0,u),l+=x;for(let e=0;e<c.length;e++)x=f[i]-f[i-1],i++,c[e]=Kp(t.vertexBufferType,g,d,l,x,!0,u),l+=x}r[o++]=[m].concat(c),h&&s++}break;case Fp.MULTILINESTRING:{const e=h[s]-h[s-1];s++;const c=new Array(e);for(let r=0;r<e;r++){let e;if(m?(e=f[i]-f[i-1],i++):e=p[n]-p[n-1],n++,y)c[r]=Qp(g,a,e,!1),a+=2*e;else{const n=Kp(t.vertexBufferType,g,d,l,e,!1,u);c[r]=n,l+=e}}r[o++]=c}break;case Fp.MULTIPOLYGON:{const e=h[s]-h[s-1];s++;const c=new Array(e);for(let r=0;r<e;r++){const e=p[n]-p[n-1];let s;n++;const o=new Array(e-1),h=f[i]-f[i-1];i++,y?(s=Qp(g,a,h,!0),a+=2*h):(s=Kp(t.vertexBufferType,g,d,l,h,!0,u),l+=h);for(let e=0;e<o.length;e++){const r=f[i]-f[i-1];i++,y?(o[e]=Qp(g,a,r,!0),a+=2*r):(o[e]=Kp(t.vertexBufferType,g,d,l,r,!0,u),l+=r)}c[r]=[s].concat(o)}r[o++]=c.flat()}break;default:throw new Error("The specified geometry type is currently not supported.")}return r}(this)}get mortonSettings(){return this._mortonSettings}}class ef extends tf{constructor(t,e,r,n,i,s,o){super(r,n,i,s,o),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Fp.POLYGON||this._geometryType===Fp.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class rf extends tf{constructor(t,e,r,n,i,s){super(t,r,n,i,s),this._geometryTypes=e}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===Fp.POLYGON||this.geometryType(t)===Fp.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class nf{constructor(t,e,r,n){this._triangleOffsets=t,this._indexBuffer=e,this._vertexBuffer=r,this._topologyVector=n}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const t=new Array(this.numGeometries),r=this._topologyVector,n=r.partOffsets,i=r.ringOffsets,s=r.geometryOffsets;let o=0,a=1,l=1,u=1;for(let r=0;r<this.numGeometries;r++)switch(this.geometryType(r)){case Fp.POLYGON:{const c=n[a]-n[a-1];a++;const h=[];for(let t=0;t<c;t++){const t=i[l]-i[l-1];l++;const r=[];for(let n=0;n<t;n++){const t=this._vertexBuffer[o++],n=this._vertexBuffer[o++];r.push(new e(t,n))}r.length>0&&r.push(r[0]),h.push(r)}t[r]=h,s&&u++}break;case Fp.MULTIPOLYGON:{const c=s[u]-s[u-1];u++;const h=[];for(let t=0;t<c;t++){const t=n[a]-n[a-1];a++;for(let r=0;r<t;r++){const t=i[l]-i[l-1];l++;const r=[];for(let n=0;n<t;n++){const t=this._vertexBuffer[o++],n=this._vertexBuffer[o++];r.push(new e(t,n))}r.length>0&&r.push(r[0]),h.push(r)}}t[r]=h}}return t}[Symbol.iterator](){return null}}function sf(t,e,r,n,i,s){return new of(t,e,r,n,i,s)}class of extends nf{constructor(t,e,r,n,i,s){super(r,n,i,s),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function af(t,e,r,n,i){return new lf(t,e,r,n,i)}class lf extends nf{constructor(t,e,r,n,i){super(e,r,n,i),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function uf(t,e,r,n,i){const s=Cp(t,r);let o,a,l,u;if(Yp(s,n,t,r)===Dp.CONST){const i=Up(t,r,s);let c,h,p,f;for(let n=0;n<e-1;n++){const e=Cp(t,r);switch(e.physicalStreamType){case Tp.LENGTH:switch(e.logicalStreamType.lengthType){case Pp.GEOMETRIES:c=Rp(t,r,e);break;case Pp.PARTS:h=Rp(t,r,e);break;case Pp.RINGS:p=Rp(t,r,e);break;case Pp.TRIANGLES:f=Rp(t,r,e)}break;case Tp.OFFSET:switch(e.logicalStreamType.offsetType){case Mp.VERTEX:o=$p(t,r,e);break;case Mp.INDEX:u=$p(t,r,e)}break;case Tp.DATA:Ep.VERTEX===e.logicalStreamType.dictionaryType?a=Op(t,r,e):(l={numBits:e.numBits,coordinateShift:e.coordinateShift},a=$p(t,r,e))}}return u?void 0!==c||void 0!==h?sf(n,i,f,u,a,{geometryOffsets:c,partOffsets:h,ringOffsets:p}):sf(n,i,f,u,a):void 0===l?function(t,e,r,n,i){return new ef(t,e,Bp.VEC_2,r,n,i)}(n,i,{geometryOffsets:c,partOffsets:h,ringOffsets:p},o,a):function(t,e,r,n,i,s){return new ef(t,e,Bp.MORTON,r,n,i,s)}(n,i,{geometryOffsets:c,partOffsets:h,ringOffsets:p},o,a,l)}const c=$p(t,r,s);let h,p,f,d,y,m,g;for(let n=0;n<e-1;n++){const e=Cp(t,r);switch(e.physicalStreamType){case Tp.LENGTH:switch(e.logicalStreamType.lengthType){case Pp.GEOMETRIES:h=$p(t,r,e);break;case Pp.PARTS:p=$p(t,r,e);break;case Pp.RINGS:f=$p(t,r,e);break;case Pp.TRIANGLES:d=Rp(t,r,e)}break;case Tp.OFFSET:switch(e.logicalStreamType.offsetType){case Mp.VERTEX:o=$p(t,r,e);break;case Mp.INDEX:u=$p(t,r,e)}break;case Tp.DATA:Ep.VERTEX===e.logicalStreamType.dictionaryType?a=Op(t,r,e):(l={numBits:e.numBits,coordinateShift:e.coordinateShift},a=$p(t,r,e))}}return h?(y=cf(c,h,2),p&&f?(m=hf(c,y,p,!1),g=function(t,e,r,n){const i=new Uint32Array(r[r.length-1]+1);let s=0;i[0]=s;let o=1,a=1,l=0;for(let u=0;u<t.length;u++){const c=t[u],h=e[u+1]-e[u];if(0!==c&&3!==c)for(let t=0;t<h;t++){const t=r[o]-r[o-1];o++;for(let e=0;e<t;e++)s=i[a++]=s+n[l++]}else for(let t=0;t<h;t++)i[a++]=++s,o++}return i}(c,y,m,f)):p&&(m=function(t,e,r){const n=new Uint32Array(e[e.length-1]+1);let i=0;n[0]=i;let s=1,o=0;for(let a=0;a<t.length;a++){const l=t[a],u=e[a+1]-e[a];if(4===l||1===l)for(let t=0;t<u;t++)i=n[s++]=i+r[o++];else for(let t=0;t<u;t++)n[s++]=++i}return n}(c,y,p))):p&&f?(m=cf(c,p,1),g=hf(c,m,f,!0)):p&&(m=cf(c,p,0)),u&&!m?af(c,d,u,a):u?af(c,d,u,a,{geometryOffsets:y,partOffsets:m,ringOffsets:g}):void 0===l?function(t,e,r,n){return new rf(Bp.VEC_2,t,e,r,n)}(c,{geometryOffsets:y,partOffsets:m,ringOffsets:g},o,a):function(t,e,r,n,i){return new rf(Bp.MORTON,t,e,r,n,i)}(c,{geometryOffsets:y,partOffsets:m,ringOffsets:g},o,a,l)}function cf(t,e,r){const n=new Uint32Array(t.length+1);let i=0;n[0]=i;let s=0;for(let o=0;o<t.length;o++)i=n[o+1]=i+(t[o]>r?e[s++]:1);return n}function hf(t,e,r,n){const i=new Uint32Array(e[e.length-1]+1);let s=0;i[0]=s;let o=1,a=0;for(let l=0;l<t.length;l++){const u=t[l],c=e[l+1]-e[l];if(5===u||2===u||n&&(4===u||1===u))for(let t=0;t<c;t++)s=i[o++]=s+r[a++];else for(let t=0;t<c;t++)i[o++]=++s}return i}class pf extends Xh{constructor(t,e,r){super(t,e.getBuffer(),r),this.dataVector=e}getValueFromBuffer(t){return this.dataVector.get(t)}}class ff extends Yh{getValueFromBuffer(t){return this.dataBuffer[t]}}class df extends Xh{constructor(t,e,r,n){super(t,n?BigInt64Array.of(e):BigUint64Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}}function yf(t,e,r,n,i){const s=function(t,e,r,n){const i=new Uint8Array(e);let s=0;const o=n.get()+r;for(;s<e&&!(n.get()>=o);){const r=t[n.increment()];if(r<=127){const o=r+3,a=t[n.increment()],l=Math.min(s+o,e);i.fill(a,s,l),s=l}else{const o=256-r;for(let r=0;r<o&&s<e;r++)i[s++]=t[n.increment()]}}return n.set(o),i}(t,Math.ceil(e/8),r,n);return i?function(t,e,r){if(!r)return t;const n=r.size(),i=new Vp(t,e),s=new Vp(new Uint8Array(Math.ceil(n/8)),n);let o=0;for(let t=0;t<n;t++){const e=!!r.get(t)&&i.get(o++);s.set(t,e)}return s.getBuffer()}(s,e,i):s}const mf=new TextDecoder;function gf(t,e,r){return r-e>=12?mf.decode(t.subarray(e,r)):function(t,e,r){let n="",i=e;for(;i<r;){const e=t[i];let s,o,a,l=null,u=e>239?4:e>223?3:e>191?2:1;if(i+u>r)break;1===u?e<128&&(l=e):2===u?(s=t[i+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===u?(s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=u}return n}(t,e,r)}class xf extends Xh{constructor(t,e,r,n){super(t,r,n),this.offsetBuffer=e}}class vf extends xf{constructor(t,e,r,n){super(t,e,r,n??e.length-1)}getValueFromBuffer(t){return gf(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class bf extends xf{constructor(t,e,r,n,i){super(t,r,n,i??e.length),this.indexBuffer=e,this.indexBuffer=e}getValueFromBuffer(t){const e=this.indexBuffer[t];return gf(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class wf extends xf{constructor(t,e,r,n,i,s,o){super(t,r,n,o),this.indexBuffer=e,this.symbolOffsetBuffer=i,this.symbolTableBuffer=s}getValueFromBuffer(t){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=function(t,e,r){const n=[],i=new Array(e.length).fill(0);for(let t=1;t<e.length;t++)i[t]=i[t-1]+e[t-1];for(let s=0;s<r.length;s++)if(255===r[s])n.push(r[++s]);else{const o=e[r[s]],a=i[r[s]];for(let e=0;e<o;e++)n.push(t[a+e])}return new Uint8Array(n)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const e=this.indexBuffer[t];return gf(this.decodedDictionary,this.offsetBuffer[e],this.offsetBuffer[e+1])}offsetToLengthBuffer(t){const e=new Uint32Array(t.length-1);let r=t[0];for(let n=1;n<t.length;n++){const i=t[n];e[n-1]=i-r,r=i}return e}}function _f(t,e,r,n,i,s){return"scalarType"===r.type?function(t,e,r,n,i,s){let o=null;if(0===t)return null;if(s.nullable){const t=Cp(e,r),n=t.numValues,i=r.get(),s=yf(e,n,t.byteLength,r);r.set(i+t.byteLength),o=new Vp(s,t.numValues)}const a=o??n;switch(i.physicalType){case 4:case 3:return function(t,e,r,n,i){const s=Cp(t,e),o=Yp(s,i,t,e),a=3===n.physicalType;if(o===Dp.FLAT){const n=Sf(i)?i:void 0,o=a?Op(t,e,s,0,n):$p(t,e,s,0,n);return new Zh(r.name,o,i)}if(o===Dp.SEQUENCE){const n=qp(t,e,s);return new Jh(r.name,n[0],n[1],s.numRleValues)}const l=a?function(t,e,r){const n=Np(t,e,r);return 1===n.length?xp(n[0]):function(t){return xp(t[1])}(n)}(t,e,s):Up(t,e,s);return new Kh(r.name,l,i,a)}(e,r,s,i,a);case 9:return function(t,e,r,n,i){let s=null,o=null,a=null,l=null,u=null,c=i??null,h=null,p=null;for(let t=0;t<n;t++){const t=Cp(e,r);switch(t.physicalStreamType){case Tp.PRESENT:{const n=yf(e,t.numValues,t.byteLength,r),s=new Vp(n,t.numValues);c=i??s;break}case Tp.OFFSET:o=$p(e,r,t,0,c);break;case Tp.LENGTH:{const n=Rp(e,r,t);Pp.DICTIONARY===t.logicalStreamType.lengthType?s=n:Pp.SYMBOL===t.logicalStreamType.lengthType?l=n:h=n;break}case Tp.DATA:{const n=e.subarray(r.get(),r.get()+t.byteLength);r.add(t.byteLength);const i=t.logicalStreamType.dictionaryType;Ep.FSST===i?u=n:Ep.SINGLE===i||Ep.SHARED===i?a=n:Ep.NONE===i&&(p=n);break}}}return function(t,e,r,n,i,s,o){return e?new wf(t,r,n,i,s,e,o):null}(t,u,o,s,a,l,c)??function(t,e,r,n,i){return e?i?new bf(t,r,n,e,i):new bf(t,r,n,e):null}(t,a,o,s,c)??function(t,e,r,n,i){if(!e||!r)return null;if(n)return i?new bf(t,n,e,r,i):new bf(t,n,e,r);if(i&&i.size()!==e.length-1){const n=new Uint32Array(i.size());let s=0;for(let t=0;t<i.size();t++)n[t]=i.get(t)?s++:0;return new bf(t,n,e,r,i)}return i?new vf(t,e,r,i):new vf(t,e,r)}(t,h,p,o,c)}(s.name,e,r,s.nullable?t-1:t,o);case 0:return function(t,e,r,n,i){const s=Cp(t,e),o=s.numValues,a=e.get(),l=Sf(i)?i:void 0,u=yf(t,o,s.byteLength,e,l);e.set(a+s.byteLength);const c=new Vp(u,o);return new pf(r.name,c,i)}(e,r,s,0,a);case 6:case 5:return function(t,e,r,n,i){const s=Cp(t,e),o=Yp(s,n,t,e,"int64"),a=5===i.physicalType;if(o===Dp.FLAT){const i=Sf(n)?n:void 0,o=a?function(t,e,r,n){return function(t,e,r){let n;switch(e.logicalLevelTechnique1){case Oh.DELTA:if(e.logicalLevelTechnique2===Oh.RLE){const i=e;if(!r)return function(t,e,r){const n=new BigInt64Array(r);let i=0,s=0n;for(let r=0;r<e;r++){const o=Number(t[r]),a=vp(t[r+e]);for(let t=0;t<o;t++)s+=a,n[i++]=s}return n}(t,i.runs,i.numRleValues);n=Ip(t=_p(t,i.runs,i.numRleValues))}else n=Ip(t);break;case Oh.RLE:n=function(t,e,r){if(void 0===r){r=0;for(let n=0;n<e;n++)r+=Number(t[n])}const n=new BigInt64Array(r);let i=0;for(let r=0;r<e;r++){const s=Number(t[r]);let o=t[r+e];o=vp(o),n.fill(o,i,i+s),i+=s}return n}(t,e.runs,e.numRleValues);break;case Oh.NONE:n=function(t){const e=new BigInt64Array(t.length);for(let r=0;r<t.length;r++)e[r]=vp(t[r]);return e}(t);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Lp(n,r,0n):n}(yp(t,e,r.numValues),r,n)}(t,e,s,i):Gp(t,e,s,i);return new Zp(r.name,o,n)}if(o===Dp.SEQUENCE){const n=jp(t,e,s);return new Wp(r.name,n[0],n[1],s.numRleValues)}const l=a?function(t,e,r){const n=yp(t,e,r.numValues);return 1===n.length?vp(n[0]):function(t){return vp(t[1])}(n)}(t,e,s):Xp(t,e,s);return new df(r.name,l,n,a)}(e,r,s,a,i);case 7:return function(t,e,r,n){const i=Cp(t,e),s=Sf(n)?n:void 0,o=function(t,e,r,n){const i=e.get(),s=i+r*Float32Array.BYTES_PER_ELEMENT,o=new Uint8Array(t.subarray(i,s)).buffer,a=new Float32Array(o);return e.set(s),n?Lp(a,n,0):a}(t,e,i.numValues,s);return new ff(r.name,o,n)}(e,r,s,a);case 8:return function(t,e,r,n){const i=Cp(t,e),s=Sf(n)?n:void 0,o=function(t,e,r,n){const i=e.get(),s=i+r*Float64Array.BYTES_PER_ELEMENT,o=new Uint8Array(t.subarray(i,s)).buffer,a=new Float64Array(o);return e.set(s),n?Lp(a,n,0):a}(t,e,i.numValues,s);return new Wh(r.name,o,n)}(e,r,s,a);default:throw new Error(`The specified data type for the field is currently not supported: ${i}`)}}(n,t,e,i,r.scalarType,r):0===n?null:function(t,e,r,n){let i=null,s=null,o=null,a=null,l=!1;for(;!l;){const r=Cp(t,e);switch(r.physicalStreamType){case Tp.LENGTH:Pp.DICTIONARY===r.logicalStreamType.lengthType?i=Rp(t,e,r):o=Rp(t,e,r);break;case Tp.DATA:Ep.SINGLE===r.logicalStreamType.dictionaryType||Ep.SHARED===r.logicalStreamType.dictionaryType?(s=t.subarray(e.get(),e.get()+r.byteLength),l=!0):a=t.subarray(e.get(),e.get()+r.byteLength),e.add(r.byteLength)}}const u=r.complexType.children,c=[];let h=0;for(const l of u){const u=dp(t,e,1)[0];if(0===u)continue;const p=l.name?`${r.name}${l.name}`:r.name;if(2!==u||"scalarField"!==l.type||9!==l.scalarField.physicalType)throw new Error("Currently only optional string fields are implemented for a struct.");const f=Cp(t,e),d=yf(t,f.numValues,f.byteLength,e),y=Cp(t,e),m=$p(t,e,y,0,y.decompressedCount!==n?new Vp(d,f.numValues):void 0);c[h++]=a?new wf(p,m,i,s,o,a,new Vp(d,f.numValues)):new bf(p,m,i,s,new Vp(d,f.numValues))}return c}(t,e,r,i)}function Sf(t){return t instanceof Vp}function Af(t){switch(t){case 0:case 1:case 2:case 3:{const e={};e.nullable=!!(1&t),e.columnScope=0;const r={type:"logicalType",logicalType:0};return r.longID=!!(2&t),e.scalarType=r,e.type="scalarType",e}case 4:{const t={nullable:!1,columnScope:0},e={type:"physicalType",physicalType:0};return t.type="complexType",t.complexType=e,t}case 30:{const t={nullable:!1,columnScope:0},e={type:"physicalType",physicalType:1};return t.type="complexType",t.complexType=e,t}default:return function(t){let e;switch(t){case 10:case 11:e=0;break;case 12:case 13:e=1;break;case 14:case 15:e=2;break;case 16:case 17:e=3;break;case 18:case 19:e=4;break;case 20:case 21:e=5;break;case 22:case 23:e=6;break;case 24:case 25:e=7;break;case 26:case 27:e=8;break;case 28:case 29:e=9;break;default:return null}const r={};r.nullable=!!(1&t),r.columnScope=0;const n={type:"physicalType"};return n.physicalType=e,r.type="scalarType",r.scalarType=n,r}(t)}}function If(t){return t>=10}function kf(t){return 30===t}function Tf(t){if("scalarType"===t.type){const e=t.scalarType;if("physicalType"===e.type)switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if("logicalType"===e.type)return!1}else if("complexType"===t.type){const e=t.complexType;if("physicalType"===e.type)switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}function Ef(t){return"complexType"===t.type&&"physicalType"===t.complexType?.type&&0===t.complexType.physicalType}const Mf=new TextDecoder;function Pf(t,e){const r=dp(t,e,1)[0];if(0===r)return"";const n=e.get(),i=t.subarray(n,n+r);return e.add(r),Mf.decode(i)}function Df(t,e){const r=dp(t,e,1)[0]>>>0;if(r<10||r>30)throw new Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT)`);const n=Af(r);if(If(r)&&(n.name=Pf(t,e)),kf(r)){const r=dp(t,e,1)[0]>>>0;n.complexType.children=new Array(r);for(let i=0;i<r;i++)n.complexType.children[i]=Df(t,e)}return function(t){return{name:t.name,nullable:t.nullable,scalarField:t.scalarType,complexField:t.complexType,type:"scalarType"===t.type?"scalarField":"complexField"}}(n)}function Ff(t,e){const r=dp(t,e,1)[0]>>>0,n=Af(r);if(!n)throw new Error(`Unsupported column type code ${r}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(If(r)?n.name=Pf(t,e):r>=0&&r<=3?n.name="id":4===r&&(n.name="geometry"),kf(r)){const r=dp(t,e,1)[0]>>>0,i=n.complexType;i.children=new Array(r);for(let n=0;n<r;n++)i.children[n]=Df(t,e)}return n}function zf(t,e){const r={featureTables:[]},n={};n.name=Pf(t,e);const i=dp(t,e,1)[0]>>>0,s=dp(t,e,1)[0]>>>0;n.columns=new Array(s);for(let r=0;r<s;r++)n.columns[r]=Ff(t,e);return r.featureTables.push(n),[r,i]}function Bf(t,e,r,n,i,s,o=!1){const a=e.scalarType;if(!a||"logicalType"!==a.type||0!==a.logicalType)throw new Error(`ID column must be a logical ID scalar type: ${n}`);const l=a.longID?6:4,u="number"==typeof s?void 0:s,c=Yp(i,s,t,r,6===l?"int64":"int32");if(4===l)switch(c){case Dp.FLAT:{const e=$p(t,r,i,0,u);return new Zh(n,e,s)}case Dp.SEQUENCE:{const e=qp(t,r,i);return new Jh(n,e[0],e[1],i.numRleValues)}case Dp.CONST:{const e=Up(t,r,i);return new Kh(n,e,s,!1)}}switch(c){case Dp.FLAT:{if(o){const e=function(t,e,r){const n=function(t,e,r){const n=new Float64Array(r);for(let i=0;i<r;i++)n[i]=gp(t,e);return n}(t,e,r.numValues);return function(t,e){switch(e.logicalLevelTechnique1){case Oh.DELTA:return e.logicalLevelTechnique2===Oh.RLE&&(t=Sp(t,e.runs,e.numRleValues)),function(t){t[0]=bp(t[0]);const e=t.length/4*4;let r=1;if(e>=4)for(;r<e-4;r+=4){const e=t[r+1],n=t[r+2],i=t[r+3];t[r]=bp(t[r])+t[r-1],t[r+1]=bp(e)+t[r],t[r+2]=bp(n)+t[r+1],t[r+3]=bp(i)+t[r+2]}for(;r!==t.length;++r)t[r]=bp(t[r])+t[r-1]}(t),t;case Oh.RLE:return function(t,e){return Sp(t,e.runs,e.numRleValues)}(t,e);case Oh.NONE:return t;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}(n,r)}(t,r,i);return new Wh(n,e,s)}const e=Gp(t,r,i,u);return new Zp(n,e,s)}case Dp.SEQUENCE:{const e=jp(t,r,i);return new Wp(n,e[0],e[1],i.numRleValues)}case Dp.CONST:{const e=Xp(t,r,i);return new df(n,e,s,!1)}}throw new Error("Vector type not supported for id column.")}class Cf{constructor(t,e){var r;switch(this._featureData=t,this.properties=this._featureData.properties||{},null===(r=this._featureData.geometry)||void 0===r?void 0:r.type){case Fp.POINT:case Fp.MULTIPOINT:this.type=1;break;case Fp.LINESTRING:case Fp.MULTILINESTRING:this.type=2;break;case Fp.POLYGON:case Fp.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){const t=[];for(const r of this._featureData.geometry.coordinates){const n=[];for(const t of r)n.push(new e(t.x,t.y));t.push(n)}return t}}class Vf{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new Cf(this.features[t],this.extent)}}class Lf{constructor(t){this.layers={};const e=function(t,e,r=!0){const n=new tp(0),i=[];for(;n.get()<t.length;){const e=dp(t,n,1)[0]>>>0,o=n.get()+e;if(o>t.length)throw new Error(`Block overruns tile: ${o} > ${t.length}`);if(1!=dp(t,n,1)[0]>>>0){n.set(o);continue}const[a,l]=zf(t,n),u=a.featureTables[0];let c=null,h=null;const p=[];let f=0;for(const e of u.columns){const i=e.name;if("scalarType"===(s=e).type&&"logicalType"===s.scalarType?.type&&0===s.scalarType.logicalType){let s=null;if(e.nullable){const e=Cp(t,n),r=n.get(),i=yf(t,e.numValues,e.byteLength,n);n.set(r+e.byteLength),s=new Vp(i,e.numValues)}const o=Cp(t,n);f=s?s.size():o.decompressedCount,c=Bf(t,e,n,i,o,s??f,r)}else if(Ef(e)){const e=dp(t,n,1)[0];if(0===f){const e=n.get();f=Cp(t,n).decompressedCount,n.set(e)}h=uf(t,e,n,f)}else{const r=Tf(e)?dp(t,n,1)[0]:1;if(0===r)continue;const i=_f(t,n,e,r,f);if(i)if(Array.isArray(i))for(const t of i)p.push(t);else p.push(i)}}const d=new Qh(u.name,h,c,p,l);i.push(d),n.set(o)}var s;return i}(new Uint8Array(t));this.layers=e.reduce(((t,e)=>Object.assign(Object.assign({},t),{[e.name]:new Vf(e)})),{})}}class Of{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){const r=new Of;return r.extend(t(new e(this.minX,this.minY))),r.extend(t(new e(this.maxX,this.minY))),r.extend(t(new e(this.minX,this.maxY))),r.extend(t(new e(this.maxX,this.maxY))),r}static fromPoints(t){const e=new Of;for(const r of t)e.extend(r);return e}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class $f{constructor(t,e){this.feature=t,this.type=t.type,this.properties=t.tags?t.tags:{},this.extent=e,"id"in t&&("string"==typeof t.id?this.id=parseInt(t.id,10):"number"!=typeof t.id||isNaN(t.id)||(this.id=t.id))}loadGeometry(){const t=[],r=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(const n of r){const r=[];for(const t of n)r.push(new e(t[0],t[1]));t.push(r)}return t}}const Rf="_geojsonTileLayer";class Nf{constructor(t,e){this.layers={[Rf]:this},this.name=Rf,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=t.length,this.features=t}feature(t){return new $f(this.features[t],this.extent)}}function Uf(t,e,r=""){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);const n={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,qf,n);const i=n.keys;for(const t of i)e.writeStringField(3,t);const s=n.values;for(const t of s)e.writeMessage(4,Zf,t)}function qf(t,e){if(!t.feature)return;const r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,jf,t),e.writeVarintField(3,r.type),e.writeMessage(4,Yf,r)}function jf(t,e){for(const r in t.feature?.properties){let n=t.feature.properties[r],i=t.keycache[r];if(null==n)continue;void 0===i&&(t.keys.push(r),i=t.keys.length-1,t.keycache[r]=i),e.writeVarint(i),"string"!=typeof n&&"boolean"!=typeof n&&"number"!=typeof n&&(n=t.jsonPrefix+JSON.stringify(n));const s=typeof n+":"+n;let o=t.valuecache[s];void 0===o&&(t.values.push(n),o=t.values.length-1,t.valuecache[s]=o),e.writeVarint(o)}}function Gf(t,e){return(e<<3)+(7&t)}function Xf(t){return t<<1^t>>31}function Yf(t,e){const r=t.loadGeometry(),n=t.type;let i=0,s=0;for(const o of r){let r=1;1===n&&(r=o.length),e.writeVarint(Gf(1,r));const a=3===n?o.length-1:o.length;for(let t=0;t<a;t++){1===t&&1!==n&&e.writeVarint(Gf(2,a-1));const r=o[t].x-i,l=o[t].y-s;e.writeVarint(Xf(r)),e.writeVarint(Xf(l)),i+=r,s+=l}3===t.type&&e.writeVarint(Gf(7,1))}}function Zf(t,e){const 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))}class Wf{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new T(p,16,0),this.grid3D=new T(p,16,0),this.featureIndexArray=new Js,this.promoteId=e}insert(t,e,r,n,i,s){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);const a=s?this.grid3D:this.grid;for(const t of e){const e=[1/0,1/0,-1/0,-1/0];for(const r of t)e[0]=Math.min(e[0],r.x),e[1]=Math.min(e[1],r.y),e[2]=Math.max(e[2],r.x),e[3]=Math.max(e[3],r.y);e[0]<p&&e[1]<p&&e[2]>=0&&e[3]>=0&&a.insert(o,e[0],e[1],e[2],e[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new Xl(new Gc(this.rawTileData)).layers:new Lf(this.rawTileData).layers,this.sourceLayerCoder=new jh(this.vtLayers?Object.keys(this.vtLayers).sort():[Rf])),this.vtLayers}query(t,r,n,i){this.loadVTLayers();const s=t.params,o=p/t.tileSize/t.scale,a=pn(s.filter,s.globalState),l=t.queryGeometry,u=t.queryPadding*o,c=Of.fromPoints(l),h=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=Of.fromPoints(t.cameraQueryGeometry).expandBy(u),d=this.grid3D.query(f.minX,f.minY,f.maxX,f.maxY,((r,n,i,s)=>function(t,r,n,i,s){for(const e of t)if(r<=e.x&&n<=e.y&&i>=e.x&&s>=e.y)return!0;const o=[new e(r,n),new e(r,s),new e(i,s),new e(i,n)];if(t.length>2)for(const e of o)if(ca(t,e))return!0;for(let e=0;e<t.length-1;e++)if(ha(t[e],t[e+1],o))return!0;return!1}(t.cameraQueryGeometry,r-u,n-u,i+u,s+u)));for(const t of d)h.push(t);h.sort(Jf);const y={};let m;for(const e of h){if(e===m)continue;m=e;const u=this.featureIndexArray.get(e);let c=null;this.loadMatchingFeature(y,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,a,s.layers,s.availableImages,r,n,i,((e,r,n)=>(c||(c=Ho(e)),r.queryIntersectsFeature({queryGeometry:l,feature:e,featureState:n,geometry:c,zoom:this.z,transform:t.transform,pixelsToTileUnits:o,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation}))))}return y}loadMatchingFeature(t,e,r,n,i,s,o,a,l,u,c){const h=this.bucketLayerIDs[e];if(s&&!h.some((t=>s.has(t))))return;const p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(n);if(i.needGeometry){const t=Jo(f,!0);if(!i.filter(new Gi(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!i.filter(new Gi(this.tileID.overscaledZ),f))return;const d=this.getId(f,p);for(const e of h){if(s&&!s.has(e))continue;const r=a[e];if(!r)continue;let i={};d&&u&&(i=u.getState(r.sourceLayer||Rf,d));const h=y({},l[e]);h.paint=Hf(h.paint,r.paint,f,i,o),h.layout=Hf(h.layout,r.layout,f,i,o);const p=!c||c(f,r,i);if(!p)continue;const m=new Gh(f,this.z,this.x,this.y,d);m.layer=h;let g=t[e];void 0===g&&(g=t[e]=[]),g.push({featureIndex:n,feature:m,intersectionZ:p})}}lookupSymbolFeatures(t,e,r,n,i,s,o,a){const l={};this.loadVTLayers();const u=pn(i.filterSpec,i.globalState);for(const i of t)this.loadMatchingFeature(l,r,n,i,u,s,o,a,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){var r;let n=t.id;return this.promoteId&&(n=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof n&&(n=Number(n)),void 0===n&&(null===(r=t.properties)||void 0===r?void 0:r.cluster)&&this.promoteId&&(n=Number(t.properties.cluster_id))),n}}function Hf(t,e,r,n,i){return m(t,((t,s)=>{const o=e instanceof es?e.get(s):null;return(null==o?void 0:o.evaluate)?o.evaluate(r,n,i):o}))}function Jf(t,e){return e-t}fi("FeatureIndex",Wf,{omit:["rawTileData","sourceLayerCoder"]});class Kf{constructor(t,e){this.keyCache={},t&&this.replace(t,e)}replace(t,e){this._layerConfigs={},this._layers={},this.update(t,[],e)}update(t,e,r){for(const e of t){this._layerConfigs[e.id]=e;const t=this._layers[e.id]=qh(e,r);t._featureFilter=pn(t.filter,r),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 n=function(t,e){const r={};for(let n=0;n<t.length;n++){const i=e&&e[t[n].id]||wn(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 n){const e=t.map((t=>this._layers[t.id])),r=e[0];if(r.isHidden())continue;const n=r.source||"";let i=this.familiesBySource[n];i||(i=this.familiesBySource[n]={});const s=r.sourceLayer||Rf;let o=i[s];o||(o=i[s]=[]),o.push(e)}}}class Qf extends e{constructor(t,e,r,n){super(t,e),this.angle=r,void 0!==n&&(this.segment=n)}clone(){return new Qf(this.x,this.y,this.angle,this.segment)}}function td(t,e,r,n,i){if(void 0===e.segment||0===r)return!0;let s=e,o=e.segment+1,a=0;for(;a>-r/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const l=[];let u=0;for(;a<r/2;){const e=t[o],r=t[o+1];if(!r)return!1;let s=t[o-1].angleTo(e)-e.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:s}),u+=s;a-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;o++,a+=e.dist(r)}return!0}function ed(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function rd(t,e,r){return t?.6*e*r:0}function nd(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function id(t,e,r,n,i,s){const o=rd(r,i,s),a=nd(r,n)*s;let l=0;const u=ed(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=de.number(n.x,i.x,c),p=de.number(n.y,i.y,c),f=new Qf(h,p,i.angleTo(n),r);return f._round(),!o||td(t,f,a,o,e)?f:void 0}l+=s}}function sd(t,e,r,n,i,s,o,a,l){const u=rd(n,s,o),c=nd(n,i),h=c*o,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),od(t,p?e/2*a%e:(c/2+2*s)*o*a%e,e,u,r,h,p,!1,l)}function od(t,e,r,n,i,s,o,a,l){const u=s/2,c=ed(t);let h=0,p=e-r,f=[];for(let e=0;e<t.length-1;e++){const o=t[e],a=t[e+1],d=o.dist(a),y=a.angleTo(o);for(;p+r<h+d;){p+=r;const m=(p-h)/d,g=de.number(o.x,a.x,m),x=de.number(o.y,a.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new Qf(g,x,y,e);r._round(),n&&!td(t,r,s,n,i)||f.push(r)}}h+=d}return a||f.length||o||(f=od(t,h/2,r,n,i,s,o,!0,l)),f}function ad(t,e,r,n,i,s){let o=ld(t,e,r,i,0);return o=ld(o,e,n,s,1),o}function ld(t,e,r,n,i){switch(e){case 1:return function(t,e,r,n){const i=[];for(const s of t)for(const t of s){const s=0===n?t.x:t.y;s>=e&&s<=r&&i.push([t])}return i}(t,r,n,i);case 2:return cd(t,r,n,i,!1);case 3:return cd(t,r,n,i,!0)}return[]}function ud(t,r,n,i,s){const o=0===i?hd:pd;let a=[];const l=[];for(let e=0;e<t.length-1;e++){const u=t[e],c=t[e+1],h=0===i?u.x:u.y,p=0===i?c.x:c.y;let f=!1;h<r?p>r&&a.push(o(u,c,r)):h>n?p<n&&a.push(o(u,c,n)):a.push(u),p<r&&h>=r&&(a.push(o(u,c,r)),f=!0),p>n&&h<=n&&(a.push(o(u,c,n)),f=!0),!s&&f&&(l.push(a),a=[])}const u=t.length-1,c=0===i?t[u].x:t[u].y;return c>=r&&c<=n&&a.push(t[u]),s&&a.length>0&&!a[0].equals(a[a.length-1])&&a.push(new e(a[0].x,a[0].y)),a.length>0&&l.push(a),l}function cd(t,e,r,n,i){const s=[];for(const o of t){const t=ud(o,e,r,n,i);t.length>0&&s.push(...t)}return s}function hd(t,r,n){return new e(n,t.y+(n-t.x)/(r.x-t.x)*(r.y-t.y))}function pd(t,r,n){return new e(t.x+(n-t.y)/(r.y-t.y)*(r.x-t.x),n)}function fd(t,r,n,i){const s=[],o=t.image,a=o.pixelRatio,l=o.paddedRect.w-2,u=o.paddedRect.h-2;let c={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom};const h=o.stretchX||[[0,l]],p=o.stretchY||[[0,u]],f=(t,e)=>t+e[1]-e[0],d=h.reduce(f,0),y=p.reduce(f,0),m=l-d,g=u-y;let x=0,v=d,b=0,w=y,_=0,S=m,A=0,I=g;if(o.content&&i){const e=o.content,r=e[2]-e[0],n=e[3]-e[1];(o.textFitWidth||o.textFitHeight)&&(c=mh(t)),x=dd(h,0,e[0]),b=dd(p,0,e[1]),v=dd(h,e[0],e[2]),w=dd(p,e[1],e[3]),_=e[0]-x,A=e[1]-b,S=r-v,I=n-w}const k=c.x1,T=c.y1,E=c.x2-k,M=c.y2-T,P=(t,i,s,l)=>{const u=md(t.stretch-x,v,E,k),c=gd(t.fixed-_,S,t.stretch,d),h=md(i.stretch-b,w,M,T),p=gd(i.fixed-A,I,i.stretch,y),f=md(s.stretch-x,v,E,k),m=gd(s.fixed-_,S,s.stretch,d),g=md(l.stretch-b,w,M,T),P=gd(l.fixed-A,I,l.stretch,y),D=new e(u,h),F=new e(f,h),z=new e(f,g),B=new e(u,g),C=new e(c/a,p/a),V=new e(m/a,P/a),L=r*Math.PI/180;if(L){const t=Math.sin(L),e=Math.cos(L),r=[e,-t,t,e];D._matMult(r),F._matMult(r),B._matMult(r),z._matMult(r)}const O=t.stretch+t.fixed,$=i.stretch+i.fixed;return{tl:D,tr:F,bl:B,br:z,tex:{x:o.paddedRect.x+1+O,y:o.paddedRect.y+1+$,w:s.stretch+s.fixed-O,h:l.stretch+l.fixed-$},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:C,pixelOffsetBR:V,minFontScaleX:S/a/E,minFontScaleY:I/a/M,isSDF:n}};if(i&&(o.stretchX||o.stretchY)){const t=yd(h,m,d),e=yd(p,g,y);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(P(n,e[t],i,e[t+1]))}}else s.push(P({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return s}function dd(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 yd(t,e,r){const n=[{fixed:-1,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+1,stretch:r}),n}function md(t,e,r,n){return t/e*r+n}function gd(t,e,r,n){return t-e*r/n}fi("Anchor",Qf);class xd{constructor(t,r,n,i,s,o,a,l,u,c){var h;if(this.boxStartIndex=t.length,u){let t=o.top,e=o.bottom;const r=o.collisionPadding;r&&(t-=r[1],e+=r[3]);let n=e-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{const u=(null===(h=o.image)||void 0===h?void 0:h.content)&&(o.image.textFitWidth||o.image.textFitHeight)?mh(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};u.y1=u.y1*a-l[0],u.y2=u.y2*a+l[2],u.x1=u.x1*a-l[3],u.x2=u.x2*a+l[1];const p=o.collisionPadding;if(p&&(u.x1-=p[0]*a,u.y1-=p[1]*a,u.x2+=p[2]*a,u.y2+=p[3]*a),c){const t=new e(u.x1,u.y1),r=new e(u.x2,u.y1),n=new e(u.x1,u.y2),i=new e(u.x2,u.y2),s=c*Math.PI/180;t._rotate(s),r._rotate(s),n._rotate(s),i._rotate(s),u.x1=Math.min(t.x,r.x,n.x,i.x),u.x2=Math.max(t.x,r.x,n.x,i.x),u.y1=Math.min(t.y,r.y,n.y,i.y),u.y2=Math.max(t.y,r.y,n.y,i.y)}t.emplaceBack(r.x,r.y,u.x1,u.y1,u.x2,u.y2,n,i,s)}this.boxEndIndex=t.length}}class vd{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare: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);const s=n+1;if(s<this.length&&r(e[s],e[n])<0&&(n=s),r(e[n],i)>=0)break;e[t]=e[n],t=n}e[t]=i}}function bd(t,r=1){const n=Of.fromPoints(t[0]),i=Math.min(n.width(),n.height());let s=i/2;const o=new vd([],wd),{minX:a,minY:l,maxX:u,maxY:c}=n;if(0===i)return new e(a,l);for(let e=a;e<u;e+=i)for(let r=l;r<c;r+=i)o.push(new _d(e+s,r+s,s,t));const h=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,s=i.length,o=s-1;t<s;o=t++){const s=i[t],a=i[o],l=s.x*a.y-a.x*s.y;r+=(s.x+a.x)*l,n+=(s.y+a.y)*l,e+=3*l}return new _d(r/e,n/e,0,t)}(t);let p=h;for(;o.length;){const e=o.pop();(e.d>p.d||!p.d)&&(p=e),e.max-p.d<=r||(s=e.h/2,o.push(new _d(e.p.x-s,e.p.y-s,s,t)),o.push(new _d(e.p.x+s,e.p.y-s,s,t)),o.push(new _d(e.p.x-s,e.p.y+s,s,t)),o.push(new _d(e.p.x+s,e.p.y+s,s,t)))}return h.d>0&&p.d-h.d<=r?h.p:p.p}function wd(t,e){return e.max-t.max}class _d{constructor(t,r,n,i){this.p=new e(t,r),this.h=n,this.d=function(t,e){let r=!1,n=1/0;for(const i of e)for(let e=0,s=i.length,o=s-1;e<s;o=e++){const s=i[e],a=i[o];s.y>t.y!=a.y>t.y&&t.x<(a.x-s.x)*(t.y-s.y)/(a.y-s.y)+s.x&&(r=!r),n=Math.min(n,la(t,s,a))}return(r?1:-1)*Math.sqrt(n)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}}var Sd;!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"}(Sd||(Sd={}));const Ad=Number.POSITIVE_INFINITY;function Id(t,e){return e[1]!==Ad?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-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}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-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}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 kd(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*Fc));n.startsWith("top")?i[1]-=7:n.startsWith("bottom")&&(i[1]+=7),e[r+1]=i}return new Vt(e)}const o=i.get("text-variable-anchor");if(o){let n;n=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[i.get("text-radial-offset").evaluate(e,{},r)*Fc,Ad]:i.get("text-offset").evaluate(e,{},r).map((t=>t*Fc));const s=[];for(const t of o)s.push(t,Id(t,n));return new Vt(s)}return null}function Td(t){var e,r;t.bucket.createArrays(),t.bucket.tilePixelRatio=p/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;const n=t.bucket.layers[0],i=n.layout,s=n._unevaluatedLayout._values,o={layoutIconSize:s["icon-size"].possiblyEvaluate(new Gi(t.bucket.zoom+1),t.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new Gi(t.bucket.zoom+1),t.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new Gi(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.bucket.textSizeData;o.compositeTextSizes=[s["text-size"].possiblyEvaluate(new Gi(e),t.canonical),s["text-size"].possiblyEvaluate(new Gi(r),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.bucket.iconSizeData;o.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new Gi(e),t.canonical),s["icon-size"].possiblyEvaluate(new Gi(r),t.canonical)]}const a=i.get("text-line-height")*Fc,l="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement"),u=i.get("text-keep-upright"),c=i.get("text-size");for(const s of t.bucket.features){const h=i.get("text-font").evaluate(s,{},t.canonical).join(","),p=c.evaluate(s,{},t.canonical),f=o.layoutTextSize.evaluate(s,{},t.canonical),d=o.layoutIconSize.evaluate(s,{},t.canonical),y={horizontal:{},vertical:void 0},m=s.text;let g,x=[0,0];if(m){const e=m.toString(),r=i.get("text-letter-spacing").evaluate(s,{},t.canonical)*Fc,o=Ci(e)?r:0,c=i.get("text-anchor").evaluate(s,{},t.canonical),d=kd(n,s,t.canonical);if(!d){const e=i.get("text-radial-offset").evaluate(s,{},t.canonical);x=e?Id(c,[e*Fc,Ad]):i.get("text-offset").evaluate(s,{},t.canonical).map((t=>t*Fc))}let g=l?"center":i.get("text-justify").evaluate(s,{},t.canonical);const v="point"===i.get("symbol-placement")?i.get("text-max-width").evaluate(s,{},t.canonical)*Fc:1/0,b=()=>{t.bucket.allowVerticalPlacement&&Bi(e)&&(y.vertical=ah(m,t.glyphMap,t.glyphPositions,t.imagePositions,h,v,a,c,"left",o,x,oh.vertical,!0,f,p))};if(!l&&d){const e=new Set;if("auto"===g)for(let t=0;t<d.values.length;t+=2)e.add(Ed(d.values[t]));else e.add(g);let r=!1;for(const n of e)if(!y.horizontal[n])if(r)y.horizontal[n]=y.horizontal[0];else{const e=ah(m,t.glyphMap,t.glyphPositions,t.imagePositions,h,v,a,"center",n,o,x,oh.horizontal,!1,f,p);e&&(y.horizontal[n]=e,r=1===e.positionedLines.length)}b()}else{"auto"===g&&(g=Ed(c));const r=ah(m,t.glyphMap,t.glyphPositions,t.imagePositions,h,v,a,c,g,o,x,oh.horizontal,!1,f,p);r&&(y.horizontal[g]=r),b(),Bi(e)&&l&&u&&(y.vertical=ah(m,t.glyphMap,t.glyphPositions,t.imagePositions,h,v,a,c,g,o,x,oh.vertical,!1,f,p))}}let b=!1;if(null===(e=s.icon)||void 0===e?void 0:e.name){const e=t.imageMap[s.icon.name];e&&(g=yh(t.imagePositions[s.icon.name],i.get("icon-offset").evaluate(s,{},t.canonical),i.get("icon-anchor").evaluate(s,{},t.canonical)),b=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=b:t.bucket.sdfIcons!==b&&v("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==i.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const w=Dd(y.horizontal)||y.vertical;(r=t.bucket).iconsInText||(r.iconsInText=!!w&&w.iconsInText),(w||g)&&Md(t.bucket,s,y,g,t.imageMap,o,f,d,x,b,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function Ed(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 Md(t,r,n,i,s,o,a,l,u,c,h,f){let d=o.textMaxSize.evaluate(r,{});void 0===d&&(d=a);const y=t.layers[0].layout,m=y.get("icon-offset").evaluate(r,{},h),g=Dd(n.horizontal),x=a/24,b=t.tilePixelRatio*x,w=t.tilePixelRatio*d/24,_=t.tilePixelRatio*l,S=t.tilePixelRatio*y.get("symbol-spacing"),A=y.get("text-padding")*t.tilePixelRatio,I=function(t,e,r,n=1){const i=t.get("icon-padding").evaluate(e,{},r),s=null==i?void 0:i.values;return[s[0]*n,s[1]*n,s[2]*n,s[3]*n]}(y,r,h,t.tilePixelRatio),k=y.get("text-max-angle")/180*Math.PI,T="viewport"!==y.get("text-rotation-alignment")&&"point"!==y.get("symbol-placement"),E="map"===y.get("icon-rotation-alignment")&&"point"!==y.get("symbol-placement"),M=y.get("symbol-placement"),P=S/2,D=y.get("icon-text-fit");let F;i&&"none"!==D&&(t.allowVerticalPlacement&&n.vertical&&(F=gh(i,n.vertical,D,y.get("icon-text-fit-padding"),m,x)),g&&(i=gh(i,g,D,y.get("icon-text-fit-padding"),m,x)));const z=h?f.line.getGranularityForZoomLevel(h.z):1,B=(e,l)=>{l.x<0||l.x>=p||l.y<0||l.y>=p||function(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,b,w,_,S,A,I){const k=t.addToLineVertexArray(e,r);let T,E,M,P,D=0,F=0,z=0,B=0,C=-1,V=-1;const L={};let O=To("");if(t.allowVerticalPlacement&&n.vertical){const t=a.layout.get("text-rotate").evaluate(w,{},A)+90;M=new xd(l,e,u,c,h,n.vertical,p,f,d,t),o&&(P=new xd(l,e,u,c,h,o,m,g,d,t))}if(i){const r=a.layout.get("icon-rotate").evaluate(w,{}),n="none"!==a.layout.get("icon-text-fit"),s=fd(i,r,S,n),p=o?fd(o,r,S,n):void 0;E=new xd(l,e,u,c,h,i,m,g,!1,r),D=4*s.length;const f=t.iconSizeData;let d=null;"source"===f.kind?(d=[xh*a.layout.get("icon-size").evaluate(w,{})],d[0]>vh&&v(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(d=[xh*_.compositeIconSizes[0].evaluate(w,{},A),xh*_.compositeIconSizes[1].evaluate(w,{},A)],(d[0]>vh||d[1]>vh)&&v(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,s,d,b,x,w,oh.none,e,k.lineStartIndex,k.lineLength,-1,A),C=t.icon.placedSymbolArray.length-1,p&&(F=4*p.length,t.addSymbols(t.icon,p,d,b,x,w,oh.vertical,e,k.lineStartIndex,k.lineLength,-1,A),V=t.icon.placedSymbolArray.length-1)}const $=Object.keys(n.horizontal);for(const r of $){const i=n.horizontal[r];if(!T){O=To(i.text);const t=a.layout.get("text-rotate").evaluate(w,{},A);T=new xd(l,e,u,c,h,i,p,f,d,t)}const o=1===i.positionedLines.length;if(z+=Pd(t,e,i,s,a,d,w,y,k,n.vertical?oh.horizontal:oh.horizontalOnly,o?$:[r],L,C,_,A),o)break}n.vertical&&(B+=Pd(t,e,n.vertical,s,a,d,w,y,k,oh.vertical,["vertical"],L,V,_,A));const R=T?T.boxStartIndex:t.collisionBoxArray.length,N=T?T.boxEndIndex:t.collisionBoxArray.length,U=M?M.boxStartIndex:t.collisionBoxArray.length,q=M?M.boxEndIndex:t.collisionBoxArray.length,j=E?E.boxStartIndex:t.collisionBoxArray.length,G=E?E.boxEndIndex:t.collisionBoxArray.length,X=P?P.boxStartIndex:t.collisionBoxArray.length,Y=P?P.boxEndIndex:t.collisionBoxArray.length;let Z=-1;const W=(t,e)=>(null==t?void 0:t.circleDiameter)?Math.max(t.circleDiameter,e):e;Z=W(T,Z),Z=W(M,Z),Z=W(E,Z),Z=W(P,Z);const H=Z>-1?1:0;H&&(Z*=I/Fc),t.glyphOffsetArray.length>=Eh.MAX_GLYPHS&&v("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 J=kd(a,w,A),[K,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(Sd[n[e]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,J);t.symbolInstances.emplaceBack(e.x,e.y,L.right>=0?L.right:-1,L.center>=0?L.center:-1,L.left>=0?L.left:-1,L.vertical||-1,C,V,O,R,N,U,q,j,G,X,Y,u,z,B,D,F,H,0,p,Z,K,Q)}(t,l,e,n,i,s,F,t.layers[0],t.collisionBoxArray,r.index,r.sourceLayerIndex,t.index,b,[A,A,A,A],T,u,_,I,E,m,r,o,c,h,a)};if("line"===M)for(const s of function(t,r,n,i,s){const o=[];for(const r of t){let t;for(let n=0;n<r.length-1;n++){let a=r[n],l=r[n+1];a.x<0&&l.x<0||(a.x<0?a=new e(0,a.y+(0-a.x)/(l.x-a.x)*(l.y-a.y))._round():l.x<0&&(l=new e(0,a.y+(0-a.x)/(l.x-a.x)*(l.y-a.y))._round()),a.y<0&&l.y<0||(a.y<0?a=new e(a.x+(0-a.y)/(l.y-a.y)*(l.x-a.x),0)._round():l.y<0&&(l=new e(a.x+(0-a.y)/(l.y-a.y)*(l.x-a.x),0)._round()),a.x>=i&&l.x>=i||(a.x>=i?a=new e(i,a.y+(i-a.x)/(l.x-a.x)*(l.y-a.y))._round():l.x>=i&&(l=new e(i,a.y+(i-a.x)/(l.x-a.x)*(l.y-a.y))._round()),a.y>=s&&l.y>=s||(a.y>=s?a=new e(a.x+(s-a.y)/(l.y-a.y)*(l.x-a.x),s)._round():l.y>=s&&(l=new e(a.x+(s-a.y)/(l.y-a.y)*(l.x-a.x),s)._round()),t&&a.equals(t[t.length-1])||(t=[a],o.push(t)),t.push(l)))))}}return o}(r.geometry,0,0,p,p)){const e=El(s,z),r=sd(e,S,k,n.vertical||g,i,24,w,t.overscaling,p);for(const n of r)g&&Fd(t,g.text,P,n)||B(e,n)}else if("line-center"===M){for(const t of r.geometry)if(t.length>1){const e=El(t,z),r=id(e,k,n.vertical||g,i,24,w);r&&B(e,r)}}else if("Polygon"===r.type)for(const t of Qe(r.geometry,0)){const e=bd(t,16);B(El(t[0],z,!0),new Qf(e.x,e.y,0))}else if("LineString"===r.type)for(const t of r.geometry){const e=El(t,z);B(e,new Qf(e[0].x,e[0].y,0))}else if("Point"===r.type)for(const t of r.geometry)for(const e of t)B([e],new Qf(e.x,e.y,0))}function Pd(t,r,n,i,s,o,a,l,u,c,h,p,f,d,y){const m=function(t,r,n,i,s,o,a,l){const u=i.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,c=[];for(const t of r.positionedLines)for(const i of t.positionedGlyphs){if(!i.rect)continue;const o=i.rect||{};let h=4,p=!0,f=1,d=0;const y=(s||l)&&i.vertical,m=i.metrics.advance*i.scale/2;if(l&&r.verticalizable&&(d=t.lineOffset/2-(i.imageName?-(Fc-i.metrics.width*i.scale)/2:(i.scale-1)*Fc)),i.imageName){const t=a[i.imageName];p=t.sdf,f=t.pixelRatio,h=1/f}const g=s?[i.x+m,i.y]:[0,0];let x=s?[0,0]:[i.x+m+n[0],i.y+n[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+o.w/b*i.scale/f,A=_+o.h/b*i.scale/f,I=new e(w,_),k=new e(S,_),T=new e(w,A),E=new e(S,A);if(y){const t=new e(-m,m- -17),r=-Math.PI/2,n=12-m,s=new e(22-n,-(i.imageName?n:0)),o=new e(...v);I._rotateAround(r,t)._add(s)._add(o),k._rotateAround(r,t)._add(s)._add(o),T._rotateAround(r,t)._add(s)._add(o),E._rotateAround(r,t)._add(s)._add(o)}if(u){const t=Math.sin(u),e=Math.cos(u),r=[e,-t,t,e];I._matMult(r),k._matMult(r),T._matMult(r),E._matMult(r)}const M=new e(0,0),P=new e(0,0);c.push({tl:I,tr:k,bl:T,br:E,tex:o,writingMode:r.writingMode,glyphOffset:g,sectionIndex:i.sectionIndex,isSDF:p,pixelOffsetTL:M,pixelOffsetBR:P,minFontScaleX:0,minFontScaleY:0})}return c}(0,n,l,s,o,a,i,t.allowVerticalPlacement),g=t.textSizeData;let x=null;"source"===g.kind?(x=[xh*s.layout.get("text-size").evaluate(a,{})],x[0]>vh&&v(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===g.kind&&(x=[xh*d.compositeTextSizes[0].evaluate(a,{},y),xh*d.compositeTextSizes[1].evaluate(a,{},y)],(x[0]>vh||x[1]>vh)&&v(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,l,o,a,c,r,u.lineStartIndex,u.lineLength,f,y);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*m.length}function Dd(t){for(const e in t)return t[e];return null}function Fd(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 zd{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}=nh(r),s=new Fa({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 o=e[r][t].rect;Fa.copy(i.bitmap,s,{x:0,y:0},{x:o.x+1,y:o.y+1},i.bitmap)}}this.image=s,this.positions=e}}function Bd(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]}fi("GlyphAtlas",zd);const Cd=6371008.8;class Vd{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 Vd(function(t,e){const r=((t-e)%360+360)%360+e;return r===e?180:r}(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 Cd*Math.acos(Math.min(i,1))}static convert(t){if(t instanceof Vd)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Vd(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Vd(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 Ld=2*Math.PI*Cd;function Od(t){return Ld*Math.cos(t*Math.PI/180)}function $d(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class Rd{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){const r=Vd.convert(t);return new Rd((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/Od(e)}(e,r.lat))}toLngLat(){return new Vd(360*this.x-180,$d(this.y))}toAltitude(){return this.z*Od($d(this.y))}meterInMercatorCoordinateUnits(){return 1/Ld*(t=$d(this.y),1/Math.cos(t*Math.PI/180));var t}}class Nd{constructor(t,e,r){if(!function(t,e,r){return!(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}(t,e,r))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=jd(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,o=this.z,a=Bd(256*(i=this.x),256*(s=Math.pow(2,o)-s-1),o),l=Bd(256*(i+1),256*(s+1),o),a[0]+","+a[1]+","+l[0]+","+l[1]);var i,s,o,a,l;const u=function(t,e,r){let n="";for(let i=t;i>0;i--){const t=1<<i-1;n+=(e&t?1:0)+(r&t?2:0)}return n}(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 r=Math.pow(2,this.z);return new e((t.x*r-this.x)*p,(t.y*r-this.y)*p)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ud{constructor(t,e){this.wrap=t,this.canonical=e,this.key=jd(t,e.z,e.z,e.x,e.y)}}class qd{constructor(t,e,r,n,i){if(this.terrainRttPosMatrix32f=null,t<r)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Nd(r,+n,+i),this.key=jd(e,t,r,n,i)}clone(){return new qd(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 qd(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new qd(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}isOverscaled(){return this.overscaledZ>this.canonical.z}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?jd(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):jd(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;if(this.overscaledZ-t.overscaledZ<=0)return!1;if(0===t.overscaledZ)return this.overscaledZ>0;const e=this.canonical.z-t.canonical.z;return!(e<0)&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new qd(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 qd(e,this.wrap,e,r,n),new qd(e,this.wrap,e,r+1,n),new qd(e,this.wrap,e,r,n+1),new qd(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 qd(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new qd(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 Ud(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Rd(t.x-this.wrap,t.y))}normalizeCoordinates(t,e,r=8192){if(t>=0&&t<r&&e>=0&&e<r)return{tileID:this,x:t,y:e};const n=Math.floor(t/r),i=Math.floor(e/r),s=t-n*r,o=e-i*r,a=this.canonical.z,l=1<<a,u=this.canonical.y+i;if(u<0||u>=l)return null;let c=this.canonical.x+n,h=this.wrap;return c<0?(h-=Math.ceil(-c/l),c=(c%l+l)%l):c>=l&&(h+=Math.floor(c/l),c%=l),{tileID:new qd(this.overscaledZ,h,a,c,u),x:s,y:o}}}function jd(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)}fi("CanonicalTileID",Nd),fi("OverscaledTileID",qd,{omit:["terrainRttPosMatrix32f"]});class Gd{constructor(t){this.tileID=new qd(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=[]}parse(e,r,n,i,s){return t(this,void 0,void 0,(function*(){this.status="parsing",this.data=e,this.collisionBoxArray=new Ns;const t=new jh(Object.keys(e.layers).sort()),o=new Wf(this.tileID,this.promoteId);o.bucketLayerIDs=[];const a={},l={featureIndex:o,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:n,subdivisionGranularity:s},u=r.familiesBySource[this.source];for(const r in u){const i=e.layers[r];if(!i)continue;1===i.version&&v(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const s=t.encode(r),c=[];for(let t=0;t<i.length;t++){const e=i.feature(t),n=o.getId(e,r);c.push({feature:e,id:n,index:t,sourceLayerIndex:s})}for(const t of u[r]){const e=t[0];e.source!==this.source&&v(`layer.source = ${e.source} does not equal this.source = ${this.source}`),e.isHidden(this.zoom,!0)||(Xd(t,this.zoom,n),(a[e.id]=e.createBucket({index:o.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:s,sourceID:this.source})).populate(c,l,this.tileID.canonical),o.bucketLayerIDs.push(t.map((t=>t.id))))}}const c=m(l.glyphDependencies,(t=>Object.keys(t).map(Number)));for(const t of this.inFlightDependencies)null==t||t.abort();this.inFlightDependencies=[];let h=Promise.resolve({});if(Object.keys(c).length){const t=new AbortController;this.inFlightDependencies.push(t),h=i.sendAsync({type:"GG",data:{stacks:c,source:this.source,tileID:this.tileID,type:"glyphs"}},t)}const p=Object.keys(l.iconDependencies);let f=Promise.resolve({});if(p.length){const t=new AbortController;this.inFlightDependencies.push(t),f=i.sendAsync({type:"GI",data:{icons:p,source:this.source,tileID:this.tileID,type:"icons"}},t)}const d=Object.keys(l.patternDependencies);let y=Promise.resolve({});if(d.length){const t=new AbortController;this.inFlightDependencies.push(t),y=i.sendAsync({type:"GI",data:{icons:d,source:this.source,tileID:this.tileID,type:"patterns"}},t)}const g=l.dashDependencies;let x=Promise.resolve({});if(Object.keys(g).length){const t=new AbortController;this.inFlightDependencies.push(t),x=i.sendAsync({type:"GDA",data:{dashes:g}},t)}const[b,w,_,S]=yield Promise.all([h,f,y,x]),A=new zd(b),I=new sh(w,_);for(const t in a){const e=a[t];e instanceof Eh?(Xd(e.layers,this.zoom,n),Td({bucket:e,glyphMap:b,glyphPositions:A.positions,imageMap:w,imagePositions:I.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:l.subdivisionGranularity})):e.hasDependencies&&(e instanceof Fl||e instanceof Hl||e instanceof xc)&&(Xd(e.layers,this.zoom,n),e.addFeatures(l,this.tileID.canonical,I.patternPositions,S))}return this.status="done",{buckets:Object.values(a).filter((t=>!t.isEmpty())),featureIndex:o,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:A.image,imageAtlas:I,dashPositions:S,glyphMap:this.returnDependencies?b:null,iconMap:this.returnDependencies?w:null,glyphPositions:this.returnDependencies?A.positions:null}}))}}function Xd(t,e,r){const n=new Gi(e);for(const e of t)e.recalculate(n,r)}class Yd{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(t,e){this.loading[t]=e}finishLoading(t){delete this.loading[t]}abort(t){const e=this.loading[t];(null==e?void 0:e.abort)&&(e.abort.abort(),delete this.loading[t])}setParsing(t,e){this.parsing[t]=e}consumeParsing(t){const e=this.parsing[t];if(e)return delete this.parsing[t],e}clearParsing(t){delete this.parsing[t]}markLoaded(t,e){this.loaded[t]=e}getLoaded(t){const e=this.loaded[t];if(e)return e}removeLoaded(t){delete this.loaded[t]}clearLoaded(){this.loaded={}}}class Zd{constructor(t){this.maxEntries=t,this.map=new Map}get(t){const e=this.map.get(t);return void 0!==e&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){const t=this.map.keys().next().value;this.map.delete(t)}this.map.set(t,e)}clear(){this.map.clear()}}class Wd{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start)}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return 0===t.length&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}}class Hd{constructor(t,e,r,n,i){this.type=t,this.properties=r||{},this.extent=i,this.pointsArray=e,this.id=n}loadGeometry(){return this.pointsArray.map((t=>t.map((t=>new e(t.x,t.y)))))}}class Jd{constructor(t,e,r){this.version=2,this._myFeatures=t,this.name=e,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}}class Kd{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}}function Qd(t){let e=function(t,e=""){const r=new Gc;return function(t,e,r=""){for(const n in t.layers)e.writeMessage(3,((t,e)=>Uf(t,e,r)),t.layers[n])}(t,r,e),r.finish()}(t);return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength||(e=new Uint8Array(e)),{vectorTile:t,rawData:e.buffer}}function ty(t,e,r){const{extent:n}=t,i=Math.pow(2,r.z-e.z),s=(r.x-e.x*i)*n,o=(r.y-e.y*i)*n,a=[];for(let e=0;e<t.length;e++){const r=t.feature(e);let l=r.loadGeometry();for(const t of l)for(const e of t)e.x=e.x*i-s,e.y=e.y*i-o;const u=128;l=ad(l,r.type,-u,-u,n+u,n+u),0!==l.length&&a.push(new Hd(r.type,l,r.properties,r.id,n))}return new Jd(a,t.name,n)}class ey{constructor(t,e,r){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new Yd,this.overzoomedTileResultCache=new Zd(1e3)}loadVectorTile(t,e){try{return{vectorTile:"mlt"!==t.encoding?new Xl(new Gc(e)):new Lf(e),rawData:e}}catch(r){const n=new Uint8Array(e);let i=`Unable to parse the tile at ${t.request.url}, `;throw i+=31===n[0]&&139===n[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${f(r).message}`,new Error(i)}}loadTile(e){return t(this,void 0,void 0,(function*(){const{uid:t,overzoomParameters:r}=e;r&&(e.request=r.overzoomRequest);const n=this._startRequestTiming(e),i=new Gd(e);this.tileState.startLoading(t,i);const s=new AbortController;i.abort=s;try{const o=yield((t,e)=>hi(y(t,{type:"arrayBuffer"}),e))(e.request,s);if(e.etag&&e.etag===o.etag)return this.tileState.finishLoading(t),this._getEtagUnmodifiedResult(o,n);const a=this.loadVectorTile(e,o.data);if(this.tileState.finishLoading(t),!a)return null;let{vectorTile:l,rawData:u}=a;r&&({vectorTile:l,rawData:u}=this._getOverzoomTile(e,l));const c=this._getExpiryData(o),h=this._finishRequestTiming(n);i.vectorTile=l,this.tileState.markLoaded(t,i);const p={rawData:u,cacheControl:c,resourceTiming:h};this.tileState.setParsing(t,p);try{return yield this._parseWorkerTile(i,e,p)}finally{this.tileState.clearParsing(t)}}catch(e){throw this.tileState.finishLoading(t),i.status="done",this.tileState.markLoaded(t,i),e}}))}_getEtagUnmodifiedResult(t,e){return y({etagUnmodified:!0},this._getExpiryData(t),this._finishRequestTiming(e))}_parseWorkerTile(e,r,n){return t(this,void 0,void 0,(function*(){let t=yield e.parse(e.vectorTile,this.layerIndex,this.availableImages,this.actor,r.subdivisionGranularity);if(n){const{rawData:e,cacheControl:i,resourceTiming:s}=n;t=y({rawTileData:e.slice(0),encoding:r.encoding},t,i,s)}return t}))}_getExpiryData({expires:t,cacheControl:e,etag:r}){const n={};return t&&(n.expires=t),e&&(n.cacheControl=e),r&&(n.etag=r),n}_startRequestTiming(t){var e;if(null===(e=t.request)||void 0===e?void 0:e.collectResourceTiming)return new Wd(t.request.url)}_finishRequestTiming(t){const e=null==t?void 0:t.finish();return e?{resourceTiming:JSON.parse(JSON.stringify(e))}:{}}_getOverzoomTile(t,e){var r;const{tileID:n,source:i,overzoomParameters:s}=t,{maxZoomTileID:o}=s,a=`${o.key}_${n.key}_${null===(r=t.request)||void 0===r?void 0:r.url}`,l=this.overzoomedTileResultCache.get(a);if(l)return l;const u=new Kd,c=this.layerIndex.familiesBySource[i];for(const t in c){const r=e.layers[t];if(!r)continue;const i=ty(r,o,n.canonical);i.length>0&&u.addLayer(i)}const h=Qd(u);return this.overzoomedTileResultCache.set(a,h),h}reloadTile(e){return t(this,void 0,void 0,(function*(){const t=e.uid,r=this.tileState.getLoaded(t);if(!r)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.showCollisionBoxes=e.showCollisionBoxes,"parsing"===r.status){const n=this.tileState.consumeParsing(t);return yield this._parseWorkerTile(r,e,n)}if("done"===r.status&&r.vectorTile)return yield this._parseWorkerTile(r,e)}))}abortTile(e){return t(this,void 0,void 0,(function*(){this.tileState.abort(e.uid)}))}removeTile(e){return t(this,void 0,void 0,(function*(){this.tileState.removeLoaded(e.uid)}))}}class ry{constructor(){this.loaded={}}loadTile(e){return t(this,void 0,void 0,(function*(){const{uid:r,encoding:n,rawImageData:i,redFactor:s,greenFactor:o,blueFactor:u,baseShift:c}=e,h=i.width+2,p=i.height+2,f=_(i)?new za({width:h,height:p},yield function(e,r,n,i,s){return t(this,void 0,void 0,(function*(){if(function(){if(null==l&&(l=!1,null!=a||(a="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),a)){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 yield function(e,r,n,i,s){return t(this,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const t=new VideoFrame(e,{timestamp:0});try{const o=null==t?void 0:t.format;if(!o||!o.startsWith("BGR")&&!o.startsWith("RGB"))throw new Error(`Unrecognized format ${o}`);const a=o.startsWith("BGR"),l=new Uint8ClampedArray(i*s*4);if(yield t.copyTo(l,function(t,e,r,n,i){const s=4*Math.max(-e,0),o=(Math.max(0,r)-r)*n*4+s,a=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:o,stride:a}]}}(e,r,n,i,s)),a)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{t.close()}}))}(e,r,n,i,s)}catch(t){}return function(t,e,r,n,i){const s=t.width,o=t.height;S&&A||(S=new OffscreenCanvas(s,o),A=S.getContext("2d",{willReadFrequently:!0})),S.width=s,S.height=o,A.drawImage(t,0,0,s,o);const a=A.getImageData(e,r,n,i);return A.clearRect(0,0,s,o),a.data}(e,r,n,i,s)}))}(i,-1,-1,h,p)):i,d=new ja(r,f,n,s,o,u,c);return this.loaded||(this.loaded={}),this.loaded[r]=d,d}))}removeTile(t){const e=this.loaded,r=t.uid;(null==e?void 0:e[r])&&delete e[r]}}class ny{constructor(t,e,r,n=iy){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new Yd,this._createGeoJSONIndex=n}loadVectorTile(t){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const{z:e,x:r,y:n}=t.tileID.canonical,i=this._geoJSONIndex.getTile(e,r,n);return i?Qd(new Nf(i.features,{version:2,extent:p})):null}loadTile(e){return t(this,void 0,void 0,(function*(){const{uid:t}=e,r=new Gd(e);r.abort=new AbortController;try{const n=this.loadVectorTile(e);if(!n)return null;const{vectorTile:i,rawData:s}=n;r.vectorTile=i,this.tileState.markLoaded(t,r);const o={rawData:s};this.tileState.setParsing(t,o);try{return yield this._parseWorkerTile(r,e,o)}finally{this.tileState.clearParsing(t)}}catch(e){throw r.status="done",this.tileState.markLoaded(t,r),e}}))}_reloadLoadedTile(e){return t(this,void 0,void 0,(function*(){const t=e.uid,r=this.tileState.getLoaded(t);if(!r)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.showCollisionBoxes=e.showCollisionBoxes,"parsing"===r.status){const n=this.tileState.consumeParsing(t);return yield this._parseWorkerTile(r,e,n)}if("done"===r.status&&r.vectorTile)return yield this._parseWorkerTile(r,e)}))}_parseWorkerTile(e,r,n){return t(this,void 0,void 0,(function*(){let t=yield e.parse(e.vectorTile,this.layerIndex,this.availableImages,this.actor,r.subdivisionGranularity);if(n){const{rawData:e}=n;t=y({rawTileData:e.slice(0),encoding:"mvt"},t)}return t}))}abortTile(e){return t(this,void 0,void 0,(function*(){this.tileState.abort(e.uid)}))}removeTile(e){return t(this,void 0,void 0,(function*(){this.tileState.removeLoaded(e.uid)}))}loadData(e){return t(this,void 0,void 0,(function*(){var t;null===(t=this._pendingRequest)||void 0===t||t.abort();const r=this._startRequestTiming(e);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(e,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();const t={};return e.request&&(t.data=e.data),this._finishRequestTiming(r,e,t),t}catch(t){if(delete this._pendingRequest,!ii(t))throw t;return{abandoned:!0}}}))}_startRequestTiming(t){var e;if(null===(e=t.request)||void 0===e?void 0:e.collectResourceTiming)return new Wd(t.request.url)}_finishRequestTiming(t,e,r){const n=null==t?void 0:t.finish();n&&(r.resourceTiming={[e.source]:JSON.parse(JSON.stringify(n))})}reloadTile(t){return this.tileState.getLoaded(t.uid)?this._reloadLoadedTile(t):this.loadTile(t)}loadAndProcessGeoJSON(e,r){return t(this,void 0,void 0,(function*(){var t;if(e.request&&(e.data=(yield((t,e)=>hi(y(t,{type:"json"}),e))(e.request,r)).data),e.data)return e.data=this._filterGeoJSON(e.data,e.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(e.data,e));if(e.dataDiff)return null!==(t=this._geoJSONIndex)&&void 0!==t||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},e)),void this._geoJSONIndex.updateData(e.dataDiff,this._getFilterPredicate(e.filter));if(e.updateCluster&&this._geoJSONIndex.updateClusterOptions(e.geojsonVtOptions.cluster,sy(e)),null==this._geoJSONIndex)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(t,e){if("FeatureCollection"!==t.type)return t;const r=this._getFilterPredicate(e);return r?{type:"FeatureCollection",features:t.features.filter((t=>r(t)))}:t}_getFilterPredicate(t){if("boolean"!=typeof t&&!(null==t?void 0:t.length))return;const e=en(t,{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(", "));return t=>e.value.evaluate({zoom:0},t)}removeSource(e){return t(this,void 0,void 0,(function*(){var t;null===(t=this._pendingRequest)||void 0===t||t.abort()}))}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getClusterChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getClusterLeaves(t.clusterId,t.limit,t.offset)}}function iy(t,e){const r=y(e.geojsonVtOptions||{},{updateable:!0,clusterOptions:sy(e)});return new hc(t,r)}function sy({geojsonVtOptions:t,clusterProperties:e}){if(!e||!t.clusterOptions)return t.clusterOptions;const r={},n={},i={accumulated:null,zoom:0},s={properties:null},o=Object.keys(e);for(const t of o){const[i,s]=e[t],o=en(s),a=en("string"==typeof i?[i,["accumulated"],["get",t]]:i);r[t]=o.value,n[t]=a.value}return t.clusterOptions.map=t=>{s.properties=t;const e={};for(const t of o)e[t]=r[t].evaluate(i,s);return e},t.clusterOptions.reduce=(t,e)=>{s.properties=e;for(const e of o)i.accumulated=t[e],t[e]=n[e].evaluate(i,s)},t.clusterOptions}class oy{constructor(e){this.self=e,this.actor=new wi(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(t,e)=>{if(this.externalWorkerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.externalWorkerSourceTypes[t]=e},this.self.addProtocol=oi,this.self.removeProtocol=ai,this.self.registerRTLTextPlugin=t=>{ji.setMethods(t)},this.self.makeRequest=hi,this.actor.registerMessageHandler("LDT",((t,e)=>this._getDEMWorkerSource(t,e.source).loadTile(e))),this.actor.registerMessageHandler("RDT",((e,r)=>t(this,void 0,void 0,(function*(){this._getDEMWorkerSource(e,r.source).removeTile(r)})))),this.actor.registerMessageHandler("GCEZ",((e,r)=>t(this,void 0,void 0,(function*(){return this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)})))),this.actor.registerMessageHandler("GCC",((e,r)=>t(this,void 0,void 0,(function*(){return this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)})))),this.actor.registerMessageHandler("GCL",((e,r)=>t(this,void 0,void 0,(function*(){return this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)})))),this.actor.registerMessageHandler("LD",((t,e)=>this._getWorkerSource(t,e.type,e.source).loadData(e))),this.actor.registerMessageHandler("LT",((t,e)=>this._getWorkerSource(t,e.type,e.source).loadTile(e))),this.actor.registerMessageHandler("RT",((t,e)=>this._getWorkerSource(t,e.type,e.source).reloadTile(e))),this.actor.registerMessageHandler("AT",((t,e)=>this._getWorkerSource(t,e.type,e.source).abortTile(e))),this.actor.registerMessageHandler("RMT",((t,e)=>this._getWorkerSource(t,e.type,e.source).removeTile(e))),this.actor.registerMessageHandler("RS",((e,r)=>t(this,void 0,void 0,(function*(){var t,n;if(!(null===(n=null===(t=this.workerSources[e])||void 0===t?void 0:t[r.type])||void 0===n?void 0:n[r.source]))return;const i=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],void 0!==i.removeSource&&i.removeSource(r)})))),this.actor.registerMessageHandler("RM",(e=>t(this,void 0,void 0,(function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],this.globalStates.delete(e)})))),this.actor.registerMessageHandler("SR",((e,r)=>t(this,void 0,void 0,(function*(){this.referrer=r})))),this.actor.registerMessageHandler("SRPS",((t,e)=>this._syncRTLPluginState(t,e))),this.actor.registerMessageHandler("IS",((e,r)=>t(this,void 0,void 0,(function*(){this.self.importScripts(r)})))),this.actor.registerMessageHandler("SI",((t,e)=>this._setImages(t,e))),this.actor.registerMessageHandler("UL",((e,r)=>t(this,void 0,void 0,(function*(){this._getLayerIndex(e).update(r.layers,r.removedIds,this._getGlobalState(e))})))),this.actor.registerMessageHandler("UGS",((e,r)=>t(this,void 0,void 0,(function*(){const t=this._getGlobalState(e);for(const e in r)t[e]=r[e]})))),this.actor.registerMessageHandler("SL",((e,r)=>t(this,void 0,void 0,(function*(){this._getLayerIndex(e).replace(r,this._getGlobalState(e))}))))}_getGlobalState(t){let e=this.globalStates.get(t);return e||(e={},this.globalStates.set(t,e)),e}_setImages(e,r){return t(this,void 0,void 0,(function*(){this.availableImages[e]=r;for(const t in this.workerSources[e]){const n=this.workerSources[e][t];for(const t in n)n[t].availableImages=r}}))}_syncRTLPluginState(e,r){return t(this,void 0,void 0,(function*(){return yield ji.syncState(r,this.self.importScripts)}))}_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 Kf),e}_getWorkerSource(t,e,r){var n,i;if((n=this.workerSources)[t]||(n[t]={}),(i=this.workerSources[t])[e]||(i[e]={}),!this.workerSources[t][e][r]){const n={sendAsync:(e,r)=>(e.targetMapId=t,this.actor.sendAsync(e,r))};switch(e){case"vector":this.workerSources[t][e][r]=new ey(n,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][r]=new ny(n,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](n,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){var r,n;return(r=this.demWorkerSources)[t]||(r[t]={}),(n=this.demWorkerSources[t])[e]||(n[e]=new ry),this.demWorkerSources[t][e]}}return w(self)&&(self.worker=new oy(self)),oy}();
|
||
//# sourceMappingURL=maplibre-gl-csp-worker.js.map
|