wacomm 2.20.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var e=require("./rolldown-runtime-D_FWMvbo.js").t(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.maplibregl=r())})(e,(function(){"use strict";var e={},t={};function n(n,r,i){if(t[n]=i,n===`index`){var a=`var sharedModule = {}; (`+t.shared+`)(sharedModule); (`+t.worker+`)(sharedModule);`,o={};return t.shared(o),t.index(e,o),typeof window<`u`&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([a],{type:`text/javascript`}))),e}}return n(`shared`,[`exports`],(function(e){function t(e,t,n,r){return new(n||=Promise)((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var r=i;function i(e,t){this.x=e,this.y=t}i.prototype={clone:function(){return new i(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=r,this},_rotateAround:function(e,t){var n=Math.cos(e),r=Math.sin(e),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(e){return e instanceof i?e:Array.isArray(e)?new i(e[0],e[1]):e};var a=n(r),o=s;function s(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}s.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,r=0;r<8;r++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)<t)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n-=i/a}var o=0,s=1;for(n=e,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-e)<t));r++)e>i?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var c=n(o);let l,u;function d(){return l??=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)&&typeof createImageBitmap==`function`,l}function f(){if(u==null&&(u=!1,d())){let e=new OffscreenCanvas(5,5).getContext(`2d`,{willReadFrequently:!0});if(e){for(let t=0;t<25;t++){let n=4*t;e.fillStyle=`rgb(${n},${n+1},${n+2})`,e.fillRect(t%5,Math.floor(t/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let e=0;e<100;e++)if(e%4!=3&&t[e]!==e){u=!0;break}}}return u||!1}function p(e,t,n,r){let i=new c(e,t,n,r);return e=>i.solve(e)}let m=p(.25,.1,.25,1);function h(e,t,n){return Math.min(n,Math.max(t,e))}function g(e,t,n){let r=n-t,i=((e-t)%r+r)%r+t;return i===t?n:i}function _(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}let v=1;function y(e,t,n){let r={};for(let n in e)r[n]=t.call(this,e[n],n,e);return r}function b(e,t,n){let r={};for(let n in e)t.call(this,e[n],n,e)&&(r[n]=e[n]);return r}function x(e){return Array.isArray(e)?e.map(x):typeof e==`object`&&e?y(e,x):e}let S={};function C(e){S[e]||(typeof console<`u`&&console.warn(e),S[e]=!0)}function w(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}function T(e){return typeof WorkerGlobalScope<`u`&&e!==void 0&&e instanceof WorkerGlobalScope}let E=null;function D(e){return typeof ImageBitmap<`u`&&e instanceof ImageBitmap}let O=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=`;function k(e,n,r,i,a){return t(this,void 0,void 0,(function*(){if(typeof VideoFrame>`u`)throw Error(`VideoFrame not supported`);let t=new VideoFrame(e,{timestamp:0});try{let o=t?.format;if(!o||!o.startsWith(`BGR`)&&!o.startsWith(`RGB`))throw Error(`Unrecognized format ${o}`);let s=o.startsWith(`BGR`),c=new Uint8ClampedArray(i*a*4);if(yield t.copyTo(c,function(e,t,n,r,i){let a=4*Math.max(-t,0),o=(Math.max(0,n)-n)*r*4+a,s=4*r,c=Math.max(0,t),l=Math.max(0,n);return{rect:{x:c,y:l,width:Math.min(e.width,t+r)-c,height:Math.min(e.height,n+i)-l},layout:[{offset:o,stride:s}]}}(e,n,r,i,a)),s)for(let e=0;e<c.length;e+=4){let t=c[e];c[e]=c[e+2],c[e+2]=t}return c}finally{t.close()}}))}let A,j,ee=`AbortError`;function M(){return Error(ee)}let te={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:``};function ne(e){return te.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf(`://`))]}let re=`global-dispatcher`;class ie extends Error{constructor(e,t,n,r){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=r}}let ae=()=>T(self)?self.worker&&self.worker.referrer:(window.location.protocol===`blob:`?window.parent:window).location.href,oe=function(e,n){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){let t=ne(e.url);if(t)return t(e,n);if(T(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:`GR`,data:e,targetMapId:re},n)}if(!(/^file:/.test(r=e.url)||/^file:/.test(ae())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,`signal`))return function(e,n){return t(this,void 0,void 0,(function*(){let t=new Request(e.url,{method:e.method||`GET`,body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:ae(),signal:n.signal});e.type!==`json`||t.headers.has(`Accept`)||t.headers.set(`Accept`,`application/json`);let r=yield fetch(t);if(!r.ok){let t=yield r.blob();throw new ie(r.status,r.statusText,e.url,t)}let i;i=e.type===`arrayBuffer`||e.type===`image`?r.arrayBuffer():e.type===`json`?r.json():r.text();let a=yield i;if(n.signal.aborted)throw M();return{data:a,cacheControl:r.headers.get(`Cache-Control`),expires:r.headers.get(`Expires`)}}))}(e,n);if(T(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:`GR`,data:e,mustQueue:!0,targetMapId:re},n)}var r;return function(e,t){return new Promise(((n,r)=>{let i=new XMLHttpRequest;i.open(e.method||`GET`,e.url,!0),e.type!==`arrayBuffer`&&e.type!==`image`||(i.responseType=`arraybuffer`);for(let t in e.headers)i.setRequestHeader(t,e.headers[t]);e.type===`json`&&(i.responseType=`text`,e.headers?.Accept||i.setRequestHeader(`Accept`,`application/json`)),i.withCredentials=e.credentials===`include`,i.onerror=()=>{r(Error(i.statusText))},i.onload=()=>{if(!t.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let t=i.response;if(e.type===`json`)try{t=JSON.parse(i.response)}catch(e){r(e);return}n({data:t,cacheControl:i.getResponseHeader(`Cache-Control`),expires:i.getResponseHeader(`Expires`)})}else{let t=new Blob([i.response],{type:i.getResponseHeader(`Content-Type`)});r(new ie(i.status,i.statusText,e.url,t))}},t.signal.addEventListener(`abort`,(()=>{i.abort(),r(M())})),i.send(e.body)}))}(e,n)};function se(e){if(!e||e.indexOf(`://`)<=0||e.indexOf(`data:image/`)===0||e.indexOf(`blob:`)===0)return!0;let t=new URL(e),n=window.location;return t.protocol===n.protocol&&t.host===n.host}function ce(e,t,n){n[e]&&n[e].indexOf(t)!==-1||(n[e]=n[e]||[],n[e].push(t))}function le(e,t,n){if(n&&n[e]){let r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}class ue{constructor(e,t={}){_(this,t),this.type=e}}class de extends ue{constructor(e,t={}){super(`error`,_({error:e},t))}}class fe{on(e,t){return this._listeners=this._listeners||{},ce(e,t,this._listeners),this}off(e,t){return le(e,t,this._listeners),le(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},ce(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){typeof e==`string`&&(e=new ue(e,t||{}));let n=e.type;if(this.listens(n)){e.target=this;let t=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let n of t)n.call(this,e);let r=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let t of r)le(n,t,this._oneTimeListeners),t.call(this,e);let i=this._eventedParent;i&&(_(e,typeof this._eventedParentData==`function`?this._eventedParentData():this._eventedParentData),i.fire(e))}else e instanceof de&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var N={$version:8,$root:{version:{required:!0,type:`enum`,values:[8]},name:{type:`string`},metadata:{type:`*`},center:{type:`array`,value:`number`},zoom:{type:`number`},bearing:{type:`number`,default:0,period:360,units:`degrees`},pitch:{type:`number`,default:0,units:`degrees`},light:{type:`light`},sky:{type:`sky`},projection:{type:`projection`},terrain:{type:`terrain`},sources:{required:!0,type:`sources`},sprite:{type:`sprite`},glyphs:{type:`string`},transition:{type:`transition`},layers:{required:!0,type:`array`,value:`layer`}},sources:{"*":{type:`source`}},source:[`source_vector`,`source_raster`,`source_raster_dem`,`source_geojson`,`source_video`,`source_image`],source_vector:{type:{required:!0,type:`enum`,values:{vector:{}}},url:{type:`string`},tiles:{type:`array`,value:`string`},bounds:{type:`array`,value:`number`,length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:`enum`,values:{xyz:{},tms:{}},default:`xyz`},minzoom:{type:`number`,default:0},maxzoom:{type:`number`,default:22},attribution:{type:`string`},promoteId:{type:`promoteId`},volatile:{type:`boolean`,default:!1},"*":{type:`*`}},source_raster:{type:{required:!0,type:`enum`,values:{raster:{}}},url:{type:`string`},tiles:{type:`array`,value:`string`},bounds:{type:`array`,value:`number`,length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:`number`,default:0},maxzoom:{type:`number`,default:22},tileSize:{type:`number`,default:512,units:`pixels`},scheme:{type:`enum`,values:{xyz:{},tms:{}},default:`xyz`},attribution:{type:`string`},volatile:{type:`boolean`,default:!1},"*":{type:`*`}},source_raster_dem:{type:{required:!0,type:`enum`,values:{"raster-dem":{}}},url:{type:`string`},tiles:{type:`array`,value:`string`},bounds:{type:`array`,value:`number`,length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:`number`,default:0},maxzoom:{type:`number`,default:22},tileSize:{type:`number`,default:512,units:`pixels`},attribution:{type:`string`},encoding:{type:`enum`,values:{terrarium:{},mapbox:{},custom:{}},default:`mapbox`},redFactor:{type:`number`,default:1},blueFactor:{type:`number`,default:1},greenFactor:{type:`number`,default:1},baseShift:{type:`number`,default:0},volatile:{type:`boolean`,default:!1},"*":{type:`*`}},source_geojson:{type:{required:!0,type:`enum`,values:{geojson:{}}},data:{required:!0,type:`*`},maxzoom:{type:`number`,default:18},attribution:{type:`string`},buffer:{type:`number`,default:128,maximum:512,minimum:0},filter:{type:`*`},tolerance:{type:`number`,default:.375},cluster:{type:`boolean`,default:!1},clusterRadius:{type:`number`,default:50,minimum:0},clusterMaxZoom:{type:`number`},clusterMinPoints:{type:`number`},clusterProperties:{type:`*`},lineMetrics:{type:`boolean`,default:!1},generateId:{type:`boolean`,default:!1},promoteId:{type:`promoteId`}},source_video:{type:{required:!0,type:`enum`,values:{video:{}}},urls:{required:!0,type:`array`,value:`string`},coordinates:{required:!0,type:`array`,length:4,value:{type:`array`,length:2,value:`number`}}},source_image:{type:{required:!0,type:`enum`,values:{image:{}}},url:{required:!0,type:`string`},coordinates:{required:!0,type:`array`,length:4,value:{type:`array`,length:2,value:`number`}}},layer:{id:{type:`string`,required:!0},type:{type:`enum`,values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:`*`},source:{type:`string`},"source-layer":{type:`string`},minzoom:{type:`number`,minimum:0,maximum:24},maxzoom:{type:`number`,minimum:0,maximum:24},filter:{type:`filter`},layout:{type:`layout`},paint:{type:`paint`}},layout:[`layout_fill`,`layout_line`,`layout_circle`,`layout_heatmap`,`layout_fill-extrusion`,`layout_symbol`,`layout_raster`,`layout_hillshade`,`layout_background`],layout_background:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_fill:{"fill-sort-key":{type:`number`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_circle:{"circle-sort-key":{type:`number`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_heatmap:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},"layout_fill-extrusion":{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_line:{"line-cap":{type:`enum`,values:{butt:{},round:{},square:{}},default:`butt`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"line-join":{type:`enum`,values:{bevel:{},round:{},miter:{}},default:`miter`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"line-miter-limit":{type:`number`,default:2,requires:[{"line-join":`miter`}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"line-round-limit":{type:`number`,default:1.05,requires:[{"line-join":`round`}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"line-sort-key":{type:`number`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_symbol:{"symbol-placement":{type:`enum`,values:{point:{},line:{},"line-center":{}},default:`point`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"symbol-spacing":{type:`number`,default:250,minimum:1,units:`pixels`,requires:[{"symbol-placement":`line`}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"symbol-avoid-edges":{type:`boolean`,default:!1,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"symbol-sort-key":{type:`number`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"symbol-z-order":{type:`enum`,values:{auto:{},"viewport-y":{},source:{}},default:`auto`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-allow-overlap":{type:`boolean`,default:!1,requires:[`icon-image`,{"!":`icon-overlap`}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-overlap":{type:`enum`,values:{never:{},always:{},cooperative:{}},requires:[`icon-image`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-ignore-placement":{type:`boolean`,default:!1,requires:[`icon-image`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-optional":{type:`boolean`,default:!1,requires:[`icon-image`,`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-rotation-alignment":{type:`enum`,values:{map:{},viewport:{},auto:{}},default:`auto`,requires:[`icon-image`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-size":{type:`number`,default:1,minimum:0,units:`factor of the original icon size`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-text-fit":{type:`enum`,values:{none:{},width:{},height:{},both:{}},default:`none`,requires:[`icon-image`,`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-text-fit-padding":{type:`array`,value:`number`,length:4,default:[0,0,0,0],units:`pixels`,requires:[`icon-image`,`text-field`,{"icon-text-fit":[`both`,`width`,`height`]}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"icon-image":{type:`resolvedImage`,tokens:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-rotate":{type:`number`,default:0,period:360,units:`degrees`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-padding":{type:`padding`,default:[2],units:`pixels`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-keep-upright":{type:`boolean`,default:!1,requires:[`icon-image`,{"icon-rotation-alignment":`map`},{"symbol-placement":[`line`,`line-center`]}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-offset":{type:`array`,value:`number`,length:2,default:[0,0],requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-anchor":{type:`enum`,values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:`center`,requires:[`icon-image`],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-pitch-alignment":{type:`enum`,values:{map:{},viewport:{},auto:{}},default:`auto`,requires:[`icon-image`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-pitch-alignment":{type:`enum`,values:{map:{},viewport:{},auto:{}},default:`auto`,requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-rotation-alignment":{type:`enum`,values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:`auto`,requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-field":{type:`formatted`,default:``,tokens:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-font":{type:`array`,value:`string`,default:[`Open Sans Regular`,`Arial Unicode MS Regular`],requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-size":{type:`number`,default:16,minimum:0,units:`pixels`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-max-width":{type:`number`,default:10,minimum:0,units:`ems`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-line-height":{type:`number`,default:1.2,units:`ems`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"text-letter-spacing":{type:`number`,default:0,units:`ems`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-justify":{type:`enum`,values:{auto:{},left:{},center:{},right:{}},default:`center`,requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-radial-offset":{type:`number`,units:`ems`,default:0,requires:[`text-field`],"property-type":`data-driven`,expression:{interpolated:!0,parameters:[`zoom`,`feature`]}},"text-variable-anchor":{type:`array`,value:`enum`,values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:[`text-field`,{"symbol-placement":[`point`]}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-variable-anchor-offset":{type:`variableAnchorOffsetCollection`,requires:[`text-field`,{"symbol-placement":[`point`]}],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-anchor":{type:`enum`,values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:`center`,requires:[`text-field`,{"!":`text-variable-anchor`}],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-max-angle":{type:`number`,default:45,units:`degrees`,requires:[`text-field`,{"symbol-placement":[`line`,`line-center`]}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"text-writing-mode":{type:`array`,value:`enum`,values:{horizontal:{},vertical:{}},requires:[`text-field`,{"symbol-placement":[`point`]}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-rotate":{type:`number`,default:0,period:360,units:`degrees`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-padding":{type:`number`,default:2,minimum:0,units:`pixels`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"text-keep-upright":{type:`boolean`,default:!0,requires:[`text-field`,{"text-rotation-alignment":`map`},{"symbol-placement":[`line`,`line-center`]}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-transform":{type:`enum`,values:{none:{},uppercase:{},lowercase:{}},default:`none`,requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-offset":{type:`array`,value:`number`,units:`ems`,length:2,default:[0,0],requires:[`text-field`,{"!":`text-radial-offset`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-allow-overlap":{type:`boolean`,default:!1,requires:[`text-field`,{"!":`text-overlap`}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-overlap":{type:`enum`,values:{never:{},always:{},cooperative:{}},requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-ignore-placement":{type:`boolean`,default:!1,requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-optional":{type:`boolean`,default:!1,requires:[`text-field`,`icon-image`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_raster:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_hillshade:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},filter:{type:`array`,value:`*`},filter_operator:{type:`enum`,values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:`enum`,values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:`expression`},stops:{type:`array`,value:`function_stop`},base:{type:`number`,default:1,minimum:0},property:{type:`string`,default:`$zoom`},type:{type:`enum`,values:{identity:{},exponential:{},interval:{},categorical:{}},default:`exponential`},colorSpace:{type:`enum`,values:{rgb:{},lab:{},hcl:{}},default:`rgb`},default:{type:`*`,required:!1}},function_stop:{type:`array`,minimum:0,maximum:24,value:[`number`,`color`],length:2},expression:{type:`array`,value:`*`,minimum:1},light:{anchor:{type:`enum`,default:`viewport`,values:{map:{},viewport:{}},"property-type":`data-constant`,transition:!1,expression:{interpolated:!1,parameters:[`zoom`]}},position:{type:`array`,default:[1.15,210,30],length:3,value:`number`,"property-type":`data-constant`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]}},color:{type:`color`,"property-type":`data-constant`,default:`#ffffff`,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},intensity:{type:`number`,"property-type":`data-constant`,default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0}},sky:{"sky-color":{type:`color`,"property-type":`data-constant`,default:`#88C6FC`,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"horizon-color":{type:`color`,"property-type":`data-constant`,default:`#ffffff`,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"fog-color":{type:`color`,"property-type":`data-constant`,default:`#ffffff`,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"fog-ground-blend":{type:`number`,"property-type":`data-constant`,default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"horizon-fog-blend":{type:`number`,"property-type":`data-constant`,default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"sky-horizon-blend":{type:`number`,"property-type":`data-constant`,default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"atmosphere-blend":{type:`number`,"property-type":`data-constant`,default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0}},terrain:{source:{type:`string`,required:!0},exaggeration:{type:`number`,minimum:0,default:1}},projection:{type:{type:`enum`,default:`mercator`,values:{mercator:{},globe:{}}}},paint:[`paint_fill`,`paint_line`,`paint_circle`,`paint_heatmap`,`paint_fill-extrusion`,`paint_symbol`,`paint_raster`,`paint_hillshade`,`paint_background`],paint_fill:{"fill-antialias":{type:`boolean`,default:!0,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"fill-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`fill-pattern`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-outline-color":{type:`color`,transition:!0,requires:[{"!":`fill-pattern`},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"fill-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`fill-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"fill-pattern":{type:`resolvedImage`,transition:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`cross-faded-data-driven`}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"fill-extrusion-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`fill-extrusion-pattern`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-extrusion-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"fill-extrusion-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`fill-extrusion-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"fill-extrusion-pattern":{type:`resolvedImage`,transition:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`cross-faded-data-driven`},"fill-extrusion-height":{type:`number`,default:0,minimum:0,units:`meters`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-extrusion-base":{type:`number`,default:0,minimum:0,units:`meters`,transition:!0,requires:[`fill-extrusion-height`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-extrusion-vertical-gradient":{type:`boolean`,default:!0,transition:!1,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`}},paint_line:{"line-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`line-pattern`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"line-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`line-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"line-width":{type:`number`,default:1,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-gap-width":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-offset":{type:`number`,default:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-blur":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-dasharray":{type:`array`,value:`number`,minimum:0,transition:!0,units:`line widths`,requires:[{"!":`line-pattern`}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`cross-faded`},"line-pattern":{type:`resolvedImage`,transition:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`cross-faded-data-driven`},"line-gradient":{type:`color`,transition:!1,requires:[{"!":`line-dasharray`},{"!":`line-pattern`},{source:`geojson`,has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:[`line-progress`]},"property-type":`color-ramp`}},paint_circle:{"circle-radius":{type:`number`,default:5,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-color":{type:`color`,default:`#000000`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-blur":{type:`number`,default:0,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"circle-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`circle-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"circle-pitch-scale":{type:`enum`,values:{map:{},viewport:{}},default:`map`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"circle-pitch-alignment":{type:`enum`,values:{map:{},viewport:{}},default:`viewport`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"circle-stroke-width":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-stroke-color":{type:`color`,default:`#000000`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-stroke-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`}},paint_heatmap:{"heatmap-radius":{type:`number`,default:30,minimum:1,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"heatmap-weight":{type:`number`,default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"heatmap-intensity":{type:`number`,default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"heatmap-color":{type:`color`,default:[`interpolate`,[`linear`],[`heatmap-density`],0,`rgba(0, 0, 255, 0)`,.1,`royalblue`,.3,`cyan`,.5,`lime`,.7,`yellow`,1,`red`],transition:!1,expression:{interpolated:!0,parameters:[`heatmap-density`]},"property-type":`color-ramp`},"heatmap-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`}},paint_symbol:{"icon-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"icon-color":{type:`color`,default:`#000000`,transition:!0,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"icon-halo-color":{type:`color`,default:`rgba(0, 0, 0, 0)`,transition:!0,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"icon-halo-width":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"icon-halo-blur":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"icon-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"icon-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`icon-image`,`icon-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"text-color":{type:`color`,default:`#000000`,transition:!0,overridable:!0,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"text-halo-color":{type:`color`,default:`rgba(0, 0, 0, 0)`,transition:!0,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"text-halo-width":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"text-halo-blur":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"text-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"text-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`text-field`,`text-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`}},paint_raster:{"raster-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-hue-rotate":{type:`number`,default:0,period:360,transition:!0,units:`degrees`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-brightness-min":{type:`number`,default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-brightness-max":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-saturation":{type:`number`,default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-contrast":{type:`number`,default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-resampling":{type:`enum`,values:{linear:{},nearest:{}},default:`linear`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"raster-fade-duration":{type:`number`,default:300,minimum:0,transition:!1,units:`milliseconds`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`}},paint_hillshade:{"hillshade-illumination-direction":{type:`number`,default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-illumination-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`viewport`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-exaggeration":{type:`number`,default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-shadow-color":{type:`color`,default:`#000000`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-highlight-color":{type:`color`,default:`#FFFFFF`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-accent-color":{type:`color`,default:`#000000`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`}},paint_background:{"background-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`background-pattern`}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"background-pattern":{type:`resolvedImage`,transition:!0,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`cross-faded`},"background-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`}},transition:{duration:{type:`number`,default:300,minimum:0,units:`milliseconds`},delay:{type:`number`,default:0,minimum:0,units:`milliseconds`}},"property-type":{"data-driven":{type:`property-type`},"cross-faded":{type:`property-type`},"cross-faded-data-driven":{type:`property-type`},"color-ramp":{type:`property-type`},"data-constant":{type:`property-type`},constant:{type:`property-type`}},promoteId:{"*":{type:`string`}}};let pe=[`type`,`source`,`source-layer`,`minzoom`,`maxzoom`,`filter`,`layout`];function me(e,t){let n={};for(let t in e)t!==`ref`&&(n[t]=e[t]);return pe.forEach((e=>{e in t&&(n[e]=t[e])})),n}function P(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!P(e[n],t[n]))return!1;return!0}if(typeof e==`object`&&e&&t!==null){if(typeof t!=`object`||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(!P(e[n],t[n]))return!1;return!0}return e===t}function he(e,t){e.push(t)}function ge(e,t,n){he(n,{command:`addSource`,args:[e,t[e]]})}function _e(e,t,n){he(t,{command:`removeSource`,args:[e]}),n[e]=!0}function ve(e,t,n,r){_e(e,n,r),ge(e,t,n)}function ye(e,t,n){let r;for(r in e[n])if(Object.prototype.hasOwnProperty.call(e[n],r)&&r!==`data`&&!P(e[n][r],t[n][r]))return!1;for(r in t[n])if(Object.prototype.hasOwnProperty.call(t[n],r)&&r!==`data`&&!P(e[n][r],t[n][r]))return!1;return!0}function be(e,t,n,r,i,a){e||={},t||={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(P(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}));for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&!Object.prototype.hasOwnProperty.call(e,o)&&(P(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}))}function xe(e){return e.id}function Se(e,t){return e[t.id]=t,e}class F{constructor(e,t,n,r){this.message=(e?`${e}: `:``)+n,r&&(this.identifier=r),t!=null&&t.__line__&&(this.line=t.__line__)}}function Ce(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}class we extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Te{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[e,n]of t)this.bindings[e]=n}concat(e){return new Te(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let Ee={kind:`null`},I={kind:`number`},L={kind:`string`},R={kind:`boolean`},De={kind:`color`},Oe={kind:`object`},z={kind:`value`},ke={kind:`collator`},Ae={kind:`formatted`},je={kind:`padding`},Me={kind:`resolvedImage`},Ne={kind:`variableAnchorOffsetCollection`};function Pe(e,t){return{kind:`array`,itemType:e,N:t}}function Fe(e){if(e.kind===`array`){let t=Fe(e.itemType);return typeof e.N==`number`?`array<${t}, ${e.N}>`:e.itemType.kind===`value`?`array`:`array<${t}>`}return e.kind}let Ie=[Ee,I,L,R,De,Ae,Oe,Pe(z),je,Me,Ne];function Le(e,t){if(t.kind===`error`)return null;if(e.kind===`array`){if(t.kind===`array`&&(t.N===0&&t.itemType.kind===`value`||!Le(e.itemType,t.itemType))&&(typeof e.N!=`number`||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind===`value`){for(let e of Ie)if(!Le(e,t))return null}}return`Expected ${Fe(e)} but found ${Fe(t)} instead.`}function Re(e,t){return t.some((t=>t.kind===e.kind))}function ze(e,t){return t.some((t=>t===`null`?e===null:t===`array`?Array.isArray(e):t===`object`?e&&!Array.isArray(e)&&typeof e==`object`:t===typeof e))}function Be(e,t){return e.kind===`array`&&t.kind===`array`?e.itemType.kind===t.itemType.kind&&typeof e.N==`number`:e.kind===t.kind}let Ve=.96422,He=.82521,Ue=4/29,We=6/29,Ge=3*We*We,Ke=Math.PI/180,qe=180/Math.PI;function Je(e){return(e%=360)<0&&(e+=360),e}function Ye([e,t,n,r]){let i,a,o=Ze((.2225045*(e=Xe(e))+.7168786*(t=Xe(t))+.0606169*(n=Xe(n)))/1);e===t&&t===n?i=a=o:(i=Ze((.4360747*e+.3850649*t+.1430804*n)/Ve),a=Ze((.0139322*e+.0971045*t+.7141733*n)/He));let s=116*o-16;return[s<0?0:s,500*(i-o),200*(o-a),r]}function Xe(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Ze(e){return e>.008856451679035631?e**(1/3):e/Ge+Ue}function Qe([e,t,n,r]){let i=(e+16)/116,a=isNaN(t)?i:i+t/500,o=isNaN(n)?i:i-n/200;return i=1*et(i),a=Ve*et(a),o=He*et(o),[$e(3.1338561*a-1.6168667*i-.4906146*o),$e(-.9787684*a+1.9161415*i+.033454*o),$e(.0719453*a-.2289914*i+1.4052427*o),r]}function $e(e){return(e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055)<0?0:e>1?1:e}function et(e){return e>We?e*e*e:Ge*(e-Ue)}function tt(e){return parseInt(e.padEnd(2,e),16)/255}function nt(e,t){return rt(t?e/100:e,0,1)}function rt(e,t,n){return Math.min(Math.max(t,e),n)}function it(e){return!e.some(Number.isNaN)}let at={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class B{constructor(e,t,n,r=1,i=!0){this.r=e,this.g=t,this.b=n,this.a=r,i||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter(`rgb`,[e,t,n,r]))}static parse(e){if(e instanceof B)return e;if(typeof e!=`string`)return;let t=function(e){if((e=e.toLowerCase().trim())===`transparent`)return[0,0,0,0];let t=at[e];if(t){let[e,n,r]=t;return[e/255,n/255,r/255,1]}if(e.startsWith(`#`)&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let t=e.length<6?1:2,n=1;return[tt(e.slice(n,n+=t)),tt(e.slice(n,n+=t)),tt(e.slice(n,n+=t)),tt(e.slice(n,n+t)||`ff`)]}if(e.startsWith(`rgb`)){let t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){let[e,n,r,i,a,o,s,c,l,u,d,f]=t,p=[i||` `,s||` `,u].join(``);if(p===` `||p===` /`||p===`,,`||p===`,,,`){let e=[r,o,l].join(``),t=e===`%%%`?100:e===``?255:0;if(t){let e=[rt(+n/t,0,1),rt(+a/t,0,1),rt(+c/t,0,1),d?nt(+d,f):1];if(it(e))return e}}return}}let n=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){let[e,t,r,i,a,o,s,c,l]=n,u=[r||` `,a||` `,s].join(``);if(u===` `||u===` /`||u===`,,`||u===`,,,`){let e=[+t,rt(+i,0,100),rt(+o,0,100),c?nt(+c,l):1];if(it(e))return function([e,t,n,r]){function i(r){let i=(r+e/30)%12,a=t*Math.min(n,1-n);return n-a*Math.max(-1,Math.min(i-3,9-i,1))}return e=Je(e),t/=100,n/=100,[i(0),i(8),i(4),r]}(e)}}}(e);return t?new B(...t,!1):void 0}get rgb(){let{r:e,g:t,b:n,a:r}=this,i=r||1/0;return this.overwriteGetter(`rgb`,[e/i,t/i,n/i,r])}get hcl(){return this.overwriteGetter(`hcl`,function(e){let[t,n,r,i]=Ye(e),a=Math.sqrt(n*n+r*r);return[Math.round(1e4*a)?Je(Math.atan2(r,n)*qe):NaN,a,t,i]}(this.rgb))}get lab(){return this.overwriteGetter(`lab`,Ye(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,n,r]=this.rgb;return`rgba(${[e,t,n].map((e=>Math.round(255*e))).join(`,`)},${r})`}}B.black=new B(0,0,0,1),B.white=new B(1,1,1,1),B.transparent=new B(0,0,0,0),B.red=new B(1,0,0,1);class ot{constructor(e,t,n){this.sensitivity=e?t?`variant`:`case`:t?`accent`:`base`,this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:`search`})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class st{constructor(e,t,n,r,i){this.text=e,this.image=t,this.scale=n,this.fontStack=r,this.textColor=i}}class ct{constructor(e){this.sections=e}static fromString(e){return new ct([new st(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof ct?e:ct.fromString(e)}toString(){return this.sections.length===0?``:this.sections.map((e=>e.text)).join(``)}}class lt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof lt)return e;if(typeof e==`number`)return new lt([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if(typeof t!=`number`)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new lt(e)}}toString(){return JSON.stringify(this.values)}}let ut=new Set([`center`,`left`,`right`,`top`,`bottom`,`top-left`,`top-right`,`bottom-left`,`bottom-right`]);class dt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof dt)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){let n=e[t],r=e[t+1];if(typeof n!=`string`||!ut.has(n)||!Array.isArray(r)||r.length!==2||typeof r[0]!=`number`||typeof r[1]!=`number`)return}return new dt(e)}}toString(){return JSON.stringify(this.values)}}class ft{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new ft({name:e,available:!1}):null}}function pt(e,t,n,r){return typeof e==`number`&&e>=0&&e<=255&&typeof t==`number`&&t>=0&&t<=255&&typeof n==`number`&&n>=0&&n<=255?r===void 0||typeof r==`number`&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,n,r].join(`, `)}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r==`number`?[e,t,n,r]:[e,t,n]).join(`, `)}]: 'r', 'g', and 'b' must be between 0 and 255.`}function mt(e){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`||e instanceof B||e instanceof ot||e instanceof ct||e instanceof lt||e instanceof dt||e instanceof ft)return!0;if(Array.isArray(e)){for(let t of e)if(!mt(t))return!1;return!0}if(typeof e==`object`){for(let t in e)if(!mt(e[t]))return!1;return!0}return!1}function ht(e){if(e===null)return Ee;if(typeof e==`string`)return L;if(typeof e==`boolean`)return R;if(typeof e==`number`)return I;if(e instanceof B)return De;if(e instanceof ot)return ke;if(e instanceof ct)return Ae;if(e instanceof lt)return je;if(e instanceof dt)return Ne;if(e instanceof ft)return Me;if(Array.isArray(e)){let t=e.length,n;for(let t of e){let e=ht(t);if(n){if(n===e)continue;n=z;break}n=e}return Pe(n||z,t)}return Oe}function gt(e){let t=typeof e;return e===null?``:t===`string`||t===`number`||t===`boolean`?String(e):e instanceof B||e instanceof ct||e instanceof lt||e instanceof dt||e instanceof ft?e.toString():JSON.stringify(e)}class _t{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!mt(e[1]))return t.error(`invalid value`);let n=e[1],r=ht(n),i=t.expectedType;return r.kind!==`array`||r.N!==0||!i||i.kind!==`array`||typeof i.N==`number`&&i.N!==0||(r=i),new _t(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class vt{constructor(e){this.name=`ExpressionEvaluationError`,this.message=e}toJSON(){return this.message}}let yt={string:L,number:I,boolean:R,object:Oe};class bt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n,r=1,i=e[0];if(i===`array`){let i,a;if(e.length>2){let n=e[1];if(typeof n!=`string`||!(n in yt)||n===`object`)return t.error(`The item type argument of "array" must be one of string, number, boolean`,1);i=yt[n],r++}else i=z;if(e.length>3){if(e[2]!==null&&(typeof e[2]!=`number`||e[2]<0||e[2]!==Math.floor(e[2])))return t.error(`The length argument to "array" must be a positive integer literal`,2);a=e[2],r++}n=Pe(i,a)}else{if(!yt[i])throw Error(`Types doesn't contain name = ${i}`);n=yt[i]}let a=[];for(;r<e.length;r++){let n=t.parse(e[r],r,z);if(!n)return null;a.push(n)}return new bt(n,a)}evaluate(e){for(let t=0;t<this.args.length;t++){let n=this.args[t].evaluate(e);if(!Le(this.type,ht(n)))return n;if(t===this.args.length-1)throw new vt(`Expected value to be of type ${Fe(this.type)}, but found ${Fe(ht(n))} instead.`)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let xt={"to-boolean":R,"to-color":De,"to-number":I,"to-string":L};class St{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[0];if(!xt[n])throw Error(`Can't parse ${n} as it is not part of the known types`);if((n===`to-boolean`||n===`to-string`)&&e.length!==2)return t.error(`Expected one argument.`);let r=xt[n],i=[];for(let n=1;n<e.length;n++){let r=t.parse(e[n],n,z);if(!r)return null;i.push(r)}return new St(r,i)}evaluate(e){switch(this.type.kind){case`boolean`:return!!this.args[0].evaluate(e);case`color`:{let t,n;for(let r of this.args){if(t=r.evaluate(e),n=null,t instanceof B)return t;if(typeof t==`string`){let n=e.parseColor(t);if(n)return n}else if(Array.isArray(t)&&(n=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:pt(t[0],t[1],t[2],t[3]),!n))return new B(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new vt(n||`Could not parse color from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`padding`:{let t;for(let n of this.args){t=n.evaluate(e);let r=lt.parse(t);if(r)return r}throw new vt(`Could not parse padding from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`variableAnchorOffsetCollection`:{let t;for(let n of this.args){t=n.evaluate(e);let r=dt.parse(t);if(r)return r}throw new vt(`Could not parse variableAnchorOffsetCollection from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`number`:{let t=null;for(let n of this.args){if(t=n.evaluate(e),t===null)return 0;let r=Number(t);if(!isNaN(r))return r}throw new vt(`Could not convert ${JSON.stringify(t)} to number.`)}case`formatted`:return ct.fromString(gt(this.args[0].evaluate(e)));case`resolvedImage`:return ft.fromString(gt(this.args[0].evaluate(e)));default:return gt(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let Ct=[`Unknown`,`Point`,`LineString`,`Polygon`];class V{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&`id`in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type==`number`?Ct[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&`geometry`in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache[e];return t||=this._parseColorCache[e]=B.parse(e),t}}class wt{constructor(e,t,n=[],r,i=new Te,a=[]){this.registry=e,this.path=n,this.key=n.map((e=>`[${e}]`)).join(``),this.scope=i,this.errors=a,this.expectedType=r,this._isConstant=t}parse(e,t,n,r,i={}){return t?this.concat(t,n,r)._parse(e,i):this._parse(e,i)}_parse(e,t){function n(e,t,n){return n===`assert`?new bt(t,[e]):n===`coerce`?new St(t,[e]):e}if(e!==null&&typeof e!=`string`&&typeof e!=`boolean`&&typeof e!=`number`||(e=[`literal`,e]),Array.isArray(e)){if(e.length===0)return this.error(`Expected an array with at least one element. If you wanted a literal array, use ["literal", []].`);let r=e[0];if(typeof r!=`string`)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let i=this.registry[r];if(i){let r=i.parse(e,this);if(!r)return null;if(this.expectedType){let e=this.expectedType,i=r.type;if(e.kind!==`string`&&e.kind!==`number`&&e.kind!==`boolean`&&e.kind!==`object`&&e.kind!==`array`||i.kind!==`value`)if(e.kind!==`color`&&e.kind!==`formatted`&&e.kind!==`resolvedImage`||i.kind!==`value`&&i.kind!==`string`)if(e.kind!==`padding`||i.kind!==`value`&&i.kind!==`number`&&i.kind!==`array`)if(e.kind!==`variableAnchorOffsetCollection`||i.kind!==`value`&&i.kind!==`array`){if(this.checkSubtype(e,i))return null}else r=n(r,e,t.typeAnnotation||`coerce`);else r=n(r,e,t.typeAnnotation||`coerce`);else r=n(r,e,t.typeAnnotation||`coerce`);else r=n(r,e,t.typeAnnotation||`assert`)}if(!(r instanceof _t)&&r.type.kind!==`resolvedImage`&&this._isConstant(r)){let e=new V;try{r=new _t(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?`'undefined' value invalid. Use null instead.`:typeof e==`object`?`Bare objects invalid. Use ["literal", {...}] instead.`:`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){let r=typeof e==`number`?this.path.concat(e):this.path,i=n?this.scope.concat(n):this.scope;return new wt(this.registry,this._isConstant,r,t||null,i,this.errors)}error(e,...t){let n=`${this.key}${t.map((e=>`[${e}]`)).join(``)}`;this.errors.push(new we(n,e))}checkSubtype(e,t){let n=Le(e,t);return n&&this.error(n),n}}class Tt{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let r=1;r<e.length-1;r+=2){let i=e[r];if(typeof i!=`string`)return t.error(`Expected string, but found ${typeof i} instead.`,r);if(/[^a-zA-Z0-9_]/.test(i))return t.error(`Variable names must contain only alphanumeric characters or '_'.`,r);let a=t.parse(e[r+1],r+1);if(!a)return null;n.push([i,a])}let r=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return r?new Tt(n,r):null}outputDefined(){return this.result.outputDefined()}}class Et{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!=`string`)return t.error(`'var' expression requires exactly one string literal argument.`);let n=e[1];return t.scope.has(n)?new Et(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Dt{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,I),r=t.parse(e[2],2,Pe(t.expectedType||z));return n&&r?new Dt(r.type.itemType,n,r):null}evaluate(e){let t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new vt(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new vt(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new vt(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Ot{constructor(e,t){this.type=R,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,z);return n&&r?Re(n.type,[R,L,I,Ee,z])?new Ot(n,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(n.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!ze(t,[`boolean`,`string`,`number`,`null`]))throw new vt(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(ht(t))} instead.`);if(!ze(n,[`string`,`array`]))throw new vt(`Expected second argument to be of type array or string, but found ${Fe(ht(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class kt{constructor(e,t,n){this.type=I,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,z);if(!n||!r)return null;if(!Re(n.type,[R,L,I,Ee,z]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,I);return i?new kt(n,r,i):null}return new kt(n,r)}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!ze(t,[`boolean`,`string`,`number`,`null`]))throw new vt(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(ht(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),ze(n,[`string`])){let e=n.indexOf(t,r);return e===-1?-1:[...n.slice(0,e)].length}if(ze(n,[`array`]))return n.indexOf(t,r);throw new vt(`Expected second argument to be of type array or string, but found ${Fe(ht(n))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class At{constructor(e,t,n,r,i,a){this.inputType=e,this.type=t,this.input=n,this.cases=r,this.outputs=i,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error(`Expected an even number of arguments.`);let n,r;t.expectedType&&t.expectedType.kind!==`value`&&(r=t.expectedType);let i={},a=[];for(let o=2;o<e.length-1;o+=2){let s=e[o],c=e[o+1];Array.isArray(s)||(s=[s]);let l=t.concat(o);if(s.length===0)return l.error(`Expected at least one branch label.`);for(let e of s){if(typeof e!=`number`&&typeof e!=`string`)return l.error(`Branch labels must be numbers or strings.`);if(typeof e==`number`&&Math.abs(e)>2**53-1)return l.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof e==`number`&&Math.floor(e)!==e)return l.error(`Numeric branch labels must be integer values.`);if(n){if(l.checkSubtype(n,ht(e)))return null}else n=ht(e);if(i[String(e)]!==void 0)return l.error(`Branch labels must be unique.`);i[String(e)]=a.length}let u=t.parse(c,o,r);if(!u)return null;r||=u.type,a.push(u)}let o=t.parse(e[1],1,z);if(!o)return null;let s=t.parse(e[e.length-1],e.length-1,r);return s?o.type.kind!==`value`&&t.concat(1).checkSubtype(n,o.type)?null:new At(n,r,o,i,a,s):null}evaluate(e){let t=this.input.evaluate(e);return(ht(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class jt{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error(`Expected an odd number of arguments.`);let n;t.expectedType&&t.expectedType.kind!==`value`&&(n=t.expectedType);let r=[];for(let i=1;i<e.length-1;i+=2){let a=t.parse(e[i],i,R);if(!a)return null;let o=t.parse(e[i+1],i+1,n);if(!o)return null;r.push([a,o]),n||=o.type}let i=t.parse(e[e.length-1],e.length-1,n);if(!i)return null;if(!n)throw Error(`Can't infer output type`);return new jt(n,r,i)}evaluate(e){for(let[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}}class Mt{constructor(e,t,n,r){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,I);if(!n||!r)return null;if(!Re(n.type,[Pe(z),L,z]))return t.error(`Expected first argument to be of type array or string, but found ${Fe(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,I);return i?new Mt(n.type,n,r,i):null}return new Mt(n.type,n,r)}evaluate(e){let t=this.input.evaluate(e),n=this.beginIndex.evaluate(e),r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),ze(t,[`string`]))return[...t].slice(n,r).join(``);if(ze(t,[`array`]))return t.slice(n,r);throw new vt(`Expected first argument to be of type array or string, but found ${Fe(ht(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Nt(e,t){let n=e.length-1,r,i,a=0,o=n,s=0;for(;a<=o;)if(s=Math.floor((a+o)/2),r=e[s],i=e[s+1],r<=t){if(s===n||t<i)return s;a=s+1}else{if(!(r>t))throw new vt(`Input is not a number.`);o=s-1}return 0}class Pt{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[e,t]of n)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);let n=t.parse(e[1],1,I);if(!n)return null;let r=[],i=null;t.expectedType&&t.expectedType.kind!==`value`&&(i=t.expectedType);for(let n=1;n<e.length;n+=2){let a=n===1?-1/0:e[n],o=e[n+1],s=n,c=n+1;if(typeof a!=`number`)return t.error(`Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.`,s);if(r.length&&r[r.length-1][0]>=a)return t.error(`Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.`,s);let l=t.parse(o,c,i);if(!l)return null;i||=l.type,r.push([a,l])}return new Pt(i,n,r)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;return r>=t[i-1]?n[i-1].evaluate(e):n[Nt(t,r)].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Ft(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var It=Lt;function Lt(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}Lt.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,r=0;r<8;r++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)<t)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n-=i/a}var o=0,s=1;for(n=e,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-e)<t));r++)e>i?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var Rt=Ft(It);function zt(e,t,n){return e+n*(t-e)}function Bt(e,t,n){return e.map(((e,r)=>zt(e,t[r],n)))}let Vt={number:zt,color:function(e,t,n,r=`rgb`){switch(r){case`rgb`:{let[r,i,a,o]=Bt(e.rgb,t.rgb,n);return new B(r,i,a,o,!1)}case`hcl`:{let[r,i,a,o]=e.hcl,[s,c,l,u]=t.hcl,d,f;if(isNaN(r)||isNaN(s))isNaN(r)?isNaN(s)?d=NaN:(d=s,a!==1&&a!==0||(f=c)):(d=r,l!==1&&l!==0||(f=i));else{let e=s-r;s>r&&e>180?e-=360:s<r&&r-s>180&&(e+=360),d=r+n*e}let[p,m,h,g]=function([e,t,n,r]){return e=isNaN(e)?0:e*Ke,Qe([n,Math.cos(e)*t,Math.sin(e)*t,r])}([d,f??zt(i,c,n),zt(a,l,n),zt(o,u,n)]);return new B(p,m,h,g,!1)}case`lab`:{let[r,i,a,o]=Qe(Bt(e.lab,t.lab,n));return new B(r,i,a,o,!1)}}},array:Bt,padding:function(e,t,n){return new lt(Bt(e.values,t.values,n))},variableAnchorOffsetCollection:function(e,t,n){let r=e.values,i=t.values;if(r.length!==i.length)throw new vt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);let a=[];for(let e=0;e<r.length;e+=2){if(r[e]!==i[e])throw new vt(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${r[e]}, to[${e}]: ${i[e]}`);a.push(r[e]);let[t,o]=r[e+1],[s,c]=i[e+1];a.push([zt(t,s,n),zt(o,c,n)])}return new dt(a)}};class Ht{constructor(e,t,n,r,i){this.type=e,this.operator=t,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(let[e,t]of i)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,n,r){let i=0;if(e.name===`exponential`)i=Ut(t,e.base,n,r);else if(e.name===`linear`)i=Ut(t,1,n,r);else if(e.name===`cubic-bezier`){let a=e.controlPoints;i=new Rt(a[0],a[1],a[2],a[3]).solve(Ut(t,1,n,r))}return i}static parse(e,t){let[n,r,i,...a]=e;if(!Array.isArray(r)||r.length===0)return t.error(`Expected an interpolation type expression.`,1);if(r[0]===`linear`)r={name:`linear`};else if(r[0]===`exponential`){let e=r[1];if(typeof e!=`number`)return t.error(`Exponential interpolation requires a numeric base.`,1,1);r={name:`exponential`,base:e}}else{if(r[0]!==`cubic-bezier`)return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{let e=r.slice(1);if(e.length!==4||e.some((e=>typeof e!=`number`||e<0||e>1)))return t.error(`Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.`,1);r={name:`cubic-bezier`,controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);if(i=t.parse(i,2,I),!i)return null;let o=[],s=null;n===`interpolate-hcl`||n===`interpolate-lab`?s=De:t.expectedType&&t.expectedType.kind!==`value`&&(s=t.expectedType);for(let e=0;e<a.length;e+=2){let n=a[e],r=a[e+1],i=e+3,c=e+4;if(typeof n!=`number`)return t.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]>=n)return t.error(`Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.`,i);let l=t.parse(r,c,s);if(!l)return null;s||=l.type,o.push([n,l])}return Be(s,I)||Be(s,De)||Be(s,je)||Be(s,Ne)||Be(s,Pe(I))?new Ht(s,n,r,i,o):t.error(`Type ${Fe(s)} is not interpolatable.`)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;if(r>=t[i-1])return n[i-1].evaluate(e);let a=Nt(t,r),o=Ht.interpolationFactor(this.interpolation,r,t[a],t[a+1]),s=n[a].evaluate(e),c=n[a+1].evaluate(e);switch(this.operator){case`interpolate`:return Vt[this.type.kind](s,c,o);case`interpolate-hcl`:return Vt.color(s,c,o,`hcl`);case`interpolate-lab`:return Vt.color(s,c,o,`lab`)}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Ut(e,t,n,r){let i=r-n,a=e-n;return i===0?0:t===1?a/i:(t**+a-1)/(t**+i-1)}class Wt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expectected at least one argument.`);let n=null,r=t.expectedType;r&&r.kind!==`value`&&(n=r);let i=[];for(let r of e.slice(1)){let e=t.parse(r,1+i.length,n,void 0,{typeAnnotation:`omit`});if(!e)return null;n||=e.type,i.push(e)}if(!n)throw Error(`No output type`);let a=r&&i.some((e=>Le(r,e.type)));return new Wt(a?z:n,i)}evaluate(e){let t,n=null,r=0;for(let i of this.args)if(r++,n=i.evaluate(e),n&&n instanceof ft&&!n.available&&(t||=n.name,n=null,r===this.args.length&&(n=t)),n!==null)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Gt(e,t){return e===`==`||e===`!=`?t.kind===`boolean`||t.kind===`string`||t.kind===`number`||t.kind===`null`||t.kind===`value`:t.kind===`string`||t.kind===`number`||t.kind===`value`}function Kt(e,t,n,r){return r.compare(t,n)===0}function qt(e,t,n){let r=e!==`==`&&e!==`!=`;return class i{constructor(e,t,n){this.type=R,this.lhs=e,this.rhs=t,this.collator=n,this.hasUntypedArgument=e.type.kind===`value`||t.type.kind===`value`}static parse(e,t){if(e.length!==3&&e.length!==4)return t.error(`Expected two or three arguments.`);let n=e[0],a=t.parse(e[1],1,z);if(!a)return null;if(!Gt(n,a.type))return t.concat(1).error(`"${n}" comparisons are not supported for type '${Fe(a.type)}'.`);let o=t.parse(e[2],2,z);if(!o)return null;if(!Gt(n,o.type))return t.concat(2).error(`"${n}" comparisons are not supported for type '${Fe(o.type)}'.`);if(a.type.kind!==o.type.kind&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot compare types '${Fe(a.type)}' and '${Fe(o.type)}'.`);r&&(a.type.kind===`value`&&o.type.kind!==`value`?a=new bt(o.type,[a]):a.type.kind!==`value`&&o.type.kind===`value`&&(o=new bt(a.type,[o])));let s=null;if(e.length===4){if(a.type.kind!==`string`&&o.type.kind!==`string`&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot use collator to compare non-string types.`);if(s=t.parse(e[3],3,ke),!s)return null}return new i(a,o,s)}evaluate(i){let a=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){let t=ht(a),n=ht(o);if(t.kind!==n.kind||t.kind!==`string`&&t.kind!==`number`)throw new vt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let e=ht(a),n=ht(o);if(e.kind!==`string`||n.kind!==`string`)return t(i,a,o)}return this.collator?n(i,a,o,this.collator.evaluate(i)):t(i,a,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}let Jt=qt(`==`,(function(e,t,n){return t===n}),Kt),Yt=qt(`!=`,(function(e,t,n){return t!==n}),(function(e,t,n,r){return!Kt(0,t,n,r)})),Xt=qt(`<`,(function(e,t,n){return t<n}),(function(e,t,n,r){return r.compare(t,n)<0})),Zt=qt(`>`,(function(e,t,n){return t>n}),(function(e,t,n,r){return r.compare(t,n)>0})),Qt=qt(`<=`,(function(e,t,n){return t<=n}),(function(e,t,n,r){return r.compare(t,n)<=0})),$t=qt(`>=`,(function(e,t,n){return t>=n}),(function(e,t,n,r){return r.compare(t,n)>=0}));class en{constructor(e,t,n){this.type=ke,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error(`Expected one argument.`);let n=e[1];if(typeof n!=`object`||Array.isArray(n))return t.error(`Collator options argument must be an object.`);let r=t.parse(n[`case-sensitive`]!==void 0&&n[`case-sensitive`],1,R);if(!r)return null;let i=t.parse(n[`diacritic-sensitive`]!==void 0&&n[`diacritic-sensitive`],1,R);if(!i)return null;let a=null;return n.locale&&(a=t.parse(n.locale,1,L),!a)?null:new en(r,i,a)}evaluate(e){return new ot(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class tn{constructor(e,t,n,r,i){this.type=L,this.number=e,this.locale=t,this.currency=n,this.minFractionDigits=r,this.maxFractionDigits=i}static parse(e,t){if(e.length!==3)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,I);if(!n)return null;let r=e[2];if(typeof r!=`object`||Array.isArray(r))return t.error(`NumberFormat options argument must be an object.`);let i=null;if(r.locale&&(i=t.parse(r.locale,1,L),!i))return null;let a=null;if(r.currency&&(a=t.parse(r.currency,1,L),!a))return null;let o=null;if(r[`min-fraction-digits`]&&(o=t.parse(r[`min-fraction-digits`],1,I),!o))return null;let s=null;return r[`max-fraction-digits`]&&(s=t.parse(r[`max-fraction-digits`],1,I),!s)?null:new tn(n,i,a,o,s)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?`currency`:`decimal`,currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class nn{constructor(e){this.type=Ae,this.sections=e}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[1];if(!Array.isArray(n)&&typeof n==`object`)return t.error(`First argument must be an image or text section.`);let r=[],i=!1;for(let n=1;n<=e.length-1;++n){let a=e[n];if(i&&typeof a==`object`&&!Array.isArray(a)){i=!1;let e=null;if(a[`font-scale`]&&(e=t.parse(a[`font-scale`],1,I),!e))return null;let n=null;if(a[`text-font`]&&(n=t.parse(a[`text-font`],1,Pe(L)),!n))return null;let o=null;if(a[`text-color`]&&(o=t.parse(a[`text-color`],1,De),!o))return null;let s=r[r.length-1];s.scale=e,s.font=n,s.textColor=o}else{let a=t.parse(e[n],1,z);if(!a)return null;let o=a.type.kind;if(o!==`string`&&o!==`value`&&o!==`null`&&o!==`resolvedImage`)return t.error(`Formatted text type must be 'string', 'value', 'image' or 'null'.`);i=!0,r.push({content:a,scale:null,font:null,textColor:null})}}return new nn(r)}evaluate(e){return new ct(this.sections.map((t=>{let n=t.content.evaluate(e);return ht(n)===Me?new st(``,n,null,null,null):new st(gt(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(`,`):null,t.textColor?t.textColor.evaluate(e):null)})))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}}class rn{constructor(e){this.type=Me,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,L);return n?new rn(n):t.error(`No image name provided.`)}evaluate(e){let t=this.input.evaluate(e),n=ft.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class an{constructor(e){this.type=I,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=t.parse(e[1],1);return n?n.type.kind!==`array`&&n.type.kind!==`string`&&n.type.kind!==`value`?t.error(`Expected argument of type string or array, but found ${Fe(n.type)} instead.`):new an(n):null}evaluate(e){let t=this.input.evaluate(e);if(typeof t==`string`)return[...t].length;if(Array.isArray(t))return t.length;throw new vt(`Expected value to be of type string or array, but found ${Fe(ht(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}let on=8192;function sn(e,t){let n=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,i=2**t.z;return[Math.round(n*i*on),Math.round(r*i*on)]}function H(e,t){let n=2**t.z;return[(i=(e[0]/on+t.x)/n,360*i-180),(r=(e[1]/on+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,i}function cn(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function ln(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function un(e,t,n){let r=e[0]-t[0],i=e[1]-t[1],a=e[0]-n[0],o=e[1]-n[1];return r*o-a*i==0&&r*a<=0&&i*o<=0}function dn(e,t,n,r){return(i=[r[0]-n[0],r[1]-n[1]])[0]*(a=[t[0]-e[0],t[1]-e[1]])[1]-i[1]*a[0]!=0&&!(!_n(e,t,n,r)||!_n(n,r,e,t));var i,a}function fn(e,t,n){for(let r of n)for(let n=0;n<r.length-1;++n)if(dn(e,t,r[n],r[n+1]))return!0;return!1}function pn(e,t,n=!1){let r=!1;for(let s of t)for(let t=0;t<s.length-1;t++){if(un(e,s[t],s[t+1]))return n;(a=s[t])[1]>(i=e)[1]!=(o=s[t+1])[1]>i[1]&&i[0]<(o[0]-a[0])*(i[1]-a[1])/(o[1]-a[1])+a[0]&&(r=!r)}var i,a,o;return r}function mn(e,t){for(let n of t)if(pn(e,n))return!0;return!1}function hn(e,t){for(let n of e)if(!pn(n,t))return!1;for(let n=0;n<e.length-1;++n)if(fn(e[n],e[n+1],t))return!1;return!0}function gn(e,t){for(let n of t)if(hn(e,n))return!0;return!1}function _n(e,t,n,r){let i=r[0]-n[0],a=r[1]-n[1],o=(e[0]-n[0])*a-i*(e[1]-n[1]),s=(t[0]-n[0])*a-i*(t[1]-n[1]);return o>0&&s<0||o<0&&s>0}function vn(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=[];for(let r=0;r<e[i].length;r++){let o=sn(e[i][r],n);cn(t,o),a.push(o)}r.push(a)}return r}function yn(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=vn(e[i],t,n);r.push(a)}return r}function bn(e,t,n,r){if(e[0]<n[0]||e[0]>n[2]){let t=.5*r,i=e[0]-n[0]>t?-r:n[0]-e[0]>t?r:0;i===0&&(i=e[0]-n[2]>t?-r:n[2]-e[0]>t?r:0),e[0]+=i}cn(t,e)}function xn(e,t,n,r){let i=2**r.z*on,a=[r.x*on,r.y*on],o=[];for(let r of e)for(let e of r){let r=[e.x+a[0],e.y+a[1]];bn(r,t,n,i),o.push(r)}return o}function Sn(e,t,n,r){let i=2**r.z*on,a=[r.x*on,r.y*on],o=[];for(let n of e){let e=[];for(let r of n){let n=[r.x+a[0],r.y+a[1]];cn(t,n),e.push(n)}o.push(e)}if(t[2]-t[0]<=i/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(let e of o)for(let r of e)bn(r,t,n,i)}var s;return o}class Cn{constructor(e,t){this.type=R,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(mt(e[1])){let t=e[1];if(t.type===`FeatureCollection`){let e=[];for(let n of t.features){let{type:t,coordinates:r}=n.geometry;t===`Polygon`&&e.push(r),t===`MultiPolygon`&&e.push(...r)}if(e.length)return new Cn(t,{type:`MultiPolygon`,coordinates:e})}else if(t.type===`Feature`){let e=t.geometry.type;if(e===`Polygon`||e===`MultiPolygon`)return new Cn(t,t.geometry)}else if(t.type===`Polygon`||t.type===`MultiPolygon`)return new Cn(t,t)}return t.error(`'within' expression requires valid geojson object that contains polygon geometry type.`)}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===`Point`)return function(e,t){let n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type===`Polygon`){let a=vn(t.coordinates,r,i),o=xn(e.geometry(),n,r,i);if(!ln(n,r))return!1;for(let e of o)if(!pn(e,a))return!1}if(t.type===`MultiPolygon`){let a=yn(t.coordinates,r,i),o=xn(e.geometry(),n,r,i);if(!ln(n,r))return!1;for(let e of o)if(!mn(e,a))return!1}return!0}(e,this.geometries);if(e.geometryType()===`LineString`)return function(e,t){let n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type===`Polygon`){let a=vn(t.coordinates,r,i),o=Sn(e.geometry(),n,r,i);if(!ln(n,r))return!1;for(let e of o)if(!hn(e,a))return!1}if(t.type===`MultiPolygon`){let a=yn(t.coordinates,r,i),o=Sn(e.geometry(),n,r,i);if(!ln(n,r))return!1;for(let e of o)if(!gn(e,a))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let wn=class{constructor(e=[],t=((e,t)=>e<t?-1:+(e>t))){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],i)>=0)break;t[e]=t[r],e=r}t[e]=i}};function Tn(e,t,n,r,i){En(e,t,n,r||e.length-1,i||On)}function En(e,t,n,r,i){for(;r>n;){if(r-n>600){var a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);En(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}var u=e[t],d=n,f=r;for(Dn(e,n,t),i(e[r],u)>0&&Dn(e,n,r);d<f;){for(Dn(e,d,f),d++,f--;i(e[d],u)<0;)d++;for(;i(e[f],u)>0;)f--}i(e[n],u)===0?Dn(e,n,f):Dn(e,++f,r),f<=t&&(n=f+1),t<=f&&(r=f-1)}}function Dn(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function On(e,t){return e<t?-1:+(e>t)}function kn(e,t){if(e.length<=1)return[e];let n=[],r,i;for(let t of e){let e=jn(t);e!==0&&(t.area=Math.abs(e),i===void 0&&(i=e<0),i===e<0?(r&&n.push(r),r=[t]):r.push(t))}if(r&&n.push(r),t>1)for(let e=0;e<n.length;e++)n[e].length<=t||(Tn(n[e],t,1,n[e].length-1,An),n[e]=n[e].slice(0,t));return n}function An(e,t){return t.area-e.area}function jn(e){let t=0;for(let n,r,i=0,a=e.length,o=a-1;i<a;o=i++)n=e[i],r=e[o],t+=(r.x-n.x)*(n.y+r.y);return t}let Mn=1/298.257223563,Nn=Mn*(2-Mn),Pn=Math.PI/180;class Fn{constructor(e){let t=6378.137*Pn*1e3,n=Math.cos(e*Pn),r=1/(1-Nn*(1-n*n)),i=Math.sqrt(r);this.kx=t*i*n,this.ky=t*i*r*(1-Nn)}distance(e,t){let n=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+r*r)}pointOnLine(e,t){let n,r,i,a,o=1/0;for(let s=0;s<e.length-1;s++){let c=e[s][0],l=e[s][1],u=this.wrap(e[s+1][0]-c)*this.kx,d=(e[s+1][1]-l)*this.ky,f=0;u===0&&d===0||(f=(this.wrap(t[0]-c)*this.kx*u+(t[1]-l)*this.ky*d)/(u*u+d*d),f>1?(c=e[s+1][0],l=e[s+1][1]):f>0&&(c+=u/this.kx*f,l+=d/this.ky*f)),u=this.wrap(t[0]-c)*this.kx,d=(t[1]-l)*this.ky;let p=u*u+d*d;p<o&&(o=p,n=c,r=l,i=s,a=f)}return{point:[n,r],index:i,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function In(e,t){return t[0]-e[0]}function Ln(e){return e[1]-e[0]+1}function Rn(e,t){return e[1]>=e[0]&&e[1]<t}function zn(e,t){if(e[0]>e[1])return[null,null];let n=Ln(e);if(t){if(n===2)return[e,null];let t=Math.floor(n/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(n===1)return[e,null];let r=Math.floor(n/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function Bn(e,t){if(!Rn(t,e.length))return[1/0,1/0,-1/0,-1/0];let n=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)cn(n,e[r]);return n}function Vn(e){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)for(let e of n)cn(t,e);return t}function Hn(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Un(e,t,n){if(!Hn(e)||!Hn(t))return NaN;let r=0,i=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(i=e[1]-t[3]),e[3]<t[1]&&(i=t[1]-e[3]),n.distance([0,0],[r,i])}function U(e,t,n){let r=n.pointOnLine(t,e);return n.distance(e,r.point)}function Wn(e,t,n,r,i){let a=Math.min(U(e,[n,r],i),U(t,[n,r],i)),o=Math.min(U(n,[e,t],i),U(r,[e,t],i));return Math.min(a,o)}function W(e,t,n,r,i){if(!Rn(t,e.length)||!Rn(r,n.length))return 1/0;let a=1/0;for(let o=t[0];o<t[1];++o){let t=e[o],s=e[o+1];for(let e=r[0];e<r[1];++e){let r=n[e],o=n[e+1];if(dn(t,s,r,o))return 0;a=Math.min(a,Wn(t,s,r,o,i))}}return a}function Gn(e,t,n,r,i){if(!Rn(t,e.length)||!Rn(r,n.length))return NaN;let a=1/0;for(let o=t[0];o<=t[1];++o)for(let t=r[0];t<=r[1];++t)if(a=Math.min(a,i.distance(e[o],n[t])),a===0)return a;return a}function G(e,t,n){if(pn(e,t,!0))return 0;let r=1/0;for(let i of t){let t=i[0],a=i[i.length-1];if(t!==a&&(r=Math.min(r,U(e,[a,t],n)),r===0))return r;let o=n.pointOnLine(i,e);if(r=Math.min(r,n.distance(e,o.point)),r===0)return r}return r}function K(e,t,n,r){if(!Rn(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(pn(e[r],n,!0))return 0;let i=1/0;for(let a=t[0];a<t[1];++a){let t=e[a],o=e[a+1];for(let e of n)for(let n=0,a=e.length,s=a-1;n<a;s=n++){let a=e[s],c=e[n];if(dn(t,o,a,c))return 0;i=Math.min(i,Wn(t,o,a,c,r))}}return i}function Kn(e,t){for(let n of e)for(let e of n)if(pn(e,t,!0))return!0;return!1}function qn(e,t,n,r=1/0){let i=Vn(e),a=Vn(t);if(r!==1/0&&Un(i,a,n)>=r)return r;if(ln(i,a)){if(Kn(e,t))return 0}else if(Kn(t,e))return 0;let o=1/0;for(let r of e)for(let e=0,i=r.length,a=i-1;e<i;a=e++){let i=r[a],s=r[e];for(let e of t)for(let t=0,r=e.length,a=r-1;t<r;a=t++){let r=e[a],c=e[t];if(dn(i,s,r,c))return 0;o=Math.min(o,Wn(i,s,r,c,n))}}return o}function Jn(e,t,n,r,i,a){if(!a)return;let o=Un(Bn(r,a),i,n);o<t&&e.push([o,a,[0,0]])}function Yn(e,t,n,r,i,a,o){if(!a||!o)return;let s=Un(Bn(r,a),Bn(i,o),n);s<t&&e.push([s,a,o])}function Xn(e,t,n,r,i=1/0){let a=Math.min(r.distance(e[0],n[0][0]),i);if(a===0)return a;let o=new wn([[0,[0,e.length-1],[0,0]]],In),s=Vn(n);for(;o.length>0;){let i=o.pop();if(i[0]>=a)continue;let c=i[1],l=t?50:100;if(Ln(c)<=l){if(!Rn(c,e.length))return NaN;if(t){let t=K(e,c,n,r);if(isNaN(t)||t===0)return t;a=Math.min(a,t)}else for(let t=c[0];t<=c[1];++t){let i=G(e[t],n,r);if(a=Math.min(a,i),a===0)return 0}}else{let n=zn(c,t);Jn(o,a,r,e,s,n[0]),Jn(o,a,r,e,s,n[1])}}return a}function Zn(e,t,n,r,i,a=1/0){let o=Math.min(a,i.distance(e[0],n[0]));if(o===0)return o;let s=new wn([[0,[0,e.length-1],[0,n.length-1]]],In);for(;s.length>0;){let a=s.pop();if(a[0]>=o)continue;let c=a[1],l=a[2],u=t?50:100,d=r?50:100;if(Ln(c)<=u&&Ln(l)<=d){if(!Rn(c,e.length)&&Rn(l,n.length))return NaN;let a;if(t&&r)a=W(e,c,n,l,i),o=Math.min(o,a);else if(t&&!r){let t=e.slice(c[0],c[1]+1);for(let e=l[0];e<=l[1];++e)if(a=U(n[e],t,i),o=Math.min(o,a),o===0)return o}else if(!t&&r){let t=n.slice(l[0],l[1]+1);for(let n=c[0];n<=c[1];++n)if(a=U(e[n],t,i),o=Math.min(o,a),o===0)return o}else a=Gn(e,c,n,l,i),o=Math.min(o,a)}else{let a=zn(c,t),u=zn(l,r);Yn(s,o,i,e,n,a[0],u[0]),Yn(s,o,i,e,n,a[0],u[1]),Yn(s,o,i,e,n,a[1],u[0]),Yn(s,o,i,e,n,a[1],u[1])}}return o}function Qn(e){return e.type===`MultiPolygon`?e.coordinates.map((e=>({type:`Polygon`,coordinates:e}))):e.type===`MultiLineString`?e.coordinates.map((e=>({type:`LineString`,coordinates:e}))):e.type===`MultiPoint`?e.coordinates.map((e=>({type:`Point`,coordinates:e}))):[e]}class $n{constructor(e,t){this.type=I,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(mt(e[1])){let t=e[1];if(t.type===`FeatureCollection`)return new $n(t,t.features.map((e=>Qn(e.geometry))).flat());if(t.type===`Feature`)return new $n(t,Qn(t.geometry));if(`type`in t&&`coordinates`in t)return new $n(t,Qn(t))}return t.error(`'distance' expression requires valid geojson object that contains polygon geometry type.`)}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===`Point`)return function(e,t){let n=e.geometry(),r=n.flat().map((t=>H([t.x,t.y],e.canonical)));if(n.length===0)return NaN;let i=new Fn(r[0][1]),a=1/0;for(let e of t){switch(e.type){case`Point`:a=Math.min(a,Zn(r,!1,[e.coordinates],!1,i,a));break;case`LineString`:a=Math.min(a,Zn(r,!1,e.coordinates,!0,i,a));break;case`Polygon`:a=Math.min(a,Xn(r,!1,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries);if(e.geometryType()===`LineString`)return function(e,t){let n=e.geometry(),r=n.flat().map((t=>H([t.x,t.y],e.canonical)));if(n.length===0)return NaN;let i=new Fn(r[0][1]),a=1/0;for(let e of t){switch(e.type){case`Point`:a=Math.min(a,Zn(r,!0,[e.coordinates],!1,i,a));break;case`LineString`:a=Math.min(a,Zn(r,!0,e.coordinates,!0,i,a));break;case`Polygon`:a=Math.min(a,Xn(r,!0,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries);if(e.geometryType()===`Polygon`)return function(e,t){let n=e.geometry();if(n.length===0||n[0].length===0)return NaN;let r=kn(n,0).map((t=>t.map((t=>t.map((t=>H([t.x,t.y],e.canonical))))))),i=new Fn(r[0][0][0][1]),a=1/0;for(let e of t)for(let t of r){switch(e.type){case`Point`:a=Math.min(a,Xn([e.coordinates],!1,t,i,a));break;case`LineString`:a=Math.min(a,Xn(e.coordinates,!0,t,i,a));break;case`Polygon`:a=Math.min(a,qn(t,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let er={"==":Jt,"!=":Yt,">":Zt,"<":Xt,">=":$t,"<=":Qt,array:bt,at:Dt,boolean:bt,case:jt,coalesce:Wt,collator:en,format:nn,image:rn,in:Ot,"index-of":kt,interpolate:Ht,"interpolate-hcl":Ht,"interpolate-lab":Ht,length:an,let:Tt,literal:_t,match:At,number:bt,"number-format":tn,object:bt,slice:Mt,step:Pt,string:bt,"to-boolean":St,"to-color":St,"to-number":St,"to-string":St,var:Et,within:Cn,distance:$n};class tr{constructor(e,t,n,r){this.name=e,this.type=t,this._evaluate=n,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let n=e[0],r=tr.definitions[n];if(!r)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let i=Array.isArray(r)?r[0]:r.type,a=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=a.filter((([t])=>!Array.isArray(t)||t.length===e.length-1)),s=null;for(let[r,a]of o){s=new wt(t.registry,or,t.path,null,t.scope);let o=[],c=!1;for(let t=1;t<e.length;t++){let n=e[t],i=Array.isArray(r)?r[t-1]:r.type,a=s.parse(n,1+o.length,i);if(!a){c=!0;break}o.push(a)}if(!c)if(Array.isArray(r)&&r.length!==o.length)s.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){let t=Array.isArray(r)?r[e]:r.type,n=o[e];s.concat(e+1).checkSubtype(t,n.type)}if(s.errors.length===0)return new tr(n,i,a,o)}}if(o.length===1)t.errors.push(...s.errors);else{let n=(o.length?o:a).map((([e])=>{return t=e,Array.isArray(t)?`(${t.map(Fe).join(`, `)})`:`(${Fe(t.type)}...)`;var t})).join(` | `),r=[];for(let n=1;n<e.length;n++){let i=t.parse(e[n],1+r.length);if(!i)return null;r.push(Fe(i.type))}t.error(`Expected arguments of type ${n}, but found (${r.join(`, `)}) instead.`)}return null}static register(e,t){tr.definitions=t;for(let n in t)e[n]=tr}}function nr(e,[t,n,r,i]){t=t.evaluate(e),n=n.evaluate(e),r=r.evaluate(e);let a=i?i.evaluate(e):1,o=pt(t,n,r,a);if(o)throw new vt(o);return new B(t/255,n/255,r/255,a,!1)}function rr(e,t){return e in t}function ir(e,t){let n=t[e];return n===void 0?null:n}function ar(e){return{type:e}}function or(e){if(e instanceof Et)return or(e.boundExpression);if(e instanceof tr&&e.name===`error`||e instanceof en||e instanceof Cn||e instanceof $n)return!1;let t=e instanceof St||e instanceof bt,n=!0;return e.eachChild((e=>{n=t?n&&or(e):n&&e instanceof _t})),!!n&&sr(e)&&lr(e,[`zoom`,`heatmap-density`,`line-progress`,`accumulated`,`is-supported-script`])}function sr(e){if(e instanceof tr&&(e.name===`get`&&e.args.length===1||e.name===`feature-state`||e.name===`has`&&e.args.length===1||e.name===`properties`||e.name===`geometry-type`||e.name===`id`||/^filter-/.test(e.name))||e instanceof Cn||e instanceof $n)return!1;let t=!0;return e.eachChild((e=>{t&&!sr(e)&&(t=!1)})),t}function cr(e){if(e instanceof tr&&e.name===`feature-state`)return!1;let t=!0;return e.eachChild((e=>{t&&!cr(e)&&(t=!1)})),t}function lr(e,t){if(e instanceof tr&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild((e=>{n&&!lr(e,t)&&(n=!1)})),n}function ur(e){return{result:`success`,value:e}}function dr(e){return{result:`error`,value:e}}function fr(e){return e[`property-type`]===`data-driven`||e[`property-type`]===`cross-faded-data-driven`}function pr(e){return!!e.expression&&e.expression.parameters.indexOf(`zoom`)>-1}function mr(e){return!!e.expression&&e.expression.interpolated}function q(e){return e instanceof Number?`number`:e instanceof String?`string`:e instanceof Boolean?`boolean`:Array.isArray(e)?`array`:e===null?`null`:typeof e}function hr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function gr(e){return e}function _r(e,t){let n=t.type===`color`,r=e.stops&&typeof e.stops[0][0]==`object`,i=r||!(r||e.property!==void 0),a=e.type||(mr(t)?`exponential`:`interval`);if(n||t.type===`padding`){let r=n?B.parse:lt.parse;(e=Ce({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],r(e[1])]))),e.default=r(e.default?e.default:t.default)}if(e.colorSpace&&(o=e.colorSpace)!==`rgb`&&o!==`hcl`&&o!==`lab`)throw Error(`Unknown color space: "${e.colorSpace}"`);var o;let s,c,l;if(a===`exponential`)s=xr;else if(a===`interval`)s=br;else if(a===`categorical`){s=yr,c=Object.create(null);for(let t of e.stops)c[t[0]]=t[1];l=typeof e.stops[0][0]}else{if(a!==`identity`)throw Error(`Unknown function type "${a}"`);s=Sr}if(r){let n={},r=[];for(let t=0;t<e.stops.length;t++){let i=e.stops[t],a=i[0].zoom;n[a]===void 0&&(n[a]={zoom:a,type:e.type,property:e.property,default:e.default,stops:[]},r.push(a)),n[a].stops.push([i[0].value,i[1]])}let i=[];for(let e of r)i.push([n[e].zoom,_r(n[e],t)]);let a={name:`linear`};return{kind:`composite`,interpolationType:a,interpolationFactor:Ht.interpolationFactor.bind(void 0,a),zoomStops:i.map((e=>e[0])),evaluate:({zoom:n},r)=>xr({stops:i,base:e.base},t,n).evaluate(n,r)}}if(i){let n=a===`exponential`?{name:`exponential`,base:e.base===void 0?1:e.base}:null;return{kind:`camera`,interpolationType:n,interpolationFactor:Ht.interpolationFactor.bind(void 0,n),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:n})=>s(e,t,n,c,l)}}return{kind:`source`,evaluate(n,r){let i=r&&r.properties?r.properties[e.property]:void 0;return i===void 0?vr(e.default,t.default):s(e,t,i,c,l)}}}function vr(e,t,n){return e===void 0?t===void 0?n===void 0?void 0:n:t:e}function yr(e,t,n,r,i){return vr(typeof n===i?r[n]:void 0,e.default,t.default)}function br(e,t,n){if(q(n)!==`number`)return vr(e.default,t.default);let r=e.stops.length;if(r===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[r-1][0])return e.stops[r-1][1];let i=Nt(e.stops.map((e=>e[0])),n);return e.stops[i][1]}function xr(e,t,n){let r=e.base===void 0?1:e.base;if(q(n)!==`number`)return vr(e.default,t.default);let i=e.stops.length;if(i===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[i-1][0])return e.stops[i-1][1];let a=Nt(e.stops.map((e=>e[0])),n),o=function(e,t,n,r){let i=r-n,a=e-n;return i===0?0:t===1?a/i:(t**+a-1)/(t**+i-1)}(n,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],c=e.stops[a+1][1],l=Vt[t.type]||gr;return typeof s.evaluate==`function`?{evaluate(...t){let n=s.evaluate.apply(void 0,t),r=c.evaluate.apply(void 0,t);if(n!==void 0&&r!==void 0)return l(n,r,o,e.colorSpace)}}:l(s,c,o,e.colorSpace)}function Sr(e,t,n){switch(t.type){case`color`:n=B.parse(n);break;case`formatted`:n=ct.fromString(n.toString());break;case`resolvedImage`:n=ft.fromString(n.toString());break;case`padding`:n=lt.parse(n);break;default:q(n)===t.type||t.type===`enum`&&t.values[n]||(n=void 0)}return vr(n,e.default,t.default)}tr.register(er,{error:[{kind:`error`},[L],(e,[t])=>{throw new vt(t.evaluate(e))}],typeof:[L,[z],(e,[t])=>Fe(ht(t.evaluate(e)))],"to-rgba":[Pe(I,4),[De],(e,[t])=>{let[n,r,i,a]=t.evaluate(e).rgb;return[255*n,255*r,255*i,a]}],rgb:[De,[I,I,I],nr],rgba:[De,[I,I,I,I],nr],has:{type:R,overloads:[[[L],(e,[t])=>rr(t.evaluate(e),e.properties())],[[L,Oe],(e,[t,n])=>rr(t.evaluate(e),n.evaluate(e))]]},get:{type:z,overloads:[[[L],(e,[t])=>ir(t.evaluate(e),e.properties())],[[L,Oe],(e,[t,n])=>ir(t.evaluate(e),n.evaluate(e))]]},"feature-state":[z,[L],(e,[t])=>ir(t.evaluate(e),e.featureState||{})],properties:[Oe,[],e=>e.properties()],"geometry-type":[L,[],e=>e.geometryType()],id:[z,[],e=>e.id()],zoom:[I,[],e=>e.globals.zoom],"heatmap-density":[I,[],e=>e.globals.heatmapDensity||0],"line-progress":[I,[],e=>e.globals.lineProgress||0],accumulated:[z,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[I,ar(I),(e,t)=>{let n=0;for(let r of t)n+=r.evaluate(e);return n}],"*":[I,ar(I),(e,t)=>{let n=1;for(let r of t)n*=r.evaluate(e);return n}],"-":{type:I,overloads:[[[I,I],(e,[t,n])=>t.evaluate(e)-n.evaluate(e)],[[I],(e,[t])=>-t.evaluate(e)]]},"/":[I,[I,I],(e,[t,n])=>t.evaluate(e)/n.evaluate(e)],"%":[I,[I,I],(e,[t,n])=>t.evaluate(e)%n.evaluate(e)],ln2:[I,[],()=>Math.LN2],pi:[I,[],()=>Math.PI],e:[I,[],()=>Math.E],"^":[I,[I,I],(e,[t,n])=>t.evaluate(e)**+n.evaluate(e)],sqrt:[I,[I],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[I,[I],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[I,[I],(e,[t])=>Math.log(t.evaluate(e))],log2:[I,[I],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[I,[I],(e,[t])=>Math.sin(t.evaluate(e))],cos:[I,[I],(e,[t])=>Math.cos(t.evaluate(e))],tan:[I,[I],(e,[t])=>Math.tan(t.evaluate(e))],asin:[I,[I],(e,[t])=>Math.asin(t.evaluate(e))],acos:[I,[I],(e,[t])=>Math.acos(t.evaluate(e))],atan:[I,[I],(e,[t])=>Math.atan(t.evaluate(e))],min:[I,ar(I),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[I,ar(I),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[I,[I],(e,[t])=>Math.abs(t.evaluate(e))],round:[I,[I],(e,[t])=>{let n=t.evaluate(e);return n<0?-Math.round(-n):Math.round(n)}],floor:[I,[I],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[I,[I],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[R,[L,z],(e,[t,n])=>e.properties()[t.value]===n.value],"filter-id-==":[R,[z],(e,[t])=>e.id()===t.value],"filter-type-==":[R,[L],(e,[t])=>e.geometryType()===t.value],"filter-<":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<i}],"filter-id-<":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n<r}],"filter->":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>i}],"filter-id->":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>r}],"filter-<=":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n<=r}],"filter->=":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>=r}],"filter-has":[R,[z],(e,[t])=>t.value in e.properties()],"filter-has-id":[R,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[R,[Pe(L)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[R,[Pe(z)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[R,[L,Pe(z)],(e,[t,n])=>n.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[R,[L,Pe(z)],(e,[t,n])=>function(e,t,n,r){for(;n<=r;){let i=n+r>>1;if(t[i]===e)return!0;t[i]>e?r=i-1:n=i+1}return!1}(e.properties()[t.value],n.value,0,n.value.length-1)],all:{type:R,overloads:[[[R,R],(e,[t,n])=>t.evaluate(e)&&n.evaluate(e)],[ar(R),(e,t)=>{for(let n of t)if(!n.evaluate(e))return!1;return!0}]]},any:{type:R,overloads:[[[R,R],(e,[t,n])=>t.evaluate(e)||n.evaluate(e)],[ar(R),(e,t)=>{for(let n of t)if(n.evaluate(e))return!0;return!1}]]},"!":[R,[R],(e,[t])=>!t.evaluate(e)],"is-supported-script":[R,[L],(e,[t])=>{let n=e.globals&&e.globals.isSupportedScript;return!n||n(t.evaluate(e))}],upcase:[L,[L],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[L,[L],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[L,ar(z),(e,t)=>t.map((t=>gt(t.evaluate(e)))).join(``)],"resolved-locale":[L,[ke],(e,[t])=>t.evaluate(e).resolvedLocale()]});class Cr{constructor(e,t){var n;this.expression=e,this._warningHistory={},this._evaluator=new V,this._defaultValue=t?(n=t).type===`color`&&hr(n.default)?new B(0,0,0,0):n.type===`color`?B.parse(n.default)||null:n.type===`padding`?lt.parse(n.default)||null:n.type===`variableAnchorOffsetCollection`?dt.parse(n.default)||null:n.default===void 0?null:n.default:null,this._enumValues=t&&t.type===`enum`?t.values:null}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,r,i,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{let e=this.expression.evaluate(this._evaluator);if(e==null||typeof e==`number`&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new vt(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(`, `)}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,typeof console<`u`&&console.warn(e.message)),this._defaultValue}}}function wr(e){return Array.isArray(e)&&e.length>0&&typeof e[0]==`string`&&e[0]in er}function Tr(e,t){let n=new wt(er,or,[],t?function(e){let t={color:De,string:L,number:I,enum:L,boolean:R,formatted:Ae,padding:je,resolvedImage:Me,variableAnchorOffsetCollection:Ne};return e.type===`array`?Pe(t[e.value]||z,e.length):t[e.type]}(t):void 0),r=n.parse(e,void 0,void 0,void 0,t&&t.type===`string`?{typeAnnotation:`coerce`}:void 0);return r?ur(new Cr(r,t)):dr(n.errors)}class Er{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!==`constant`&&!cr(t.expression)}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._styleExpression.evaluate(e,t,n,r,i,a)}}class Dr{constructor(e,t,n,r){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!==`camera`&&!cr(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._styleExpression.evaluate(e,t,n,r,i,a)}interpolationFactor(e,t,n){return this.interpolationType?Ht.interpolationFactor(this.interpolationType,e,t,n):0}}function Or(e,t){let n=Tr(e,t);if(n.result===`error`)return n;let r=n.value.expression,i=sr(r);if(!i&&!fr(t))return dr([new we(``,`data expressions not supported`)]);let a=lr(r,[`zoom`]);if(!a&&!pr(t))return dr([new we(``,`zoom expressions not supported`)]);let o=Ar(r);return o||a?o instanceof we?dr([o]):o instanceof Ht&&!mr(t)?dr([new we(``,`"interpolate" expressions cannot be used with this property`)]):ur(o?new Dr(i?`camera`:`composite`,n.value,o.labels,o instanceof Ht?o.interpolation:void 0):new Er(i?`constant`:`source`,n.value)):dr([new we(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`)])}class kr{constructor(e,t){this._parameters=e,this._specification=t,Ce(this,_r(this._parameters,this._specification))}static deserialize(e){return new kr(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ar(e){let t=null;if(e instanceof Tt)t=Ar(e.result);else if(e instanceof Wt){for(let n of e.args)if(t=Ar(n),t)break}else(e instanceof Pt||e instanceof Ht)&&e.input instanceof tr&&e.input.name===`zoom`&&(t=e);return t instanceof we||e.eachChild((e=>{let n=Ar(e);n instanceof we?t=n:!t&&n?t=new we(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`):t&&n&&t!==n&&(t=new we(``,`Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.`))})),t}function jr(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case`has`:return e.length>=2&&e[1]!==`$id`&&e[1]!==`$type`;case`in`:return e.length>=3&&(typeof e[1]!=`string`||Array.isArray(e[2]));case`!in`:case`!has`:case`none`:return!1;case`==`:case`!=`:case`>`:case`>=`:case`<`:case`<=`:return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case`any`:case`all`:for(let t of e.slice(1))if(!jr(t)&&typeof t!=`boolean`)return!1;return!0;default:return!0}}let Mr={type:`boolean`,default:!1,transition:!1,"property-type":`data-driven`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]}};function Nr(e){if(e==null)return{filter:()=>!0,needGeometry:!1};jr(e)||(e=Ir(e));let t=Tr(e,Mr);if(t.result===`error`)throw Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return{filter:(e,n,r)=>t.value.evaluate(e,n,{},r),needGeometry:Fr(e)}}function Pr(e,t){return e<t?-1:+(e>t)}function Fr(e){if(!Array.isArray(e))return!1;if(e[0]===`within`||e[0]===`distance`)return!0;for(let t=1;t<e.length;t++)if(Fr(e[t]))return!0;return!1}function Ir(e){if(!e)return!0;let t=e[0];return e.length<=1?t!==`any`:t===`==`?Lr(e[1],e[2],`==`):t===`!=`?Br(Lr(e[1],e[2],`==`)):t===`<`||t===`>`||t===`<=`||t===`>=`?Lr(e[1],e[2],t):t===`any`?(n=e.slice(1),[`any`].concat(n.map(Ir))):t===`all`?[`all`].concat(e.slice(1).map(Ir)):t===`none`?[`all`].concat(e.slice(1).map(Ir).map(Br)):t===`in`?Rr(e[1],e.slice(2)):t===`!in`?Br(Rr(e[1],e.slice(2))):t===`has`?zr(e[1]):t!==`!has`||Br(zr(e[1]));var n}function Lr(e,t,n){switch(e){case`$type`:return[`filter-type-${n}`,t];case`$id`:return[`filter-id-${n}`,t];default:return[`filter-${n}`,e,t]}}function Rr(e,t){if(t.length===0)return!1;switch(e){case`$type`:return[`filter-type-in`,[`literal`,t]];case`$id`:return[`filter-id-in`,[`literal`,t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?[`filter-in-large`,e,[`literal`,t.sort(Pr)]]:[`filter-in-small`,e,[`literal`,t]]}}function zr(e){switch(e){case`$type`:return!0;case`$id`:return[`filter-has-id`];default:return[`filter-has`,e]}}function Br(e){return[`!`,e]}function Vr(e){let t=typeof e;if(t===`number`||t===`boolean`||t===`string`||e==null)return JSON.stringify(e);if(Array.isArray(e)){let t=`[`;for(let n of e)t+=`${Vr(n)},`;return`${t}]`}let n=Object.keys(e).sort(),r=`{`;for(let t=0;t<n.length;t++)r+=`${JSON.stringify(n[t])}:${Vr(e[n[t]])},`;return`${r}}`}function Hr(e){let t=``;for(let n of pe)t+=`/${Vr(e[n])}`;return t}function Ur(e){let t=e.value;return t?[new F(e.key,t,`constants have been deprecated as of v8`)]:[]}function Wr(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Gr(e){if(Array.isArray(e))return e.map(Gr);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let n in e)t[n]=Gr(e[n]);return t}return Wr(e)}function Kr(e){let t=e.key,n=e.value,r=e.valueSpec||{},i=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,c=[],l=q(n);if(l!==`object`)return[new F(t,n,`object expected, ${l} found`)];for(let e in n){let l=e.split(`.`)[0],u=r[l]||r[`*`],d;if(i[l])d=i[l];else if(r[l])d=s;else if(i[`*`])d=i[`*`];else{if(!r[`*`]){c.push(new F(t,n[e],`unknown property "${e}"`));continue}d=s}c=c.concat(d({key:(t&&`${t}.`)+e,value:n[e],valueSpec:u,style:a,styleSpec:o,object:n,objectKey:e,validateSpec:s},n))}for(let e in r)i[e]||r[e].required&&r[e].default===void 0&&n[e]===void 0&&c.push(new F(t,n,`missing required property "${e}"`));return c}function qr(e){let t=e.value,n=e.valueSpec,r=e.style,i=e.styleSpec,a=e.key,o=e.arrayElementValidator||e.validateSpec;if(q(t)!==`array`)return[new F(a,t,`array expected, ${q(t)} found`)];if(n.length&&t.length!==n.length)return[new F(a,t,`array length ${n.length} expected, length ${t.length} found`)];if(n[`min-length`]&&t.length<n[`min-length`])return[new F(a,t,`array length at least ${n[`min-length`]} expected, length ${t.length} found`)];let s={type:n.value,values:n.values};i.$version<7&&(s.function=n.function),q(n.value)===`object`&&(s=n.value);let c=[];for(let n=0;n<t.length;n++)c=c.concat(o({array:t,arrayIndex:n,value:t[n],valueSpec:s,validateSpec:e.validateSpec,style:r,styleSpec:i,key:`${a}[${n}]`}));return c}function Jr(e){let t=e.key,n=e.value,r=e.valueSpec,i=q(n);return i===`number`&&n!=n&&(i=`NaN`),i===`number`?`minimum`in r&&n<r.minimum?[new F(t,n,`${n} is less than the minimum value ${r.minimum}`)]:`maximum`in r&&n>r.maximum?[new F(t,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]:[new F(t,n,`number expected, ${i} found`)]}function Yr(e){let t=e.valueSpec,n=Wr(e.value.type),r,i,a,o={},s=n!==`categorical`&&e.value.property===void 0,c=!s,l=q(e.value.stops)===`array`&&q(e.value.stops[0])===`array`&&q(e.value.stops[0][0])===`object`,u=Kr({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if(n===`identity`)return[new F(e.key,e.value,`identity function may not have a "stops" property`)];let t=[],r=e.value;return t=t.concat(qr({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:d})),q(r)===`array`&&r.length===0&&t.push(new F(e.key,r,`array must have at least one stop`)),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return n===`identity`&&s&&u.push(new F(e.key,e.value,`missing required property "property"`)),n===`identity`||e.value.stops||u.push(new F(e.key,e.value,`missing required property "stops"`)),n===`exponential`&&e.valueSpec.expression&&!mr(e.valueSpec)&&u.push(new F(e.key,e.value,`exponential functions not supported`)),e.styleSpec.$version>=8&&(c&&!fr(e.valueSpec)?u.push(new F(e.key,e.value,`property functions not supported`)):s&&!pr(e.valueSpec)&&u.push(new F(e.key,e.value,`zoom functions not supported`))),n!==`categorical`&&!l||e.value.property!==void 0||u.push(new F(e.key,e.value,`"property" property is required`)),u;function d(e){let n=[],r=e.value,s=e.key;if(q(r)!==`array`)return[new F(s,r,`array expected, ${q(r)} found`)];if(r.length!==2)return[new F(s,r,`array length 2 expected, length ${r.length} found`)];if(l){if(q(r[0])!==`object`)return[new F(s,r,`object expected, ${q(r[0])} found`)];if(r[0].zoom===void 0)return[new F(s,r,`object stop key must have zoom`)];if(r[0].value===void 0)return[new F(s,r,`object stop key must have value`)];if(a&&a>Wr(r[0].zoom))return[new F(s,r[0].zoom,`stop zoom values must appear in ascending order`)];Wr(r[0].zoom)!==a&&(a=Wr(r[0].zoom),i=void 0,o={}),n=n.concat(Kr({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Jr,value:f}}))}else n=n.concat(f({key:`${s}[0]`,value:r[0],valueSpec:{},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return wr(Gr(r[1]))?n.concat([new F(`${s}[1]`,r[1],`expressions are not allowed in function stops.`)]):n.concat(e.validateSpec({key:`${s}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function f(e,a){let s=q(e.value),c=Wr(e.value),l=e.value===null?a:e.value;if(r){if(s!==r)return[new F(e.key,l,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if(s!==`number`&&s!==`string`&&s!==`boolean`)return[new F(e.key,l,`stop domain value must be a number, string, or boolean`)];if(s!==`number`&&n!==`categorical`){let r=`number expected, ${s} found`;return fr(t)&&n===void 0&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new F(e.key,l,r)]}return n!==`categorical`||s!==`number`||isFinite(c)&&Math.floor(c)===c?n!==`categorical`&&s===`number`&&i!==void 0&&c<i?[new F(e.key,l,`stop domain values must appear in ascending order`)]:(i=c,n===`categorical`&&c in o?[new F(e.key,l,`stop domain values must be unique`)]:(o[c]=!0,[])):[new F(e.key,l,`integer expected, found ${c}`)]}}function Xr(e){let t=(e.expressionContext===`property`?Or:Tr)(Gr(e.value),e.valueSpec);if(t.result===`error`)return t.value.map((t=>new F(`${e.key}${t.key}`,e.value,t.message)));let n=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext===`property`&&e.propertyKey===`text-font`&&!n.outputDefined())return[new F(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext===`property`&&e.propertyType===`layout`&&!cr(n))return[new F(e.key,e.value,`"feature-state" data expressions are not supported with layout properties.`)];if(e.expressionContext===`filter`&&!cr(n))return[new F(e.key,e.value,`"feature-state" data expressions are not supported with filters.`)];if(e.expressionContext&&e.expressionContext.indexOf(`cluster`)===0){if(!lr(n,[`zoom`,`feature-state`]))return[new F(e.key,e.value,`"zoom" and "feature-state" expressions are not supported with cluster properties.`)];if(e.expressionContext===`cluster-initial`&&!sr(n))return[new F(e.key,e.value,`Feature data expressions are not supported with initial expression part of cluster properties.`)]}return[]}function Zr(e){let t=e.key,n=e.value,r=e.valueSpec,i=[];return Array.isArray(r.values)?r.values.indexOf(Wr(n))===-1&&i.push(new F(t,n,`expected one of [${r.values.join(`, `)}], ${JSON.stringify(n)} found`)):Object.keys(r.values).indexOf(Wr(n))===-1&&i.push(new F(t,n,`expected one of [${Object.keys(r.values).join(`, `)}], ${JSON.stringify(n)} found`)),i}function Qr(e){return jr(Gr(e.value))?Xr(Ce({},e,{expressionContext:`filter`,valueSpec:{value:`boolean`}})):$r(e)}function $r(e){let t=e.value,n=e.key;if(q(t)!==`array`)return[new F(n,t,`array expected, ${q(t)} found`)];let r=e.styleSpec,i,a=[];if(t.length<1)return[new F(n,t,`filter array must have at least 1 element`)];switch(a=a.concat(Zr({key:`${n}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),Wr(t[0])){case`<`:case`<=`:case`>`:case`>=`:t.length>=2&&Wr(t[1])===`$type`&&a.push(new F(n,t,`"$type" cannot be use with operator "${t[0]}"`));case`==`:case`!=`:t.length!==3&&a.push(new F(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case`in`:case`!in`:t.length>=2&&(i=q(t[1]),i!==`string`&&a.push(new F(`${n}[1]`,t[1],`string expected, ${i} found`)));for(let o=2;o<t.length;o++)i=q(t[o]),Wr(t[1])===`$type`?a=a.concat(Zr({key:`${n}[${o}]`,value:t[o],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):i!==`string`&&i!==`number`&&i!==`boolean`&&a.push(new F(`${n}[${o}]`,t[o],`string, number, or boolean expected, ${i} found`));break;case`any`:case`all`:case`none`:for(let r=1;r<t.length;r++)a=a.concat($r({key:`${n}[${r}]`,value:t[r],style:e.style,styleSpec:e.styleSpec}));break;case`has`:case`!has`:i=q(t[1]),t.length===2?i!==`string`&&a.push(new F(`${n}[1]`,t[1],`string expected, ${i} found`)):a.push(new F(n,t,`filter array for "${t[0]}" operator must have 2 elements`))}return a}function ei(e,t){let n=e.key,r=e.validateSpec,i=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,c=a[`${t}_${e.layerType}`];if(!c)return[];let l=s.match(/^(.*)-transition$/);if(t===`paint`&&l&&c[l[1]]&&c[l[1]].transition)return r({key:n,value:o,valueSpec:a.transition,style:i,styleSpec:a});let u=e.valueSpec||c[s];if(!u)return[new F(n,o,`unknown property "${s}"`)];let d;if(q(o)===`string`&&fr(u)&&!u.tokens&&(d=/^{([^}]+)}$/.exec(o)))return[new F(n,o,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(d[1])} }\`.`)];let f=[];return e.layerType===`symbol`&&(s===`text-field`&&i&&!i.glyphs&&f.push(new F(n,o,`use of "text-field" requires a style "glyphs" property`)),s===`text-font`&&hr(Gr(o))&&Wr(o.type)===`identity`&&f.push(new F(n,o,`"text-font" does not support identity functions`))),f.concat(r({key:e.key,value:o,valueSpec:u,style:i,styleSpec:a,expressionContext:`property`,propertyType:t,propertyKey:s}))}function ti(e){return ei(e,`paint`)}function ni(e){return ei(e,`layout`)}function ri(e){let t=[],n=e.value,r=e.key,i=e.style,a=e.styleSpec;n.type||n.ref||t.push(new F(r,n,`either "type" or "ref" is required`));let o=Wr(n.type),s=Wr(n.ref);if(n.id){let a=Wr(n.id);for(let o=0;o<e.arrayIndex;o++){let e=i.layers[o];Wr(e.id)===a&&t.push(new F(r,n.id,`duplicate layer id "${n.id}", previously used at line ${e.id.__line__}`))}}if(`ref`in n){let e;[`type`,`source`,`source-layer`,`filter`,`layout`].forEach((e=>{e in n&&t.push(new F(r,n[e],`"${e}" is prohibited for ref layers`))})),i.layers.forEach((t=>{Wr(t.id)===s&&(e=t)})),e?e.ref?t.push(new F(r,n.ref,`ref cannot reference another ref layer`)):o=Wr(e.type):t.push(new F(r,n.ref,`ref layer "${s}" not found`))}else if(o!==`background`)if(n.source){let e=i.sources&&i.sources[n.source],a=e&&Wr(e.type);e?a===`vector`&&o===`raster`?t.push(new F(r,n.source,`layer "${n.id}" requires a raster source`)):a!==`raster-dem`&&o===`hillshade`?t.push(new F(r,n.source,`layer "${n.id}" requires a raster-dem source`)):a===`raster`&&o!==`raster`?t.push(new F(r,n.source,`layer "${n.id}" requires a vector source`)):a!==`vector`||n[`source-layer`]?a===`raster-dem`&&o!==`hillshade`?t.push(new F(r,n.source,`raster-dem source can only be used with layer type 'hillshade'.`)):o!==`line`||!n.paint||!n.paint[`line-gradient`]||a===`geojson`&&e.lineMetrics||t.push(new F(r,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new F(r,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new F(r,n.source,`source "${n.source}" not found`))}else t.push(new F(r,n,`missing required property "source"`));return t=t.concat(Kr({key:r,value:n,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${r}.type`,value:n.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:n,objectKey:`type`}),filter:Qr,layout:e=>Kr({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>ni(Ce({layerType:o},e))}}),paint:e=>Kr({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>ti(Ce({layerType:o},e))}})}})),t}function ii(e){let t=e.value,n=e.key,r=q(t);return r===`string`?[]:[new F(n,t,`string expected, ${r} found`)]}let ai={promoteId:function({key:e,value:t}){if(q(t)===`string`)return ii({key:e,value:t});{let n=[];for(let r in t)n.push(...ii({key:`${e}.${r}`,value:t[r]}));return n}}};function oi(e){let t=e.value,n=e.key,r=e.styleSpec,i=e.style,a=e.validateSpec;if(!t.type)return[new F(n,t,`"type" is required`)];let o=Wr(t.type),s;switch(o){case`vector`:case`raster`:return s=Kr({key:n,value:t,valueSpec:r[`source_${o.replace(`-`,`_`)}`],style:e.style,styleSpec:r,objectElementValidators:ai,validateSpec:a}),s;case`raster-dem`:return s=function(e){let t=e.sourceName??``,n=e.value,r=e.styleSpec,i=r.source_raster_dem,a=e.style,o=[],s=q(n);if(n===void 0)return o;if(s!==`object`)return o.push(new F(`source_raster_dem`,n,`object expected, ${s} found`)),o;let c=Wr(n.encoding)===`custom`,l=[`redFactor`,`greenFactor`,`blueFactor`,`baseShift`],u=e.value.encoding?`"${e.value.encoding}"`:`Default`;for(let s in n)!c&&l.includes(s)?o.push(new F(s,n[s],`In "${t}": "${s}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):i[s]?o=o.concat(e.validateSpec({key:s,value:n[s],valueSpec:i[s],validateSpec:e.validateSpec,style:a,styleSpec:r})):o.push(new F(s,n[s],`unknown property "${s}"`));return o}({sourceName:n,value:t,style:e.style,styleSpec:r,validateSpec:a}),s;case`geojson`:if(s=Kr({key:n,value:t,valueSpec:r.source_geojson,style:i,styleSpec:r,validateSpec:a,objectElementValidators:ai}),t.cluster)for(let e in t.clusterProperties){let[r,i]=t.clusterProperties[e],o=typeof r==`string`?[r,[`accumulated`],[`get`,e]]:r;s.push(...Xr({key:`${n}.${e}.map`,value:i,validateSpec:a,expressionContext:`cluster-map`})),s.push(...Xr({key:`${n}.${e}.reduce`,value:o,validateSpec:a,expressionContext:`cluster-reduce`}))}return s;case`video`:return Kr({key:n,value:t,valueSpec:r.source_video,style:i,validateSpec:a,styleSpec:r});case`image`:return Kr({key:n,value:t,valueSpec:r.source_image,style:i,validateSpec:a,styleSpec:r});case`canvas`:return[new F(n,null,`Please use runtime APIs to add canvas sources, rather than including them in stylesheets.`,`source.canvas`)];default:return Zr({key:`${n}.type`,value:t.type,valueSpec:{values:[`vector`,`raster`,`raster-dem`,`geojson`,`video`,`image`]},style:i,validateSpec:a,styleSpec:r})}}function si(e){let t=e.value,n=e.styleSpec,r=n.light,i=e.style,a=[],o=q(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new F(`light`,t,`object expected, ${o} found`)]),a;for(let o in t){let s=o.match(/^(.*)-transition$/);a=a.concat(s&&r[s[1]]&&r[s[1]].transition?e.validateSpec({key:o,value:t[o],valueSpec:n.transition,validateSpec:e.validateSpec,style:i,styleSpec:n}):r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new F(o,t[o],`unknown property "${o}"`)])}return a}function ci(e){let t=e.value,n=e.styleSpec,r=n.sky,i=e.style,a=q(t);if(t===void 0)return[];if(a!==`object`)return[new F(`sky`,t,`object expected, ${a} found`)];let o=[];for(let a in t)o=o.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n}):[new F(a,t[a],`unknown property "${a}"`)]);return o}function li(e){let t=e.value,n=e.styleSpec,r=n.terrain,i=e.style,a=[],o=q(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new F(`terrain`,t,`object expected, ${o} found`)]),a;for(let o in t)a=a.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new F(o,t[o],`unknown property "${o}"`)]);return a}function ui(e){let t=[],n=e.value,r=e.key;if(Array.isArray(n)){let i=[],a=[];for(let o in n)n[o].id&&i.includes(n[o].id)&&t.push(new F(r,n,`all the sprites' ids must be unique, but ${n[o].id} is duplicated`)),i.push(n[o].id),n[o].url&&a.includes(n[o].url)&&t.push(new F(r,n,`all the sprites' URLs must be unique, but ${n[o].url} is duplicated`)),a.push(n[o].url),t=t.concat(Kr({key:`${r}[${o}]`,value:n[o],valueSpec:{id:{type:`string`,required:!0},url:{type:`string`,required:!0}},validateSpec:e.validateSpec}));return t}return ii({key:r,value:n})}let di={"*":()=>[],array:qr,boolean:function(e){let t=e.value,n=e.key,r=q(t);return r===`boolean`?[]:[new F(n,t,`boolean expected, ${r} found`)]},number:Jr,color:function(e){let t=e.key,n=e.value,r=q(n);return r===`string`?B.parse(String(n))?[]:[new F(t,n,`color expected, "${n}" found`)]:[new F(t,n,`color expected, ${r} found`)]},constants:Ur,enum:Zr,filter:Qr,function:Yr,layer:ri,object:Kr,source:oi,light:si,sky:ci,terrain:li,projection:function(e){let t=e.value,n=e.styleSpec,r=n.projection,i=e.style,a=q(t);if(t===void 0)return[];if(a!==`object`)return[new F(`projection`,t,`object expected, ${a} found`)];let o=[];for(let a in t)o=o.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n}):[new F(a,t[a],`unknown property "${a}"`)]);return o},string:ii,formatted:function(e){return ii(e).length===0?[]:Xr(e)},resolvedImage:function(e){return ii(e).length===0?[]:Xr(e)},padding:function(e){let t=e.key,n=e.value;if(q(n)===`array`){if(n.length<1||n.length>4)return[new F(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];let r={type:`number`},i=[];for(let a=0;a<n.length;a++)i=i.concat(e.validateSpec({key:`${t}[${a}]`,value:n[a],validateSpec:e.validateSpec,valueSpec:r}));return i}return Jr({key:t,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(e){let t=e.key,n=e.value,r=q(n),i=e.styleSpec;if(r!==`array`||n.length<1||n.length%2!=0)return[new F(t,n,`variableAnchorOffsetCollection requires a non-empty array of even length`)];let a=[];for(let r=0;r<n.length;r+=2)a=a.concat(Zr({key:`${t}[${r}]`,value:n[r],valueSpec:i.layout_symbol[`text-anchor`]})),a=a.concat(qr({key:`${t}[${r+1}]`,value:n[r+1],valueSpec:{length:2,value:`number`},validateSpec:e.validateSpec,style:e.style,styleSpec:i}));return a},sprite:ui};function fi(e){let t=e.value,n=e.valueSpec,r=e.styleSpec;return e.validateSpec=fi,n.expression&&hr(Wr(t))?Yr(e):n.expression&&wr(Gr(t))?Xr(e):n.type&&di[n.type]?di[n.type](e):Kr(Ce({},e,{valueSpec:n.type?r[n.type]:n}))}function pi(e){let t=e.value,n=e.key,r=ii(e);return r.length||(t.indexOf(`{fontstack}`)===-1&&r.push(new F(n,t,`"glyphs" url must include a "{fontstack}" token`)),t.indexOf(`{range}`)===-1&&r.push(new F(n,t,`"glyphs" url must include a "{range}" token`))),r}function mi(e,t=N){let n=[];return n=n.concat(fi({key:``,value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:fi,objectElementValidators:{glyphs:pi,"*":()=>[]}})),e.constants&&(n=n.concat(Ur({key:`constants`,value:e.constants,style:e,styleSpec:t,validateSpec:fi}))),gi(n)}function hi(e){return function(t){return e({...t,validateSpec:fi})}}function gi(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function _i(e){return function(...t){return gi(e.apply(this,t))}}mi.source=_i(hi(oi)),mi.sprite=_i(hi(ui)),mi.glyphs=_i(hi(pi)),mi.light=_i(hi(si)),mi.sky=_i(hi(ci)),mi.terrain=_i(hi(li)),mi.layer=_i(hi(ri)),mi.filter=_i(hi(Qr)),mi.paintProperty=_i(hi(ti)),mi.layoutProperty=_i(hi(ni));let vi=mi,yi=vi.light,bi=vi.sky,xi=vi.paintProperty,Si=vi.layoutProperty;function Ci(e,t){let n=!1;if(t&&t.length)for(let r of t)e.fire(new de(Error(r.message))),n=!0;return n}class wi{constructor(e,t,n){let r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let i=new Int32Array(this.arrayBuffer);e=i[0],this.d=(t=i[1])+2*(n=i[2]);for(let e=0;e<this.d*this.d;e++){let t=i[3+e],n=i[3+e+1];r.push(t===n?null:i.subarray(t,n))}let a=i[3+r.length+1];this.keys=i.subarray(i[3+r.length],a),this.bboxes=i.subarray(a),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let e=0;e<this.d*this.d;e++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;let i=n/t*e;this.min=-i,this.max=e+i}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}_insertReadonly(){throw Error(`Cannot insert into a GridIndex created from an ArrayBuffer.`)}_insertCell(e,t,n,r,i,a){this.cells[i].push(a)}query(e,t,n,r,i){let a=this.min,o=this.max;if(e<=a&&t<=a&&o<=n&&o<=r&&!i)return Array.prototype.slice.call(this.keys);{let a=[];return this._forEachCell(e,t,n,r,this._queryCell,a,{},i),a}}_queryCell(e,t,n,r,i,a,o,s){let c=this.cells[i];if(c!==null){let i=this.keys,l=this.bboxes;for(let u=0;u<c.length;u++){let d=c[u];if(o[d]===void 0){let c=4*d;(s?s(l[c+0],l[c+1],l[c+2],l[c+3]):e<=l[c+2]&&t<=l[c+3]&&n>=l[c+0]&&r>=l[c+1])?(o[d]=!0,a.push(i[d])):o[d]=!1}}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToCellCoord(e),l=this._convertToCellCoord(t),u=this._convertToCellCoord(n),d=this._convertToCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++){let l=this.d*c+f;if((!s||s(this._convertFromCellCoord(f),this._convertFromCellCoord(c),this._convertFromCellCoord(f+1),this._convertFromCellCoord(c+1)))&&i.call(this,e,t,n,r,l,a,o,s))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,t=3+this.cells.length+1+1,n=0;for(let e=0;e<this.cells.length;e++)n+=this.cells[e].length;let r=new Int32Array(t+n+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let i=t;for(let t=0;t<e.length;t++){let n=e[t];r[3+t]=i,r.set(n,i),i+=n.length}return r[3+e.length]=i,r.set(this.keys,i),i+=this.keys.length,r[3+e.length+1]=i,r.set(this.bboxes,i),i+=this.bboxes.length,r.buffer}static serialize(e,t){let n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new wi(e.buffer)}}let Ti={};function J(e,t,n={}){if(Ti[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),Ti[e]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}J(`Object`,Object),J(`TransferableGridIndex`,wi),J(`Color`,B),J(`Error`,Error),J(`AJAXError`,ie),J(`ResolvedImage`,ft),J(`StylePropertyFunction`,kr),J(`StyleExpression`,Cr,{omit:[`_evaluator`]}),J(`ZoomDependentExpression`,Dr),J(`ZoomConstantExpression`,Er),J(`CompoundExpression`,tr,{omit:[`_evaluate`]});for(let e in er)er[e]._classRegistryKey||J(`Expression_${e}`,er[e]);function Ei(e){return e&&typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name===`ArrayBuffer`)}function Di(e){return e.$name||e.constructor._classRegistryKey}function Oi(e){return!function(e){if(typeof e!=`object`||!e)return!1;let t=Di(e);return!(!t||t===`Object`)}(e)&&(e==null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||Ei(e)||D(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function ki(e,t){if(Oi(e))return(Ei(e)||D(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let n=[];for(let r of e)n.push(ki(r,t));return n}if(typeof e!=`object`)throw Error(`can't serialize object of type `+typeof e);let n=Di(e);if(!n)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!Ti[n])throw Error(`${n} is not registered.`);let{klass:r}=Ti[n],i=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&i===t[t.length-1])throw Error(`statically serialized object won't survive transfer of $name property`)}else{for(let r in e){if(!e.hasOwnProperty(r)||Ti[n].omit.indexOf(r)>=0)continue;let a=e[r];i[r]=Ti[n].shallow.indexOf(r)>=0?a:ki(a,t)}e instanceof Error&&(i.message=e.message)}if(i.$name)throw Error(`$name property is reserved for worker serialization logic.`);return n!==`Object`&&(i.$name=n),i}function Ai(e){if(Oi(e))return e;if(Array.isArray(e))return e.map(Ai);if(typeof e!=`object`)throw Error(`can't deserialize object of type `+typeof e);let t=Di(e)||`Object`;if(!Ti[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:n}=Ti[t];if(!n)throw Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(e);let r=Object.create(n.prototype);for(let n of Object.keys(e)){if(n===`$name`)continue;let i=e[n];r[n]=Ti[t].shallow.indexOf(n)>=0?i:Ai(i)}return r}class ji{constructor(){this.first=!0}update(e,t){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=n,!0))}}let Y={"Latin-1 Supplement":e=>e>=128&&e<=255,"Hangul Jamo":e=>e>=4352&&e<=4607,Khmer:e=>e>=6016&&e<=6143,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Katakana:e=>e>=12448&&e<=12543,Kanbun:e=>e>=12688&&e<=12703,"CJK Strokes":e=>e>=12736&&e<=12783,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"Private Use Area":e=>e>=57344&&e<=63743,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function Mi(e){for(let t of e)if(Ri(t.charCodeAt(0)))return!0;return!1}function Ni(e){for(let t of e)if(!Ii(t.charCodeAt(0)))return!1;return!0}function Pi(e){let t=e.map((e=>{try{return RegExp(`\\p{sc=${e}}`,`u`).source}catch{return null}})).filter((e=>e));return new RegExp(t.join(`|`),`u`)}let Fi=Pi([`Arab`,`Dupl`,`Mong`,`Ougr`,`Syrc`]);function Ii(e){return!Fi.test(String.fromCodePoint(e))}let Li=Pi([`Bopo`,`Hani`,`Hira`,`Kana`,`Kits`,`Nshu`,`Tang`,`Yiii`]);function Ri(e){return!(e!==746&&e!==747&&(e<4352||!(Y[`CJK Compatibility Forms`](e)&&!(e>=65097&&e<=65103)||Y[`CJK Compatibility`](e)||Y[`CJK Strokes`](e)||!(!Y[`CJK Symbols and Punctuation`](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||e===12336)||Y[`Enclosed CJK Letters and Months`](e)||Y[`Ideographic Description Characters`](e)||Y.Kanbun(e)||Y.Katakana(e)&&e!==12540||!(!Y[`Halfwidth and Fullwidth Forms`](e)||e===65288||e===65289||e===65293||e>=65306&&e<=65310||e===65339||e===65341||e===65343||e>=65371&&e<=65503||e===65507||e>=65512&&e<=65519)||!(!Y[`Small Form Variants`](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||Y[`Vertical Forms`](e)||Y[`Yijing Hexagram Symbols`](e)||/\p{sc=Cans}/u.test(String.fromCodePoint(e))||/\p{sc=Hang}/u.test(String.fromCodePoint(e))||Li.test(String.fromCodePoint(e)))))}function zi(e){return!(Ri(e)||function(e){return!!(Y[`Latin-1 Supplement`](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Y[`General Punctuation`](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Y[`Letterlike Symbols`](e)||Y[`Number Forms`](e)||Y[`Miscellaneous Technical`](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Y[`Control Pictures`](e)&&e!==9251||Y[`Optical Character Recognition`](e)||Y[`Enclosed Alphanumerics`](e)||Y[`Geometric Shapes`](e)||Y[`Miscellaneous Symbols`](e)&&!(e>=9754&&e<=9759)||Y[`Miscellaneous Symbols and Arrows`](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Y[`CJK Symbols and Punctuation`](e)||Y.Katakana(e)||Y[`Private Use Area`](e)||Y[`CJK Compatibility Forms`](e)||Y[`Small Form Variants`](e)||Y[`Halfwidth and Fullwidth Forms`](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(e))}let Bi=Pi(`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`.split(`.`));function Vi(e){return Bi.test(String.fromCodePoint(e))}function Hi(e,t){return!(!t&&Vi(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||Y.Khmer(e))}function Ui(e){for(let t of e)if(Vi(t.charCodeAt(0)))return!0;return!1}let Wi=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus=`unavailable`,this.pluginURL=null}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class X{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ji,this.transition={})}isSupportedScript(e){return function(e,t){for(let n of e)if(!Hi(n.charCodeAt(0),t))return!1;return!0}(e,Wi.getRTLTextPluginStatus()===`loaded`)}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*t}}}class Gi{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(hr(e))return new kr(e,t);if(wr(e)){let n=Or(e,t);if(n.result===`error`)throw Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return n.value}{let n=e;return t.type===`color`&&typeof e==`string`?n=B.parse(e):t.type!==`padding`||typeof e!=`number`&&!Array.isArray(e)?t.type===`variableAnchorOffsetCollection`&&Array.isArray(e)&&(n=dt.parse(e)):n=lt.parse(e),{kind:`constant`,evaluate:()=>n}}}(t===void 0?e.specification.default:t,e.specification)}isDataDriven(){return this.expression.kind===`source`||this.expression.kind===`composite`}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}}class Ki{constructor(e){this.property=e,this.value=new Gi(e,void 0)}transitioned(e,t){return new Ji(this.property,this.value,t,_({},e.transition,this.transition),e.now)}untransitioned(){return new Ji(this.property,this.value,null,{},0)}}class qi{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return x(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ki(this._values[e].property)),this._values[e].value=new Gi(this._values[e].property,t===null?void 0:x(t))}getTransition(e){return x(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ki(this._values[e].property)),this._values[e].transition=x(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n);let r=this.getTransition(t);r!==void 0&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){let n=new Yi(this._properties);for(let r of Object.keys(this._values))n._values[r]=this._values[r].transitioned(e,t._values[r]);return n}untransitioned(){let e=new Yi(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Ji{constructor(e,t,n,r,i){this.property=e,this.value=t,this.begin=i+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){let r=e.now||0,i=this.value.possiblyEvaluate(e,t,n),a=this.prior;if(a){if(r>this.end||this.value.isDataDriven())return this.prior=null,i;if(r<this.begin)return a.possiblyEvaluate(e,t,n);{let o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,n),i,function(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}(o))}}return i}}class Yi{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){let r=new Qi(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Xi{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return x(this._values[e].value)}setValue(e,t){this._values[e]=new Gi(this._values[e].property,t===null?void 0:x(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n)}return e}possiblyEvaluate(e,t,n){let r=new Qi(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}}class Zi{constructor(e,t,n){this.property=e,this.value=t,this.parameters=n}isConstant(){return this.value.kind===`constant`}constantOr(e){return this.value.kind===`constant`?this.value.value:e}evaluate(e,t,n,r){return this.property.evaluate(this.value,this.parameters,e,t,n,r)}}class Qi{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Z{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw Error(`Value should not be data driven`);return e.expression.evaluate(t)}interpolate(e,t,n){let r=Vt[this.specification.type];return r?r(e,t,n):e}}class Q{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,r){return new Zi(this,e.expression.kind===`constant`||e.expression.kind===`camera`?{kind:`constant`,value:e.expression.evaluate(t,null,{},n,r)}:e.expression,t)}interpolate(e,t,n){if(e.value.kind!==`constant`||t.value.kind!==`constant`)return e;if(e.value.value===void 0||t.value.value===void 0)return new Zi(this,{kind:`constant`,value:void 0},e.parameters);let r=Vt[this.specification.type];if(r){let i=r(e.value.value,t.value.value,n);return new Zi(this,{kind:`constant`,value:i},e.parameters)}return e}evaluate(e,t,n,r,i,a){return e.kind===`constant`?e.value:e.evaluate(t,n,r,i,a)}}class $i extends Q{possiblyEvaluate(e,t,n,r){if(e.value===void 0)return new Zi(this,{kind:`constant`,value:void 0},t);if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r),a=e.property.specification.type===`resolvedImage`&&typeof i!=`string`?i.name:i,o=this._calculate(a,a,a,t);return new Zi(this,{kind:`constant`,value:o},t)}if(e.expression.kind===`camera`){let n=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Zi(this,{kind:`constant`,value:n},t)}return new Zi(this,e.expression,t)}evaluate(e,t,n,r,i,a){if(e.kind===`source`){let o=e.evaluate(t,n,r,i,a);return this._calculate(o,o,o,t)}return e.kind===`composite`?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,r),e.evaluate({zoom:Math.floor(t.zoom)},n,r),e.evaluate({zoom:Math.floor(t.zoom)+1},n,r),t):e.value}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class ea{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){if(e.value!==void 0){if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r);return this._calculate(i,i,i,t)}return this._calculate(e.expression.evaluate(new X(Math.floor(t.zoom-1),t)),e.expression.evaluate(new X(Math.floor(t.zoom),t)),e.expression.evaluate(new X(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class ta{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){return!!e.expression.evaluate(t,null,{},n,r)}interpolate(){return!1}}class na{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let n=e[t];n.specification.overridable&&this.overridableProperties.push(t);let r=this.defaultPropertyValues[t]=new Gi(n,void 0),i=this.defaultTransitionablePropertyValues[t]=new Ki(n);this.defaultTransitioningPropertyValues[t]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}J(`DataDrivenProperty`,Q),J(`DataConstantProperty`,Z),J(`CrossFadedDataDrivenProperty`,$i),J(`CrossFadedProperty`,ea),J(`ColorRampProperty`,ta);let ra=`-transition`;class ia extends fe{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!==`custom`&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!==`background`&&(this.source=e.source,this.sourceLayer=e[`source-layer`],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new Xi(t.layout)),t.paint)){this._transitionablePaint=new qi(t.paint);for(let t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Qi(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e===`visibility`?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,n={}){t!=null&&this._validate(Si,`layers.${this.id}.layout.${e}`,e,t,n)||(e===`visibility`?this.visibility=t:this._unevaluatedLayout.setValue(e,t))}getPaintProperty(e){return e.endsWith(ra)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(t!=null&&this._validate(xi,`layers.${this.id}.paint.${e}`,e,t,n))return!1;if(e.endsWith(ra))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let n=this._transitionablePaint._values[e],r=n.property.specification[`property-type`]===`cross-faded-data-driven`,i=n.value.isDataDriven(),a=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let o=this._transitionablePaint._values[e].value;return o.isDataDriven()||i||r||this._handleOverridablePaintPropertyUpdate(e,a,o)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility===`none`}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),b(e,((e,t)=>!(e===void 0||t===`layout`&&!Object.keys(e).length||t===`paint`&&!Object.keys(e).length)))}_validate(e,t,n,r,i={}){return(!i||!1!==i.validate)&&Ci(this,e.call(vi,{key:t,layerType:this.type,objectKey:n,value:r,styleSpec:N,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(t instanceof Zi&&fr(t.property.specification)&&(t.value.kind===`source`||t.value.kind===`composite`)&&t.value.isStateDependent)return!0}return!1}}let aa={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class oa{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class sa{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw Error(`_refreshViews() must be implemented by each concrete StructArray layout`)}}function ca(e,t=1){let n=0,r=0;return{members:e.map((e=>{let i=aa[e.type].BYTES_PER_ELEMENT,a=n=la(n,Math.max(t,i)),o=e.components||1;return r=Math.max(r,i),n+=i*o,{name:e.name,type:e.type,components:o,offset:a}})),size:la(n,Math.max(r,t)),alignment:t}}function la(e,t){return Math.ceil(e/t)*t}class ua extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.int16[r+0]=t,this.int16[r+1]=n,e}}ua.prototype.bytesPerElement=4,J(`StructArrayLayout2i4`,ua);class da extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=r,e}}da.prototype.bytesPerElement=6,J(`StructArrayLayout3i6`,da);class fa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.int16[a+0]=t,this.int16[a+1]=n,this.int16[a+2]=r,this.int16[a+3]=i,e}}fa.prototype.bytesPerElement=8,J(`StructArrayLayout4i8`,fa);class pa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}pa.prototype.bytesPerElement=12,J(`StructArrayLayout2i4i12`,pa);class ma extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=4*e,c=8*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.uint8[c+4]=r,this.uint8[c+5]=i,this.uint8[c+6]=a,this.uint8[c+7]=o,e}}ma.prototype.bytesPerElement=8,J(`StructArrayLayout2i4ub8`,ma);class ha extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.float32[r+0]=t,this.float32[r+1]=n,e}}ha.prototype.bytesPerElement=8,J(`StructArrayLayout2f8`,ha);class ga extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,n,r,i,a,o,s,c,l)}emplace(e,t,n,r,i,a,o,s,c,l,u){let d=10*e;return this.uint16[d+0]=t,this.uint16[d+1]=n,this.uint16[d+2]=r,this.uint16[d+3]=i,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=c,this.uint16[d+8]=l,this.uint16[d+9]=u,e}}ga.prototype.bytesPerElement=20,J(`StructArrayLayout10ui20`,ga);class _a extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,e,t,n,r,i,a,o,s,c,l,u,d)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f){let p=12*e;return this.int16[p+0]=t,this.int16[p+1]=n,this.int16[p+2]=r,this.int16[p+3]=i,this.uint16[p+4]=a,this.uint16[p+5]=o,this.uint16[p+6]=s,this.uint16[p+7]=c,this.int16[p+8]=l,this.int16[p+9]=u,this.int16[p+10]=d,this.int16[p+11]=f,e}}_a.prototype.bytesPerElement=24,J(`StructArrayLayout4i4ui4i24`,_a);class va extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}va.prototype.bytesPerElement=12,J(`StructArrayLayout3f12`,va);class ya extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}ya.prototype.bytesPerElement=4,J(`StructArrayLayout1ul4`,ya);class ba extends sa{_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(e,t,n,r,i,a,o,s,c){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,r,i,a,o,s,c)}emplace(e,t,n,r,i,a,o,s,c,l){let u=10*e,d=5*e;return this.int16[u+0]=t,this.int16[u+1]=n,this.int16[u+2]=r,this.int16[u+3]=i,this.int16[u+4]=a,this.int16[u+5]=o,this.uint32[d+3]=s,this.uint16[u+8]=c,this.uint16[u+9]=l,e}}ba.prototype.bytesPerElement=20,J(`StructArrayLayout6i1ul2ui20`,ba);class xa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}xa.prototype.bytesPerElement=12,J(`StructArrayLayout2i2i2i12`,xa);class Sa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r,i)}emplace(e,t,n,r,i,a){let o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=r,this.int16[s+6]=i,this.int16[s+7]=a,e}}Sa.prototype.bytesPerElement=16,J(`StructArrayLayout2f1f2i16`,Sa);class Ca extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=16*e,c=4*e,l=8*e;return this.uint8[s+0]=t,this.uint8[s+1]=n,this.float32[c+1]=r,this.float32[c+2]=i,this.int16[l+6]=a,this.int16[l+7]=o,e}}Ca.prototype.bytesPerElement=16,J(`StructArrayLayout2ub2f2i16`,Ca);class wa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.uint16[i+0]=t,this.uint16[i+1]=n,this.uint16[i+2]=r,e}}wa.prototype.bytesPerElement=6,J(`StructArrayLayout3ui6`,wa);class Ta extends sa{_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(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=24*e,y=12*e,b=48*e;return this.int16[v+0]=t,this.int16[v+1]=n,this.uint16[v+2]=r,this.uint16[v+3]=i,this.uint32[y+2]=a,this.uint32[y+3]=o,this.uint32[y+4]=s,this.uint16[v+10]=c,this.uint16[v+11]=l,this.uint16[v+12]=u,this.float32[y+7]=d,this.float32[y+8]=f,this.uint8[b+36]=p,this.uint8[b+37]=m,this.uint8[b+38]=h,this.uint32[y+10]=g,this.int16[v+22]=_,e}}Ta.prototype.bytesPerElement=48,J(`StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48`,Ta);class Ea extends sa{_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(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D){let O=this.length;return this.resize(O+1),this.emplace(O,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O){let k=32*e,A=16*e;return this.int16[k+0]=t,this.int16[k+1]=n,this.int16[k+2]=r,this.int16[k+3]=i,this.int16[k+4]=a,this.int16[k+5]=o,this.int16[k+6]=s,this.int16[k+7]=c,this.uint16[k+8]=l,this.uint16[k+9]=u,this.uint16[k+10]=d,this.uint16[k+11]=f,this.uint16[k+12]=p,this.uint16[k+13]=m,this.uint16[k+14]=h,this.uint16[k+15]=g,this.uint16[k+16]=_,this.uint16[k+17]=v,this.uint16[k+18]=y,this.uint16[k+19]=b,this.uint16[k+20]=x,this.uint16[k+21]=S,this.uint16[k+22]=C,this.uint32[A+12]=w,this.float32[A+13]=T,this.float32[A+14]=E,this.uint16[k+30]=D,this.uint16[k+31]=O,e}}Ea.prototype.bytesPerElement=64,J(`StructArrayLayout8i15ui1ul2f2ui64`,Ea);class Da extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Da.prototype.bytesPerElement=4,J(`StructArrayLayout1f4`,Da);class Oa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.uint16[6*e+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}Oa.prototype.bytesPerElement=12,J(`StructArrayLayout1ui2f12`,Oa);class ka extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=4*e;return this.uint32[2*e+0]=t,this.uint16[i+2]=n,this.uint16[i+3]=r,e}}ka.prototype.bytesPerElement=8,J(`StructArrayLayout1ul2ui8`,ka);class Aa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=n,e}}Aa.prototype.bytesPerElement=4,J(`StructArrayLayout2ui4`,Aa);class ja extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}ja.prototype.bytesPerElement=2,J(`StructArrayLayout1ui2`,ja);class Ma extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=r,this.float32[a+3]=i,e}}Ma.prototype.bytesPerElement=16,J(`StructArrayLayout4f16`,Ma);class Na extends oa{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 a(this.anchorPointX,this.anchorPointY)}}Na.prototype.size=20;class Pa extends ba{get(e){return new Na(this,e)}}J(`CollisionBoxArray`,Pa);class Fa extends oa{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Fa.prototype.size=48;class Ia extends Ta{get(e){return new Fa(this,e)}}J(`PlacedSymbolArray`,Ia);class La extends oa{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}La.prototype.size=64;class Ra extends Ea{get(e){return new La(this,e)}}J(`SymbolInstanceArray`,Ra);class za extends Da{getoffsetX(e){return this.float32[1*e+0]}}J(`GlyphOffsetArray`,za);class Ba extends da{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}J(`SymbolLineVertexArray`,Ba);class Va extends oa{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]}}Va.prototype.size=12;class Ha extends Oa{get(e){return new Va(this,e)}}J(`TextAnchorOffsetArray`,Ha);class Ua extends oa{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]}}Ua.prototype.size=8;class Wa extends ka{get(e){return new Ua(this,e)}}J(`FeatureIndexArray`,Wa);class Ga extends ua{}class Ka extends ua{}class qa extends ua{}class Ja extends pa{}class Ya extends ma{}class Xa extends ha{}class Za extends ga{}class Qa extends _a{}class $a extends va{}class eo extends ya{}class to extends xa{}class no extends Ca{}class ro extends wa{}class io extends Aa{}let{members:ao}=ca([{name:`a_pos`,components:2,type:`Int16`}],4);class oo{constructor(e=[]){this.segments=e}prepareSegment(e,t,n,r){let i=this.segments[this.segments.length-1];return e>oo.MAX_VERTEX_ARRAY_LENGTH&&C(`Max vertices per segment is ${oo.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!i||i.vertexLength+e>oo.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==r)&&(i={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},r!==void 0&&(i.sortKey=r),this.segments.push(i)),i}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,r){return new oo([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:r,vaos:{},sortKey:0}])}}function so(e,t){return 256*(e=h(Math.floor(e),0,255))+h(Math.floor(t),0,255)}oo.MAX_VERTEX_ARRAY_LENGTH=2**16-1,J(`SegmentVector`,oo);let co=ca([{name:`a_pattern_from`,components:4,type:`Uint16`},{name:`a_pattern_to`,components:4,type:`Uint16`},{name:`a_pixel_ratio_from`,components:1,type:`Uint16`},{name:`a_pixel_ratio_to`,components:1,type:`Uint16`}]);var lo={exports:{}},uo={exports:{}};uo.exports=function(e,t){var n,r,i,a,o,s,c,l;for(r=e.length-(n=3&e.length),i=t,o=3432918353,s=461845907,l=0;l<r;)c=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,i=27492+(65535&(a=5*(65535&(i=(i^=c=(65535&(c=(c=(65535&c)*o+(((c>>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(c=0,n){case 3:c^=(255&e.charCodeAt(l+2))<<16;case 2:c^=(255&e.charCodeAt(l+1))<<8;case 1:i^=c=(65535&(c=(c=(65535&(c^=255&e.charCodeAt(l)))*o+(((c>>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295}return i^=e.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var fo=uo.exports,po={exports:{}};po.exports=function(e,t){for(var n,r=e.length,i=t^r,a=0;r>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))+((1540483477*(n>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++a;switch(r){case 3:i^=(255&e.charCodeAt(a+2))<<16;case 2:i^=(255&e.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var mo=fo,ho=po.exports;lo.exports=mo,lo.exports.murmur3=mo,lo.exports.murmur2=ho;var go=n(lo.exports);class _o{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,r){this.ids.push(vo(e)),this.positions.push(t,n,r)}getPositions(e){if(!this.indexed)throw Error(`Trying to get index, but feature positions are not indexed`);let t=vo(e),n=0,r=this.ids.length-1;for(;n<r;){let e=n+r>>1;this.ids[e]>=t?r=e:n=e+1}let i=[];for(;this.ids[n]===t;)i.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return i}static serialize(e,t){let n=new Float64Array(e.ids),r=new Uint32Array(e.positions);return yo(n,r,0,n.length-1),t&&t.push(n.buffer,r.buffer),{ids:n,positions:r}}static deserialize(e){let t=new _o;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function vo(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:go(String(e))}function yo(e,t,n,r){for(;n<r;){let i=e[n+r>>1],a=n-1,o=r+1;for(;;){do a++;while(e[a]<i);do o--;while(e[o]>i);if(a>=o)break;bo(e,a,o),bo(t,3*a,3*o),bo(t,3*a+1,3*o+1),bo(t,3*a+2,3*o+2)}o-n<r-o?(yo(e,t,n,o),n=o+1):(yo(e,t,o+1,r),r=o)}}function bo(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}J(`FeaturePositionMap`,_o);class xo{constructor(e,t){this.gl=e.gl,this.location=t}}class So extends xo{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Co extends xo{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class wo extends xo{constructor(e,t){super(e,t),this.current=B.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}let To=new Float32Array(16);function Eo(e){return[so(255*e.r,255*e.g),so(255*e.b,255*e.a)]}class Do{constructor(e,t,n){this.value=e,this.uniformNames=t.map((e=>`u_${e}`)),this.type=n}setUniform(e,t,n){e.set(n.constantOr(this.value))}getBinding(e,t,n){return this.type===`color`?new wo(e,t):new So(e,t)}}class Oo{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,n,r){let i=r===`u_pattern_to`?this.patternTo:r===`u_pattern_from`?this.patternFrom:r===`u_pixel_ratio_to`?this.pixelRatioTo:r===`u_pixel_ratio_from`?this.pixelRatioFrom:null;i&&e.set(i)}getBinding(e,t,n){return n.substr(0,9)===`u_pattern`?new Co(e,t):new So(e,t)}}class ko{constructor(e,t,n,r){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,n,r,i){let a=this.paintVertexArray.length,o=this.expression.evaluate(new X(0),t,{},r,[],i);this.paintVertexArray.resize(e),this._setPaintValue(a,e,o)}updatePaintArray(e,t,n,r){let i=this.expression.evaluate({zoom:0},n,r);this._setPaintValue(e,t,i)}_setPaintValue(e,t,n){if(this.type===`color`){let r=Eo(n);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ao{constructor(e,t,n,r,i,a){this.expression=e,this.uniformNames=t.map((e=>`u_${e}_t`)),this.type=n,this.useIntegerZoom=r,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?4:2,offset:0}))),this.paintVertexArray=new a}populatePaintArray(e,t,n,r,i){let a=this.expression.evaluate(new X(this.zoom),t,{},r,[],i),o=this.expression.evaluate(new X(this.zoom+1),t,{},r,[],i),s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(s,e,a,o)}updatePaintArray(e,t,n,r){let i=this.expression.evaluate({zoom:this.zoom},n,r),a=this.expression.evaluate({zoom:this.zoom+1},n,r);this._setPaintValue(e,t,i,a)}_setPaintValue(e,t,n,r){if(this.type===`color`){let i=Eo(n),a=Eo(r);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i[0],i[1],a[0],a[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n,r);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let n=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=h(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,n){return new So(e,t)}}class jo{constructor(e,t,n,r,i,a){this.expression=e,this.type=t,this.useIntegerZoom=n,this.zoom=r,this.layerId=a,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i}populatePaintArray(e,t,n){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,t.patterns&&t.patterns[this.layerId],n)}updatePaintArray(e,t,n,r,i){this._setPaintValues(e,t,n.patterns&&n.patterns[this.layerId],i)}_setPaintValues(e,t,n,r){if(!r||!n)return;let{min:i,mid:a,max:o}=n,s=r[i],c=r[a],l=r[o];if(s&&c&&l)for(let n=e;n<t;n++)this.zoomInPaintVertexArray.emplace(n,c.tl[0],c.tl[1],c.br[0],c.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],c.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(n,c.tl[0],c.tl[1],c.br[0],c.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],c.pixelRatio,l.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,co.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,co.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Mo{constructor(e,t,n){this.binders={},this._buffers=[];let r=[];for(let i in e.paint._values){if(!n(i))continue;let a=e.paint.get(i);if(!(a instanceof Zi&&fr(a.property.specification)))continue;let o=Po(i,e.type),s=a.value,c=a.property.specification.type,l=a.property.useIntegerZoom,u=a.property.specification[`property-type`],d=u===`cross-faded`||u===`cross-faded-data-driven`;if(s.kind===`constant`)this.binders[i]=d?new Oo(s.value,o):new Do(s.value,o,c),r.push(`/u_${i}`);else if(s.kind===`source`||d){let n=Fo(i,c,`source`);this.binders[i]=d?new jo(s,c,l,t,n,e.id):new ko(s,o,c,n),r.push(`/a_${i}`)}else{let e=Fo(i,c,`composite`);this.binders[i]=new Ao(s,o,c,l,t,e),r.push(`/z_${i}`)}}this.cacheKey=r.sort().join(``)}getMaxValue(e){let t=this.binders[e];return t instanceof ko||t instanceof Ao?t.maxValue:0}populatePaintArrays(e,t,n,r,i){for(let a in this.binders){let o=this.binders[a];(o instanceof ko||o instanceof Ao||o instanceof jo)&&o.populatePaintArray(e,t,n,r,i)}}setConstantPatternPositions(e,t){for(let n in this.binders){let r=this.binders[n];r instanceof Oo&&r.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,n,r,i){let a=!1;for(let o in e){let s=t.getPositions(o);for(let t of s){let s=n.feature(t.index);for(let n in this.binders){let c=this.binders[n];(c instanceof ko||c instanceof Ao||c instanceof jo)&&!0===c.expression.isStateDependent&&(c.expression=r.paint.get(n).value,c.updatePaintArray(t.start,t.end,s,e[o],i),a=!0)}}}return a}defines(){let e=[];for(let t in this.binders){let n=this.binders[t];(n instanceof Do||n instanceof Oo)&&e.push(...n.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof ko||n instanceof Ao)for(let t=0;t<n.paintVertexAttributes.length;t++)e.push(n.paintVertexAttributes[t].name);else if(n instanceof jo)for(let t=0;t<co.members.length;t++)e.push(co.members[t].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof Do||n instanceof Oo||n instanceof Ao)for(let t of n.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let n=[];for(let r in this.binders){let i=this.binders[r];if(i instanceof Do||i instanceof Oo||i instanceof Ao){for(let a of i.uniformNames)if(t[a]){let o=i.getBinding(e,t[a],a);n.push({name:a,property:r,binding:o})}}}return n}setUniforms(e,t,n,r){for(let{name:e,property:i,binding:a}of t)this.binders[i].setUniform(a,r,n.get(i),e)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let n=this.binders[t];if(e&&n instanceof jo){let t=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(n instanceof ko||n instanceof Ao)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let t in this.binders){let n=this.binders[t];(n instanceof ko||n instanceof Ao||n instanceof jo)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof ko||t instanceof Ao||t instanceof jo)&&t.destroy()}}}class No{constructor(e,t,n=(()=>!0)){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new Mo(r,t,n);this.needsUpload=!1,this._featureMap=new _o,this._bufferOffset=0}populatePaintArrays(e,t,n,r,i,a){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,r,i,a);t.id!==void 0&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,r){for(let i of n)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(e,this._featureMap,t,i,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Po(e,t){return{"text-opacity":[`opacity`],"icon-opacity":[`opacity`],"text-color":[`fill_color`],"icon-color":[`fill_color`],"text-halo-color":[`halo_color`],"icon-halo-color":[`halo_color`],"text-halo-blur":[`halo_blur`],"icon-halo-blur":[`halo_blur`],"text-halo-width":[`halo_width`],"icon-halo-width":[`halo_width`],"line-gap-width":[`gapwidth`],"line-pattern":[`pattern_to`,`pattern_from`,`pixel_ratio_to`,`pixel_ratio_from`],"fill-pattern":[`pattern_to`,`pattern_from`,`pixel_ratio_to`,`pixel_ratio_from`],"fill-extrusion-pattern":[`pattern_to`,`pattern_from`,`pixel_ratio_to`,`pixel_ratio_from`]}[e]||[e.replace(`${t}-`,``).replace(/-/g,`_`)]}function Fo(e,t,n){let r={color:{source:ha,composite:Ma},number:{source:Da,composite:ha}},i=function(e){return{"line-pattern":{source:Za,composite:Za},"fill-pattern":{source:Za,composite:Za},"fill-extrusion-pattern":{source:Za,composite:Za}}[e]}(e);return i&&i[n]||r[t][n]}J(`ConstantBinder`,Do),J(`CrossFadedConstantBinder`,Oo),J(`SourceExpressionBinder`,ko),J(`CrossFadedCompositeBinder`,jo),J(`CompositeExpressionBinder`,Ao),J(`ProgramConfiguration`,Mo,{omit:[`_buffers`]}),J(`ProgramConfigurationSet`,No);let Io=8192,Lo=2**14-1,Ro=-Lo-1;function zo(e){let t=Io/e.extent,n=e.loadGeometry();for(let e=0;e<n.length;e++){let r=n[e];for(let e=0;e<r.length;e++){let n=r[e],i=Math.round(n.x*t),a=Math.round(n.y*t);n.x=h(i,Ro,Lo),n.y=h(a,Ro,Lo),(i<n.x||i>n.x+1||a<n.y||a>n.y+1)&&C(`Geometry exceeds allowed extent, reduce your vector tile buffer size`)}}return n}function Bo(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?zo(e):[]}}function Vo(e,t,n,r,i){e.emplaceBack(2*t+(r+1)/2,2*n+(i+1)/2)}class Ho{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ka,this.indexArray=new ro,this.segments=new oo,this.programConfigurations=new No(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){let r=this.layers[0],i=[],a=null,o=!1;r.type===`circle`&&(a=r.layout.get(`circle-sort-key`),o=!a.isConstant());for(let{feature:t,id:r,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Bo(t,e);if(!this.layers[0]._featureFilter.filter(new X(this.zoom),l,n))continue;let u=o?a.evaluate(l,{},n):void 0,d={id:r,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:zo(t),patterns:{},sortKey:u};i.push(d)}o&&i.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of i){let{geometry:i,index:a,sourceLayerIndex:o}=r,s=e[a].feature;this.addFeature(r,i,a,n),t.featureIndex.insert(s,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ao),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,n,r){for(let n of t)for(let t of n){let n=t.x,r=t.y;if(n<0||n>=Io||r<0||r>=Io)continue;let i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=i.vertexLength;Vo(this.layoutVertexArray,n,r,-1,-1),Vo(this.layoutVertexArray,n,r,1,-1),Vo(this.layoutVertexArray,n,r,1,1),Vo(this.layoutVertexArray,n,r,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+3,a+2),i.vertexLength+=4,i.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},r)}}function Uo(e,t){for(let n=0;n<e.length;n++)if(Qo(t,e[n]))return!0;for(let n=0;n<t.length;n++)if(Qo(e,t[n]))return!0;return!!qo(e,t)}function Wo(e,t,n){return!!Qo(e,t)||!!Yo(t,e,n)}function Go(e,t){if(e.length===1)return Zo(t,e[0]);for(let n=0;n<t.length;n++){let r=t[n];for(let t=0;t<r.length;t++)if(Qo(e,r[t]))return!0}for(let n=0;n<e.length;n++)if(Zo(t,e[n]))return!0;for(let n=0;n<t.length;n++)if(qo(e,t[n]))return!0;return!1}function Ko(e,t,n){if(e.length>1){if(qo(e,t))return!0;for(let r=0;r<t.length;r++)if(Yo(t[r],e,n))return!0}for(let r=0;r<e.length;r++)if(Yo(e[r],t,n))return!0;return!1}function qo(e,t){if(e.length===0||t.length===0)return!1;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)if(Jo(r,i,t[e],t[e+1]))return!0}return!1}function Jo(e,t,n,r){return w(e,n,r)!==w(t,n,r)&&w(e,t,n)!==w(e,t,r)}function Yo(e,t,n){let r=n*n;if(t.length===1)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++)if(Xo(e,t[n-1],t[n])<r)return!0;return!1}function Xo(e,t,n){let r=t.distSqr(n);if(r===0)return e.distSqr(t);let i=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/r;return e.distSqr(i<0?t:i>1?n:n.sub(t)._mult(i)._add(t))}function Zo(e,t){let n,r,i,a=!1;for(let o=0;o<e.length;o++){n=e[o];for(let e=0,o=n.length-1;e<n.length;o=e++)r=n[e],i=n[o],r.y>t.y!=i.y>t.y&&t.x<(i.x-r.x)*(t.y-r.y)/(i.y-r.y)+r.x&&(a=!a)}return a}function Qo(e,t){let n=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let a=e[r],o=e[i];a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(n=!n)}return n}function $o(e,t,n){let r=n[0],i=n[2];if(e.x<r.x&&t.x<r.x||e.x>i.x&&t.x>i.x||e.y<r.y&&t.y<r.y||e.y>i.y&&t.y>i.y)return!1;let a=w(e,t,n[0]);return a!==w(e,t,n[1])||a!==w(e,t,n[2])||a!==w(e,t,n[3])}function es(e,t,n){let r=t.paint.get(e).value;return r.kind===`constant`?r.value:n.programConfigurations.get(t.id).getMaxValue(e)}function ts(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ns(e,t,n,r,i){if(!t[0]&&!t[1])return e;let o=a.convert(t)._mult(i);n===`viewport`&&o._rotate(-r);let s=[];for(let t=0;t<e.length;t++)s.push(e[t].sub(o));return s}let rs,is;J(`CircleBucket`,Ho,{omit:[`layers`]});var as={get paint(){return is||=new na({"circle-radius":new Q(N.paint_circle[`circle-radius`]),"circle-color":new Q(N.paint_circle[`circle-color`]),"circle-blur":new Q(N.paint_circle[`circle-blur`]),"circle-opacity":new Q(N.paint_circle[`circle-opacity`]),"circle-translate":new Z(N.paint_circle[`circle-translate`]),"circle-translate-anchor":new Z(N.paint_circle[`circle-translate-anchor`]),"circle-pitch-scale":new Z(N.paint_circle[`circle-pitch-scale`]),"circle-pitch-alignment":new Z(N.paint_circle[`circle-pitch-alignment`]),"circle-stroke-width":new Q(N.paint_circle[`circle-stroke-width`]),"circle-stroke-color":new Q(N.paint_circle[`circle-stroke-color`]),"circle-stroke-opacity":new Q(N.paint_circle[`circle-stroke-opacity`])})},get layout(){return rs||=new na({"circle-sort-key":new Q(N.layout_circle[`circle-sort-key`])})}},os=1e-6,ss=typeof Float32Array<`u`?Float32Array:Array;function cs(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ls(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=n[0],b=n[1],x=n[2],S=n[3];return e[0]=y*r+b*s+x*d+S*h,e[1]=y*i+b*c+x*f+S*g,e[2]=y*a+b*l+x*p+S*_,e[3]=y*o+b*u+x*m+S*v,e[4]=(y=n[4])*r+(b=n[5])*s+(x=n[6])*d+(S=n[7])*h,e[5]=y*i+b*c+x*f+S*g,e[6]=y*a+b*l+x*p+S*_,e[7]=y*o+b*u+x*m+S*v,e[8]=(y=n[8])*r+(b=n[9])*s+(x=n[10])*d+(S=n[11])*h,e[9]=y*i+b*c+x*f+S*g,e[10]=y*a+b*l+x*p+S*_,e[11]=y*o+b*u+x*m+S*v,e[12]=(y=n[12])*r+(b=n[13])*s+(x=n[14])*d+(S=n[15])*h,e[13]=y*i+b*c+x*f+S*g,e[14]=y*a+b*l+x*p+S*_,e[15]=y*o+b*u+x*m+S*v,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var us,ds=ls;function fs(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3];return e[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*o,e[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*o,e[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*o,e[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*o,e}us=new ss(4),ss!=Float32Array&&(us[0]=0,us[1]=0,us[2]=0,us[3]=0);class ps extends ia{constructor(e){super(e,as)}createBucket(e){return new Ho(e)}queryRadius(e){let t=e;return es(`circle-radius`,this,t)+es(`circle-stroke-width`,this,t)+ts(this.paint.get(`circle-translate`))}queryIntersectsFeature(e,t,n,r,i,a,o,s){let c=ns(e,this.paint.get(`circle-translate`),this.paint.get(`circle-translate-anchor`),a.angle,o),l=this.paint.get(`circle-radius`).evaluate(t,n)+this.paint.get(`circle-stroke-width`).evaluate(t,n),u=this.paint.get(`circle-pitch-alignment`)===`map`,d=u?c:function(e,t){return e.map((e=>ms(e,t)))}(c,s),f=u?l*o:l;for(let e of r)for(let t of e){let e=u?t:ms(t,s),n=f,r=fs([],[t.x,t.y,0,1],s);if(this.paint.get(`circle-pitch-scale`)===`viewport`&&this.paint.get(`circle-pitch-alignment`)===`map`?n*=r[3]/a.cameraToCenterDistance:this.paint.get(`circle-pitch-scale`)===`map`&&this.paint.get(`circle-pitch-alignment`)===`viewport`&&(n*=a.cameraToCenterDistance/r[3]),Wo(d,e,n))return!0}return!1}}function ms(e,t){let n=fs([],[e.x,e.y,0,1],t);return new a(n[0]/n[3],n[1]/n[3])}class hs extends Ho{}let gs;J(`HeatmapBucket`,hs,{omit:[`layers`]});var _s={get paint(){return gs||=new na({"heatmap-radius":new Q(N.paint_heatmap[`heatmap-radius`]),"heatmap-weight":new Q(N.paint_heatmap[`heatmap-weight`]),"heatmap-intensity":new Z(N.paint_heatmap[`heatmap-intensity`]),"heatmap-color":new ta(N.paint_heatmap[`heatmap-color`]),"heatmap-opacity":new Z(N.paint_heatmap[`heatmap-opacity`])})}};function vs(e,{width:t,height:n},r,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*n*r)throw RangeError(`mismatched image size. expected: ${i.length} but got: ${t*n*r}`)}else i=new Uint8Array(t*n*r);return e.width=t,e.height=n,e.data=i,e}function ys(e,{width:t,height:n},r){if(t===e.width&&n===e.height)return;let i=vs({},{width:t,height:n},r);bs(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,n)},r),e.width=t,e.height=n,e.data=i.data}function bs(e,t,n,r,i,a){if(i.width===0||i.height===0)return t;if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw RangeError(`out of range source coordinates for image copy`);if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw RangeError(`out of range destination coordinates for image copy`);let o=e.data,s=t.data;if(o===s)throw Error(`srcData equals dstData, so image is already copied`);for(let c=0;c<i.height;c++){let l=((n.y+c)*e.width+n.x)*a,u=((r.y+c)*t.width+r.x)*a;for(let e=0;e<i.width*a;e++)s[u+e]=o[l+e]}return t}class xs{constructor(e,t){vs(this,e,1,t)}resize(e){ys(this,e,1)}clone(){return new xs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,r,i){bs(e,t,n,r,i,1)}}class Ss{constructor(e,t){vs(this,e,4,t)}resize(e){ys(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Ss({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,r,i){bs(e,t,n,r,i,4)}}function Cs(e){let t={},n=e.resolution||256,r=e.clips?e.clips.length:1,i=e.image||new Ss({width:n,height:r});if(Math.log(n)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${n}`);let a=(n,r,a)=>{t[e.evaluationKey]=a;let o=e.expression.evaluate(t);i.data[n+r+0]=Math.floor(255*o.r/o.a),i.data[n+r+1]=Math.floor(255*o.g/o.a),i.data[n+r+2]=Math.floor(255*o.b/o.a),i.data[n+r+3]=Math.floor(255*o.a)};if(e.clips)for(let t=0,i=0;t<r;++t,i+=4*n)for(let r=0,o=0;r<n;r++,o+=4){let s=r/(n-1),{start:c,end:l}=e.clips[t];a(i,o,c*(1-s)+l*s)}else for(let e=0,t=0;e<n;e++,t+=4)a(0,t,e/(n-1));return i}J(`AlphaImage`,xs),J(`RGBAImage`,Ss);let ws=`big-fb`;class Ts extends ia{createBucket(e){return new hs(e)}constructor(e){super(e,_s),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e===`heatmap-color`&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Cs({expression:this._transitionablePaint._values[`heatmap-color`].value.expression,evaluationKey:`heatmapDensity`,image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(ws)&&this.heatmapFbos.delete(ws)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get(`heatmap-opacity`)!==0&&this.visibility!==`none`}}let Es;var Ds={get paint(){return Es||=new na({"hillshade-illumination-direction":new Z(N.paint_hillshade[`hillshade-illumination-direction`]),"hillshade-illumination-anchor":new Z(N.paint_hillshade[`hillshade-illumination-anchor`]),"hillshade-exaggeration":new Z(N.paint_hillshade[`hillshade-exaggeration`]),"hillshade-shadow-color":new Z(N.paint_hillshade[`hillshade-shadow-color`]),"hillshade-highlight-color":new Z(N.paint_hillshade[`hillshade-highlight-color`]),"hillshade-accent-color":new Z(N.paint_hillshade[`hillshade-accent-color`])})}};class Os extends ia{constructor(e){super(e,Ds)}hasOffscreenPass(){return this.paint.get(`hillshade-exaggeration`)!==0&&this.visibility!==`none`}}let{members:ks}=ca([{name:`a_pos`,components:2,type:`Int16`}],4);function As(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=js(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=function(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=js(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(Hs(o))}i.sort(Rs);for(let e=0;e<i.length;e++)n=zs(i[e],n);return n}(e,t,a,n)),e.length>80*n){s=1/0,c=1/0;let t=-1/0,r=-1/0;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return Ns(a,o,n,s,c,l,0),o}function js(e,t,n,r,i){let a;if(i===function(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Qs(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Qs(i/r|0,e[i],e[i+1],a);return a&&Ks(a,a.next)&&($s(a),a=a.next),a}function Ms(e,t){if(!e)return e;t||=e;let n,r=e;do if(n=!1,r.steiner||!Ks(r,r.next)&&Gs(r.prev,r,r.next)!==0)r=r.next;else{if($s(r),r=t=r.prev,r===r.next)break;n=!0}while(n||r!==t);return t}function Ns(e,t,n,r,i,a,o){if(!e)return;!o&&a&&function(e,t,n,r){let i=e;do i.z===0&&(i.z=Vs(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n=1;do{let r,i=e;e=null;let a=null;for(t=0;i;){t++;let o=i,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||i.z<=o.z)?(r=i,i=i.nextZ,s--):(r=o,o=o.nextZ,c--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;i=o}a.nextZ=null,n*=2}while(t>1)}(i)}(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?Fs(e,r,i,a):Ps(e))t.push(c.i,e.i,l.i),$s(e),e=l.next,s=l.next;else if((e=l)===s){o?o===1?Ns(e=Is(Ms(e),t),t,n,r,i,a,2):o===2&&Ls(e,t,n,r,i,a):Ns(Ms(e),t,n,r,i,a,1);break}}}function Ps(e){let t=e.prev,n=e,r=e.next;if(Gs(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=i<a?i<o?i:o:a<o?a:o,d=s<c?s<l?s:l:c<l?c:l,f=i>a?i>o?i:o:a>o?a:o,p=s>c?s>l?s:l:c>l?c:l,m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&Us(i,s,a,c,o,l,m.x,m.y)&&Gs(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Fs(e,t,n,r){let i=e.prev,a=e,o=e.next;if(Gs(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=s<c?s<l?s:l:c<l?c:l,m=u<d?u<f?u:f:d<f?d:f,h=s>c?s>l?s:l:c>l?c:l,g=u>d?u>f?u:f:d>f?d:f,_=Vs(p,m,t,n,r),v=Vs(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&Us(s,u,c,d,l,f,y.x,y.y)&&Gs(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&Us(s,u,c,d,l,f,b.x,b.y)&&Gs(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&Us(s,u,c,d,l,f,y.x,y.y)&&Gs(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&Us(s,u,c,d,l,f,b.x,b.y)&&Gs(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Is(e,t){let n=e;do{let r=n.prev,i=n.next.next;!Ks(r,i)&&qs(r,n,n.next,i)&&Xs(r,i)&&Xs(i,r)&&(t.push(r.i,n.i,i.i),$s(n),$s(n.next),n=e=i),n=n.next}while(n!==e);return Ms(n)}function Ls(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Ws(o,e)){let s=Zs(o,e);o=Ms(o,o.next),s=Ms(s,s.next),Ns(o,t,n,r,i,a,0),Ns(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function Rs(e,t){return e.x-t.x}function zs(e,t){let n=function(e,t){let n=t,r=e.x,i=e.y,a,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>o&&(o=e,a=n.x<n.next.x?n:n.next,e===r))return a}n=n.next}while(n!==t);if(!a)return null;let s=a,c=a.x,l=a.y,u=1/0;n=a;do{if(r>=n.x&&n.x>=c&&r!==n.x&&Us(i<l?r:o,i,c,l,i<l?o:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);Xs(n,e)&&(t<u||t===u&&(n.x>a.x||n.x===a.x&&Bs(a,n)))&&(a=n,u=t)}n=n.next}while(n!==s);return a}(e,t);if(!n)return t;let r=Zs(n,e);return Ms(r,r.next),Ms(n,n.next)}function Bs(e,t){return Gs(e.prev,e,t.prev)<0&&Gs(t.next,e,e.next)<0}function Vs(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Hs(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Us(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function Ws(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&qs(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Xs(e,t)&&Xs(t,e)&&function(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}(e,t)&&(Gs(e.prev,e,t.prev)||Gs(e,t.prev,t))||Ks(e,t)&&Gs(e.prev,e,e.next)>0&&Gs(t.prev,t,t.next)>0)}function Gs(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ks(e,t){return e.x===t.x&&e.y===t.y}function qs(e,t,n,r){let i=Ys(Gs(e,t,n)),a=Ys(Gs(e,t,r)),o=Ys(Gs(n,r,e)),s=Ys(Gs(n,r,t));return i!==a&&o!==s||!(i!==0||!Js(e,n,t))||!(a!==0||!Js(e,r,t))||!(o!==0||!Js(n,e,r))||!(s!==0||!Js(n,t,r))}function Js(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Ys(e){return e>0?1:e<0?-1:0}function Xs(e,t){return Gs(e.prev,e,e.next)<0?Gs(e,t,e.next)>=0&&Gs(e,e.prev,t)>=0:Gs(e,t,e.prev)<0||Gs(e,e.next,t)<0}function Zs(e,t){let n=ec(e.i,e.x,e.y),r=ec(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Qs(e,t,n,r){let i=ec(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function $s(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ec(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tc(e,t,n){let r=n.patternDependencies,i=!1;for(let n of t){let t=n.paint.get(`${e}-pattern`);t.isConstant()||(i=!0);let a=t.constantOr(null);a&&(i=!0,r[a.to]=!0,r[a.from]=!0)}return i}function nc(e,t,n,r,i){let a=i.patternDependencies;for(let o of t){let t=o.paint.get(`${e}-pattern`).value;if(t.kind!==`constant`){let e=t.evaluate({zoom:r-1},n,{},i.availableImages),s=t.evaluate({zoom:r},n,{},i.availableImages),c=t.evaluate({zoom:r+1},n,{},i.availableImages);e=e&&e.name?e.name:e,s=s&&s.name?s.name:s,c=c&&c.name?c.name:c,a[e]=!0,a[s]=!0,a[c]=!0,n.patterns[o.id]={min:e,mid:s,max:c}}}return n}class rc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new qa,this.indexArray=new ro,this.indexArray2=new io,this.programConfigurations=new No(e.layers,e.zoom),this.segments=new oo,this.segments2=new oo,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.hasPattern=tc(`fill`,this.layers,t);let r=this.layers[0].layout.get(`fill-sort-key`),i=!r.isConstant(),a=[];for(let{feature:o,id:s,index:c,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,u=Bo(o,e);if(!this.layers[0]._featureFilter.filter(new X(this.zoom),u,n))continue;let d=i?r.evaluate(u,{},n,t.availableImages):void 0,f={id:s,properties:o.properties,type:o.type,sourceLayerIndex:l,index:c,geometry:e?u.geometry:zo(o),patterns:{},sortKey:d};a.push(f)}i&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;if(this.hasPattern){let e=nc(`fill`,this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,i,a,n,{});t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ks),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,t,n,r,i){for(let e of kn(t,500)){let t=0;for(let n of e)t+=n.length;let n=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),r=n.vertexLength,i=[],a=[];for(let t of e){if(t.length===0)continue;t!==e[0]&&a.push(i.length/2);let n=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),r=n.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(r+t.length-1,r),i.push(t[0].x),i.push(t[0].y);for(let e=1;e<t.length;e++)this.layoutVertexArray.emplaceBack(t[e].x,t[e].y),this.indexArray2.emplaceBack(r+e-1,r+e),i.push(t[e].x),i.push(t[e].y);n.vertexLength+=t.length,n.primitiveLength+=t.length}let o=As(i,a);for(let e=0;e<o.length;e+=3)this.indexArray.emplaceBack(r+o[e],r+o[e+1],r+o[e+2]);n.vertexLength+=t,n.primitiveLength+=o.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,i,r)}}let ic,ac;J(`FillBucket`,rc,{omit:[`layers`,`patternFeatures`]});var oc={get paint(){return ac||=new na({"fill-antialias":new Z(N.paint_fill[`fill-antialias`]),"fill-opacity":new Q(N.paint_fill[`fill-opacity`]),"fill-color":new Q(N.paint_fill[`fill-color`]),"fill-outline-color":new Q(N.paint_fill[`fill-outline-color`]),"fill-translate":new Z(N.paint_fill[`fill-translate`]),"fill-translate-anchor":new Z(N.paint_fill[`fill-translate-anchor`]),"fill-pattern":new $i(N.paint_fill[`fill-pattern`])})},get layout(){return ic||=new na({"fill-sort-key":new Q(N.layout_fill[`fill-sort-key`])})}};class sc extends ia{constructor(e){super(e,oc)}recalculate(e,t){super.recalculate(e,t);let n=this.paint._values[`fill-outline-color`];n.value.kind===`constant`&&n.value.value===void 0&&(this.paint._values[`fill-outline-color`]=this.paint._values[`fill-color`])}createBucket(e){return new rc(e)}queryRadius(){return ts(this.paint.get(`fill-translate`))}queryIntersectsFeature(e,t,n,r,i,a,o){return Go(ns(e,this.paint.get(`fill-translate`),this.paint.get(`fill-translate-anchor`),a.angle,o),r)}isTileClipped(){return!0}}let cc=ca([{name:`a_pos`,components:2,type:`Int16`},{name:`a_normal_ed`,components:4,type:`Int16`}],4),lc=ca([{name:`a_centroid`,components:2,type:`Int16`}],4),{members:uc}=cc;var dc={},fc=r,pc=mc;function mc(e,t,n,r,i){this.properties={},this.extent=n,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=i,e.readFields(hc,this,t)}function hc(e,t,n){e==1?t.id=n.readVarint():e==2?function(e,t){for(var n=e.readVarint()+e.pos;e.pos<n;){var r=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[r]=i}}(n,t):e==3?t.type=n.readVarint():e==4&&(t._geometry=n.pos)}function gc(e){for(var t,n,r=0,i=0,a=e.length,o=a-1;i<a;o=i++)r+=((n=e[o]).x-(t=e[i]).x)*(t.y+n.y);return r}mc.types=[`Unknown`,`Point`,`LineString`,`Polygon`],mc.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,n=e.readVarint()+e.pos,r=1,i=0,a=0,o=0,s=[];e.pos<n;){if(i<=0){var c=e.readVarint();r=7&c,i=c>>3}if(i--,r===1||r===2)a+=e.readSVarint(),o+=e.readSVarint(),r===1&&(t&&s.push(t),t=[]),t.push(new fc(a,o));else{if(r!==7)throw Error(`unknown command `+r);t&&t.push(t[0].clone())}}return t&&s.push(t),s},mc.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,n=1,r=0,i=0,a=0,o=1/0,s=-1/0,c=1/0,l=-1/0;e.pos<t;){if(r<=0){var u=e.readVarint();n=7&u,r=u>>3}if(r--,n===1||n===2)(i+=e.readSVarint())<o&&(o=i),i>s&&(s=i),(a+=e.readSVarint())<c&&(c=a),a>l&&(l=a);else if(n!==7)throw Error(`unknown command `+n)}return[o,c,s,l]},mc.prototype.toGeoJSON=function(e,t,n){var r,i,a=this.extent*2**n,o=this.extent*e,s=this.extent*t,c=this.loadGeometry(),l=mc.types[this.type];function u(e){for(var t=0;t<e.length;t++){var n=e[t];e[t]=[360*(n.x+o)/a-180,360/Math.PI*Math.atan(Math.exp((180-360*(n.y+s)/a)*Math.PI/180))-90]}}switch(this.type){case 1:var d=[];for(r=0;r<c.length;r++)d[r]=c[r][0];u(c=d);break;case 2:for(r=0;r<c.length;r++)u(c[r]);break;case 3:for(c=function(e){var t=e.length;if(t<=1)return[e];for(var n,r,i=[],a=0;a<t;a++){var o=gc(e[a]);o!==0&&(r===void 0&&(r=o<0),r===o<0?(n&&i.push(n),n=[e[a]]):n.push(e[a]))}return n&&i.push(n),i}(c),r=0;r<c.length;r++)for(i=0;i<c[r].length;i++)u(c[r][i])}c.length===1?c=c[0]:l=`Multi`+l;var f={type:`Feature`,geometry:{type:l,coordinates:c},properties:this.properties};return`id`in this&&(f.id=this.id),f};var _c=pc,vc=yc;function yc(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(bc,this,t),this.length=this._features.length}function bc(e,t,n){e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(function(e){for(var t=null,n=e.readVarint()+e.pos;e.pos<n;){var r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}(n))}yc.prototype.feature=function(e){if(e<0||e>=this._features.length)throw Error(`feature index out of bounds`);this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new _c(this._pbf,t,this.extent,this._keys,this._values)};var xc=vc;function Sc(e,t,n){if(e===3){var r=new xc(n,n.readVarint()+n.pos);r.length&&(t[r.name]=r)}}dc.VectorTile=function(e,t){this.layers=e.readFields(Sc,{},t)},dc.VectorTileFeature=pc,dc.VectorTileLayer=vc;let Cc=dc.VectorTileFeature.types,wc=2**13;function Tc(e,t,n,r,i,a,o,s){e.emplaceBack(t,n,2*Math.floor(r*wc)+o,i*wc*2,a*wc*2,Math.round(s))}class Ec{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ja,this.centroidVertexArray=new Ga,this.indexArray=new ro,this.programConfigurations=new No(e.layers,e.zoom),this.segments=new oo,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.features=[],this.hasPattern=tc(`fill-extrusion`,this.layers,t);for(let{feature:r,id:i,index:a,sourceLayerIndex:o}of e){let e=this.layers[0]._featureFilter.needGeometry,s=Bo(r,e);if(!this.layers[0]._featureFilter.filter(new X(this.zoom),s,n))continue;let c={id:i,sourceLayerIndex:o,index:a,geometry:e?s.geometry:zo(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(nc(`fill-extrusion`,this.layers,c,this.zoom,t)):this.addFeature(c,c.geometry,a,n,{}),t.featureIndex.insert(r,c.geometry,a,o,this.index,!0)}}addFeatures(e,t,n){for(let e of this.features){let{geometry:r}=e;this.addFeature(e,r,e.index,t,n)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uc),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,lc.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,n,r,i){for(let n of kn(t,500)){let t={x:0,y:0,vertexCount:0},r=0;for(let e of n)r+=e.length;let i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let e of n){if(e.length===0||Oc(e))continue;let n=0;for(let r=0;r<e.length;r++){let a=e[r];if(r>=1){let o=e[r-1];if(!Dc(a,o)){i.vertexLength+4>oo.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let e=a.sub(o)._perp()._unit(),r=o.dist(a);n+r>32768&&(n=0),Tc(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,0,n),Tc(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,1,n),t.x+=2*a.x,t.y+=2*a.y,t.vertexCount+=2,n+=r,Tc(this.layoutVertexArray,o.x,o.y,e.x,e.y,0,0,n),Tc(this.layoutVertexArray,o.x,o.y,e.x,e.y,0,1,n),t.x+=2*o.x,t.y+=2*o.y,t.vertexCount+=2;let s=i.vertexLength;this.indexArray.emplaceBack(s,s+2,s+1),this.indexArray.emplaceBack(s+1,s+2,s+3),i.vertexLength+=4,i.primitiveLength+=2}}}}if(i.vertexLength+r>oo.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(r,this.layoutVertexArray,this.indexArray)),Cc[e.type]!==`Polygon`)continue;let a=[],o=[],s=i.vertexLength;for(let e of n)if(e.length!==0){e!==n[0]&&o.push(a.length/2);for(let n=0;n<e.length;n++){let r=e[n];Tc(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),t.x+=r.x,t.y+=r.y,t.vertexCount+=1,a.push(r.x),a.push(r.y)}}let c=As(a,o);for(let e=0;e<c.length;e+=3)this.indexArray.emplaceBack(s+c[e],s+c[e+2],s+c[e+1]);i.primitiveLength+=c.length/3,i.vertexLength+=r;for(let e=0;e<t.vertexCount;e++){let e=Math.floor(t.x/t.vertexCount),n=Math.floor(t.y/t.vertexCount);this.centroidVertexArray.emplaceBack(e,n)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,i,r)}}function Dc(e,t){return e.x===t.x&&(e.x<0||e.x>Io)||e.y===t.y&&(e.y<0||e.y>Io)}function Oc(e){return e.every((e=>e.x<0))||e.every((e=>e.x>Io))||e.every((e=>e.y<0))||e.every((e=>e.y>Io))}let kc;J(`FillExtrusionBucket`,Ec,{omit:[`layers`,`features`]});var Ac={get paint(){return kc||=new na({"fill-extrusion-opacity":new Z(N[`paint_fill-extrusion`][`fill-extrusion-opacity`]),"fill-extrusion-color":new Q(N[`paint_fill-extrusion`][`fill-extrusion-color`]),"fill-extrusion-translate":new Z(N[`paint_fill-extrusion`][`fill-extrusion-translate`]),"fill-extrusion-translate-anchor":new Z(N[`paint_fill-extrusion`][`fill-extrusion-translate-anchor`]),"fill-extrusion-pattern":new $i(N[`paint_fill-extrusion`][`fill-extrusion-pattern`]),"fill-extrusion-height":new Q(N[`paint_fill-extrusion`][`fill-extrusion-height`]),"fill-extrusion-base":new Q(N[`paint_fill-extrusion`][`fill-extrusion-base`]),"fill-extrusion-vertical-gradient":new Z(N[`paint_fill-extrusion`][`fill-extrusion-vertical-gradient`])})}};class jc extends ia{constructor(e){super(e,Ac)}createBucket(e){return new Ec(e)}queryRadius(){return ts(this.paint.get(`fill-extrusion-translate`))}is3D(){return!0}queryIntersectsFeature(e,t,n,r,i,o,s,c){let l=ns(e,this.paint.get(`fill-extrusion-translate`),this.paint.get(`fill-extrusion-translate-anchor`),o.angle,s),u=this.paint.get(`fill-extrusion-height`).evaluate(t,n),d=this.paint.get(`fill-extrusion-base`).evaluate(t,n),f=function(e,t,n,r){let i=[];for(let n of e){let e=[n.x,n.y,0,1];fs(e,e,t),i.push(new a(e[0]/e[3],e[1]/e[3]))}return i}(l,c),p=function(e,t,n,r){let i=[],o=[],s=r[8]*t,c=r[9]*t,l=r[10]*t,u=r[11]*t,d=r[8]*n,f=r[9]*n,p=r[10]*n,m=r[11]*n;for(let t of e){let e=[],n=[];for(let i of t){let t=i.x,o=i.y,h=r[0]*t+r[4]*o+r[12],g=r[1]*t+r[5]*o+r[13],_=r[2]*t+r[6]*o+r[14],v=r[3]*t+r[7]*o+r[15],y=_+l,b=v+u,x=h+d,S=g+f,C=_+p,w=v+m,T=new a((h+s)/b,(g+c)/b);T.z=y/b,e.push(T);let E=new a(x/w,S/w);E.z=C/w,n.push(E)}i.push(e),o.push(n)}return[i,o]}(r,d,u,c);return function(e,t,n){let r=1/0;Go(n,t)&&(r=Nc(n,t[0]));for(let i=0;i<t.length;i++){let a=t[i],o=e[i];for(let e=0;e<a.length-1;e++){let t=a[e],i=[t,a[e+1],o[e+1],o[e],t];Uo(n,i)&&(r=Math.min(r,Nc(n,i)))}}return r!==1/0&&r}(p[0],p[1],f)}}function Mc(e,t){return e.x*t.x+e.y*t.y}function Nc(e,t){if(e.length===1){let n=0,r=t[n++],i;for(;!i||r.equals(i);)if(i=t[n++],!i)return 1/0;for(;n<t.length;n++){let a=t[n],o=e[0],s=i.sub(r),c=a.sub(r),l=o.sub(r),u=Mc(s,s),d=Mc(s,c),f=Mc(c,c),p=Mc(l,s),m=Mc(l,c),h=u*f-d*d,g=(f*p-d*m)/h,_=(u*m-d*p)/h,v=r.z*(1-g-_)+i.z*g+a.z*_;if(isFinite(v))return v}return 1/0}{let e=1/0;for(let n of t)e=Math.min(e,n.z);return e}}let{members:Pc}=ca([{name:`a_pos_normal`,components:2,type:`Int16`},{name:`a_data`,components:4,type:`Uint8`}],4),{members:Fc}=ca([{name:`a_uv_x`,components:1,type:`Float32`},{name:`a_split_index`,components:1,type:`Float32`}]),Ic=dc.VectorTileFeature.types,Lc=Math.cos(Math.PI/180*37.5),Rc=2**14/.5;class zc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new Ya,this.layoutVertexArray2=new Xa,this.indexArray=new ro,this.programConfigurations=new No(e.layers,e.zoom),this.segments=new oo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.hasPattern=tc(`line`,this.layers,t);let r=this.layers[0].layout.get(`line-sort-key`),i=!r.isConstant(),a=[];for(let{feature:t,id:o,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Bo(t,e);if(!this.layers[0]._featureFilter.filter(new X(this.zoom),l,n))continue;let u=i?r.evaluate(l,{},n):void 0,d={id:o,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:zo(t),patterns:{},sortKey:u};a.push(d)}i&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;if(this.hasPattern){let e=nc(`line`,this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,i,a,n,{});t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Fc)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Pc),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,`mapbox_clip_start`)&&Object.prototype.hasOwnProperty.call(e.properties,`mapbox_clip_end`))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,n,r,i){let a=this.layers[0].layout,o=a.get(`line-join`).evaluate(e,{}),s=a.get(`line-cap`),c=a.get(`line-miter-limit`),l=a.get(`line-round-limit`);this.lineClips=this.lineFeatureClips(e);for(let n of t)this.addLine(n,e,o,s,c,l);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,i,r)}addLine(e,t,n,r,i,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let o=Ic[t.type]===`Polygon`,s=e.length;for(;s>=2&&e[s-1].equals(e[s-2]);)s--;let c=0;for(;c<s-1&&e[c].equals(e[c+1]);)c++;if(s<(o?3:2))return;n===`bevel`&&(i=1.05);let l=this.overscaling<=16?15*Io/(512*this.overscaling):0,u=this.segments.prepareSegment(10*s,this.layoutVertexArray,this.indexArray),d,f,p,m,h;this.e1=this.e2=-1,o&&(d=e[s-2],h=e[c].sub(d)._unit()._perp());for(let t=c;t<s;t++){if(p=t===s-1?o?e[c+1]:void 0:e[t+1],p&&e[t].equals(p))continue;h&&(m=h),d&&(f=d),d=e[t],h=p?p.sub(d)._unit()._perp():m,m||=h;let g=m.add(h);g.x===0&&g.y===0||g._unit();let _=m.x*h.x+m.y*h.y,v=g.x*h.x+g.y*h.y,y=v===0?1/0:1/v,b=2*Math.sqrt(2-2*v),x=v<Lc&&f&&p,S=m.x*h.y-m.y*h.x>0;if(x&&t>c){let e=d.dist(f);if(e>2*l){let t=d.sub(d.sub(f)._mult(l/e)._round());this.updateDistance(f,t),this.addCurrentVertex(t,m,0,0,u),f=t}}let C=f&&p,w=C?n:o?`butt`:r;if(C&&w===`round`&&(y<a?w=`miter`:y<=2&&(w=`fakeround`)),w===`miter`&&y>i&&(w=`bevel`),w===`bevel`&&(y>2&&(w=`flipbevel`),y<i&&(w=`miter`)),f&&this.updateDistance(f,d),w===`miter`)g._mult(y),this.addCurrentVertex(d,g,0,0,u);else if(w===`flipbevel`){if(y>100)g=h.mult(-1);else{let e=y*m.add(h).mag()/m.sub(h).mag();g._perp()._mult(e*(S?-1:1))}this.addCurrentVertex(d,g,0,0,u),this.addCurrentVertex(d,g.mult(-1),0,0,u)}else if(w===`bevel`||w===`fakeround`){let e=-Math.sqrt(y*y-1),t=S?e:0,n=S?0:e;if(f&&this.addCurrentVertex(d,m,t,n,u),w===`fakeround`){let e=Math.round(180*b/Math.PI/20);for(let t=1;t<e;t++){let n=t/e;if(n!==.5){let e=n-.5;n+=n*e*(n-1)*((1.0904+_*(_*(3.55645-1.43519*_)-3.2452))*e*e+(.848013+_*(.215638*_-1.06021)))}let r=h.sub(m)._mult(n)._add(m)._unit()._mult(S?-1:1);this.addHalfVertex(d,r.x,r.y,!1,S,0,u)}}p&&this.addCurrentVertex(d,h,-t,-n,u)}else if(w===`butt`)this.addCurrentVertex(d,g,0,0,u);else if(w===`square`){let e=f?1:-1;this.addCurrentVertex(d,g,e,e,u)}else w===`round`&&(f&&(this.addCurrentVertex(d,m,0,0,u),this.addCurrentVertex(d,m,1,1,u,!0)),p&&(this.addCurrentVertex(d,h,-1,-1,u,!0),this.addCurrentVertex(d,h,0,0,u)));if(x&&t<s-1){let e=d.dist(p);if(e>2*l){let t=d.add(p.sub(d)._mult(l/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,h,0,0,u),d=t}}}}addCurrentVertex(e,t,n,r,i,a=!1){let o=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,a,!1,n,i),this.addHalfVertex(e,o,s,a,!0,-r,i),this.distance>Rc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,n,r,i,a))}addHalfVertex({x:e,y:t},n,r,i,a,o,s){let c=.5*(this.lineClips?this.scaledDistance*(Rc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+ +!!i,(t<<1)+ +!!a,Math.round(63*n)+128,Math.round(63*r)+128,1+(o===0?0:o<0?-1:1)|(63&c)<<2,c>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let l=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),s.primitiveLength++),a?this.e2=l:this.e1=l}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}let Bc,Vc;J(`LineBucket`,zc,{omit:[`layers`,`patternFeatures`]});var Hc={get paint(){return Vc||=new na({"line-opacity":new Q(N.paint_line[`line-opacity`]),"line-color":new Q(N.paint_line[`line-color`]),"line-translate":new Z(N.paint_line[`line-translate`]),"line-translate-anchor":new Z(N.paint_line[`line-translate-anchor`]),"line-width":new Q(N.paint_line[`line-width`]),"line-gap-width":new Q(N.paint_line[`line-gap-width`]),"line-offset":new Q(N.paint_line[`line-offset`]),"line-blur":new Q(N.paint_line[`line-blur`]),"line-dasharray":new ea(N.paint_line[`line-dasharray`]),"line-pattern":new $i(N.paint_line[`line-pattern`]),"line-gradient":new ta(N.paint_line[`line-gradient`])})},get layout(){return Bc||=new na({"line-cap":new Z(N.layout_line[`line-cap`]),"line-join":new Q(N.layout_line[`line-join`]),"line-miter-limit":new Z(N.layout_line[`line-miter-limit`]),"line-round-limit":new Z(N.layout_line[`line-round-limit`]),"line-sort-key":new Q(N.layout_line[`line-sort-key`])})}};class Uc extends Q{possiblyEvaluate(e,t){return t=new X(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,r){return t=_({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,r)}}let Wc;class Gc extends ia{constructor(e){super(e,Hc),this.gradientVersion=0,Wc||(Wc=new Uc(Hc.paint.properties[`line-width`].specification),Wc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e===`line-gradient`){let e=this.gradientExpression();this.stepInterpolant=!!function(e){return e._styleExpression!==void 0}(e)&&e._styleExpression.expression instanceof Pt,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values[`line-gradient`].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values[`line-floorwidth`]=Wc.possiblyEvaluate(this._transitioningPaint._values[`line-width`].value,e)}createBucket(e){return new zc(e)}queryRadius(e){let t=e,n=Kc(es(`line-width`,this,t),es(`line-gap-width`,this,t)),r=es(`line-offset`,this,t);return n/2+Math.abs(r)+ts(this.paint.get(`line-translate`))}queryIntersectsFeature(e,t,n,r,i,o,s){let c=ns(e,this.paint.get(`line-translate`),this.paint.get(`line-translate-anchor`),o.angle,s),l=s/2*Kc(this.paint.get(`line-width`).evaluate(t,n),this.paint.get(`line-gap-width`).evaluate(t,n)),u=this.paint.get(`line-offset`).evaluate(t,n);return u&&(r=function(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=[];for(let e=0;e<i.length;e++){let n=i[e-1],r=i[e],s=i[e+1],c=e===0?new a(0,0):r.sub(n)._unit()._perp(),l=e===i.length-1?new a(0,0):s.sub(r)._unit()._perp(),u=c._add(l)._unit(),d=u.x*l.x+u.y*l.y;d!==0&&u._mult(1/d),o.push(u._mult(t)._add(r))}n.push(o)}return n}(r,u*s)),function(e,t,n){for(let r=0;r<t.length;r++){let i=t[r];if(e.length>=3){for(let t=0;t<i.length;t++)if(Qo(e,i[t]))return!0}if(Ko(e,i,n))return!0}return!1}(c,r,l)}isTileClipped(){return!0}}function Kc(e,t){return t>0?t+2*e:e}let qc=ca([{name:`a_pos_offset`,components:4,type:`Int16`},{name:`a_data`,components:4,type:`Uint16`},{name:`a_pixeloffset`,components:4,type:`Int16`}],4),Jc=ca([{name:`a_projected_pos`,components:3,type:`Float32`}],4);ca([{name:`a_fade_opacity`,components:1,type:`Uint32`}],4);let Yc=ca([{name:`a_placed`,components:2,type:`Uint8`},{name:`a_shift`,components:2,type:`Float32`},{name:`a_box_real`,components:2,type:`Int16`}]);ca([{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`}]);let Xc=ca([{name:`a_pos`,components:2,type:`Int16`},{name:`a_anchor_pos`,components:2,type:`Int16`},{name:`a_extrude`,components:2,type:`Int16`}],4),Zc=ca([{name:`a_pos`,components:2,type:`Float32`},{name:`a_radius`,components:1,type:`Float32`},{name:`a_flags`,components:2,type:`Int16`}],4);function Qc(e,t,n){return e.sections.forEach((e=>{e.text=function(e,t,n){let r=t.layout.get(`text-transform`).evaluate(n,{});return r===`uppercase`?e=e.toLocaleUpperCase():r===`lowercase`&&(e=e.toLocaleLowerCase()),Wi.applyArabicShaping&&(e=Wi.applyArabicShaping(e)),e}(e.text,t,n)})),e}ca([{name:`triangle`,components:3,type:`Uint16`}]),ca([{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`}]),ca([{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`}]),ca([{type:`Float32`,name:`offsetX`}]),ca([{type:`Int16`,name:`x`},{type:`Int16`,name:`y`},{type:`Int16`,name:`tileUnitDistanceFromAnchor`}]),ca([{type:`Uint16`,name:`textAnchor`},{type:`Float32`,components:2,name:`textOffset`}]);let $c={"!":`︕`,"#":`#`,$:`$`,"%":`%`,"&":`&`,"(":`︵`,")":`︶`,"*":`*`,"+":`+`,",":`︐`,"-":`︲`,".":`・`,"/":`/`,":":`︓`,";":`︔`,"<":`︿`,"=":`=`,">":`﹀`,"?":`︖`,"@":`@`,"[":`﹇`,"\\":`\`,"]":`﹈`,"^":`^`,_:`︳`,"`":```,"{":`︷`,"|":`―`,"}":`︸`,"~":`~`,"¢":`¢`,"£":`£`,"¥":`¥`,"¦":`¦`,"¬":`¬`,"¯":` ̄`,"–":`︲`,"—":`︱`,"‘":`﹃`,"’":`﹄`,"“":`﹁`,"”":`﹂`,"…":`︙`,"‧":`・`,"₩":`₩`,"、":`︑`,"。":`︒`,"〈":`︿`,"〉":`﹀`,"《":`︽`,"》":`︾`,"「":`﹁`,"」":`﹂`,"『":`﹃`,"』":`﹄`,"【":`︻`,"】":`︼`,"〔":`︹`,"〕":`︺`,"〖":`︗`,"〗":`︘`,"!":`︕`,"(":`︵`,")":`︶`,",":`︐`,"-":`︲`,".":`・`,":":`︓`,";":`︔`,"<":`︿`,">":`﹀`,"?":`︖`,"[":`﹇`,"]":`﹈`,"_":`︳`,"{":`︷`,"|":`―`,"}":`︸`,"⦅":`︵`,"⦆":`︶`,"。":`︒`,"「":`﹁`,"」":`﹂`};var el=24,tl=$,nl=function(e,t,n,r,i){var a,o,s=8*i-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=256*a+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=256*o+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else{if(a===c)return o?NaN:1/0*(p?-1:1);o+=2**r,a-=l}return(p?-1:1)*o*2**(a-r)},rl=function(e,t,n,r,i,a){var o,s,c,l=8*a-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),(t+=o+d>=1?f/c:f*2**(1-d))*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=255&s,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=255&o,p+=m,o/=256,l-=8);e[n+p-m]|=128*h};function $(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}$.Varint=0,$.Fixed64=1,$.Bytes=2,$.Fixed32=5;var il=4294967296,al=1/il,ol=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`);function sl(e){return e.type===$.Bytes?e.readVarint()+e.pos:e.pos+1}function cl(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function ll(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=e;i--)n.buf[i+r]=n.buf[i]}function ul(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function dl(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function fl(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function pl(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function ml(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function hl(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function gl(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function _l(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function vl(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function yl(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function bl(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function xl(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}$.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n||=this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,a=this.pos;this.type=7&r,e(i,t,this),this.pos===a&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=yl(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=xl(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=yl(this.buf,this.pos)+yl(this.buf,this.pos+4)*il;return this.pos+=8,e},readSFixed64:function(){var e=yl(this.buf,this.pos)+xl(this.buf,this.pos+4)*il;return this.pos+=8,e},readFloat:function(){var e=nl(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=nl(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,n,r=this.buf;return t=127&(n=r[this.pos++]),n<128?t:(t|=(127&(n=r[this.pos++]))<<7,n<128?t:(t|=(127&(n=r[this.pos++]))<<14,n<128?t:(t|=(127&(n=r[this.pos++]))<<21,n<128?t:function(e,t,n){var r,i,a=n.buf;if(r=(112&(i=a[n.pos++]))>>4,i<128||(r|=(127&(i=a[n.pos++]))<<3,i<128)||(r|=(127&(i=a[n.pos++]))<<10,i<128)||(r|=(127&(i=a[n.pos++]))<<17,i<128)||(r|=(127&(i=a[n.pos++]))<<24,i<128)||(r|=(1&(i=a[n.pos++]))<<31,i<128))return cl(e,r,t);throw Error(`Expected varint not more than 10 bytes`)}(t|=(15&(n=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&ol?function(e,t,n){return ol.decode(e.subarray(t,n))}(this.buf,t,e):function(e,t,n){for(var r=``,i=t;i<n;){var a,o,s,c=e[i],l=null,u=c>239?4:c>223?3:c>191?2:1;if(i+u>n)break;u===1?c<128&&(l=c):u===2?(192&(a=e[i+1]))==128&&(l=(31&c)<<6|63&a)<=127&&(l=null):u===3?(o=e[i+2],(192&(a=e[i+1]))==128&&(192&o)==128&&((l=(15&c)<<12|(63&a)<<6|63&o)<=2047||l>=55296&&l<=57343)&&(l=null)):u===4&&(o=e[i+2],s=e[i+3],(192&(a=e[i+1]))==128&&(192&o)==128&&(192&s)==128&&((l=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||l>=1114112)&&(l=null)),l===null?(l=65533,u=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),i+=u}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==$.Bytes)return e.push(this.readVarint(t));var n=sl(this);for(e||=[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==$.Bytes)return e.push(this.readSVarint());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==$.Bytes)return e.push(this.readBoolean());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==$.Bytes)return e.push(this.readFloat());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==$.Bytes)return e.push(this.readDouble());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==$.Bytes)return e.push(this.readFixed32());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==$.Bytes)return e.push(this.readSFixed32());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==$.Bytes)return e.push(this.readFixed64());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==$.Bytes)return e.push(this.readSFixed64());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===$.Varint)for(;this.buf[this.pos++]>127;);else if(t===$.Bytes)this.pos=this.readVarint()+this.pos;else if(t===$.Fixed32)this.pos+=4;else{if(t!==$.Fixed64)throw Error(`Unimplemented type: `+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),bl(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),bl(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),bl(this.buf,-1&e,this.pos),bl(this.buf,Math.floor(e*al),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),bl(this.buf,-1&e,this.pos),bl(this.buf,Math.floor(e*al),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw Error(`Given varint doesn't fit into 10 bytes`);t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,n.buf[n.pos]=127&(e>>>=7)}(n,0,t),function(e,t){var n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,n){for(var r,i,a=0;a<t.length;a++){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){r>56319||a+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=r;continue}if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&=(e[n++]=239,e[n++]=191,e[n++]=189,null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|128)}return n}(this.buf,e,this.pos);var n=this.pos-t;n>=128&&ll(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),rl(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),rl(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&ll(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,$.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,ul,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,dl,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,ml,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,fl,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,pl,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,hl,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,gl,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,_l,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,vl,t)},writeBytesField:function(e,t){this.writeTag(e,$.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,$.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,$.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,$.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,$.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,$.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,$.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,$.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,$.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,$.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}};var Sl=n(tl);function Cl(e,t,n){e===1&&n.readMessage(wl,t)}function wl(e,t,n){if(e===3){let{id:e,bitmap:r,width:i,height:a,left:o,top:s,advance:c}=n.readMessage(Tl,{});t.push({id:e,bitmap:new xs({width:i+6,height:a+6},r),metrics:{width:i,height:a,left:o,top:s,advance:c}})}}function Tl(e,t,n){e===1?t.id=n.readVarint():e===2?t.bitmap=n.readBytes():e===3?t.width=n.readVarint():e===4?t.height=n.readVarint():e===5?t.left=n.readSVarint():e===6?t.top=n.readSVarint():e===7&&(t.advance=n.readVarint())}function El(e){let t=0,n=0;for(let r of e)t+=r.w*r.h,n=Math.max(n,r.w);e.sort(((e,t)=>t.h-e.h));let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}],i=0,a=0;for(let t of e)for(let e=r.length-1;e>=0;e--){let n=r[e];if(!(t.w>n.w||t.h>n.h)){if(t.x=n.x,t.y=n.y,a=Math.max(a,t.y+t.h),i=Math.max(i,t.x+t.w),t.w===n.w&&t.h===n.h){let t=r.pop();e<r.length&&(r[e]=t)}else t.h===n.h?(n.x+=t.w,n.w-=t.w):t.w===n.w?(n.y+=t.h,n.h-=t.h):(r.push({x:n.x+t.w,y:n.y,w:n.w-t.w,h:t.h}),n.y+=t.h,n.h-=t.h);break}}return{w:i,h:a,fill:t/(i*a)||0}}class Dl{constructor(e,{pixelRatio:t,version:n,stretchX:r,stretchY:i,content:a,textFitWidth:o,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=i,this.content=a,this.version=n,this.textFitWidth=o,this.textFitHeight=s}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 Ol{constructor(e,t){let n={},r={};this.haveRenderCallbacks=[];let i=[];this.addImages(e,n,i),this.addImages(t,r,i);let{w:a,h:o}=El(i),s=new Ss({width:a||1,height:o||1});for(let t in e){let r=e[t],i=n[t].paddedRect;Ss.copy(r.data,s,{x:0,y:0},{x:i.x+1,y:i.y+1},r.data)}for(let e in t){let n=t[e],i=r[e].paddedRect,a=i.x+1,o=i.y+1,c=n.data.width,l=n.data.height;Ss.copy(n.data,s,{x:0,y:0},{x:a,y:o},n.data),Ss.copy(n.data,s,{x:0,y:l-1},{x:a,y:o-1},{width:c,height:1}),Ss.copy(n.data,s,{x:0,y:0},{x:a,y:o+l},{width:c,height:1}),Ss.copy(n.data,s,{x:c-1,y:0},{x:a-1,y:o},{width:1,height:l}),Ss.copy(n.data,s,{x:0,y:0},{x:a+c,y:o},{width:1,height:l})}this.image=s,this.iconPositions=n,this.patternPositions=r}addImages(e,t,n){for(let r in e){let i=e[r],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};n.push(a),t[r]=new Dl(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),t),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),t)}patchUpdatedImage(e,t,n){if(!e||!t||e.version===t.version)return;e.version=t.version;let[r,i]=e.tl;n.update(t.data,void 0,{x:r,y:i})}}var kl;J(`ImagePosition`,Dl),J(`ImageAtlas`,Ol),e.ah=void 0,(kl=e.ah||={})[kl.none=0]=`none`,kl[kl.horizontal=1]=`horizontal`,kl[kl.vertical=2]=`vertical`,kl[kl.horizontalOnly=3]=`horizontalOnly`;class Al{constructor(){this.scale=1,this.fontStack=``,this.imageName=null}static forText(e,t){let n=new Al;return n.scale=e||1,n.fontStack=t,n}static forImage(e){let t=new Al;return t.imageName=e,t}}class jl{constructor(){this.text=``,this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){let n=new jl;for(let r=0;r<e.sections.length;r++){let i=e.sections[r];i.image?n.addImageSection(i):n.addTextSection(i,t)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n+1)||null,i=e.charCodeAt(n-1)||null;t+=r&&zi(r)&&!$c[e[n+1]]||i&&zi(i)&&!$c[e[n-1]]||!$c[e[n]]?e[n]:$c[e[n]]}return t}(this.text)}trim(){let e=0;for(let t=0;t<this.text.length&&Nl[this.text.charCodeAt(t)];t++)e++;let t=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&Nl[this.text.charCodeAt(n)];n--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){let n=new jl;return n.text=this.text.substring(e,t),n.sectionIndex=this.sectionIndex.slice(e,t),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(Al.forText(e.scale,e.fontStack||t));let n=this.sections.length-1;for(let t=0;t<e.text.length;++t)this.sectionIndex.push(n)}addImageSection(e){let t=e.image?e.image.name:``;if(t.length===0)return void C(`Can't add FormattedSection with an empty image.`);let n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(Al.forImage(t)),this.sectionIndex.push(this.sections.length-1)):C(`Reached maximum number of images 6401`)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ml(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=jl.fromFeature(t,a),_;f===e.ah.vertical&&g.verticalizePunctuation();let{processBidirectionalText:v,processStyledBidirectionalText:y}=Wi;if(v&&g.sections.length===1){_=[];let e=v(g.toString(),Vl(g,u,o,n,i,m));for(let t of e){let e=new jl;e.text=t,e.sections=g.sections;for(let n=0;n<t.length;n++)e.sectionIndex.push(0);_.push(e)}}else if(y){_=[];let e=y(g.text,g.sectionIndex,Vl(g,u,o,n,i,m));for(let t of e){let e=new jl;e.text=t[0],e.sectionIndex=t[1],e.sections=g.sections,_.push(e)}}else _=function(e,t){let n=[],r=e.text,i=0;for(let r of t)n.push(e.substring(i,r)),i=r;return i<r.length&&n.push(e.substring(i,r.length)),n}(g,Vl(g,u,o,n,i,m));let b=[],x={positionedLines:b,text:g.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:f,iconsInText:!1,verticalizable:!1};return function(t,n,r,i,a,o,s,c,l,u,d,f){let p=0,m=-17,h=0,g=0,_=c===`right`?1:c===`left`?0:.5,v=0;for(let s of a){s.trim();let a=s.getMaxScale(),c=(a-1)*el,b={positionedGlyphs:[],lineOffset:0};t.positionedLines[v]=b;let x=b.positionedGlyphs,S=0;if(!s.length()){m+=o,++v;continue}for(let o=0;o<s.length();o++){let h=s.getSection(o),g=s.getSectionIndex(o),_=s.getCharCode(o),v=0,b=null,C=null,w=null,T=el,E=!(l===e.ah.horizontal||!d&&!Ri(_)||d&&(Nl[_]||(y=_,/\p{sc=Arab}/u.test(String.fromCodePoint(y)))));if(h.imageName){let e=i[h.imageName];if(!e)continue;w=h.imageName,t.iconsInText=t.iconsInText||!0,C=e.paddedRect;let n=e.displaySize;h.scale=h.scale*el/f,b={width:n[0],height:n[1],left:1,top:-3,advance:E?n[1]:n[0]},v=c+(el-n[1]*h.scale),T=b.advance;let r=E?n[0]*h.scale-el*a:n[1]*h.scale-el*a;r>0&&r>S&&(S=r)}else{let e=r[h.fontStack],t=e&&e[_];if(t&&t.rect)C=t.rect,b=t.metrics;else{let e=n[h.fontStack],t=e&&e[_];if(!t)continue;b=t.metrics}v=(a-h.scale)*el}E?(t.verticalizable=!0,x.push({glyph:_,imageName:w,x:p,y:m+v,vertical:E,scale:h.scale,fontStack:h.fontStack,sectionIndex:g,metrics:b,rect:C}),p+=T*h.scale+u):(x.push({glyph:_,imageName:w,x:p,y:m+v,vertical:E,scale:h.scale,fontStack:h.fontStack,sectionIndex:g,metrics:b,rect:C}),p+=b.advance*h.scale+u)}x.length!==0&&(h=Math.max(p-u,h),Ul(x,0,x.length-1,_,S)),p=0;let C=o*a+S;b.lineOffset=Math.max(S,c),m+=C,g=Math.max(C,g),++v}var y;let b=m- -17,{horizontalAlign:x,verticalAlign:S}=Hl(s);(function(e,t,n,r,i,a,o,s,c){let l=(t-n)*i,u=0;u=a===o?(-r*c+.5)*o:-s*r- -17;for(let t of e)for(let e of t.positionedGlyphs)e.x+=l,e.y+=u})(t.positionedLines,_,x,S,h,g,o,b,a.length),t.top+=-S*b,t.bottom=t.top+b,t.left+=-x*h,t.right=t.left+h}(x,n,r,i,_,s,c,l,f,u,p,h),!function(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}(b)&&x}let Nl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Pl={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},Fl={40:!0};function Il(e,t,n,r,i,a){if(t.imageName){let e=r[t.imageName];return e?e.displaySize[0]*t.scale*el/a+i:0}{let r=n[t.fontStack],a=r&&r[e];return a?a.metrics.advance*t.scale+i:0}}function Ll(e,t,n,r){let i=(e-t)**2;return r?e<t?i/2:2*i:i+Math.abs(n)*n}function Rl(e,t,n){let r=0;return e===10&&(r-=1e4),n&&(r+=150),e!==40&&e!==65288||(r+=50),t!==41&&t!==65289||(r+=50),r}function zl(e,t,n,r,i,a){let o=null,s=Ll(t,n,i,a);for(let e of r){let r=Ll(t-e.x,n,i,a)+e.badness;r<=s&&(o=e,s=r)}return{index:e,x:t,priorBreak:o,badness:s}}function Bl(e){return e?Bl(e.priorBreak).concat(e.index):[]}function Vl(e,t,n,r,i,a){if(!e)return[];let o=[],s=function(e,t,n,r,i,a){let o=0;for(let n=0;n<e.length();n++){let s=e.getSection(n);o+=Il(e.getCharCode(n),s,r,i,t,a)}return o/Math.max(1,Math.ceil(o/n))}(e,t,n,r,i,a),c=e.text.indexOf(`​`)>=0,l=0;for(let n=0;n<e.length();n++){let d=e.getSection(n),f=e.getCharCode(n);if(Nl[f]||(l+=Il(f,d,r,i,t,a)),n<e.length()-1){let t=!((u=f)<11904)&&(!!Y[`CJK Compatibility Forms`](u)||!!Y[`CJK Compatibility`](u)||!!Y[`CJK Strokes`](u)||!!Y[`CJK Symbols and Punctuation`](u)||!!Y[`Enclosed CJK Letters and Months`](u)||!!Y[`Halfwidth and Fullwidth Forms`](u)||!!Y[`Ideographic Description Characters`](u)||!!Y[`Vertical Forms`](u)||Li.test(String.fromCodePoint(u)));(Pl[f]||t||d.imageName||n!==e.length()-2&&Fl[e.getCharCode(n+1)])&&o.push(zl(n+1,l,s,o,Rl(f,e.getCharCode(n+1),t&&c),!1))}}var u;return Bl(zl(e.length(),l,s,o,0,!0))}function Hl(e){let t=.5,n=.5;switch(e){case`right`:case`top-right`:case`bottom-right`:t=1;break;case`left`:case`top-left`:case`bottom-left`:t=0}switch(e){case`bottom`:case`bottom-right`:case`bottom-left`:n=1;break;case`top`:case`top-right`:case`top-left`:n=0}return{horizontalAlign:t,verticalAlign:n}}function Ul(e,t,n,r,i){if(!r&&!i)return;let a=e[n],o=(e[n].x+a.metrics.advance*a.scale)*r;for(let r=t;r<=n;r++)e[r].x-=o,e[r].y+=i}function Wl(e,t,n){let{horizontalAlign:r,verticalAlign:i}=Hl(n),a=t[0]-e.displaySize[0]*r,o=t[1]-e.displaySize[1]*i;return{image:e,top:o,bottom:o+e.displaySize[1],left:a,right:a+e.displaySize[0]}}function Gl(e){let t=e.left,n=e.top,r=e.right-t,i=e.bottom-n,a=e.image.textFitWidth??`stretchOrShrink`,o=e.image.textFitHeight??`stretchOrShrink`,s=(e.image.content[2]-e.image.content[0])/(e.image.content[3]-e.image.content[1]);if(o===`proportional`){if(a===`stretchOnly`&&r/i<s||a===`proportional`){let e=Math.ceil(i*s);t*=e/r,r=e}}else if(a===`proportional`&&o===`stretchOnly`&&s!==0&&r/i>s){let e=Math.ceil(r/s);n*=e/i,i=e}return{x1:t,y1:n,x2:t+r,y2:n+i}}function Kl(e,t,n,r,i,a){let o=e.image,s;if(o.content){let e=o.content,t=o.pixelRatio||1;s=[e[0]/t,e[1]/t,o.displaySize[0]-e[2]/t,o.displaySize[1]-e[3]/t]}let c=t.left*a,l=t.right*a,u,d,f,p;n===`width`||n===`both`?(p=i[0]+c-r[3],d=i[0]+l+r[1]):(p=i[0]+(c+l-o.displaySize[0])/2,d=p+o.displaySize[0]);let m=t.top*a,h=t.bottom*a;return n===`height`||n===`both`?(u=i[1]+m-r[0],f=i[1]+h+r[2]):(u=i[1]+(m+h-o.displaySize[1])/2,f=u+o.displaySize[1]),{image:o,top:u,right:d,bottom:f,left:p,collisionPadding:s}}let ql=32640;function Jl(e,t){let{expression:n}=t;if(n.kind===`constant`)return{kind:`constant`,layoutSize:n.evaluate(new X(e+1))};if(n.kind===`source`)return{kind:`source`};{let{zoomStops:t,interpolationType:r}=n,i=0;for(;i<t.length&&t[i]<=e;)i++;i=Math.max(0,i-1);let a=i;for(;a<t.length&&t[a]<e+1;)a++;a=Math.min(t.length-1,a);let o=t[i],s=t[a];return n.kind===`composite`?{kind:`composite`,minZoom:o,maxZoom:s,interpolationType:r}:{kind:`camera`,minZoom:o,maxZoom:s,minSize:n.evaluate(new X(o)),maxSize:n.evaluate(new X(s)),interpolationType:r}}}function Yl(e,t,n){let r=`never`,i=e.get(t);return i?r=i:e.get(n)&&(r=`always`),r}let Xl=dc.VectorTileFeature.types,Zl=[{name:`a_fade_opacity`,components:1,type:`Uint8`,offset:0}];function Ql(e,t,n,r,i,a,o,s,c,l,u,d,f){let p=s?Math.min(ql,Math.round(s[0])):0,m=s?Math.min(ql,Math.round(s[1])):0;e.emplaceBack(t,n,Math.round(32*r),Math.round(32*i),a,o,(p<<1)+ +!!c,m,16*l,16*u,256*d,256*f)}function $l(e,t,n){e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n)}function eu(e){for(let t of e.sections)if(Ui(t.text))return!0;return!1}class tu{constructor(e){this.layoutVertexArray=new Qa,this.indexArray=new ro,this.programConfigurations=e,this.segments=new oo,this.dynamicLayoutVertexArray=new $a,this.opacityVertexArray=new eo,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ia}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,n,r){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,qc.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Jc.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Zl,!0),this.opacityVertexBuffer.itemSize=1),(n||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}J(`SymbolBuffers`,tu);class nu{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new oo,this.collisionVertexArray=new no}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Yc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}J(`CollisionBuffers`,nu);class ru{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=cs([]),this.placementViewportMatrix=cs([]);let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Jl(this.zoom,n[`text-size`]),this.iconSizeData=Jl(this.zoom,n[`icon-size`]);let r=this.layers[0].layout,i=r.get(`symbol-sort-key`),a=r.get(`symbol-z-order`);this.canOverlap=Yl(r,`text-overlap`,`text-allow-overlap`)!==`never`||Yl(r,`icon-overlap`,`icon-allow-overlap`)!==`never`||r.get(`text-ignore-placement`)||r.get(`icon-ignore-placement`),this.sortFeaturesByKey=a!==`viewport-y`&&!i.isConstant(),this.sortFeaturesByY=(a===`viewport-y`||a===`auto`&&!this.sortFeaturesByKey)&&this.canOverlap,r.get(`symbol-placement`)===`point`&&(this.writingModes=r.get(`text-writing-mode`).map((t=>e.ah[t]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=t.sourceID}createArrays(){this.text=new tu(new No(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new tu(new No(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new za,this.lineVertexArray=new Ba,this.symbolInstances=new Ra,this.textAnchorOffsets=new Ha}calculateGlyphDependencies(e,t,n,r,i){for(let a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,(n||r)&&i){let n=$c[e.charAt(a)];n&&(t[n.charCodeAt(0)]=!0)}}populate(t,n,r){let i=this.layers[0],a=i.layout,o=a.get(`text-font`),s=a.get(`text-field`),c=a.get(`icon-image`),l=(s.value.kind!==`constant`||s.value.value instanceof ct&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(o.value.kind!==`constant`||o.value.value.length>0),u=c.value.kind!==`constant`||!!c.value.value||Object.keys(c.parameters).length>0,d=a.get(`symbol-sort-key`);if(this.features=[],!l&&!u)return;let f=n.iconDependencies,p=n.glyphDependencies,m=n.availableImages,h=new X(this.zoom);for(let{feature:n,id:s,index:c,sourceLayerIndex:g}of t){let t=i._featureFilter.needGeometry,_=Bo(n,t);if(!i._featureFilter.filter(h,_,r))continue;let v,y;if(t||(_.geometry=zo(n)),l){let e=i.getValueAndResolveTokens(`text-field`,_,r,m),t=ct.factory(e),n=this.hasRTLText=this.hasRTLText||eu(t);(!n||Wi.getRTLTextPluginStatus()===`unavailable`||n&&Wi.isParsed())&&(v=Qc(t,i,_))}if(u){let e=i.getValueAndResolveTokens(`icon-image`,_,r,m);y=e instanceof ft?e:ft.fromString(e)}if(!v&&!y)continue;let b=this.sortFeaturesByKey?d.evaluate(_,{},r):void 0;if(this.features.push({id:s,text:v,icon:y,index:c,sourceLayerIndex:g,geometry:_.geometry,properties:n.properties,type:Xl[n.type],sortKey:b}),y&&(f[y.name]=!0),v){let t=o.evaluate(_,{},r).join(`,`),n=a.get(`text-rotation-alignment`)!==`viewport`&&a.get(`symbol-placement`)!==`point`;this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.ah.vertical)>=0;for(let e of v.sections)if(e.image)f[e.image.name]=!0;else{let r=Mi(v.toString()),i=e.fontStack||t,a=p[i]=p[i]||{};this.calculateGlyphDependencies(e.text,a,n,this.allowVerticalPlacement,r)}}}a.get(`symbol-placement`)===`line`&&(this.features=function(e){let t={},n={},r=[],i=0;function a(t){r.push(e[t]),i++}function o(e,t,i){let a=n[e];return delete n[e],n[t]=a,r[a].geometry[0].pop(),r[a].geometry[0]=r[a].geometry[0].concat(i[0]),a}function s(e,n,i){let a=t[n];return delete t[n],t[e]=a,r[a].geometry[0].shift(),r[a].geometry[0]=i[0].concat(r[a].geometry[0]),a}function c(e,t,n){let r=n?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let l=0;l<e.length;l++){let u=e[l],d=u.geometry,f=u.text?u.text.toString():null;if(!f){a(l);continue}let p=c(f,d),m=c(f,d,!0);if(p in n&&m in t&&n[p]!==t[m]){let e=s(p,m,d),i=o(p,m,r[e].geometry);delete t[p],delete n[m],n[c(f,r[i].geometry,!0)]=i,r[e].geometry=null}else p in n?o(p,m,d):m in t?s(p,m,d):(a(l),t[p]=i-1,n[m]=i-1)}return r.filter((e=>e.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,t){let n=this.lineVertexArray.length;if(e.segment!==void 0){let n=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]),i={};for(let r=e.segment+1;r<t.length;r++)i[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:n},r<t.length-1&&(n+=t[r+1].dist(t[r]));for(let n=e.segment||0;n>=0;n--)i[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:r},n>0&&(r+=t[n-1].dist(t[n]));for(let e=0;e<t.length;e++){let t=i[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,n,r,i,a,o,s,c,l,u,d,f){let p=t.indexArray,m=t.layoutVertexArray,h=t.segments.prepareSegment(4*n.length,m,p,this.canOverlap?o.sortKey:void 0),g=this.glyphOffsetArray.length,_=h.vertexLength,v=this.allowVerticalPlacement&&s===e.ah.vertical?Math.PI/2:0,y=o.text&&o.text.sections;for(let e=0;e<n.length;e++){let{tl:i,tr:a,bl:s,br:l,tex:u,pixelOffsetTL:d,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:b,glyphOffset:x,isSDF:S,sectionIndex:C}=n[e],w=h.vertexLength,T=x[1];Ql(m,c.x,c.y,i.x,T+i.y,u.x,u.y,r,S,d.x,d.y,_,b),Ql(m,c.x,c.y,a.x,T+a.y,u.x+u.w,u.y,r,S,g.x,d.y,_,b),Ql(m,c.x,c.y,s.x,T+s.y,u.x,u.y+u.h,r,S,d.x,g.y,_,b),Ql(m,c.x,c.y,l.x,T+l.y,u.x+u.w,u.y+u.h,r,S,g.x,g.y,_,b),$l(t.dynamicLayoutVertexArray,c,v),p.emplaceBack(w,w+1,w+2),p.emplaceBack(w+1,w+2,w+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),e!==n.length-1&&C===n[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(m.length,o,o.index,{},f,y&&y[C])}t.placedSymbolArray.emplaceBack(c.x,c.y,g,this.glyphOffsetArray.length-g,_,l,u,c.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,d)}_addCollisionDebugVertex(e,t,n,r,i,a){return t.emplaceBack(0,0),e.emplaceBack(n.x,n.y,r,i,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,n,r,i,o,s){let c=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),l=c.vertexLength,u=i.layoutVertexArray,d=i.collisionVertexArray,f=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,d,o,f,p,new a(e,t)),this._addCollisionDebugVertex(u,d,o,f,p,new a(n,t)),this._addCollisionDebugVertex(u,d,o,f,p,new a(n,r)),this._addCollisionDebugVertex(u,d,o,f,p,new a(e,r)),c.vertexLength+=4;let m=i.indexArray;m.emplaceBack(l,l+1),m.emplaceBack(l+1,l+2),m.emplaceBack(l+2,l+3),m.emplaceBack(l+3,l),c.primitiveLength+=4}addDebugCollisionBoxes(e,t,n,r){for(let i=e;i<t;i++){let e=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,r?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new nu(to,Xc.members,io),this.iconCollisionBox=new nu(to,Xc.members,io);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,n,r,i,a,o,s,c){let l={};for(let r=t;r<n;r++){let t=e.get(r);l.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},l.textFeatureIndex=t.featureIndex;break}for(let t=r;t<i;t++){let n=e.get(t);l.verticalTextBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.verticalTextFeatureIndex=n.featureIndex;break}for(let t=a;t<o;t++){let n=e.get(t);l.iconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.iconFeatureIndex=n.featureIndex;break}for(let t=s;t<c;t++){let n=e.get(t);l.verticalIconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.verticalIconFeatureIndex=n.featureIndex;break}return l}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let n=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.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(e,t){let n=e.placedSymbolArray.get(t),r=n.vertexStartIndex+4*n.numGlyphs;for(let t=n.vertexStartIndex;t<r;t+=4)e.indexArray.emplaceBack(t,t+1,t+2),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),n=Math.cos(e),r=[],i=[],a=[];for(let e=0;e<this.symbolInstances.length;++e){a.push(e);let o=this.symbolInstances.get(e);r.push(0|Math.round(t*o.anchorX+n*o.anchorY)),i.push(o.featureIndex)}return a.sort(((e,t)=>r[e]-r[t]||i[t]-i[e])),a}addToSortKeyRanges(e,t){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach(((e,t,n)=>{e>=0&&n.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)})),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let iu,au;J(`SymbolBucket`,ru,{omit:[`layers`,`collisionBoxArray`,`features`,`compareText`]}),ru.MAX_GLYPHS=65535,ru.addDynamicAttributes=$l;var ou={get paint(){return au||=new na({"icon-opacity":new Q(N.paint_symbol[`icon-opacity`]),"icon-color":new Q(N.paint_symbol[`icon-color`]),"icon-halo-color":new Q(N.paint_symbol[`icon-halo-color`]),"icon-halo-width":new Q(N.paint_symbol[`icon-halo-width`]),"icon-halo-blur":new Q(N.paint_symbol[`icon-halo-blur`]),"icon-translate":new Z(N.paint_symbol[`icon-translate`]),"icon-translate-anchor":new Z(N.paint_symbol[`icon-translate-anchor`]),"text-opacity":new Q(N.paint_symbol[`text-opacity`]),"text-color":new Q(N.paint_symbol[`text-color`],{runtimeType:De,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Q(N.paint_symbol[`text-halo-color`]),"text-halo-width":new Q(N.paint_symbol[`text-halo-width`]),"text-halo-blur":new Q(N.paint_symbol[`text-halo-blur`]),"text-translate":new Z(N.paint_symbol[`text-translate`]),"text-translate-anchor":new Z(N.paint_symbol[`text-translate-anchor`])})},get layout(){return iu||=new na({"symbol-placement":new Z(N.layout_symbol[`symbol-placement`]),"symbol-spacing":new Z(N.layout_symbol[`symbol-spacing`]),"symbol-avoid-edges":new Z(N.layout_symbol[`symbol-avoid-edges`]),"symbol-sort-key":new Q(N.layout_symbol[`symbol-sort-key`]),"symbol-z-order":new Z(N.layout_symbol[`symbol-z-order`]),"icon-allow-overlap":new Z(N.layout_symbol[`icon-allow-overlap`]),"icon-overlap":new Z(N.layout_symbol[`icon-overlap`]),"icon-ignore-placement":new Z(N.layout_symbol[`icon-ignore-placement`]),"icon-optional":new Z(N.layout_symbol[`icon-optional`]),"icon-rotation-alignment":new Z(N.layout_symbol[`icon-rotation-alignment`]),"icon-size":new Q(N.layout_symbol[`icon-size`]),"icon-text-fit":new Z(N.layout_symbol[`icon-text-fit`]),"icon-text-fit-padding":new Z(N.layout_symbol[`icon-text-fit-padding`]),"icon-image":new Q(N.layout_symbol[`icon-image`]),"icon-rotate":new Q(N.layout_symbol[`icon-rotate`]),"icon-padding":new Q(N.layout_symbol[`icon-padding`]),"icon-keep-upright":new Z(N.layout_symbol[`icon-keep-upright`]),"icon-offset":new Q(N.layout_symbol[`icon-offset`]),"icon-anchor":new Q(N.layout_symbol[`icon-anchor`]),"icon-pitch-alignment":new Z(N.layout_symbol[`icon-pitch-alignment`]),"text-pitch-alignment":new Z(N.layout_symbol[`text-pitch-alignment`]),"text-rotation-alignment":new Z(N.layout_symbol[`text-rotation-alignment`]),"text-field":new Q(N.layout_symbol[`text-field`]),"text-font":new Q(N.layout_symbol[`text-font`]),"text-size":new Q(N.layout_symbol[`text-size`]),"text-max-width":new Q(N.layout_symbol[`text-max-width`]),"text-line-height":new Z(N.layout_symbol[`text-line-height`]),"text-letter-spacing":new Q(N.layout_symbol[`text-letter-spacing`]),"text-justify":new Q(N.layout_symbol[`text-justify`]),"text-radial-offset":new Q(N.layout_symbol[`text-radial-offset`]),"text-variable-anchor":new Z(N.layout_symbol[`text-variable-anchor`]),"text-variable-anchor-offset":new Q(N.layout_symbol[`text-variable-anchor-offset`]),"text-anchor":new Q(N.layout_symbol[`text-anchor`]),"text-max-angle":new Z(N.layout_symbol[`text-max-angle`]),"text-writing-mode":new Z(N.layout_symbol[`text-writing-mode`]),"text-rotate":new Q(N.layout_symbol[`text-rotate`]),"text-padding":new Z(N.layout_symbol[`text-padding`]),"text-keep-upright":new Z(N.layout_symbol[`text-keep-upright`]),"text-transform":new Q(N.layout_symbol[`text-transform`]),"text-offset":new Q(N.layout_symbol[`text-offset`]),"text-allow-overlap":new Z(N.layout_symbol[`text-allow-overlap`]),"text-overlap":new Z(N.layout_symbol[`text-overlap`]),"text-ignore-placement":new Z(N.layout_symbol[`text-ignore-placement`]),"text-optional":new Z(N.layout_symbol[`text-optional`])})}};class su{constructor(e){if(e.property.overrides===void 0)throw Error(`overrides must be provided to instantiate FormatSectionOverride class`);this.type=e.property.overrides?e.property.overrides.runtimeType:Ee,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}J(`FormatSectionOverride`,su,{omit:[`defaultValue`]});class cu extends ia{constructor(e){super(e,ou)}recalculate(e,t){if(super.recalculate(e,t),this.layout.get(`icon-rotation-alignment`)===`auto`&&(this.layout._values[`icon-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),this.layout.get(`text-rotation-alignment`)===`auto`&&(this.layout._values[`text-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),this.layout.get(`text-pitch-alignment`)===`auto`&&(this.layout._values[`text-pitch-alignment`]=this.layout.get(`text-rotation-alignment`)===`map`?`map`:`viewport`),this.layout.get(`icon-pitch-alignment`)===`auto`&&(this.layout._values[`icon-pitch-alignment`]=this.layout.get(`icon-rotation-alignment`)),this.layout.get(`symbol-placement`)===`point`){let e=this.layout.get(`text-writing-mode`);if(e){let t=[];for(let n of e)t.indexOf(n)<0&&t.push(n);this.layout._values[`text-writing-mode`]=t}else this.layout._values[`text-writing-mode`]=[`horizontal`]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,n,r){let i=this.layout.get(e).evaluate(t,{},n,r),a=this._unevaluatedLayout._values[e];return a.isDataDriven()||wr(a.value)||!i?i:function(e,t){return t.replace(/{([^{}]+)}/g,((t,n)=>e&&n in e?String(e[n]):``))}(t.properties,i)}createBucket(e){return new ru(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error(`Should take a different path in FeatureIndex`)}_setPaintOverrides(){for(let e of ou.paint.overridableProperties){if(!cu.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),n=new su(t),r=new Cr(n,t.property.specification),i=null;i=t.value.kind===`constant`||t.value.kind===`source`?new Er(`source`,r):new Dr(`composite`,r,t.value.zoomStops),this.paint._values[e]=new Zi(t.property,i,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&cu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let n=e.get(`text-field`),r=ou.paint.properties[t],i=!1,a=e=>{for(let t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(i=!0)};if(n.value.kind===`constant`&&n.value.value instanceof ct)a(n.value.value.sections);else if(n.value.kind===`source`){let e=t=>{i||(t instanceof _t&&ht(t.value)===Ae?a(t.value.sections):t instanceof nn?a(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return i}}let lu;var uu={get paint(){return lu||=new na({"background-color":new Z(N.paint_background[`background-color`]),"background-pattern":new ea(N.paint_background[`background-pattern`]),"background-opacity":new Z(N.paint_background[`background-opacity`])})}};class du extends ia{constructor(e){super(e,uu)}}let fu;var pu={get paint(){return fu||=new na({"raster-opacity":new Z(N.paint_raster[`raster-opacity`]),"raster-hue-rotate":new Z(N.paint_raster[`raster-hue-rotate`]),"raster-brightness-min":new Z(N.paint_raster[`raster-brightness-min`]),"raster-brightness-max":new Z(N.paint_raster[`raster-brightness-max`]),"raster-saturation":new Z(N.paint_raster[`raster-saturation`]),"raster-contrast":new Z(N.paint_raster[`raster-contrast`]),"raster-resampling":new Z(N.paint_raster[`raster-resampling`]),"raster-fade-duration":new Z(N.paint_raster[`raster-fade-duration`])})}};class mu extends ia{constructor(e){super(e,pu)}}class hu extends ia{constructor(e){super(e,{}),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode===`3d`}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error(`Custom layers cannot be serialized`)}}class gu{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<`u`&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let _u=6371008.8;class vu{constructor(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw Error(`Invalid LngLat latitude value: must be between -90 and 90`)}wrap(){return new vu(g(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,n=this.lat*t,r=e.lat*t,i=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return _u*Math.acos(Math.min(i,1))}static convert(e){if(e instanceof vu)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new vu(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e==`object`&&e)return new vu(Number(`lng`in e?e.lng:e.lon),Number(e.lat));throw 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>]")}}let yu=2*Math.PI*_u;function bu(e){return yu*Math.cos(e*Math.PI/180)}function xu(e){return(180+e)/360}function Su(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Cu(e,t){return e/bu(t)}function wu(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}class Tu{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){let n=vu.convert(e);return new Tu(xu(n.lng),Su(n.lat),Cu(t,n.lat))}toLngLat(){return new vu(360*this.x-180,wu(this.y))}toAltitude(){return this.z*bu(wu(this.y))}meterInMercatorCoordinateUnits(){return 1/yu*(e=wu(this.y),1/Math.cos(e*Math.PI/180));var e}}function Eu(e,t,n){var r=2*Math.PI*6378137/256/2**n;return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class Du{constructor(e,t,n){if(!function(e,t,n){return!(e<0||e>25||n<0||n>=2**e||t<0||t>=2**e)}(e,t,n))throw Error(`x=${t}, y=${n}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=n,this.key=Au(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,n){let r=(a=this.y,o=this.z,s=Eu(256*(i=this.x),256*(a=2**o-a-1),o),c=Eu(256*(i+1),256*(a+1),o),s[0]+`,`+s[1]+`,`+c[0]+`,`+c[1]);var i,a,o,s,c;let l=function(e,t,n){let r,i=``;for(let a=e;a>0;a--)r=1<<a-1,i+=(t&r?1:0)+(n&r?2:0);return i}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(n===`tms`?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?`@2x`:``).replace(/{quadkey}/g,l).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=2**this.z;return new a((e.x*t-this.x)*Io,(e.y*t-this.y)*Io)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ou{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Au(e,t.z,t.z,t.x,t.y)}}class ku{constructor(e,t,n,r,i){if(e<n)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Du(n,+r,+i),this.key=Au(t,e,n,r,i)}clone(){return new ku(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let t=this.canonical.z-e;return e>this.canonical.z?new ku(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ku(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?Au(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Au(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let t=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new ku(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,n=2*this.canonical.x,r=2*this.canonical.y;return[new ku(t,this.wrap,t,n,r),new ku(t,this.wrap,t,n+1,r),new ku(t,this.wrap,t,n,r+1),new ku(t,this.wrap,t,n+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new ku(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new ku(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Ou(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Tu(e.x-this.wrap,e.y))}}function Au(e,t,n,r,i){(e*=2)<0&&(e=-1*e-1);let a=1<<n;return(a*a*e+a*i+r).toString(36)+n.toString(36)+t.toString(36)}J(`CanonicalTileID`,Du),J(`OverscaledTileID`,ku,{omit:[`posMatrix`]});class ju{constructor(e,t,n,r=1,i=1,a=1,o=0){if(this.uid=e,t.height!==t.width)throw RangeError(`DEM tiles must be square`);if(n&&![`mapbox`,`terrarium`,`custom`].includes(n))return void C(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;let s=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),n){case`terrarium`:this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case`custom`:this.redFactor=r,this.greenFactor=i,this.blueFactor=a,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let e=0;e<s;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(s,e)]=this.data[this._idx(s-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,s)]=this.data[this._idx(e,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=2**53-1,this.max=-(2**53-1);for(let e=0;e<s;e++)for(let t=0;t<s;t++){let n=this.get(e,t);n>this.max&&(this.max=n),n<this.min&&(this.min=n)}}get(e,t){let n=new Uint8Array(this.data.buffer),r=4*this._idx(e,t);return this.unpack(n[r],n[r+1],n[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw RangeError(`out of range source coordinates for DEM data`);return(t+1)*this.stride+(e+1)}unpack(e,t,n){return e*this.redFactor+t*this.greenFactor+n*this.blueFactor-this.baseShift}getPixels(){return new Ss({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,n){if(this.dim!==e.dim)throw Error(`dem dimension mismatch`);let r=t*this.dim,i=t*this.dim+this.dim,a=n*this.dim,o=n*this.dim+this.dim;switch(t){case-1:r=i-1;break;case 1:i=r+1}switch(n){case-1:a=o-1;break;case 1:o=a+1}let s=-t*this.dim,c=-n*this.dim;for(let t=a;t<o;t++)for(let n=r;n<i;n++)this.data[this._idx(n,t)]=e.data[this._idx(n+s,t+c)]}}J(`DEMData`,ju);class Mu{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let n=e[t];this._stringToNumber[n]=t,this._numberToString[t]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Nu{constructor(e,t,n,r,i){this.type=`Feature`,this._vectorTileFeature=e,e._z=t,e._x=n,e._y=r,this.properties=e.properties,this.id=i}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t!==`_geometry`&&t!==`_vectorTileFeature`&&(e[t]=this[t]);return e}}class Pu{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new wi(Io,16,0),this.grid3D=new wi(Io,16,0),this.featureIndexArray=new Wa,this.promoteId=t}insert(e,t,n,r,i,a){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,r,i);let s=a?this.grid3D:this.grid;for(let e=0;e<t.length;e++){let n=t[e],r=[1/0,1/0,-1/0,-1/0];for(let e=0;e<n.length;e++){let t=n[e];r[0]=Math.min(r[0],t.x),r[1]=Math.min(r[1],t.y),r[2]=Math.max(r[2],t.x),r[3]=Math.max(r[3],t.y)}r[0]<Io&&r[1]<Io&&r[2]>=0&&r[3]>=0&&s.insert(o,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new dc.VectorTile(new Sl(this.rawTileData)).layers,this.sourceLayerCoder=new Mu(this.vtLayers?Object.keys(this.vtLayers).sort():[`_geojsonTileLayer`])),this.vtLayers}query(e,t,n,r){this.loadVTLayers();let i=e.params||{},o=Io/e.tileSize/e.scale,s=Nr(i.filter),c=e.queryGeometry,l=e.queryPadding*o,u=Iu(c),d=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),f=Iu(e.cameraQueryGeometry),p=this.grid3D.query(f.minX-l,f.minY-l,f.maxX+l,f.maxY+l,((t,n,r,i)=>function(e,t,n,r,i){for(let a of e)if(t<=a.x&&n<=a.y&&r>=a.x&&i>=a.y)return!0;let o=[new a(t,n),new a(t,i),new a(r,i),new a(r,n)];if(e.length>2){for(let t of o)if(Qo(e,t))return!0}for(let t=0;t<e.length-1;t++)if($o(e[t],e[t+1],o))return!0;return!1}(e.cameraQueryGeometry,t-l,n-l,r+l,i+l)));for(let e of p)d.push(e);d.sort(Lu);let m={},h;for(let a=0;a<d.length;a++){let l=d[a];if(l===h)continue;h=l;let u=this.featureIndexArray.get(l),f=null;this.loadMatchingFeature(m,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,s,i.layers,i.availableImages,t,n,r,((t,n,r)=>(f||=zo(t),n.queryIntersectsFeature(c,t,r,f,this.z,e.transform,o,e.pixelPosMatrix))))}return m}loadMatchingFeature(e,t,n,r,i,a,o,s,c,l,u){let d=this.bucketLayerIDs[t];if(a&&!function(e,t){for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>=0)return!0;return!1}(a,d))return;let f=this.sourceLayerCoder.decode(n),p=this.vtLayers[f].feature(r);if(i.needGeometry){let e=Bo(p,!0);if(!i.filter(new X(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!i.filter(new X(this.tileID.overscaledZ),p))return;let m=this.getId(p,f);for(let t=0;t<d.length;t++){let n=d[t];if(a&&a.indexOf(n)<0)continue;let i=s[n];if(!i)continue;let f={};m&&l&&(f=l.getState(i.sourceLayer||`_geojsonTileLayer`,m));let h=_({},c[n]);h.paint=Fu(h.paint,i.paint,p,f,o),h.layout=Fu(h.layout,i.layout,p,f,o);let g=!u||u(p,i,f);if(!g)continue;let v=new Nu(p,this.z,this.x,this.y,m);v.layer=h;let y=e[n];y===void 0&&(y=e[n]=[]),y.push({featureIndex:r,feature:v,intersectionZ:g})}}lookupSymbolFeatures(e,t,n,r,i,a,o,s){let c={};this.loadVTLayers();let l=Nr(i);for(let i of e)this.loadMatchingFeature(c,n,r,i,l,a,o,s,t);return c}hasLayer(e){for(let t of this.bucketLayerIDs)for(let n of t)if(e===n)return!0;return!1}getId(e,t){let n=e.id;return this.promoteId&&(n=e.properties[typeof this.promoteId==`string`?this.promoteId:this.promoteId[t]],typeof n==`boolean`&&(n=Number(n))),n}}function Fu(e,t,n,r,i){return y(e,((e,a)=>{let o=t instanceof Qi?t.get(a):null;return o&&o.evaluate?o.evaluate(n,r,i):o}))}function Iu(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{minX:t,minY:n,maxX:r,maxY:i}}function Lu(e,t){return t-e}function Ru(e,t,n,r,i){let o=[];for(let s=0;s<e.length;s++){let c=e[s],l;for(let e=0;e<c.length-1;e++){let s=c[e],u=c[e+1];s.x<t&&u.x<t||(s.x<t?s=new a(t,s.y+(t-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x<t&&(u=new a(t,s.y+(t-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y<n&&u.y<n||(s.y<n?s=new a(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round():u.y<n&&(u=new a(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round()),s.x>=r&&u.x>=r||(s.x>=r?s=new a(r,s.y+(r-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=r&&(u=new a(r,s.y+(r-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=i&&u.y>=i||(s.y>=i?s=new a(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round():u.y>=i&&(u=new a(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round()),l&&s.equals(l[l.length-1])||(l=[s],o.push(l)),l.push(u)))))}}return o}J(`FeatureIndex`,Pu,{omit:[`rawTileData`,`sourceLayerCoder`]});class zu extends a{constructor(e,t,n,r){super(e,t),this.angle=n,r!==void 0&&(this.segment=r)}clone(){return new zu(this.x,this.y,this.angle,this.segment)}}function Bu(e,t,n,r,i){if(t.segment===void 0||n===0)return!0;let a=t,o=t.segment+1,s=0;for(;s>-n/2;){if(o--,o<0)return!1;s-=e[o].dist(a),a=e[o]}s+=e[o].dist(e[o+1]),o++;let c=[],l=0;for(;s<n/2;){let t=e[o],n=e[o+1];if(!n)return!1;let a=e[o-1].angleTo(t)-t.angleTo(n);for(a=Math.abs((a+3*Math.PI)%(2*Math.PI)-Math.PI),c.push({distance:s,angleDelta:a}),l+=a;s-c[0].distance>r;)l-=c.shift().angleDelta;if(l>i)return!1;o++,s+=t.dist(n)}return!0}function Vu(e){let t=0;for(let n=0;n<e.length-1;n++)t+=e[n].dist(e[n+1]);return t}function Hu(e,t,n){return e?.6*t*n:0}function Uu(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Wu(e,t,n,r,i,a){let o=Hu(n,i,a),s=Uu(n,r)*a,c=0,l=Vu(e)/2;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1],a=r.dist(i);if(c+a>l){let u=(l-c)/a,d=Vt.number(r.x,i.x,u),f=Vt.number(r.y,i.y,u),p=new zu(d,f,i.angleTo(r),n);return p._round(),!o||Bu(e,p,s,o,t)?p:void 0}c+=a}}function Gu(e,t,n,r,i,a,o,s,c){let l=Hu(r,a,o),u=Uu(r,i),d=u*o,f=e[0].x===0||e[0].x===c||e[0].y===0||e[0].y===c;return t-d<t/4&&(t=d+t/4),Ku(e,f?t/2*s%t:(u/2+2*a)*o*s%t,t,l,n,d,f,!1,c)}function Ku(e,t,n,r,i,a,o,s,c){let l=a/2,u=Vu(e),d=0,f=t-n,p=[];for(let t=0;t<e.length-1;t++){let o=e[t],s=e[t+1],m=o.dist(s),h=s.angleTo(o);for(;f+n<d+m;){f+=n;let g=(f-d)/m,_=Vt.number(o.x,s.x,g),v=Vt.number(o.y,s.y,g);if(_>=0&&_<c&&v>=0&&v<c&&f-l>=0&&f+l<=u){let n=new zu(_,v,h,t);n._round(),r&&!Bu(e,n,a,r,i)||p.push(n)}}d+=m}return s||p.length||o||(p=Ku(e,d/2,n,r,i,a,o,!0,c)),p}J(`Anchor`,zu);function qu(e,t,n,r){let i=[],o=e.image,s=o.pixelRatio,c=o.paddedRect.w-2,l=o.paddedRect.h-2,u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},d=o.stretchX||[[0,c]],f=o.stretchY||[[0,l]],p=(e,t)=>e+t[1]-t[0],m=d.reduce(p,0),h=f.reduce(p,0),g=c-m,_=l-h,v=0,y=m,b=0,x=h,S=0,C=g,w=0,T=_;if(o.content&&r){let t=o.content,n=t[2]-t[0],r=t[3]-t[1];(o.textFitWidth||o.textFitHeight)&&(u=Gl(e)),v=Ju(d,0,t[0]),b=Ju(f,0,t[1]),y=Ju(d,t[0],t[2]),x=Ju(f,t[1],t[3]),S=t[0]-v,w=t[1]-b,C=n-y,T=r-x}let E=u.x1,D=u.y1,O=u.x2-E,k=u.y2-D,A=(e,r,i,c)=>{let l=Xu(e.stretch-v,y,O,E),u=Zu(e.fixed-S,C,e.stretch,m),d=Xu(r.stretch-b,x,k,D),f=Zu(r.fixed-w,T,r.stretch,h),p=Xu(i.stretch-v,y,O,E),g=Zu(i.fixed-S,C,i.stretch,m),_=Xu(c.stretch-b,x,k,D),A=Zu(c.fixed-w,T,c.stretch,h),j=new a(l,d),ee=new a(p,d),M=new a(p,_),te=new a(l,_),ne=new a(u/s,f/s),re=new a(g/s,A/s),ie=t*Math.PI/180;if(ie){let e=Math.sin(ie),t=Math.cos(ie),n=[t,-e,e,t];j._matMult(n),ee._matMult(n),te._matMult(n),M._matMult(n)}let ae=e.stretch+e.fixed,oe=r.stretch+r.fixed;return{tl:j,tr:ee,bl:te,br:M,tex:{x:o.paddedRect.x+1+ae,y:o.paddedRect.y+1+oe,w:i.stretch+i.fixed-ae,h:c.stretch+c.fixed-oe},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ne,pixelOffsetBR:re,minFontScaleX:C/s/O,minFontScaleY:T/s/k,isSDF:n}};if(r&&(o.stretchX||o.stretchY)){let e=Yu(d,g,m),t=Yu(f,_,h);for(let n=0;n<e.length-1;n++){let r=e[n],a=e[n+1];for(let e=0;e<t.length-1;e++)i.push(A(r,t[e],a,t[e+1]))}}else i.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:c+1},{fixed:0,stretch:l+1}));return i}function Ju(e,t,n){let r=0;for(let i of e)r+=Math.max(t,Math.min(n,i[1]))-Math.max(t,Math.min(n,i[0]));return r}function Yu(e,t,n){let r=[{fixed:-1,stretch:0}];for(let[t,n]of e){let e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(n-t)})}return r.push({fixed:t+1,stretch:n}),r}function Xu(e,t,n,r){return e/t*n+r}function Zu(e,t,n,r){return e-t*n/r}class Qu{constructor(e,t,n,r,i,o,s,c,l,u){if(this.boxStartIndex=e.length,l){let e=o.top,t=o.bottom,n=o.collisionPadding;n&&(e-=n[1],t+=n[3]);let r=t-e;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{let l=o.image?.content&&(o.image.textFitWidth||o.image.textFitHeight)?Gl(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};l.y1=l.y1*s-c[0],l.y2=l.y2*s+c[2],l.x1=l.x1*s-c[3],l.x2=l.x2*s+c[1];let d=o.collisionPadding;if(d&&(l.x1-=d[0]*s,l.y1-=d[1]*s,l.x2+=d[2]*s,l.y2+=d[3]*s),u){let e=new a(l.x1,l.y1),t=new a(l.x2,l.y1),n=new a(l.x1,l.y2),r=new a(l.x2,l.y2),i=u*Math.PI/180;e._rotate(i),t._rotate(i),n._rotate(i),r._rotate(i),l.x1=Math.min(e.x,t.x,n.x,r.x),l.x2=Math.max(e.x,t.x,n.x,r.x),l.y1=Math.min(e.y,t.y,n.y,r.y),l.y2=Math.max(e.y,t.y,n.y,r.y)}e.emplaceBack(t.x,t.y,l.x1,l.y1,l.x2,l.y2,n,r,i)}this.boxEndIndex=e.length}}class $u{constructor(e=[],t=((e,t)=>e<t?-1:+(e>t))){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],i)>=0)break;t[e]=t[r],e=r}t[e]=i}}function ed(e,t=1,n=!1){let r=1/0,i=1/0,o=-1/0,s=-1/0,c=e[0];for(let e=0;e<c.length;e++){let t=c[e];(!e||t.x<r)&&(r=t.x),(!e||t.y<i)&&(i=t.y),(!e||t.x>o)&&(o=t.x),(!e||t.y>s)&&(s=t.y)}let l=Math.min(o-r,s-i),u=l/2,d=new $u([],td);if(l===0)return new a(r,i);for(let t=r;t<o;t+=l)for(let n=i;n<s;n+=l)d.push(new nd(t+u,n+u,u,e));let f=function(e){let t=0,n=0,r=0,i=e[0];for(let e=0,a=i.length,o=a-1;e<a;o=e++){let a=i[e],s=i[o],c=a.x*s.y-s.x*a.y;n+=(a.x+s.x)*c,r+=(a.y+s.y)*c,t+=3*c}return new nd(n/t,r/t,0,e)}(e),p=d.length;for(;d.length;){let r=d.pop();(r.d>f.d||!f.d)&&(f=r,n&&console.log(`found best %d after %d probes`,Math.round(1e4*r.d)/1e4,p)),r.max-f.d<=t||(u=r.h/2,d.push(new nd(r.p.x-u,r.p.y-u,u,e)),d.push(new nd(r.p.x+u,r.p.y-u,u,e)),d.push(new nd(r.p.x-u,r.p.y+u,u,e)),d.push(new nd(r.p.x+u,r.p.y+u,u,e)),p+=4)}return n&&(console.log(`num probes: ${p}`),console.log(`best distance: ${f.d}`)),f.p}function td(e,t){return t.max-e.max}function nd(e,t,n,r){this.p=new a(e,t),this.h=n,this.d=function(e,t){let n=!1,r=1/0;for(let i=0;i<t.length;i++){let a=t[i];for(let t=0,i=a.length,o=i-1;t<i;o=t++){let i=a[t],s=a[o];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n),r=Math.min(r,Xo(e,i,s))}}return(n?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var rd;e.aq=void 0,(rd=e.aq||={})[rd.center=1]=`center`,rd[rd.left=2]=`left`,rd[rd.right=3]=`right`,rd[rd.top=4]=`top`,rd[rd.bottom=5]=`bottom`,rd[rd[`top-left`]=6]=`top-left`,rd[rd[`top-right`]=7]=`top-right`,rd[rd[`bottom-left`]=8]=`bottom-left`,rd[rd[`bottom-right`]=9]=`bottom-right`;let id=1/0;function ad(e,t){return t[1]===id?function(e,t){let n=0,r=0;t<0&&(t=0);let i=t/Math.SQRT2;switch(e){case`top-right`:case`top-left`:r=i-7;break;case`bottom-right`:case`bottom-left`:r=-i+7;break;case`bottom`:r=-t+7;break;case`top`:r=t-7}switch(e){case`top-right`:case`bottom-right`:n=-i;break;case`top-left`:case`bottom-left`:n=i;break;case`left`:n=t;break;case`right`:n=-t}return[n,r]}(e,t[0]):function(e,t,n){let r=0,i=0;switch(t=Math.abs(t),n=Math.abs(n),e){case`top-right`:case`top-left`:case`top`:i=n-7;break;case`bottom-right`:case`bottom-left`:case`bottom`:i=-n+7}switch(e){case`top-right`:case`bottom-right`:case`right`:r=-t;break;case`top-left`:case`bottom-left`:case`left`:r=t}return[r,i]}(e,t[0],t[1])}function od(e,t,n){let r=e.layout,i=r.get(`text-variable-anchor-offset`)?.evaluate(t,{},n);if(i){let e=i.values,t=[];for(let n=0;n<e.length;n+=2){let r=t[n]=e[n],i=e[n+1].map((e=>e*el));r.startsWith(`top`)?i[1]-=7:r.startsWith(`bottom`)&&(i[1]+=7),t[n+1]=i}return new dt(t)}let a=r.get(`text-variable-anchor`);if(a){let i;i=e._unevaluatedLayout.getValue(`text-radial-offset`)===void 0?r.get(`text-offset`).evaluate(t,{},n).map((e=>e*el)):[r.get(`text-radial-offset`).evaluate(t,{},n)*el,id];let o=[];for(let e of a)o.push(e,ad(e,i));return new dt(o)}return null}function sd(e){switch(e){case`right`:case`top-right`:case`bottom-right`:return`right`;case`left`:case`top-left`:case`bottom-left`:return`left`}return`center`}function cd(t,n,r,i,a,o,s,c,l,u,d){let f=o.textMaxSize.evaluate(n,{});f===void 0&&(f=s);let p=t.layers[0].layout,m=p.get(`icon-offset`).evaluate(n,{},d),h=ud(r.horizontal),g=s/24,_=t.tilePixelRatio*g,v=t.tilePixelRatio*f/24,y=t.tilePixelRatio*c,b=t.tilePixelRatio*p.get(`symbol-spacing`),x=p.get(`text-padding`)*t.tilePixelRatio,S=function(e,t,n,r=1){let i=e.get(`icon-padding`).evaluate(t,{},n),a=i&&i.values;return[a[0]*r,a[1]*r,a[2]*r,a[3]*r]}(p,n,d,t.tilePixelRatio),w=p.get(`text-max-angle`)/180*Math.PI,T=p.get(`text-rotation-alignment`)!==`viewport`&&p.get(`symbol-placement`)!==`point`,E=p.get(`icon-rotation-alignment`)===`map`&&p.get(`symbol-placement`)!==`point`,D=p.get(`symbol-placement`),O=b/2,k=p.get(`icon-text-fit`),A;i&&k!==`none`&&(t.allowVerticalPlacement&&r.vertical&&(A=Kl(i,r.vertical,k,p.get(`icon-text-fit-padding`),m,g)),h&&(i=Kl(i,h,k,p.get(`icon-text-fit-padding`),m,g)));let j=(c,f)=>{f.x<0||f.x>=Io||f.y<0||f.y>=Io||function(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,w,T,E){let D=t.addToLineVertexArray(n,r),O,k,A,j,ee=0,M=0,te=0,ne=0,re=-1,ie=-1,ae={},oe=go(``);if(t.allowVerticalPlacement&&i.vertical){let e=c.layout.get(`text-rotate`).evaluate(x,{},T)+90;A=new Qu(l,n,u,d,f,i.vertical,p,m,h,e),s&&(j=new Qu(l,n,u,d,f,s,_,v,h,e))}if(a){let r=c.layout.get(`icon-rotate`).evaluate(x,{}),i=c.layout.get(`icon-text-fit`)!==`none`,o=qu(a,r,w,i),p=s?qu(s,r,w,i):void 0;k=new Qu(l,n,u,d,f,a,_,v,!1,r),ee=4*o.length;let m=t.iconSizeData,h=null;m.kind===`source`?(h=[128*c.layout.get(`icon-size`).evaluate(x,{})],h[0]>ql&&C(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):m.kind===`composite`&&(h=[128*S.compositeIconSizes[0].evaluate(x,{},T),128*S.compositeIconSizes[1].evaluate(x,{},T)],(h[0]>ql||h[1]>ql)&&C(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,o,h,b,y,x,e.ah.none,n,D.lineStartIndex,D.lineLength,-1,T),re=t.icon.placedSymbolArray.length-1,p&&(M=4*p.length,t.addSymbols(t.icon,p,h,b,y,x,e.ah.vertical,n,D.lineStartIndex,D.lineLength,-1,T),ie=t.icon.placedSymbolArray.length-1)}let se=Object.keys(i.horizontal);for(let r of se){let a=i.horizontal[r];if(!O){oe=go(a.text);let e=c.layout.get(`text-rotate`).evaluate(x,{},T);O=new Qu(l,n,u,d,f,a,p,m,h,e)}let s=a.positionedLines.length===1;if(te+=ld(t,n,a,o,c,h,x,g,D,i.vertical?e.ah.horizontal:e.ah.horizontalOnly,s?se:[r],ae,re,S,T),s)break}i.vertical&&(ne+=ld(t,n,i.vertical,o,c,h,x,g,D,e.ah.vertical,[`vertical`],ae,ie,S,T));let ce=O?O.boxStartIndex:t.collisionBoxArray.length,le=O?O.boxEndIndex:t.collisionBoxArray.length,ue=A?A.boxStartIndex:t.collisionBoxArray.length,de=A?A.boxEndIndex:t.collisionBoxArray.length,fe=k?k.boxStartIndex:t.collisionBoxArray.length,N=k?k.boxEndIndex:t.collisionBoxArray.length,pe=j?j.boxStartIndex:t.collisionBoxArray.length,me=j?j.boxEndIndex:t.collisionBoxArray.length,P=-1,he=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;P=he(O,P),P=he(A,P),P=he(k,P),P=he(j,P);let ge=+(P>-1);ge&&(P*=E/el),t.glyphOffsetArray.length>=ru.MAX_GLYPHS&&C(`Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907`),x.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey);let _e=od(c,x,T),[ve,ye]=function(t,n){let r=t.length,i=n?.values;if(i?.length>0)for(let n=0;n<i.length;n+=2){let r=i[n+1];t.emplaceBack(e.aq[i[n]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,_e);t.symbolInstances.emplaceBack(n.x,n.y,ae.right>=0?ae.right:-1,ae.center>=0?ae.center:-1,ae.left>=0?ae.left:-1,ae.vertical||-1,re,ie,oe,ce,le,ue,de,fe,N,pe,me,u,te,ne,ee,M,ge,0,p,P,ve,ye)}(t,f,c,r,i,a,A,t.layers[0],t.collisionBoxArray,n.index,n.sourceLayerIndex,t.index,_,[x,x,x,x],T,l,y,S,E,m,n,o,u,d,s)};if(D===`line`)for(let e of Ru(n.geometry,0,0,Io,Io)){let n=Gu(e,b,w,r.vertical||h,i,24,v,t.overscaling,Io);for(let r of n)h&&dd(t,h.text,O,r)||j(e,r)}else if(D===`line-center`){for(let e of n.geometry)if(e.length>1){let t=Wu(e,w,r.vertical||h,i,24,v);t&&j(e,t)}}else if(n.type===`Polygon`)for(let e of kn(n.geometry,0)){let t=ed(e,16);j(e[0],new zu(t.x,t.y,0))}else if(n.type===`LineString`)for(let e of n.geometry)j(e,new zu(e[0].x,e[0].y,0));else if(n.type===`Point`)for(let e of n.geometry)for(let t of e)j([t],new zu(t.x,t.y,0))}function ld(e,t,n,r,i,o,s,c,l,u,d,f,p,m,h){let g=function(e,t,n,r,i,o,s,c){let l=r.layout.get(`text-rotate`).evaluate(o,{})*Math.PI/180,u=[];for(let e of t.positionedLines)for(let r of e.positionedGlyphs){if(!r.rect)continue;let o=r.rect||{},d=4,f=!0,p=1,m=0,h=(i||c)&&r.vertical,g=r.metrics.advance*r.scale/2;if(c&&t.verticalizable&&(m=e.lineOffset/2-(r.imageName?-(el-r.metrics.width*r.scale)/2:(r.scale-1)*el)),r.imageName){let e=s[r.imageName];f=e.sdf,p=e.pixelRatio,d=1/p}let _=i?[r.x+g,r.y]:[0,0],v=i?[0,0]:[r.x+g+n[0],r.y+n[1]-m],y=[0,0];h&&(y=v,v=[0,0]);let b=r.metrics.isDoubleResolution?2:1,x=(r.metrics.left-d)*r.scale-g+v[0],S=(-r.metrics.top-d)*r.scale+v[1],C=x+o.w/b*r.scale/p,w=S+o.h/b*r.scale/p,T=new a(x,S),E=new a(C,S),D=new a(x,w),O=new a(C,w);if(h){let e=new a(-g,g- -17),t=-Math.PI/2,n=el/2-g,i=new a(22-n,-(r.imageName?n:0)),o=new a(...y);T._rotateAround(t,e)._add(i)._add(o),E._rotateAround(t,e)._add(i)._add(o),D._rotateAround(t,e)._add(i)._add(o),O._rotateAround(t,e)._add(i)._add(o)}if(l){let e=Math.sin(l),t=Math.cos(l),n=[t,-e,e,t];T._matMult(n),E._matMult(n),D._matMult(n),O._matMult(n)}let k=new a(0,0),A=new a(0,0);u.push({tl:T,tr:E,bl:D,br:O,tex:o,writingMode:t.writingMode,glyphOffset:_,sectionIndex:r.sectionIndex,isSDF:f,pixelOffsetTL:k,pixelOffsetBR:A,minFontScaleX:0,minFontScaleY:0})}return u}(0,n,c,i,o,s,r,e.allowVerticalPlacement),_=e.textSizeData,v=null;_.kind===`source`?(v=[128*i.layout.get(`text-size`).evaluate(s,{})],v[0]>ql&&C(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):_.kind===`composite`&&(v=[128*m.compositeTextSizes[0].evaluate(s,{},h),128*m.compositeTextSizes[1].evaluate(s,{},h)],(v[0]>ql||v[1]>ql)&&C(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,v,c,o,s,u,t,l.lineStartIndex,l.lineLength,p,h);for(let t of d)f[t]=e.text.placedSymbolArray.length-1;return 4*g.length}function ud(e){for(let t in e)return e[t];return null}function dd(e,t,n,r){let i=e.compareText;if(t in i){let e=i[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<n)return!0}else i[t]=[];return i[t].push(r),!1}let fd=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class pd{static from(e){if(!(e instanceof ArrayBuffer))throw Error(`Data must be an instance of ArrayBuffer.`);let[t,n]=new Uint8Array(e,0,2);if(t!==219)throw Error(`Data does not appear to be in a KDBush format.`);let r=n>>4;if(r!==1)throw Error(`Got v${r} data when expected v1.`);let i=fd[15&n];if(!i)throw Error(`Unrecognized array type.`);let[a]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new pd(o,a,i,e)}constructor(e,t=64,n=Float64Array,r){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let i=fd.indexOf(this.ArrayType),a=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-o%8)%8;if(i<0)throw Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+a+o+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return md(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this,s=[0,i.length-1,0],c=[];for(;s.length;){let l=s.pop()||0,u=s.pop()||0,d=s.pop()||0;if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&(s.push(d),s.push(f-1),s.push(1-l)),(l===0?n>=p:r>=m)&&(s.push(f+1),s.push(u),s.push(1-l))}return c}within(e,t,n){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:r,coords:i,nodeSize:a}=this,o=[0,r.length-1,0],s=[],c=n*n;for(;o.length;){let l=o.pop()||0,u=o.pop()||0,d=o.pop()||0;if(u-d<=a){for(let n=d;n<=u;n++)vd(i[2*n],i[2*n+1],e,t)<=c&&s.push(r[n]);continue}let f=d+u>>1,p=i[2*f],m=i[2*f+1];vd(p,m,e,t)<=c&&s.push(r[f]),(l===0?e-n<=p:t-n<=m)&&(o.push(d),o.push(f-1),o.push(1-l)),(l===0?e+n>=p:t+n>=m)&&(o.push(f+1),o.push(u),o.push(1-l))}return s}}function md(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;hd(e,t,o,r,i,a),md(e,t,n,r,o-1,1-a),md(e,t,n,o+1,i,1-a)}function hd(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);hd(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(gd(e,t,r,n),t[2*i+a]>o&&gd(e,t,r,i);s<c;){for(gd(e,t,s,c),s++,c--;t[2*s+a]<o;)s++;for(;t[2*c+a]>o;)c--}t[2*r+a]===o?gd(e,t,r,c):(c++,gd(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function gd(e,t,n,r){_d(e,n,r),_d(t,2*n,2*r),_d(t,2*n+1,2*r+1)}function _d(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function vd(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}var yd;e.bg=void 0,(yd=e.bg||={}).create=`create`,yd.load=`load`,yd.fullLoad=`fullLoad`;let bd=null,xd=[],Sd=1e3/60,Cd=`loadTime`,wd=`fullLoadTime`;e.$=class extends fa{},e.A=ss,e.B=bi,e.C=function(e){if(E==null){let t=e.navigator?e.navigator.userAgent:null;E=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match(`Safari`)&&!t.match(`Chrome`)))}return E},e.D=Z,e.E=fe,e.F=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new gu((()=>this.process())),this.subscription=function(e,t,n,r){return e.addEventListener(t,n,!1),{unsubscribe:()=>{e.removeEventListener(t,n,!1)}}}(this.target,`message`,(e=>this.receive(e))),this.globalScope=T(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise(((n,r)=>{let i=Math.round(0xde0b6b3a7640000*Math.random()).toString(36).substring(0,10);this.resolveRejects[i]={resolve:n,reject:r},t&&t.signal.addEventListener(`abort`,(()=>{delete this.resolveRejects[i];let t={id:i,type:`<cancel>`,origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)}),{once:!0});let a=[],o=Object.assign(Object.assign({},e),{id:i,sourceMapId:this.mapId,origin:location.origin,data:ki(e.data,a)});this.target.postMessage(o,{transfer:a})}))}receive(e){let t=e.data,n=t.id;if(!(t.origin!==`file://`&&location.origin!==`file://`&&t.origin!==`resource://android`&&location.origin!==`resource://android`&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type===`<cancel>`){delete this.tasks[n];let e=this.abortControllers[n];delete this.abortControllers[n],e&&e.abort();return}if(T(self)||t.mustQueue)return this.tasks[n]=t,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,n){return t(this,void 0,void 0,(function*(){if(n.type===`<response>`){let t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;n.error?t.reject(Ai(n.error)):t.resolve(Ai(n.data));return}if(!this.messageHandlers[n.type])return void this.completeTask(e,Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(`, `)}`));let t=Ai(n.data),r=new AbortController;this.abortControllers[e]=r;try{let i=yield this.messageHandlers[n.type](n.sourceMapId,t,r);this.completeTask(e,null,i)}catch(t){this.completeTask(e,t)}}))}completeTask(e,t,n){let r=[];delete this.abortControllers[e];let i={id:e,type:`<response>`,sourceMapId:this.mapId,origin:location.origin,error:t?ki(t):null,data:ki(n,r)};this.target.postMessage(i,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.G=re,e.H=function(){var e=new ss(16);return ss!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.I=Dl,e.J=function(e,t,n){var r,i,a,o,s,c,l,u,d,f,p,m,h=n[0],g=n[1],_=n[2];return t===e?(e[12]=t[0]*h+t[4]*g+t[8]*_+t[12],e[13]=t[1]*h+t[5]*g+t[9]*_+t[13],e[14]=t[2]*h+t[6]*g+t[10]*_+t[14],e[15]=t[3]*h+t[7]*g+t[11]*_+t[15]):(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],e[0]=r=t[0],e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=l,e[7]=u,e[8]=d,e[9]=f,e[10]=p,e[11]=m,e[12]=r*h+s*g+d*_+t[12],e[13]=i*h+c*g+f*_+t[13],e[14]=a*h+l*g+p*_+t[14],e[15]=o*h+u*g+m*_+t[15]),e},e.K=function(e,t,n){var r=n[0],i=n[1],a=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.L=ls,e.M=function(e,t){let n={};for(let r=0;r<t.length;r++){let i=t[r];i in e&&(n[i]=e[i])}return n},e.N=vu,e.O=xu,e.P=a,e.Q=Su,e.R=Ss,e.S=ku,e.T=qi,e.U=d,e.V=f,e.W=k,e.X=Io,e.Y=ca,e.Z=Tu,e._=t,e.a=te,e.a$=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],d=e[9],f=e[10],p=e[11],m=e[12],h=e[13],g=e[14],_=e[15],v=t[0],y=t[1],b=t[2],x=t[3],S=t[4],C=t[5],w=t[6],T=t[7],E=t[8],D=t[9],O=t[10],k=t[11],A=t[12],j=t[13],ee=t[14],M=t[15];return Math.abs(n-v)<=os*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(r-y)<=os*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(i-b)<=os*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(a-x)<=os*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(o-S)<=os*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(s-C)<=os*Math.max(1,Math.abs(s),Math.abs(C))&&Math.abs(c-w)<=os*Math.max(1,Math.abs(c),Math.abs(w))&&Math.abs(l-T)<=os*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-E)<=os*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(d-D)<=os*Math.max(1,Math.abs(d),Math.abs(D))&&Math.abs(f-O)<=os*Math.max(1,Math.abs(f),Math.abs(O))&&Math.abs(p-k)<=os*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(m-A)<=os*Math.max(1,Math.abs(m),Math.abs(A))&&Math.abs(h-j)<=os*Math.max(1,Math.abs(h),Math.abs(j))&&Math.abs(g-ee)<=os*Math.max(1,Math.abs(g),Math.abs(ee))&&Math.abs(_-M)<=os*Math.max(1,Math.abs(_),Math.abs(M))},e.a0=oo,e.a1=Du,e.a2=F,e.a3=e=>{let t=window.document.createElement(`video`);return t.muted=!0,new Promise((n=>{t.onloadstart=()=>{n(t)};for(let n of e){let e=window.document.createElement(`source`);se(n)||(t.crossOrigin=`Anonymous`),e.src=n,t.appendChild(e)}}))},e.a4=function(){return v++},e.a5=Pa,e.a6=ru,e.a7=Nr,e.a8=Bo,e.a9=Nu,e.aA=function(e){if(e.type===`custom`)return new hu(e);switch(e.type){case`background`:return new du(e);case`circle`:return new ps(e);case`fill`:return new sc(e);case`fill-extrusion`:return new jc(e);case`heatmap`:return new Ts(e);case`hillshade`:return new Os(e);case`line`:return new Gc(e);case`raster`:return new mu(e);case`symbol`:return new cu(e)}},e.aB=x,e.aC=function(e,t){if(!e)return[{command:`setStyle`,args:[t]}];let n=[];try{if(!P(e.version,t.version))return[{command:`setStyle`,args:[t]}];P(e.center,t.center)||n.push({command:`setCenter`,args:[t.center]}),P(e.zoom,t.zoom)||n.push({command:`setZoom`,args:[t.zoom]}),P(e.bearing,t.bearing)||n.push({command:`setBearing`,args:[t.bearing]}),P(e.pitch,t.pitch)||n.push({command:`setPitch`,args:[t.pitch]}),P(e.sprite,t.sprite)||n.push({command:`setSprite`,args:[t.sprite]}),P(e.glyphs,t.glyphs)||n.push({command:`setGlyphs`,args:[t.glyphs]}),P(e.transition,t.transition)||n.push({command:`setTransition`,args:[t.transition]}),P(e.light,t.light)||n.push({command:`setLight`,args:[t.light]}),P(e.terrain,t.terrain)||n.push({command:`setTerrain`,args:[t.terrain]}),P(e.sky,t.sky)||n.push({command:`setSky`,args:[t.sky]}),P(e.projection,t.projection)||n.push({command:`setProjection`,args:[t.projection]});let r={},i=[];(function(e,t,n,r){let i;for(i in t||={},e||={})Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||_e(i,n,r));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?P(e[i],t[i])||(e[i].type===`geojson`&&t[i].type===`geojson`&&ye(e,t,i)?he(n,{command:`setGeoJSONSourceData`,args:[i,t[i].data]}):ve(i,t,n,r)):ge(i,t,n))})(e.sources,t.sources,i,r);let a=[];e.layers&&e.layers.forEach((e=>{`source`in e&&r[e.source]?n.push({command:`removeLayer`,args:[e.id]}):a.push(e)})),n=n.concat(i),function(e,t,n){t||=[];let r=(e||=[]).map(xe),i=t.map(xe),a=e.reduce(Se,{}),o=t.reduce(Se,{}),s=r.slice(),c=Object.create(null),l,u,d,f,p;for(let e=0,t=0;e<r.length;e++)l=r[e],Object.prototype.hasOwnProperty.call(o,l)?t++:(he(n,{command:`removeLayer`,args:[l]}),s.splice(s.indexOf(l,t),1));for(let e=0,t=0;e<i.length;e++)l=i[i.length-1-e],s[s.length-1-e]!==l&&(Object.prototype.hasOwnProperty.call(a,l)?(he(n,{command:`removeLayer`,args:[l]}),s.splice(s.lastIndexOf(l,s.length-t),1)):t++,f=s[s.length-e],he(n,{command:`addLayer`,args:[o[l],f]}),s.splice(s.length-e,0,l),c[l]=!0);for(let e=0;e<i.length;e++)if(l=i[e],u=a[l],d=o[l],!c[l]&&!P(u,d))if(P(u.source,d.source)&&P(u[`source-layer`],d[`source-layer`])&&P(u.type,d.type)){for(p in be(u.layout,d.layout,n,l,null,`setLayoutProperty`),be(u.paint,d.paint,n,l,null,`setPaintProperty`),P(u.filter,d.filter)||he(n,{command:`setFilter`,args:[l,d.filter]}),P(u.minzoom,d.minzoom)&&P(u.maxzoom,d.maxzoom)||he(n,{command:`setLayerZoomRange`,args:[l,d.minzoom,d.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?be(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):P(u[p],d[p])||he(n,{command:`setLayerProperty`,args:[l,p,d[p]]}));for(p in d)Object.prototype.hasOwnProperty.call(d,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?be(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):P(u[p],d[p])||he(n,{command:`setLayerProperty`,args:[l,p,d[p]]}))}else he(n,{command:`removeLayer`,args:[l]}),f=s[s.lastIndexOf(l)+1],he(n,{command:`addLayer`,args:[d,f]})}(a,t.layers,n)}catch(e){console.warn(`Unable to compute style diff:`,e),n=[{command:`setStyle`,args:[t]}]}return n},e.aD=function(e){let t=[],n=e.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),e.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),e.renderingMode&&e.renderingMode!==`2d`&&e.renderingMode!==`3d`&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},e.aE=function e(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}if(typeof t==`object`&&t&&n!==null){if(typeof n!=`object`||Object.keys(t).length!==Object.keys(n).length)return!1;for(let r in t)if(!e(t[r],n[r]))return!1;return!0}return t===n},e.aF=y,e.aG=b,e.aH=class extends xo{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.aI=So,e.aJ=class extends xo{constructor(e,t){super(e,t),this.current=To}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.aK=Co,e.aL=wo,e.aM=B,e.aN=class extends xo{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.aO=class extends xo{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.aP=function(e,t,n,r,i,a,o){var s=1/(t-n),c=1/(r-i),l=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*s,e[13]=(i+r)*c,e[14]=(o+a)*l,e[15]=1,e},e.aQ=ds,e.aR=class extends Sa{},e.aS=Zc,e.aT=class extends wa{},e.aU=ws,e.aV=function(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)},e.aW=Cs,e.aX=Ga,e.aY=ro,e.aZ=class extends ja{},e.a_=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},e.aa=function(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,n,r,i)=>{let a=r||i;return t[n]=!a||a.toLowerCase(),``})),t[`max-age`]){let e=parseInt(t[`max-age`],10);isNaN(e)?delete t[`max-age`]:t[`max-age`]=e}return t},e.ab=function(e,t){let n=[];for(let r in e)r in t||n.push(r);return n},e.ac=h,e.ad=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[0],o=t[1],s=t[2],c=t[3],l=t[4],u=t[5],d=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i+l*r,e[1]=o*i+u*r,e[2]=s*i+d*r,e[3]=c*i+f*r,e[4]=l*i-a*r,e[5]=u*i-o*r,e[6]=d*i-s*r,e[7]=f*i-c*r,e},e.ae=function(e){var t=new ss(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.af=fs,e.ag=function(e,t){let n=0,r=0;if(e.kind===`constant`)r=e.layoutSize;else if(e.kind!==`source`){let{interpolationType:i,minZoom:a,maxZoom:o}=e,s=i?h(Ht.interpolationFactor(i,t,a,o),0,1):0;e.kind===`camera`?r=Vt.number(e.minSize,e.maxSize,s):n=s}return{uSizeT:n,uSize:r}},e.ai=function(e,{uSize:t,uSizeT:n},{lowerSize:r,upperSize:i}){return e.kind===`source`?r/128:e.kind===`composite`?Vt.number(r/128,i/128,n):t},e.aj=$l,e.ak=function(e,t,n,r){let i=t.y-e.y,o=t.x-e.x,s=r.y-n.y,c=r.x-n.x,l=s*o-c*i;if(l===0)return null;let u=(c*(e.y-n.y)-s*(e.x-n.x))/l;return new a(e.x+u*o,e.y+u*i)},e.al=Ru,e.am=Uo,e.an=cs,e.ao=function(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return[t,n,r,i]},e.ap=el,e.ar=Yl,e.as=function(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(e[0]=(s*k-c*O+l*D)*(A=1/A),e[1]=(i*O-r*k-a*D)*A,e[2]=(h*C-g*S+_*x)*A,e[3]=(f*S-d*C-p*x)*A,e[4]=(c*E-o*k-l*T)*A,e[5]=(n*k-i*E+a*T)*A,e[6]=(g*b-m*C-_*y)*A,e[7]=(u*C-f*b+p*y)*A,e[8]=(o*O-s*E+l*w)*A,e[9]=(r*E-n*O-a*w)*A,e[10]=(m*S-h*b+_*v)*A,e[11]=(d*b-u*S-p*v)*A,e[12]=(s*T-o*D-c*w)*A,e[13]=(n*D-r*T+i*w)*A,e[14]=(h*y-m*x-g*v)*A,e[15]=(u*x-d*y+f*v)*A,e):null},e.at=sd,e.au=Hl,e.av=pd,e.aw=function(){let e={},t=N.$version;for(let n in N.$root){let r=N.$root[n];if(r.required){let i=null;i=n===`version`?t:r.type===`array`?[]:{},i!=null&&(e[n]=i)}}return e},e.ax=ji,e.ay=ae,e.az=function(e){e=e.slice();let t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].id]=e[n];for(let n=0;n<e.length;n++)`ref`in e[n]&&(e[n]=me(e[n],t[e[n].ref]));return e},e.b=D,e.b0=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.b1=function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e},e.b2=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},e.b3=g,e.b4=Ou,e.b5=Cu,e.b6=function(e,t,n,r,i){var a,o=1/Math.tan(t/2);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(e[10]=(i+r)*(a=1/(r-i)),e[14]=2*i*r*a):(e[10]=-1,e[14]=-2*r),e},e.b7=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*i+l*r,e[5]=o*i+u*r,e[6]=s*i+d*r,e[7]=c*i+f*r,e[8]=l*i-a*r,e[9]=u*i-o*r,e[10]=d*i-s*r,e[11]=f*i-c*r,e},e.b8=p,e.b9=m,e.bA=tl,e.bB=function(e){return e.message===ee},e.bC=Tr,e.bD=Wi,e.ba=function(e){return e*Math.PI/180},e.bb=function(e,t){let{x:n,y:r}=Tu.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||n<0||n>=1)},e.bc=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.bd=class extends da{},e.be=_u,e.bf={mark(e){performance.mark(e)},frame(e){let t=e;bd!=null&&xd.push(t-bd),bd=t},clearMetrics(){bd=null,xd=[],performance.clearMeasures(Cd),performance.clearMeasures(wd);for(let t in e.bg)performance.clearMarks(e.bg[t])},getPerformanceMetrics(){performance.measure(Cd,e.bg.create,e.bg.load),performance.measure(wd,e.bg.create,e.bg.fullLoad);let t=performance.getEntriesByName(Cd)[0].duration,n=performance.getEntriesByName(wd)[0].duration,r=xd.length,i=1/(xd.reduce(((e,t)=>e+t),0)/r/1e3),a=xd.filter((e=>e>Sd)).reduce(((e,t)=>e+(t-Sd)/Sd),0);return{loadTime:t,fullLoadTime:n,fps:i,percentDroppedFrames:a/(r+a)*100,totalFrames:r}}},e.bh=ie,e.bi=function(e,t){te.REGISTERED_PROTOCOLS[e]=t},e.bj=function(e){delete te.REGISTERED_PROTOCOLS[e]},e.bk=function(e,t){let n={};for(let r=0;r<e.length;r++){let i=t&&t[e[r].id]||Hr(e[r]);t&&(t[e[r].id]=i);let a=n[i];a||=n[i]=[],a.push(e[r])}let r=[];for(let e in n)r.push(n[e]);return r},e.bl=J,e.bm=Mu,e.bn=Pu,e.bo=Ol,e.bp=function(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=Io/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let n=t.bucket.layers[0],r=n.layout,i=n._unevaluatedLayout._values,a={layoutIconSize:i[`icon-size`].possiblyEvaluate(new X(t.bucket.zoom+1),t.canonical),layoutTextSize:i[`text-size`].possiblyEvaluate(new X(t.bucket.zoom+1),t.canonical),textMaxSize:i[`text-size`].possiblyEvaluate(new X(18))};if(t.bucket.textSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.bucket.textSizeData;a.compositeTextSizes=[i[`text-size`].possiblyEvaluate(new X(e),t.canonical),i[`text-size`].possiblyEvaluate(new X(n),t.canonical)]}if(t.bucket.iconSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.bucket.iconSizeData;a.compositeIconSizes=[i[`icon-size`].possiblyEvaluate(new X(e),t.canonical),i[`icon-size`].possiblyEvaluate(new X(n),t.canonical)]}let o=r.get(`text-line-height`)*el,s=r.get(`text-rotation-alignment`)!==`viewport`&&r.get(`symbol-placement`)!==`point`,c=r.get(`text-keep-upright`),l=r.get(`text-size`);for(let i of t.bucket.features){let u=r.get(`text-font`).evaluate(i,{},t.canonical).join(`,`),d=l.evaluate(i,{},t.canonical),f=a.layoutTextSize.evaluate(i,{},t.canonical),p=a.layoutIconSize.evaluate(i,{},t.canonical),m={horizontal:{},vertical:void 0},h=i.text,g,_=[0,0];if(h){let a=h.toString(),l=r.get(`text-letter-spacing`).evaluate(i,{},t.canonical)*el,p=Ni(a)?l:0,g=r.get(`text-anchor`).evaluate(i,{},t.canonical),v=od(n,i,t.canonical);if(!v){let e=r.get(`text-radial-offset`).evaluate(i,{},t.canonical);_=e?ad(g,[e*el,id]):r.get(`text-offset`).evaluate(i,{},t.canonical).map((e=>e*el))}let y=s?`center`:r.get(`text-justify`).evaluate(i,{},t.canonical),b=r.get(`symbol-placement`)===`point`?r.get(`text-max-width`).evaluate(i,{},t.canonical)*el:1/0,x=()=>{t.bucket.allowVerticalPlacement&&Mi(a)&&(m.vertical=Ml(h,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,o,g,`left`,p,_,e.ah.vertical,!0,f,d))};if(!s&&v){let n=new Set;if(y===`auto`)for(let e=0;e<v.values.length;e+=2)n.add(sd(v.values[e]));else n.add(y);let r=!1;for(let i of n)if(!m.horizontal[i])if(r)m.horizontal[i]=m.horizontal[0];else{let n=Ml(h,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,o,`center`,i,p,_,e.ah.horizontal,!1,f,d);n&&(m.horizontal[i]=n,r=n.positionedLines.length===1)}x()}else{y===`auto`&&(y=sd(g));let n=Ml(h,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,o,g,y,p,_,e.ah.horizontal,!1,f,d);n&&(m.horizontal[y]=n),x(),Mi(a)&&s&&c&&(m.vertical=Ml(h,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,o,g,y,p,_,e.ah.vertical,!1,f,d))}}let v=!1;if(i.icon&&i.icon.name){let e=t.imageMap[i.icon.name];e&&(g=Wl(t.imagePositions[i.icon.name],r.get(`icon-offset`).evaluate(i,{},t.canonical),r.get(`icon-anchor`).evaluate(i,{},t.canonical)),v=!!e.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=v:t.bucket.sdfIcons!==v&&C(`Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer`),(e.pixelRatio!==t.bucket.pixelRatio||r.get(`icon-rotate`).constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let y=ud(m.horizontal)||m.vertical;t.bucket.iconsInText=!!y&&y.iconsInText,(y||g)&&cd(t.bucket,i,m,g,t.imageMap,a,f,p,_,v,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.bq=zc,e.br=rc,e.bs=Ec,e.bt=dc,e.bu=Sl,e.bv=class{constructor(e){this._marks={start:[e.url,`start`].join(`#`),end:[e.url,`end`].join(`#`),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return e.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}},e.bw=function(e,n,r,i,a){return t(this,void 0,void 0,(function*(){if(f())try{return yield k(e,n,r,i,a)}catch{}return function(e,t,n,r,i){let a=e.width,o=e.height;A&&j||(A=new OffscreenCanvas(a,o),j=A.getContext(`2d`,{willReadFrequently:!0})),A.width=a,A.height=o,j.drawImage(e,0,0,a,o);let s=j.getImageData(t,n,r,i);return j.clearRect(0,0,a,o),s.data}(e,n,r,i,a)}))},e.bx=ju,e.by=n,e.bz=r,e.c=M,e.d=e=>t(void 0,void 0,void 0,(function*(){if(e.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(e)],{type:`image/png`});try{return createImageBitmap(t)}catch(e){throw Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),e.e=_,e.f=e=>new Promise(((t,n)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=O}))},r.onerror=()=>n(Error(`Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`));let i=new Blob([new Uint8Array(e)],{type:`image/png`});r.src=e.byteLength?URL.createObjectURL(i):O})),e.g=ne,e.h=(e,t)=>oe(_(e,{type:`json`}),t),e.i=T,e.j=de,e.k=ue,e.l=(e,t)=>oe(_(e,{type:`arrayBuffer`}),t),e.m=oe,e.n=function(e){return new Sl(e).readFields(Cl,[])},e.o=xs,e.p=El,e.q=na,e.r=yi,e.s=se,e.t=Ci,e.u=vi,e.v=N,e.w=C,e.x=function([e,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(n),y:e*Math.sin(t)*Math.sin(n),z:e*Math.cos(n)}},e.y=Vt,e.z=X})),n(`worker`,[`./shared`],(function(e){class t{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,n){for(let n of t){this._layerConfigs[n.id]=n;let t=this._layers[n.id]=e.aA(n);t._featureFilter=e.a7(t.filter),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(let e of n)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};let r=e.bk(Object.values(this._layerConfigs),this.keyCache);for(let e of r){let t=e.map((e=>this._layers[e.id])),n=t[0];if(n.visibility===`none`)continue;let r=n.source||``,i=this.familiesBySource[r];i||=this.familiesBySource[r]={};let a=n.sourceLayer||`_geojsonTileLayer`,o=i[a];o||=i[a]=[],o.push(t)}}}class n{constructor(t){let n={},r=[];for(let e in t){let i=t[e],a=n[e]={};for(let e in i){let t=i[+e];if(!t||t.bitmap.width===0||t.bitmap.height===0)continue;let n={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};r.push(n),a[e]={rect:n,metrics:t.metrics}}}let{w:i,h:a}=e.p(r),o=new e.o({width:i||1,height:a||1});for(let r in t){let i=t[r];for(let t in i){let a=i[+t];if(!a||a.bitmap.width===0||a.bitmap.height===0)continue;let s=n[r][t].rect;e.o.copy(a.bitmap,o,{x:0,y:0},{x:s.x+1,y:s.y+1},a.bitmap)}}this.image=o,this.positions=n}}e.bl(`GlyphAtlas`,n);class r{constructor(t){this.tileID=new e.S(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(t,r,a,o){return e._(this,void 0,void 0,(function*(){this.status=`parsing`,this.data=t,this.collisionBoxArray=new e.a5;let s=new e.bm(Object.keys(t.layers).sort()),c=new e.bn(this.tileID,this.promoteId);c.bucketLayerIDs=[];let l={},u={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:a},d=r.familiesBySource[this.source];for(let n in d){let r=t.layers[n];if(!r)continue;r.version===1&&e.w(`Vector tile source "${this.source}" layer "${n}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let o=s.encode(n),f=[];for(let e=0;e<r.length;e++){let t=r.feature(e),i=c.getId(t,n);f.push({feature:t,id:i,index:e,sourceLayerIndex:o})}for(let t of d[n]){let n=t[0];n.source!==this.source&&e.w(`layer.source = ${n.source} does not equal this.source = ${this.source}`),n.minzoom&&this.zoom<Math.floor(n.minzoom)||n.maxzoom&&this.zoom>=n.maxzoom||n.visibility!==`none`&&(i(t,this.zoom,a),(l[n.id]=n.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(f,u,this.tileID.canonical),c.bucketLayerIDs.push(t.map((e=>e.id))))}}let f=e.aF(u.glyphDependencies,(e=>Object.keys(e).map(Number)));this.inFlightDependencies.forEach((e=>e?.abort())),this.inFlightDependencies=[];let p=Promise.resolve({});if(Object.keys(f).length){let e=new AbortController;this.inFlightDependencies.push(e),p=o.sendAsync({type:`GG`,data:{stacks:f,source:this.source,tileID:this.tileID,type:`glyphs`}},e)}let m=Object.keys(u.iconDependencies),h=Promise.resolve({});if(m.length){let e=new AbortController;this.inFlightDependencies.push(e),h=o.sendAsync({type:`GI`,data:{icons:m,source:this.source,tileID:this.tileID,type:`icons`}},e)}let g=Object.keys(u.patternDependencies),_=Promise.resolve({});if(g.length){let e=new AbortController;this.inFlightDependencies.push(e),_=o.sendAsync({type:`GI`,data:{icons:g,source:this.source,tileID:this.tileID,type:`patterns`}},e)}let[v,y,b]=yield Promise.all([p,h,_]),x=new n(v),S=new e.bo(y,b);for(let t in l){let n=l[t];n instanceof e.a6?(i(n.layers,this.zoom,a),e.bp({bucket:n,glyphMap:v,glyphPositions:x.positions,imageMap:y,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):n.hasPattern&&(n instanceof e.bq||n instanceof e.br||n instanceof e.bs)&&(i(n.layers,this.zoom,a),n.addFeatures(u,this.tileID.canonical,S.patternPositions))}return this.status=`done`,{buckets:Object.values(l).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:x.image,imageAtlas:S,glyphMap:this.returnDependencies?v:null,iconMap:this.returnDependencies?y:null,glyphPositions:this.returnDependencies?x.positions:null}}))}}function i(t,n,r){let i=new e.z(n);for(let e of t)e.recalculate(i,r)}class a{constructor(e,t,n){this.actor=e,this.layerIndex=t,this.availableImages=n,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(t,n){return e._(this,void 0,void 0,(function*(){let r=yield e.l(t.request,n);try{return{vectorTile:new e.bt.VectorTile(new e.bu(r.data)),rawData:r.data,cacheControl:r.cacheControl,expires:r.expires}}catch(e){let n=new Uint8Array(r.data),i=`Unable to parse the tile at ${t.request.url}, `;throw i+=n[0]===31&&n[1]===139?`please make sure the data is not gzipped and that you have configured the relevant header in the server`:`got error: ${e.message}`,Error(i)}}))}loadTile(t){return e._(this,void 0,void 0,(function*(){let n=t.uid,i=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.bv(t.request),a=new r(t);this.loading[n]=a;let o=new AbortController;a.abort=o;try{let r=yield this.loadVectorTile(t,o);if(delete this.loading[n],!r)return null;let s=r.rawData,c={};r.expires&&(c.expires=r.expires),r.cacheControl&&(c.cacheControl=r.cacheControl);let l={};if(i){let e=i.finish();e&&(l.resourceTiming=JSON.parse(JSON.stringify(e)))}a.vectorTile=r.vectorTile;let u=a.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[n]=a,this.fetching[n]={rawTileData:s,cacheControl:c,resourceTiming:l};try{let t=yield u;return e.e({rawTileData:s.slice(0)},t,c,l)}finally{delete this.fetching[n]}}catch(e){throw delete this.loading[n],a.status=`done`,this.loaded[n]=a,e}}))}reloadTile(t){return e._(this,void 0,void 0,(function*(){let n=t.uid;if(!this.loaded||!this.loaded[n])throw Error(`Should not be trying to reload a tile that was never loaded or has been removed`);let r=this.loaded[n];if(r.showCollisionBoxes=t.showCollisionBoxes,r.status===`parsing`){let t=yield r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor),i;if(this.fetching[n]){let{rawTileData:r,cacheControl:a,resourceTiming:o}=this.fetching[n];delete this.fetching[n],i=e.e({rawTileData:r.slice(0)},t,a,o)}else i=t;return i}if(r.status===`done`&&r.vectorTile)return r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){let e=this.loading,n=t.uid;e&&e[n]&&e[n].abort&&(e[n].abort.abort(),delete e[n])}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[t.uid]&&delete this.loaded[t.uid]}))}}class o{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,(function*(){let{uid:n,encoding:r,rawImageData:i,redFactor:a,greenFactor:o,blueFactor:s,baseShift:c}=t,l=i.width+2,u=i.height+2,d=e.b(i)?new e.R({width:l,height:u},yield e.bw(i,-1,-1,l,u)):i,f=new e.bx(n,d,r,a,o,s,c);return this.loaded=this.loaded||{},this.loaded[n]=f,f}))}removeTile(e){let t=this.loaded,n=e.uid;t&&t[n]&&delete t[n]}}function s(e,t){if(e.length!==0){c(e[0],t);for(var n=1;n<e.length;n++)c(e[n],!t)}}function c(e,t){for(var n=0,r=0,i=0,a=e.length,o=a-1;i<a;o=i++){var s=(e[i][0]-e[o][0])*(e[o][1]+e[i][1]),c=n+s;r+=Math.abs(n)>=Math.abs(s)?n-c+s:s-c+n,n=c}n+r>=0!=!!t&&e.reverse()}var l=e.by((function e(t,n){var r,i=t&&t.type;if(i===`FeatureCollection`)for(r=0;r<t.features.length;r++)e(t.features[r],n);else if(i===`GeometryCollection`)for(r=0;r<t.geometries.length;r++)e(t.geometries[r],n);else if(i===`Feature`)e(t.geometry,n);else if(i===`Polygon`)s(t.coordinates,n);else if(i===`MultiPolygon`)for(r=0;r<t.coordinates.length;r++)s(t.coordinates[r],n);return t}));let u=e.bt.VectorTileFeature.prototype.toGeoJSON;var d={exports:{}},f=e.bz,p=e.bt.VectorTileFeature,m=h;function h(e,t){this.options=t||{},this.features=e,this.length=e.length}function g(e,t){this.id=typeof e.id==`number`?e.id:void 0,this.type=e.type,this.rawGeometry=e.type===1?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}h.prototype.feature=function(e){return new g(this.features[e],this.options.extent)},g.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var n=e[t],r=[],i=0;i<n.length;i++)r.push(new f(n[i][0],n[i][1]));this.geometry.push(r)}return this.geometry},g.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,n=-1/0,r=1/0,i=-1/0,a=0;a<e.length;a++)for(var o=e[a],s=0;s<o.length;s++){var c=o[s];t=Math.min(t,c.x),n=Math.max(n,c.x),r=Math.min(r,c.y),i=Math.max(i,c.y)}return[t,r,n,i]},g.prototype.toGeoJSON=p.prototype.toGeoJSON;var _=e.bA,v=m;function y(e){var t=new _;return function(e,t){for(var n in e.layers)t.writeMessage(3,b,e.layers[n])}(e,t),t.finish()}function b(e,t){var n;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||``),t.writeVarintField(5,e.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(n=0;n<e.length;n++)r.feature=e.feature(n),t.writeMessage(2,x,r);var i=r.keys;for(n=0;n<i.length;n++)t.writeStringField(3,i[n]);var a=r.values;for(n=0;n<a.length;n++)t.writeMessage(4,E,a[n])}function x(e,t){var n=e.feature;n.id!==void 0&&t.writeVarintField(1,n.id),t.writeMessage(2,S,e),t.writeVarintField(3,n.type),t.writeMessage(4,T,n)}function S(e,t){var n=e.feature,r=e.keys,i=e.values,a=e.keycache,o=e.valuecache;for(var s in n.properties){var c=n.properties[s],l=a[s];if(c!==null){l===void 0&&(r.push(s),a[s]=l=r.length-1),t.writeVarint(l);var u=typeof c;u!==`string`&&u!==`boolean`&&u!==`number`&&(c=JSON.stringify(c));var d=u+`:`+c,f=o[d];f===void 0&&(i.push(c),o[d]=f=i.length-1),t.writeVarint(f)}}}function C(e,t){return(t<<3)+(7&e)}function w(e){return e<<1^e>>31}function T(e,t){for(var n=e.loadGeometry(),r=e.type,i=0,a=0,o=n.length,s=0;s<o;s++){var c=n[s],l=1;r===1&&(l=c.length),t.writeVarint(C(1,l));for(var u=r===3?c.length-1:c.length,d=0;d<u;d++){d===1&&r!==1&&t.writeVarint(C(2,u-1));var f=c[d].x-i,p=c[d].y-a;t.writeVarint(w(f)),t.writeVarint(w(p)),i+=f,a+=p}r===3&&t.writeVarint(C(7,1))}}function E(e,t){var n=typeof e;n===`string`?t.writeStringField(1,e):n===`boolean`?t.writeBooleanField(7,e):n===`number`&&(e%1==0?e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e):t.writeDoubleField(3,e))}d.exports=y,d.exports.fromVectorTileJs=y,d.exports.fromGeojsonVt=function(e,t){t||={};var n={};for(var r in e)n[r]=new v(e[r].features,t),n[r].name=r,n[r].version=t.version,n[r].extent=t.extent;return y({layers:n})},d.exports.GeoJSONWrapper=v;var D=e.by(d.exports);let O={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},k=Math.fround||(A=new Float32Array(1),e=>(A[0]=+e,A[0]));var A;class j{constructor(e){this.options=Object.assign(Object.create(O),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:t,minZoom:n,maxZoom:r}=this.options;t&&console.time(`total time`);let i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let a=[];for(let t=0;t<e.length;t++){let n=e[t];if(!n.geometry)continue;let[r,i]=n.geometry.coordinates,o=k(te(r)),s=k(ne(i));a.push(o,s,1/0,t,-1,1),this.options.reduce&&a.push(0)}let o=this.trees[r+1]=this._createTree(a);t&&console.timeEnd(i);for(let e=r;e>=n;e--){let n=+Date.now();o=this.trees[e]=this._createTree(this._cluster(o,e)),t&&console.log(`z%d: %d clusters in %dms`,e,o.numItems,+Date.now()-n)}return t&&console.timeEnd(`total time`),this}getClusters(e,t){let n=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,i=180;else if(n>i){let e=this.getClusters([n,r,180,a],t),o=this.getClusters([-180,r,i,a],t);return e.concat(o)}let o=this.trees[this._limitZoom(t)],s=o.range(te(n),ne(a),te(i),ne(r)),c=o.data,l=[];for(let e of s){let t=this.stride*e;l.push(c[t+5]>1?ee(c,t,this.clusterProps):this.points[c[t+3]])}return l}getChildren(e){let t=this._getOriginId(e),n=this._getOriginZoom(e),r=`No cluster with the specified id.`,i=this.trees[n];if(!i)throw Error(r);let a=i.data;if(t*this.stride>=a.length)throw Error(r);let o=this.options.radius/(this.options.extent*2**(n-1)),s=i.within(a[t*this.stride],a[t*this.stride+1],o),c=[];for(let t of s){let n=t*this.stride;a[n+4]===e&&c.push(a[n+5]>1?ee(a,n,this.clusterProps):this.points[a[n+3]])}if(c.length===0)throw Error(r);return c}getLeaves(e,t,n){let r=[];return this._appendLeaves(r,e,t||=10,n||=0,0),r}getTile(e,t,n){let r=this.trees[this._limitZoom(e)],i=2**e,{extent:a,radius:o}=this.options,s=o/a,c=(n-s)/i,l=(n+1+s)/i,u={features:[]};return this._addTileFeatures(r.range((t-s)/i,c,(t+1+s)/i,l),r.data,t,n,i,u),t===0&&this._addTileFeatures(r.range(1-s/i,c,1,l),r.data,i,n,i,u),t===i-1&&this._addTileFeatures(r.range(0,c,s/i,l),r.data,-1,n,i,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){let n=this.getChildren(e);if(t++,n.length!==1)break;e=n[0].properties.cluster_id}return t}_appendLeaves(e,t,n,r,i){let a=this.getChildren(t);for(let t of a){let a=t.properties;if(a&&a.cluster?i+a.point_count<=r?i+=a.point_count:i=this._appendLeaves(e,a.cluster_id,n,r,i):i<r?i++:e.push(t),e.length===n)break}return i}_createTree(t){let n=new e.av(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)n.add(t[e],t[e+1]);return n.finish(),n.data=t,n}_addTileFeatures(e,t,n,r,i,a){for(let o of e){let e=o*this.stride,s=t[e+5]>1,c,l,u;if(s)c=M(t,e,this.clusterProps),l=t[e],u=t[e+1];else{let n=this.points[t[e+3]];c=n.properties;let[r,i]=n.geometry.coordinates;l=te(r),u=ne(i)}let d={type:1,geometry:[[Math.round(this.options.extent*(l*i-n)),Math.round(this.options.extent*(u*i-r))]],tags:c},f;f=s||this.options.generateId?t[e+3]:this.points[t[e+3]].id,f!==void 0&&(d.id=f),a.features.push(d)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){let{radius:n,extent:r,reduce:i,minPoints:a}=this.options,o=n/(r*2**t),s=e.data,c=[],l=this.stride;for(let n=0;n<s.length;n+=l){if(s[n+2]<=t)continue;s[n+2]=t;let r=s[n],u=s[n+1],d=e.within(s[n],s[n+1],o),f=s[n+5],p=f;for(let e of d){let n=e*l;s[n+2]>t&&(p+=s[n+5])}if(p>f&&p>=a){let e,a=r*f,o=u*f,m=-1,h=((n/l|0)<<5)+(t+1)+this.points.length;for(let r of d){let c=r*l;if(s[c+2]<=t)continue;s[c+2]=t;let u=s[c+5];a+=s[c]*u,o+=s[c+1]*u,s[c+4]=h,i&&(e||(e=this._map(s,n,!0),m=this.clusterProps.length,this.clusterProps.push(e)),i(e,this._map(s,c)))}s[n+4]=h,c.push(a/p,o/p,1/0,h,-1,p),i&&c.push(m)}else{for(let e=0;e<l;e++)c.push(s[n+e]);if(p>1)for(let e of d){let n=e*l;if(!(s[n+2]<=t)){s[n+2]=t;for(let e=0;e<l;e++)c.push(s[n+e])}}}}return c}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,n){if(e[t+5]>1){let r=this.clusterProps[e[t+6]];return n?Object.assign({},r):r}let r=this.points[e[t+3]].properties,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}}function ee(e,t,n){return{type:`Feature`,id:e[t+3],properties:M(e,t,n),geometry:{type:`Point`,coordinates:[(r=e[t],360*(r-.5)),re(e[t+1])]}};var r}function M(e,t,n){let r=e[t+5],i=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+`k`:r,a=e[t+6],o=a===-1?{}:Object.assign({},n[a]);return Object.assign(o,{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:i})}function te(e){return e/360+.5}function ne(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function re(e){let t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function ie(e,t,n,r){let i=r,a=t+(n-t>>1),o,s=n-t,c=e[t],l=e[t+1],u=e[n],d=e[n+1];for(let r=t+3;r<n;r+=3){let t=ae(e[r],e[r+1],c,l,u,d);if(t>i)o=r,i=t;else if(t===i){let e=Math.abs(r-a);e<s&&(o=r,s=e)}}i>r&&(o-t>3&&ie(e,t,o,r),e[o+2]=i,n-o>3&&ie(e,o,n,r))}function ae(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return o=e-n,s=t-r,o*o+s*s}function oe(e,t,n,r){let i={id:e??null,type:t,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(t===`Point`||t===`MultiPoint`||t===`LineString`)se(i,n);else if(t===`Polygon`)se(i,n[0]);else if(t===`MultiLineString`)for(let e of n)se(i,e);else if(t===`MultiPolygon`)for(let e of n)se(i,e[0]);return i}function se(e,t){for(let n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function ce(e,t,n,r){if(!t.geometry)return;let i=t.geometry.coordinates;if(i&&i.length===0)return;let a=t.geometry.type,o=(n.tolerance/((1<<n.maxZoom)*n.extent))**2,s=[],c=t.id;if(n.promoteId?c=t.properties[n.promoteId]:n.generateId&&(c=r||0),a===`Point`)le(i,s);else if(a===`MultiPoint`)for(let e of i)le(e,s);else if(a===`LineString`)ue(i,s,o,!1);else if(a===`MultiLineString`){if(n.lineMetrics){for(let n of i)s=[],ue(n,s,o,!1),e.push(oe(c,`LineString`,s,t.properties));return}de(i,s,o,!1)}else if(a===`Polygon`)de(i,s,o,!0);else{if(a!==`MultiPolygon`){if(a===`GeometryCollection`){for(let i of t.geometry.geometries)ce(e,{id:c,geometry:i,properties:t.properties},n,r);return}throw Error(`Input data is not a valid GeoJSON object.`)}for(let e of i){let t=[];de(e,t,o,!0),s.push(t)}}e.push(oe(c,a,s,t.properties))}function le(e,t){t.push(fe(e[0]),N(e[1]),0)}function ue(e,t,n,r){let i,a,o=0;for(let n=0;n<e.length;n++){let s=fe(e[n][0]),c=N(e[n][1]);t.push(s,c,0),n>0&&(o+=r?(i*c-s*a)/2:Math.sqrt((s-i)**2+(c-a)**2)),i=s,a=c}let s=t.length-3;t[2]=1,ie(t,0,s,n),t[s+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function de(e,t,n,r){for(let i=0;i<e.length;i++){let a=[];ue(e[i],a,n,r),t.push(a)}}function fe(e){return e/360+.5}function N(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function pe(e,t,n,r,i,a,o,s){if(r/=t,a>=(n/=t)&&o<r)return e;if(o<n||a>=r)return null;let c=[];for(let t of e){let e=t.geometry,a=t.type,o=i===0?t.minX:t.minY,l=i===0?t.maxX:t.maxY;if(o>=n&&l<r){c.push(t);continue}if(l<n||o>=r)continue;let u=[];if(a===`Point`||a===`MultiPoint`)me(e,u,n,r,i);else if(a===`LineString`)P(e,u,n,r,i,!1,s.lineMetrics);else if(a===`MultiLineString`)ge(e,u,n,r,i,!1);else if(a===`Polygon`)ge(e,u,n,r,i,!0);else if(a===`MultiPolygon`)for(let t of e){let e=[];ge(t,e,n,r,i,!0),e.length&&u.push(e)}if(u.length){if(s.lineMetrics&&a===`LineString`){for(let e of u)c.push(oe(t.id,a,e,t.tags));continue}a!==`LineString`&&a!==`MultiLineString`||(u.length===1?(a=`LineString`,u=u[0]):a=`MultiLineString`),a!==`Point`&&a!==`MultiPoint`||(a=u.length===3?`Point`:`MultiPoint`),c.push(oe(t.id,a,u,t.tags))}}return c.length?c:null}function me(e,t,n,r,i){for(let a=0;a<e.length;a+=3){let o=e[a+i];o>=n&&o<=r&&_e(t,e[a],e[a+1],e[a+2])}}function P(e,t,n,r,i,a,o){let s=he(e),c=i===0?ve:ye,l,u,d=e.start;for(let f=0;f<e.length-3;f+=3){let p=e[f],m=e[f+1],h=e[f+2],g=e[f+3],_=e[f+4],v=i===0?p:m,y=i===0?g:_,b=!1;o&&(l=Math.sqrt((p-g)**2+(m-_)**2)),v<n?y>n&&(u=c(s,p,m,g,_,n),o&&(s.start=d+l*u)):v>r?y<r&&(u=c(s,p,m,g,_,r),o&&(s.start=d+l*u)):_e(s,p,m,h),y<n&&v>=n&&(u=c(s,p,m,g,_,n),b=!0),y>r&&v<=r&&(u=c(s,p,m,g,_,r),b=!0),!a&&b&&(o&&(s.end=d+l*u),t.push(s),s=he(e)),o&&(d+=l)}let f=e.length-3,p=e[f],m=e[f+1],h=i===0?p:m;h>=n&&h<=r&&_e(s,p,m,e[f+2]),f=s.length-3,a&&f>=3&&(s[f]!==s[0]||s[f+1]!==s[1])&&_e(s,s[0],s[1],s[2]),s.length&&t.push(s)}function he(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ge(e,t,n,r,i,a){for(let o of e)P(o,t,n,r,i,a,!1)}function _e(e,t,n,r){e.push(t,n,r)}function ve(e,t,n,r,i,a){let o=(a-t)/(r-t);return _e(e,a,n+(i-n)*o,1),o}function ye(e,t,n,r,i,a){let o=(a-n)/(i-n);return _e(e,t+(r-t)*o,a,1),o}function be(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=i.type,o;if(a===`Point`||a===`MultiPoint`||a===`LineString`)o=xe(i.geometry,t);else if(a===`MultiLineString`||a===`Polygon`){o=[];for(let e of i.geometry)o.push(xe(e,t))}else if(a===`MultiPolygon`){o=[];for(let e of i.geometry){let n=[];for(let r of e)n.push(xe(r,t));o.push(n)}}n.push(oe(i.id,a,o,i.tags))}return n}function xe(e,t){let n=[];n.size=e.size,e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}function Se(e,t){if(e.transformed)return e;let n=1<<e.z,r=e.x,i=e.y;for(let a of e.features){let e=a.geometry,o=a.type;if(a.geometry=[],o===1)for(let o=0;o<e.length;o+=2)a.geometry.push(F(e[o],e[o+1],t,n,r,i));else for(let o=0;o<e.length;o++){let s=[];for(let a=0;a<e[o].length;a+=2)s.push(F(e[o][a],e[o][a+1],t,n,r,i));a.geometry.push(s)}}return e.transformed=!0,e}function F(e,t,n,r,i,a){return[Math.round(n*(e*r-i)),Math.round(n*(t*r-a))]}function Ce(e,t,n,r,i){let a=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:n,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let t of e)we(o,t,a,i);return o}function we(e,t,n,r){let i=t.geometry,a=t.type,o=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),a===`Point`||a===`MultiPoint`)for(let t=0;t<i.length;t+=3)o.push(i[t],i[t+1]),e.numPoints++,e.numSimplified++;else if(a===`LineString`)Te(o,i,e,n,!1,!1);else if(a===`MultiLineString`||a===`Polygon`)for(let t=0;t<i.length;t++)Te(o,i[t],e,n,a===`Polygon`,t===0);else if(a===`MultiPolygon`)for(let t=0;t<i.length;t++){let r=i[t];for(let t=0;t<r.length;t++)Te(o,r[t],e,n,!0,t===0)}if(o.length){let n=t.tags||null;if(a===`LineString`&&r.lineMetrics){n={};for(let e in t.tags)n[e]=t.tags[e];n.mapbox_clip_start=i.start/i.size,n.mapbox_clip_end=i.end/i.size}let s={geometry:o,type:a===`Polygon`||a===`MultiPolygon`?3:a===`LineString`||a===`MultiLineString`?2:1,tags:n};t.id!==null&&(s.id=t.id),e.features.push(s)}}function Te(e,t,n,r,i,a){let o=r*r;if(r>0&&t.size<(i?o:r))return void(n.numPoints+=t.length/3);let s=[];for(let e=0;e<t.length;e+=3)(r===0||t[e+2]>o)&&(n.numSimplified++,s.push(t[e],t[e+1])),n.numPoints++;i&&function(e,t){let n=0;for(let t=0,r=e.length,i=r-2;t<r;i=t,t+=2)n+=(e[t]-e[i])*(e[t+1]+e[i+1]);if(n>0===t)for(let t=0,n=e.length;t<n/2;t+=2){let r=e[t],i=e[t+1];e[t]=e[n-2-t],e[t+1]=e[n-1-t],e[n-2-t]=r,e[n-1-t]=i}}(s,a),e.push(s)}let Ee={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class I{constructor(e,t){let n=(t=this.options=function(e,t){for(let n in t)e[n]=t[n];return e}(Object.create(Ee),t)).debug;if(n&&console.time(`preprocess data`),t.maxZoom<0||t.maxZoom>24)throw Error(`maxZoom should be in the 0-24 range`);if(t.promoteId&&t.generateId)throw Error(`promoteId and generateId cannot be used together.`);let r=function(e,t){let n=[];if(e.type===`FeatureCollection`)for(let r=0;r<e.features.length;r++)ce(n,e.features[r],t,r);else ce(n,e.type===`Feature`?e:{geometry:e},t);return n}(e,t);this.tiles={},this.tileCoords=[],n&&(console.timeEnd(`preprocess data`),console.log(`index: maxZoom: %d, maxPoints: %d`,t.indexMaxZoom,t.indexMaxPoints),console.time(`generate tiles`),this.stats={},this.total=0),r=function(e,t){let n=t.buffer/t.extent,r=e,i=pe(e,1,-1-n,n,0,-1,2,t),a=pe(e,1,1-n,2+n,0,-1,2,t);return(i||a)&&(r=pe(e,1,-n,1+n,0,-1,2,t)||[],i&&(r=be(i,1).concat(r)),a&&(r=r.concat(be(a,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),n&&(r.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)))}splitTile(e,t,n,r,i,a,o){let s=[e,t,n,r],c=this.options,l=c.debug;for(;s.length;){r=s.pop(),n=s.pop(),t=s.pop(),e=s.pop();let u=1<<t,d=L(t,n,r),f=this.tiles[d];if(!f&&(l>1&&console.time(`creation`),f=this.tiles[d]=Ce(e,t,n,r,c),this.tileCoords.push({z:t,x:n,y:r}),l)){l>1&&(console.log(`tile z%d-%d-%d (features: %d, points: %d, simplified: %d)`,t,n,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd(`creation`));let e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(f.source=e,i==null){if(t===c.indexMaxZoom||f.numPoints<=c.indexMaxPoints)continue}else{if(t===c.maxZoom||t===i)continue;if(i!=null){let e=i-t;if(n!==a>>e||r!==o>>e)continue}}if(f.source=null,e.length===0)continue;l>1&&console.time(`clipping`);let p=.5*c.buffer/c.extent,m=.5-p,h=.5+p,g=1+p,_=null,v=null,y=null,b=null,x=pe(e,u,n-p,n+h,0,f.minX,f.maxX,c),S=pe(e,u,n+m,n+g,0,f.minX,f.maxX,c);e=null,x&&=(_=pe(x,u,r-p,r+h,1,f.minY,f.maxY,c),v=pe(x,u,r+m,r+g,1,f.minY,f.maxY,c),null),S&&=(y=pe(S,u,r-p,r+h,1,f.minY,f.maxY,c),b=pe(S,u,r+m,r+g,1,f.minY,f.maxY,c),null),l>1&&console.timeEnd(`clipping`),s.push(_||[],t+1,2*n,2*r),s.push(v||[],t+1,2*n,2*r+1),s.push(y||[],t+1,2*n+1,2*r),s.push(b||[],t+1,2*n+1,2*r+1)}}getTile(e,t,n){e=+e,t=+t,n=+n;let{extent:r,debug:i}=this.options;if(e<0||e>24)return null;let a=1<<e,o=L(e,t=t+a&a-1,n);if(this.tiles[o])return Se(this.tiles[o],r);i>1&&console.log(`drilling down to z%d-%d-%d`,e,t,n);let s,c=e,l=t,u=n;for(;!s&&c>0;)c--,l>>=1,u>>=1,s=this.tiles[L(c,l,u)];return s&&s.source?(i>1&&(console.log(`found parent tile z%d-%d-%d`,c,l,u),console.time(`drilling down`)),this.splitTile(s.source,c,l,u,e,t,n),i>1&&console.timeEnd(`drilling down`),this.tiles[o]?Se(this.tiles[o],r):null):null}}function L(e,t,n){return 32*((1<<e)*n+t)+e}function R(e,t){return t?e.properties[t]:e.id}function De(e,t){if(e==null)return!0;if(e.type===`Feature`)return R(e,t)!=null;if(e.type===`FeatureCollection`){let n=new Set;for(let r of e.features){let e=R(r,t);if(e==null||n.has(e))return!1;n.add(e)}return!0}return!1}function Oe(e,t){let n=new Map;if(e!=null)if(e.type===`Feature`)n.set(R(e,t),e);else for(let r of e.features)n.set(R(r,t),r);return n}class z extends a{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(t,n){return e._(this,void 0,void 0,(function*(){let n=t.tileID.canonical;if(!this._geoJSONIndex)throw Error(`Unable to parse the data into a cluster or geojson`);let r=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!r)return null;let i=new class{constructor(t){this.layers={_geojsonTileLayer:this},this.name=`_geojsonTileLayer`,this.extent=e.X,this.length=t.length,this._features=t}feature(t){return new class{constructor(t){this._feature=t,this.extent=e.X,this.type=t.type,this.properties=t.tags,`id`in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(this._feature.type===1){let t=[];for(let n of this._feature.geometry)t.push([new e.P(n[0],n[1])]);return t}{let t=[];for(let n of this._feature.geometry){let r=[];for(let t of n)r.push(new e.P(t[0],t[1]));t.push(r)}return t}}toGeoJSON(e,t,n){return u.call(this,e,t,n)}}(this._features[t])}}(r.features),a=D(i);return a.byteOffset===0&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),{vectorTile:i,rawData:a.buffer}}))}loadData(t){return e._(this,void 0,void 0,(function*(){var n;(n=this._pendingRequest)==null||n.abort();let r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.bv(t.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(t,this._pendingRequest),this._geoJSONIndex=t.cluster?new j(function({superclusterOptions:t,clusterProperties:n}){if(!n||!t)return t;let r={},i={},a={accumulated:null,zoom:0},o={properties:null},s=Object.keys(n);for(let t of s){let[a,o]=n[t],s=e.bC(o),c=e.bC(typeof a==`string`?[a,[`accumulated`],[`get`,t]]:a);r[t]=s.value,i[t]=c.value}return t.map=e=>{o.properties=e;let t={};for(let e of s)t[e]=r[e].evaluate(a,o);return t},t.reduce=(e,t)=>{o.properties=t;for(let t of s)a.accumulated=e[t],e[t]=i[t].evaluate(a,o)},t}(t)).load((yield this._pendingData).features):(i=yield this._pendingData,new I(i,t.geojsonVtOptions)),this.loaded={};let n={};if(r){let e=r.finish();e&&(n.resourceTiming={},n.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}return n}catch(t){if(delete this._pendingRequest,e.bB(t))return{abandoned:!0};throw t}var i}))}getData(){return e._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(e){let t=this.loaded;return t&&t[e.uid]?super.reloadTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,n){return e._(this,void 0,void 0,(function*(){let r=yield this.loadGeoJSON(t,n);if(delete this._pendingRequest,typeof r!=`object`)throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(l(r,!0),t.filter){let n=e.bC(t.filter,{type:`boolean`,"property-type":`data-driven`,overridable:!1,transition:!1});if(n.result===`error`)throw Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));r={type:`FeatureCollection`,features:r.features.filter((e=>n.value.evaluate({zoom:0},e)))}}return r}))}loadGeoJSON(t,n){return e._(this,void 0,void 0,(function*(){let{promoteId:r}=t;if(t.request){let i=yield e.h(t.request,n);return this._dataUpdateable=De(i.data,r)?Oe(i.data,r):void 0,i.data}if(typeof t.data==`string`)try{let e=JSON.parse(t.data);return this._dataUpdateable=De(e,r)?Oe(e,r):void 0,e}catch{throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}if(!t.dataDiff)throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw Error(`Cannot update existing geojson data in ${t.source}`);return function(e,t,n){if(t.removeAll&&e.clear(),t.remove)for(let n of t.remove)e.delete(n);if(t.add)for(let r of t.add){let t=R(r,n);t!=null&&e.set(t,r)}if(t.update)for(let n of t.update){let t=e.get(n.id);if(t==null)continue;let r=!n.removeAllProperties&&(n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0);if((n.newGeometry||n.removeAllProperties||r)&&(t=Object.assign({},t),e.set(n.id,t),r&&(t.properties=Object.assign({},t.properties))),n.newGeometry&&(t.geometry=n.newGeometry),n.removeAllProperties)t.properties={};else if(n.removeProperties?.length>0)for(let e of n.removeProperties)Object.prototype.hasOwnProperty.call(t.properties,e)&&delete t.properties[e];if(n.addOrUpdateProperties?.length>0)for(let{key:e,value:r}of n.addOrUpdateProperties)t.properties[e]=r}}(this._dataUpdateable,t.dataDiff,r),{type:`FeatureCollection`,features:Array.from(this._dataUpdateable.values())}}))}removeSource(t){return e._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset)}}class ke{constructor(t){this.self=t,this.actor=new e.F(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.bi,this.self.removeProtocol=e.bj,this.self.registerRTLTextPlugin=t=>{if(e.bD.isParsed())throw Error(`RTL text plugin already registered.`);e.bD.setMethods(t)},this.actor.registerMessageHandler(`LDT`,((e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t))),this.actor.registerMessageHandler(`RDT`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(t,n.source).removeTile(n)})))),this.actor.registerMessageHandler(`GCEZ`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterExpansionZoom(n)})))),this.actor.registerMessageHandler(`GCC`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterChildren(n)})))),this.actor.registerMessageHandler(`GCL`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterLeaves(n)})))),this.actor.registerMessageHandler(`LD`,((e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t))),this.actor.registerMessageHandler(`GD`,((e,t)=>this._getWorkerSource(e,t.type,t.source).getData())),this.actor.registerMessageHandler(`LT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t))),this.actor.registerMessageHandler(`RT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t))),this.actor.registerMessageHandler(`AT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t))),this.actor.registerMessageHandler(`RMT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t))),this.actor.registerMessageHandler(`RS`,((t,n)=>e._(this,void 0,void 0,(function*(){if(!this.workerSources[t]||!this.workerSources[t][n.type]||!this.workerSources[t][n.type][n.source])return;let e=this.workerSources[t][n.type][n.source];delete this.workerSources[t][n.type][n.source],e.removeSource!==void 0&&e.removeSource(n)})))),this.actor.registerMessageHandler(`RM`,(t=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t]})))),this.actor.registerMessageHandler(`SR`,((t,n)=>e._(this,void 0,void 0,(function*(){this.referrer=n})))),this.actor.registerMessageHandler(`SRPS`,((e,t)=>this._syncRTLPluginState(e,t))),this.actor.registerMessageHandler(`IS`,((t,n)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(n)})))),this.actor.registerMessageHandler(`SI`,((e,t)=>this._setImages(e,t))),this.actor.registerMessageHandler(`UL`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).update(n.layers,n.removedIds)})))),this.actor.registerMessageHandler(`SL`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).replace(n)}))))}_setImages(t,n){return e._(this,void 0,void 0,(function*(){this.availableImages[t]=n;for(let e in this.workerSources[t]){let r=this.workerSources[t][e];for(let e in r)r[e].availableImages=n}}))}_syncRTLPluginState(t,n){return e._(this,void 0,void 0,(function*(){if(e.bD.isParsed())return e.bD.getState();if(n.pluginStatus!==`loading`)return e.bD.setState(n),n;let t=n.pluginURL;if(this.self.importScripts(t),e.bD.isParsed()){let n={pluginStatus:`loaded`,pluginURL:t};return e.bD.setState(n),n}throw e.bD.setState({pluginStatus:`error`,pluginURL:``}),Error(`RTL Text Plugin failed to import scripts from ${t}`)}))}_getAvailableImages(e){let t=this.availableImages[e];return t||=[],t}_getLayerIndex(e){let n=this.layerIndexes[e];return n||=this.layerIndexes[e]=new t,n}_getWorkerSource(e,t,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][n]){let r={sendAsync:(t,n)=>(t.targetMapId=e,this.actor.sendAsync(t,n))};switch(t){case`vector`:this.workerSources[e][t][n]=new a(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case`geojson`:this.workerSources[e][t][n]=new z(r,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][n]=new this.externalWorkerSourceTypes[t](r,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][n]}_getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new o),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new ke(self)),ke})),n(`index`,[`exports`,`./shared`],(function(e,t){var n=`4.7.1`;let r,i,a={now:typeof performance<`u`&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:e=>new Promise(((n,r)=>{let i=requestAnimationFrame(n);e.signal.addEventListener(`abort`,(()=>{cancelAnimationFrame(i),r(t.c())}))})),getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement(`canvas`),n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)throw Error(`failed to create canvas 2d context`);return t.width=e.width,t.height=e.height,n.drawImage(e,0,0,e.width,e.height),n},resolveURL:e=>(r||=document.createElement(`a`),r.href=e,r.href),hardwareConcurrency:typeof navigator<`u`&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(i??=matchMedia(`(prefers-reduced-motion: reduce)`),i.matches)}};class o{static testProp(e){if(!o.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in o.docStyle)return e[t];return e[0]}static create(e,t,n){let r=window.document.createElement(e);return t!==void 0&&(r.className=t),n&&n.appendChild(r),r}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){o.docStyle&&o.selectProp&&(o.userSelect=o.docStyle[o.selectProp],o.docStyle[o.selectProp]=`none`)}static enableDrag(){o.docStyle&&o.selectProp&&(o.docStyle[o.selectProp]=o.userSelect)}static setTransform(e,t){e.style[o.transformProp]=t}static addEventListener(e,t,n,r={}){e.addEventListener(t,n,`passive`in r?r:r.capture)}static removeEventListener(e,t,n,r={}){e.removeEventListener(t,n,`passive`in r?r:r.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener(`click`,o.suppressClickInternal,!0)}static suppressClick(){window.addEventListener(`click`,o.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener(`click`,o.suppressClickInternal,!0)}),0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,n,r){let i=n.boundingClientRect;return new t.P((r.clientX-i.left)/n.x-e.clientLeft,(r.clientY-i.top)/n.y-e.clientTop)}static mousePos(e,t){let n=o.getScale(e);return o.getPoint(e,n,t)}static touchPos(e,t){let n=[],r=o.getScale(e);for(let i=0;i<t.length;i++)n.push(o.getPoint(e,r,t[i]));return n}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}o.docStyle=typeof window<`u`&&window.document&&window.document.documentElement.style,o.selectProp=o.testProp([`userSelect`,`MozUserSelect`,`WebkitUserSelect`,`msUserSelect`]),o.transformProp=o.testProp([`transform`,`WebkitTransform`]);let s={supported:!1,testSupport:function(e){!u&&l&&(d?f(e):c=e)}},c,l,u=!1,d=!1;function f(e){let t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,l),e.isContextLost())return;s.supported=!0}catch{}e.deleteTexture(t),u=!0}var p;typeof document<`u`&&(l=document.createElement(`img`),l.onload=()=>{c&&f(c),c=null,d=!0},l.onerror=()=>{u=!0,c=null},l.src=`data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=`),function(e){let n,r,i,a;e.resetRequestQueue=()=>{n=[],r=0,i=0,a={}},e.addThrottleControl=e=>{let t=i++;return a[t]=e,t},e.removeThrottleControl=e=>{delete a[e],c()},e.getImage=(e,r,i=!0)=>new Promise(((a,o)=>{s.supported&&(e.headers||={},e.headers.accept=`image/webp,*/*`),t.e(e,{type:`image`}),n.push({abortController:r,requestParameters:e,supportImageRefresh:i,state:`queued`,onError:e=>{o(e)},onSuccess:e=>{a(e)}}),c()}));let o=e=>t._(this,void 0,void 0,(function*(){e.state=`running`;let{requestParameters:n,supportImageRefresh:i,onError:a,onSuccess:o,abortController:s}=e,u=!1===i&&!t.i(self)&&!t.g(n.url)&&(!n.headers||Object.keys(n.headers).reduce(((e,t)=>e&&t===`accept`),!0));r++;let d=u?l(n,s):t.m(n,s);try{let n=yield d;delete e.abortController,e.state=`completed`,n.data instanceof HTMLImageElement||t.b(n.data)?o(n):n.data&&o({data:yield(f=n.data,typeof createImageBitmap==`function`?t.d(f):t.f(f)),cacheControl:n.cacheControl,expires:n.expires})}catch(t){delete e.abortController,a(t)}finally{r--,c()}var f})),c=()=>{let e=(()=>{for(let e of Object.keys(a))if(a[e]())return!0;return!1})()?t.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&n.length>0;t++){let e=n.shift();e.abortController.signal.aborted?t--:o(e)}},l=(e,n)=>new Promise(((r,i)=>{let a=new Image,o=e.url,s=e.credentials;s&&s===`include`?a.crossOrigin=`use-credentials`:(s&&s===`same-origin`||!t.s(o))&&(a.crossOrigin=`anonymous`),n.signal.addEventListener(`abort`,(()=>{a.src=``,i(t.c())})),a.fetchPriority=`high`,a.onload=()=>{a.onerror=a.onload=null,r({data:a})},a.onerror=()=>{a.onerror=a.onload=null,n.signal.aborted||i(Error(`Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))},a.src=o}))}(p||={}),p.resetRequestQueue();class m{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function h(e){var n=new t.A(3);return n[0]=e[0],n[1]=e[1],n[2]=e[2],n}var g,_=function(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e};g=new t.A(3),t.A!=Float32Array&&(g[0]=0,g[1]=0,g[2]=0);var v=function(e){var t=e[0],n=e[1];return t*t+n*n};function y(e){let t=[];if(typeof e==`string`)t.push({id:`default`,url:e});else if(e&&e.length>0){let n=[];for(let{id:r,url:i}of e){let e=`${r}${i}`;n.indexOf(e)===-1&&(n.push(e),t.push({id:r,url:i}))}}return t}function b(e,t,n){let r=e.split(`?`);return r[0]+=`${t}${n}`,r.join(`?`)}(function(){var e=new t.A(2);t.A!=Float32Array&&(e[0]=0,e[1]=0)})();class x{constructor(e,t,n,r){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(t,r)}update(e,n,r){let{width:i,height:a}=e,o=!(this.size&&this.size[0]===i&&this.size[1]===a||r),{context:s}=this,{gl:c}=s;if(this.useMipmap=!!(n&&n.useMipmap),c.bindTexture(c.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===c.RGBA&&(!n||!1!==n.premultiply)),o)this.size=[i,a],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.b(e)?c.texImage2D(c.TEXTURE_2D,0,this.format,this.format,c.UNSIGNED_BYTE,e):c.texImage2D(c.TEXTURE_2D,0,this.format,i,a,0,this.format,c.UNSIGNED_BYTE,e.data);else{let{x:n,y:o}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.b(e)?c.texSubImage2D(c.TEXTURE_2D,0,n,o,c.RGBA,c.UNSIGNED_BYTE,e):c.texSubImage2D(c.TEXTURE_2D,0,n,o,i,a,c.RGBA,c.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&c.generateMipmap(c.TEXTURE_2D)}bind(e,t,n){let{context:r}=this,{gl:i}=r;i.bindTexture(i.TEXTURE_2D,this.texture),n!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=i.LINEAR),e!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function S(e){let{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class C extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let n=this.images[e];if(n&&!n.data&&n.spriteData){let e=n.spriteData;n.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),n.spriteData=null}return n}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,n){let r=!0,i=n.data||n.spriteData;return this._validateStretch(n.stretchX,i&&i.width)||(this.fire(new t.j(Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(n.stretchY,i&&i.height)||(this.fire(new t.j(Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(n.content,n)||(this.fire(new t.j(Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let n=0;for(let r of e){if(r[0]<n||r[1]<r[0]||t<r[1])return!1;n=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let n=t.spriteData,r=n&&n.width||t.data.width,i=n&&n.height||t.data.height;return!(e[0]<0||r<e[0]||e[1]<0||i<e[1]||e[2]<0||r<e[2]||e[3]<0||i<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,n=!0){let r=this.getImage(e);if(n&&(r.data.width!==t.data.width||r.data.height!==t.data.height))throw Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=r.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){let t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((t,n)=>{let r=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})}))}_getImagesForIds(e){let n={};for(let r of e){let e=this.getImage(r);e||=(this.fire(new t.k(`styleimagemissing`,{id:r})),this.getImage(r)),e?n[r]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!!(e.userImage&&e.userImage.render)}:t.w(`Image "${r}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let n=this.patterns[e],r=this.getImage(e);if(!r)return null;if(n&&n.position.version===r.version)return n.position;if(n)n.position.version=r.version;else{let n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},i=new t.I(n,r);this.patterns[e]={bin:n,position:i}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let t=e.gl;this.atlasTexture?this.dirty&&=(this.atlasTexture.update(this.atlasImage),!1):this.atlasTexture=new x(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let t in this.patterns)e.push(this.patterns[t].bin);let{w:n,h:r}=t.p(e),i=this.atlasImage;i.resize({width:n||1,height:r||1});for(let e in this.patterns){let{bin:n}=this.patterns[e],r=n.x+1,a=n.y+1,o=this.getImage(e).data,s=o.width,c=o.height;t.R.copy(o,i,{x:0,y:0},{x:r,y:a},{width:s,height:c}),t.R.copy(o,i,{x:0,y:c-1},{x:r,y:a-1},{width:s,height:1}),t.R.copy(o,i,{x:0,y:0},{x:r,y:a+c},{width:s,height:1}),t.R.copy(o,i,{x:s-1,y:0},{x:r-1,y:a},{width:1,height:c}),t.R.copy(o,i,{x:0,y:0},{x:r+s,y:a},{width:1,height:c})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let e=this.getImage(n);e||t.w(`Image with ID: "${n}" was not found`),S(e)&&this.updateImage(n,e)}}}let w=0x56bc75e2d63100000;function T(e,t,n,r,i,a,o,s,c){for(let l=t;l<t+r;l++)E(e,n*a+l,a,i,o,s,c);for(let l=n;l<n+i;l++)E(e,l*a+t,1,r,o,s,c)}function E(e,t,n,r,i,a,o){a[0]=0,o[0]=-0x56bc75e2d63100000,o[1]=w,i[0]=e[t];for(let s=1,c=0,l=0;s<r;s++){i[s]=e[t+s*n];let r=s*s;do{let e=a[c];l=(i[s]-i[e]+r-e*e)/(s-e)/2}while(l<=o[c]&&--c>-1);c++,a[c]=s,o[c]=l,o[c+1]=w}for(let s=0,c=0;s<r;s++){for(;o[c+1]<s;)c++;let r=a[c],l=s-r;e[t+s*n]=i[r]+l*l}}class D{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,(function*(){let t=[];for(let n in e)for(let r of e[n])t.push(this._getAndCacheGlyphsPromise(n,r));let n=yield Promise.all(t),r={};for(let{stack:e,id:t,glyph:i}of n)r[e]||(r[e]={}),r[e][t]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics};return r}))}_getAndCacheGlyphsPromise(e,n){return t._(this,void 0,void 0,(function*(){let t=this.entries[e];t||=this.entries[e]={glyphs:{},requests:{},ranges:{}};let r=t.glyphs[n];if(r!==void 0)return{stack:e,id:n,glyph:r};if(r=this._tinySDF(t,e,n),r)return t.glyphs[n]=r,{stack:e,id:n,glyph:r};let i=Math.floor(n/256);if(256*i>65535)throw Error(`glyphs > 65535 not supported`);if(t.ranges[i])return{stack:e,id:n,glyph:r};if(!this.url)throw Error(`glyphsUrl is not set`);if(!t.requests[i]){let n=D.loadGlyphRange(e,i,this.url,this.requestManager);t.requests[i]=n}let a=yield t.requests[i];for(let e in a)this._doesCharSupportLocalGlyph(+e)||(t.glyphs[+e]=a[+e]);return t.ranges[i]=!0,{stack:e,id:n,glyph:a[n]||null}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))}_tinySDF(e,n,r){let i=this.localIdeographFontFamily;if(!i||!this._doesCharSupportLocalGlyph(r))return;let a=e.tinySDF;if(!a){let t=`400`;/bold/i.test(n)?t=`900`:/medium/i.test(n)?t=`500`:/light/i.test(n)&&(t=`200`),a=e.tinySDF=new D.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:i,fontWeight:t})}let o=a.draw(String.fromCharCode(r));return{id:r,bitmap:new t.o({width:o.width||60,height:o.height||60},o.data),metrics:{width:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+.5||0,top:o.glyphTop/2-27.5||-8,advance:o.glyphAdvance/2||24,isDoubleResolution:!0}}}}D.loadGlyphRange=function(e,n,r,i){return t._(this,void 0,void 0,(function*(){let a=256*n,o=a+255,s=i.transformRequest(r.replace(`{fontstack}`,e).replace(`{range}`,`${a}-${o}`),`Glyphs`),c=yield t.l(s,new AbortController);if(!c||!c.data)throw Error(`Could not load glyph range. range: ${n}, ${a}-${o}`);let l={};for(let e of t.n(c.data))l[e.id]=e;return l}))},D.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:r=.25,fontFamily:i=`sans-serif`,fontWeight:a=`normal`,fontStyle:o=`normal`}={}){this.buffer=t,this.cutoff=r,this.radius=n;let s=this.size=e+4*t,c=this._createCanvas(s),l=this.ctx=c.getContext(`2d`,{willReadFrequently:!0});l.font=`${o} ${a} ${e}px ${i}`,l.textBaseline=`alphabetic`,l.textAlign=`left`,l.fillStyle=`black`,this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(e){let t=document.createElement(`canvas`);return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-i))),c=Math.min(this.size-this.buffer,o+Math.ceil(r)),l=s+2*this.buffer,u=c+2*this.buffer,d=Math.max(l*u,0),f=new Uint8ClampedArray(d),p={data:f,width:l,height:u,glyphWidth:s,glyphHeight:c,glyphTop:o,glyphLeft:0,glyphAdvance:t};if(s===0||c===0)return p;let{ctx:m,buffer:h,gridInner:g,gridOuter:_}=this;m.clearRect(h,h,s,c),m.fillText(e,h,h+o);let v=m.getImageData(h,h,s,c);_.fill(w,0,d),g.fill(0,0,d);for(let e=0;e<c;e++)for(let t=0;t<s;t++){let n=v.data[4*(e*s+t)+3]/255;if(n===0)continue;let r=(e+h)*l+t+h;if(n===1)_[r]=0,g[r]=w;else{let e=.5-n;_[r]=e>0?e*e:0,g[r]=e<0?e*e:0}}T(_,0,0,l,u,l,this.f,this.v,this.z),T(g,h,h,s,c,l,this.f,this.v,this.z);for(let e=0;e<d;e++){let t=Math.sqrt(_[e])-Math.sqrt(g[e]);f[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return p}};class O{constructor(){this.specification=t.v.light.position}possiblyEvaluate(e,n){return t.x(e.expression.evaluate(n))}interpolate(e,n,r){return{x:t.y.number(e.x,n.x,r),y:t.y.number(e.y,n.y,r),z:t.y.number(e.z,n.z,r)}}}let k;class A extends t.E{constructor(e){super(),k||=new t.q({anchor:new t.D(t.v.light.anchor),position:new O,color:new t.D(t.v.light.color),intensity:new t.D(t.v.light.intensity)}),this._transitionable=new t.T(k),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(t.r,e,n))for(let t in e){let n=e[t];t.endsWith(`-transition`)?this._transitionable.setTransition(t.slice(0,-11),n):this._transitionable.setValue(t,n)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,r){return(!r||!1!==r.validate)&&t.t(this,e.call(t.u,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.v}))}}let j=new t.q({"sky-color":new t.D(t.v.sky[`sky-color`]),"horizon-color":new t.D(t.v.sky[`horizon-color`]),"fog-color":new t.D(t.v.sky[`fog-color`]),"fog-ground-blend":new t.D(t.v.sky[`fog-ground-blend`]),"horizon-fog-blend":new t.D(t.v.sky[`horizon-fog-blend`]),"sky-horizon-blend":new t.D(t.v.sky[`sky-horizon-blend`]),"atmosphere-blend":new t.D(t.v.sky[`atmosphere-blend`])});class ee extends t.E{constructor(e){super(),this._transitionable=new t.T(j),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.z(0))}setSky(e,n={}){if(!this._validate(t.B,e,n)){e||={"sky-color":`transparent`,"horizon-color":`transparent`,"fog-color":`transparent`,"fog-ground-blend":1,"atmosphere-blend":0};for(let t in e){let n=e[t];t.endsWith(`-transition`)?this._transitionable.setTransition(t.slice(0,-11),n):this._transitionable.setValue(t,n)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,r={}){return!1!==r?.validate&&t.t(this,e.call(t.u,t.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class M{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let n=e.join(`,`)+String(t);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(e,t)),this.dashEntry[n]}getDashRanges(e,t,n){let r=[],i=e.length%2==1?-e[e.length-1]*n:0,a=e[0]*n,o=!0;r.push({left:i,right:a,isDash:o,zeroLength:e[0]===0});let s=e[0];for(let t=1;t<e.length;t++){o=!o;let c=e[t];i=s*n,s+=c,a=s*n,r.push({left:i,right:a,isDash:o,zeroLength:c===0})}return r}addRoundDash(e,t,n){let r=t/2;for(let t=-n;t<=n;t++){let i=this.width*(this.nextRow+n+t),a=0,o=e[a];for(let s=0;s<this.width;s++){s/o.right>1&&(o=e[++a]);let c=Math.abs(s-o.left),l=Math.abs(s-o.right),u=Math.min(c,l),d,f=t/n*(r+1);if(o.isDash){let e=r-Math.abs(f);d=Math.sqrt(u*u+e*e)}else d=r-Math.sqrt(u*u+f*f);this.data[i+s]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=e[t+1];n.zeroLength?e.splice(t,1):r&&r.isDash===n.isDash&&(r.left=n.left,e.splice(t,1))}let t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);let r=this.width*this.nextRow,i=0,a=e[i];for(let t=0;t<this.width;t++){t/a.right>1&&(a=e[++i]);let n=Math.abs(t-a.left),o=Math.abs(t-a.right),s=Math.min(n,o);this.data[r+t]=Math.max(0,Math.min(255,(a.isDash?s:-s)+128))}}addDash(e,n){let r=n?7:0,i=2*r+1;if(this.nextRow+i>this.height)return t.w(`LineAtlas out of space`),null;let a=0;for(let t=0;t<e.length;t++)a+=e[t];if(a!==0){let t=this.width/a,i=this.getDashRanges(e,this.width,t);n?this.addRoundDash(i,t,r):this.addRegularDash(i)}let o={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:a};return this.nextRow+=i,this.dirty=!0,o}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}}let te=`maplibre_preloaded_worker_pool`;class ne{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<ne.workerCount;)this.workers.push(new Worker(t.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach((e=>{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[te]}numActive(){return Object.keys(this.active).length}}let re=Math.floor(a.hardwareConcurrency/2),ie,ae;function oe(){return ie||=new ne,ie}ne.workerCount=t.C(globalThis)?Math.max(Math.min(re,3),1):1;class se{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;let r=this.workerPool.acquire(n);for(let e=0;e<r.length;e++){let i=new t.F(r[e],n);i.name=`Worker ${e}`,this.actors.push(i)}if(!this.actors.length)throw Error(`No actors found`)}broadcast(e,t){let n=[];for(let r of this.actors)n.push(r.sendAsync({type:e,data:t}));return Promise.all(n)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach((e=>{e.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let n of this.actors)n.registerMessageHandler(e,t)}}function ce(){return ae||(ae=new se(oe(),t.G),ae.registerMessageHandler(`GR`,((e,n,r)=>t.m(n,r)))),ae}function le(e,n){let r=t.H();return t.J(r,r,[1,1,0]),t.K(r,r,[.5*e.width,.5*e.height,1]),t.L(r,r,e.calculatePosMatrix(n.toUnwrapped()))}function ue(e,t,n,r,i,a){let o=function(e,t,n){if(e)for(let r of e){let e=t[r];if(e&&e.source===n&&e.type===`fill-extrusion`)return!0}else for(let e in t){let r=t[e];if(r.source===n&&r.type===`fill-extrusion`)return!0}return!1}(i&&i.layers,t,e.id),s=a.maxPitchScaleFactor(),c=e.tilesIn(r,s,o);c.sort(de);let l=[];for(let r of c)l.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,n,e._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,i,a,s,le(e.transform,r.tileID))});let u=function(e){let t={},n={};for(let r of e){let e=r.queryResults,i=r.wrappedTileID,a=n[i]=n[i]||{};for(let n in e){let r=e[n],i=a[n]=a[n]||{},o=t[n]=t[n]||[];for(let e of r)i[e.featureIndex]||(i[e.featureIndex]=!0,o.push(e))}}return t}(l);for(let t in u)u[t].forEach((t=>{let n=t.feature,r=e.getFeatureState(n.layer[`source-layer`],n.id);n.source=n.layer.source,n.layer[`source-layer`]&&(n.sourceLayer=n.layer[`source-layer`]),n.state=r}));return u}function de(e,t){let n=e.tileID,r=t.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.canonical.x}function fe(e,n,r){return t._(this,void 0,void 0,(function*(){let i=e;if(e.url?i=(yield t.h(n.transformRequest(e.url,`Source`),r)).data:yield a.frameAsync(r),!i)return null;let o=t.M(t.e(i,e),[`tiles`,`minzoom`,`maxzoom`,`attribution`,`bounds`,`scheme`,`tileSize`,`encoding`]);return`vector_layers`in i&&i.vector_layers&&(o.vectorLayerIds=i.vector_layers.map((e=>e.id))),o}))}class N{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.N?new t.N(e.lng,e.lat):t.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.N?new t.N(e.lng,e.lat):t.N.convert(e),this}extend(e){let n=this._sw,r=this._ne,i,a;if(e instanceof t.N)i=e,a=e;else{if(!(e instanceof N))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(N.convert(e)):this.extend(t.N.convert(e)):e&&(`lng`in e||`lon`in e)&&`lat`in e?this.extend(t.N.convert(e)):this;if(i=e._sw,a=e._ne,!i||!a)return this}return n||r?(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)):(this._sw=new t.N(i.lng,i.lat),this._ne=new t.N(a.lng,a.lat)),this}getCenter(){return new t.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new t.N(this.getWest(),this.getNorth())}getSouthEast(){return new t.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:n,lat:r}=t.N.convert(e),i=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&i}static convert(e){return e instanceof N?e:e&&new N(e)}static fromLngLat(e,n=0){let r=360*n/40075017,i=r/Math.cos(Math.PI/180*e.lat);return new N(new t.N(e.lng-i,e.lat-r),new t.N(e.lng+i,e.lat+r))}adjustAntiMeridian(){let e=new t.N(this._sw.lng,this._sw.lat),n=new t.N(this._ne.lng,this._ne.lat);return new N(e,e.lng>n.lng?new t.N(n.lng+360,n.lat):n)}}class pe{constructor(e,t,n){this.bounds=N.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=n||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=2**e.z,r=Math.floor(t.O(this.bounds.getWest())*n),i=Math.floor(t.Q(this.bounds.getNorth())*n),a=Math.ceil(t.O(this.bounds.getEast())*n),o=Math.ceil(t.Q(this.bounds.getSouth())*n);return e.x>=r&&e.x<a&&e.y>=i&&e.y<o}}class me extends t.E{constructor(e,n,r,i){if(super(),this.id=e,this.dispatcher=r,this.type=`vector`,this.minzoom=0,this.maxzoom=22,this.scheme=`xyz`,this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.M(n,[`url`,`scheme`,`tileSize`,`promoteId`])),this._options=t.e({type:`vector`},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw Error(`vector tile sources must have a tileSize of 512`);this.setEventedParent(i)}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.k(`dataloading`,{dataType:`source`})),this._tileJSONRequest=new AbortController;try{let e=yield fe(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(t.e(this,e),e.bounds&&(this.tileBounds=new pe(e.bounds,this.minzoom,this.maxzoom)),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`content`})))}catch(e){this._tileJSONRequest=null,this.fire(new t.j(e))}}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:this.map._requestManager.transformRequest(t,`Tile`),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};n.request.collectResourceTiming=this._collectResourceTiming;let r=`RT`;if(e.actor&&e.state!==`expired`){if(e.state===`loading`)return new Promise(((t,n)=>{e.reloadPromise={resolve:t,reject:n}}))}else e.actor=this.dispatcher.getActor(),r=`LT`;e.abortController=new AbortController;try{let t=yield e.actor.sendAsync({type:r,data:n},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t)}catch(t){if(delete e.abortController,e.aborted)return;if(t&&t.status!==404)throw t;this._afterTileLoadWorkerResponse(e,null)}}))}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:`AT`,data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:`RMT`,data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class P extends t.E{constructor(e,n,r,i){super(),this.id=e,this.dispatcher=r,this.setEventedParent(i),this.type=`raster`,this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=`xyz`,this.tileSize=512,this._loaded=!1,this._options=t.e({type:`raster`},n),t.e(this,t.M(n,[`url`,`scheme`,`tileSize`]))}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.k(`dataloading`,{dataType:`source`})),this._tileJSONRequest=new AbortController;try{let e=yield fe(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(t.e(this,e),e.bounds&&(this.tileBounds=new pe(e.bounds,this.minzoom,this.maxzoom)),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`content`})))}catch(e){this._tileJSONRequest=null,this.fire(new t.j(e))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(e){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let n=yield p.getImage(this.map._requestManager.transformRequest(t,`Tile`),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state=`unloaded`);if(n&&n.data){this.map._refreshExpiredTiles&&n.cacheControl&&n.expires&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let t=this.map.painter.context,r=t.gl,i=n.data;e.texture=this.map.painter.getTileTexture(i.width),e.texture?e.texture.update(i,{useMipmap:!0}):(e.texture=new x(t,i,r.RGBA,{useMipmap:!0}),e.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class he extends P{constructor(e,n,r,i){super(e,n,r,i),this.type=`raster-dem`,this.maxzoom=22,this._options=t.e({type:`raster-dem`},n),this.encoding=n.encoding||`mapbox`,this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return t._(this,void 0,void 0,(function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this.map._requestManager.transformRequest(n,`Tile`);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let n=yield p.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state=`unloaded`);if(n&&n.data){let r=n.data;this.map._refreshExpiredTiles&&n.cacheControl&&n.expires&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let i=t.b(r)&&t.U()?r:yield this.readImageNow(r),a={type:this.type,uid:e.uid,source:this.id,rawImageData:i,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};(!e.actor||e.state===`expired`)&&(e.actor=this.dispatcher.getActor(),e.dem=yield e.actor.sendAsync({type:`LDT`,data:a}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state=`loaded`)}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}))}readImageNow(e){return t._(this,void 0,void 0,(function*(){if(typeof VideoFrame<`u`&&t.V()){let n=e.width+2,r=e.height+2;try{return new t.R({width:n,height:r},yield t.W(e,-1,-1,n,r))}catch{}}return a.getImageData(e,1)}))}_getNeighboringTiles(e){let n=e.canonical,r=2**n.z,i=(n.x-1+r)%r,a=n.x===0?e.wrap-1:e.wrap,o=(n.x+1+r)%r,s=n.x+1===r?e.wrap+1:e.wrap,c={};return c[new t.S(e.overscaledZ,a,n.z,i,n.y).key]={backfilled:!1},c[new t.S(e.overscaledZ,s,n.z,o,n.y).key]={backfilled:!1},n.y>0&&(c[new t.S(e.overscaledZ,a,n.z,i,n.y-1).key]={backfilled:!1},c[new t.S(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},c[new t.S(e.overscaledZ,s,n.z,o,n.y-1).key]={backfilled:!1}),n.y+1<r&&(c[new t.S(e.overscaledZ,a,n.z,i,n.y+1).key]={backfilled:!1},c[new t.S(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},c[new t.S(e.overscaledZ,s,n.z,o,n.y+1).key]={backfilled:!1}),c}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state=`unloaded`,e.actor&&(yield e.actor.sendAsync({type:`RDT`,data:{type:this.type,uid:e.uid,source:this.id}}))}))}}class ge extends t.E{constructor(e,n,r,i){super(),this.id=e,this.type=`geojson`,this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=r.getActor(),this.setEventedParent(i),this._data=n.data,this._options=t.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;let a=t.X/this.tileSize;n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer===void 0?128:n.buffer)*a,tolerance:(n.tolerance===void 0?.375:n.tolerance)*a,extent:t.X,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom===void 0?this.maxzoom-1:n.clusterMaxZoom,minPoints:Math.max(2,n.clusterMinPoints||2),extent:t.X,radius:(n.clusterRadius||50)*a,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId==`string`&&(this.workerOptions.promoteId=this.promoteId)}load(){return t._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return t._(this,void 0,void 0,(function*(){let e=t.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:`GD`,data:e})}))}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:`GCEZ`,data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:`GCC`,data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,n){return this.actor.sendAsync({type:`GCL`,data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:n}})}_updateWorkerData(e){return t._(this,void 0,void 0,(function*(){let n=t.e({type:this.type},this.workerOptions);e?n.dataDiff=e:typeof this._data==`string`?(n.request=this.map._requestManager.transformRequest(a.resolveURL(this._data),`Source`),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.k(`dataloading`,{dataType:`source`}));try{let e=yield this.actor.sendAsync({type:`LD`,data:n});if(this._pendingLoads--,this._removed||e.abandoned)return void this.fire(new t.k(`dataabort`,{dataType:`source`}));let r=null;e.resourceTiming&&e.resourceTiming[this.id]&&(r=e.resourceTiming[this.id].slice(0));let i={dataType:`source`};this._collectResourceTiming&&r&&r.length>0&&t.e(i,{resourceTiming:r}),this.fire(new t.k(`data`,Object.assign(Object.assign({},i),{sourceDataType:`metadata`}))),this.fire(new t.k(`data`,Object.assign(Object.assign({},i),{sourceDataType:`content`})))}catch(e){if(this._pendingLoads--,this._removed)return void this.fire(new t.k(`dataabort`,{dataType:`source`}));this.fire(new t.j(e))}}))}loaded(){return this._pendingLoads===0}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.actor?`RT`:`LT`;e.actor=this.actor;let n={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;let r=yield this.actor.sendAsync({type:t,data:n},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t===`RT`)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:`RMT`,data:{uid:e.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:`RS`,data:{type:this.type,source:this.id}})}serialize(){return t.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var _e=t.Y([{name:`a_pos`,type:`Int16`,components:2},{name:`a_texture_pos`,type:`Int16`,components:2}]);class ve extends t.E{constructor(e,t,n,r){super(),this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type=`image`,this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}load(e){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.k(`dataloading`,{dataType:`source`})),this.url=this.options.url,this._request=new AbortController;try{let t=yield p.getImage(this.map._requestManager.transformRequest(this.url,`Image`),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,this.fire(new t.j(e))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&=(this._request.abort(),null),this.options.url=e.url,this.load(e.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`metadata`})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&=(this._request.abort(),null)}setCoordinates(e){this.coordinates=e;let n=e.map(t.Z.fromLngLat);this.tileID=function(e){let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let t of e)n=Math.min(n,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x),a=Math.max(a,t.y);let o=Math.max(i-n,a-r),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),c=2**s;return new t.a1(s,Math.floor((n+i)/2*c),Math.floor((r+a)/2*c))}(n),this.minzoom=this.maxzoom=this.tileID.z;let r=n.map((e=>this.tileID.getTilePoint(e)._round()));return this._boundsArray=new t.$,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,t.X,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,t.X),this._boundsArray.emplaceBack(r[2].x,r[2].y,t.X,t.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`content`})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||=e.createVertexBuffer(this._boundsArray,_e.members),this.boundsSegments||=t.a0.simpleSegment(0,0,4,2),this.texture||(this.texture=new x(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`idle`,sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state=`errored`}))}serialize(){return{type:`image`,url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class ye extends ve{constructor(e,t,n,r){super(e,t,n,r),this.roundZoom=!0,this.type=`video`,this.options=t}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,`Source`).url);try{let e=yield t.a3(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener(`playing`,(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new t.j(e))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new t.j(new t.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||=e.createVertexBuffer(this._boundsArray,_e.members),this.boundsSegments||=t.a0.simpleSegment(0,0,4,2),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new x(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`idle`,sourceId:this.id}))}serialize(){return{type:`video`,urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class be extends ve{constructor(e,n,r,i){super(e,n,r,i),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((e=>!Array.isArray(e)||e.length!==2||e.some((e=>typeof e!=`number`))))||this.fire(new t.j(new t.a2(`sources.${e}`,null,`"coordinates" property must be an array of 4 longitude/latitude array pairs`))):this.fire(new t.j(new t.a2(`sources.${e}`,null,`missing required property "coordinates"`))),n.animate&&typeof n.animate!=`boolean`&&this.fire(new t.j(new t.a2(`sources.${e}`,null,`optional "animate" property must be a boolean value`))),n.canvas?typeof n.canvas==`string`||n.canvas instanceof HTMLCanvasElement||this.fire(new t.j(new t.a2(`sources.${e}`,null,`"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance`))):this.fire(new t.j(new t.a2(`sources.${e}`,null,`missing required property "canvas"`))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.j(Error(`Canvas dimensions cannot be less than or equal to zero.`))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&=(this.prepare(),!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,r=n.gl;this.boundsBuffer||=n.createVertexBuffer(this._boundsArray,_e.members),this.boundsSegments||=t.a0.simpleSegment(0,0,4,2),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new x(n,this.canvas,r.RGBA,{premultiply:!0});let i=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,i=!0)}i&&this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`idle`,sourceId:this.id}))}serialize(){return{type:`canvas`,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let xe={},Se=e=>{switch(e){case`geojson`:return ge;case`image`:return ve;case`raster`:return P;case`raster-dem`:return he;case`vector`:return me;case`video`:return ye;case`canvas`:return be}return xe[e]},F=`RTLPluginLoaded`;class Ce extends t.E{constructor(){super(...arguments),this.status=`unavailable`,this.url=null,this.dispatcher=ce()}_syncState(e){return this.status=e,this.dispatcher.broadcast(`SRPS`,{pluginStatus:e,pluginURL:this.url}).catch((e=>{throw this.status=`error`,e}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status=`unavailable`,this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,(function*(e,t=!1){if(this.url)throw Error(`setRTLTextPlugin cannot be called multiple times.`);if(this.url=a.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status===`unavailable`){if(!t)return this._requestImport();this.status=`deferred`,this._syncState(this.status)}else if(this.status===`requested`)return this._requestImport()}))}_requestImport(){return t._(this,void 0,void 0,(function*(){yield this._syncState(`loading`),this.status=`loaded`,this.fire(new t.k(F))}))}lazyLoad(){this.status===`unavailable`?this.status=`requested`:this.status===`deferred`&&this._requestImport()}}let we=null;function Te(){return we||=new Ce,we}class Ee{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.a4(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state=`loading`}registerFadeDuration(e){let t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return this.state===`errored`||this.state===`loaded`||this.state===`reloading`}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,n,r){if(this.hasData()&&this.unloadVectorData(),this.state=`loaded`,e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){let n={};if(!t)return n;for(let r of e){let e=r.layerIds.map((e=>t.getLayer(e))).filter(Boolean);if(e.length!==0){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(let t of e)n[t.id]=r}}return n}(e.buckets,n.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let n=this.buckets[e];if(n instanceof t.a6){if(this.hasSymbolBuckets=!0,!r)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let n=this.buckets[e];if(n instanceof t.a6&&n.hasRTLText){this.hasRTLText=!0,Te().lazyLoad();break}}this.queryPadding=0;for(let e in this.buckets){let t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.a5}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&=null,this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state=`unloaded`}getBucket(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let n=this.buckets[t];n.uploadPending()&&n.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new x(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new x(e,this.glyphAtlasImage,t.ALPHA),null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,r,i,a,o,s,c,l){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:i,scale:a,tileSize:this.tileSize,pixelPosMatrix:l,transform:s,params:o,queryPadding:this.queryPadding*c},e,t,n):{}}querySourceFeatures(e,n){let r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;let i=r.loadVTLayers(),a=n&&n.sourceLayer?n.sourceLayer:``,o=i._geojsonTileLayer||i[a];if(!o)return;let s=t.a7(n&&n.filter),{z:c,x:l,y:u}=this.tileID.canonical,d={z:c,x:l,y:u};for(let n=0;n<o.length;n++){let i=o.feature(n);if(s.needGeometry){let e=t.a8(i,!0);if(!s.filter(new t.z(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.z(this.tileID.overscaledZ),i))continue;let f=r.getId(i,a),p=new t.a9(i,c,l,u,f);p.tile=d,e.push(p)}}hasData(){return this.state===`loaded`||this.state===`reloading`||this.state===`expired`}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let n=this.expirationTime;if(e.cacheControl){let n=t.aa(e.cacheControl);n[`max-age`]&&(this.expirationTime=Date.now()+1e3*n[`max-age`])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),t=!1;if(this.expirationTime>e)t=!1;else if(n)if(this.expirationTime<n)t=!0;else{let r=this.expirationTime-n;r?this.expirationTime=e+Math.max(r,3e4):t=!0}else t=!0;t?(this.expiredRequestCount++,this.state=`expired`):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),2**31-1)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let n=this.latestFeatureIndex.loadVTLayers();for(let r in this.buckets){if(!t.style.hasLayer(r))continue;let i=this.buckets[r],a=i.layers[0].sourceLayer||`_geojsonTileLayer`,o=n[a],s=e[a];if(!o||!s||Object.keys(s).length===0)continue;i.update(s,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});let c=t&&t.style&&t.style.getLayer(r);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(i)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=a.now()+e}setDependencies(e,t){let n={};for(let e of t)n[e]=!0;this.dependencies[e]=n}hasDependency(e,t){for(let n of e){let e=this.dependencies[n];if(e){for(let n of t)if(e[n])return!0}}return!1}}class I{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,n){let r=e.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let i={value:t,timeout:void 0};if(n!==void 0&&(i.timeout=setTimeout((()=>{this.remove(e,i)}),n)),this.data[r].push(i),this.order.push(r),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let n=e.wrapped().key,r=t===void 0?0:this.data[n].indexOf(t),i=this.data[n][r];return this.data[n].splice(r,1),i.timeout&&clearTimeout(i.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let t=[];for(let n in this.data)for(let r of this.data[n])e(r.value)||t.push(r);for(let e of t)this.remove(e.value.tileID,e)}}class L{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,r){let i=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][i]=this.stateChanges[e][i]||{},t.e(this.stateChanges[e][i],r),this.deletedStates[e]===null){this.deletedStates[e]={};for(let t in this.state[e])t!==i&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][i]===null){this.deletedStates[e][i]={};for(let t in this.state[e][i])r[t]||(this.deletedStates[e][i][t]=null)}else for(let t in r)this.deletedStates[e]&&this.deletedStates[e][i]&&this.deletedStates[e][i][t]===null&&delete this.deletedStates[e][i][t]}removeFeatureState(e,t,n){if(this.deletedStates[e]===null)return;let r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&t!==void 0)this.deletedStates[e][r]!==null&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][n]=null);else if(t!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][r])for(n in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][n]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,n){let r=String(n),i=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let t=this.deletedStates[e][n];if(t===null)return{};for(let e in t)delete i[e]}return i}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,n){let r={};for(let e in this.stateChanges){this.state[e]=this.state[e]||{};let n={};for(let r in this.stateChanges[e])this.state[e][r]||(this.state[e][r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),n[r]=this.state[e][r];r[e]=n}for(let e in this.deletedStates){this.state[e]=this.state[e]||{};let n={};if(this.deletedStates[e]===null)for(let t in this.state[e])n[t]={},this.state[e][t]={};else for(let t in this.deletedStates[e]){if(this.deletedStates[e][t]===null)this.state[e][t]={};else for(let n of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][n];n[t]=this.state[e][t]}r[e]=r[e]||{},t.e(r[e],n)}if(this.stateChanges={},this.deletedStates={},Object.keys(r).length!==0)for(let t in e)e[t].setFeatureState(r,n)}}class R extends t.E{constructor(e,t,n){super(),this.id=e,this.dispatcher=n,this.on(`data`,(e=>this._dataHandler(e))),this.on(`dataloading`,(()=>{this._sourceErrored=!1})),this.on(`error`,(()=>{this._sourceErrored=this._source.loaded()})),this._source=((e,t,n,r)=>{let i=new(Se(t.type))(e,t,n,r);if(i.id!==e)throw Error(`Expected Source id to be ${e} instead of ${i.id}`);return i})(e,t,n,this),this._tiles={},this._cache=new I(0,(e=>this._unloadTile(e))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new L,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let e in this._tiles){let t=this._tiles[e];if(t.state!==`loaded`&&t.state!==`errored`)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,r){return t._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,n,r)}catch(n){e.state=`errored`,n.status===404?this.update(this.transform,this.terrain):this._source.fire(new t.j(n,{tile:e}))}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.k(`dataabort`,{tile:e,coord:e.tileID,dataType:`source`}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let t in this._tiles){let n=this._tiles[t];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(De).map((e=>e.key))}getRenderableIds(e){let n=[];for(let t in this._tiles)this._isIdRenderable(t,e)&&n.push(this._tiles[t]);return e?n.sort(((e,n)=>{let r=e.tileID,i=n.tileID,a=new t.P(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),o=new t.P(i.canonical.x,i.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-i.overscaledZ||o.y-a.y||o.x-a.x})).map((e=>e.tileID.key)):n.map((e=>e.tileID)).sort(De).map((e=>e.key))}hasRenderableParent(e){let t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)this._tiles[e].state!==`errored`&&this._reloadTile(e,`reloading`)}}_reloadTile(e,n){return t._(this,void 0,void 0,(function*(){let t=this._tiles[e];t&&(t.state!==`loading`&&(t.state=n),yield this._loadTile(t,e,n))}))}_tileLoaded(e,n,r){e.timeAdded=a.now(),r===`expired`&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),this.getSource().type===`raster-dem`&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.k(`data`,{dataType:`source`,tile:e,coord:e.tileID}))}_backfillDEM(e){let t=this.getRenderableIds();for(let r=0;r<t.length;r++){let i=t[r];if(e.neighboringTiles&&e.neighboringTiles[i]){let t=this.getTileByID(i);n(e,t),n(t,e)}}function n(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let n=t.tileID.canonical.x-e.tileID.canonical.x,r=t.tileID.canonical.y-e.tileID.canonical.y,i=2**e.tileID.canonical.z,a=t.tileID.key;n===0&&r===0||Math.abs(r)>1||(Math.abs(n)>1&&(Math.abs(n+i)===1?n+=i:Math.abs(n-i)===1&&(n-=i)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,r),e.neighboringTiles&&e.neighboringTiles[a]&&(e.neighboringTiles[a].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,n,r){for(let i in this._tiles){let a=this._tiles[i];if(r[i]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>n)continue;let o=a.tileID;for(;a&&a.tileID.overscaledZ>t+1;){let e=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[e.key],a&&a.hasData()&&(o=e)}let s=o;for(;s.overscaledZ>t;)if(s=s.scaledTo(s.overscaledZ-1),e[s.key]){r[o.key]=o;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){let n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=t?n:null}for(let n=e.overscaledZ-1;n>=t;n--){let t=e.scaledTo(n),r=this._getLoadedTile(t);if(r)return r}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,i=Math.floor(n*r*(this._maxTileCacheZoomLevels===null?t.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),a=typeof this._maxTileCacheSize==`number`?Math.min(this._maxTileCacheSize,i):i;this._cache.setMaxSize(a)}handleWrapJump(e){let t=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,t){let e={};for(let n in this._tiles){let r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e;for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}}_updateCoveredAndRetainedTiles(e,t,n,r,i,o){let s={},c={},l=Object.keys(e),u=a.now();for(let n of l){let r=e[n],i=this._tiles[n];if(!i||i.fadeEndTime!==0&&i.fadeEndTime<=u)continue;let a=this.findLoadedParent(r,t),o=this.findLoadedSibling(r),l=a||o||null;l&&(this._addTile(l.tileID),s[l.tileID.key]=l.tileID),c[n]=r}this._retainLoadedChildren(c,r,n,e);for(let t in s)e[t]||(this._coveredTiles[t]=!0,e[t]=s[t]);if(o){let t={},n={};for(let e of i)this._tiles[e.key].hasData()?t[e.key]=e:n[e.key]=e;for(let r in n){let i=n[r].children(this._source.maxzoom);this._tiles[i[0].key]&&this._tiles[i[1].key]&&this._tiles[i[2].key]&&this._tiles[i[3].key]&&(t[i[0].key]=e[i[0].key]=i[0],t[i[1].key]=e[i[1].key]=i[1],t[i[2].key]=e[i[2].key]=i[2],t[i[3].key]=e[i[3].key]=i[3],delete n[r])}for(let r in n){let i=n[r],a=this.findLoadedParent(i,this._source.minzoom),o=this.findLoadedSibling(i),s=a||o||null;if(s){t[s.tileID.key]=e[s.tileID.key]=s.tileID;for(let e in t)t[e].isChildOf(s.tileID)&&delete t[e]}}for(let e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}update(e,n){if(!this._sourceLoaded||this._paused)return;let r;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.S(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(r=r.filter((e=>this._source.hasTile(e))))):r=[];let i=e.coveringZoomLevel(this._source),a=Math.max(i-R.maxOverzooming,this._source.minzoom),o=Math.max(i+R.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let e={};for(let t of r)if(t.canonical.z>this._source.minzoom){let n=t.scaledTo(t.canonical.z-1);e[n.key]=n;let r=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[r.key]=r}r=r.concat(Object.values(e))}let s=r.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new t.k(`data`,{sourceDataType:`idle`,dataType:`source`,sourceId:this.id}));let c=this._updateRetainedTiles(r,i);Oe(this._source.type)&&this._updateCoveredAndRetainedTiles(c,a,o,i,r,n);for(let e in c)this._tiles[e].clearFadeHold();let l=t.ab(this._tiles,c);for(let e of l){let t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(e)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){let n={},r={},i=Math.max(t-R.maxOverzooming,this._source.minzoom),a=Math.max(t+R.maxUnderzooming,this._source.minzoom),o={};for(let r of e){let e=this._addTile(r);n[r.key]=r,e.hasData()||t<this._source.maxzoom&&(o[r.key]=r)}this._retainLoadedChildren(o,t,a,n);for(let a of e){let e=this._tiles[a.key];if(e.hasData())continue;if(t+1>this._source.maxzoom){let e=a.children(this._source.maxzoom)[0],t=this.getTile(e);if(t&&t.hasData()){n[e.key]=e;continue}}else{let e=a.children(this._source.maxzoom);if(n[e[0].key]&&n[e[1].key]&&n[e[2].key]&&n[e[3].key])continue}let o=e.wasRequested();for(let t=a.overscaledZ-1;t>=i;--t){let i=a.scaledTo(t);if(r[i.key])break;if(r[i.key]=!0,e=this.getTile(i),!e&&o&&(e=this._addTile(i)),e){let t=e.hasData();if((t||!this.map?.cancelPendingTileRequestsWhileZooming||o)&&(n[i.key]=i),o=e.wasRequested(),t)break}}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let t=[],n,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){n=this._loadedParentTiles[r.key];break}t.push(r.key);let e=r.scaledTo(r.overscaledZ-1);if(n=this._getLoadedTile(e),n)break;r=e}for(let e of t)this._loadedParentTiles[e]=n}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let e in this._tiles){let t=this._tiles[e].tileID,n=this._getLoadedTile(t);this._loadedSiblingTiles[t.key]=n}}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));let r=n;return n||(n=new Ee(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._tiles[e.key]=n,r||this._source.fire(new t.k(`dataloading`,{tile:n,coord:n.tileID,dataType:`source`})),n}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,`expired`),delete this._timers[e]}),n))}_removeTile(e){let t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&t.state!==`reloading`?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){let t=e.sourceDataType;e.dataType===`source`&&t===`metadata`&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType===`source`&&t===`content`&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,r){let i=[],a=this.transform;if(!a)return i;let o=r?a.getCameraQueryGeometry(e):e,s=e.map((e=>a.pointCoordinate(e,this.terrain))),c=o.map((e=>a.pointCoordinate(e,this.terrain))),l=this.getIds(),u=1/0,d=1/0,f=-1/0,p=-1/0;for(let e of c)u=Math.min(u,e.x),d=Math.min(d,e.y),f=Math.max(f,e.x),p=Math.max(p,e.y);for(let e=0;e<l.length;e++){let r=this._tiles[l[e]];if(r.holdingForFade())continue;let o=r.tileID,m=2**(a.zoom-r.tileID.overscaledZ),h=n*r.queryPadding*t.X/r.tileSize/m,g=[o.getTilePoint(new t.Z(u,d)),o.getTilePoint(new t.Z(f,p))];if(g[0].x-h<t.X&&g[0].y-h<t.X&&g[1].x+h>=0&&g[1].y+h>=0){let e=s.map((e=>o.getTilePoint(e))),t=c.map((e=>o.getTilePoint(e)));i.push({tile:r,tileID:o,queryGeometry:e,cameraQueryGeometry:t,scale:m})}}return i}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));for(let e of t)e.posMatrix=this.transform.calculatePosMatrix(e.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(Oe(this._source.type)){let e=a.now();for(let t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,n){this._state.updateState(e||=`_geojsonTileLayer`,t,n)}removeFeatureState(e,t,n){this._state.removeFeatureState(e||=`_geojsonTileLayer`,t,n)}getFeatureState(e,t){return this._state.getState(e||=`_geojsonTileLayer`,t)}setDependencies(e,t,n){let r=this._tiles[e];r&&r.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(let n in this._tiles)this._tiles[n].hasDependency(e,t)&&this._reloadTile(n,`reloading`);this._cache.filter((n=>!n.hasDependency(e,t)))}}function De(e,t){let n=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-n||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Oe(e){return e===`raster`||e===`image`||e===`video`}R.maxOverzooming=10,R.maxUnderzooming=3;class z{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=t.ac(e,0,1);let n=1,r=this._distances[n],i=e*this.paddedLength+this.padding;for(;r<i&&n<this._distances.length;)r=this._distances[++n];let a=n-1,o=this._distances[a],s=r-o,c=s>0?(i-o)/s:0;return this.points[a].mult(1-c).add(this.points[n].mult(c))}}function ke(e,t){let n=!0;return e===`always`||e!==`never`&&t!==`never`||(n=!1),n}class Ae{constructor(e,t,n){let r=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),i.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}insertCircle(e,t,n,r){this._forEachCell(t-r,n-r,t+r,n+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(r)}_insertBoxCell(e,t,n,r,i,a){this.boxCells[i].push(a)}_insertCircleCell(e,t,n,r,i,a){this.circleCells[i].push(a)}_query(e,t,n,r,i,a,o){if(n<0||e>this.width||r<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(i)return[{key:null,x1:e,y1:t,x2:n,y2:r}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],n=this.circles[3*e+1],r=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-r,y1:n-r,x2:t+r,y2:n+r})}}else this._forEachCell(e,t,n,r,this._queryCell,s,{hitTest:i,overlapMode:a,seenUids:{box:{},circle:{}}},o);return s}query(e,t,n,r){return this._query(e,t,n,r,!1,null)}hitTest(e,t,n,r,i,a){return this._query(e,t,n,r,!0,i,a).length>0}hitTestCircle(e,t,n,r,i){let a=e-n,o=e+n,s=t-n,c=t+n;if(o<0||a>this.width||c<0||s>this.height)return!1;let l=[];return this._forEachCell(a,s,o,c,this._queryCellCircle,l,{hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},i),l.length>0}_queryCell(e,t,n,r,i,a,o,s){let{seenUids:c,hitTest:l,overlapMode:u}=o,d=this.boxCells[i];if(d!==null){let i=this.bboxes;for(let o of d)if(!c.box[o]){c.box[o]=!0;let d=4*o,f=this.boxKeys[o];if(e<=i[d+2]&&t<=i[d+3]&&n>=i[d+0]&&r>=i[d+1]&&(!s||s(f))&&(!l||!ke(u,f.overlapMode))&&(a.push({key:f,x1:i[d],y1:i[d+1],x2:i[d+2],y2:i[d+3]}),l))return!0}}let f=this.circleCells[i];if(f!==null){let i=this.circles;for(let o of f)if(!c.circle[o]){c.circle[o]=!0;let d=3*o,f=this.circleKeys[o];if(this._circleAndRectCollide(i[d],i[d+1],i[d+2],e,t,n,r)&&(!s||s(f))&&(!l||!ke(u,f.overlapMode))){let e=i[d],t=i[d+1],n=i[d+2];if(a.push({key:f,x1:e-n,y1:t-n,x2:e+n,y2:t+n}),l)return!0}}}return!1}_queryCellCircle(e,t,n,r,i,a,o,s){let{circle:c,seenUids:l,overlapMode:u}=o,d=this.boxCells[i];if(d!==null){let e=this.bboxes;for(let t of d)if(!l.box[t]){l.box[t]=!0;let n=4*t,r=this.boxKeys[t];if(this._circleAndRectCollide(c.x,c.y,c.radius,e[n+0],e[n+1],e[n+2],e[n+3])&&(!s||s(r))&&!ke(u,r.overlapMode))return a.push(!0),!0}}let f=this.circleCells[i];if(f!==null){let e=this.circles;for(let t of f)if(!l.circle[t]){l.circle[t]=!0;let n=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[n],e[n+1],e[n+2],c.x,c.y,c.radius)&&(!s||s(r))&&!ke(u,r.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToXCellCoord(e),l=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++)if(i.call(this,e,t,n,r,this.xCellCount*c+f,a,o,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,r,i,a){let o=r-e,s=i-t,c=n+a;return c*c>o*o+s*s}_circleAndRectCollide(e,t,n,r,i,a,o){let s=(a-r)/2,c=Math.abs(e-(r+s));if(c>s+n)return!1;let l=(o-i)/2,u=Math.abs(t-(i+l));if(u>l+n)return!1;if(c<=s||u<=l)return!0;let d=c-s,f=u-l;return d*d+f*f<=n*n}}function je(e,n,r,i,a){let o=t.H();return n?(t.K(o,o,[1/a,1/a,1]),r||t.ad(o,o,i.angle)):t.L(o,i.labelPlaneMatrix,e),o}function Me(e,n,r,i,a){if(n){let n=t.ae(e);return t.K(n,n,[a,a,1]),r||t.ad(n,n,-i.angle),n}return i.glCoordMatrix}function Ne(e,n,r,i){let a;i?(a=[e,n,i(e,n),1],t.af(a,a,r)):(a=[e,n,0,1],Je(a,a,r));let o=a[3];return{point:new t.P(a[0]/o,a[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function Pe(e,t){return .5+e/t*.5}function Fe(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function Ie(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=i?e.textSizeData:e.iconSizeData,_=t.ag(g,r.transform.zoom),v=[256/r.width*2+1,256/r.height*2+1],y=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;y.clear();let b=e.lineVertexArray,x=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,S=r.transform.width/r.transform.height,C=!1;for(let i=0;i<x.length;i++){let w=x.get(i);if(w.hidden||w.writingMode===t.ah.vertical&&!C){qe(w.numGlyphs,y);continue}C=!1;let T=Ne(w.anchorX,w.anchorY,n,h);if(!Fe(T.point,v)){qe(w.numGlyphs,y);continue}let E=Pe(r.transform.cameraToCenterDistance,T.signedDistanceFromCamera),D=t.ai(g,_,w),O=s?D/E:D*E,k={getElevation:h,labelPlaneMatrix:a,lineVertexArray:b,pitchWithMap:s,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:u,tileAnchorPoint:new t.P(w.anchorX,w.anchorY),unwrappedTileID:d,width:f,height:p,translation:m},A=ze(k,w,O,!1,c,n,o,e.glyphOffsetArray,y,S,l);C=A.useVertical,(A.notEnoughRoom||C||A.needsFlipping&&ze(k,w,O,!0,c,n,o,e.glyphOffsetArray,y,S,l).notEnoughRoom)&&qe(w.numGlyphs,y)}i?e.text.dynamicLayoutVertexBuffer.updateData(y):e.icon.dynamicLayoutVertexBuffer.updateData(y)}function Le(e,t,n,r,i,a,o,s){let c=a.glyphStartIndex+a.numGlyphs,l=a.lineStartIndex,u=a.lineStartIndex+a.lineLength,d=t.getoffsetX(a.glyphStartIndex),f=t.getoffsetX(c-1),p=Ge(e*d,n,r,i,a.segment,l,u,s,o);if(!p)return null;let m=Ge(e*f,n,r,i,a.segment,l,u,s,o);return m?s.projectionCache.anyProjectionOccluded?null:{first:p,last:m}:null}function Re(e,n,r,i){return e===t.ah.horizontal&&Math.abs(r.y-n.y)>Math.abs(r.x-n.x)*i?{useVertical:!0}:(e===t.ah.vertical?n.y<r.y:n.x>r.x)?{needsFlipping:!0}:null}function ze(e,n,r,i,a,o,s,c,l,u,d){let f=r/24,p=n.lineOffsetX*f,m=n.lineOffsetY*f,h;if(n.numGlyphs>1){let t=n.glyphStartIndex+n.numGlyphs,r=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,l=Le(f,c,p,m,i,n,d,e);if(!l)return{notEnoughRoom:!0};let g=Ne(l.first.point.x,l.first.point.y,s,e.getElevation).point,_=Ne(l.last.point.x,l.last.point.y,s,e.getElevation).point;if(a&&!i){let e=Re(n.writingMode,g,_,u);if(e)return e}h=[l.first];for(let a=n.glyphStartIndex+1;a<t-1;a++)h.push(Ge(f*c.getoffsetX(a),p,m,i,n.segment,r,o,e,d));h.push(l.last)}else{if(a&&!i){let r=Ne(e.tileAnchorPoint.x,e.tileAnchorPoint.y,o,e.getElevation).point,i=n.lineStartIndex+n.segment+1,a=new t.P(e.lineVertexArray.getx(i),e.lineVertexArray.gety(i)),s=Ne(a.x,a.y,o,e.getElevation),c=s.signedDistanceFromCamera>0?s.point:function(e,t,n,r,i,a){return Be(e,t,n,1,i,a)}(e.tileAnchorPoint,a,r,0,o,e),l=Re(n.writingMode,r,c,u);if(l)return l}let r=Ge(f*c.getoffsetX(n.glyphStartIndex),p,m,i,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,e,d);if(!r||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};h=[r]}for(let e of h)t.aj(l,e.point,e.angle);return{}}function Be(e,t,n,r,i,a){let o=e.add(e.sub(t)._unit()),s=i===void 0?He(o.x,o.y,a).point:Ne(o.x,o.y,i,a.getElevation).point,c=n.sub(s);return n.add(c._mult(r/c.mag()))}function Ve(e,n,r){let i=n.projectionCache;if(i.projections[e])return i.projections[e];let a=new t.P(n.lineVertexArray.getx(e),n.lineVertexArray.gety(e)),o=He(a.x,a.y,n);if(o.signedDistanceFromCamera>0)return i.projections[e]=o.point,i.anyProjectionOccluded=i.anyProjectionOccluded||o.isOccluded,o.point;let s=e-r.direction;return function(e,t,n,r,i){return Be(e,t,n,r,void 0,i)}(r.distanceFromAnchor===0?n.tileAnchorPoint:new t.P(n.lineVertexArray.getx(s),n.lineVertexArray.gety(s)),a,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,n)}function He(e,t,n){let r=e+n.translation[0],i=t+n.translation[1],a;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(a=n.projection.projectTileCoordinates(r,i,n.unwrappedTileID,n.getElevation),a.point.x=(.5*a.point.x+.5)*n.width,a.point.y=(.5*-a.point.y+.5)*n.height):(a=Ne(r,i,n.labelPlaneMatrix,n.getElevation),a.isOccluded=!1),a}function Ue(e,t,n){return e._unit()._perp()._mult(t*n)}function We(e,n,r,i,a,o,s,c,l){if(c.projectionCache.offsets[e])return c.projectionCache.offsets[e];let u=r.add(n);if(e+l.direction<i||e+l.direction>=a)return c.projectionCache.offsets[e]=u,u;let d=Ve(e+l.direction,c,l),f=Ue(d.sub(r),s,l.direction),p=r.add(f),m=d.add(f);return c.projectionCache.offsets[e]=t.ak(o,u,p,m)||u,c.projectionCache.offsets[e]}function Ge(e,t,n,r,i,a,o,s,c){let l=r?e-t:e+t,u=l>0?1:-1,d=0;r&&(u*=-1,d=Math.PI),u<0&&(d+=Math.PI);let f,p=u>0?a+i:a+i+1;s.projectionCache.cachedAnchorPoint?f=s.projectionCache.cachedAnchorPoint:(f=He(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=f);let m,h,g=f,_=f,v=0,y=0,b=Math.abs(l),x=[],S;for(;v+y<=b;){if(p+=u,p<a||p>=o)return null;v+=y,_=g,h=m;let e={absOffsetX:b,direction:u,distanceFromAnchor:v,previousVertex:_};if(g=Ve(p,s,e),n===0)x.push(_),S=g.sub(_);else{let t,r=g.sub(_);t=r.mag()===0?Ue(Ve(p+u,s,e).sub(g),n,u):Ue(r,n,u),h||=_.add(t),m=We(p,t,g,a,o,h,n,s,e),x.push(h),S=m.sub(h)}y=S.mag()}let C=S._mult((b-v)/y)._add(h||_),w=d+Math.atan2(g.y-_.y,g.x-_.x);return x.push(C),{point:C,angle:c?w:0,path:x}}let Ke=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function qe(e,t){for(let n=0;n<e;n++){let e=t.length;t.resize(e+4),t.float32.set(Ke,3*e)}}function Je(e,t,n){let r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e[3]=n[3]*r+n[7]*i+n[15],e}class Ye{constructor(e,t,n=new Ae(e.width+200,e.height+200,25),r=new Ae(e.width+200,e.height+200,25)){this.transform=e,this.mapProjection=t,this.grid=n,this.ignoredGrid=r,this.pitchFactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,n,r,i,a,o,s,c,l,u){let d=e.anchorPointX+s[0],f=e.anchorPointY+s[1],p=this.projectAndGetPerspectiveRatio(r,d,f,i,l),m=n*p.perspectiveRatio,h;if(a||o)h=this._projectCollisionBox(e,m,r,i,a,o,s,p,l,u);else{let t=p.point.x+(u?u.x*m:0),n=p.point.y+(u?u.y*m:0);h={allPointsOccluded:!1,box:[t+e.x1*m,n+e.y1*m,t+e.x2*m,n+e.y2*m]}}let[g,_,v,y]=h.box;return this.mapProjection.useSpecialProjectionForSymbols&&(a?h.allPointsOccluded:this.mapProjection.isOccluded(d,f,i))||p.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(g,_,v,y)||t!==`always`&&this.grid.hitTest(g,_,v,y,t,c)?{box:[g,_,v,y],placeable:!1,offscreen:!1}:{box:[g,_,v,y],placeable:!0,offscreen:this.isOffscreen(g,_,v,y)}}placeCollisionCircles(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=[],v=new t.P(n.anchorX,n.anchorY),y=this.getPerspectiveRatio(o,v.x,v.y,s,g),b=(d?a/y:a*y)/t.ap,x={getElevation:g,labelPlaneMatrix:c,lineVertexArray:r,pitchWithMap:d,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:v,unwrappedTileID:s,width:this.transform.width,height:this.transform.height,translation:h},S=Le(b,i,n.lineOffsetX*b,n.lineOffsetY*b,!1,n,!1,x),C=!1,w=!1,T=!0;if(S){let n=.5*p*y+m,r=new t.P(-100,-100),i=new t.P(this.screenRightBoundary,this.screenBottomBoundary),a=new z,o=S.first,s=S.last,c=[];for(let e=o.path.length-1;e>=1;e--)c.push(o.path[e]);for(let e=1;e<s.path.length;e++)c.push(s.path[e]);let d=2.5*n;if(l){let e=this.projectPathToScreenSpace(c,x,l);c=e.some((e=>e.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let h=[];if(c.length>0){let e=c[0].clone(),n=c[0].clone();for(let t=1;t<c.length;t++)e.x=Math.min(e.x,c[t].x),e.y=Math.min(e.y,c[t].y),n.x=Math.max(n.x,c[t].x),n.y=Math.max(n.y,c[t].y);h=e.x>=r.x&&n.x<=i.x&&e.y>=r.y&&n.y<=i.y?[c]:n.x<r.x||e.x>i.x||n.y<r.y||e.y>i.y?[]:t.al([c],r.x,r.y,i.x,i.y)}for(let t of h){a.reset(t,.25*n);let r=0;r=a.length<=.5*n?1:Math.ceil(a.paddedLength/d)+1;for(let t=0;t<r;t++){let i=t/Math.max(r-1,1),o=a.lerp(i),s=o.x+100,c=o.y+100;_.push(s,c,n,0);let l=s-n,d=c-n,p=s+n,m=c+n;if(T&&=this.isOffscreen(l,d,p,m),w||=this.isInsideGrid(l,d,p,m),e!==`always`&&this.grid.hitTestCircle(s,c,n,e,f)&&(C=!0,!u))return{circles:[],offscreen:!1,collisionDetected:C}}}}return{circles:!u&&C||!w||y<this.perspectiveRatioCutoff?[]:_,offscreen:T,collisionDetected:C}}projectPathToScreenSpace(e,t,n){return e.map((e=>Ne(e.x,e.y,n,t.getElevation)))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],r=1/0,i=1/0,a=-1/0,o=-1/0;for(let s of e){let e=new t.P(s.x+100,s.y+100);r=Math.min(r,e.x),i=Math.min(i,e.y),a=Math.max(a,e.x),o=Math.max(o,e.y),n.push(e)}let s=this.grid.query(r,i,a,o).concat(this.ignoredGrid.query(r,i,a,o)),c={},l={};for(let e of s){let r=e.key;if(c[r.bucketInstanceId]===void 0&&(c[r.bucketInstanceId]={}),c[r.bucketInstanceId][r.featureIndex])continue;let i=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.am(n,i)&&(c[r.bucketInstanceId][r.featureIndex]=!0,l[r.bucketInstanceId]===void 0&&(l[r.bucketInstanceId]=[]),l[r.bucketInstanceId].push(r.featureIndex))}return l}insertCollisionBox(e,t,n,r,i,a){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,r,i,a){let o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,n,r,i,a){let o;a?(o=[n,r,a(n,r),1],t.af(o,o,e)):(o=[n,r,0,1],Je(o,o,e));let s=o[3];return{point:new t.P((o[0]/s+1)/2*this.transform.width+100,(-o[1]/s+1)/2*this.transform.height+100),perspectiveRatio:.5+this.transform.cameraToCenterDistance/s*.5,isOccluded:!1,signedDistanceFromCamera:s}}getPerspectiveRatio(e,t,n,r,i){let a=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(t,n,r,i):Ne(t,n,e,i);return .5+this.transform.cameraToCenterDistance/a.signedDistanceFromCamera*.5}isOffscreen(e,t,n,r){return n<100||e>=this.screenRightBoundary||r<100||t>this.screenBottomBoundary}isInsideGrid(e,t,n,r){return n>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=t.an([]);return t.J(e,e,[-100,-100,0]),e}_projectCollisionBox(e,n,r,i,a,o,s,c,l,u){let d=new t.P(1,0),f=new t.P(0,1),p=new t.P(e.anchorPointX+s[0],e.anchorPointY+s[1]);if(o&&!a){let e=this.projectAndGetPerspectiveRatio(r,p.x+1,p.y,i,l).point.sub(c.point).unit(),n=Math.atan(e.y/e.x)+(e.x<0?Math.PI:0),a=Math.sin(n),o=Math.cos(n);d=new t.P(o,a),f=new t.P(-a,o)}else if(!o&&a){let e=-this.transform.angle,n=Math.sin(e),r=Math.cos(e);d=new t.P(r,n),f=new t.P(-n,r)}let m=c.point,h=n;a&&(m=p,h=2**-(this.transform.zoom-Math.floor(this.transform.zoom)),h*=this.mapProjection.getPitchedTextCorrection(this.transform,p,i),u||(h*=t.ac(.5+c.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(m=m.add(d.mult(u.x*h)).add(f.mult(u.y*h)));let g=e.x1*h,_=e.x2*h,v=(g+_)/2,y=e.y1*h,b=e.y2*h,x=(y+b)/2,S=[{offsetX:g,offsetY:y},{offsetX:v,offsetY:y},{offsetX:_,offsetY:y},{offsetX:_,offsetY:x},{offsetX:_,offsetY:b},{offsetX:v,offsetY:b},{offsetX:g,offsetY:b},{offsetX:g,offsetY:x}],C=[];for(let{offsetX:e,offsetY:n}of S)C.push(new t.P(m.x+d.x*e+f.x*n,m.y+d.y*e+f.y*n));let w=!1;if(a){let e=C.map((e=>this.projectAndGetPerspectiveRatio(r,e.x,e.y,i,l)));w=e.some((e=>!e.isOccluded)),C=e.map((e=>e.point))}else w=!0;return{box:t.ao(C),allPointsOccluded:!w}}}function Xe(e,n,r){return n*(t.X/(e.tileSize*2**(r-e.tileID.overscaledZ)))}class Ze{constructor(e,t,n,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}}class Qe{constructor(e,t,n,r,i){this.text=new Ze(e?e.text:null,t,n,i),this.icon=new Ze(e?e.icon:null,t,r,i)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class $e{constructor(e,t,n){this.text=e,this.icon=t,this.skipFade=n}}class et{constructor(){this.invProjMatrix=t.H(),this.viewportMatrix=t.H(),this.circles=[]}}class tt{constructor(e,t,n,r,i){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=r,this.tileID=i}}class nt{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function rt(e,n,r,i,a){let{horizontalAlign:o,verticalAlign:s}=t.au(e);return new t.P(-(o-.5)*n+i[0]*a,-(s-.5)*r+i[1]*a)}class it{constructor(e,t,n,r,i,a){this.transform=e.clone(),this.terrain=n,this.collisionIndex=new Ye(this.transform,t),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new nt(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;return t?(n,r)=>t.getElevation(e,n,r):null}getBucketParts(e,n,r,i){let a=r.getBucket(n),o=r.latestFeatureIndex;if(!a||!o||n.id!==a.layerIds[0])return;let s=r.collisionBoxArray,c=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.transform.zoom-r.tileID.overscaledZ),d=r.tileSize/t.X,f=r.tileID.toUnwrapped(),p=this.transform.calculatePosMatrix(f),m=c.get(`text-pitch-alignment`)===`map`,h=c.get(`text-rotation-alignment`)===`map`,g=Xe(r,1,this.transform.zoom),_=this.collisionIndex.mapProjection.translatePosition(this.transform,r,l.get(`text-translate`),l.get(`text-translate-anchor`)),v=this.collisionIndex.mapProjection.translatePosition(this.transform,r,l.get(`icon-translate`),l.get(`icon-translate-anchor`)),y=je(p,m,h,this.transform,g),b=null;if(m){let e=Me(p,m,h,this.transform,g);b=t.L([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[a.bucketInstanceId]=new tt(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,r.tileID);let x={bucket:a,layout:c,translationText:_,translationIcon:v,posMatrix:p,unwrappedTileID:f,textLabelPlaneMatrix:y,labelToScreenMatrix:b,scale:u,textPixelRatio:d,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.ag(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(i)for(let t of a.sortKeyRanges){let{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i}=t;e.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i,parameters:x})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:x})}attemptAnchorPlacement(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y){let b=t.aq[e.textAnchor],x=[e.textOffset0,e.textOffset1],S=rt(b,r,i,x,a),C=this.collisionIndex.placeCollisionBox(n,f,c,l,u,s,o,g,d.predicate,y,S);if((!v||this.collisionIndex.placeCollisionBox(v,f,c,l,u,s,o,_,d.predicate,y,S).placeable)&&C.placeable){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);return this.variableOffsets[p.crossTileID]={textOffset:x,width:r,height:i,anchor:b,textBoxScale:a,prevAnchor:e},this.markUsedJustification(m,b,p,h),m.allowVerticalPlacement&&(this.markUsedOrientation(m,h,p),this.placedOrientations[p.crossTileID]=h),{shift:S,placedGlyphBoxes:C}}}placeLayerBucketPart(e,n,r){let{bucket:i,layout:a,translationText:o,translationIcon:s,posMatrix:c,unwrappedTileID:l,textLabelPlaneMatrix:u,labelToScreenMatrix:d,textPixelRatio:f,holdingForFade:p,collisionBoxArray:m,partiallyEvaluatedTextSize:h,collisionGroup:g}=e.parameters,_=a.get(`text-optional`),v=a.get(`icon-optional`),y=t.ar(a,`text-overlap`,`text-allow-overlap`),b=y===`always`,x=t.ar(a,`icon-overlap`,`icon-allow-overlap`),S=x===`always`,C=a.get(`text-rotation-alignment`)===`map`,w=a.get(`text-pitch-alignment`)===`map`,T=a.get(`icon-text-fit`)!==`none`,E=a.get(`symbol-z-order`)===`viewport-y`,D=b&&(S||!i.hasIconData()||v),O=S&&(b||!i.hasTextData()||_);!i.collisionArrays&&m&&i.deserializeCollisionBoxes(m);let k=this._getTerrainElevationFunc(this.retainedQueryData[i.bucketInstanceId].tileID),A=(e,m,S)=>{if(n[e.crossTileID])return;if(p)return void(this.placements[e.crossTileID]=new $e(!1,!1,!1));let E=!1,A=!1,j=!0,ee=null,M={box:null,placeable:!1,offscreen:null},te={box:null,placeable:!1,offscreen:null},ne=null,re=null,ie=null,ae=0,oe=0,se=0;m.textFeatureIndex?ae=m.textFeatureIndex:e.useRuntimeCollisionCircles&&(ae=e.featureIndex),m.verticalTextFeatureIndex&&(oe=m.verticalTextFeatureIndex);let ce=m.textBox;if(ce){let n=n=>{let r=t.ah.horizontal;if(i.allowVerticalPlacement&&!n&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(i,r,e))}return r},a=(n,r)=>{if(i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&m.verticalTextBox){for(let e of i.writingModes)if(e===t.ah.vertical?(M=r(),te=M):M=n(),M&&M.placeable)break}else M=n()},u=e.textAnchorOffsetStartIndex,d=e.textAnchorOffsetEndIndex;if(d===u){let r=(t,n)=>{let r=this.collisionIndex.placeCollisionBox(t,y,f,c,l,w,C,o,g.predicate,k);return r&&r.placeable&&(this.markUsedOrientation(i,n,e),this.placedOrientations[e.crossTileID]=n),r};a((()=>r(ce,t.ah.horizontal)),(()=>{let n=m.verticalTextBox;return i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&n?r(n,t.ah.vertical):{box:null,offscreen:null}})),n(M&&M.placeable)}else{let p=t.aq[this.prevPlacement?.variableOffsets[e.crossTileID]?.anchor],h=(n,a,m)=>{let h=n.x2-n.x1,_=n.y2-n.y1,v=e.textBoxScale,b=T&&x===`never`?a:null,S=null,D=y===`never`?1:2,O=`never`;p&&D++;for(let t=0;t<D;t++){for(let t=u;t<d;t++){let r=i.textAnchorOffsets.get(t);if(p&&r.textAnchor!==p)continue;let a=this.attemptAnchorPlacement(r,n,h,_,v,C,w,f,c,l,g,O,e,i,m,o,s,b,k);if(a&&(S=a.placedGlyphBoxes,S&&S.placeable))return E=!0,ee=a.shift,S}p?p=null:O=y}return r&&!S&&(S={box:this.collisionIndex.placeCollisionBox(ce,`always`,f,c,l,w,C,o,g.predicate,k,new t.P(0,0)).box,offscreen:!1,placeable:!1}),S};a((()=>h(ce,m.iconBox,t.ah.horizontal)),(()=>{let n=m.verticalTextBox;return i.allowVerticalPlacement&&(!M||!M.placeable)&&e.numVerticalGlyphVertices>0&&n?h(n,m.verticalIconBox,t.ah.vertical):{box:null,occluded:!0,offscreen:null}})),M&&(E=M.placeable,j=M.offscreen);let _=n(M&&M.placeable);if(!E&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(i,t.anchor,e,_))}}}if(ne=M,E=ne&&ne.placeable,j=ne&&ne.offscreen,e.useRuntimeCollisionCircles){let n=i.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),s=t.ai(i.textSizeData,h,n),f=a.get(`text-padding`);re=this.collisionIndex.placeCollisionCircles(y,n,i.lineVertexArray,i.glyphOffsetArray,s,c,l,u,d,r,w,g.predicate,e.collisionCircleDiameter,f,o,k),re.circles.length&&re.collisionDetected&&!r&&t.w(`Collisions detected, but collision boxes are not shown`),E=b||re.circles.length>0&&!re.collisionDetected,j&&=re.offscreen}if(m.iconFeatureIndex&&(se=m.iconFeatureIndex),m.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,x,f,c,l,w,C,s,g.predicate,k,T&&ee?ee:void 0);te&&te.placeable&&m.verticalIconBox?(ie=e(m.verticalIconBox),A=ie.placeable):(ie=e(m.iconBox),A=ie.placeable),j&&=ie.offscreen}let le=_||e.numHorizontalGlyphVertices===0&&e.numVerticalGlyphVertices===0,ue=v||e.numIconVertices===0;le||ue?ue?le||(A&&=E):E=A&&E:A=E=A&&E;let de=A&&ie.placeable;if(E&&ne.placeable&&this.collisionIndex.insertCollisionBox(ne.box,y,a.get(`text-ignore-placement`),i.bucketInstanceId,te&&te.placeable&&oe?oe:ae,g.ID),de&&this.collisionIndex.insertCollisionBox(ie.box,x,a.get(`icon-ignore-placement`),i.bucketInstanceId,se,g.ID),re&&E&&this.collisionIndex.insertCollisionCircles(re.circles,y,a.get(`text-ignore-placement`),i.bucketInstanceId,ae,g.ID),r&&this.storeCollisionData(i.bucketInstanceId,S,m,ne,ie,re),e.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);if(i.bucketInstanceId===0)throw Error(`bucket.bucketInstanceId can't be 0`);this.placements[e.crossTileID]=new $e(E||D,A||O,j||i.justReloaded),n[e.crossTileID]=!0};if(E){if(e.symbolInstanceStart!==0)throw Error(`bucket.bucketInstanceId should be 0`);let t=i.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){let n=t[e];A(i.symbolInstances.get(n),i.collisionArrays[n],n)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)A(i.symbolInstances.get(t),i.collisionArrays[t],t);if(r&&i.bucketInstanceId in this.collisionCircleArrays){let e=this.collisionCircleArrays[i.bucketInstanceId];t.as(e.invProjMatrix,c),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}i.justReloaded=!1}storeCollisionData(e,t,n,r,i,a){if(n.textBox||n.iconBox){let a,o;this.collisionBoxArrays.has(e)?a=this.collisionBoxArrays.get(e):(a=new Map,this.collisionBoxArrays.set(e,a)),a.has(t)?o=a.get(t):(o={text:null,icon:null},a.set(t,o)),n.textBox&&(o.text=r.box),n.iconBox&&(o.icon=i.box)}if(a){let t=this.collisionCircleArrays[e];t===void 0&&(t=this.collisionCircleArrays[e]=new et);for(let e=0;e<a.circles.length;e+=4)t.circles.push(a.circles[e+0]),t.circles.push(a.circles[e+1]),t.circles.push(a.circles[e+2]),t.circles.push(+!!a.collisionDetected)}}markUsedJustification(e,n,r,i){let a;a=i===t.ah.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.at(n)];let o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let t of o)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=a>=0&&t!==a?0:r.crossTileID)}markUsedOrientation(e,n,r){let i=n===t.ah.horizontal||n===t.ah.horizontalOnly?n:0,a=n===t.ah.vertical?n:0,o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let t of o)e.text.placedSymbolArray.get(t).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,i=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],a=i[e];a?(this.opacities[e]=new Qe(a,r,t.text,t.icon),n=n||t.text!==a.text.placed||t.icon!==a.icon.placed):(this.opacities[e]=new Qe(null,r,t.text,t.icon,t.skipFade),n=n||t.text||t.icon)}for(let e in i){let t=i[e];if(!this.opacities[e]){let i=new Qe(t,r,!1,!1);i.isHidden()||(this.opacities[e]=i,n=n||t.text.placed||t.icon.placed)}}for(let e in a)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=a[e]);for(let e in o)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=o[e]);if(t&&t.lastPlacementChangeTime===void 0)throw Error(`Last placement time for previous placement is not defined`);n?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!=`number`&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let n={};for(let r of t){let t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,n,r.collisionBoxArray)}}updateBucketOpacities(e,n,r,i){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let a=e.layers[0],o=a.layout,s=new Qe(null,0,!1,!1,!0),c=o.get(`text-allow-overlap`),l=o.get(`icon-allow-overlap`),u=a._unevaluatedLayout.hasValue(`text-variable-anchor`)||a._unevaluatedLayout.hasValue(`text-variable-anchor-offset`),d=o.get(`text-rotation-alignment`)===`map`,f=o.get(`text-pitch-alignment`)===`map`,p=o.get(`icon-text-fit`)!==`none`,m=new Qe(null,0,c&&(l||!e.hasIconData()||o.get(`icon-optional`)),l&&(c||!e.hasTextData()||o.get(`text-optional`)),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let h=(e,t,n)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(n);e.hasVisibleVertices=e.hasVisibleVertices||n!==ut},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let n=0;n<e.symbolInstances.length;n++){let i=e.symbolInstances.get(n),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:o,crossTileID:c}=i,l=this.opacities[c];r[c]?l=s:l||(l=m,this.opacities[c]=l),r[c]=!0;let _=i.numIconVertices>0,v=this.placedOrientations[i.crossTileID],y=v===t.ah.vertical,b=v===t.ah.horizontal||v===t.ah.horizontalOnly;if(a>0||o>0){let t=lt(l.text);h(e.text,a,y?ut:t),h(e.text,o,b?ut:t);let n=l.text.isHidden();[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=n||y?1:0)})),i.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=n||b?1:0);let r=this.variableOffsets[i.crossTileID];r&&this.markUsedJustification(e,r.anchor,i,v);let s=this.placedOrientations[i.crossTileID];s&&(this.markUsedJustification(e,`left`,i,s),this.markUsedOrientation(e,s,i))}if(_){let t=lt(l.icon),n=!(p&&i.verticalPlacedIconSymbolIndex&&y);i.placedIconSymbolIndex>=0&&(h(e.icon,i.numIconVertices,n?t:ut),e.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=l.icon.isHidden()),i.verticalPlacedIconSymbolIndex>=0&&(h(e.icon,i.numVerticalIconVertices,n?ut:t),e.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=l.icon.isHidden())}let x=g&&g.has(n)?g.get(n):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let r=e.collisionArrays[n];if(r){let n=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){let e=this.variableOffsets[c];e?(n=rt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),d&&n._rotate(f?this.transform.angle:-this.transform.angle)):t=!1}if(r.textBox||r.verticalTextBox){let i;r.textBox&&(i=y),r.verticalTextBox&&(i=b),at(e.textCollisionBox.collisionVertexArray,l.text.placed,!t||i,x.text,n.x,n.y)}}if(r.iconBox||r.verticalIconBox){let t=!!(!b&&r.verticalIconBox),i;r.iconBox&&(i=t),r.verticalIconBox&&(i=!t),at(e.iconCollisionBox.collisionVertexArray,l.icon.placed,i,x.icon,p?n.x:0,p?n.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){let t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let n=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}}function at(e,t,n,r,i,a){r&&r.length!==0||(r=[0,0,0,0]);let o=r[0]-100,s=r[1]-100,c=r[2]-100,l=r[3]-100;e.emplaceBack(+!!t,+!!n,i||0,a||0,o,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,l),e.emplaceBack(+!!t,+!!n,i||0,a||0,o,l)}let B=2**25,ot=2**24,st=2**17,ct=2**16;function lt(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=+!!e.placed,n=Math.floor(127*e.opacity);return n*B+t*ot+n*st+t*ct+n*512+t*256+n*2+t}let ut=0;function dt(){return{isOccluded:(e,t,n)=>!1,getPitchedTextCorrection:(e,t,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(e,t,n,r){throw Error(`Not implemented.`)},translatePosition:(e,t,n,r)=>function(e,t,n,r,i=!1){if(!n[0]&&!n[1])return[0,0];let a=i?r===`map`?e.angle:0:r===`viewport`?-e.angle:0;if(a){let e=Math.sin(a),t=Math.cos(a);n=[n[0]*t-n[1]*e,n[0]*e+n[1]*t]}return[i?n[0]:Xe(t,n[0],e.zoom),i?n[1]:Xe(t,n[1],e.zoom)]}(e,t,n,r),getCircleRadiusCorrection:e=>1}}class ft{constructor(e){this._sortAcrossTiles=e.layout.get(`symbol-z-order`)!==`viewport-y`&&!e.layout.get(`symbol-sort-key`).isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,r,i){let a=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(a,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,i())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<a.length;)if(t.placeLayerBucketPart(a[this._currentPartIndex],this._seenCrossTileIDs,n),this._currentPartIndex++,i())return!0;return!1}}class pt{constructor(e,t,n,r,i,a,o,s){this.placement=new it(e,dt(),t,a,o,s),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=i,this._done=!1}isDone(){return this._done}continuePlacement(e,t,n){let r=a.now(),i=()=>!this._forceFullPlacement&&a.now()-r>2;for(;this._currentPlacementIndex>=0;){let r=t[e[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if(r.type===`symbol`&&(!r.minzoom||r.minzoom<=a)&&(!r.maxzoom||r.maxzoom>a)){if(this._inProgressLayer||=new ft(r),this._inProgressLayer.continuePlacement(n[r.source],this.placement,this._showCollisionBoxes,r,i))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let mt=512/t.X/2;class ht{constructor(e,n,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let i=new Map;for(let e=0;e<n.length;e++){let t=n.get(e),r=t.key,a=i.get(r);a?a.push(t):i.set(r,[t])}for(let[e,n]of i){let r={positions:n.map((e=>({x:Math.floor(e.anchorX*mt),y:Math.floor(e.anchorY*mt)}))),crossTileIDs:n.map((e=>e.crossTileID))};if(r.positions.length>128){let e=new t.av(r.positions.length,16,Uint16Array);for(let{x:t,y:n}of r.positions)e.add(t,n);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,n){let{x:r,y:i,z:a}=this.tileID.canonical,{x:o,y:s,z:c}=n.canonical,l=mt/2**(c-a),u=(s*t.X+e.anchorY)*l,d=i*t.X*mt;return{x:Math.floor((o*t.X+e.anchorX)*l-r*t.X*mt),y:Math.floor(u-d)}}findMatches(e,t,n){let r=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let i=0;i<e.length;i++){let a=e.get(i);if(a.crossTileID)continue;let o=this._symbolsByKey[a.key];if(!o)continue;let s=this.getScaledCoordinates(a,t);if(o.index){let e=o.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(let t of e){let e=o.crossTileIDs[t];if(!n[e]){n[e]=!0,a.crossTileID=e;break}}}else if(o.positions)for(let e=0;e<o.positions.length;e++){let t=o.positions[e],i=o.crossTileIDs[e];if(Math.abs(t.x-s.x)<=r&&Math.abs(t.y-s.y)<=r&&!n[i]){n[i]=!0,a.crossTileID=i;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class gt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class _t{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let e in this.indexes){let n=this.indexes[e],r={};for(let e in n){let i=n[e];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+t),r[i.tileID.key]=i}this.indexes[e]=r}this.lng=e}addBucket(e,t,n){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let r=this.usedCrossTileIDs[e.overscaledZ];for(let n in this.indexes){let i=this.indexes[n];if(Number(n)>e.overscaledZ)for(let n in i){let a=i[n];a.tileID.isChildOf(e)&&a.findMatches(t.symbolInstances,e,r)}else{let a=i[e.scaledTo(Number(n)).key];a&&a.findMatches(t.symbolInstances,e,r)}}for(let e=0;e<t.symbolInstances.length;e++){let i=t.symbolInstances.get(e);i.crossTileID||(i.crossTileID=n.generate(),r[i.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ht(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let n of t.getCrossTileIDsLists())for(let t of n)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let n in this.indexes){let r=this.indexes[n];for(let i in r)e[r[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,r[i]),delete r[i],t=!0)}return t}}class vt{constructor(){this.layerIndexes={},this.crossTileIDs=new gt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new _t);let i=!1,a={};r.handleWrapJump(n);for(let n of t){let t=n.getBucket(e);t&&e.id===t.layerIds[0]&&(t.bucketInstanceId||=++this.maxBucketInstanceId,r.addBucket(n.tileID,t,this.crossTileIDs)&&(i=!0),a[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(i=!0),i}pruneUnusedLayers(e){let t={};e.forEach((e=>{t[e]=!0}));for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}let yt=(e,n)=>t.t(e,n&&n.filter((e=>e.identifier!==`source.canvas`))),bt=t.aw();class xt extends t.E{constructor(e,n={}){super(),this._rtlPluginLoaded=()=>{for(let e in this.sourceCaches){let t=this.sourceCaches[e].getSource().type;t!==`vector`&&t!==`geojson`||this.sourceCaches[e].reload()}},this.map=e,this.dispatcher=new se(oe(),e._getMapId()),this.dispatcher.registerMessageHandler(`GG`,((e,t)=>this.getGlyphs(e,t))),this.dispatcher.registerMessageHandler(`GI`,((e,t)=>this.getImages(e,t))),this.imageManager=new C,this.imageManager.setEventedParent(this),this.glyphManager=new D(e._requestManager,n.localIdeographFontFamily),this.lineAtlas=new M(256,512),this.crossTileSymbolIndex=new vt,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast(`SR`,t.ay()),Te().on(F,this._rtlPluginLoaded),this.on(`data`,(e=>{if(e.dataType!==`source`||e.sourceDataType!==`metadata`)return;let t=this.sourceCaches[e.sourceId];if(!t)return;let n=t.getSource();if(n&&n.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===n.id&&this._validateLayer(t)}}))}loadURL(e,n={},r){this.fire(new t.k(`dataloading`,{dataType:`style`})),n.validate=typeof n.validate!=`boolean`||n.validate;let i=this.map._requestManager.transformRequest(e,`Style`);this._loadStyleRequest=new AbortController;let a=this._loadStyleRequest;t.h(i,this._loadStyleRequest).then((e=>{this._loadStyleRequest=null,this._load(e.data,n,r)})).catch((e=>{this._loadStyleRequest=null,e&&!a.signal.aborted&&this.fire(new t.j(e))}))}loadJSON(e,n={},r){this.fire(new t.k(`dataloading`,{dataType:`style`})),this._frameRequest=new AbortController,a.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,n.validate=!1!==n.validate,this._load(e,n,r)})).catch((()=>{}))}loadEmpty(){this.fire(new t.k(`dataloading`,{dataType:`style`})),this._load(bt,{validate:!1})}_load(e,n,r){let i=n.transformStyle?n.transformStyle(r,e):e;if(!n.validate||!yt(this,t.u(i))){this._loaded=!0,this.stylesheet=i;for(let e in i.sources)this.addSource(e,i.sources[e],{validate:!1});i.sprite?this._loadSprite(i.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(i.glyphs),this._createLayers(),this.light=new A(this.stylesheet.light),this.sky=new ee(this.stylesheet.sky),this.map.setTerrain(this.stylesheet.terrain??null),this.fire(new t.k(`data`,{dataType:`style`})),this.fire(new t.k(`style.load`))}}_createLayers(){let e=t.az(this.stylesheet.layers);this.dispatcher.broadcast(`SL`,e),this._order=e.map((e=>e.id)),this._layers={},this._serializedLayers=null;for(let n of e){let e=t.aA(n);e.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=e}}_loadSprite(e,n=!1,r=void 0){let i;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(e,n,r,i){return t._(this,void 0,void 0,(function*(){let o=y(e),s=r>1?`@2x`:``,c={},l={};for(let{id:e,url:r}of o){let a=n.transformRequest(b(r,s,`.json`),`SpriteJSON`);c[e]=t.h(a,i);let o=n.transformRequest(b(r,s,`.png`),`SpriteImage`);l[e]=p.getImage(o,i)}return yield Promise.all([...Object.values(c),...Object.values(l)]),function(e,n){return t._(this,void 0,void 0,(function*(){let t={};for(let r in e){t[r]={};let i=a.getImageCanvasContext((yield n[r]).data),o=(yield e[r]).data;for(let e in o){let{width:n,height:a,x:s,y:c,sdf:l,pixelRatio:u,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:h}=o[e];t[r][e]={data:null,pixelRatio:u,sdf:l,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:h,spriteData:{width:n,height:a,x:s,y:c,context:i}}}}return t}))}(c,l)}))}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((e=>{if(this._spriteRequest=null,e)for(let t in e){this._spritesImagesIds[t]=[];let r=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in e))):[];for(let e of r)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(let r in e[t]){let i=t==="default"?r:`${t}:${r}`;this._spritesImagesIds[t].push(i),i in this.imageManager.images?this.imageManager.updateImage(i,e[t][r],!1):this.imageManager.addImage(i,e[t][r]),n&&(this._changedImages[i]=!0)}}})).catch((e=>{this._spriteRequest=null,i=e,this.fire(new t.j(i))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.k(`data`,{dataType:`style`})),r&&r(i)}))}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.k(`data`,{dataType:`style`}))}_validateLayer(e){let n=this.sourceCaches[e.source];if(!n)return;let r=e.sourceLayer;if(!r)return;let i=n.getSource();(i.type===`geojson`||i.vectorLayerIds&&i.vectorLayerIds.indexOf(r)===-1)&&this.fire(new t.j(Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,n=!1){let r=this._serializedAllLayers();if(!e||e.length===0)return Object.values(n?t.aB(r):r);let i=[];for(let a of e)if(r[a]){let e=n?t.aB(r[a]):r[a];i.push(e)}return i}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let n of t){let t=this._layers[n];t.type!==`custom`&&(e[n]=t.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error(`Style is not done loading.`)}update(e){if(!this._loaded)return;let n=this._changed;if(n){let t=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(t.length||n.length)&&this._updateWorkerLayers(t,n);for(let e in this._updatedSources){let t=this._updatedSources[e];if(t===`reload`)this._reloadSource(e);else{if(t!==`clear`)throw Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let r={};for(let e in this.sourceCaches){let t=this.sourceCaches[e];r[e]=t.used,t.used=!1}for(let t of this._order){let n=this._layers[t];n.recalculate(e,this._availableImages),!n.isHidden(e.zoom)&&n.source&&(this.sourceCaches[n.source].used=!0)}for(let e in r){let n=this.sourceCaches[e];!!r[e]!=!!n.used&&n.fire(new t.k(`data`,{sourceDataType:`visibility`,dataType:`source`,sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,n&&this.fire(new t.k(`data`,{dataType:`style`}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies([`icons`,`patterns`],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies([`glyphs`],[``]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast(`UL`,{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){var r;this._checkLoaded();let i=this.serialize();if(e=n.transformStyle?n.transformStyle(i,e):e,((r=n.validate)==null||r)&&yt(this,t.u(e)))return!1;(e=t.aB(e)).layers=t.az(e.layers);let a=t.aC(i,e),o=this._getOperationsToPerform(a);if(o.unimplemented.length>0)throw Error(`Unimplemented: ${o.unimplemented.join(`, `)}.`);if(o.operations.length===0)return!1;for(let e of o.operations)e();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let t=[],n=[];for(let r of e)switch(r.command){case`setCenter`:case`setZoom`:case`setBearing`:case`setPitch`:continue;case`addLayer`:t.push((()=>this.addLayer.apply(this,r.args)));break;case`removeLayer`:t.push((()=>this.removeLayer.apply(this,r.args)));break;case`setPaintProperty`:t.push((()=>this.setPaintProperty.apply(this,r.args)));break;case`setLayoutProperty`:t.push((()=>this.setLayoutProperty.apply(this,r.args)));break;case`setFilter`:t.push((()=>this.setFilter.apply(this,r.args)));break;case`addSource`:t.push((()=>this.addSource.apply(this,r.args)));break;case`removeSource`:t.push((()=>this.removeSource.apply(this,r.args)));break;case`setLayerZoomRange`:t.push((()=>this.setLayerZoomRange.apply(this,r.args)));break;case`setLight`:t.push((()=>this.setLight.apply(this,r.args)));break;case`setGeoJSONSourceData`:t.push((()=>this.setGeoJSONSourceData.apply(this,r.args)));break;case`setGlyphs`:t.push((()=>this.setGlyphs.apply(this,r.args)));break;case`setSprite`:t.push((()=>this.setSprite.apply(this,r.args)));break;case`setSky`:t.push((()=>this.setSky.apply(this,r.args)));break;case`setTerrain`:t.push((()=>this.map.setTerrain.apply(this,r.args)));break;case`setTransition`:t.push((()=>{}));break;default:n.push(r.command)}return{operations:t,unimplemented:n}}addImage(e,n){if(this.getImage(e))return this.fire(new t.j(Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new t.j(Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.k(`data`,{dataType:`style`}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,r={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw Error(`Source "${e}" already exists.`);if(!n.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(`, `)}.`);if([`vector`,`raster`,`geojson`,`video`,`image`].indexOf(n.type)>=0&&this._validate(t.u.source,`sources.${e}`,n,null,r))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let i=this.sourceCaches[e]=new R(e,n,this.dispatcher);i.style=this,i.setEventedParent(this,(()=>({isSourceLoaded:i.loaded(),source:i.serialize(),sourceId:e}))),i.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw Error(`There is no source with this ID`);for(let n in this._layers)if(this._layers[n].source===e)return this.fire(new t.j(Error(`Source "${e}" cannot be removed while layer "${n}" is using it.`)));let n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.k(`data`,{sourceDataType:`metadata`,dataType:`source`,sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw Error(`There is no source with this ID=${e}`);let n=this.sourceCaches[e].getSource();if(n.type!==`geojson`)throw Error(`geojsonSource.type is ${n.type}, which is !== 'geojson`);n.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,n,r={}){this._checkLoaded();let i=e.id;if(this.getLayer(i))return void this.fire(new t.j(Error(`Layer "${i}" already exists on this map.`)));let a;if(e.type===`custom`){if(yt(this,t.aD(e)))return;a=t.aA(e)}else{if(`source`in e&&typeof e.source==`object`&&(this.addSource(i,e.source),e=t.aB(e),e=t.e(e,{source:i})),this._validate(t.u.layer,`layers.${i}`,e,{arrayIndex:-1},r))return;a=t.aA(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:i}})}let o=n?this._order.indexOf(n):this._order.length;if(n&&o===-1)this.fire(new t.j(Error(`Cannot add layer "${i}" before non-existing layer "${n}".`)));else{if(this._order.splice(o,0,i),this._layerOrderChanged=!0,this._layers[i]=a,this._removedLayers[i]&&a.source&&a.type!==`custom`){let e=this._removedLayers[i];delete this._removedLayers[i],e.type===a.type?(this._updatedSources[a.source]=`reload`,this.sourceCaches[a.source].pause()):this._updatedSources[a.source]=`clear`}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.j(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;let r=this._order.indexOf(e);this._order.splice(r,1);let i=n?this._order.indexOf(n):this._order.length;n&&i===-1?this.fire(new t.j(Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let n=this._layers[e];if(!n)return void this.fire(new t.j(Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,r){this._checkLoaded();let i=this.getLayer(e);i?i.minzoom===n&&i.maxzoom===r||(n!=null&&(i.minzoom=n),r!=null&&(i.maxzoom=r),this._updateLayer(i)):this.fire(new t.j(Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,r={}){this._checkLoaded();let i=this.getLayer(e);if(i){if(!t.aE(i.filter,n))return n==null?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.u.filter,`layers.${i.id}.filter`,n,null,r)||(i.filter=t.aB(n),this._updateLayer(i)))}else this.fire(new t.j(Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.aB(this.getLayer(e).filter)}setLayoutProperty(e,n,r,i={}){this._checkLoaded();let a=this.getLayer(e);a?t.aE(a.getLayoutProperty(n),r)||(a.setLayoutProperty(n,r,i),this._updateLayer(a)):this.fire(new t.j(Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){let r=this.getLayer(e);if(r)return r.getLayoutProperty(n);this.fire(new t.j(Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,r,i={}){this._checkLoaded();let a=this.getLayer(e);a?t.aE(a.getPaintProperty(n),r)||(a.setPaintProperty(n,r,i)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new t.j(Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,n){this._checkLoaded();let r=e.source,i=e.sourceLayer,a=this.sourceCaches[r];if(a===void 0)return void this.fire(new t.j(Error(`The source '${r}' does not exist in the map's style.`)));let o=a.getSource().type;o===`geojson`&&i?this.fire(new t.j(Error(`GeoJSON sources cannot have a sourceLayer parameter.`))):o!==`vector`||i?(e.id===void 0&&this.fire(new t.j(Error(`The feature id parameter must be provided.`))),a.setFeatureState(i,e.id,n)):this.fire(new t.j(Error(`The sourceLayer parameter must be provided for vector source types.`)))}removeFeatureState(e,n){this._checkLoaded();let r=e.source,i=this.sourceCaches[r];if(i===void 0)return void this.fire(new t.j(Error(`The source '${r}' does not exist in the map's style.`)));let a=i.getSource().type,o=a===`vector`?e.sourceLayer:void 0;a!==`vector`||o?n&&typeof e.id!=`string`&&typeof e.id!=`number`?this.fire(new t.j(Error(`A feature id is required to remove its specific state property.`))):i.removeFeatureState(o,e.id,n):this.fire(new t.j(Error(`The sourceLayer parameter must be provided for vector source types.`)))}getFeatureState(e){this._checkLoaded();let n=e.source,r=e.sourceLayer,i=this.sourceCaches[n];if(i!==void 0)return i.getSource().type!==`vector`||r?(e.id===void 0&&this.fire(new t.j(Error(`The feature id parameter must be provided.`))),i.getFeatureState(r,e.id)):void this.fire(new t.j(Error(`The sourceLayer parameter must be provided for vector source types.`)));this.fire(new t.j(Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=t.aF(this.sourceCaches,(e=>e.serialize())),n=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,i=this.stylesheet;return t.aG({version:i.version,name:i.name,metadata:i.metadata,light:i.light,sky:i.sky,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,transition:i.transition,sources:e,layers:n,terrain:r},(e=>e!==void 0))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!==`raster`&&(this._updatedSources[e.source]=`reload`,this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=e=>this._layers[e].type===`fill-extrusion`,n={},r=[];for(let i=this._order.length-1;i>=0;i--){let a=this._order[i];if(t(a)){n[a]=i;for(let t of e){let e=t[a];if(e)for(let t of e)r.push(t)}}}r.sort(((e,t)=>t.intersectionZ-e.intersectionZ));let i=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o))for(let e=r.length-1;e>=0;e--){let t=r[e].feature;if(n[t.layer.id]<a)break;i.push(t),r.pop()}else for(let t of e){let e=t[o];if(e)for(let t of e)i.push(t.feature)}}return i}queryRenderedFeatures(e,n,r){n&&n.filter&&this._validate(t.u.filter,`queryRenderedFeatures.filter`,n.filter,null,n);let i={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new t.j(Error(`parameters.layers must be an Array.`))),[];for(let e of n.layers){let n=this._layers[e];if(!n)return this.fire(new t.j(Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];i[n.source]=!0}}let a=[];n.availableImages=this._availableImages;let o=this._serializedAllLayers();for(let t in this.sourceCaches)n.layers&&!i[t]||a.push(ue(this.sourceCaches[t],this._layers,o,e,n,r));return this.placement&&a.push(function(e,t,n,r,i,a,o){let s={},c=a.queryRenderedSymbols(r),l=[];for(let e of Object.keys(c).map(Number))l.push(o[e]);l.sort(de);for(let n of l){let r=n.featureIndex.lookupSymbolFeatures(c[n.bucketInstanceId],t,n.bucketIndex,n.sourceLayerIndex,i.filter,i.layers,i.availableImages,e);for(let e in r){let t=s[e]=s[e]||[],i=r[e];i.sort(((e,t)=>{let r=n.featureSortOrder;if(r){let n=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex}));for(let e of i)t.push(e)}}for(let t in s)s[t].forEach((r=>{let i=r.feature,a=n[e[t].source].getFeatureState(i.layer[`source-layer`],i.id);i.source=i.layer.source,i.layer[`source-layer`]&&(i.sourceLayer=i.layer[`source-layer`]),i.state=a}));return s}(this._layers,o,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,n){n&&n.filter&&this._validate(t.u.filter,`querySourceFeatures.filter`,n.filter,null,n);let r=this.sourceCaches[e];return r?function(e,t){let n=e.getRenderableIds().map((t=>e.getTileByID(t))),r=[],i={};for(let e=0;e<n.length;e++){let a=n[e],o=a.tileID.canonical.key;i[o]||(i[o]=!0,a.querySourceFeatures(r,t))}return r}(r,n):[]}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();let r=this.light.getLight(),i=!1;for(let n in e)if(!t.aE(e[n],r[n])){i=!0;break}if(!i)return;let o={now:a.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(o)}getSky(){return this.stylesheet?.sky}setSky(e,n={}){let r=this.getSky(),i=!1;if(!e&&!r)return;if(e&&!r)i=!0;else if(!e&&r)i=!0;else for(let n in e)if(!t.aE(e[n],r[n])){i=!0;break}if(!i)return;let o={now:a.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,n),this.sky.updateTransitions(o)}_validate(e,n,r,i,a={}){return(!a||!1!==a.validate)&&yt(this,e.call(t.u,t.e({key:n,style:this.serialize(),value:r,styleSpec:t.v},i)))}_remove(e=!0){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),Te().off(F,this._rtlPluginLoaded);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.sourceCaches){let t=this.sourceCaches[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast(`RM`,void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let t in this.sourceCaches)this.sourceCaches[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,t,n,r,i=!1){let o=!1,s=!1,c={};for(let t of this._order){let n=this._layers[t];if(n.type!==`symbol`)continue;if(!c[n.source]){let e=this.sourceCaches[n.source];c[n.source]=e.getRenderableIds(!0).map((t=>e.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}let r=this.crossTileSymbolIndex.addLayer(n,c[n.source],e.center.lng);o||=r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((i=i||this._layerOrderChanged||n===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.now(),e.zoom))&&(this.pauseablePlacement=new pt(e,this.map.terrain,this._order,i,t,n,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.now()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(let e of this._order){let t=this._layers[e];t.type===`symbol`&&this.placement.updateLayerOpacities(t,c[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,n){return t._(this,void 0,void 0,(function*(){let e=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();let t=this.sourceCaches[n.source];return t&&t.setDependencies(n.tileID.key,n.type,n.icons),e}))}getGlyphs(e,n){return t._(this,void 0,void 0,(function*(){let e=yield this.glyphManager.getGlyphs(n.stacks),t=this.sourceCaches[n.source];return t&&t.setDependencies(n.tileID.key,n.type,[``]),e}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}){this._checkLoaded(),e&&this._validate(t.u.glyphs,`glyphs`,e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,n,r={},i){this._checkLoaded();let a=[{id:e,url:n}],o=[...y(this.stylesheet.sprite),...a];this._validate(t.u.sprite,`sprite`,o,null,r)||(this.stylesheet.sprite=o,this._loadSprite(a,!0,i))}removeSprite(e){this._checkLoaded();let n=y(this.stylesheet.sprite);if(n.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(let t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;n.splice(n.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.k(`data`,{dataType:`style`}))}else this.fire(new t.j(Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return y(this.stylesheet.sprite)}setSprite(e,n={},r){this._checkLoaded(),e&&this._validate(t.u.sprite,`sprite`,e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}}var St=t.Y([{name:`a_pos`,type:`Int16`,components:2}]);let Ct={prelude:V(`#ifdef GL_ES
1
+ var e=require("./rolldown-runtime-C6qsp3rV.js").t(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.maplibregl=r())})(e,(function(){"use strict";var e={},t={};function n(n,r,i){if(t[n]=i,n===`index`){var a=`var sharedModule = {}; (`+t.shared+`)(sharedModule); (`+t.worker+`)(sharedModule);`,o={};return t.shared(o),t.index(e,o),typeof window<`u`&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([a],{type:`text/javascript`}))),e}}return n(`shared`,[`exports`],(function(e){function t(e,t,n,r){return new(n||=Promise)((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var r=i;function i(e,t){this.x=e,this.y=t}i.prototype={clone:function(){return new i(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=r,this},_rotateAround:function(e,t){var n=Math.cos(e),r=Math.sin(e),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(e){return e instanceof i?e:Array.isArray(e)?new i(e[0],e[1]):e};var a=n(r),o=s;function s(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}s.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,r=0;r<8;r++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)<t)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n-=i/a}var o=0,s=1;for(n=e,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-e)<t));r++)e>i?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var c=n(o);let l,u;function d(){return l??=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)&&typeof createImageBitmap==`function`,l}function f(){if(u==null&&(u=!1,d())){let e=new OffscreenCanvas(5,5).getContext(`2d`,{willReadFrequently:!0});if(e){for(let t=0;t<25;t++){let n=4*t;e.fillStyle=`rgb(${n},${n+1},${n+2})`,e.fillRect(t%5,Math.floor(t/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let e=0;e<100;e++)if(e%4!=3&&t[e]!==e){u=!0;break}}}return u||!1}function p(e,t,n,r){let i=new c(e,t,n,r);return e=>i.solve(e)}let m=p(.25,.1,.25,1);function h(e,t,n){return Math.min(n,Math.max(t,e))}function g(e,t,n){let r=n-t,i=((e-t)%r+r)%r+t;return i===t?n:i}function _(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}let v=1;function y(e,t,n){let r={};for(let n in e)r[n]=t.call(this,e[n],n,e);return r}function b(e,t,n){let r={};for(let n in e)t.call(this,e[n],n,e)&&(r[n]=e[n]);return r}function x(e){return Array.isArray(e)?e.map(x):typeof e==`object`&&e?y(e,x):e}let S={};function C(e){S[e]||(typeof console<`u`&&console.warn(e),S[e]=!0)}function w(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}function T(e){return typeof WorkerGlobalScope<`u`&&e!==void 0&&e instanceof WorkerGlobalScope}let E=null;function D(e){return typeof ImageBitmap<`u`&&e instanceof ImageBitmap}let O=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=`;function k(e,n,r,i,a){return t(this,void 0,void 0,(function*(){if(typeof VideoFrame>`u`)throw Error(`VideoFrame not supported`);let t=new VideoFrame(e,{timestamp:0});try{let o=t?.format;if(!o||!o.startsWith(`BGR`)&&!o.startsWith(`RGB`))throw Error(`Unrecognized format ${o}`);let s=o.startsWith(`BGR`),c=new Uint8ClampedArray(i*a*4);if(yield t.copyTo(c,function(e,t,n,r,i){let a=4*Math.max(-t,0),o=(Math.max(0,n)-n)*r*4+a,s=4*r,c=Math.max(0,t),l=Math.max(0,n);return{rect:{x:c,y:l,width:Math.min(e.width,t+r)-c,height:Math.min(e.height,n+i)-l},layout:[{offset:o,stride:s}]}}(e,n,r,i,a)),s)for(let e=0;e<c.length;e+=4){let t=c[e];c[e]=c[e+2],c[e+2]=t}return c}finally{t.close()}}))}let A,j,ee=`AbortError`;function M(){return Error(ee)}let te={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:``};function ne(e){return te.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf(`://`))]}let re=`global-dispatcher`;class ie extends Error{constructor(e,t,n,r){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=r}}let ae=()=>T(self)?self.worker&&self.worker.referrer:(window.location.protocol===`blob:`?window.parent:window).location.href,oe=function(e,n){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){let t=ne(e.url);if(t)return t(e,n);if(T(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:`GR`,data:e,targetMapId:re},n)}if(!(/^file:/.test(r=e.url)||/^file:/.test(ae())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,`signal`))return function(e,n){return t(this,void 0,void 0,(function*(){let t=new Request(e.url,{method:e.method||`GET`,body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:ae(),signal:n.signal});e.type!==`json`||t.headers.has(`Accept`)||t.headers.set(`Accept`,`application/json`);let r=yield fetch(t);if(!r.ok){let t=yield r.blob();throw new ie(r.status,r.statusText,e.url,t)}let i;i=e.type===`arrayBuffer`||e.type===`image`?r.arrayBuffer():e.type===`json`?r.json():r.text();let a=yield i;if(n.signal.aborted)throw M();return{data:a,cacheControl:r.headers.get(`Cache-Control`),expires:r.headers.get(`Expires`)}}))}(e,n);if(T(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:`GR`,data:e,mustQueue:!0,targetMapId:re},n)}var r;return function(e,t){return new Promise(((n,r)=>{let i=new XMLHttpRequest;i.open(e.method||`GET`,e.url,!0),e.type!==`arrayBuffer`&&e.type!==`image`||(i.responseType=`arraybuffer`);for(let t in e.headers)i.setRequestHeader(t,e.headers[t]);e.type===`json`&&(i.responseType=`text`,e.headers?.Accept||i.setRequestHeader(`Accept`,`application/json`)),i.withCredentials=e.credentials===`include`,i.onerror=()=>{r(Error(i.statusText))},i.onload=()=>{if(!t.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let t=i.response;if(e.type===`json`)try{t=JSON.parse(i.response)}catch(e){r(e);return}n({data:t,cacheControl:i.getResponseHeader(`Cache-Control`),expires:i.getResponseHeader(`Expires`)})}else{let t=new Blob([i.response],{type:i.getResponseHeader(`Content-Type`)});r(new ie(i.status,i.statusText,e.url,t))}},t.signal.addEventListener(`abort`,(()=>{i.abort(),r(M())})),i.send(e.body)}))}(e,n)};function se(e){if(!e||e.indexOf(`://`)<=0||e.indexOf(`data:image/`)===0||e.indexOf(`blob:`)===0)return!0;let t=new URL(e),n=window.location;return t.protocol===n.protocol&&t.host===n.host}function ce(e,t,n){n[e]&&n[e].indexOf(t)!==-1||(n[e]=n[e]||[],n[e].push(t))}function le(e,t,n){if(n&&n[e]){let r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}class ue{constructor(e,t={}){_(this,t),this.type=e}}class de extends ue{constructor(e,t={}){super(`error`,_({error:e},t))}}class fe{on(e,t){return this._listeners=this._listeners||{},ce(e,t,this._listeners),this}off(e,t){return le(e,t,this._listeners),le(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},ce(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){typeof e==`string`&&(e=new ue(e,t||{}));let n=e.type;if(this.listens(n)){e.target=this;let t=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let n of t)n.call(this,e);let r=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let t of r)le(n,t,this._oneTimeListeners),t.call(this,e);let i=this._eventedParent;i&&(_(e,typeof this._eventedParentData==`function`?this._eventedParentData():this._eventedParentData),i.fire(e))}else e instanceof de&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var N={$version:8,$root:{version:{required:!0,type:`enum`,values:[8]},name:{type:`string`},metadata:{type:`*`},center:{type:`array`,value:`number`},zoom:{type:`number`},bearing:{type:`number`,default:0,period:360,units:`degrees`},pitch:{type:`number`,default:0,units:`degrees`},light:{type:`light`},sky:{type:`sky`},projection:{type:`projection`},terrain:{type:`terrain`},sources:{required:!0,type:`sources`},sprite:{type:`sprite`},glyphs:{type:`string`},transition:{type:`transition`},layers:{required:!0,type:`array`,value:`layer`}},sources:{"*":{type:`source`}},source:[`source_vector`,`source_raster`,`source_raster_dem`,`source_geojson`,`source_video`,`source_image`],source_vector:{type:{required:!0,type:`enum`,values:{vector:{}}},url:{type:`string`},tiles:{type:`array`,value:`string`},bounds:{type:`array`,value:`number`,length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:`enum`,values:{xyz:{},tms:{}},default:`xyz`},minzoom:{type:`number`,default:0},maxzoom:{type:`number`,default:22},attribution:{type:`string`},promoteId:{type:`promoteId`},volatile:{type:`boolean`,default:!1},"*":{type:`*`}},source_raster:{type:{required:!0,type:`enum`,values:{raster:{}}},url:{type:`string`},tiles:{type:`array`,value:`string`},bounds:{type:`array`,value:`number`,length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:`number`,default:0},maxzoom:{type:`number`,default:22},tileSize:{type:`number`,default:512,units:`pixels`},scheme:{type:`enum`,values:{xyz:{},tms:{}},default:`xyz`},attribution:{type:`string`},volatile:{type:`boolean`,default:!1},"*":{type:`*`}},source_raster_dem:{type:{required:!0,type:`enum`,values:{"raster-dem":{}}},url:{type:`string`},tiles:{type:`array`,value:`string`},bounds:{type:`array`,value:`number`,length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:`number`,default:0},maxzoom:{type:`number`,default:22},tileSize:{type:`number`,default:512,units:`pixels`},attribution:{type:`string`},encoding:{type:`enum`,values:{terrarium:{},mapbox:{},custom:{}},default:`mapbox`},redFactor:{type:`number`,default:1},blueFactor:{type:`number`,default:1},greenFactor:{type:`number`,default:1},baseShift:{type:`number`,default:0},volatile:{type:`boolean`,default:!1},"*":{type:`*`}},source_geojson:{type:{required:!0,type:`enum`,values:{geojson:{}}},data:{required:!0,type:`*`},maxzoom:{type:`number`,default:18},attribution:{type:`string`},buffer:{type:`number`,default:128,maximum:512,minimum:0},filter:{type:`*`},tolerance:{type:`number`,default:.375},cluster:{type:`boolean`,default:!1},clusterRadius:{type:`number`,default:50,minimum:0},clusterMaxZoom:{type:`number`},clusterMinPoints:{type:`number`},clusterProperties:{type:`*`},lineMetrics:{type:`boolean`,default:!1},generateId:{type:`boolean`,default:!1},promoteId:{type:`promoteId`}},source_video:{type:{required:!0,type:`enum`,values:{video:{}}},urls:{required:!0,type:`array`,value:`string`},coordinates:{required:!0,type:`array`,length:4,value:{type:`array`,length:2,value:`number`}}},source_image:{type:{required:!0,type:`enum`,values:{image:{}}},url:{required:!0,type:`string`},coordinates:{required:!0,type:`array`,length:4,value:{type:`array`,length:2,value:`number`}}},layer:{id:{type:`string`,required:!0},type:{type:`enum`,values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:`*`},source:{type:`string`},"source-layer":{type:`string`},minzoom:{type:`number`,minimum:0,maximum:24},maxzoom:{type:`number`,minimum:0,maximum:24},filter:{type:`filter`},layout:{type:`layout`},paint:{type:`paint`}},layout:[`layout_fill`,`layout_line`,`layout_circle`,`layout_heatmap`,`layout_fill-extrusion`,`layout_symbol`,`layout_raster`,`layout_hillshade`,`layout_background`],layout_background:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_fill:{"fill-sort-key":{type:`number`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_circle:{"circle-sort-key":{type:`number`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_heatmap:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},"layout_fill-extrusion":{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_line:{"line-cap":{type:`enum`,values:{butt:{},round:{},square:{}},default:`butt`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"line-join":{type:`enum`,values:{bevel:{},round:{},miter:{}},default:`miter`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"line-miter-limit":{type:`number`,default:2,requires:[{"line-join":`miter`}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"line-round-limit":{type:`number`,default:1.05,requires:[{"line-join":`round`}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"line-sort-key":{type:`number`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_symbol:{"symbol-placement":{type:`enum`,values:{point:{},line:{},"line-center":{}},default:`point`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"symbol-spacing":{type:`number`,default:250,minimum:1,units:`pixels`,requires:[{"symbol-placement":`line`}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"symbol-avoid-edges":{type:`boolean`,default:!1,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"symbol-sort-key":{type:`number`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"symbol-z-order":{type:`enum`,values:{auto:{},"viewport-y":{},source:{}},default:`auto`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-allow-overlap":{type:`boolean`,default:!1,requires:[`icon-image`,{"!":`icon-overlap`}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-overlap":{type:`enum`,values:{never:{},always:{},cooperative:{}},requires:[`icon-image`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-ignore-placement":{type:`boolean`,default:!1,requires:[`icon-image`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-optional":{type:`boolean`,default:!1,requires:[`icon-image`,`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-rotation-alignment":{type:`enum`,values:{map:{},viewport:{},auto:{}},default:`auto`,requires:[`icon-image`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-size":{type:`number`,default:1,minimum:0,units:`factor of the original icon size`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-text-fit":{type:`enum`,values:{none:{},width:{},height:{},both:{}},default:`none`,requires:[`icon-image`,`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-text-fit-padding":{type:`array`,value:`number`,length:4,default:[0,0,0,0],units:`pixels`,requires:[`icon-image`,`text-field`,{"icon-text-fit":[`both`,`width`,`height`]}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"icon-image":{type:`resolvedImage`,tokens:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-rotate":{type:`number`,default:0,period:360,units:`degrees`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-padding":{type:`padding`,default:[2],units:`pixels`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-keep-upright":{type:`boolean`,default:!1,requires:[`icon-image`,{"icon-rotation-alignment":`map`},{"symbol-placement":[`line`,`line-center`]}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-offset":{type:`array`,value:`number`,length:2,default:[0,0],requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-anchor":{type:`enum`,values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:`center`,requires:[`icon-image`],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-pitch-alignment":{type:`enum`,values:{map:{},viewport:{},auto:{}},default:`auto`,requires:[`icon-image`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-pitch-alignment":{type:`enum`,values:{map:{},viewport:{},auto:{}},default:`auto`,requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-rotation-alignment":{type:`enum`,values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:`auto`,requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-field":{type:`formatted`,default:``,tokens:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-font":{type:`array`,value:`string`,default:[`Open Sans Regular`,`Arial Unicode MS Regular`],requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-size":{type:`number`,default:16,minimum:0,units:`pixels`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-max-width":{type:`number`,default:10,minimum:0,units:`ems`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-line-height":{type:`number`,default:1.2,units:`ems`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"text-letter-spacing":{type:`number`,default:0,units:`ems`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-justify":{type:`enum`,values:{auto:{},left:{},center:{},right:{}},default:`center`,requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-radial-offset":{type:`number`,units:`ems`,default:0,requires:[`text-field`],"property-type":`data-driven`,expression:{interpolated:!0,parameters:[`zoom`,`feature`]}},"text-variable-anchor":{type:`array`,value:`enum`,values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:[`text-field`,{"symbol-placement":[`point`]}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-variable-anchor-offset":{type:`variableAnchorOffsetCollection`,requires:[`text-field`,{"symbol-placement":[`point`]}],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-anchor":{type:`enum`,values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:`center`,requires:[`text-field`,{"!":`text-variable-anchor`}],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-max-angle":{type:`number`,default:45,units:`degrees`,requires:[`text-field`,{"symbol-placement":[`line`,`line-center`]}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"text-writing-mode":{type:`array`,value:`enum`,values:{horizontal:{},vertical:{}},requires:[`text-field`,{"symbol-placement":[`point`]}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-rotate":{type:`number`,default:0,period:360,units:`degrees`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-padding":{type:`number`,default:2,minimum:0,units:`pixels`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"text-keep-upright":{type:`boolean`,default:!0,requires:[`text-field`,{"text-rotation-alignment":`map`},{"symbol-placement":[`line`,`line-center`]}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-transform":{type:`enum`,values:{none:{},uppercase:{},lowercase:{}},default:`none`,requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-offset":{type:`array`,value:`number`,units:`ems`,length:2,default:[0,0],requires:[`text-field`,{"!":`text-radial-offset`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"text-allow-overlap":{type:`boolean`,default:!1,requires:[`text-field`,{"!":`text-overlap`}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-overlap":{type:`enum`,values:{never:{},always:{},cooperative:{}},requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-ignore-placement":{type:`boolean`,default:!1,requires:[`text-field`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-optional":{type:`boolean`,default:!1,requires:[`text-field`,`icon-image`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_raster:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},layout_hillshade:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`}},filter:{type:`array`,value:`*`},filter_operator:{type:`enum`,values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:`enum`,values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:`expression`},stops:{type:`array`,value:`function_stop`},base:{type:`number`,default:1,minimum:0},property:{type:`string`,default:`$zoom`},type:{type:`enum`,values:{identity:{},exponential:{},interval:{},categorical:{}},default:`exponential`},colorSpace:{type:`enum`,values:{rgb:{},lab:{},hcl:{}},default:`rgb`},default:{type:`*`,required:!1}},function_stop:{type:`array`,minimum:0,maximum:24,value:[`number`,`color`],length:2},expression:{type:`array`,value:`*`,minimum:1},light:{anchor:{type:`enum`,default:`viewport`,values:{map:{},viewport:{}},"property-type":`data-constant`,transition:!1,expression:{interpolated:!1,parameters:[`zoom`]}},position:{type:`array`,default:[1.15,210,30],length:3,value:`number`,"property-type":`data-constant`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]}},color:{type:`color`,"property-type":`data-constant`,default:`#ffffff`,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},intensity:{type:`number`,"property-type":`data-constant`,default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0}},sky:{"sky-color":{type:`color`,"property-type":`data-constant`,default:`#88C6FC`,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"horizon-color":{type:`color`,"property-type":`data-constant`,default:`#ffffff`,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"fog-color":{type:`color`,"property-type":`data-constant`,default:`#ffffff`,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"fog-ground-blend":{type:`number`,"property-type":`data-constant`,default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"horizon-fog-blend":{type:`number`,"property-type":`data-constant`,default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"sky-horizon-blend":{type:`number`,"property-type":`data-constant`,default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"atmosphere-blend":{type:`number`,"property-type":`data-constant`,default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0}},terrain:{source:{type:`string`,required:!0},exaggeration:{type:`number`,minimum:0,default:1}},projection:{type:{type:`enum`,default:`mercator`,values:{mercator:{},globe:{}}}},paint:[`paint_fill`,`paint_line`,`paint_circle`,`paint_heatmap`,`paint_fill-extrusion`,`paint_symbol`,`paint_raster`,`paint_hillshade`,`paint_background`],paint_fill:{"fill-antialias":{type:`boolean`,default:!0,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"fill-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`fill-pattern`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-outline-color":{type:`color`,transition:!0,requires:[{"!":`fill-pattern`},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"fill-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`fill-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"fill-pattern":{type:`resolvedImage`,transition:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`cross-faded-data-driven`}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"fill-extrusion-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`fill-extrusion-pattern`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-extrusion-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"fill-extrusion-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`fill-extrusion-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"fill-extrusion-pattern":{type:`resolvedImage`,transition:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`cross-faded-data-driven`},"fill-extrusion-height":{type:`number`,default:0,minimum:0,units:`meters`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-extrusion-base":{type:`number`,default:0,minimum:0,units:`meters`,transition:!0,requires:[`fill-extrusion-height`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-extrusion-vertical-gradient":{type:`boolean`,default:!0,transition:!1,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`}},paint_line:{"line-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`line-pattern`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"line-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`line-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"line-width":{type:`number`,default:1,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-gap-width":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-offset":{type:`number`,default:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-blur":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-dasharray":{type:`array`,value:`number`,minimum:0,transition:!0,units:`line widths`,requires:[{"!":`line-pattern`}],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`cross-faded`},"line-pattern":{type:`resolvedImage`,transition:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`cross-faded-data-driven`},"line-gradient":{type:`color`,transition:!1,requires:[{"!":`line-dasharray`},{"!":`line-pattern`},{source:`geojson`,has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:[`line-progress`]},"property-type":`color-ramp`}},paint_circle:{"circle-radius":{type:`number`,default:5,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-color":{type:`color`,default:`#000000`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-blur":{type:`number`,default:0,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"circle-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`circle-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"circle-pitch-scale":{type:`enum`,values:{map:{},viewport:{}},default:`map`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"circle-pitch-alignment":{type:`enum`,values:{map:{},viewport:{}},default:`viewport`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"circle-stroke-width":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-stroke-color":{type:`color`,default:`#000000`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"circle-stroke-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`}},paint_heatmap:{"heatmap-radius":{type:`number`,default:30,minimum:1,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"heatmap-weight":{type:`number`,default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"heatmap-intensity":{type:`number`,default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"heatmap-color":{type:`color`,default:[`interpolate`,[`linear`],[`heatmap-density`],0,`rgba(0, 0, 255, 0)`,.1,`royalblue`,.3,`cyan`,.5,`lime`,.7,`yellow`,1,`red`],transition:!1,expression:{interpolated:!0,parameters:[`heatmap-density`]},"property-type":`color-ramp`},"heatmap-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`}},paint_symbol:{"icon-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"icon-color":{type:`color`,default:`#000000`,transition:!0,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"icon-halo-color":{type:`color`,default:`rgba(0, 0, 0, 0)`,transition:!0,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"icon-halo-width":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"icon-halo-blur":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"icon-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"icon-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`icon-image`,`icon-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"text-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"text-color":{type:`color`,default:`#000000`,transition:!0,overridable:!0,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"text-halo-color":{type:`color`,default:`rgba(0, 0, 0, 0)`,transition:!0,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"text-halo-width":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"text-halo-blur":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"text-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,requires:[`text-field`],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"text-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`text-field`,`text-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`}},paint_raster:{"raster-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-hue-rotate":{type:`number`,default:0,period:360,transition:!0,units:`degrees`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-brightness-min":{type:`number`,default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-brightness-max":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-saturation":{type:`number`,default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-contrast":{type:`number`,default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"raster-resampling":{type:`enum`,values:{linear:{},nearest:{}},default:`linear`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"raster-fade-duration":{type:`number`,default:300,minimum:0,transition:!1,units:`milliseconds`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`}},paint_hillshade:{"hillshade-illumination-direction":{type:`number`,default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-illumination-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`viewport`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-exaggeration":{type:`number`,default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-shadow-color":{type:`color`,default:`#000000`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-highlight-color":{type:`color`,default:`#FFFFFF`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-accent-color":{type:`color`,default:`#000000`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`}},paint_background:{"background-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`background-pattern`}],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"background-pattern":{type:`resolvedImage`,transition:!0,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`cross-faded`},"background-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`}},transition:{duration:{type:`number`,default:300,minimum:0,units:`milliseconds`},delay:{type:`number`,default:0,minimum:0,units:`milliseconds`}},"property-type":{"data-driven":{type:`property-type`},"cross-faded":{type:`property-type`},"cross-faded-data-driven":{type:`property-type`},"color-ramp":{type:`property-type`},"data-constant":{type:`property-type`},constant:{type:`property-type`}},promoteId:{"*":{type:`string`}}};let pe=[`type`,`source`,`source-layer`,`minzoom`,`maxzoom`,`filter`,`layout`];function me(e,t){let n={};for(let t in e)t!==`ref`&&(n[t]=e[t]);return pe.forEach((e=>{e in t&&(n[e]=t[e])})),n}function P(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!P(e[n],t[n]))return!1;return!0}if(typeof e==`object`&&e&&t!==null){if(typeof t!=`object`||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(!P(e[n],t[n]))return!1;return!0}return e===t}function he(e,t){e.push(t)}function ge(e,t,n){he(n,{command:`addSource`,args:[e,t[e]]})}function _e(e,t,n){he(t,{command:`removeSource`,args:[e]}),n[e]=!0}function ve(e,t,n,r){_e(e,n,r),ge(e,t,n)}function ye(e,t,n){let r;for(r in e[n])if(Object.prototype.hasOwnProperty.call(e[n],r)&&r!==`data`&&!P(e[n][r],t[n][r]))return!1;for(r in t[n])if(Object.prototype.hasOwnProperty.call(t[n],r)&&r!==`data`&&!P(e[n][r],t[n][r]))return!1;return!0}function be(e,t,n,r,i,a){e||={},t||={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(P(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}));for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&!Object.prototype.hasOwnProperty.call(e,o)&&(P(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}))}function xe(e){return e.id}function Se(e,t){return e[t.id]=t,e}class F{constructor(e,t,n,r){this.message=(e?`${e}: `:``)+n,r&&(this.identifier=r),t!=null&&t.__line__&&(this.line=t.__line__)}}function Ce(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}class we extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Te{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[e,n]of t)this.bindings[e]=n}concat(e){return new Te(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let Ee={kind:`null`},I={kind:`number`},L={kind:`string`},R={kind:`boolean`},De={kind:`color`},Oe={kind:`object`},z={kind:`value`},ke={kind:`collator`},Ae={kind:`formatted`},je={kind:`padding`},Me={kind:`resolvedImage`},Ne={kind:`variableAnchorOffsetCollection`};function Pe(e,t){return{kind:`array`,itemType:e,N:t}}function Fe(e){if(e.kind===`array`){let t=Fe(e.itemType);return typeof e.N==`number`?`array<${t}, ${e.N}>`:e.itemType.kind===`value`?`array`:`array<${t}>`}return e.kind}let Ie=[Ee,I,L,R,De,Ae,Oe,Pe(z),je,Me,Ne];function Le(e,t){if(t.kind===`error`)return null;if(e.kind===`array`){if(t.kind===`array`&&(t.N===0&&t.itemType.kind===`value`||!Le(e.itemType,t.itemType))&&(typeof e.N!=`number`||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind===`value`){for(let e of Ie)if(!Le(e,t))return null}}return`Expected ${Fe(e)} but found ${Fe(t)} instead.`}function Re(e,t){return t.some((t=>t.kind===e.kind))}function ze(e,t){return t.some((t=>t===`null`?e===null:t===`array`?Array.isArray(e):t===`object`?e&&!Array.isArray(e)&&typeof e==`object`:t===typeof e))}function Be(e,t){return e.kind===`array`&&t.kind===`array`?e.itemType.kind===t.itemType.kind&&typeof e.N==`number`:e.kind===t.kind}let Ve=.96422,He=.82521,Ue=4/29,We=6/29,Ge=3*We*We,Ke=Math.PI/180,qe=180/Math.PI;function Je(e){return(e%=360)<0&&(e+=360),e}function Ye([e,t,n,r]){let i,a,o=Ze((.2225045*(e=Xe(e))+.7168786*(t=Xe(t))+.0606169*(n=Xe(n)))/1);e===t&&t===n?i=a=o:(i=Ze((.4360747*e+.3850649*t+.1430804*n)/Ve),a=Ze((.0139322*e+.0971045*t+.7141733*n)/He));let s=116*o-16;return[s<0?0:s,500*(i-o),200*(o-a),r]}function Xe(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Ze(e){return e>.008856451679035631?e**(1/3):e/Ge+Ue}function Qe([e,t,n,r]){let i=(e+16)/116,a=isNaN(t)?i:i+t/500,o=isNaN(n)?i:i-n/200;return i=1*et(i),a=Ve*et(a),o=He*et(o),[$e(3.1338561*a-1.6168667*i-.4906146*o),$e(-.9787684*a+1.9161415*i+.033454*o),$e(.0719453*a-.2289914*i+1.4052427*o),r]}function $e(e){return(e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055)<0?0:e>1?1:e}function et(e){return e>We?e*e*e:Ge*(e-Ue)}function tt(e){return parseInt(e.padEnd(2,e),16)/255}function nt(e,t){return rt(t?e/100:e,0,1)}function rt(e,t,n){return Math.min(Math.max(t,e),n)}function it(e){return!e.some(Number.isNaN)}let at={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class B{constructor(e,t,n,r=1,i=!0){this.r=e,this.g=t,this.b=n,this.a=r,i||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter(`rgb`,[e,t,n,r]))}static parse(e){if(e instanceof B)return e;if(typeof e!=`string`)return;let t=function(e){if((e=e.toLowerCase().trim())===`transparent`)return[0,0,0,0];let t=at[e];if(t){let[e,n,r]=t;return[e/255,n/255,r/255,1]}if(e.startsWith(`#`)&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let t=e.length<6?1:2,n=1;return[tt(e.slice(n,n+=t)),tt(e.slice(n,n+=t)),tt(e.slice(n,n+=t)),tt(e.slice(n,n+t)||`ff`)]}if(e.startsWith(`rgb`)){let t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){let[e,n,r,i,a,o,s,c,l,u,d,f]=t,p=[i||` `,s||` `,u].join(``);if(p===` `||p===` /`||p===`,,`||p===`,,,`){let e=[r,o,l].join(``),t=e===`%%%`?100:e===``?255:0;if(t){let e=[rt(+n/t,0,1),rt(+a/t,0,1),rt(+c/t,0,1),d?nt(+d,f):1];if(it(e))return e}}return}}let n=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){let[e,t,r,i,a,o,s,c,l]=n,u=[r||` `,a||` `,s].join(``);if(u===` `||u===` /`||u===`,,`||u===`,,,`){let e=[+t,rt(+i,0,100),rt(+o,0,100),c?nt(+c,l):1];if(it(e))return function([e,t,n,r]){function i(r){let i=(r+e/30)%12,a=t*Math.min(n,1-n);return n-a*Math.max(-1,Math.min(i-3,9-i,1))}return e=Je(e),t/=100,n/=100,[i(0),i(8),i(4),r]}(e)}}}(e);return t?new B(...t,!1):void 0}get rgb(){let{r:e,g:t,b:n,a:r}=this,i=r||1/0;return this.overwriteGetter(`rgb`,[e/i,t/i,n/i,r])}get hcl(){return this.overwriteGetter(`hcl`,function(e){let[t,n,r,i]=Ye(e),a=Math.sqrt(n*n+r*r);return[Math.round(1e4*a)?Je(Math.atan2(r,n)*qe):NaN,a,t,i]}(this.rgb))}get lab(){return this.overwriteGetter(`lab`,Ye(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,n,r]=this.rgb;return`rgba(${[e,t,n].map((e=>Math.round(255*e))).join(`,`)},${r})`}}B.black=new B(0,0,0,1),B.white=new B(1,1,1,1),B.transparent=new B(0,0,0,0),B.red=new B(1,0,0,1);class ot{constructor(e,t,n){this.sensitivity=e?t?`variant`:`case`:t?`accent`:`base`,this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:`search`})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class st{constructor(e,t,n,r,i){this.text=e,this.image=t,this.scale=n,this.fontStack=r,this.textColor=i}}class ct{constructor(e){this.sections=e}static fromString(e){return new ct([new st(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof ct?e:ct.fromString(e)}toString(){return this.sections.length===0?``:this.sections.map((e=>e.text)).join(``)}}class lt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof lt)return e;if(typeof e==`number`)return new lt([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if(typeof t!=`number`)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new lt(e)}}toString(){return JSON.stringify(this.values)}}let ut=new Set([`center`,`left`,`right`,`top`,`bottom`,`top-left`,`top-right`,`bottom-left`,`bottom-right`]);class dt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof dt)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){let n=e[t],r=e[t+1];if(typeof n!=`string`||!ut.has(n)||!Array.isArray(r)||r.length!==2||typeof r[0]!=`number`||typeof r[1]!=`number`)return}return new dt(e)}}toString(){return JSON.stringify(this.values)}}class ft{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new ft({name:e,available:!1}):null}}function pt(e,t,n,r){return typeof e==`number`&&e>=0&&e<=255&&typeof t==`number`&&t>=0&&t<=255&&typeof n==`number`&&n>=0&&n<=255?r===void 0||typeof r==`number`&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,n,r].join(`, `)}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r==`number`?[e,t,n,r]:[e,t,n]).join(`, `)}]: 'r', 'g', and 'b' must be between 0 and 255.`}function mt(e){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`||e instanceof B||e instanceof ot||e instanceof ct||e instanceof lt||e instanceof dt||e instanceof ft)return!0;if(Array.isArray(e)){for(let t of e)if(!mt(t))return!1;return!0}if(typeof e==`object`){for(let t in e)if(!mt(e[t]))return!1;return!0}return!1}function ht(e){if(e===null)return Ee;if(typeof e==`string`)return L;if(typeof e==`boolean`)return R;if(typeof e==`number`)return I;if(e instanceof B)return De;if(e instanceof ot)return ke;if(e instanceof ct)return Ae;if(e instanceof lt)return je;if(e instanceof dt)return Ne;if(e instanceof ft)return Me;if(Array.isArray(e)){let t=e.length,n;for(let t of e){let e=ht(t);if(n){if(n===e)continue;n=z;break}n=e}return Pe(n||z,t)}return Oe}function gt(e){let t=typeof e;return e===null?``:t===`string`||t===`number`||t===`boolean`?String(e):e instanceof B||e instanceof ct||e instanceof lt||e instanceof dt||e instanceof ft?e.toString():JSON.stringify(e)}class _t{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!mt(e[1]))return t.error(`invalid value`);let n=e[1],r=ht(n),i=t.expectedType;return r.kind!==`array`||r.N!==0||!i||i.kind!==`array`||typeof i.N==`number`&&i.N!==0||(r=i),new _t(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class vt{constructor(e){this.name=`ExpressionEvaluationError`,this.message=e}toJSON(){return this.message}}let yt={string:L,number:I,boolean:R,object:Oe};class bt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n,r=1,i=e[0];if(i===`array`){let i,a;if(e.length>2){let n=e[1];if(typeof n!=`string`||!(n in yt)||n===`object`)return t.error(`The item type argument of "array" must be one of string, number, boolean`,1);i=yt[n],r++}else i=z;if(e.length>3){if(e[2]!==null&&(typeof e[2]!=`number`||e[2]<0||e[2]!==Math.floor(e[2])))return t.error(`The length argument to "array" must be a positive integer literal`,2);a=e[2],r++}n=Pe(i,a)}else{if(!yt[i])throw Error(`Types doesn't contain name = ${i}`);n=yt[i]}let a=[];for(;r<e.length;r++){let n=t.parse(e[r],r,z);if(!n)return null;a.push(n)}return new bt(n,a)}evaluate(e){for(let t=0;t<this.args.length;t++){let n=this.args[t].evaluate(e);if(!Le(this.type,ht(n)))return n;if(t===this.args.length-1)throw new vt(`Expected value to be of type ${Fe(this.type)}, but found ${Fe(ht(n))} instead.`)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let xt={"to-boolean":R,"to-color":De,"to-number":I,"to-string":L};class St{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[0];if(!xt[n])throw Error(`Can't parse ${n} as it is not part of the known types`);if((n===`to-boolean`||n===`to-string`)&&e.length!==2)return t.error(`Expected one argument.`);let r=xt[n],i=[];for(let n=1;n<e.length;n++){let r=t.parse(e[n],n,z);if(!r)return null;i.push(r)}return new St(r,i)}evaluate(e){switch(this.type.kind){case`boolean`:return!!this.args[0].evaluate(e);case`color`:{let t,n;for(let r of this.args){if(t=r.evaluate(e),n=null,t instanceof B)return t;if(typeof t==`string`){let n=e.parseColor(t);if(n)return n}else if(Array.isArray(t)&&(n=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:pt(t[0],t[1],t[2],t[3]),!n))return new B(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new vt(n||`Could not parse color from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`padding`:{let t;for(let n of this.args){t=n.evaluate(e);let r=lt.parse(t);if(r)return r}throw new vt(`Could not parse padding from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`variableAnchorOffsetCollection`:{let t;for(let n of this.args){t=n.evaluate(e);let r=dt.parse(t);if(r)return r}throw new vt(`Could not parse variableAnchorOffsetCollection from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`number`:{let t=null;for(let n of this.args){if(t=n.evaluate(e),t===null)return 0;let r=Number(t);if(!isNaN(r))return r}throw new vt(`Could not convert ${JSON.stringify(t)} to number.`)}case`formatted`:return ct.fromString(gt(this.args[0].evaluate(e)));case`resolvedImage`:return ft.fromString(gt(this.args[0].evaluate(e)));default:return gt(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let Ct=[`Unknown`,`Point`,`LineString`,`Polygon`];class V{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&`id`in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type==`number`?Ct[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&`geometry`in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache[e];return t||=this._parseColorCache[e]=B.parse(e),t}}class wt{constructor(e,t,n=[],r,i=new Te,a=[]){this.registry=e,this.path=n,this.key=n.map((e=>`[${e}]`)).join(``),this.scope=i,this.errors=a,this.expectedType=r,this._isConstant=t}parse(e,t,n,r,i={}){return t?this.concat(t,n,r)._parse(e,i):this._parse(e,i)}_parse(e,t){function n(e,t,n){return n===`assert`?new bt(t,[e]):n===`coerce`?new St(t,[e]):e}if(e!==null&&typeof e!=`string`&&typeof e!=`boolean`&&typeof e!=`number`||(e=[`literal`,e]),Array.isArray(e)){if(e.length===0)return this.error(`Expected an array with at least one element. If you wanted a literal array, use ["literal", []].`);let r=e[0];if(typeof r!=`string`)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let i=this.registry[r];if(i){let r=i.parse(e,this);if(!r)return null;if(this.expectedType){let e=this.expectedType,i=r.type;if(e.kind!==`string`&&e.kind!==`number`&&e.kind!==`boolean`&&e.kind!==`object`&&e.kind!==`array`||i.kind!==`value`)if(e.kind!==`color`&&e.kind!==`formatted`&&e.kind!==`resolvedImage`||i.kind!==`value`&&i.kind!==`string`)if(e.kind!==`padding`||i.kind!==`value`&&i.kind!==`number`&&i.kind!==`array`)if(e.kind!==`variableAnchorOffsetCollection`||i.kind!==`value`&&i.kind!==`array`){if(this.checkSubtype(e,i))return null}else r=n(r,e,t.typeAnnotation||`coerce`);else r=n(r,e,t.typeAnnotation||`coerce`);else r=n(r,e,t.typeAnnotation||`coerce`);else r=n(r,e,t.typeAnnotation||`assert`)}if(!(r instanceof _t)&&r.type.kind!==`resolvedImage`&&this._isConstant(r)){let e=new V;try{r=new _t(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?`'undefined' value invalid. Use null instead.`:typeof e==`object`?`Bare objects invalid. Use ["literal", {...}] instead.`:`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){let r=typeof e==`number`?this.path.concat(e):this.path,i=n?this.scope.concat(n):this.scope;return new wt(this.registry,this._isConstant,r,t||null,i,this.errors)}error(e,...t){let n=`${this.key}${t.map((e=>`[${e}]`)).join(``)}`;this.errors.push(new we(n,e))}checkSubtype(e,t){let n=Le(e,t);return n&&this.error(n),n}}class Tt{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let r=1;r<e.length-1;r+=2){let i=e[r];if(typeof i!=`string`)return t.error(`Expected string, but found ${typeof i} instead.`,r);if(/[^a-zA-Z0-9_]/.test(i))return t.error(`Variable names must contain only alphanumeric characters or '_'.`,r);let a=t.parse(e[r+1],r+1);if(!a)return null;n.push([i,a])}let r=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return r?new Tt(n,r):null}outputDefined(){return this.result.outputDefined()}}class Et{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!=`string`)return t.error(`'var' expression requires exactly one string literal argument.`);let n=e[1];return t.scope.has(n)?new Et(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Dt{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,I),r=t.parse(e[2],2,Pe(t.expectedType||z));return n&&r?new Dt(r.type.itemType,n,r):null}evaluate(e){let t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new vt(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new vt(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new vt(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Ot{constructor(e,t){this.type=R,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,z);return n&&r?Re(n.type,[R,L,I,Ee,z])?new Ot(n,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(n.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!ze(t,[`boolean`,`string`,`number`,`null`]))throw new vt(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(ht(t))} instead.`);if(!ze(n,[`string`,`array`]))throw new vt(`Expected second argument to be of type array or string, but found ${Fe(ht(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class kt{constructor(e,t,n){this.type=I,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,z);if(!n||!r)return null;if(!Re(n.type,[R,L,I,Ee,z]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,I);return i?new kt(n,r,i):null}return new kt(n,r)}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!ze(t,[`boolean`,`string`,`number`,`null`]))throw new vt(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(ht(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),ze(n,[`string`])){let e=n.indexOf(t,r);return e===-1?-1:[...n.slice(0,e)].length}if(ze(n,[`array`]))return n.indexOf(t,r);throw new vt(`Expected second argument to be of type array or string, but found ${Fe(ht(n))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class At{constructor(e,t,n,r,i,a){this.inputType=e,this.type=t,this.input=n,this.cases=r,this.outputs=i,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error(`Expected an even number of arguments.`);let n,r;t.expectedType&&t.expectedType.kind!==`value`&&(r=t.expectedType);let i={},a=[];for(let o=2;o<e.length-1;o+=2){let s=e[o],c=e[o+1];Array.isArray(s)||(s=[s]);let l=t.concat(o);if(s.length===0)return l.error(`Expected at least one branch label.`);for(let e of s){if(typeof e!=`number`&&typeof e!=`string`)return l.error(`Branch labels must be numbers or strings.`);if(typeof e==`number`&&Math.abs(e)>2**53-1)return l.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof e==`number`&&Math.floor(e)!==e)return l.error(`Numeric branch labels must be integer values.`);if(n){if(l.checkSubtype(n,ht(e)))return null}else n=ht(e);if(i[String(e)]!==void 0)return l.error(`Branch labels must be unique.`);i[String(e)]=a.length}let u=t.parse(c,o,r);if(!u)return null;r||=u.type,a.push(u)}let o=t.parse(e[1],1,z);if(!o)return null;let s=t.parse(e[e.length-1],e.length-1,r);return s?o.type.kind!==`value`&&t.concat(1).checkSubtype(n,o.type)?null:new At(n,r,o,i,a,s):null}evaluate(e){let t=this.input.evaluate(e);return(ht(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class jt{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error(`Expected an odd number of arguments.`);let n;t.expectedType&&t.expectedType.kind!==`value`&&(n=t.expectedType);let r=[];for(let i=1;i<e.length-1;i+=2){let a=t.parse(e[i],i,R);if(!a)return null;let o=t.parse(e[i+1],i+1,n);if(!o)return null;r.push([a,o]),n||=o.type}let i=t.parse(e[e.length-1],e.length-1,n);if(!i)return null;if(!n)throw Error(`Can't infer output type`);return new jt(n,r,i)}evaluate(e){for(let[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}}class Mt{constructor(e,t,n,r){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,I);if(!n||!r)return null;if(!Re(n.type,[Pe(z),L,z]))return t.error(`Expected first argument to be of type array or string, but found ${Fe(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,I);return i?new Mt(n.type,n,r,i):null}return new Mt(n.type,n,r)}evaluate(e){let t=this.input.evaluate(e),n=this.beginIndex.evaluate(e),r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),ze(t,[`string`]))return[...t].slice(n,r).join(``);if(ze(t,[`array`]))return t.slice(n,r);throw new vt(`Expected first argument to be of type array or string, but found ${Fe(ht(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Nt(e,t){let n=e.length-1,r,i,a=0,o=n,s=0;for(;a<=o;)if(s=Math.floor((a+o)/2),r=e[s],i=e[s+1],r<=t){if(s===n||t<i)return s;a=s+1}else{if(!(r>t))throw new vt(`Input is not a number.`);o=s-1}return 0}class Pt{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[e,t]of n)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);let n=t.parse(e[1],1,I);if(!n)return null;let r=[],i=null;t.expectedType&&t.expectedType.kind!==`value`&&(i=t.expectedType);for(let n=1;n<e.length;n+=2){let a=n===1?-1/0:e[n],o=e[n+1],s=n,c=n+1;if(typeof a!=`number`)return t.error(`Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.`,s);if(r.length&&r[r.length-1][0]>=a)return t.error(`Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.`,s);let l=t.parse(o,c,i);if(!l)return null;i||=l.type,r.push([a,l])}return new Pt(i,n,r)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;return r>=t[i-1]?n[i-1].evaluate(e):n[Nt(t,r)].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Ft(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var It=Lt;function Lt(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}Lt.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,r=0;r<8;r++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)<t)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n-=i/a}var o=0,s=1;for(n=e,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-e)<t));r++)e>i?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var Rt=Ft(It);function zt(e,t,n){return e+n*(t-e)}function Bt(e,t,n){return e.map(((e,r)=>zt(e,t[r],n)))}let Vt={number:zt,color:function(e,t,n,r=`rgb`){switch(r){case`rgb`:{let[r,i,a,o]=Bt(e.rgb,t.rgb,n);return new B(r,i,a,o,!1)}case`hcl`:{let[r,i,a,o]=e.hcl,[s,c,l,u]=t.hcl,d,f;if(isNaN(r)||isNaN(s))isNaN(r)?isNaN(s)?d=NaN:(d=s,a!==1&&a!==0||(f=c)):(d=r,l!==1&&l!==0||(f=i));else{let e=s-r;s>r&&e>180?e-=360:s<r&&r-s>180&&(e+=360),d=r+n*e}let[p,m,h,g]=function([e,t,n,r]){return e=isNaN(e)?0:e*Ke,Qe([n,Math.cos(e)*t,Math.sin(e)*t,r])}([d,f??zt(i,c,n),zt(a,l,n),zt(o,u,n)]);return new B(p,m,h,g,!1)}case`lab`:{let[r,i,a,o]=Qe(Bt(e.lab,t.lab,n));return new B(r,i,a,o,!1)}}},array:Bt,padding:function(e,t,n){return new lt(Bt(e.values,t.values,n))},variableAnchorOffsetCollection:function(e,t,n){let r=e.values,i=t.values;if(r.length!==i.length)throw new vt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);let a=[];for(let e=0;e<r.length;e+=2){if(r[e]!==i[e])throw new vt(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${r[e]}, to[${e}]: ${i[e]}`);a.push(r[e]);let[t,o]=r[e+1],[s,c]=i[e+1];a.push([zt(t,s,n),zt(o,c,n)])}return new dt(a)}};class Ht{constructor(e,t,n,r,i){this.type=e,this.operator=t,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(let[e,t]of i)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,n,r){let i=0;if(e.name===`exponential`)i=Ut(t,e.base,n,r);else if(e.name===`linear`)i=Ut(t,1,n,r);else if(e.name===`cubic-bezier`){let a=e.controlPoints;i=new Rt(a[0],a[1],a[2],a[3]).solve(Ut(t,1,n,r))}return i}static parse(e,t){let[n,r,i,...a]=e;if(!Array.isArray(r)||r.length===0)return t.error(`Expected an interpolation type expression.`,1);if(r[0]===`linear`)r={name:`linear`};else if(r[0]===`exponential`){let e=r[1];if(typeof e!=`number`)return t.error(`Exponential interpolation requires a numeric base.`,1,1);r={name:`exponential`,base:e}}else{if(r[0]!==`cubic-bezier`)return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{let e=r.slice(1);if(e.length!==4||e.some((e=>typeof e!=`number`||e<0||e>1)))return t.error(`Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.`,1);r={name:`cubic-bezier`,controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);if(i=t.parse(i,2,I),!i)return null;let o=[],s=null;n===`interpolate-hcl`||n===`interpolate-lab`?s=De:t.expectedType&&t.expectedType.kind!==`value`&&(s=t.expectedType);for(let e=0;e<a.length;e+=2){let n=a[e],r=a[e+1],i=e+3,c=e+4;if(typeof n!=`number`)return t.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]>=n)return t.error(`Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.`,i);let l=t.parse(r,c,s);if(!l)return null;s||=l.type,o.push([n,l])}return Be(s,I)||Be(s,De)||Be(s,je)||Be(s,Ne)||Be(s,Pe(I))?new Ht(s,n,r,i,o):t.error(`Type ${Fe(s)} is not interpolatable.`)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;if(r>=t[i-1])return n[i-1].evaluate(e);let a=Nt(t,r),o=Ht.interpolationFactor(this.interpolation,r,t[a],t[a+1]),s=n[a].evaluate(e),c=n[a+1].evaluate(e);switch(this.operator){case`interpolate`:return Vt[this.type.kind](s,c,o);case`interpolate-hcl`:return Vt.color(s,c,o,`hcl`);case`interpolate-lab`:return Vt.color(s,c,o,`lab`)}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Ut(e,t,n,r){let i=r-n,a=e-n;return i===0?0:t===1?a/i:(t**+a-1)/(t**+i-1)}class Wt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expectected at least one argument.`);let n=null,r=t.expectedType;r&&r.kind!==`value`&&(n=r);let i=[];for(let r of e.slice(1)){let e=t.parse(r,1+i.length,n,void 0,{typeAnnotation:`omit`});if(!e)return null;n||=e.type,i.push(e)}if(!n)throw Error(`No output type`);let a=r&&i.some((e=>Le(r,e.type)));return new Wt(a?z:n,i)}evaluate(e){let t,n=null,r=0;for(let i of this.args)if(r++,n=i.evaluate(e),n&&n instanceof ft&&!n.available&&(t||=n.name,n=null,r===this.args.length&&(n=t)),n!==null)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Gt(e,t){return e===`==`||e===`!=`?t.kind===`boolean`||t.kind===`string`||t.kind===`number`||t.kind===`null`||t.kind===`value`:t.kind===`string`||t.kind===`number`||t.kind===`value`}function Kt(e,t,n,r){return r.compare(t,n)===0}function qt(e,t,n){let r=e!==`==`&&e!==`!=`;return class i{constructor(e,t,n){this.type=R,this.lhs=e,this.rhs=t,this.collator=n,this.hasUntypedArgument=e.type.kind===`value`||t.type.kind===`value`}static parse(e,t){if(e.length!==3&&e.length!==4)return t.error(`Expected two or three arguments.`);let n=e[0],a=t.parse(e[1],1,z);if(!a)return null;if(!Gt(n,a.type))return t.concat(1).error(`"${n}" comparisons are not supported for type '${Fe(a.type)}'.`);let o=t.parse(e[2],2,z);if(!o)return null;if(!Gt(n,o.type))return t.concat(2).error(`"${n}" comparisons are not supported for type '${Fe(o.type)}'.`);if(a.type.kind!==o.type.kind&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot compare types '${Fe(a.type)}' and '${Fe(o.type)}'.`);r&&(a.type.kind===`value`&&o.type.kind!==`value`?a=new bt(o.type,[a]):a.type.kind!==`value`&&o.type.kind===`value`&&(o=new bt(a.type,[o])));let s=null;if(e.length===4){if(a.type.kind!==`string`&&o.type.kind!==`string`&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot use collator to compare non-string types.`);if(s=t.parse(e[3],3,ke),!s)return null}return new i(a,o,s)}evaluate(i){let a=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){let t=ht(a),n=ht(o);if(t.kind!==n.kind||t.kind!==`string`&&t.kind!==`number`)throw new vt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let e=ht(a),n=ht(o);if(e.kind!==`string`||n.kind!==`string`)return t(i,a,o)}return this.collator?n(i,a,o,this.collator.evaluate(i)):t(i,a,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}let Jt=qt(`==`,(function(e,t,n){return t===n}),Kt),Yt=qt(`!=`,(function(e,t,n){return t!==n}),(function(e,t,n,r){return!Kt(0,t,n,r)})),Xt=qt(`<`,(function(e,t,n){return t<n}),(function(e,t,n,r){return r.compare(t,n)<0})),Zt=qt(`>`,(function(e,t,n){return t>n}),(function(e,t,n,r){return r.compare(t,n)>0})),Qt=qt(`<=`,(function(e,t,n){return t<=n}),(function(e,t,n,r){return r.compare(t,n)<=0})),$t=qt(`>=`,(function(e,t,n){return t>=n}),(function(e,t,n,r){return r.compare(t,n)>=0}));class en{constructor(e,t,n){this.type=ke,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error(`Expected one argument.`);let n=e[1];if(typeof n!=`object`||Array.isArray(n))return t.error(`Collator options argument must be an object.`);let r=t.parse(n[`case-sensitive`]!==void 0&&n[`case-sensitive`],1,R);if(!r)return null;let i=t.parse(n[`diacritic-sensitive`]!==void 0&&n[`diacritic-sensitive`],1,R);if(!i)return null;let a=null;return n.locale&&(a=t.parse(n.locale,1,L),!a)?null:new en(r,i,a)}evaluate(e){return new ot(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class tn{constructor(e,t,n,r,i){this.type=L,this.number=e,this.locale=t,this.currency=n,this.minFractionDigits=r,this.maxFractionDigits=i}static parse(e,t){if(e.length!==3)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,I);if(!n)return null;let r=e[2];if(typeof r!=`object`||Array.isArray(r))return t.error(`NumberFormat options argument must be an object.`);let i=null;if(r.locale&&(i=t.parse(r.locale,1,L),!i))return null;let a=null;if(r.currency&&(a=t.parse(r.currency,1,L),!a))return null;let o=null;if(r[`min-fraction-digits`]&&(o=t.parse(r[`min-fraction-digits`],1,I),!o))return null;let s=null;return r[`max-fraction-digits`]&&(s=t.parse(r[`max-fraction-digits`],1,I),!s)?null:new tn(n,i,a,o,s)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?`currency`:`decimal`,currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class nn{constructor(e){this.type=Ae,this.sections=e}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[1];if(!Array.isArray(n)&&typeof n==`object`)return t.error(`First argument must be an image or text section.`);let r=[],i=!1;for(let n=1;n<=e.length-1;++n){let a=e[n];if(i&&typeof a==`object`&&!Array.isArray(a)){i=!1;let e=null;if(a[`font-scale`]&&(e=t.parse(a[`font-scale`],1,I),!e))return null;let n=null;if(a[`text-font`]&&(n=t.parse(a[`text-font`],1,Pe(L)),!n))return null;let o=null;if(a[`text-color`]&&(o=t.parse(a[`text-color`],1,De),!o))return null;let s=r[r.length-1];s.scale=e,s.font=n,s.textColor=o}else{let a=t.parse(e[n],1,z);if(!a)return null;let o=a.type.kind;if(o!==`string`&&o!==`value`&&o!==`null`&&o!==`resolvedImage`)return t.error(`Formatted text type must be 'string', 'value', 'image' or 'null'.`);i=!0,r.push({content:a,scale:null,font:null,textColor:null})}}return new nn(r)}evaluate(e){return new ct(this.sections.map((t=>{let n=t.content.evaluate(e);return ht(n)===Me?new st(``,n,null,null,null):new st(gt(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(`,`):null,t.textColor?t.textColor.evaluate(e):null)})))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}}class rn{constructor(e){this.type=Me,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,L);return n?new rn(n):t.error(`No image name provided.`)}evaluate(e){let t=this.input.evaluate(e),n=ft.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class an{constructor(e){this.type=I,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=t.parse(e[1],1);return n?n.type.kind!==`array`&&n.type.kind!==`string`&&n.type.kind!==`value`?t.error(`Expected argument of type string or array, but found ${Fe(n.type)} instead.`):new an(n):null}evaluate(e){let t=this.input.evaluate(e);if(typeof t==`string`)return[...t].length;if(Array.isArray(t))return t.length;throw new vt(`Expected value to be of type string or array, but found ${Fe(ht(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}let on=8192;function sn(e,t){let n=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,i=2**t.z;return[Math.round(n*i*on),Math.round(r*i*on)]}function H(e,t){let n=2**t.z;return[(i=(e[0]/on+t.x)/n,360*i-180),(r=(e[1]/on+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,i}function cn(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function ln(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function un(e,t,n){let r=e[0]-t[0],i=e[1]-t[1],a=e[0]-n[0],o=e[1]-n[1];return r*o-a*i==0&&r*a<=0&&i*o<=0}function dn(e,t,n,r){return(i=[r[0]-n[0],r[1]-n[1]])[0]*(a=[t[0]-e[0],t[1]-e[1]])[1]-i[1]*a[0]!=0&&!(!_n(e,t,n,r)||!_n(n,r,e,t));var i,a}function fn(e,t,n){for(let r of n)for(let n=0;n<r.length-1;++n)if(dn(e,t,r[n],r[n+1]))return!0;return!1}function pn(e,t,n=!1){let r=!1;for(let s of t)for(let t=0;t<s.length-1;t++){if(un(e,s[t],s[t+1]))return n;(a=s[t])[1]>(i=e)[1]!=(o=s[t+1])[1]>i[1]&&i[0]<(o[0]-a[0])*(i[1]-a[1])/(o[1]-a[1])+a[0]&&(r=!r)}var i,a,o;return r}function mn(e,t){for(let n of t)if(pn(e,n))return!0;return!1}function hn(e,t){for(let n of e)if(!pn(n,t))return!1;for(let n=0;n<e.length-1;++n)if(fn(e[n],e[n+1],t))return!1;return!0}function gn(e,t){for(let n of t)if(hn(e,n))return!0;return!1}function _n(e,t,n,r){let i=r[0]-n[0],a=r[1]-n[1],o=(e[0]-n[0])*a-i*(e[1]-n[1]),s=(t[0]-n[0])*a-i*(t[1]-n[1]);return o>0&&s<0||o<0&&s>0}function vn(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=[];for(let r=0;r<e[i].length;r++){let o=sn(e[i][r],n);cn(t,o),a.push(o)}r.push(a)}return r}function yn(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=vn(e[i],t,n);r.push(a)}return r}function bn(e,t,n,r){if(e[0]<n[0]||e[0]>n[2]){let t=.5*r,i=e[0]-n[0]>t?-r:n[0]-e[0]>t?r:0;i===0&&(i=e[0]-n[2]>t?-r:n[2]-e[0]>t?r:0),e[0]+=i}cn(t,e)}function xn(e,t,n,r){let i=2**r.z*on,a=[r.x*on,r.y*on],o=[];for(let r of e)for(let e of r){let r=[e.x+a[0],e.y+a[1]];bn(r,t,n,i),o.push(r)}return o}function Sn(e,t,n,r){let i=2**r.z*on,a=[r.x*on,r.y*on],o=[];for(let n of e){let e=[];for(let r of n){let n=[r.x+a[0],r.y+a[1]];cn(t,n),e.push(n)}o.push(e)}if(t[2]-t[0]<=i/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(let e of o)for(let r of e)bn(r,t,n,i)}var s;return o}class Cn{constructor(e,t){this.type=R,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(mt(e[1])){let t=e[1];if(t.type===`FeatureCollection`){let e=[];for(let n of t.features){let{type:t,coordinates:r}=n.geometry;t===`Polygon`&&e.push(r),t===`MultiPolygon`&&e.push(...r)}if(e.length)return new Cn(t,{type:`MultiPolygon`,coordinates:e})}else if(t.type===`Feature`){let e=t.geometry.type;if(e===`Polygon`||e===`MultiPolygon`)return new Cn(t,t.geometry)}else if(t.type===`Polygon`||t.type===`MultiPolygon`)return new Cn(t,t)}return t.error(`'within' expression requires valid geojson object that contains polygon geometry type.`)}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===`Point`)return function(e,t){let n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type===`Polygon`){let a=vn(t.coordinates,r,i),o=xn(e.geometry(),n,r,i);if(!ln(n,r))return!1;for(let e of o)if(!pn(e,a))return!1}if(t.type===`MultiPolygon`){let a=yn(t.coordinates,r,i),o=xn(e.geometry(),n,r,i);if(!ln(n,r))return!1;for(let e of o)if(!mn(e,a))return!1}return!0}(e,this.geometries);if(e.geometryType()===`LineString`)return function(e,t){let n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type===`Polygon`){let a=vn(t.coordinates,r,i),o=Sn(e.geometry(),n,r,i);if(!ln(n,r))return!1;for(let e of o)if(!hn(e,a))return!1}if(t.type===`MultiPolygon`){let a=yn(t.coordinates,r,i),o=Sn(e.geometry(),n,r,i);if(!ln(n,r))return!1;for(let e of o)if(!gn(e,a))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let wn=class{constructor(e=[],t=((e,t)=>e<t?-1:+(e>t))){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],i)>=0)break;t[e]=t[r],e=r}t[e]=i}};function Tn(e,t,n,r,i){En(e,t,n,r||e.length-1,i||On)}function En(e,t,n,r,i){for(;r>n;){if(r-n>600){var a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);En(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}var u=e[t],d=n,f=r;for(Dn(e,n,t),i(e[r],u)>0&&Dn(e,n,r);d<f;){for(Dn(e,d,f),d++,f--;i(e[d],u)<0;)d++;for(;i(e[f],u)>0;)f--}i(e[n],u)===0?Dn(e,n,f):Dn(e,++f,r),f<=t&&(n=f+1),t<=f&&(r=f-1)}}function Dn(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function On(e,t){return e<t?-1:+(e>t)}function kn(e,t){if(e.length<=1)return[e];let n=[],r,i;for(let t of e){let e=jn(t);e!==0&&(t.area=Math.abs(e),i===void 0&&(i=e<0),i===e<0?(r&&n.push(r),r=[t]):r.push(t))}if(r&&n.push(r),t>1)for(let e=0;e<n.length;e++)n[e].length<=t||(Tn(n[e],t,1,n[e].length-1,An),n[e]=n[e].slice(0,t));return n}function An(e,t){return t.area-e.area}function jn(e){let t=0;for(let n,r,i=0,a=e.length,o=a-1;i<a;o=i++)n=e[i],r=e[o],t+=(r.x-n.x)*(n.y+r.y);return t}let Mn=1/298.257223563,Nn=Mn*(2-Mn),Pn=Math.PI/180;class Fn{constructor(e){let t=6378.137*Pn*1e3,n=Math.cos(e*Pn),r=1/(1-Nn*(1-n*n)),i=Math.sqrt(r);this.kx=t*i*n,this.ky=t*i*r*(1-Nn)}distance(e,t){let n=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+r*r)}pointOnLine(e,t){let n,r,i,a,o=1/0;for(let s=0;s<e.length-1;s++){let c=e[s][0],l=e[s][1],u=this.wrap(e[s+1][0]-c)*this.kx,d=(e[s+1][1]-l)*this.ky,f=0;u===0&&d===0||(f=(this.wrap(t[0]-c)*this.kx*u+(t[1]-l)*this.ky*d)/(u*u+d*d),f>1?(c=e[s+1][0],l=e[s+1][1]):f>0&&(c+=u/this.kx*f,l+=d/this.ky*f)),u=this.wrap(t[0]-c)*this.kx,d=(t[1]-l)*this.ky;let p=u*u+d*d;p<o&&(o=p,n=c,r=l,i=s,a=f)}return{point:[n,r],index:i,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function In(e,t){return t[0]-e[0]}function Ln(e){return e[1]-e[0]+1}function Rn(e,t){return e[1]>=e[0]&&e[1]<t}function zn(e,t){if(e[0]>e[1])return[null,null];let n=Ln(e);if(t){if(n===2)return[e,null];let t=Math.floor(n/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(n===1)return[e,null];let r=Math.floor(n/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function Bn(e,t){if(!Rn(t,e.length))return[1/0,1/0,-1/0,-1/0];let n=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)cn(n,e[r]);return n}function Vn(e){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)for(let e of n)cn(t,e);return t}function Hn(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Un(e,t,n){if(!Hn(e)||!Hn(t))return NaN;let r=0,i=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(i=e[1]-t[3]),e[3]<t[1]&&(i=t[1]-e[3]),n.distance([0,0],[r,i])}function U(e,t,n){let r=n.pointOnLine(t,e);return n.distance(e,r.point)}function Wn(e,t,n,r,i){let a=Math.min(U(e,[n,r],i),U(t,[n,r],i)),o=Math.min(U(n,[e,t],i),U(r,[e,t],i));return Math.min(a,o)}function W(e,t,n,r,i){if(!Rn(t,e.length)||!Rn(r,n.length))return 1/0;let a=1/0;for(let o=t[0];o<t[1];++o){let t=e[o],s=e[o+1];for(let e=r[0];e<r[1];++e){let r=n[e],o=n[e+1];if(dn(t,s,r,o))return 0;a=Math.min(a,Wn(t,s,r,o,i))}}return a}function Gn(e,t,n,r,i){if(!Rn(t,e.length)||!Rn(r,n.length))return NaN;let a=1/0;for(let o=t[0];o<=t[1];++o)for(let t=r[0];t<=r[1];++t)if(a=Math.min(a,i.distance(e[o],n[t])),a===0)return a;return a}function G(e,t,n){if(pn(e,t,!0))return 0;let r=1/0;for(let i of t){let t=i[0],a=i[i.length-1];if(t!==a&&(r=Math.min(r,U(e,[a,t],n)),r===0))return r;let o=n.pointOnLine(i,e);if(r=Math.min(r,n.distance(e,o.point)),r===0)return r}return r}function K(e,t,n,r){if(!Rn(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(pn(e[r],n,!0))return 0;let i=1/0;for(let a=t[0];a<t[1];++a){let t=e[a],o=e[a+1];for(let e of n)for(let n=0,a=e.length,s=a-1;n<a;s=n++){let a=e[s],c=e[n];if(dn(t,o,a,c))return 0;i=Math.min(i,Wn(t,o,a,c,r))}}return i}function Kn(e,t){for(let n of e)for(let e of n)if(pn(e,t,!0))return!0;return!1}function qn(e,t,n,r=1/0){let i=Vn(e),a=Vn(t);if(r!==1/0&&Un(i,a,n)>=r)return r;if(ln(i,a)){if(Kn(e,t))return 0}else if(Kn(t,e))return 0;let o=1/0;for(let r of e)for(let e=0,i=r.length,a=i-1;e<i;a=e++){let i=r[a],s=r[e];for(let e of t)for(let t=0,r=e.length,a=r-1;t<r;a=t++){let r=e[a],c=e[t];if(dn(i,s,r,c))return 0;o=Math.min(o,Wn(i,s,r,c,n))}}return o}function Jn(e,t,n,r,i,a){if(!a)return;let o=Un(Bn(r,a),i,n);o<t&&e.push([o,a,[0,0]])}function Yn(e,t,n,r,i,a,o){if(!a||!o)return;let s=Un(Bn(r,a),Bn(i,o),n);s<t&&e.push([s,a,o])}function Xn(e,t,n,r,i=1/0){let a=Math.min(r.distance(e[0],n[0][0]),i);if(a===0)return a;let o=new wn([[0,[0,e.length-1],[0,0]]],In),s=Vn(n);for(;o.length>0;){let i=o.pop();if(i[0]>=a)continue;let c=i[1],l=t?50:100;if(Ln(c)<=l){if(!Rn(c,e.length))return NaN;if(t){let t=K(e,c,n,r);if(isNaN(t)||t===0)return t;a=Math.min(a,t)}else for(let t=c[0];t<=c[1];++t){let i=G(e[t],n,r);if(a=Math.min(a,i),a===0)return 0}}else{let n=zn(c,t);Jn(o,a,r,e,s,n[0]),Jn(o,a,r,e,s,n[1])}}return a}function Zn(e,t,n,r,i,a=1/0){let o=Math.min(a,i.distance(e[0],n[0]));if(o===0)return o;let s=new wn([[0,[0,e.length-1],[0,n.length-1]]],In);for(;s.length>0;){let a=s.pop();if(a[0]>=o)continue;let c=a[1],l=a[2],u=t?50:100,d=r?50:100;if(Ln(c)<=u&&Ln(l)<=d){if(!Rn(c,e.length)&&Rn(l,n.length))return NaN;let a;if(t&&r)a=W(e,c,n,l,i),o=Math.min(o,a);else if(t&&!r){let t=e.slice(c[0],c[1]+1);for(let e=l[0];e<=l[1];++e)if(a=U(n[e],t,i),o=Math.min(o,a),o===0)return o}else if(!t&&r){let t=n.slice(l[0],l[1]+1);for(let n=c[0];n<=c[1];++n)if(a=U(e[n],t,i),o=Math.min(o,a),o===0)return o}else a=Gn(e,c,n,l,i),o=Math.min(o,a)}else{let a=zn(c,t),u=zn(l,r);Yn(s,o,i,e,n,a[0],u[0]),Yn(s,o,i,e,n,a[0],u[1]),Yn(s,o,i,e,n,a[1],u[0]),Yn(s,o,i,e,n,a[1],u[1])}}return o}function Qn(e){return e.type===`MultiPolygon`?e.coordinates.map((e=>({type:`Polygon`,coordinates:e}))):e.type===`MultiLineString`?e.coordinates.map((e=>({type:`LineString`,coordinates:e}))):e.type===`MultiPoint`?e.coordinates.map((e=>({type:`Point`,coordinates:e}))):[e]}class $n{constructor(e,t){this.type=I,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(mt(e[1])){let t=e[1];if(t.type===`FeatureCollection`)return new $n(t,t.features.map((e=>Qn(e.geometry))).flat());if(t.type===`Feature`)return new $n(t,Qn(t.geometry));if(`type`in t&&`coordinates`in t)return new $n(t,Qn(t))}return t.error(`'distance' expression requires valid geojson object that contains polygon geometry type.`)}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===`Point`)return function(e,t){let n=e.geometry(),r=n.flat().map((t=>H([t.x,t.y],e.canonical)));if(n.length===0)return NaN;let i=new Fn(r[0][1]),a=1/0;for(let e of t){switch(e.type){case`Point`:a=Math.min(a,Zn(r,!1,[e.coordinates],!1,i,a));break;case`LineString`:a=Math.min(a,Zn(r,!1,e.coordinates,!0,i,a));break;case`Polygon`:a=Math.min(a,Xn(r,!1,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries);if(e.geometryType()===`LineString`)return function(e,t){let n=e.geometry(),r=n.flat().map((t=>H([t.x,t.y],e.canonical)));if(n.length===0)return NaN;let i=new Fn(r[0][1]),a=1/0;for(let e of t){switch(e.type){case`Point`:a=Math.min(a,Zn(r,!0,[e.coordinates],!1,i,a));break;case`LineString`:a=Math.min(a,Zn(r,!0,e.coordinates,!0,i,a));break;case`Polygon`:a=Math.min(a,Xn(r,!0,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries);if(e.geometryType()===`Polygon`)return function(e,t){let n=e.geometry();if(n.length===0||n[0].length===0)return NaN;let r=kn(n,0).map((t=>t.map((t=>t.map((t=>H([t.x,t.y],e.canonical))))))),i=new Fn(r[0][0][0][1]),a=1/0;for(let e of t)for(let t of r){switch(e.type){case`Point`:a=Math.min(a,Xn([e.coordinates],!1,t,i,a));break;case`LineString`:a=Math.min(a,Xn(e.coordinates,!0,t,i,a));break;case`Polygon`:a=Math.min(a,qn(t,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let er={"==":Jt,"!=":Yt,">":Zt,"<":Xt,">=":$t,"<=":Qt,array:bt,at:Dt,boolean:bt,case:jt,coalesce:Wt,collator:en,format:nn,image:rn,in:Ot,"index-of":kt,interpolate:Ht,"interpolate-hcl":Ht,"interpolate-lab":Ht,length:an,let:Tt,literal:_t,match:At,number:bt,"number-format":tn,object:bt,slice:Mt,step:Pt,string:bt,"to-boolean":St,"to-color":St,"to-number":St,"to-string":St,var:Et,within:Cn,distance:$n};class tr{constructor(e,t,n,r){this.name=e,this.type=t,this._evaluate=n,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let n=e[0],r=tr.definitions[n];if(!r)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let i=Array.isArray(r)?r[0]:r.type,a=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=a.filter((([t])=>!Array.isArray(t)||t.length===e.length-1)),s=null;for(let[r,a]of o){s=new wt(t.registry,or,t.path,null,t.scope);let o=[],c=!1;for(let t=1;t<e.length;t++){let n=e[t],i=Array.isArray(r)?r[t-1]:r.type,a=s.parse(n,1+o.length,i);if(!a){c=!0;break}o.push(a)}if(!c)if(Array.isArray(r)&&r.length!==o.length)s.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){let t=Array.isArray(r)?r[e]:r.type,n=o[e];s.concat(e+1).checkSubtype(t,n.type)}if(s.errors.length===0)return new tr(n,i,a,o)}}if(o.length===1)t.errors.push(...s.errors);else{let n=(o.length?o:a).map((([e])=>{return t=e,Array.isArray(t)?`(${t.map(Fe).join(`, `)})`:`(${Fe(t.type)}...)`;var t})).join(` | `),r=[];for(let n=1;n<e.length;n++){let i=t.parse(e[n],1+r.length);if(!i)return null;r.push(Fe(i.type))}t.error(`Expected arguments of type ${n}, but found (${r.join(`, `)}) instead.`)}return null}static register(e,t){tr.definitions=t;for(let n in t)e[n]=tr}}function nr(e,[t,n,r,i]){t=t.evaluate(e),n=n.evaluate(e),r=r.evaluate(e);let a=i?i.evaluate(e):1,o=pt(t,n,r,a);if(o)throw new vt(o);return new B(t/255,n/255,r/255,a,!1)}function rr(e,t){return e in t}function ir(e,t){let n=t[e];return n===void 0?null:n}function ar(e){return{type:e}}function or(e){if(e instanceof Et)return or(e.boundExpression);if(e instanceof tr&&e.name===`error`||e instanceof en||e instanceof Cn||e instanceof $n)return!1;let t=e instanceof St||e instanceof bt,n=!0;return e.eachChild((e=>{n=t?n&&or(e):n&&e instanceof _t})),!!n&&sr(e)&&lr(e,[`zoom`,`heatmap-density`,`line-progress`,`accumulated`,`is-supported-script`])}function sr(e){if(e instanceof tr&&(e.name===`get`&&e.args.length===1||e.name===`feature-state`||e.name===`has`&&e.args.length===1||e.name===`properties`||e.name===`geometry-type`||e.name===`id`||/^filter-/.test(e.name))||e instanceof Cn||e instanceof $n)return!1;let t=!0;return e.eachChild((e=>{t&&!sr(e)&&(t=!1)})),t}function cr(e){if(e instanceof tr&&e.name===`feature-state`)return!1;let t=!0;return e.eachChild((e=>{t&&!cr(e)&&(t=!1)})),t}function lr(e,t){if(e instanceof tr&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild((e=>{n&&!lr(e,t)&&(n=!1)})),n}function ur(e){return{result:`success`,value:e}}function dr(e){return{result:`error`,value:e}}function fr(e){return e[`property-type`]===`data-driven`||e[`property-type`]===`cross-faded-data-driven`}function pr(e){return!!e.expression&&e.expression.parameters.indexOf(`zoom`)>-1}function mr(e){return!!e.expression&&e.expression.interpolated}function q(e){return e instanceof Number?`number`:e instanceof String?`string`:e instanceof Boolean?`boolean`:Array.isArray(e)?`array`:e===null?`null`:typeof e}function hr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function gr(e){return e}function _r(e,t){let n=t.type===`color`,r=e.stops&&typeof e.stops[0][0]==`object`,i=r||!(r||e.property!==void 0),a=e.type||(mr(t)?`exponential`:`interval`);if(n||t.type===`padding`){let r=n?B.parse:lt.parse;(e=Ce({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],r(e[1])]))),e.default=r(e.default?e.default:t.default)}if(e.colorSpace&&(o=e.colorSpace)!==`rgb`&&o!==`hcl`&&o!==`lab`)throw Error(`Unknown color space: "${e.colorSpace}"`);var o;let s,c,l;if(a===`exponential`)s=xr;else if(a===`interval`)s=br;else if(a===`categorical`){s=yr,c=Object.create(null);for(let t of e.stops)c[t[0]]=t[1];l=typeof e.stops[0][0]}else{if(a!==`identity`)throw Error(`Unknown function type "${a}"`);s=Sr}if(r){let n={},r=[];for(let t=0;t<e.stops.length;t++){let i=e.stops[t],a=i[0].zoom;n[a]===void 0&&(n[a]={zoom:a,type:e.type,property:e.property,default:e.default,stops:[]},r.push(a)),n[a].stops.push([i[0].value,i[1]])}let i=[];for(let e of r)i.push([n[e].zoom,_r(n[e],t)]);let a={name:`linear`};return{kind:`composite`,interpolationType:a,interpolationFactor:Ht.interpolationFactor.bind(void 0,a),zoomStops:i.map((e=>e[0])),evaluate:({zoom:n},r)=>xr({stops:i,base:e.base},t,n).evaluate(n,r)}}if(i){let n=a===`exponential`?{name:`exponential`,base:e.base===void 0?1:e.base}:null;return{kind:`camera`,interpolationType:n,interpolationFactor:Ht.interpolationFactor.bind(void 0,n),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:n})=>s(e,t,n,c,l)}}return{kind:`source`,evaluate(n,r){let i=r&&r.properties?r.properties[e.property]:void 0;return i===void 0?vr(e.default,t.default):s(e,t,i,c,l)}}}function vr(e,t,n){return e===void 0?t===void 0?n===void 0?void 0:n:t:e}function yr(e,t,n,r,i){return vr(typeof n===i?r[n]:void 0,e.default,t.default)}function br(e,t,n){if(q(n)!==`number`)return vr(e.default,t.default);let r=e.stops.length;if(r===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[r-1][0])return e.stops[r-1][1];let i=Nt(e.stops.map((e=>e[0])),n);return e.stops[i][1]}function xr(e,t,n){let r=e.base===void 0?1:e.base;if(q(n)!==`number`)return vr(e.default,t.default);let i=e.stops.length;if(i===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[i-1][0])return e.stops[i-1][1];let a=Nt(e.stops.map((e=>e[0])),n),o=function(e,t,n,r){let i=r-n,a=e-n;return i===0?0:t===1?a/i:(t**+a-1)/(t**+i-1)}(n,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],c=e.stops[a+1][1],l=Vt[t.type]||gr;return typeof s.evaluate==`function`?{evaluate(...t){let n=s.evaluate.apply(void 0,t),r=c.evaluate.apply(void 0,t);if(n!==void 0&&r!==void 0)return l(n,r,o,e.colorSpace)}}:l(s,c,o,e.colorSpace)}function Sr(e,t,n){switch(t.type){case`color`:n=B.parse(n);break;case`formatted`:n=ct.fromString(n.toString());break;case`resolvedImage`:n=ft.fromString(n.toString());break;case`padding`:n=lt.parse(n);break;default:q(n)===t.type||t.type===`enum`&&t.values[n]||(n=void 0)}return vr(n,e.default,t.default)}tr.register(er,{error:[{kind:`error`},[L],(e,[t])=>{throw new vt(t.evaluate(e))}],typeof:[L,[z],(e,[t])=>Fe(ht(t.evaluate(e)))],"to-rgba":[Pe(I,4),[De],(e,[t])=>{let[n,r,i,a]=t.evaluate(e).rgb;return[255*n,255*r,255*i,a]}],rgb:[De,[I,I,I],nr],rgba:[De,[I,I,I,I],nr],has:{type:R,overloads:[[[L],(e,[t])=>rr(t.evaluate(e),e.properties())],[[L,Oe],(e,[t,n])=>rr(t.evaluate(e),n.evaluate(e))]]},get:{type:z,overloads:[[[L],(e,[t])=>ir(t.evaluate(e),e.properties())],[[L,Oe],(e,[t,n])=>ir(t.evaluate(e),n.evaluate(e))]]},"feature-state":[z,[L],(e,[t])=>ir(t.evaluate(e),e.featureState||{})],properties:[Oe,[],e=>e.properties()],"geometry-type":[L,[],e=>e.geometryType()],id:[z,[],e=>e.id()],zoom:[I,[],e=>e.globals.zoom],"heatmap-density":[I,[],e=>e.globals.heatmapDensity||0],"line-progress":[I,[],e=>e.globals.lineProgress||0],accumulated:[z,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[I,ar(I),(e,t)=>{let n=0;for(let r of t)n+=r.evaluate(e);return n}],"*":[I,ar(I),(e,t)=>{let n=1;for(let r of t)n*=r.evaluate(e);return n}],"-":{type:I,overloads:[[[I,I],(e,[t,n])=>t.evaluate(e)-n.evaluate(e)],[[I],(e,[t])=>-t.evaluate(e)]]},"/":[I,[I,I],(e,[t,n])=>t.evaluate(e)/n.evaluate(e)],"%":[I,[I,I],(e,[t,n])=>t.evaluate(e)%n.evaluate(e)],ln2:[I,[],()=>Math.LN2],pi:[I,[],()=>Math.PI],e:[I,[],()=>Math.E],"^":[I,[I,I],(e,[t,n])=>t.evaluate(e)**+n.evaluate(e)],sqrt:[I,[I],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[I,[I],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[I,[I],(e,[t])=>Math.log(t.evaluate(e))],log2:[I,[I],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[I,[I],(e,[t])=>Math.sin(t.evaluate(e))],cos:[I,[I],(e,[t])=>Math.cos(t.evaluate(e))],tan:[I,[I],(e,[t])=>Math.tan(t.evaluate(e))],asin:[I,[I],(e,[t])=>Math.asin(t.evaluate(e))],acos:[I,[I],(e,[t])=>Math.acos(t.evaluate(e))],atan:[I,[I],(e,[t])=>Math.atan(t.evaluate(e))],min:[I,ar(I),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[I,ar(I),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[I,[I],(e,[t])=>Math.abs(t.evaluate(e))],round:[I,[I],(e,[t])=>{let n=t.evaluate(e);return n<0?-Math.round(-n):Math.round(n)}],floor:[I,[I],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[I,[I],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[R,[L,z],(e,[t,n])=>e.properties()[t.value]===n.value],"filter-id-==":[R,[z],(e,[t])=>e.id()===t.value],"filter-type-==":[R,[L],(e,[t])=>e.geometryType()===t.value],"filter-<":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<i}],"filter-id-<":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n<r}],"filter->":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>i}],"filter-id->":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>r}],"filter-<=":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n<=r}],"filter->=":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>=r}],"filter-has":[R,[z],(e,[t])=>t.value in e.properties()],"filter-has-id":[R,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[R,[Pe(L)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[R,[Pe(z)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[R,[L,Pe(z)],(e,[t,n])=>n.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[R,[L,Pe(z)],(e,[t,n])=>function(e,t,n,r){for(;n<=r;){let i=n+r>>1;if(t[i]===e)return!0;t[i]>e?r=i-1:n=i+1}return!1}(e.properties()[t.value],n.value,0,n.value.length-1)],all:{type:R,overloads:[[[R,R],(e,[t,n])=>t.evaluate(e)&&n.evaluate(e)],[ar(R),(e,t)=>{for(let n of t)if(!n.evaluate(e))return!1;return!0}]]},any:{type:R,overloads:[[[R,R],(e,[t,n])=>t.evaluate(e)||n.evaluate(e)],[ar(R),(e,t)=>{for(let n of t)if(n.evaluate(e))return!0;return!1}]]},"!":[R,[R],(e,[t])=>!t.evaluate(e)],"is-supported-script":[R,[L],(e,[t])=>{let n=e.globals&&e.globals.isSupportedScript;return!n||n(t.evaluate(e))}],upcase:[L,[L],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[L,[L],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[L,ar(z),(e,t)=>t.map((t=>gt(t.evaluate(e)))).join(``)],"resolved-locale":[L,[ke],(e,[t])=>t.evaluate(e).resolvedLocale()]});class Cr{constructor(e,t){var n;this.expression=e,this._warningHistory={},this._evaluator=new V,this._defaultValue=t?(n=t).type===`color`&&hr(n.default)?new B(0,0,0,0):n.type===`color`?B.parse(n.default)||null:n.type===`padding`?lt.parse(n.default)||null:n.type===`variableAnchorOffsetCollection`?dt.parse(n.default)||null:n.default===void 0?null:n.default:null,this._enumValues=t&&t.type===`enum`?t.values:null}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,r,i,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{let e=this.expression.evaluate(this._evaluator);if(e==null||typeof e==`number`&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new vt(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(`, `)}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,typeof console<`u`&&console.warn(e.message)),this._defaultValue}}}function wr(e){return Array.isArray(e)&&e.length>0&&typeof e[0]==`string`&&e[0]in er}function Tr(e,t){let n=new wt(er,or,[],t?function(e){let t={color:De,string:L,number:I,enum:L,boolean:R,formatted:Ae,padding:je,resolvedImage:Me,variableAnchorOffsetCollection:Ne};return e.type===`array`?Pe(t[e.value]||z,e.length):t[e.type]}(t):void 0),r=n.parse(e,void 0,void 0,void 0,t&&t.type===`string`?{typeAnnotation:`coerce`}:void 0);return r?ur(new Cr(r,t)):dr(n.errors)}class Er{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!==`constant`&&!cr(t.expression)}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._styleExpression.evaluate(e,t,n,r,i,a)}}class Dr{constructor(e,t,n,r){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!==`camera`&&!cr(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._styleExpression.evaluate(e,t,n,r,i,a)}interpolationFactor(e,t,n){return this.interpolationType?Ht.interpolationFactor(this.interpolationType,e,t,n):0}}function Or(e,t){let n=Tr(e,t);if(n.result===`error`)return n;let r=n.value.expression,i=sr(r);if(!i&&!fr(t))return dr([new we(``,`data expressions not supported`)]);let a=lr(r,[`zoom`]);if(!a&&!pr(t))return dr([new we(``,`zoom expressions not supported`)]);let o=Ar(r);return o||a?o instanceof we?dr([o]):o instanceof Ht&&!mr(t)?dr([new we(``,`"interpolate" expressions cannot be used with this property`)]):ur(o?new Dr(i?`camera`:`composite`,n.value,o.labels,o instanceof Ht?o.interpolation:void 0):new Er(i?`constant`:`source`,n.value)):dr([new we(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`)])}class kr{constructor(e,t){this._parameters=e,this._specification=t,Ce(this,_r(this._parameters,this._specification))}static deserialize(e){return new kr(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ar(e){let t=null;if(e instanceof Tt)t=Ar(e.result);else if(e instanceof Wt){for(let n of e.args)if(t=Ar(n),t)break}else(e instanceof Pt||e instanceof Ht)&&e.input instanceof tr&&e.input.name===`zoom`&&(t=e);return t instanceof we||e.eachChild((e=>{let n=Ar(e);n instanceof we?t=n:!t&&n?t=new we(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`):t&&n&&t!==n&&(t=new we(``,`Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.`))})),t}function jr(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case`has`:return e.length>=2&&e[1]!==`$id`&&e[1]!==`$type`;case`in`:return e.length>=3&&(typeof e[1]!=`string`||Array.isArray(e[2]));case`!in`:case`!has`:case`none`:return!1;case`==`:case`!=`:case`>`:case`>=`:case`<`:case`<=`:return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case`any`:case`all`:for(let t of e.slice(1))if(!jr(t)&&typeof t!=`boolean`)return!1;return!0;default:return!0}}let Mr={type:`boolean`,default:!1,transition:!1,"property-type":`data-driven`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]}};function Nr(e){if(e==null)return{filter:()=>!0,needGeometry:!1};jr(e)||(e=Ir(e));let t=Tr(e,Mr);if(t.result===`error`)throw Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return{filter:(e,n,r)=>t.value.evaluate(e,n,{},r),needGeometry:Fr(e)}}function Pr(e,t){return e<t?-1:+(e>t)}function Fr(e){if(!Array.isArray(e))return!1;if(e[0]===`within`||e[0]===`distance`)return!0;for(let t=1;t<e.length;t++)if(Fr(e[t]))return!0;return!1}function Ir(e){if(!e)return!0;let t=e[0];return e.length<=1?t!==`any`:t===`==`?Lr(e[1],e[2],`==`):t===`!=`?Br(Lr(e[1],e[2],`==`)):t===`<`||t===`>`||t===`<=`||t===`>=`?Lr(e[1],e[2],t):t===`any`?(n=e.slice(1),[`any`].concat(n.map(Ir))):t===`all`?[`all`].concat(e.slice(1).map(Ir)):t===`none`?[`all`].concat(e.slice(1).map(Ir).map(Br)):t===`in`?Rr(e[1],e.slice(2)):t===`!in`?Br(Rr(e[1],e.slice(2))):t===`has`?zr(e[1]):t!==`!has`||Br(zr(e[1]));var n}function Lr(e,t,n){switch(e){case`$type`:return[`filter-type-${n}`,t];case`$id`:return[`filter-id-${n}`,t];default:return[`filter-${n}`,e,t]}}function Rr(e,t){if(t.length===0)return!1;switch(e){case`$type`:return[`filter-type-in`,[`literal`,t]];case`$id`:return[`filter-id-in`,[`literal`,t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?[`filter-in-large`,e,[`literal`,t.sort(Pr)]]:[`filter-in-small`,e,[`literal`,t]]}}function zr(e){switch(e){case`$type`:return!0;case`$id`:return[`filter-has-id`];default:return[`filter-has`,e]}}function Br(e){return[`!`,e]}function Vr(e){let t=typeof e;if(t===`number`||t===`boolean`||t===`string`||e==null)return JSON.stringify(e);if(Array.isArray(e)){let t=`[`;for(let n of e)t+=`${Vr(n)},`;return`${t}]`}let n=Object.keys(e).sort(),r=`{`;for(let t=0;t<n.length;t++)r+=`${JSON.stringify(n[t])}:${Vr(e[n[t]])},`;return`${r}}`}function Hr(e){let t=``;for(let n of pe)t+=`/${Vr(e[n])}`;return t}function Ur(e){let t=e.value;return t?[new F(e.key,t,`constants have been deprecated as of v8`)]:[]}function Wr(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Gr(e){if(Array.isArray(e))return e.map(Gr);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let n in e)t[n]=Gr(e[n]);return t}return Wr(e)}function Kr(e){let t=e.key,n=e.value,r=e.valueSpec||{},i=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,c=[],l=q(n);if(l!==`object`)return[new F(t,n,`object expected, ${l} found`)];for(let e in n){let l=e.split(`.`)[0],u=r[l]||r[`*`],d;if(i[l])d=i[l];else if(r[l])d=s;else if(i[`*`])d=i[`*`];else{if(!r[`*`]){c.push(new F(t,n[e],`unknown property "${e}"`));continue}d=s}c=c.concat(d({key:(t&&`${t}.`)+e,value:n[e],valueSpec:u,style:a,styleSpec:o,object:n,objectKey:e,validateSpec:s},n))}for(let e in r)i[e]||r[e].required&&r[e].default===void 0&&n[e]===void 0&&c.push(new F(t,n,`missing required property "${e}"`));return c}function qr(e){let t=e.value,n=e.valueSpec,r=e.style,i=e.styleSpec,a=e.key,o=e.arrayElementValidator||e.validateSpec;if(q(t)!==`array`)return[new F(a,t,`array expected, ${q(t)} found`)];if(n.length&&t.length!==n.length)return[new F(a,t,`array length ${n.length} expected, length ${t.length} found`)];if(n[`min-length`]&&t.length<n[`min-length`])return[new F(a,t,`array length at least ${n[`min-length`]} expected, length ${t.length} found`)];let s={type:n.value,values:n.values};i.$version<7&&(s.function=n.function),q(n.value)===`object`&&(s=n.value);let c=[];for(let n=0;n<t.length;n++)c=c.concat(o({array:t,arrayIndex:n,value:t[n],valueSpec:s,validateSpec:e.validateSpec,style:r,styleSpec:i,key:`${a}[${n}]`}));return c}function Jr(e){let t=e.key,n=e.value,r=e.valueSpec,i=q(n);return i===`number`&&n!=n&&(i=`NaN`),i===`number`?`minimum`in r&&n<r.minimum?[new F(t,n,`${n} is less than the minimum value ${r.minimum}`)]:`maximum`in r&&n>r.maximum?[new F(t,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]:[new F(t,n,`number expected, ${i} found`)]}function Yr(e){let t=e.valueSpec,n=Wr(e.value.type),r,i,a,o={},s=n!==`categorical`&&e.value.property===void 0,c=!s,l=q(e.value.stops)===`array`&&q(e.value.stops[0])===`array`&&q(e.value.stops[0][0])===`object`,u=Kr({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if(n===`identity`)return[new F(e.key,e.value,`identity function may not have a "stops" property`)];let t=[],r=e.value;return t=t.concat(qr({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:d})),q(r)===`array`&&r.length===0&&t.push(new F(e.key,r,`array must have at least one stop`)),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return n===`identity`&&s&&u.push(new F(e.key,e.value,`missing required property "property"`)),n===`identity`||e.value.stops||u.push(new F(e.key,e.value,`missing required property "stops"`)),n===`exponential`&&e.valueSpec.expression&&!mr(e.valueSpec)&&u.push(new F(e.key,e.value,`exponential functions not supported`)),e.styleSpec.$version>=8&&(c&&!fr(e.valueSpec)?u.push(new F(e.key,e.value,`property functions not supported`)):s&&!pr(e.valueSpec)&&u.push(new F(e.key,e.value,`zoom functions not supported`))),n!==`categorical`&&!l||e.value.property!==void 0||u.push(new F(e.key,e.value,`"property" property is required`)),u;function d(e){let n=[],r=e.value,s=e.key;if(q(r)!==`array`)return[new F(s,r,`array expected, ${q(r)} found`)];if(r.length!==2)return[new F(s,r,`array length 2 expected, length ${r.length} found`)];if(l){if(q(r[0])!==`object`)return[new F(s,r,`object expected, ${q(r[0])} found`)];if(r[0].zoom===void 0)return[new F(s,r,`object stop key must have zoom`)];if(r[0].value===void 0)return[new F(s,r,`object stop key must have value`)];if(a&&a>Wr(r[0].zoom))return[new F(s,r[0].zoom,`stop zoom values must appear in ascending order`)];Wr(r[0].zoom)!==a&&(a=Wr(r[0].zoom),i=void 0,o={}),n=n.concat(Kr({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Jr,value:f}}))}else n=n.concat(f({key:`${s}[0]`,value:r[0],valueSpec:{},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return wr(Gr(r[1]))?n.concat([new F(`${s}[1]`,r[1],`expressions are not allowed in function stops.`)]):n.concat(e.validateSpec({key:`${s}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function f(e,a){let s=q(e.value),c=Wr(e.value),l=e.value===null?a:e.value;if(r){if(s!==r)return[new F(e.key,l,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if(s!==`number`&&s!==`string`&&s!==`boolean`)return[new F(e.key,l,`stop domain value must be a number, string, or boolean`)];if(s!==`number`&&n!==`categorical`){let r=`number expected, ${s} found`;return fr(t)&&n===void 0&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new F(e.key,l,r)]}return n!==`categorical`||s!==`number`||isFinite(c)&&Math.floor(c)===c?n!==`categorical`&&s===`number`&&i!==void 0&&c<i?[new F(e.key,l,`stop domain values must appear in ascending order`)]:(i=c,n===`categorical`&&c in o?[new F(e.key,l,`stop domain values must be unique`)]:(o[c]=!0,[])):[new F(e.key,l,`integer expected, found ${c}`)]}}function Xr(e){let t=(e.expressionContext===`property`?Or:Tr)(Gr(e.value),e.valueSpec);if(t.result===`error`)return t.value.map((t=>new F(`${e.key}${t.key}`,e.value,t.message)));let n=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext===`property`&&e.propertyKey===`text-font`&&!n.outputDefined())return[new F(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext===`property`&&e.propertyType===`layout`&&!cr(n))return[new F(e.key,e.value,`"feature-state" data expressions are not supported with layout properties.`)];if(e.expressionContext===`filter`&&!cr(n))return[new F(e.key,e.value,`"feature-state" data expressions are not supported with filters.`)];if(e.expressionContext&&e.expressionContext.indexOf(`cluster`)===0){if(!lr(n,[`zoom`,`feature-state`]))return[new F(e.key,e.value,`"zoom" and "feature-state" expressions are not supported with cluster properties.`)];if(e.expressionContext===`cluster-initial`&&!sr(n))return[new F(e.key,e.value,`Feature data expressions are not supported with initial expression part of cluster properties.`)]}return[]}function Zr(e){let t=e.key,n=e.value,r=e.valueSpec,i=[];return Array.isArray(r.values)?r.values.indexOf(Wr(n))===-1&&i.push(new F(t,n,`expected one of [${r.values.join(`, `)}], ${JSON.stringify(n)} found`)):Object.keys(r.values).indexOf(Wr(n))===-1&&i.push(new F(t,n,`expected one of [${Object.keys(r.values).join(`, `)}], ${JSON.stringify(n)} found`)),i}function Qr(e){return jr(Gr(e.value))?Xr(Ce({},e,{expressionContext:`filter`,valueSpec:{value:`boolean`}})):$r(e)}function $r(e){let t=e.value,n=e.key;if(q(t)!==`array`)return[new F(n,t,`array expected, ${q(t)} found`)];let r=e.styleSpec,i,a=[];if(t.length<1)return[new F(n,t,`filter array must have at least 1 element`)];switch(a=a.concat(Zr({key:`${n}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),Wr(t[0])){case`<`:case`<=`:case`>`:case`>=`:t.length>=2&&Wr(t[1])===`$type`&&a.push(new F(n,t,`"$type" cannot be use with operator "${t[0]}"`));case`==`:case`!=`:t.length!==3&&a.push(new F(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case`in`:case`!in`:t.length>=2&&(i=q(t[1]),i!==`string`&&a.push(new F(`${n}[1]`,t[1],`string expected, ${i} found`)));for(let o=2;o<t.length;o++)i=q(t[o]),Wr(t[1])===`$type`?a=a.concat(Zr({key:`${n}[${o}]`,value:t[o],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):i!==`string`&&i!==`number`&&i!==`boolean`&&a.push(new F(`${n}[${o}]`,t[o],`string, number, or boolean expected, ${i} found`));break;case`any`:case`all`:case`none`:for(let r=1;r<t.length;r++)a=a.concat($r({key:`${n}[${r}]`,value:t[r],style:e.style,styleSpec:e.styleSpec}));break;case`has`:case`!has`:i=q(t[1]),t.length===2?i!==`string`&&a.push(new F(`${n}[1]`,t[1],`string expected, ${i} found`)):a.push(new F(n,t,`filter array for "${t[0]}" operator must have 2 elements`))}return a}function ei(e,t){let n=e.key,r=e.validateSpec,i=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,c=a[`${t}_${e.layerType}`];if(!c)return[];let l=s.match(/^(.*)-transition$/);if(t===`paint`&&l&&c[l[1]]&&c[l[1]].transition)return r({key:n,value:o,valueSpec:a.transition,style:i,styleSpec:a});let u=e.valueSpec||c[s];if(!u)return[new F(n,o,`unknown property "${s}"`)];let d;if(q(o)===`string`&&fr(u)&&!u.tokens&&(d=/^{([^}]+)}$/.exec(o)))return[new F(n,o,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(d[1])} }\`.`)];let f=[];return e.layerType===`symbol`&&(s===`text-field`&&i&&!i.glyphs&&f.push(new F(n,o,`use of "text-field" requires a style "glyphs" property`)),s===`text-font`&&hr(Gr(o))&&Wr(o.type)===`identity`&&f.push(new F(n,o,`"text-font" does not support identity functions`))),f.concat(r({key:e.key,value:o,valueSpec:u,style:i,styleSpec:a,expressionContext:`property`,propertyType:t,propertyKey:s}))}function ti(e){return ei(e,`paint`)}function ni(e){return ei(e,`layout`)}function ri(e){let t=[],n=e.value,r=e.key,i=e.style,a=e.styleSpec;n.type||n.ref||t.push(new F(r,n,`either "type" or "ref" is required`));let o=Wr(n.type),s=Wr(n.ref);if(n.id){let a=Wr(n.id);for(let o=0;o<e.arrayIndex;o++){let e=i.layers[o];Wr(e.id)===a&&t.push(new F(r,n.id,`duplicate layer id "${n.id}", previously used at line ${e.id.__line__}`))}}if(`ref`in n){let e;[`type`,`source`,`source-layer`,`filter`,`layout`].forEach((e=>{e in n&&t.push(new F(r,n[e],`"${e}" is prohibited for ref layers`))})),i.layers.forEach((t=>{Wr(t.id)===s&&(e=t)})),e?e.ref?t.push(new F(r,n.ref,`ref cannot reference another ref layer`)):o=Wr(e.type):t.push(new F(r,n.ref,`ref layer "${s}" not found`))}else if(o!==`background`)if(n.source){let e=i.sources&&i.sources[n.source],a=e&&Wr(e.type);e?a===`vector`&&o===`raster`?t.push(new F(r,n.source,`layer "${n.id}" requires a raster source`)):a!==`raster-dem`&&o===`hillshade`?t.push(new F(r,n.source,`layer "${n.id}" requires a raster-dem source`)):a===`raster`&&o!==`raster`?t.push(new F(r,n.source,`layer "${n.id}" requires a vector source`)):a!==`vector`||n[`source-layer`]?a===`raster-dem`&&o!==`hillshade`?t.push(new F(r,n.source,`raster-dem source can only be used with layer type 'hillshade'.`)):o!==`line`||!n.paint||!n.paint[`line-gradient`]||a===`geojson`&&e.lineMetrics||t.push(new F(r,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new F(r,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new F(r,n.source,`source "${n.source}" not found`))}else t.push(new F(r,n,`missing required property "source"`));return t=t.concat(Kr({key:r,value:n,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${r}.type`,value:n.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:n,objectKey:`type`}),filter:Qr,layout:e=>Kr({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>ni(Ce({layerType:o},e))}}),paint:e=>Kr({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>ti(Ce({layerType:o},e))}})}})),t}function ii(e){let t=e.value,n=e.key,r=q(t);return r===`string`?[]:[new F(n,t,`string expected, ${r} found`)]}let ai={promoteId:function({key:e,value:t}){if(q(t)===`string`)return ii({key:e,value:t});{let n=[];for(let r in t)n.push(...ii({key:`${e}.${r}`,value:t[r]}));return n}}};function oi(e){let t=e.value,n=e.key,r=e.styleSpec,i=e.style,a=e.validateSpec;if(!t.type)return[new F(n,t,`"type" is required`)];let o=Wr(t.type),s;switch(o){case`vector`:case`raster`:return s=Kr({key:n,value:t,valueSpec:r[`source_${o.replace(`-`,`_`)}`],style:e.style,styleSpec:r,objectElementValidators:ai,validateSpec:a}),s;case`raster-dem`:return s=function(e){let t=e.sourceName??``,n=e.value,r=e.styleSpec,i=r.source_raster_dem,a=e.style,o=[],s=q(n);if(n===void 0)return o;if(s!==`object`)return o.push(new F(`source_raster_dem`,n,`object expected, ${s} found`)),o;let c=Wr(n.encoding)===`custom`,l=[`redFactor`,`greenFactor`,`blueFactor`,`baseShift`],u=e.value.encoding?`"${e.value.encoding}"`:`Default`;for(let s in n)!c&&l.includes(s)?o.push(new F(s,n[s],`In "${t}": "${s}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):i[s]?o=o.concat(e.validateSpec({key:s,value:n[s],valueSpec:i[s],validateSpec:e.validateSpec,style:a,styleSpec:r})):o.push(new F(s,n[s],`unknown property "${s}"`));return o}({sourceName:n,value:t,style:e.style,styleSpec:r,validateSpec:a}),s;case`geojson`:if(s=Kr({key:n,value:t,valueSpec:r.source_geojson,style:i,styleSpec:r,validateSpec:a,objectElementValidators:ai}),t.cluster)for(let e in t.clusterProperties){let[r,i]=t.clusterProperties[e],o=typeof r==`string`?[r,[`accumulated`],[`get`,e]]:r;s.push(...Xr({key:`${n}.${e}.map`,value:i,validateSpec:a,expressionContext:`cluster-map`})),s.push(...Xr({key:`${n}.${e}.reduce`,value:o,validateSpec:a,expressionContext:`cluster-reduce`}))}return s;case`video`:return Kr({key:n,value:t,valueSpec:r.source_video,style:i,validateSpec:a,styleSpec:r});case`image`:return Kr({key:n,value:t,valueSpec:r.source_image,style:i,validateSpec:a,styleSpec:r});case`canvas`:return[new F(n,null,`Please use runtime APIs to add canvas sources, rather than including them in stylesheets.`,`source.canvas`)];default:return Zr({key:`${n}.type`,value:t.type,valueSpec:{values:[`vector`,`raster`,`raster-dem`,`geojson`,`video`,`image`]},style:i,validateSpec:a,styleSpec:r})}}function si(e){let t=e.value,n=e.styleSpec,r=n.light,i=e.style,a=[],o=q(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new F(`light`,t,`object expected, ${o} found`)]),a;for(let o in t){let s=o.match(/^(.*)-transition$/);a=a.concat(s&&r[s[1]]&&r[s[1]].transition?e.validateSpec({key:o,value:t[o],valueSpec:n.transition,validateSpec:e.validateSpec,style:i,styleSpec:n}):r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new F(o,t[o],`unknown property "${o}"`)])}return a}function ci(e){let t=e.value,n=e.styleSpec,r=n.sky,i=e.style,a=q(t);if(t===void 0)return[];if(a!==`object`)return[new F(`sky`,t,`object expected, ${a} found`)];let o=[];for(let a in t)o=o.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n}):[new F(a,t[a],`unknown property "${a}"`)]);return o}function li(e){let t=e.value,n=e.styleSpec,r=n.terrain,i=e.style,a=[],o=q(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new F(`terrain`,t,`object expected, ${o} found`)]),a;for(let o in t)a=a.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new F(o,t[o],`unknown property "${o}"`)]);return a}function ui(e){let t=[],n=e.value,r=e.key;if(Array.isArray(n)){let i=[],a=[];for(let o in n)n[o].id&&i.includes(n[o].id)&&t.push(new F(r,n,`all the sprites' ids must be unique, but ${n[o].id} is duplicated`)),i.push(n[o].id),n[o].url&&a.includes(n[o].url)&&t.push(new F(r,n,`all the sprites' URLs must be unique, but ${n[o].url} is duplicated`)),a.push(n[o].url),t=t.concat(Kr({key:`${r}[${o}]`,value:n[o],valueSpec:{id:{type:`string`,required:!0},url:{type:`string`,required:!0}},validateSpec:e.validateSpec}));return t}return ii({key:r,value:n})}let di={"*":()=>[],array:qr,boolean:function(e){let t=e.value,n=e.key,r=q(t);return r===`boolean`?[]:[new F(n,t,`boolean expected, ${r} found`)]},number:Jr,color:function(e){let t=e.key,n=e.value,r=q(n);return r===`string`?B.parse(String(n))?[]:[new F(t,n,`color expected, "${n}" found`)]:[new F(t,n,`color expected, ${r} found`)]},constants:Ur,enum:Zr,filter:Qr,function:Yr,layer:ri,object:Kr,source:oi,light:si,sky:ci,terrain:li,projection:function(e){let t=e.value,n=e.styleSpec,r=n.projection,i=e.style,a=q(t);if(t===void 0)return[];if(a!==`object`)return[new F(`projection`,t,`object expected, ${a} found`)];let o=[];for(let a in t)o=o.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n}):[new F(a,t[a],`unknown property "${a}"`)]);return o},string:ii,formatted:function(e){return ii(e).length===0?[]:Xr(e)},resolvedImage:function(e){return ii(e).length===0?[]:Xr(e)},padding:function(e){let t=e.key,n=e.value;if(q(n)===`array`){if(n.length<1||n.length>4)return[new F(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];let r={type:`number`},i=[];for(let a=0;a<n.length;a++)i=i.concat(e.validateSpec({key:`${t}[${a}]`,value:n[a],validateSpec:e.validateSpec,valueSpec:r}));return i}return Jr({key:t,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(e){let t=e.key,n=e.value,r=q(n),i=e.styleSpec;if(r!==`array`||n.length<1||n.length%2!=0)return[new F(t,n,`variableAnchorOffsetCollection requires a non-empty array of even length`)];let a=[];for(let r=0;r<n.length;r+=2)a=a.concat(Zr({key:`${t}[${r}]`,value:n[r],valueSpec:i.layout_symbol[`text-anchor`]})),a=a.concat(qr({key:`${t}[${r+1}]`,value:n[r+1],valueSpec:{length:2,value:`number`},validateSpec:e.validateSpec,style:e.style,styleSpec:i}));return a},sprite:ui};function fi(e){let t=e.value,n=e.valueSpec,r=e.styleSpec;return e.validateSpec=fi,n.expression&&hr(Wr(t))?Yr(e):n.expression&&wr(Gr(t))?Xr(e):n.type&&di[n.type]?di[n.type](e):Kr(Ce({},e,{valueSpec:n.type?r[n.type]:n}))}function pi(e){let t=e.value,n=e.key,r=ii(e);return r.length||(t.indexOf(`{fontstack}`)===-1&&r.push(new F(n,t,`"glyphs" url must include a "{fontstack}" token`)),t.indexOf(`{range}`)===-1&&r.push(new F(n,t,`"glyphs" url must include a "{range}" token`))),r}function mi(e,t=N){let n=[];return n=n.concat(fi({key:``,value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:fi,objectElementValidators:{glyphs:pi,"*":()=>[]}})),e.constants&&(n=n.concat(Ur({key:`constants`,value:e.constants,style:e,styleSpec:t,validateSpec:fi}))),gi(n)}function hi(e){return function(t){return e({...t,validateSpec:fi})}}function gi(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function _i(e){return function(...t){return gi(e.apply(this,t))}}mi.source=_i(hi(oi)),mi.sprite=_i(hi(ui)),mi.glyphs=_i(hi(pi)),mi.light=_i(hi(si)),mi.sky=_i(hi(ci)),mi.terrain=_i(hi(li)),mi.layer=_i(hi(ri)),mi.filter=_i(hi(Qr)),mi.paintProperty=_i(hi(ti)),mi.layoutProperty=_i(hi(ni));let vi=mi,yi=vi.light,bi=vi.sky,xi=vi.paintProperty,Si=vi.layoutProperty;function Ci(e,t){let n=!1;if(t&&t.length)for(let r of t)e.fire(new de(Error(r.message))),n=!0;return n}class wi{constructor(e,t,n){let r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let i=new Int32Array(this.arrayBuffer);e=i[0],this.d=(t=i[1])+2*(n=i[2]);for(let e=0;e<this.d*this.d;e++){let t=i[3+e],n=i[3+e+1];r.push(t===n?null:i.subarray(t,n))}let a=i[3+r.length+1];this.keys=i.subarray(i[3+r.length],a),this.bboxes=i.subarray(a),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let e=0;e<this.d*this.d;e++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;let i=n/t*e;this.min=-i,this.max=e+i}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}_insertReadonly(){throw Error(`Cannot insert into a GridIndex created from an ArrayBuffer.`)}_insertCell(e,t,n,r,i,a){this.cells[i].push(a)}query(e,t,n,r,i){let a=this.min,o=this.max;if(e<=a&&t<=a&&o<=n&&o<=r&&!i)return Array.prototype.slice.call(this.keys);{let a=[];return this._forEachCell(e,t,n,r,this._queryCell,a,{},i),a}}_queryCell(e,t,n,r,i,a,o,s){let c=this.cells[i];if(c!==null){let i=this.keys,l=this.bboxes;for(let u=0;u<c.length;u++){let d=c[u];if(o[d]===void 0){let c=4*d;(s?s(l[c+0],l[c+1],l[c+2],l[c+3]):e<=l[c+2]&&t<=l[c+3]&&n>=l[c+0]&&r>=l[c+1])?(o[d]=!0,a.push(i[d])):o[d]=!1}}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToCellCoord(e),l=this._convertToCellCoord(t),u=this._convertToCellCoord(n),d=this._convertToCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++){let l=this.d*c+f;if((!s||s(this._convertFromCellCoord(f),this._convertFromCellCoord(c),this._convertFromCellCoord(f+1),this._convertFromCellCoord(c+1)))&&i.call(this,e,t,n,r,l,a,o,s))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,t=3+this.cells.length+1+1,n=0;for(let e=0;e<this.cells.length;e++)n+=this.cells[e].length;let r=new Int32Array(t+n+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let i=t;for(let t=0;t<e.length;t++){let n=e[t];r[3+t]=i,r.set(n,i),i+=n.length}return r[3+e.length]=i,r.set(this.keys,i),i+=this.keys.length,r[3+e.length+1]=i,r.set(this.bboxes,i),i+=this.bboxes.length,r.buffer}static serialize(e,t){let n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new wi(e.buffer)}}let Ti={};function J(e,t,n={}){if(Ti[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),Ti[e]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}J(`Object`,Object),J(`TransferableGridIndex`,wi),J(`Color`,B),J(`Error`,Error),J(`AJAXError`,ie),J(`ResolvedImage`,ft),J(`StylePropertyFunction`,kr),J(`StyleExpression`,Cr,{omit:[`_evaluator`]}),J(`ZoomDependentExpression`,Dr),J(`ZoomConstantExpression`,Er),J(`CompoundExpression`,tr,{omit:[`_evaluate`]});for(let e in er)er[e]._classRegistryKey||J(`Expression_${e}`,er[e]);function Ei(e){return e&&typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name===`ArrayBuffer`)}function Di(e){return e.$name||e.constructor._classRegistryKey}function Oi(e){return!function(e){if(typeof e!=`object`||!e)return!1;let t=Di(e);return!(!t||t===`Object`)}(e)&&(e==null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||Ei(e)||D(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function ki(e,t){if(Oi(e))return(Ei(e)||D(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let n=[];for(let r of e)n.push(ki(r,t));return n}if(typeof e!=`object`)throw Error(`can't serialize object of type `+typeof e);let n=Di(e);if(!n)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!Ti[n])throw Error(`${n} is not registered.`);let{klass:r}=Ti[n],i=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&i===t[t.length-1])throw Error(`statically serialized object won't survive transfer of $name property`)}else{for(let r in e){if(!e.hasOwnProperty(r)||Ti[n].omit.indexOf(r)>=0)continue;let a=e[r];i[r]=Ti[n].shallow.indexOf(r)>=0?a:ki(a,t)}e instanceof Error&&(i.message=e.message)}if(i.$name)throw Error(`$name property is reserved for worker serialization logic.`);return n!==`Object`&&(i.$name=n),i}function Ai(e){if(Oi(e))return e;if(Array.isArray(e))return e.map(Ai);if(typeof e!=`object`)throw Error(`can't deserialize object of type `+typeof e);let t=Di(e)||`Object`;if(!Ti[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:n}=Ti[t];if(!n)throw Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(e);let r=Object.create(n.prototype);for(let n of Object.keys(e)){if(n===`$name`)continue;let i=e[n];r[n]=Ti[t].shallow.indexOf(n)>=0?i:Ai(i)}return r}class ji{constructor(){this.first=!0}update(e,t){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=n,!0))}}let Y={"Latin-1 Supplement":e=>e>=128&&e<=255,"Hangul Jamo":e=>e>=4352&&e<=4607,Khmer:e=>e>=6016&&e<=6143,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Katakana:e=>e>=12448&&e<=12543,Kanbun:e=>e>=12688&&e<=12703,"CJK Strokes":e=>e>=12736&&e<=12783,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"Private Use Area":e=>e>=57344&&e<=63743,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function Mi(e){for(let t of e)if(Ri(t.charCodeAt(0)))return!0;return!1}function Ni(e){for(let t of e)if(!Ii(t.charCodeAt(0)))return!1;return!0}function Pi(e){let t=e.map((e=>{try{return RegExp(`\\p{sc=${e}}`,`u`).source}catch{return null}})).filter((e=>e));return new RegExp(t.join(`|`),`u`)}let Fi=Pi([`Arab`,`Dupl`,`Mong`,`Ougr`,`Syrc`]);function Ii(e){return!Fi.test(String.fromCodePoint(e))}let Li=Pi([`Bopo`,`Hani`,`Hira`,`Kana`,`Kits`,`Nshu`,`Tang`,`Yiii`]);function Ri(e){return!(e!==746&&e!==747&&(e<4352||!(Y[`CJK Compatibility Forms`](e)&&!(e>=65097&&e<=65103)||Y[`CJK Compatibility`](e)||Y[`CJK Strokes`](e)||!(!Y[`CJK Symbols and Punctuation`](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||e===12336)||Y[`Enclosed CJK Letters and Months`](e)||Y[`Ideographic Description Characters`](e)||Y.Kanbun(e)||Y.Katakana(e)&&e!==12540||!(!Y[`Halfwidth and Fullwidth Forms`](e)||e===65288||e===65289||e===65293||e>=65306&&e<=65310||e===65339||e===65341||e===65343||e>=65371&&e<=65503||e===65507||e>=65512&&e<=65519)||!(!Y[`Small Form Variants`](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||Y[`Vertical Forms`](e)||Y[`Yijing Hexagram Symbols`](e)||/\p{sc=Cans}/u.test(String.fromCodePoint(e))||/\p{sc=Hang}/u.test(String.fromCodePoint(e))||Li.test(String.fromCodePoint(e)))))}function zi(e){return!(Ri(e)||function(e){return!!(Y[`Latin-1 Supplement`](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Y[`General Punctuation`](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Y[`Letterlike Symbols`](e)||Y[`Number Forms`](e)||Y[`Miscellaneous Technical`](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Y[`Control Pictures`](e)&&e!==9251||Y[`Optical Character Recognition`](e)||Y[`Enclosed Alphanumerics`](e)||Y[`Geometric Shapes`](e)||Y[`Miscellaneous Symbols`](e)&&!(e>=9754&&e<=9759)||Y[`Miscellaneous Symbols and Arrows`](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Y[`CJK Symbols and Punctuation`](e)||Y.Katakana(e)||Y[`Private Use Area`](e)||Y[`CJK Compatibility Forms`](e)||Y[`Small Form Variants`](e)||Y[`Halfwidth and Fullwidth Forms`](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(e))}let Bi=Pi(`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`.split(`.`));function Vi(e){return Bi.test(String.fromCodePoint(e))}function Hi(e,t){return!(!t&&Vi(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||Y.Khmer(e))}function Ui(e){for(let t of e)if(Vi(t.charCodeAt(0)))return!0;return!1}let Wi=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus=`unavailable`,this.pluginURL=null}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class X{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ji,this.transition={})}isSupportedScript(e){return function(e,t){for(let n of e)if(!Hi(n.charCodeAt(0),t))return!1;return!0}(e,Wi.getRTLTextPluginStatus()===`loaded`)}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*t}}}class Gi{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(hr(e))return new kr(e,t);if(wr(e)){let n=Or(e,t);if(n.result===`error`)throw Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return n.value}{let n=e;return t.type===`color`&&typeof e==`string`?n=B.parse(e):t.type!==`padding`||typeof e!=`number`&&!Array.isArray(e)?t.type===`variableAnchorOffsetCollection`&&Array.isArray(e)&&(n=dt.parse(e)):n=lt.parse(e),{kind:`constant`,evaluate:()=>n}}}(t===void 0?e.specification.default:t,e.specification)}isDataDriven(){return this.expression.kind===`source`||this.expression.kind===`composite`}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}}class Ki{constructor(e){this.property=e,this.value=new Gi(e,void 0)}transitioned(e,t){return new Ji(this.property,this.value,t,_({},e.transition,this.transition),e.now)}untransitioned(){return new Ji(this.property,this.value,null,{},0)}}class qi{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return x(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ki(this._values[e].property)),this._values[e].value=new Gi(this._values[e].property,t===null?void 0:x(t))}getTransition(e){return x(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ki(this._values[e].property)),this._values[e].transition=x(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n);let r=this.getTransition(t);r!==void 0&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){let n=new Yi(this._properties);for(let r of Object.keys(this._values))n._values[r]=this._values[r].transitioned(e,t._values[r]);return n}untransitioned(){let e=new Yi(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Ji{constructor(e,t,n,r,i){this.property=e,this.value=t,this.begin=i+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){let r=e.now||0,i=this.value.possiblyEvaluate(e,t,n),a=this.prior;if(a){if(r>this.end||this.value.isDataDriven())return this.prior=null,i;if(r<this.begin)return a.possiblyEvaluate(e,t,n);{let o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,n),i,function(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}(o))}}return i}}class Yi{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){let r=new Qi(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Xi{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return x(this._values[e].value)}setValue(e,t){this._values[e]=new Gi(this._values[e].property,t===null?void 0:x(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n)}return e}possiblyEvaluate(e,t,n){let r=new Qi(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}}class Zi{constructor(e,t,n){this.property=e,this.value=t,this.parameters=n}isConstant(){return this.value.kind===`constant`}constantOr(e){return this.value.kind===`constant`?this.value.value:e}evaluate(e,t,n,r){return this.property.evaluate(this.value,this.parameters,e,t,n,r)}}class Qi{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Z{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw Error(`Value should not be data driven`);return e.expression.evaluate(t)}interpolate(e,t,n){let r=Vt[this.specification.type];return r?r(e,t,n):e}}class Q{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,r){return new Zi(this,e.expression.kind===`constant`||e.expression.kind===`camera`?{kind:`constant`,value:e.expression.evaluate(t,null,{},n,r)}:e.expression,t)}interpolate(e,t,n){if(e.value.kind!==`constant`||t.value.kind!==`constant`)return e;if(e.value.value===void 0||t.value.value===void 0)return new Zi(this,{kind:`constant`,value:void 0},e.parameters);let r=Vt[this.specification.type];if(r){let i=r(e.value.value,t.value.value,n);return new Zi(this,{kind:`constant`,value:i},e.parameters)}return e}evaluate(e,t,n,r,i,a){return e.kind===`constant`?e.value:e.evaluate(t,n,r,i,a)}}class $i extends Q{possiblyEvaluate(e,t,n,r){if(e.value===void 0)return new Zi(this,{kind:`constant`,value:void 0},t);if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r),a=e.property.specification.type===`resolvedImage`&&typeof i!=`string`?i.name:i,o=this._calculate(a,a,a,t);return new Zi(this,{kind:`constant`,value:o},t)}if(e.expression.kind===`camera`){let n=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Zi(this,{kind:`constant`,value:n},t)}return new Zi(this,e.expression,t)}evaluate(e,t,n,r,i,a){if(e.kind===`source`){let o=e.evaluate(t,n,r,i,a);return this._calculate(o,o,o,t)}return e.kind===`composite`?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,r),e.evaluate({zoom:Math.floor(t.zoom)},n,r),e.evaluate({zoom:Math.floor(t.zoom)+1},n,r),t):e.value}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class ea{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){if(e.value!==void 0){if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r);return this._calculate(i,i,i,t)}return this._calculate(e.expression.evaluate(new X(Math.floor(t.zoom-1),t)),e.expression.evaluate(new X(Math.floor(t.zoom),t)),e.expression.evaluate(new X(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class ta{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){return!!e.expression.evaluate(t,null,{},n,r)}interpolate(){return!1}}class na{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let n=e[t];n.specification.overridable&&this.overridableProperties.push(t);let r=this.defaultPropertyValues[t]=new Gi(n,void 0),i=this.defaultTransitionablePropertyValues[t]=new Ki(n);this.defaultTransitioningPropertyValues[t]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}J(`DataDrivenProperty`,Q),J(`DataConstantProperty`,Z),J(`CrossFadedDataDrivenProperty`,$i),J(`CrossFadedProperty`,ea),J(`ColorRampProperty`,ta);let ra=`-transition`;class ia extends fe{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!==`custom`&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!==`background`&&(this.source=e.source,this.sourceLayer=e[`source-layer`],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new Xi(t.layout)),t.paint)){this._transitionablePaint=new qi(t.paint);for(let t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Qi(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e===`visibility`?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,n={}){t!=null&&this._validate(Si,`layers.${this.id}.layout.${e}`,e,t,n)||(e===`visibility`?this.visibility=t:this._unevaluatedLayout.setValue(e,t))}getPaintProperty(e){return e.endsWith(ra)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(t!=null&&this._validate(xi,`layers.${this.id}.paint.${e}`,e,t,n))return!1;if(e.endsWith(ra))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let n=this._transitionablePaint._values[e],r=n.property.specification[`property-type`]===`cross-faded-data-driven`,i=n.value.isDataDriven(),a=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let o=this._transitionablePaint._values[e].value;return o.isDataDriven()||i||r||this._handleOverridablePaintPropertyUpdate(e,a,o)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility===`none`}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),b(e,((e,t)=>!(e===void 0||t===`layout`&&!Object.keys(e).length||t===`paint`&&!Object.keys(e).length)))}_validate(e,t,n,r,i={}){return(!i||!1!==i.validate)&&Ci(this,e.call(vi,{key:t,layerType:this.type,objectKey:n,value:r,styleSpec:N,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(t instanceof Zi&&fr(t.property.specification)&&(t.value.kind===`source`||t.value.kind===`composite`)&&t.value.isStateDependent)return!0}return!1}}let aa={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class oa{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class sa{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw Error(`_refreshViews() must be implemented by each concrete StructArray layout`)}}function ca(e,t=1){let n=0,r=0;return{members:e.map((e=>{let i=aa[e.type].BYTES_PER_ELEMENT,a=n=la(n,Math.max(t,i)),o=e.components||1;return r=Math.max(r,i),n+=i*o,{name:e.name,type:e.type,components:o,offset:a}})),size:la(n,Math.max(r,t)),alignment:t}}function la(e,t){return Math.ceil(e/t)*t}class ua extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.int16[r+0]=t,this.int16[r+1]=n,e}}ua.prototype.bytesPerElement=4,J(`StructArrayLayout2i4`,ua);class da extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=r,e}}da.prototype.bytesPerElement=6,J(`StructArrayLayout3i6`,da);class fa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.int16[a+0]=t,this.int16[a+1]=n,this.int16[a+2]=r,this.int16[a+3]=i,e}}fa.prototype.bytesPerElement=8,J(`StructArrayLayout4i8`,fa);class pa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}pa.prototype.bytesPerElement=12,J(`StructArrayLayout2i4i12`,pa);class ma extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=4*e,c=8*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.uint8[c+4]=r,this.uint8[c+5]=i,this.uint8[c+6]=a,this.uint8[c+7]=o,e}}ma.prototype.bytesPerElement=8,J(`StructArrayLayout2i4ub8`,ma);class ha extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.float32[r+0]=t,this.float32[r+1]=n,e}}ha.prototype.bytesPerElement=8,J(`StructArrayLayout2f8`,ha);class ga extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,n,r,i,a,o,s,c,l)}emplace(e,t,n,r,i,a,o,s,c,l,u){let d=10*e;return this.uint16[d+0]=t,this.uint16[d+1]=n,this.uint16[d+2]=r,this.uint16[d+3]=i,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=c,this.uint16[d+8]=l,this.uint16[d+9]=u,e}}ga.prototype.bytesPerElement=20,J(`StructArrayLayout10ui20`,ga);class _a extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,e,t,n,r,i,a,o,s,c,l,u,d)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f){let p=12*e;return this.int16[p+0]=t,this.int16[p+1]=n,this.int16[p+2]=r,this.int16[p+3]=i,this.uint16[p+4]=a,this.uint16[p+5]=o,this.uint16[p+6]=s,this.uint16[p+7]=c,this.int16[p+8]=l,this.int16[p+9]=u,this.int16[p+10]=d,this.int16[p+11]=f,e}}_a.prototype.bytesPerElement=24,J(`StructArrayLayout4i4ui4i24`,_a);class va extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}va.prototype.bytesPerElement=12,J(`StructArrayLayout3f12`,va);class ya extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}ya.prototype.bytesPerElement=4,J(`StructArrayLayout1ul4`,ya);class ba extends sa{_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(e,t,n,r,i,a,o,s,c){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,r,i,a,o,s,c)}emplace(e,t,n,r,i,a,o,s,c,l){let u=10*e,d=5*e;return this.int16[u+0]=t,this.int16[u+1]=n,this.int16[u+2]=r,this.int16[u+3]=i,this.int16[u+4]=a,this.int16[u+5]=o,this.uint32[d+3]=s,this.uint16[u+8]=c,this.uint16[u+9]=l,e}}ba.prototype.bytesPerElement=20,J(`StructArrayLayout6i1ul2ui20`,ba);class xa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}xa.prototype.bytesPerElement=12,J(`StructArrayLayout2i2i2i12`,xa);class Sa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r,i)}emplace(e,t,n,r,i,a){let o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=r,this.int16[s+6]=i,this.int16[s+7]=a,e}}Sa.prototype.bytesPerElement=16,J(`StructArrayLayout2f1f2i16`,Sa);class Ca extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=16*e,c=4*e,l=8*e;return this.uint8[s+0]=t,this.uint8[s+1]=n,this.float32[c+1]=r,this.float32[c+2]=i,this.int16[l+6]=a,this.int16[l+7]=o,e}}Ca.prototype.bytesPerElement=16,J(`StructArrayLayout2ub2f2i16`,Ca);class wa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.uint16[i+0]=t,this.uint16[i+1]=n,this.uint16[i+2]=r,e}}wa.prototype.bytesPerElement=6,J(`StructArrayLayout3ui6`,wa);class Ta extends sa{_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(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=24*e,y=12*e,b=48*e;return this.int16[v+0]=t,this.int16[v+1]=n,this.uint16[v+2]=r,this.uint16[v+3]=i,this.uint32[y+2]=a,this.uint32[y+3]=o,this.uint32[y+4]=s,this.uint16[v+10]=c,this.uint16[v+11]=l,this.uint16[v+12]=u,this.float32[y+7]=d,this.float32[y+8]=f,this.uint8[b+36]=p,this.uint8[b+37]=m,this.uint8[b+38]=h,this.uint32[y+10]=g,this.int16[v+22]=_,e}}Ta.prototype.bytesPerElement=48,J(`StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48`,Ta);class Ea extends sa{_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(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D){let O=this.length;return this.resize(O+1),this.emplace(O,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O){let k=32*e,A=16*e;return this.int16[k+0]=t,this.int16[k+1]=n,this.int16[k+2]=r,this.int16[k+3]=i,this.int16[k+4]=a,this.int16[k+5]=o,this.int16[k+6]=s,this.int16[k+7]=c,this.uint16[k+8]=l,this.uint16[k+9]=u,this.uint16[k+10]=d,this.uint16[k+11]=f,this.uint16[k+12]=p,this.uint16[k+13]=m,this.uint16[k+14]=h,this.uint16[k+15]=g,this.uint16[k+16]=_,this.uint16[k+17]=v,this.uint16[k+18]=y,this.uint16[k+19]=b,this.uint16[k+20]=x,this.uint16[k+21]=S,this.uint16[k+22]=C,this.uint32[A+12]=w,this.float32[A+13]=T,this.float32[A+14]=E,this.uint16[k+30]=D,this.uint16[k+31]=O,e}}Ea.prototype.bytesPerElement=64,J(`StructArrayLayout8i15ui1ul2f2ui64`,Ea);class Da extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Da.prototype.bytesPerElement=4,J(`StructArrayLayout1f4`,Da);class Oa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.uint16[6*e+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}Oa.prototype.bytesPerElement=12,J(`StructArrayLayout1ui2f12`,Oa);class ka extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=4*e;return this.uint32[2*e+0]=t,this.uint16[i+2]=n,this.uint16[i+3]=r,e}}ka.prototype.bytesPerElement=8,J(`StructArrayLayout1ul2ui8`,ka);class Aa extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=n,e}}Aa.prototype.bytesPerElement=4,J(`StructArrayLayout2ui4`,Aa);class ja extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}ja.prototype.bytesPerElement=2,J(`StructArrayLayout1ui2`,ja);class Ma extends sa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=r,this.float32[a+3]=i,e}}Ma.prototype.bytesPerElement=16,J(`StructArrayLayout4f16`,Ma);class Na extends oa{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 a(this.anchorPointX,this.anchorPointY)}}Na.prototype.size=20;class Pa extends ba{get(e){return new Na(this,e)}}J(`CollisionBoxArray`,Pa);class Fa extends oa{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Fa.prototype.size=48;class Ia extends Ta{get(e){return new Fa(this,e)}}J(`PlacedSymbolArray`,Ia);class La extends oa{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}La.prototype.size=64;class Ra extends Ea{get(e){return new La(this,e)}}J(`SymbolInstanceArray`,Ra);class za extends Da{getoffsetX(e){return this.float32[1*e+0]}}J(`GlyphOffsetArray`,za);class Ba extends da{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}J(`SymbolLineVertexArray`,Ba);class Va extends oa{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]}}Va.prototype.size=12;class Ha extends Oa{get(e){return new Va(this,e)}}J(`TextAnchorOffsetArray`,Ha);class Ua extends oa{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]}}Ua.prototype.size=8;class Wa extends ka{get(e){return new Ua(this,e)}}J(`FeatureIndexArray`,Wa);class Ga extends ua{}class Ka extends ua{}class qa extends ua{}class Ja extends pa{}class Ya extends ma{}class Xa extends ha{}class Za extends ga{}class Qa extends _a{}class $a extends va{}class eo extends ya{}class to extends xa{}class no extends Ca{}class ro extends wa{}class io extends Aa{}let{members:ao}=ca([{name:`a_pos`,components:2,type:`Int16`}],4);class oo{constructor(e=[]){this.segments=e}prepareSegment(e,t,n,r){let i=this.segments[this.segments.length-1];return e>oo.MAX_VERTEX_ARRAY_LENGTH&&C(`Max vertices per segment is ${oo.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!i||i.vertexLength+e>oo.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==r)&&(i={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},r!==void 0&&(i.sortKey=r),this.segments.push(i)),i}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,r){return new oo([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:r,vaos:{},sortKey:0}])}}function so(e,t){return 256*(e=h(Math.floor(e),0,255))+h(Math.floor(t),0,255)}oo.MAX_VERTEX_ARRAY_LENGTH=2**16-1,J(`SegmentVector`,oo);let co=ca([{name:`a_pattern_from`,components:4,type:`Uint16`},{name:`a_pattern_to`,components:4,type:`Uint16`},{name:`a_pixel_ratio_from`,components:1,type:`Uint16`},{name:`a_pixel_ratio_to`,components:1,type:`Uint16`}]);var lo={exports:{}},uo={exports:{}};uo.exports=function(e,t){var n,r,i,a,o,s,c,l;for(r=e.length-(n=3&e.length),i=t,o=3432918353,s=461845907,l=0;l<r;)c=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,i=27492+(65535&(a=5*(65535&(i=(i^=c=(65535&(c=(c=(65535&c)*o+(((c>>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(c=0,n){case 3:c^=(255&e.charCodeAt(l+2))<<16;case 2:c^=(255&e.charCodeAt(l+1))<<8;case 1:i^=c=(65535&(c=(c=(65535&(c^=255&e.charCodeAt(l)))*o+(((c>>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295}return i^=e.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var fo=uo.exports,po={exports:{}};po.exports=function(e,t){for(var n,r=e.length,i=t^r,a=0;r>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))+((1540483477*(n>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++a;switch(r){case 3:i^=(255&e.charCodeAt(a+2))<<16;case 2:i^=(255&e.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var mo=fo,ho=po.exports;lo.exports=mo,lo.exports.murmur3=mo,lo.exports.murmur2=ho;var go=n(lo.exports);class _o{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,r){this.ids.push(vo(e)),this.positions.push(t,n,r)}getPositions(e){if(!this.indexed)throw Error(`Trying to get index, but feature positions are not indexed`);let t=vo(e),n=0,r=this.ids.length-1;for(;n<r;){let e=n+r>>1;this.ids[e]>=t?r=e:n=e+1}let i=[];for(;this.ids[n]===t;)i.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return i}static serialize(e,t){let n=new Float64Array(e.ids),r=new Uint32Array(e.positions);return yo(n,r,0,n.length-1),t&&t.push(n.buffer,r.buffer),{ids:n,positions:r}}static deserialize(e){let t=new _o;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function vo(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:go(String(e))}function yo(e,t,n,r){for(;n<r;){let i=e[n+r>>1],a=n-1,o=r+1;for(;;){do a++;while(e[a]<i);do o--;while(e[o]>i);if(a>=o)break;bo(e,a,o),bo(t,3*a,3*o),bo(t,3*a+1,3*o+1),bo(t,3*a+2,3*o+2)}o-n<r-o?(yo(e,t,n,o),n=o+1):(yo(e,t,o+1,r),r=o)}}function bo(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}J(`FeaturePositionMap`,_o);class xo{constructor(e,t){this.gl=e.gl,this.location=t}}class So extends xo{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Co extends xo{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class wo extends xo{constructor(e,t){super(e,t),this.current=B.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}let To=new Float32Array(16);function Eo(e){return[so(255*e.r,255*e.g),so(255*e.b,255*e.a)]}class Do{constructor(e,t,n){this.value=e,this.uniformNames=t.map((e=>`u_${e}`)),this.type=n}setUniform(e,t,n){e.set(n.constantOr(this.value))}getBinding(e,t,n){return this.type===`color`?new wo(e,t):new So(e,t)}}class Oo{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,n,r){let i=r===`u_pattern_to`?this.patternTo:r===`u_pattern_from`?this.patternFrom:r===`u_pixel_ratio_to`?this.pixelRatioTo:r===`u_pixel_ratio_from`?this.pixelRatioFrom:null;i&&e.set(i)}getBinding(e,t,n){return n.substr(0,9)===`u_pattern`?new Co(e,t):new So(e,t)}}class ko{constructor(e,t,n,r){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,n,r,i){let a=this.paintVertexArray.length,o=this.expression.evaluate(new X(0),t,{},r,[],i);this.paintVertexArray.resize(e),this._setPaintValue(a,e,o)}updatePaintArray(e,t,n,r){let i=this.expression.evaluate({zoom:0},n,r);this._setPaintValue(e,t,i)}_setPaintValue(e,t,n){if(this.type===`color`){let r=Eo(n);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ao{constructor(e,t,n,r,i,a){this.expression=e,this.uniformNames=t.map((e=>`u_${e}_t`)),this.type=n,this.useIntegerZoom=r,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?4:2,offset:0}))),this.paintVertexArray=new a}populatePaintArray(e,t,n,r,i){let a=this.expression.evaluate(new X(this.zoom),t,{},r,[],i),o=this.expression.evaluate(new X(this.zoom+1),t,{},r,[],i),s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(s,e,a,o)}updatePaintArray(e,t,n,r){let i=this.expression.evaluate({zoom:this.zoom},n,r),a=this.expression.evaluate({zoom:this.zoom+1},n,r);this._setPaintValue(e,t,i,a)}_setPaintValue(e,t,n,r){if(this.type===`color`){let i=Eo(n),a=Eo(r);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i[0],i[1],a[0],a[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n,r);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let n=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=h(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,n){return new So(e,t)}}class jo{constructor(e,t,n,r,i,a){this.expression=e,this.type=t,this.useIntegerZoom=n,this.zoom=r,this.layerId=a,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i}populatePaintArray(e,t,n){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,t.patterns&&t.patterns[this.layerId],n)}updatePaintArray(e,t,n,r,i){this._setPaintValues(e,t,n.patterns&&n.patterns[this.layerId],i)}_setPaintValues(e,t,n,r){if(!r||!n)return;let{min:i,mid:a,max:o}=n,s=r[i],c=r[a],l=r[o];if(s&&c&&l)for(let n=e;n<t;n++)this.zoomInPaintVertexArray.emplace(n,c.tl[0],c.tl[1],c.br[0],c.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],c.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(n,c.tl[0],c.tl[1],c.br[0],c.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],c.pixelRatio,l.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,co.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,co.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Mo{constructor(e,t,n){this.binders={},this._buffers=[];let r=[];for(let i in e.paint._values){if(!n(i))continue;let a=e.paint.get(i);if(!(a instanceof Zi&&fr(a.property.specification)))continue;let o=Po(i,e.type),s=a.value,c=a.property.specification.type,l=a.property.useIntegerZoom,u=a.property.specification[`property-type`],d=u===`cross-faded`||u===`cross-faded-data-driven`;if(s.kind===`constant`)this.binders[i]=d?new Oo(s.value,o):new Do(s.value,o,c),r.push(`/u_${i}`);else if(s.kind===`source`||d){let n=Fo(i,c,`source`);this.binders[i]=d?new jo(s,c,l,t,n,e.id):new ko(s,o,c,n),r.push(`/a_${i}`)}else{let e=Fo(i,c,`composite`);this.binders[i]=new Ao(s,o,c,l,t,e),r.push(`/z_${i}`)}}this.cacheKey=r.sort().join(``)}getMaxValue(e){let t=this.binders[e];return t instanceof ko||t instanceof Ao?t.maxValue:0}populatePaintArrays(e,t,n,r,i){for(let a in this.binders){let o=this.binders[a];(o instanceof ko||o instanceof Ao||o instanceof jo)&&o.populatePaintArray(e,t,n,r,i)}}setConstantPatternPositions(e,t){for(let n in this.binders){let r=this.binders[n];r instanceof Oo&&r.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,n,r,i){let a=!1;for(let o in e){let s=t.getPositions(o);for(let t of s){let s=n.feature(t.index);for(let n in this.binders){let c=this.binders[n];(c instanceof ko||c instanceof Ao||c instanceof jo)&&!0===c.expression.isStateDependent&&(c.expression=r.paint.get(n).value,c.updatePaintArray(t.start,t.end,s,e[o],i),a=!0)}}}return a}defines(){let e=[];for(let t in this.binders){let n=this.binders[t];(n instanceof Do||n instanceof Oo)&&e.push(...n.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof ko||n instanceof Ao)for(let t=0;t<n.paintVertexAttributes.length;t++)e.push(n.paintVertexAttributes[t].name);else if(n instanceof jo)for(let t=0;t<co.members.length;t++)e.push(co.members[t].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof Do||n instanceof Oo||n instanceof Ao)for(let t of n.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let n=[];for(let r in this.binders){let i=this.binders[r];if(i instanceof Do||i instanceof Oo||i instanceof Ao){for(let a of i.uniformNames)if(t[a]){let o=i.getBinding(e,t[a],a);n.push({name:a,property:r,binding:o})}}}return n}setUniforms(e,t,n,r){for(let{name:e,property:i,binding:a}of t)this.binders[i].setUniform(a,r,n.get(i),e)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let n=this.binders[t];if(e&&n instanceof jo){let t=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(n instanceof ko||n instanceof Ao)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let t in this.binders){let n=this.binders[t];(n instanceof ko||n instanceof Ao||n instanceof jo)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof ko||t instanceof Ao||t instanceof jo)&&t.destroy()}}}class No{constructor(e,t,n=(()=>!0)){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new Mo(r,t,n);this.needsUpload=!1,this._featureMap=new _o,this._bufferOffset=0}populatePaintArrays(e,t,n,r,i,a){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,r,i,a);t.id!==void 0&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,r){for(let i of n)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(e,this._featureMap,t,i,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Po(e,t){return{"text-opacity":[`opacity`],"icon-opacity":[`opacity`],"text-color":[`fill_color`],"icon-color":[`fill_color`],"text-halo-color":[`halo_color`],"icon-halo-color":[`halo_color`],"text-halo-blur":[`halo_blur`],"icon-halo-blur":[`halo_blur`],"text-halo-width":[`halo_width`],"icon-halo-width":[`halo_width`],"line-gap-width":[`gapwidth`],"line-pattern":[`pattern_to`,`pattern_from`,`pixel_ratio_to`,`pixel_ratio_from`],"fill-pattern":[`pattern_to`,`pattern_from`,`pixel_ratio_to`,`pixel_ratio_from`],"fill-extrusion-pattern":[`pattern_to`,`pattern_from`,`pixel_ratio_to`,`pixel_ratio_from`]}[e]||[e.replace(`${t}-`,``).replace(/-/g,`_`)]}function Fo(e,t,n){let r={color:{source:ha,composite:Ma},number:{source:Da,composite:ha}},i=function(e){return{"line-pattern":{source:Za,composite:Za},"fill-pattern":{source:Za,composite:Za},"fill-extrusion-pattern":{source:Za,composite:Za}}[e]}(e);return i&&i[n]||r[t][n]}J(`ConstantBinder`,Do),J(`CrossFadedConstantBinder`,Oo),J(`SourceExpressionBinder`,ko),J(`CrossFadedCompositeBinder`,jo),J(`CompositeExpressionBinder`,Ao),J(`ProgramConfiguration`,Mo,{omit:[`_buffers`]}),J(`ProgramConfigurationSet`,No);let Io=8192,Lo=2**14-1,Ro=-Lo-1;function zo(e){let t=Io/e.extent,n=e.loadGeometry();for(let e=0;e<n.length;e++){let r=n[e];for(let e=0;e<r.length;e++){let n=r[e],i=Math.round(n.x*t),a=Math.round(n.y*t);n.x=h(i,Ro,Lo),n.y=h(a,Ro,Lo),(i<n.x||i>n.x+1||a<n.y||a>n.y+1)&&C(`Geometry exceeds allowed extent, reduce your vector tile buffer size`)}}return n}function Bo(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?zo(e):[]}}function Vo(e,t,n,r,i){e.emplaceBack(2*t+(r+1)/2,2*n+(i+1)/2)}class Ho{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ka,this.indexArray=new ro,this.segments=new oo,this.programConfigurations=new No(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){let r=this.layers[0],i=[],a=null,o=!1;r.type===`circle`&&(a=r.layout.get(`circle-sort-key`),o=!a.isConstant());for(let{feature:t,id:r,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Bo(t,e);if(!this.layers[0]._featureFilter.filter(new X(this.zoom),l,n))continue;let u=o?a.evaluate(l,{},n):void 0,d={id:r,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:zo(t),patterns:{},sortKey:u};i.push(d)}o&&i.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of i){let{geometry:i,index:a,sourceLayerIndex:o}=r,s=e[a].feature;this.addFeature(r,i,a,n),t.featureIndex.insert(s,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ao),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,n,r){for(let n of t)for(let t of n){let n=t.x,r=t.y;if(n<0||n>=Io||r<0||r>=Io)continue;let i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=i.vertexLength;Vo(this.layoutVertexArray,n,r,-1,-1),Vo(this.layoutVertexArray,n,r,1,-1),Vo(this.layoutVertexArray,n,r,1,1),Vo(this.layoutVertexArray,n,r,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+3,a+2),i.vertexLength+=4,i.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},r)}}function Uo(e,t){for(let n=0;n<e.length;n++)if(Qo(t,e[n]))return!0;for(let n=0;n<t.length;n++)if(Qo(e,t[n]))return!0;return!!qo(e,t)}function Wo(e,t,n){return!!Qo(e,t)||!!Yo(t,e,n)}function Go(e,t){if(e.length===1)return Zo(t,e[0]);for(let n=0;n<t.length;n++){let r=t[n];for(let t=0;t<r.length;t++)if(Qo(e,r[t]))return!0}for(let n=0;n<e.length;n++)if(Zo(t,e[n]))return!0;for(let n=0;n<t.length;n++)if(qo(e,t[n]))return!0;return!1}function Ko(e,t,n){if(e.length>1){if(qo(e,t))return!0;for(let r=0;r<t.length;r++)if(Yo(t[r],e,n))return!0}for(let r=0;r<e.length;r++)if(Yo(e[r],t,n))return!0;return!1}function qo(e,t){if(e.length===0||t.length===0)return!1;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)if(Jo(r,i,t[e],t[e+1]))return!0}return!1}function Jo(e,t,n,r){return w(e,n,r)!==w(t,n,r)&&w(e,t,n)!==w(e,t,r)}function Yo(e,t,n){let r=n*n;if(t.length===1)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++)if(Xo(e,t[n-1],t[n])<r)return!0;return!1}function Xo(e,t,n){let r=t.distSqr(n);if(r===0)return e.distSqr(t);let i=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/r;return e.distSqr(i<0?t:i>1?n:n.sub(t)._mult(i)._add(t))}function Zo(e,t){let n,r,i,a=!1;for(let o=0;o<e.length;o++){n=e[o];for(let e=0,o=n.length-1;e<n.length;o=e++)r=n[e],i=n[o],r.y>t.y!=i.y>t.y&&t.x<(i.x-r.x)*(t.y-r.y)/(i.y-r.y)+r.x&&(a=!a)}return a}function Qo(e,t){let n=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let a=e[r],o=e[i];a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(n=!n)}return n}function $o(e,t,n){let r=n[0],i=n[2];if(e.x<r.x&&t.x<r.x||e.x>i.x&&t.x>i.x||e.y<r.y&&t.y<r.y||e.y>i.y&&t.y>i.y)return!1;let a=w(e,t,n[0]);return a!==w(e,t,n[1])||a!==w(e,t,n[2])||a!==w(e,t,n[3])}function es(e,t,n){let r=t.paint.get(e).value;return r.kind===`constant`?r.value:n.programConfigurations.get(t.id).getMaxValue(e)}function ts(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ns(e,t,n,r,i){if(!t[0]&&!t[1])return e;let o=a.convert(t)._mult(i);n===`viewport`&&o._rotate(-r);let s=[];for(let t=0;t<e.length;t++)s.push(e[t].sub(o));return s}let rs,is;J(`CircleBucket`,Ho,{omit:[`layers`]});var as={get paint(){return is||=new na({"circle-radius":new Q(N.paint_circle[`circle-radius`]),"circle-color":new Q(N.paint_circle[`circle-color`]),"circle-blur":new Q(N.paint_circle[`circle-blur`]),"circle-opacity":new Q(N.paint_circle[`circle-opacity`]),"circle-translate":new Z(N.paint_circle[`circle-translate`]),"circle-translate-anchor":new Z(N.paint_circle[`circle-translate-anchor`]),"circle-pitch-scale":new Z(N.paint_circle[`circle-pitch-scale`]),"circle-pitch-alignment":new Z(N.paint_circle[`circle-pitch-alignment`]),"circle-stroke-width":new Q(N.paint_circle[`circle-stroke-width`]),"circle-stroke-color":new Q(N.paint_circle[`circle-stroke-color`]),"circle-stroke-opacity":new Q(N.paint_circle[`circle-stroke-opacity`])})},get layout(){return rs||=new na({"circle-sort-key":new Q(N.layout_circle[`circle-sort-key`])})}},os=1e-6,ss=typeof Float32Array<`u`?Float32Array:Array;function cs(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ls(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=n[0],b=n[1],x=n[2],S=n[3];return e[0]=y*r+b*s+x*d+S*h,e[1]=y*i+b*c+x*f+S*g,e[2]=y*a+b*l+x*p+S*_,e[3]=y*o+b*u+x*m+S*v,e[4]=(y=n[4])*r+(b=n[5])*s+(x=n[6])*d+(S=n[7])*h,e[5]=y*i+b*c+x*f+S*g,e[6]=y*a+b*l+x*p+S*_,e[7]=y*o+b*u+x*m+S*v,e[8]=(y=n[8])*r+(b=n[9])*s+(x=n[10])*d+(S=n[11])*h,e[9]=y*i+b*c+x*f+S*g,e[10]=y*a+b*l+x*p+S*_,e[11]=y*o+b*u+x*m+S*v,e[12]=(y=n[12])*r+(b=n[13])*s+(x=n[14])*d+(S=n[15])*h,e[13]=y*i+b*c+x*f+S*g,e[14]=y*a+b*l+x*p+S*_,e[15]=y*o+b*u+x*m+S*v,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var us,ds=ls;function fs(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3];return e[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*o,e[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*o,e[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*o,e[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*o,e}us=new ss(4),ss!=Float32Array&&(us[0]=0,us[1]=0,us[2]=0,us[3]=0);class ps extends ia{constructor(e){super(e,as)}createBucket(e){return new Ho(e)}queryRadius(e){let t=e;return es(`circle-radius`,this,t)+es(`circle-stroke-width`,this,t)+ts(this.paint.get(`circle-translate`))}queryIntersectsFeature(e,t,n,r,i,a,o,s){let c=ns(e,this.paint.get(`circle-translate`),this.paint.get(`circle-translate-anchor`),a.angle,o),l=this.paint.get(`circle-radius`).evaluate(t,n)+this.paint.get(`circle-stroke-width`).evaluate(t,n),u=this.paint.get(`circle-pitch-alignment`)===`map`,d=u?c:function(e,t){return e.map((e=>ms(e,t)))}(c,s),f=u?l*o:l;for(let e of r)for(let t of e){let e=u?t:ms(t,s),n=f,r=fs([],[t.x,t.y,0,1],s);if(this.paint.get(`circle-pitch-scale`)===`viewport`&&this.paint.get(`circle-pitch-alignment`)===`map`?n*=r[3]/a.cameraToCenterDistance:this.paint.get(`circle-pitch-scale`)===`map`&&this.paint.get(`circle-pitch-alignment`)===`viewport`&&(n*=a.cameraToCenterDistance/r[3]),Wo(d,e,n))return!0}return!1}}function ms(e,t){let n=fs([],[e.x,e.y,0,1],t);return new a(n[0]/n[3],n[1]/n[3])}class hs extends Ho{}let gs;J(`HeatmapBucket`,hs,{omit:[`layers`]});var _s={get paint(){return gs||=new na({"heatmap-radius":new Q(N.paint_heatmap[`heatmap-radius`]),"heatmap-weight":new Q(N.paint_heatmap[`heatmap-weight`]),"heatmap-intensity":new Z(N.paint_heatmap[`heatmap-intensity`]),"heatmap-color":new ta(N.paint_heatmap[`heatmap-color`]),"heatmap-opacity":new Z(N.paint_heatmap[`heatmap-opacity`])})}};function vs(e,{width:t,height:n},r,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*n*r)throw RangeError(`mismatched image size. expected: ${i.length} but got: ${t*n*r}`)}else i=new Uint8Array(t*n*r);return e.width=t,e.height=n,e.data=i,e}function ys(e,{width:t,height:n},r){if(t===e.width&&n===e.height)return;let i=vs({},{width:t,height:n},r);bs(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,n)},r),e.width=t,e.height=n,e.data=i.data}function bs(e,t,n,r,i,a){if(i.width===0||i.height===0)return t;if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw RangeError(`out of range source coordinates for image copy`);if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw RangeError(`out of range destination coordinates for image copy`);let o=e.data,s=t.data;if(o===s)throw Error(`srcData equals dstData, so image is already copied`);for(let c=0;c<i.height;c++){let l=((n.y+c)*e.width+n.x)*a,u=((r.y+c)*t.width+r.x)*a;for(let e=0;e<i.width*a;e++)s[u+e]=o[l+e]}return t}class xs{constructor(e,t){vs(this,e,1,t)}resize(e){ys(this,e,1)}clone(){return new xs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,r,i){bs(e,t,n,r,i,1)}}class Ss{constructor(e,t){vs(this,e,4,t)}resize(e){ys(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Ss({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,r,i){bs(e,t,n,r,i,4)}}function Cs(e){let t={},n=e.resolution||256,r=e.clips?e.clips.length:1,i=e.image||new Ss({width:n,height:r});if(Math.log(n)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${n}`);let a=(n,r,a)=>{t[e.evaluationKey]=a;let o=e.expression.evaluate(t);i.data[n+r+0]=Math.floor(255*o.r/o.a),i.data[n+r+1]=Math.floor(255*o.g/o.a),i.data[n+r+2]=Math.floor(255*o.b/o.a),i.data[n+r+3]=Math.floor(255*o.a)};if(e.clips)for(let t=0,i=0;t<r;++t,i+=4*n)for(let r=0,o=0;r<n;r++,o+=4){let s=r/(n-1),{start:c,end:l}=e.clips[t];a(i,o,c*(1-s)+l*s)}else for(let e=0,t=0;e<n;e++,t+=4)a(0,t,e/(n-1));return i}J(`AlphaImage`,xs),J(`RGBAImage`,Ss);let ws=`big-fb`;class Ts extends ia{createBucket(e){return new hs(e)}constructor(e){super(e,_s),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e===`heatmap-color`&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Cs({expression:this._transitionablePaint._values[`heatmap-color`].value.expression,evaluationKey:`heatmapDensity`,image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(ws)&&this.heatmapFbos.delete(ws)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get(`heatmap-opacity`)!==0&&this.visibility!==`none`}}let Es;var Ds={get paint(){return Es||=new na({"hillshade-illumination-direction":new Z(N.paint_hillshade[`hillshade-illumination-direction`]),"hillshade-illumination-anchor":new Z(N.paint_hillshade[`hillshade-illumination-anchor`]),"hillshade-exaggeration":new Z(N.paint_hillshade[`hillshade-exaggeration`]),"hillshade-shadow-color":new Z(N.paint_hillshade[`hillshade-shadow-color`]),"hillshade-highlight-color":new Z(N.paint_hillshade[`hillshade-highlight-color`]),"hillshade-accent-color":new Z(N.paint_hillshade[`hillshade-accent-color`])})}};class Os extends ia{constructor(e){super(e,Ds)}hasOffscreenPass(){return this.paint.get(`hillshade-exaggeration`)!==0&&this.visibility!==`none`}}let{members:ks}=ca([{name:`a_pos`,components:2,type:`Int16`}],4);function As(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=js(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=function(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=js(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(Hs(o))}i.sort(Rs);for(let e=0;e<i.length;e++)n=zs(i[e],n);return n}(e,t,a,n)),e.length>80*n){s=1/0,c=1/0;let t=-1/0,r=-1/0;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return Ns(a,o,n,s,c,l,0),o}function js(e,t,n,r,i){let a;if(i===function(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Qs(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Qs(i/r|0,e[i],e[i+1],a);return a&&Ks(a,a.next)&&($s(a),a=a.next),a}function Ms(e,t){if(!e)return e;t||=e;let n,r=e;do if(n=!1,r.steiner||!Ks(r,r.next)&&Gs(r.prev,r,r.next)!==0)r=r.next;else{if($s(r),r=t=r.prev,r===r.next)break;n=!0}while(n||r!==t);return t}function Ns(e,t,n,r,i,a,o){if(!e)return;!o&&a&&function(e,t,n,r){let i=e;do i.z===0&&(i.z=Vs(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n=1;do{let r,i=e;e=null;let a=null;for(t=0;i;){t++;let o=i,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||i.z<=o.z)?(r=i,i=i.nextZ,s--):(r=o,o=o.nextZ,c--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;i=o}a.nextZ=null,n*=2}while(t>1)}(i)}(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?Fs(e,r,i,a):Ps(e))t.push(c.i,e.i,l.i),$s(e),e=l.next,s=l.next;else if((e=l)===s){o?o===1?Ns(e=Is(Ms(e),t),t,n,r,i,a,2):o===2&&Ls(e,t,n,r,i,a):Ns(Ms(e),t,n,r,i,a,1);break}}}function Ps(e){let t=e.prev,n=e,r=e.next;if(Gs(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=i<a?i<o?i:o:a<o?a:o,d=s<c?s<l?s:l:c<l?c:l,f=i>a?i>o?i:o:a>o?a:o,p=s>c?s>l?s:l:c>l?c:l,m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&Us(i,s,a,c,o,l,m.x,m.y)&&Gs(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Fs(e,t,n,r){let i=e.prev,a=e,o=e.next;if(Gs(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=s<c?s<l?s:l:c<l?c:l,m=u<d?u<f?u:f:d<f?d:f,h=s>c?s>l?s:l:c>l?c:l,g=u>d?u>f?u:f:d>f?d:f,_=Vs(p,m,t,n,r),v=Vs(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&Us(s,u,c,d,l,f,y.x,y.y)&&Gs(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&Us(s,u,c,d,l,f,b.x,b.y)&&Gs(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&Us(s,u,c,d,l,f,y.x,y.y)&&Gs(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&Us(s,u,c,d,l,f,b.x,b.y)&&Gs(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Is(e,t){let n=e;do{let r=n.prev,i=n.next.next;!Ks(r,i)&&qs(r,n,n.next,i)&&Xs(r,i)&&Xs(i,r)&&(t.push(r.i,n.i,i.i),$s(n),$s(n.next),n=e=i),n=n.next}while(n!==e);return Ms(n)}function Ls(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Ws(o,e)){let s=Zs(o,e);o=Ms(o,o.next),s=Ms(s,s.next),Ns(o,t,n,r,i,a,0),Ns(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function Rs(e,t){return e.x-t.x}function zs(e,t){let n=function(e,t){let n=t,r=e.x,i=e.y,a,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>o&&(o=e,a=n.x<n.next.x?n:n.next,e===r))return a}n=n.next}while(n!==t);if(!a)return null;let s=a,c=a.x,l=a.y,u=1/0;n=a;do{if(r>=n.x&&n.x>=c&&r!==n.x&&Us(i<l?r:o,i,c,l,i<l?o:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);Xs(n,e)&&(t<u||t===u&&(n.x>a.x||n.x===a.x&&Bs(a,n)))&&(a=n,u=t)}n=n.next}while(n!==s);return a}(e,t);if(!n)return t;let r=Zs(n,e);return Ms(r,r.next),Ms(n,n.next)}function Bs(e,t){return Gs(e.prev,e,t.prev)<0&&Gs(t.next,e,e.next)<0}function Vs(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Hs(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Us(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function Ws(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&qs(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Xs(e,t)&&Xs(t,e)&&function(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}(e,t)&&(Gs(e.prev,e,t.prev)||Gs(e,t.prev,t))||Ks(e,t)&&Gs(e.prev,e,e.next)>0&&Gs(t.prev,t,t.next)>0)}function Gs(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ks(e,t){return e.x===t.x&&e.y===t.y}function qs(e,t,n,r){let i=Ys(Gs(e,t,n)),a=Ys(Gs(e,t,r)),o=Ys(Gs(n,r,e)),s=Ys(Gs(n,r,t));return i!==a&&o!==s||!(i!==0||!Js(e,n,t))||!(a!==0||!Js(e,r,t))||!(o!==0||!Js(n,e,r))||!(s!==0||!Js(n,t,r))}function Js(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Ys(e){return e>0?1:e<0?-1:0}function Xs(e,t){return Gs(e.prev,e,e.next)<0?Gs(e,t,e.next)>=0&&Gs(e,e.prev,t)>=0:Gs(e,t,e.prev)<0||Gs(e,e.next,t)<0}function Zs(e,t){let n=ec(e.i,e.x,e.y),r=ec(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Qs(e,t,n,r){let i=ec(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function $s(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ec(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tc(e,t,n){let r=n.patternDependencies,i=!1;for(let n of t){let t=n.paint.get(`${e}-pattern`);t.isConstant()||(i=!0);let a=t.constantOr(null);a&&(i=!0,r[a.to]=!0,r[a.from]=!0)}return i}function nc(e,t,n,r,i){let a=i.patternDependencies;for(let o of t){let t=o.paint.get(`${e}-pattern`).value;if(t.kind!==`constant`){let e=t.evaluate({zoom:r-1},n,{},i.availableImages),s=t.evaluate({zoom:r},n,{},i.availableImages),c=t.evaluate({zoom:r+1},n,{},i.availableImages);e=e&&e.name?e.name:e,s=s&&s.name?s.name:s,c=c&&c.name?c.name:c,a[e]=!0,a[s]=!0,a[c]=!0,n.patterns[o.id]={min:e,mid:s,max:c}}}return n}class rc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new qa,this.indexArray=new ro,this.indexArray2=new io,this.programConfigurations=new No(e.layers,e.zoom),this.segments=new oo,this.segments2=new oo,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.hasPattern=tc(`fill`,this.layers,t);let r=this.layers[0].layout.get(`fill-sort-key`),i=!r.isConstant(),a=[];for(let{feature:o,id:s,index:c,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,u=Bo(o,e);if(!this.layers[0]._featureFilter.filter(new X(this.zoom),u,n))continue;let d=i?r.evaluate(u,{},n,t.availableImages):void 0,f={id:s,properties:o.properties,type:o.type,sourceLayerIndex:l,index:c,geometry:e?u.geometry:zo(o),patterns:{},sortKey:d};a.push(f)}i&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;if(this.hasPattern){let e=nc(`fill`,this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,i,a,n,{});t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ks),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,t,n,r,i){for(let e of kn(t,500)){let t=0;for(let n of e)t+=n.length;let n=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),r=n.vertexLength,i=[],a=[];for(let t of e){if(t.length===0)continue;t!==e[0]&&a.push(i.length/2);let n=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),r=n.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(r+t.length-1,r),i.push(t[0].x),i.push(t[0].y);for(let e=1;e<t.length;e++)this.layoutVertexArray.emplaceBack(t[e].x,t[e].y),this.indexArray2.emplaceBack(r+e-1,r+e),i.push(t[e].x),i.push(t[e].y);n.vertexLength+=t.length,n.primitiveLength+=t.length}let o=As(i,a);for(let e=0;e<o.length;e+=3)this.indexArray.emplaceBack(r+o[e],r+o[e+1],r+o[e+2]);n.vertexLength+=t,n.primitiveLength+=o.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,i,r)}}let ic,ac;J(`FillBucket`,rc,{omit:[`layers`,`patternFeatures`]});var oc={get paint(){return ac||=new na({"fill-antialias":new Z(N.paint_fill[`fill-antialias`]),"fill-opacity":new Q(N.paint_fill[`fill-opacity`]),"fill-color":new Q(N.paint_fill[`fill-color`]),"fill-outline-color":new Q(N.paint_fill[`fill-outline-color`]),"fill-translate":new Z(N.paint_fill[`fill-translate`]),"fill-translate-anchor":new Z(N.paint_fill[`fill-translate-anchor`]),"fill-pattern":new $i(N.paint_fill[`fill-pattern`])})},get layout(){return ic||=new na({"fill-sort-key":new Q(N.layout_fill[`fill-sort-key`])})}};class sc extends ia{constructor(e){super(e,oc)}recalculate(e,t){super.recalculate(e,t);let n=this.paint._values[`fill-outline-color`];n.value.kind===`constant`&&n.value.value===void 0&&(this.paint._values[`fill-outline-color`]=this.paint._values[`fill-color`])}createBucket(e){return new rc(e)}queryRadius(){return ts(this.paint.get(`fill-translate`))}queryIntersectsFeature(e,t,n,r,i,a,o){return Go(ns(e,this.paint.get(`fill-translate`),this.paint.get(`fill-translate-anchor`),a.angle,o),r)}isTileClipped(){return!0}}let cc=ca([{name:`a_pos`,components:2,type:`Int16`},{name:`a_normal_ed`,components:4,type:`Int16`}],4),lc=ca([{name:`a_centroid`,components:2,type:`Int16`}],4),{members:uc}=cc;var dc={},fc=r,pc=mc;function mc(e,t,n,r,i){this.properties={},this.extent=n,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=i,e.readFields(hc,this,t)}function hc(e,t,n){e==1?t.id=n.readVarint():e==2?function(e,t){for(var n=e.readVarint()+e.pos;e.pos<n;){var r=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[r]=i}}(n,t):e==3?t.type=n.readVarint():e==4&&(t._geometry=n.pos)}function gc(e){for(var t,n,r=0,i=0,a=e.length,o=a-1;i<a;o=i++)r+=((n=e[o]).x-(t=e[i]).x)*(t.y+n.y);return r}mc.types=[`Unknown`,`Point`,`LineString`,`Polygon`],mc.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,n=e.readVarint()+e.pos,r=1,i=0,a=0,o=0,s=[];e.pos<n;){if(i<=0){var c=e.readVarint();r=7&c,i=c>>3}if(i--,r===1||r===2)a+=e.readSVarint(),o+=e.readSVarint(),r===1&&(t&&s.push(t),t=[]),t.push(new fc(a,o));else{if(r!==7)throw Error(`unknown command `+r);t&&t.push(t[0].clone())}}return t&&s.push(t),s},mc.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,n=1,r=0,i=0,a=0,o=1/0,s=-1/0,c=1/0,l=-1/0;e.pos<t;){if(r<=0){var u=e.readVarint();n=7&u,r=u>>3}if(r--,n===1||n===2)(i+=e.readSVarint())<o&&(o=i),i>s&&(s=i),(a+=e.readSVarint())<c&&(c=a),a>l&&(l=a);else if(n!==7)throw Error(`unknown command `+n)}return[o,c,s,l]},mc.prototype.toGeoJSON=function(e,t,n){var r,i,a=this.extent*2**n,o=this.extent*e,s=this.extent*t,c=this.loadGeometry(),l=mc.types[this.type];function u(e){for(var t=0;t<e.length;t++){var n=e[t];e[t]=[360*(n.x+o)/a-180,360/Math.PI*Math.atan(Math.exp((180-360*(n.y+s)/a)*Math.PI/180))-90]}}switch(this.type){case 1:var d=[];for(r=0;r<c.length;r++)d[r]=c[r][0];u(c=d);break;case 2:for(r=0;r<c.length;r++)u(c[r]);break;case 3:for(c=function(e){var t=e.length;if(t<=1)return[e];for(var n,r,i=[],a=0;a<t;a++){var o=gc(e[a]);o!==0&&(r===void 0&&(r=o<0),r===o<0?(n&&i.push(n),n=[e[a]]):n.push(e[a]))}return n&&i.push(n),i}(c),r=0;r<c.length;r++)for(i=0;i<c[r].length;i++)u(c[r][i])}c.length===1?c=c[0]:l=`Multi`+l;var f={type:`Feature`,geometry:{type:l,coordinates:c},properties:this.properties};return`id`in this&&(f.id=this.id),f};var _c=pc,vc=yc;function yc(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(bc,this,t),this.length=this._features.length}function bc(e,t,n){e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(function(e){for(var t=null,n=e.readVarint()+e.pos;e.pos<n;){var r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}(n))}yc.prototype.feature=function(e){if(e<0||e>=this._features.length)throw Error(`feature index out of bounds`);this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new _c(this._pbf,t,this.extent,this._keys,this._values)};var xc=vc;function Sc(e,t,n){if(e===3){var r=new xc(n,n.readVarint()+n.pos);r.length&&(t[r.name]=r)}}dc.VectorTile=function(e,t){this.layers=e.readFields(Sc,{},t)},dc.VectorTileFeature=pc,dc.VectorTileLayer=vc;let Cc=dc.VectorTileFeature.types,wc=2**13;function Tc(e,t,n,r,i,a,o,s){e.emplaceBack(t,n,2*Math.floor(r*wc)+o,i*wc*2,a*wc*2,Math.round(s))}class Ec{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ja,this.centroidVertexArray=new Ga,this.indexArray=new ro,this.programConfigurations=new No(e.layers,e.zoom),this.segments=new oo,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.features=[],this.hasPattern=tc(`fill-extrusion`,this.layers,t);for(let{feature:r,id:i,index:a,sourceLayerIndex:o}of e){let e=this.layers[0]._featureFilter.needGeometry,s=Bo(r,e);if(!this.layers[0]._featureFilter.filter(new X(this.zoom),s,n))continue;let c={id:i,sourceLayerIndex:o,index:a,geometry:e?s.geometry:zo(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(nc(`fill-extrusion`,this.layers,c,this.zoom,t)):this.addFeature(c,c.geometry,a,n,{}),t.featureIndex.insert(r,c.geometry,a,o,this.index,!0)}}addFeatures(e,t,n){for(let e of this.features){let{geometry:r}=e;this.addFeature(e,r,e.index,t,n)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uc),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,lc.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,n,r,i){for(let n of kn(t,500)){let t={x:0,y:0,vertexCount:0},r=0;for(let e of n)r+=e.length;let i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let e of n){if(e.length===0||Oc(e))continue;let n=0;for(let r=0;r<e.length;r++){let a=e[r];if(r>=1){let o=e[r-1];if(!Dc(a,o)){i.vertexLength+4>oo.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let e=a.sub(o)._perp()._unit(),r=o.dist(a);n+r>32768&&(n=0),Tc(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,0,n),Tc(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,1,n),t.x+=2*a.x,t.y+=2*a.y,t.vertexCount+=2,n+=r,Tc(this.layoutVertexArray,o.x,o.y,e.x,e.y,0,0,n),Tc(this.layoutVertexArray,o.x,o.y,e.x,e.y,0,1,n),t.x+=2*o.x,t.y+=2*o.y,t.vertexCount+=2;let s=i.vertexLength;this.indexArray.emplaceBack(s,s+2,s+1),this.indexArray.emplaceBack(s+1,s+2,s+3),i.vertexLength+=4,i.primitiveLength+=2}}}}if(i.vertexLength+r>oo.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(r,this.layoutVertexArray,this.indexArray)),Cc[e.type]!==`Polygon`)continue;let a=[],o=[],s=i.vertexLength;for(let e of n)if(e.length!==0){e!==n[0]&&o.push(a.length/2);for(let n=0;n<e.length;n++){let r=e[n];Tc(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),t.x+=r.x,t.y+=r.y,t.vertexCount+=1,a.push(r.x),a.push(r.y)}}let c=As(a,o);for(let e=0;e<c.length;e+=3)this.indexArray.emplaceBack(s+c[e],s+c[e+2],s+c[e+1]);i.primitiveLength+=c.length/3,i.vertexLength+=r;for(let e=0;e<t.vertexCount;e++){let e=Math.floor(t.x/t.vertexCount),n=Math.floor(t.y/t.vertexCount);this.centroidVertexArray.emplaceBack(e,n)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,i,r)}}function Dc(e,t){return e.x===t.x&&(e.x<0||e.x>Io)||e.y===t.y&&(e.y<0||e.y>Io)}function Oc(e){return e.every((e=>e.x<0))||e.every((e=>e.x>Io))||e.every((e=>e.y<0))||e.every((e=>e.y>Io))}let kc;J(`FillExtrusionBucket`,Ec,{omit:[`layers`,`features`]});var Ac={get paint(){return kc||=new na({"fill-extrusion-opacity":new Z(N[`paint_fill-extrusion`][`fill-extrusion-opacity`]),"fill-extrusion-color":new Q(N[`paint_fill-extrusion`][`fill-extrusion-color`]),"fill-extrusion-translate":new Z(N[`paint_fill-extrusion`][`fill-extrusion-translate`]),"fill-extrusion-translate-anchor":new Z(N[`paint_fill-extrusion`][`fill-extrusion-translate-anchor`]),"fill-extrusion-pattern":new $i(N[`paint_fill-extrusion`][`fill-extrusion-pattern`]),"fill-extrusion-height":new Q(N[`paint_fill-extrusion`][`fill-extrusion-height`]),"fill-extrusion-base":new Q(N[`paint_fill-extrusion`][`fill-extrusion-base`]),"fill-extrusion-vertical-gradient":new Z(N[`paint_fill-extrusion`][`fill-extrusion-vertical-gradient`])})}};class jc extends ia{constructor(e){super(e,Ac)}createBucket(e){return new Ec(e)}queryRadius(){return ts(this.paint.get(`fill-extrusion-translate`))}is3D(){return!0}queryIntersectsFeature(e,t,n,r,i,o,s,c){let l=ns(e,this.paint.get(`fill-extrusion-translate`),this.paint.get(`fill-extrusion-translate-anchor`),o.angle,s),u=this.paint.get(`fill-extrusion-height`).evaluate(t,n),d=this.paint.get(`fill-extrusion-base`).evaluate(t,n),f=function(e,t,n,r){let i=[];for(let n of e){let e=[n.x,n.y,0,1];fs(e,e,t),i.push(new a(e[0]/e[3],e[1]/e[3]))}return i}(l,c),p=function(e,t,n,r){let i=[],o=[],s=r[8]*t,c=r[9]*t,l=r[10]*t,u=r[11]*t,d=r[8]*n,f=r[9]*n,p=r[10]*n,m=r[11]*n;for(let t of e){let e=[],n=[];for(let i of t){let t=i.x,o=i.y,h=r[0]*t+r[4]*o+r[12],g=r[1]*t+r[5]*o+r[13],_=r[2]*t+r[6]*o+r[14],v=r[3]*t+r[7]*o+r[15],y=_+l,b=v+u,x=h+d,S=g+f,C=_+p,w=v+m,T=new a((h+s)/b,(g+c)/b);T.z=y/b,e.push(T);let E=new a(x/w,S/w);E.z=C/w,n.push(E)}i.push(e),o.push(n)}return[i,o]}(r,d,u,c);return function(e,t,n){let r=1/0;Go(n,t)&&(r=Nc(n,t[0]));for(let i=0;i<t.length;i++){let a=t[i],o=e[i];for(let e=0;e<a.length-1;e++){let t=a[e],i=[t,a[e+1],o[e+1],o[e],t];Uo(n,i)&&(r=Math.min(r,Nc(n,i)))}}return r!==1/0&&r}(p[0],p[1],f)}}function Mc(e,t){return e.x*t.x+e.y*t.y}function Nc(e,t){if(e.length===1){let n=0,r=t[n++],i;for(;!i||r.equals(i);)if(i=t[n++],!i)return 1/0;for(;n<t.length;n++){let a=t[n],o=e[0],s=i.sub(r),c=a.sub(r),l=o.sub(r),u=Mc(s,s),d=Mc(s,c),f=Mc(c,c),p=Mc(l,s),m=Mc(l,c),h=u*f-d*d,g=(f*p-d*m)/h,_=(u*m-d*p)/h,v=r.z*(1-g-_)+i.z*g+a.z*_;if(isFinite(v))return v}return 1/0}{let e=1/0;for(let n of t)e=Math.min(e,n.z);return e}}let{members:Pc}=ca([{name:`a_pos_normal`,components:2,type:`Int16`},{name:`a_data`,components:4,type:`Uint8`}],4),{members:Fc}=ca([{name:`a_uv_x`,components:1,type:`Float32`},{name:`a_split_index`,components:1,type:`Float32`}]),Ic=dc.VectorTileFeature.types,Lc=Math.cos(Math.PI/180*37.5),Rc=2**14/.5;class zc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new Ya,this.layoutVertexArray2=new Xa,this.indexArray=new ro,this.programConfigurations=new No(e.layers,e.zoom),this.segments=new oo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.hasPattern=tc(`line`,this.layers,t);let r=this.layers[0].layout.get(`line-sort-key`),i=!r.isConstant(),a=[];for(let{feature:t,id:o,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Bo(t,e);if(!this.layers[0]._featureFilter.filter(new X(this.zoom),l,n))continue;let u=i?r.evaluate(l,{},n):void 0,d={id:o,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:zo(t),patterns:{},sortKey:u};a.push(d)}i&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;if(this.hasPattern){let e=nc(`line`,this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,i,a,n,{});t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Fc)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Pc),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,`mapbox_clip_start`)&&Object.prototype.hasOwnProperty.call(e.properties,`mapbox_clip_end`))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,n,r,i){let a=this.layers[0].layout,o=a.get(`line-join`).evaluate(e,{}),s=a.get(`line-cap`),c=a.get(`line-miter-limit`),l=a.get(`line-round-limit`);this.lineClips=this.lineFeatureClips(e);for(let n of t)this.addLine(n,e,o,s,c,l);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,i,r)}addLine(e,t,n,r,i,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let o=Ic[t.type]===`Polygon`,s=e.length;for(;s>=2&&e[s-1].equals(e[s-2]);)s--;let c=0;for(;c<s-1&&e[c].equals(e[c+1]);)c++;if(s<(o?3:2))return;n===`bevel`&&(i=1.05);let l=this.overscaling<=16?15*Io/(512*this.overscaling):0,u=this.segments.prepareSegment(10*s,this.layoutVertexArray,this.indexArray),d,f,p,m,h;this.e1=this.e2=-1,o&&(d=e[s-2],h=e[c].sub(d)._unit()._perp());for(let t=c;t<s;t++){if(p=t===s-1?o?e[c+1]:void 0:e[t+1],p&&e[t].equals(p))continue;h&&(m=h),d&&(f=d),d=e[t],h=p?p.sub(d)._unit()._perp():m,m||=h;let g=m.add(h);g.x===0&&g.y===0||g._unit();let _=m.x*h.x+m.y*h.y,v=g.x*h.x+g.y*h.y,y=v===0?1/0:1/v,b=2*Math.sqrt(2-2*v),x=v<Lc&&f&&p,S=m.x*h.y-m.y*h.x>0;if(x&&t>c){let e=d.dist(f);if(e>2*l){let t=d.sub(d.sub(f)._mult(l/e)._round());this.updateDistance(f,t),this.addCurrentVertex(t,m,0,0,u),f=t}}let C=f&&p,w=C?n:o?`butt`:r;if(C&&w===`round`&&(y<a?w=`miter`:y<=2&&(w=`fakeround`)),w===`miter`&&y>i&&(w=`bevel`),w===`bevel`&&(y>2&&(w=`flipbevel`),y<i&&(w=`miter`)),f&&this.updateDistance(f,d),w===`miter`)g._mult(y),this.addCurrentVertex(d,g,0,0,u);else if(w===`flipbevel`){if(y>100)g=h.mult(-1);else{let e=y*m.add(h).mag()/m.sub(h).mag();g._perp()._mult(e*(S?-1:1))}this.addCurrentVertex(d,g,0,0,u),this.addCurrentVertex(d,g.mult(-1),0,0,u)}else if(w===`bevel`||w===`fakeround`){let e=-Math.sqrt(y*y-1),t=S?e:0,n=S?0:e;if(f&&this.addCurrentVertex(d,m,t,n,u),w===`fakeround`){let e=Math.round(180*b/Math.PI/20);for(let t=1;t<e;t++){let n=t/e;if(n!==.5){let e=n-.5;n+=n*e*(n-1)*((1.0904+_*(_*(3.55645-1.43519*_)-3.2452))*e*e+(.848013+_*(.215638*_-1.06021)))}let r=h.sub(m)._mult(n)._add(m)._unit()._mult(S?-1:1);this.addHalfVertex(d,r.x,r.y,!1,S,0,u)}}p&&this.addCurrentVertex(d,h,-t,-n,u)}else if(w===`butt`)this.addCurrentVertex(d,g,0,0,u);else if(w===`square`){let e=f?1:-1;this.addCurrentVertex(d,g,e,e,u)}else w===`round`&&(f&&(this.addCurrentVertex(d,m,0,0,u),this.addCurrentVertex(d,m,1,1,u,!0)),p&&(this.addCurrentVertex(d,h,-1,-1,u,!0),this.addCurrentVertex(d,h,0,0,u)));if(x&&t<s-1){let e=d.dist(p);if(e>2*l){let t=d.add(p.sub(d)._mult(l/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,h,0,0,u),d=t}}}}addCurrentVertex(e,t,n,r,i,a=!1){let o=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,a,!1,n,i),this.addHalfVertex(e,o,s,a,!0,-r,i),this.distance>Rc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,n,r,i,a))}addHalfVertex({x:e,y:t},n,r,i,a,o,s){let c=.5*(this.lineClips?this.scaledDistance*(Rc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+ +!!i,(t<<1)+ +!!a,Math.round(63*n)+128,Math.round(63*r)+128,1+(o===0?0:o<0?-1:1)|(63&c)<<2,c>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let l=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),s.primitiveLength++),a?this.e2=l:this.e1=l}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}let Bc,Vc;J(`LineBucket`,zc,{omit:[`layers`,`patternFeatures`]});var Hc={get paint(){return Vc||=new na({"line-opacity":new Q(N.paint_line[`line-opacity`]),"line-color":new Q(N.paint_line[`line-color`]),"line-translate":new Z(N.paint_line[`line-translate`]),"line-translate-anchor":new Z(N.paint_line[`line-translate-anchor`]),"line-width":new Q(N.paint_line[`line-width`]),"line-gap-width":new Q(N.paint_line[`line-gap-width`]),"line-offset":new Q(N.paint_line[`line-offset`]),"line-blur":new Q(N.paint_line[`line-blur`]),"line-dasharray":new ea(N.paint_line[`line-dasharray`]),"line-pattern":new $i(N.paint_line[`line-pattern`]),"line-gradient":new ta(N.paint_line[`line-gradient`])})},get layout(){return Bc||=new na({"line-cap":new Z(N.layout_line[`line-cap`]),"line-join":new Q(N.layout_line[`line-join`]),"line-miter-limit":new Z(N.layout_line[`line-miter-limit`]),"line-round-limit":new Z(N.layout_line[`line-round-limit`]),"line-sort-key":new Q(N.layout_line[`line-sort-key`])})}};class Uc extends Q{possiblyEvaluate(e,t){return t=new X(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,r){return t=_({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,r)}}let Wc;class Gc extends ia{constructor(e){super(e,Hc),this.gradientVersion=0,Wc||(Wc=new Uc(Hc.paint.properties[`line-width`].specification),Wc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e===`line-gradient`){let e=this.gradientExpression();this.stepInterpolant=!!function(e){return e._styleExpression!==void 0}(e)&&e._styleExpression.expression instanceof Pt,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values[`line-gradient`].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values[`line-floorwidth`]=Wc.possiblyEvaluate(this._transitioningPaint._values[`line-width`].value,e)}createBucket(e){return new zc(e)}queryRadius(e){let t=e,n=Kc(es(`line-width`,this,t),es(`line-gap-width`,this,t)),r=es(`line-offset`,this,t);return n/2+Math.abs(r)+ts(this.paint.get(`line-translate`))}queryIntersectsFeature(e,t,n,r,i,o,s){let c=ns(e,this.paint.get(`line-translate`),this.paint.get(`line-translate-anchor`),o.angle,s),l=s/2*Kc(this.paint.get(`line-width`).evaluate(t,n),this.paint.get(`line-gap-width`).evaluate(t,n)),u=this.paint.get(`line-offset`).evaluate(t,n);return u&&(r=function(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=[];for(let e=0;e<i.length;e++){let n=i[e-1],r=i[e],s=i[e+1],c=e===0?new a(0,0):r.sub(n)._unit()._perp(),l=e===i.length-1?new a(0,0):s.sub(r)._unit()._perp(),u=c._add(l)._unit(),d=u.x*l.x+u.y*l.y;d!==0&&u._mult(1/d),o.push(u._mult(t)._add(r))}n.push(o)}return n}(r,u*s)),function(e,t,n){for(let r=0;r<t.length;r++){let i=t[r];if(e.length>=3){for(let t=0;t<i.length;t++)if(Qo(e,i[t]))return!0}if(Ko(e,i,n))return!0}return!1}(c,r,l)}isTileClipped(){return!0}}function Kc(e,t){return t>0?t+2*e:e}let qc=ca([{name:`a_pos_offset`,components:4,type:`Int16`},{name:`a_data`,components:4,type:`Uint16`},{name:`a_pixeloffset`,components:4,type:`Int16`}],4),Jc=ca([{name:`a_projected_pos`,components:3,type:`Float32`}],4);ca([{name:`a_fade_opacity`,components:1,type:`Uint32`}],4);let Yc=ca([{name:`a_placed`,components:2,type:`Uint8`},{name:`a_shift`,components:2,type:`Float32`},{name:`a_box_real`,components:2,type:`Int16`}]);ca([{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`}]);let Xc=ca([{name:`a_pos`,components:2,type:`Int16`},{name:`a_anchor_pos`,components:2,type:`Int16`},{name:`a_extrude`,components:2,type:`Int16`}],4),Zc=ca([{name:`a_pos`,components:2,type:`Float32`},{name:`a_radius`,components:1,type:`Float32`},{name:`a_flags`,components:2,type:`Int16`}],4);function Qc(e,t,n){return e.sections.forEach((e=>{e.text=function(e,t,n){let r=t.layout.get(`text-transform`).evaluate(n,{});return r===`uppercase`?e=e.toLocaleUpperCase():r===`lowercase`&&(e=e.toLocaleLowerCase()),Wi.applyArabicShaping&&(e=Wi.applyArabicShaping(e)),e}(e.text,t,n)})),e}ca([{name:`triangle`,components:3,type:`Uint16`}]),ca([{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`}]),ca([{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`}]),ca([{type:`Float32`,name:`offsetX`}]),ca([{type:`Int16`,name:`x`},{type:`Int16`,name:`y`},{type:`Int16`,name:`tileUnitDistanceFromAnchor`}]),ca([{type:`Uint16`,name:`textAnchor`},{type:`Float32`,components:2,name:`textOffset`}]);let $c={"!":`︕`,"#":`#`,$:`$`,"%":`%`,"&":`&`,"(":`︵`,")":`︶`,"*":`*`,"+":`+`,",":`︐`,"-":`︲`,".":`・`,"/":`/`,":":`︓`,";":`︔`,"<":`︿`,"=":`=`,">":`﹀`,"?":`︖`,"@":`@`,"[":`﹇`,"\\":`\`,"]":`﹈`,"^":`^`,_:`︳`,"`":```,"{":`︷`,"|":`―`,"}":`︸`,"~":`~`,"¢":`¢`,"£":`£`,"¥":`¥`,"¦":`¦`,"¬":`¬`,"¯":` ̄`,"–":`︲`,"—":`︱`,"‘":`﹃`,"’":`﹄`,"“":`﹁`,"”":`﹂`,"…":`︙`,"‧":`・`,"₩":`₩`,"、":`︑`,"。":`︒`,"〈":`︿`,"〉":`﹀`,"《":`︽`,"》":`︾`,"「":`﹁`,"」":`﹂`,"『":`﹃`,"』":`﹄`,"【":`︻`,"】":`︼`,"〔":`︹`,"〕":`︺`,"〖":`︗`,"〗":`︘`,"!":`︕`,"(":`︵`,")":`︶`,",":`︐`,"-":`︲`,".":`・`,":":`︓`,";":`︔`,"<":`︿`,">":`﹀`,"?":`︖`,"[":`﹇`,"]":`﹈`,"_":`︳`,"{":`︷`,"|":`―`,"}":`︸`,"⦅":`︵`,"⦆":`︶`,"。":`︒`,"「":`﹁`,"」":`﹂`};var el=24,tl=$,nl=function(e,t,n,r,i){var a,o,s=8*i-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=256*a+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=256*o+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else{if(a===c)return o?NaN:1/0*(p?-1:1);o+=2**r,a-=l}return(p?-1:1)*o*2**(a-r)},rl=function(e,t,n,r,i,a){var o,s,c,l=8*a-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),(t+=o+d>=1?f/c:f*2**(1-d))*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=255&s,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=255&o,p+=m,o/=256,l-=8);e[n+p-m]|=128*h};function $(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}$.Varint=0,$.Fixed64=1,$.Bytes=2,$.Fixed32=5;var il=4294967296,al=1/il,ol=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`);function sl(e){return e.type===$.Bytes?e.readVarint()+e.pos:e.pos+1}function cl(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function ll(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=e;i--)n.buf[i+r]=n.buf[i]}function ul(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function dl(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function fl(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function pl(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function ml(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function hl(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function gl(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function _l(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function vl(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function yl(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function bl(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function xl(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}$.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n||=this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,a=this.pos;this.type=7&r,e(i,t,this),this.pos===a&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=yl(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=xl(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=yl(this.buf,this.pos)+yl(this.buf,this.pos+4)*il;return this.pos+=8,e},readSFixed64:function(){var e=yl(this.buf,this.pos)+xl(this.buf,this.pos+4)*il;return this.pos+=8,e},readFloat:function(){var e=nl(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=nl(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,n,r=this.buf;return t=127&(n=r[this.pos++]),n<128?t:(t|=(127&(n=r[this.pos++]))<<7,n<128?t:(t|=(127&(n=r[this.pos++]))<<14,n<128?t:(t|=(127&(n=r[this.pos++]))<<21,n<128?t:function(e,t,n){var r,i,a=n.buf;if(r=(112&(i=a[n.pos++]))>>4,i<128||(r|=(127&(i=a[n.pos++]))<<3,i<128)||(r|=(127&(i=a[n.pos++]))<<10,i<128)||(r|=(127&(i=a[n.pos++]))<<17,i<128)||(r|=(127&(i=a[n.pos++]))<<24,i<128)||(r|=(1&(i=a[n.pos++]))<<31,i<128))return cl(e,r,t);throw Error(`Expected varint not more than 10 bytes`)}(t|=(15&(n=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&ol?function(e,t,n){return ol.decode(e.subarray(t,n))}(this.buf,t,e):function(e,t,n){for(var r=``,i=t;i<n;){var a,o,s,c=e[i],l=null,u=c>239?4:c>223?3:c>191?2:1;if(i+u>n)break;u===1?c<128&&(l=c):u===2?(192&(a=e[i+1]))==128&&(l=(31&c)<<6|63&a)<=127&&(l=null):u===3?(o=e[i+2],(192&(a=e[i+1]))==128&&(192&o)==128&&((l=(15&c)<<12|(63&a)<<6|63&o)<=2047||l>=55296&&l<=57343)&&(l=null)):u===4&&(o=e[i+2],s=e[i+3],(192&(a=e[i+1]))==128&&(192&o)==128&&(192&s)==128&&((l=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||l>=1114112)&&(l=null)),l===null?(l=65533,u=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),i+=u}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==$.Bytes)return e.push(this.readVarint(t));var n=sl(this);for(e||=[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==$.Bytes)return e.push(this.readSVarint());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==$.Bytes)return e.push(this.readBoolean());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==$.Bytes)return e.push(this.readFloat());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==$.Bytes)return e.push(this.readDouble());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==$.Bytes)return e.push(this.readFixed32());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==$.Bytes)return e.push(this.readSFixed32());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==$.Bytes)return e.push(this.readFixed64());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==$.Bytes)return e.push(this.readSFixed64());var t=sl(this);for(e||=[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===$.Varint)for(;this.buf[this.pos++]>127;);else if(t===$.Bytes)this.pos=this.readVarint()+this.pos;else if(t===$.Fixed32)this.pos+=4;else{if(t!==$.Fixed64)throw Error(`Unimplemented type: `+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),bl(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),bl(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),bl(this.buf,-1&e,this.pos),bl(this.buf,Math.floor(e*al),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),bl(this.buf,-1&e,this.pos),bl(this.buf,Math.floor(e*al),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw Error(`Given varint doesn't fit into 10 bytes`);t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,n.buf[n.pos]=127&(e>>>=7)}(n,0,t),function(e,t){var n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,n){for(var r,i,a=0;a<t.length;a++){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){r>56319||a+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=r;continue}if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&=(e[n++]=239,e[n++]=191,e[n++]=189,null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|128)}return n}(this.buf,e,this.pos);var n=this.pos-t;n>=128&&ll(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),rl(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),rl(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&ll(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,$.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,ul,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,dl,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,ml,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,fl,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,pl,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,hl,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,gl,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,_l,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,vl,t)},writeBytesField:function(e,t){this.writeTag(e,$.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,$.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,$.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,$.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,$.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,$.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,$.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,$.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,$.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,$.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}};var Sl=n(tl);function Cl(e,t,n){e===1&&n.readMessage(wl,t)}function wl(e,t,n){if(e===3){let{id:e,bitmap:r,width:i,height:a,left:o,top:s,advance:c}=n.readMessage(Tl,{});t.push({id:e,bitmap:new xs({width:i+6,height:a+6},r),metrics:{width:i,height:a,left:o,top:s,advance:c}})}}function Tl(e,t,n){e===1?t.id=n.readVarint():e===2?t.bitmap=n.readBytes():e===3?t.width=n.readVarint():e===4?t.height=n.readVarint():e===5?t.left=n.readSVarint():e===6?t.top=n.readSVarint():e===7&&(t.advance=n.readVarint())}function El(e){let t=0,n=0;for(let r of e)t+=r.w*r.h,n=Math.max(n,r.w);e.sort(((e,t)=>t.h-e.h));let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}],i=0,a=0;for(let t of e)for(let e=r.length-1;e>=0;e--){let n=r[e];if(!(t.w>n.w||t.h>n.h)){if(t.x=n.x,t.y=n.y,a=Math.max(a,t.y+t.h),i=Math.max(i,t.x+t.w),t.w===n.w&&t.h===n.h){let t=r.pop();e<r.length&&(r[e]=t)}else t.h===n.h?(n.x+=t.w,n.w-=t.w):t.w===n.w?(n.y+=t.h,n.h-=t.h):(r.push({x:n.x+t.w,y:n.y,w:n.w-t.w,h:t.h}),n.y+=t.h,n.h-=t.h);break}}return{w:i,h:a,fill:t/(i*a)||0}}class Dl{constructor(e,{pixelRatio:t,version:n,stretchX:r,stretchY:i,content:a,textFitWidth:o,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=i,this.content=a,this.version=n,this.textFitWidth=o,this.textFitHeight=s}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 Ol{constructor(e,t){let n={},r={};this.haveRenderCallbacks=[];let i=[];this.addImages(e,n,i),this.addImages(t,r,i);let{w:a,h:o}=El(i),s=new Ss({width:a||1,height:o||1});for(let t in e){let r=e[t],i=n[t].paddedRect;Ss.copy(r.data,s,{x:0,y:0},{x:i.x+1,y:i.y+1},r.data)}for(let e in t){let n=t[e],i=r[e].paddedRect,a=i.x+1,o=i.y+1,c=n.data.width,l=n.data.height;Ss.copy(n.data,s,{x:0,y:0},{x:a,y:o},n.data),Ss.copy(n.data,s,{x:0,y:l-1},{x:a,y:o-1},{width:c,height:1}),Ss.copy(n.data,s,{x:0,y:0},{x:a,y:o+l},{width:c,height:1}),Ss.copy(n.data,s,{x:c-1,y:0},{x:a-1,y:o},{width:1,height:l}),Ss.copy(n.data,s,{x:0,y:0},{x:a+c,y:o},{width:1,height:l})}this.image=s,this.iconPositions=n,this.patternPositions=r}addImages(e,t,n){for(let r in e){let i=e[r],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};n.push(a),t[r]=new Dl(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),t),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),t)}patchUpdatedImage(e,t,n){if(!e||!t||e.version===t.version)return;e.version=t.version;let[r,i]=e.tl;n.update(t.data,void 0,{x:r,y:i})}}var kl;J(`ImagePosition`,Dl),J(`ImageAtlas`,Ol),e.ah=void 0,(kl=e.ah||={})[kl.none=0]=`none`,kl[kl.horizontal=1]=`horizontal`,kl[kl.vertical=2]=`vertical`,kl[kl.horizontalOnly=3]=`horizontalOnly`;class Al{constructor(){this.scale=1,this.fontStack=``,this.imageName=null}static forText(e,t){let n=new Al;return n.scale=e||1,n.fontStack=t,n}static forImage(e){let t=new Al;return t.imageName=e,t}}class jl{constructor(){this.text=``,this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){let n=new jl;for(let r=0;r<e.sections.length;r++){let i=e.sections[r];i.image?n.addImageSection(i):n.addTextSection(i,t)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n+1)||null,i=e.charCodeAt(n-1)||null;t+=r&&zi(r)&&!$c[e[n+1]]||i&&zi(i)&&!$c[e[n-1]]||!$c[e[n]]?e[n]:$c[e[n]]}return t}(this.text)}trim(){let e=0;for(let t=0;t<this.text.length&&Nl[this.text.charCodeAt(t)];t++)e++;let t=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&Nl[this.text.charCodeAt(n)];n--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){let n=new jl;return n.text=this.text.substring(e,t),n.sectionIndex=this.sectionIndex.slice(e,t),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(Al.forText(e.scale,e.fontStack||t));let n=this.sections.length-1;for(let t=0;t<e.text.length;++t)this.sectionIndex.push(n)}addImageSection(e){let t=e.image?e.image.name:``;if(t.length===0)return void C(`Can't add FormattedSection with an empty image.`);let n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(Al.forImage(t)),this.sectionIndex.push(this.sections.length-1)):C(`Reached maximum number of images 6401`)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ml(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=jl.fromFeature(t,a),_;f===e.ah.vertical&&g.verticalizePunctuation();let{processBidirectionalText:v,processStyledBidirectionalText:y}=Wi;if(v&&g.sections.length===1){_=[];let e=v(g.toString(),Vl(g,u,o,n,i,m));for(let t of e){let e=new jl;e.text=t,e.sections=g.sections;for(let n=0;n<t.length;n++)e.sectionIndex.push(0);_.push(e)}}else if(y){_=[];let e=y(g.text,g.sectionIndex,Vl(g,u,o,n,i,m));for(let t of e){let e=new jl;e.text=t[0],e.sectionIndex=t[1],e.sections=g.sections,_.push(e)}}else _=function(e,t){let n=[],r=e.text,i=0;for(let r of t)n.push(e.substring(i,r)),i=r;return i<r.length&&n.push(e.substring(i,r.length)),n}(g,Vl(g,u,o,n,i,m));let b=[],x={positionedLines:b,text:g.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:f,iconsInText:!1,verticalizable:!1};return function(t,n,r,i,a,o,s,c,l,u,d,f){let p=0,m=-17,h=0,g=0,_=c===`right`?1:c===`left`?0:.5,v=0;for(let s of a){s.trim();let a=s.getMaxScale(),c=(a-1)*el,b={positionedGlyphs:[],lineOffset:0};t.positionedLines[v]=b;let x=b.positionedGlyphs,S=0;if(!s.length()){m+=o,++v;continue}for(let o=0;o<s.length();o++){let h=s.getSection(o),g=s.getSectionIndex(o),_=s.getCharCode(o),v=0,b=null,C=null,w=null,T=el,E=!(l===e.ah.horizontal||!d&&!Ri(_)||d&&(Nl[_]||(y=_,/\p{sc=Arab}/u.test(String.fromCodePoint(y)))));if(h.imageName){let e=i[h.imageName];if(!e)continue;w=h.imageName,t.iconsInText=t.iconsInText||!0,C=e.paddedRect;let n=e.displaySize;h.scale=h.scale*el/f,b={width:n[0],height:n[1],left:1,top:-3,advance:E?n[1]:n[0]},v=c+(el-n[1]*h.scale),T=b.advance;let r=E?n[0]*h.scale-el*a:n[1]*h.scale-el*a;r>0&&r>S&&(S=r)}else{let e=r[h.fontStack],t=e&&e[_];if(t&&t.rect)C=t.rect,b=t.metrics;else{let e=n[h.fontStack],t=e&&e[_];if(!t)continue;b=t.metrics}v=(a-h.scale)*el}E?(t.verticalizable=!0,x.push({glyph:_,imageName:w,x:p,y:m+v,vertical:E,scale:h.scale,fontStack:h.fontStack,sectionIndex:g,metrics:b,rect:C}),p+=T*h.scale+u):(x.push({glyph:_,imageName:w,x:p,y:m+v,vertical:E,scale:h.scale,fontStack:h.fontStack,sectionIndex:g,metrics:b,rect:C}),p+=b.advance*h.scale+u)}x.length!==0&&(h=Math.max(p-u,h),Ul(x,0,x.length-1,_,S)),p=0;let C=o*a+S;b.lineOffset=Math.max(S,c),m+=C,g=Math.max(C,g),++v}var y;let b=m- -17,{horizontalAlign:x,verticalAlign:S}=Hl(s);(function(e,t,n,r,i,a,o,s,c){let l=(t-n)*i,u=0;u=a===o?(-r*c+.5)*o:-s*r- -17;for(let t of e)for(let e of t.positionedGlyphs)e.x+=l,e.y+=u})(t.positionedLines,_,x,S,h,g,o,b,a.length),t.top+=-S*b,t.bottom=t.top+b,t.left+=-x*h,t.right=t.left+h}(x,n,r,i,_,s,c,l,f,u,p,h),!function(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}(b)&&x}let Nl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Pl={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},Fl={40:!0};function Il(e,t,n,r,i,a){if(t.imageName){let e=r[t.imageName];return e?e.displaySize[0]*t.scale*el/a+i:0}{let r=n[t.fontStack],a=r&&r[e];return a?a.metrics.advance*t.scale+i:0}}function Ll(e,t,n,r){let i=(e-t)**2;return r?e<t?i/2:2*i:i+Math.abs(n)*n}function Rl(e,t,n){let r=0;return e===10&&(r-=1e4),n&&(r+=150),e!==40&&e!==65288||(r+=50),t!==41&&t!==65289||(r+=50),r}function zl(e,t,n,r,i,a){let o=null,s=Ll(t,n,i,a);for(let e of r){let r=Ll(t-e.x,n,i,a)+e.badness;r<=s&&(o=e,s=r)}return{index:e,x:t,priorBreak:o,badness:s}}function Bl(e){return e?Bl(e.priorBreak).concat(e.index):[]}function Vl(e,t,n,r,i,a){if(!e)return[];let o=[],s=function(e,t,n,r,i,a){let o=0;for(let n=0;n<e.length();n++){let s=e.getSection(n);o+=Il(e.getCharCode(n),s,r,i,t,a)}return o/Math.max(1,Math.ceil(o/n))}(e,t,n,r,i,a),c=e.text.indexOf(`​`)>=0,l=0;for(let n=0;n<e.length();n++){let d=e.getSection(n),f=e.getCharCode(n);if(Nl[f]||(l+=Il(f,d,r,i,t,a)),n<e.length()-1){let t=!((u=f)<11904)&&(!!Y[`CJK Compatibility Forms`](u)||!!Y[`CJK Compatibility`](u)||!!Y[`CJK Strokes`](u)||!!Y[`CJK Symbols and Punctuation`](u)||!!Y[`Enclosed CJK Letters and Months`](u)||!!Y[`Halfwidth and Fullwidth Forms`](u)||!!Y[`Ideographic Description Characters`](u)||!!Y[`Vertical Forms`](u)||Li.test(String.fromCodePoint(u)));(Pl[f]||t||d.imageName||n!==e.length()-2&&Fl[e.getCharCode(n+1)])&&o.push(zl(n+1,l,s,o,Rl(f,e.getCharCode(n+1),t&&c),!1))}}var u;return Bl(zl(e.length(),l,s,o,0,!0))}function Hl(e){let t=.5,n=.5;switch(e){case`right`:case`top-right`:case`bottom-right`:t=1;break;case`left`:case`top-left`:case`bottom-left`:t=0}switch(e){case`bottom`:case`bottom-right`:case`bottom-left`:n=1;break;case`top`:case`top-right`:case`top-left`:n=0}return{horizontalAlign:t,verticalAlign:n}}function Ul(e,t,n,r,i){if(!r&&!i)return;let a=e[n],o=(e[n].x+a.metrics.advance*a.scale)*r;for(let r=t;r<=n;r++)e[r].x-=o,e[r].y+=i}function Wl(e,t,n){let{horizontalAlign:r,verticalAlign:i}=Hl(n),a=t[0]-e.displaySize[0]*r,o=t[1]-e.displaySize[1]*i;return{image:e,top:o,bottom:o+e.displaySize[1],left:a,right:a+e.displaySize[0]}}function Gl(e){let t=e.left,n=e.top,r=e.right-t,i=e.bottom-n,a=e.image.textFitWidth??`stretchOrShrink`,o=e.image.textFitHeight??`stretchOrShrink`,s=(e.image.content[2]-e.image.content[0])/(e.image.content[3]-e.image.content[1]);if(o===`proportional`){if(a===`stretchOnly`&&r/i<s||a===`proportional`){let e=Math.ceil(i*s);t*=e/r,r=e}}else if(a===`proportional`&&o===`stretchOnly`&&s!==0&&r/i>s){let e=Math.ceil(r/s);n*=e/i,i=e}return{x1:t,y1:n,x2:t+r,y2:n+i}}function Kl(e,t,n,r,i,a){let o=e.image,s;if(o.content){let e=o.content,t=o.pixelRatio||1;s=[e[0]/t,e[1]/t,o.displaySize[0]-e[2]/t,o.displaySize[1]-e[3]/t]}let c=t.left*a,l=t.right*a,u,d,f,p;n===`width`||n===`both`?(p=i[0]+c-r[3],d=i[0]+l+r[1]):(p=i[0]+(c+l-o.displaySize[0])/2,d=p+o.displaySize[0]);let m=t.top*a,h=t.bottom*a;return n===`height`||n===`both`?(u=i[1]+m-r[0],f=i[1]+h+r[2]):(u=i[1]+(m+h-o.displaySize[1])/2,f=u+o.displaySize[1]),{image:o,top:u,right:d,bottom:f,left:p,collisionPadding:s}}let ql=32640;function Jl(e,t){let{expression:n}=t;if(n.kind===`constant`)return{kind:`constant`,layoutSize:n.evaluate(new X(e+1))};if(n.kind===`source`)return{kind:`source`};{let{zoomStops:t,interpolationType:r}=n,i=0;for(;i<t.length&&t[i]<=e;)i++;i=Math.max(0,i-1);let a=i;for(;a<t.length&&t[a]<e+1;)a++;a=Math.min(t.length-1,a);let o=t[i],s=t[a];return n.kind===`composite`?{kind:`composite`,minZoom:o,maxZoom:s,interpolationType:r}:{kind:`camera`,minZoom:o,maxZoom:s,minSize:n.evaluate(new X(o)),maxSize:n.evaluate(new X(s)),interpolationType:r}}}function Yl(e,t,n){let r=`never`,i=e.get(t);return i?r=i:e.get(n)&&(r=`always`),r}let Xl=dc.VectorTileFeature.types,Zl=[{name:`a_fade_opacity`,components:1,type:`Uint8`,offset:0}];function Ql(e,t,n,r,i,a,o,s,c,l,u,d,f){let p=s?Math.min(ql,Math.round(s[0])):0,m=s?Math.min(ql,Math.round(s[1])):0;e.emplaceBack(t,n,Math.round(32*r),Math.round(32*i),a,o,(p<<1)+ +!!c,m,16*l,16*u,256*d,256*f)}function $l(e,t,n){e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n)}function eu(e){for(let t of e.sections)if(Ui(t.text))return!0;return!1}class tu{constructor(e){this.layoutVertexArray=new Qa,this.indexArray=new ro,this.programConfigurations=e,this.segments=new oo,this.dynamicLayoutVertexArray=new $a,this.opacityVertexArray=new eo,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ia}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,n,r){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,qc.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Jc.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Zl,!0),this.opacityVertexBuffer.itemSize=1),(n||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}J(`SymbolBuffers`,tu);class nu{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new oo,this.collisionVertexArray=new no}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Yc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}J(`CollisionBuffers`,nu);class ru{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=cs([]),this.placementViewportMatrix=cs([]);let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Jl(this.zoom,n[`text-size`]),this.iconSizeData=Jl(this.zoom,n[`icon-size`]);let r=this.layers[0].layout,i=r.get(`symbol-sort-key`),a=r.get(`symbol-z-order`);this.canOverlap=Yl(r,`text-overlap`,`text-allow-overlap`)!==`never`||Yl(r,`icon-overlap`,`icon-allow-overlap`)!==`never`||r.get(`text-ignore-placement`)||r.get(`icon-ignore-placement`),this.sortFeaturesByKey=a!==`viewport-y`&&!i.isConstant(),this.sortFeaturesByY=(a===`viewport-y`||a===`auto`&&!this.sortFeaturesByKey)&&this.canOverlap,r.get(`symbol-placement`)===`point`&&(this.writingModes=r.get(`text-writing-mode`).map((t=>e.ah[t]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=t.sourceID}createArrays(){this.text=new tu(new No(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new tu(new No(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new za,this.lineVertexArray=new Ba,this.symbolInstances=new Ra,this.textAnchorOffsets=new Ha}calculateGlyphDependencies(e,t,n,r,i){for(let a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,(n||r)&&i){let n=$c[e.charAt(a)];n&&(t[n.charCodeAt(0)]=!0)}}populate(t,n,r){let i=this.layers[0],a=i.layout,o=a.get(`text-font`),s=a.get(`text-field`),c=a.get(`icon-image`),l=(s.value.kind!==`constant`||s.value.value instanceof ct&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(o.value.kind!==`constant`||o.value.value.length>0),u=c.value.kind!==`constant`||!!c.value.value||Object.keys(c.parameters).length>0,d=a.get(`symbol-sort-key`);if(this.features=[],!l&&!u)return;let f=n.iconDependencies,p=n.glyphDependencies,m=n.availableImages,h=new X(this.zoom);for(let{feature:n,id:s,index:c,sourceLayerIndex:g}of t){let t=i._featureFilter.needGeometry,_=Bo(n,t);if(!i._featureFilter.filter(h,_,r))continue;let v,y;if(t||(_.geometry=zo(n)),l){let e=i.getValueAndResolveTokens(`text-field`,_,r,m),t=ct.factory(e),n=this.hasRTLText=this.hasRTLText||eu(t);(!n||Wi.getRTLTextPluginStatus()===`unavailable`||n&&Wi.isParsed())&&(v=Qc(t,i,_))}if(u){let e=i.getValueAndResolveTokens(`icon-image`,_,r,m);y=e instanceof ft?e:ft.fromString(e)}if(!v&&!y)continue;let b=this.sortFeaturesByKey?d.evaluate(_,{},r):void 0;if(this.features.push({id:s,text:v,icon:y,index:c,sourceLayerIndex:g,geometry:_.geometry,properties:n.properties,type:Xl[n.type],sortKey:b}),y&&(f[y.name]=!0),v){let t=o.evaluate(_,{},r).join(`,`),n=a.get(`text-rotation-alignment`)!==`viewport`&&a.get(`symbol-placement`)!==`point`;this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.ah.vertical)>=0;for(let e of v.sections)if(e.image)f[e.image.name]=!0;else{let r=Mi(v.toString()),i=e.fontStack||t,a=p[i]=p[i]||{};this.calculateGlyphDependencies(e.text,a,n,this.allowVerticalPlacement,r)}}}a.get(`symbol-placement`)===`line`&&(this.features=function(e){let t={},n={},r=[],i=0;function a(t){r.push(e[t]),i++}function o(e,t,i){let a=n[e];return delete n[e],n[t]=a,r[a].geometry[0].pop(),r[a].geometry[0]=r[a].geometry[0].concat(i[0]),a}function s(e,n,i){let a=t[n];return delete t[n],t[e]=a,r[a].geometry[0].shift(),r[a].geometry[0]=i[0].concat(r[a].geometry[0]),a}function c(e,t,n){let r=n?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let l=0;l<e.length;l++){let u=e[l],d=u.geometry,f=u.text?u.text.toString():null;if(!f){a(l);continue}let p=c(f,d),m=c(f,d,!0);if(p in n&&m in t&&n[p]!==t[m]){let e=s(p,m,d),i=o(p,m,r[e].geometry);delete t[p],delete n[m],n[c(f,r[i].geometry,!0)]=i,r[e].geometry=null}else p in n?o(p,m,d):m in t?s(p,m,d):(a(l),t[p]=i-1,n[m]=i-1)}return r.filter((e=>e.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,t){let n=this.lineVertexArray.length;if(e.segment!==void 0){let n=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]),i={};for(let r=e.segment+1;r<t.length;r++)i[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:n},r<t.length-1&&(n+=t[r+1].dist(t[r]));for(let n=e.segment||0;n>=0;n--)i[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:r},n>0&&(r+=t[n-1].dist(t[n]));for(let e=0;e<t.length;e++){let t=i[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,n,r,i,a,o,s,c,l,u,d,f){let p=t.indexArray,m=t.layoutVertexArray,h=t.segments.prepareSegment(4*n.length,m,p,this.canOverlap?o.sortKey:void 0),g=this.glyphOffsetArray.length,_=h.vertexLength,v=this.allowVerticalPlacement&&s===e.ah.vertical?Math.PI/2:0,y=o.text&&o.text.sections;for(let e=0;e<n.length;e++){let{tl:i,tr:a,bl:s,br:l,tex:u,pixelOffsetTL:d,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:b,glyphOffset:x,isSDF:S,sectionIndex:C}=n[e],w=h.vertexLength,T=x[1];Ql(m,c.x,c.y,i.x,T+i.y,u.x,u.y,r,S,d.x,d.y,_,b),Ql(m,c.x,c.y,a.x,T+a.y,u.x+u.w,u.y,r,S,g.x,d.y,_,b),Ql(m,c.x,c.y,s.x,T+s.y,u.x,u.y+u.h,r,S,d.x,g.y,_,b),Ql(m,c.x,c.y,l.x,T+l.y,u.x+u.w,u.y+u.h,r,S,g.x,g.y,_,b),$l(t.dynamicLayoutVertexArray,c,v),p.emplaceBack(w,w+1,w+2),p.emplaceBack(w+1,w+2,w+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),e!==n.length-1&&C===n[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(m.length,o,o.index,{},f,y&&y[C])}t.placedSymbolArray.emplaceBack(c.x,c.y,g,this.glyphOffsetArray.length-g,_,l,u,c.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,d)}_addCollisionDebugVertex(e,t,n,r,i,a){return t.emplaceBack(0,0),e.emplaceBack(n.x,n.y,r,i,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,n,r,i,o,s){let c=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),l=c.vertexLength,u=i.layoutVertexArray,d=i.collisionVertexArray,f=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,d,o,f,p,new a(e,t)),this._addCollisionDebugVertex(u,d,o,f,p,new a(n,t)),this._addCollisionDebugVertex(u,d,o,f,p,new a(n,r)),this._addCollisionDebugVertex(u,d,o,f,p,new a(e,r)),c.vertexLength+=4;let m=i.indexArray;m.emplaceBack(l,l+1),m.emplaceBack(l+1,l+2),m.emplaceBack(l+2,l+3),m.emplaceBack(l+3,l),c.primitiveLength+=4}addDebugCollisionBoxes(e,t,n,r){for(let i=e;i<t;i++){let e=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,r?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new nu(to,Xc.members,io),this.iconCollisionBox=new nu(to,Xc.members,io);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,n,r,i,a,o,s,c){let l={};for(let r=t;r<n;r++){let t=e.get(r);l.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},l.textFeatureIndex=t.featureIndex;break}for(let t=r;t<i;t++){let n=e.get(t);l.verticalTextBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.verticalTextFeatureIndex=n.featureIndex;break}for(let t=a;t<o;t++){let n=e.get(t);l.iconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.iconFeatureIndex=n.featureIndex;break}for(let t=s;t<c;t++){let n=e.get(t);l.verticalIconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.verticalIconFeatureIndex=n.featureIndex;break}return l}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let n=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.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(e,t){let n=e.placedSymbolArray.get(t),r=n.vertexStartIndex+4*n.numGlyphs;for(let t=n.vertexStartIndex;t<r;t+=4)e.indexArray.emplaceBack(t,t+1,t+2),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),n=Math.cos(e),r=[],i=[],a=[];for(let e=0;e<this.symbolInstances.length;++e){a.push(e);let o=this.symbolInstances.get(e);r.push(0|Math.round(t*o.anchorX+n*o.anchorY)),i.push(o.featureIndex)}return a.sort(((e,t)=>r[e]-r[t]||i[t]-i[e])),a}addToSortKeyRanges(e,t){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach(((e,t,n)=>{e>=0&&n.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)})),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let iu,au;J(`SymbolBucket`,ru,{omit:[`layers`,`collisionBoxArray`,`features`,`compareText`]}),ru.MAX_GLYPHS=65535,ru.addDynamicAttributes=$l;var ou={get paint(){return au||=new na({"icon-opacity":new Q(N.paint_symbol[`icon-opacity`]),"icon-color":new Q(N.paint_symbol[`icon-color`]),"icon-halo-color":new Q(N.paint_symbol[`icon-halo-color`]),"icon-halo-width":new Q(N.paint_symbol[`icon-halo-width`]),"icon-halo-blur":new Q(N.paint_symbol[`icon-halo-blur`]),"icon-translate":new Z(N.paint_symbol[`icon-translate`]),"icon-translate-anchor":new Z(N.paint_symbol[`icon-translate-anchor`]),"text-opacity":new Q(N.paint_symbol[`text-opacity`]),"text-color":new Q(N.paint_symbol[`text-color`],{runtimeType:De,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Q(N.paint_symbol[`text-halo-color`]),"text-halo-width":new Q(N.paint_symbol[`text-halo-width`]),"text-halo-blur":new Q(N.paint_symbol[`text-halo-blur`]),"text-translate":new Z(N.paint_symbol[`text-translate`]),"text-translate-anchor":new Z(N.paint_symbol[`text-translate-anchor`])})},get layout(){return iu||=new na({"symbol-placement":new Z(N.layout_symbol[`symbol-placement`]),"symbol-spacing":new Z(N.layout_symbol[`symbol-spacing`]),"symbol-avoid-edges":new Z(N.layout_symbol[`symbol-avoid-edges`]),"symbol-sort-key":new Q(N.layout_symbol[`symbol-sort-key`]),"symbol-z-order":new Z(N.layout_symbol[`symbol-z-order`]),"icon-allow-overlap":new Z(N.layout_symbol[`icon-allow-overlap`]),"icon-overlap":new Z(N.layout_symbol[`icon-overlap`]),"icon-ignore-placement":new Z(N.layout_symbol[`icon-ignore-placement`]),"icon-optional":new Z(N.layout_symbol[`icon-optional`]),"icon-rotation-alignment":new Z(N.layout_symbol[`icon-rotation-alignment`]),"icon-size":new Q(N.layout_symbol[`icon-size`]),"icon-text-fit":new Z(N.layout_symbol[`icon-text-fit`]),"icon-text-fit-padding":new Z(N.layout_symbol[`icon-text-fit-padding`]),"icon-image":new Q(N.layout_symbol[`icon-image`]),"icon-rotate":new Q(N.layout_symbol[`icon-rotate`]),"icon-padding":new Q(N.layout_symbol[`icon-padding`]),"icon-keep-upright":new Z(N.layout_symbol[`icon-keep-upright`]),"icon-offset":new Q(N.layout_symbol[`icon-offset`]),"icon-anchor":new Q(N.layout_symbol[`icon-anchor`]),"icon-pitch-alignment":new Z(N.layout_symbol[`icon-pitch-alignment`]),"text-pitch-alignment":new Z(N.layout_symbol[`text-pitch-alignment`]),"text-rotation-alignment":new Z(N.layout_symbol[`text-rotation-alignment`]),"text-field":new Q(N.layout_symbol[`text-field`]),"text-font":new Q(N.layout_symbol[`text-font`]),"text-size":new Q(N.layout_symbol[`text-size`]),"text-max-width":new Q(N.layout_symbol[`text-max-width`]),"text-line-height":new Z(N.layout_symbol[`text-line-height`]),"text-letter-spacing":new Q(N.layout_symbol[`text-letter-spacing`]),"text-justify":new Q(N.layout_symbol[`text-justify`]),"text-radial-offset":new Q(N.layout_symbol[`text-radial-offset`]),"text-variable-anchor":new Z(N.layout_symbol[`text-variable-anchor`]),"text-variable-anchor-offset":new Q(N.layout_symbol[`text-variable-anchor-offset`]),"text-anchor":new Q(N.layout_symbol[`text-anchor`]),"text-max-angle":new Z(N.layout_symbol[`text-max-angle`]),"text-writing-mode":new Z(N.layout_symbol[`text-writing-mode`]),"text-rotate":new Q(N.layout_symbol[`text-rotate`]),"text-padding":new Z(N.layout_symbol[`text-padding`]),"text-keep-upright":new Z(N.layout_symbol[`text-keep-upright`]),"text-transform":new Q(N.layout_symbol[`text-transform`]),"text-offset":new Q(N.layout_symbol[`text-offset`]),"text-allow-overlap":new Z(N.layout_symbol[`text-allow-overlap`]),"text-overlap":new Z(N.layout_symbol[`text-overlap`]),"text-ignore-placement":new Z(N.layout_symbol[`text-ignore-placement`]),"text-optional":new Z(N.layout_symbol[`text-optional`])})}};class su{constructor(e){if(e.property.overrides===void 0)throw Error(`overrides must be provided to instantiate FormatSectionOverride class`);this.type=e.property.overrides?e.property.overrides.runtimeType:Ee,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}J(`FormatSectionOverride`,su,{omit:[`defaultValue`]});class cu extends ia{constructor(e){super(e,ou)}recalculate(e,t){if(super.recalculate(e,t),this.layout.get(`icon-rotation-alignment`)===`auto`&&(this.layout._values[`icon-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),this.layout.get(`text-rotation-alignment`)===`auto`&&(this.layout._values[`text-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),this.layout.get(`text-pitch-alignment`)===`auto`&&(this.layout._values[`text-pitch-alignment`]=this.layout.get(`text-rotation-alignment`)===`map`?`map`:`viewport`),this.layout.get(`icon-pitch-alignment`)===`auto`&&(this.layout._values[`icon-pitch-alignment`]=this.layout.get(`icon-rotation-alignment`)),this.layout.get(`symbol-placement`)===`point`){let e=this.layout.get(`text-writing-mode`);if(e){let t=[];for(let n of e)t.indexOf(n)<0&&t.push(n);this.layout._values[`text-writing-mode`]=t}else this.layout._values[`text-writing-mode`]=[`horizontal`]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,n,r){let i=this.layout.get(e).evaluate(t,{},n,r),a=this._unevaluatedLayout._values[e];return a.isDataDriven()||wr(a.value)||!i?i:function(e,t){return t.replace(/{([^{}]+)}/g,((t,n)=>e&&n in e?String(e[n]):``))}(t.properties,i)}createBucket(e){return new ru(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error(`Should take a different path in FeatureIndex`)}_setPaintOverrides(){for(let e of ou.paint.overridableProperties){if(!cu.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),n=new su(t),r=new Cr(n,t.property.specification),i=null;i=t.value.kind===`constant`||t.value.kind===`source`?new Er(`source`,r):new Dr(`composite`,r,t.value.zoomStops),this.paint._values[e]=new Zi(t.property,i,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&cu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let n=e.get(`text-field`),r=ou.paint.properties[t],i=!1,a=e=>{for(let t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(i=!0)};if(n.value.kind===`constant`&&n.value.value instanceof ct)a(n.value.value.sections);else if(n.value.kind===`source`){let e=t=>{i||(t instanceof _t&&ht(t.value)===Ae?a(t.value.sections):t instanceof nn?a(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return i}}let lu;var uu={get paint(){return lu||=new na({"background-color":new Z(N.paint_background[`background-color`]),"background-pattern":new ea(N.paint_background[`background-pattern`]),"background-opacity":new Z(N.paint_background[`background-opacity`])})}};class du extends ia{constructor(e){super(e,uu)}}let fu;var pu={get paint(){return fu||=new na({"raster-opacity":new Z(N.paint_raster[`raster-opacity`]),"raster-hue-rotate":new Z(N.paint_raster[`raster-hue-rotate`]),"raster-brightness-min":new Z(N.paint_raster[`raster-brightness-min`]),"raster-brightness-max":new Z(N.paint_raster[`raster-brightness-max`]),"raster-saturation":new Z(N.paint_raster[`raster-saturation`]),"raster-contrast":new Z(N.paint_raster[`raster-contrast`]),"raster-resampling":new Z(N.paint_raster[`raster-resampling`]),"raster-fade-duration":new Z(N.paint_raster[`raster-fade-duration`])})}};class mu extends ia{constructor(e){super(e,pu)}}class hu extends ia{constructor(e){super(e,{}),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode===`3d`}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error(`Custom layers cannot be serialized`)}}class gu{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<`u`&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let _u=6371008.8;class vu{constructor(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw Error(`Invalid LngLat latitude value: must be between -90 and 90`)}wrap(){return new vu(g(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,n=this.lat*t,r=e.lat*t,i=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return _u*Math.acos(Math.min(i,1))}static convert(e){if(e instanceof vu)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new vu(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e==`object`&&e)return new vu(Number(`lng`in e?e.lng:e.lon),Number(e.lat));throw 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>]")}}let yu=2*Math.PI*_u;function bu(e){return yu*Math.cos(e*Math.PI/180)}function xu(e){return(180+e)/360}function Su(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Cu(e,t){return e/bu(t)}function wu(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}class Tu{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){let n=vu.convert(e);return new Tu(xu(n.lng),Su(n.lat),Cu(t,n.lat))}toLngLat(){return new vu(360*this.x-180,wu(this.y))}toAltitude(){return this.z*bu(wu(this.y))}meterInMercatorCoordinateUnits(){return 1/yu*(e=wu(this.y),1/Math.cos(e*Math.PI/180));var e}}function Eu(e,t,n){var r=2*Math.PI*6378137/256/2**n;return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class Du{constructor(e,t,n){if(!function(e,t,n){return!(e<0||e>25||n<0||n>=2**e||t<0||t>=2**e)}(e,t,n))throw Error(`x=${t}, y=${n}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=n,this.key=Au(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,n){let r=(a=this.y,o=this.z,s=Eu(256*(i=this.x),256*(a=2**o-a-1),o),c=Eu(256*(i+1),256*(a+1),o),s[0]+`,`+s[1]+`,`+c[0]+`,`+c[1]);var i,a,o,s,c;let l=function(e,t,n){let r,i=``;for(let a=e;a>0;a--)r=1<<a-1,i+=(t&r?1:0)+(n&r?2:0);return i}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(n===`tms`?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?`@2x`:``).replace(/{quadkey}/g,l).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=2**this.z;return new a((e.x*t-this.x)*Io,(e.y*t-this.y)*Io)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ou{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Au(e,t.z,t.z,t.x,t.y)}}class ku{constructor(e,t,n,r,i){if(e<n)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Du(n,+r,+i),this.key=Au(t,e,n,r,i)}clone(){return new ku(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let t=this.canonical.z-e;return e>this.canonical.z?new ku(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ku(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?Au(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Au(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let t=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new ku(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,n=2*this.canonical.x,r=2*this.canonical.y;return[new ku(t,this.wrap,t,n,r),new ku(t,this.wrap,t,n+1,r),new ku(t,this.wrap,t,n,r+1),new ku(t,this.wrap,t,n+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new ku(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new ku(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Ou(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Tu(e.x-this.wrap,e.y))}}function Au(e,t,n,r,i){(e*=2)<0&&(e=-1*e-1);let a=1<<n;return(a*a*e+a*i+r).toString(36)+n.toString(36)+t.toString(36)}J(`CanonicalTileID`,Du),J(`OverscaledTileID`,ku,{omit:[`posMatrix`]});class ju{constructor(e,t,n,r=1,i=1,a=1,o=0){if(this.uid=e,t.height!==t.width)throw RangeError(`DEM tiles must be square`);if(n&&![`mapbox`,`terrarium`,`custom`].includes(n))return void C(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;let s=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),n){case`terrarium`:this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case`custom`:this.redFactor=r,this.greenFactor=i,this.blueFactor=a,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let e=0;e<s;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(s,e)]=this.data[this._idx(s-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,s)]=this.data[this._idx(e,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=2**53-1,this.max=-(2**53-1);for(let e=0;e<s;e++)for(let t=0;t<s;t++){let n=this.get(e,t);n>this.max&&(this.max=n),n<this.min&&(this.min=n)}}get(e,t){let n=new Uint8Array(this.data.buffer),r=4*this._idx(e,t);return this.unpack(n[r],n[r+1],n[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw RangeError(`out of range source coordinates for DEM data`);return(t+1)*this.stride+(e+1)}unpack(e,t,n){return e*this.redFactor+t*this.greenFactor+n*this.blueFactor-this.baseShift}getPixels(){return new Ss({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,n){if(this.dim!==e.dim)throw Error(`dem dimension mismatch`);let r=t*this.dim,i=t*this.dim+this.dim,a=n*this.dim,o=n*this.dim+this.dim;switch(t){case-1:r=i-1;break;case 1:i=r+1}switch(n){case-1:a=o-1;break;case 1:o=a+1}let s=-t*this.dim,c=-n*this.dim;for(let t=a;t<o;t++)for(let n=r;n<i;n++)this.data[this._idx(n,t)]=e.data[this._idx(n+s,t+c)]}}J(`DEMData`,ju);class Mu{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let n=e[t];this._stringToNumber[n]=t,this._numberToString[t]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Nu{constructor(e,t,n,r,i){this.type=`Feature`,this._vectorTileFeature=e,e._z=t,e._x=n,e._y=r,this.properties=e.properties,this.id=i}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t!==`_geometry`&&t!==`_vectorTileFeature`&&(e[t]=this[t]);return e}}class Pu{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new wi(Io,16,0),this.grid3D=new wi(Io,16,0),this.featureIndexArray=new Wa,this.promoteId=t}insert(e,t,n,r,i,a){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,r,i);let s=a?this.grid3D:this.grid;for(let e=0;e<t.length;e++){let n=t[e],r=[1/0,1/0,-1/0,-1/0];for(let e=0;e<n.length;e++){let t=n[e];r[0]=Math.min(r[0],t.x),r[1]=Math.min(r[1],t.y),r[2]=Math.max(r[2],t.x),r[3]=Math.max(r[3],t.y)}r[0]<Io&&r[1]<Io&&r[2]>=0&&r[3]>=0&&s.insert(o,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new dc.VectorTile(new Sl(this.rawTileData)).layers,this.sourceLayerCoder=new Mu(this.vtLayers?Object.keys(this.vtLayers).sort():[`_geojsonTileLayer`])),this.vtLayers}query(e,t,n,r){this.loadVTLayers();let i=e.params||{},o=Io/e.tileSize/e.scale,s=Nr(i.filter),c=e.queryGeometry,l=e.queryPadding*o,u=Iu(c),d=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),f=Iu(e.cameraQueryGeometry),p=this.grid3D.query(f.minX-l,f.minY-l,f.maxX+l,f.maxY+l,((t,n,r,i)=>function(e,t,n,r,i){for(let a of e)if(t<=a.x&&n<=a.y&&r>=a.x&&i>=a.y)return!0;let o=[new a(t,n),new a(t,i),new a(r,i),new a(r,n)];if(e.length>2){for(let t of o)if(Qo(e,t))return!0}for(let t=0;t<e.length-1;t++)if($o(e[t],e[t+1],o))return!0;return!1}(e.cameraQueryGeometry,t-l,n-l,r+l,i+l)));for(let e of p)d.push(e);d.sort(Lu);let m={},h;for(let a=0;a<d.length;a++){let l=d[a];if(l===h)continue;h=l;let u=this.featureIndexArray.get(l),f=null;this.loadMatchingFeature(m,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,s,i.layers,i.availableImages,t,n,r,((t,n,r)=>(f||=zo(t),n.queryIntersectsFeature(c,t,r,f,this.z,e.transform,o,e.pixelPosMatrix))))}return m}loadMatchingFeature(e,t,n,r,i,a,o,s,c,l,u){let d=this.bucketLayerIDs[t];if(a&&!function(e,t){for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>=0)return!0;return!1}(a,d))return;let f=this.sourceLayerCoder.decode(n),p=this.vtLayers[f].feature(r);if(i.needGeometry){let e=Bo(p,!0);if(!i.filter(new X(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!i.filter(new X(this.tileID.overscaledZ),p))return;let m=this.getId(p,f);for(let t=0;t<d.length;t++){let n=d[t];if(a&&a.indexOf(n)<0)continue;let i=s[n];if(!i)continue;let f={};m&&l&&(f=l.getState(i.sourceLayer||`_geojsonTileLayer`,m));let h=_({},c[n]);h.paint=Fu(h.paint,i.paint,p,f,o),h.layout=Fu(h.layout,i.layout,p,f,o);let g=!u||u(p,i,f);if(!g)continue;let v=new Nu(p,this.z,this.x,this.y,m);v.layer=h;let y=e[n];y===void 0&&(y=e[n]=[]),y.push({featureIndex:r,feature:v,intersectionZ:g})}}lookupSymbolFeatures(e,t,n,r,i,a,o,s){let c={};this.loadVTLayers();let l=Nr(i);for(let i of e)this.loadMatchingFeature(c,n,r,i,l,a,o,s,t);return c}hasLayer(e){for(let t of this.bucketLayerIDs)for(let n of t)if(e===n)return!0;return!1}getId(e,t){let n=e.id;return this.promoteId&&(n=e.properties[typeof this.promoteId==`string`?this.promoteId:this.promoteId[t]],typeof n==`boolean`&&(n=Number(n))),n}}function Fu(e,t,n,r,i){return y(e,((e,a)=>{let o=t instanceof Qi?t.get(a):null;return o&&o.evaluate?o.evaluate(n,r,i):o}))}function Iu(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{minX:t,minY:n,maxX:r,maxY:i}}function Lu(e,t){return t-e}function Ru(e,t,n,r,i){let o=[];for(let s=0;s<e.length;s++){let c=e[s],l;for(let e=0;e<c.length-1;e++){let s=c[e],u=c[e+1];s.x<t&&u.x<t||(s.x<t?s=new a(t,s.y+(t-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x<t&&(u=new a(t,s.y+(t-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y<n&&u.y<n||(s.y<n?s=new a(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round():u.y<n&&(u=new a(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round()),s.x>=r&&u.x>=r||(s.x>=r?s=new a(r,s.y+(r-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=r&&(u=new a(r,s.y+(r-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=i&&u.y>=i||(s.y>=i?s=new a(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round():u.y>=i&&(u=new a(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round()),l&&s.equals(l[l.length-1])||(l=[s],o.push(l)),l.push(u)))))}}return o}J(`FeatureIndex`,Pu,{omit:[`rawTileData`,`sourceLayerCoder`]});class zu extends a{constructor(e,t,n,r){super(e,t),this.angle=n,r!==void 0&&(this.segment=r)}clone(){return new zu(this.x,this.y,this.angle,this.segment)}}function Bu(e,t,n,r,i){if(t.segment===void 0||n===0)return!0;let a=t,o=t.segment+1,s=0;for(;s>-n/2;){if(o--,o<0)return!1;s-=e[o].dist(a),a=e[o]}s+=e[o].dist(e[o+1]),o++;let c=[],l=0;for(;s<n/2;){let t=e[o],n=e[o+1];if(!n)return!1;let a=e[o-1].angleTo(t)-t.angleTo(n);for(a=Math.abs((a+3*Math.PI)%(2*Math.PI)-Math.PI),c.push({distance:s,angleDelta:a}),l+=a;s-c[0].distance>r;)l-=c.shift().angleDelta;if(l>i)return!1;o++,s+=t.dist(n)}return!0}function Vu(e){let t=0;for(let n=0;n<e.length-1;n++)t+=e[n].dist(e[n+1]);return t}function Hu(e,t,n){return e?.6*t*n:0}function Uu(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Wu(e,t,n,r,i,a){let o=Hu(n,i,a),s=Uu(n,r)*a,c=0,l=Vu(e)/2;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1],a=r.dist(i);if(c+a>l){let u=(l-c)/a,d=Vt.number(r.x,i.x,u),f=Vt.number(r.y,i.y,u),p=new zu(d,f,i.angleTo(r),n);return p._round(),!o||Bu(e,p,s,o,t)?p:void 0}c+=a}}function Gu(e,t,n,r,i,a,o,s,c){let l=Hu(r,a,o),u=Uu(r,i),d=u*o,f=e[0].x===0||e[0].x===c||e[0].y===0||e[0].y===c;return t-d<t/4&&(t=d+t/4),Ku(e,f?t/2*s%t:(u/2+2*a)*o*s%t,t,l,n,d,f,!1,c)}function Ku(e,t,n,r,i,a,o,s,c){let l=a/2,u=Vu(e),d=0,f=t-n,p=[];for(let t=0;t<e.length-1;t++){let o=e[t],s=e[t+1],m=o.dist(s),h=s.angleTo(o);for(;f+n<d+m;){f+=n;let g=(f-d)/m,_=Vt.number(o.x,s.x,g),v=Vt.number(o.y,s.y,g);if(_>=0&&_<c&&v>=0&&v<c&&f-l>=0&&f+l<=u){let n=new zu(_,v,h,t);n._round(),r&&!Bu(e,n,a,r,i)||p.push(n)}}d+=m}return s||p.length||o||(p=Ku(e,d/2,n,r,i,a,o,!0,c)),p}J(`Anchor`,zu);function qu(e,t,n,r){let i=[],o=e.image,s=o.pixelRatio,c=o.paddedRect.w-2,l=o.paddedRect.h-2,u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},d=o.stretchX||[[0,c]],f=o.stretchY||[[0,l]],p=(e,t)=>e+t[1]-t[0],m=d.reduce(p,0),h=f.reduce(p,0),g=c-m,_=l-h,v=0,y=m,b=0,x=h,S=0,C=g,w=0,T=_;if(o.content&&r){let t=o.content,n=t[2]-t[0],r=t[3]-t[1];(o.textFitWidth||o.textFitHeight)&&(u=Gl(e)),v=Ju(d,0,t[0]),b=Ju(f,0,t[1]),y=Ju(d,t[0],t[2]),x=Ju(f,t[1],t[3]),S=t[0]-v,w=t[1]-b,C=n-y,T=r-x}let E=u.x1,D=u.y1,O=u.x2-E,k=u.y2-D,A=(e,r,i,c)=>{let l=Xu(e.stretch-v,y,O,E),u=Zu(e.fixed-S,C,e.stretch,m),d=Xu(r.stretch-b,x,k,D),f=Zu(r.fixed-w,T,r.stretch,h),p=Xu(i.stretch-v,y,O,E),g=Zu(i.fixed-S,C,i.stretch,m),_=Xu(c.stretch-b,x,k,D),A=Zu(c.fixed-w,T,c.stretch,h),j=new a(l,d),ee=new a(p,d),M=new a(p,_),te=new a(l,_),ne=new a(u/s,f/s),re=new a(g/s,A/s),ie=t*Math.PI/180;if(ie){let e=Math.sin(ie),t=Math.cos(ie),n=[t,-e,e,t];j._matMult(n),ee._matMult(n),te._matMult(n),M._matMult(n)}let ae=e.stretch+e.fixed,oe=r.stretch+r.fixed;return{tl:j,tr:ee,bl:te,br:M,tex:{x:o.paddedRect.x+1+ae,y:o.paddedRect.y+1+oe,w:i.stretch+i.fixed-ae,h:c.stretch+c.fixed-oe},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ne,pixelOffsetBR:re,minFontScaleX:C/s/O,minFontScaleY:T/s/k,isSDF:n}};if(r&&(o.stretchX||o.stretchY)){let e=Yu(d,g,m),t=Yu(f,_,h);for(let n=0;n<e.length-1;n++){let r=e[n],a=e[n+1];for(let e=0;e<t.length-1;e++)i.push(A(r,t[e],a,t[e+1]))}}else i.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:c+1},{fixed:0,stretch:l+1}));return i}function Ju(e,t,n){let r=0;for(let i of e)r+=Math.max(t,Math.min(n,i[1]))-Math.max(t,Math.min(n,i[0]));return r}function Yu(e,t,n){let r=[{fixed:-1,stretch:0}];for(let[t,n]of e){let e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(n-t)})}return r.push({fixed:t+1,stretch:n}),r}function Xu(e,t,n,r){return e/t*n+r}function Zu(e,t,n,r){return e-t*n/r}class Qu{constructor(e,t,n,r,i,o,s,c,l,u){if(this.boxStartIndex=e.length,l){let e=o.top,t=o.bottom,n=o.collisionPadding;n&&(e-=n[1],t+=n[3]);let r=t-e;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{let l=o.image?.content&&(o.image.textFitWidth||o.image.textFitHeight)?Gl(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};l.y1=l.y1*s-c[0],l.y2=l.y2*s+c[2],l.x1=l.x1*s-c[3],l.x2=l.x2*s+c[1];let d=o.collisionPadding;if(d&&(l.x1-=d[0]*s,l.y1-=d[1]*s,l.x2+=d[2]*s,l.y2+=d[3]*s),u){let e=new a(l.x1,l.y1),t=new a(l.x2,l.y1),n=new a(l.x1,l.y2),r=new a(l.x2,l.y2),i=u*Math.PI/180;e._rotate(i),t._rotate(i),n._rotate(i),r._rotate(i),l.x1=Math.min(e.x,t.x,n.x,r.x),l.x2=Math.max(e.x,t.x,n.x,r.x),l.y1=Math.min(e.y,t.y,n.y,r.y),l.y2=Math.max(e.y,t.y,n.y,r.y)}e.emplaceBack(t.x,t.y,l.x1,l.y1,l.x2,l.y2,n,r,i)}this.boxEndIndex=e.length}}class $u{constructor(e=[],t=((e,t)=>e<t?-1:+(e>t))){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],i)>=0)break;t[e]=t[r],e=r}t[e]=i}}function ed(e,t=1,n=!1){let r=1/0,i=1/0,o=-1/0,s=-1/0,c=e[0];for(let e=0;e<c.length;e++){let t=c[e];(!e||t.x<r)&&(r=t.x),(!e||t.y<i)&&(i=t.y),(!e||t.x>o)&&(o=t.x),(!e||t.y>s)&&(s=t.y)}let l=Math.min(o-r,s-i),u=l/2,d=new $u([],td);if(l===0)return new a(r,i);for(let t=r;t<o;t+=l)for(let n=i;n<s;n+=l)d.push(new nd(t+u,n+u,u,e));let f=function(e){let t=0,n=0,r=0,i=e[0];for(let e=0,a=i.length,o=a-1;e<a;o=e++){let a=i[e],s=i[o],c=a.x*s.y-s.x*a.y;n+=(a.x+s.x)*c,r+=(a.y+s.y)*c,t+=3*c}return new nd(n/t,r/t,0,e)}(e),p=d.length;for(;d.length;){let r=d.pop();(r.d>f.d||!f.d)&&(f=r,n&&console.log(`found best %d after %d probes`,Math.round(1e4*r.d)/1e4,p)),r.max-f.d<=t||(u=r.h/2,d.push(new nd(r.p.x-u,r.p.y-u,u,e)),d.push(new nd(r.p.x+u,r.p.y-u,u,e)),d.push(new nd(r.p.x-u,r.p.y+u,u,e)),d.push(new nd(r.p.x+u,r.p.y+u,u,e)),p+=4)}return n&&(console.log(`num probes: ${p}`),console.log(`best distance: ${f.d}`)),f.p}function td(e,t){return t.max-e.max}function nd(e,t,n,r){this.p=new a(e,t),this.h=n,this.d=function(e,t){let n=!1,r=1/0;for(let i=0;i<t.length;i++){let a=t[i];for(let t=0,i=a.length,o=i-1;t<i;o=t++){let i=a[t],s=a[o];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n),r=Math.min(r,Xo(e,i,s))}}return(n?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var rd;e.aq=void 0,(rd=e.aq||={})[rd.center=1]=`center`,rd[rd.left=2]=`left`,rd[rd.right=3]=`right`,rd[rd.top=4]=`top`,rd[rd.bottom=5]=`bottom`,rd[rd[`top-left`]=6]=`top-left`,rd[rd[`top-right`]=7]=`top-right`,rd[rd[`bottom-left`]=8]=`bottom-left`,rd[rd[`bottom-right`]=9]=`bottom-right`;let id=1/0;function ad(e,t){return t[1]===id?function(e,t){let n=0,r=0;t<0&&(t=0);let i=t/Math.SQRT2;switch(e){case`top-right`:case`top-left`:r=i-7;break;case`bottom-right`:case`bottom-left`:r=-i+7;break;case`bottom`:r=-t+7;break;case`top`:r=t-7}switch(e){case`top-right`:case`bottom-right`:n=-i;break;case`top-left`:case`bottom-left`:n=i;break;case`left`:n=t;break;case`right`:n=-t}return[n,r]}(e,t[0]):function(e,t,n){let r=0,i=0;switch(t=Math.abs(t),n=Math.abs(n),e){case`top-right`:case`top-left`:case`top`:i=n-7;break;case`bottom-right`:case`bottom-left`:case`bottom`:i=-n+7}switch(e){case`top-right`:case`bottom-right`:case`right`:r=-t;break;case`top-left`:case`bottom-left`:case`left`:r=t}return[r,i]}(e,t[0],t[1])}function od(e,t,n){let r=e.layout,i=r.get(`text-variable-anchor-offset`)?.evaluate(t,{},n);if(i){let e=i.values,t=[];for(let n=0;n<e.length;n+=2){let r=t[n]=e[n],i=e[n+1].map((e=>e*el));r.startsWith(`top`)?i[1]-=7:r.startsWith(`bottom`)&&(i[1]+=7),t[n+1]=i}return new dt(t)}let a=r.get(`text-variable-anchor`);if(a){let i;i=e._unevaluatedLayout.getValue(`text-radial-offset`)===void 0?r.get(`text-offset`).evaluate(t,{},n).map((e=>e*el)):[r.get(`text-radial-offset`).evaluate(t,{},n)*el,id];let o=[];for(let e of a)o.push(e,ad(e,i));return new dt(o)}return null}function sd(e){switch(e){case`right`:case`top-right`:case`bottom-right`:return`right`;case`left`:case`top-left`:case`bottom-left`:return`left`}return`center`}function cd(t,n,r,i,a,o,s,c,l,u,d){let f=o.textMaxSize.evaluate(n,{});f===void 0&&(f=s);let p=t.layers[0].layout,m=p.get(`icon-offset`).evaluate(n,{},d),h=ud(r.horizontal),g=s/24,_=t.tilePixelRatio*g,v=t.tilePixelRatio*f/24,y=t.tilePixelRatio*c,b=t.tilePixelRatio*p.get(`symbol-spacing`),x=p.get(`text-padding`)*t.tilePixelRatio,S=function(e,t,n,r=1){let i=e.get(`icon-padding`).evaluate(t,{},n),a=i&&i.values;return[a[0]*r,a[1]*r,a[2]*r,a[3]*r]}(p,n,d,t.tilePixelRatio),w=p.get(`text-max-angle`)/180*Math.PI,T=p.get(`text-rotation-alignment`)!==`viewport`&&p.get(`symbol-placement`)!==`point`,E=p.get(`icon-rotation-alignment`)===`map`&&p.get(`symbol-placement`)!==`point`,D=p.get(`symbol-placement`),O=b/2,k=p.get(`icon-text-fit`),A;i&&k!==`none`&&(t.allowVerticalPlacement&&r.vertical&&(A=Kl(i,r.vertical,k,p.get(`icon-text-fit-padding`),m,g)),h&&(i=Kl(i,h,k,p.get(`icon-text-fit-padding`),m,g)));let j=(c,f)=>{f.x<0||f.x>=Io||f.y<0||f.y>=Io||function(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,w,T,E){let D=t.addToLineVertexArray(n,r),O,k,A,j,ee=0,M=0,te=0,ne=0,re=-1,ie=-1,ae={},oe=go(``);if(t.allowVerticalPlacement&&i.vertical){let e=c.layout.get(`text-rotate`).evaluate(x,{},T)+90;A=new Qu(l,n,u,d,f,i.vertical,p,m,h,e),s&&(j=new Qu(l,n,u,d,f,s,_,v,h,e))}if(a){let r=c.layout.get(`icon-rotate`).evaluate(x,{}),i=c.layout.get(`icon-text-fit`)!==`none`,o=qu(a,r,w,i),p=s?qu(s,r,w,i):void 0;k=new Qu(l,n,u,d,f,a,_,v,!1,r),ee=4*o.length;let m=t.iconSizeData,h=null;m.kind===`source`?(h=[128*c.layout.get(`icon-size`).evaluate(x,{})],h[0]>ql&&C(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):m.kind===`composite`&&(h=[128*S.compositeIconSizes[0].evaluate(x,{},T),128*S.compositeIconSizes[1].evaluate(x,{},T)],(h[0]>ql||h[1]>ql)&&C(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,o,h,b,y,x,e.ah.none,n,D.lineStartIndex,D.lineLength,-1,T),re=t.icon.placedSymbolArray.length-1,p&&(M=4*p.length,t.addSymbols(t.icon,p,h,b,y,x,e.ah.vertical,n,D.lineStartIndex,D.lineLength,-1,T),ie=t.icon.placedSymbolArray.length-1)}let se=Object.keys(i.horizontal);for(let r of se){let a=i.horizontal[r];if(!O){oe=go(a.text);let e=c.layout.get(`text-rotate`).evaluate(x,{},T);O=new Qu(l,n,u,d,f,a,p,m,h,e)}let s=a.positionedLines.length===1;if(te+=ld(t,n,a,o,c,h,x,g,D,i.vertical?e.ah.horizontal:e.ah.horizontalOnly,s?se:[r],ae,re,S,T),s)break}i.vertical&&(ne+=ld(t,n,i.vertical,o,c,h,x,g,D,e.ah.vertical,[`vertical`],ae,ie,S,T));let ce=O?O.boxStartIndex:t.collisionBoxArray.length,le=O?O.boxEndIndex:t.collisionBoxArray.length,ue=A?A.boxStartIndex:t.collisionBoxArray.length,de=A?A.boxEndIndex:t.collisionBoxArray.length,fe=k?k.boxStartIndex:t.collisionBoxArray.length,N=k?k.boxEndIndex:t.collisionBoxArray.length,pe=j?j.boxStartIndex:t.collisionBoxArray.length,me=j?j.boxEndIndex:t.collisionBoxArray.length,P=-1,he=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;P=he(O,P),P=he(A,P),P=he(k,P),P=he(j,P);let ge=+(P>-1);ge&&(P*=E/el),t.glyphOffsetArray.length>=ru.MAX_GLYPHS&&C(`Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907`),x.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey);let _e=od(c,x,T),[ve,ye]=function(t,n){let r=t.length,i=n?.values;if(i?.length>0)for(let n=0;n<i.length;n+=2){let r=i[n+1];t.emplaceBack(e.aq[i[n]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,_e);t.symbolInstances.emplaceBack(n.x,n.y,ae.right>=0?ae.right:-1,ae.center>=0?ae.center:-1,ae.left>=0?ae.left:-1,ae.vertical||-1,re,ie,oe,ce,le,ue,de,fe,N,pe,me,u,te,ne,ee,M,ge,0,p,P,ve,ye)}(t,f,c,r,i,a,A,t.layers[0],t.collisionBoxArray,n.index,n.sourceLayerIndex,t.index,_,[x,x,x,x],T,l,y,S,E,m,n,o,u,d,s)};if(D===`line`)for(let e of Ru(n.geometry,0,0,Io,Io)){let n=Gu(e,b,w,r.vertical||h,i,24,v,t.overscaling,Io);for(let r of n)h&&dd(t,h.text,O,r)||j(e,r)}else if(D===`line-center`){for(let e of n.geometry)if(e.length>1){let t=Wu(e,w,r.vertical||h,i,24,v);t&&j(e,t)}}else if(n.type===`Polygon`)for(let e of kn(n.geometry,0)){let t=ed(e,16);j(e[0],new zu(t.x,t.y,0))}else if(n.type===`LineString`)for(let e of n.geometry)j(e,new zu(e[0].x,e[0].y,0));else if(n.type===`Point`)for(let e of n.geometry)for(let t of e)j([t],new zu(t.x,t.y,0))}function ld(e,t,n,r,i,o,s,c,l,u,d,f,p,m,h){let g=function(e,t,n,r,i,o,s,c){let l=r.layout.get(`text-rotate`).evaluate(o,{})*Math.PI/180,u=[];for(let e of t.positionedLines)for(let r of e.positionedGlyphs){if(!r.rect)continue;let o=r.rect||{},d=4,f=!0,p=1,m=0,h=(i||c)&&r.vertical,g=r.metrics.advance*r.scale/2;if(c&&t.verticalizable&&(m=e.lineOffset/2-(r.imageName?-(el-r.metrics.width*r.scale)/2:(r.scale-1)*el)),r.imageName){let e=s[r.imageName];f=e.sdf,p=e.pixelRatio,d=1/p}let _=i?[r.x+g,r.y]:[0,0],v=i?[0,0]:[r.x+g+n[0],r.y+n[1]-m],y=[0,0];h&&(y=v,v=[0,0]);let b=r.metrics.isDoubleResolution?2:1,x=(r.metrics.left-d)*r.scale-g+v[0],S=(-r.metrics.top-d)*r.scale+v[1],C=x+o.w/b*r.scale/p,w=S+o.h/b*r.scale/p,T=new a(x,S),E=new a(C,S),D=new a(x,w),O=new a(C,w);if(h){let e=new a(-g,g- -17),t=-Math.PI/2,n=el/2-g,i=new a(22-n,-(r.imageName?n:0)),o=new a(...y);T._rotateAround(t,e)._add(i)._add(o),E._rotateAround(t,e)._add(i)._add(o),D._rotateAround(t,e)._add(i)._add(o),O._rotateAround(t,e)._add(i)._add(o)}if(l){let e=Math.sin(l),t=Math.cos(l),n=[t,-e,e,t];T._matMult(n),E._matMult(n),D._matMult(n),O._matMult(n)}let k=new a(0,0),A=new a(0,0);u.push({tl:T,tr:E,bl:D,br:O,tex:o,writingMode:t.writingMode,glyphOffset:_,sectionIndex:r.sectionIndex,isSDF:f,pixelOffsetTL:k,pixelOffsetBR:A,minFontScaleX:0,minFontScaleY:0})}return u}(0,n,c,i,o,s,r,e.allowVerticalPlacement),_=e.textSizeData,v=null;_.kind===`source`?(v=[128*i.layout.get(`text-size`).evaluate(s,{})],v[0]>ql&&C(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):_.kind===`composite`&&(v=[128*m.compositeTextSizes[0].evaluate(s,{},h),128*m.compositeTextSizes[1].evaluate(s,{},h)],(v[0]>ql||v[1]>ql)&&C(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,v,c,o,s,u,t,l.lineStartIndex,l.lineLength,p,h);for(let t of d)f[t]=e.text.placedSymbolArray.length-1;return 4*g.length}function ud(e){for(let t in e)return e[t];return null}function dd(e,t,n,r){let i=e.compareText;if(t in i){let e=i[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<n)return!0}else i[t]=[];return i[t].push(r),!1}let fd=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class pd{static from(e){if(!(e instanceof ArrayBuffer))throw Error(`Data must be an instance of ArrayBuffer.`);let[t,n]=new Uint8Array(e,0,2);if(t!==219)throw Error(`Data does not appear to be in a KDBush format.`);let r=n>>4;if(r!==1)throw Error(`Got v${r} data when expected v1.`);let i=fd[15&n];if(!i)throw Error(`Unrecognized array type.`);let[a]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new pd(o,a,i,e)}constructor(e,t=64,n=Float64Array,r){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let i=fd.indexOf(this.ArrayType),a=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-o%8)%8;if(i<0)throw Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+a+o+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return md(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this,s=[0,i.length-1,0],c=[];for(;s.length;){let l=s.pop()||0,u=s.pop()||0,d=s.pop()||0;if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&(s.push(d),s.push(f-1),s.push(1-l)),(l===0?n>=p:r>=m)&&(s.push(f+1),s.push(u),s.push(1-l))}return c}within(e,t,n){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:r,coords:i,nodeSize:a}=this,o=[0,r.length-1,0],s=[],c=n*n;for(;o.length;){let l=o.pop()||0,u=o.pop()||0,d=o.pop()||0;if(u-d<=a){for(let n=d;n<=u;n++)vd(i[2*n],i[2*n+1],e,t)<=c&&s.push(r[n]);continue}let f=d+u>>1,p=i[2*f],m=i[2*f+1];vd(p,m,e,t)<=c&&s.push(r[f]),(l===0?e-n<=p:t-n<=m)&&(o.push(d),o.push(f-1),o.push(1-l)),(l===0?e+n>=p:t+n>=m)&&(o.push(f+1),o.push(u),o.push(1-l))}return s}}function md(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;hd(e,t,o,r,i,a),md(e,t,n,r,o-1,1-a),md(e,t,n,o+1,i,1-a)}function hd(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);hd(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(gd(e,t,r,n),t[2*i+a]>o&&gd(e,t,r,i);s<c;){for(gd(e,t,s,c),s++,c--;t[2*s+a]<o;)s++;for(;t[2*c+a]>o;)c--}t[2*r+a]===o?gd(e,t,r,c):(c++,gd(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function gd(e,t,n,r){_d(e,n,r),_d(t,2*n,2*r),_d(t,2*n+1,2*r+1)}function _d(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function vd(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}var yd;e.bg=void 0,(yd=e.bg||={}).create=`create`,yd.load=`load`,yd.fullLoad=`fullLoad`;let bd=null,xd=[],Sd=1e3/60,Cd=`loadTime`,wd=`fullLoadTime`;e.$=class extends fa{},e.A=ss,e.B=bi,e.C=function(e){if(E==null){let t=e.navigator?e.navigator.userAgent:null;E=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match(`Safari`)&&!t.match(`Chrome`)))}return E},e.D=Z,e.E=fe,e.F=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new gu((()=>this.process())),this.subscription=function(e,t,n,r){return e.addEventListener(t,n,!1),{unsubscribe:()=>{e.removeEventListener(t,n,!1)}}}(this.target,`message`,(e=>this.receive(e))),this.globalScope=T(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise(((n,r)=>{let i=Math.round(0xde0b6b3a7640000*Math.random()).toString(36).substring(0,10);this.resolveRejects[i]={resolve:n,reject:r},t&&t.signal.addEventListener(`abort`,(()=>{delete this.resolveRejects[i];let t={id:i,type:`<cancel>`,origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)}),{once:!0});let a=[],o=Object.assign(Object.assign({},e),{id:i,sourceMapId:this.mapId,origin:location.origin,data:ki(e.data,a)});this.target.postMessage(o,{transfer:a})}))}receive(e){let t=e.data,n=t.id;if(!(t.origin!==`file://`&&location.origin!==`file://`&&t.origin!==`resource://android`&&location.origin!==`resource://android`&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type===`<cancel>`){delete this.tasks[n];let e=this.abortControllers[n];delete this.abortControllers[n],e&&e.abort();return}if(T(self)||t.mustQueue)return this.tasks[n]=t,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,n){return t(this,void 0,void 0,(function*(){if(n.type===`<response>`){let t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;n.error?t.reject(Ai(n.error)):t.resolve(Ai(n.data));return}if(!this.messageHandlers[n.type])return void this.completeTask(e,Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(`, `)}`));let t=Ai(n.data),r=new AbortController;this.abortControllers[e]=r;try{let i=yield this.messageHandlers[n.type](n.sourceMapId,t,r);this.completeTask(e,null,i)}catch(t){this.completeTask(e,t)}}))}completeTask(e,t,n){let r=[];delete this.abortControllers[e];let i={id:e,type:`<response>`,sourceMapId:this.mapId,origin:location.origin,error:t?ki(t):null,data:ki(n,r)};this.target.postMessage(i,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.G=re,e.H=function(){var e=new ss(16);return ss!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.I=Dl,e.J=function(e,t,n){var r,i,a,o,s,c,l,u,d,f,p,m,h=n[0],g=n[1],_=n[2];return t===e?(e[12]=t[0]*h+t[4]*g+t[8]*_+t[12],e[13]=t[1]*h+t[5]*g+t[9]*_+t[13],e[14]=t[2]*h+t[6]*g+t[10]*_+t[14],e[15]=t[3]*h+t[7]*g+t[11]*_+t[15]):(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],e[0]=r=t[0],e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=l,e[7]=u,e[8]=d,e[9]=f,e[10]=p,e[11]=m,e[12]=r*h+s*g+d*_+t[12],e[13]=i*h+c*g+f*_+t[13],e[14]=a*h+l*g+p*_+t[14],e[15]=o*h+u*g+m*_+t[15]),e},e.K=function(e,t,n){var r=n[0],i=n[1],a=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.L=ls,e.M=function(e,t){let n={};for(let r=0;r<t.length;r++){let i=t[r];i in e&&(n[i]=e[i])}return n},e.N=vu,e.O=xu,e.P=a,e.Q=Su,e.R=Ss,e.S=ku,e.T=qi,e.U=d,e.V=f,e.W=k,e.X=Io,e.Y=ca,e.Z=Tu,e._=t,e.a=te,e.a$=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],d=e[9],f=e[10],p=e[11],m=e[12],h=e[13],g=e[14],_=e[15],v=t[0],y=t[1],b=t[2],x=t[3],S=t[4],C=t[5],w=t[6],T=t[7],E=t[8],D=t[9],O=t[10],k=t[11],A=t[12],j=t[13],ee=t[14],M=t[15];return Math.abs(n-v)<=os*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(r-y)<=os*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(i-b)<=os*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(a-x)<=os*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(o-S)<=os*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(s-C)<=os*Math.max(1,Math.abs(s),Math.abs(C))&&Math.abs(c-w)<=os*Math.max(1,Math.abs(c),Math.abs(w))&&Math.abs(l-T)<=os*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-E)<=os*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(d-D)<=os*Math.max(1,Math.abs(d),Math.abs(D))&&Math.abs(f-O)<=os*Math.max(1,Math.abs(f),Math.abs(O))&&Math.abs(p-k)<=os*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(m-A)<=os*Math.max(1,Math.abs(m),Math.abs(A))&&Math.abs(h-j)<=os*Math.max(1,Math.abs(h),Math.abs(j))&&Math.abs(g-ee)<=os*Math.max(1,Math.abs(g),Math.abs(ee))&&Math.abs(_-M)<=os*Math.max(1,Math.abs(_),Math.abs(M))},e.a0=oo,e.a1=Du,e.a2=F,e.a3=e=>{let t=window.document.createElement(`video`);return t.muted=!0,new Promise((n=>{t.onloadstart=()=>{n(t)};for(let n of e){let e=window.document.createElement(`source`);se(n)||(t.crossOrigin=`Anonymous`),e.src=n,t.appendChild(e)}}))},e.a4=function(){return v++},e.a5=Pa,e.a6=ru,e.a7=Nr,e.a8=Bo,e.a9=Nu,e.aA=function(e){if(e.type===`custom`)return new hu(e);switch(e.type){case`background`:return new du(e);case`circle`:return new ps(e);case`fill`:return new sc(e);case`fill-extrusion`:return new jc(e);case`heatmap`:return new Ts(e);case`hillshade`:return new Os(e);case`line`:return new Gc(e);case`raster`:return new mu(e);case`symbol`:return new cu(e)}},e.aB=x,e.aC=function(e,t){if(!e)return[{command:`setStyle`,args:[t]}];let n=[];try{if(!P(e.version,t.version))return[{command:`setStyle`,args:[t]}];P(e.center,t.center)||n.push({command:`setCenter`,args:[t.center]}),P(e.zoom,t.zoom)||n.push({command:`setZoom`,args:[t.zoom]}),P(e.bearing,t.bearing)||n.push({command:`setBearing`,args:[t.bearing]}),P(e.pitch,t.pitch)||n.push({command:`setPitch`,args:[t.pitch]}),P(e.sprite,t.sprite)||n.push({command:`setSprite`,args:[t.sprite]}),P(e.glyphs,t.glyphs)||n.push({command:`setGlyphs`,args:[t.glyphs]}),P(e.transition,t.transition)||n.push({command:`setTransition`,args:[t.transition]}),P(e.light,t.light)||n.push({command:`setLight`,args:[t.light]}),P(e.terrain,t.terrain)||n.push({command:`setTerrain`,args:[t.terrain]}),P(e.sky,t.sky)||n.push({command:`setSky`,args:[t.sky]}),P(e.projection,t.projection)||n.push({command:`setProjection`,args:[t.projection]});let r={},i=[];(function(e,t,n,r){let i;for(i in t||={},e||={})Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||_e(i,n,r));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?P(e[i],t[i])||(e[i].type===`geojson`&&t[i].type===`geojson`&&ye(e,t,i)?he(n,{command:`setGeoJSONSourceData`,args:[i,t[i].data]}):ve(i,t,n,r)):ge(i,t,n))})(e.sources,t.sources,i,r);let a=[];e.layers&&e.layers.forEach((e=>{`source`in e&&r[e.source]?n.push({command:`removeLayer`,args:[e.id]}):a.push(e)})),n=n.concat(i),function(e,t,n){t||=[];let r=(e||=[]).map(xe),i=t.map(xe),a=e.reduce(Se,{}),o=t.reduce(Se,{}),s=r.slice(),c=Object.create(null),l,u,d,f,p;for(let e=0,t=0;e<r.length;e++)l=r[e],Object.prototype.hasOwnProperty.call(o,l)?t++:(he(n,{command:`removeLayer`,args:[l]}),s.splice(s.indexOf(l,t),1));for(let e=0,t=0;e<i.length;e++)l=i[i.length-1-e],s[s.length-1-e]!==l&&(Object.prototype.hasOwnProperty.call(a,l)?(he(n,{command:`removeLayer`,args:[l]}),s.splice(s.lastIndexOf(l,s.length-t),1)):t++,f=s[s.length-e],he(n,{command:`addLayer`,args:[o[l],f]}),s.splice(s.length-e,0,l),c[l]=!0);for(let e=0;e<i.length;e++)if(l=i[e],u=a[l],d=o[l],!c[l]&&!P(u,d))if(P(u.source,d.source)&&P(u[`source-layer`],d[`source-layer`])&&P(u.type,d.type)){for(p in be(u.layout,d.layout,n,l,null,`setLayoutProperty`),be(u.paint,d.paint,n,l,null,`setPaintProperty`),P(u.filter,d.filter)||he(n,{command:`setFilter`,args:[l,d.filter]}),P(u.minzoom,d.minzoom)&&P(u.maxzoom,d.maxzoom)||he(n,{command:`setLayerZoomRange`,args:[l,d.minzoom,d.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?be(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):P(u[p],d[p])||he(n,{command:`setLayerProperty`,args:[l,p,d[p]]}));for(p in d)Object.prototype.hasOwnProperty.call(d,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?be(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):P(u[p],d[p])||he(n,{command:`setLayerProperty`,args:[l,p,d[p]]}))}else he(n,{command:`removeLayer`,args:[l]}),f=s[s.lastIndexOf(l)+1],he(n,{command:`addLayer`,args:[d,f]})}(a,t.layers,n)}catch(e){console.warn(`Unable to compute style diff:`,e),n=[{command:`setStyle`,args:[t]}]}return n},e.aD=function(e){let t=[],n=e.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),e.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),e.renderingMode&&e.renderingMode!==`2d`&&e.renderingMode!==`3d`&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},e.aE=function e(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}if(typeof t==`object`&&t&&n!==null){if(typeof n!=`object`||Object.keys(t).length!==Object.keys(n).length)return!1;for(let r in t)if(!e(t[r],n[r]))return!1;return!0}return t===n},e.aF=y,e.aG=b,e.aH=class extends xo{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.aI=So,e.aJ=class extends xo{constructor(e,t){super(e,t),this.current=To}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.aK=Co,e.aL=wo,e.aM=B,e.aN=class extends xo{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.aO=class extends xo{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.aP=function(e,t,n,r,i,a,o){var s=1/(t-n),c=1/(r-i),l=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*s,e[13]=(i+r)*c,e[14]=(o+a)*l,e[15]=1,e},e.aQ=ds,e.aR=class extends Sa{},e.aS=Zc,e.aT=class extends wa{},e.aU=ws,e.aV=function(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)},e.aW=Cs,e.aX=Ga,e.aY=ro,e.aZ=class extends ja{},e.a_=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},e.aa=function(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,n,r,i)=>{let a=r||i;return t[n]=!a||a.toLowerCase(),``})),t[`max-age`]){let e=parseInt(t[`max-age`],10);isNaN(e)?delete t[`max-age`]:t[`max-age`]=e}return t},e.ab=function(e,t){let n=[];for(let r in e)r in t||n.push(r);return n},e.ac=h,e.ad=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[0],o=t[1],s=t[2],c=t[3],l=t[4],u=t[5],d=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i+l*r,e[1]=o*i+u*r,e[2]=s*i+d*r,e[3]=c*i+f*r,e[4]=l*i-a*r,e[5]=u*i-o*r,e[6]=d*i-s*r,e[7]=f*i-c*r,e},e.ae=function(e){var t=new ss(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.af=fs,e.ag=function(e,t){let n=0,r=0;if(e.kind===`constant`)r=e.layoutSize;else if(e.kind!==`source`){let{interpolationType:i,minZoom:a,maxZoom:o}=e,s=i?h(Ht.interpolationFactor(i,t,a,o),0,1):0;e.kind===`camera`?r=Vt.number(e.minSize,e.maxSize,s):n=s}return{uSizeT:n,uSize:r}},e.ai=function(e,{uSize:t,uSizeT:n},{lowerSize:r,upperSize:i}){return e.kind===`source`?r/128:e.kind===`composite`?Vt.number(r/128,i/128,n):t},e.aj=$l,e.ak=function(e,t,n,r){let i=t.y-e.y,o=t.x-e.x,s=r.y-n.y,c=r.x-n.x,l=s*o-c*i;if(l===0)return null;let u=(c*(e.y-n.y)-s*(e.x-n.x))/l;return new a(e.x+u*o,e.y+u*i)},e.al=Ru,e.am=Uo,e.an=cs,e.ao=function(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return[t,n,r,i]},e.ap=el,e.ar=Yl,e.as=function(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(e[0]=(s*k-c*O+l*D)*(A=1/A),e[1]=(i*O-r*k-a*D)*A,e[2]=(h*C-g*S+_*x)*A,e[3]=(f*S-d*C-p*x)*A,e[4]=(c*E-o*k-l*T)*A,e[5]=(n*k-i*E+a*T)*A,e[6]=(g*b-m*C-_*y)*A,e[7]=(u*C-f*b+p*y)*A,e[8]=(o*O-s*E+l*w)*A,e[9]=(r*E-n*O-a*w)*A,e[10]=(m*S-h*b+_*v)*A,e[11]=(d*b-u*S-p*v)*A,e[12]=(s*T-o*D-c*w)*A,e[13]=(n*D-r*T+i*w)*A,e[14]=(h*y-m*x-g*v)*A,e[15]=(u*x-d*y+f*v)*A,e):null},e.at=sd,e.au=Hl,e.av=pd,e.aw=function(){let e={},t=N.$version;for(let n in N.$root){let r=N.$root[n];if(r.required){let i=null;i=n===`version`?t:r.type===`array`?[]:{},i!=null&&(e[n]=i)}}return e},e.ax=ji,e.ay=ae,e.az=function(e){e=e.slice();let t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].id]=e[n];for(let n=0;n<e.length;n++)`ref`in e[n]&&(e[n]=me(e[n],t[e[n].ref]));return e},e.b=D,e.b0=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.b1=function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e},e.b2=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},e.b3=g,e.b4=Ou,e.b5=Cu,e.b6=function(e,t,n,r,i){var a,o=1/Math.tan(t/2);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(e[10]=(i+r)*(a=1/(r-i)),e[14]=2*i*r*a):(e[10]=-1,e[14]=-2*r),e},e.b7=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*i+l*r,e[5]=o*i+u*r,e[6]=s*i+d*r,e[7]=c*i+f*r,e[8]=l*i-a*r,e[9]=u*i-o*r,e[10]=d*i-s*r,e[11]=f*i-c*r,e},e.b8=p,e.b9=m,e.bA=tl,e.bB=function(e){return e.message===ee},e.bC=Tr,e.bD=Wi,e.ba=function(e){return e*Math.PI/180},e.bb=function(e,t){let{x:n,y:r}=Tu.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||n<0||n>=1)},e.bc=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.bd=class extends da{},e.be=_u,e.bf={mark(e){performance.mark(e)},frame(e){let t=e;bd!=null&&xd.push(t-bd),bd=t},clearMetrics(){bd=null,xd=[],performance.clearMeasures(Cd),performance.clearMeasures(wd);for(let t in e.bg)performance.clearMarks(e.bg[t])},getPerformanceMetrics(){performance.measure(Cd,e.bg.create,e.bg.load),performance.measure(wd,e.bg.create,e.bg.fullLoad);let t=performance.getEntriesByName(Cd)[0].duration,n=performance.getEntriesByName(wd)[0].duration,r=xd.length,i=1/(xd.reduce(((e,t)=>e+t),0)/r/1e3),a=xd.filter((e=>e>Sd)).reduce(((e,t)=>e+(t-Sd)/Sd),0);return{loadTime:t,fullLoadTime:n,fps:i,percentDroppedFrames:a/(r+a)*100,totalFrames:r}}},e.bh=ie,e.bi=function(e,t){te.REGISTERED_PROTOCOLS[e]=t},e.bj=function(e){delete te.REGISTERED_PROTOCOLS[e]},e.bk=function(e,t){let n={};for(let r=0;r<e.length;r++){let i=t&&t[e[r].id]||Hr(e[r]);t&&(t[e[r].id]=i);let a=n[i];a||=n[i]=[],a.push(e[r])}let r=[];for(let e in n)r.push(n[e]);return r},e.bl=J,e.bm=Mu,e.bn=Pu,e.bo=Ol,e.bp=function(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=Io/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let n=t.bucket.layers[0],r=n.layout,i=n._unevaluatedLayout._values,a={layoutIconSize:i[`icon-size`].possiblyEvaluate(new X(t.bucket.zoom+1),t.canonical),layoutTextSize:i[`text-size`].possiblyEvaluate(new X(t.bucket.zoom+1),t.canonical),textMaxSize:i[`text-size`].possiblyEvaluate(new X(18))};if(t.bucket.textSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.bucket.textSizeData;a.compositeTextSizes=[i[`text-size`].possiblyEvaluate(new X(e),t.canonical),i[`text-size`].possiblyEvaluate(new X(n),t.canonical)]}if(t.bucket.iconSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.bucket.iconSizeData;a.compositeIconSizes=[i[`icon-size`].possiblyEvaluate(new X(e),t.canonical),i[`icon-size`].possiblyEvaluate(new X(n),t.canonical)]}let o=r.get(`text-line-height`)*el,s=r.get(`text-rotation-alignment`)!==`viewport`&&r.get(`symbol-placement`)!==`point`,c=r.get(`text-keep-upright`),l=r.get(`text-size`);for(let i of t.bucket.features){let u=r.get(`text-font`).evaluate(i,{},t.canonical).join(`,`),d=l.evaluate(i,{},t.canonical),f=a.layoutTextSize.evaluate(i,{},t.canonical),p=a.layoutIconSize.evaluate(i,{},t.canonical),m={horizontal:{},vertical:void 0},h=i.text,g,_=[0,0];if(h){let a=h.toString(),l=r.get(`text-letter-spacing`).evaluate(i,{},t.canonical)*el,p=Ni(a)?l:0,g=r.get(`text-anchor`).evaluate(i,{},t.canonical),v=od(n,i,t.canonical);if(!v){let e=r.get(`text-radial-offset`).evaluate(i,{},t.canonical);_=e?ad(g,[e*el,id]):r.get(`text-offset`).evaluate(i,{},t.canonical).map((e=>e*el))}let y=s?`center`:r.get(`text-justify`).evaluate(i,{},t.canonical),b=r.get(`symbol-placement`)===`point`?r.get(`text-max-width`).evaluate(i,{},t.canonical)*el:1/0,x=()=>{t.bucket.allowVerticalPlacement&&Mi(a)&&(m.vertical=Ml(h,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,o,g,`left`,p,_,e.ah.vertical,!0,f,d))};if(!s&&v){let n=new Set;if(y===`auto`)for(let e=0;e<v.values.length;e+=2)n.add(sd(v.values[e]));else n.add(y);let r=!1;for(let i of n)if(!m.horizontal[i])if(r)m.horizontal[i]=m.horizontal[0];else{let n=Ml(h,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,o,`center`,i,p,_,e.ah.horizontal,!1,f,d);n&&(m.horizontal[i]=n,r=n.positionedLines.length===1)}x()}else{y===`auto`&&(y=sd(g));let n=Ml(h,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,o,g,y,p,_,e.ah.horizontal,!1,f,d);n&&(m.horizontal[y]=n),x(),Mi(a)&&s&&c&&(m.vertical=Ml(h,t.glyphMap,t.glyphPositions,t.imagePositions,u,b,o,g,y,p,_,e.ah.vertical,!1,f,d))}}let v=!1;if(i.icon&&i.icon.name){let e=t.imageMap[i.icon.name];e&&(g=Wl(t.imagePositions[i.icon.name],r.get(`icon-offset`).evaluate(i,{},t.canonical),r.get(`icon-anchor`).evaluate(i,{},t.canonical)),v=!!e.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=v:t.bucket.sdfIcons!==v&&C(`Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer`),(e.pixelRatio!==t.bucket.pixelRatio||r.get(`icon-rotate`).constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let y=ud(m.horizontal)||m.vertical;t.bucket.iconsInText=!!y&&y.iconsInText,(y||g)&&cd(t.bucket,i,m,g,t.imageMap,a,f,p,_,v,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.bq=zc,e.br=rc,e.bs=Ec,e.bt=dc,e.bu=Sl,e.bv=class{constructor(e){this._marks={start:[e.url,`start`].join(`#`),end:[e.url,`end`].join(`#`),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return e.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}},e.bw=function(e,n,r,i,a){return t(this,void 0,void 0,(function*(){if(f())try{return yield k(e,n,r,i,a)}catch{}return function(e,t,n,r,i){let a=e.width,o=e.height;A&&j||(A=new OffscreenCanvas(a,o),j=A.getContext(`2d`,{willReadFrequently:!0})),A.width=a,A.height=o,j.drawImage(e,0,0,a,o);let s=j.getImageData(t,n,r,i);return j.clearRect(0,0,a,o),s.data}(e,n,r,i,a)}))},e.bx=ju,e.by=n,e.bz=r,e.c=M,e.d=e=>t(void 0,void 0,void 0,(function*(){if(e.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(e)],{type:`image/png`});try{return createImageBitmap(t)}catch(e){throw Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),e.e=_,e.f=e=>new Promise(((t,n)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=O}))},r.onerror=()=>n(Error(`Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`));let i=new Blob([new Uint8Array(e)],{type:`image/png`});r.src=e.byteLength?URL.createObjectURL(i):O})),e.g=ne,e.h=(e,t)=>oe(_(e,{type:`json`}),t),e.i=T,e.j=de,e.k=ue,e.l=(e,t)=>oe(_(e,{type:`arrayBuffer`}),t),e.m=oe,e.n=function(e){return new Sl(e).readFields(Cl,[])},e.o=xs,e.p=El,e.q=na,e.r=yi,e.s=se,e.t=Ci,e.u=vi,e.v=N,e.w=C,e.x=function([e,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(n),y:e*Math.sin(t)*Math.sin(n),z:e*Math.cos(n)}},e.y=Vt,e.z=X})),n(`worker`,[`./shared`],(function(e){class t{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,n){for(let n of t){this._layerConfigs[n.id]=n;let t=this._layers[n.id]=e.aA(n);t._featureFilter=e.a7(t.filter),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(let e of n)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};let r=e.bk(Object.values(this._layerConfigs),this.keyCache);for(let e of r){let t=e.map((e=>this._layers[e.id])),n=t[0];if(n.visibility===`none`)continue;let r=n.source||``,i=this.familiesBySource[r];i||=this.familiesBySource[r]={};let a=n.sourceLayer||`_geojsonTileLayer`,o=i[a];o||=i[a]=[],o.push(t)}}}class n{constructor(t){let n={},r=[];for(let e in t){let i=t[e],a=n[e]={};for(let e in i){let t=i[+e];if(!t||t.bitmap.width===0||t.bitmap.height===0)continue;let n={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};r.push(n),a[e]={rect:n,metrics:t.metrics}}}let{w:i,h:a}=e.p(r),o=new e.o({width:i||1,height:a||1});for(let r in t){let i=t[r];for(let t in i){let a=i[+t];if(!a||a.bitmap.width===0||a.bitmap.height===0)continue;let s=n[r][t].rect;e.o.copy(a.bitmap,o,{x:0,y:0},{x:s.x+1,y:s.y+1},a.bitmap)}}this.image=o,this.positions=n}}e.bl(`GlyphAtlas`,n);class r{constructor(t){this.tileID=new e.S(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(t,r,a,o){return e._(this,void 0,void 0,(function*(){this.status=`parsing`,this.data=t,this.collisionBoxArray=new e.a5;let s=new e.bm(Object.keys(t.layers).sort()),c=new e.bn(this.tileID,this.promoteId);c.bucketLayerIDs=[];let l={},u={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:a},d=r.familiesBySource[this.source];for(let n in d){let r=t.layers[n];if(!r)continue;r.version===1&&e.w(`Vector tile source "${this.source}" layer "${n}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let o=s.encode(n),f=[];for(let e=0;e<r.length;e++){let t=r.feature(e),i=c.getId(t,n);f.push({feature:t,id:i,index:e,sourceLayerIndex:o})}for(let t of d[n]){let n=t[0];n.source!==this.source&&e.w(`layer.source = ${n.source} does not equal this.source = ${this.source}`),n.minzoom&&this.zoom<Math.floor(n.minzoom)||n.maxzoom&&this.zoom>=n.maxzoom||n.visibility!==`none`&&(i(t,this.zoom,a),(l[n.id]=n.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(f,u,this.tileID.canonical),c.bucketLayerIDs.push(t.map((e=>e.id))))}}let f=e.aF(u.glyphDependencies,(e=>Object.keys(e).map(Number)));this.inFlightDependencies.forEach((e=>e?.abort())),this.inFlightDependencies=[];let p=Promise.resolve({});if(Object.keys(f).length){let e=new AbortController;this.inFlightDependencies.push(e),p=o.sendAsync({type:`GG`,data:{stacks:f,source:this.source,tileID:this.tileID,type:`glyphs`}},e)}let m=Object.keys(u.iconDependencies),h=Promise.resolve({});if(m.length){let e=new AbortController;this.inFlightDependencies.push(e),h=o.sendAsync({type:`GI`,data:{icons:m,source:this.source,tileID:this.tileID,type:`icons`}},e)}let g=Object.keys(u.patternDependencies),_=Promise.resolve({});if(g.length){let e=new AbortController;this.inFlightDependencies.push(e),_=o.sendAsync({type:`GI`,data:{icons:g,source:this.source,tileID:this.tileID,type:`patterns`}},e)}let[v,y,b]=yield Promise.all([p,h,_]),x=new n(v),S=new e.bo(y,b);for(let t in l){let n=l[t];n instanceof e.a6?(i(n.layers,this.zoom,a),e.bp({bucket:n,glyphMap:v,glyphPositions:x.positions,imageMap:y,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):n.hasPattern&&(n instanceof e.bq||n instanceof e.br||n instanceof e.bs)&&(i(n.layers,this.zoom,a),n.addFeatures(u,this.tileID.canonical,S.patternPositions))}return this.status=`done`,{buckets:Object.values(l).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:x.image,imageAtlas:S,glyphMap:this.returnDependencies?v:null,iconMap:this.returnDependencies?y:null,glyphPositions:this.returnDependencies?x.positions:null}}))}}function i(t,n,r){let i=new e.z(n);for(let e of t)e.recalculate(i,r)}class a{constructor(e,t,n){this.actor=e,this.layerIndex=t,this.availableImages=n,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(t,n){return e._(this,void 0,void 0,(function*(){let r=yield e.l(t.request,n);try{return{vectorTile:new e.bt.VectorTile(new e.bu(r.data)),rawData:r.data,cacheControl:r.cacheControl,expires:r.expires}}catch(e){let n=new Uint8Array(r.data),i=`Unable to parse the tile at ${t.request.url}, `;throw i+=n[0]===31&&n[1]===139?`please make sure the data is not gzipped and that you have configured the relevant header in the server`:`got error: ${e.message}`,Error(i)}}))}loadTile(t){return e._(this,void 0,void 0,(function*(){let n=t.uid,i=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.bv(t.request),a=new r(t);this.loading[n]=a;let o=new AbortController;a.abort=o;try{let r=yield this.loadVectorTile(t,o);if(delete this.loading[n],!r)return null;let s=r.rawData,c={};r.expires&&(c.expires=r.expires),r.cacheControl&&(c.cacheControl=r.cacheControl);let l={};if(i){let e=i.finish();e&&(l.resourceTiming=JSON.parse(JSON.stringify(e)))}a.vectorTile=r.vectorTile;let u=a.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[n]=a,this.fetching[n]={rawTileData:s,cacheControl:c,resourceTiming:l};try{let t=yield u;return e.e({rawTileData:s.slice(0)},t,c,l)}finally{delete this.fetching[n]}}catch(e){throw delete this.loading[n],a.status=`done`,this.loaded[n]=a,e}}))}reloadTile(t){return e._(this,void 0,void 0,(function*(){let n=t.uid;if(!this.loaded||!this.loaded[n])throw Error(`Should not be trying to reload a tile that was never loaded or has been removed`);let r=this.loaded[n];if(r.showCollisionBoxes=t.showCollisionBoxes,r.status===`parsing`){let t=yield r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor),i;if(this.fetching[n]){let{rawTileData:r,cacheControl:a,resourceTiming:o}=this.fetching[n];delete this.fetching[n],i=e.e({rawTileData:r.slice(0)},t,a,o)}else i=t;return i}if(r.status===`done`&&r.vectorTile)return r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){let e=this.loading,n=t.uid;e&&e[n]&&e[n].abort&&(e[n].abort.abort(),delete e[n])}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[t.uid]&&delete this.loaded[t.uid]}))}}class o{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,(function*(){let{uid:n,encoding:r,rawImageData:i,redFactor:a,greenFactor:o,blueFactor:s,baseShift:c}=t,l=i.width+2,u=i.height+2,d=e.b(i)?new e.R({width:l,height:u},yield e.bw(i,-1,-1,l,u)):i,f=new e.bx(n,d,r,a,o,s,c);return this.loaded=this.loaded||{},this.loaded[n]=f,f}))}removeTile(e){let t=this.loaded,n=e.uid;t&&t[n]&&delete t[n]}}function s(e,t){if(e.length!==0){c(e[0],t);for(var n=1;n<e.length;n++)c(e[n],!t)}}function c(e,t){for(var n=0,r=0,i=0,a=e.length,o=a-1;i<a;o=i++){var s=(e[i][0]-e[o][0])*(e[o][1]+e[i][1]),c=n+s;r+=Math.abs(n)>=Math.abs(s)?n-c+s:s-c+n,n=c}n+r>=0!=!!t&&e.reverse()}var l=e.by((function e(t,n){var r,i=t&&t.type;if(i===`FeatureCollection`)for(r=0;r<t.features.length;r++)e(t.features[r],n);else if(i===`GeometryCollection`)for(r=0;r<t.geometries.length;r++)e(t.geometries[r],n);else if(i===`Feature`)e(t.geometry,n);else if(i===`Polygon`)s(t.coordinates,n);else if(i===`MultiPolygon`)for(r=0;r<t.coordinates.length;r++)s(t.coordinates[r],n);return t}));let u=e.bt.VectorTileFeature.prototype.toGeoJSON;var d={exports:{}},f=e.bz,p=e.bt.VectorTileFeature,m=h;function h(e,t){this.options=t||{},this.features=e,this.length=e.length}function g(e,t){this.id=typeof e.id==`number`?e.id:void 0,this.type=e.type,this.rawGeometry=e.type===1?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}h.prototype.feature=function(e){return new g(this.features[e],this.options.extent)},g.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var n=e[t],r=[],i=0;i<n.length;i++)r.push(new f(n[i][0],n[i][1]));this.geometry.push(r)}return this.geometry},g.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,n=-1/0,r=1/0,i=-1/0,a=0;a<e.length;a++)for(var o=e[a],s=0;s<o.length;s++){var c=o[s];t=Math.min(t,c.x),n=Math.max(n,c.x),r=Math.min(r,c.y),i=Math.max(i,c.y)}return[t,r,n,i]},g.prototype.toGeoJSON=p.prototype.toGeoJSON;var _=e.bA,v=m;function y(e){var t=new _;return function(e,t){for(var n in e.layers)t.writeMessage(3,b,e.layers[n])}(e,t),t.finish()}function b(e,t){var n;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||``),t.writeVarintField(5,e.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(n=0;n<e.length;n++)r.feature=e.feature(n),t.writeMessage(2,x,r);var i=r.keys;for(n=0;n<i.length;n++)t.writeStringField(3,i[n]);var a=r.values;for(n=0;n<a.length;n++)t.writeMessage(4,E,a[n])}function x(e,t){var n=e.feature;n.id!==void 0&&t.writeVarintField(1,n.id),t.writeMessage(2,S,e),t.writeVarintField(3,n.type),t.writeMessage(4,T,n)}function S(e,t){var n=e.feature,r=e.keys,i=e.values,a=e.keycache,o=e.valuecache;for(var s in n.properties){var c=n.properties[s],l=a[s];if(c!==null){l===void 0&&(r.push(s),a[s]=l=r.length-1),t.writeVarint(l);var u=typeof c;u!==`string`&&u!==`boolean`&&u!==`number`&&(c=JSON.stringify(c));var d=u+`:`+c,f=o[d];f===void 0&&(i.push(c),o[d]=f=i.length-1),t.writeVarint(f)}}}function C(e,t){return(t<<3)+(7&e)}function w(e){return e<<1^e>>31}function T(e,t){for(var n=e.loadGeometry(),r=e.type,i=0,a=0,o=n.length,s=0;s<o;s++){var c=n[s],l=1;r===1&&(l=c.length),t.writeVarint(C(1,l));for(var u=r===3?c.length-1:c.length,d=0;d<u;d++){d===1&&r!==1&&t.writeVarint(C(2,u-1));var f=c[d].x-i,p=c[d].y-a;t.writeVarint(w(f)),t.writeVarint(w(p)),i+=f,a+=p}r===3&&t.writeVarint(C(7,1))}}function E(e,t){var n=typeof e;n===`string`?t.writeStringField(1,e):n===`boolean`?t.writeBooleanField(7,e):n===`number`&&(e%1==0?e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e):t.writeDoubleField(3,e))}d.exports=y,d.exports.fromVectorTileJs=y,d.exports.fromGeojsonVt=function(e,t){t||={};var n={};for(var r in e)n[r]=new v(e[r].features,t),n[r].name=r,n[r].version=t.version,n[r].extent=t.extent;return y({layers:n})},d.exports.GeoJSONWrapper=v;var D=e.by(d.exports);let O={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},k=Math.fround||(A=new Float32Array(1),e=>(A[0]=+e,A[0]));var A;class j{constructor(e){this.options=Object.assign(Object.create(O),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:t,minZoom:n,maxZoom:r}=this.options;t&&console.time(`total time`);let i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let a=[];for(let t=0;t<e.length;t++){let n=e[t];if(!n.geometry)continue;let[r,i]=n.geometry.coordinates,o=k(te(r)),s=k(ne(i));a.push(o,s,1/0,t,-1,1),this.options.reduce&&a.push(0)}let o=this.trees[r+1]=this._createTree(a);t&&console.timeEnd(i);for(let e=r;e>=n;e--){let n=+Date.now();o=this.trees[e]=this._createTree(this._cluster(o,e)),t&&console.log(`z%d: %d clusters in %dms`,e,o.numItems,+Date.now()-n)}return t&&console.timeEnd(`total time`),this}getClusters(e,t){let n=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,i=180;else if(n>i){let e=this.getClusters([n,r,180,a],t),o=this.getClusters([-180,r,i,a],t);return e.concat(o)}let o=this.trees[this._limitZoom(t)],s=o.range(te(n),ne(a),te(i),ne(r)),c=o.data,l=[];for(let e of s){let t=this.stride*e;l.push(c[t+5]>1?ee(c,t,this.clusterProps):this.points[c[t+3]])}return l}getChildren(e){let t=this._getOriginId(e),n=this._getOriginZoom(e),r=`No cluster with the specified id.`,i=this.trees[n];if(!i)throw Error(r);let a=i.data;if(t*this.stride>=a.length)throw Error(r);let o=this.options.radius/(this.options.extent*2**(n-1)),s=i.within(a[t*this.stride],a[t*this.stride+1],o),c=[];for(let t of s){let n=t*this.stride;a[n+4]===e&&c.push(a[n+5]>1?ee(a,n,this.clusterProps):this.points[a[n+3]])}if(c.length===0)throw Error(r);return c}getLeaves(e,t,n){let r=[];return this._appendLeaves(r,e,t||=10,n||=0,0),r}getTile(e,t,n){let r=this.trees[this._limitZoom(e)],i=2**e,{extent:a,radius:o}=this.options,s=o/a,c=(n-s)/i,l=(n+1+s)/i,u={features:[]};return this._addTileFeatures(r.range((t-s)/i,c,(t+1+s)/i,l),r.data,t,n,i,u),t===0&&this._addTileFeatures(r.range(1-s/i,c,1,l),r.data,i,n,i,u),t===i-1&&this._addTileFeatures(r.range(0,c,s/i,l),r.data,-1,n,i,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){let n=this.getChildren(e);if(t++,n.length!==1)break;e=n[0].properties.cluster_id}return t}_appendLeaves(e,t,n,r,i){let a=this.getChildren(t);for(let t of a){let a=t.properties;if(a&&a.cluster?i+a.point_count<=r?i+=a.point_count:i=this._appendLeaves(e,a.cluster_id,n,r,i):i<r?i++:e.push(t),e.length===n)break}return i}_createTree(t){let n=new e.av(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)n.add(t[e],t[e+1]);return n.finish(),n.data=t,n}_addTileFeatures(e,t,n,r,i,a){for(let o of e){let e=o*this.stride,s=t[e+5]>1,c,l,u;if(s)c=M(t,e,this.clusterProps),l=t[e],u=t[e+1];else{let n=this.points[t[e+3]];c=n.properties;let[r,i]=n.geometry.coordinates;l=te(r),u=ne(i)}let d={type:1,geometry:[[Math.round(this.options.extent*(l*i-n)),Math.round(this.options.extent*(u*i-r))]],tags:c},f;f=s||this.options.generateId?t[e+3]:this.points[t[e+3]].id,f!==void 0&&(d.id=f),a.features.push(d)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){let{radius:n,extent:r,reduce:i,minPoints:a}=this.options,o=n/(r*2**t),s=e.data,c=[],l=this.stride;for(let n=0;n<s.length;n+=l){if(s[n+2]<=t)continue;s[n+2]=t;let r=s[n],u=s[n+1],d=e.within(s[n],s[n+1],o),f=s[n+5],p=f;for(let e of d){let n=e*l;s[n+2]>t&&(p+=s[n+5])}if(p>f&&p>=a){let e,a=r*f,o=u*f,m=-1,h=((n/l|0)<<5)+(t+1)+this.points.length;for(let r of d){let c=r*l;if(s[c+2]<=t)continue;s[c+2]=t;let u=s[c+5];a+=s[c]*u,o+=s[c+1]*u,s[c+4]=h,i&&(e||(e=this._map(s,n,!0),m=this.clusterProps.length,this.clusterProps.push(e)),i(e,this._map(s,c)))}s[n+4]=h,c.push(a/p,o/p,1/0,h,-1,p),i&&c.push(m)}else{for(let e=0;e<l;e++)c.push(s[n+e]);if(p>1)for(let e of d){let n=e*l;if(!(s[n+2]<=t)){s[n+2]=t;for(let e=0;e<l;e++)c.push(s[n+e])}}}}return c}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,n){if(e[t+5]>1){let r=this.clusterProps[e[t+6]];return n?Object.assign({},r):r}let r=this.points[e[t+3]].properties,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}}function ee(e,t,n){return{type:`Feature`,id:e[t+3],properties:M(e,t,n),geometry:{type:`Point`,coordinates:[(r=e[t],360*(r-.5)),re(e[t+1])]}};var r}function M(e,t,n){let r=e[t+5],i=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+`k`:r,a=e[t+6],o=a===-1?{}:Object.assign({},n[a]);return Object.assign(o,{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:i})}function te(e){return e/360+.5}function ne(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function re(e){let t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function ie(e,t,n,r){let i=r,a=t+(n-t>>1),o,s=n-t,c=e[t],l=e[t+1],u=e[n],d=e[n+1];for(let r=t+3;r<n;r+=3){let t=ae(e[r],e[r+1],c,l,u,d);if(t>i)o=r,i=t;else if(t===i){let e=Math.abs(r-a);e<s&&(o=r,s=e)}}i>r&&(o-t>3&&ie(e,t,o,r),e[o+2]=i,n-o>3&&ie(e,o,n,r))}function ae(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return o=e-n,s=t-r,o*o+s*s}function oe(e,t,n,r){let i={id:e??null,type:t,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(t===`Point`||t===`MultiPoint`||t===`LineString`)se(i,n);else if(t===`Polygon`)se(i,n[0]);else if(t===`MultiLineString`)for(let e of n)se(i,e);else if(t===`MultiPolygon`)for(let e of n)se(i,e[0]);return i}function se(e,t){for(let n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function ce(e,t,n,r){if(!t.geometry)return;let i=t.geometry.coordinates;if(i&&i.length===0)return;let a=t.geometry.type,o=(n.tolerance/((1<<n.maxZoom)*n.extent))**2,s=[],c=t.id;if(n.promoteId?c=t.properties[n.promoteId]:n.generateId&&(c=r||0),a===`Point`)le(i,s);else if(a===`MultiPoint`)for(let e of i)le(e,s);else if(a===`LineString`)ue(i,s,o,!1);else if(a===`MultiLineString`){if(n.lineMetrics){for(let n of i)s=[],ue(n,s,o,!1),e.push(oe(c,`LineString`,s,t.properties));return}de(i,s,o,!1)}else if(a===`Polygon`)de(i,s,o,!0);else{if(a!==`MultiPolygon`){if(a===`GeometryCollection`){for(let i of t.geometry.geometries)ce(e,{id:c,geometry:i,properties:t.properties},n,r);return}throw Error(`Input data is not a valid GeoJSON object.`)}for(let e of i){let t=[];de(e,t,o,!0),s.push(t)}}e.push(oe(c,a,s,t.properties))}function le(e,t){t.push(fe(e[0]),N(e[1]),0)}function ue(e,t,n,r){let i,a,o=0;for(let n=0;n<e.length;n++){let s=fe(e[n][0]),c=N(e[n][1]);t.push(s,c,0),n>0&&(o+=r?(i*c-s*a)/2:Math.sqrt((s-i)**2+(c-a)**2)),i=s,a=c}let s=t.length-3;t[2]=1,ie(t,0,s,n),t[s+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function de(e,t,n,r){for(let i=0;i<e.length;i++){let a=[];ue(e[i],a,n,r),t.push(a)}}function fe(e){return e/360+.5}function N(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function pe(e,t,n,r,i,a,o,s){if(r/=t,a>=(n/=t)&&o<r)return e;if(o<n||a>=r)return null;let c=[];for(let t of e){let e=t.geometry,a=t.type,o=i===0?t.minX:t.minY,l=i===0?t.maxX:t.maxY;if(o>=n&&l<r){c.push(t);continue}if(l<n||o>=r)continue;let u=[];if(a===`Point`||a===`MultiPoint`)me(e,u,n,r,i);else if(a===`LineString`)P(e,u,n,r,i,!1,s.lineMetrics);else if(a===`MultiLineString`)ge(e,u,n,r,i,!1);else if(a===`Polygon`)ge(e,u,n,r,i,!0);else if(a===`MultiPolygon`)for(let t of e){let e=[];ge(t,e,n,r,i,!0),e.length&&u.push(e)}if(u.length){if(s.lineMetrics&&a===`LineString`){for(let e of u)c.push(oe(t.id,a,e,t.tags));continue}a!==`LineString`&&a!==`MultiLineString`||(u.length===1?(a=`LineString`,u=u[0]):a=`MultiLineString`),a!==`Point`&&a!==`MultiPoint`||(a=u.length===3?`Point`:`MultiPoint`),c.push(oe(t.id,a,u,t.tags))}}return c.length?c:null}function me(e,t,n,r,i){for(let a=0;a<e.length;a+=3){let o=e[a+i];o>=n&&o<=r&&_e(t,e[a],e[a+1],e[a+2])}}function P(e,t,n,r,i,a,o){let s=he(e),c=i===0?ve:ye,l,u,d=e.start;for(let f=0;f<e.length-3;f+=3){let p=e[f],m=e[f+1],h=e[f+2],g=e[f+3],_=e[f+4],v=i===0?p:m,y=i===0?g:_,b=!1;o&&(l=Math.sqrt((p-g)**2+(m-_)**2)),v<n?y>n&&(u=c(s,p,m,g,_,n),o&&(s.start=d+l*u)):v>r?y<r&&(u=c(s,p,m,g,_,r),o&&(s.start=d+l*u)):_e(s,p,m,h),y<n&&v>=n&&(u=c(s,p,m,g,_,n),b=!0),y>r&&v<=r&&(u=c(s,p,m,g,_,r),b=!0),!a&&b&&(o&&(s.end=d+l*u),t.push(s),s=he(e)),o&&(d+=l)}let f=e.length-3,p=e[f],m=e[f+1],h=i===0?p:m;h>=n&&h<=r&&_e(s,p,m,e[f+2]),f=s.length-3,a&&f>=3&&(s[f]!==s[0]||s[f+1]!==s[1])&&_e(s,s[0],s[1],s[2]),s.length&&t.push(s)}function he(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ge(e,t,n,r,i,a){for(let o of e)P(o,t,n,r,i,a,!1)}function _e(e,t,n,r){e.push(t,n,r)}function ve(e,t,n,r,i,a){let o=(a-t)/(r-t);return _e(e,a,n+(i-n)*o,1),o}function ye(e,t,n,r,i,a){let o=(a-n)/(i-n);return _e(e,t+(r-t)*o,a,1),o}function be(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=i.type,o;if(a===`Point`||a===`MultiPoint`||a===`LineString`)o=xe(i.geometry,t);else if(a===`MultiLineString`||a===`Polygon`){o=[];for(let e of i.geometry)o.push(xe(e,t))}else if(a===`MultiPolygon`){o=[];for(let e of i.geometry){let n=[];for(let r of e)n.push(xe(r,t));o.push(n)}}n.push(oe(i.id,a,o,i.tags))}return n}function xe(e,t){let n=[];n.size=e.size,e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}function Se(e,t){if(e.transformed)return e;let n=1<<e.z,r=e.x,i=e.y;for(let a of e.features){let e=a.geometry,o=a.type;if(a.geometry=[],o===1)for(let o=0;o<e.length;o+=2)a.geometry.push(F(e[o],e[o+1],t,n,r,i));else for(let o=0;o<e.length;o++){let s=[];for(let a=0;a<e[o].length;a+=2)s.push(F(e[o][a],e[o][a+1],t,n,r,i));a.geometry.push(s)}}return e.transformed=!0,e}function F(e,t,n,r,i,a){return[Math.round(n*(e*r-i)),Math.round(n*(t*r-a))]}function Ce(e,t,n,r,i){let a=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:n,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let t of e)we(o,t,a,i);return o}function we(e,t,n,r){let i=t.geometry,a=t.type,o=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),a===`Point`||a===`MultiPoint`)for(let t=0;t<i.length;t+=3)o.push(i[t],i[t+1]),e.numPoints++,e.numSimplified++;else if(a===`LineString`)Te(o,i,e,n,!1,!1);else if(a===`MultiLineString`||a===`Polygon`)for(let t=0;t<i.length;t++)Te(o,i[t],e,n,a===`Polygon`,t===0);else if(a===`MultiPolygon`)for(let t=0;t<i.length;t++){let r=i[t];for(let t=0;t<r.length;t++)Te(o,r[t],e,n,!0,t===0)}if(o.length){let n=t.tags||null;if(a===`LineString`&&r.lineMetrics){n={};for(let e in t.tags)n[e]=t.tags[e];n.mapbox_clip_start=i.start/i.size,n.mapbox_clip_end=i.end/i.size}let s={geometry:o,type:a===`Polygon`||a===`MultiPolygon`?3:a===`LineString`||a===`MultiLineString`?2:1,tags:n};t.id!==null&&(s.id=t.id),e.features.push(s)}}function Te(e,t,n,r,i,a){let o=r*r;if(r>0&&t.size<(i?o:r))return void(n.numPoints+=t.length/3);let s=[];for(let e=0;e<t.length;e+=3)(r===0||t[e+2]>o)&&(n.numSimplified++,s.push(t[e],t[e+1])),n.numPoints++;i&&function(e,t){let n=0;for(let t=0,r=e.length,i=r-2;t<r;i=t,t+=2)n+=(e[t]-e[i])*(e[t+1]+e[i+1]);if(n>0===t)for(let t=0,n=e.length;t<n/2;t+=2){let r=e[t],i=e[t+1];e[t]=e[n-2-t],e[t+1]=e[n-1-t],e[n-2-t]=r,e[n-1-t]=i}}(s,a),e.push(s)}let Ee={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class I{constructor(e,t){let n=(t=this.options=function(e,t){for(let n in t)e[n]=t[n];return e}(Object.create(Ee),t)).debug;if(n&&console.time(`preprocess data`),t.maxZoom<0||t.maxZoom>24)throw Error(`maxZoom should be in the 0-24 range`);if(t.promoteId&&t.generateId)throw Error(`promoteId and generateId cannot be used together.`);let r=function(e,t){let n=[];if(e.type===`FeatureCollection`)for(let r=0;r<e.features.length;r++)ce(n,e.features[r],t,r);else ce(n,e.type===`Feature`?e:{geometry:e},t);return n}(e,t);this.tiles={},this.tileCoords=[],n&&(console.timeEnd(`preprocess data`),console.log(`index: maxZoom: %d, maxPoints: %d`,t.indexMaxZoom,t.indexMaxPoints),console.time(`generate tiles`),this.stats={},this.total=0),r=function(e,t){let n=t.buffer/t.extent,r=e,i=pe(e,1,-1-n,n,0,-1,2,t),a=pe(e,1,1-n,2+n,0,-1,2,t);return(i||a)&&(r=pe(e,1,-n,1+n,0,-1,2,t)||[],i&&(r=be(i,1).concat(r)),a&&(r=r.concat(be(a,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),n&&(r.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)))}splitTile(e,t,n,r,i,a,o){let s=[e,t,n,r],c=this.options,l=c.debug;for(;s.length;){r=s.pop(),n=s.pop(),t=s.pop(),e=s.pop();let u=1<<t,d=L(t,n,r),f=this.tiles[d];if(!f&&(l>1&&console.time(`creation`),f=this.tiles[d]=Ce(e,t,n,r,c),this.tileCoords.push({z:t,x:n,y:r}),l)){l>1&&(console.log(`tile z%d-%d-%d (features: %d, points: %d, simplified: %d)`,t,n,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd(`creation`));let e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(f.source=e,i==null){if(t===c.indexMaxZoom||f.numPoints<=c.indexMaxPoints)continue}else{if(t===c.maxZoom||t===i)continue;if(i!=null){let e=i-t;if(n!==a>>e||r!==o>>e)continue}}if(f.source=null,e.length===0)continue;l>1&&console.time(`clipping`);let p=.5*c.buffer/c.extent,m=.5-p,h=.5+p,g=1+p,_=null,v=null,y=null,b=null,x=pe(e,u,n-p,n+h,0,f.minX,f.maxX,c),S=pe(e,u,n+m,n+g,0,f.minX,f.maxX,c);e=null,x&&=(_=pe(x,u,r-p,r+h,1,f.minY,f.maxY,c),v=pe(x,u,r+m,r+g,1,f.minY,f.maxY,c),null),S&&=(y=pe(S,u,r-p,r+h,1,f.minY,f.maxY,c),b=pe(S,u,r+m,r+g,1,f.minY,f.maxY,c),null),l>1&&console.timeEnd(`clipping`),s.push(_||[],t+1,2*n,2*r),s.push(v||[],t+1,2*n,2*r+1),s.push(y||[],t+1,2*n+1,2*r),s.push(b||[],t+1,2*n+1,2*r+1)}}getTile(e,t,n){e=+e,t=+t,n=+n;let{extent:r,debug:i}=this.options;if(e<0||e>24)return null;let a=1<<e,o=L(e,t=t+a&a-1,n);if(this.tiles[o])return Se(this.tiles[o],r);i>1&&console.log(`drilling down to z%d-%d-%d`,e,t,n);let s,c=e,l=t,u=n;for(;!s&&c>0;)c--,l>>=1,u>>=1,s=this.tiles[L(c,l,u)];return s&&s.source?(i>1&&(console.log(`found parent tile z%d-%d-%d`,c,l,u),console.time(`drilling down`)),this.splitTile(s.source,c,l,u,e,t,n),i>1&&console.timeEnd(`drilling down`),this.tiles[o]?Se(this.tiles[o],r):null):null}}function L(e,t,n){return 32*((1<<e)*n+t)+e}function R(e,t){return t?e.properties[t]:e.id}function De(e,t){if(e==null)return!0;if(e.type===`Feature`)return R(e,t)!=null;if(e.type===`FeatureCollection`){let n=new Set;for(let r of e.features){let e=R(r,t);if(e==null||n.has(e))return!1;n.add(e)}return!0}return!1}function Oe(e,t){let n=new Map;if(e!=null)if(e.type===`Feature`)n.set(R(e,t),e);else for(let r of e.features)n.set(R(r,t),r);return n}class z extends a{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(t,n){return e._(this,void 0,void 0,(function*(){let n=t.tileID.canonical;if(!this._geoJSONIndex)throw Error(`Unable to parse the data into a cluster or geojson`);let r=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!r)return null;let i=new class{constructor(t){this.layers={_geojsonTileLayer:this},this.name=`_geojsonTileLayer`,this.extent=e.X,this.length=t.length,this._features=t}feature(t){return new class{constructor(t){this._feature=t,this.extent=e.X,this.type=t.type,this.properties=t.tags,`id`in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(this._feature.type===1){let t=[];for(let n of this._feature.geometry)t.push([new e.P(n[0],n[1])]);return t}{let t=[];for(let n of this._feature.geometry){let r=[];for(let t of n)r.push(new e.P(t[0],t[1]));t.push(r)}return t}}toGeoJSON(e,t,n){return u.call(this,e,t,n)}}(this._features[t])}}(r.features),a=D(i);return a.byteOffset===0&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),{vectorTile:i,rawData:a.buffer}}))}loadData(t){return e._(this,void 0,void 0,(function*(){var n;(n=this._pendingRequest)==null||n.abort();let r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.bv(t.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(t,this._pendingRequest),this._geoJSONIndex=t.cluster?new j(function({superclusterOptions:t,clusterProperties:n}){if(!n||!t)return t;let r={},i={},a={accumulated:null,zoom:0},o={properties:null},s=Object.keys(n);for(let t of s){let[a,o]=n[t],s=e.bC(o),c=e.bC(typeof a==`string`?[a,[`accumulated`],[`get`,t]]:a);r[t]=s.value,i[t]=c.value}return t.map=e=>{o.properties=e;let t={};for(let e of s)t[e]=r[e].evaluate(a,o);return t},t.reduce=(e,t)=>{o.properties=t;for(let t of s)a.accumulated=e[t],e[t]=i[t].evaluate(a,o)},t}(t)).load((yield this._pendingData).features):(i=yield this._pendingData,new I(i,t.geojsonVtOptions)),this.loaded={};let n={};if(r){let e=r.finish();e&&(n.resourceTiming={},n.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}return n}catch(t){if(delete this._pendingRequest,e.bB(t))return{abandoned:!0};throw t}var i}))}getData(){return e._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(e){let t=this.loaded;return t&&t[e.uid]?super.reloadTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,n){return e._(this,void 0,void 0,(function*(){let r=yield this.loadGeoJSON(t,n);if(delete this._pendingRequest,typeof r!=`object`)throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(l(r,!0),t.filter){let n=e.bC(t.filter,{type:`boolean`,"property-type":`data-driven`,overridable:!1,transition:!1});if(n.result===`error`)throw Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));r={type:`FeatureCollection`,features:r.features.filter((e=>n.value.evaluate({zoom:0},e)))}}return r}))}loadGeoJSON(t,n){return e._(this,void 0,void 0,(function*(){let{promoteId:r}=t;if(t.request){let i=yield e.h(t.request,n);return this._dataUpdateable=De(i.data,r)?Oe(i.data,r):void 0,i.data}if(typeof t.data==`string`)try{let e=JSON.parse(t.data);return this._dataUpdateable=De(e,r)?Oe(e,r):void 0,e}catch{throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}if(!t.dataDiff)throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw Error(`Cannot update existing geojson data in ${t.source}`);return function(e,t,n){if(t.removeAll&&e.clear(),t.remove)for(let n of t.remove)e.delete(n);if(t.add)for(let r of t.add){let t=R(r,n);t!=null&&e.set(t,r)}if(t.update)for(let n of t.update){let t=e.get(n.id);if(t==null)continue;let r=!n.removeAllProperties&&(n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0);if((n.newGeometry||n.removeAllProperties||r)&&(t=Object.assign({},t),e.set(n.id,t),r&&(t.properties=Object.assign({},t.properties))),n.newGeometry&&(t.geometry=n.newGeometry),n.removeAllProperties)t.properties={};else if(n.removeProperties?.length>0)for(let e of n.removeProperties)Object.prototype.hasOwnProperty.call(t.properties,e)&&delete t.properties[e];if(n.addOrUpdateProperties?.length>0)for(let{key:e,value:r}of n.addOrUpdateProperties)t.properties[e]=r}}(this._dataUpdateable,t.dataDiff,r),{type:`FeatureCollection`,features:Array.from(this._dataUpdateable.values())}}))}removeSource(t){return e._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset)}}class ke{constructor(t){this.self=t,this.actor=new e.F(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.bi,this.self.removeProtocol=e.bj,this.self.registerRTLTextPlugin=t=>{if(e.bD.isParsed())throw Error(`RTL text plugin already registered.`);e.bD.setMethods(t)},this.actor.registerMessageHandler(`LDT`,((e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t))),this.actor.registerMessageHandler(`RDT`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(t,n.source).removeTile(n)})))),this.actor.registerMessageHandler(`GCEZ`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterExpansionZoom(n)})))),this.actor.registerMessageHandler(`GCC`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterChildren(n)})))),this.actor.registerMessageHandler(`GCL`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterLeaves(n)})))),this.actor.registerMessageHandler(`LD`,((e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t))),this.actor.registerMessageHandler(`GD`,((e,t)=>this._getWorkerSource(e,t.type,t.source).getData())),this.actor.registerMessageHandler(`LT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t))),this.actor.registerMessageHandler(`RT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t))),this.actor.registerMessageHandler(`AT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t))),this.actor.registerMessageHandler(`RMT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t))),this.actor.registerMessageHandler(`RS`,((t,n)=>e._(this,void 0,void 0,(function*(){if(!this.workerSources[t]||!this.workerSources[t][n.type]||!this.workerSources[t][n.type][n.source])return;let e=this.workerSources[t][n.type][n.source];delete this.workerSources[t][n.type][n.source],e.removeSource!==void 0&&e.removeSource(n)})))),this.actor.registerMessageHandler(`RM`,(t=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t]})))),this.actor.registerMessageHandler(`SR`,((t,n)=>e._(this,void 0,void 0,(function*(){this.referrer=n})))),this.actor.registerMessageHandler(`SRPS`,((e,t)=>this._syncRTLPluginState(e,t))),this.actor.registerMessageHandler(`IS`,((t,n)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(n)})))),this.actor.registerMessageHandler(`SI`,((e,t)=>this._setImages(e,t))),this.actor.registerMessageHandler(`UL`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).update(n.layers,n.removedIds)})))),this.actor.registerMessageHandler(`SL`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).replace(n)}))))}_setImages(t,n){return e._(this,void 0,void 0,(function*(){this.availableImages[t]=n;for(let e in this.workerSources[t]){let r=this.workerSources[t][e];for(let e in r)r[e].availableImages=n}}))}_syncRTLPluginState(t,n){return e._(this,void 0,void 0,(function*(){if(e.bD.isParsed())return e.bD.getState();if(n.pluginStatus!==`loading`)return e.bD.setState(n),n;let t=n.pluginURL;if(this.self.importScripts(t),e.bD.isParsed()){let n={pluginStatus:`loaded`,pluginURL:t};return e.bD.setState(n),n}throw e.bD.setState({pluginStatus:`error`,pluginURL:``}),Error(`RTL Text Plugin failed to import scripts from ${t}`)}))}_getAvailableImages(e){let t=this.availableImages[e];return t||=[],t}_getLayerIndex(e){let n=this.layerIndexes[e];return n||=this.layerIndexes[e]=new t,n}_getWorkerSource(e,t,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][n]){let r={sendAsync:(t,n)=>(t.targetMapId=e,this.actor.sendAsync(t,n))};switch(t){case`vector`:this.workerSources[e][t][n]=new a(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case`geojson`:this.workerSources[e][t][n]=new z(r,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][n]=new this.externalWorkerSourceTypes[t](r,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][n]}_getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new o),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new ke(self)),ke})),n(`index`,[`exports`,`./shared`],(function(e,t){var n=`4.7.1`;let r,i,a={now:typeof performance<`u`&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:e=>new Promise(((n,r)=>{let i=requestAnimationFrame(n);e.signal.addEventListener(`abort`,(()=>{cancelAnimationFrame(i),r(t.c())}))})),getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement(`canvas`),n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)throw Error(`failed to create canvas 2d context`);return t.width=e.width,t.height=e.height,n.drawImage(e,0,0,e.width,e.height),n},resolveURL:e=>(r||=document.createElement(`a`),r.href=e,r.href),hardwareConcurrency:typeof navigator<`u`&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(i??=matchMedia(`(prefers-reduced-motion: reduce)`),i.matches)}};class o{static testProp(e){if(!o.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in o.docStyle)return e[t];return e[0]}static create(e,t,n){let r=window.document.createElement(e);return t!==void 0&&(r.className=t),n&&n.appendChild(r),r}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){o.docStyle&&o.selectProp&&(o.userSelect=o.docStyle[o.selectProp],o.docStyle[o.selectProp]=`none`)}static enableDrag(){o.docStyle&&o.selectProp&&(o.docStyle[o.selectProp]=o.userSelect)}static setTransform(e,t){e.style[o.transformProp]=t}static addEventListener(e,t,n,r={}){e.addEventListener(t,n,`passive`in r?r:r.capture)}static removeEventListener(e,t,n,r={}){e.removeEventListener(t,n,`passive`in r?r:r.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener(`click`,o.suppressClickInternal,!0)}static suppressClick(){window.addEventListener(`click`,o.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener(`click`,o.suppressClickInternal,!0)}),0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,n,r){let i=n.boundingClientRect;return new t.P((r.clientX-i.left)/n.x-e.clientLeft,(r.clientY-i.top)/n.y-e.clientTop)}static mousePos(e,t){let n=o.getScale(e);return o.getPoint(e,n,t)}static touchPos(e,t){let n=[],r=o.getScale(e);for(let i=0;i<t.length;i++)n.push(o.getPoint(e,r,t[i]));return n}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}o.docStyle=typeof window<`u`&&window.document&&window.document.documentElement.style,o.selectProp=o.testProp([`userSelect`,`MozUserSelect`,`WebkitUserSelect`,`msUserSelect`]),o.transformProp=o.testProp([`transform`,`WebkitTransform`]);let s={supported:!1,testSupport:function(e){!u&&l&&(d?f(e):c=e)}},c,l,u=!1,d=!1;function f(e){let t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,l),e.isContextLost())return;s.supported=!0}catch{}e.deleteTexture(t),u=!0}var p;typeof document<`u`&&(l=document.createElement(`img`),l.onload=()=>{c&&f(c),c=null,d=!0},l.onerror=()=>{u=!0,c=null},l.src=`data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=`),function(e){let n,r,i,a;e.resetRequestQueue=()=>{n=[],r=0,i=0,a={}},e.addThrottleControl=e=>{let t=i++;return a[t]=e,t},e.removeThrottleControl=e=>{delete a[e],c()},e.getImage=(e,r,i=!0)=>new Promise(((a,o)=>{s.supported&&(e.headers||={},e.headers.accept=`image/webp,*/*`),t.e(e,{type:`image`}),n.push({abortController:r,requestParameters:e,supportImageRefresh:i,state:`queued`,onError:e=>{o(e)},onSuccess:e=>{a(e)}}),c()}));let o=e=>t._(this,void 0,void 0,(function*(){e.state=`running`;let{requestParameters:n,supportImageRefresh:i,onError:a,onSuccess:o,abortController:s}=e,u=!1===i&&!t.i(self)&&!t.g(n.url)&&(!n.headers||Object.keys(n.headers).reduce(((e,t)=>e&&t===`accept`),!0));r++;let d=u?l(n,s):t.m(n,s);try{let n=yield d;delete e.abortController,e.state=`completed`,n.data instanceof HTMLImageElement||t.b(n.data)?o(n):n.data&&o({data:yield(f=n.data,typeof createImageBitmap==`function`?t.d(f):t.f(f)),cacheControl:n.cacheControl,expires:n.expires})}catch(t){delete e.abortController,a(t)}finally{r--,c()}var f})),c=()=>{let e=(()=>{for(let e of Object.keys(a))if(a[e]())return!0;return!1})()?t.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&n.length>0;t++){let e=n.shift();e.abortController.signal.aborted?t--:o(e)}},l=(e,n)=>new Promise(((r,i)=>{let a=new Image,o=e.url,s=e.credentials;s&&s===`include`?a.crossOrigin=`use-credentials`:(s&&s===`same-origin`||!t.s(o))&&(a.crossOrigin=`anonymous`),n.signal.addEventListener(`abort`,(()=>{a.src=``,i(t.c())})),a.fetchPriority=`high`,a.onload=()=>{a.onerror=a.onload=null,r({data:a})},a.onerror=()=>{a.onerror=a.onload=null,n.signal.aborted||i(Error(`Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))},a.src=o}))}(p||={}),p.resetRequestQueue();class m{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function h(e){var n=new t.A(3);return n[0]=e[0],n[1]=e[1],n[2]=e[2],n}var g,_=function(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e};g=new t.A(3),t.A!=Float32Array&&(g[0]=0,g[1]=0,g[2]=0);var v=function(e){var t=e[0],n=e[1];return t*t+n*n};function y(e){let t=[];if(typeof e==`string`)t.push({id:`default`,url:e});else if(e&&e.length>0){let n=[];for(let{id:r,url:i}of e){let e=`${r}${i}`;n.indexOf(e)===-1&&(n.push(e),t.push({id:r,url:i}))}}return t}function b(e,t,n){let r=e.split(`?`);return r[0]+=`${t}${n}`,r.join(`?`)}(function(){var e=new t.A(2);t.A!=Float32Array&&(e[0]=0,e[1]=0)})();class x{constructor(e,t,n,r){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(t,r)}update(e,n,r){let{width:i,height:a}=e,o=!(this.size&&this.size[0]===i&&this.size[1]===a||r),{context:s}=this,{gl:c}=s;if(this.useMipmap=!!(n&&n.useMipmap),c.bindTexture(c.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===c.RGBA&&(!n||!1!==n.premultiply)),o)this.size=[i,a],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.b(e)?c.texImage2D(c.TEXTURE_2D,0,this.format,this.format,c.UNSIGNED_BYTE,e):c.texImage2D(c.TEXTURE_2D,0,this.format,i,a,0,this.format,c.UNSIGNED_BYTE,e.data);else{let{x:n,y:o}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.b(e)?c.texSubImage2D(c.TEXTURE_2D,0,n,o,c.RGBA,c.UNSIGNED_BYTE,e):c.texSubImage2D(c.TEXTURE_2D,0,n,o,i,a,c.RGBA,c.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&c.generateMipmap(c.TEXTURE_2D)}bind(e,t,n){let{context:r}=this,{gl:i}=r;i.bindTexture(i.TEXTURE_2D,this.texture),n!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=i.LINEAR),e!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function S(e){let{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class C extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let n=this.images[e];if(n&&!n.data&&n.spriteData){let e=n.spriteData;n.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),n.spriteData=null}return n}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,n){let r=!0,i=n.data||n.spriteData;return this._validateStretch(n.stretchX,i&&i.width)||(this.fire(new t.j(Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(n.stretchY,i&&i.height)||(this.fire(new t.j(Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(n.content,n)||(this.fire(new t.j(Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let n=0;for(let r of e){if(r[0]<n||r[1]<r[0]||t<r[1])return!1;n=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let n=t.spriteData,r=n&&n.width||t.data.width,i=n&&n.height||t.data.height;return!(e[0]<0||r<e[0]||e[1]<0||i<e[1]||e[2]<0||r<e[2]||e[3]<0||i<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,n=!0){let r=this.getImage(e);if(n&&(r.data.width!==t.data.width||r.data.height!==t.data.height))throw Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=r.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){let t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((t,n)=>{let r=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})}))}_getImagesForIds(e){let n={};for(let r of e){let e=this.getImage(r);e||=(this.fire(new t.k(`styleimagemissing`,{id:r})),this.getImage(r)),e?n[r]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!!(e.userImage&&e.userImage.render)}:t.w(`Image "${r}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let n=this.patterns[e],r=this.getImage(e);if(!r)return null;if(n&&n.position.version===r.version)return n.position;if(n)n.position.version=r.version;else{let n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},i=new t.I(n,r);this.patterns[e]={bin:n,position:i}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let t=e.gl;this.atlasTexture?this.dirty&&=(this.atlasTexture.update(this.atlasImage),!1):this.atlasTexture=new x(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let t in this.patterns)e.push(this.patterns[t].bin);let{w:n,h:r}=t.p(e),i=this.atlasImage;i.resize({width:n||1,height:r||1});for(let e in this.patterns){let{bin:n}=this.patterns[e],r=n.x+1,a=n.y+1,o=this.getImage(e).data,s=o.width,c=o.height;t.R.copy(o,i,{x:0,y:0},{x:r,y:a},{width:s,height:c}),t.R.copy(o,i,{x:0,y:c-1},{x:r,y:a-1},{width:s,height:1}),t.R.copy(o,i,{x:0,y:0},{x:r,y:a+c},{width:s,height:1}),t.R.copy(o,i,{x:s-1,y:0},{x:r-1,y:a},{width:1,height:c}),t.R.copy(o,i,{x:0,y:0},{x:r+s,y:a},{width:1,height:c})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let e=this.getImage(n);e||t.w(`Image with ID: "${n}" was not found`),S(e)&&this.updateImage(n,e)}}}let w=0x56bc75e2d63100000;function T(e,t,n,r,i,a,o,s,c){for(let l=t;l<t+r;l++)E(e,n*a+l,a,i,o,s,c);for(let l=n;l<n+i;l++)E(e,l*a+t,1,r,o,s,c)}function E(e,t,n,r,i,a,o){a[0]=0,o[0]=-0x56bc75e2d63100000,o[1]=w,i[0]=e[t];for(let s=1,c=0,l=0;s<r;s++){i[s]=e[t+s*n];let r=s*s;do{let e=a[c];l=(i[s]-i[e]+r-e*e)/(s-e)/2}while(l<=o[c]&&--c>-1);c++,a[c]=s,o[c]=l,o[c+1]=w}for(let s=0,c=0;s<r;s++){for(;o[c+1]<s;)c++;let r=a[c],l=s-r;e[t+s*n]=i[r]+l*l}}class D{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,(function*(){let t=[];for(let n in e)for(let r of e[n])t.push(this._getAndCacheGlyphsPromise(n,r));let n=yield Promise.all(t),r={};for(let{stack:e,id:t,glyph:i}of n)r[e]||(r[e]={}),r[e][t]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics};return r}))}_getAndCacheGlyphsPromise(e,n){return t._(this,void 0,void 0,(function*(){let t=this.entries[e];t||=this.entries[e]={glyphs:{},requests:{},ranges:{}};let r=t.glyphs[n];if(r!==void 0)return{stack:e,id:n,glyph:r};if(r=this._tinySDF(t,e,n),r)return t.glyphs[n]=r,{stack:e,id:n,glyph:r};let i=Math.floor(n/256);if(256*i>65535)throw Error(`glyphs > 65535 not supported`);if(t.ranges[i])return{stack:e,id:n,glyph:r};if(!this.url)throw Error(`glyphsUrl is not set`);if(!t.requests[i]){let n=D.loadGlyphRange(e,i,this.url,this.requestManager);t.requests[i]=n}let a=yield t.requests[i];for(let e in a)this._doesCharSupportLocalGlyph(+e)||(t.glyphs[+e]=a[+e]);return t.ranges[i]=!0,{stack:e,id:n,glyph:a[n]||null}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))}_tinySDF(e,n,r){let i=this.localIdeographFontFamily;if(!i||!this._doesCharSupportLocalGlyph(r))return;let a=e.tinySDF;if(!a){let t=`400`;/bold/i.test(n)?t=`900`:/medium/i.test(n)?t=`500`:/light/i.test(n)&&(t=`200`),a=e.tinySDF=new D.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:i,fontWeight:t})}let o=a.draw(String.fromCharCode(r));return{id:r,bitmap:new t.o({width:o.width||60,height:o.height||60},o.data),metrics:{width:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+.5||0,top:o.glyphTop/2-27.5||-8,advance:o.glyphAdvance/2||24,isDoubleResolution:!0}}}}D.loadGlyphRange=function(e,n,r,i){return t._(this,void 0,void 0,(function*(){let a=256*n,o=a+255,s=i.transformRequest(r.replace(`{fontstack}`,e).replace(`{range}`,`${a}-${o}`),`Glyphs`),c=yield t.l(s,new AbortController);if(!c||!c.data)throw Error(`Could not load glyph range. range: ${n}, ${a}-${o}`);let l={};for(let e of t.n(c.data))l[e.id]=e;return l}))},D.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:r=.25,fontFamily:i=`sans-serif`,fontWeight:a=`normal`,fontStyle:o=`normal`}={}){this.buffer=t,this.cutoff=r,this.radius=n;let s=this.size=e+4*t,c=this._createCanvas(s),l=this.ctx=c.getContext(`2d`,{willReadFrequently:!0});l.font=`${o} ${a} ${e}px ${i}`,l.textBaseline=`alphabetic`,l.textAlign=`left`,l.fillStyle=`black`,this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(e){let t=document.createElement(`canvas`);return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-i))),c=Math.min(this.size-this.buffer,o+Math.ceil(r)),l=s+2*this.buffer,u=c+2*this.buffer,d=Math.max(l*u,0),f=new Uint8ClampedArray(d),p={data:f,width:l,height:u,glyphWidth:s,glyphHeight:c,glyphTop:o,glyphLeft:0,glyphAdvance:t};if(s===0||c===0)return p;let{ctx:m,buffer:h,gridInner:g,gridOuter:_}=this;m.clearRect(h,h,s,c),m.fillText(e,h,h+o);let v=m.getImageData(h,h,s,c);_.fill(w,0,d),g.fill(0,0,d);for(let e=0;e<c;e++)for(let t=0;t<s;t++){let n=v.data[4*(e*s+t)+3]/255;if(n===0)continue;let r=(e+h)*l+t+h;if(n===1)_[r]=0,g[r]=w;else{let e=.5-n;_[r]=e>0?e*e:0,g[r]=e<0?e*e:0}}T(_,0,0,l,u,l,this.f,this.v,this.z),T(g,h,h,s,c,l,this.f,this.v,this.z);for(let e=0;e<d;e++){let t=Math.sqrt(_[e])-Math.sqrt(g[e]);f[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return p}};class O{constructor(){this.specification=t.v.light.position}possiblyEvaluate(e,n){return t.x(e.expression.evaluate(n))}interpolate(e,n,r){return{x:t.y.number(e.x,n.x,r),y:t.y.number(e.y,n.y,r),z:t.y.number(e.z,n.z,r)}}}let k;class A extends t.E{constructor(e){super(),k||=new t.q({anchor:new t.D(t.v.light.anchor),position:new O,color:new t.D(t.v.light.color),intensity:new t.D(t.v.light.intensity)}),this._transitionable=new t.T(k),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(t.r,e,n))for(let t in e){let n=e[t];t.endsWith(`-transition`)?this._transitionable.setTransition(t.slice(0,-11),n):this._transitionable.setValue(t,n)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,r){return(!r||!1!==r.validate)&&t.t(this,e.call(t.u,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.v}))}}let j=new t.q({"sky-color":new t.D(t.v.sky[`sky-color`]),"horizon-color":new t.D(t.v.sky[`horizon-color`]),"fog-color":new t.D(t.v.sky[`fog-color`]),"fog-ground-blend":new t.D(t.v.sky[`fog-ground-blend`]),"horizon-fog-blend":new t.D(t.v.sky[`horizon-fog-blend`]),"sky-horizon-blend":new t.D(t.v.sky[`sky-horizon-blend`]),"atmosphere-blend":new t.D(t.v.sky[`atmosphere-blend`])});class ee extends t.E{constructor(e){super(),this._transitionable=new t.T(j),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.z(0))}setSky(e,n={}){if(!this._validate(t.B,e,n)){e||={"sky-color":`transparent`,"horizon-color":`transparent`,"fog-color":`transparent`,"fog-ground-blend":1,"atmosphere-blend":0};for(let t in e){let n=e[t];t.endsWith(`-transition`)?this._transitionable.setTransition(t.slice(0,-11),n):this._transitionable.setValue(t,n)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,r={}){return!1!==r?.validate&&t.t(this,e.call(t.u,t.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class M{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let n=e.join(`,`)+String(t);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(e,t)),this.dashEntry[n]}getDashRanges(e,t,n){let r=[],i=e.length%2==1?-e[e.length-1]*n:0,a=e[0]*n,o=!0;r.push({left:i,right:a,isDash:o,zeroLength:e[0]===0});let s=e[0];for(let t=1;t<e.length;t++){o=!o;let c=e[t];i=s*n,s+=c,a=s*n,r.push({left:i,right:a,isDash:o,zeroLength:c===0})}return r}addRoundDash(e,t,n){let r=t/2;for(let t=-n;t<=n;t++){let i=this.width*(this.nextRow+n+t),a=0,o=e[a];for(let s=0;s<this.width;s++){s/o.right>1&&(o=e[++a]);let c=Math.abs(s-o.left),l=Math.abs(s-o.right),u=Math.min(c,l),d,f=t/n*(r+1);if(o.isDash){let e=r-Math.abs(f);d=Math.sqrt(u*u+e*e)}else d=r-Math.sqrt(u*u+f*f);this.data[i+s]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=e[t+1];n.zeroLength?e.splice(t,1):r&&r.isDash===n.isDash&&(r.left=n.left,e.splice(t,1))}let t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);let r=this.width*this.nextRow,i=0,a=e[i];for(let t=0;t<this.width;t++){t/a.right>1&&(a=e[++i]);let n=Math.abs(t-a.left),o=Math.abs(t-a.right),s=Math.min(n,o);this.data[r+t]=Math.max(0,Math.min(255,(a.isDash?s:-s)+128))}}addDash(e,n){let r=n?7:0,i=2*r+1;if(this.nextRow+i>this.height)return t.w(`LineAtlas out of space`),null;let a=0;for(let t=0;t<e.length;t++)a+=e[t];if(a!==0){let t=this.width/a,i=this.getDashRanges(e,this.width,t);n?this.addRoundDash(i,t,r):this.addRegularDash(i)}let o={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:a};return this.nextRow+=i,this.dirty=!0,o}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}}let te=`maplibre_preloaded_worker_pool`;class ne{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<ne.workerCount;)this.workers.push(new Worker(t.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach((e=>{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[te]}numActive(){return Object.keys(this.active).length}}let re=Math.floor(a.hardwareConcurrency/2),ie,ae;function oe(){return ie||=new ne,ie}ne.workerCount=t.C(globalThis)?Math.max(Math.min(re,3),1):1;class se{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;let r=this.workerPool.acquire(n);for(let e=0;e<r.length;e++){let i=new t.F(r[e],n);i.name=`Worker ${e}`,this.actors.push(i)}if(!this.actors.length)throw Error(`No actors found`)}broadcast(e,t){let n=[];for(let r of this.actors)n.push(r.sendAsync({type:e,data:t}));return Promise.all(n)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach((e=>{e.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let n of this.actors)n.registerMessageHandler(e,t)}}function ce(){return ae||(ae=new se(oe(),t.G),ae.registerMessageHandler(`GR`,((e,n,r)=>t.m(n,r)))),ae}function le(e,n){let r=t.H();return t.J(r,r,[1,1,0]),t.K(r,r,[.5*e.width,.5*e.height,1]),t.L(r,r,e.calculatePosMatrix(n.toUnwrapped()))}function ue(e,t,n,r,i,a){let o=function(e,t,n){if(e)for(let r of e){let e=t[r];if(e&&e.source===n&&e.type===`fill-extrusion`)return!0}else for(let e in t){let r=t[e];if(r.source===n&&r.type===`fill-extrusion`)return!0}return!1}(i&&i.layers,t,e.id),s=a.maxPitchScaleFactor(),c=e.tilesIn(r,s,o);c.sort(de);let l=[];for(let r of c)l.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,n,e._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,i,a,s,le(e.transform,r.tileID))});let u=function(e){let t={},n={};for(let r of e){let e=r.queryResults,i=r.wrappedTileID,a=n[i]=n[i]||{};for(let n in e){let r=e[n],i=a[n]=a[n]||{},o=t[n]=t[n]||[];for(let e of r)i[e.featureIndex]||(i[e.featureIndex]=!0,o.push(e))}}return t}(l);for(let t in u)u[t].forEach((t=>{let n=t.feature,r=e.getFeatureState(n.layer[`source-layer`],n.id);n.source=n.layer.source,n.layer[`source-layer`]&&(n.sourceLayer=n.layer[`source-layer`]),n.state=r}));return u}function de(e,t){let n=e.tileID,r=t.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.canonical.x}function fe(e,n,r){return t._(this,void 0,void 0,(function*(){let i=e;if(e.url?i=(yield t.h(n.transformRequest(e.url,`Source`),r)).data:yield a.frameAsync(r),!i)return null;let o=t.M(t.e(i,e),[`tiles`,`minzoom`,`maxzoom`,`attribution`,`bounds`,`scheme`,`tileSize`,`encoding`]);return`vector_layers`in i&&i.vector_layers&&(o.vectorLayerIds=i.vector_layers.map((e=>e.id))),o}))}class N{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.N?new t.N(e.lng,e.lat):t.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.N?new t.N(e.lng,e.lat):t.N.convert(e),this}extend(e){let n=this._sw,r=this._ne,i,a;if(e instanceof t.N)i=e,a=e;else{if(!(e instanceof N))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(N.convert(e)):this.extend(t.N.convert(e)):e&&(`lng`in e||`lon`in e)&&`lat`in e?this.extend(t.N.convert(e)):this;if(i=e._sw,a=e._ne,!i||!a)return this}return n||r?(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)):(this._sw=new t.N(i.lng,i.lat),this._ne=new t.N(a.lng,a.lat)),this}getCenter(){return new t.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new t.N(this.getWest(),this.getNorth())}getSouthEast(){return new t.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:n,lat:r}=t.N.convert(e),i=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&i}static convert(e){return e instanceof N?e:e&&new N(e)}static fromLngLat(e,n=0){let r=360*n/40075017,i=r/Math.cos(Math.PI/180*e.lat);return new N(new t.N(e.lng-i,e.lat-r),new t.N(e.lng+i,e.lat+r))}adjustAntiMeridian(){let e=new t.N(this._sw.lng,this._sw.lat),n=new t.N(this._ne.lng,this._ne.lat);return new N(e,e.lng>n.lng?new t.N(n.lng+360,n.lat):n)}}class pe{constructor(e,t,n){this.bounds=N.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=n||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=2**e.z,r=Math.floor(t.O(this.bounds.getWest())*n),i=Math.floor(t.Q(this.bounds.getNorth())*n),a=Math.ceil(t.O(this.bounds.getEast())*n),o=Math.ceil(t.Q(this.bounds.getSouth())*n);return e.x>=r&&e.x<a&&e.y>=i&&e.y<o}}class me extends t.E{constructor(e,n,r,i){if(super(),this.id=e,this.dispatcher=r,this.type=`vector`,this.minzoom=0,this.maxzoom=22,this.scheme=`xyz`,this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.M(n,[`url`,`scheme`,`tileSize`,`promoteId`])),this._options=t.e({type:`vector`},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw Error(`vector tile sources must have a tileSize of 512`);this.setEventedParent(i)}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.k(`dataloading`,{dataType:`source`})),this._tileJSONRequest=new AbortController;try{let e=yield fe(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(t.e(this,e),e.bounds&&(this.tileBounds=new pe(e.bounds,this.minzoom,this.maxzoom)),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`content`})))}catch(e){this._tileJSONRequest=null,this.fire(new t.j(e))}}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:this.map._requestManager.transformRequest(t,`Tile`),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};n.request.collectResourceTiming=this._collectResourceTiming;let r=`RT`;if(e.actor&&e.state!==`expired`){if(e.state===`loading`)return new Promise(((t,n)=>{e.reloadPromise={resolve:t,reject:n}}))}else e.actor=this.dispatcher.getActor(),r=`LT`;e.abortController=new AbortController;try{let t=yield e.actor.sendAsync({type:r,data:n},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t)}catch(t){if(delete e.abortController,e.aborted)return;if(t&&t.status!==404)throw t;this._afterTileLoadWorkerResponse(e,null)}}))}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:`AT`,data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:`RMT`,data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class P extends t.E{constructor(e,n,r,i){super(),this.id=e,this.dispatcher=r,this.setEventedParent(i),this.type=`raster`,this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=`xyz`,this.tileSize=512,this._loaded=!1,this._options=t.e({type:`raster`},n),t.e(this,t.M(n,[`url`,`scheme`,`tileSize`]))}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.k(`dataloading`,{dataType:`source`})),this._tileJSONRequest=new AbortController;try{let e=yield fe(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(t.e(this,e),e.bounds&&(this.tileBounds=new pe(e.bounds,this.minzoom,this.maxzoom)),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`content`})))}catch(e){this._tileJSONRequest=null,this.fire(new t.j(e))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(e){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let n=yield p.getImage(this.map._requestManager.transformRequest(t,`Tile`),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state=`unloaded`);if(n&&n.data){this.map._refreshExpiredTiles&&n.cacheControl&&n.expires&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let t=this.map.painter.context,r=t.gl,i=n.data;e.texture=this.map.painter.getTileTexture(i.width),e.texture?e.texture.update(i,{useMipmap:!0}):(e.texture=new x(t,i,r.RGBA,{useMipmap:!0}),e.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class he extends P{constructor(e,n,r,i){super(e,n,r,i),this.type=`raster-dem`,this.maxzoom=22,this._options=t.e({type:`raster-dem`},n),this.encoding=n.encoding||`mapbox`,this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return t._(this,void 0,void 0,(function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this.map._requestManager.transformRequest(n,`Tile`);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let n=yield p.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state=`unloaded`);if(n&&n.data){let r=n.data;this.map._refreshExpiredTiles&&n.cacheControl&&n.expires&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let i=t.b(r)&&t.U()?r:yield this.readImageNow(r),a={type:this.type,uid:e.uid,source:this.id,rawImageData:i,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};(!e.actor||e.state===`expired`)&&(e.actor=this.dispatcher.getActor(),e.dem=yield e.actor.sendAsync({type:`LDT`,data:a}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state=`loaded`)}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}))}readImageNow(e){return t._(this,void 0,void 0,(function*(){if(typeof VideoFrame<`u`&&t.V()){let n=e.width+2,r=e.height+2;try{return new t.R({width:n,height:r},yield t.W(e,-1,-1,n,r))}catch{}}return a.getImageData(e,1)}))}_getNeighboringTiles(e){let n=e.canonical,r=2**n.z,i=(n.x-1+r)%r,a=n.x===0?e.wrap-1:e.wrap,o=(n.x+1+r)%r,s=n.x+1===r?e.wrap+1:e.wrap,c={};return c[new t.S(e.overscaledZ,a,n.z,i,n.y).key]={backfilled:!1},c[new t.S(e.overscaledZ,s,n.z,o,n.y).key]={backfilled:!1},n.y>0&&(c[new t.S(e.overscaledZ,a,n.z,i,n.y-1).key]={backfilled:!1},c[new t.S(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},c[new t.S(e.overscaledZ,s,n.z,o,n.y-1).key]={backfilled:!1}),n.y+1<r&&(c[new t.S(e.overscaledZ,a,n.z,i,n.y+1).key]={backfilled:!1},c[new t.S(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},c[new t.S(e.overscaledZ,s,n.z,o,n.y+1).key]={backfilled:!1}),c}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state=`unloaded`,e.actor&&(yield e.actor.sendAsync({type:`RDT`,data:{type:this.type,uid:e.uid,source:this.id}}))}))}}class ge extends t.E{constructor(e,n,r,i){super(),this.id=e,this.type=`geojson`,this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=r.getActor(),this.setEventedParent(i),this._data=n.data,this._options=t.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;let a=t.X/this.tileSize;n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer===void 0?128:n.buffer)*a,tolerance:(n.tolerance===void 0?.375:n.tolerance)*a,extent:t.X,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom===void 0?this.maxzoom-1:n.clusterMaxZoom,minPoints:Math.max(2,n.clusterMinPoints||2),extent:t.X,radius:(n.clusterRadius||50)*a,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId==`string`&&(this.workerOptions.promoteId=this.promoteId)}load(){return t._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return t._(this,void 0,void 0,(function*(){let e=t.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:`GD`,data:e})}))}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:`GCEZ`,data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:`GCC`,data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,n){return this.actor.sendAsync({type:`GCL`,data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:n}})}_updateWorkerData(e){return t._(this,void 0,void 0,(function*(){let n=t.e({type:this.type},this.workerOptions);e?n.dataDiff=e:typeof this._data==`string`?(n.request=this.map._requestManager.transformRequest(a.resolveURL(this._data),`Source`),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.k(`dataloading`,{dataType:`source`}));try{let e=yield this.actor.sendAsync({type:`LD`,data:n});if(this._pendingLoads--,this._removed||e.abandoned)return void this.fire(new t.k(`dataabort`,{dataType:`source`}));let r=null;e.resourceTiming&&e.resourceTiming[this.id]&&(r=e.resourceTiming[this.id].slice(0));let i={dataType:`source`};this._collectResourceTiming&&r&&r.length>0&&t.e(i,{resourceTiming:r}),this.fire(new t.k(`data`,Object.assign(Object.assign({},i),{sourceDataType:`metadata`}))),this.fire(new t.k(`data`,Object.assign(Object.assign({},i),{sourceDataType:`content`})))}catch(e){if(this._pendingLoads--,this._removed)return void this.fire(new t.k(`dataabort`,{dataType:`source`}));this.fire(new t.j(e))}}))}loaded(){return this._pendingLoads===0}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.actor?`RT`:`LT`;e.actor=this.actor;let n={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;let r=yield this.actor.sendAsync({type:t,data:n},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t===`RT`)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:`RMT`,data:{uid:e.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:`RS`,data:{type:this.type,source:this.id}})}serialize(){return t.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var _e=t.Y([{name:`a_pos`,type:`Int16`,components:2},{name:`a_texture_pos`,type:`Int16`,components:2}]);class ve extends t.E{constructor(e,t,n,r){super(),this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type=`image`,this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}load(e){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.k(`dataloading`,{dataType:`source`})),this.url=this.options.url,this._request=new AbortController;try{let t=yield p.getImage(this.map._requestManager.transformRequest(this.url,`Image`),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,this.fire(new t.j(e))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&=(this._request.abort(),null),this.options.url=e.url,this.load(e.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`metadata`})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&=(this._request.abort(),null)}setCoordinates(e){this.coordinates=e;let n=e.map(t.Z.fromLngLat);this.tileID=function(e){let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let t of e)n=Math.min(n,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x),a=Math.max(a,t.y);let o=Math.max(i-n,a-r),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),c=2**s;return new t.a1(s,Math.floor((n+i)/2*c),Math.floor((r+a)/2*c))}(n),this.minzoom=this.maxzoom=this.tileID.z;let r=n.map((e=>this.tileID.getTilePoint(e)._round()));return this._boundsArray=new t.$,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,t.X,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,t.X),this._boundsArray.emplaceBack(r[2].x,r[2].y,t.X,t.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`content`})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||=e.createVertexBuffer(this._boundsArray,_e.members),this.boundsSegments||=t.a0.simpleSegment(0,0,4,2),this.texture||(this.texture=new x(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`idle`,sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state=`errored`}))}serialize(){return{type:`image`,url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class ye extends ve{constructor(e,t,n,r){super(e,t,n,r),this.roundZoom=!0,this.type=`video`,this.options=t}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,`Source`).url);try{let e=yield t.a3(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener(`playing`,(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new t.j(e))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new t.j(new t.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||=e.createVertexBuffer(this._boundsArray,_e.members),this.boundsSegments||=t.a0.simpleSegment(0,0,4,2),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new x(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`idle`,sourceId:this.id}))}serialize(){return{type:`video`,urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class be extends ve{constructor(e,n,r,i){super(e,n,r,i),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((e=>!Array.isArray(e)||e.length!==2||e.some((e=>typeof e!=`number`))))||this.fire(new t.j(new t.a2(`sources.${e}`,null,`"coordinates" property must be an array of 4 longitude/latitude array pairs`))):this.fire(new t.j(new t.a2(`sources.${e}`,null,`missing required property "coordinates"`))),n.animate&&typeof n.animate!=`boolean`&&this.fire(new t.j(new t.a2(`sources.${e}`,null,`optional "animate" property must be a boolean value`))),n.canvas?typeof n.canvas==`string`||n.canvas instanceof HTMLCanvasElement||this.fire(new t.j(new t.a2(`sources.${e}`,null,`"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance`))):this.fire(new t.j(new t.a2(`sources.${e}`,null,`missing required property "canvas"`))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.j(Error(`Canvas dimensions cannot be less than or equal to zero.`))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&=(this.prepare(),!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,r=n.gl;this.boundsBuffer||=n.createVertexBuffer(this._boundsArray,_e.members),this.boundsSegments||=t.a0.simpleSegment(0,0,4,2),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new x(n,this.canvas,r.RGBA,{premultiply:!0});let i=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,i=!0)}i&&this.fire(new t.k(`data`,{dataType:`source`,sourceDataType:`idle`,sourceId:this.id}))}serialize(){return{type:`canvas`,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let xe={},Se=e=>{switch(e){case`geojson`:return ge;case`image`:return ve;case`raster`:return P;case`raster-dem`:return he;case`vector`:return me;case`video`:return ye;case`canvas`:return be}return xe[e]},F=`RTLPluginLoaded`;class Ce extends t.E{constructor(){super(...arguments),this.status=`unavailable`,this.url=null,this.dispatcher=ce()}_syncState(e){return this.status=e,this.dispatcher.broadcast(`SRPS`,{pluginStatus:e,pluginURL:this.url}).catch((e=>{throw this.status=`error`,e}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status=`unavailable`,this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,(function*(e,t=!1){if(this.url)throw Error(`setRTLTextPlugin cannot be called multiple times.`);if(this.url=a.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status===`unavailable`){if(!t)return this._requestImport();this.status=`deferred`,this._syncState(this.status)}else if(this.status===`requested`)return this._requestImport()}))}_requestImport(){return t._(this,void 0,void 0,(function*(){yield this._syncState(`loading`),this.status=`loaded`,this.fire(new t.k(F))}))}lazyLoad(){this.status===`unavailable`?this.status=`requested`:this.status===`deferred`&&this._requestImport()}}let we=null;function Te(){return we||=new Ce,we}class Ee{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.a4(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state=`loading`}registerFadeDuration(e){let t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return this.state===`errored`||this.state===`loaded`||this.state===`reloading`}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,n,r){if(this.hasData()&&this.unloadVectorData(),this.state=`loaded`,e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){let n={};if(!t)return n;for(let r of e){let e=r.layerIds.map((e=>t.getLayer(e))).filter(Boolean);if(e.length!==0){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(let t of e)n[t.id]=r}}return n}(e.buckets,n.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let n=this.buckets[e];if(n instanceof t.a6){if(this.hasSymbolBuckets=!0,!r)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let n=this.buckets[e];if(n instanceof t.a6&&n.hasRTLText){this.hasRTLText=!0,Te().lazyLoad();break}}this.queryPadding=0;for(let e in this.buckets){let t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.a5}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&=null,this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state=`unloaded`}getBucket(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let n=this.buckets[t];n.uploadPending()&&n.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new x(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new x(e,this.glyphAtlasImage,t.ALPHA),null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,r,i,a,o,s,c,l){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:i,scale:a,tileSize:this.tileSize,pixelPosMatrix:l,transform:s,params:o,queryPadding:this.queryPadding*c},e,t,n):{}}querySourceFeatures(e,n){let r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;let i=r.loadVTLayers(),a=n&&n.sourceLayer?n.sourceLayer:``,o=i._geojsonTileLayer||i[a];if(!o)return;let s=t.a7(n&&n.filter),{z:c,x:l,y:u}=this.tileID.canonical,d={z:c,x:l,y:u};for(let n=0;n<o.length;n++){let i=o.feature(n);if(s.needGeometry){let e=t.a8(i,!0);if(!s.filter(new t.z(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.z(this.tileID.overscaledZ),i))continue;let f=r.getId(i,a),p=new t.a9(i,c,l,u,f);p.tile=d,e.push(p)}}hasData(){return this.state===`loaded`||this.state===`reloading`||this.state===`expired`}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let n=this.expirationTime;if(e.cacheControl){let n=t.aa(e.cacheControl);n[`max-age`]&&(this.expirationTime=Date.now()+1e3*n[`max-age`])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),t=!1;if(this.expirationTime>e)t=!1;else if(n)if(this.expirationTime<n)t=!0;else{let r=this.expirationTime-n;r?this.expirationTime=e+Math.max(r,3e4):t=!0}else t=!0;t?(this.expiredRequestCount++,this.state=`expired`):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),2**31-1)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let n=this.latestFeatureIndex.loadVTLayers();for(let r in this.buckets){if(!t.style.hasLayer(r))continue;let i=this.buckets[r],a=i.layers[0].sourceLayer||`_geojsonTileLayer`,o=n[a],s=e[a];if(!o||!s||Object.keys(s).length===0)continue;i.update(s,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});let c=t&&t.style&&t.style.getLayer(r);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(i)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=a.now()+e}setDependencies(e,t){let n={};for(let e of t)n[e]=!0;this.dependencies[e]=n}hasDependency(e,t){for(let n of e){let e=this.dependencies[n];if(e){for(let n of t)if(e[n])return!0}}return!1}}class I{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,n){let r=e.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let i={value:t,timeout:void 0};if(n!==void 0&&(i.timeout=setTimeout((()=>{this.remove(e,i)}),n)),this.data[r].push(i),this.order.push(r),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let n=e.wrapped().key,r=t===void 0?0:this.data[n].indexOf(t),i=this.data[n][r];return this.data[n].splice(r,1),i.timeout&&clearTimeout(i.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let t=[];for(let n in this.data)for(let r of this.data[n])e(r.value)||t.push(r);for(let e of t)this.remove(e.value.tileID,e)}}class L{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,r){let i=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][i]=this.stateChanges[e][i]||{},t.e(this.stateChanges[e][i],r),this.deletedStates[e]===null){this.deletedStates[e]={};for(let t in this.state[e])t!==i&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][i]===null){this.deletedStates[e][i]={};for(let t in this.state[e][i])r[t]||(this.deletedStates[e][i][t]=null)}else for(let t in r)this.deletedStates[e]&&this.deletedStates[e][i]&&this.deletedStates[e][i][t]===null&&delete this.deletedStates[e][i][t]}removeFeatureState(e,t,n){if(this.deletedStates[e]===null)return;let r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&t!==void 0)this.deletedStates[e][r]!==null&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][n]=null);else if(t!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][r])for(n in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][n]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,n){let r=String(n),i=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let t=this.deletedStates[e][n];if(t===null)return{};for(let e in t)delete i[e]}return i}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,n){let r={};for(let e in this.stateChanges){this.state[e]=this.state[e]||{};let n={};for(let r in this.stateChanges[e])this.state[e][r]||(this.state[e][r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),n[r]=this.state[e][r];r[e]=n}for(let e in this.deletedStates){this.state[e]=this.state[e]||{};let n={};if(this.deletedStates[e]===null)for(let t in this.state[e])n[t]={},this.state[e][t]={};else for(let t in this.deletedStates[e]){if(this.deletedStates[e][t]===null)this.state[e][t]={};else for(let n of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][n];n[t]=this.state[e][t]}r[e]=r[e]||{},t.e(r[e],n)}if(this.stateChanges={},this.deletedStates={},Object.keys(r).length!==0)for(let t in e)e[t].setFeatureState(r,n)}}class R extends t.E{constructor(e,t,n){super(),this.id=e,this.dispatcher=n,this.on(`data`,(e=>this._dataHandler(e))),this.on(`dataloading`,(()=>{this._sourceErrored=!1})),this.on(`error`,(()=>{this._sourceErrored=this._source.loaded()})),this._source=((e,t,n,r)=>{let i=new(Se(t.type))(e,t,n,r);if(i.id!==e)throw Error(`Expected Source id to be ${e} instead of ${i.id}`);return i})(e,t,n,this),this._tiles={},this._cache=new I(0,(e=>this._unloadTile(e))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new L,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let e in this._tiles){let t=this._tiles[e];if(t.state!==`loaded`&&t.state!==`errored`)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,r){return t._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,n,r)}catch(n){e.state=`errored`,n.status===404?this.update(this.transform,this.terrain):this._source.fire(new t.j(n,{tile:e}))}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.k(`dataabort`,{tile:e,coord:e.tileID,dataType:`source`}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let t in this._tiles){let n=this._tiles[t];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(De).map((e=>e.key))}getRenderableIds(e){let n=[];for(let t in this._tiles)this._isIdRenderable(t,e)&&n.push(this._tiles[t]);return e?n.sort(((e,n)=>{let r=e.tileID,i=n.tileID,a=new t.P(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),o=new t.P(i.canonical.x,i.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-i.overscaledZ||o.y-a.y||o.x-a.x})).map((e=>e.tileID.key)):n.map((e=>e.tileID)).sort(De).map((e=>e.key))}hasRenderableParent(e){let t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)this._tiles[e].state!==`errored`&&this._reloadTile(e,`reloading`)}}_reloadTile(e,n){return t._(this,void 0,void 0,(function*(){let t=this._tiles[e];t&&(t.state!==`loading`&&(t.state=n),yield this._loadTile(t,e,n))}))}_tileLoaded(e,n,r){e.timeAdded=a.now(),r===`expired`&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),this.getSource().type===`raster-dem`&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.k(`data`,{dataType:`source`,tile:e,coord:e.tileID}))}_backfillDEM(e){let t=this.getRenderableIds();for(let r=0;r<t.length;r++){let i=t[r];if(e.neighboringTiles&&e.neighboringTiles[i]){let t=this.getTileByID(i);n(e,t),n(t,e)}}function n(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let n=t.tileID.canonical.x-e.tileID.canonical.x,r=t.tileID.canonical.y-e.tileID.canonical.y,i=2**e.tileID.canonical.z,a=t.tileID.key;n===0&&r===0||Math.abs(r)>1||(Math.abs(n)>1&&(Math.abs(n+i)===1?n+=i:Math.abs(n-i)===1&&(n-=i)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,r),e.neighboringTiles&&e.neighboringTiles[a]&&(e.neighboringTiles[a].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,n,r){for(let i in this._tiles){let a=this._tiles[i];if(r[i]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>n)continue;let o=a.tileID;for(;a&&a.tileID.overscaledZ>t+1;){let e=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[e.key],a&&a.hasData()&&(o=e)}let s=o;for(;s.overscaledZ>t;)if(s=s.scaledTo(s.overscaledZ-1),e[s.key]){r[o.key]=o;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){let n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=t?n:null}for(let n=e.overscaledZ-1;n>=t;n--){let t=e.scaledTo(n),r=this._getLoadedTile(t);if(r)return r}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,i=Math.floor(n*r*(this._maxTileCacheZoomLevels===null?t.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),a=typeof this._maxTileCacheSize==`number`?Math.min(this._maxTileCacheSize,i):i;this._cache.setMaxSize(a)}handleWrapJump(e){let t=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,t){let e={};for(let n in this._tiles){let r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e;for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}}_updateCoveredAndRetainedTiles(e,t,n,r,i,o){let s={},c={},l=Object.keys(e),u=a.now();for(let n of l){let r=e[n],i=this._tiles[n];if(!i||i.fadeEndTime!==0&&i.fadeEndTime<=u)continue;let a=this.findLoadedParent(r,t),o=this.findLoadedSibling(r),l=a||o||null;l&&(this._addTile(l.tileID),s[l.tileID.key]=l.tileID),c[n]=r}this._retainLoadedChildren(c,r,n,e);for(let t in s)e[t]||(this._coveredTiles[t]=!0,e[t]=s[t]);if(o){let t={},n={};for(let e of i)this._tiles[e.key].hasData()?t[e.key]=e:n[e.key]=e;for(let r in n){let i=n[r].children(this._source.maxzoom);this._tiles[i[0].key]&&this._tiles[i[1].key]&&this._tiles[i[2].key]&&this._tiles[i[3].key]&&(t[i[0].key]=e[i[0].key]=i[0],t[i[1].key]=e[i[1].key]=i[1],t[i[2].key]=e[i[2].key]=i[2],t[i[3].key]=e[i[3].key]=i[3],delete n[r])}for(let r in n){let i=n[r],a=this.findLoadedParent(i,this._source.minzoom),o=this.findLoadedSibling(i),s=a||o||null;if(s){t[s.tileID.key]=e[s.tileID.key]=s.tileID;for(let e in t)t[e].isChildOf(s.tileID)&&delete t[e]}}for(let e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}update(e,n){if(!this._sourceLoaded||this._paused)return;let r;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.S(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(r=r.filter((e=>this._source.hasTile(e))))):r=[];let i=e.coveringZoomLevel(this._source),a=Math.max(i-R.maxOverzooming,this._source.minzoom),o=Math.max(i+R.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let e={};for(let t of r)if(t.canonical.z>this._source.minzoom){let n=t.scaledTo(t.canonical.z-1);e[n.key]=n;let r=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[r.key]=r}r=r.concat(Object.values(e))}let s=r.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new t.k(`data`,{sourceDataType:`idle`,dataType:`source`,sourceId:this.id}));let c=this._updateRetainedTiles(r,i);Oe(this._source.type)&&this._updateCoveredAndRetainedTiles(c,a,o,i,r,n);for(let e in c)this._tiles[e].clearFadeHold();let l=t.ab(this._tiles,c);for(let e of l){let t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(e)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){let n={},r={},i=Math.max(t-R.maxOverzooming,this._source.minzoom),a=Math.max(t+R.maxUnderzooming,this._source.minzoom),o={};for(let r of e){let e=this._addTile(r);n[r.key]=r,e.hasData()||t<this._source.maxzoom&&(o[r.key]=r)}this._retainLoadedChildren(o,t,a,n);for(let a of e){let e=this._tiles[a.key];if(e.hasData())continue;if(t+1>this._source.maxzoom){let e=a.children(this._source.maxzoom)[0],t=this.getTile(e);if(t&&t.hasData()){n[e.key]=e;continue}}else{let e=a.children(this._source.maxzoom);if(n[e[0].key]&&n[e[1].key]&&n[e[2].key]&&n[e[3].key])continue}let o=e.wasRequested();for(let t=a.overscaledZ-1;t>=i;--t){let i=a.scaledTo(t);if(r[i.key])break;if(r[i.key]=!0,e=this.getTile(i),!e&&o&&(e=this._addTile(i)),e){let t=e.hasData();if((t||!this.map?.cancelPendingTileRequestsWhileZooming||o)&&(n[i.key]=i),o=e.wasRequested(),t)break}}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let t=[],n,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){n=this._loadedParentTiles[r.key];break}t.push(r.key);let e=r.scaledTo(r.overscaledZ-1);if(n=this._getLoadedTile(e),n)break;r=e}for(let e of t)this._loadedParentTiles[e]=n}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let e in this._tiles){let t=this._tiles[e].tileID,n=this._getLoadedTile(t);this._loadedSiblingTiles[t.key]=n}}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));let r=n;return n||(n=new Ee(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._tiles[e.key]=n,r||this._source.fire(new t.k(`dataloading`,{tile:n,coord:n.tileID,dataType:`source`})),n}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,`expired`),delete this._timers[e]}),n))}_removeTile(e){let t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&t.state!==`reloading`?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){let t=e.sourceDataType;e.dataType===`source`&&t===`metadata`&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType===`source`&&t===`content`&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,r){let i=[],a=this.transform;if(!a)return i;let o=r?a.getCameraQueryGeometry(e):e,s=e.map((e=>a.pointCoordinate(e,this.terrain))),c=o.map((e=>a.pointCoordinate(e,this.terrain))),l=this.getIds(),u=1/0,d=1/0,f=-1/0,p=-1/0;for(let e of c)u=Math.min(u,e.x),d=Math.min(d,e.y),f=Math.max(f,e.x),p=Math.max(p,e.y);for(let e=0;e<l.length;e++){let r=this._tiles[l[e]];if(r.holdingForFade())continue;let o=r.tileID,m=2**(a.zoom-r.tileID.overscaledZ),h=n*r.queryPadding*t.X/r.tileSize/m,g=[o.getTilePoint(new t.Z(u,d)),o.getTilePoint(new t.Z(f,p))];if(g[0].x-h<t.X&&g[0].y-h<t.X&&g[1].x+h>=0&&g[1].y+h>=0){let e=s.map((e=>o.getTilePoint(e))),t=c.map((e=>o.getTilePoint(e)));i.push({tile:r,tileID:o,queryGeometry:e,cameraQueryGeometry:t,scale:m})}}return i}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));for(let e of t)e.posMatrix=this.transform.calculatePosMatrix(e.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(Oe(this._source.type)){let e=a.now();for(let t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,n){this._state.updateState(e||=`_geojsonTileLayer`,t,n)}removeFeatureState(e,t,n){this._state.removeFeatureState(e||=`_geojsonTileLayer`,t,n)}getFeatureState(e,t){return this._state.getState(e||=`_geojsonTileLayer`,t)}setDependencies(e,t,n){let r=this._tiles[e];r&&r.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(let n in this._tiles)this._tiles[n].hasDependency(e,t)&&this._reloadTile(n,`reloading`);this._cache.filter((n=>!n.hasDependency(e,t)))}}function De(e,t){let n=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-n||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Oe(e){return e===`raster`||e===`image`||e===`video`}R.maxOverzooming=10,R.maxUnderzooming=3;class z{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=t.ac(e,0,1);let n=1,r=this._distances[n],i=e*this.paddedLength+this.padding;for(;r<i&&n<this._distances.length;)r=this._distances[++n];let a=n-1,o=this._distances[a],s=r-o,c=s>0?(i-o)/s:0;return this.points[a].mult(1-c).add(this.points[n].mult(c))}}function ke(e,t){let n=!0;return e===`always`||e!==`never`&&t!==`never`||(n=!1),n}class Ae{constructor(e,t,n){let r=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),i.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}insertCircle(e,t,n,r){this._forEachCell(t-r,n-r,t+r,n+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(r)}_insertBoxCell(e,t,n,r,i,a){this.boxCells[i].push(a)}_insertCircleCell(e,t,n,r,i,a){this.circleCells[i].push(a)}_query(e,t,n,r,i,a,o){if(n<0||e>this.width||r<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(i)return[{key:null,x1:e,y1:t,x2:n,y2:r}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],n=this.circles[3*e+1],r=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-r,y1:n-r,x2:t+r,y2:n+r})}}else this._forEachCell(e,t,n,r,this._queryCell,s,{hitTest:i,overlapMode:a,seenUids:{box:{},circle:{}}},o);return s}query(e,t,n,r){return this._query(e,t,n,r,!1,null)}hitTest(e,t,n,r,i,a){return this._query(e,t,n,r,!0,i,a).length>0}hitTestCircle(e,t,n,r,i){let a=e-n,o=e+n,s=t-n,c=t+n;if(o<0||a>this.width||c<0||s>this.height)return!1;let l=[];return this._forEachCell(a,s,o,c,this._queryCellCircle,l,{hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},i),l.length>0}_queryCell(e,t,n,r,i,a,o,s){let{seenUids:c,hitTest:l,overlapMode:u}=o,d=this.boxCells[i];if(d!==null){let i=this.bboxes;for(let o of d)if(!c.box[o]){c.box[o]=!0;let d=4*o,f=this.boxKeys[o];if(e<=i[d+2]&&t<=i[d+3]&&n>=i[d+0]&&r>=i[d+1]&&(!s||s(f))&&(!l||!ke(u,f.overlapMode))&&(a.push({key:f,x1:i[d],y1:i[d+1],x2:i[d+2],y2:i[d+3]}),l))return!0}}let f=this.circleCells[i];if(f!==null){let i=this.circles;for(let o of f)if(!c.circle[o]){c.circle[o]=!0;let d=3*o,f=this.circleKeys[o];if(this._circleAndRectCollide(i[d],i[d+1],i[d+2],e,t,n,r)&&(!s||s(f))&&(!l||!ke(u,f.overlapMode))){let e=i[d],t=i[d+1],n=i[d+2];if(a.push({key:f,x1:e-n,y1:t-n,x2:e+n,y2:t+n}),l)return!0}}}return!1}_queryCellCircle(e,t,n,r,i,a,o,s){let{circle:c,seenUids:l,overlapMode:u}=o,d=this.boxCells[i];if(d!==null){let e=this.bboxes;for(let t of d)if(!l.box[t]){l.box[t]=!0;let n=4*t,r=this.boxKeys[t];if(this._circleAndRectCollide(c.x,c.y,c.radius,e[n+0],e[n+1],e[n+2],e[n+3])&&(!s||s(r))&&!ke(u,r.overlapMode))return a.push(!0),!0}}let f=this.circleCells[i];if(f!==null){let e=this.circles;for(let t of f)if(!l.circle[t]){l.circle[t]=!0;let n=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[n],e[n+1],e[n+2],c.x,c.y,c.radius)&&(!s||s(r))&&!ke(u,r.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToXCellCoord(e),l=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++)if(i.call(this,e,t,n,r,this.xCellCount*c+f,a,o,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,r,i,a){let o=r-e,s=i-t,c=n+a;return c*c>o*o+s*s}_circleAndRectCollide(e,t,n,r,i,a,o){let s=(a-r)/2,c=Math.abs(e-(r+s));if(c>s+n)return!1;let l=(o-i)/2,u=Math.abs(t-(i+l));if(u>l+n)return!1;if(c<=s||u<=l)return!0;let d=c-s,f=u-l;return d*d+f*f<=n*n}}function je(e,n,r,i,a){let o=t.H();return n?(t.K(o,o,[1/a,1/a,1]),r||t.ad(o,o,i.angle)):t.L(o,i.labelPlaneMatrix,e),o}function Me(e,n,r,i,a){if(n){let n=t.ae(e);return t.K(n,n,[a,a,1]),r||t.ad(n,n,-i.angle),n}return i.glCoordMatrix}function Ne(e,n,r,i){let a;i?(a=[e,n,i(e,n),1],t.af(a,a,r)):(a=[e,n,0,1],Je(a,a,r));let o=a[3];return{point:new t.P(a[0]/o,a[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function Pe(e,t){return .5+e/t*.5}function Fe(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function Ie(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=i?e.textSizeData:e.iconSizeData,_=t.ag(g,r.transform.zoom),v=[256/r.width*2+1,256/r.height*2+1],y=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;y.clear();let b=e.lineVertexArray,x=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,S=r.transform.width/r.transform.height,C=!1;for(let i=0;i<x.length;i++){let w=x.get(i);if(w.hidden||w.writingMode===t.ah.vertical&&!C){qe(w.numGlyphs,y);continue}C=!1;let T=Ne(w.anchorX,w.anchorY,n,h);if(!Fe(T.point,v)){qe(w.numGlyphs,y);continue}let E=Pe(r.transform.cameraToCenterDistance,T.signedDistanceFromCamera),D=t.ai(g,_,w),O=s?D/E:D*E,k={getElevation:h,labelPlaneMatrix:a,lineVertexArray:b,pitchWithMap:s,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:u,tileAnchorPoint:new t.P(w.anchorX,w.anchorY),unwrappedTileID:d,width:f,height:p,translation:m},A=ze(k,w,O,!1,c,n,o,e.glyphOffsetArray,y,S,l);C=A.useVertical,(A.notEnoughRoom||C||A.needsFlipping&&ze(k,w,O,!0,c,n,o,e.glyphOffsetArray,y,S,l).notEnoughRoom)&&qe(w.numGlyphs,y)}i?e.text.dynamicLayoutVertexBuffer.updateData(y):e.icon.dynamicLayoutVertexBuffer.updateData(y)}function Le(e,t,n,r,i,a,o,s){let c=a.glyphStartIndex+a.numGlyphs,l=a.lineStartIndex,u=a.lineStartIndex+a.lineLength,d=t.getoffsetX(a.glyphStartIndex),f=t.getoffsetX(c-1),p=Ge(e*d,n,r,i,a.segment,l,u,s,o);if(!p)return null;let m=Ge(e*f,n,r,i,a.segment,l,u,s,o);return m?s.projectionCache.anyProjectionOccluded?null:{first:p,last:m}:null}function Re(e,n,r,i){return e===t.ah.horizontal&&Math.abs(r.y-n.y)>Math.abs(r.x-n.x)*i?{useVertical:!0}:(e===t.ah.vertical?n.y<r.y:n.x>r.x)?{needsFlipping:!0}:null}function ze(e,n,r,i,a,o,s,c,l,u,d){let f=r/24,p=n.lineOffsetX*f,m=n.lineOffsetY*f,h;if(n.numGlyphs>1){let t=n.glyphStartIndex+n.numGlyphs,r=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,l=Le(f,c,p,m,i,n,d,e);if(!l)return{notEnoughRoom:!0};let g=Ne(l.first.point.x,l.first.point.y,s,e.getElevation).point,_=Ne(l.last.point.x,l.last.point.y,s,e.getElevation).point;if(a&&!i){let e=Re(n.writingMode,g,_,u);if(e)return e}h=[l.first];for(let a=n.glyphStartIndex+1;a<t-1;a++)h.push(Ge(f*c.getoffsetX(a),p,m,i,n.segment,r,o,e,d));h.push(l.last)}else{if(a&&!i){let r=Ne(e.tileAnchorPoint.x,e.tileAnchorPoint.y,o,e.getElevation).point,i=n.lineStartIndex+n.segment+1,a=new t.P(e.lineVertexArray.getx(i),e.lineVertexArray.gety(i)),s=Ne(a.x,a.y,o,e.getElevation),c=s.signedDistanceFromCamera>0?s.point:function(e,t,n,r,i,a){return Be(e,t,n,1,i,a)}(e.tileAnchorPoint,a,r,0,o,e),l=Re(n.writingMode,r,c,u);if(l)return l}let r=Ge(f*c.getoffsetX(n.glyphStartIndex),p,m,i,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,e,d);if(!r||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};h=[r]}for(let e of h)t.aj(l,e.point,e.angle);return{}}function Be(e,t,n,r,i,a){let o=e.add(e.sub(t)._unit()),s=i===void 0?He(o.x,o.y,a).point:Ne(o.x,o.y,i,a.getElevation).point,c=n.sub(s);return n.add(c._mult(r/c.mag()))}function Ve(e,n,r){let i=n.projectionCache;if(i.projections[e])return i.projections[e];let a=new t.P(n.lineVertexArray.getx(e),n.lineVertexArray.gety(e)),o=He(a.x,a.y,n);if(o.signedDistanceFromCamera>0)return i.projections[e]=o.point,i.anyProjectionOccluded=i.anyProjectionOccluded||o.isOccluded,o.point;let s=e-r.direction;return function(e,t,n,r,i){return Be(e,t,n,r,void 0,i)}(r.distanceFromAnchor===0?n.tileAnchorPoint:new t.P(n.lineVertexArray.getx(s),n.lineVertexArray.gety(s)),a,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,n)}function He(e,t,n){let r=e+n.translation[0],i=t+n.translation[1],a;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(a=n.projection.projectTileCoordinates(r,i,n.unwrappedTileID,n.getElevation),a.point.x=(.5*a.point.x+.5)*n.width,a.point.y=(.5*-a.point.y+.5)*n.height):(a=Ne(r,i,n.labelPlaneMatrix,n.getElevation),a.isOccluded=!1),a}function Ue(e,t,n){return e._unit()._perp()._mult(t*n)}function We(e,n,r,i,a,o,s,c,l){if(c.projectionCache.offsets[e])return c.projectionCache.offsets[e];let u=r.add(n);if(e+l.direction<i||e+l.direction>=a)return c.projectionCache.offsets[e]=u,u;let d=Ve(e+l.direction,c,l),f=Ue(d.sub(r),s,l.direction),p=r.add(f),m=d.add(f);return c.projectionCache.offsets[e]=t.ak(o,u,p,m)||u,c.projectionCache.offsets[e]}function Ge(e,t,n,r,i,a,o,s,c){let l=r?e-t:e+t,u=l>0?1:-1,d=0;r&&(u*=-1,d=Math.PI),u<0&&(d+=Math.PI);let f,p=u>0?a+i:a+i+1;s.projectionCache.cachedAnchorPoint?f=s.projectionCache.cachedAnchorPoint:(f=He(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=f);let m,h,g=f,_=f,v=0,y=0,b=Math.abs(l),x=[],S;for(;v+y<=b;){if(p+=u,p<a||p>=o)return null;v+=y,_=g,h=m;let e={absOffsetX:b,direction:u,distanceFromAnchor:v,previousVertex:_};if(g=Ve(p,s,e),n===0)x.push(_),S=g.sub(_);else{let t,r=g.sub(_);t=r.mag()===0?Ue(Ve(p+u,s,e).sub(g),n,u):Ue(r,n,u),h||=_.add(t),m=We(p,t,g,a,o,h,n,s,e),x.push(h),S=m.sub(h)}y=S.mag()}let C=S._mult((b-v)/y)._add(h||_),w=d+Math.atan2(g.y-_.y,g.x-_.x);return x.push(C),{point:C,angle:c?w:0,path:x}}let Ke=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function qe(e,t){for(let n=0;n<e;n++){let e=t.length;t.resize(e+4),t.float32.set(Ke,3*e)}}function Je(e,t,n){let r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e[3]=n[3]*r+n[7]*i+n[15],e}class Ye{constructor(e,t,n=new Ae(e.width+200,e.height+200,25),r=new Ae(e.width+200,e.height+200,25)){this.transform=e,this.mapProjection=t,this.grid=n,this.ignoredGrid=r,this.pitchFactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,n,r,i,a,o,s,c,l,u){let d=e.anchorPointX+s[0],f=e.anchorPointY+s[1],p=this.projectAndGetPerspectiveRatio(r,d,f,i,l),m=n*p.perspectiveRatio,h;if(a||o)h=this._projectCollisionBox(e,m,r,i,a,o,s,p,l,u);else{let t=p.point.x+(u?u.x*m:0),n=p.point.y+(u?u.y*m:0);h={allPointsOccluded:!1,box:[t+e.x1*m,n+e.y1*m,t+e.x2*m,n+e.y2*m]}}let[g,_,v,y]=h.box;return this.mapProjection.useSpecialProjectionForSymbols&&(a?h.allPointsOccluded:this.mapProjection.isOccluded(d,f,i))||p.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(g,_,v,y)||t!==`always`&&this.grid.hitTest(g,_,v,y,t,c)?{box:[g,_,v,y],placeable:!1,offscreen:!1}:{box:[g,_,v,y],placeable:!0,offscreen:this.isOffscreen(g,_,v,y)}}placeCollisionCircles(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=[],v=new t.P(n.anchorX,n.anchorY),y=this.getPerspectiveRatio(o,v.x,v.y,s,g),b=(d?a/y:a*y)/t.ap,x={getElevation:g,labelPlaneMatrix:c,lineVertexArray:r,pitchWithMap:d,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:v,unwrappedTileID:s,width:this.transform.width,height:this.transform.height,translation:h},S=Le(b,i,n.lineOffsetX*b,n.lineOffsetY*b,!1,n,!1,x),C=!1,w=!1,T=!0;if(S){let n=.5*p*y+m,r=new t.P(-100,-100),i=new t.P(this.screenRightBoundary,this.screenBottomBoundary),a=new z,o=S.first,s=S.last,c=[];for(let e=o.path.length-1;e>=1;e--)c.push(o.path[e]);for(let e=1;e<s.path.length;e++)c.push(s.path[e]);let d=2.5*n;if(l){let e=this.projectPathToScreenSpace(c,x,l);c=e.some((e=>e.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let h=[];if(c.length>0){let e=c[0].clone(),n=c[0].clone();for(let t=1;t<c.length;t++)e.x=Math.min(e.x,c[t].x),e.y=Math.min(e.y,c[t].y),n.x=Math.max(n.x,c[t].x),n.y=Math.max(n.y,c[t].y);h=e.x>=r.x&&n.x<=i.x&&e.y>=r.y&&n.y<=i.y?[c]:n.x<r.x||e.x>i.x||n.y<r.y||e.y>i.y?[]:t.al([c],r.x,r.y,i.x,i.y)}for(let t of h){a.reset(t,.25*n);let r=0;r=a.length<=.5*n?1:Math.ceil(a.paddedLength/d)+1;for(let t=0;t<r;t++){let i=t/Math.max(r-1,1),o=a.lerp(i),s=o.x+100,c=o.y+100;_.push(s,c,n,0);let l=s-n,d=c-n,p=s+n,m=c+n;if(T&&=this.isOffscreen(l,d,p,m),w||=this.isInsideGrid(l,d,p,m),e!==`always`&&this.grid.hitTestCircle(s,c,n,e,f)&&(C=!0,!u))return{circles:[],offscreen:!1,collisionDetected:C}}}}return{circles:!u&&C||!w||y<this.perspectiveRatioCutoff?[]:_,offscreen:T,collisionDetected:C}}projectPathToScreenSpace(e,t,n){return e.map((e=>Ne(e.x,e.y,n,t.getElevation)))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],r=1/0,i=1/0,a=-1/0,o=-1/0;for(let s of e){let e=new t.P(s.x+100,s.y+100);r=Math.min(r,e.x),i=Math.min(i,e.y),a=Math.max(a,e.x),o=Math.max(o,e.y),n.push(e)}let s=this.grid.query(r,i,a,o).concat(this.ignoredGrid.query(r,i,a,o)),c={},l={};for(let e of s){let r=e.key;if(c[r.bucketInstanceId]===void 0&&(c[r.bucketInstanceId]={}),c[r.bucketInstanceId][r.featureIndex])continue;let i=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.am(n,i)&&(c[r.bucketInstanceId][r.featureIndex]=!0,l[r.bucketInstanceId]===void 0&&(l[r.bucketInstanceId]=[]),l[r.bucketInstanceId].push(r.featureIndex))}return l}insertCollisionBox(e,t,n,r,i,a){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,r,i,a){let o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,n,r,i,a){let o;a?(o=[n,r,a(n,r),1],t.af(o,o,e)):(o=[n,r,0,1],Je(o,o,e));let s=o[3];return{point:new t.P((o[0]/s+1)/2*this.transform.width+100,(-o[1]/s+1)/2*this.transform.height+100),perspectiveRatio:.5+this.transform.cameraToCenterDistance/s*.5,isOccluded:!1,signedDistanceFromCamera:s}}getPerspectiveRatio(e,t,n,r,i){let a=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(t,n,r,i):Ne(t,n,e,i);return .5+this.transform.cameraToCenterDistance/a.signedDistanceFromCamera*.5}isOffscreen(e,t,n,r){return n<100||e>=this.screenRightBoundary||r<100||t>this.screenBottomBoundary}isInsideGrid(e,t,n,r){return n>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=t.an([]);return t.J(e,e,[-100,-100,0]),e}_projectCollisionBox(e,n,r,i,a,o,s,c,l,u){let d=new t.P(1,0),f=new t.P(0,1),p=new t.P(e.anchorPointX+s[0],e.anchorPointY+s[1]);if(o&&!a){let e=this.projectAndGetPerspectiveRatio(r,p.x+1,p.y,i,l).point.sub(c.point).unit(),n=Math.atan(e.y/e.x)+(e.x<0?Math.PI:0),a=Math.sin(n),o=Math.cos(n);d=new t.P(o,a),f=new t.P(-a,o)}else if(!o&&a){let e=-this.transform.angle,n=Math.sin(e),r=Math.cos(e);d=new t.P(r,n),f=new t.P(-n,r)}let m=c.point,h=n;a&&(m=p,h=2**-(this.transform.zoom-Math.floor(this.transform.zoom)),h*=this.mapProjection.getPitchedTextCorrection(this.transform,p,i),u||(h*=t.ac(.5+c.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(m=m.add(d.mult(u.x*h)).add(f.mult(u.y*h)));let g=e.x1*h,_=e.x2*h,v=(g+_)/2,y=e.y1*h,b=e.y2*h,x=(y+b)/2,S=[{offsetX:g,offsetY:y},{offsetX:v,offsetY:y},{offsetX:_,offsetY:y},{offsetX:_,offsetY:x},{offsetX:_,offsetY:b},{offsetX:v,offsetY:b},{offsetX:g,offsetY:b},{offsetX:g,offsetY:x}],C=[];for(let{offsetX:e,offsetY:n}of S)C.push(new t.P(m.x+d.x*e+f.x*n,m.y+d.y*e+f.y*n));let w=!1;if(a){let e=C.map((e=>this.projectAndGetPerspectiveRatio(r,e.x,e.y,i,l)));w=e.some((e=>!e.isOccluded)),C=e.map((e=>e.point))}else w=!0;return{box:t.ao(C),allPointsOccluded:!w}}}function Xe(e,n,r){return n*(t.X/(e.tileSize*2**(r-e.tileID.overscaledZ)))}class Ze{constructor(e,t,n,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}}class Qe{constructor(e,t,n,r,i){this.text=new Ze(e?e.text:null,t,n,i),this.icon=new Ze(e?e.icon:null,t,r,i)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class $e{constructor(e,t,n){this.text=e,this.icon=t,this.skipFade=n}}class et{constructor(){this.invProjMatrix=t.H(),this.viewportMatrix=t.H(),this.circles=[]}}class tt{constructor(e,t,n,r,i){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=r,this.tileID=i}}class nt{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function rt(e,n,r,i,a){let{horizontalAlign:o,verticalAlign:s}=t.au(e);return new t.P(-(o-.5)*n+i[0]*a,-(s-.5)*r+i[1]*a)}class it{constructor(e,t,n,r,i,a){this.transform=e.clone(),this.terrain=n,this.collisionIndex=new Ye(this.transform,t),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new nt(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;return t?(n,r)=>t.getElevation(e,n,r):null}getBucketParts(e,n,r,i){let a=r.getBucket(n),o=r.latestFeatureIndex;if(!a||!o||n.id!==a.layerIds[0])return;let s=r.collisionBoxArray,c=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.transform.zoom-r.tileID.overscaledZ),d=r.tileSize/t.X,f=r.tileID.toUnwrapped(),p=this.transform.calculatePosMatrix(f),m=c.get(`text-pitch-alignment`)===`map`,h=c.get(`text-rotation-alignment`)===`map`,g=Xe(r,1,this.transform.zoom),_=this.collisionIndex.mapProjection.translatePosition(this.transform,r,l.get(`text-translate`),l.get(`text-translate-anchor`)),v=this.collisionIndex.mapProjection.translatePosition(this.transform,r,l.get(`icon-translate`),l.get(`icon-translate-anchor`)),y=je(p,m,h,this.transform,g),b=null;if(m){let e=Me(p,m,h,this.transform,g);b=t.L([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[a.bucketInstanceId]=new tt(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,r.tileID);let x={bucket:a,layout:c,translationText:_,translationIcon:v,posMatrix:p,unwrappedTileID:f,textLabelPlaneMatrix:y,labelToScreenMatrix:b,scale:u,textPixelRatio:d,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.ag(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(i)for(let t of a.sortKeyRanges){let{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i}=t;e.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i,parameters:x})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:x})}attemptAnchorPlacement(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y){let b=t.aq[e.textAnchor],x=[e.textOffset0,e.textOffset1],S=rt(b,r,i,x,a),C=this.collisionIndex.placeCollisionBox(n,f,c,l,u,s,o,g,d.predicate,y,S);if((!v||this.collisionIndex.placeCollisionBox(v,f,c,l,u,s,o,_,d.predicate,y,S).placeable)&&C.placeable){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);return this.variableOffsets[p.crossTileID]={textOffset:x,width:r,height:i,anchor:b,textBoxScale:a,prevAnchor:e},this.markUsedJustification(m,b,p,h),m.allowVerticalPlacement&&(this.markUsedOrientation(m,h,p),this.placedOrientations[p.crossTileID]=h),{shift:S,placedGlyphBoxes:C}}}placeLayerBucketPart(e,n,r){let{bucket:i,layout:a,translationText:o,translationIcon:s,posMatrix:c,unwrappedTileID:l,textLabelPlaneMatrix:u,labelToScreenMatrix:d,textPixelRatio:f,holdingForFade:p,collisionBoxArray:m,partiallyEvaluatedTextSize:h,collisionGroup:g}=e.parameters,_=a.get(`text-optional`),v=a.get(`icon-optional`),y=t.ar(a,`text-overlap`,`text-allow-overlap`),b=y===`always`,x=t.ar(a,`icon-overlap`,`icon-allow-overlap`),S=x===`always`,C=a.get(`text-rotation-alignment`)===`map`,w=a.get(`text-pitch-alignment`)===`map`,T=a.get(`icon-text-fit`)!==`none`,E=a.get(`symbol-z-order`)===`viewport-y`,D=b&&(S||!i.hasIconData()||v),O=S&&(b||!i.hasTextData()||_);!i.collisionArrays&&m&&i.deserializeCollisionBoxes(m);let k=this._getTerrainElevationFunc(this.retainedQueryData[i.bucketInstanceId].tileID),A=(e,m,S)=>{if(n[e.crossTileID])return;if(p)return void(this.placements[e.crossTileID]=new $e(!1,!1,!1));let E=!1,A=!1,j=!0,ee=null,M={box:null,placeable:!1,offscreen:null},te={box:null,placeable:!1,offscreen:null},ne=null,re=null,ie=null,ae=0,oe=0,se=0;m.textFeatureIndex?ae=m.textFeatureIndex:e.useRuntimeCollisionCircles&&(ae=e.featureIndex),m.verticalTextFeatureIndex&&(oe=m.verticalTextFeatureIndex);let ce=m.textBox;if(ce){let n=n=>{let r=t.ah.horizontal;if(i.allowVerticalPlacement&&!n&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(i,r,e))}return r},a=(n,r)=>{if(i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&m.verticalTextBox){for(let e of i.writingModes)if(e===t.ah.vertical?(M=r(),te=M):M=n(),M&&M.placeable)break}else M=n()},u=e.textAnchorOffsetStartIndex,d=e.textAnchorOffsetEndIndex;if(d===u){let r=(t,n)=>{let r=this.collisionIndex.placeCollisionBox(t,y,f,c,l,w,C,o,g.predicate,k);return r&&r.placeable&&(this.markUsedOrientation(i,n,e),this.placedOrientations[e.crossTileID]=n),r};a((()=>r(ce,t.ah.horizontal)),(()=>{let n=m.verticalTextBox;return i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&n?r(n,t.ah.vertical):{box:null,offscreen:null}})),n(M&&M.placeable)}else{let p=t.aq[this.prevPlacement?.variableOffsets[e.crossTileID]?.anchor],h=(n,a,m)=>{let h=n.x2-n.x1,_=n.y2-n.y1,v=e.textBoxScale,b=T&&x===`never`?a:null,S=null,D=y===`never`?1:2,O=`never`;p&&D++;for(let t=0;t<D;t++){for(let t=u;t<d;t++){let r=i.textAnchorOffsets.get(t);if(p&&r.textAnchor!==p)continue;let a=this.attemptAnchorPlacement(r,n,h,_,v,C,w,f,c,l,g,O,e,i,m,o,s,b,k);if(a&&(S=a.placedGlyphBoxes,S&&S.placeable))return E=!0,ee=a.shift,S}p?p=null:O=y}return r&&!S&&(S={box:this.collisionIndex.placeCollisionBox(ce,`always`,f,c,l,w,C,o,g.predicate,k,new t.P(0,0)).box,offscreen:!1,placeable:!1}),S};a((()=>h(ce,m.iconBox,t.ah.horizontal)),(()=>{let n=m.verticalTextBox;return i.allowVerticalPlacement&&(!M||!M.placeable)&&e.numVerticalGlyphVertices>0&&n?h(n,m.verticalIconBox,t.ah.vertical):{box:null,occluded:!0,offscreen:null}})),M&&(E=M.placeable,j=M.offscreen);let _=n(M&&M.placeable);if(!E&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(i,t.anchor,e,_))}}}if(ne=M,E=ne&&ne.placeable,j=ne&&ne.offscreen,e.useRuntimeCollisionCircles){let n=i.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),s=t.ai(i.textSizeData,h,n),f=a.get(`text-padding`);re=this.collisionIndex.placeCollisionCircles(y,n,i.lineVertexArray,i.glyphOffsetArray,s,c,l,u,d,r,w,g.predicate,e.collisionCircleDiameter,f,o,k),re.circles.length&&re.collisionDetected&&!r&&t.w(`Collisions detected, but collision boxes are not shown`),E=b||re.circles.length>0&&!re.collisionDetected,j&&=re.offscreen}if(m.iconFeatureIndex&&(se=m.iconFeatureIndex),m.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,x,f,c,l,w,C,s,g.predicate,k,T&&ee?ee:void 0);te&&te.placeable&&m.verticalIconBox?(ie=e(m.verticalIconBox),A=ie.placeable):(ie=e(m.iconBox),A=ie.placeable),j&&=ie.offscreen}let le=_||e.numHorizontalGlyphVertices===0&&e.numVerticalGlyphVertices===0,ue=v||e.numIconVertices===0;le||ue?ue?le||(A&&=E):E=A&&E:A=E=A&&E;let de=A&&ie.placeable;if(E&&ne.placeable&&this.collisionIndex.insertCollisionBox(ne.box,y,a.get(`text-ignore-placement`),i.bucketInstanceId,te&&te.placeable&&oe?oe:ae,g.ID),de&&this.collisionIndex.insertCollisionBox(ie.box,x,a.get(`icon-ignore-placement`),i.bucketInstanceId,se,g.ID),re&&E&&this.collisionIndex.insertCollisionCircles(re.circles,y,a.get(`text-ignore-placement`),i.bucketInstanceId,ae,g.ID),r&&this.storeCollisionData(i.bucketInstanceId,S,m,ne,ie,re),e.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);if(i.bucketInstanceId===0)throw Error(`bucket.bucketInstanceId can't be 0`);this.placements[e.crossTileID]=new $e(E||D,A||O,j||i.justReloaded),n[e.crossTileID]=!0};if(E){if(e.symbolInstanceStart!==0)throw Error(`bucket.bucketInstanceId should be 0`);let t=i.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){let n=t[e];A(i.symbolInstances.get(n),i.collisionArrays[n],n)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)A(i.symbolInstances.get(t),i.collisionArrays[t],t);if(r&&i.bucketInstanceId in this.collisionCircleArrays){let e=this.collisionCircleArrays[i.bucketInstanceId];t.as(e.invProjMatrix,c),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}i.justReloaded=!1}storeCollisionData(e,t,n,r,i,a){if(n.textBox||n.iconBox){let a,o;this.collisionBoxArrays.has(e)?a=this.collisionBoxArrays.get(e):(a=new Map,this.collisionBoxArrays.set(e,a)),a.has(t)?o=a.get(t):(o={text:null,icon:null},a.set(t,o)),n.textBox&&(o.text=r.box),n.iconBox&&(o.icon=i.box)}if(a){let t=this.collisionCircleArrays[e];t===void 0&&(t=this.collisionCircleArrays[e]=new et);for(let e=0;e<a.circles.length;e+=4)t.circles.push(a.circles[e+0]),t.circles.push(a.circles[e+1]),t.circles.push(a.circles[e+2]),t.circles.push(+!!a.collisionDetected)}}markUsedJustification(e,n,r,i){let a;a=i===t.ah.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.at(n)];let o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let t of o)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=a>=0&&t!==a?0:r.crossTileID)}markUsedOrientation(e,n,r){let i=n===t.ah.horizontal||n===t.ah.horizontalOnly?n:0,a=n===t.ah.vertical?n:0,o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let t of o)e.text.placedSymbolArray.get(t).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,i=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],a=i[e];a?(this.opacities[e]=new Qe(a,r,t.text,t.icon),n=n||t.text!==a.text.placed||t.icon!==a.icon.placed):(this.opacities[e]=new Qe(null,r,t.text,t.icon,t.skipFade),n=n||t.text||t.icon)}for(let e in i){let t=i[e];if(!this.opacities[e]){let i=new Qe(t,r,!1,!1);i.isHidden()||(this.opacities[e]=i,n=n||t.text.placed||t.icon.placed)}}for(let e in a)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=a[e]);for(let e in o)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=o[e]);if(t&&t.lastPlacementChangeTime===void 0)throw Error(`Last placement time for previous placement is not defined`);n?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!=`number`&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let n={};for(let r of t){let t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,n,r.collisionBoxArray)}}updateBucketOpacities(e,n,r,i){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let a=e.layers[0],o=a.layout,s=new Qe(null,0,!1,!1,!0),c=o.get(`text-allow-overlap`),l=o.get(`icon-allow-overlap`),u=a._unevaluatedLayout.hasValue(`text-variable-anchor`)||a._unevaluatedLayout.hasValue(`text-variable-anchor-offset`),d=o.get(`text-rotation-alignment`)===`map`,f=o.get(`text-pitch-alignment`)===`map`,p=o.get(`icon-text-fit`)!==`none`,m=new Qe(null,0,c&&(l||!e.hasIconData()||o.get(`icon-optional`)),l&&(c||!e.hasTextData()||o.get(`text-optional`)),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let h=(e,t,n)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(n);e.hasVisibleVertices=e.hasVisibleVertices||n!==ut},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let n=0;n<e.symbolInstances.length;n++){let i=e.symbolInstances.get(n),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:o,crossTileID:c}=i,l=this.opacities[c];r[c]?l=s:l||(l=m,this.opacities[c]=l),r[c]=!0;let _=i.numIconVertices>0,v=this.placedOrientations[i.crossTileID],y=v===t.ah.vertical,b=v===t.ah.horizontal||v===t.ah.horizontalOnly;if(a>0||o>0){let t=lt(l.text);h(e.text,a,y?ut:t),h(e.text,o,b?ut:t);let n=l.text.isHidden();[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=n||y?1:0)})),i.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=n||b?1:0);let r=this.variableOffsets[i.crossTileID];r&&this.markUsedJustification(e,r.anchor,i,v);let s=this.placedOrientations[i.crossTileID];s&&(this.markUsedJustification(e,`left`,i,s),this.markUsedOrientation(e,s,i))}if(_){let t=lt(l.icon),n=!(p&&i.verticalPlacedIconSymbolIndex&&y);i.placedIconSymbolIndex>=0&&(h(e.icon,i.numIconVertices,n?t:ut),e.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=l.icon.isHidden()),i.verticalPlacedIconSymbolIndex>=0&&(h(e.icon,i.numVerticalIconVertices,n?ut:t),e.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=l.icon.isHidden())}let x=g&&g.has(n)?g.get(n):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let r=e.collisionArrays[n];if(r){let n=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){let e=this.variableOffsets[c];e?(n=rt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),d&&n._rotate(f?this.transform.angle:-this.transform.angle)):t=!1}if(r.textBox||r.verticalTextBox){let i;r.textBox&&(i=y),r.verticalTextBox&&(i=b),at(e.textCollisionBox.collisionVertexArray,l.text.placed,!t||i,x.text,n.x,n.y)}}if(r.iconBox||r.verticalIconBox){let t=!!(!b&&r.verticalIconBox),i;r.iconBox&&(i=t),r.verticalIconBox&&(i=!t),at(e.iconCollisionBox.collisionVertexArray,l.icon.placed,i,x.icon,p?n.x:0,p?n.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){let t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let n=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}}function at(e,t,n,r,i,a){r&&r.length!==0||(r=[0,0,0,0]);let o=r[0]-100,s=r[1]-100,c=r[2]-100,l=r[3]-100;e.emplaceBack(+!!t,+!!n,i||0,a||0,o,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,l),e.emplaceBack(+!!t,+!!n,i||0,a||0,o,l)}let B=2**25,ot=2**24,st=2**17,ct=2**16;function lt(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=+!!e.placed,n=Math.floor(127*e.opacity);return n*B+t*ot+n*st+t*ct+n*512+t*256+n*2+t}let ut=0;function dt(){return{isOccluded:(e,t,n)=>!1,getPitchedTextCorrection:(e,t,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(e,t,n,r){throw Error(`Not implemented.`)},translatePosition:(e,t,n,r)=>function(e,t,n,r,i=!1){if(!n[0]&&!n[1])return[0,0];let a=i?r===`map`?e.angle:0:r===`viewport`?-e.angle:0;if(a){let e=Math.sin(a),t=Math.cos(a);n=[n[0]*t-n[1]*e,n[0]*e+n[1]*t]}return[i?n[0]:Xe(t,n[0],e.zoom),i?n[1]:Xe(t,n[1],e.zoom)]}(e,t,n,r),getCircleRadiusCorrection:e=>1}}class ft{constructor(e){this._sortAcrossTiles=e.layout.get(`symbol-z-order`)!==`viewport-y`&&!e.layout.get(`symbol-sort-key`).isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,r,i){let a=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(a,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,i())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<a.length;)if(t.placeLayerBucketPart(a[this._currentPartIndex],this._seenCrossTileIDs,n),this._currentPartIndex++,i())return!0;return!1}}class pt{constructor(e,t,n,r,i,a,o,s){this.placement=new it(e,dt(),t,a,o,s),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=i,this._done=!1}isDone(){return this._done}continuePlacement(e,t,n){let r=a.now(),i=()=>!this._forceFullPlacement&&a.now()-r>2;for(;this._currentPlacementIndex>=0;){let r=t[e[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if(r.type===`symbol`&&(!r.minzoom||r.minzoom<=a)&&(!r.maxzoom||r.maxzoom>a)){if(this._inProgressLayer||=new ft(r),this._inProgressLayer.continuePlacement(n[r.source],this.placement,this._showCollisionBoxes,r,i))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let mt=512/t.X/2;class ht{constructor(e,n,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let i=new Map;for(let e=0;e<n.length;e++){let t=n.get(e),r=t.key,a=i.get(r);a?a.push(t):i.set(r,[t])}for(let[e,n]of i){let r={positions:n.map((e=>({x:Math.floor(e.anchorX*mt),y:Math.floor(e.anchorY*mt)}))),crossTileIDs:n.map((e=>e.crossTileID))};if(r.positions.length>128){let e=new t.av(r.positions.length,16,Uint16Array);for(let{x:t,y:n}of r.positions)e.add(t,n);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,n){let{x:r,y:i,z:a}=this.tileID.canonical,{x:o,y:s,z:c}=n.canonical,l=mt/2**(c-a),u=(s*t.X+e.anchorY)*l,d=i*t.X*mt;return{x:Math.floor((o*t.X+e.anchorX)*l-r*t.X*mt),y:Math.floor(u-d)}}findMatches(e,t,n){let r=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let i=0;i<e.length;i++){let a=e.get(i);if(a.crossTileID)continue;let o=this._symbolsByKey[a.key];if(!o)continue;let s=this.getScaledCoordinates(a,t);if(o.index){let e=o.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(let t of e){let e=o.crossTileIDs[t];if(!n[e]){n[e]=!0,a.crossTileID=e;break}}}else if(o.positions)for(let e=0;e<o.positions.length;e++){let t=o.positions[e],i=o.crossTileIDs[e];if(Math.abs(t.x-s.x)<=r&&Math.abs(t.y-s.y)<=r&&!n[i]){n[i]=!0,a.crossTileID=i;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class gt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class _t{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let e in this.indexes){let n=this.indexes[e],r={};for(let e in n){let i=n[e];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+t),r[i.tileID.key]=i}this.indexes[e]=r}this.lng=e}addBucket(e,t,n){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let r=this.usedCrossTileIDs[e.overscaledZ];for(let n in this.indexes){let i=this.indexes[n];if(Number(n)>e.overscaledZ)for(let n in i){let a=i[n];a.tileID.isChildOf(e)&&a.findMatches(t.symbolInstances,e,r)}else{let a=i[e.scaledTo(Number(n)).key];a&&a.findMatches(t.symbolInstances,e,r)}}for(let e=0;e<t.symbolInstances.length;e++){let i=t.symbolInstances.get(e);i.crossTileID||(i.crossTileID=n.generate(),r[i.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ht(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let n of t.getCrossTileIDsLists())for(let t of n)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let n in this.indexes){let r=this.indexes[n];for(let i in r)e[r[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,r[i]),delete r[i],t=!0)}return t}}class vt{constructor(){this.layerIndexes={},this.crossTileIDs=new gt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new _t);let i=!1,a={};r.handleWrapJump(n);for(let n of t){let t=n.getBucket(e);t&&e.id===t.layerIds[0]&&(t.bucketInstanceId||=++this.maxBucketInstanceId,r.addBucket(n.tileID,t,this.crossTileIDs)&&(i=!0),a[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(i=!0),i}pruneUnusedLayers(e){let t={};e.forEach((e=>{t[e]=!0}));for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}let yt=(e,n)=>t.t(e,n&&n.filter((e=>e.identifier!==`source.canvas`))),bt=t.aw();class xt extends t.E{constructor(e,n={}){super(),this._rtlPluginLoaded=()=>{for(let e in this.sourceCaches){let t=this.sourceCaches[e].getSource().type;t!==`vector`&&t!==`geojson`||this.sourceCaches[e].reload()}},this.map=e,this.dispatcher=new se(oe(),e._getMapId()),this.dispatcher.registerMessageHandler(`GG`,((e,t)=>this.getGlyphs(e,t))),this.dispatcher.registerMessageHandler(`GI`,((e,t)=>this.getImages(e,t))),this.imageManager=new C,this.imageManager.setEventedParent(this),this.glyphManager=new D(e._requestManager,n.localIdeographFontFamily),this.lineAtlas=new M(256,512),this.crossTileSymbolIndex=new vt,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast(`SR`,t.ay()),Te().on(F,this._rtlPluginLoaded),this.on(`data`,(e=>{if(e.dataType!==`source`||e.sourceDataType!==`metadata`)return;let t=this.sourceCaches[e.sourceId];if(!t)return;let n=t.getSource();if(n&&n.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===n.id&&this._validateLayer(t)}}))}loadURL(e,n={},r){this.fire(new t.k(`dataloading`,{dataType:`style`})),n.validate=typeof n.validate!=`boolean`||n.validate;let i=this.map._requestManager.transformRequest(e,`Style`);this._loadStyleRequest=new AbortController;let a=this._loadStyleRequest;t.h(i,this._loadStyleRequest).then((e=>{this._loadStyleRequest=null,this._load(e.data,n,r)})).catch((e=>{this._loadStyleRequest=null,e&&!a.signal.aborted&&this.fire(new t.j(e))}))}loadJSON(e,n={},r){this.fire(new t.k(`dataloading`,{dataType:`style`})),this._frameRequest=new AbortController,a.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,n.validate=!1!==n.validate,this._load(e,n,r)})).catch((()=>{}))}loadEmpty(){this.fire(new t.k(`dataloading`,{dataType:`style`})),this._load(bt,{validate:!1})}_load(e,n,r){let i=n.transformStyle?n.transformStyle(r,e):e;if(!n.validate||!yt(this,t.u(i))){this._loaded=!0,this.stylesheet=i;for(let e in i.sources)this.addSource(e,i.sources[e],{validate:!1});i.sprite?this._loadSprite(i.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(i.glyphs),this._createLayers(),this.light=new A(this.stylesheet.light),this.sky=new ee(this.stylesheet.sky),this.map.setTerrain(this.stylesheet.terrain??null),this.fire(new t.k(`data`,{dataType:`style`})),this.fire(new t.k(`style.load`))}}_createLayers(){let e=t.az(this.stylesheet.layers);this.dispatcher.broadcast(`SL`,e),this._order=e.map((e=>e.id)),this._layers={},this._serializedLayers=null;for(let n of e){let e=t.aA(n);e.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=e}}_loadSprite(e,n=!1,r=void 0){let i;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(e,n,r,i){return t._(this,void 0,void 0,(function*(){let o=y(e),s=r>1?`@2x`:``,c={},l={};for(let{id:e,url:r}of o){let a=n.transformRequest(b(r,s,`.json`),`SpriteJSON`);c[e]=t.h(a,i);let o=n.transformRequest(b(r,s,`.png`),`SpriteImage`);l[e]=p.getImage(o,i)}return yield Promise.all([...Object.values(c),...Object.values(l)]),function(e,n){return t._(this,void 0,void 0,(function*(){let t={};for(let r in e){t[r]={};let i=a.getImageCanvasContext((yield n[r]).data),o=(yield e[r]).data;for(let e in o){let{width:n,height:a,x:s,y:c,sdf:l,pixelRatio:u,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:h}=o[e];t[r][e]={data:null,pixelRatio:u,sdf:l,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:h,spriteData:{width:n,height:a,x:s,y:c,context:i}}}}return t}))}(c,l)}))}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((e=>{if(this._spriteRequest=null,e)for(let t in e){this._spritesImagesIds[t]=[];let r=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in e))):[];for(let e of r)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(let r in e[t]){let i=t==="default"?r:`${t}:${r}`;this._spritesImagesIds[t].push(i),i in this.imageManager.images?this.imageManager.updateImage(i,e[t][r],!1):this.imageManager.addImage(i,e[t][r]),n&&(this._changedImages[i]=!0)}}})).catch((e=>{this._spriteRequest=null,i=e,this.fire(new t.j(i))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.k(`data`,{dataType:`style`})),r&&r(i)}))}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.k(`data`,{dataType:`style`}))}_validateLayer(e){let n=this.sourceCaches[e.source];if(!n)return;let r=e.sourceLayer;if(!r)return;let i=n.getSource();(i.type===`geojson`||i.vectorLayerIds&&i.vectorLayerIds.indexOf(r)===-1)&&this.fire(new t.j(Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,n=!1){let r=this._serializedAllLayers();if(!e||e.length===0)return Object.values(n?t.aB(r):r);let i=[];for(let a of e)if(r[a]){let e=n?t.aB(r[a]):r[a];i.push(e)}return i}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let n of t){let t=this._layers[n];t.type!==`custom`&&(e[n]=t.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error(`Style is not done loading.`)}update(e){if(!this._loaded)return;let n=this._changed;if(n){let t=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(t.length||n.length)&&this._updateWorkerLayers(t,n);for(let e in this._updatedSources){let t=this._updatedSources[e];if(t===`reload`)this._reloadSource(e);else{if(t!==`clear`)throw Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let r={};for(let e in this.sourceCaches){let t=this.sourceCaches[e];r[e]=t.used,t.used=!1}for(let t of this._order){let n=this._layers[t];n.recalculate(e,this._availableImages),!n.isHidden(e.zoom)&&n.source&&(this.sourceCaches[n.source].used=!0)}for(let e in r){let n=this.sourceCaches[e];!!r[e]!=!!n.used&&n.fire(new t.k(`data`,{sourceDataType:`visibility`,dataType:`source`,sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,n&&this.fire(new t.k(`data`,{dataType:`style`}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies([`icons`,`patterns`],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies([`glyphs`],[``]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast(`UL`,{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){var r;this._checkLoaded();let i=this.serialize();if(e=n.transformStyle?n.transformStyle(i,e):e,((r=n.validate)==null||r)&&yt(this,t.u(e)))return!1;(e=t.aB(e)).layers=t.az(e.layers);let a=t.aC(i,e),o=this._getOperationsToPerform(a);if(o.unimplemented.length>0)throw Error(`Unimplemented: ${o.unimplemented.join(`, `)}.`);if(o.operations.length===0)return!1;for(let e of o.operations)e();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let t=[],n=[];for(let r of e)switch(r.command){case`setCenter`:case`setZoom`:case`setBearing`:case`setPitch`:continue;case`addLayer`:t.push((()=>this.addLayer.apply(this,r.args)));break;case`removeLayer`:t.push((()=>this.removeLayer.apply(this,r.args)));break;case`setPaintProperty`:t.push((()=>this.setPaintProperty.apply(this,r.args)));break;case`setLayoutProperty`:t.push((()=>this.setLayoutProperty.apply(this,r.args)));break;case`setFilter`:t.push((()=>this.setFilter.apply(this,r.args)));break;case`addSource`:t.push((()=>this.addSource.apply(this,r.args)));break;case`removeSource`:t.push((()=>this.removeSource.apply(this,r.args)));break;case`setLayerZoomRange`:t.push((()=>this.setLayerZoomRange.apply(this,r.args)));break;case`setLight`:t.push((()=>this.setLight.apply(this,r.args)));break;case`setGeoJSONSourceData`:t.push((()=>this.setGeoJSONSourceData.apply(this,r.args)));break;case`setGlyphs`:t.push((()=>this.setGlyphs.apply(this,r.args)));break;case`setSprite`:t.push((()=>this.setSprite.apply(this,r.args)));break;case`setSky`:t.push((()=>this.setSky.apply(this,r.args)));break;case`setTerrain`:t.push((()=>this.map.setTerrain.apply(this,r.args)));break;case`setTransition`:t.push((()=>{}));break;default:n.push(r.command)}return{operations:t,unimplemented:n}}addImage(e,n){if(this.getImage(e))return this.fire(new t.j(Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new t.j(Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.k(`data`,{dataType:`style`}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,r={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw Error(`Source "${e}" already exists.`);if(!n.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(`, `)}.`);if([`vector`,`raster`,`geojson`,`video`,`image`].indexOf(n.type)>=0&&this._validate(t.u.source,`sources.${e}`,n,null,r))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let i=this.sourceCaches[e]=new R(e,n,this.dispatcher);i.style=this,i.setEventedParent(this,(()=>({isSourceLoaded:i.loaded(),source:i.serialize(),sourceId:e}))),i.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw Error(`There is no source with this ID`);for(let n in this._layers)if(this._layers[n].source===e)return this.fire(new t.j(Error(`Source "${e}" cannot be removed while layer "${n}" is using it.`)));let n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.k(`data`,{sourceDataType:`metadata`,dataType:`source`,sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw Error(`There is no source with this ID=${e}`);let n=this.sourceCaches[e].getSource();if(n.type!==`geojson`)throw Error(`geojsonSource.type is ${n.type}, which is !== 'geojson`);n.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,n,r={}){this._checkLoaded();let i=e.id;if(this.getLayer(i))return void this.fire(new t.j(Error(`Layer "${i}" already exists on this map.`)));let a;if(e.type===`custom`){if(yt(this,t.aD(e)))return;a=t.aA(e)}else{if(`source`in e&&typeof e.source==`object`&&(this.addSource(i,e.source),e=t.aB(e),e=t.e(e,{source:i})),this._validate(t.u.layer,`layers.${i}`,e,{arrayIndex:-1},r))return;a=t.aA(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:i}})}let o=n?this._order.indexOf(n):this._order.length;if(n&&o===-1)this.fire(new t.j(Error(`Cannot add layer "${i}" before non-existing layer "${n}".`)));else{if(this._order.splice(o,0,i),this._layerOrderChanged=!0,this._layers[i]=a,this._removedLayers[i]&&a.source&&a.type!==`custom`){let e=this._removedLayers[i];delete this._removedLayers[i],e.type===a.type?(this._updatedSources[a.source]=`reload`,this.sourceCaches[a.source].pause()):this._updatedSources[a.source]=`clear`}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.j(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;let r=this._order.indexOf(e);this._order.splice(r,1);let i=n?this._order.indexOf(n):this._order.length;n&&i===-1?this.fire(new t.j(Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let n=this._layers[e];if(!n)return void this.fire(new t.j(Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,r){this._checkLoaded();let i=this.getLayer(e);i?i.minzoom===n&&i.maxzoom===r||(n!=null&&(i.minzoom=n),r!=null&&(i.maxzoom=r),this._updateLayer(i)):this.fire(new t.j(Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,r={}){this._checkLoaded();let i=this.getLayer(e);if(i){if(!t.aE(i.filter,n))return n==null?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.u.filter,`layers.${i.id}.filter`,n,null,r)||(i.filter=t.aB(n),this._updateLayer(i)))}else this.fire(new t.j(Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.aB(this.getLayer(e).filter)}setLayoutProperty(e,n,r,i={}){this._checkLoaded();let a=this.getLayer(e);a?t.aE(a.getLayoutProperty(n),r)||(a.setLayoutProperty(n,r,i),this._updateLayer(a)):this.fire(new t.j(Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){let r=this.getLayer(e);if(r)return r.getLayoutProperty(n);this.fire(new t.j(Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,r,i={}){this._checkLoaded();let a=this.getLayer(e);a?t.aE(a.getPaintProperty(n),r)||(a.setPaintProperty(n,r,i)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new t.j(Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,n){this._checkLoaded();let r=e.source,i=e.sourceLayer,a=this.sourceCaches[r];if(a===void 0)return void this.fire(new t.j(Error(`The source '${r}' does not exist in the map's style.`)));let o=a.getSource().type;o===`geojson`&&i?this.fire(new t.j(Error(`GeoJSON sources cannot have a sourceLayer parameter.`))):o!==`vector`||i?(e.id===void 0&&this.fire(new t.j(Error(`The feature id parameter must be provided.`))),a.setFeatureState(i,e.id,n)):this.fire(new t.j(Error(`The sourceLayer parameter must be provided for vector source types.`)))}removeFeatureState(e,n){this._checkLoaded();let r=e.source,i=this.sourceCaches[r];if(i===void 0)return void this.fire(new t.j(Error(`The source '${r}' does not exist in the map's style.`)));let a=i.getSource().type,o=a===`vector`?e.sourceLayer:void 0;a!==`vector`||o?n&&typeof e.id!=`string`&&typeof e.id!=`number`?this.fire(new t.j(Error(`A feature id is required to remove its specific state property.`))):i.removeFeatureState(o,e.id,n):this.fire(new t.j(Error(`The sourceLayer parameter must be provided for vector source types.`)))}getFeatureState(e){this._checkLoaded();let n=e.source,r=e.sourceLayer,i=this.sourceCaches[n];if(i!==void 0)return i.getSource().type!==`vector`||r?(e.id===void 0&&this.fire(new t.j(Error(`The feature id parameter must be provided.`))),i.getFeatureState(r,e.id)):void this.fire(new t.j(Error(`The sourceLayer parameter must be provided for vector source types.`)));this.fire(new t.j(Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=t.aF(this.sourceCaches,(e=>e.serialize())),n=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,i=this.stylesheet;return t.aG({version:i.version,name:i.name,metadata:i.metadata,light:i.light,sky:i.sky,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,transition:i.transition,sources:e,layers:n,terrain:r},(e=>e!==void 0))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!==`raster`&&(this._updatedSources[e.source]=`reload`,this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=e=>this._layers[e].type===`fill-extrusion`,n={},r=[];for(let i=this._order.length-1;i>=0;i--){let a=this._order[i];if(t(a)){n[a]=i;for(let t of e){let e=t[a];if(e)for(let t of e)r.push(t)}}}r.sort(((e,t)=>t.intersectionZ-e.intersectionZ));let i=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o))for(let e=r.length-1;e>=0;e--){let t=r[e].feature;if(n[t.layer.id]<a)break;i.push(t),r.pop()}else for(let t of e){let e=t[o];if(e)for(let t of e)i.push(t.feature)}}return i}queryRenderedFeatures(e,n,r){n&&n.filter&&this._validate(t.u.filter,`queryRenderedFeatures.filter`,n.filter,null,n);let i={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new t.j(Error(`parameters.layers must be an Array.`))),[];for(let e of n.layers){let n=this._layers[e];if(!n)return this.fire(new t.j(Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];i[n.source]=!0}}let a=[];n.availableImages=this._availableImages;let o=this._serializedAllLayers();for(let t in this.sourceCaches)n.layers&&!i[t]||a.push(ue(this.sourceCaches[t],this._layers,o,e,n,r));return this.placement&&a.push(function(e,t,n,r,i,a,o){let s={},c=a.queryRenderedSymbols(r),l=[];for(let e of Object.keys(c).map(Number))l.push(o[e]);l.sort(de);for(let n of l){let r=n.featureIndex.lookupSymbolFeatures(c[n.bucketInstanceId],t,n.bucketIndex,n.sourceLayerIndex,i.filter,i.layers,i.availableImages,e);for(let e in r){let t=s[e]=s[e]||[],i=r[e];i.sort(((e,t)=>{let r=n.featureSortOrder;if(r){let n=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex}));for(let e of i)t.push(e)}}for(let t in s)s[t].forEach((r=>{let i=r.feature,a=n[e[t].source].getFeatureState(i.layer[`source-layer`],i.id);i.source=i.layer.source,i.layer[`source-layer`]&&(i.sourceLayer=i.layer[`source-layer`]),i.state=a}));return s}(this._layers,o,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,n){n&&n.filter&&this._validate(t.u.filter,`querySourceFeatures.filter`,n.filter,null,n);let r=this.sourceCaches[e];return r?function(e,t){let n=e.getRenderableIds().map((t=>e.getTileByID(t))),r=[],i={};for(let e=0;e<n.length;e++){let a=n[e],o=a.tileID.canonical.key;i[o]||(i[o]=!0,a.querySourceFeatures(r,t))}return r}(r,n):[]}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();let r=this.light.getLight(),i=!1;for(let n in e)if(!t.aE(e[n],r[n])){i=!0;break}if(!i)return;let o={now:a.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(o)}getSky(){return this.stylesheet?.sky}setSky(e,n={}){let r=this.getSky(),i=!1;if(!e&&!r)return;if(e&&!r)i=!0;else if(!e&&r)i=!0;else for(let n in e)if(!t.aE(e[n],r[n])){i=!0;break}if(!i)return;let o={now:a.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,n),this.sky.updateTransitions(o)}_validate(e,n,r,i,a={}){return(!a||!1!==a.validate)&&yt(this,e.call(t.u,t.e({key:n,style:this.serialize(),value:r,styleSpec:t.v},i)))}_remove(e=!0){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),Te().off(F,this._rtlPluginLoaded);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.sourceCaches){let t=this.sourceCaches[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast(`RM`,void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let t in this.sourceCaches)this.sourceCaches[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,t,n,r,i=!1){let o=!1,s=!1,c={};for(let t of this._order){let n=this._layers[t];if(n.type!==`symbol`)continue;if(!c[n.source]){let e=this.sourceCaches[n.source];c[n.source]=e.getRenderableIds(!0).map((t=>e.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}let r=this.crossTileSymbolIndex.addLayer(n,c[n.source],e.center.lng);o||=r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((i=i||this._layerOrderChanged||n===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.now(),e.zoom))&&(this.pauseablePlacement=new pt(e,this.map.terrain,this._order,i,t,n,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.now()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(let e of this._order){let t=this._layers[e];t.type===`symbol`&&this.placement.updateLayerOpacities(t,c[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,n){return t._(this,void 0,void 0,(function*(){let e=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();let t=this.sourceCaches[n.source];return t&&t.setDependencies(n.tileID.key,n.type,n.icons),e}))}getGlyphs(e,n){return t._(this,void 0,void 0,(function*(){let e=yield this.glyphManager.getGlyphs(n.stacks),t=this.sourceCaches[n.source];return t&&t.setDependencies(n.tileID.key,n.type,[``]),e}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}){this._checkLoaded(),e&&this._validate(t.u.glyphs,`glyphs`,e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,n,r={},i){this._checkLoaded();let a=[{id:e,url:n}],o=[...y(this.stylesheet.sprite),...a];this._validate(t.u.sprite,`sprite`,o,null,r)||(this.stylesheet.sprite=o,this._loadSprite(a,!0,i))}removeSprite(e){this._checkLoaded();let n=y(this.stylesheet.sprite);if(n.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(let t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;n.splice(n.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.k(`data`,{dataType:`style`}))}else this.fire(new t.j(Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return y(this.stylesheet.sprite)}setSprite(e,n={},r){this._checkLoaded(),e&&this._validate(t.u.sprite,`sprite`,e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}}var St=t.Y([{name:`a_pos`,type:`Int16`,components:2}]);let Ct={prelude:V(`#ifdef GL_ES
2
2
  precision mediump float;
3
3
  #else
4
4
  #if !defined(lowp)