mapbox-gl 2.7.0-beta.1 → 2.7.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,2 +1,2 @@
1
- var mapboxgl=function(){"use strict";var t=e;function e(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}e.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},e.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},e.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},e.prototype.solveCurveX=function(t,e){var r,n,i,s,o;for(void 0===e&&(e=1e-6),i=t,o=0;o<8;o++){if(s=this.sampleCurveX(i)-t,Math.abs(s)<e)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i-=s/a}if((i=t)<(r=0))return r;if(i>(n=1))return n;for(;r<n;){if(s=this.sampleCurveX(i),Math.abs(s-t)<e)return i;t>s?r=i:n=i,i=.5*(n-r)+r}return i},e.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var r=n;function n(t,e){this.x=t,this.y=e}n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t};var i,s="undefined"!=typeof self?self:{},o="undefined"!=typeof Float32Array?Float32Array:Array;function a(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function l(t,e,r){var n=r[0],i=r[1],s=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function u(){var t=new o(3);return o!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function c(t){var e=new o(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function h(t,e,r){var n=new o(3);return n[0]=t,n[1]=e,n[2]=r,n}function p(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function f(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*o,t}function d(){var t=new o(4);return o!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function y(t,e){return t[0]===e[0]&&t[1]===e[1]}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),u(),function(){var t;t=new o(4),o!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),u(),h(1,0,0),h(0,1,0),d(),d(),i=new o(9),o!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,function(){var t=new o(2);o!=Float32Array&&(t[0]=0,t[1]=0)}();const m=Math.PI/180,g=180/Math.PI;function x(t){return t*m}function v(t){return t*g}function b(t,e,r){return Math.min(r,Math.max(e,t))}function w(t,e,r){const n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function _(t){const e=[];for(const r in t)e.push(t[r]);return e}function A(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}function S(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function k(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function I(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}function z(t,e){return-1!==t.indexOf(e,t.length-e.length)}function M(t,e,r){const n={};for(const i in t)n[i]=e.call(r||this,t[i],i,t);return n}function P(t){return Array.isArray(t)?t.map(P):"object"==typeof t&&t?M(t,P):t}const C={};function T(t){C[t]||("undefined"!=typeof console&&console.warn(t),C[t]=!0)}function B(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function V(t){let e=0;for(let r,n,i=0,s=t.length,o=s-1;i<s;o=i++)r=t[i],n=t[o],e+=(n.x-r.x)*(r.y+n.y);return e}function E(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function D(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,r,n,i)=>{const s=n||i;return e[r]=!s||s.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}let F=null;function L(t){if(null==F){const e=t.navigator?t.navigator.userAgent:null;F=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return F}function j(t){try{const e=s[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var $=O;function O(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(var s=0;s<this.d*this.d;s++){var o=i[3+s],a=i[3+s+1];n.push(o===a?null:i.subarray(o,a))}var l=i[3+n.length+1];this.keys=i.subarray(i[3+n.length],l),this.bboxes=i.subarray(l),this.insert=this._insertReadonly}else{this.d=e+2*r;for(var u=0;u<this.d*this.d;u++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;var c=r/e*t;this.min=-c,this.max=t+c}function R(t){var e={exports:{}};return t(e,e.exports),e.exports}O.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},O.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},O.prototype._insertCell=function(t,e,r,n,i,s){this.cells[i].push(s)},O.prototype.query=function(t,e,r,n,i){var s=this.min,o=this.max;if(t<=s&&e<=s&&o<=r&&o<=n&&!i)return Array.prototype.slice.call(this.keys);var a=[];return this._forEachCell(t,e,r,n,this._queryCell,a,{},i),a},O.prototype._queryCell=function(t,e,r,n,i,s,o,a){var l=this.cells[i];if(null!==l)for(var u=this.keys,c=this.bboxes,h=0;h<l.length;h++){var p=l[h];if(void 0===o[p]){var f=4*p;(a?a(c[f+0],c[f+1],c[f+2],c[f+3]):t<=c[f+2]&&e<=c[f+3]&&r>=c[f+0]&&n>=c[f+1])?(o[p]=!0,s.push(u[p])):o[p]=!1}}},O.prototype._forEachCell=function(t,e,r,n,i,s,o,a){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n),p=l;p<=c;p++)for(var f=u;f<=h;f++){var d=this.d*f+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(f),this._convertFromCellCoord(p+1),this._convertFromCellCoord(f+1)))&&i.call(this,t,e,r,n,d,s,o,a))return}},O.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},O.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},O.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var i=new Int32Array(e+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;for(var s=e,o=0;o<t.length;o++){var a=t[o];i[3+o]=s,i.set(a,s),s+=a.length}return i[3+t.length]=s,i.set(this.keys,s),i[3+t.length+1]=s+=this.keys.length,i.set(this.bboxes,s),s+=this.bboxes.length,i.buffer};var q=R((function(t,e){var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function n(t){return(t=Math.round(t))<0?0:t>255?255:t}function i(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function s(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function o(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,a=t.replace(/ /g,"").toLowerCase();if(a in r)return r[a].slice();if("#"===a[0])return 4===a.length?(e=parseInt(a.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===a.length&&(e=parseInt(a.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var c=a.substr(0,l),h=a.substr(l+1,u-(l+1)).split(","),p=1;switch(c){case"rgba":if(4!==h.length)return null;p=s(h.pop());case"rgb":return 3!==h.length?null:[i(h[0]),i(h[1]),i(h[2]),p];case"hsla":if(4!==h.length)return null;p=s(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,d=s(h[1]),y=s(h[2]),m=y<=.5?y*(d+1):y+d-y*d,g=2*y-m;return[n(255*o(g,m,f+1/3)),n(255*o(g,m,f)),n(255*o(g,m,f-1/3)),p];default:return null}}return null}}catch(t){}}));class U{constructor(t,e,r,n=1){this.r=t,this.g=e,this.b=r,this.a=n}static parse(t){if(!t)return;if(t instanceof U)return t;if("string"!=typeof t)return;const e=q.parseCSSColor(t);return e?new U(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,r,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(r)},${n})`}toArray(){const{r:t,g:e,b:r,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]}}function N(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}U.black=new U(0,0,0,1),U.white=new U(1,1,1,1),U.transparent=new U(0,0,0,0),U.red=new U(1,0,0,1),U.blue=new U(0,0,1,1);class Z extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class X{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new X(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const G={kind:"null"},Y={kind:"number"},K={kind:"string"},J={kind:"boolean"},H={kind:"color"},W={kind:"object"},Q={kind:"value"},tt={kind:"collator"},et={kind:"formatted"},rt={kind:"resolvedImage"};function nt(t,e){return{kind:"array",itemType:t,N:e}}function it(t){if("array"===t.kind){const e=it(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const st=[G,Y,K,J,H,et,W,nt(Q),rt];function ot(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!ot(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of st)if(!ot(t,e))return null}return`Expected ${it(t)} but found ${it(e)} instead.`}function at(t,e){return e.some((e=>e.kind===t.kind))}function lt(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}class ut{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ct{constructor(t,e,r,n,i){this.text=t.normalize?t.normalize():t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i}}class ht{constructor(t){this.sections=t}static fromString(t){return new ht([new ct(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof ht?t:ht.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const r={};e.fontStack&&(r["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(r["font-scale"]=e.scale),e.textColor&&(r["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(r)}return t}}class pt{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new pt({name:t,available:!1}):null}serialize(){return["image",this.name]}}function ft(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function dt(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof U)return!0;if(t instanceof ut)return!0;if(t instanceof ht)return!0;if(t instanceof pt)return!0;if(Array.isArray(t)){for(const e of t)if(!dt(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!dt(t[e]))return!1;return!0}return!1}function yt(t){if(null===t)return G;if("string"==typeof t)return K;if("boolean"==typeof t)return J;if("number"==typeof t)return Y;if(t instanceof U)return H;if(t instanceof ut)return tt;if(t instanceof ht)return et;if(t instanceof pt)return rt;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=yt(e);if(r){if(r===t)continue;r=Q;break}r=t}return nt(r||Q,e)}return W}function mt(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof U||t instanceof ht||t instanceof pt?t.toString():JSON.stringify(t)}class gt{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!dt(t[1]))return e.error("invalid value");const r=t[1];let n=yt(r);const i=e.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new gt(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof U?["rgba"].concat(this.value.toArray()):this.value instanceof ht?this.value.serialize():this.value}}class xt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const vt={string:K,number:Y,boolean:J,object:W};class bt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in vt)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=vt[r],n++}else i=Q;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=nt(i,s)}else r=vt[i];const s=[];for(;n<t.length;n++){const r=e.parse(t[n],n,Q);if(!r)return null;s.push(r)}return new bt(r,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!ot(this.type,yt(r)))return r;if(e===this.args.length-1)throw new xt(`Expected value to be of type ${it(this.type)}, but found ${it(yt(r))} instead.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const r=t.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){e.push(r.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((t=>t.serialize())))}}class wt{constructor(t){this.type=et,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const s=t[r];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,Y),!t))return null;let r=null;if(s["text-font"]&&(r=e.parse(s["text-font"],1,nt(K)),!r))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,H),!o))return null;const a=n[n.length-1];a.scale=t,a.font=r,a.textColor=o}else{const s=e.parse(t[r],1,Q);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new wt(n)}evaluate(t){return new ht(this.sections.map((e=>{const r=e.content.evaluate(t);return yt(r)===rt?new ct("",r,null,null,null):new ct(mt(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const r={};e.scale&&(r["font-scale"]=e.scale.serialize()),e.font&&(r["text-font"]=e.font.serialize()),e.textColor&&(r["text-color"]=e.textColor.serialize()),t.push(r)}return t}}class _t{constructor(t){this.type=rt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,K);return r?new _t(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=pt.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const At={"to-boolean":J,"to-color":H,"to-number":Y,"to-string":K};class St{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");const n=At[r],i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],r,Q);if(!n)return null;i.push(n)}return new St(n,i)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,r;for(const n of this.args){if(e=n.evaluate(t),r=null,e instanceof U)return e;if("string"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:ft(e[0],e[1],e[2],e[3]),!r))return new U(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new xt(r||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new xt(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?ht.fromString(mt(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?pt.fromString(mt(this.args[0].evaluate(t))):mt(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new wt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new _t(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}const kt=["Unknown","Point","LineString","Polygon"];class It{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?kt[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||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:r,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*e-t[0])+this.featureDistanceData.bearing[1]*(n*e-t[1])}return 0}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=U.parse(t)),e}}class zt{constructor(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const r=t[0],n=zt.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,s]of o){a=new Jt(e.registry,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e<t.length;e++){const r=t[e],i=Array.isArray(n)?n[e-1]:n.type,s=a.parse(r,1+o.length,i);if(!s){l=!0;break}o.push(s)}if(!l)if(Array.isArray(n)&&n.length!==o.length)a.error(`Expected ${n.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=o[t];a.concat(t+1).checkSubtype(e,r.type)}if(0===a.errors.length)return new zt(r,i,s,o)}}if(1===o.length)e.errors.push(...a.errors);else{const r=(o.length?o:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(it).join(", ")})`:`(${it(e.type)}...)`;var e})).join(" | "),n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],1+n.length);if(!i)return null;n.push(it(i.type))}e.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){zt.definitions=e;for(const r in e)t[r]=zt}}class Mt{constructor(t,e,r){this.type=tt,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,J);if(!n)return null;const i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,J);if(!i)return null;let s=null;return r.locale&&(s=e.parse(r.locale,1,K),!s)?null:new Mt(n,i,s)}evaluate(t){return new ut(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const Pt=8192;function Ct(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Tt(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Bt(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*Pt),Math.round(n*i*Pt)]}function Vt(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],o=t[1]-r[1];return n*o-s*i==0&&n*s<=0&&i*o<=0}function Et(t,e){let r=!1;for(let o=0,a=e.length;o<a;o++){const a=e[o];for(let e=0,o=a.length;e<o-1;e++){if(Vt(t,a[e],a[e+1]))return!1;(i=a[e])[1]>(n=t)[1]!=(s=a[e+1])[1]>n[1]&&n[0]<(s[0]-i[0])*(n[1]-i[1])/(s[1]-i[1])+i[0]&&(r=!r)}}var n,i,s;return r}function Dt(t,e){for(let r=0;r<e.length;r++)if(Et(t,e[r]))return!0;return!1}function Ft(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],o=(t[0]-r[0])*s-i*(t[1]-r[1]),a=(e[0]-r[0])*s-i*(e[1]-r[1]);return o>0&&a<0||o<0&&a>0}function Lt(t,e,r){for(const u of r)for(let r=0;r<u.length-1;++r)if(0!=(a=[(o=u[r+1])[0]-(s=u[r])[0],o[1]-s[1]])[0]*(l=[(i=e)[0]-(n=t)[0],i[1]-n[1]])[1]-a[1]*l[0]&&Ft(n,i,s,o)&&Ft(s,o,n,i))return!0;var n,i,s,o,a,l;return!1}function jt(t,e){for(let r=0;r<t.length;++r)if(!Et(t[r],e))return!1;for(let r=0;r<t.length-1;++r)if(Lt(t[r],t[r+1],e))return!1;return!0}function $t(t,e){for(let r=0;r<e.length;r++)if(jt(t,e[r]))return!0;return!1}function Ot(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=[];for(let n=0;n<t[i].length;n++){const o=Bt(t[i][n],r);Ct(e,o),s.push(o)}n.push(s)}return n}function Rt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=Ot(t[i],e,r);n.push(s)}return n}function qt(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i}Ct(e,t)}function Ut(t,e,r,n){const i=Math.pow(2,n.z)*Pt,s=[n.x*Pt,n.y*Pt],o=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];qt(n,e,r,i),o.push(n)}return o}function Nt(t,e,r,n){const i=Math.pow(2,n.z)*Pt,s=[n.x*Pt,n.y*Pt],o=[];for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];Ct(e,r),t.push(r)}o.push(t)}if(e[2]-e[0]<=i/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const n of t)qt(n,e,r,i)}var a;return o}class Zt{constructor(t,e){this.type=J,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(dt(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const r=e.features[t].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new Zt(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Zt(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Zt(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=Ot(e.coordinates,n,i),o=Ut(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of o)if(!Et(t,s))return!1}if("MultiPolygon"===e.type){const s=Rt(e.coordinates,n,i),o=Ut(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of o)if(!Dt(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=Ot(e.coordinates,n,i),o=Nt(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of o)if(!jt(t,s))return!1}if("MultiPolygon"===e.type){const s=Rt(e.coordinates,n,i),o=Nt(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of o)if(!$t(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function Xt(t){if(t instanceof zt){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Zt)return!1;let e=!0;return t.eachChild((t=>{e&&!Xt(t)&&(e=!1)})),e}function Gt(t){if(t instanceof zt&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Gt(t)&&(e=!1)})),e}function Yt(t,e){if(t instanceof zt&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!Yt(t,e)&&(r=!1)})),r}class Kt{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new Kt(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Jt{constructor(t,e=[],r,n=new X,i=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=i,this.expectedType=r}parse(t,e,r,n,i={}){return e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)}_parse(t,e){function r(t,e,r){return"assert"===r?new bt(e,[t]):"coerce"===r?new St(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const i=this.registry[n];if(i){let n=i.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,i=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(t,i))return null}else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"assert")}if(!(n instanceof gt)&&"resolvedImage"!==n.type.kind&&Ht(n)){const t=new It;try{n=new gt(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new Jt(this.registry,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new Z(r,t))}checkSubtype(t,e){const r=ot(t,e);return r&&this.error(r),r}}function Ht(t){if(t instanceof Kt)return Ht(t.boundExpression);if(t instanceof zt&&"error"===t.name)return!1;if(t instanceof Mt)return!1;if(t instanceof Zt)return!1;const e=t instanceof St||t instanceof bt;let r=!0;return t.eachChild((t=>{r=e?r&&Ht(t):r&&t instanceof gt})),!!r&&Xt(t)&&Yt(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function Wt(t,e){const r=t.length-1;let n,i,s=0,o=r,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],i=t[a+1],n<=e){if(a===r||e<i)return a;s=a+1}else{if(!(n>e))throw new xt("Input is not a number.");o=a-1}return 0}class Qt{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,Y);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r<t.length;r+=2){const s=1===r?-1/0:t[r],o=t[r+1],a=r,l=r+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const u=e.parse(o,l,i);if(!u)return null;i=i||u.type,n.push([s,u])}return new Qt(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Wt(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}function te(t,e,r){return t*(1-r)+e*r}var ee=Object.freeze({__proto__:null,number:te,color:function(t,e,r){return new U(te(t.r,e.r,r),te(t.g,e.g,r),te(t.b,e.b,r),te(t.a,e.a,r))},array:function(t,e,r){return t.map(((t,n)=>te(t,e[n],r)))}});const re=.95047,ne=1.08883,ie=4/29,se=6/29,oe=3*se*se,ae=Math.PI/180,le=180/Math.PI;function ue(t){return t>.008856451679035631?Math.pow(t,1/3):t/oe+ie}function ce(t){return t>se?t*t*t:oe*(t-ie)}function he(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function pe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fe(t){const e=pe(t.r),r=pe(t.g),n=pe(t.b),i=ue((.4124564*e+.3575761*r+.1804375*n)/re),s=ue((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-ue((.0193339*e+.119192*r+.9503041*n)/ne)),alpha:t.a}}function de(t){let e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*ce(e),r=re*ce(r),n=ne*ce(n),new U(he(3.2404542*r-1.5371385*e-.4985314*n),he(-.969266*r+1.8760108*e+.041556*n),he(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function ye(t,e,r){const n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const me={forward:fe,reverse:de,interpolate:function(t,e,r){return{l:te(t.l,e.l,r),a:te(t.a,e.a,r),b:te(t.b,e.b,r),alpha:te(t.alpha,e.alpha,r)}}},ge={forward:function(t){const{l:e,a:r,b:n}=fe(t),i=Math.atan2(n,r)*le;return{h:i<0?i+360:i,c:Math.sqrt(r*r+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*ae,r=t.c;return de({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:ye(t.h,e.h,r),c:te(t.c,e.c,r),l:te(t.l,e.l,r),alpha:te(t.alpha,e.alpha,r)}}};var xe=Object.freeze({__proto__:null,lab:me,hcl:ge});class ve{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(e,r,n,i){let s=0;if("exponential"===e.name)s=be(r,e.base,n,i);else if("linear"===e.name)s=be(r,1,n,i);else if("cubic-bezier"===e.name){const o=e.controlPoints;s=new t(o[0],o[1],o[2],o[3]).solve(be(r,1,n,i))}return s}static parse(t,e){let[r,n,i,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,Y),!i)return null;const o=[];let a=null;"interpolate-hcl"===r||"interpolate-lab"===r?a=H:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t<s.length;t+=2){const r=s[t],n=s[t+1],i=t+3,l=t+4;if("number"!=typeof r)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(o.length&&o[o.length-1][0]>=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,a);if(!u)return null;a=a||u.type,o.push([r,u])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new ve(a,r,n,i,o):e.error(`Type ${it(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=Wt(e,n),o=ve.interpolationFactor(this.interpolation,n,e[s],e[s+1]),a=r[s].evaluate(t),l=r[s+1].evaluate(t);return"interpolate"===this.operator?ee[this.type.kind.toLowerCase()](a,l,o):"interpolate-hcl"===this.operator?ge.reverse(ge.interpolate(ge.forward(a),ge.forward(l),o)):me.reverse(me.interpolate(me.forward(a),me.forward(l),o))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)e.push(this.labels[t],this.outputs[t].serialize());return e}}function be(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}class we{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let r=null;const n=e.expectedType;n&&"value"!==n.kind&&(r=n);const i=[];for(const n of t.slice(1)){const t=e.parse(n,1+i.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,i.push(t)}const s=n&&i.some((t=>ot(n,t.type)));return new we(s?Q:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args){if(n++,r=i.evaluate(t),r&&r instanceof pt&&!r.available&&(e||(e=r),r=null,n===this.args.length))return e;if(null!==r)break}return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class _e{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n<t.length-1;n+=2){const i=t[n];if("string"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;r.push([i,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return n?new _e(r,n):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[e,r]of this.bindings)t.push(e,r.serialize());return t.push(this.result.serialize()),t}}class Ae{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Y),n=e.parse(t[2],2,nt(e.expectedType||Q));return r&&n?new Ae(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new xt(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new xt(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new xt(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Se{constructor(t,e){this.type=J,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Q),n=e.parse(t[2],2,Q);return r&&n?at(r.type,[J,K,Y,G,Q])?new Se(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!lt(e,["boolean","string","number","null"]))throw new xt(`Expected first argument to be of type boolean, string, number or null, but found ${it(yt(e))} instead.`);if(!lt(r,["string","array"]))throw new xt(`Expected second argument to be of type array or string, but found ${it(yt(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class ke{constructor(t,e,r){this.type=Y,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Q),n=e.parse(t[2],2,Q);if(!r||!n)return null;if(!at(r.type,[J,K,Y,G,Q]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,Y);return i?new ke(r,n,i):null}return new ke(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!lt(e,["boolean","string","number","null"]))throw new xt(`Expected first argument to be of type boolean, string, number or null, but found ${it(yt(e))} instead.`);if(!lt(r,["string","array"]))throw new xt(`Expected second argument to be of type array or string, but found ${it(yt(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Ie{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const l=t[o+1];Array.isArray(a)||(a=[a]);const u=e.concat(o);if(0===a.length)return u.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,yt(t)))return null}else r=yt(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length}const c=e.parse(l,o,n);if(!c)return null;n=n||c.type,s.push(c)}const o=e.parse(t[1],1,Q);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(r,o.type)?null:new Ie(r,n,o,i,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(yt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),r=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=r.length,r.push([this.cases[t],[t]])):r[e][1].push(t)}const i=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of r)t.push(1===n.length?i(n[0]):n.map(i)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class ze{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;i<t.length-1;i+=2){const s=e.parse(t[i],i,J);if(!s)return null;const o=e.parse(t[i+1],i+1,r);if(!o)return null;n.push([s,o]),r=r||o.type}const i=e.parse(t[t.length-1],t.length-1,r);return i?new ze(r,n,i):null}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class Me{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Q),n=e.parse(t[2],2,Y);if(!r||!n)return null;if(!at(r.type,[nt(Q),K,Q]))return e.error(`Expected first argument to be of type array or string, but found ${it(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,Y);return i?new Me(r.type,r,n,i):null}return new Me(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!lt(e,["string","array"]))throw new xt(`Expected first argument to be of type array or string, but found ${it(yt(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function Pe(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Ce(t,e,r,n){return 0===n.compare(e,r)}function Te(t,e,r){const n="=="!==t&&"!="!==t;return class i{constructor(t,e,r){this.type=J,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let s=e.parse(t[1],1,Q);if(!s)return null;if(!Pe(r,s.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${it(s.type)}'.`);let o=e.parse(t[2],2,Q);if(!o)return null;if(!Pe(r,o.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${it(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${it(s.type)}' and '${it(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new bt(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new bt(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,tt),!a)return null}return new i(s,o,a)}evaluate(i){const s=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=yt(s),r=yt(o);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new xt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=yt(s),r=yt(o);if("string"!==t.kind||"string"!==r.kind)return e(i,s,o)}return this.collator?r(i,s,o,this.collator.evaluate(i)):e(i,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const Be=Te("==",(function(t,e,r){return e===r}),Ce),Ve=Te("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!Ce(0,e,r,n)})),Ee=Te("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),De=Te(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),Fe=Te("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Le=Te(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class je{constructor(t,e,r,n,i){this.type=K,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,Y);if(!r)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=e.parse(n.locale,1,K),!i))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,K),!s))return null;let o=null;if(n["min-fraction-digits"]&&(o=e.parse(n["min-fraction-digits"],1,Y),!o))return null;let a=null;return n["max-fraction-digits"]&&(a=e.parse(n["max-fraction-digits"],1,Y),!a)?null:new je(r,i,s,o,a)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class $e{constructor(t){this.type=Y,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${it(r.type)} instead.`):new $e(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new xt(`Expected value to be of type string or array, but found ${it(yt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const Oe={"==":Be,"!=":Ve,">":De,"<":Ee,">=":Le,"<=":Fe,array:bt,at:Ae,boolean:bt,case:ze,coalesce:we,collator:Mt,format:wt,image:_t,in:Se,"index-of":ke,interpolate:ve,"interpolate-hcl":ve,"interpolate-lab":ve,length:$e,let:_e,literal:gt,match:Ie,number:bt,"number-format":je,object:bt,slice:Me,step:Qt,string:bt,"to-boolean":St,"to-color":St,"to-number":St,"to-string":St,var:Kt,within:Zt};function Re(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,o=ft(e,r,n,s);if(o)throw new xt(o);return new U(e/255*s,r/255*s,n/255*s,s)}function qe(t,e){return t in e}function Ue(t,e){const r=e[t];return void 0===r?null:r}function Ne(t){return{type:t}}function Ze(t){return{result:"success",value:t}}function Xe(t){return{result:"error",value:t}}function Ge(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Ye(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Ke(t){return!!t.expression&&t.expression.interpolated}function Je(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function He(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function We(t){return t}function Qe(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(Ke(e)?"exponential":"interval");if(r&&((t=N({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],U.parse(t[1])]))),t.default=U.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!xe[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let o,a,l;if("exponential"===s)o=nr;else if("interval"===s)o=rr;else if("categorical"===s){o=er,a=Object.create(null);for(const e of t.stops)a[e[0]]=e[1];l=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);o=ir}if(n){const r={},n=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],s=i[0].zoom;void 0===r[s]&&(r[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},n.push(s)),r[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of n)i.push([r[t].zoom,Qe(r[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:ve.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>nr({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:ve.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>o(t,e,r,a,l)}}return{kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?tr(t.default,e.default):o(t,e,i,a,l)}}}function tr(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function er(t,e,r,n,i){return tr(typeof r===i?n[r]:void 0,t.default,e.default)}function rr(t,e,r){if("number"!==Je(r))return tr(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=Wt(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function nr(t,e,r){const n=void 0!==t.base?t.base:1;if("number"!==Je(r))return tr(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const s=Wt(t.stops.map((t=>t[0])),r),o=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),a=t.stops[s][1],l=t.stops[s+1][1];let u=ee[e.type]||We;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=xe[t.colorSpace];u=(t,r)=>e.reverse(e.interpolate(e.forward(t),e.forward(r),o))}return"function"==typeof a.evaluate?{evaluate(...t){const e=a.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==r)return u(e,r,o)}}:u(a,l,o)}function ir(t,e,r){return"color"===e.type?r=U.parse(r):"formatted"===e.type?r=ht.fromString(r.toString()):"resolvedImage"===e.type?r=pt.fromString(r.toString()):Je(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),tr(r,t.default,e.default)}zt.register(Oe,{error:[{kind:"error"},[K],(t,[e])=>{throw new xt(e.evaluate(t))}],typeof:[K,[Q],(t,[e])=>it(yt(e.evaluate(t)))],"to-rgba":[nt(Y,4),[H],(t,[e])=>e.evaluate(t).toArray()],rgb:[H,[Y,Y,Y],Re],rgba:[H,[Y,Y,Y,Y],Re],has:{type:J,overloads:[[[K],(t,[e])=>qe(e.evaluate(t),t.properties())],[[K,W],(t,[e,r])=>qe(e.evaluate(t),r.evaluate(t))]]},get:{type:Q,overloads:[[[K],(t,[e])=>Ue(e.evaluate(t),t.properties())],[[K,W],(t,[e,r])=>Ue(e.evaluate(t),r.evaluate(t))]]},"feature-state":[Q,[K],(t,[e])=>Ue(e.evaluate(t),t.featureState||{})],properties:[W,[],t=>t.properties()],"geometry-type":[K,[],t=>t.geometryType()],id:[Q,[],t=>t.id()],zoom:[Y,[],t=>t.globals.zoom],pitch:[Y,[],t=>t.globals.pitch||0],"distance-from-center":[Y,[],t=>t.distanceFromCenter()],"heatmap-density":[Y,[],t=>t.globals.heatmapDensity||0],"line-progress":[Y,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[Y,[],t=>t.globals.skyRadialProgress||0],accumulated:[Q,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Y,Ne(Y),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[Y,Ne(Y),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:Y,overloads:[[[Y,Y],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[Y],(t,[e])=>-e.evaluate(t)]]},"/":[Y,[Y,Y],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[Y,[Y,Y],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[Y,[],()=>Math.LN2],pi:[Y,[],()=>Math.PI],e:[Y,[],()=>Math.E],"^":[Y,[Y,Y],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[Y,[Y],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Y,[Y],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Y,[Y],(t,[e])=>Math.log(e.evaluate(t))],log2:[Y,[Y],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Y,[Y],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Y,[Y],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Y,[Y],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Y,[Y],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Y,[Y],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Y,[Y],(t,[e])=>Math.atan(e.evaluate(t))],min:[Y,Ne(Y),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[Y,Ne(Y),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[Y,[Y],(t,[e])=>Math.abs(e.evaluate(t))],round:[Y,[Y],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[Y,[Y],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Y,[Y],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[J,[K,Q],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[J,[Q],(t,[e])=>t.id()===e.value],"filter-type-==":[J,[K],(t,[e])=>t.geometryType()===e.value],"filter-<":[J,[K,Q],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[J,[Q],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[J,[K,Q],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[J,[Q],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[J,[K,Q],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[J,[Q],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[J,[K,Q],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[J,[Q],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[J,[Q],(t,[e])=>e.value in t.properties()],"filter-has-id":[J,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[J,[nt(K)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[J,[nt(Q)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[J,[K,nt(Q)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[J,[K,nt(Q)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:J,overloads:[[[J,J],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Ne(J),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:J,overloads:[[[J,J],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Ne(J),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[J,[J],(t,[e])=>!e.evaluate(t)],"is-supported-script":[J,[K],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[K,[K],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[K,[K],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[K,Ne(Q),(t,e)=>e.map((e=>mt(e.evaluate(t)))).join("")],"resolved-locale":[K,[tt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class sr{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new It,this._defaultValue=e?function(t){return"color"===t.type&&He(t.default)?new U(0,0,0,0):"color"===t.type?U.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,r,n,i,s,o,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s,o,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new xt(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function or(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Oe}function ar(t,e){const r=new Jt(Oe,[],e?function(t){const e={color:H,string:K,number:Y,enum:K,boolean:J,formatted:et,resolvedImage:rt};return"array"===t.type?nt(e[t.value]||Q,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Ze(new sr(n,e)):Xe(r.errors)}class lr{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Gt(e.expression)}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}}class ur{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Gt(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?ve.interpolationFactor(this.interpolationType,t,e,r):0}}function cr(t,e){if("error"===(t=ar(t,e)).result)return t;const r=t.value.expression,n=Xt(r);if(!n&&!Ge(e))return Xe([new Z("","data expressions not supported")]);const i=Yt(r,["zoom","pitch","distance-from-center"]);if(!i&&!Ye(e))return Xe([new Z("","zoom expressions not supported")]);const s=pr(r);return s||i?s instanceof Z?Xe([s]):s instanceof ve&&!Ke(e)?Xe([new Z("",'"interpolate" expressions cannot be used with this property')]):Ze(s?new ur(n?"camera":"composite",t.value,s.labels,s instanceof ve?s.interpolation:void 0):new lr(n?"constant":"source",t.value)):Xe([new Z("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class hr{constructor(t,e){this._parameters=t,this._specification=e,N(this,Qe(this._parameters,this._specification))}static deserialize(t){return new hr(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function pr(t){let e=null;if(t instanceof _e)e=pr(t.result);else if(t instanceof we){for(const r of t.args)if(e=pr(r),e)break}else(t instanceof Qt||t instanceof ve)&&t.input instanceof zt&&"zoom"===t.input.name&&(e=t);return e instanceof Z||t.eachChild((t=>{const r=pr(t);r instanceof Z?e=r:!e&&r?e=new Z("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new Z("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}const{ImageData:fr,ImageBitmap:dr}=s,yr={};function mr(t,e,r={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),yr[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}mr("Object",Object),$.serialize=function(t,e){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}},$.deserialize=function(t){return new $(t.buffer)},mr("Grid",$),mr("Color",U),mr("Error",Error),mr("ResolvedImage",pt),mr("StylePropertyFunction",hr),mr("StyleExpression",sr,{omit:["_evaluator"]}),mr("ZoomDependentExpression",ur),mr("ZoomConstantExpression",lr),mr("CompoundExpression",zt,{omit:["_evaluate"]});for(const t in Oe)Oe[t]._classRegistryKey||mr(`Expression_${t}`,Oe[t]);function gr(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function xr(t){return dr&&t instanceof dr}function vr(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(gr(t)||xr(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const r=t;return e&&e.push(r.buffer),r}if(t instanceof fr)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(vr(n,e));return r}if("object"==typeof t){const r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error("can't serialize object of unregistered class");const i=r.serialize?r.serialize(t,e):{};if(!r.serialize){for(const r in t){if(!t.hasOwnProperty(r))continue;if(yr[n].omit.indexOf(r)>=0)continue;const s=t[r];i[r]=yr[n].shallow.indexOf(r)>=0?s:vr(s,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(i.$name=n),i}throw new Error("can't serialize object of type "+typeof t)}function br(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||gr(t)||xr(t)||ArrayBuffer.isView(t)||t instanceof fr)return t;if(Array.isArray(t))return t.map(br);if("object"==typeof t){const e=t.$name||"Object",{klass:r}=yr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const r of Object.keys(t)){if("$name"===r)continue;const i=t[r];n[r]=yr[e].shallow.indexOf(r)>=0?i:br(i)}return n}throw new Error("can't deserialize object of type "+typeof t)}class wr{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){delete this._channel,this._callback=()=>{}}}const _r=s.performance;function Ar(t){const e=t?t.url.toString():void 0;return _r.getEntriesByName(e)}class Sr{constructor(){this.tasks={},this.taskQueue=[],I(["process"],this),this.invoker=new wr(this.process),this.nextId=0}add(t,e){const r=this.nextId++,n=function({type:t,isSymbolTile:e,zoom:r}){return r=r||0,"message"===t?0:"maybePrepare"!==t||e?"parseTile"!==t||e?"parseTile"===t&&e?300-r:"maybePrepare"===t&&e?400-r:500:200-r:100-r}(e);if(0===n){E();try{t()}finally{}return{cancel:()=>{}}}return this.tasks[r]={fn:t,metadata:e,priority:n,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}}}process(){E();try{if(this.taskQueue=this.taskQueue.filter((t=>!!this.tasks[t])),!this.taskQueue.length)return;const t=this.pick();if(null===t)return;const e=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),!e)return;e.fn()}finally{}}pick(){let t=null,e=1/0;for(let r=0;r<this.taskQueue.length;r++){const n=this.tasks[this.taskQueue[r]];n.priority<e&&(e=n.priority,t=r)}if(null===t)return null;const r=this.taskQueue[t];return this.taskQueue.splice(t,1),r}remove(){this.invoker.remove()}}class kr{constructor(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.cancelCallbacks={},I(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=E()?t:s,this.scheduler=new Sr}send(t,e,r,n,i=!1,s){const o=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=s,this.callbacks[o]=r);const a=L(this.globalScope)?void 0:[];return this.target.postMessage({id:o,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:vr(e,a)},a),{cancel:()=>{r&&delete this.callbacks[o],this.target.postMessage({id:o,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(t){const e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t.cancel()}else if(e.mustQueue||E()){const t=this.callbacks[r];this.cancelCallbacks[r]=this.scheduler.add((()=>this.processTask(r,e)),t&&t.metadata||{type:"message"})}else this.processTask(r,e)}processTask(t,e){if("<response>"===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(br(e.error)):r(null,br(e.data)))}else{const r=L(this.globalScope)?void 0:[],n=e.hasCallback?(e,n)=>{delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?vr(e):null,data:vr(n,r)},r)}:t=>{},i=br(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,i,n);else if(this.parent.getWorkerSource){const t=e.type.split(".");this.parent.getWorkerSource(e.sourceMapId,t[0],i.source)[t[1]](i,n)}else n(new Error(`Could not find function ${e.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Ir=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"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":true,"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":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"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":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"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_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"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":true,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"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":true,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"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":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"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_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":0.1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"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"}}}');class zr{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function Mr(t){const e=t.value;return e?[new zr(t.key,e,"constants have been deprecated as of v8")]:[]}function Pr(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Cr(t){if(Array.isArray(t))return t.map(Cr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=Cr(t[r]);return e}return Pr(t)}function Tr(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,o=t.styleSpec;let a=[];const l=Je(r);if("object"!==l)return[new zr(e,r,`object expected, ${l} found`)];for(const t in r){const l=t.split(".")[0],u=n[l]||n["*"];let c;if(i[l])c=i[l];else if(n[l])c=hn;else if(i["*"])c=i["*"];else{if(!n["*"]){a.push(new zr(e,r[t],`unknown property "${t}"`));continue}c=hn}a=a.concat(c({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:u,style:s,styleSpec:o,object:r,objectKey:t},r))}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&a.push(new zr(e,r,`missing required property "${t}"`));return a}function Br(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,s=t.key,o=t.arrayElementValidator||hn;if("array"!==Je(e))return[new zr(s,e,`array expected, ${Je(e)} found`)];if(r.length&&e.length!==r.length)return[new zr(s,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new zr(s,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let a={type:r.value,values:r.values,minimum:r.minimum,maximum:r.maximum};i.$version<7&&(a.function=r.function),"object"===Je(r.value)&&(a=r.value);let l=[];for(let t=0;t<e.length;t++)l=l.concat(o({array:e,arrayIndex:t,value:e[t],valueSpec:a,style:n,styleSpec:i,key:`${s}[${t}]`}));return l}function Vr(t){const e=t.key,r=t.value,n=t.valueSpec;let i=Je(r);if("number"===i&&r!=r&&(i="NaN"),"number"!==i)return[new zr(e,r,`number expected, ${i} found`)];if("minimum"in n){let i=n.minimum;if("array"===Je(n.minimum)&&(i=n.minimum[t.arrayIndex]),r<i)return[new zr(e,r,`${r} is less than the minimum value ${i}`)]}if("maximum"in n){let i=n.maximum;if("array"===Je(n.maximum)&&(i=n.maximum[t.arrayIndex]),r>i)return[new zr(e,r,`${r} is greater than the maximum value ${i}`)]}return[]}function Er(t){const e=t.valueSpec,r=Pr(t.value.type);let n,i,s,o={};const a="categorical"!==r&&void 0===t.value.property,l=!a,u="array"===Je(t.value.stops)&&"array"===Je(t.value.stops[0])&&"object"===Je(t.value.stops[0][0]),c=Tr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new zr(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Br({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Je(n)&&0===n.length&&e.push(new zr(t.key,n,"array must have at least one stop")),e},default:function(t){return hn({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&a&&c.push(new zr(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||c.push(new zr(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!Ke(t.valueSpec)&&c.push(new zr(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Ge(t.valueSpec)?c.push(new zr(t.key,t.value,"property functions not supported")):a&&!Ye(t.valueSpec)&&c.push(new zr(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||c.push(new zr(t.key,t.value,'"property" property is required')),c;function h(t){let r=[];const n=t.value,a=t.key;if("array"!==Je(n))return[new zr(a,n,`array expected, ${Je(n)} found`)];if(2!==n.length)return[new zr(a,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==Je(n[0]))return[new zr(a,n,`object expected, ${Je(n[0])} found`)];if(void 0===n[0].zoom)return[new zr(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new zr(a,n,"object stop key must have value")];if(s&&s>Pr(n[0].zoom))return[new zr(a,n[0].zoom,"stop zoom values must appear in ascending order")];Pr(n[0].zoom)!==s&&(s=Pr(n[0].zoom),i=void 0,o={}),r=r.concat(Tr({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Vr,value:p}}))}else r=r.concat(p({key:`${a}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return or(Cr(n[1]))?r.concat([new zr(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(hn({key:`${a}[1]`,value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const a=Je(t.value),l=Pr(t.value),u=null!==t.value?t.value:s;if(n){if(a!==n)return[new zr(t.key,u,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new zr(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==r){let n=`number expected, ${a} found`;return Ge(e)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new zr(t.key,u,n)]}return"categorical"!==r||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===a&&void 0!==i&&l<i?[new zr(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===r&&l in o?[new zr(t.key,u,"stop domain values must be unique")]:(o[l]=!0,[])):[new zr(t.key,u,`integer expected, found ${l}`)]}}function Dr(t){const e=("property"===t.expressionContext?cr:ar)(Cr(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new zr(`${t.key}${e.key}`,t.value,e.message)));const r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new zr(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Gt(r))return[new zr(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext)return Fr(r,t);if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Yt(r,["zoom","feature-state"]))return[new zr(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Xt(r))return[new zr(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Fr(t,e){const r=new Set(["zoom","feature-state","pitch","distance-from-center"]);for(const t of e.valueSpec.expression.parameters)r.delete(t);if(0===r.size)return[];const n=[];return t instanceof zt&&r.has(t.name)?[new zr(e.key,e.value,`["${t.name}"] expression is not supported in a filter for a ${e.object.type} layer with id: ${e.object.id}`)]:(t.eachChild((t=>{n.push(...Fr(t,e))})),n)}function Lr(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(Pr(r))&&i.push(new zr(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(Pr(r))&&i.push(new zr(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function jr(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!jr(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function $r(t,e="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};jr(t)||(t=Xr(t));const r=t;let n=!0;try{n=function(t){if(!qr(t))return t;let e=Cr(t);return Rr(e),e=Or(e),e}(r)}catch(t){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(r,null,2)}\n `)}const i=Ir[`filter_${e}`],s=ar(n,i);let o=null;if("error"===s.result)throw new Error(s.value.map((t=>`${t.key}: ${t.message}`)).join(", "));o=(t,e,r)=>s.value.evaluate(t,e,{},r);let a=null,l=null;if(n!==r){const t=ar(r,i);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));a=(e,r,n,i,s)=>t.value.evaluate(e,r,{},n,void 0,void 0,i,s),l=!Xt(t.value.expression)}return o=o,{filter:o,dynamicFilter:a||void 0,needGeometry:Zr(n),needFeature:!!l}}function Or(t){if(!Array.isArray(t))return t;const e=function(t){if(Ur.has(t[0]))for(let e=1;e<t.length;e++)if(qr(t[e]))return!0;return t}(t);return!0===e?e:e.map((t=>Or(t)))}function Rr(t){let e=!1;const r=[];if("case"===t[0]){for(let n=1;n<t.length-1;n+=2)e=e||qr(t[n]),r.push(t[n+1]);r.push(t[t.length-1])}else if("match"===t[0]){e=e||qr(t[1]);for(let e=2;e<t.length-1;e+=2)r.push(t[e+1]);r.push(t[t.length-1])}else if("step"===t[0]){e=e||qr(t[1]);for(let e=1;e<t.length-1;e+=2)r.push(t[e+1])}e&&(t.length=0,t.push("any",...r));for(let e=1;e<t.length;e++)Rr(t[e])}function qr(t){if(!Array.isArray(t))return!1;if("pitch"===(e=t[0])||"distance-from-center"===e)return!0;var e;for(let e=1;e<t.length;e++)if(qr(t[e]))return!0;return!1}const Ur=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Nr(t,e){return t<e?-1:t>e?1:0}function Zr(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Zr(t[e]))return!0;return!1}function Xr(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Gr(t[1],t[2],"=="):"!="===e?Jr(Gr(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Gr(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(Xr))):"all"===e?["all"].concat(t.slice(1).map(Xr)):"none"===e?["all"].concat(t.slice(1).map(Xr).map(Jr)):"in"===e?Yr(t[1],t.slice(2)):"!in"===e?Jr(Yr(t[1],t.slice(2))):"has"===e?Kr(t[1]):"!has"===e?Jr(Kr(t[1])):"within"!==e||t;var r}function Gr(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Yr(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Nr)]]:["filter-in-small",t,["literal",e]]}}function Kr(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Jr(t){return["!",t]}function Hr(t){if(jr(Cr(t.value))){const e=Cr(t.layerType);return Dr(N({},t,{expressionContext:"filter",valueSpec:t.styleSpec[`filter_${e||"fill"}`]}))}return Wr(t)}function Wr(t){const e=t.value,r=t.key;if("array"!==Je(e))return[new zr(r,e,`array expected, ${Je(e)} found`)];const n=t.styleSpec;let i,s=[];if(e.length<1)return[new zr(r,e,"filter array must have at least 1 element")];switch(s=s.concat(Lr({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Pr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Pr(e[1])&&s.push(new zr(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new zr(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=Je(e[1]),"string"!==i&&s.push(new zr(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let o=2;o<e.length;o++)i=Je(e[o]),"$type"===Pr(e[1])?s=s.concat(Lr({key:`${r}[${o}]`,value:e[o],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new zr(`${r}[${o}]`,e[o],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(Wr({key:`${r}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=Je(e[1]),2!==e.length?s.push(new zr(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new zr(`${r}[1]`,e[1],`string expected, ${i} found`));break;case"within":i=Je(e[1]),2!==e.length?s.push(new zr(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==i&&s.push(new zr(`${r}[1]`,e[1],`object expected, ${i} found`))}return s}function Qr(t,e){const r=t.key,n=t.style,i=t.styleSpec,s=t.value,o=t.objectKey,a=i[`${e}_${t.layerType}`];if(!a)return[];const l=o.match(/^(.*)-transition$/);if("paint"===e&&l&&a[l[1]]&&a[l[1]].transition)return hn({key:r,value:s,valueSpec:i.transition,style:n,styleSpec:i});const u=t.valueSpec||a[o];if(!u)return[new zr(r,s,`unknown property "${o}"`)];let c;if("string"===Je(s)&&Ge(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new zr(r,s,`"${o}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];const h=[];return"symbol"===t.layerType&&("text-field"===o&&n&&!n.glyphs&&h.push(new zr(r,s,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&He(Cr(s))&&"identity"===Pr(s.type)&&h.push(new zr(r,s,'"text-font" does not support identity functions'))),h.concat(hn({key:t.key,value:s,valueSpec:u,style:n,styleSpec:i,expressionContext:"property",propertyType:e,propertyKey:o}))}function tn(t){return Qr(t,"paint")}function en(t){return Qr(t,"layout")}function rn(t){let e=[];const r=t.value,n=t.key,i=t.style,s=t.styleSpec;r.type||r.ref||e.push(new zr(n,r,'either "type" or "ref" is required'));let o=Pr(r.type);const a=Pr(r.ref);if(r.id){const s=Pr(r.id);for(let o=0;o<t.arrayIndex;o++){const t=i.layers[o];Pr(t.id)===s&&e.push(new zr(n,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in r&&e.push(new zr(n,r[t],`"${t}" is prohibited for ref layers`))})),i.layers.forEach((e=>{Pr(e.id)===a&&(t=e)})),t?t.ref?e.push(new zr(n,r.ref,"ref cannot reference another ref layer")):o=Pr(t.type):e.push(new zr(n,r.ref,`ref layer "${a}" not found`))}else if("background"!==o&&"sky"!==o)if(r.source){const t=i.sources&&i.sources[r.source],s=t&&Pr(t.type);t?"vector"===s&&"raster"===o?e.push(new zr(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===s&&"raster"!==o?e.push(new zr(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==o?e.push(new zr(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==o||!r.paint||!r.paint["line-gradient"]||"geojson"===s&&t.lineMetrics||e.push(new zr(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new zr(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new zr(n,r.source,`source "${r.source}" not found`))}else e.push(new zr(n,r,'missing required property "source"'));return e=e.concat(Tr({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>hn({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:t=>Hr(N({layerType:o},t)),layout:t=>Tr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>en(N({layerType:o},t))}}),paint:t=>Tr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>tn(N({layerType:o},t))}})}})),e}function nn(t){const e=t.value,r=t.key,n=Je(e);return"string"!==n?[new zr(r,e,`string expected, ${n} found`)]:[]}const sn={promoteId:function({key:t,value:e}){if("string"===Je(e))return nn({key:t,value:e});{const r=[];for(const n in e)r.push(...nn({key:`${t}.${n}`,value:e[n]}));return r}}};function on(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style;if(!e.type)return[new zr(r,e,'"type" is required')];const s=Pr(e.type);let o;switch(s){case"vector":case"raster":case"raster-dem":return o=Tr({key:r,value:e,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:sn}),o;case"geojson":if(o=Tr({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,objectElementValidators:sn}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;o.push(...Dr({key:`${r}.${t}.map`,value:i,expressionContext:"cluster-map"})),o.push(...Dr({key:`${r}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return o;case"video":return Tr({key:r,value:e,valueSpec:n.source_video,style:i,styleSpec:n});case"image":return Tr({key:r,value:e,valueSpec:n.source_image,style:i,styleSpec:n});case"canvas":return[new zr(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Lr({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:n})}}function an(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let s=[];const o=Je(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new zr("light",e,`object expected, ${o} found`)]),s;for(const t in e){const o=t.match(/^(.*)-transition$/);s=s.concat(o&&n[o[1]]&&n[o[1]].transition?hn({key:t,value:e[t],valueSpec:r.transition,style:i,styleSpec:r}):n[t]?hn({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}):[new zr(t,e[t],`unknown property "${t}"`)])}return s}function ln(t){const e=t.value,r=t.key,n=t.style,i=t.styleSpec,s=i.terrain;let o=[];const a=Je(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new zr("terrain",e,`object expected, ${a} found`)]),o;for(const t in e){const r=t.match(/^(.*)-transition$/);o=o.concat(r&&s[r[1]]&&s[r[1]].transition?hn({key:t,value:e[t],valueSpec:i.transition,style:n,styleSpec:i}):s[t]?hn({key:t,value:e[t],valueSpec:s[t],style:n,styleSpec:i}):[new zr(t,e[t],`unknown property "${t}"`)])}if(e.source){const t=n.sources&&n.sources[e.source],i=t&&Pr(t.type);t?"raster-dem"!==i&&o.push(new zr(r,e.source,`terrain cannot be used with a source of type ${i}, it only be used with a "raster-dem" source type`)):o.push(new zr(r,e.source,`source "${e.source}" not found`))}else o.push(new zr(r,e,'terrain is missing required property "source"'));return o}function un(t){const e=t.value,r=t.style,n=t.styleSpec,i=n.fog;let s=[];const o=Je(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new zr("fog",e,`object expected, ${o} found`)]),s;for(const t in e){const o=t.match(/^(.*)-transition$/);s=s.concat(o&&i[o[1]]&&i[o[1]].transition?hn({key:t,value:e[t],valueSpec:n.transition,style:r,styleSpec:n}):i[t]?hn({key:t,value:e[t],valueSpec:i[t],style:r,styleSpec:n}):[new zr(t,e[t],`unknown property "${t}"`)])}return s}const cn={"*":()=>[],array:Br,boolean:function(t){const e=t.value,r=t.key,n=Je(e);return"boolean"!==n?[new zr(r,e,`boolean expected, ${n} found`)]:[]},number:Vr,color:function(t){const e=t.key,r=t.value,n=Je(r);return"string"!==n?[new zr(e,r,`color expected, ${n} found`)]:null===q.parseCSSColor(r)?[new zr(e,r,`color expected, "${r}" found`)]:[]},constants:Mr,enum:Lr,filter:Hr,function:Er,layer:rn,object:Tr,source:on,light:an,terrain:ln,fog:un,string:nn,formatted:function(t){return 0===nn(t).length?[]:Dr(t)},resolvedImage:function(t){return 0===nn(t).length?[]:Dr(t)},projection:function(t){const e=t.value,r=t.styleSpec,n=r.projection,i=t.style;let s=[];const o=Je(e);if("object"===o)for(const t in e)s=s.concat(hn({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}));else"string"!==o&&(s=s.concat([new zr("projection",e,`object or string expected, ${o} found`)]));return s}};function hn(t){const e=t.value,r=t.valueSpec,n=t.styleSpec;return r.expression&&He(Pr(e))?Er(t):r.expression&&or(Cr(e))?Dr(t):r.type&&cn[r.type]?cn[r.type](t):Tr(N({},t,{valueSpec:r.type?n[r.type]:r}))}function pn(t){const e=t.value,r=t.key,n=nn(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new zr(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new zr(r,e,'"glyphs" url must include a "{range}" token'))),n}function fn(t,e=Ir){let r=[];return r=r.concat(hn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:pn,"*":()=>[]}})),t.constants&&(r=r.concat(Mr({key:"constants",value:t.constants,style:t,styleSpec:e}))),dn(r)}function dn(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function yn(t){return function(...e){return dn(t.apply(this,e))}}function mn(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function gn(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}fn.source=yn(on),fn.light=yn(an),fn.terrain=yn(ln),fn.fog=yn(un),fn.layer=yn(rn),fn.filter=yn(Hr),fn.paintProperty=yn(tn),fn.layoutProperty=yn(en);class xn{constructor(t,e={}){A(this,e),this.type=t}}class vn extends xn{constructor(t,e={}){super("error",A({error:t},e))}}class bn{on(t,e){return this._listeners=this._listeners||{},mn(t,e,this._listeners),this}off(t,e){return gn(t,e,this._listeners),gn(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},mn(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new xn(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of n)gn(r,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(A(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t))}else t instanceof vn&&console.error(t.error);return this}listens(t){return!!(this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}const wn=fn,_n=wn.paintProperty,An=wn.layoutProperty;class Sn{constructor(){this.first=!0}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}}const kn=t=>t>=1536&&t<=1791,In=t=>t>=1872&&t<=1919,zn=t=>t>=2208&&t<=2303,Mn=t=>t>=11904&&t<=12031,Pn=t=>t>=12032&&t<=12255,Cn=t=>t>=12272&&t<=12287,Tn=t=>t>=12288&&t<=12351,Bn=t=>t>=12352&&t<=12447,Vn=t=>t>=12448&&t<=12543,En=t=>t>=12544&&t<=12591,Dn=t=>t>=12704&&t<=12735,Fn=t=>t>=12736&&t<=12783,Ln=t=>t>=12784&&t<=12799,jn=t=>t>=12800&&t<=13055,$n=t=>t>=13056&&t<=13311,On=t=>t>=13312&&t<=19903,Rn=t=>t>=19968&&t<=40959,qn=t=>t>=40960&&t<=42127,Un=t=>t>=42128&&t<=42191,Nn=t=>t>=63744&&t<=64255,Zn=t=>t>=64336&&t<=65023,Xn=t=>t>=65040&&t<=65055,Gn=t=>t>=65072&&t<=65103,Yn=t=>t>=65104&&t<=65135,Kn=t=>t>=65136&&t<=65279,Jn=t=>t>=65280&&t<=65519;function Hn(t){for(const e of t)if(ti(e.charCodeAt(0)))return!0;return!1}function Wn(t){for(const e of t)if(!Qn(e.charCodeAt(0)))return!1;return!0}function Qn(t){return!(kn(t)||In(t)||zn(t)||Zn(t)||Kn(t))}function ti(t){return!(746!==t&&747!==t&&(t<4352||!(Dn(t)||En(t)||Gn(t)&&!(t>=65097&&t<=65103)||Nn(t)||$n(t)||Mn(t)||Fn(t)||!(!Tn(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||On(t)||Rn(t)||jn(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||(t=>t>=44032&&t<=55215)(t)||Bn(t)||Cn(t)||(t=>t>=12688&&t<=12703)(t)||Pn(t)||Ln(t)||Vn(t)&&12540!==t||!(!Jn(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Yn(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||Xn(t)||(t=>t>=19904&&t<=19967)(t)||qn(t)||Un(t))))}function ei(t){return!(ti(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Tn(t)||Vn(t)||(t=>t>=57344&&t<=63743)(t)||Gn(t)||Yn(t)||Jn(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function ri(t){return t>=1424&&t<=2303||Zn(t)||Kn(t)}function ni(t,e){return!(!e&&ri(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||(t=>t>=6016&&t<=6143)(t))}function ii(t){for(const e of t)if(ri(e.charCodeAt(0)))return!0;return!1}let si;const oi={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==si){const t=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{si=null!=process.env.API_URL_REGEX?new RegExp(process.env.API_URL_REGEX):t}catch(e){si=t}}return si},get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},ai={supported:!1,testSupport:function(t){!ci&&ui&&(hi?pi(t):li=t)}};let li,ui,ci=!1,hi=!1;function pi(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,ui),t.isContextLost())return;ai.supported=!0}catch(t){}t.deleteTexture(e),ci=!0}s.document&&(ui=s.document.createElement("img"),ui.onload=function(){li&&pi(li),li=null,hi=!0},ui.onerror=function(){ci=!0,li=null},ui.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const fi="NO_ACCESS_TOKEN";function di(t){return oi.API_URL_REGEX.test(t)}const yi=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function mi(t){const e=t.match(yi);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function gi(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}function xi(t){if(!t)return null;const e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(s.atob(e[1]).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(t){return null}}class vi{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const e=xi(oi.ACCESS_TOKEN);let r="";return r=e&&e.u?s.btoa(encodeURIComponent(e.u).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(Number("0x"+e))))):"",t?`mapbox.eventData.${t}:${r}`:`mapbox.eventData:${r}`}fetchEventData(){const t=j("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{const t=s.localStorage.getItem(e);t&&(this.eventData=JSON.parse(t));const n=s.localStorage.getItem(r);n&&(this.anonId=n)}catch(t){T("Unable to read from LocalStorage")}}saveEventData(){const t=j("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{s.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&s.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){T("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,e,r,n){if(!oi.EVENTS_URL)return;const i=mi(oi.EVENTS_URL);i.params.push(`access_token=${n||oi.ACCESS_TOKEN||""}`);const s={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"2.7.0-beta.1",skuId:"01",userId:this.anonId},o=e?A(s,e):s,a={url:gi(i),headers:{"Content-Type":"text/plain"},body:JSON.stringify([o])};this.pendingRequest=Ci(a,(t=>{this.pendingRequest=null,r(t),this.saveEventData(),this.processRequests(n)}))}queueRequest(t,e){this.queue.push(t),this.processRequests(e)}}const bi=new class extends vi{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){oi.EVENTS_URL&&oi.ACCESS_TOKEN&&Array.isArray(t)&&t.some((t=>function(t){return 0===t.indexOf("mapbox:")}(t)||di(t)))&&this.queueRequest(Date.now(),e)}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=xi(oi.ACCESS_TOKEN),r=e?e.u:oi.ACCESS_TOKEN;let n=r!==this.eventData.tokenU;k(this.anonId)||(this.anonId=S(),n=!0);const i=this.queue.shift();if(this.eventData.lastSuccess){const t=new Date(this.eventData.lastSuccess),e=new Date(i),r=(i-this.eventData.lastSuccess)/864e5;n=n||r>=1||r<-1||t.getDate()!==e.getDate()}else n=!0;if(!n)return this.processRequests();this.postEvent(i,{"enabled.telemetry":!1},(t=>{t||(this.eventData.lastSuccess=i,this.eventData.tokenU=r)}),t)}};bi.postTurnstileEvent.bind(bi);const wi=new class extends vi{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,r,n){this.skuToken=e,this.errorCb=n,oi.EVENTS_URL&&(r||oi.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(fi)))}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:r}=this.queue.shift();e&&this.success[e]||(this.anonId||this.fetchEventData(),k(this.anonId)||(this.anonId=S()),this.postEvent(r,{skuToken:this.skuToken},(t=>{t?this.errorCb(t):e&&(this.success[e]=!0)}),t))}};wi.postMapLoadEvent.bind(wi);const _i=new class extends vi{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,e,r,n){const i=mi(oi.API_URL+oi.SESSION_PATH);i.params.push(`sku=${e||""}`),i.params.push(`access_token=${n||oi.ACCESS_TOKEN||""}`);const s={url:gi(i),headers:{"Content-Type":"text/plain"}};this.pendingRequest=Ti(s,(t=>{this.pendingRequest=null,r(t),this.saveEventData(),this.processRequests(n)}))}getSessionAPI(t,e,r,n){this.skuToken=e,this.errorCb=n,r||oi.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(fi))}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:r}=this.queue.shift();e&&this.success[e]||this.getSession(r,this.skuToken,(t=>{t?this.errorCb(t):e&&(this.success[e]=!0)}),t)}};let Ai,Si;function ki(){s.caches&&!Ai&&(Ai=s.caches.open("mapbox-tiles"))}function Ii(t){const e=t.indexOf("?");return e<0?t:t.slice(0,e)}_i.getSessionAPI.bind(_i),"function"==typeof Object.freeze&&Object.freeze({Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"});class zi extends Error{constructor(t,e,r){401===e&&di(r)&&(t+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(t),this.status=e,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Mi=E()?()=>self.worker&&self.worker.referrer:()=>("blob:"===s.location.protocol?s.parent:s).location.href;const Pi=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(Mi())&&!/^\w+:/.test(r))){if(s.fetch&&s.Request&&s.AbortController&&s.Request.prototype.hasOwnProperty("signal"))return function(t,e){const r=new s.AbortController,n=new s.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:Mi(),signal:r.signal});let i=!1,o=!1;const a=(l=n.url).indexOf("sku=")>0&&di(l);var l;"json"===t.type&&n.headers.set("Accept","application/json");const u=(r,i,l)=>{if(o)return;if(r&&"SecurityError"!==r.message&&T(r),i&&l)return c(i);const u=Date.now();s.fetch(n).then((r=>{if(r.ok){const t=a?r.clone():null;return c(r,t,u)}return e(new zi(r.statusText,r.status,t.url))})).catch((t=>{20!==t.code&&e(new Error(t.message))}))},c=(r,a,l)=>{("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{o||(a&&l&&function(t,e,r){if(ki(),!Ai)return;const n={status:e.status,statusText:e.statusText,headers:new s.Headers};e.headers.forEach(((t,e)=>n.headers.set(e,t)));const i=D(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===Si)try{new Response(new ReadableStream),Si=!0}catch(t){Si=!1}Si?e(t.body):t.blob().then(e)}(e,(e=>{const r=new s.Response(e,n);ki(),Ai&&Ai.then((e=>e.put(Ii(t.url),r))).catch((t=>T(t.message)))})))}(n,a,l),i=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((t=>{o||e(new Error(t.message))}))};return a?function(t,e){if(ki(),!Ai)return e(null);const r=Ii(t.url);Ai.then((t=>{t.match(r).then((n=>{const i=function(t){if(!t)return!1;const e=new Date(t.headers.get("Expires")||0),r=D(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(n);t.delete(r),i&&t.put(r,n.clone()),e(null,n,i)})).catch(e)})).catch(e)}(n,u):u(null,null),{cancel:()=>{o=!0,i||r.abort()}}}(t,e);if(E()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){const r=new s.XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{e(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else e(new zi(r.statusText,r.status,t.url))},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},Ci=function(t,e){return Pi(A(t,{method:"POST"}),e)},Ti=function(t,e){return Pi(A(t,{method:"GET"}),e)};let Bi="unavailable",Vi=null;const Ei={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>"loaded"===Bi||null!=Ei.applyArabicShaping,isLoading:()=>"loading"===Bi,setState(t){Bi=t.pluginStatus,Vi=t.pluginURL},isParsed:()=>null!=Ei.applyArabicShaping&&null!=Ei.processBidirectionalText&&null!=Ei.processStyledBidirectionalText,getPluginURL:()=>Vi};class Di{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition,this.pitch=e.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Sn,this.transition={},this.pitch=0)}isSupportedScript(t){return function(t,e){for(const r of t)if(!ni(r.charCodeAt(0),e))return!1;return!0}(t,Ei.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}class Fi{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(He(t))return new hr(t,e);if(or(t)){const r=cr(t,e);if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return r.value}{let r=t;return"string"==typeof t&&"color"===e.type&&(r=U.parse(t)),{kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class Li{constructor(t){this.property=t,this.value=new Fi(t,void 0)}transitioned(t,e){return new $i(this.property,this.value,e,A({},t.transition,this.transition),t.now)}untransitioned(){return new $i(this.property,this.value,null,{},0)}}class ji{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return P(this._values[t].value.value)}setValue(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Li(this._values[t].property)),this._values[t].value=new Fi(this._values[t].property,null===e?void 0:P(e))}getTransition(t){return P(this._values[t].transition)}setTransition(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Li(this._values[t].property)),this._values[t].transition=P(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n)}return t}transitioned(t,e){const r=new Oi(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new Oi(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class $i{constructor(t,e,r,n,i){const s=n.delay||0,o=n.duration||0;i=i||0,this.property=t,this.value=e,this.begin=i+s,this.end=this.begin+o,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return s.possiblyEvaluate(t,e,r);{const o=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,r),i,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(o))}}return i}}class Oi{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const n=new Ui(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Ri{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return P(this._values[t].value)}setValue(t,e){this._values[t]=new Fi(this._values[t].property,null===e?void 0:P(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){const n=new Ui(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class qi{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)}}class Ui{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ni{constructor(t){this.specification=t}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,r){const n=ee[this.specification.type];return n?n(t,e,r):t}}class Zi{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,n){return new qi(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new qi(this,{kind:"constant",value:void 0},t.parameters);const n=ee[this.specification.type];return n?new qi(this,{kind:"constant",value:n(t.value.value,e.value.value,r)},t.parameters):t}evaluate(t,e,r,n,i,s){return"constant"===t.kind?t.value:t.evaluate(e,r,n,i,s)}}class Xi extends Zi{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new qi(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),s="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,o=this._calculate(s,s,s,e);return new qi(this,{kind:"constant",value:o},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new qi(this,{kind:"constant",value:r},e)}return new qi(this,t.expression,e)}evaluate(t,e,r,n,i,s){if("source"===t.kind){const o=t.evaluate(e,r,n,i,s);return this._calculate(o,o,o,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e,other:r}:{from:r,to:e,other:t}}interpolate(t){return t}}class Gi{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new Di(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Di(Math.floor(e.zoom),e)),t.expression.evaluate(new Di(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class Yi{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)}interpolate(){return!1}}class Ki{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new Fi(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new Li(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}function Ji(t,e){return 256*(t=b(Math.floor(t),0,255))+b(Math.floor(e),0,255)}mr("DataDrivenProperty",Zi),mr("DataConstantProperty",Ni),mr("CrossFadedDataDrivenProperty",Xi),mr("CrossFadedProperty",Gi),mr("ColorRampProperty",Yi);const Hi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Wi{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Qi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ts(t,e=1){let r=0,n=0;return{members:t.map((t=>{const i=Hi[t.type].BYTES_PER_ELEMENT,s=r=es(r,Math.max(e,i)),o=t.components||1;return n=Math.max(n,i),r+=i*o,{name:t.name,type:t.type,components:o,offset:s}})),size:es(r,Math.max(n,e)),alignment:e}}function es(t,e){return Math.ceil(t/e)*e}class rs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}rs.prototype.bytesPerElement=4,mr("StructArrayLayout2i4",rs);class ns extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,t}}ns.prototype.bytesPerElement=8,mr("StructArrayLayout4i8",ns);class is extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s,o)}emplace(t,e,r,n,i,s,o,a){const l=6*t,u=12*t,c=3*t;return this.int16[l+0]=e,this.int16[l+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=s,this.uint8[u+7]=o,this.float32[c+2]=a,t}}is.prototype.bytesPerElement=12,mr("StructArrayLayout2i4ub1f12",is);class ss extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}ss.prototype.bytesPerElement=12,mr("StructArrayLayout3f12",ss);class os extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,s,o,a,l,u)}emplace(t,e,r,n,i,s,o,a,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=s,this.uint16[h+5]=o,this.uint16[h+6]=a,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}os.prototype.bytesPerElement=20,mr("StructArrayLayout10ui20",os);class as extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,n,i,s,o,a)}emplace(t,e,r,n,i,s,o,a,l){const u=8*t;return this.uint16[u+0]=e,this.uint16[u+1]=r,this.uint16[u+2]=n,this.uint16[u+3]=i,this.uint16[u+4]=s,this.uint16[u+5]=o,this.uint16[u+6]=a,this.uint16[u+7]=l,t}}as.prototype.bytesPerElement=16,mr("StructArrayLayout8ui16",as);class ls extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y){const m=this.length;return this.resize(m+1),this.emplace(m,t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y)}emplace(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m){const g=16*t;return this.int16[g+0]=e,this.int16[g+1]=r,this.int16[g+2]=n,this.int16[g+3]=i,this.uint16[g+4]=s,this.uint16[g+5]=o,this.uint16[g+6]=a,this.uint16[g+7]=l,this.int16[g+8]=u,this.int16[g+9]=c,this.int16[g+10]=h,this.int16[g+11]=p,this.int16[g+12]=f,this.int16[g+13]=d,this.int16[g+14]=y,this.int16[g+15]=m,t}}ls.prototype.bytesPerElement=32,mr("StructArrayLayout4i4ui4i4i32",ls);class us extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}us.prototype.bytesPerElement=4,mr("StructArrayLayout1ul4",us);class cs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a,l,u,c,h,p){const f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,n,i,s,o,a,l,u,c,h,p)}emplace(t,e,r,n,i,s,o,a,l,u,c,h,p,f){const d=20*t,y=10*t;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=n,this.int16[d+3]=i,this.int16[d+4]=s,this.float32[y+3]=o,this.float32[y+4]=a,this.float32[y+5]=l,this.float32[y+6]=u,this.int16[d+14]=c,this.uint32[y+8]=h,this.uint16[d+18]=p,this.uint16[d+19]=f,t}}cs.prototype.bytesPerElement=40,mr("StructArrayLayout5i4f1i1ul2ui40",cs);class hs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s,o)}emplace(t,e,r,n,i,s,o,a){const l=8*t;return this.int16[l+0]=e,this.int16[l+1]=r,this.int16[l+2]=n,this.int16[l+4]=i,this.int16[l+5]=s,this.int16[l+6]=o,this.int16[l+7]=a,t}}hs.prototype.bytesPerElement=16,mr("StructArrayLayout3i2i2i16",hs);class ps extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const o=4*t,a=8*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.int16[a+6]=i,this.int16[a+7]=s,t}}ps.prototype.bytesPerElement=16,mr("StructArrayLayout2f1f2i16",ps);class fs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=12*t,o=3*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[o+1]=n,this.float32[o+2]=i,t}}fs.prototype.bytesPerElement=12,mr("StructArrayLayout2ub2f12",fs);class ds extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}ds.prototype.bytesPerElement=6,mr("StructArrayLayout3ui6",ds);class ys extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b)}emplace(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w){const _=30*t,A=15*t,S=60*t;return this.int16[_+0]=e,this.int16[_+1]=r,this.int16[_+2]=n,this.float32[A+2]=i,this.float32[A+3]=s,this.uint16[_+8]=o,this.uint16[_+9]=a,this.uint32[A+5]=l,this.uint32[A+6]=u,this.uint32[A+7]=c,this.uint16[_+16]=h,this.uint16[_+17]=p,this.uint16[_+18]=f,this.float32[A+10]=d,this.float32[A+11]=y,this.uint8[S+48]=m,this.uint8[S+49]=g,this.uint8[S+50]=x,this.uint32[A+13]=v,this.int16[_+28]=b,this.uint8[S+58]=w,t}}ys.prototype.bytesPerElement=60,mr("StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60",ys);class ms extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S,k,I,z,M,P){const C=this.length;return this.resize(C+1),this.emplace(C,t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S,k,I,z,M,P)}emplace(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S,k,I,z,M,P,C){const T=38*t,B=19*t;return this.int16[T+0]=e,this.int16[T+1]=r,this.int16[T+2]=n,this.float32[B+2]=i,this.float32[B+3]=s,this.int16[T+8]=o,this.int16[T+9]=a,this.int16[T+10]=l,this.int16[T+11]=u,this.int16[T+12]=c,this.int16[T+13]=h,this.uint16[T+14]=p,this.uint16[T+15]=f,this.uint16[T+16]=d,this.uint16[T+17]=y,this.uint16[T+18]=m,this.uint16[T+19]=g,this.uint16[T+20]=x,this.uint16[T+21]=v,this.uint16[T+22]=b,this.uint16[T+23]=w,this.uint16[T+24]=_,this.uint16[T+25]=A,this.uint16[T+26]=S,this.uint16[T+27]=k,this.uint16[T+28]=I,this.uint32[B+15]=z,this.float32[B+16]=M,this.float32[B+17]=P,this.float32[B+18]=C,t}}ms.prototype.bytesPerElement=76,mr("StructArrayLayout3i2f6i15ui1ul3f76",ms);class gs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}gs.prototype.bytesPerElement=4,mr("StructArrayLayout1f4",gs);class xs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}xs.prototype.bytesPerElement=6,mr("StructArrayLayout3i6",xs);class vs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s,o)}emplace(t,e,r,n,i,s,o,a){const l=7*t;return this.float32[l+0]=e,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=i,this.float32[l+4]=s,this.float32[l+5]=o,this.float32[l+6]=a,t}}vs.prototype.bytesPerElement=28,mr("StructArrayLayout7f28",vs);class bs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=6*t;return this.uint32[3*t+0]=e,this.uint16[s+2]=r,this.uint16[s+3]=n,this.uint16[s+4]=i,t}}bs.prototype.bytesPerElement=12,mr("StructArrayLayout1ul3ui12",bs);class ws extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}ws.prototype.bytesPerElement=4,mr("StructArrayLayout2ui4",ws);class _s extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}_s.prototype.bytesPerElement=2,mr("StructArrayLayout1ui2",_s);class As extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}As.prototype.bytesPerElement=8,mr("StructArrayLayout2f8",As);class Ss extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,t}}Ss.prototype.bytesPerElement=16,mr("StructArrayLayout4f16",Ss);class ks extends Wi{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}ks.prototype.size=40;class Is extends cs{get(t){return new ks(this,t)}}mr("CollisionBoxArray",Is);class zs extends Wi{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(t){this._structArray.uint8[this._pos1+49]=t}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(t){this._structArray.uint8[this._pos1+50]=t}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(t){this._structArray.uint32[this._pos4+13]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(t){this._structArray.uint8[this._pos1+58]=t}}zs.prototype.size=60;class Ms extends ys{get(t){return new zs(this,t)}}mr("PlacedSymbolArray",Ms);class Ps extends Wi{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(t){this._structArray.uint32[this._pos4+15]=t}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}Ps.prototype.size=76;class Cs extends ms{get(t){return new Ps(this,t)}}mr("SymbolInstanceArray",Cs);class Ts extends gs{getoffsetX(t){return this.float32[1*t+0]}}mr("GlyphOffsetArray",Ts);class Bs extends xs{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}mr("SymbolLineVertexArray",Bs);class Vs extends Wi{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}Vs.prototype.size=12;class Es extends bs{get(t){return new Vs(this,t)}}mr("FeatureIndexArray",Es);class Ds extends Wi{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}Ds.prototype.size=4;class Fs extends ws{get(t){return new Ds(this,t)}}mr("FillExtrusionCentroidArray",Fs);const Ls=ts([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"}]),js=ts([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]);var $s=R((function(t){t.exports=function(t,e){var r,n,i,s,o,a,l,u;for(n=t.length-(r=3&t.length),i=e,o=3432918353,a=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),Os=R((function(t){t.exports=function(t,e){for(var r,n=t.length,i=e^n,s=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}})),Rs=$s,qs=Os;Rs.murmur3=$s,Rs.murmur2=qs;class Us{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,n){this.ids.push(Ns(t)),this.positions.push(e,r,n)}getPositions(t){const e=Ns(t);let r=0,n=this.ids.length-1;for(;r<n;){const t=r+n>>1;this.ids[t]>=e?n=t:r=t+1}const i=[];for(;this.ids[r]===e;)i.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return i}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return Zs(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new Us;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Ns(t){const e=+t;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:Rs(String(t))}function Zs(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let s=r-1,o=n+1;for(;;){do{s++}while(t[s]<i);do{o--}while(t[o]>i);if(s>=o)break;Xs(t,s,o),Xs(e,3*s,3*o),Xs(e,3*s+1,3*o+1),Xs(e,3*s+2,3*o+2)}o-r<n-o?(Zs(t,e,r,o),r=o+1):(Zs(t,e,o+1,n),n=o)}}function Xs(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}mr("FeaturePositionMap",Us);class Gs{constructor(t,e){this.gl=t.gl,this.location=e}}class Ys extends Gs{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Ks extends Gs{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Js extends Gs{constructor(t,e){super(t,e),this.current=U.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}function Hs(t){return[Ji(255*t.r,255*t.g),Ji(255*t.b,255*t.a)]}class Ws{constructor(t,e,r){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return"color"===this.type?new Js(t,e):new Ys(t,e)}}class Qs{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tl.concat(e.br),this.patternTo=t.tl.concat(t.br)}setUniform(t,e,r,n){const i="u_pattern_to"===n||"u_dash_to"===n?this.patternTo:"u_pattern_from"===n||"u_dash_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;i&&t.set(i)}getBinding(t,e,r){return"u_pattern_from"===r||"u_pattern_to"===r||"u_dash_from"===r||"u_dash_to"===r?new Ks(t,e):new Ys(t,e)}}class to{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(t,e,r,n,i,s){const o=this.paintVertexArray.length,a=this.expression.evaluate(new Di(0),e,{},i,n,s);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)}updatePaintArray(t,e,r,n,i){const s=this.expression.evaluate({zoom:0},r,n,void 0,i);this._setPaintValue(t,e,s)}_setPaintValue(t,e,r){if("color"===this.type){const n=Hs(r);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class eo{constructor(t,e,r,n,i,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,r,n,i,s){const o=this.expression.evaluate(new Di(this.zoom),e,{},i,n,s),a=this.expression.evaluate(new Di(this.zoom+1),e,{},i,n,s),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,o,a)}updatePaintArray(t,e,r,n,i){const s=this.expression.evaluate({zoom:this.zoom},r,n,void 0,i),o=this.expression.evaluate({zoom:this.zoom+1},r,n,void 0,i);this._setPaintValue(t,e,s,o)}_setPaintValue(t,e,r,n){if("color"===this.type){const i=Hs(r),s=Hs(n);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i[0],i[1],s[0],s[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,n=b(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(n)}getBinding(t,e,r){return new Ys(t,e)}}class ro{constructor(t,e,r,n,i,s,o){this.expression=t,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=o,this.paintVertexAttributes=("array"===r?js:Ls).members;for(let t=0;t<e.length;++t);this.zoomInPaintVertexArray=new s,this.zoomOutPaintVertexArray=new s}populatePaintArray(t,e,r){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],r)}updatePaintArray(t,e,r,n,i,s){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],s)}_setPaintValues(t,e,r,n){if(!n||!r)return;const{min:i,mid:s,max:o}=r,a=n[i],l=n[s],u=n[o];if(a&&l&&u)for(let r=t;r<e;r++)this._setPaintValue(this.zoomInPaintVertexArray,r,l,a),this._setPaintValue(this.zoomOutPaintVertexArray,r,l,u)}_setPaintValue(t,e,r,n){t.emplace(e,r.tl[0],r.tl[1],r.br[0],r.br[1],n.tl[0],n.tl[1],n.br[0],n.br[1],r.pixelRatio,n.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class no{constructor(t,e,r=(()=>!0)){this.binders={},this._buffers=[];const n=[];for(const i in t.paint._values){if(!r(i))continue;const s=t.paint.get(i);if(!(s instanceof qi&&Ge(s.property.specification)))continue;const o=oo(i,t.type),a=s.value,l=s.property.specification.type,u=s.property.useIntegerZoom,c=s.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c,p="line-dasharray"===String(i)&&"constant"!==t.layout.get("line-cap").value.kind;if("constant"!==a.kind||p)if("source"===a.kind||p||h){const r=uo(i,l,"source");this.binders[i]=h?new ro(a,o,l,u,e,r,t.id):new to(a,o,l,r),n.push(`/a_${i}`)}else{const t=uo(i,l,"composite");this.binders[i]=new eo(a,o,l,u,e,t),n.push(`/z_${i}`)}else this.binders[i]=h?new Qs(a.value,o):new Ws(a.value,o,l),n.push(`/u_${i}`)}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof to||e instanceof eo?e.maxValue:0}populatePaintArrays(t,e,r,n,i,s){for(const o in this.binders){const a=this.binders[o];(a instanceof to||a instanceof eo||a instanceof ro)&&a.populatePaintArray(t,e,r,n,i,s)}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof Qs&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,n,i,s){let o=!1;for(const a in t){const l=e.getPositions(a);for(const e of l){const l=r.feature(e.index);for(const r in this.binders){const u=this.binders[r];if((u instanceof to||u instanceof eo||u instanceof ro)&&!0===u.expression.isStateDependent){const c=n.paint.get(r);u.expression=c.value,u.updatePaintArray(e.start,e.end,l,t[a],i,s),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof Ws||r instanceof Qs)&&t.push(...r.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof to||r instanceof eo||r instanceof ro)for(let e=0;e<r.paintVertexAttributes.length;e++)t.push(r.paintVertexAttributes[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Ws||r instanceof Qs||r instanceof eo)for(const e of r.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const r=[];for(const n in this.binders){const i=this.binders[n];if(i instanceof Ws||i instanceof Qs||i instanceof eo)for(const s of i.uniformNames)if(e[s]){const o=i.getBinding(t,e[s],s);r.push({name:s,property:n,binding:o})}}return r}setUniforms(t,e,r,n){for(const{name:t,property:i,binding:s}of e)this.binders[i].setUniform(s,n,r.get(i),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof ro){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof to||r instanceof eo)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof to||r instanceof eo||r instanceof ro)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof to||e instanceof eo||e instanceof ro)&&e.destroy()}}}class io{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new no(n,e,r);this.needsUpload=!1,this._featureMap=new Us,this._bufferOffset=0}populatePaintArrays(t,e,r,n,i,s,o){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s,o);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,n,i){for(const s of r)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(t,this._featureMap,e,s,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}const so={"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"],"line-dasharray":["dash_to","dash_from"]};function oo(t,e){return so[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const ao={"line-pattern":{source:os,composite:os},"fill-pattern":{source:os,composite:os},"fill-extrusion-pattern":{source:os,composite:os},"line-dasharray":{source:as,composite:as}},lo={color:{source:As,composite:Ss},number:{source:gs,composite:As}};function uo(t,e,r){const n=ao[t];return n&&n[r]||lo[e][r]}mr("ConstantBinder",Ws),mr("CrossFadedConstantBinder",Qs),mr("SourceExpressionBinder",to),mr("CrossFadedCompositeBinder",ro),mr("CompositeExpressionBinder",eo),mr("ProgramConfiguration",no,{omit:["_buffers"]}),mr("ProgramConfigurationSet",io);const co="-transition";class ho extends bn{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==t.type&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&"sky"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new Ri(e.layout)),e.paint)){this._transitionablePaint=new ji(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ui(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(An,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return z(t,co)?this._transitionablePaint.getTransition(t.slice(0,-co.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(_n,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(z(t,co))return this._transitionablePaint.setTransition(t.slice(0,-co.length),e||void 0),!1;{const r=this._transitionablePaint._values[t],n="cross-faded-data-driven"===r.property.specification["property-type"],i=r.value.isDataDriven(),s=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const o=this._transitionablePaint._values[t].value;return o.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,s,o)}}_handleSpecialPaintPropertyUpdate(t){}getProgramIds(){return null}getProgramConfiguration(t){return null}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),function(t,e,r){const n={};for(const r in t)e.call(this,t[r],r,t)&&(n[r]=t[r]);return n}(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,r,n,i={}){return(!i||!1!==i.validate)&&function(t,e){let r=!1;if(e&&e.length)for(const n of e)t.fire(new vn(new Error(n.message))),r=!0;return r}(this,t.call(wn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:Ir,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof qi&&Ge(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=$r(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const po=ts([{name:"a_pos",components:2,type:"Int16"}],4),{members:fo}=po;class yo{constructor(t=[]){this.segments=t}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>yo.MAX_VERTEX_ARRAY_LENGTH&&T(`Max vertices per segment is ${yo.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>yo.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,n){return new yo([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}yo.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,mr("SegmentVector",yo);var mo=8192;class go{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof vo?new vo(t.lng,t.lat):vo.convert(t),this}setSouthWest(t){return this._sw=t instanceof vo?new vo(t.lng,t.lat):vo.convert(t),this}extend(t){const e=this._sw,r=this._ne;let n,i;if(t instanceof vo)n=t,i=t;else{if(!(t instanceof go))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(go.convert(t)):this.extend(vo.convert(t)):this;if(n=t._sw,i=t._ne,!n||!i)return this}return e||r?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),r.lng=Math.max(i.lng,r.lng),r.lat=Math.max(i.lat,r.lat)):(this._sw=new vo(n.lng,n.lat),this._ne=new vo(i.lng,i.lat)),this}getCenter(){return new vo((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 vo(this.getWest(),this.getNorth())}getSouthEast(){return new vo(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(t){const{lng:e,lat:r}=vo.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){return!t||t instanceof go?t:new go(t)}}const xo=6371008.8;class vo{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new vo(w(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return xo*Math.acos(Math.min(i,1))}toBounds(t=0){const e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new go(new vo(this.lng-r,this.lat-e),new vo(this.lng+r,this.lat+e))}static convert(t){if(t instanceof vo)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new vo(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new vo(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const bo=2*Math.PI*xo;function wo(t,e){return t/(bo*Math.cos(e*Math.PI/180))}function _o(t){return 360*t-180}function Ao(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}const So=85.051129;function ko(t,e,n,i,s,o,a,l,u){const c=(e+i)/2,h=(n+s)/2,p=new r(c,h);l(p),function(t,e,r,n,i,s){const o=r-i,a=n-s;return Math.abs((n-e)*o-(r-t)*a)/Math.hypot(o,a)}(p.x,p.y,o.x,o.y,a.x,a.y)>=u?(ko(t,e,n,c,h,o,p,l,u),ko(t,c,h,i,s,p,a,l,u)):t.push(a)}function Io(t,e,r){const n=[];let i,s,o;for(const a of t){const{x:t,y:l}=a;e(a),o?ko(n,i,s,t,l,o,a,e,r):n.push(a),i=t,s=l,o=a}return n}const zo=Math.pow(2,14)-1,Mo=-zo-1;function Po(t,e){const r=Math.round(t.x*e),n=Math.round(t.y*e);return t.x=b(r,Mo,zo),t.y=b(n,Mo,zo),(r<t.x||r>t.x+1||n<t.y||n>t.y+1)&&T("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function Co(t,e,r){const n=t.loadGeometry(),i=t.extent,s=mo/i;if(e&&r&&r.projection.isReprojectedInTileSpace){const s=1<<e.z,{scale:o,x:a,y:l,projection:u}=r,c=t=>{const r=_o((e.x+t.x/i)/s),n=Ao((e.y+t.y/i)/s),c=u.project(r,n);t.x=(c.x*o-a)*i,t.y=(c.y*o-l)*i};for(let e=0;e<n.length;e++)if(1!==t.type)n[e]=Io(n[e],c,1);else{const t=[];for(const r of n[e])r.x<0||r.x>=i||r.y<0||r.y>=i||(c(r),t.push(r));n[e]=t}}for(const t of n)for(const e of t)Po(e,s);return n}function To(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Co(t):[]}}function Bo(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}class Vo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new rs,this.indexArray=new ds,this.segments=new yo,this.programConfigurations=new io(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r,n){const i=this.layers[0],s=[];let o=null;"circle"===i.type&&(o=i.layout.get("circle-sort-key"));for(const{feature:e,id:i,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=To(e,t);if(!this.layers[0]._featureFilter.filter(new Di(this.zoom),u,r))continue;const c=o?o.evaluate(u,{},r):void 0,h={id:i,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?u.geometry:Co(e,r,n),patterns:{},sortKey:c};s.push(h)}o&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:o}=n,a=t[s].feature;this.addFeature(n,i,s,e.availableImages,r),e.featureIndex.insert(a,i,s,o,this.index)}}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,n,i){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=mo||n<0||n>=mo)continue;const i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),s=i.vertexLength;Bo(this.layoutVertexArray,r,n,-1,-1),Bo(this.layoutVertexArray,r,n,1,-1),Bo(this.layoutVertexArray,r,n,1,1),Bo(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+3,s+2),i.vertexLength+=4,i.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n,i)}}function Eo(t,e){for(let r=0;r<t.length;r++)if(Uo(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Uo(t,e[r]))return!0;return!!jo(t,e)}function Do(t,e,r){return!!Uo(t,e)||!!Oo(e,t,r)}function Fo(t,e){if(1===t.length)return qo(e,t[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++)if(Uo(t,n[e]))return!0}for(let r=0;r<t.length;r++)if(qo(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(jo(t,e[r]))return!0;return!1}function Lo(t,e,r){if(t.length>1){if(jo(t,e))return!0;for(let n=0;n<e.length;n++)if(Oo(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(Oo(t[n],e,r))return!0;return!1}function jo(t,e){if(0===t.length||0===e.length)return!1;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)if($o(n,i,e[t],e[t+1]))return!0}return!1}function $o(t,e,r,n){return B(t,r,n)!==B(e,r,n)&&B(t,e,r)!==B(t,e,n)}function Oo(t,e,r){const n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(let r=1;r<e.length;r++)if(Ro(t,e[r-1],e[r])<n)return!0;return!1}function Ro(t,e,r){const n=e.distSqr(r);if(0===n)return t.distSqr(e);const i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return t.distSqr(i<0?e:i>1?r:r.sub(e)._mult(i)._add(e))}function qo(t,e){let r,n,i,s=!1;for(let o=0;o<t.length;o++){r=t[o];for(let t=0,o=r.length-1;t<r.length;o=t++)n=r[t],i=r[o],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s)}return s}function Uo(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const s=t[n],o=t[i];s.y>e.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(r=!r)}return r}function No(t,e,r){const n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;const s=B(t,e,r[0]);return s!==B(t,e,r[1])||s!==B(t,e,r[2])||s!==B(t,e,r[3])}function Zo(t,e,r){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Xo(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Go(t,e,n,i,s){if(!e[0]&&!e[1])return t;const o=r.convert(e)._mult(s);"viewport"===n&&o._rotate(-i);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(o));return a}function Yo(t,e,n,i){const s=r.convert(t)._mult(i);return"viewport"===e&&s._rotate(-n),s}mr("CircleBucket",Vo,{omit:["layers"]});const Ko=new Ki({"circle-sort-key":new Zi(Ir.layout_circle["circle-sort-key"])});var Jo={paint:new Ki({"circle-radius":new Zi(Ir.paint_circle["circle-radius"]),"circle-color":new Zi(Ir.paint_circle["circle-color"]),"circle-blur":new Zi(Ir.paint_circle["circle-blur"]),"circle-opacity":new Zi(Ir.paint_circle["circle-opacity"]),"circle-translate":new Ni(Ir.paint_circle["circle-translate"]),"circle-translate-anchor":new Ni(Ir.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ni(Ir.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ni(Ir.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Zi(Ir.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Zi(Ir.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Zi(Ir.paint_circle["circle-stroke-opacity"])}),layout:Ko};class Ho{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,r){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],r=c(this.min),n=c(this.max);for(let t=0;t<e.length;t++)r[t]=e[t]?this.min[t]:this.center[t],n[t]=e[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new Ho(r,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}distanceZ(t){return Math.max(Math.min(this.max[2],t[2]),this.min[2])-t[2]}getCorners(){const t=this.min,e=this.max;return[[t[0],t[1],t[2]],[e[0],t[1],t[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],e[2]],[t[0],e[1],e[2]]]}intersects(t){const e=this.getCorners();let r=!0;for(let s=0;s<t.planes.length;s++){const o=t.planes[s];let a=0;for(let t=0;t<e.length;t++)a+=(n=o)[0]*(i=e[t])[0]+n[1]*i[1]+n[2]*i[2]+o[3]>=0;if(0===a)return 0;a!==e.length&&(r=!1)}var n,i;if(r)return 2;for(let e=0;e<3;e++){let r=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let i=0;i<t.points.length;i++){const s=t.points[i][e]-this.min[e];r=Math.min(r,s),n=Math.max(n,s)}if(n<0||r>this.max[e]-this.min[e])return 0}return 1}}function Wo(t,e,r,n,i,s,o,a,l){if(s&&t.queryGeometry.isAboveHorizon)return!1;s&&(l*=t.pixelToTileUnitsFactor);for(const u of e)for(const e of u){const u=e.add(a),c=i&&r.elevation?r.elevation.exaggeration()*i.getElevationAt(u.x,u.y,!0):0,h=s?u:Qo(u,c,n),p=s?t.tilespaceRays.map((t=>ra(t,c))):t.queryGeometry.screenGeometry,d=f([],[e.x,e.y,c,1],n);if(!o&&s?l*=d[3]/r.cameraToCenterDistance:o&&!s&&(l*=r.cameraToCenterDistance/d[3]),Do(p,h,l))return!0}return!1}function Qo(t,e,n){const i=f([],[t.x,t.y,e,1],n);return new r(i[0]/i[3],i[1]/i[3])}const ta=h(0,0,0),ea=h(0,0,1);function ra(t,e){const n=u();return ta[2]=e,t.intersectsPlane(ta,ea,n),new r(n[0],n[1])}class na extends Vo{}function ia(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError("mismatched image size")}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function sa(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;const i=ia({},{width:e,height:r},n);oa(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function oa(t,e,r,n,i,s){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=e.data;for(let l=0;l<i.height;l++){const u=((r.y+l)*t.width+r.x)*s,c=((n.y+l)*e.width+n.x)*s;for(let t=0;t<i.width*s;t++)a[c+t]=o[u+t]}return e}mr("HeatmapBucket",na,{omit:["layers"]});class aa{constructor(t,e){ia(this,t,1,e)}resize(t){sa(this,t,1)}clone(){return new aa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){oa(t,e,r,n,i,1)}}class la{constructor(t,e){ia(this,t,4,e)}resize(t){sa(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new la({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){oa(t,e,r,n,i,4)}}mr("AlphaImage",aa),mr("RGBAImage",la);var ua={paint:new Ki({"heatmap-radius":new Zi(Ir.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Zi(Ir.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ni(Ir.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yi(Ir.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ni(Ir.paint_heatmap["heatmap-opacity"])})};function ca(t){const e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new la({width:r,height:n}),s=(r,n,s)=>{e[t.evaluationKey]=s;const o=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*o.r/o.a),i.data[r+n+1]=Math.floor(255*o.g/o.a),i.data[r+n+2]=Math.floor(255*o.b/o.a),i.data[r+n+3]=Math.floor(255*o.a)};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,o=0;n<r;n++,o+=4){const a=n/(r-1),{start:l,end:u}=t.clips[e];s(i,o,l*(1-a)+u*a)}else for(let t=0,e=0;t<r;t++,e+=4)s(0,e,t/(r-1));return i}var ha={paint:new Ki({"hillshade-illumination-direction":new Ni(Ir.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ni(Ir.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ni(Ir.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ni(Ir.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ni(Ir.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ni(Ir.paint_hillshade["hillshade-accent-color"])})};const pa=ts([{name:"a_pos",components:2,type:"Int16"}],4),{members:fa}=pa;var da=ma,ya=ma;function ma(t,e,r){r=r||2;var n,i,s,o,a,l,u,c=e&&e.length,h=c?e[0]*r:t.length,p=ga(t,0,h,r,!0),f=[];if(!p||p.next===p.prev)return f;if(c&&(p=function(t,e,r,n){var i,s,o,a=[];for(i=0,s=e.length;i<s;i++)(o=ga(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1))===o.next&&(o.steiner=!0),a.push(Ma(o));for(a.sort(Sa),i=0;i<a.length;i++)r=xa(r=ka(a[i],r),r.next);return r}(t,e,p,r)),t.length>80*r){n=s=t[0],i=o=t[1];for(var d=r;d<h;d+=r)(a=t[d])<n&&(n=a),(l=t[d+1])<i&&(i=l),a>s&&(s=a),l>o&&(o=l);u=0!==(u=Math.max(s-n,o-i))?1/u:0}return va(p,f,r,n,i,u),f}function ga(t,e,r,n,i){var s,o;if(i===Ra(t,e,r,n)>0)for(s=e;s<r;s+=n)o=ja(s,t[s],t[s+1],o);else for(s=r-n;s>=e;s-=n)o=ja(s,t[s],t[s+1],o);return o&&Ba(o,o.next)&&($a(o),o=o.next),o}function xa(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Ba(n,n.next)&&0!==Ta(n.prev,n,n.next))n=n.next;else{if($a(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function va(t,e,r,n,i,s,o){if(t){!o&&s&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=za(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,s,o,a,l,u=1;do{for(r=t,t=null,s=null,o=0;r;){for(o++,n=r,a=0,e=0;e<u&&(a++,n=n.nextZ);e++);for(l=u;a>0||l>0&&n;)0!==a&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=n}s.nextZ=null,u*=2}while(o>1)}(i)}(t,n,i,s);for(var a,l,u=t;t.prev!==t.next;)if(a=t.prev,l=t.next,s?wa(t,n,i,s):ba(t))e.push(a.i/r),e.push(t.i/r),e.push(l.i/r),$a(t),t=l.next,u=l.next;else if((t=l)===u){o?1===o?va(t=_a(xa(t),e,r),e,r,n,i,s,2):2===o&&Aa(t,e,r,n,i,s):va(xa(t),e,r,n,i,s,1);break}}}function ba(t){var e=t.prev,r=t,n=t.next;if(Ta(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Pa(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Ta(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function wa(t,e,r,n){var i=t.prev,s=t,o=t.next;if(Ta(i,s,o)>=0)return!1;for(var a=i.x>s.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,l=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,u=za(i.x<s.x?i.x<o.x?i.x:o.x:s.x<o.x?s.x:o.x,i.y<s.y?i.y<o.y?i.y:o.y:s.y<o.y?s.y:o.y,e,r,n),c=za(a,l,e,r,n),h=t.prevZ,p=t.nextZ;h&&h.z>=u&&p&&p.z<=c;){if(h!==t.prev&&h!==t.next&&Pa(i.x,i.y,s.x,s.y,o.x,o.y,h.x,h.y)&&Ta(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,p!==t.prev&&p!==t.next&&Pa(i.x,i.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Ta(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;h&&h.z>=u;){if(h!==t.prev&&h!==t.next&&Pa(i.x,i.y,s.x,s.y,o.x,o.y,h.x,h.y)&&Ta(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;p&&p.z<=c;){if(p!==t.prev&&p!==t.next&&Pa(i.x,i.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Ta(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function _a(t,e,r){var n=t;do{var i=n.prev,s=n.next.next;!Ba(i,s)&&Va(i,n,n.next,s)&&Fa(i,s)&&Fa(s,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(s.i/r),$a(n),$a(n.next),n=t=s),n=n.next}while(n!==t);return xa(n)}function Aa(t,e,r,n,i,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Ca(o,a)){var l=La(o,a);return o=xa(o,o.next),l=xa(l,l.next),va(o,e,r,n,i,s),void va(l,e,r,n,i,s)}a=a.next}o=o.next}while(o!==t)}function Sa(t,e){return t.x-e.x}function ka(t,e){var r=function(t,e){var r,n=e,i=t.x,s=t.y,o=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var a=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>o){if(o=a,a===i){if(s===n.y)return n;if(s===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===o)return r;var l,u=r,c=r.x,h=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&Pa(s<h?i:o,s,c,h,s<h?o:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),Fa(n,t)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&Ia(r,n)))&&(r=n,p=l)),n=n.next}while(n!==u);return r}(t,e);if(!r)return e;var n=La(r,t),i=xa(r,r.next);return xa(n,n.next),e===r?i:e}function Ia(t,e){return Ta(t.prev,t,e.prev)<0&&Ta(e.next,t,t.next)<0}function za(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ma(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function Pa(t,e,r,n,i,s,o,a){return(i-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(n-a)-(r-o)*(e-a)>=0&&(r-o)*(s-a)-(i-o)*(n-a)>=0}function Ca(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Va(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Fa(t,e)&&Fa(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Ta(t.prev,t,e.prev)||Ta(t,e.prev,e))||Ba(t,e)&&Ta(t.prev,t,t.next)>0&&Ta(e.prev,e,e.next)>0)}function Ta(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Ba(t,e){return t.x===e.x&&t.y===e.y}function Va(t,e,r,n){var i=Da(Ta(t,e,r)),s=Da(Ta(t,e,n)),o=Da(Ta(r,n,t)),a=Da(Ta(r,n,e));return i!==s&&o!==a||!(0!==i||!Ea(t,r,e))||!(0!==s||!Ea(t,n,e))||!(0!==o||!Ea(r,t,n))||!(0!==a||!Ea(r,e,n))}function Ea(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Da(t){return t>0?1:t<0?-1:0}function Fa(t,e){return Ta(t.prev,t,t.next)<0?Ta(t,e,t.next)>=0&&Ta(t,t.prev,e)>=0:Ta(t,e,t.prev)<0||Ta(t,t.next,e)<0}function La(t,e){var r=new Oa(t.i,t.x,t.y),n=new Oa(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function ja(t,e,r,n){var i=new Oa(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function $a(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Oa(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ra(t,e,r,n){for(var i=0,s=e,o=r-n;s<r;s+=n)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}function qa(t,e,r,n,i){Ua(t,e,r||0,n||t.length-1,i||Za)}function Ua(t,e,r,n,i){for(;n>r;){if(n-r>600){var s=n-r+1,o=e-r+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);Ua(t,e,Math.max(r,Math.floor(e-o*l/s+u)),Math.min(n,Math.floor(e+(s-o)*l/s+u)),i)}var c=t[e],h=r,p=n;for(Na(t,r,e),i(t[n],c)>0&&Na(t,r,n);h<p;){for(Na(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--}0===i(t[r],c)?Na(t,r,p):Na(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1)}}function Na(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Za(t,e){return t<e?-1:t>e?1:0}function Xa(t,e){const r=t.length;if(r<=1)return[t];const n=[];let i,s;for(let e=0;e<r;e++){const r=V(t[e]);0!==r&&(t[e].area=Math.abs(r),void 0===s&&(s=r<0),s===r<0?(i&&n.push(i),i=[t[e]]):i.push(t[e]))}if(i&&n.push(i),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(qa(n[t],e,1,n[t].length-1,Ga),n[t]=n[t].slice(0,e));return n}function Ga(t,e){return e.area-t.area}function Ya(t,e,r){const n=r.patternDependencies;let i=!1;for(const r of e){const e=r.paint.get(`${t}-pattern`);e.isConstant()||(i=!0);const s=e.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Ka(t,e,r,n,i){const s=i.patternDependencies;for(const o of e){const e=o.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},r,{},i.availableImages),a=e.evaluate({zoom:n},r,{},i.availableImages),l=e.evaluate({zoom:n+1},r,{},i.availableImages);t=t&&t.name?t.name:t,a=a&&a.name?a.name:a,l=l&&l.name?l.name:l,s[t]=!0,s[a]=!0,s[l]=!0,r.patterns[o.id]={min:t,mid:a,max:l}}}return r}ma.deviation=function(t,e,r,n){var i=e&&e.length,s=Math.abs(Ra(t,0,i?e[0]*r:t.length,r));if(i)for(var o=0,a=e.length;o<a;o++)s-=Math.abs(Ra(t,e[o]*r,o<a-1?e[o+1]*r:t.length,r));var l=0;for(o=0;o<n.length;o+=3){var u=n[o]*r,c=n[o+1]*r,h=n[o+2]*r;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},ma.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var o=0;o<e;o++)r.vertices.push(t[i][s][o]);i>0&&r.holes.push(n+=t[i-1].length)}return r},da.default=ya;class Ja{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new rs,this.indexArray=new ds,this.indexArray2=new ws,this.programConfigurations=new io(t.layers,t.zoom),this.segments=new yo,this.segments2=new yo,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r,n){this.hasPattern=Ya("fill",this.layers,e);const i=this.layers[0].layout.get("fill-sort-key"),s=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=To(o,t);if(!this.layers[0]._featureFilter.filter(new Di(this.zoom),c,r))continue;const h=i?i.evaluate(c,{},r,e.availableImages):void 0,p={id:a,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Co(o,r,n),patterns:{},sortKey:h};s.push(p)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:o}=n;if(this.hasPattern){const t=Ka("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{},e.availableImages);e.featureIndex.insert(t[s].feature,i,s,o,this.index)}}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}addFeatures(t,e,r,n){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fa),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,n,i,s=[]){for(const t of Xa(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),i.push(e[t].x),i.push(e[t].y);r.vertexLength+=e.length,r.primitiveLength+=e.length}const o=da(i,s);for(let t=0;t<o.length;t+=3)this.indexArray.emplaceBack(n+o[t],n+o[t+1],n+o[t+2]);r.vertexLength+=e,r.primitiveLength+=o.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n)}}mr("FillBucket",Ja,{omit:["layers","patternFeatures"]});const Ha=new Ki({"fill-sort-key":new Zi(Ir.layout_fill["fill-sort-key"])});var Wa={paint:new Ki({"fill-antialias":new Ni(Ir.paint_fill["fill-antialias"]),"fill-opacity":new Zi(Ir.paint_fill["fill-opacity"]),"fill-color":new Zi(Ir.paint_fill["fill-color"]),"fill-outline-color":new Zi(Ir.paint_fill["fill-outline-color"]),"fill-translate":new Ni(Ir.paint_fill["fill-translate"]),"fill-translate-anchor":new Ni(Ir.paint_fill["fill-translate-anchor"]),"fill-pattern":new Xi(Ir.paint_fill["fill-pattern"])}),layout:Ha};const Qa=ts([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),tl=ts([{name:"a_centroid_pos",components:2,type:"Uint16"}]),{members:el}=Qa;var rl=nl;function nl(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(il,this,e)}function il(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function sl(t){for(var e,r,n=0,i=0,s=t.length,o=s-1;i<s;o=i++)n+=((r=t[o]).x-(e=t[i]).x)*(e.y+r.y);return n}nl.types=["Unknown","Point","LineString","Polygon"],nl.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,i=1,s=0,o=0,a=0,l=[];t.pos<n;){if(s<=0){var u=t.readVarint();i=7&u,s=u>>3}if(s--,1===i||2===i)o+=t.readSVarint(),a+=t.readSVarint(),1===i&&(e&&l.push(e),e=[]),e.push(new r(o,a));else{if(7!==i)throw new Error("unknown command "+i);e&&e.push(e[0].clone())}}return e&&l.push(e),l},nl.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<o&&(o=i),i>a&&(a=i),(s+=t.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,a,u]},nl.prototype.toGeoJSON=function(t,e,r){var n,i,s=this.extent*Math.pow(2,r),o=this.extent*t,a=this.extent*e,l=this.loadGeometry(),u=nl.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+o)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+a)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],s=0;s<e;s++){var o=sl(t[s]);0!==o&&(void 0===n&&(n=o<0),n===o<0?(r&&i.push(r),r=[t[s]]):r.push(t[s]))}return r&&i.push(r),i}(l),n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)c(l[n][i])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var ol=al;function al(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ll,this,e),this.length=this._features.length}function ll(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function ul(t,e,r){if(3===t){var n=new ol(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}al.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new rl(this._pbf,e,this.extent,this._keys,this._values)};var cl={VectorTile:function(t,e){this.layers=t.readFields(ul,{},e)},VectorTileFeature:rl,VectorTileLayer:ol};const hl=cl.VectorTileFeature.types,pl=Math.pow(2,13);function fl(t,e,r,n,i,s,o,a){t.emplaceBack((e<<1)+o,(r<<1)+s,(Math.floor(n*pl)<<1)+i,Math.round(a))}class dl{constructor(){this.acc=new r(0,0),this.polyCount=[]}startRing(t){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new r(t.x,t.y),this.max=new r(t.x,t.y))}append(t,e){this.currentPolyCount.edges++,this.acc._add(t);let r=!!this.borders;const n=this.min,i=this.max;t.x<n.x?(n.x=t.x,r=!0):t.x>i.x&&(i.x=t.x,r=!0),t.y<n.y?(n.y=t.y,r=!0):t.y>i.y&&(i.y=t.y,r=!0),((0===t.x||t.x===mo)&&t.x===e.x)!=((0===t.y||t.y===mo)&&t.y===e.y)&&this.processBorderOverlap(t,e),r&&this.checkBorderIntersection(t,e)}checkBorderIntersection(t,e){e.x<0!=t.x<0&&this.addBorderIntersection(0,te(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>mo!=t.x>mo&&this.addBorderIntersection(1,te(e.y,t.y,(mo-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,te(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>mo!=t.y>mo&&this.addBorderIntersection(3,te(e.x,t.x,(mo-e.y)/(t.y-e.y)))}addBorderIntersection(t,e){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const r=this.borders[t];e<r[0]&&(r[0]=e),e>r[1]&&(r[1]=e)}processBorderOverlap(t,e){if(t.x===e.x){if(t.y===e.y)return;const r=0===t.x?0:1;this.addBorderIntersection(r,e.y),this.addBorderIntersection(r,t.y)}else{const r=0===t.y?2:3;this.addBorderIntersection(r,e.x),this.addBorderIntersection(r,t.x)}}centroid(){const t=this.polyCount.reduce(((t,e)=>t+e.edges),0);return 0!==t?this.acc.div(t)._round():new r(0,0)}span(){return new r(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce(((t,e)=>t+ +(e[0]!==Number.MAX_VALUE)),0)}}class yl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ns,this.centroidVertexArray=new Fs,this.indexArray=new ds,this.programConfigurations=new io(t.layers,t.zoom),this.segments=new yo,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.enableTerrain=t.enableTerrain}populate(t,e,r,n){this.features=[],this.hasPattern=Ya("fill-extrusion",this.layers,e),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(t){const e=Math.exp(Math.PI*(1-t.y/(1<<t.z)*2));return 80150034*e/(e*e+1)/mo/(1<<t.z)}(r);for(const{feature:i,id:s,index:o,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,l=To(i,t);if(!this.layers[0]._featureFilter.filter(new Di(this.zoom),l,r))continue;const u={id:s,sourceLayerIndex:a,index:o,geometry:t?l.geometry:Co(i,r,n),properties:i.properties,type:i.type,patterns:{}},c=this.layoutVertexArray.length;this.hasPattern?this.features.push(Ka("fill-extrusion",this.layers,u,this.zoom,e)):this.addFeature(u,u.geometry,o,r,{},e.availableImages),e.featureIndex.insert(i,u.geometry,o,a,this.index,c)}this.sortBorders()}addFeatures(t,e,r,n){for(const t of this.features){const{geometry:i}=t;this.addFeature(t,i,t.index,e,r,n)}this.sortBorders()}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,el),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}uploadCentroid(t){0!==this.centroidVertexArray.length&&(this.centroidVertexBuffer?this.needsCentroidUpdate&&this.centroidVertexBuffer.updateData(this.centroidVertexArray):this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,tl.members,!0),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,n,i,s){const o=this.enableTerrain?new dl:null;for(const r of Xa(e,500)){let e=0,n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);if(0===r.length||(a=r[0]).every((t=>t.x<=0))||a.every((t=>t.x>=mo))||a.every((t=>t.y<=0))||a.every((t=>t.y>=mo)))continue;for(let t=0;t<r.length;t++){const i=r[t];if(0===i.length)continue;e+=i.length;let s=0;o&&o.startRing(i[0]);for(let t=0;t<i.length;t++){const e=i[t];if(t>=1){const r=i[t-1];if(!ml(e,r)){o&&o.append(e,r),n.vertexLength+4>yo.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=e.sub(r)._perp(),i=t.x/(Math.abs(t.x)+Math.abs(t.y)),a=t.y>0?1:0,l=r.dist(e);s+l>32768&&(s=0),fl(this.layoutVertexArray,e.x,e.y,i,a,0,0,s),fl(this.layoutVertexArray,e.x,e.y,i,a,0,1,s),s+=l,fl(this.layoutVertexArray,r.x,r.y,i,a,0,0,s),fl(this.layoutVertexArray,r.x,r.y,i,a,0,1,s);const u=n.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),n.vertexLength+=4,n.primitiveLength+=2}}}}if(n.vertexLength+e>yo.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==hl[t.type])continue;const i=[],s=[],l=n.vertexLength;for(let t=0;t<r.length;t++){const e=r[t];if(0!==e.length){e!==r[0]&&s.push(i.length/2);for(let t=0;t<e.length;t++){const r=e[t];fl(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),i.push(r.x),i.push(r.y),o&&o.currentPolyCount.top++}}}const u=da(i,s);for(let t=0;t<u.length;t+=3)this.indexArray.emplaceBack(l+u[t],l+u[t+2],l+u[t+1]);n.primitiveLength+=u.length/3,n.vertexLength+=e}var a;if(o&&o.polyCount.length>0){if(o.borders){o.vertexArrayOffset=this.centroidVertexArray.length;const t=o.borders,e=this.featuresOnBorder.push(o)-1;for(let r=0;r<4;r++)t[r][0]!==Number.MAX_VALUE&&this.borders[r].push(e)}this.encodeCentroid(o.borders?void 0:o.centroid(),o)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n)}sortBorders(){for(let t=0;t<4;t++)this.borders[t].sort(((e,r)=>this.featuresOnBorder[e].borders[t][0]-this.featuresOnBorder[r].borders[t][0]))}encodeCentroid(t,e,r=!0){let n,i;if(t)if(0!==t.y){const r=e.span()._mult(this.tileToMeter);n=(Math.max(t.x,1)<<3)+Math.min(7,Math.round(r.x/10)),i=(Math.max(t.y,1)<<3)+Math.min(7,Math.round(r.y/10))}else n=Math.ceil(7*(t.x+450)),i=0;else n=0,i=+r;let s=r?this.centroidVertexArray.length:e.vertexArrayOffset;for(const t of e.polyCount){r&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*t.edges+t.top);for(let e=0;e<2*t.edges;e++)this.centroidVertexArray.emplace(s++,0,i),this.centroidVertexArray.emplace(s++,n,i);for(let e=0;e<t.top;e++)this.centroidVertexArray.emplace(s++,n,i)}}}function ml(t,e){return t.x===e.x&&(t.x<0||t.x>mo)||t.y===e.y&&(t.y<0||t.y>mo)}mr("FillExtrusionBucket",yl,{omit:["layers","features"]}),mr("PartMetadata",dl);var gl={paint:new Ki({"fill-extrusion-opacity":new Ni(Ir["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Zi(Ir["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ni(Ir["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ni(Ir["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Xi(Ir["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Zi(Ir["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Zi(Ir["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ni(Ir["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function xl(t,e){return t.x*e.x+t.y*e.y}function vl(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){const s=e[r],o=t[0],a=i.sub(n),l=s.sub(n),u=o.sub(n),c=xl(a,a),h=xl(a,l),p=xl(l,l),f=xl(u,a),d=xl(u,l),y=c*p-h*h,m=(p*f-h*d)/y,g=(c*d-h*f)/y,x=n.z*(1-m-g)+i.z*m+s.z*g;if(isFinite(x))return x}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}function bl(t){const e=new r(t[0],t[1]);return e.z=t[2],e}function wl(t,e,r,n,i,s,o,a){const l=o*i.getElevationAt(t,e,!0,!0),u=0!==s[0],c=u?0===s[1]?o*(s[0]/7-450):o*function(t,e,r){const n=Math.floor(e[0]/8),i=Math.floor(e[1]/8),s=10*(e[0]-8*n),o=10*(e[1]-8*i),a=t.getElevationAt(n,i,!0,!0),l=t.getMeterToDEM(r),u=Math.floor(.5*(s*l-1)),c=Math.floor(.5*(o*l-1)),h=t.tileCoordToPixel(n,i),p=2*u+1,f=2*c+1,d=function(t,e,r,n,i){return[t.getElevationAtPixel(e,r,!0),t.getElevationAtPixel(e+i,r,!0),t.getElevationAtPixel(e,r+i,!0),t.getElevationAtPixel(e+n,r+i,!0)]}(t,h.x-u,h.y-c,p,f),y=Math.abs(d[0]-d[1]),m=Math.abs(d[2]-d[3]),g=Math.abs(d[0]-d[2])+Math.abs(d[1]-d[3]),x=Math.min(.25,.5*l*(y+m)/p),v=Math.min(.25,.5*l*g/f);return a+Math.max(x*s,v*o)}(i,s,a):l;return{base:l+(0===r)?-1:r,top:u?Math.max(c+n,l+r+2):l+n}}const _l=ts([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:Al}=_l,Sl=ts([{name:"a_packed",components:3,type:"Float32"}]),{members:kl}=Sl,Il=cl.VectorTileFeature.types,zl=Math.cos(Math.PI/180*37.5);class Ml{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new is,this.layoutVertexArray2=new ss,this.indexArray=new ds,this.programConfigurations=new io(t.layers,t.zoom),this.segments=new yo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r,n){this.hasPattern=Ya("line",this.layers,e);const i=this.layers[0].layout.get("line-sort-key"),s=[];for(const{feature:e,id:o,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=To(e,t);if(!this.layers[0]._featureFilter.filter(new Di(this.zoom),u,r))continue;const c=i?i.evaluate(u,{},r):void 0,h={id:o,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?u.geometry:Co(e,r,n),patterns:{},sortKey:c};s.push(h)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));const{lineAtlas:o,featureIndex:a}=e,l=this.addConstantDashes(o);for(const n of s){const{geometry:i,index:s,sourceLayerIndex:u}=n;if(l&&this.addFeatureDashes(n,o),this.hasPattern){const t=Ka("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,o.positions,e.availableImages);a.insert(t[s].feature,i,s,u,this.index)}}addConstantDashes(t){let e=!1;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,i=r.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==i.kind)e=!0;else{const e=i.value,r=n.value;if(!r)continue;t.addDash(r.from,e),t.addDash(r.to,e),r.other&&t.addDash(r.other,e)}}return e}addFeatureDashes(t,e){const r=this.zoom;for(const n of this.layers){const i=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"===i.kind&&"constant"===s.kind)continue;let o,a,l,u,c,h;if("constant"===i.kind){const t=i.value;if(!t)continue;o=t.other||t.to,a=t.to,l=t.from}else o=i.evaluate({zoom:r-1},t),a=i.evaluate({zoom:r},t),l=i.evaluate({zoom:r+1},t);"constant"===s.kind?u=c=h=s.value:(u=s.evaluate({zoom:r-1},t),c=s.evaluate({zoom:r},t),h=s.evaluate({zoom:r+1},t)),e.addDash(o,u),e.addDash(a,c),e.addDash(l,h);const p=e.getKey(o,u),f=e.getKey(a,c),d=e.getKey(l,h);t.patterns[n.id]={min:p,mid:f,max:d}}}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}addFeatures(t,e,r,n){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,kl)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Al),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&t.properties.hasOwnProperty("mapbox_clip_start")&&t.properties.hasOwnProperty("mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,n,i,s){const o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),l=o.get("line-cap").evaluate(t,{}),u=o.get("line-miter-limit"),c=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,a,l,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n)}addLine(t,e,r,n,i,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const o="Polygon"===Il[e.type];let a=t.length;for(;a>=2&&t[a-1].equals(t[a-2]);)a--;let l=0;for(;l<a-1&&t[l].equals(t[l+1]);)l++;if(a<(o?3:2))return;"bevel"===r&&(i=1.05);const u=this.overscaling<=16?122880/(512*this.overscaling):0,c=this.segments.prepareSegment(10*a,this.layoutVertexArray,this.indexArray);let h,p,f,d,y;this.e1=this.e2=-1,o&&(h=t[a-2],y=t[l].sub(h)._unit()._perp());for(let e=l;e<a;e++){if(f=e===a-1?o?t[l+1]:void 0:t[e+1],f&&t[e].equals(f))continue;y&&(d=y),h&&(p=h),h=t[e],y=f?f.sub(h)._unit()._perp():d,d=d||y;let m=d.add(y);0===m.x&&0===m.y||m._unit();const g=d.x*y.x+d.y*y.y,x=m.x*y.x+m.y*y.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<zl&&p&&f,_=d.x*y.y-d.y*y.x>0;if(w&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,d,0,0,c),p=e}}const A=p&&f;let S=A?r:o?"butt":n;if(A&&"round"===S&&(v<s?S="miter":v<=2&&(S="fakeround")),"miter"===S&&v>i&&(S="bevel"),"bevel"===S&&(v>2&&(S="flipbevel"),v<i&&(S="miter")),p&&this.updateDistance(p,h),"miter"===S)m._mult(v),this.addCurrentVertex(h,m,0,0,c);else if("flipbevel"===S){if(v>100)m=y.mult(-1);else{const t=v*d.add(y).mag()/d.sub(y).mag();m._perp()._mult(t*(_?-1:1))}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c)}else if("bevel"===S||"fakeround"===S){const t=-Math.sqrt(v*v-1),e=_?t:0,r=_?0:t;if(p&&this.addCurrentVertex(h,d,e,r,c),"fakeround"===S){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const n=y.sub(d)._mult(r)._add(d)._unit()._mult(_?-1:1);this.addHalfVertex(h,n.x,n.y,!1,_,0,c)}}f&&this.addCurrentVertex(h,y,-e,-r,c)}else if("butt"===S)this.addCurrentVertex(h,m,0,0,c);else if("square"===S){const t=p?1:-1;p||this.addCurrentVertex(h,m,t,t,c),this.addCurrentVertex(h,m,0,0,c),p&&this.addCurrentVertex(h,m,t,t,c)}else"round"===S&&(p&&(this.addCurrentVertex(h,d,0,0,c),this.addCurrentVertex(h,d,1,1,c,!0)),f&&(this.addCurrentVertex(h,y,-1,-1,c,!0),this.addCurrentVertex(h,y,0,0,c)));if(w&&e<a-1){const t=h.dist(f);if(t>2*u){const e=h.add(f.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e}}}}addCurrentVertex(t,e,r,n,i,s=!1){const o=e.y*n-e.x,a=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,s,!1,r,i),this.addHalfVertex(t,o,a,s,!0,-n,i)}addHalfVertex({x:t,y:e},r,n,i,s,o,a){this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===o?0:o<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineSoFar);const l=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),a.primitiveLength++),s?this.e2=l:this.e1=l}updateScaledDistance(){if(this.lineClips){const t=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=t*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}mr("LineBucket",Ml,{omit:["layers","patternFeatures"]});const Pl=new Ki({"line-cap":new Zi(Ir.layout_line["line-cap"]),"line-join":new Zi(Ir.layout_line["line-join"]),"line-miter-limit":new Ni(Ir.layout_line["line-miter-limit"]),"line-round-limit":new Ni(Ir.layout_line["line-round-limit"]),"line-sort-key":new Zi(Ir.layout_line["line-sort-key"])});var Cl={paint:new Ki({"line-opacity":new Zi(Ir.paint_line["line-opacity"]),"line-color":new Zi(Ir.paint_line["line-color"]),"line-translate":new Ni(Ir.paint_line["line-translate"]),"line-translate-anchor":new Ni(Ir.paint_line["line-translate-anchor"]),"line-width":new Zi(Ir.paint_line["line-width"]),"line-gap-width":new Zi(Ir.paint_line["line-gap-width"]),"line-offset":new Zi(Ir.paint_line["line-offset"]),"line-blur":new Zi(Ir.paint_line["line-blur"]),"line-dasharray":new Xi(Ir.paint_line["line-dasharray"]),"line-pattern":new Xi(Ir.paint_line["line-pattern"]),"line-gradient":new Yi(Ir.paint_line["line-gradient"])}),layout:Pl};const Tl=new class extends Zi{possiblyEvaluate(t,e){return e=new Di(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,n){return e=A({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}(Cl.paint.properties["line-width"].specification);function Bl(t,e){return e>0?e+2*t:t}Tl.useIntegerZoom=!0;const Vl=ts([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_z_tile_anchor",components:4,type:"Int16"}],4),El=ts([{name:"a_projected_pos",components:3,type:"Float32"}],4);ts([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Dl=ts([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Fl=ts([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);ts([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ll=ts([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);ts([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),ts([{name:"triangle",components:3,type:"Uint16"}]),ts([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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"},{type:"Uint8",name:"flipState"}]),ts([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),ts([{type:"Float32",name:"offsetX"}]),ts([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var jl=24;const $l=128;function Ol(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Di(t+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=r;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let s=i;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const o=e[i],a=e[s];return"composite"===r.kind?{kind:"composite",minZoom:o,maxZoom:a,interpolationType:n}:{kind:"camera",minZoom:o,maxZoom:a,minSize:r.evaluate(new Di(o)),maxSize:r.evaluate(new Di(a)),interpolationType:n}}}function Rl(t,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:i}){return"source"===t.kind?n/$l:"composite"===t.kind?te(n/$l,i/$l,r):e}function ql(t,e){let r=0,n=0;if("constant"===t.kind)n=t.layoutSize;else if("source"!==t.kind){const{interpolationType:i,minZoom:s,maxZoom:o}=t,a=i?b(ve.interpolationFactor(i,e,s,o),0,1):0;"camera"===t.kind?n=te(t.minSize,t.maxSize,a):r=a}return{uSizeT:r,uSize:n}}function Ul(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Ei.applyArabicShaping&&(t=Ei.applyArabicShaping(t)),t}(t.text,e,r)})),t}const Nl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Zl(t){return"︶"===t||"﹈"===t||"︸"===t||"﹄"===t||"﹂"===t||"︾"===t||"︼"===t||"︺"===t||"︘"===t||"﹀"===t||"︐"===t||"︓"===t||"︔"===t||"`"===t||" ̄"===t||"︑"===t||"︒"===t}function Xl(t){return"︵"===t||"﹇"===t||"︷"===t||"﹃"===t||"﹁"===t||"︽"===t||"︻"===t||"︹"===t||"︗"===t||"︿"===t}var Gl=function(t,e,r,n,i){var s,o,a=8*i-n-1,l=(1<<a)-1,u=l>>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,s=f&(1<<-c)-1,f>>=-c,c+=a;c>0;s=256*s+t[e+h],h+=p,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=p,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=u}return(f?-1:1)*o*Math.pow(2,s-n)},Yl=function(t,e,r,n,i,s){var o,a,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(e*l-1)*Math.pow(2,i),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+f]=255&a,f+=d,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;t[r+f]=255&o,f+=d,o/=256,u-=8);t[r+f-d]|=128*y},Kl=Jl;function Jl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Jl.Varint=0,Jl.Fixed64=1,Jl.Bytes=2,Jl.Fixed32=5;var Hl=4294967296,Wl=1/Hl,Ql="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function tu(t){return t.type===Jl.Bytes?t.readVarint()+t.pos:t.pos+1}function eu(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function ru(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function nu(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function iu(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function su(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function ou(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function au(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function lu(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function uu(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function cu(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function hu(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function pu(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function fu(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function du(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function yu(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:i,h:s,fill:e/(i*s)||0}}Jl.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,s=this.pos;this.type=7&n,t(i,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=pu(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=du(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=pu(this.buf,this.pos)+pu(this.buf,this.pos+4)*Hl;return this.pos+=8,t},readSFixed64:function(){var t=pu(this.buf,this.pos)+du(this.buf,this.pos+4)*Hl;return this.pos+=8,t},readFloat:function(){var t=Gl(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Gl(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,s=r.buf;if(n=(112&(i=s[r.pos++]))>>4,i<128)return eu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<3,i<128)return eu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<10,i<128)return eu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<17,i<128)return eu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<24,i<128)return eu(t,n,e);if(n|=(1&(i=s[r.pos++]))<<31,i<128)return eu(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ql?function(t,e,r){return Ql.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i<r;){var s,o,a,l=t[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(o=t[i+2],128==(192&(s=t[i+1]))&&128==(192&o)&&((u=(15&l)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=t[i+2],a=t[i+3],128==(192&(s=t[i+1]))&&128==(192&o)&&128==(192&a)&&((u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Jl.Bytes)return t.push(this.readVarint(e));var r=tu(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Jl.Bytes)return t.push(this.readSVarint());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Jl.Bytes)return t.push(this.readBoolean());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Jl.Bytes)return t.push(this.readFloat());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Jl.Bytes)return t.push(this.readDouble());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Jl.Bytes)return t.push(this.readFixed32());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Jl.Bytes)return t.push(this.readSFixed32());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Jl.Bytes)return t.push(this.readFixed64());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Jl.Bytes)return t.push(this.readSFixed64());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Jl.Varint)for(;this.buf[this.pos++]>127;);else if(e===Jl.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Jl.Fixed32)this.pos+=4;else{if(e!==Jl.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),fu(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),fu(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),fu(this.buf,-1&t,this.pos),fu(this.buf,Math.floor(t*Wl),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),fu(this.buf,-1&t,this.pos),fu(this.buf,Math.floor(t*Wl),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,s=0;s<e.length;s++){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){n>56319||s+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&ru(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Yl(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Yl(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&ru(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Jl.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,nu,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,iu,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,au,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,su,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,ou,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,lu,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,uu,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,cu,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,hu,e)},writeBytesField:function(t,e){this.writeTag(t,Jl.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Jl.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Jl.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Jl.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Jl.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Jl.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Jl.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Jl.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Jl.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Jl.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class mu{constructor(t,{pixelRatio:e,version:r,stretchX:n,stretchY:i,content:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=i,this.content=s,this.version=r}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class gu{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:s,h:o}=yu(i),a=new la({width:s||1,height:o||1});for(const e in t){const n=t[e],i=r[e].paddedRect;la.copy(n.data,a,{x:0,y:0},{x:i.x+1,y:i.y+1},n.data)}for(const t in e){const r=e[t],i=n[t].paddedRect,s=i.x+1,o=i.y+1,l=r.data.width,u=r.data.height;la.copy(r.data,a,{x:0,y:0},{x:s,y:o},r.data),la.copy(r.data,a,{x:0,y:u-1},{x:s,y:o-1},{width:l,height:1}),la.copy(r.data,a,{x:0,y:0},{x:s,y:o+u},{width:l,height:1}),la.copy(r.data,a,{x:l-1,y:0},{x:s-1,y:o},{width:1,height:u}),la.copy(r.data,a,{x:0,y:0},{x:s+l,y:o},{width:1,height:u})}this.image=a,this.iconPositions=r,this.patternPositions=n}addImages(t,e,r){for(const n in t){const i=t[n],s={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(s),e[n]=new mu(s,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,i]=t.tl;r.update(e.data,void 0,{x:n,y:i})}}mr("ImagePosition",mu),mr("ImageAtlas",gu);const xu={horizontal:1,vertical:2,horizontalOnly:3};class vu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const r=new vu;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new vu;return e.imageName=t,e}}class bu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const r=new bu;for(let n=0;n<t.sections.length;n++){const i=t.sections[n];i.image?r.addImageSection(i):r.addTextSection(i,e)}return r}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSections(){return this.sections}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(t){this.text=function(t,e){let r="";for(let n=0;n<t.length;n++){const i=t.charCodeAt(n+1)||null,s=t.charCodeAt(n-1)||null;r+=!e&&(i&&ei(i)&&!Nl[t[n+1]]||s&&ei(s)&&!Nl[t[n-1]])||!Nl[t[n]]?t[n]:Nl[t[n]]}return r}(this.text,t)}trim(){let t=0;for(let e=0;e<this.text.length&&_u[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&_u[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const r=new bu;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(vu.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(r)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void T("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(vu.forImage(e)),this.sectionIndex.push(this.sections.length-1)):T("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function wu(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y){const m=bu.fromFeature(t,i);let g;h===xu.vertical&&m.verticalizePunctuation(p);const{processBidirectionalText:x,processStyledBidirectionalText:v}=Ei;if(x&&1===m.sections.length){g=[];const t=x(m.toString(),Pu(m,u,s,e,n,f,d));for(const e of t){const t=new bu;t.text=e,t.sections=m.sections;for(let r=0;r<e.length;r++)t.sectionIndex.push(0);g.push(t)}}else if(v){g=[];const t=v(m.text,m.sectionIndex,Pu(m,u,s,e,n,f,d));for(const e of t){const t=new bu;t.text=e[0],t.sectionIndex=e[1],t.sections=m.sections,g.push(t)}}else g=function(t,e){const r=[],n=t.text;let i=0;for(const n of e)r.push(t.substring(i,n)),i=n;return i<n.length&&r.push(t.substring(i,n.length)),r}(m,Pu(m,u,s,e,n,f,d));const b=[],w={positionedLines:b,text:m.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(t,e,r,n,i,s,o,a,l,u,c,h){let p=0,f=0,d=0;const y="right"===a?1:"left"===a?0:.5;let m=!1;for(const t of i){const r=t.getSections();for(const t of r){if(t.imageName)continue;const r=e[t.fontStack];if(r&&(m=void 0!==r.ascender&&void 0!==r.descender,!m))break}if(!m)break}let g=0;for(const o of i){o.trim();const i=o.getMaxScale(),a=(i-1)*jl,v={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=v;const b=v.positionedGlyphs;let w=0;if(!o.length()){f+=s,++g;continue}let _=0,A=0;for(let s=0;s<o.length();s++){const a=o.getSection(s),d=o.getSectionIndex(s),y=o.getCharCode(s);let g=a.scale,v=null,S=null,k=null,I=jl,z=0;const M=!(l===xu.horizontal||!c&&!ti(y)||c&&(_u[y]||(x=y,kn(x)||In(x)||zn(x)||Zn(x)||Kn(x))));if(a.imageName){const e=n[a.imageName];if(!e)continue;k=a.imageName,t.iconsInText=t.iconsInText||!0,S=e.paddedRect;const r=e.displaySize;g=g*jl/h,v={width:r[0],height:r[1],left:1,top:-3,advance:M?r[1]:r[0],localGlyph:!1},z=m?-v.height*g:i*jl-17-r[1]*g,I=v.advance;const s=(M?r[0]:r[1])*g-jl*i;s>0&&s>w&&(w=s)}else{const t=r[a.fontStack];if(!t)continue;t[y]&&(S=t[y]);const n=e[a.fontStack];if(!n)continue;const s=n.glyphs[y];if(!s)continue;if(v=s.metrics,I=8203!==y?jl:0,m){const t=void 0!==n.ascender?Math.abs(n.ascender):0,e=void 0!==n.descender?Math.abs(n.descender):0,r=(t+e)*g;_<r&&(_=r,A=(t-e)/2*g),z=-t*g}else z=(i-g)*jl-17}M?(t.verticalizable=!0,b.push({glyph:y,imageName:k,x:p,y:f+z,vertical:M,scale:g,localGlyph:v.localGlyph,fontStack:a.fontStack,sectionIndex:d,metrics:v,rect:S}),p+=I*g+u):(b.push({glyph:y,imageName:k,x:p,y:f+z,vertical:M,scale:g,localGlyph:v.localGlyph,fontStack:a.fontStack,sectionIndex:d,metrics:v,rect:S}),p+=v.advance*g+u)}0!==b.length&&(d=Math.max(p-u,d),m?Tu(b,y,w,A,s*i/2):Tu(b,y,w,0,s/2)),p=0;const S=s*i+w;v.lineOffset=Math.max(w,a),f+=S,++g}var x;const v=f,{horizontalAlign:b,verticalAlign:w}=Cu(o);(function(t,e,r,n,i,s){const o=(e-r)*i,a=-s*n;for(const e of t)for(const t of e.positionedGlyphs)t.x+=o,t.y+=a})(t.positionedLines,y,b,w,d,v),t.top+=-w*v,t.bottom=t.top+v,t.left+=-b*d,t.right=t.left+d,t.hasBaseline=m}(w,e,r,n,g,o,a,l,h,u,p,y),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const _u={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Au={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Su(t,e,r,n,i,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*jl/s+i:0}{const n=r[e.fontStack],s=n&&n.glyphs[t];return s?s.metrics.advance*e.scale+i:0}}function ku(t,e,r,n){const i=Math.pow(t-e,2);return n?t<e?i/2:2*i:i+Math.abs(r)*r}function Iu(t,e,r){let n=0;return 10===t&&(n-=1e4),r&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function zu(t,e,r,n,i,s){let o=null,a=ku(e,r,i,s);for(const t of n){const n=ku(e-t.x,r,i,s)+t.badness;n<=a&&(o=t,a=n)}return{index:t,x:e,priorBreak:o,badness:a}}function Mu(t){return t?Mu(t.priorBreak).concat(t.index):[]}function Pu(t,e,r,n,i,s,o){if("point"!==s)return[];if(!t)return[];const a=[],l=function(t,e,r,n,i,s){let o=0;for(let r=0;r<t.length();r++){const a=t.getSection(r);o+=Su(t.getCharCode(r),a,n,i,e,s)}return o/Math.max(1,Math.ceil(o/r))}(t,e,r,n,i,o),u=t.text.indexOf("​")>=0;let c=0;for(let r=0;r<t.length();r++){const s=t.getSection(r),p=t.getCharCode(r);if(_u[p]||(c+=Su(p,s,n,i,e,o)),r<t.length()-1){const e=!((h=p)<11904||!(Dn(h)||En(h)||Gn(h)||Nn(h)||$n(h)||Mn(h)||Fn(h)||Tn(h)||On(h)||Rn(h)||jn(h)||Jn(h)||Bn(h)||Cn(h)||Pn(h)||Ln(h)||Vn(h)||Xn(h)||Un(h)||qn(h)));(Au[p]||e||s.imageName)&&a.push(zu(r+1,c,l,a,Iu(p,t.getCharCode(r+1),e&&u),!1))}}var h;return Mu(zu(t.length(),c,l,a,0,!0))}function Cu(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Tu(t,e,r,n,i){if(!(e||r||n||i))return;const s=t.length-1,o=t[s],a=(o.x+o.metrics.advance*o.scale)*e;for(let e=0;e<=s;e++)t[e].x-=a,t[e].y+=r+n+i}function Bu(t,e,r){const{horizontalAlign:n,verticalAlign:i}=Cu(r),s=e[0]-t.displaySize[0]*n,o=e[1]-t.displaySize[1]*i;return{image:t,top:o,bottom:o+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function Vu(t,e,r,n,i,s){const o=t.image;let a;if(o.content){const t=o.content,e=o.pixelRatio||1;a=[t[0]/e,t[1]/e,o.displaySize[0]-t[2]/e,o.displaySize[1]-t[3]/e]}const l=e.left*s,u=e.right*s;let c,h,p,f;"width"===r||"both"===r?(f=i[0]+l-n[3],h=i[0]+u+n[1]):(f=i[0]+(l+u-o.displaySize[0])/2,h=f+o.displaySize[0]);const d=e.top*s,y=e.bottom*s;return"height"===r||"both"===r?(c=i[1]+d-n[0],p=i[1]+y+n[2]):(c=i[1]+(d+y-o.displaySize[1])/2,p=c+o.displaySize[1]),{image:o,top:c,right:h,bottom:p,left:f,collisionPadding:a}}class Eu extends r{constructor(t,e,r,n,i){super(t,e),this.angle=n,this.z=r,void 0!==i&&(this.segment=i)}clone(){return new Eu(this.x,this.y,this.z,this.angle,this.segment)}}function Du(t,e,r,n,i){if(void 0===e.segment)return!0;let s=e,o=e.segment+1,a=0;for(;a>-r/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const l=[];let u=0;for(;a<r/2;){const e=t[o],r=t[o+1];if(!r)return!1;let s=t[o-1].angleTo(e)-e.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:s}),u+=s;a-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;o++,a+=e.dist(r)}return!0}function Fu(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Lu(t,e,r){return t?.6*e*r:0}function ju(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function $u(t,e,r,n,i,s){const o=Lu(r,i,s),a=ju(r,n)*s;let l=0;const u=Fu(t)/2;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1],s=n.dist(i);if(l+s>u){const c=(u-l)/s,h=te(n.x,i.x,c),p=te(n.y,i.y,c),f=new Eu(h,p,0,i.angleTo(n),r);return!o||Du(t,f,a,o,e)?f:void 0}l+=s}}function Ou(t,e,r,n,i,s,o,a,l){const u=Lu(n,s,o),c=ju(n,i),h=c*o,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),Ru(t,p?e/2*a%e:(c/2+2*s)*o*a%e,e,u,r,h,p,!1,l)}function Ru(t,e,r,n,i,s,o,a,l){const u=s/2,c=Fu(t);let h=0,p=e-r,f=[];for(let e=0;e<t.length-1;e++){const o=t[e],a=t[e+1],d=o.dist(a),y=a.angleTo(o);for(;p+r<h+d;){p+=r;const m=(p-h)/d,g=te(o.x,a.x,m),x=te(o.y,a.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new Eu(g,x,0,y,e);r._round(),n&&!Du(t,r,s,n,i)||f.push(r)}}h+=d}return a||f.length||o||(f=Ru(t,h/2,r,n,i,s,o,!0,l)),f}function qu(t,e,n,i){const s=[],o=t.image,a=o.pixelRatio,l=o.paddedRect.w-2,u=o.paddedRect.h-2,c=t.right-t.left,h=t.bottom-t.top,p=o.stretchX||[[0,l]],f=o.stretchY||[[0,u]],d=(t,e)=>t+e[1]-e[0],y=p.reduce(d,0),m=f.reduce(d,0),g=l-y,x=u-m;let v=0,b=y,w=0,_=m,A=0,S=g,k=0,I=x;if(o.content&&i){const t=o.content;v=Uu(p,0,t[0]),w=Uu(f,0,t[1]),b=Uu(p,t[0],t[2]),_=Uu(f,t[1],t[3]),A=t[0]-v,k=t[1]-w,S=t[2]-t[0]-b,I=t[3]-t[1]-_}const z=(i,s,l,u)=>{const p=Zu(i.stretch-v,b,c,t.left),f=Xu(i.fixed-A,S,i.stretch,y),d=Zu(s.stretch-w,_,h,t.top),g=Xu(s.fixed-k,I,s.stretch,m),x=Zu(l.stretch-v,b,c,t.left),z=Xu(l.fixed-A,S,l.stretch,y),M=Zu(u.stretch-w,_,h,t.top),P=Xu(u.fixed-k,I,u.stretch,m),C=new r(p,d),T=new r(x,d),B=new r(x,M),V=new r(p,M),E=new r(f/a,g/a),D=new r(z/a,P/a),F=e*Math.PI/180;if(F){const t=Math.sin(F),e=Math.cos(F),r=[e,-t,t,e];C._matMult(r),T._matMult(r),V._matMult(r),B._matMult(r)}const L=i.stretch+i.fixed,j=s.stretch+s.fixed;return{tl:C,tr:T,bl:V,br:B,tex:{x:o.paddedRect.x+1+L,y:o.paddedRect.y+1+j,w:l.stretch+l.fixed-L,h:u.stretch+u.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:E,pixelOffsetBR:D,minFontScaleX:S/a/c,minFontScaleY:I/a/h,isSDF:n}};if(i&&(o.stretchX||o.stretchY)){const t=Nu(p,g,y),e=Nu(f,x,m);for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)s.push(z(n,e[t],i,e[t+1]))}}else s.push(z({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return s}function Uu(t,e,r){let n=0;for(const i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function Nu(t,e,r){const n=[{fixed:-1,stretch:0}];for(const[e,r]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(r-e)})}return n.push({fixed:e+1,stretch:r}),n}function Zu(t,e,r,n){return t/e*r+n}function Xu(t,e,r,n){return t-e*r/n}function Gu(t,e,r,n){const i=e+t.positionedLines[n].lineOffset;return 0===n?r+i/2:r+(i+(e+t.positionedLines[n-1].lineOffset))/2}mr("Anchor",Eu);class Yu{constructor(t=[],e=Ku){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t<n;){let n=1+(t<<1),s=e[n];const o=n+1;if(o<this.length&&r(e[o],s)<0&&(n=o,s=e[o]),r(s,i)>=0)break;e[t]=s,t=n}e[t]=i}}function Ku(t,e){return t<e?-1:t>e?1:0}function Ju(t,e=1,n=!1){let i=1/0,s=1/0,o=-1/0,a=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<i)&&(i=e.x),(!t||e.y<s)&&(s=e.y),(!t||e.x>o)&&(o=e.x),(!t||e.y>a)&&(a=e.y)}const u=Math.min(o-i,a-s);let c=u/2;const h=new Yu([],Hu);if(0===u)return new r(i,s);for(let e=i;e<o;e+=u)for(let r=s;r<a;r+=u)h.push(new Wu(e+c,r+c,c,t));let p=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,s=i.length,o=s-1;t<s;o=t++){const s=i[t],a=i[o],l=s.x*a.y-a.x*s.y;r+=(s.x+a.x)*l,n+=(s.y+a.y)*l,e+=3*l}return new Wu(r/e,n/e,0,t)}(t),f=h.length;for(;h.length;){const r=h.pop();(r.d>p.d||!p.d)&&(p=r,n&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,f)),r.max-p.d<=e||(c=r.h/2,h.push(new Wu(r.p.x-c,r.p.y-c,c,t)),h.push(new Wu(r.p.x+c,r.p.y-c,c,t)),h.push(new Wu(r.p.x-c,r.p.y+c,c,t)),h.push(new Wu(r.p.x+c,r.p.y+c,c,t)),f+=4)}return n&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function Hu(t,e){return e.max-t.max}function Wu(t,e,n,i){this.p=new r(t,e),this.h=n,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){const s=e[i];for(let e=0,i=s.length,o=i-1;e<i;o=e++){const i=s[e],a=s[o];i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(r=!r),n=Math.min(n,Ro(t,i,a))}}return(r?1:-1)*Math.sqrt(n)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}const Qu=Number.POSITIVE_INFINITY,tc=Math.sqrt(2);function ec(t,e,r,n,i,s,o,a,l,u){t.createArrays(),t.tilePixelRatio=mo/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const c=t.layers[0].layout,h=t.layers[0]._unevaluatedLayout._values,p={};if("composite"===t.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.textSizeData;p.compositeTextSizes=[h["text-size"].possiblyEvaluate(new Di(e),a),h["text-size"].possiblyEvaluate(new Di(r),a)]}if("composite"===t.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.iconSizeData;p.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new Di(e),a),h["icon-size"].possiblyEvaluate(new Di(r),a)]}p.layoutTextSize=h["text-size"].possiblyEvaluate(new Di(l+1),a),p.layoutIconSize=h["icon-size"].possiblyEvaluate(new Di(l+1),a),p.textMaxSize=h["text-size"].possiblyEvaluate(new Di(18),a);const f="map"===c.get("text-rotation-alignment")&&"point"!==c.get("symbol-placement"),d=c.get("text-size");for(const s of t.features){const l=c.get("text-font").evaluate(s,{},a).join(","),h=d.evaluate(s,{},a),g=p.layoutTextSize.evaluate(s,{},a),x=(p.layoutIconSize.evaluate(s,{},a),{horizontal:{},vertical:void 0}),v=s.text;let b,w=[0,0];if(v){const n=v.toString(),o=c.get("text-letter-spacing").evaluate(s,{},a)*jl,u=c.get("text-line-height").evaluate(s,{},a)*jl,p=Wn(n)?o:0,d=c.get("text-anchor").evaluate(s,{},a),b=c.get("text-variable-anchor");if(!b){const t=c.get("text-radial-offset").evaluate(s,{},a);t?(y=d,w=(m=[t*jl,Qu])[1]!==Qu?function(t,e,r){let n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(y,m[0],m[1]):function(t,e){let r=0,n=0;e<0&&(e=0);const i=e/tc;switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(y,m[0])):w=c.get("text-offset").evaluate(s,{},a).map((t=>t*jl))}let _=f?"center":c.get("text-justify").evaluate(s,{},a);const A=c.get("symbol-placement"),S="point"===A,k="point"===A?c.get("text-max-width").evaluate(s,{},a)*jl:0,I=s=>{t.allowVerticalPlacement&&Hn(n)&&(x.vertical=wu(v,e,r,i,l,k,u,d,s,p,w,xu.vertical,!0,A,g,h))};if(!f&&b){const t="auto"===_?b.map((t=>rc(t))):[_];let n=!1;for(let s=0;s<t.length;s++){const o=t[s];if(!x.horizontal[o])if(n)x.horizontal[o]=x.horizontal[0];else{const t=wu(v,e,r,i,l,k,u,"center",o,p,w,xu.horizontal,!1,A,g,h);t&&(x.horizontal[o]=t,n=1===t.positionedLines.length)}}I("left")}else{if("auto"===_&&(_=rc(d)),S||c.get("text-writing-mode").indexOf("horizontal")>=0||!Hn(n)){const t=wu(v,e,r,i,l,k,u,d,_,p,w,xu.horizontal,!1,A,g,h);t&&(x.horizontal[_]=t)}I("point"===A?"left":_)}}let _=!1;if(s.icon&&s.icon.name){const e=n[s.icon.name];e&&(b=Bu(i[s.icon.name],c.get("icon-offset").evaluate(s,{},a),c.get("icon-anchor").evaluate(s,{},a)),_=e.sdf,void 0===t.sdfIcons?t.sdfIcons=e.sdf:t.sdfIcons!==e.sdf&&T("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.pixelRatio||0!==c.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}const A=oc(x.horizontal)||x.vertical;t.iconsInText||(t.iconsInText=!!A&&A.iconsInText),(A||b)&&nc(t,s,x,b,n,p,g,0,w,_,o,a,u)}var y,m;s&&t.generateCollisionDebugBuffers(l,t.collisionBoxArray)}function rc(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function nc(t,e,n,i,s,o,a,l,u,c,h,p,f){let d=o.textMaxSize.evaluate(e,{},p);void 0===d&&(d=a);const y=t.layers[0].layout,m=y.get("icon-offset").evaluate(e,{},p),g=oc(n.horizontal)||n.vertical,v=a/24,b=t.tilePixelRatio*d/24,w=t.tilePixelRatio*y.get("symbol-spacing"),_=y.get("text-padding")*t.tilePixelRatio,A=y.get("icon-padding")*t.tilePixelRatio,S=x(y.get("text-max-angle")),k="map"===y.get("text-rotation-alignment")&&"point"!==y.get("symbol-placement"),I="map"===y.get("icon-rotation-alignment")&&"point"!==y.get("symbol-placement"),z=y.get("symbol-placement"),M=w/2,P=y.get("icon-text-fit");let C;i&&"none"!==P&&(t.allowVerticalPlacement&&n.vertical&&(C=Vu(i,n.vertical,P,y.get("icon-text-fit-padding"),m,v)),g&&(i=Vu(i,g,P,y.get("icon-text-fit-padding"),m,v)));const B=(r,a,l)=>{if(a.x<0||a.x>=mo||a.y<0||a.y>=mo)return;const{x:d,y:y,z:g}=f.projectTilePoint(a.x,a.y,l),x=new Eu(d,y,g,0,void 0);!function(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S){const k=t.addToLineVertexArray(e,n);let I,z,M,P,C,B,V,E=0,D=0,F=0,L=0,j=-1,$=-1;const O={};let R=Rs(""),q=0,U=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[q,U]=l.layout.get("text-offset").evaluate(b,{},S).map((t=>t*jl)):(q=l.layout.get("text-radial-offset").evaluate(b,{},S)*jl,U=Qu),t.allowVerticalPlacement&&i.vertical){const t=i.vertical;if(d)B=lc(t),a&&(V=lc(a));else{const n=l.layout.get("text-rotate").evaluate(b,{},S)+90;M=ac(u,r,e,c,h,p,t,f,n,y),a&&(P=ac(u,r,e,c,h,p,a,g,n))}}if(s){const n=l.layout.get("icon-rotate").evaluate(b,{},S),i="none"!==l.layout.get("icon-text-fit"),o=qu(s,n,_,i),f=a?qu(a,n,_,i):void 0;z=ac(u,r,e,c,h,p,s,g,n),E=4*o.length;const d=t.iconSizeData;let y=null;"source"===d.kind?(y=[$l*l.layout.get("icon-size").evaluate(b,{},S)],y[0]>ic&&T(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===d.kind&&(y=[$l*w.compositeIconSizes[0].evaluate(b,{},S),$l*w.compositeIconSizes[1].evaluate(b,{},S)],(y[0]>ic||y[1]>ic)&&T(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,o,y,v,x,b,!1,r,e,k.lineStartIndex,k.lineLength,-1,A,S),j=t.icon.placedSymbolArray.length-1,f&&(D=4*f.length,t.addSymbols(t.icon,f,y,v,x,b,xu.vertical,r,e,k.lineStartIndex,k.lineLength,-1,A,S),$=t.icon.placedSymbolArray.length-1)}for(const n in i.horizontal){const s=i.horizontal[n];I||(R=Rs(s.text),d?C=lc(s):I=ac(u,r,e,c,h,p,s,f,l.layout.get("text-rotate").evaluate(b,{},S),y));const a=1===s.positionedLines.length;if(F+=sc(t,r,e,s,o,l,d,b,y,k,i.vertical?xu.horizontal:xu.horizontalOnly,a?Object.keys(i.horizontal):[n],O,j,w,A,S),a)break}i.vertical&&(L+=sc(t,r,e,i.vertical,o,l,d,b,y,k,xu.vertical,["vertical"],O,$,w,A,S));let N=-1;const Z=(t,e)=>t?Math.max(t,e):e;N=Z(C,N),N=Z(B,N),N=Z(V,N);const X=N>-1?1:0;t.glyphOffsetArray.length>=gc.MAX_GLYPHS&&T("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey),t.symbolInstances.emplaceBack(r.x,r.y,r.z,e.x,e.y,O.right>=0?O.right:-1,O.center>=0?O.center:-1,O.left>=0?O.left:-1,O.vertical>=0?O.vertical:-1,j,$,R,void 0!==I?I:t.collisionBoxArray.length,void 0!==I?I+1:t.collisionBoxArray.length,void 0!==M?M:t.collisionBoxArray.length,void 0!==M?M+1:t.collisionBoxArray.length,void 0!==z?z:t.collisionBoxArray.length,void 0!==z?z+1:t.collisionBoxArray.length,P||t.collisionBoxArray.length,P?P+1:t.collisionBoxArray.length,c,F,L,E,D,X,0,q,U,N)}(t,a,x,r,n,i,s,C,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,_,k,u,0,A,I,m,e,o,c,h,p)};if("line"===z)for(const s of function(t,e,n,i,s){const o=[];for(let e=0;e<t.length;e++){const n=t[e];let a;for(let t=0;t<n.length-1;t++){let e=n[t],l=n[t+1];e.x<0&&l.x<0||(e.x<0?e=new r(0,e.y+(0-e.x)/(l.x-e.x)*(l.y-e.y))._round():l.x<0&&(l=new r(0,e.y+(0-e.x)/(l.x-e.x)*(l.y-e.y))._round()),e.y<0&&l.y<0||(e.y<0?e=new r(e.x+(0-e.y)/(l.y-e.y)*(l.x-e.x),0)._round():l.y<0&&(l=new r(e.x+(0-e.y)/(l.y-e.y)*(l.x-e.x),0)._round()),e.x>=i&&l.x>=i||(e.x>=i?e=new r(i,e.y+(i-e.x)/(l.x-e.x)*(l.y-e.y))._round():l.x>=i&&(l=new r(i,e.y+(i-e.x)/(l.x-e.x)*(l.y-e.y))._round()),e.y>=s&&l.y>=s||(e.y>=s?e=new r(e.x+(s-e.y)/(l.y-e.y)*(l.x-e.x),s)._round():l.y>=s&&(l=new r(e.x+(s-e.y)/(l.y-e.y)*(l.x-e.x),s)._round()),a&&e.equals(a[a.length-1])||(a=[e],o.push(a)),a.push(l)))))}}return o}(e.geometry,0,0,mo,mo)){const e=Ou(s,w,S,n.vertical||g,i,24,b,t.overscaling,mo);for(const r of e){const e=g;e&&uc(t,e.text,M,r)||B(s,r,p)}}else if("line-center"===z){for(const t of e.geometry)if(t.length>1){const e=$u(t,S,n.vertical||g,i,24,b);e&&B(t,e,p)}}else if("Polygon"===e.type)for(const t of Xa(e.geometry,0)){const e=Ju(t,16);B(t[0],new Eu(e.x,e.y,0,0,void 0),p)}else if("LineString"===e.type)for(const t of e.geometry)B(t,new Eu(t[0].x,t[0].y,0,0,void 0),p);else if("Point"===e.type)for(const t of e.geometry)for(const e of t)B([e],new Eu(e.x,e.y,0,0,void 0),p)}const ic=32640;function sc(t,e,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g){const x=function(t,e,n,i,s,o,a,l){const u=[];if(0===e.positionedLines.length)return u;const c=i.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,h=function(t){const e=t[0],r=t[1],n=e*r;return n>0?[e,-r]:n<0?[-e,r]:0===e?[r,e]:[r,-e]}(n);let p=Math.abs(e.top-e.bottom);for(const t of e.positionedLines)p-=t.lineOffset;const f=e.positionedLines.length,d=p/f;let y=e.top-n[1];for(let t=0;t<f;++t){const i=e.positionedLines[t];y=Gu(e,d,y,t);for(const t of i.positionedGlyphs){if(!t.rect)continue;const i=t.rect||{};let o=4,p=!0,f=1,d=0;if(t.imageName){const e=a[t.imageName];if(!e)continue;if(e.sdf){T("SDF images are not supported in formatted text and will be ignored.");continue}p=!1,f=e.pixelRatio,o=1/f}const m=(s||l)&&t.vertical,g=t.metrics.advance*t.scale/2,x=t.metrics,v=t.rect;if(null===v)continue;l&&e.verticalizable&&(d=t.imageName?g-t.metrics.width*t.scale/2:0);const b=s?[t.x+g,t.y]:[0,0];let w=[0,0],_=[0,0],A=!1;s||(m?(_=[t.x+g+h[0],t.y+h[1]-d],A=!0):w=[t.x+g+n[0],t.y+n[1]-d]);const S=v.w*t.scale/(f*(t.localGlyph?2:1)),k=v.h*t.scale/(f*(t.localGlyph?2:1));let I,z,M,P;if(m){const e=t.y-y,n=new r(-g,g-e),i=-Math.PI/2,s=new r(..._);I=new r(-g+w[0],w[1]),I._rotateAround(i,n)._add(s),I.x+=-e+g,I.y-=(x.left-o)*t.scale;const a=t.imageName?x.advance*t.scale:jl*t.scale,l=String.fromCharCode(t.glyph);Zl(l)?I.x+=(1-o)*t.scale:Xl(l)?I.x+=a-x.height*t.scale+(-o-1)*t.scale:I.x+=t.imageName||x.width+2*o===v.w&&x.height+2*o===v.h?(a-k)/2:(a-(x.height+2*o)*t.scale)/2,z=new r(I.x,I.y-S),M=new r(I.x+k,I.y),P=new r(I.x+k,I.y-S)}else{const e=(x.left-o)*t.scale-g+w[0],n=(-x.top-o)*t.scale+w[1],i=e+S,s=n+k;I=new r(e,n),z=new r(i,n),M=new r(e,s),P=new r(i,s)}if(c){let t;t=s?new r(0,0):A?new r(h[0],h[1]):new r(n[0],n[1]),I._rotateAround(c,t),z._rotateAround(c,t),M._rotateAround(c,t),P._rotateAround(c,t)}const C=new r(0,0),B=new r(0,0);u.push({tl:I,tr:z,bl:M,br:P,tex:i,writingMode:e.writingMode,glyphOffset:b,sectionIndex:t.sectionIndex,isSDF:p,pixelOffsetTL:C,pixelOffsetBR:B,minFontScaleX:0,minFontScaleY:0})}}return u}(0,i,u,o,a,l,s,t.allowVerticalPlacement),v=t.textSizeData;let b=null;"source"===v.kind?(b=[$l*o.layout.get("text-size").evaluate(l,{},g)],b[0]>ic&&T(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===v.kind&&(b=[$l*y.compositeTextSizes[0].evaluate(l,{},g),$l*y.compositeTextSizes[1].evaluate(l,{},g)],(b[0]>ic||b[1]>ic)&&T(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,x,b,u,a,l,h,e,n,c.lineStartIndex,c.lineLength,d,m,g);for(const e of p)f[e]=t.text.placedSymbolArray.length-1;return 4*x.length}function oc(t){for(const e in t)return t[e];return null}function ac(t,e,n,i,s,o,a,l,u,c){let h=a.top,p=a.bottom,f=a.left,d=a.right;const y=a.collisionPadding;if(y&&(f-=y[0],h-=y[1],d+=y[2],p+=y[3]),u){const t=new r(f,h),e=new r(d,h),n=new r(f,p),i=new r(d,p),s=x(u);let o=new r(0,0);c&&(o=new r(c[0],c[1])),t._rotateAround(s,o),e._rotateAround(s,o),n._rotateAround(s,o),i._rotateAround(s,o),f=Math.min(t.x,e.x,n.x,i.x),d=Math.max(t.x,e.x,n.x,i.x),h=Math.min(t.y,e.y,n.y,i.y),p=Math.max(t.y,e.y,n.y,i.y)}return t.emplaceBack(e.x,e.y,e.z,n.x,n.y,f,h,d,p,l,i,s,o),t.length-1}function lc(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function uc(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<r)return!0}else i[e]=[];return i[e].push(n),!1}const cc=cl.VectorTileFeature.types,hc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function pc(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y){const m=c?Math.min(ic,Math.round(c[0])):0,g=c?Math.min(ic,Math.round(c[1])):0;t.emplaceBack(e,r,Math.round(32*o),Math.round(32*a),l,u,(m<<1)+(h?1:0),g,16*p,16*f,256*d,256*y,n,i,s,0)}function fc(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function dc(t){for(const e of t.sections)if(ii(e.text))return!0;return!1}class yc{constructor(t){this.layoutVertexArray=new ls,this.indexArray=new ds,this.programConfigurations=t,this.segments=new yo,this.dynamicLayoutVertexArray=new ss,this.opacityVertexArray=new us,this.placedSymbolArray=new Ms}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,r,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Vl.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,El.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,hc,!0),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}mr("SymbolBuffers",yc);class mc{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new yo,this.collisionVertexArray=new fs,this.collisionVertexArrayExt=new ss}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Dl.members,!0),this.collisionVertexBufferExt=t.createVertexBuffer(this.collisionVertexArrayExt,Fl.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}mr("CollisionBuffers",mc);class gc{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=a([]),this.placementViewportMatrix=a([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ol(this.zoom,e["text-size"]),this.iconSizeData=Ol(this.zoom,e["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map((t=>xu[t])),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID}createArrays(){this.text=new yc(new io(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new yc(new io(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Ts,this.lineVertexArray=new Bs,this.symbolInstances=new Cs}calculateGlyphDependencies(t,e,r,n,i){for(let r=0;r<t.length;r++)if(e[t.charCodeAt(r)]=!0,n&&i){const n=Nl[t.charAt(r)];n&&(e[n.charCodeAt(0)]=!0)}}populate(t,e,r,n){const i=this.layers[0],s=i.layout,o=s.get("text-font"),a=s.get("text-field"),l=s.get("icon-image"),u=("constant"!==a.value.kind||a.value.value instanceof ht&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),c="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=s.get("symbol-sort-key");if(this.features=[],!u&&!c)return;const p=e.iconDependencies,f=e.glyphDependencies,d=e.availableImages,y=new Di(this.zoom);for(const{feature:e,id:a,index:l,sourceLayerIndex:m}of t){const t=i._featureFilter.needGeometry,g=To(e,t);if(!i._featureFilter.filter(y,g,r))continue;let x,v;if(t||(g.geometry=Co(e,r,n)),u){const t=i.getValueAndResolveTokens("text-field",g,r,d),e=ht.factory(t);dc(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Bi||this.hasRTLText&&Ei.isParsed())&&(x=Ul(e,i,g))}if(c){const t=i.getValueAndResolveTokens("icon-image",g,r,d);v=t instanceof pt?t:pt.fromString(t)}if(!x&&!v)continue;const b=this.sortFeaturesByKey?h.evaluate(g,{},r):void 0;if(this.features.push({id:a,text:x,icon:v,index:l,sourceLayerIndex:m,geometry:g.geometry,properties:e.properties,type:cc[e.type],sortKey:b}),v&&(p[v.name]=!0),x){const t=o.evaluate(g,{},r).join(","),e="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(xu.vertical)>=0;for(const r of x.sections)if(r.image)p[r.image.name]=!0;else{const n=Hn(x.toString()),i=r.fontStack||t,s=f[i]=f[i]||{};this.calculateGlyphDependencies(r.text,s,e,this.allowVerticalPlacement,n)}}}"line"===s.get("symbol-placement")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++}function o(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function a(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const f=l(p,h),d=l(p,h,!0);if(f in r&&d in e&&r[f]!==e[d]){const t=a(f,d,h),i=o(f,d,n[t].geometry);delete e[f],delete r[d],r[l(p,n[i].geometry,!0)]=i,n[t].geometry=null}else f in r?o(f,d,h):d in e?a(f,d,h):(s(u),e[f]=i-1,r[d]=i-1)}return n.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r,n),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r,n))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const i={};for(let n=t.segment+1;n<e.length;n++)i[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:r},n<e.length-1&&(r+=e[n+1].dist(e[n]));for(let r=t.segment||0;r>=0;r--)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r>0&&(n+=e[r-1].dist(e[r]));for(let t=0;t<e.length;t++){const e=i[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,o,a,l,u,c,h,p,f){const d=t.indexArray,y=t.layoutVertexArray,m=t.segments.prepareSegment(4*e.length,y,d,this.canOverlap?s.sortKey:void 0),g=this.glyphOffsetArray.length,x=m.vertexLength,v=this.allowVerticalPlacement&&o===xu.vertical?Math.PI/2:0,b=s.text&&s.text.sections;for(let n=0;n<e.length;n++){const{tl:i,tr:o,bl:u,br:c,tex:h,pixelOffsetTL:g,pixelOffsetBR:x,minFontScaleX:w,minFontScaleY:_,glyphOffset:A,isSDF:S,sectionIndex:k}=e[n],I=m.vertexLength,z=A[1];pc(y,a.x,a.y,a.z,l.x,l.y,i.x,z+i.y,h.x,h.y,r,S,g.x,g.y,w,_),pc(y,a.x,a.y,a.z,l.x,l.y,o.x,z+o.y,h.x+h.w,h.y,r,S,x.x,g.y,w,_),pc(y,a.x,a.y,a.z,l.x,l.y,u.x,z+u.y,h.x,h.y+h.h,r,S,g.x,x.y,w,_),pc(y,a.x,a.y,a.z,l.x,l.y,c.x,z+c.y,h.x+h.w,h.y+h.h,r,S,x.x,x.y,w,_),fc(t.dynamicLayoutVertexArray,a,v),d.emplaceBack(I,I+1,I+2),d.emplaceBack(I+1,I+2,I+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),n!==e.length-1&&k===e[n+1].sectionIndex||t.programConfigurations.populatePaintArrays(y.length,s,s.index,{},p,f,b&&b[k])}t.placedSymbolArray.emplaceBack(a.x,a.y,a.z,l.x,l.y,g,this.glyphOffsetArray.length-g,x,u,c,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],o,0,!1,0,h,0)}_commitLayoutVertex(t,e,r,n,i,s,o){t.emplaceBack(e,r,n,i,s,Math.round(o.x),Math.round(o.y))}_addCollisionDebugVertices(t,e,n,i,s,o,a){const l=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),u=l.vertexLength,c=a.tileAnchorX,h=a.tileAnchorY;for(let t=0;t<4;t++)n.collisionVertexArray.emplaceBack(0,0,0,0);n.collisionVertexArrayExt.emplaceBack(e,-t.padding,-t.padding),n.collisionVertexArrayExt.emplaceBack(e,t.padding,-t.padding),n.collisionVertexArrayExt.emplaceBack(e,t.padding,t.padding),n.collisionVertexArrayExt.emplaceBack(e,-t.padding,t.padding),this._commitLayoutVertex(n.layoutVertexArray,i,s,o,c,h,new r(t.x1,t.y1)),this._commitLayoutVertex(n.layoutVertexArray,i,s,o,c,h,new r(t.x2,t.y1)),this._commitLayoutVertex(n.layoutVertexArray,i,s,o,c,h,new r(t.x2,t.y2)),this._commitLayoutVertex(n.layoutVertexArray,i,s,o,c,h,new r(t.x1,t.y2)),l.vertexLength+=4;const p=n.indexArray;p.emplaceBack(u,u+1),p.emplaceBack(u+1,u+2),p.emplaceBack(u+2,u+3),p.emplaceBack(u+3,u),l.primitiveLength+=4}_addTextDebugCollisionBoxes(t,e,r,n,i,s){for(let o=n;o<i;o++){const n=r.get(o),i=this.getSymbolInstanceTextSize(t,s,e,o);this._addCollisionDebugVertices(n,i,this.textCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(t,e,r,n,i,s){for(let o=n;o<i;o++){const n=r.get(o),i=this.getSymbolInstanceIconSize(t,e,o);this._addCollisionDebugVertices(n,i,this.iconCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}generateCollisionDebugBuffers(t,e){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new mc(hs,Ll.members,ws),this.iconCollisionBox=new mc(hs,Ll.members,ws);const r=ql(this.iconSizeData,t),n=ql(this.textSizeData,t);for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this._addTextDebugCollisionBoxes(n,t,e,s.textBoxStartIndex,s.textBoxEndIndex,s),this._addTextDebugCollisionBoxes(n,t,e,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._addIconDebugCollisionBoxes(r,t,e,s.iconBoxStartIndex,s.iconBoxEndIndex,s),this._addIconDebugCollisionBoxes(r,t,e,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s)}}getSymbolInstanceTextSize(t,e,r,n){const i=this.text.placedSymbolArray.get(e.rightJustifiedTextSymbolIndex>=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:n),s=Rl(this.textSizeData,t,i)/jl;return this.tilePixelRatio*s}getSymbolInstanceIconSize(t,e,r){const n=this.icon.placedSymbolArray.get(r),i=Rl(this.iconSizeData,t,n);return this.tilePixelRatio*i}_commitDebugCollisionVertexUpdate(t,e,r){t.emplaceBack(e,-r,-r),t.emplaceBack(e,r,-r),t.emplaceBack(e,r,r),t.emplaceBack(e,-r,r)}_updateTextDebugCollisionBoxes(t,e,r,n,i,s){for(let o=n;o<i;o++){const n=r.get(o),i=this.getSymbolInstanceTextSize(t,s,e,o);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,i,n.padding)}}_updateIconDebugCollisionBoxes(t,e,r,n,i){for(let s=n;s<i;s++){const n=r.get(s),i=this.getSymbolInstanceIconSize(t,e,s);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,i,n.padding)}}updateCollisionDebugBuffers(t,e){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const r=ql(this.iconSizeData,t),n=ql(this.textSizeData,t);for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this._updateTextDebugCollisionBoxes(n,t,e,s.textBoxStartIndex,s.textBoxEndIndex,s),this._updateTextDebugCollisionBoxes(n,t,e,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._updateIconDebugCollisionBoxes(r,t,e,s.iconBoxStartIndex,s.iconBoxEndIndex),this._updateIconDebugCollisionBoxes(r,t,e,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(t,e,r,n,i,s,o,a,l){const u={};for(let n=e;n<r;n++){const e=t.get(n);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,padding:e.padding,projectedAnchorX:e.projectedAnchorX,projectedAnchorY:e.projectedAnchorY,projectedAnchorZ:e.projectedAnchorZ,tileAnchorX:e.tileAnchorX,tileAnchorY:e.tileAnchorY},u.textFeatureIndex=e.featureIndex;break}for(let e=n;e<i;e++){const r=t.get(e);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,padding:r.padding,projectedAnchorX:r.projectedAnchorX,projectedAnchorY:r.projectedAnchorY,projectedAnchorZ:r.projectedAnchorZ,tileAnchorX:r.tileAnchorX,tileAnchorY:r.tileAnchorY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let e=s;e<o;e++){const r=t.get(e);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,padding:r.padding,projectedAnchorX:r.projectedAnchorX,projectedAnchorY:r.projectedAnchorY,projectedAnchorZ:r.projectedAnchorZ,tileAnchorX:r.tileAnchorX,tileAnchorY:r.tileAnchorY},u.iconFeatureIndex=r.featureIndex;break}for(let e=a;e<l;e++){const r=t.get(e);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,padding:r.padding,projectedAnchorX:r.projectedAnchorX,projectedAnchorY:r.projectedAnchorY,projectedAnchorZ:r.projectedAnchorZ,tileAnchorX:r.tileAnchorX,tileAnchorY:r.tileAnchorY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),n=[],i=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);const o=this.symbolInstances.get(t);n.push(0|Math.round(e*o.tileAnchorX+r*o.tileAnchorY)),i.push(o.featureIndex)}return s.sort(((t,e)=>n[t]-n[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}mr("SymbolBucket",gc,{omit:["layers","collisionBoxArray","features","compareText"]}),gc.MAX_GLYPHS=65535,gc.addDynamicAttributes=fc;const xc=new Ki({"symbol-placement":new Ni(Ir.layout_symbol["symbol-placement"]),"symbol-spacing":new Ni(Ir.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ni(Ir.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Zi(Ir.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ni(Ir.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ni(Ir.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ni(Ir.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ni(Ir.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ni(Ir.layout_symbol["icon-rotation-alignment"]),"icon-size":new Zi(Ir.layout_symbol["icon-size"]),"icon-text-fit":new Ni(Ir.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ni(Ir.layout_symbol["icon-text-fit-padding"]),"icon-image":new Zi(Ir.layout_symbol["icon-image"]),"icon-rotate":new Zi(Ir.layout_symbol["icon-rotate"]),"icon-padding":new Ni(Ir.layout_symbol["icon-padding"]),"icon-keep-upright":new Ni(Ir.layout_symbol["icon-keep-upright"]),"icon-offset":new Zi(Ir.layout_symbol["icon-offset"]),"icon-anchor":new Zi(Ir.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ni(Ir.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ni(Ir.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ni(Ir.layout_symbol["text-rotation-alignment"]),"text-field":new Zi(Ir.layout_symbol["text-field"]),"text-font":new Zi(Ir.layout_symbol["text-font"]),"text-size":new Zi(Ir.layout_symbol["text-size"]),"text-max-width":new Zi(Ir.layout_symbol["text-max-width"]),"text-line-height":new Zi(Ir.layout_symbol["text-line-height"]),"text-letter-spacing":new Zi(Ir.layout_symbol["text-letter-spacing"]),"text-justify":new Zi(Ir.layout_symbol["text-justify"]),"text-radial-offset":new Zi(Ir.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ni(Ir.layout_symbol["text-variable-anchor"]),"text-anchor":new Zi(Ir.layout_symbol["text-anchor"]),"text-max-angle":new Ni(Ir.layout_symbol["text-max-angle"]),"text-writing-mode":new Ni(Ir.layout_symbol["text-writing-mode"]),"text-rotate":new Zi(Ir.layout_symbol["text-rotate"]),"text-padding":new Ni(Ir.layout_symbol["text-padding"]),"text-keep-upright":new Ni(Ir.layout_symbol["text-keep-upright"]),"text-transform":new Zi(Ir.layout_symbol["text-transform"]),"text-offset":new Zi(Ir.layout_symbol["text-offset"]),"text-allow-overlap":new Ni(Ir.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ni(Ir.layout_symbol["text-ignore-placement"]),"text-optional":new Ni(Ir.layout_symbol["text-optional"])});var vc={paint:new Ki({"icon-opacity":new Zi(Ir.paint_symbol["icon-opacity"]),"icon-color":new Zi(Ir.paint_symbol["icon-color"]),"icon-halo-color":new Zi(Ir.paint_symbol["icon-halo-color"]),"icon-halo-width":new Zi(Ir.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Zi(Ir.paint_symbol["icon-halo-blur"]),"icon-translate":new Ni(Ir.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ni(Ir.paint_symbol["icon-translate-anchor"]),"text-opacity":new Zi(Ir.paint_symbol["text-opacity"]),"text-color":new Zi(Ir.paint_symbol["text-color"],{runtimeType:H,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Zi(Ir.paint_symbol["text-halo-color"]),"text-halo-width":new Zi(Ir.paint_symbol["text-halo-width"]),"text-halo-blur":new Zi(Ir.paint_symbol["text-halo-blur"]),"text-translate":new Ni(Ir.paint_symbol["text-translate"]),"text-translate-anchor":new Ni(Ir.paint_symbol["text-translate-anchor"])}),layout:xc};class bc{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:G,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}mr("FormatSectionOverride",bc,{omit:["defaultValue"]});class wc extends ho{constructor(t){super(t,vc)}recalculate(t,e){super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const r=this.layout.get("text-writing-mode");if(r){const t=[];for(const e of r)t.indexOf(e)<0&&t.push(e);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||or(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):""))}(e.properties,i)}createBucket(t){return new gc(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of vc.paint.overridableProperties){if(!wc.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new bc(e),n=new sr(r,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new lr("source",n):new ur("composite",n,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new qi(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&wc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=vc.paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof ht)s(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof gt&&yt(e.value)===et?s(e.value.sections):e instanceof wt?s(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return i}getProgramConfiguration(t){return new no(this,t)}}var _c={paint:new Ki({"background-color":new Ni(Ir.paint_background["background-color"]),"background-pattern":new Gi(Ir.paint_background["background-pattern"]),"background-opacity":new Ni(Ir.paint_background["background-opacity"])})},Ac={paint:new Ki({"raster-opacity":new Ni(Ir.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ni(Ir.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ni(Ir.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ni(Ir.paint_raster["raster-brightness-max"]),"raster-saturation":new Ni(Ir.paint_raster["raster-saturation"]),"raster-contrast":new Ni(Ir.paint_raster["raster-contrast"]),"raster-resampling":new Ni(Ir.paint_raster["raster-resampling"]),"raster-fade-duration":new Ni(Ir.paint_raster["raster-fade-duration"])})};class Sc extends ho{constructor(t){super(t,{}),this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)}onRemove(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)}}var kc={paint:new Ki({"sky-type":new Ni(Ir.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ni(Ir.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ni(Ir.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ni(Ir.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ni(Ir.paint_sky["sky-gradient-radius"]),"sky-gradient":new Yi(Ir.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ni(Ir.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ni(Ir.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ni(Ir.paint_sky["sky-opacity"])})};function Ic(t,e,r){const n=h(0,0,1),i=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}(d());return function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(r),l=Math.cos(r);t[0]=n*l-s*a,t[1]=i*l+o*a,t[2]=s*l+n*a,t[3]=o*l-i*a}(i,i,r?-x(t)+Math.PI:x(t)),function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(r),l=Math.cos(r);t[0]=n*l+o*a,t[1]=i*l+s*a,t[2]=s*l-i*a,t[3]=o*l-n*a}(i,i,-x(e)),function(t,e,r){var n=r[0],i=r[1],s=r[2],o=e[0],a=e[1],l=e[2],u=i*l-s*a,c=s*o-n*l,h=n*a-i*o,p=i*h-s*c,f=s*u-n*h,d=n*c-i*u,y=2*r[3];c*=y,h*=y,f*=2,d*=2,t[0]=o+(u*=y)+(p*=2),t[1]=a+c+f,t[2]=l+h+d}(n,n,i),function(t,e){var r=e[0],n=e[1],i=e[2],s=r*r+n*n+i*i;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}(n,n)}const zc={circle:class extends ho{constructor(t){super(t,Jo)}createBucket(t){return new Vo(t)}queryRadius(t){const e=t;return Zo("circle-radius",this,e)+Zo("circle-stroke-width",this,e)+Xo(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,r,n,i,s,o,a){const l=Yo(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r);return Wo(t,n,s,o,a,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,u)}getProgramIds(){return["circle"]}getProgramConfiguration(t){return new no(this,t)}},heatmap:class extends ho{createBucket(t){return new na(t)}constructor(t){super(t,ua),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ca({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(t){return Zo("heatmap-radius",this,t)}queryIntersectsFeature(t,e,n,i,s,o,a,l){const u=this.paint.get("heatmap-radius").evaluate(e,n);return Wo(t,i,o,a,l,!0,!0,new r(0,0),u)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(t){return new no(this,t)}},hillshade:class extends ho{constructor(t){super(t,ha)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getProgramConfiguration(t){return new no(this,t)}},fill:class extends ho{constructor(t){super(t,Wa)}getProgramIds(){const t=this.paint.get("fill-pattern"),e=t&&t.constantOr(1),r=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&r.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),r}getProgramConfiguration(t){return new no(this,t)}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Ja(t)}queryRadius(){return Xo(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,r,n,i,s){return!t.queryGeometry.isAboveHorizon&&Fo(Go(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),n)}isTileClipped(){return!0}},"fill-extrusion":class extends ho{constructor(t){super(t,gl)}createBucket(t){return new yl(t)}queryRadius(){return Xo(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(t){return new no(this,t)}queryIntersectsFeature(t,e,n,i,s,o,a,l,u){const c=Yo(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,t.pixelToTileUnitsFactor),h=this.paint.get("fill-extrusion-height").evaluate(e,n),p=this.paint.get("fill-extrusion-base").evaluate(e,n),d=[0,0],y=l&&o.elevation,m=o.elevation?o.elevation.exaggeration():1;if(y){const e=t.tile.getBucket(this).centroidVertexArray,r=u+1;if(r<e.length){const t=e.get(r);d[0]=t.a_centroid_pos0,d[1]=t.a_centroid_pos1}}if(0===d[0]&&1===d[1])return!1;const g=function(t,e,n,i,s,o,a,l,u){return o?function(t,e,r,n,i,s,o,a,l){const u=[],c=[],h=[0,0,0,1];for(const p of t){const t=[],d=[];for(const u of p){const c=u.x+n.x,p=u.y+n.y,y=wl(c,p,e,r,s,o,a,l);h[0]=c,h[1]=p,h[2]=y.base,h[3]=1,f(h,h,i),h[3]=Math.max(h[3],1e-5);const m=bl([h[0]/h[3],h[1]/h[3],h[2]/h[3]]);h[0]=c,h[1]=p,h[2]=y.top,h[3]=1,f(h,h,i),h[3]=Math.max(h[3],1e-5);const g=bl([h[0]/h[3],h[1]/h[3],h[2]/h[3]]);t.push(m),d.push(g)}u.push(t),c.push(d)}return[u,c]}(t,e,n,i,s,o,a,l,u):function(t,e,n,i,s){const o=[],a=[],l=s[8]*e,u=s[9]*e,c=s[10]*e,h=s[11]*e,p=s[8]*n,f=s[9]*n,d=s[10]*n,y=s[11]*n;for(const e of t){const t=[],n=[];for(const o of e){const e=o.x+i.x,a=o.y+i.y,m=s[0]*e+s[4]*a+s[12],g=s[1]*e+s[5]*a+s[13],x=s[2]*e+s[6]*a+s[14],v=s[3]*e+s[7]*a+s[15],b=m+l,w=g+u,_=x+c,A=Math.max(v+h,1e-5),S=m+p,k=g+f,I=x+d,z=Math.max(v+y,1e-5),M=new r(b/A,w/A);M.z=_/A,t.push(M);const P=new r(S/z,k/z);P.z=I/z,n.push(P)}o.push(t),a.push(n)}return[o,a]}(t,e,n,i,s)}(i,p,h,c,a,y?l:null,d,m,o.center.lat),x=t.queryGeometry;return function(t,e,r){let n=1/0;Fo(r,e)&&(n=vl(r,e[0]));for(let i=0;i<e.length;i++){const s=e[i],o=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],o[t+1],o[t],e];Eo(r,i)&&(n=Math.min(n,vl(r,i)))}}return n!==1/0&&n}(g[0],g[1],x.isPointQuery()?x.screenBounds:x.screenGeometry)}},line:class extends ho{constructor(t){super(t,Cl),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=t._styleExpression&&t._styleExpression.expression instanceof Qt,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Tl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Ml(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getProgramConfiguration(t){return new no(this,t)}queryRadius(t){const e=t,r=Bl(Zo("line-width",this,e),Zo("line-gap-width",this,e)),n=Zo("line-offset",this,e);return r/2+Math.abs(n)+Xo(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,n,i,s,o){if(t.queryGeometry.isAboveHorizon)return!1;const a=Go(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,t.pixelToTileUnitsFactor),l=t.pixelToTileUnitsFactor/2*Bl(this.paint.get("line-width").evaluate(e,n),this.paint.get("line-gap-width").evaluate(e,n)),u=this.paint.get("line-offset").evaluate(e,n);return u&&(i=function(t,e){const n=[],i=new r(0,0);for(let r=0;r<t.length;r++){const s=t[r],o=[];for(let t=0;t<s.length;t++){const r=s[t-1],n=s[t],a=s[t+1],l=0===t?i:n.sub(r)._unit()._perp(),u=t===s.length-1?i:a.sub(n)._unit()._perp(),c=l._add(u)._unit();c._mult(1/(c.x*u.x+c.y*u.y)),o.push(c._mult(e)._add(n))}n.push(o)}return n}(i,u*t.pixelToTileUnitsFactor)),function(t,e,r){for(let n=0;n<e.length;n++){const i=e[n];if(t.length>=3)for(let e=0;e<i.length;e++)if(Uo(t,i[e]))return!0;if(Lo(t,i,r))return!0}return!1}(a,i,l)}isTileClipped(){return!0}},symbol:wc,background:class extends ho{constructor(t){super(t,_c)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class extends ho{constructor(t){super(t,Ac)}getProgramIds(){return["raster"]}},sky:class extends ho{constructor(t){super(t,kc),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"sky-gradient"===t?this._updateColorRamp():"sky-atmosphere-sun"!==t&&"sky-atmosphere-halo-color"!==t&&"sky-atmosphere-color"!==t&&"sky-atmosphere-sun-intensity"!==t||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=ca({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(t){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=t.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}}getCenter(t,e){const r=this.paint.get("sky-type");if("atmosphere"===r){const r=this.paint.get("sky-atmosphere-sun"),n=!r,i=t.style.light,s=i.properties.get("position");return n&&"viewport"===i.properties.get("anchor")&&T("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),n?Ic(s.azimuthal,90-s.polar,e):Ic(r[0],90-r[1],e)}if("gradient"===r){const t=this.paint.get("sky-gradient-center");return Ic(t[0],90-t[1],e)}}is3D(){return!1}isSky(){return!0}markSkyboxValid(t){this._skyboxInvalidated=!1,this._lightPosition=t.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const t=this.paint.get("sky-type");return"atmosphere"===t?["skyboxCapture","skybox"]:"gradient"===t?["skyboxGradient"]:null}}};var Mc=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Pc(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const r of t)e+=`${Pc(r)},`;return`${e}]`}const r=Object.keys(t).sort();let n="{";for(let e=0;e<r.length;e++)n+=`${JSON.stringify(r[e])}:${Pc(t[r[e]])},`;return`${n}}`}function Cc(t){let e="";for(const r of Mc)e+=`/${Pc(t[r])}`;return e}class Tc{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(t,e){for(const e of t)this._layerConfigs[e.id]=e,(this._layers[e.id]=(r=e,"custom"===r.type?new Sc(r):new zc[r.type](r))).compileFilter(),this.keyCache[e.id]&&delete this.keyCache[e.id];var r;for(const t of e)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const n=function(t,e){const r={};for(let n=0;n<t.length;n++){const i=e&&e[t[n].id]||Cc(t[n]);e&&(e[t[n].id]=i);let s=r[i];s||(s=r[i]=[]),s.push(t[n])}const n=[];for(const t in r)n.push(r[t]);return n}(_(this._layerConfigs),this.keyCache);for(const t of n){const e=t.map((t=>this._layers[t.id])),r=e[0];if("none"===r.visibility)continue;const n=r.source||"";let i=this.familiesBySource[n];i||(i=this.familiesBySource[n]={});const s=r.sourceLayer||"_geojsonTileLayer";let o=i[s];o||(o=i[s]=[]),o.push(e)}}}class Bc{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}class Vc{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}function Ec(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class Dc{constructor(t,e,r){this.z=t,this.x=e,this.y=r,this.key=jc(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e){const r=(i=this.y,s=this.z,o=Ec(256*(n=this.x),256*(i=Math.pow(2,s)-i-1),s),a=Ec(256*(n+1),256*(i+1),s),o[0]+","+o[1]+","+a[0]+","+a[1]);var n,i,s,o,a;const l=function(t,e,r){let n,i="";for(let s=t;s>0;s--)n=1<<s-1,i+=(e&n?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",String(this.z)).replace("{x}",String(this.x)).replace("{y}",String("tms"===e?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",l).replace("{bbox-epsg-3857}",r)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Fc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=jc(t,e.z,e.z,e.x,e.y)}}class Lc{constructor(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new Dc(r,+n,+i),this.key=0===e&&t===r?this.canonical.key:jc(e,t,r,n,i)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){const e=this.canonical.z-t;return t>this.canonical.z?new Lc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Lc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e=!0){if(this.overscaledZ===t&&e)return this.key;if(t>this.canonical.z)return jc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-t;return jc(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Lc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Lc(e,this.wrap,e,r,n),new Lc(e,this.wrap,e,r+1,n),new Lc(e,this.wrap,e,r,n+1),new Lc(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Lc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Lc(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Fc(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function jc(t,e,r,n,i){const s=1<<Math.min(r,22);let o=s*(i%s)+n%s;return t&&r<22&&(o+=s*s*((t<0?-2*t-1:2*t)%(1<<2*(22-r)))),16*(32*o+r)+(e-r)}function $c(t,e){const r=t.fovAboveCenter,n=t.elevation?t.elevation.getMinElevationBelowMSL()*e:0,i=(t._camera.position[2]*t.worldSize-n)/Math.cos(t._pitch),s=Math.sin(r)*i/Math.sin(Math.max(Math.PI/2-t._pitch-r,.01)),o=Math.sin(t._pitch)*s+i;return Math.min(1.01*o,i*(1/t._horizonShift))}mr("CanonicalTileID",Dc),mr("OverscaledTileID",Lc,{omit:["projMatrix"]}),ts([{name:"a_pos",type:"Int16",components:2}]),ts([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_merc_pos",components:2},{type:"Float32",name:"a_uv",components:2}]),ts([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);const Oc=mo/Math.PI/2,Rc=-Oc,qc=Oc;function Uc(t,e){if(!e.isReprojectedInTileSpace)return{scale:1<<t.z,x:t.x,y:t.y,x2:t.x+1,y2:t.y+1,projection:e};const r=Math.pow(2,-t.z),n=t.x*r,i=(t.x+1)*r,s=t.y*r,o=(t.y+1)*r,a=_o(n),l=_o(i),u=Ao(s),c=Ao(o),h=e.project(a,u),p=e.project(l,u),f=e.project(l,c),d=e.project(a,c);let y=Math.min(h.x,p.x,f.x,d.x),m=Math.min(h.y,p.y,f.y,d.y),g=Math.max(h.x,p.x,f.x,d.x),x=Math.max(h.y,p.y,f.y,d.y);const v=r/16;function b(t,r,n,i,s,o){const a=(n+s)/2,l=(i+o)/2,u=e.project(_o(a),Ao(l)),c=Math.max(0,y-u.x,m-u.y,u.x-g,u.y-x);y=Math.min(y,u.x),g=Math.max(g,u.x),m=Math.min(m,u.y),x=Math.max(x,u.y),c>v&&(b(t,u,n,i,a,l),b(u,r,a,l,s,o))}b(h,p,n,s,i,s),b(p,f,i,s,i,o),b(f,d,i,o,n,o),b(d,h,n,o,n,s),y-=v,m-=v,g+=v,x+=v;const w=1/Math.max(g-y,x-m);return{scale:w,x:y*w,y:m*w,x2:g*w,y2:x*w,projection:e}}new Ho([Rc,Rc,Rc],[qc,qc,qc]),new Ho([Rc,Rc,Rc],[0,0,qc]),new Ho([0,Rc,Rc],[qc,0,qc]),new Ho([Rc,0,Rc],[0,qc,qc]),new Ho([0,0,Rc],[qc,qc,qc]);const Nc=new Uint16Array(8184);for(let t=0;t<2046;t++){let e=t+2,r=0,n=0,i=0,s=0,o=0,a=0;for(1&e?i=s=o=32:r=n=a=32;(e>>=1)>1;){const t=r+i>>1,l=n+s>>1;1&e?(i=r,s=n,r=o,n=a):(r=i,n=s,i=o,s=a),o=t,a=l}const l=4*t;Nc[l+0]=r,Nc[l+1]=n,Nc[l+2]=i,Nc[l+3]=s}ts([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Zc{constructor(t){this.size=t,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(t,e){const r=this.toIdx(t,e);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(t,e){return this.leaves[this.toIdx(t,e)]}toIdx(t,e){return e*this.size+t}}function Xc(t,e,r,n){let i=0,s=Number.MAX_VALUE;for(let o=0;o<3;o++)if(Math.abs(n[o])<1e-15){if(r[o]<t[o]||r[o]>e[o])return null}else{const a=1/n[o];let l=(t[o]-r[o])*a,u=(e[o]-r[o])*a;if(l>u){const t=l;l=u,u=t}if(l>i&&(i=l),u<s&&(s=u),i>s)return null}return i}function Gc(t,e,r,n,i,s,o,a,l,u,c){const h=n-t,p=i-e,f=s-r,d=o-t,y=a-e,m=l-r,g=c[1]*m-c[2]*y,x=c[2]*d-c[0]*m,v=c[0]*y-c[1]*d,b=h*g+p*x+f*v;if(Math.abs(b)<1e-15)return null;const w=1/b,_=u[0]-t,A=u[1]-e,S=u[2]-r,k=(_*g+A*x+S*v)*w;if(k<0||k>1)return null;const I=A*f-S*p,z=S*h-_*f,M=_*p-A*h,P=(c[0]*I+c[1]*z+c[2]*M)*w;return P<0||k+P>1?null:(d*I+y*z+m*M)*w}function Yc(t,e,r){return(t-e)/(r-e)}function Kc(t,e,r,n,i,s,o,a,l){const u=1<<r,c=s-n,h=o-i,p=(t+1)/u*c+n,f=(e+0)/u*h+i,d=(e+1)/u*h+i;a[0]=(t+0)/u*c+n,a[1]=f,l[0]=p,l[1]=d}class Jc{constructor(t){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=t,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const e=function(t){const e=Math.ceil(Math.log2(t.dim/8)),r=[];let n=Math.ceil(Math.pow(2,e));const i=1/n,s=(t,e,r,n,i)=>{const s=n?1:0,o=(t+1)*r-s,a=e*r,l=(e+1)*r-s;i[0]=t*r,i[1]=a,i[2]=o,i[3]=l};let o=new Zc(n);const a=[];for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),i,!1,a);const r=Wc(a[0],a[1],t),l=Wc(a[2],a[1],t),u=Wc(a[2],a[3],t),c=Wc(a[0],a[3],t);o.minimums.push(Math.min(r,l,u,c)),o.maximums.push(Math.max(r,l,u,c)),o.leaves.push(1)}for(r.push(o),n/=2;n>=1;n/=2){const t=r[r.length-1];o=new Zc(n);for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),2,!0,a);const r=t.getElevation(a[0],a[1]),i=t.getElevation(a[2],a[1]),l=t.getElevation(a[2],a[3]),u=t.getElevation(a[0],a[3]),c=t.isLeaf(a[0],a[1]),h=t.isLeaf(a[2],a[1]),p=t.isLeaf(a[2],a[3]),f=t.isLeaf(a[0],a[3]),d=Math.min(r.min,i.min,l.min,u.min),y=Math.max(r.max,i.max,l.max,u.max),m=c&&h&&p&&f;o.maximums.push(y),o.minimums.push(d),o.leaves.push(y-d<=5&&m?1:0)}r.push(o)}return r}(this.dem),r=e.length-1,n=e[r];this._addNode(n.minimums[0],n.maximums[0],n.leaves[0]),this._construct(e,0,0,r,0)}raycastRoot(t,e,r,n,i,s,o=1){return Xc([t,e,-100],[r,n,this.maximums[0]*o],i,s)}raycast(t,e,r,n,i,s,o=1){if(!this.nodeCount)return null;const a=this.raycastRoot(t,e,r,n,i,s,o);if(null==a)return null;const l=[],u=[],c=[],h=[],f=[{idx:0,t:a,nodex:0,nodey:0,depth:0}];for(;f.length>0;){const{idx:a,t:d,nodex:y,nodey:m,depth:g}=f.pop();if(this.leaves[a]){Kc(y,m,g,t,e,r,n,c,h);const a=1<<g,l=(y+0)/a,u=(y+1)/a,f=(m+0)/a,x=(m+1)/a,v=Wc(l,f,this.dem)*o,b=Wc(u,f,this.dem)*o,w=Wc(u,x,this.dem)*o,_=Wc(l,x,this.dem)*o,A=Gc(c[0],c[1],v,h[0],c[1],b,h[0],h[1],w,i,s),S=Gc(h[0],h[1],w,c[0],h[1],_,c[0],c[1],v,i,s),k=Math.min(null!==A?A:Number.MAX_VALUE,null!==S?S:Number.MAX_VALUE);if(k!==Number.MAX_VALUE)return k;{const t=p([],i,s,d);if(Hc(v,b,_,w,Yc(t[0],c[0],h[0]),Yc(t[1],c[1],h[1]))>=t[2])return d}continue}let x=0;for(let p=0;p<this._siblingOffset.length;p++){Kc((y<<1)+this._siblingOffset[p][0],(m<<1)+this._siblingOffset[p][1],g+1,t,e,r,n,c,h),c[2]=-100,h[2]=this.maximums[this.childOffsets[a]+p]*o;const f=Xc(c,h,i,s);if(null!=f){const t=f;l[p]=t;let e=!1;for(let r=0;r<x&&!e;r++)t>=l[u[r]]&&(u.splice(r,0,p),e=!0);e||(u[x]=p),x++}}for(let t=0;t<x;t++){const e=u[t];f.push({idx:this.childOffsets[a]+e,t:l[e],nodex:(y<<1)+this._siblingOffset[e][0],nodey:(m<<1)+this._siblingOffset[e][1],depth:g+1})}}return null}_addNode(t,e,r){return this.minimums.push(t),this.maximums.push(e),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(t,e,r,n,i){if(1===t[n].isLeaf(e,r))return;this.childOffsets[i]||(this.childOffsets[i]=this.nodeCount);const s=n-1,o=t[s];let a,l=0;for(let t=0;t<this._siblingOffset.length;t++){const n=2*e+this._siblingOffset[t][0],i=2*r+this._siblingOffset[t][1],s=o.getElevation(n,i),u=o.isLeaf(n,i),c=this._addNode(s.min,s.max,u);u&&(l|=1<<t),a||(a=c)}for(let n=0;n<this._siblingOffset.length;n++)l&1<<n||this._construct(t,2*e+this._siblingOffset[n][0],2*r+this._siblingOffset[n][1],s,a+n)}}function Hc(t,e,r,n,i,s){return te(te(t,r,s),te(e,n,s),i)}function Wc(t,e,r){const n=r.dim,i=b(t*n-.5,0,n-1),s=b(e*n-.5,0,n-1),o=Math.floor(i),a=Math.floor(s),l=Math.min(o+1,n-1),u=Math.min(a+1,n-1);return Hc(r.get(o,a),r.get(l,a),r.get(o,u),r.get(l,u),i-o,s-a)}const Qc={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};class th{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(t,e,r,n=!1,i=!1){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return T(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const s=this.dim=e.height-2;if(this.data=new Uint32Array(e.data.buffer),this.encoding=r||"mapbox",this.borderReady=n,!n){for(let t=0;t<s;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(s,t)]=this.data[this._idx(s-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,s)]=this.data[this._idx(t,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)],i&&this._buildQuadTree()}}_buildQuadTree(){this._tree=new Jc(this)}get(t,e,r=!1){const n=new Uint8Array(this.data.buffer);r&&(t=b(t,-1,this.dim),e=b(e,-1,this.dim));const i=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(n[i],n[i+1],n[i+2])}static getUnpackVector(t){return Qc[t]}get unpackVector(){return Qc[this.encoding]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,r){return(256*t*256+256*e+r)/10-1e4}_unpackTerrarium(t,e,r){return 256*t+e+r/256-32768}static pack(t,e){const r=[0,0,0,0],n=th.getUnpackVector(e);let i=Math.floor((t+n[3])/n[2]);return r[2]=i%256,i=Math.floor(i/256),r[1]=i%256,i=Math.floor(i/256),r[0]=i,r}getPixels(){return new la({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,o=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=o-1;break;case 1:o=s+1}const a=-e*this.dim,l=-r*this.dim;for(let e=s;e<o;e++)for(let r=n;r<i;r++)this.data[this._idx(r,e)]=t.data[this._idx(r+a,e+l)]}onDeserialize(){this._tree&&(this._tree.dem=this)}}mr("DEMData",th),mr("DemMinMaxQuadTree",Jc,{omit:["dem"]});class eh{constructor(t,e,r){this._demTile=t,this._dem=this._demTile.dem,this._scale=e,this._offset=r}static create(t,e,r){const n=r||t.findDEMTileFor(e);if(!n||!n.dem)return;const i=n.dem,s=n.tileID,o=1<<e.canonical.z-s.canonical.z;return new eh(n,n.tileSize/mo/o,[(e.canonical.x/o-s.canonical.x)*i.dim,(e.canonical.y/o-s.canonical.y)*i.dim])}tileCoordToPixel(t,e){const n=e*this._scale+this._offset[1],i=Math.floor(t*this._scale+this._offset[0]),s=Math.floor(n);return new r(i,s)}getElevationAt(t,e,r,n){const i=t*this._scale+this._offset[0],s=e*this._scale+this._offset[1],o=Math.floor(i),a=Math.floor(s),l=this._dem;return n=!!n,r?te(te(l.get(o,a,n),l.get(o,a+1,n),s-a),te(l.get(o+1,a,n),l.get(o+1,a+1,n),s-a),i-o):l.get(o,a,n)}getElevationAtPixel(t,e,r){return this._dem.get(t,e,!!r)}getMeterToDEM(t){return(1<<this._demTile.tileID.canonical.z)*wo(1,t)*this._dem.stride}}class rh{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new $(mo,16,0),this.featureIndexArray=new Es,this.promoteId=e}insert(t,e,r,n,i,s=0){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i,s);const a=this.grid;for(let t=0;t<e.length;t++){const r=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){const e=r[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}n[0]<mo&&n[1]<mo&&n[2]>=0&&n[3]>=0&&a.insert(o,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new cl.VectorTile(new Kl(this.rawTileData)).layers,this.sourceLayerCoder=new Bc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const t in this.vtLayers)this.vtFeatures[t]=[]}return this.vtLayers}query(t,e,n,i){this.loadVTLayers();const s=t.params||{},o=$r(s.filter),a=t.tileResult,l=t.transform,u=a.bufferedTilespaceBounds,c=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,((t,e,n,i)=>function(t,e,n,i,s){for(const r of t)if(e<=r.x&&n<=r.y&&i>=r.x&&s>=r.y)return!0;const o=[new r(e,n),new r(e,s),new r(i,s),new r(i,n)];if(t.length>2)for(const e of o)if(Uo(t,e))return!0;for(let e=0;e<t.length-1;e++)if(No(t[e],t[e+1],o))return!0;return!1}(a.bufferedTilespaceGeometry,t,e,n,i)));c.sort(ih);let h=null;l.elevation&&c.length>0&&(h=eh.create(l.elevation,this.tileID));const p={};let f;for(let r=0;r<c.length;r++){const l=c[r];if(l===f)continue;f=l;const u=this.featureIndexArray.get(l);let d=null;this.loadMatchingFeature(p,u,o,s.layers,s.availableImages,e,n,i,((e,r,n,i=0)=>(d||(d=Co(e,this.tileID.canonical,t.tileTransform)),r.queryIntersectsFeature(a,e,n,d,this.z,t.transform,t.pixelPosMatrix,h,i))))}return p}loadMatchingFeature(t,e,r,n,i,s,o,a,l){const{featureIndex:u,bucketIndex:c,sourceLayerIndex:h,layoutVertexArrayOffset:p}=e,f=this.bucketLayerIDs[c];if(n&&!function(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}(n,f))return;const d=this.sourceLayerCoder.decode(h),y=this.vtLayers[d].feature(u);if(r.needGeometry){const t=To(y,!0);if(!r.filter(new Di(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!r.filter(new Di(this.tileID.overscaledZ),y))return;const m=this.getId(y,d);for(let e=0;e<f.length;e++){const r=f[e];if(n&&n.indexOf(r)<0)continue;const c=s[r];if(!c)continue;let h={};void 0!==m&&a&&(h=a.getState(c.sourceLayer||"_geojsonTileLayer",m));const d=A({},o[r]);d.paint=nh(d.paint,c.paint,y,h,i),d.layout=nh(d.layout,c.layout,y,h,i);const g=!l||l(y,c,h,p);if(!g)continue;const x=new Vc(y,this.z,this.x,this.y,m);x.layer=d;let v=t[r];void 0===v&&(v=t[r]=[]),v.push({featureIndex:u,feature:x,intersectionZ:g})}}lookupSymbolFeatures(t,e,r,n,i,s,o,a){const l={};this.loadVTLayers();const u=$r(i);for(const i of t)this.loadMatchingFeature(l,{bucketIndex:r,sourceLayerIndex:n,featureIndex:i,layoutVertexArrayOffset:0},u,s,o,a,e);return l}loadFeature(t){const{featureIndex:e,sourceLayerIndex:r}=t;this.loadVTLayers();const n=this.sourceLayerCoder.decode(r),i=this.vtFeatures[n];if(i[e])return i[e];const s=this.vtLayers[n].feature(e);return i[e]=s,s}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;return this.promoteId&&(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof r&&(r=Number(r))),r}}function nh(t,e,r,n,i){return M(t,((t,s)=>{const o=e instanceof Ui?e.get(s):null;return o&&o.evaluate?o.evaluate(r,n,i):o}))}function ih(t,e){return e-t}mr("FeatureIndex",rh,{omit:["rawTileData","sourceLayerCoder"]});class sh{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.image=new aa({width:t,height:e}),this.positions={},this.uploaded=!1}getDash(t,e){const r=this.getKey(t,e);return this.positions[r]}trim(){const t=this.width,e=this.height=(r=this.nextRow)<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2));var r;this.image.resize({width:t,height:e})}getKey(t,e){return t.join(",")+e}getDashRanges(t,e,r){const n=[];let i=t.length%2==1?-t[t.length-1]*r:0,s=t[0]*r,o=!0;n.push({left:i,right:s,isDash:o,zeroLength:0===t[0]});let a=t[0];for(let e=1;e<t.length;e++){o=!o;const l=t[e];i=a*r,a+=l,s=a*r,n.push({left:i,right:s,isDash:o,zeroLength:0===l})}return n}addRoundDash(t,e,r){const n=e/2;for(let e=-r;e<=r;e++){const i=this.width*(this.nextRow+r+e);let s=0,o=t[s];for(let a=0;a<this.width;a++){a/o.right>1&&(o=t[++s]);const l=Math.abs(a-o.left),u=Math.abs(a-o.right),c=Math.min(l,u);let h;const p=e/r*(n+1);if(o.isDash){const t=n-Math.abs(p);h=Math.sqrt(c*c+t*t)}else h=n-Math.sqrt(c*c+p*p);this.image.data[i+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t,e){for(let e=t.length-1;e>=0;--e){const r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1))}const r=t[0],n=t[t.length-1];r.isDash===n.isDash&&(r.left=n.left-this.width,n.right=r.right+this.width);const i=this.width*this.nextRow;let s=0,o=t[s];for(let r=0;r<this.width;r++){r/o.right>1&&(o=t[++s]);const n=Math.abs(r-o.left),a=Math.abs(r-o.right),l=Math.min(n,a);this.image.data[i+r]=Math.max(0,Math.min(255,(o.isDash?l:-l)+e+128))}}addDash(t,e){const r=this.getKey(t,e);if(this.positions[r])return this.positions[r];const n="round"===e,i=n?7:0,s=2*i+1;if(this.nextRow+s>this.height)return T("LineAtlas out of space"),null;0===t.length&&t.push(1);let o=0;for(let e=0;e<t.length;e++)t[e]<0&&(T("Negative value is found in line dasharray, replacing values with 0"),t[e]=0),o+=t[e];if(0!==o){const r=this.width/o,s=this.getDashRanges(t,this.width,r);n?this.addRoundDash(s,r,i):this.addRegularDash(s,"square"===e?.5*r:0)}const a=this.nextRow+i;this.nextRow+=s;const l={tl:[a,i],br:[o,0]};return this.positions[r]=l,l}}mr("LineAtlas",sh);class oh{constructor(t){const e={},r=[];for(const n in t){const i=t[n],s=e[n]={};for(const t in i.glyphs){const e=i.glyphs[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const n=e.metrics.localGlyph?2:1,o={x:0,y:0,w:e.bitmap.width+2*n,h:e.bitmap.height+2*n};r.push(o),s[t]=o}}const{w:n,h:i}=yu(r),s=new aa({width:n||1,height:i||1});for(const r in t){const n=t[r];for(const t in n.glyphs){const i=n.glyphs[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const o=e[r][t],a=i.metrics.localGlyph?2:1;aa.copy(i.bitmap,s,{x:0,y:0},{x:o.x+a,y:o.y+a},i.bitmap)}}this.image=s,this.positions=e}}mr("GlyphAtlas",oh);class ah{constructor(t){this.tileID=new Lc(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,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.enableTerrain=!!t.enableTerrain,this.isSymbolTile=t.isSymbolTile,this.tileTransform=Uc(t.tileID.canonical,t.projection),this.projection=t.projection}parse(t,e,r,n,i){this.status="parsing",this.data=t,this.collisionBoxArray=new Is;const s=new Bc(Object.keys(t.layers).sort()),o=new rh(this.tileID,this.promoteId);o.bucketLayerIDs=[];const a={},l=new sh(256,256),u={featureIndex:o,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:l,availableImages:r},c=e.familiesBySource[this.source];for(const e in c){const n=t.layers[e];if(!n)continue;let i=!1,l=!1;for(const t of c[e])"symbol"===t[0].type?i=!0:l=!0;if(!0===this.isSymbolTile&&!i)continue;if(!1===this.isSymbolTile&&!l)continue;1===n.version&&T(`Vector tile source "${this.source}" layer "${e}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const h=s.encode(e),p=[];for(let t=0;t<n.length;t++){const r=n.feature(t),i=o.getId(r,e);p.push({feature:r,id:i,index:t,sourceLayerIndex:h})}for(const t of c[e]){const e=t[0];void 0!==this.isSymbolTile&&"symbol"===e.type!==this.isSymbolTile||e.minzoom&&this.zoom<Math.floor(e.minzoom)||e.maxzoom&&this.zoom>=e.maxzoom||"none"!==e.visibility&&(lh(t,this.zoom,r),(a[e.id]=e.createBucket({index:o.bucketLayerIDs.length,layers:t,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:h,sourceID:this.source,enableTerrain:this.enableTerrain,availableImages:r})).populate(p,u,this.tileID.canonical,this.tileTransform),o.bucketLayerIDs.push(t.map((t=>t.id))))}}let h,p,f,d;l.trim();const y={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},m=M(u.glyphDependencies,(t=>Object.keys(t).map(Number)));Object.keys(m).length?n.send("getGlyphs",{uid:this.uid,stacks:m},((t,e)=>{h||(h=t,p=e,v.call(this))}),void 0,!1,y):p={};const g=Object.keys(u.iconDependencies);g.length?n.send("getImages",{icons:g,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{h||(h=t,f=e,v.call(this))}),void 0,!1,y):f={};const x=Object.keys(u.patternDependencies);function v(){if(h)return i(h);if(p&&f&&d){const t=new oh(p),e=new gu(f,d);for(const n in a){const i=a[n];i instanceof gc?(lh(i.layers,this.zoom,r),ec(i,p,t.positions,f,e.iconPositions,this.showCollisionBoxes,r,this.tileID.canonical,this.tileZoom,this.projection),i.projection=this.projection.name):i.hasPattern&&(i instanceof Ml||i instanceof Ja||i instanceof yl)&&(lh(i.layers,this.zoom,r),i.addFeatures(u,this.tileID.canonical,e.patternPositions,r))}this.status="done",i(null,{buckets:_(a).filter((t=>!t.isEmpty())),featureIndex:o,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,lineAtlas:l,imageAtlas:e,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?t.positions:null})}}x.length?n.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{h||(h=t,d=e,v.call(this))}),void 0,!1,y):d={},v.call(this)}}function lh(t,e,r){const n=new Di(e);for(const e of t)e.recalculate(n,r)}class uh{constructor(t){this.entries={},this.scheduler=t}request(t,e,r,n){const i=this.entries[t]=this.entries[t]||{callbacks:[]};if(i.result){const[t,r]=i.result;return this.scheduler?this.scheduler.add((()=>{n(t,r)}),e):n(t,r),()=>{}}return i.callbacks.push(n),i.cancel||(i.cancel=r(((r,n)=>{i.result=[r,n];for(const t of i.callbacks)this.scheduler?this.scheduler.add((()=>{t(r,n)}),e):t(r,n);setTimeout((()=>delete this.entries[t]),3e3)}))),()=>{i.result||(i.callbacks=i.callbacks.filter((t=>t!==n)),i.callbacks.length||(i.cancel(),delete this.entries[t]))}}}function ch(t,e,r){const n=JSON.stringify(t.request);return t.data&&(this.deduped.entries[n]={result:[null,t.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},(e=>{const n=function(t,e){return Pi(A(t,{type:"arrayBuffer"}),e)}(t.request,((t,n,i,s)=>{t?e(t):n&&e(null,{vectorTile:r?void 0:new cl.VectorTile(new Kl(n)),rawData:n,cacheControl:i,expires:s})}));return()=>{n.cancel(),e()}}),e)}class hh extends bn{constructor(t,e,r,n,i){super(),this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=i||ch,this.loading={},this.loaded={},this.deduped=new uh(t.scheduler),this.isSpriteLoaded=n,this.scheduler=t.scheduler}loadTile(t,e){const r=t.uid,n=t&&t.request,i=n&&n.collectResourceTiming,s=this.loading[r]=new ah(t);s.abort=this.loadVectorData(t,((o,a)=>{const l=!this.loading[r];if(delete this.loading[r],l||o||!a)return s.status="done",l||(this.loaded[r]=s),e(o);const u=a.rawData,c={};a.expires&&(c.expires=a.expires),a.cacheControl&&(c.cacheControl=a.cacheControl),s.vectorTile=a.vectorTile||new cl.VectorTile(new Kl(u));const h=()=>{s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,r)=>{if(t||!r)return e(t);const s={};if(i){const t=Ar(n);t.length>0&&(s.resourceTiming=JSON.parse(JSON.stringify(t)))}e(null,A({rawTileData:u.slice(0)},r,c,s))}))};this.isSpriteLoaded?h():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(h,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom}):h()})),this.loaded=this.loaded||{},this.loaded[r]=s}))}reloadTile(t,e){const r=this.loaded,n=t.uid,i=this;if(r&&r[n]){const s=r[n];s.showCollisionBoxes=t.showCollisionBoxes,s.enableTerrain=!!t.enableTerrain,s.projection=t.projection;const o=(t,r)=>{const n=s.reloadCallback;n&&(delete s.reloadCallback,s.parse(s.vectorTile,i.layerIndex,this.availableImages,i.actor,n)),e(t,r)};"parsing"===s.status?s.reloadCallback=o:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,o):o())}}abortTile(t,e){const r=t.uid,n=this.loading[r];n&&(n.abort&&n.abort(),delete this.loading[r]),e()}removeTile(t,e){const r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()}}const{ImageBitmap:ph}=s;class fh{loadTile(t,e){const{uid:r,encoding:n,rawImageData:i,padding:s,buildQuadTree:o}=t,a=ph&&i instanceof ph?this.getImageData(i,s):i;e(null,new th(r,a,n,s<1,o))}getImageData(t,e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);const r=this.offscreenCanvasContext.getImageData(-e,-e,t.width+2*e,t.height+2*e);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new la({width:r.width,height:r.height},r.data)}}var dh=function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n<e.features.length;n++)t(e.features[n],r);else if("GeometryCollection"===i)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],r);else if("Feature"===i)t(e.geometry,r);else if("Polygon"===i)yh(e.coordinates,r);else if("MultiPolygon"===i)for(n=0;n<e.coordinates.length;n++)yh(e.coordinates[n],r);return e};function yh(t,e){if(0!==t.length){mh(t[0],e);for(var r=1;r<t.length;r++)mh(t[r],!e)}}function mh(t,e){for(var r=0,n=0,i=0,s=t.length,o=s-1;i<s;o=i++){var a=(t[i][0]-t[o][0])*(t[o][1]+t[i][1]),l=r+a;n+=Math.abs(r)>=Math.abs(a)?r-l+a:a-l+r,r=l}r+n>=0!=!!e&&t.reverse()}const gh=cl.VectorTileFeature.prototype.toGeoJSON;class xh{constructor(t){this._feature=t,this.extent=mo,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const e of this._feature.geometry)t.push([new r(e[0],e[1])]);return t}{const t=[];for(const e of this._feature.geometry){const n=[];for(const t of e)n.push(new r(t[0],t[1]));t.push(n)}return t}}toGeoJSON(t,e,r){return gh.call(this,t,e,r)}}class vh{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=mo,this.length=t.length,this._features=t}feature(t){return new xh(this._features[t])}}var bh=cl.VectorTileFeature,wh=_h;function _h(t,e){this.options=e||{},this.features=t,this.length=t.length}function Ah(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}_h.prototype.feature=function(t){return new Ah(this.features[t],this.options.extent)},Ah.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var n=t[e],i=[],s=0;s<n.length;s++)i.push(new r(n[s][0],n[s][1]));this.geometry.push(i)}return this.geometry},Ah.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,s=0;s<t.length;s++)for(var o=t[s],a=0;a<o.length;a++){var l=o[a];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},Ah.prototype.toGeoJSON=bh.prototype.toGeoJSON;var Sh=Ih,kh=wh;function Ih(t){var e=new Kl;return function(t,e){for(var r in t.layers)e.writeMessage(3,zh,t.layers[r])}(t,e),e.finish()}function zh(t,e){var r;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,Mh,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var s=n.values;for(r=0;r<s.length;r++)e.writeMessage(4,Vh,s[r])}function Mh(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,Ph,t),e.writeVarintField(3,r.type),e.writeMessage(4,Bh,r)}function Ph(t,e){var r=t.feature,n=t.keys,i=t.values,s=t.keycache,o=t.valuecache;for(var a in r.properties){var l=r.properties[a],u=s[a];if(null!==l){void 0===u&&(n.push(a),s[a]=u=n.length-1),e.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=o[h];void 0===p&&(i.push(l),o[h]=p=i.length-1),e.writeVarint(p)}}}function Ch(t,e){return(e<<3)+(7&t)}function Th(t){return t<<1^t>>31}function Bh(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,s=0,o=r.length,a=0;a<o;a++){var l=r[a],u=1;1===n&&(u=l.length),e.writeVarint(Ch(1,u));for(var c=3===n?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==n&&e.writeVarint(Ch(2,c-1));var p=l[h].x-i,f=l[h].y-s;e.writeVarint(Th(p)),e.writeVarint(Th(f)),i+=p,s+=f}3===n&&e.writeVarint(Ch(7,1))}}function Vh(t,e){var r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}function Eh(t,e,r,n,i,s){if(i-n<=r)return;const o=n+i>>1;Dh(t,e,o,n,i,s%2),Eh(t,e,r,n,o-1,s+1),Eh(t,e,r,o+1,i,s+1)}function Dh(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const o=i-n+1,a=r-n+1,l=Math.log(o),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(o-u)/o)*(a-o/2<0?-1:1);Dh(t,e,r,Math.max(n,Math.floor(r-a*u/o+c)),Math.min(i,Math.floor(r+(o-a)*u/o+c)),s)}const o=e[2*r+s];let a=n,l=i;for(Fh(t,e,n,r),e[2*i+s]>o&&Fh(t,e,n,i);a<l;){for(Fh(t,e,a,l),a++,l--;e[2*a+s]<o;)a++;for(;e[2*l+s]>o;)l--}e[2*n+s]===o?Fh(t,e,n,l):(l++,Fh(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Fh(t,e,r,n){Lh(t,r,n),Lh(e,2*r,2*n),Lh(e,2*r+1,2*n+1)}function Lh(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function jh(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}Sh.fromVectorTileJs=Ih,Sh.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var n in t)r[n]=new wh(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Ih({layers:r})},Sh.GeoJSONWrapper=kh;const $h=t=>t[0],Oh=t=>t[1];class Rh{constructor(t,e=$h,r=Oh,n=64,i=Float64Array){this.nodeSize=n,this.points=t;const s=t.length<65536?Uint16Array:Uint32Array,o=this.ids=new s(t.length),a=this.coords=new i(2*t.length);for(let n=0;n<t.length;n++)o[n]=n,a[2*n]=e(t[n]),a[2*n+1]=r(t[n]);Eh(o,a,n,0,o.length-1,0)}range(t,e,r,n){return function(t,e,r,n,i,s,o){const a=[0,t.length-1,0],l=[];let u,c;for(;a.length;){const h=a.pop(),p=a.pop(),f=a.pop();if(p-f<=o){for(let o=f;o<=p;o++)u=e[2*o],c=e[2*o+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[o]);continue}const d=Math.floor((f+p)/2);u=e[2*d],c=e[2*d+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[d]);const y=(h+1)%2;(0===h?r<=u:n<=c)&&(a.push(f),a.push(d-1),a.push(y)),(0===h?i>=u:s>=c)&&(a.push(d+1),a.push(p),a.push(y))}return l}(this.ids,this.coords,t,e,r,n,this.nodeSize)}within(t,e,r){return function(t,e,r,n,i,s){const o=[0,t.length-1,0],a=[],l=i*i;for(;o.length;){const u=o.pop(),c=o.pop(),h=o.pop();if(c-h<=s){for(let i=h;i<=c;i++)jh(e[2*i],e[2*i+1],r,n)<=l&&a.push(t[i]);continue}const p=Math.floor((h+c)/2),f=e[2*p],d=e[2*p+1];jh(f,d,r,n)<=l&&a.push(t[p]);const y=(u+1)%2;(0===u?r-i<=f:n-i<=d)&&(o.push(h),o.push(p-1),o.push(y)),(0===u?r+i>=f:n+i>=d)&&(o.push(p+1),o.push(c),o.push(y))}return a}(this.ids,this.coords,t,e,r,this.nodeSize)}}const qh={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Uh=Math.fround||(Nh=new Float32Array(1),t=>(Nh[0]=+t,Nh[0]));var Nh;class Zh{constructor(t){this.options=Qh(Object.create(qh),t),this.trees=new Array(this.options.maxZoom+1)}load(t){const{log:e,minZoom:r,maxZoom:n,nodeSize:i}=this.options;e&&console.time("total time");const s=`prepare ${t.length} points`;e&&console.time(s),this.points=t;let o=[];for(let e=0;e<t.length;e++)t[e].geometry&&o.push(Gh(t[e],e));this.trees[n+1]=new Rh(o,tp,ep,i,Float32Array),e&&console.timeEnd(s);for(let t=n;t>=r;t--){const r=+Date.now();o=this._cluster(o,t),this.trees[t]=new Rh(o,tp,ep,i,Float32Array),e&&console.log("z%d: %d clusters in %dms",t,o.length,+Date.now()-r)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let i=180===t[2]?180:((t[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){const t=this.getClusters([r,n,180,s],e),o=this.getClusters([-180,n,i,s],e);return t.concat(o)}const o=this.trees[this._limitZoom(e)],a=o.range(Jh(r),Hh(s),Jh(i),Hh(n)),l=[];for(const t of a){const e=o.points[t];l.push(e.numPoints?Yh(e):this.points[e.index])}return l}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",i=this.trees[r];if(!i)throw new Error(n);const s=i.points[e];if(!s)throw new Error(n);const o=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=i.within(s.x,s.y,o),l=[];for(const e of a){const r=i.points[e];r.parentId===t&&l.push(r.numPoints?Yh(r):this.points[r.index])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,r){const n=[];return this._appendLeaves(n,t,e=e||10,r=r||0,0),n}getTile(t,e,r){const n=this.trees[this._limitZoom(t)],i=Math.pow(2,t),{extent:s,radius:o}=this.options,a=o/s,l=(r-a)/i,u=(r+1+a)/i,c={features:[]};return this._addTileFeatures(n.range((e-a)/i,l,(e+1+a)/i,u),n.points,e,r,i,c),0===e&&this._addTileFeatures(n.range(1-a/i,l,1,u),n.points,i,r,i,c),e===i-1&&this._addTileFeatures(n.range(0,l,a/i,u),n.points,-1,r,i,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,n,i){const s=this.getChildren(e);for(const e of s){const s=e.properties;if(s&&s.cluster?i+s.point_count<=n?i+=s.point_count:i=this._appendLeaves(t,s.cluster_id,r,n,i):i<n?i++:t.push(e),t.length===r)break}return i}_addTileFeatures(t,e,r,n,i,s){for(const o of t){const t=e[o],a=t.numPoints;let l,u,c;if(a)l=Kh(t),u=t.x,c=t.y;else{const e=this.points[t.index];l=e.properties,u=Jh(e.geometry.coordinates[0]),c=Hh(e.geometry.coordinates[1])}const h={type:1,geometry:[[Math.round(this.options.extent*(u*i-r)),Math.round(this.options.extent*(c*i-n))]],tags:l};let p;a?p=t.id:this.options.generateId?p=t.index:this.points[t.index].id&&(p=this.points[t.index].id),void 0!==p&&(h.id=p),s.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))}_cluster(t,e){const r=[],{radius:n,extent:i,reduce:s,minPoints:o}=this.options,a=n/(i*Math.pow(2,e));for(let n=0;n<t.length;n++){const i=t[n];if(i.zoom<=e)continue;i.zoom=e;const l=this.trees[e+1],u=l.within(i.x,i.y,a),c=i.numPoints||1;let h=c;for(const t of u){const r=l.points[t];r.zoom>e&&(h+=r.numPoints||1)}if(h>c&&h>=o){let t=i.x*c,o=i.y*c,a=s&&c>1?this._map(i,!0):null;const p=(n<<5)+(e+1)+this.points.length;for(const r of u){const n=l.points[r];if(n.zoom<=e)continue;n.zoom=e;const u=n.numPoints||1;t+=n.x*u,o+=n.y*u,n.parentId=p,s&&(a||(a=this._map(i,!0)),s(a,this._map(n)))}i.parentId=p,r.push(Xh(t/h,o/h,p,h,a))}else if(r.push(i),h>1)for(const t of u){const n=l.points[t];n.zoom<=e||(n.zoom=e,r.push(n))}}return r}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e){if(t.numPoints)return e?Qh({},t.properties):t.properties;const r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?Qh({},n):n}}function Xh(t,e,r,n,i){return{x:Uh(t),y:Uh(e),zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function Gh(t,e){const[r,n]=t.geometry.coordinates;return{x:Uh(Jh(r)),y:Uh(Hh(n)),zoom:1/0,index:e,parentId:-1}}function Yh(t){return{type:"Feature",id:t.id,properties:Kh(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),Wh(t.y)]}};var e}function Kh(t){const e=t.numPoints,r=e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?Math.round(e/100)/10+"k":e;return Qh(Qh({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function Jh(t){return t/360+.5}function Hh(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Wh(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Qh(t,e){for(const r in e)t[r]=e[r];return t}function tp(t){return t.x}function ep(t){return t.y}function rp(t,e,r,n){for(var i,s=n,o=r-e>>1,a=r-e,l=t[e],u=t[e+1],c=t[r],h=t[r+1],p=e+3;p<r;p+=3){var f=np(t[p],t[p+1],l,u,c,h);if(f>s)i=p,s=f;else if(f===s){var d=Math.abs(p-o);d<a&&(i=p,a=d)}}s>n&&(i-e>3&&rp(t,e,i,n),t[i+2]=s,r-i>3&&rp(t,i,r,n))}function np(t,e,r,n,i,s){var o=i-r,a=s-n;if(0!==o||0!==a){var l=((t-r)*o+(e-n)*a)/(o*o+a*a);l>1?(r=i,n=s):l>0&&(r+=o*l,n+=a*l)}return(o=t-r)*o+(a=e-n)*a}function ip(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)sp(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<e.length;n++)sp(t,e[n]);else if("MultiPolygon"===r)for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)sp(t,e[n][i])}(i),i}function sp(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function op(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,s=e.geometry.type,o=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),a=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),"Point"===s)ap(i,a);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)ap(i[u],a);else if("LineString"===s)lp(i,a,o,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(u=0;u<i.length;u++)lp(i[u],a=[],o,!1),t.push(ip(l,"LineString",a,e.properties));return}up(i,a,o,!1)}else if("Polygon"===s)up(i,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<e.geometry.geometries.length;u++)op(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<i.length;u++){var c=[];up(i[u],c,o,!0),a.push(c)}}t.push(ip(l,s,a,e.properties))}}function ap(t,e){e.push(cp(t[0])),e.push(hp(t[1])),e.push(0)}function lp(t,e,r,n){for(var i,s,o=0,a=0;a<t.length;a++){var l=cp(t[a][0]),u=hp(t[a][1]);e.push(l),e.push(u),e.push(0),a>0&&(o+=n?(i*u-l*s)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-s,2))),i=l,s=u}var c=e.length-3;e[2]=1,rp(e,0,c,r),e[c+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function up(t,e,r,n){for(var i=0;i<t.length;i++){var s=[];lp(t[i],s,r,n),e.push(s)}}function cp(t){return t/360+.5}function hp(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function pp(t,e,r,n,i,s,o,a){if(n/=e,s>=(r/=e)&&o<n)return t;if(o<r||s>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,f=0===i?c.minX:c.minY,d=0===i?c.maxX:c.maxY;if(f>=r&&d<n)l.push(c);else if(!(d<r||f>=n)){var y=[];if("Point"===p||"MultiPoint"===p)fp(h,y,r,n,i);else if("LineString"===p)dp(h,y,r,n,i,!1,a.lineMetrics);else if("MultiLineString"===p)mp(h,y,r,n,i,!1);else if("Polygon"===p)mp(h,y,r,n,i,!0);else if("MultiPolygon"===p)for(var m=0;m<h.length;m++){var g=[];mp(h[m],g,r,n,i,!0),g.length&&y.push(g)}if(y.length){if(a.lineMetrics&&"LineString"===p){for(m=0;m<y.length;m++)l.push(ip(c.id,p,y[m],c.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===y.length?(p="LineString",y=y[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===y.length?"Point":"MultiPoint"),l.push(ip(c.id,p,y,c.tags))}}}return l.length?l:null}function fp(t,e,r,n,i){for(var s=0;s<t.length;s+=3){var o=t[s+i];o>=r&&o<=n&&(e.push(t[s]),e.push(t[s+1]),e.push(t[s+2]))}}function dp(t,e,r,n,i,s,o){for(var a,l,u=yp(t),c=0===i?xp:vp,h=t.start,p=0;p<t.length-3;p+=3){var f=t[p],d=t[p+1],y=t[p+2],m=t[p+3],g=t[p+4],x=0===i?f:d,v=0===i?m:g,b=!1;o&&(a=Math.sqrt(Math.pow(f-m,2)+Math.pow(d-g,2))),x<r?v>r&&(l=c(u,f,d,m,g,r),o&&(u.start=h+a*l)):x>n?v<n&&(l=c(u,f,d,m,g,n),o&&(u.start=h+a*l)):gp(u,f,d,y),v<r&&x>=r&&(l=c(u,f,d,m,g,r),b=!0),v>n&&x<=n&&(l=c(u,f,d,m,g,n),b=!0),!s&&b&&(o&&(u.end=h+a*l),e.push(u),u=yp(t)),o&&(h+=a)}var w=t.length-3;f=t[w],d=t[w+1],y=t[w+2],(x=0===i?f:d)>=r&&x<=n&&gp(u,f,d,y),w=u.length-3,s&&w>=3&&(u[w]!==u[0]||u[w+1]!==u[1])&&gp(u,u[0],u[1],u[2]),u.length&&e.push(u)}function yp(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function mp(t,e,r,n,i,s){for(var o=0;o<t.length;o++)dp(t[o],e,r,n,i,s,!1)}function gp(t,e,r,n){t.push(e),t.push(r),t.push(n)}function xp(t,e,r,n,i,s){var o=(s-e)/(n-e);return t.push(s),t.push(r+(i-r)*o),t.push(1),o}function vp(t,e,r,n,i,s){var o=(s-r)/(i-r);return t.push(e+(n-e)*o),t.push(s),t.push(1),o}function bp(t,e){for(var r=[],n=0;n<t.length;n++){var i,s=t[n],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)i=wp(s.geometry,e);else if("MultiLineString"===o||"Polygon"===o){i=[];for(var a=0;a<s.geometry.length;a++)i.push(wp(s.geometry[a],e))}else if("MultiPolygon"===o)for(i=[],a=0;a<s.geometry.length;a++){for(var l=[],u=0;u<s.geometry[a].length;u++)l.push(wp(s.geometry[a][u],e));i.push(l)}r.push(ip(s.id,o,i,s.tags))}return r}function wp(t,e){var r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function _p(t,e){if(t.transformed)return t;var r,n,i,s=1<<t.z,o=t.x,a=t.y;for(r=0;r<t.features.length;r++){var l=t.features[r],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(Ap(u[n],u[n+1],e,s,o,a));else for(n=0;n<u.length;n++){var h=[];for(i=0;i<u[n].length;i+=2)h.push(Ap(u[n][i],u[n][i+1],e,s,o,a));l.geometry.push(h)}}return t.transformed=!0,t}function Ap(t,e,r,n,i,s){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-s))]}function Sp(t,e,r,n,i){for(var s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){o.numFeatures++,kp(o,t[a],s,i);var l=t[a].minX,u=t[a].minY,c=t[a].maxX,h=t[a].maxY;l<o.minX&&(o.minX=l),u<o.minY&&(o.minY=u),c>o.maxX&&(o.maxX=c),h>o.maxY&&(o.maxY=h)}return o}function kp(t,e,r,n){var i=e.geometry,s=e.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<i.length;a+=3)o.push(i[a]),o.push(i[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)Ip(o,i,t,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<i.length;a++)Ip(o,i[a],t,r,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var l=0;l<i.length;l++){var u=i[l];for(a=0;a<u.length;a++)Ip(o,u[a],t,r,!0,0===a)}if(o.length){var c=e.tags||null;if("LineString"===s&&n.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var p={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function Ip(t,e,r,n,i,s){var o=n*n;if(n>0&&e.size<(i?o:n))r.numPoints+=e.length/3;else{for(var a=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>o)&&(r.numSimplified++,a.push(e[l]),a.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,s=i-2;n<i;s=n,n+=2)r+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var o=t[n],a=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=o,t[i-1-n]=a}}(a,s),t.push(a)}}function zp(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)op(r,t.features[n],e,n);else op(r,"Feature"===t.type?t:{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(n=function(t,e){var r=e.buffer/e.extent,n=t,i=pp(t,1,-1-r,r,0,-1,2,e),s=pp(t,1,1-r,2+r,0,-1,2,e);return(i||s)&&(n=pp(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=bp(i,1).concat(n)),s&&(n=n.concat(bp(s,-1)))),n}(n,e)).length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Mp(t,e,r){return 32*((1<<t)*r+e)+t}function Pp(t,e){const r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);const n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return e(null,null);const i=new vh(n.features);let s=Sh(i);0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),e(null,{vectorTile:i,rawData:s.buffer})}zp.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},zp.prototype.splitTile=function(t,e,r,n,i,s,o){for(var a=[t,e,r,n],l=this.options,u=l.debug;a.length;){n=a.pop(),r=a.pop(),e=a.pop(),t=a.pop();var c=1<<e,h=Mp(e,r,n),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=Sp(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<<i-e;if(r!==Math.floor(s/d)||n!==Math.floor(o/d))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){u>1&&console.time("clipping");var y,m,g,x,v,b,w=.5*l.buffer/l.extent,_=.5-w,A=.5+w,S=1+w;y=m=g=x=null,v=pp(t,c,r-w,r+A,0,p.minX,p.maxX,l),b=pp(t,c,r+_,r+S,0,p.minX,p.maxX,l),t=null,v&&(y=pp(v,c,n-w,n+A,1,p.minY,p.maxY,l),m=pp(v,c,n+_,n+S,1,p.minY,p.maxY,l),v=null),b&&(g=pp(b,c,n-w,n+A,1,p.minY,p.maxY,l),x=pp(b,c,n+_,n+S,1,p.minY,p.maxY,l),b=null),u>1&&console.timeEnd("clipping"),a.push(y||[],e+1,2*r,2*n),a.push(m||[],e+1,2*r,2*n+1),a.push(g||[],e+1,2*r+1,2*n),a.push(x||[],e+1,2*r+1,2*n+1)}}},zp.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,s=n.debug;if(t<0||t>24)return null;var o=1<<t,a=Mp(t,e=(e%o+o)%o,r);if(this.tiles[a])return _p(this.tiles[a],i);s>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Mp(u,c,h)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,c,h),s>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,r),s>1&&console.timeEnd("drilling down"),this.tiles[a]?_p(this.tiles[a],i):null):null};class Cp extends hh{constructor(t,e,r,n,i){super(t,e,r,n,Pp),i&&(this.loadGeoJSON=i)}loadData(t,e){const r=t&&t.request,n=r&&r.collectResourceTiming;this.loadGeoJSON(t,((i,s)=>{if(i||!s)return e(i);if("object"!=typeof s)return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{dh(s,!0);try{if(t.filter){const e=ar(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const r=s.features.filter((t=>e.value.evaluate({zoom:0},t)));s={type:"FeatureCollection",features:r}}this._geoJSONIndex=t.cluster?new Zh(function({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;const r={},n={},i={accumulated:null,zoom:0},s={properties:null},o=Object.keys(e);for(const t of o){const[i,s]=e[t],o=ar(s),a=ar("string"==typeof i?[i,["accumulated"],["get",t]]:i);r[t]=o.value,n[t]=a.value}return t.map=t=>{s.properties=t;const e={};for(const t of o)e[t]=r[t].evaluate(i,s);return e},t.reduce=(t,e)=>{s.properties=e;for(const e of o)i.accumulated=t[e],t[e]=n[e].evaluate(i,s)},t}(t)).load(s.features):function(t,e){return new zp(t,e)}(s,t.geojsonVtOptions)}catch(i){return e(i)}this.loaded={};const o={};if(n){const e=Ar(r);e&&(o.resourceTiming={},o.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}e(null,o)}}))}reloadTile(t,e){const r=this.loaded;return r&&r[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}loadGeoJSON(t,e){if(t.request)!function(t,e){Pi(A(t,{type:"json"}),e)}(t.request,e);else{if("string"!=typeof t.data)return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return e(null,JSON.parse(t.data))}catch(r){return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}const Tp=a(new Float64Array(16));class Bp{constructor(t,e){this._tr=t,this._worldSize=e}createInversionMatrix(){return Tp}createTileMatrix(t){let e,r,n;const i=t.canonical,s=a(new Float64Array(16)),o=this._tr.projection;if(o.isReprojectedInTileSpace){const a=Uc(i,o);e=1,r=a.x+t.wrap*a.scale,n=a.y,l(s,s,[e/a.scale,e/a.scale,this._tr.pixelsPerMeter/this._worldSize])}else e=this._worldSize/this._tr.zoomScale(i.z),r=(i.x+Math.pow(2,i.z)*t.wrap)*e,n=i.y*e;return function(t,e,r){var n,i,s,o,a,l,u,c,h,p,f,d,y=r[0],m=r[1],g=r[2];e===t?(t[12]=e[0]*y+e[4]*m+e[8]*g+e[12],t[13]=e[1]*y+e[5]*m+e[9]*g+e[13],t[14]=e[2]*y+e[6]*m+e[10]*g+e[14],t[15]=e[3]*y+e[7]*m+e[11]*g+e[15]):(i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],t[0]=n=e[0],t[1]=i,t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=f,t[11]=d,t[12]=n*y+a*m+h*g+e[12],t[13]=i*y+l*m+p*g+e[13],t[14]=s*y+u*m+f*g+e[14],t[15]=o*y+c*m+d*g+e[15])}(s,s,[r,n,0]),l(s,s,[e/mo,e/mo,1]),s}pointCoordinate(t,e,n){const i=this._tr.horizonLineFromTop(!1),s=new r(t,Math.max(i,e));return this._tr.rayIntersectionCoordinate(this._tr.pointRayIntersection(s,n))}upVector(){return[0,0,1]}upVectorScale(){return 1}}var Vp={name:"albers",range:[4,7],center:[-96,37.5],parallels:[29.5,45.5],zAxisUnit:"meters",conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&y(this.parallels,this.constants.parallels))return;const t=Math.sin(x(this.parallels[0])),e=(t+Math.sin(x(this.parallels[1])))/2,r=1+t*(2*e-t),n=Math.sqrt(r)/e;this.constants={n:e,c:r,r0:n,parallels:this.parallels}},project(t,e){this.initializeConstants();const r=x(t-this.center[0]),n=x(e),{n:i,c:s,r0:o}=this.constants,a=Math.sqrt(s-2*i*Math.sin(n))/i;return{x:a*Math.sin(r*i),y:a*Math.cos(r*i)-o,z:0}},unproject(t,e){this.initializeConstants();const{n:r,c:n,r0:i}=this.constants,s=i+e;let o=Math.atan2(t,Math.abs(s))*Math.sign(s);s*r<0&&(o-=Math.PI*Math.sign(t)*Math.sign(s));const a=x(this.center[0])*r;o=w(o,-Math.PI-a,Math.PI-a);const l=v(o/r)+this.center[0],u=Math.asin(b((n-(t*t+s*s)*r*r)/(2*r),-1,1)),c=b(v(u),-85.051129,So);return new vo(l,c)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)};const Ep=1.340264,Dp=-.081106,Fp=893e-6,Lp=.003796,jp=Math.sqrt(3)/2;var $p={name:"equalEarth",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(t,e){e=e/180*Math.PI,t=t/180*Math.PI;const r=Math.asin(jp*Math.sin(e)),n=r*r,i=n*n*n;return{x:.5*(t*Math.cos(r)/(jp*(Ep+3*Dp*n+i*(7*Fp+9*Lp*n)))/Math.PI+.5),y:1-.5*(r*(Ep+Dp*n+i*(Fp+Lp*n))/Math.PI+1),z:0}},unproject(t,e){t=(2*t-.5)*Math.PI;let r=e=(2*(1-e)-1)*Math.PI,n=r*r,i=n*n*n;for(let t,s,o,a=0;a<12&&(s=r*(Ep+Dp*n+i*(Fp+Lp*n))-e,o=Ep+3*Dp*n+i*(7*Fp+9*Lp*n),t=s/o,r=b(r-t,-Math.PI/3,Math.PI/3),n=r*r,i=n*n*n,!(Math.abs(t)<1e-12));++a);const s=jp*t*(Ep+3*Dp*n+i*(7*Fp+9*Lp*n))/Math.cos(r),o=Math.asin(Math.sin(r)/jp),a=b(180*s/Math.PI,-180,180),l=b(180*o/Math.PI,-85.051129,So);return new vo(a,l)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)},Op={name:"equirectangular",supportsWorldCopies:!0,center:[0,0],range:[3.5,7],zAxisUnit:"meters",wrap:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project:(t,e)=>({x:.5+t/360,y:.5-e/360,z:0}),unproject(t,e){const r=360*(t-.5),n=b(360*(.5-e),-85.051129,So);return new vo(r,n)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)};const Rp=Math.PI/2;function qp(t){return Math.tan((Rp+t)/2)}var Up={name:"lambertConformalConic",range:[3.5,7],zAxisUnit:"meters",center:[0,30],parallels:[30,30],conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&y(this.parallels,this.constants.parallels))return;const t=x(this.parallels[0]),e=x(this.parallels[1]),r=Math.cos(t),n=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(qp(e)/qp(t)),i=r*Math.pow(qp(t),n)/n;this.constants={n:n,f:i,parallels:this.parallels}},project(t,e){this.initializeConstants(),e=x(e),t=x(t-this.center[0]);const r=1e-6,{n:n,f:i}=this.constants;i>0?e<-Rp+r&&(e=-Rp+r):e>Rp-r&&(e=Rp-r);const s=i/Math.pow(qp(e),n),o=s*Math.sin(n*t),a=i-s*Math.cos(n*t);return{x:.5*(o/Math.PI+.5),y:1-.5*(a/Math.PI+.5),z:0}},unproject(t,e){this.initializeConstants(),t=(2*t-.5)*Math.PI,e=(2*(1-e)-.5)*Math.PI;const{n:r,f:n}=this.constants,i=n-e,s=Math.sign(i),o=Math.sign(r)*Math.sqrt(t*t+i*i);let a=Math.atan2(t,Math.abs(i))*s;i*r<0&&(a-=Math.PI*Math.sign(t)*s);const l=b(v(a/r)+this.center[0],-180,180),u=b(v(2*Math.atan(Math.pow(n/o,1/r))-Rp),-85.051129,So);return new vo(l,u)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)},Np={name:"mercator",wrap:!0,requiresDraping:!1,supportsWorldCopies:!0,supportsTerrain:!0,supportsFog:!0,supportsFreeCamera:!0,zAxisUnit:"meters",center:[0,0],project:(t,e)=>({x:function(t){return(180+t)/360}(t),y:function(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}(e),z:0}),unproject(t,e){const r=_o(t),n=Ao(e);return new vo(r,n)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)};const Zp=x(So);var Xp={name:"naturalEarth",center:[0,0],range:[3.5,7],isReprojectedInTileSpace:!0,zAxisUnit:"meters",unsupportedLayers:["custom"],project(t,e){const r=(e=x(e))*e,n=r*r;return{x:.5*((t=x(t))*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))/Math.PI+1),z:0}},unproject(t,e){t=(2*t-.5)*Math.PI;let r=e=(2*(1-e)-1)*Math.PI,n=25,i=0,s=r*r;do{s=r*r;const t=s*s;i=(r*(1.007226+s*(.015085+t*(.028874*s-.044475-.005916*t)))-e)/(1.007226+s*(.045255+t*(.259866*s-.311325-.005916*11*t))),r=b(r-i,-Zp,Zp)}while(Math.abs(i)>1e-6&&--n>0);s=r*r;const o=b(v(t/(.8707+s*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))),-180,180),a=v(r);return new vo(o,a)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)};const Gp=x(So),Yp={albers:Vp,equalEarth:$p,equirectangular:Op,lambertConformalConic:Up,mercator:Np,naturalEarth:Xp,winkelTripel:{name:"winkelTripel",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(t,e){e=x(e),t=x(t);const r=Math.cos(e),n=2/Math.PI,i=Math.acos(r*Math.cos(t/2)),s=Math.sin(i)/i,o=.5*(t*n+2*r*Math.sin(t/2)/s)||0,a=.5*(e+Math.sin(e)/s)||0;return{x:.5*(o/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}},unproject(t,e){let r=t=(2*t-.5)*Math.PI,n=e=(2*(1-e)-1)*Math.PI,i=25;const s=1e-6;let o=0,a=0;do{const i=Math.cos(n),s=Math.sin(n),l=2*s*i,u=s*s,c=i*i,h=Math.cos(r/2),p=Math.sin(r/2),f=2*h*p,d=p*p,y=1-c*h*h,m=y?1/y:0,g=y?Math.acos(i*h)*Math.sqrt(1/y):0,x=.5*(2*g*i*p+2*r/Math.PI)-t,v=.5*(g*s+n)-e,w=.5*m*(c*d+g*i*h*u)+1/Math.PI,_=m*(f*l/4-g*s*p),A=.125*m*(l*p-g*s*c*f),S=.5*m*(u*h+g*d*i)+.5,k=_*A-S*w;o=(v*_-x*S)/k,a=(x*A-v*w)/k,r=b(r-o,-Math.PI,Math.PI),n=b(n-a,-Gp,Gp)}while((Math.abs(o)>s||Math.abs(a)>s)&&--i>0);return new vo(v(r),v(n))},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)}};function Kp(t){const e=Yp[t.name];if(!e)throw new Error(`Invalid projection name: ${t.name}`);return e.conic?function(t,e){if(e.parallels&&Math.abs(e.parallels[0]+e.parallels[1])<.01){let r=function(t){const e=Math.max(.01,Math.cos(x(t))),r=1/(2*Math.max(Math.PI*e,1/e));return{wrap:!0,supportsWorldCopies:!0,unsupportedLayers:["custom"],project(t,n){const i=x(t)*e,s=Math.sin(x(n))/e;return{x:i*r+.5,y:-s*r+.5,z:0}},unproject(t,n){const i=-(n-.5)/r,s=b(v((t-.5)/r)/e,-180,180),o=Math.asin(b(i*e,-1,1)),a=b(v(o),-85.051129,So);return new vo(s,a)}}}(e.parallels[0]);if("lambertConformalConic"===e.name){const{project:t,unproject:e}=Yp.mercator;r={wrap:!0,supportsWorldCopies:!0,project:t,unproject:e}}return A({},t,e,r)}return A({},t,e)}(e,t):e}class Jp{constructor(t){this.self=t,this.actor=new kr(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=Kp({name:"mercator"}),this.workerSourceTypes={vector:hh,geojson:Cp},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=t=>{if(Ei.isParsed())throw new Error("RTL text plugin already registered.");Ei.applyArabicShaping=t.applyArabicShaping,Ei.processBidirectionalText=t.processBidirectionalText,Ei.processStyledBidirectionalText=t.processStyledBidirectionalText}}clearCaches(t,e,r){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],r()}checkIfReady(t,e,r){r()}setReferrer(t,e){this.referrer=e}spriteLoaded(t,e){this.isSpriteLoaded[t]=e;for(const r in this.workerSources[t]){const n=this.workerSources[t][r];for(const t in n)n[t]instanceof hh&&(n[t].isSpriteLoaded=e,n[t].fire(new xn("isSpriteLoaded")))}}setImages(t,e,r){this.availableImages[t]=e;for(const r in this.workerSources[t]){const n=this.workerSources[t][r];for(const t in n)n[t].availableImages=e}r()}enableTerrain(t,e,r){this.terrain=e,r()}setProjection(t,e){this.projections[t]=Kp(e)}setLayers(t,e,r){this.getLayerIndex(t).replace(e),r()}updateLayers(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()}loadTile(t,e,r){const n=this.enableTerrain?A({enableTerrain:this.terrain},e):e;n.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,e.type,e.source).loadTile(n,r)}loadDEMTile(t,e,r){const n=this.enableTerrain?A({buildQuadTree:this.terrain},e):e;this.getDEMWorkerSource(t,e.source).loadTile(n,r)}reloadTile(t,e,r){const n=this.enableTerrain?A({enableTerrain:this.terrain},e):e;n.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,e.type,e.source).reloadTile(n,r)}abortTile(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)}removeTile(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)}removeSource(t,e,r){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}loadWorkerSource(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}}syncRTLPluginState(t,e,r){try{Ei.setState(e);const t=Ei.getPluginURL();if(Ei.isLoaded()&&!Ei.isParsed()&&null!=t){this.self.importScripts(t);const e=Ei.isParsed();r(e?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),e)}}catch(t){r(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new Tc),e}getWorkerSource(t,e,r){return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][r]||(this.workerSources[t][e][r]=new this.workerSourceTypes[e]({send:(e,r,n,i,s,o)=>{this.actor.send(e,r,n,t,s,o)},scheduler:this.actor.scheduler},this.getLayerIndex(t),this.getAvailableImages(t),this.isSpriteLoaded[t])),this.workerSources[t][e][r]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new fh),this.demWorkerSources[t][e]}enforceCacheSizeLimit(t,e){!function(t){ki(),Ai&&Ai.then((e=>{e.keys().then((r=>{for(let n=0;n<r.length-t;n++)e.delete(r[n])}))}))}(e)}getWorkerPerformanceMetrics(t,e,r){r(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new Jp(self)),Jp}();
1
+ var mapboxgl=function(){"use strict";var t=e;function e(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}e.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},e.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},e.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},e.prototype.solveCurveX=function(t,e){var r,n,i,s,o;for(void 0===e&&(e=1e-6),i=t,o=0;o<8;o++){if(s=this.sampleCurveX(i)-t,Math.abs(s)<e)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i-=s/a}if((i=t)<(r=0))return r;if(i>(n=1))return n;for(;r<n;){if(s=this.sampleCurveX(i),Math.abs(s-t)<e)return i;t>s?r=i:n=i,i=.5*(n-r)+r}return i},e.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var r=n;function n(t,e){this.x=t,this.y=e}n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t};var i,s="undefined"!=typeof self?self:{},o="undefined"!=typeof Float32Array?Float32Array:Array;function a(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function l(t,e,r){var n=r[0],i=r[1],s=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function u(){var t=new o(3);return o!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function c(t){var e=new o(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function h(t,e,r){var n=new o(3);return n[0]=t,n[1]=e,n[2]=r,n}function p(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function f(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*o,t}function d(){var t=new o(4);return o!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function y(t,e){return t[0]===e[0]&&t[1]===e[1]}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),u(),function(){var t;t=new o(4),o!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),u(),h(1,0,0),h(0,1,0),d(),d(),i=new o(9),o!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,function(){var t=new o(2);o!=Float32Array&&(t[0]=0,t[1]=0)}();const m=Math.PI/180,g=180/Math.PI;function x(t){return t*m}function v(t){return t*g}function b(t,e,r){return Math.min(r,Math.max(e,t))}function w(t,e,r){const n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function _(t){const e=[];for(const r in t)e.push(t[r]);return e}function A(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}function S(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function k(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function I(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}function z(t,e){return-1!==t.indexOf(e,t.length-e.length)}function M(t,e,r){const n={};for(const i in t)n[i]=e.call(r||this,t[i],i,t);return n}function P(t){return Array.isArray(t)?t.map(P):"object"==typeof t&&t?M(t,P):t}const C={};function T(t){C[t]||("undefined"!=typeof console&&console.warn(t),C[t]=!0)}function B(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function V(t){let e=0;for(let r,n,i=0,s=t.length,o=s-1;i<s;o=i++)r=t[i],n=t[o],e+=(n.x-r.x)*(r.y+n.y);return e}function E(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function D(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,r,n,i)=>{const s=n||i;return e[r]=!s||s.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}let F=null;function L(t){if(null==F){const e=t.navigator?t.navigator.userAgent:null;F=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return F}function j(t){try{const e=s[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var $=O;function O(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(var s=0;s<this.d*this.d;s++){var o=i[3+s],a=i[3+s+1];n.push(o===a?null:i.subarray(o,a))}var l=i[3+n.length+1];this.keys=i.subarray(i[3+n.length],l),this.bboxes=i.subarray(l),this.insert=this._insertReadonly}else{this.d=e+2*r;for(var u=0;u<this.d*this.d;u++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;var c=r/e*t;this.min=-c,this.max=t+c}function R(t){var e={exports:{}};return t(e,e.exports),e.exports}O.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},O.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},O.prototype._insertCell=function(t,e,r,n,i,s){this.cells[i].push(s)},O.prototype.query=function(t,e,r,n,i){var s=this.min,o=this.max;if(t<=s&&e<=s&&o<=r&&o<=n&&!i)return Array.prototype.slice.call(this.keys);var a=[];return this._forEachCell(t,e,r,n,this._queryCell,a,{},i),a},O.prototype._queryCell=function(t,e,r,n,i,s,o,a){var l=this.cells[i];if(null!==l)for(var u=this.keys,c=this.bboxes,h=0;h<l.length;h++){var p=l[h];if(void 0===o[p]){var f=4*p;(a?a(c[f+0],c[f+1],c[f+2],c[f+3]):t<=c[f+2]&&e<=c[f+3]&&r>=c[f+0]&&n>=c[f+1])?(o[p]=!0,s.push(u[p])):o[p]=!1}}},O.prototype._forEachCell=function(t,e,r,n,i,s,o,a){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n),p=l;p<=c;p++)for(var f=u;f<=h;f++){var d=this.d*f+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(f),this._convertFromCellCoord(p+1),this._convertFromCellCoord(f+1)))&&i.call(this,t,e,r,n,d,s,o,a))return}},O.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},O.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},O.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var i=new Int32Array(e+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;for(var s=e,o=0;o<t.length;o++){var a=t[o];i[3+o]=s,i.set(a,s),s+=a.length}return i[3+t.length]=s,i.set(this.keys,s),i[3+t.length+1]=s+=this.keys.length,i.set(this.bboxes,s),s+=this.bboxes.length,i.buffer};var q=R((function(t,e){var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function n(t){return(t=Math.round(t))<0?0:t>255?255:t}function i(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function s(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function o(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,a=t.replace(/ /g,"").toLowerCase();if(a in r)return r[a].slice();if("#"===a[0])return 4===a.length?(e=parseInt(a.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===a.length&&(e=parseInt(a.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var c=a.substr(0,l),h=a.substr(l+1,u-(l+1)).split(","),p=1;switch(c){case"rgba":if(4!==h.length)return null;p=s(h.pop());case"rgb":return 3!==h.length?null:[i(h[0]),i(h[1]),i(h[2]),p];case"hsla":if(4!==h.length)return null;p=s(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,d=s(h[1]),y=s(h[2]),m=y<=.5?y*(d+1):y+d-y*d,g=2*y-m;return[n(255*o(g,m,f+1/3)),n(255*o(g,m,f)),n(255*o(g,m,f-1/3)),p];default:return null}}return null}}catch(t){}}));class U{constructor(t,e,r,n=1){this.r=t,this.g=e,this.b=r,this.a=n}static parse(t){if(!t)return;if(t instanceof U)return t;if("string"!=typeof t)return;const e=q.parseCSSColor(t);return e?new U(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,r,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(r)},${n})`}toArray(){const{r:t,g:e,b:r,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]}}function N(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}U.black=new U(0,0,0,1),U.white=new U(1,1,1,1),U.transparent=new U(0,0,0,0),U.red=new U(1,0,0,1),U.blue=new U(0,0,1,1);class Z extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class X{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new X(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const G={kind:"null"},Y={kind:"number"},K={kind:"string"},J={kind:"boolean"},H={kind:"color"},W={kind:"object"},Q={kind:"value"},tt={kind:"collator"},et={kind:"formatted"},rt={kind:"resolvedImage"};function nt(t,e){return{kind:"array",itemType:t,N:e}}function it(t){if("array"===t.kind){const e=it(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const st=[G,Y,K,J,H,et,W,nt(Q),rt];function ot(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!ot(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of st)if(!ot(t,e))return null}return`Expected ${it(t)} but found ${it(e)} instead.`}function at(t,e){return e.some((e=>e.kind===t.kind))}function lt(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}class ut{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ct{constructor(t,e,r,n,i){this.text=t.normalize?t.normalize():t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i}}class ht{constructor(t){this.sections=t}static fromString(t){return new ht([new ct(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof ht?t:ht.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const r={};e.fontStack&&(r["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(r["font-scale"]=e.scale),e.textColor&&(r["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(r)}return t}}class pt{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new pt({name:t,available:!1}):null}serialize(){return["image",this.name]}}function ft(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function dt(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof U)return!0;if(t instanceof ut)return!0;if(t instanceof ht)return!0;if(t instanceof pt)return!0;if(Array.isArray(t)){for(const e of t)if(!dt(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!dt(t[e]))return!1;return!0}return!1}function yt(t){if(null===t)return G;if("string"==typeof t)return K;if("boolean"==typeof t)return J;if("number"==typeof t)return Y;if(t instanceof U)return H;if(t instanceof ut)return tt;if(t instanceof ht)return et;if(t instanceof pt)return rt;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=yt(e);if(r){if(r===t)continue;r=Q;break}r=t}return nt(r||Q,e)}return W}function mt(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof U||t instanceof ht||t instanceof pt?t.toString():JSON.stringify(t)}class gt{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!dt(t[1]))return e.error("invalid value");const r=t[1];let n=yt(r);const i=e.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new gt(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof U?["rgba"].concat(this.value.toArray()):this.value instanceof ht?this.value.serialize():this.value}}class xt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const vt={string:K,number:Y,boolean:J,object:W};class bt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in vt)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=vt[r],n++}else i=Q;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=nt(i,s)}else r=vt[i];const s=[];for(;n<t.length;n++){const r=e.parse(t[n],n,Q);if(!r)return null;s.push(r)}return new bt(r,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!ot(this.type,yt(r)))return r;if(e===this.args.length-1)throw new xt(`Expected value to be of type ${it(this.type)}, but found ${it(yt(r))} instead.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const r=t.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){e.push(r.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((t=>t.serialize())))}}class wt{constructor(t){this.type=et,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const s=t[r];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,Y),!t))return null;let r=null;if(s["text-font"]&&(r=e.parse(s["text-font"],1,nt(K)),!r))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,H),!o))return null;const a=n[n.length-1];a.scale=t,a.font=r,a.textColor=o}else{const s=e.parse(t[r],1,Q);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new wt(n)}evaluate(t){return new ht(this.sections.map((e=>{const r=e.content.evaluate(t);return yt(r)===rt?new ct("",r,null,null,null):new ct(mt(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const r={};e.scale&&(r["font-scale"]=e.scale.serialize()),e.font&&(r["text-font"]=e.font.serialize()),e.textColor&&(r["text-color"]=e.textColor.serialize()),t.push(r)}return t}}class _t{constructor(t){this.type=rt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,K);return r?new _t(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=pt.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const At={"to-boolean":J,"to-color":H,"to-number":Y,"to-string":K};class St{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");const n=At[r],i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],r,Q);if(!n)return null;i.push(n)}return new St(n,i)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,r;for(const n of this.args){if(e=n.evaluate(t),r=null,e instanceof U)return e;if("string"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:ft(e[0],e[1],e[2],e[3]),!r))return new U(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new xt(r||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new xt(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?ht.fromString(mt(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?pt.fromString(mt(this.args[0].evaluate(t))):mt(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new wt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new _t(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}const kt=["Unknown","Point","LineString","Polygon"];class It{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?kt[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||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:r,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*e-t[0])+this.featureDistanceData.bearing[1]*(n*e-t[1])}return 0}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=U.parse(t)),e}}class zt{constructor(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const r=t[0],n=zt.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,s]of o){a=new Jt(e.registry,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e<t.length;e++){const r=t[e],i=Array.isArray(n)?n[e-1]:n.type,s=a.parse(r,1+o.length,i);if(!s){l=!0;break}o.push(s)}if(!l)if(Array.isArray(n)&&n.length!==o.length)a.error(`Expected ${n.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=o[t];a.concat(t+1).checkSubtype(e,r.type)}if(0===a.errors.length)return new zt(r,i,s,o)}}if(1===o.length)e.errors.push(...a.errors);else{const r=(o.length?o:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(it).join(", ")})`:`(${it(e.type)}...)`;var e})).join(" | "),n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],1+n.length);if(!i)return null;n.push(it(i.type))}e.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){zt.definitions=e;for(const r in e)t[r]=zt}}class Mt{constructor(t,e,r){this.type=tt,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,J);if(!n)return null;const i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,J);if(!i)return null;let s=null;return r.locale&&(s=e.parse(r.locale,1,K),!s)?null:new Mt(n,i,s)}evaluate(t){return new ut(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const Pt=8192;function Ct(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Tt(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Bt(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*Pt),Math.round(n*i*Pt)]}function Vt(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],o=t[1]-r[1];return n*o-s*i==0&&n*s<=0&&i*o<=0}function Et(t,e){let r=!1;for(let o=0,a=e.length;o<a;o++){const a=e[o];for(let e=0,o=a.length;e<o-1;e++){if(Vt(t,a[e],a[e+1]))return!1;(i=a[e])[1]>(n=t)[1]!=(s=a[e+1])[1]>n[1]&&n[0]<(s[0]-i[0])*(n[1]-i[1])/(s[1]-i[1])+i[0]&&(r=!r)}}var n,i,s;return r}function Dt(t,e){for(let r=0;r<e.length;r++)if(Et(t,e[r]))return!0;return!1}function Ft(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],o=(t[0]-r[0])*s-i*(t[1]-r[1]),a=(e[0]-r[0])*s-i*(e[1]-r[1]);return o>0&&a<0||o<0&&a>0}function Lt(t,e,r){for(const u of r)for(let r=0;r<u.length-1;++r)if(0!=(a=[(o=u[r+1])[0]-(s=u[r])[0],o[1]-s[1]])[0]*(l=[(i=e)[0]-(n=t)[0],i[1]-n[1]])[1]-a[1]*l[0]&&Ft(n,i,s,o)&&Ft(s,o,n,i))return!0;var n,i,s,o,a,l;return!1}function jt(t,e){for(let r=0;r<t.length;++r)if(!Et(t[r],e))return!1;for(let r=0;r<t.length-1;++r)if(Lt(t[r],t[r+1],e))return!1;return!0}function $t(t,e){for(let r=0;r<e.length;r++)if(jt(t,e[r]))return!0;return!1}function Ot(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=[];for(let n=0;n<t[i].length;n++){const o=Bt(t[i][n],r);Ct(e,o),s.push(o)}n.push(s)}return n}function Rt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=Ot(t[i],e,r);n.push(s)}return n}function qt(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i}Ct(e,t)}function Ut(t,e,r,n){const i=Math.pow(2,n.z)*Pt,s=[n.x*Pt,n.y*Pt],o=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];qt(n,e,r,i),o.push(n)}return o}function Nt(t,e,r,n){const i=Math.pow(2,n.z)*Pt,s=[n.x*Pt,n.y*Pt],o=[];for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];Ct(e,r),t.push(r)}o.push(t)}if(e[2]-e[0]<=i/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const n of t)qt(n,e,r,i)}var a;return o}class Zt{constructor(t,e){this.type=J,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(dt(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const r=e.features[t].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new Zt(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Zt(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Zt(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=Ot(e.coordinates,n,i),o=Ut(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of o)if(!Et(t,s))return!1}if("MultiPolygon"===e.type){const s=Rt(e.coordinates,n,i),o=Ut(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of o)if(!Dt(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=Ot(e.coordinates,n,i),o=Nt(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of o)if(!jt(t,s))return!1}if("MultiPolygon"===e.type){const s=Rt(e.coordinates,n,i),o=Nt(t.geometry(),r,n,i);if(!Tt(r,n))return!1;for(const t of o)if(!$t(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function Xt(t){if(t instanceof zt){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Zt)return!1;let e=!0;return t.eachChild((t=>{e&&!Xt(t)&&(e=!1)})),e}function Gt(t){if(t instanceof zt&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Gt(t)&&(e=!1)})),e}function Yt(t,e){if(t instanceof zt&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!Yt(t,e)&&(r=!1)})),r}class Kt{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new Kt(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Jt{constructor(t,e=[],r,n=new X,i=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=i,this.expectedType=r}parse(t,e,r,n,i={}){return e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)}_parse(t,e){function r(t,e,r){return"assert"===r?new bt(e,[t]):"coerce"===r?new St(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const i=this.registry[n];if(i){let n=i.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,i=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(t,i))return null}else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"assert")}if(!(n instanceof gt)&&"resolvedImage"!==n.type.kind&&Ht(n)){const t=new It;try{n=new gt(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new Jt(this.registry,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new Z(r,t))}checkSubtype(t,e){const r=ot(t,e);return r&&this.error(r),r}}function Ht(t){if(t instanceof Kt)return Ht(t.boundExpression);if(t instanceof zt&&"error"===t.name)return!1;if(t instanceof Mt)return!1;if(t instanceof Zt)return!1;const e=t instanceof St||t instanceof bt;let r=!0;return t.eachChild((t=>{r=e?r&&Ht(t):r&&t instanceof gt})),!!r&&Xt(t)&&Yt(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function Wt(t,e){const r=t.length-1;let n,i,s=0,o=r,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],i=t[a+1],n<=e){if(a===r||e<i)return a;s=a+1}else{if(!(n>e))throw new xt("Input is not a number.");o=a-1}return 0}class Qt{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,Y);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r<t.length;r+=2){const s=1===r?-1/0:t[r],o=t[r+1],a=r,l=r+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const u=e.parse(o,l,i);if(!u)return null;i=i||u.type,n.push([s,u])}return new Qt(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Wt(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}function te(t,e,r){return t*(1-r)+e*r}var ee=Object.freeze({__proto__:null,number:te,color:function(t,e,r){return new U(te(t.r,e.r,r),te(t.g,e.g,r),te(t.b,e.b,r),te(t.a,e.a,r))},array:function(t,e,r){return t.map(((t,n)=>te(t,e[n],r)))}});const re=.95047,ne=1.08883,ie=4/29,se=6/29,oe=3*se*se,ae=Math.PI/180,le=180/Math.PI;function ue(t){return t>.008856451679035631?Math.pow(t,1/3):t/oe+ie}function ce(t){return t>se?t*t*t:oe*(t-ie)}function he(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function pe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fe(t){const e=pe(t.r),r=pe(t.g),n=pe(t.b),i=ue((.4124564*e+.3575761*r+.1804375*n)/re),s=ue((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-ue((.0193339*e+.119192*r+.9503041*n)/ne)),alpha:t.a}}function de(t){let e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*ce(e),r=re*ce(r),n=ne*ce(n),new U(he(3.2404542*r-1.5371385*e-.4985314*n),he(-.969266*r+1.8760108*e+.041556*n),he(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function ye(t,e,r){const n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const me={forward:fe,reverse:de,interpolate:function(t,e,r){return{l:te(t.l,e.l,r),a:te(t.a,e.a,r),b:te(t.b,e.b,r),alpha:te(t.alpha,e.alpha,r)}}},ge={forward:function(t){const{l:e,a:r,b:n}=fe(t),i=Math.atan2(n,r)*le;return{h:i<0?i+360:i,c:Math.sqrt(r*r+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*ae,r=t.c;return de({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:ye(t.h,e.h,r),c:te(t.c,e.c,r),l:te(t.l,e.l,r),alpha:te(t.alpha,e.alpha,r)}}};var xe=Object.freeze({__proto__:null,lab:me,hcl:ge});class ve{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(e,r,n,i){let s=0;if("exponential"===e.name)s=be(r,e.base,n,i);else if("linear"===e.name)s=be(r,1,n,i);else if("cubic-bezier"===e.name){const o=e.controlPoints;s=new t(o[0],o[1],o[2],o[3]).solve(be(r,1,n,i))}return s}static parse(t,e){let[r,n,i,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,Y),!i)return null;const o=[];let a=null;"interpolate-hcl"===r||"interpolate-lab"===r?a=H:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t<s.length;t+=2){const r=s[t],n=s[t+1],i=t+3,l=t+4;if("number"!=typeof r)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(o.length&&o[o.length-1][0]>=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,a);if(!u)return null;a=a||u.type,o.push([r,u])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new ve(a,r,n,i,o):e.error(`Type ${it(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=Wt(e,n),o=ve.interpolationFactor(this.interpolation,n,e[s],e[s+1]),a=r[s].evaluate(t),l=r[s+1].evaluate(t);return"interpolate"===this.operator?ee[this.type.kind.toLowerCase()](a,l,o):"interpolate-hcl"===this.operator?ge.reverse(ge.interpolate(ge.forward(a),ge.forward(l),o)):me.reverse(me.interpolate(me.forward(a),me.forward(l),o))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)e.push(this.labels[t],this.outputs[t].serialize());return e}}function be(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}class we{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let r=null;const n=e.expectedType;n&&"value"!==n.kind&&(r=n);const i=[];for(const n of t.slice(1)){const t=e.parse(n,1+i.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,i.push(t)}const s=n&&i.some((t=>ot(n,t.type)));return new we(s?Q:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args){if(n++,r=i.evaluate(t),r&&r instanceof pt&&!r.available&&(e||(e=r),r=null,n===this.args.length))return e;if(null!==r)break}return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class _e{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n<t.length-1;n+=2){const i=t[n];if("string"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;r.push([i,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return n?new _e(r,n):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[e,r]of this.bindings)t.push(e,r.serialize());return t.push(this.result.serialize()),t}}class Ae{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Y),n=e.parse(t[2],2,nt(e.expectedType||Q));return r&&n?new Ae(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new xt(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new xt(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new xt(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Se{constructor(t,e){this.type=J,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Q),n=e.parse(t[2],2,Q);return r&&n?at(r.type,[J,K,Y,G,Q])?new Se(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!lt(e,["boolean","string","number","null"]))throw new xt(`Expected first argument to be of type boolean, string, number or null, but found ${it(yt(e))} instead.`);if(!lt(r,["string","array"]))throw new xt(`Expected second argument to be of type array or string, but found ${it(yt(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class ke{constructor(t,e,r){this.type=Y,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Q),n=e.parse(t[2],2,Q);if(!r||!n)return null;if(!at(r.type,[J,K,Y,G,Q]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,Y);return i?new ke(r,n,i):null}return new ke(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!lt(e,["boolean","string","number","null"]))throw new xt(`Expected first argument to be of type boolean, string, number or null, but found ${it(yt(e))} instead.`);if(!lt(r,["string","array"]))throw new xt(`Expected second argument to be of type array or string, but found ${it(yt(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Ie{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const l=t[o+1];Array.isArray(a)||(a=[a]);const u=e.concat(o);if(0===a.length)return u.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,yt(t)))return null}else r=yt(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length}const c=e.parse(l,o,n);if(!c)return null;n=n||c.type,s.push(c)}const o=e.parse(t[1],1,Q);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(r,o.type)?null:new Ie(r,n,o,i,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(yt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),r=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=r.length,r.push([this.cases[t],[t]])):r[e][1].push(t)}const i=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of r)t.push(1===n.length?i(n[0]):n.map(i)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class ze{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;i<t.length-1;i+=2){const s=e.parse(t[i],i,J);if(!s)return null;const o=e.parse(t[i+1],i+1,r);if(!o)return null;n.push([s,o]),r=r||o.type}const i=e.parse(t[t.length-1],t.length-1,r);return i?new ze(r,n,i):null}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class Me{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Q),n=e.parse(t[2],2,Y);if(!r||!n)return null;if(!at(r.type,[nt(Q),K,Q]))return e.error(`Expected first argument to be of type array or string, but found ${it(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,Y);return i?new Me(r.type,r,n,i):null}return new Me(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!lt(e,["string","array"]))throw new xt(`Expected first argument to be of type array or string, but found ${it(yt(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function Pe(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Ce(t,e,r,n){return 0===n.compare(e,r)}function Te(t,e,r){const n="=="!==t&&"!="!==t;return class i{constructor(t,e,r){this.type=J,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let s=e.parse(t[1],1,Q);if(!s)return null;if(!Pe(r,s.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${it(s.type)}'.`);let o=e.parse(t[2],2,Q);if(!o)return null;if(!Pe(r,o.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${it(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${it(s.type)}' and '${it(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new bt(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new bt(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,tt),!a)return null}return new i(s,o,a)}evaluate(i){const s=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=yt(s),r=yt(o);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new xt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=yt(s),r=yt(o);if("string"!==t.kind||"string"!==r.kind)return e(i,s,o)}return this.collator?r(i,s,o,this.collator.evaluate(i)):e(i,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const Be=Te("==",(function(t,e,r){return e===r}),Ce),Ve=Te("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!Ce(0,e,r,n)})),Ee=Te("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),De=Te(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),Fe=Te("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Le=Te(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class je{constructor(t,e,r,n,i){this.type=K,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,Y);if(!r)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=e.parse(n.locale,1,K),!i))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,K),!s))return null;let o=null;if(n["min-fraction-digits"]&&(o=e.parse(n["min-fraction-digits"],1,Y),!o))return null;let a=null;return n["max-fraction-digits"]&&(a=e.parse(n["max-fraction-digits"],1,Y),!a)?null:new je(r,i,s,o,a)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class $e{constructor(t){this.type=Y,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${it(r.type)} instead.`):new $e(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new xt(`Expected value to be of type string or array, but found ${it(yt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const Oe={"==":Be,"!=":Ve,">":De,"<":Ee,">=":Le,"<=":Fe,array:bt,at:Ae,boolean:bt,case:ze,coalesce:we,collator:Mt,format:wt,image:_t,in:Se,"index-of":ke,interpolate:ve,"interpolate-hcl":ve,"interpolate-lab":ve,length:$e,let:_e,literal:gt,match:Ie,number:bt,"number-format":je,object:bt,slice:Me,step:Qt,string:bt,"to-boolean":St,"to-color":St,"to-number":St,"to-string":St,var:Kt,within:Zt};function Re(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,o=ft(e,r,n,s);if(o)throw new xt(o);return new U(e/255*s,r/255*s,n/255*s,s)}function qe(t,e){return t in e}function Ue(t,e){const r=e[t];return void 0===r?null:r}function Ne(t){return{type:t}}function Ze(t){return{result:"success",value:t}}function Xe(t){return{result:"error",value:t}}function Ge(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Ye(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Ke(t){return!!t.expression&&t.expression.interpolated}function Je(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function He(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function We(t){return t}function Qe(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(Ke(e)?"exponential":"interval");if(r&&((t=N({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],U.parse(t[1])]))),t.default=U.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!xe[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let o,a,l;if("exponential"===s)o=nr;else if("interval"===s)o=rr;else if("categorical"===s){o=er,a=Object.create(null);for(const e of t.stops)a[e[0]]=e[1];l=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);o=ir}if(n){const r={},n=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],s=i[0].zoom;void 0===r[s]&&(r[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},n.push(s)),r[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of n)i.push([r[t].zoom,Qe(r[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:ve.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>nr({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:ve.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>o(t,e,r,a,l)}}return{kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?tr(t.default,e.default):o(t,e,i,a,l)}}}function tr(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function er(t,e,r,n,i){return tr(typeof r===i?n[r]:void 0,t.default,e.default)}function rr(t,e,r){if("number"!==Je(r))return tr(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=Wt(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function nr(t,e,r){const n=void 0!==t.base?t.base:1;if("number"!==Je(r))return tr(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const s=Wt(t.stops.map((t=>t[0])),r),o=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),a=t.stops[s][1],l=t.stops[s+1][1];let u=ee[e.type]||We;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=xe[t.colorSpace];u=(t,r)=>e.reverse(e.interpolate(e.forward(t),e.forward(r),o))}return"function"==typeof a.evaluate?{evaluate(...t){const e=a.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==r)return u(e,r,o)}}:u(a,l,o)}function ir(t,e,r){return"color"===e.type?r=U.parse(r):"formatted"===e.type?r=ht.fromString(r.toString()):"resolvedImage"===e.type?r=pt.fromString(r.toString()):Je(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),tr(r,t.default,e.default)}zt.register(Oe,{error:[{kind:"error"},[K],(t,[e])=>{throw new xt(e.evaluate(t))}],typeof:[K,[Q],(t,[e])=>it(yt(e.evaluate(t)))],"to-rgba":[nt(Y,4),[H],(t,[e])=>e.evaluate(t).toArray()],rgb:[H,[Y,Y,Y],Re],rgba:[H,[Y,Y,Y,Y],Re],has:{type:J,overloads:[[[K],(t,[e])=>qe(e.evaluate(t),t.properties())],[[K,W],(t,[e,r])=>qe(e.evaluate(t),r.evaluate(t))]]},get:{type:Q,overloads:[[[K],(t,[e])=>Ue(e.evaluate(t),t.properties())],[[K,W],(t,[e,r])=>Ue(e.evaluate(t),r.evaluate(t))]]},"feature-state":[Q,[K],(t,[e])=>Ue(e.evaluate(t),t.featureState||{})],properties:[W,[],t=>t.properties()],"geometry-type":[K,[],t=>t.geometryType()],id:[Q,[],t=>t.id()],zoom:[Y,[],t=>t.globals.zoom],pitch:[Y,[],t=>t.globals.pitch||0],"distance-from-center":[Y,[],t=>t.distanceFromCenter()],"heatmap-density":[Y,[],t=>t.globals.heatmapDensity||0],"line-progress":[Y,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[Y,[],t=>t.globals.skyRadialProgress||0],accumulated:[Q,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Y,Ne(Y),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[Y,Ne(Y),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:Y,overloads:[[[Y,Y],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[Y],(t,[e])=>-e.evaluate(t)]]},"/":[Y,[Y,Y],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[Y,[Y,Y],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[Y,[],()=>Math.LN2],pi:[Y,[],()=>Math.PI],e:[Y,[],()=>Math.E],"^":[Y,[Y,Y],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[Y,[Y],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Y,[Y],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Y,[Y],(t,[e])=>Math.log(e.evaluate(t))],log2:[Y,[Y],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Y,[Y],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Y,[Y],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Y,[Y],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Y,[Y],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Y,[Y],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Y,[Y],(t,[e])=>Math.atan(e.evaluate(t))],min:[Y,Ne(Y),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[Y,Ne(Y),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[Y,[Y],(t,[e])=>Math.abs(e.evaluate(t))],round:[Y,[Y],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[Y,[Y],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Y,[Y],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[J,[K,Q],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[J,[Q],(t,[e])=>t.id()===e.value],"filter-type-==":[J,[K],(t,[e])=>t.geometryType()===e.value],"filter-<":[J,[K,Q],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[J,[Q],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[J,[K,Q],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[J,[Q],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[J,[K,Q],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[J,[Q],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[J,[K,Q],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[J,[Q],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[J,[Q],(t,[e])=>e.value in t.properties()],"filter-has-id":[J,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[J,[nt(K)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[J,[nt(Q)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[J,[K,nt(Q)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[J,[K,nt(Q)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:J,overloads:[[[J,J],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Ne(J),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:J,overloads:[[[J,J],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Ne(J),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[J,[J],(t,[e])=>!e.evaluate(t)],"is-supported-script":[J,[K],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[K,[K],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[K,[K],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[K,Ne(Q),(t,e)=>e.map((e=>mt(e.evaluate(t)))).join("")],"resolved-locale":[K,[tt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class sr{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new It,this._defaultValue=e?function(t){return"color"===t.type&&He(t.default)?new U(0,0,0,0):"color"===t.type?U.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,r,n,i,s,o,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s,o,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new xt(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function or(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Oe}function ar(t,e){const r=new Jt(Oe,[],e?function(t){const e={color:H,string:K,number:Y,enum:K,boolean:J,formatted:et,resolvedImage:rt};return"array"===t.type?nt(e[t.value]||Q,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Ze(new sr(n,e)):Xe(r.errors)}class lr{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Gt(e.expression)}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}}class ur{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Gt(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?ve.interpolationFactor(this.interpolationType,t,e,r):0}}function cr(t,e){if("error"===(t=ar(t,e)).result)return t;const r=t.value.expression,n=Xt(r);if(!n&&!Ge(e))return Xe([new Z("","data expressions not supported")]);const i=Yt(r,["zoom","pitch","distance-from-center"]);if(!i&&!Ye(e))return Xe([new Z("","zoom expressions not supported")]);const s=pr(r);return s||i?s instanceof Z?Xe([s]):s instanceof ve&&!Ke(e)?Xe([new Z("",'"interpolate" expressions cannot be used with this property')]):Ze(s?new ur(n?"camera":"composite",t.value,s.labels,s instanceof ve?s.interpolation:void 0):new lr(n?"constant":"source",t.value)):Xe([new Z("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class hr{constructor(t,e){this._parameters=t,this._specification=e,N(this,Qe(this._parameters,this._specification))}static deserialize(t){return new hr(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function pr(t){let e=null;if(t instanceof _e)e=pr(t.result);else if(t instanceof we){for(const r of t.args)if(e=pr(r),e)break}else(t instanceof Qt||t instanceof ve)&&t.input instanceof zt&&"zoom"===t.input.name&&(e=t);return e instanceof Z||t.eachChild((t=>{const r=pr(t);r instanceof Z?e=r:!e&&r?e=new Z("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new Z("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}const{ImageData:fr,ImageBitmap:dr}=s,yr={};function mr(t,e,r={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),yr[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}mr("Object",Object),$.serialize=function(t,e){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}},$.deserialize=function(t){return new $(t.buffer)},mr("Grid",$),mr("Color",U),mr("Error",Error),mr("ResolvedImage",pt),mr("StylePropertyFunction",hr),mr("StyleExpression",sr,{omit:["_evaluator"]}),mr("ZoomDependentExpression",ur),mr("ZoomConstantExpression",lr),mr("CompoundExpression",zt,{omit:["_evaluate"]});for(const t in Oe)Oe[t]._classRegistryKey||mr(`Expression_${t}`,Oe[t]);function gr(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function xr(t){return dr&&t instanceof dr}function vr(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(gr(t)||xr(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const r=t;return e&&e.push(r.buffer),r}if(t instanceof fr)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(vr(n,e));return r}if("object"==typeof t){const r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error("can't serialize object of unregistered class");const i=r.serialize?r.serialize(t,e):{};if(!r.serialize){for(const r in t){if(!t.hasOwnProperty(r))continue;if(yr[n].omit.indexOf(r)>=0)continue;const s=t[r];i[r]=yr[n].shallow.indexOf(r)>=0?s:vr(s,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(i.$name=n),i}throw new Error("can't serialize object of type "+typeof t)}function br(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||gr(t)||xr(t)||ArrayBuffer.isView(t)||t instanceof fr)return t;if(Array.isArray(t))return t.map(br);if("object"==typeof t){const e=t.$name||"Object",{klass:r}=yr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const r of Object.keys(t)){if("$name"===r)continue;const i=t[r];n[r]=yr[e].shallow.indexOf(r)>=0?i:br(i)}return n}throw new Error("can't deserialize object of type "+typeof t)}class wr{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){delete this._channel,this._callback=()=>{}}}const _r=s.performance;function Ar(t){const e=t?t.url.toString():void 0;return _r.getEntriesByName(e)}class Sr{constructor(){this.tasks={},this.taskQueue=[],I(["process"],this),this.invoker=new wr(this.process),this.nextId=0}add(t,e){const r=this.nextId++,n=function({type:t,isSymbolTile:e,zoom:r}){return r=r||0,"message"===t?0:"maybePrepare"!==t||e?"parseTile"!==t||e?"parseTile"===t&&e?300-r:"maybePrepare"===t&&e?400-r:500:200-r:100-r}(e);if(0===n){E();try{t()}finally{}return{cancel:()=>{}}}return this.tasks[r]={fn:t,metadata:e,priority:n,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}}}process(){E();try{if(this.taskQueue=this.taskQueue.filter((t=>!!this.tasks[t])),!this.taskQueue.length)return;const t=this.pick();if(null===t)return;const e=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),!e)return;e.fn()}finally{}}pick(){let t=null,e=1/0;for(let r=0;r<this.taskQueue.length;r++){const n=this.tasks[this.taskQueue[r]];n.priority<e&&(e=n.priority,t=r)}if(null===t)return null;const r=this.taskQueue[t];return this.taskQueue.splice(t,1),r}remove(){this.invoker.remove()}}class kr{constructor(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.cancelCallbacks={},I(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=E()?t:s,this.scheduler=new Sr}send(t,e,r,n,i=!1,s){const o=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=s,this.callbacks[o]=r);const a=L(this.globalScope)?void 0:[];return this.target.postMessage({id:o,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:vr(e,a)},a),{cancel:()=>{r&&delete this.callbacks[o],this.target.postMessage({id:o,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(t){const e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t.cancel()}else if(e.mustQueue||E()){const t=this.callbacks[r];this.cancelCallbacks[r]=this.scheduler.add((()=>this.processTask(r,e)),t&&t.metadata||{type:"message"})}else this.processTask(r,e)}processTask(t,e){if("<response>"===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(br(e.error)):r(null,br(e.data)))}else{const r=L(this.globalScope)?void 0:[],n=e.hasCallback?(e,n)=>{delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?vr(e):null,data:vr(n,r)},r)}:t=>{},i=br(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,i,n);else if(this.parent.getWorkerSource){const t=e.type.split(".");this.parent.getWorkerSource(e.sourceMapId,t[0],i.source)[t[1]](i,n)}else n(new Error(`Could not find function ${e.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Ir=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"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":true,"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":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"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":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"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_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"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":true,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"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":true,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"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":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"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_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":0.1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"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"}}}');class zr{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function Mr(t){const e=t.value;return e?[new zr(t.key,e,"constants have been deprecated as of v8")]:[]}function Pr(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Cr(t){if(Array.isArray(t))return t.map(Cr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=Cr(t[r]);return e}return Pr(t)}function Tr(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,o=t.styleSpec;let a=[];const l=Je(r);if("object"!==l)return[new zr(e,r,`object expected, ${l} found`)];for(const t in r){const l=t.split(".")[0],u=n[l]||n["*"];let c;if(i[l])c=i[l];else if(n[l])c=hn;else if(i["*"])c=i["*"];else{if(!n["*"]){a.push(new zr(e,r[t],`unknown property "${t}"`));continue}c=hn}a=a.concat(c({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:u,style:s,styleSpec:o,object:r,objectKey:t},r))}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&a.push(new zr(e,r,`missing required property "${t}"`));return a}function Br(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,s=t.key,o=t.arrayElementValidator||hn;if("array"!==Je(e))return[new zr(s,e,`array expected, ${Je(e)} found`)];if(r.length&&e.length!==r.length)return[new zr(s,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new zr(s,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let a={type:r.value,values:r.values,minimum:r.minimum,maximum:r.maximum};i.$version<7&&(a.function=r.function),"object"===Je(r.value)&&(a=r.value);let l=[];for(let t=0;t<e.length;t++)l=l.concat(o({array:e,arrayIndex:t,value:e[t],valueSpec:a,style:n,styleSpec:i,key:`${s}[${t}]`}));return l}function Vr(t){const e=t.key,r=t.value,n=t.valueSpec;let i=Je(r);if("number"===i&&r!=r&&(i="NaN"),"number"!==i)return[new zr(e,r,`number expected, ${i} found`)];if("minimum"in n){let i=n.minimum;if("array"===Je(n.minimum)&&(i=n.minimum[t.arrayIndex]),r<i)return[new zr(e,r,`${r} is less than the minimum value ${i}`)]}if("maximum"in n){let i=n.maximum;if("array"===Je(n.maximum)&&(i=n.maximum[t.arrayIndex]),r>i)return[new zr(e,r,`${r} is greater than the maximum value ${i}`)]}return[]}function Er(t){const e=t.valueSpec,r=Pr(t.value.type);let n,i,s,o={};const a="categorical"!==r&&void 0===t.value.property,l=!a,u="array"===Je(t.value.stops)&&"array"===Je(t.value.stops[0])&&"object"===Je(t.value.stops[0][0]),c=Tr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new zr(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Br({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Je(n)&&0===n.length&&e.push(new zr(t.key,n,"array must have at least one stop")),e},default:function(t){return hn({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&a&&c.push(new zr(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||c.push(new zr(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!Ke(t.valueSpec)&&c.push(new zr(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Ge(t.valueSpec)?c.push(new zr(t.key,t.value,"property functions not supported")):a&&!Ye(t.valueSpec)&&c.push(new zr(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||c.push(new zr(t.key,t.value,'"property" property is required')),c;function h(t){let r=[];const n=t.value,a=t.key;if("array"!==Je(n))return[new zr(a,n,`array expected, ${Je(n)} found`)];if(2!==n.length)return[new zr(a,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==Je(n[0]))return[new zr(a,n,`object expected, ${Je(n[0])} found`)];if(void 0===n[0].zoom)return[new zr(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new zr(a,n,"object stop key must have value")];if(s&&s>Pr(n[0].zoom))return[new zr(a,n[0].zoom,"stop zoom values must appear in ascending order")];Pr(n[0].zoom)!==s&&(s=Pr(n[0].zoom),i=void 0,o={}),r=r.concat(Tr({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Vr,value:p}}))}else r=r.concat(p({key:`${a}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return or(Cr(n[1]))?r.concat([new zr(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(hn({key:`${a}[1]`,value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const a=Je(t.value),l=Pr(t.value),u=null!==t.value?t.value:s;if(n){if(a!==n)return[new zr(t.key,u,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new zr(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==r){let n=`number expected, ${a} found`;return Ge(e)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new zr(t.key,u,n)]}return"categorical"!==r||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===a&&void 0!==i&&l<i?[new zr(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===r&&l in o?[new zr(t.key,u,"stop domain values must be unique")]:(o[l]=!0,[])):[new zr(t.key,u,`integer expected, found ${l}`)]}}function Dr(t){const e=("property"===t.expressionContext?cr:ar)(Cr(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new zr(`${t.key}${e.key}`,t.value,e.message)));const r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new zr(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Gt(r))return[new zr(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext)return Fr(r,t);if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Yt(r,["zoom","feature-state"]))return[new zr(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Xt(r))return[new zr(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Fr(t,e){const r=new Set(["zoom","feature-state","pitch","distance-from-center"]);for(const t of e.valueSpec.expression.parameters)r.delete(t);if(0===r.size)return[];const n=[];return t instanceof zt&&r.has(t.name)?[new zr(e.key,e.value,`["${t.name}"] expression is not supported in a filter for a ${e.object.type} layer with id: ${e.object.id}`)]:(t.eachChild((t=>{n.push(...Fr(t,e))})),n)}function Lr(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(Pr(r))&&i.push(new zr(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(Pr(r))&&i.push(new zr(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function jr(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!jr(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function $r(t,e="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};jr(t)||(t=Xr(t));const r=t;let n=!0;try{n=function(t){if(!qr(t))return t;let e=Cr(t);return Rr(e),e=Or(e),e}(r)}catch(t){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(r,null,2)}\n `)}const i=Ir[`filter_${e}`],s=ar(n,i);let o=null;if("error"===s.result)throw new Error(s.value.map((t=>`${t.key}: ${t.message}`)).join(", "));o=(t,e,r)=>s.value.evaluate(t,e,{},r);let a=null,l=null;if(n!==r){const t=ar(r,i);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));a=(e,r,n,i,s)=>t.value.evaluate(e,r,{},n,void 0,void 0,i,s),l=!Xt(t.value.expression)}return o=o,{filter:o,dynamicFilter:a||void 0,needGeometry:Zr(n),needFeature:!!l}}function Or(t){if(!Array.isArray(t))return t;const e=function(t){if(Ur.has(t[0]))for(let e=1;e<t.length;e++)if(qr(t[e]))return!0;return t}(t);return!0===e?e:e.map((t=>Or(t)))}function Rr(t){let e=!1;const r=[];if("case"===t[0]){for(let n=1;n<t.length-1;n+=2)e=e||qr(t[n]),r.push(t[n+1]);r.push(t[t.length-1])}else if("match"===t[0]){e=e||qr(t[1]);for(let e=2;e<t.length-1;e+=2)r.push(t[e+1]);r.push(t[t.length-1])}else if("step"===t[0]){e=e||qr(t[1]);for(let e=1;e<t.length-1;e+=2)r.push(t[e+1])}e&&(t.length=0,t.push("any",...r));for(let e=1;e<t.length;e++)Rr(t[e])}function qr(t){if(!Array.isArray(t))return!1;if("pitch"===(e=t[0])||"distance-from-center"===e)return!0;var e;for(let e=1;e<t.length;e++)if(qr(t[e]))return!0;return!1}const Ur=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Nr(t,e){return t<e?-1:t>e?1:0}function Zr(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Zr(t[e]))return!0;return!1}function Xr(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Gr(t[1],t[2],"=="):"!="===e?Jr(Gr(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Gr(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(Xr))):"all"===e?["all"].concat(t.slice(1).map(Xr)):"none"===e?["all"].concat(t.slice(1).map(Xr).map(Jr)):"in"===e?Yr(t[1],t.slice(2)):"!in"===e?Jr(Yr(t[1],t.slice(2))):"has"===e?Kr(t[1]):"!has"===e?Jr(Kr(t[1])):"within"!==e||t;var r}function Gr(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Yr(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Nr)]]:["filter-in-small",t,["literal",e]]}}function Kr(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Jr(t){return["!",t]}function Hr(t){if(jr(Cr(t.value))){const e=Cr(t.layerType);return Dr(N({},t,{expressionContext:"filter",valueSpec:t.styleSpec[`filter_${e||"fill"}`]}))}return Wr(t)}function Wr(t){const e=t.value,r=t.key;if("array"!==Je(e))return[new zr(r,e,`array expected, ${Je(e)} found`)];const n=t.styleSpec;let i,s=[];if(e.length<1)return[new zr(r,e,"filter array must have at least 1 element")];switch(s=s.concat(Lr({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Pr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Pr(e[1])&&s.push(new zr(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new zr(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=Je(e[1]),"string"!==i&&s.push(new zr(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let o=2;o<e.length;o++)i=Je(e[o]),"$type"===Pr(e[1])?s=s.concat(Lr({key:`${r}[${o}]`,value:e[o],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new zr(`${r}[${o}]`,e[o],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(Wr({key:`${r}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=Je(e[1]),2!==e.length?s.push(new zr(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new zr(`${r}[1]`,e[1],`string expected, ${i} found`));break;case"within":i=Je(e[1]),2!==e.length?s.push(new zr(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==i&&s.push(new zr(`${r}[1]`,e[1],`object expected, ${i} found`))}return s}function Qr(t,e){const r=t.key,n=t.style,i=t.styleSpec,s=t.value,o=t.objectKey,a=i[`${e}_${t.layerType}`];if(!a)return[];const l=o.match(/^(.*)-transition$/);if("paint"===e&&l&&a[l[1]]&&a[l[1]].transition)return hn({key:r,value:s,valueSpec:i.transition,style:n,styleSpec:i});const u=t.valueSpec||a[o];if(!u)return[new zr(r,s,`unknown property "${o}"`)];let c;if("string"===Je(s)&&Ge(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new zr(r,s,`"${o}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];const h=[];return"symbol"===t.layerType&&("text-field"===o&&n&&!n.glyphs&&h.push(new zr(r,s,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&He(Cr(s))&&"identity"===Pr(s.type)&&h.push(new zr(r,s,'"text-font" does not support identity functions'))),h.concat(hn({key:t.key,value:s,valueSpec:u,style:n,styleSpec:i,expressionContext:"property",propertyType:e,propertyKey:o}))}function tn(t){return Qr(t,"paint")}function en(t){return Qr(t,"layout")}function rn(t){let e=[];const r=t.value,n=t.key,i=t.style,s=t.styleSpec;r.type||r.ref||e.push(new zr(n,r,'either "type" or "ref" is required'));let o=Pr(r.type);const a=Pr(r.ref);if(r.id){const s=Pr(r.id);for(let o=0;o<t.arrayIndex;o++){const t=i.layers[o];Pr(t.id)===s&&e.push(new zr(n,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in r&&e.push(new zr(n,r[t],`"${t}" is prohibited for ref layers`))})),i.layers.forEach((e=>{Pr(e.id)===a&&(t=e)})),t?t.ref?e.push(new zr(n,r.ref,"ref cannot reference another ref layer")):o=Pr(t.type):e.push(new zr(n,r.ref,`ref layer "${a}" not found`))}else if("background"!==o&&"sky"!==o)if(r.source){const t=i.sources&&i.sources[r.source],s=t&&Pr(t.type);t?"vector"===s&&"raster"===o?e.push(new zr(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===s&&"raster"!==o?e.push(new zr(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==o?e.push(new zr(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==o||!r.paint||!r.paint["line-gradient"]||"geojson"===s&&t.lineMetrics||e.push(new zr(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new zr(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new zr(n,r.source,`source "${r.source}" not found`))}else e.push(new zr(n,r,'missing required property "source"'));return e=e.concat(Tr({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>hn({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:t=>Hr(N({layerType:o},t)),layout:t=>Tr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>en(N({layerType:o},t))}}),paint:t=>Tr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>tn(N({layerType:o},t))}})}})),e}function nn(t){const e=t.value,r=t.key,n=Je(e);return"string"!==n?[new zr(r,e,`string expected, ${n} found`)]:[]}const sn={promoteId:function({key:t,value:e}){if("string"===Je(e))return nn({key:t,value:e});{const r=[];for(const n in e)r.push(...nn({key:`${t}.${n}`,value:e[n]}));return r}}};function on(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style;if(!e.type)return[new zr(r,e,'"type" is required')];const s=Pr(e.type);let o;switch(s){case"vector":case"raster":case"raster-dem":return o=Tr({key:r,value:e,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:sn}),o;case"geojson":if(o=Tr({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,objectElementValidators:sn}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;o.push(...Dr({key:`${r}.${t}.map`,value:i,expressionContext:"cluster-map"})),o.push(...Dr({key:`${r}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return o;case"video":return Tr({key:r,value:e,valueSpec:n.source_video,style:i,styleSpec:n});case"image":return Tr({key:r,value:e,valueSpec:n.source_image,style:i,styleSpec:n});case"canvas":return[new zr(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Lr({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:n})}}function an(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let s=[];const o=Je(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new zr("light",e,`object expected, ${o} found`)]),s;for(const t in e){const o=t.match(/^(.*)-transition$/);s=s.concat(o&&n[o[1]]&&n[o[1]].transition?hn({key:t,value:e[t],valueSpec:r.transition,style:i,styleSpec:r}):n[t]?hn({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}):[new zr(t,e[t],`unknown property "${t}"`)])}return s}function ln(t){const e=t.value,r=t.key,n=t.style,i=t.styleSpec,s=i.terrain;let o=[];const a=Je(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new zr("terrain",e,`object expected, ${a} found`)]),o;for(const t in e){const r=t.match(/^(.*)-transition$/);o=o.concat(r&&s[r[1]]&&s[r[1]].transition?hn({key:t,value:e[t],valueSpec:i.transition,style:n,styleSpec:i}):s[t]?hn({key:t,value:e[t],valueSpec:s[t],style:n,styleSpec:i}):[new zr(t,e[t],`unknown property "${t}"`)])}if(e.source){const t=n.sources&&n.sources[e.source],i=t&&Pr(t.type);t?"raster-dem"!==i&&o.push(new zr(r,e.source,`terrain cannot be used with a source of type ${i}, it only be used with a "raster-dem" source type`)):o.push(new zr(r,e.source,`source "${e.source}" not found`))}else o.push(new zr(r,e,'terrain is missing required property "source"'));return o}function un(t){const e=t.value,r=t.style,n=t.styleSpec,i=n.fog;let s=[];const o=Je(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new zr("fog",e,`object expected, ${o} found`)]),s;for(const t in e){const o=t.match(/^(.*)-transition$/);s=s.concat(o&&i[o[1]]&&i[o[1]].transition?hn({key:t,value:e[t],valueSpec:n.transition,style:r,styleSpec:n}):i[t]?hn({key:t,value:e[t],valueSpec:i[t],style:r,styleSpec:n}):[new zr(t,e[t],`unknown property "${t}"`)])}return s}const cn={"*":()=>[],array:Br,boolean:function(t){const e=t.value,r=t.key,n=Je(e);return"boolean"!==n?[new zr(r,e,`boolean expected, ${n} found`)]:[]},number:Vr,color:function(t){const e=t.key,r=t.value,n=Je(r);return"string"!==n?[new zr(e,r,`color expected, ${n} found`)]:null===q.parseCSSColor(r)?[new zr(e,r,`color expected, "${r}" found`)]:[]},constants:Mr,enum:Lr,filter:Hr,function:Er,layer:rn,object:Tr,source:on,light:an,terrain:ln,fog:un,string:nn,formatted:function(t){return 0===nn(t).length?[]:Dr(t)},resolvedImage:function(t){return 0===nn(t).length?[]:Dr(t)},projection:function(t){const e=t.value,r=t.styleSpec,n=r.projection,i=t.style;let s=[];const o=Je(e);if("object"===o)for(const t in e)s=s.concat(hn({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}));else"string"!==o&&(s=s.concat([new zr("projection",e,`object or string expected, ${o} found`)]));return s}};function hn(t){const e=t.value,r=t.valueSpec,n=t.styleSpec;return r.expression&&He(Pr(e))?Er(t):r.expression&&or(Cr(e))?Dr(t):r.type&&cn[r.type]?cn[r.type](t):Tr(N({},t,{valueSpec:r.type?n[r.type]:r}))}function pn(t){const e=t.value,r=t.key,n=nn(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new zr(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new zr(r,e,'"glyphs" url must include a "{range}" token'))),n}function fn(t,e=Ir){let r=[];return r=r.concat(hn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:pn,"*":()=>[]}})),t.constants&&(r=r.concat(Mr({key:"constants",value:t.constants,style:t,styleSpec:e}))),dn(r)}function dn(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function yn(t){return function(...e){return dn(t.apply(this,e))}}function mn(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function gn(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}fn.source=yn(on),fn.light=yn(an),fn.terrain=yn(ln),fn.fog=yn(un),fn.layer=yn(rn),fn.filter=yn(Hr),fn.paintProperty=yn(tn),fn.layoutProperty=yn(en);class xn{constructor(t,e={}){A(this,e),this.type=t}}class vn extends xn{constructor(t,e={}){super("error",A({error:t},e))}}class bn{on(t,e){return this._listeners=this._listeners||{},mn(t,e,this._listeners),this}off(t,e){return gn(t,e,this._listeners),gn(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},mn(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new xn(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of n)gn(r,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(A(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t))}else t instanceof vn&&console.error(t.error);return this}listens(t){return!!(this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}const wn=fn,_n=wn.paintProperty,An=wn.layoutProperty;class Sn{constructor(){this.first=!0}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}}const kn=t=>t>=1536&&t<=1791,In=t=>t>=1872&&t<=1919,zn=t=>t>=2208&&t<=2303,Mn=t=>t>=11904&&t<=12031,Pn=t=>t>=12032&&t<=12255,Cn=t=>t>=12272&&t<=12287,Tn=t=>t>=12288&&t<=12351,Bn=t=>t>=12352&&t<=12447,Vn=t=>t>=12448&&t<=12543,En=t=>t>=12544&&t<=12591,Dn=t=>t>=12704&&t<=12735,Fn=t=>t>=12736&&t<=12783,Ln=t=>t>=12784&&t<=12799,jn=t=>t>=12800&&t<=13055,$n=t=>t>=13056&&t<=13311,On=t=>t>=13312&&t<=19903,Rn=t=>t>=19968&&t<=40959,qn=t=>t>=40960&&t<=42127,Un=t=>t>=42128&&t<=42191,Nn=t=>t>=63744&&t<=64255,Zn=t=>t>=64336&&t<=65023,Xn=t=>t>=65040&&t<=65055,Gn=t=>t>=65072&&t<=65103,Yn=t=>t>=65104&&t<=65135,Kn=t=>t>=65136&&t<=65279,Jn=t=>t>=65280&&t<=65519;function Hn(t){for(const e of t)if(ti(e.charCodeAt(0)))return!0;return!1}function Wn(t){for(const e of t)if(!Qn(e.charCodeAt(0)))return!1;return!0}function Qn(t){return!(kn(t)||In(t)||zn(t)||Zn(t)||Kn(t))}function ti(t){return!(746!==t&&747!==t&&(t<4352||!(Dn(t)||En(t)||Gn(t)&&!(t>=65097&&t<=65103)||Nn(t)||$n(t)||Mn(t)||Fn(t)||!(!Tn(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||On(t)||Rn(t)||jn(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||(t=>t>=44032&&t<=55215)(t)||Bn(t)||Cn(t)||(t=>t>=12688&&t<=12703)(t)||Pn(t)||Ln(t)||Vn(t)&&12540!==t||!(!Jn(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Yn(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||Xn(t)||(t=>t>=19904&&t<=19967)(t)||qn(t)||Un(t))))}function ei(t){return!(ti(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Tn(t)||Vn(t)||(t=>t>=57344&&t<=63743)(t)||Gn(t)||Yn(t)||Jn(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function ri(t){return t>=1424&&t<=2303||Zn(t)||Kn(t)}function ni(t,e){return!(!e&&ri(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||(t=>t>=6016&&t<=6143)(t))}function ii(t){for(const e of t)if(ri(e.charCodeAt(0)))return!0;return!1}let si;const oi={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==si){const t=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{si=null!=process.env.API_URL_REGEX?new RegExp(process.env.API_URL_REGEX):t}catch(e){si=t}}return si},get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},ai={supported:!1,testSupport:function(t){!ci&&ui&&(hi?pi(t):li=t)}};let li,ui,ci=!1,hi=!1;function pi(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,ui),t.isContextLost())return;ai.supported=!0}catch(t){}t.deleteTexture(e),ci=!0}s.document&&(ui=s.document.createElement("img"),ui.onload=function(){li&&pi(li),li=null,hi=!0},ui.onerror=function(){ci=!0,li=null},ui.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const fi="NO_ACCESS_TOKEN";function di(t){return oi.API_URL_REGEX.test(t)}const yi=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function mi(t){const e=t.match(yi);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function gi(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}function xi(t){if(!t)return null;const e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(s.atob(e[1]).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(t){return null}}class vi{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const e=xi(oi.ACCESS_TOKEN);let r="";return r=e&&e.u?s.btoa(encodeURIComponent(e.u).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(Number("0x"+e))))):"",t?`mapbox.eventData.${t}:${r}`:`mapbox.eventData:${r}`}fetchEventData(){const t=j("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{const t=s.localStorage.getItem(e);t&&(this.eventData=JSON.parse(t));const n=s.localStorage.getItem(r);n&&(this.anonId=n)}catch(t){T("Unable to read from LocalStorage")}}saveEventData(){const t=j("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{s.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&s.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){T("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,e,r,n){if(!oi.EVENTS_URL)return;const i=mi(oi.EVENTS_URL);i.params.push(`access_token=${n||oi.ACCESS_TOKEN||""}`);const s={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"2.7.0",skuId:"01",userId:this.anonId},o=e?A(s,e):s,a={url:gi(i),headers:{"Content-Type":"text/plain"},body:JSON.stringify([o])};this.pendingRequest=Ci(a,(t=>{this.pendingRequest=null,r(t),this.saveEventData(),this.processRequests(n)}))}queueRequest(t,e){this.queue.push(t),this.processRequests(e)}}const bi=new class extends vi{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){oi.EVENTS_URL&&oi.ACCESS_TOKEN&&Array.isArray(t)&&t.some((t=>function(t){return 0===t.indexOf("mapbox:")}(t)||di(t)))&&this.queueRequest(Date.now(),e)}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=xi(oi.ACCESS_TOKEN),r=e?e.u:oi.ACCESS_TOKEN;let n=r!==this.eventData.tokenU;k(this.anonId)||(this.anonId=S(),n=!0);const i=this.queue.shift();if(this.eventData.lastSuccess){const t=new Date(this.eventData.lastSuccess),e=new Date(i),r=(i-this.eventData.lastSuccess)/864e5;n=n||r>=1||r<-1||t.getDate()!==e.getDate()}else n=!0;if(!n)return this.processRequests();this.postEvent(i,{"enabled.telemetry":!1},(t=>{t||(this.eventData.lastSuccess=i,this.eventData.tokenU=r)}),t)}};bi.postTurnstileEvent.bind(bi);const wi=new class extends vi{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,r,n){this.skuToken=e,this.errorCb=n,oi.EVENTS_URL&&(r||oi.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(fi)))}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:r}=this.queue.shift();e&&this.success[e]||(this.anonId||this.fetchEventData(),k(this.anonId)||(this.anonId=S()),this.postEvent(r,{skuToken:this.skuToken},(t=>{t?this.errorCb(t):e&&(this.success[e]=!0)}),t))}};wi.postMapLoadEvent.bind(wi);const _i=new class extends vi{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,e,r,n){const i=mi(oi.API_URL+oi.SESSION_PATH);i.params.push(`sku=${e||""}`),i.params.push(`access_token=${n||oi.ACCESS_TOKEN||""}`);const s={url:gi(i),headers:{"Content-Type":"text/plain"}};this.pendingRequest=Ti(s,(t=>{this.pendingRequest=null,r(t),this.saveEventData(),this.processRequests(n)}))}getSessionAPI(t,e,r,n){this.skuToken=e,this.errorCb=n,r||oi.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(fi))}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:r}=this.queue.shift();e&&this.success[e]||this.getSession(r,this.skuToken,(t=>{t?this.errorCb(t):e&&(this.success[e]=!0)}),t)}};let Ai,Si;function ki(){s.caches&&!Ai&&(Ai=s.caches.open("mapbox-tiles"))}function Ii(t){const e=t.indexOf("?");return e<0?t:t.slice(0,e)}_i.getSessionAPI.bind(_i),"function"==typeof Object.freeze&&Object.freeze({Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"});class zi extends Error{constructor(t,e,r){401===e&&di(r)&&(t+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(t),this.status=e,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Mi=E()?()=>self.worker&&self.worker.referrer:()=>("blob:"===s.location.protocol?s.parent:s).location.href;const Pi=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(Mi())&&!/^\w+:/.test(r))){if(s.fetch&&s.Request&&s.AbortController&&s.Request.prototype.hasOwnProperty("signal"))return function(t,e){const r=new s.AbortController,n=new s.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:Mi(),signal:r.signal});let i=!1,o=!1;const a=(l=n.url).indexOf("sku=")>0&&di(l);var l;"json"===t.type&&n.headers.set("Accept","application/json");const u=(r,i,l)=>{if(o)return;if(r&&"SecurityError"!==r.message&&T(r),i&&l)return c(i);const u=Date.now();s.fetch(n).then((r=>{if(r.ok){const t=a?r.clone():null;return c(r,t,u)}return e(new zi(r.statusText,r.status,t.url))})).catch((t=>{20!==t.code&&e(new Error(t.message))}))},c=(r,a,l)=>{("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{o||(a&&l&&function(t,e,r){if(ki(),!Ai)return;const n={status:e.status,statusText:e.statusText,headers:new s.Headers};e.headers.forEach(((t,e)=>n.headers.set(e,t)));const i=D(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===Si)try{new Response(new ReadableStream),Si=!0}catch(t){Si=!1}Si?e(t.body):t.blob().then(e)}(e,(e=>{const r=new s.Response(e,n);ki(),Ai&&Ai.then((e=>e.put(Ii(t.url),r))).catch((t=>T(t.message)))})))}(n,a,l),i=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((t=>{o||e(new Error(t.message))}))};return a?function(t,e){if(ki(),!Ai)return e(null);const r=Ii(t.url);Ai.then((t=>{t.match(r).then((n=>{const i=function(t){if(!t)return!1;const e=new Date(t.headers.get("Expires")||0),r=D(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(n);t.delete(r),i&&t.put(r,n.clone()),e(null,n,i)})).catch(e)})).catch(e)}(n,u):u(null,null),{cancel:()=>{o=!0,i||r.abort()}}}(t,e);if(E()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){const r=new s.XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{e(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else e(new zi(r.statusText,r.status,t.url))},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},Ci=function(t,e){return Pi(A(t,{method:"POST"}),e)},Ti=function(t,e){return Pi(A(t,{method:"GET"}),e)};let Bi="unavailable",Vi=null;const Ei={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>"loaded"===Bi||null!=Ei.applyArabicShaping,isLoading:()=>"loading"===Bi,setState(t){Bi=t.pluginStatus,Vi=t.pluginURL},isParsed:()=>null!=Ei.applyArabicShaping&&null!=Ei.processBidirectionalText&&null!=Ei.processStyledBidirectionalText,getPluginURL:()=>Vi};class Di{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition,this.pitch=e.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Sn,this.transition={},this.pitch=0)}isSupportedScript(t){return function(t,e){for(const r of t)if(!ni(r.charCodeAt(0),e))return!1;return!0}(t,Ei.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}class Fi{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(He(t))return new hr(t,e);if(or(t)){const r=cr(t,e);if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return r.value}{let r=t;return"string"==typeof t&&"color"===e.type&&(r=U.parse(t)),{kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class Li{constructor(t){this.property=t,this.value=new Fi(t,void 0)}transitioned(t,e){return new $i(this.property,this.value,e,A({},t.transition,this.transition),t.now)}untransitioned(){return new $i(this.property,this.value,null,{},0)}}class ji{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return P(this._values[t].value.value)}setValue(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Li(this._values[t].property)),this._values[t].value=new Fi(this._values[t].property,null===e?void 0:P(e))}getTransition(t){return P(this._values[t].transition)}setTransition(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Li(this._values[t].property)),this._values[t].transition=P(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n)}return t}transitioned(t,e){const r=new Oi(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new Oi(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class $i{constructor(t,e,r,n,i){const s=n.delay||0,o=n.duration||0;i=i||0,this.property=t,this.value=e,this.begin=i+s,this.end=this.begin+o,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return s.possiblyEvaluate(t,e,r);{const o=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,r),i,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(o))}}return i}}class Oi{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const n=new Ui(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Ri{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return P(this._values[t].value)}setValue(t,e){this._values[t]=new Fi(this._values[t].property,null===e?void 0:P(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){const n=new Ui(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class qi{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)}}class Ui{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ni{constructor(t){this.specification=t}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,r){const n=ee[this.specification.type];return n?n(t,e,r):t}}class Zi{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,n){return new qi(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new qi(this,{kind:"constant",value:void 0},t.parameters);const n=ee[this.specification.type];return n?new qi(this,{kind:"constant",value:n(t.value.value,e.value.value,r)},t.parameters):t}evaluate(t,e,r,n,i,s){return"constant"===t.kind?t.value:t.evaluate(e,r,n,i,s)}}class Xi extends Zi{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new qi(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),s="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,o=this._calculate(s,s,s,e);return new qi(this,{kind:"constant",value:o},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new qi(this,{kind:"constant",value:r},e)}return new qi(this,t.expression,e)}evaluate(t,e,r,n,i,s){if("source"===t.kind){const o=t.evaluate(e,r,n,i,s);return this._calculate(o,o,o,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e,other:r}:{from:r,to:e,other:t}}interpolate(t){return t}}class Gi{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new Di(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Di(Math.floor(e.zoom),e)),t.expression.evaluate(new Di(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class Yi{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)}interpolate(){return!1}}class Ki{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new Fi(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new Li(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}function Ji(t,e){return 256*(t=b(Math.floor(t),0,255))+b(Math.floor(e),0,255)}mr("DataDrivenProperty",Zi),mr("DataConstantProperty",Ni),mr("CrossFadedDataDrivenProperty",Xi),mr("CrossFadedProperty",Gi),mr("ColorRampProperty",Yi);const Hi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Wi{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Qi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ts(t,e=1){let r=0,n=0;return{members:t.map((t=>{const i=Hi[t.type].BYTES_PER_ELEMENT,s=r=es(r,Math.max(e,i)),o=t.components||1;return n=Math.max(n,i),r+=i*o,{name:t.name,type:t.type,components:o,offset:s}})),size:es(r,Math.max(n,e)),alignment:e}}function es(t,e){return Math.ceil(t/e)*e}class rs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}rs.prototype.bytesPerElement=4,mr("StructArrayLayout2i4",rs);class ns extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,t}}ns.prototype.bytesPerElement=8,mr("StructArrayLayout4i8",ns);class is extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s,o)}emplace(t,e,r,n,i,s,o,a){const l=6*t,u=12*t,c=3*t;return this.int16[l+0]=e,this.int16[l+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=s,this.uint8[u+7]=o,this.float32[c+2]=a,t}}is.prototype.bytesPerElement=12,mr("StructArrayLayout2i4ub1f12",is);class ss extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}ss.prototype.bytesPerElement=12,mr("StructArrayLayout3f12",ss);class os extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,s,o,a,l,u)}emplace(t,e,r,n,i,s,o,a,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=s,this.uint16[h+5]=o,this.uint16[h+6]=a,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}os.prototype.bytesPerElement=20,mr("StructArrayLayout10ui20",os);class as extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,n,i,s,o,a)}emplace(t,e,r,n,i,s,o,a,l){const u=8*t;return this.uint16[u+0]=e,this.uint16[u+1]=r,this.uint16[u+2]=n,this.uint16[u+3]=i,this.uint16[u+4]=s,this.uint16[u+5]=o,this.uint16[u+6]=a,this.uint16[u+7]=l,t}}as.prototype.bytesPerElement=16,mr("StructArrayLayout8ui16",as);class ls extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y){const m=this.length;return this.resize(m+1),this.emplace(m,t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y)}emplace(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m){const g=16*t;return this.int16[g+0]=e,this.int16[g+1]=r,this.int16[g+2]=n,this.int16[g+3]=i,this.uint16[g+4]=s,this.uint16[g+5]=o,this.uint16[g+6]=a,this.uint16[g+7]=l,this.int16[g+8]=u,this.int16[g+9]=c,this.int16[g+10]=h,this.int16[g+11]=p,this.int16[g+12]=f,this.int16[g+13]=d,this.int16[g+14]=y,this.int16[g+15]=m,t}}ls.prototype.bytesPerElement=32,mr("StructArrayLayout4i4ui4i4i32",ls);class us extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}us.prototype.bytesPerElement=4,mr("StructArrayLayout1ul4",us);class cs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a,l,u,c,h,p){const f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,n,i,s,o,a,l,u,c,h,p)}emplace(t,e,r,n,i,s,o,a,l,u,c,h,p,f){const d=20*t,y=10*t;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=n,this.int16[d+3]=i,this.int16[d+4]=s,this.float32[y+3]=o,this.float32[y+4]=a,this.float32[y+5]=l,this.float32[y+6]=u,this.int16[d+14]=c,this.uint32[y+8]=h,this.uint16[d+18]=p,this.uint16[d+19]=f,t}}cs.prototype.bytesPerElement=40,mr("StructArrayLayout5i4f1i1ul2ui40",cs);class hs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s,o)}emplace(t,e,r,n,i,s,o,a){const l=8*t;return this.int16[l+0]=e,this.int16[l+1]=r,this.int16[l+2]=n,this.int16[l+4]=i,this.int16[l+5]=s,this.int16[l+6]=o,this.int16[l+7]=a,t}}hs.prototype.bytesPerElement=16,mr("StructArrayLayout3i2i2i16",hs);class ps extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const o=4*t,a=8*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.int16[a+6]=i,this.int16[a+7]=s,t}}ps.prototype.bytesPerElement=16,mr("StructArrayLayout2f1f2i16",ps);class fs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=12*t,o=3*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[o+1]=n,this.float32[o+2]=i,t}}fs.prototype.bytesPerElement=12,mr("StructArrayLayout2ub2f12",fs);class ds extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}ds.prototype.bytesPerElement=6,mr("StructArrayLayout3ui6",ds);class ys extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b)}emplace(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w){const _=30*t,A=15*t,S=60*t;return this.int16[_+0]=e,this.int16[_+1]=r,this.int16[_+2]=n,this.float32[A+2]=i,this.float32[A+3]=s,this.uint16[_+8]=o,this.uint16[_+9]=a,this.uint32[A+5]=l,this.uint32[A+6]=u,this.uint32[A+7]=c,this.uint16[_+16]=h,this.uint16[_+17]=p,this.uint16[_+18]=f,this.float32[A+10]=d,this.float32[A+11]=y,this.uint8[S+48]=m,this.uint8[S+49]=g,this.uint8[S+50]=x,this.uint32[A+13]=v,this.int16[_+28]=b,this.uint8[S+58]=w,t}}ys.prototype.bytesPerElement=60,mr("StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60",ys);class ms extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S,k,I,z,M,P){const C=this.length;return this.resize(C+1),this.emplace(C,t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S,k,I,z,M,P)}emplace(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S,k,I,z,M,P,C){const T=38*t,B=19*t;return this.int16[T+0]=e,this.int16[T+1]=r,this.int16[T+2]=n,this.float32[B+2]=i,this.float32[B+3]=s,this.int16[T+8]=o,this.int16[T+9]=a,this.int16[T+10]=l,this.int16[T+11]=u,this.int16[T+12]=c,this.int16[T+13]=h,this.uint16[T+14]=p,this.uint16[T+15]=f,this.uint16[T+16]=d,this.uint16[T+17]=y,this.uint16[T+18]=m,this.uint16[T+19]=g,this.uint16[T+20]=x,this.uint16[T+21]=v,this.uint16[T+22]=b,this.uint16[T+23]=w,this.uint16[T+24]=_,this.uint16[T+25]=A,this.uint16[T+26]=S,this.uint16[T+27]=k,this.uint16[T+28]=I,this.uint32[B+15]=z,this.float32[B+16]=M,this.float32[B+17]=P,this.float32[B+18]=C,t}}ms.prototype.bytesPerElement=76,mr("StructArrayLayout3i2f6i15ui1ul3f76",ms);class gs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}gs.prototype.bytesPerElement=4,mr("StructArrayLayout1f4",gs);class xs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}xs.prototype.bytesPerElement=6,mr("StructArrayLayout3i6",xs);class vs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s,o)}emplace(t,e,r,n,i,s,o,a){const l=7*t;return this.float32[l+0]=e,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=i,this.float32[l+4]=s,this.float32[l+5]=o,this.float32[l+6]=a,t}}vs.prototype.bytesPerElement=28,mr("StructArrayLayout7f28",vs);class bs extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=6*t;return this.uint32[3*t+0]=e,this.uint16[s+2]=r,this.uint16[s+3]=n,this.uint16[s+4]=i,t}}bs.prototype.bytesPerElement=12,mr("StructArrayLayout1ul3ui12",bs);class ws extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}ws.prototype.bytesPerElement=4,mr("StructArrayLayout2ui4",ws);class _s extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}_s.prototype.bytesPerElement=2,mr("StructArrayLayout1ui2",_s);class As extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}As.prototype.bytesPerElement=8,mr("StructArrayLayout2f8",As);class Ss extends Qi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,t}}Ss.prototype.bytesPerElement=16,mr("StructArrayLayout4f16",Ss);class ks extends Wi{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}ks.prototype.size=40;class Is extends cs{get(t){return new ks(this,t)}}mr("CollisionBoxArray",Is);class zs extends Wi{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(t){this._structArray.uint8[this._pos1+49]=t}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(t){this._structArray.uint8[this._pos1+50]=t}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(t){this._structArray.uint32[this._pos4+13]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(t){this._structArray.uint8[this._pos1+58]=t}}zs.prototype.size=60;class Ms extends ys{get(t){return new zs(this,t)}}mr("PlacedSymbolArray",Ms);class Ps extends Wi{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(t){this._structArray.uint32[this._pos4+15]=t}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}Ps.prototype.size=76;class Cs extends ms{get(t){return new Ps(this,t)}}mr("SymbolInstanceArray",Cs);class Ts extends gs{getoffsetX(t){return this.float32[1*t+0]}}mr("GlyphOffsetArray",Ts);class Bs extends xs{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}mr("SymbolLineVertexArray",Bs);class Vs extends Wi{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}Vs.prototype.size=12;class Es extends bs{get(t){return new Vs(this,t)}}mr("FeatureIndexArray",Es);class Ds extends Wi{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}Ds.prototype.size=4;class Fs extends ws{get(t){return new Ds(this,t)}}mr("FillExtrusionCentroidArray",Fs);const Ls=ts([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"}]),js=ts([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]);var $s=R((function(t){t.exports=function(t,e){var r,n,i,s,o,a,l,u;for(n=t.length-(r=3&t.length),i=e,o=3432918353,a=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),Os=R((function(t){t.exports=function(t,e){for(var r,n=t.length,i=e^n,s=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}})),Rs=$s,qs=Os;Rs.murmur3=$s,Rs.murmur2=qs;class Us{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,n){this.ids.push(Ns(t)),this.positions.push(e,r,n)}getPositions(t){const e=Ns(t);let r=0,n=this.ids.length-1;for(;r<n;){const t=r+n>>1;this.ids[t]>=e?n=t:r=t+1}const i=[];for(;this.ids[r]===e;)i.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return i}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return Zs(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new Us;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Ns(t){const e=+t;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:Rs(String(t))}function Zs(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let s=r-1,o=n+1;for(;;){do{s++}while(t[s]<i);do{o--}while(t[o]>i);if(s>=o)break;Xs(t,s,o),Xs(e,3*s,3*o),Xs(e,3*s+1,3*o+1),Xs(e,3*s+2,3*o+2)}o-r<n-o?(Zs(t,e,r,o),r=o+1):(Zs(t,e,o+1,n),n=o)}}function Xs(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}mr("FeaturePositionMap",Us);class Gs{constructor(t,e){this.gl=t.gl,this.location=e}}class Ys extends Gs{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Ks extends Gs{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Js extends Gs{constructor(t,e){super(t,e),this.current=U.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}function Hs(t){return[Ji(255*t.r,255*t.g),Ji(255*t.b,255*t.a)]}class Ws{constructor(t,e,r){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return"color"===this.type?new Js(t,e):new Ys(t,e)}}class Qs{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tl.concat(e.br),this.patternTo=t.tl.concat(t.br)}setUniform(t,e,r,n){const i="u_pattern_to"===n||"u_dash_to"===n?this.patternTo:"u_pattern_from"===n||"u_dash_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;i&&t.set(i)}getBinding(t,e,r){return"u_pattern_from"===r||"u_pattern_to"===r||"u_dash_from"===r||"u_dash_to"===r?new Ks(t,e):new Ys(t,e)}}class to{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(t,e,r,n,i,s){const o=this.paintVertexArray.length,a=this.expression.evaluate(new Di(0),e,{},i,n,s);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)}updatePaintArray(t,e,r,n,i){const s=this.expression.evaluate({zoom:0},r,n,void 0,i);this._setPaintValue(t,e,s)}_setPaintValue(t,e,r){if("color"===this.type){const n=Hs(r);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class eo{constructor(t,e,r,n,i,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,r,n,i,s){const o=this.expression.evaluate(new Di(this.zoom),e,{},i,n,s),a=this.expression.evaluate(new Di(this.zoom+1),e,{},i,n,s),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,o,a)}updatePaintArray(t,e,r,n,i){const s=this.expression.evaluate({zoom:this.zoom},r,n,void 0,i),o=this.expression.evaluate({zoom:this.zoom+1},r,n,void 0,i);this._setPaintValue(t,e,s,o)}_setPaintValue(t,e,r,n){if("color"===this.type){const i=Hs(r),s=Hs(n);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i[0],i[1],s[0],s[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,n=b(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(n)}getBinding(t,e,r){return new Ys(t,e)}}class ro{constructor(t,e,r,n,i,s,o){this.expression=t,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=o,this.paintVertexAttributes=("array"===r?js:Ls).members;for(let t=0;t<e.length;++t);this.zoomInPaintVertexArray=new s,this.zoomOutPaintVertexArray=new s}populatePaintArray(t,e,r){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],r)}updatePaintArray(t,e,r,n,i,s){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],s)}_setPaintValues(t,e,r,n){if(!n||!r)return;const{min:i,mid:s,max:o}=r,a=n[i],l=n[s],u=n[o];if(a&&l&&u)for(let r=t;r<e;r++)this._setPaintValue(this.zoomInPaintVertexArray,r,l,a),this._setPaintValue(this.zoomOutPaintVertexArray,r,l,u)}_setPaintValue(t,e,r,n){t.emplace(e,r.tl[0],r.tl[1],r.br[0],r.br[1],n.tl[0],n.tl[1],n.br[0],n.br[1],r.pixelRatio,n.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class no{constructor(t,e,r=(()=>!0)){this.binders={},this._buffers=[];const n=[];for(const i in t.paint._values){if(!r(i))continue;const s=t.paint.get(i);if(!(s instanceof qi&&Ge(s.property.specification)))continue;const o=oo(i,t.type),a=s.value,l=s.property.specification.type,u=s.property.useIntegerZoom,c=s.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c,p="line-dasharray"===String(i)&&"constant"!==t.layout.get("line-cap").value.kind;if("constant"!==a.kind||p)if("source"===a.kind||p||h){const r=uo(i,l,"source");this.binders[i]=h?new ro(a,o,l,u,e,r,t.id):new to(a,o,l,r),n.push(`/a_${i}`)}else{const t=uo(i,l,"composite");this.binders[i]=new eo(a,o,l,u,e,t),n.push(`/z_${i}`)}else this.binders[i]=h?new Qs(a.value,o):new Ws(a.value,o,l),n.push(`/u_${i}`)}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof to||e instanceof eo?e.maxValue:0}populatePaintArrays(t,e,r,n,i,s){for(const o in this.binders){const a=this.binders[o];(a instanceof to||a instanceof eo||a instanceof ro)&&a.populatePaintArray(t,e,r,n,i,s)}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof Qs&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,n,i,s){let o=!1;for(const a in t){const l=e.getPositions(a);for(const e of l){const l=r.feature(e.index);for(const r in this.binders){const u=this.binders[r];if((u instanceof to||u instanceof eo||u instanceof ro)&&!0===u.expression.isStateDependent){const c=n.paint.get(r);u.expression=c.value,u.updatePaintArray(e.start,e.end,l,t[a],i,s),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof Ws||r instanceof Qs)&&t.push(...r.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof to||r instanceof eo||r instanceof ro)for(let e=0;e<r.paintVertexAttributes.length;e++)t.push(r.paintVertexAttributes[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Ws||r instanceof Qs||r instanceof eo)for(const e of r.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const r=[];for(const n in this.binders){const i=this.binders[n];if(i instanceof Ws||i instanceof Qs||i instanceof eo)for(const s of i.uniformNames)if(e[s]){const o=i.getBinding(t,e[s],s);r.push({name:s,property:n,binding:o})}}return r}setUniforms(t,e,r,n){for(const{name:t,property:i,binding:s}of e)this.binders[i].setUniform(s,n,r.get(i),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof ro){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof to||r instanceof eo)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof to||r instanceof eo||r instanceof ro)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof to||e instanceof eo||e instanceof ro)&&e.destroy()}}}class io{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new no(n,e,r);this.needsUpload=!1,this._featureMap=new Us,this._bufferOffset=0}populatePaintArrays(t,e,r,n,i,s,o){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s,o);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,n,i){for(const s of r)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(t,this._featureMap,e,s,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}const so={"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"],"line-dasharray":["dash_to","dash_from"]};function oo(t,e){return so[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const ao={"line-pattern":{source:os,composite:os},"fill-pattern":{source:os,composite:os},"fill-extrusion-pattern":{source:os,composite:os},"line-dasharray":{source:as,composite:as}},lo={color:{source:As,composite:Ss},number:{source:gs,composite:As}};function uo(t,e,r){const n=ao[t];return n&&n[r]||lo[e][r]}mr("ConstantBinder",Ws),mr("CrossFadedConstantBinder",Qs),mr("SourceExpressionBinder",to),mr("CrossFadedCompositeBinder",ro),mr("CompositeExpressionBinder",eo),mr("ProgramConfiguration",no,{omit:["_buffers"]}),mr("ProgramConfigurationSet",io);const co="-transition";class ho extends bn{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==t.type&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&"sky"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new Ri(e.layout)),e.paint)){this._transitionablePaint=new ji(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ui(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(An,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return z(t,co)?this._transitionablePaint.getTransition(t.slice(0,-co.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(_n,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(z(t,co))return this._transitionablePaint.setTransition(t.slice(0,-co.length),e||void 0),!1;{const r=this._transitionablePaint._values[t],n="cross-faded-data-driven"===r.property.specification["property-type"],i=r.value.isDataDriven(),s=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const o=this._transitionablePaint._values[t].value;return o.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,s,o)}}_handleSpecialPaintPropertyUpdate(t){}getProgramIds(){return null}getProgramConfiguration(t){return null}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),function(t,e,r){const n={};for(const r in t)e.call(this,t[r],r,t)&&(n[r]=t[r]);return n}(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,r,n,i={}){return(!i||!1!==i.validate)&&function(t,e){let r=!1;if(e&&e.length)for(const n of e)t.fire(new vn(new Error(n.message))),r=!0;return r}(this,t.call(wn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:Ir,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof qi&&Ge(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=$r(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const po=ts([{name:"a_pos",components:2,type:"Int16"}],4),{members:fo}=po;class yo{constructor(t=[]){this.segments=t}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>yo.MAX_VERTEX_ARRAY_LENGTH&&T(`Max vertices per segment is ${yo.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>yo.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,n){return new yo([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}yo.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,mr("SegmentVector",yo);var mo=8192;class go{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof vo?new vo(t.lng,t.lat):vo.convert(t),this}setSouthWest(t){return this._sw=t instanceof vo?new vo(t.lng,t.lat):vo.convert(t),this}extend(t){const e=this._sw,r=this._ne;let n,i;if(t instanceof vo)n=t,i=t;else{if(!(t instanceof go))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(go.convert(t)):this.extend(vo.convert(t)):this;if(n=t._sw,i=t._ne,!n||!i)return this}return e||r?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),r.lng=Math.max(i.lng,r.lng),r.lat=Math.max(i.lat,r.lat)):(this._sw=new vo(n.lng,n.lat),this._ne=new vo(i.lng,i.lat)),this}getCenter(){return new vo((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 vo(this.getWest(),this.getNorth())}getSouthEast(){return new vo(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(t){const{lng:e,lat:r}=vo.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){return!t||t instanceof go?t:new go(t)}}const xo=6371008.8;class vo{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new vo(w(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return xo*Math.acos(Math.min(i,1))}toBounds(t=0){const e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new go(new vo(this.lng-r,this.lat-e),new vo(this.lng+r,this.lat+e))}static convert(t){if(t instanceof vo)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new vo(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new vo(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const bo=2*Math.PI*xo;function wo(t,e){return t/(bo*Math.cos(e*Math.PI/180))}function _o(t){return 360*t-180}function Ao(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}const So=85.051129;function ko(t,e,n,i,s,o,a,l,u){const c=(e+i)/2,h=(n+s)/2,p=new r(c,h);l(p),function(t,e,r,n,i,s){const o=r-i,a=n-s;return Math.abs((n-e)*o-(r-t)*a)/Math.hypot(o,a)}(p.x,p.y,o.x,o.y,a.x,a.y)>=u?(ko(t,e,n,c,h,o,p,l,u),ko(t,c,h,i,s,p,a,l,u)):t.push(a)}function Io(t,e,r){const n=[];let i,s,o;for(const a of t){const{x:t,y:l}=a;e(a),o?ko(n,i,s,t,l,o,a,e,r):n.push(a),i=t,s=l,o=a}return n}const zo=Math.pow(2,14)-1,Mo=-zo-1;function Po(t,e){const r=Math.round(t.x*e),n=Math.round(t.y*e);return t.x=b(r,Mo,zo),t.y=b(n,Mo,zo),(r<t.x||r>t.x+1||n<t.y||n>t.y+1)&&T("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function Co(t,e,r){const n=t.loadGeometry(),i=t.extent,s=mo/i;if(e&&r&&r.projection.isReprojectedInTileSpace){const s=1<<e.z,{scale:o,x:a,y:l,projection:u}=r,c=t=>{const r=_o((e.x+t.x/i)/s),n=Ao((e.y+t.y/i)/s),c=u.project(r,n);t.x=(c.x*o-a)*i,t.y=(c.y*o-l)*i};for(let e=0;e<n.length;e++)if(1!==t.type)n[e]=Io(n[e],c,1);else{const t=[];for(const r of n[e])r.x<0||r.x>=i||r.y<0||r.y>=i||(c(r),t.push(r));n[e]=t}}for(const t of n)for(const e of t)Po(e,s);return n}function To(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Co(t):[]}}function Bo(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}class Vo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new rs,this.indexArray=new ds,this.segments=new yo,this.programConfigurations=new io(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r,n){const i=this.layers[0],s=[];let o=null;"circle"===i.type&&(o=i.layout.get("circle-sort-key"));for(const{feature:e,id:i,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=To(e,t);if(!this.layers[0]._featureFilter.filter(new Di(this.zoom),u,r))continue;const c=o?o.evaluate(u,{},r):void 0,h={id:i,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?u.geometry:Co(e,r,n),patterns:{},sortKey:c};s.push(h)}o&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:o}=n,a=t[s].feature;this.addFeature(n,i,s,e.availableImages,r),e.featureIndex.insert(a,i,s,o,this.index)}}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,n,i){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=mo||n<0||n>=mo)continue;const i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),s=i.vertexLength;Bo(this.layoutVertexArray,r,n,-1,-1),Bo(this.layoutVertexArray,r,n,1,-1),Bo(this.layoutVertexArray,r,n,1,1),Bo(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+3,s+2),i.vertexLength+=4,i.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n,i)}}function Eo(t,e){for(let r=0;r<t.length;r++)if(Uo(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Uo(t,e[r]))return!0;return!!jo(t,e)}function Do(t,e,r){return!!Uo(t,e)||!!Oo(e,t,r)}function Fo(t,e){if(1===t.length)return qo(e,t[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++)if(Uo(t,n[e]))return!0}for(let r=0;r<t.length;r++)if(qo(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(jo(t,e[r]))return!0;return!1}function Lo(t,e,r){if(t.length>1){if(jo(t,e))return!0;for(let n=0;n<e.length;n++)if(Oo(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(Oo(t[n],e,r))return!0;return!1}function jo(t,e){if(0===t.length||0===e.length)return!1;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)if($o(n,i,e[t],e[t+1]))return!0}return!1}function $o(t,e,r,n){return B(t,r,n)!==B(e,r,n)&&B(t,e,r)!==B(t,e,n)}function Oo(t,e,r){const n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(let r=1;r<e.length;r++)if(Ro(t,e[r-1],e[r])<n)return!0;return!1}function Ro(t,e,r){const n=e.distSqr(r);if(0===n)return t.distSqr(e);const i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return t.distSqr(i<0?e:i>1?r:r.sub(e)._mult(i)._add(e))}function qo(t,e){let r,n,i,s=!1;for(let o=0;o<t.length;o++){r=t[o];for(let t=0,o=r.length-1;t<r.length;o=t++)n=r[t],i=r[o],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s)}return s}function Uo(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const s=t[n],o=t[i];s.y>e.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(r=!r)}return r}function No(t,e,r){const n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;const s=B(t,e,r[0]);return s!==B(t,e,r[1])||s!==B(t,e,r[2])||s!==B(t,e,r[3])}function Zo(t,e,r){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Xo(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Go(t,e,n,i,s){if(!e[0]&&!e[1])return t;const o=r.convert(e)._mult(s);"viewport"===n&&o._rotate(-i);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(o));return a}function Yo(t,e,n,i){const s=r.convert(t)._mult(i);return"viewport"===e&&s._rotate(-n),s}mr("CircleBucket",Vo,{omit:["layers"]});const Ko=new Ki({"circle-sort-key":new Zi(Ir.layout_circle["circle-sort-key"])});var Jo={paint:new Ki({"circle-radius":new Zi(Ir.paint_circle["circle-radius"]),"circle-color":new Zi(Ir.paint_circle["circle-color"]),"circle-blur":new Zi(Ir.paint_circle["circle-blur"]),"circle-opacity":new Zi(Ir.paint_circle["circle-opacity"]),"circle-translate":new Ni(Ir.paint_circle["circle-translate"]),"circle-translate-anchor":new Ni(Ir.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ni(Ir.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ni(Ir.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Zi(Ir.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Zi(Ir.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Zi(Ir.paint_circle["circle-stroke-opacity"])}),layout:Ko};class Ho{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,r){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],r=c(this.min),n=c(this.max);for(let t=0;t<e.length;t++)r[t]=e[t]?this.min[t]:this.center[t],n[t]=e[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new Ho(r,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}distanceZ(t){return Math.max(Math.min(this.max[2],t[2]),this.min[2])-t[2]}getCorners(){const t=this.min,e=this.max;return[[t[0],t[1],t[2]],[e[0],t[1],t[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],e[2]],[t[0],e[1],e[2]]]}intersects(t){const e=this.getCorners();let r=!0;for(let s=0;s<t.planes.length;s++){const o=t.planes[s];let a=0;for(let t=0;t<e.length;t++)a+=(n=o)[0]*(i=e[t])[0]+n[1]*i[1]+n[2]*i[2]+o[3]>=0;if(0===a)return 0;a!==e.length&&(r=!1)}var n,i;if(r)return 2;for(let e=0;e<3;e++){let r=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let i=0;i<t.points.length;i++){const s=t.points[i][e]-this.min[e];r=Math.min(r,s),n=Math.max(n,s)}if(n<0||r>this.max[e]-this.min[e])return 0}return 1}}function Wo(t,e,r,n,i,s,o,a,l){if(s&&t.queryGeometry.isAboveHorizon)return!1;s&&(l*=t.pixelToTileUnitsFactor);for(const u of e)for(const e of u){const u=e.add(a),c=i&&r.elevation?r.elevation.exaggeration()*i.getElevationAt(u.x,u.y,!0):0,h=s?u:Qo(u,c,n),p=s?t.tilespaceRays.map((t=>ra(t,c))):t.queryGeometry.screenGeometry,d=f([],[e.x,e.y,c,1],n);if(!o&&s?l*=d[3]/r.cameraToCenterDistance:o&&!s&&(l*=r.cameraToCenterDistance/d[3]),Do(p,h,l))return!0}return!1}function Qo(t,e,n){const i=f([],[t.x,t.y,e,1],n);return new r(i[0]/i[3],i[1]/i[3])}const ta=h(0,0,0),ea=h(0,0,1);function ra(t,e){const n=u();return ta[2]=e,t.intersectsPlane(ta,ea,n),new r(n[0],n[1])}class na extends Vo{}function ia(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError("mismatched image size")}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function sa(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;const i=ia({},{width:e,height:r},n);oa(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function oa(t,e,r,n,i,s){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=e.data;for(let l=0;l<i.height;l++){const u=((r.y+l)*t.width+r.x)*s,c=((n.y+l)*e.width+n.x)*s;for(let t=0;t<i.width*s;t++)a[c+t]=o[u+t]}return e}mr("HeatmapBucket",na,{omit:["layers"]});class aa{constructor(t,e){ia(this,t,1,e)}resize(t){sa(this,t,1)}clone(){return new aa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){oa(t,e,r,n,i,1)}}class la{constructor(t,e){ia(this,t,4,e)}resize(t){sa(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new la({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){oa(t,e,r,n,i,4)}}mr("AlphaImage",aa),mr("RGBAImage",la);var ua={paint:new Ki({"heatmap-radius":new Zi(Ir.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Zi(Ir.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ni(Ir.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yi(Ir.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ni(Ir.paint_heatmap["heatmap-opacity"])})};function ca(t){const e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new la({width:r,height:n}),s=(r,n,s)=>{e[t.evaluationKey]=s;const o=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*o.r/o.a),i.data[r+n+1]=Math.floor(255*o.g/o.a),i.data[r+n+2]=Math.floor(255*o.b/o.a),i.data[r+n+3]=Math.floor(255*o.a)};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,o=0;n<r;n++,o+=4){const a=n/(r-1),{start:l,end:u}=t.clips[e];s(i,o,l*(1-a)+u*a)}else for(let t=0,e=0;t<r;t++,e+=4)s(0,e,t/(r-1));return i}var ha={paint:new Ki({"hillshade-illumination-direction":new Ni(Ir.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ni(Ir.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ni(Ir.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ni(Ir.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ni(Ir.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ni(Ir.paint_hillshade["hillshade-accent-color"])})};const pa=ts([{name:"a_pos",components:2,type:"Int16"}],4),{members:fa}=pa;var da=ma,ya=ma;function ma(t,e,r){r=r||2;var n,i,s,o,a,l,u,c=e&&e.length,h=c?e[0]*r:t.length,p=ga(t,0,h,r,!0),f=[];if(!p||p.next===p.prev)return f;if(c&&(p=function(t,e,r,n){var i,s,o,a=[];for(i=0,s=e.length;i<s;i++)(o=ga(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1))===o.next&&(o.steiner=!0),a.push(Ma(o));for(a.sort(Sa),i=0;i<a.length;i++)r=xa(r=ka(a[i],r),r.next);return r}(t,e,p,r)),t.length>80*r){n=s=t[0],i=o=t[1];for(var d=r;d<h;d+=r)(a=t[d])<n&&(n=a),(l=t[d+1])<i&&(i=l),a>s&&(s=a),l>o&&(o=l);u=0!==(u=Math.max(s-n,o-i))?1/u:0}return va(p,f,r,n,i,u),f}function ga(t,e,r,n,i){var s,o;if(i===Ra(t,e,r,n)>0)for(s=e;s<r;s+=n)o=ja(s,t[s],t[s+1],o);else for(s=r-n;s>=e;s-=n)o=ja(s,t[s],t[s+1],o);return o&&Ba(o,o.next)&&($a(o),o=o.next),o}function xa(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Ba(n,n.next)&&0!==Ta(n.prev,n,n.next))n=n.next;else{if($a(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function va(t,e,r,n,i,s,o){if(t){!o&&s&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=za(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,s,o,a,l,u=1;do{for(r=t,t=null,s=null,o=0;r;){for(o++,n=r,a=0,e=0;e<u&&(a++,n=n.nextZ);e++);for(l=u;a>0||l>0&&n;)0!==a&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=n}s.nextZ=null,u*=2}while(o>1)}(i)}(t,n,i,s);for(var a,l,u=t;t.prev!==t.next;)if(a=t.prev,l=t.next,s?wa(t,n,i,s):ba(t))e.push(a.i/r),e.push(t.i/r),e.push(l.i/r),$a(t),t=l.next,u=l.next;else if((t=l)===u){o?1===o?va(t=_a(xa(t),e,r),e,r,n,i,s,2):2===o&&Aa(t,e,r,n,i,s):va(xa(t),e,r,n,i,s,1);break}}}function ba(t){var e=t.prev,r=t,n=t.next;if(Ta(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Pa(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Ta(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function wa(t,e,r,n){var i=t.prev,s=t,o=t.next;if(Ta(i,s,o)>=0)return!1;for(var a=i.x>s.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,l=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,u=za(i.x<s.x?i.x<o.x?i.x:o.x:s.x<o.x?s.x:o.x,i.y<s.y?i.y<o.y?i.y:o.y:s.y<o.y?s.y:o.y,e,r,n),c=za(a,l,e,r,n),h=t.prevZ,p=t.nextZ;h&&h.z>=u&&p&&p.z<=c;){if(h!==t.prev&&h!==t.next&&Pa(i.x,i.y,s.x,s.y,o.x,o.y,h.x,h.y)&&Ta(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,p!==t.prev&&p!==t.next&&Pa(i.x,i.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Ta(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;h&&h.z>=u;){if(h!==t.prev&&h!==t.next&&Pa(i.x,i.y,s.x,s.y,o.x,o.y,h.x,h.y)&&Ta(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;p&&p.z<=c;){if(p!==t.prev&&p!==t.next&&Pa(i.x,i.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Ta(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function _a(t,e,r){var n=t;do{var i=n.prev,s=n.next.next;!Ba(i,s)&&Va(i,n,n.next,s)&&Fa(i,s)&&Fa(s,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(s.i/r),$a(n),$a(n.next),n=t=s),n=n.next}while(n!==t);return xa(n)}function Aa(t,e,r,n,i,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Ca(o,a)){var l=La(o,a);return o=xa(o,o.next),l=xa(l,l.next),va(o,e,r,n,i,s),void va(l,e,r,n,i,s)}a=a.next}o=o.next}while(o!==t)}function Sa(t,e){return t.x-e.x}function ka(t,e){var r=function(t,e){var r,n=e,i=t.x,s=t.y,o=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var a=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>o){if(o=a,a===i){if(s===n.y)return n;if(s===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===o)return r;var l,u=r,c=r.x,h=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&Pa(s<h?i:o,s,c,h,s<h?o:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),Fa(n,t)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&Ia(r,n)))&&(r=n,p=l)),n=n.next}while(n!==u);return r}(t,e);if(!r)return e;var n=La(r,t),i=xa(r,r.next);return xa(n,n.next),e===r?i:e}function Ia(t,e){return Ta(t.prev,t,e.prev)<0&&Ta(e.next,t,t.next)<0}function za(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ma(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function Pa(t,e,r,n,i,s,o,a){return(i-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(n-a)-(r-o)*(e-a)>=0&&(r-o)*(s-a)-(i-o)*(n-a)>=0}function Ca(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Va(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Fa(t,e)&&Fa(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Ta(t.prev,t,e.prev)||Ta(t,e.prev,e))||Ba(t,e)&&Ta(t.prev,t,t.next)>0&&Ta(e.prev,e,e.next)>0)}function Ta(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Ba(t,e){return t.x===e.x&&t.y===e.y}function Va(t,e,r,n){var i=Da(Ta(t,e,r)),s=Da(Ta(t,e,n)),o=Da(Ta(r,n,t)),a=Da(Ta(r,n,e));return i!==s&&o!==a||!(0!==i||!Ea(t,r,e))||!(0!==s||!Ea(t,n,e))||!(0!==o||!Ea(r,t,n))||!(0!==a||!Ea(r,e,n))}function Ea(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Da(t){return t>0?1:t<0?-1:0}function Fa(t,e){return Ta(t.prev,t,t.next)<0?Ta(t,e,t.next)>=0&&Ta(t,t.prev,e)>=0:Ta(t,e,t.prev)<0||Ta(t,t.next,e)<0}function La(t,e){var r=new Oa(t.i,t.x,t.y),n=new Oa(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function ja(t,e,r,n){var i=new Oa(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function $a(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Oa(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ra(t,e,r,n){for(var i=0,s=e,o=r-n;s<r;s+=n)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}function qa(t,e,r,n,i){Ua(t,e,r||0,n||t.length-1,i||Za)}function Ua(t,e,r,n,i){for(;n>r;){if(n-r>600){var s=n-r+1,o=e-r+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);Ua(t,e,Math.max(r,Math.floor(e-o*l/s+u)),Math.min(n,Math.floor(e+(s-o)*l/s+u)),i)}var c=t[e],h=r,p=n;for(Na(t,r,e),i(t[n],c)>0&&Na(t,r,n);h<p;){for(Na(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--}0===i(t[r],c)?Na(t,r,p):Na(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1)}}function Na(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Za(t,e){return t<e?-1:t>e?1:0}function Xa(t,e){const r=t.length;if(r<=1)return[t];const n=[];let i,s;for(let e=0;e<r;e++){const r=V(t[e]);0!==r&&(t[e].area=Math.abs(r),void 0===s&&(s=r<0),s===r<0?(i&&n.push(i),i=[t[e]]):i.push(t[e]))}if(i&&n.push(i),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(qa(n[t],e,1,n[t].length-1,Ga),n[t]=n[t].slice(0,e));return n}function Ga(t,e){return e.area-t.area}function Ya(t,e,r){const n=r.patternDependencies;let i=!1;for(const r of e){const e=r.paint.get(`${t}-pattern`);e.isConstant()||(i=!0);const s=e.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Ka(t,e,r,n,i){const s=i.patternDependencies;for(const o of e){const e=o.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},r,{},i.availableImages),a=e.evaluate({zoom:n},r,{},i.availableImages),l=e.evaluate({zoom:n+1},r,{},i.availableImages);t=t&&t.name?t.name:t,a=a&&a.name?a.name:a,l=l&&l.name?l.name:l,s[t]=!0,s[a]=!0,s[l]=!0,r.patterns[o.id]={min:t,mid:a,max:l}}}return r}ma.deviation=function(t,e,r,n){var i=e&&e.length,s=Math.abs(Ra(t,0,i?e[0]*r:t.length,r));if(i)for(var o=0,a=e.length;o<a;o++)s-=Math.abs(Ra(t,e[o]*r,o<a-1?e[o+1]*r:t.length,r));var l=0;for(o=0;o<n.length;o+=3){var u=n[o]*r,c=n[o+1]*r,h=n[o+2]*r;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},ma.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var o=0;o<e;o++)r.vertices.push(t[i][s][o]);i>0&&r.holes.push(n+=t[i-1].length)}return r},da.default=ya;class Ja{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new rs,this.indexArray=new ds,this.indexArray2=new ws,this.programConfigurations=new io(t.layers,t.zoom),this.segments=new yo,this.segments2=new yo,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r,n){this.hasPattern=Ya("fill",this.layers,e);const i=this.layers[0].layout.get("fill-sort-key"),s=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=To(o,t);if(!this.layers[0]._featureFilter.filter(new Di(this.zoom),c,r))continue;const h=i?i.evaluate(c,{},r,e.availableImages):void 0,p={id:a,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Co(o,r,n),patterns:{},sortKey:h};s.push(p)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:o}=n;if(this.hasPattern){const t=Ka("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{},e.availableImages);e.featureIndex.insert(t[s].feature,i,s,o,this.index)}}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}addFeatures(t,e,r,n){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fa),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,n,i,s=[]){for(const t of Xa(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),i.push(e[t].x),i.push(e[t].y);r.vertexLength+=e.length,r.primitiveLength+=e.length}const o=da(i,s);for(let t=0;t<o.length;t+=3)this.indexArray.emplaceBack(n+o[t],n+o[t+1],n+o[t+2]);r.vertexLength+=e,r.primitiveLength+=o.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n)}}mr("FillBucket",Ja,{omit:["layers","patternFeatures"]});const Ha=new Ki({"fill-sort-key":new Zi(Ir.layout_fill["fill-sort-key"])});var Wa={paint:new Ki({"fill-antialias":new Ni(Ir.paint_fill["fill-antialias"]),"fill-opacity":new Zi(Ir.paint_fill["fill-opacity"]),"fill-color":new Zi(Ir.paint_fill["fill-color"]),"fill-outline-color":new Zi(Ir.paint_fill["fill-outline-color"]),"fill-translate":new Ni(Ir.paint_fill["fill-translate"]),"fill-translate-anchor":new Ni(Ir.paint_fill["fill-translate-anchor"]),"fill-pattern":new Xi(Ir.paint_fill["fill-pattern"])}),layout:Ha};const Qa=ts([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),tl=ts([{name:"a_centroid_pos",components:2,type:"Uint16"}]),{members:el}=Qa;var rl=nl;function nl(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(il,this,e)}function il(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function sl(t){for(var e,r,n=0,i=0,s=t.length,o=s-1;i<s;o=i++)n+=((r=t[o]).x-(e=t[i]).x)*(e.y+r.y);return n}nl.types=["Unknown","Point","LineString","Polygon"],nl.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,i=1,s=0,o=0,a=0,l=[];t.pos<n;){if(s<=0){var u=t.readVarint();i=7&u,s=u>>3}if(s--,1===i||2===i)o+=t.readSVarint(),a+=t.readSVarint(),1===i&&(e&&l.push(e),e=[]),e.push(new r(o,a));else{if(7!==i)throw new Error("unknown command "+i);e&&e.push(e[0].clone())}}return e&&l.push(e),l},nl.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<o&&(o=i),i>a&&(a=i),(s+=t.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,a,u]},nl.prototype.toGeoJSON=function(t,e,r){var n,i,s=this.extent*Math.pow(2,r),o=this.extent*t,a=this.extent*e,l=this.loadGeometry(),u=nl.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+o)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+a)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],s=0;s<e;s++){var o=sl(t[s]);0!==o&&(void 0===n&&(n=o<0),n===o<0?(r&&i.push(r),r=[t[s]]):r.push(t[s]))}return r&&i.push(r),i}(l),n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)c(l[n][i])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var ol=al;function al(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ll,this,e),this.length=this._features.length}function ll(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function ul(t,e,r){if(3===t){var n=new ol(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}al.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new rl(this._pbf,e,this.extent,this._keys,this._values)};var cl={VectorTile:function(t,e){this.layers=t.readFields(ul,{},e)},VectorTileFeature:rl,VectorTileLayer:ol};const hl=cl.VectorTileFeature.types,pl=Math.pow(2,13);function fl(t,e,r,n,i,s,o,a){t.emplaceBack((e<<1)+o,(r<<1)+s,(Math.floor(n*pl)<<1)+i,Math.round(a))}class dl{constructor(){this.acc=new r(0,0),this.polyCount=[]}startRing(t){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new r(t.x,t.y),this.max=new r(t.x,t.y))}append(t,e){this.currentPolyCount.edges++,this.acc._add(t);let r=!!this.borders;const n=this.min,i=this.max;t.x<n.x?(n.x=t.x,r=!0):t.x>i.x&&(i.x=t.x,r=!0),t.y<n.y?(n.y=t.y,r=!0):t.y>i.y&&(i.y=t.y,r=!0),((0===t.x||t.x===mo)&&t.x===e.x)!=((0===t.y||t.y===mo)&&t.y===e.y)&&this.processBorderOverlap(t,e),r&&this.checkBorderIntersection(t,e)}checkBorderIntersection(t,e){e.x<0!=t.x<0&&this.addBorderIntersection(0,te(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>mo!=t.x>mo&&this.addBorderIntersection(1,te(e.y,t.y,(mo-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,te(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>mo!=t.y>mo&&this.addBorderIntersection(3,te(e.x,t.x,(mo-e.y)/(t.y-e.y)))}addBorderIntersection(t,e){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const r=this.borders[t];e<r[0]&&(r[0]=e),e>r[1]&&(r[1]=e)}processBorderOverlap(t,e){if(t.x===e.x){if(t.y===e.y)return;const r=0===t.x?0:1;this.addBorderIntersection(r,e.y),this.addBorderIntersection(r,t.y)}else{const r=0===t.y?2:3;this.addBorderIntersection(r,e.x),this.addBorderIntersection(r,t.x)}}centroid(){const t=this.polyCount.reduce(((t,e)=>t+e.edges),0);return 0!==t?this.acc.div(t)._round():new r(0,0)}span(){return new r(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce(((t,e)=>t+ +(e[0]!==Number.MAX_VALUE)),0)}}class yl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ns,this.centroidVertexArray=new Fs,this.indexArray=new ds,this.programConfigurations=new io(t.layers,t.zoom),this.segments=new yo,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.enableTerrain=t.enableTerrain}populate(t,e,r,n){this.features=[],this.hasPattern=Ya("fill-extrusion",this.layers,e),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(t){const e=Math.exp(Math.PI*(1-t.y/(1<<t.z)*2));return 80150034*e/(e*e+1)/mo/(1<<t.z)}(r);for(const{feature:i,id:s,index:o,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,l=To(i,t);if(!this.layers[0]._featureFilter.filter(new Di(this.zoom),l,r))continue;const u={id:s,sourceLayerIndex:a,index:o,geometry:t?l.geometry:Co(i,r,n),properties:i.properties,type:i.type,patterns:{}},c=this.layoutVertexArray.length;this.hasPattern?this.features.push(Ka("fill-extrusion",this.layers,u,this.zoom,e)):this.addFeature(u,u.geometry,o,r,{},e.availableImages),e.featureIndex.insert(i,u.geometry,o,a,this.index,c)}this.sortBorders()}addFeatures(t,e,r,n){for(const t of this.features){const{geometry:i}=t;this.addFeature(t,i,t.index,e,r,n)}this.sortBorders()}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,el),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}uploadCentroid(t){0!==this.centroidVertexArray.length&&(this.centroidVertexBuffer?this.needsCentroidUpdate&&this.centroidVertexBuffer.updateData(this.centroidVertexArray):this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,tl.members,!0),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,n,i,s){const o=this.enableTerrain?new dl:null;for(const r of Xa(e,500)){let e=0,n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);if(0===r.length||(a=r[0]).every((t=>t.x<=0))||a.every((t=>t.x>=mo))||a.every((t=>t.y<=0))||a.every((t=>t.y>=mo)))continue;for(let t=0;t<r.length;t++){const i=r[t];if(0===i.length)continue;e+=i.length;let s=0;o&&o.startRing(i[0]);for(let t=0;t<i.length;t++){const e=i[t];if(t>=1){const r=i[t-1];if(!ml(e,r)){o&&o.append(e,r),n.vertexLength+4>yo.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=e.sub(r)._perp(),i=t.x/(Math.abs(t.x)+Math.abs(t.y)),a=t.y>0?1:0,l=r.dist(e);s+l>32768&&(s=0),fl(this.layoutVertexArray,e.x,e.y,i,a,0,0,s),fl(this.layoutVertexArray,e.x,e.y,i,a,0,1,s),s+=l,fl(this.layoutVertexArray,r.x,r.y,i,a,0,0,s),fl(this.layoutVertexArray,r.x,r.y,i,a,0,1,s);const u=n.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),n.vertexLength+=4,n.primitiveLength+=2}}}}if(n.vertexLength+e>yo.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==hl[t.type])continue;const i=[],s=[],l=n.vertexLength;for(let t=0;t<r.length;t++){const e=r[t];if(0!==e.length){e!==r[0]&&s.push(i.length/2);for(let t=0;t<e.length;t++){const r=e[t];fl(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),i.push(r.x),i.push(r.y),o&&o.currentPolyCount.top++}}}const u=da(i,s);for(let t=0;t<u.length;t+=3)this.indexArray.emplaceBack(l+u[t],l+u[t+2],l+u[t+1]);n.primitiveLength+=u.length/3,n.vertexLength+=e}var a;if(o&&o.polyCount.length>0){if(o.borders){o.vertexArrayOffset=this.centroidVertexArray.length;const t=o.borders,e=this.featuresOnBorder.push(o)-1;for(let r=0;r<4;r++)t[r][0]!==Number.MAX_VALUE&&this.borders[r].push(e)}this.encodeCentroid(o.borders?void 0:o.centroid(),o)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n)}sortBorders(){for(let t=0;t<4;t++)this.borders[t].sort(((e,r)=>this.featuresOnBorder[e].borders[t][0]-this.featuresOnBorder[r].borders[t][0]))}encodeCentroid(t,e,r=!0){let n,i;if(t)if(0!==t.y){const r=e.span()._mult(this.tileToMeter);n=(Math.max(t.x,1)<<3)+Math.min(7,Math.round(r.x/10)),i=(Math.max(t.y,1)<<3)+Math.min(7,Math.round(r.y/10))}else n=Math.ceil(7*(t.x+450)),i=0;else n=0,i=+r;let s=r?this.centroidVertexArray.length:e.vertexArrayOffset;for(const t of e.polyCount){r&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*t.edges+t.top);for(let e=0;e<2*t.edges;e++)this.centroidVertexArray.emplace(s++,0,i),this.centroidVertexArray.emplace(s++,n,i);for(let e=0;e<t.top;e++)this.centroidVertexArray.emplace(s++,n,i)}}}function ml(t,e){return t.x===e.x&&(t.x<0||t.x>mo)||t.y===e.y&&(t.y<0||t.y>mo)}mr("FillExtrusionBucket",yl,{omit:["layers","features"]}),mr("PartMetadata",dl);var gl={paint:new Ki({"fill-extrusion-opacity":new Ni(Ir["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Zi(Ir["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ni(Ir["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ni(Ir["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Xi(Ir["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Zi(Ir["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Zi(Ir["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ni(Ir["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function xl(t,e){return t.x*e.x+t.y*e.y}function vl(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){const s=e[r],o=t[0],a=i.sub(n),l=s.sub(n),u=o.sub(n),c=xl(a,a),h=xl(a,l),p=xl(l,l),f=xl(u,a),d=xl(u,l),y=c*p-h*h,m=(p*f-h*d)/y,g=(c*d-h*f)/y,x=n.z*(1-m-g)+i.z*m+s.z*g;if(isFinite(x))return x}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}function bl(t){const e=new r(t[0],t[1]);return e.z=t[2],e}function wl(t,e,r,n,i,s,o,a){const l=o*i.getElevationAt(t,e,!0,!0),u=0!==s[0],c=u?0===s[1]?o*(s[0]/7-450):o*function(t,e,r){const n=Math.floor(e[0]/8),i=Math.floor(e[1]/8),s=10*(e[0]-8*n),o=10*(e[1]-8*i),a=t.getElevationAt(n,i,!0,!0),l=t.getMeterToDEM(r),u=Math.floor(.5*(s*l-1)),c=Math.floor(.5*(o*l-1)),h=t.tileCoordToPixel(n,i),p=2*u+1,f=2*c+1,d=function(t,e,r,n,i){return[t.getElevationAtPixel(e,r,!0),t.getElevationAtPixel(e+i,r,!0),t.getElevationAtPixel(e,r+i,!0),t.getElevationAtPixel(e+n,r+i,!0)]}(t,h.x-u,h.y-c,p,f),y=Math.abs(d[0]-d[1]),m=Math.abs(d[2]-d[3]),g=Math.abs(d[0]-d[2])+Math.abs(d[1]-d[3]),x=Math.min(.25,.5*l*(y+m)/p),v=Math.min(.25,.5*l*g/f);return a+Math.max(x*s,v*o)}(i,s,a):l;return{base:l+(0===r)?-1:r,top:u?Math.max(c+n,l+r+2):l+n}}const _l=ts([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:Al}=_l,Sl=ts([{name:"a_packed",components:3,type:"Float32"}]),{members:kl}=Sl,Il=cl.VectorTileFeature.types,zl=Math.cos(Math.PI/180*37.5);class Ml{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new is,this.layoutVertexArray2=new ss,this.indexArray=new ds,this.programConfigurations=new io(t.layers,t.zoom),this.segments=new yo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r,n){this.hasPattern=Ya("line",this.layers,e);const i=this.layers[0].layout.get("line-sort-key"),s=[];for(const{feature:e,id:o,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=To(e,t);if(!this.layers[0]._featureFilter.filter(new Di(this.zoom),u,r))continue;const c=i?i.evaluate(u,{},r):void 0,h={id:o,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?u.geometry:Co(e,r,n),patterns:{},sortKey:c};s.push(h)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));const{lineAtlas:o,featureIndex:a}=e,l=this.addConstantDashes(o);for(const n of s){const{geometry:i,index:s,sourceLayerIndex:u}=n;if(l&&this.addFeatureDashes(n,o),this.hasPattern){const t=Ka("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,o.positions,e.availableImages);a.insert(t[s].feature,i,s,u,this.index)}}addConstantDashes(t){let e=!1;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,i=r.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==i.kind)e=!0;else{const e=i.value,r=n.value;if(!r)continue;t.addDash(r.from,e),t.addDash(r.to,e),r.other&&t.addDash(r.other,e)}}return e}addFeatureDashes(t,e){const r=this.zoom;for(const n of this.layers){const i=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"===i.kind&&"constant"===s.kind)continue;let o,a,l,u,c,h;if("constant"===i.kind){const t=i.value;if(!t)continue;o=t.other||t.to,a=t.to,l=t.from}else o=i.evaluate({zoom:r-1},t),a=i.evaluate({zoom:r},t),l=i.evaluate({zoom:r+1},t);"constant"===s.kind?u=c=h=s.value:(u=s.evaluate({zoom:r-1},t),c=s.evaluate({zoom:r},t),h=s.evaluate({zoom:r+1},t)),e.addDash(o,u),e.addDash(a,c),e.addDash(l,h);const p=e.getKey(o,u),f=e.getKey(a,c),d=e.getKey(l,h);t.patterns[n.id]={min:p,mid:f,max:d}}}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}addFeatures(t,e,r,n){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,kl)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Al),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&t.properties.hasOwnProperty("mapbox_clip_start")&&t.properties.hasOwnProperty("mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,n,i,s){const o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),l=o.get("line-cap").evaluate(t,{}),u=o.get("line-miter-limit"),c=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,a,l,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n)}addLine(t,e,r,n,i,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const o="Polygon"===Il[e.type];let a=t.length;for(;a>=2&&t[a-1].equals(t[a-2]);)a--;let l=0;for(;l<a-1&&t[l].equals(t[l+1]);)l++;if(a<(o?3:2))return;"bevel"===r&&(i=1.05);const u=this.overscaling<=16?122880/(512*this.overscaling):0,c=this.segments.prepareSegment(10*a,this.layoutVertexArray,this.indexArray);let h,p,f,d,y;this.e1=this.e2=-1,o&&(h=t[a-2],y=t[l].sub(h)._unit()._perp());for(let e=l;e<a;e++){if(f=e===a-1?o?t[l+1]:void 0:t[e+1],f&&t[e].equals(f))continue;y&&(d=y),h&&(p=h),h=t[e],y=f?f.sub(h)._unit()._perp():d,d=d||y;let m=d.add(y);0===m.x&&0===m.y||m._unit();const g=d.x*y.x+d.y*y.y,x=m.x*y.x+m.y*y.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<zl&&p&&f,_=d.x*y.y-d.y*y.x>0;if(w&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,d,0,0,c),p=e}}const A=p&&f;let S=A?r:o?"butt":n;if(A&&"round"===S&&(v<s?S="miter":v<=2&&(S="fakeround")),"miter"===S&&v>i&&(S="bevel"),"bevel"===S&&(v>2&&(S="flipbevel"),v<i&&(S="miter")),p&&this.updateDistance(p,h),"miter"===S)m._mult(v),this.addCurrentVertex(h,m,0,0,c);else if("flipbevel"===S){if(v>100)m=y.mult(-1);else{const t=v*d.add(y).mag()/d.sub(y).mag();m._perp()._mult(t*(_?-1:1))}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c)}else if("bevel"===S||"fakeround"===S){const t=-Math.sqrt(v*v-1),e=_?t:0,r=_?0:t;if(p&&this.addCurrentVertex(h,d,e,r,c),"fakeround"===S){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const n=y.sub(d)._mult(r)._add(d)._unit()._mult(_?-1:1);this.addHalfVertex(h,n.x,n.y,!1,_,0,c)}}f&&this.addCurrentVertex(h,y,-e,-r,c)}else if("butt"===S)this.addCurrentVertex(h,m,0,0,c);else if("square"===S){const t=p?1:-1;p||this.addCurrentVertex(h,m,t,t,c),this.addCurrentVertex(h,m,0,0,c),p&&this.addCurrentVertex(h,m,t,t,c)}else"round"===S&&(p&&(this.addCurrentVertex(h,d,0,0,c),this.addCurrentVertex(h,d,1,1,c,!0)),f&&(this.addCurrentVertex(h,y,-1,-1,c,!0),this.addCurrentVertex(h,y,0,0,c)));if(w&&e<a-1){const t=h.dist(f);if(t>2*u){const e=h.add(f.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e}}}}addCurrentVertex(t,e,r,n,i,s=!1){const o=e.y*n-e.x,a=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,s,!1,r,i),this.addHalfVertex(t,o,a,s,!0,-n,i)}addHalfVertex({x:t,y:e},r,n,i,s,o,a){this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===o?0:o<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineSoFar);const l=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),a.primitiveLength++),s?this.e2=l:this.e1=l}updateScaledDistance(){if(this.lineClips){const t=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=t*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}mr("LineBucket",Ml,{omit:["layers","patternFeatures"]});const Pl=new Ki({"line-cap":new Zi(Ir.layout_line["line-cap"]),"line-join":new Zi(Ir.layout_line["line-join"]),"line-miter-limit":new Ni(Ir.layout_line["line-miter-limit"]),"line-round-limit":new Ni(Ir.layout_line["line-round-limit"]),"line-sort-key":new Zi(Ir.layout_line["line-sort-key"])});var Cl={paint:new Ki({"line-opacity":new Zi(Ir.paint_line["line-opacity"]),"line-color":new Zi(Ir.paint_line["line-color"]),"line-translate":new Ni(Ir.paint_line["line-translate"]),"line-translate-anchor":new Ni(Ir.paint_line["line-translate-anchor"]),"line-width":new Zi(Ir.paint_line["line-width"]),"line-gap-width":new Zi(Ir.paint_line["line-gap-width"]),"line-offset":new Zi(Ir.paint_line["line-offset"]),"line-blur":new Zi(Ir.paint_line["line-blur"]),"line-dasharray":new Xi(Ir.paint_line["line-dasharray"]),"line-pattern":new Xi(Ir.paint_line["line-pattern"]),"line-gradient":new Yi(Ir.paint_line["line-gradient"])}),layout:Pl};const Tl=new class extends Zi{possiblyEvaluate(t,e){return e=new Di(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,n){return e=A({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}(Cl.paint.properties["line-width"].specification);function Bl(t,e){return e>0?e+2*t:t}Tl.useIntegerZoom=!0;const Vl=ts([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_z_tile_anchor",components:4,type:"Int16"}],4),El=ts([{name:"a_projected_pos",components:3,type:"Float32"}],4);ts([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Dl=ts([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Fl=ts([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);ts([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ll=ts([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);ts([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),ts([{name:"triangle",components:3,type:"Uint16"}]),ts([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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"},{type:"Uint8",name:"flipState"}]),ts([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),ts([{type:"Float32",name:"offsetX"}]),ts([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var jl=24;const $l=128;function Ol(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Di(t+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=r;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let s=i;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const o=e[i],a=e[s];return"composite"===r.kind?{kind:"composite",minZoom:o,maxZoom:a,interpolationType:n}:{kind:"camera",minZoom:o,maxZoom:a,minSize:r.evaluate(new Di(o)),maxSize:r.evaluate(new Di(a)),interpolationType:n}}}function Rl(t,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:i}){return"source"===t.kind?n/$l:"composite"===t.kind?te(n/$l,i/$l,r):e}function ql(t,e){let r=0,n=0;if("constant"===t.kind)n=t.layoutSize;else if("source"!==t.kind){const{interpolationType:i,minZoom:s,maxZoom:o}=t,a=i?b(ve.interpolationFactor(i,e,s,o),0,1):0;"camera"===t.kind?n=te(t.minSize,t.maxSize,a):r=a}return{uSizeT:r,uSize:n}}function Ul(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Ei.applyArabicShaping&&(t=Ei.applyArabicShaping(t)),t}(t.text,e,r)})),t}const Nl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Zl(t){return"︶"===t||"﹈"===t||"︸"===t||"﹄"===t||"﹂"===t||"︾"===t||"︼"===t||"︺"===t||"︘"===t||"﹀"===t||"︐"===t||"︓"===t||"︔"===t||"`"===t||" ̄"===t||"︑"===t||"︒"===t}function Xl(t){return"︵"===t||"﹇"===t||"︷"===t||"﹃"===t||"﹁"===t||"︽"===t||"︻"===t||"︹"===t||"︗"===t||"︿"===t}var Gl=function(t,e,r,n,i){var s,o,a=8*i-n-1,l=(1<<a)-1,u=l>>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,s=f&(1<<-c)-1,f>>=-c,c+=a;c>0;s=256*s+t[e+h],h+=p,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=p,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=u}return(f?-1:1)*o*Math.pow(2,s-n)},Yl=function(t,e,r,n,i,s){var o,a,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(e*l-1)*Math.pow(2,i),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+f]=255&a,f+=d,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;t[r+f]=255&o,f+=d,o/=256,u-=8);t[r+f-d]|=128*y},Kl=Jl;function Jl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Jl.Varint=0,Jl.Fixed64=1,Jl.Bytes=2,Jl.Fixed32=5;var Hl=4294967296,Wl=1/Hl,Ql="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function tu(t){return t.type===Jl.Bytes?t.readVarint()+t.pos:t.pos+1}function eu(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function ru(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function nu(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function iu(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function su(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function ou(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function au(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function lu(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function uu(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function cu(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function hu(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function pu(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function fu(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function du(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function yu(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:i,h:s,fill:e/(i*s)||0}}Jl.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,s=this.pos;this.type=7&n,t(i,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=pu(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=du(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=pu(this.buf,this.pos)+pu(this.buf,this.pos+4)*Hl;return this.pos+=8,t},readSFixed64:function(){var t=pu(this.buf,this.pos)+du(this.buf,this.pos+4)*Hl;return this.pos+=8,t},readFloat:function(){var t=Gl(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Gl(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,s=r.buf;if(n=(112&(i=s[r.pos++]))>>4,i<128)return eu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<3,i<128)return eu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<10,i<128)return eu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<17,i<128)return eu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<24,i<128)return eu(t,n,e);if(n|=(1&(i=s[r.pos++]))<<31,i<128)return eu(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ql?function(t,e,r){return Ql.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i<r;){var s,o,a,l=t[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(o=t[i+2],128==(192&(s=t[i+1]))&&128==(192&o)&&((u=(15&l)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=t[i+2],a=t[i+3],128==(192&(s=t[i+1]))&&128==(192&o)&&128==(192&a)&&((u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Jl.Bytes)return t.push(this.readVarint(e));var r=tu(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Jl.Bytes)return t.push(this.readSVarint());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Jl.Bytes)return t.push(this.readBoolean());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Jl.Bytes)return t.push(this.readFloat());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Jl.Bytes)return t.push(this.readDouble());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Jl.Bytes)return t.push(this.readFixed32());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Jl.Bytes)return t.push(this.readSFixed32());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Jl.Bytes)return t.push(this.readFixed64());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Jl.Bytes)return t.push(this.readSFixed64());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Jl.Varint)for(;this.buf[this.pos++]>127;);else if(e===Jl.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Jl.Fixed32)this.pos+=4;else{if(e!==Jl.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),fu(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),fu(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),fu(this.buf,-1&t,this.pos),fu(this.buf,Math.floor(t*Wl),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),fu(this.buf,-1&t,this.pos),fu(this.buf,Math.floor(t*Wl),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,s=0;s<e.length;s++){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){n>56319||s+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&ru(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Yl(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Yl(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&ru(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Jl.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,nu,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,iu,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,au,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,su,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,ou,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,lu,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,uu,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,cu,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,hu,e)},writeBytesField:function(t,e){this.writeTag(t,Jl.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Jl.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Jl.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Jl.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Jl.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Jl.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Jl.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Jl.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Jl.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Jl.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class mu{constructor(t,{pixelRatio:e,version:r,stretchX:n,stretchY:i,content:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=i,this.content=s,this.version=r}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class gu{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:s,h:o}=yu(i),a=new la({width:s||1,height:o||1});for(const e in t){const n=t[e],i=r[e].paddedRect;la.copy(n.data,a,{x:0,y:0},{x:i.x+1,y:i.y+1},n.data)}for(const t in e){const r=e[t],i=n[t].paddedRect,s=i.x+1,o=i.y+1,l=r.data.width,u=r.data.height;la.copy(r.data,a,{x:0,y:0},{x:s,y:o},r.data),la.copy(r.data,a,{x:0,y:u-1},{x:s,y:o-1},{width:l,height:1}),la.copy(r.data,a,{x:0,y:0},{x:s,y:o+u},{width:l,height:1}),la.copy(r.data,a,{x:l-1,y:0},{x:s-1,y:o},{width:1,height:u}),la.copy(r.data,a,{x:0,y:0},{x:s+l,y:o},{width:1,height:u})}this.image=a,this.iconPositions=r,this.patternPositions=n}addImages(t,e,r){for(const n in t){const i=t[n],s={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(s),e[n]=new mu(s,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,i]=t.tl;r.update(e.data,void 0,{x:n,y:i})}}mr("ImagePosition",mu),mr("ImageAtlas",gu);const xu={horizontal:1,vertical:2,horizontalOnly:3};class vu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const r=new vu;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new vu;return e.imageName=t,e}}class bu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const r=new bu;for(let n=0;n<t.sections.length;n++){const i=t.sections[n];i.image?r.addImageSection(i):r.addTextSection(i,e)}return r}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSections(){return this.sections}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(t){this.text=function(t,e){let r="";for(let n=0;n<t.length;n++){const i=t.charCodeAt(n+1)||null,s=t.charCodeAt(n-1)||null;r+=!e&&(i&&ei(i)&&!Nl[t[n+1]]||s&&ei(s)&&!Nl[t[n-1]])||!Nl[t[n]]?t[n]:Nl[t[n]]}return r}(this.text,t)}trim(){let t=0;for(let e=0;e<this.text.length&&_u[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&_u[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const r=new bu;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(vu.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(r)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void T("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(vu.forImage(e)),this.sectionIndex.push(this.sections.length-1)):T("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function wu(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y){const m=bu.fromFeature(t,i);let g;h===xu.vertical&&m.verticalizePunctuation(p);const{processBidirectionalText:x,processStyledBidirectionalText:v}=Ei;if(x&&1===m.sections.length){g=[];const t=x(m.toString(),Pu(m,u,s,e,n,f,d));for(const e of t){const t=new bu;t.text=e,t.sections=m.sections;for(let r=0;r<e.length;r++)t.sectionIndex.push(0);g.push(t)}}else if(v){g=[];const t=v(m.text,m.sectionIndex,Pu(m,u,s,e,n,f,d));for(const e of t){const t=new bu;t.text=e[0],t.sectionIndex=e[1],t.sections=m.sections,g.push(t)}}else g=function(t,e){const r=[],n=t.text;let i=0;for(const n of e)r.push(t.substring(i,n)),i=n;return i<n.length&&r.push(t.substring(i,n.length)),r}(m,Pu(m,u,s,e,n,f,d));const b=[],w={positionedLines:b,text:m.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(t,e,r,n,i,s,o,a,l,u,c,h){let p=0,f=0,d=0;const y="right"===a?1:"left"===a?0:.5;let m=!1;for(const t of i){const r=t.getSections();for(const t of r){if(t.imageName)continue;const r=e[t.fontStack];if(r&&(m=void 0!==r.ascender&&void 0!==r.descender,!m))break}if(!m)break}let g=0;for(const o of i){o.trim();const i=o.getMaxScale(),a=(i-1)*jl,v={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=v;const b=v.positionedGlyphs;let w=0;if(!o.length()){f+=s,++g;continue}let _=0,A=0;for(let s=0;s<o.length();s++){const a=o.getSection(s),d=o.getSectionIndex(s),y=o.getCharCode(s);let g=a.scale,v=null,S=null,k=null,I=jl,z=0;const M=!(l===xu.horizontal||!c&&!ti(y)||c&&(_u[y]||(x=y,kn(x)||In(x)||zn(x)||Zn(x)||Kn(x))));if(a.imageName){const e=n[a.imageName];if(!e)continue;k=a.imageName,t.iconsInText=t.iconsInText||!0,S=e.paddedRect;const r=e.displaySize;g=g*jl/h,v={width:r[0],height:r[1],left:1,top:-3,advance:M?r[1]:r[0],localGlyph:!1},z=m?-v.height*g:i*jl-17-r[1]*g,I=v.advance;const s=(M?r[0]:r[1])*g-jl*i;s>0&&s>w&&(w=s)}else{const t=r[a.fontStack];if(!t)continue;t[y]&&(S=t[y]);const n=e[a.fontStack];if(!n)continue;const s=n.glyphs[y];if(!s)continue;if(v=s.metrics,I=8203!==y?jl:0,m){const t=void 0!==n.ascender?Math.abs(n.ascender):0,e=void 0!==n.descender?Math.abs(n.descender):0,r=(t+e)*g;_<r&&(_=r,A=(t-e)/2*g),z=-t*g}else z=(i-g)*jl-17}M?(t.verticalizable=!0,b.push({glyph:y,imageName:k,x:p,y:f+z,vertical:M,scale:g,localGlyph:v.localGlyph,fontStack:a.fontStack,sectionIndex:d,metrics:v,rect:S}),p+=I*g+u):(b.push({glyph:y,imageName:k,x:p,y:f+z,vertical:M,scale:g,localGlyph:v.localGlyph,fontStack:a.fontStack,sectionIndex:d,metrics:v,rect:S}),p+=v.advance*g+u)}0!==b.length&&(d=Math.max(p-u,d),m?Tu(b,y,w,A,s*i/2):Tu(b,y,w,0,s/2)),p=0;const S=s*i+w;v.lineOffset=Math.max(w,a),f+=S,++g}var x;const v=f,{horizontalAlign:b,verticalAlign:w}=Cu(o);(function(t,e,r,n,i,s){const o=(e-r)*i,a=-s*n;for(const e of t)for(const t of e.positionedGlyphs)t.x+=o,t.y+=a})(t.positionedLines,y,b,w,d,v),t.top+=-w*v,t.bottom=t.top+v,t.left+=-b*d,t.right=t.left+d,t.hasBaseline=m}(w,e,r,n,g,o,a,l,h,u,p,y),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const _u={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Au={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Su(t,e,r,n,i,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*jl/s+i:0}{const n=r[e.fontStack],s=n&&n.glyphs[t];return s?s.metrics.advance*e.scale+i:0}}function ku(t,e,r,n){const i=Math.pow(t-e,2);return n?t<e?i/2:2*i:i+Math.abs(r)*r}function Iu(t,e,r){let n=0;return 10===t&&(n-=1e4),r&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function zu(t,e,r,n,i,s){let o=null,a=ku(e,r,i,s);for(const t of n){const n=ku(e-t.x,r,i,s)+t.badness;n<=a&&(o=t,a=n)}return{index:t,x:e,priorBreak:o,badness:a}}function Mu(t){return t?Mu(t.priorBreak).concat(t.index):[]}function Pu(t,e,r,n,i,s,o){if("point"!==s)return[];if(!t)return[];const a=[],l=function(t,e,r,n,i,s){let o=0;for(let r=0;r<t.length();r++){const a=t.getSection(r);o+=Su(t.getCharCode(r),a,n,i,e,s)}return o/Math.max(1,Math.ceil(o/r))}(t,e,r,n,i,o),u=t.text.indexOf("​")>=0;let c=0;for(let r=0;r<t.length();r++){const s=t.getSection(r),p=t.getCharCode(r);if(_u[p]||(c+=Su(p,s,n,i,e,o)),r<t.length()-1){const e=!((h=p)<11904||!(Dn(h)||En(h)||Gn(h)||Nn(h)||$n(h)||Mn(h)||Fn(h)||Tn(h)||On(h)||Rn(h)||jn(h)||Jn(h)||Bn(h)||Cn(h)||Pn(h)||Ln(h)||Vn(h)||Xn(h)||Un(h)||qn(h)));(Au[p]||e||s.imageName)&&a.push(zu(r+1,c,l,a,Iu(p,t.getCharCode(r+1),e&&u),!1))}}var h;return Mu(zu(t.length(),c,l,a,0,!0))}function Cu(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Tu(t,e,r,n,i){if(!(e||r||n||i))return;const s=t.length-1,o=t[s],a=(o.x+o.metrics.advance*o.scale)*e;for(let e=0;e<=s;e++)t[e].x-=a,t[e].y+=r+n+i}function Bu(t,e,r){const{horizontalAlign:n,verticalAlign:i}=Cu(r),s=e[0]-t.displaySize[0]*n,o=e[1]-t.displaySize[1]*i;return{image:t,top:o,bottom:o+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function Vu(t,e,r,n,i,s){const o=t.image;let a;if(o.content){const t=o.content,e=o.pixelRatio||1;a=[t[0]/e,t[1]/e,o.displaySize[0]-t[2]/e,o.displaySize[1]-t[3]/e]}const l=e.left*s,u=e.right*s;let c,h,p,f;"width"===r||"both"===r?(f=i[0]+l-n[3],h=i[0]+u+n[1]):(f=i[0]+(l+u-o.displaySize[0])/2,h=f+o.displaySize[0]);const d=e.top*s,y=e.bottom*s;return"height"===r||"both"===r?(c=i[1]+d-n[0],p=i[1]+y+n[2]):(c=i[1]+(d+y-o.displaySize[1])/2,p=c+o.displaySize[1]),{image:o,top:c,right:h,bottom:p,left:f,collisionPadding:a}}class Eu extends r{constructor(t,e,r,n,i){super(t,e),this.angle=n,this.z=r,void 0!==i&&(this.segment=i)}clone(){return new Eu(this.x,this.y,this.z,this.angle,this.segment)}}function Du(t,e,r,n,i){if(void 0===e.segment)return!0;let s=e,o=e.segment+1,a=0;for(;a>-r/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const l=[];let u=0;for(;a<r/2;){const e=t[o],r=t[o+1];if(!r)return!1;let s=t[o-1].angleTo(e)-e.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:s}),u+=s;a-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;o++,a+=e.dist(r)}return!0}function Fu(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Lu(t,e,r){return t?.6*e*r:0}function ju(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function $u(t,e,r,n,i,s){const o=Lu(r,i,s),a=ju(r,n)*s;let l=0;const u=Fu(t)/2;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1],s=n.dist(i);if(l+s>u){const c=(u-l)/s,h=te(n.x,i.x,c),p=te(n.y,i.y,c),f=new Eu(h,p,0,i.angleTo(n),r);return!o||Du(t,f,a,o,e)?f:void 0}l+=s}}function Ou(t,e,r,n,i,s,o,a,l){const u=Lu(n,s,o),c=ju(n,i),h=c*o,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),Ru(t,p?e/2*a%e:(c/2+2*s)*o*a%e,e,u,r,h,p,!1,l)}function Ru(t,e,r,n,i,s,o,a,l){const u=s/2,c=Fu(t);let h=0,p=e-r,f=[];for(let e=0;e<t.length-1;e++){const o=t[e],a=t[e+1],d=o.dist(a),y=a.angleTo(o);for(;p+r<h+d;){p+=r;const m=(p-h)/d,g=te(o.x,a.x,m),x=te(o.y,a.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new Eu(g,x,0,y,e);r._round(),n&&!Du(t,r,s,n,i)||f.push(r)}}h+=d}return a||f.length||o||(f=Ru(t,h/2,r,n,i,s,o,!0,l)),f}function qu(t,e,n,i){const s=[],o=t.image,a=o.pixelRatio,l=o.paddedRect.w-2,u=o.paddedRect.h-2,c=t.right-t.left,h=t.bottom-t.top,p=o.stretchX||[[0,l]],f=o.stretchY||[[0,u]],d=(t,e)=>t+e[1]-e[0],y=p.reduce(d,0),m=f.reduce(d,0),g=l-y,x=u-m;let v=0,b=y,w=0,_=m,A=0,S=g,k=0,I=x;if(o.content&&i){const t=o.content;v=Uu(p,0,t[0]),w=Uu(f,0,t[1]),b=Uu(p,t[0],t[2]),_=Uu(f,t[1],t[3]),A=t[0]-v,k=t[1]-w,S=t[2]-t[0]-b,I=t[3]-t[1]-_}const z=(i,s,l,u)=>{const p=Zu(i.stretch-v,b,c,t.left),f=Xu(i.fixed-A,S,i.stretch,y),d=Zu(s.stretch-w,_,h,t.top),g=Xu(s.fixed-k,I,s.stretch,m),x=Zu(l.stretch-v,b,c,t.left),z=Xu(l.fixed-A,S,l.stretch,y),M=Zu(u.stretch-w,_,h,t.top),P=Xu(u.fixed-k,I,u.stretch,m),C=new r(p,d),T=new r(x,d),B=new r(x,M),V=new r(p,M),E=new r(f/a,g/a),D=new r(z/a,P/a),F=e*Math.PI/180;if(F){const t=Math.sin(F),e=Math.cos(F),r=[e,-t,t,e];C._matMult(r),T._matMult(r),V._matMult(r),B._matMult(r)}const L=i.stretch+i.fixed,j=s.stretch+s.fixed;return{tl:C,tr:T,bl:V,br:B,tex:{x:o.paddedRect.x+1+L,y:o.paddedRect.y+1+j,w:l.stretch+l.fixed-L,h:u.stretch+u.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:E,pixelOffsetBR:D,minFontScaleX:S/a/c,minFontScaleY:I/a/h,isSDF:n}};if(i&&(o.stretchX||o.stretchY)){const t=Nu(p,g,y),e=Nu(f,x,m);for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)s.push(z(n,e[t],i,e[t+1]))}}else s.push(z({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return s}function Uu(t,e,r){let n=0;for(const i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function Nu(t,e,r){const n=[{fixed:-1,stretch:0}];for(const[e,r]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(r-e)})}return n.push({fixed:e+1,stretch:r}),n}function Zu(t,e,r,n){return t/e*r+n}function Xu(t,e,r,n){return t-e*r/n}function Gu(t,e,r,n){const i=e+t.positionedLines[n].lineOffset;return 0===n?r+i/2:r+(i+(e+t.positionedLines[n-1].lineOffset))/2}mr("Anchor",Eu);class Yu{constructor(t=[],e=Ku){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t<n;){let n=1+(t<<1),s=e[n];const o=n+1;if(o<this.length&&r(e[o],s)<0&&(n=o,s=e[o]),r(s,i)>=0)break;e[t]=s,t=n}e[t]=i}}function Ku(t,e){return t<e?-1:t>e?1:0}function Ju(t,e=1,n=!1){let i=1/0,s=1/0,o=-1/0,a=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<i)&&(i=e.x),(!t||e.y<s)&&(s=e.y),(!t||e.x>o)&&(o=e.x),(!t||e.y>a)&&(a=e.y)}const u=Math.min(o-i,a-s);let c=u/2;const h=new Yu([],Hu);if(0===u)return new r(i,s);for(let e=i;e<o;e+=u)for(let r=s;r<a;r+=u)h.push(new Wu(e+c,r+c,c,t));let p=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,s=i.length,o=s-1;t<s;o=t++){const s=i[t],a=i[o],l=s.x*a.y-a.x*s.y;r+=(s.x+a.x)*l,n+=(s.y+a.y)*l,e+=3*l}return new Wu(r/e,n/e,0,t)}(t),f=h.length;for(;h.length;){const r=h.pop();(r.d>p.d||!p.d)&&(p=r,n&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,f)),r.max-p.d<=e||(c=r.h/2,h.push(new Wu(r.p.x-c,r.p.y-c,c,t)),h.push(new Wu(r.p.x+c,r.p.y-c,c,t)),h.push(new Wu(r.p.x-c,r.p.y+c,c,t)),h.push(new Wu(r.p.x+c,r.p.y+c,c,t)),f+=4)}return n&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function Hu(t,e){return e.max-t.max}function Wu(t,e,n,i){this.p=new r(t,e),this.h=n,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){const s=e[i];for(let e=0,i=s.length,o=i-1;e<i;o=e++){const i=s[e],a=s[o];i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(r=!r),n=Math.min(n,Ro(t,i,a))}}return(r?1:-1)*Math.sqrt(n)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}const Qu=Number.POSITIVE_INFINITY,tc=Math.sqrt(2);function ec(t,e,r,n,i,s,o,a,l,u){t.createArrays(),t.tilePixelRatio=mo/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const c=t.layers[0].layout,h=t.layers[0]._unevaluatedLayout._values,p={};if("composite"===t.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.textSizeData;p.compositeTextSizes=[h["text-size"].possiblyEvaluate(new Di(e),a),h["text-size"].possiblyEvaluate(new Di(r),a)]}if("composite"===t.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.iconSizeData;p.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new Di(e),a),h["icon-size"].possiblyEvaluate(new Di(r),a)]}p.layoutTextSize=h["text-size"].possiblyEvaluate(new Di(l+1),a),p.layoutIconSize=h["icon-size"].possiblyEvaluate(new Di(l+1),a),p.textMaxSize=h["text-size"].possiblyEvaluate(new Di(18),a);const f="map"===c.get("text-rotation-alignment")&&"point"!==c.get("symbol-placement"),d=c.get("text-size");for(const s of t.features){const l=c.get("text-font").evaluate(s,{},a).join(","),h=d.evaluate(s,{},a),g=p.layoutTextSize.evaluate(s,{},a),x=(p.layoutIconSize.evaluate(s,{},a),{horizontal:{},vertical:void 0}),v=s.text;let b,w=[0,0];if(v){const n=v.toString(),o=c.get("text-letter-spacing").evaluate(s,{},a)*jl,u=c.get("text-line-height").evaluate(s,{},a)*jl,p=Wn(n)?o:0,d=c.get("text-anchor").evaluate(s,{},a),b=c.get("text-variable-anchor");if(!b){const t=c.get("text-radial-offset").evaluate(s,{},a);t?(y=d,w=(m=[t*jl,Qu])[1]!==Qu?function(t,e,r){let n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(y,m[0],m[1]):function(t,e){let r=0,n=0;e<0&&(e=0);const i=e/tc;switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(y,m[0])):w=c.get("text-offset").evaluate(s,{},a).map((t=>t*jl))}let _=f?"center":c.get("text-justify").evaluate(s,{},a);const A=c.get("symbol-placement"),S="point"===A,k="point"===A?c.get("text-max-width").evaluate(s,{},a)*jl:0,I=s=>{t.allowVerticalPlacement&&Hn(n)&&(x.vertical=wu(v,e,r,i,l,k,u,d,s,p,w,xu.vertical,!0,A,g,h))};if(!f&&b){const t="auto"===_?b.map((t=>rc(t))):[_];let n=!1;for(let s=0;s<t.length;s++){const o=t[s];if(!x.horizontal[o])if(n)x.horizontal[o]=x.horizontal[0];else{const t=wu(v,e,r,i,l,k,u,"center",o,p,w,xu.horizontal,!1,A,g,h);t&&(x.horizontal[o]=t,n=1===t.positionedLines.length)}}I("left")}else{if("auto"===_&&(_=rc(d)),S||c.get("text-writing-mode").indexOf("horizontal")>=0||!Hn(n)){const t=wu(v,e,r,i,l,k,u,d,_,p,w,xu.horizontal,!1,A,g,h);t&&(x.horizontal[_]=t)}I("point"===A?"left":_)}}let _=!1;if(s.icon&&s.icon.name){const e=n[s.icon.name];e&&(b=Bu(i[s.icon.name],c.get("icon-offset").evaluate(s,{},a),c.get("icon-anchor").evaluate(s,{},a)),_=e.sdf,void 0===t.sdfIcons?t.sdfIcons=e.sdf:t.sdfIcons!==e.sdf&&T("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.pixelRatio||0!==c.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}const A=oc(x.horizontal)||x.vertical;t.iconsInText||(t.iconsInText=!!A&&A.iconsInText),(A||b)&&nc(t,s,x,b,n,p,g,0,w,_,o,a,u)}var y,m;s&&t.generateCollisionDebugBuffers(l,t.collisionBoxArray)}function rc(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function nc(t,e,n,i,s,o,a,l,u,c,h,p,f){let d=o.textMaxSize.evaluate(e,{},p);void 0===d&&(d=a);const y=t.layers[0].layout,m=y.get("icon-offset").evaluate(e,{},p),g=oc(n.horizontal)||n.vertical,v=a/24,b=t.tilePixelRatio*d/24,w=t.tilePixelRatio*y.get("symbol-spacing"),_=y.get("text-padding")*t.tilePixelRatio,A=y.get("icon-padding")*t.tilePixelRatio,S=x(y.get("text-max-angle")),k="map"===y.get("text-rotation-alignment")&&"point"!==y.get("symbol-placement"),I="map"===y.get("icon-rotation-alignment")&&"point"!==y.get("symbol-placement"),z=y.get("symbol-placement"),M=w/2,P=y.get("icon-text-fit");let C;i&&"none"!==P&&(t.allowVerticalPlacement&&n.vertical&&(C=Vu(i,n.vertical,P,y.get("icon-text-fit-padding"),m,v)),g&&(i=Vu(i,g,P,y.get("icon-text-fit-padding"),m,v)));const B=(r,a,l)=>{if(a.x<0||a.x>=mo||a.y<0||a.y>=mo)return;const{x:d,y:y,z:g}=f.projectTilePoint(a.x,a.y,l),x=new Eu(d,y,g,0,void 0);!function(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S){const k=t.addToLineVertexArray(e,n);let I,z,M,P,C,B,V,E=0,D=0,F=0,L=0,j=-1,$=-1;const O={};let R=Rs(""),q=0,U=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[q,U]=l.layout.get("text-offset").evaluate(b,{},S).map((t=>t*jl)):(q=l.layout.get("text-radial-offset").evaluate(b,{},S)*jl,U=Qu),t.allowVerticalPlacement&&i.vertical){const t=i.vertical;if(d)B=lc(t),a&&(V=lc(a));else{const n=l.layout.get("text-rotate").evaluate(b,{},S)+90;M=ac(u,r,e,c,h,p,t,f,n,y),a&&(P=ac(u,r,e,c,h,p,a,g,n))}}if(s){const n=l.layout.get("icon-rotate").evaluate(b,{},S),i="none"!==l.layout.get("icon-text-fit"),o=qu(s,n,_,i),f=a?qu(a,n,_,i):void 0;z=ac(u,r,e,c,h,p,s,g,n),E=4*o.length;const d=t.iconSizeData;let y=null;"source"===d.kind?(y=[$l*l.layout.get("icon-size").evaluate(b,{},S)],y[0]>ic&&T(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===d.kind&&(y=[$l*w.compositeIconSizes[0].evaluate(b,{},S),$l*w.compositeIconSizes[1].evaluate(b,{},S)],(y[0]>ic||y[1]>ic)&&T(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,o,y,v,x,b,!1,r,e,k.lineStartIndex,k.lineLength,-1,A,S),j=t.icon.placedSymbolArray.length-1,f&&(D=4*f.length,t.addSymbols(t.icon,f,y,v,x,b,xu.vertical,r,e,k.lineStartIndex,k.lineLength,-1,A,S),$=t.icon.placedSymbolArray.length-1)}for(const n in i.horizontal){const s=i.horizontal[n];I||(R=Rs(s.text),d?C=lc(s):I=ac(u,r,e,c,h,p,s,f,l.layout.get("text-rotate").evaluate(b,{},S),y));const a=1===s.positionedLines.length;if(F+=sc(t,r,e,s,o,l,d,b,y,k,i.vertical?xu.horizontal:xu.horizontalOnly,a?Object.keys(i.horizontal):[n],O,j,w,A,S),a)break}i.vertical&&(L+=sc(t,r,e,i.vertical,o,l,d,b,y,k,xu.vertical,["vertical"],O,$,w,A,S));let N=-1;const Z=(t,e)=>t?Math.max(t,e):e;N=Z(C,N),N=Z(B,N),N=Z(V,N);const X=N>-1?1:0;t.glyphOffsetArray.length>=gc.MAX_GLYPHS&&T("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey),t.symbolInstances.emplaceBack(r.x,r.y,r.z,e.x,e.y,O.right>=0?O.right:-1,O.center>=0?O.center:-1,O.left>=0?O.left:-1,O.vertical>=0?O.vertical:-1,j,$,R,void 0!==I?I:t.collisionBoxArray.length,void 0!==I?I+1:t.collisionBoxArray.length,void 0!==M?M:t.collisionBoxArray.length,void 0!==M?M+1:t.collisionBoxArray.length,void 0!==z?z:t.collisionBoxArray.length,void 0!==z?z+1:t.collisionBoxArray.length,P||t.collisionBoxArray.length,P?P+1:t.collisionBoxArray.length,c,F,L,E,D,X,0,q,U,N)}(t,a,x,r,n,i,s,C,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,_,k,u,0,A,I,m,e,o,c,h,p)};if("line"===z)for(const s of function(t,e,n,i,s){const o=[];for(let e=0;e<t.length;e++){const n=t[e];let a;for(let t=0;t<n.length-1;t++){let e=n[t],l=n[t+1];e.x<0&&l.x<0||(e.x<0?e=new r(0,e.y+(0-e.x)/(l.x-e.x)*(l.y-e.y))._round():l.x<0&&(l=new r(0,e.y+(0-e.x)/(l.x-e.x)*(l.y-e.y))._round()),e.y<0&&l.y<0||(e.y<0?e=new r(e.x+(0-e.y)/(l.y-e.y)*(l.x-e.x),0)._round():l.y<0&&(l=new r(e.x+(0-e.y)/(l.y-e.y)*(l.x-e.x),0)._round()),e.x>=i&&l.x>=i||(e.x>=i?e=new r(i,e.y+(i-e.x)/(l.x-e.x)*(l.y-e.y))._round():l.x>=i&&(l=new r(i,e.y+(i-e.x)/(l.x-e.x)*(l.y-e.y))._round()),e.y>=s&&l.y>=s||(e.y>=s?e=new r(e.x+(s-e.y)/(l.y-e.y)*(l.x-e.x),s)._round():l.y>=s&&(l=new r(e.x+(s-e.y)/(l.y-e.y)*(l.x-e.x),s)._round()),a&&e.equals(a[a.length-1])||(a=[e],o.push(a)),a.push(l)))))}}return o}(e.geometry,0,0,mo,mo)){const e=Ou(s,w,S,n.vertical||g,i,24,b,t.overscaling,mo);for(const r of e){const e=g;e&&uc(t,e.text,M,r)||B(s,r,p)}}else if("line-center"===z){for(const t of e.geometry)if(t.length>1){const e=$u(t,S,n.vertical||g,i,24,b);e&&B(t,e,p)}}else if("Polygon"===e.type)for(const t of Xa(e.geometry,0)){const e=Ju(t,16);B(t[0],new Eu(e.x,e.y,0,0,void 0),p)}else if("LineString"===e.type)for(const t of e.geometry)B(t,new Eu(t[0].x,t[0].y,0,0,void 0),p);else if("Point"===e.type)for(const t of e.geometry)for(const e of t)B([e],new Eu(e.x,e.y,0,0,void 0),p)}const ic=32640;function sc(t,e,n,i,s,o,a,l,u,c,h,p,f,d,y,m,g){const x=function(t,e,n,i,s,o,a,l){const u=[];if(0===e.positionedLines.length)return u;const c=i.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,h=function(t){const e=t[0],r=t[1],n=e*r;return n>0?[e,-r]:n<0?[-e,r]:0===e?[r,e]:[r,-e]}(n);let p=Math.abs(e.top-e.bottom);for(const t of e.positionedLines)p-=t.lineOffset;const f=e.positionedLines.length,d=p/f;let y=e.top-n[1];for(let t=0;t<f;++t){const i=e.positionedLines[t];y=Gu(e,d,y,t);for(const t of i.positionedGlyphs){if(!t.rect)continue;const i=t.rect||{};let o=4,p=!0,f=1,d=0;if(t.imageName){const e=a[t.imageName];if(!e)continue;if(e.sdf){T("SDF images are not supported in formatted text and will be ignored.");continue}p=!1,f=e.pixelRatio,o=1/f}const m=(s||l)&&t.vertical,g=t.metrics.advance*t.scale/2,x=t.metrics,v=t.rect;if(null===v)continue;l&&e.verticalizable&&(d=t.imageName?g-t.metrics.width*t.scale/2:0);const b=s?[t.x+g,t.y]:[0,0];let w=[0,0],_=[0,0],A=!1;s||(m?(_=[t.x+g+h[0],t.y+h[1]-d],A=!0):w=[t.x+g+n[0],t.y+n[1]-d]);const S=v.w*t.scale/(f*(t.localGlyph?2:1)),k=v.h*t.scale/(f*(t.localGlyph?2:1));let I,z,M,P;if(m){const e=t.y-y,n=new r(-g,g-e),i=-Math.PI/2,s=new r(..._);I=new r(-g+w[0],w[1]),I._rotateAround(i,n)._add(s),I.x+=-e+g,I.y-=(x.left-o)*t.scale;const a=t.imageName?x.advance*t.scale:jl*t.scale,l=String.fromCharCode(t.glyph);Zl(l)?I.x+=(1-o)*t.scale:Xl(l)?I.x+=a-x.height*t.scale+(-o-1)*t.scale:I.x+=t.imageName||x.width+2*o===v.w&&x.height+2*o===v.h?(a-k)/2:(a-(x.height+2*o)*t.scale)/2,z=new r(I.x,I.y-S),M=new r(I.x+k,I.y),P=new r(I.x+k,I.y-S)}else{const e=(x.left-o)*t.scale-g+w[0],n=(-x.top-o)*t.scale+w[1],i=e+S,s=n+k;I=new r(e,n),z=new r(i,n),M=new r(e,s),P=new r(i,s)}if(c){let t;t=s?new r(0,0):A?new r(h[0],h[1]):new r(n[0],n[1]),I._rotateAround(c,t),z._rotateAround(c,t),M._rotateAround(c,t),P._rotateAround(c,t)}const C=new r(0,0),B=new r(0,0);u.push({tl:I,tr:z,bl:M,br:P,tex:i,writingMode:e.writingMode,glyphOffset:b,sectionIndex:t.sectionIndex,isSDF:p,pixelOffsetTL:C,pixelOffsetBR:B,minFontScaleX:0,minFontScaleY:0})}}return u}(0,i,u,o,a,l,s,t.allowVerticalPlacement),v=t.textSizeData;let b=null;"source"===v.kind?(b=[$l*o.layout.get("text-size").evaluate(l,{},g)],b[0]>ic&&T(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===v.kind&&(b=[$l*y.compositeTextSizes[0].evaluate(l,{},g),$l*y.compositeTextSizes[1].evaluate(l,{},g)],(b[0]>ic||b[1]>ic)&&T(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,x,b,u,a,l,h,e,n,c.lineStartIndex,c.lineLength,d,m,g);for(const e of p)f[e]=t.text.placedSymbolArray.length-1;return 4*x.length}function oc(t){for(const e in t)return t[e];return null}function ac(t,e,n,i,s,o,a,l,u,c){let h=a.top,p=a.bottom,f=a.left,d=a.right;const y=a.collisionPadding;if(y&&(f-=y[0],h-=y[1],d+=y[2],p+=y[3]),u){const t=new r(f,h),e=new r(d,h),n=new r(f,p),i=new r(d,p),s=x(u);let o=new r(0,0);c&&(o=new r(c[0],c[1])),t._rotateAround(s,o),e._rotateAround(s,o),n._rotateAround(s,o),i._rotateAround(s,o),f=Math.min(t.x,e.x,n.x,i.x),d=Math.max(t.x,e.x,n.x,i.x),h=Math.min(t.y,e.y,n.y,i.y),p=Math.max(t.y,e.y,n.y,i.y)}return t.emplaceBack(e.x,e.y,e.z,n.x,n.y,f,h,d,p,l,i,s,o),t.length-1}function lc(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function uc(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<r)return!0}else i[e]=[];return i[e].push(n),!1}const cc=cl.VectorTileFeature.types,hc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function pc(t,e,r,n,i,s,o,a,l,u,c,h,p,f,d,y){const m=c?Math.min(ic,Math.round(c[0])):0,g=c?Math.min(ic,Math.round(c[1])):0;t.emplaceBack(e,r,Math.round(32*o),Math.round(32*a),l,u,(m<<1)+(h?1:0),g,16*p,16*f,256*d,256*y,n,i,s,0)}function fc(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function dc(t){for(const e of t.sections)if(ii(e.text))return!0;return!1}class yc{constructor(t){this.layoutVertexArray=new ls,this.indexArray=new ds,this.programConfigurations=t,this.segments=new yo,this.dynamicLayoutVertexArray=new ss,this.opacityVertexArray=new us,this.placedSymbolArray=new Ms}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,r,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Vl.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,El.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,hc,!0),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}mr("SymbolBuffers",yc);class mc{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new yo,this.collisionVertexArray=new fs,this.collisionVertexArrayExt=new ss}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Dl.members,!0),this.collisionVertexBufferExt=t.createVertexBuffer(this.collisionVertexArrayExt,Fl.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}mr("CollisionBuffers",mc);class gc{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=a([]),this.placementViewportMatrix=a([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ol(this.zoom,e["text-size"]),this.iconSizeData=Ol(this.zoom,e["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map((t=>xu[t])),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID}createArrays(){this.text=new yc(new io(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new yc(new io(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Ts,this.lineVertexArray=new Bs,this.symbolInstances=new Cs}calculateGlyphDependencies(t,e,r,n,i){for(let r=0;r<t.length;r++)if(e[t.charCodeAt(r)]=!0,n&&i){const n=Nl[t.charAt(r)];n&&(e[n.charCodeAt(0)]=!0)}}populate(t,e,r,n){const i=this.layers[0],s=i.layout,o=s.get("text-font"),a=s.get("text-field"),l=s.get("icon-image"),u=("constant"!==a.value.kind||a.value.value instanceof ht&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),c="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=s.get("symbol-sort-key");if(this.features=[],!u&&!c)return;const p=e.iconDependencies,f=e.glyphDependencies,d=e.availableImages,y=new Di(this.zoom);for(const{feature:e,id:a,index:l,sourceLayerIndex:m}of t){const t=i._featureFilter.needGeometry,g=To(e,t);if(!i._featureFilter.filter(y,g,r))continue;let x,v;if(t||(g.geometry=Co(e,r,n)),u){const t=i.getValueAndResolveTokens("text-field",g,r,d),e=ht.factory(t);dc(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Bi||this.hasRTLText&&Ei.isParsed())&&(x=Ul(e,i,g))}if(c){const t=i.getValueAndResolveTokens("icon-image",g,r,d);v=t instanceof pt?t:pt.fromString(t)}if(!x&&!v)continue;const b=this.sortFeaturesByKey?h.evaluate(g,{},r):void 0;if(this.features.push({id:a,text:x,icon:v,index:l,sourceLayerIndex:m,geometry:g.geometry,properties:e.properties,type:cc[e.type],sortKey:b}),v&&(p[v.name]=!0),x){const t=o.evaluate(g,{},r).join(","),e="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(xu.vertical)>=0;for(const r of x.sections)if(r.image)p[r.image.name]=!0;else{const n=Hn(x.toString()),i=r.fontStack||t,s=f[i]=f[i]||{};this.calculateGlyphDependencies(r.text,s,e,this.allowVerticalPlacement,n)}}}"line"===s.get("symbol-placement")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++}function o(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function a(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const f=l(p,h),d=l(p,h,!0);if(f in r&&d in e&&r[f]!==e[d]){const t=a(f,d,h),i=o(f,d,n[t].geometry);delete e[f],delete r[d],r[l(p,n[i].geometry,!0)]=i,n[t].geometry=null}else f in r?o(f,d,h):d in e?a(f,d,h):(s(u),e[f]=i-1,r[d]=i-1)}return n.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r,n),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r,n))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const i={};for(let n=t.segment+1;n<e.length;n++)i[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:r},n<e.length-1&&(r+=e[n+1].dist(e[n]));for(let r=t.segment||0;r>=0;r--)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r>0&&(n+=e[r-1].dist(e[r]));for(let t=0;t<e.length;t++){const e=i[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,o,a,l,u,c,h,p,f){const d=t.indexArray,y=t.layoutVertexArray,m=t.segments.prepareSegment(4*e.length,y,d,this.canOverlap?s.sortKey:void 0),g=this.glyphOffsetArray.length,x=m.vertexLength,v=this.allowVerticalPlacement&&o===xu.vertical?Math.PI/2:0,b=s.text&&s.text.sections;for(let n=0;n<e.length;n++){const{tl:i,tr:o,bl:u,br:c,tex:h,pixelOffsetTL:g,pixelOffsetBR:x,minFontScaleX:w,minFontScaleY:_,glyphOffset:A,isSDF:S,sectionIndex:k}=e[n],I=m.vertexLength,z=A[1];pc(y,a.x,a.y,a.z,l.x,l.y,i.x,z+i.y,h.x,h.y,r,S,g.x,g.y,w,_),pc(y,a.x,a.y,a.z,l.x,l.y,o.x,z+o.y,h.x+h.w,h.y,r,S,x.x,g.y,w,_),pc(y,a.x,a.y,a.z,l.x,l.y,u.x,z+u.y,h.x,h.y+h.h,r,S,g.x,x.y,w,_),pc(y,a.x,a.y,a.z,l.x,l.y,c.x,z+c.y,h.x+h.w,h.y+h.h,r,S,x.x,x.y,w,_),fc(t.dynamicLayoutVertexArray,a,v),d.emplaceBack(I,I+1,I+2),d.emplaceBack(I+1,I+2,I+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),n!==e.length-1&&k===e[n+1].sectionIndex||t.programConfigurations.populatePaintArrays(y.length,s,s.index,{},p,f,b&&b[k])}t.placedSymbolArray.emplaceBack(a.x,a.y,a.z,l.x,l.y,g,this.glyphOffsetArray.length-g,x,u,c,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],o,0,!1,0,h,0)}_commitLayoutVertex(t,e,r,n,i,s,o){t.emplaceBack(e,r,n,i,s,Math.round(o.x),Math.round(o.y))}_addCollisionDebugVertices(t,e,n,i,s,o,a){const l=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),u=l.vertexLength,c=a.tileAnchorX,h=a.tileAnchorY;for(let t=0;t<4;t++)n.collisionVertexArray.emplaceBack(0,0,0,0);n.collisionVertexArrayExt.emplaceBack(e,-t.padding,-t.padding),n.collisionVertexArrayExt.emplaceBack(e,t.padding,-t.padding),n.collisionVertexArrayExt.emplaceBack(e,t.padding,t.padding),n.collisionVertexArrayExt.emplaceBack(e,-t.padding,t.padding),this._commitLayoutVertex(n.layoutVertexArray,i,s,o,c,h,new r(t.x1,t.y1)),this._commitLayoutVertex(n.layoutVertexArray,i,s,o,c,h,new r(t.x2,t.y1)),this._commitLayoutVertex(n.layoutVertexArray,i,s,o,c,h,new r(t.x2,t.y2)),this._commitLayoutVertex(n.layoutVertexArray,i,s,o,c,h,new r(t.x1,t.y2)),l.vertexLength+=4;const p=n.indexArray;p.emplaceBack(u,u+1),p.emplaceBack(u+1,u+2),p.emplaceBack(u+2,u+3),p.emplaceBack(u+3,u),l.primitiveLength+=4}_addTextDebugCollisionBoxes(t,e,r,n,i,s){for(let o=n;o<i;o++){const n=r.get(o),i=this.getSymbolInstanceTextSize(t,s,e,o);this._addCollisionDebugVertices(n,i,this.textCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(t,e,r,n,i,s){for(let o=n;o<i;o++){const n=r.get(o),i=this.getSymbolInstanceIconSize(t,e,o);this._addCollisionDebugVertices(n,i,this.iconCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}generateCollisionDebugBuffers(t,e){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new mc(hs,Ll.members,ws),this.iconCollisionBox=new mc(hs,Ll.members,ws);const r=ql(this.iconSizeData,t),n=ql(this.textSizeData,t);for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this._addTextDebugCollisionBoxes(n,t,e,s.textBoxStartIndex,s.textBoxEndIndex,s),this._addTextDebugCollisionBoxes(n,t,e,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._addIconDebugCollisionBoxes(r,t,e,s.iconBoxStartIndex,s.iconBoxEndIndex,s),this._addIconDebugCollisionBoxes(r,t,e,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s)}}getSymbolInstanceTextSize(t,e,r,n){const i=this.text.placedSymbolArray.get(e.rightJustifiedTextSymbolIndex>=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:n),s=Rl(this.textSizeData,t,i)/jl;return this.tilePixelRatio*s}getSymbolInstanceIconSize(t,e,r){const n=this.icon.placedSymbolArray.get(r),i=Rl(this.iconSizeData,t,n);return this.tilePixelRatio*i}_commitDebugCollisionVertexUpdate(t,e,r){t.emplaceBack(e,-r,-r),t.emplaceBack(e,r,-r),t.emplaceBack(e,r,r),t.emplaceBack(e,-r,r)}_updateTextDebugCollisionBoxes(t,e,r,n,i,s){for(let o=n;o<i;o++){const n=r.get(o),i=this.getSymbolInstanceTextSize(t,s,e,o);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,i,n.padding)}}_updateIconDebugCollisionBoxes(t,e,r,n,i){for(let s=n;s<i;s++){const n=r.get(s),i=this.getSymbolInstanceIconSize(t,e,s);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,i,n.padding)}}updateCollisionDebugBuffers(t,e){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const r=ql(this.iconSizeData,t),n=ql(this.textSizeData,t);for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this._updateTextDebugCollisionBoxes(n,t,e,s.textBoxStartIndex,s.textBoxEndIndex,s),this._updateTextDebugCollisionBoxes(n,t,e,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._updateIconDebugCollisionBoxes(r,t,e,s.iconBoxStartIndex,s.iconBoxEndIndex),this._updateIconDebugCollisionBoxes(r,t,e,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(t,e,r,n,i,s,o,a,l){const u={};for(let n=e;n<r;n++){const e=t.get(n);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,padding:e.padding,projectedAnchorX:e.projectedAnchorX,projectedAnchorY:e.projectedAnchorY,projectedAnchorZ:e.projectedAnchorZ,tileAnchorX:e.tileAnchorX,tileAnchorY:e.tileAnchorY},u.textFeatureIndex=e.featureIndex;break}for(let e=n;e<i;e++){const r=t.get(e);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,padding:r.padding,projectedAnchorX:r.projectedAnchorX,projectedAnchorY:r.projectedAnchorY,projectedAnchorZ:r.projectedAnchorZ,tileAnchorX:r.tileAnchorX,tileAnchorY:r.tileAnchorY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let e=s;e<o;e++){const r=t.get(e);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,padding:r.padding,projectedAnchorX:r.projectedAnchorX,projectedAnchorY:r.projectedAnchorY,projectedAnchorZ:r.projectedAnchorZ,tileAnchorX:r.tileAnchorX,tileAnchorY:r.tileAnchorY},u.iconFeatureIndex=r.featureIndex;break}for(let e=a;e<l;e++){const r=t.get(e);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,padding:r.padding,projectedAnchorX:r.projectedAnchorX,projectedAnchorY:r.projectedAnchorY,projectedAnchorZ:r.projectedAnchorZ,tileAnchorX:r.tileAnchorX,tileAnchorY:r.tileAnchorY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),n=[],i=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);const o=this.symbolInstances.get(t);n.push(0|Math.round(e*o.tileAnchorX+r*o.tileAnchorY)),i.push(o.featureIndex)}return s.sort(((t,e)=>n[t]-n[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}mr("SymbolBucket",gc,{omit:["layers","collisionBoxArray","features","compareText"]}),gc.MAX_GLYPHS=65535,gc.addDynamicAttributes=fc;const xc=new Ki({"symbol-placement":new Ni(Ir.layout_symbol["symbol-placement"]),"symbol-spacing":new Ni(Ir.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ni(Ir.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Zi(Ir.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ni(Ir.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ni(Ir.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ni(Ir.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ni(Ir.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ni(Ir.layout_symbol["icon-rotation-alignment"]),"icon-size":new Zi(Ir.layout_symbol["icon-size"]),"icon-text-fit":new Ni(Ir.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ni(Ir.layout_symbol["icon-text-fit-padding"]),"icon-image":new Zi(Ir.layout_symbol["icon-image"]),"icon-rotate":new Zi(Ir.layout_symbol["icon-rotate"]),"icon-padding":new Ni(Ir.layout_symbol["icon-padding"]),"icon-keep-upright":new Ni(Ir.layout_symbol["icon-keep-upright"]),"icon-offset":new Zi(Ir.layout_symbol["icon-offset"]),"icon-anchor":new Zi(Ir.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ni(Ir.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ni(Ir.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ni(Ir.layout_symbol["text-rotation-alignment"]),"text-field":new Zi(Ir.layout_symbol["text-field"]),"text-font":new Zi(Ir.layout_symbol["text-font"]),"text-size":new Zi(Ir.layout_symbol["text-size"]),"text-max-width":new Zi(Ir.layout_symbol["text-max-width"]),"text-line-height":new Zi(Ir.layout_symbol["text-line-height"]),"text-letter-spacing":new Zi(Ir.layout_symbol["text-letter-spacing"]),"text-justify":new Zi(Ir.layout_symbol["text-justify"]),"text-radial-offset":new Zi(Ir.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ni(Ir.layout_symbol["text-variable-anchor"]),"text-anchor":new Zi(Ir.layout_symbol["text-anchor"]),"text-max-angle":new Ni(Ir.layout_symbol["text-max-angle"]),"text-writing-mode":new Ni(Ir.layout_symbol["text-writing-mode"]),"text-rotate":new Zi(Ir.layout_symbol["text-rotate"]),"text-padding":new Ni(Ir.layout_symbol["text-padding"]),"text-keep-upright":new Ni(Ir.layout_symbol["text-keep-upright"]),"text-transform":new Zi(Ir.layout_symbol["text-transform"]),"text-offset":new Zi(Ir.layout_symbol["text-offset"]),"text-allow-overlap":new Ni(Ir.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ni(Ir.layout_symbol["text-ignore-placement"]),"text-optional":new Ni(Ir.layout_symbol["text-optional"])});var vc={paint:new Ki({"icon-opacity":new Zi(Ir.paint_symbol["icon-opacity"]),"icon-color":new Zi(Ir.paint_symbol["icon-color"]),"icon-halo-color":new Zi(Ir.paint_symbol["icon-halo-color"]),"icon-halo-width":new Zi(Ir.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Zi(Ir.paint_symbol["icon-halo-blur"]),"icon-translate":new Ni(Ir.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ni(Ir.paint_symbol["icon-translate-anchor"]),"text-opacity":new Zi(Ir.paint_symbol["text-opacity"]),"text-color":new Zi(Ir.paint_symbol["text-color"],{runtimeType:H,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Zi(Ir.paint_symbol["text-halo-color"]),"text-halo-width":new Zi(Ir.paint_symbol["text-halo-width"]),"text-halo-blur":new Zi(Ir.paint_symbol["text-halo-blur"]),"text-translate":new Ni(Ir.paint_symbol["text-translate"]),"text-translate-anchor":new Ni(Ir.paint_symbol["text-translate-anchor"])}),layout:xc};class bc{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:G,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}mr("FormatSectionOverride",bc,{omit:["defaultValue"]});class wc extends ho{constructor(t){super(t,vc)}recalculate(t,e){super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const r=this.layout.get("text-writing-mode");if(r){const t=[];for(const e of r)t.indexOf(e)<0&&t.push(e);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||or(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):""))}(e.properties,i)}createBucket(t){return new gc(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of vc.paint.overridableProperties){if(!wc.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new bc(e),n=new sr(r,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new lr("source",n):new ur("composite",n,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new qi(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&wc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=vc.paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof ht)s(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof gt&&yt(e.value)===et?s(e.value.sections):e instanceof wt?s(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return i}getProgramConfiguration(t){return new no(this,t)}}var _c={paint:new Ki({"background-color":new Ni(Ir.paint_background["background-color"]),"background-pattern":new Gi(Ir.paint_background["background-pattern"]),"background-opacity":new Ni(Ir.paint_background["background-opacity"])})},Ac={paint:new Ki({"raster-opacity":new Ni(Ir.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ni(Ir.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ni(Ir.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ni(Ir.paint_raster["raster-brightness-max"]),"raster-saturation":new Ni(Ir.paint_raster["raster-saturation"]),"raster-contrast":new Ni(Ir.paint_raster["raster-contrast"]),"raster-resampling":new Ni(Ir.paint_raster["raster-resampling"]),"raster-fade-duration":new Ni(Ir.paint_raster["raster-fade-duration"])})};class Sc extends ho{constructor(t){super(t,{}),this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)}onRemove(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)}}var kc={paint:new Ki({"sky-type":new Ni(Ir.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ni(Ir.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ni(Ir.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ni(Ir.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ni(Ir.paint_sky["sky-gradient-radius"]),"sky-gradient":new Yi(Ir.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ni(Ir.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ni(Ir.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ni(Ir.paint_sky["sky-opacity"])})};function Ic(t,e,r){const n=h(0,0,1),i=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}(d());return function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(r),l=Math.cos(r);t[0]=n*l-s*a,t[1]=i*l+o*a,t[2]=s*l+n*a,t[3]=o*l-i*a}(i,i,r?-x(t)+Math.PI:x(t)),function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(r),l=Math.cos(r);t[0]=n*l+o*a,t[1]=i*l+s*a,t[2]=s*l-i*a,t[3]=o*l-n*a}(i,i,-x(e)),function(t,e,r){var n=r[0],i=r[1],s=r[2],o=e[0],a=e[1],l=e[2],u=i*l-s*a,c=s*o-n*l,h=n*a-i*o,p=i*h-s*c,f=s*u-n*h,d=n*c-i*u,y=2*r[3];c*=y,h*=y,f*=2,d*=2,t[0]=o+(u*=y)+(p*=2),t[1]=a+c+f,t[2]=l+h+d}(n,n,i),function(t,e){var r=e[0],n=e[1],i=e[2],s=r*r+n*n+i*i;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}(n,n)}const zc={circle:class extends ho{constructor(t){super(t,Jo)}createBucket(t){return new Vo(t)}queryRadius(t){const e=t;return Zo("circle-radius",this,e)+Zo("circle-stroke-width",this,e)+Xo(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,r,n,i,s,o,a){const l=Yo(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r);return Wo(t,n,s,o,a,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,u)}getProgramIds(){return["circle"]}getProgramConfiguration(t){return new no(this,t)}},heatmap:class extends ho{createBucket(t){return new na(t)}constructor(t){super(t,ua),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ca({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(t){return Zo("heatmap-radius",this,t)}queryIntersectsFeature(t,e,n,i,s,o,a,l){const u=this.paint.get("heatmap-radius").evaluate(e,n);return Wo(t,i,o,a,l,!0,!0,new r(0,0),u)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(t){return new no(this,t)}},hillshade:class extends ho{constructor(t){super(t,ha)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getProgramConfiguration(t){return new no(this,t)}},fill:class extends ho{constructor(t){super(t,Wa)}getProgramIds(){const t=this.paint.get("fill-pattern"),e=t&&t.constantOr(1),r=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&r.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),r}getProgramConfiguration(t){return new no(this,t)}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Ja(t)}queryRadius(){return Xo(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,r,n,i,s){return!t.queryGeometry.isAboveHorizon&&Fo(Go(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),n)}isTileClipped(){return!0}},"fill-extrusion":class extends ho{constructor(t){super(t,gl)}createBucket(t){return new yl(t)}queryRadius(){return Xo(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(t){return new no(this,t)}queryIntersectsFeature(t,e,n,i,s,o,a,l,u){const c=Yo(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,t.pixelToTileUnitsFactor),h=this.paint.get("fill-extrusion-height").evaluate(e,n),p=this.paint.get("fill-extrusion-base").evaluate(e,n),d=[0,0],y=l&&o.elevation,m=o.elevation?o.elevation.exaggeration():1;if(y){const e=t.tile.getBucket(this).centroidVertexArray,r=u+1;if(r<e.length){const t=e.get(r);d[0]=t.a_centroid_pos0,d[1]=t.a_centroid_pos1}}if(0===d[0]&&1===d[1])return!1;const g=function(t,e,n,i,s,o,a,l,u){return o?function(t,e,r,n,i,s,o,a,l){const u=[],c=[],h=[0,0,0,1];for(const p of t){const t=[],d=[];for(const u of p){const c=u.x+n.x,p=u.y+n.y,y=wl(c,p,e,r,s,o,a,l);h[0]=c,h[1]=p,h[2]=y.base,h[3]=1,f(h,h,i),h[3]=Math.max(h[3],1e-5);const m=bl([h[0]/h[3],h[1]/h[3],h[2]/h[3]]);h[0]=c,h[1]=p,h[2]=y.top,h[3]=1,f(h,h,i),h[3]=Math.max(h[3],1e-5);const g=bl([h[0]/h[3],h[1]/h[3],h[2]/h[3]]);t.push(m),d.push(g)}u.push(t),c.push(d)}return[u,c]}(t,e,n,i,s,o,a,l,u):function(t,e,n,i,s){const o=[],a=[],l=s[8]*e,u=s[9]*e,c=s[10]*e,h=s[11]*e,p=s[8]*n,f=s[9]*n,d=s[10]*n,y=s[11]*n;for(const e of t){const t=[],n=[];for(const o of e){const e=o.x+i.x,a=o.y+i.y,m=s[0]*e+s[4]*a+s[12],g=s[1]*e+s[5]*a+s[13],x=s[2]*e+s[6]*a+s[14],v=s[3]*e+s[7]*a+s[15],b=m+l,w=g+u,_=x+c,A=Math.max(v+h,1e-5),S=m+p,k=g+f,I=x+d,z=Math.max(v+y,1e-5),M=new r(b/A,w/A);M.z=_/A,t.push(M);const P=new r(S/z,k/z);P.z=I/z,n.push(P)}o.push(t),a.push(n)}return[o,a]}(t,e,n,i,s)}(i,p,h,c,a,y?l:null,d,m,o.center.lat),x=t.queryGeometry;return function(t,e,r){let n=1/0;Fo(r,e)&&(n=vl(r,e[0]));for(let i=0;i<e.length;i++){const s=e[i],o=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],o[t+1],o[t],e];Eo(r,i)&&(n=Math.min(n,vl(r,i)))}}return n!==1/0&&n}(g[0],g[1],x.isPointQuery()?x.screenBounds:x.screenGeometry)}},line:class extends ho{constructor(t){super(t,Cl),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=t._styleExpression&&t._styleExpression.expression instanceof Qt,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Tl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Ml(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getProgramConfiguration(t){return new no(this,t)}queryRadius(t){const e=t,r=Bl(Zo("line-width",this,e),Zo("line-gap-width",this,e)),n=Zo("line-offset",this,e);return r/2+Math.abs(n)+Xo(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,n,i,s,o){if(t.queryGeometry.isAboveHorizon)return!1;const a=Go(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,t.pixelToTileUnitsFactor),l=t.pixelToTileUnitsFactor/2*Bl(this.paint.get("line-width").evaluate(e,n),this.paint.get("line-gap-width").evaluate(e,n)),u=this.paint.get("line-offset").evaluate(e,n);return u&&(i=function(t,e){const n=[],i=new r(0,0);for(let r=0;r<t.length;r++){const s=t[r],o=[];for(let t=0;t<s.length;t++){const r=s[t-1],n=s[t],a=s[t+1],l=0===t?i:n.sub(r)._unit()._perp(),u=t===s.length-1?i:a.sub(n)._unit()._perp(),c=l._add(u)._unit();c._mult(1/(c.x*u.x+c.y*u.y)),o.push(c._mult(e)._add(n))}n.push(o)}return n}(i,u*t.pixelToTileUnitsFactor)),function(t,e,r){for(let n=0;n<e.length;n++){const i=e[n];if(t.length>=3)for(let e=0;e<i.length;e++)if(Uo(t,i[e]))return!0;if(Lo(t,i,r))return!0}return!1}(a,i,l)}isTileClipped(){return!0}},symbol:wc,background:class extends ho{constructor(t){super(t,_c)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class extends ho{constructor(t){super(t,Ac)}getProgramIds(){return["raster"]}},sky:class extends ho{constructor(t){super(t,kc),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"sky-gradient"===t?this._updateColorRamp():"sky-atmosphere-sun"!==t&&"sky-atmosphere-halo-color"!==t&&"sky-atmosphere-color"!==t&&"sky-atmosphere-sun-intensity"!==t||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=ca({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(t){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=t.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}}getCenter(t,e){const r=this.paint.get("sky-type");if("atmosphere"===r){const r=this.paint.get("sky-atmosphere-sun"),n=!r,i=t.style.light,s=i.properties.get("position");return n&&"viewport"===i.properties.get("anchor")&&T("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),n?Ic(s.azimuthal,90-s.polar,e):Ic(r[0],90-r[1],e)}if("gradient"===r){const t=this.paint.get("sky-gradient-center");return Ic(t[0],90-t[1],e)}}is3D(){return!1}isSky(){return!0}markSkyboxValid(t){this._skyboxInvalidated=!1,this._lightPosition=t.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const t=this.paint.get("sky-type");return"atmosphere"===t?["skyboxCapture","skybox"]:"gradient"===t?["skyboxGradient"]:null}}};var Mc=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Pc(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const r of t)e+=`${Pc(r)},`;return`${e}]`}const r=Object.keys(t).sort();let n="{";for(let e=0;e<r.length;e++)n+=`${JSON.stringify(r[e])}:${Pc(t[r[e]])},`;return`${n}}`}function Cc(t){let e="";for(const r of Mc)e+=`/${Pc(t[r])}`;return e}class Tc{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(t,e){for(const e of t)this._layerConfigs[e.id]=e,(this._layers[e.id]=(r=e,"custom"===r.type?new Sc(r):new zc[r.type](r))).compileFilter(),this.keyCache[e.id]&&delete this.keyCache[e.id];var r;for(const t of e)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const n=function(t,e){const r={};for(let n=0;n<t.length;n++){const i=e&&e[t[n].id]||Cc(t[n]);e&&(e[t[n].id]=i);let s=r[i];s||(s=r[i]=[]),s.push(t[n])}const n=[];for(const t in r)n.push(r[t]);return n}(_(this._layerConfigs),this.keyCache);for(const t of n){const e=t.map((t=>this._layers[t.id])),r=e[0];if("none"===r.visibility)continue;const n=r.source||"";let i=this.familiesBySource[n];i||(i=this.familiesBySource[n]={});const s=r.sourceLayer||"_geojsonTileLayer";let o=i[s];o||(o=i[s]=[]),o.push(e)}}}class Bc{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}class Vc{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}function Ec(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class Dc{constructor(t,e,r){this.z=t,this.x=e,this.y=r,this.key=jc(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e){const r=(i=this.y,s=this.z,o=Ec(256*(n=this.x),256*(i=Math.pow(2,s)-i-1),s),a=Ec(256*(n+1),256*(i+1),s),o[0]+","+o[1]+","+a[0]+","+a[1]);var n,i,s,o,a;const l=function(t,e,r){let n,i="";for(let s=t;s>0;s--)n=1<<s-1,i+=(e&n?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",String(this.z)).replace("{x}",String(this.x)).replace("{y}",String("tms"===e?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",l).replace("{bbox-epsg-3857}",r)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Fc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=jc(t,e.z,e.z,e.x,e.y)}}class Lc{constructor(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new Dc(r,+n,+i),this.key=0===e&&t===r?this.canonical.key:jc(e,t,r,n,i)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){const e=this.canonical.z-t;return t>this.canonical.z?new Lc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Lc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e=!0){if(this.overscaledZ===t&&e)return this.key;if(t>this.canonical.z)return jc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-t;return jc(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Lc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Lc(e,this.wrap,e,r,n),new Lc(e,this.wrap,e,r+1,n),new Lc(e,this.wrap,e,r,n+1),new Lc(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Lc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Lc(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Fc(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function jc(t,e,r,n,i){const s=1<<Math.min(r,22);let o=s*(i%s)+n%s;return t&&r<22&&(o+=s*s*((t<0?-2*t-1:2*t)%(1<<2*(22-r)))),16*(32*o+r)+(e-r)}function $c(t,e){const r=t.fovAboveCenter,n=t.elevation?t.elevation.getMinElevationBelowMSL()*e:0,i=(t._camera.position[2]*t.worldSize-n)/Math.cos(t._pitch),s=Math.sin(r)*i/Math.sin(Math.max(Math.PI/2-t._pitch-r,.01)),o=Math.sin(t._pitch)*s+i;return Math.min(1.01*o,i*(1/t._horizonShift))}mr("CanonicalTileID",Dc),mr("OverscaledTileID",Lc,{omit:["projMatrix"]}),ts([{name:"a_pos",type:"Int16",components:2}]),ts([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_merc_pos",components:2},{type:"Float32",name:"a_uv",components:2}]),ts([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);const Oc=mo/Math.PI/2,Rc=-Oc,qc=Oc;function Uc(t,e){if(!e.isReprojectedInTileSpace)return{scale:1<<t.z,x:t.x,y:t.y,x2:t.x+1,y2:t.y+1,projection:e};const r=Math.pow(2,-t.z),n=t.x*r,i=(t.x+1)*r,s=t.y*r,o=(t.y+1)*r,a=_o(n),l=_o(i),u=Ao(s),c=Ao(o),h=e.project(a,u),p=e.project(l,u),f=e.project(l,c),d=e.project(a,c);let y=Math.min(h.x,p.x,f.x,d.x),m=Math.min(h.y,p.y,f.y,d.y),g=Math.max(h.x,p.x,f.x,d.x),x=Math.max(h.y,p.y,f.y,d.y);const v=r/16;function b(t,r,n,i,s,o){const a=(n+s)/2,l=(i+o)/2,u=e.project(_o(a),Ao(l)),c=Math.max(0,y-u.x,m-u.y,u.x-g,u.y-x);y=Math.min(y,u.x),g=Math.max(g,u.x),m=Math.min(m,u.y),x=Math.max(x,u.y),c>v&&(b(t,u,n,i,a,l),b(u,r,a,l,s,o))}b(h,p,n,s,i,s),b(p,f,i,s,i,o),b(f,d,i,o,n,o),b(d,h,n,o,n,s),y-=v,m-=v,g+=v,x+=v;const w=1/Math.max(g-y,x-m);return{scale:w,x:y*w,y:m*w,x2:g*w,y2:x*w,projection:e}}new Ho([Rc,Rc,Rc],[qc,qc,qc]),new Ho([Rc,Rc,Rc],[0,0,qc]),new Ho([0,Rc,Rc],[qc,0,qc]),new Ho([Rc,0,Rc],[0,qc,qc]),new Ho([0,0,Rc],[qc,qc,qc]);const Nc=new Uint16Array(8184);for(let t=0;t<2046;t++){let e=t+2,r=0,n=0,i=0,s=0,o=0,a=0;for(1&e?i=s=o=32:r=n=a=32;(e>>=1)>1;){const t=r+i>>1,l=n+s>>1;1&e?(i=r,s=n,r=o,n=a):(r=i,n=s,i=o,s=a),o=t,a=l}const l=4*t;Nc[l+0]=r,Nc[l+1]=n,Nc[l+2]=i,Nc[l+3]=s}ts([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Zc{constructor(t){this.size=t,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(t,e){const r=this.toIdx(t,e);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(t,e){return this.leaves[this.toIdx(t,e)]}toIdx(t,e){return e*this.size+t}}function Xc(t,e,r,n){let i=0,s=Number.MAX_VALUE;for(let o=0;o<3;o++)if(Math.abs(n[o])<1e-15){if(r[o]<t[o]||r[o]>e[o])return null}else{const a=1/n[o];let l=(t[o]-r[o])*a,u=(e[o]-r[o])*a;if(l>u){const t=l;l=u,u=t}if(l>i&&(i=l),u<s&&(s=u),i>s)return null}return i}function Gc(t,e,r,n,i,s,o,a,l,u,c){const h=n-t,p=i-e,f=s-r,d=o-t,y=a-e,m=l-r,g=c[1]*m-c[2]*y,x=c[2]*d-c[0]*m,v=c[0]*y-c[1]*d,b=h*g+p*x+f*v;if(Math.abs(b)<1e-15)return null;const w=1/b,_=u[0]-t,A=u[1]-e,S=u[2]-r,k=(_*g+A*x+S*v)*w;if(k<0||k>1)return null;const I=A*f-S*p,z=S*h-_*f,M=_*p-A*h,P=(c[0]*I+c[1]*z+c[2]*M)*w;return P<0||k+P>1?null:(d*I+y*z+m*M)*w}function Yc(t,e,r){return(t-e)/(r-e)}function Kc(t,e,r,n,i,s,o,a,l){const u=1<<r,c=s-n,h=o-i,p=(t+1)/u*c+n,f=(e+0)/u*h+i,d=(e+1)/u*h+i;a[0]=(t+0)/u*c+n,a[1]=f,l[0]=p,l[1]=d}class Jc{constructor(t){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=t,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const e=function(t){const e=Math.ceil(Math.log2(t.dim/8)),r=[];let n=Math.ceil(Math.pow(2,e));const i=1/n,s=(t,e,r,n,i)=>{const s=n?1:0,o=(t+1)*r-s,a=e*r,l=(e+1)*r-s;i[0]=t*r,i[1]=a,i[2]=o,i[3]=l};let o=new Zc(n);const a=[];for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),i,!1,a);const r=Wc(a[0],a[1],t),l=Wc(a[2],a[1],t),u=Wc(a[2],a[3],t),c=Wc(a[0],a[3],t);o.minimums.push(Math.min(r,l,u,c)),o.maximums.push(Math.max(r,l,u,c)),o.leaves.push(1)}for(r.push(o),n/=2;n>=1;n/=2){const t=r[r.length-1];o=new Zc(n);for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),2,!0,a);const r=t.getElevation(a[0],a[1]),i=t.getElevation(a[2],a[1]),l=t.getElevation(a[2],a[3]),u=t.getElevation(a[0],a[3]),c=t.isLeaf(a[0],a[1]),h=t.isLeaf(a[2],a[1]),p=t.isLeaf(a[2],a[3]),f=t.isLeaf(a[0],a[3]),d=Math.min(r.min,i.min,l.min,u.min),y=Math.max(r.max,i.max,l.max,u.max),m=c&&h&&p&&f;o.maximums.push(y),o.minimums.push(d),o.leaves.push(y-d<=5&&m?1:0)}r.push(o)}return r}(this.dem),r=e.length-1,n=e[r];this._addNode(n.minimums[0],n.maximums[0],n.leaves[0]),this._construct(e,0,0,r,0)}raycastRoot(t,e,r,n,i,s,o=1){return Xc([t,e,-100],[r,n,this.maximums[0]*o],i,s)}raycast(t,e,r,n,i,s,o=1){if(!this.nodeCount)return null;const a=this.raycastRoot(t,e,r,n,i,s,o);if(null==a)return null;const l=[],u=[],c=[],h=[],f=[{idx:0,t:a,nodex:0,nodey:0,depth:0}];for(;f.length>0;){const{idx:a,t:d,nodex:y,nodey:m,depth:g}=f.pop();if(this.leaves[a]){Kc(y,m,g,t,e,r,n,c,h);const a=1<<g,l=(y+0)/a,u=(y+1)/a,f=(m+0)/a,x=(m+1)/a,v=Wc(l,f,this.dem)*o,b=Wc(u,f,this.dem)*o,w=Wc(u,x,this.dem)*o,_=Wc(l,x,this.dem)*o,A=Gc(c[0],c[1],v,h[0],c[1],b,h[0],h[1],w,i,s),S=Gc(h[0],h[1],w,c[0],h[1],_,c[0],c[1],v,i,s),k=Math.min(null!==A?A:Number.MAX_VALUE,null!==S?S:Number.MAX_VALUE);if(k!==Number.MAX_VALUE)return k;{const t=p([],i,s,d);if(Hc(v,b,_,w,Yc(t[0],c[0],h[0]),Yc(t[1],c[1],h[1]))>=t[2])return d}continue}let x=0;for(let p=0;p<this._siblingOffset.length;p++){Kc((y<<1)+this._siblingOffset[p][0],(m<<1)+this._siblingOffset[p][1],g+1,t,e,r,n,c,h),c[2]=-100,h[2]=this.maximums[this.childOffsets[a]+p]*o;const f=Xc(c,h,i,s);if(null!=f){const t=f;l[p]=t;let e=!1;for(let r=0;r<x&&!e;r++)t>=l[u[r]]&&(u.splice(r,0,p),e=!0);e||(u[x]=p),x++}}for(let t=0;t<x;t++){const e=u[t];f.push({idx:this.childOffsets[a]+e,t:l[e],nodex:(y<<1)+this._siblingOffset[e][0],nodey:(m<<1)+this._siblingOffset[e][1],depth:g+1})}}return null}_addNode(t,e,r){return this.minimums.push(t),this.maximums.push(e),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(t,e,r,n,i){if(1===t[n].isLeaf(e,r))return;this.childOffsets[i]||(this.childOffsets[i]=this.nodeCount);const s=n-1,o=t[s];let a,l=0;for(let t=0;t<this._siblingOffset.length;t++){const n=2*e+this._siblingOffset[t][0],i=2*r+this._siblingOffset[t][1],s=o.getElevation(n,i),u=o.isLeaf(n,i),c=this._addNode(s.min,s.max,u);u&&(l|=1<<t),a||(a=c)}for(let n=0;n<this._siblingOffset.length;n++)l&1<<n||this._construct(t,2*e+this._siblingOffset[n][0],2*r+this._siblingOffset[n][1],s,a+n)}}function Hc(t,e,r,n,i,s){return te(te(t,r,s),te(e,n,s),i)}function Wc(t,e,r){const n=r.dim,i=b(t*n-.5,0,n-1),s=b(e*n-.5,0,n-1),o=Math.floor(i),a=Math.floor(s),l=Math.min(o+1,n-1),u=Math.min(a+1,n-1);return Hc(r.get(o,a),r.get(l,a),r.get(o,u),r.get(l,u),i-o,s-a)}const Qc={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};class th{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(t,e,r,n=!1,i=!1){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return T(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const s=this.dim=e.height-2;if(this.data=new Uint32Array(e.data.buffer),this.encoding=r||"mapbox",this.borderReady=n,!n){for(let t=0;t<s;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(s,t)]=this.data[this._idx(s-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,s)]=this.data[this._idx(t,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)],i&&this._buildQuadTree()}}_buildQuadTree(){this._tree=new Jc(this)}get(t,e,r=!1){const n=new Uint8Array(this.data.buffer);r&&(t=b(t,-1,this.dim),e=b(e,-1,this.dim));const i=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(n[i],n[i+1],n[i+2])}static getUnpackVector(t){return Qc[t]}get unpackVector(){return Qc[this.encoding]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,r){return(256*t*256+256*e+r)/10-1e4}_unpackTerrarium(t,e,r){return 256*t+e+r/256-32768}static pack(t,e){const r=[0,0,0,0],n=th.getUnpackVector(e);let i=Math.floor((t+n[3])/n[2]);return r[2]=i%256,i=Math.floor(i/256),r[1]=i%256,i=Math.floor(i/256),r[0]=i,r}getPixels(){return new la({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,o=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=o-1;break;case 1:o=s+1}const a=-e*this.dim,l=-r*this.dim;for(let e=s;e<o;e++)for(let r=n;r<i;r++)this.data[this._idx(r,e)]=t.data[this._idx(r+a,e+l)]}onDeserialize(){this._tree&&(this._tree.dem=this)}}mr("DEMData",th),mr("DemMinMaxQuadTree",Jc,{omit:["dem"]});class eh{constructor(t,e,r){this._demTile=t,this._dem=this._demTile.dem,this._scale=e,this._offset=r}static create(t,e,r){const n=r||t.findDEMTileFor(e);if(!n||!n.dem)return;const i=n.dem,s=n.tileID,o=1<<e.canonical.z-s.canonical.z;return new eh(n,n.tileSize/mo/o,[(e.canonical.x/o-s.canonical.x)*i.dim,(e.canonical.y/o-s.canonical.y)*i.dim])}tileCoordToPixel(t,e){const n=e*this._scale+this._offset[1],i=Math.floor(t*this._scale+this._offset[0]),s=Math.floor(n);return new r(i,s)}getElevationAt(t,e,r,n){const i=t*this._scale+this._offset[0],s=e*this._scale+this._offset[1],o=Math.floor(i),a=Math.floor(s),l=this._dem;return n=!!n,r?te(te(l.get(o,a,n),l.get(o,a+1,n),s-a),te(l.get(o+1,a,n),l.get(o+1,a+1,n),s-a),i-o):l.get(o,a,n)}getElevationAtPixel(t,e,r){return this._dem.get(t,e,!!r)}getMeterToDEM(t){return(1<<this._demTile.tileID.canonical.z)*wo(1,t)*this._dem.stride}}class rh{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new $(mo,16,0),this.featureIndexArray=new Es,this.promoteId=e}insert(t,e,r,n,i,s=0){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i,s);const a=this.grid;for(let t=0;t<e.length;t++){const r=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){const e=r[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}n[0]<mo&&n[1]<mo&&n[2]>=0&&n[3]>=0&&a.insert(o,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new cl.VectorTile(new Kl(this.rawTileData)).layers,this.sourceLayerCoder=new Bc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const t in this.vtLayers)this.vtFeatures[t]=[]}return this.vtLayers}query(t,e,n,i){this.loadVTLayers();const s=t.params||{},o=$r(s.filter),a=t.tileResult,l=t.transform,u=a.bufferedTilespaceBounds,c=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,((t,e,n,i)=>function(t,e,n,i,s){for(const r of t)if(e<=r.x&&n<=r.y&&i>=r.x&&s>=r.y)return!0;const o=[new r(e,n),new r(e,s),new r(i,s),new r(i,n)];if(t.length>2)for(const e of o)if(Uo(t,e))return!0;for(let e=0;e<t.length-1;e++)if(No(t[e],t[e+1],o))return!0;return!1}(a.bufferedTilespaceGeometry,t,e,n,i)));c.sort(ih);let h=null;l.elevation&&c.length>0&&(h=eh.create(l.elevation,this.tileID));const p={};let f;for(let r=0;r<c.length;r++){const l=c[r];if(l===f)continue;f=l;const u=this.featureIndexArray.get(l);let d=null;this.loadMatchingFeature(p,u,o,s.layers,s.availableImages,e,n,i,((e,r,n,i=0)=>(d||(d=Co(e,this.tileID.canonical,t.tileTransform)),r.queryIntersectsFeature(a,e,n,d,this.z,t.transform,t.pixelPosMatrix,h,i))))}return p}loadMatchingFeature(t,e,r,n,i,s,o,a,l){const{featureIndex:u,bucketIndex:c,sourceLayerIndex:h,layoutVertexArrayOffset:p}=e,f=this.bucketLayerIDs[c];if(n&&!function(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}(n,f))return;const d=this.sourceLayerCoder.decode(h),y=this.vtLayers[d].feature(u);if(r.needGeometry){const t=To(y,!0);if(!r.filter(new Di(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!r.filter(new Di(this.tileID.overscaledZ),y))return;const m=this.getId(y,d);for(let e=0;e<f.length;e++){const r=f[e];if(n&&n.indexOf(r)<0)continue;const c=s[r];if(!c)continue;let h={};void 0!==m&&a&&(h=a.getState(c.sourceLayer||"_geojsonTileLayer",m));const d=A({},o[r]);d.paint=nh(d.paint,c.paint,y,h,i),d.layout=nh(d.layout,c.layout,y,h,i);const g=!l||l(y,c,h,p);if(!g)continue;const x=new Vc(y,this.z,this.x,this.y,m);x.layer=d;let v=t[r];void 0===v&&(v=t[r]=[]),v.push({featureIndex:u,feature:x,intersectionZ:g})}}lookupSymbolFeatures(t,e,r,n,i,s,o,a){const l={};this.loadVTLayers();const u=$r(i);for(const i of t)this.loadMatchingFeature(l,{bucketIndex:r,sourceLayerIndex:n,featureIndex:i,layoutVertexArrayOffset:0},u,s,o,a,e);return l}loadFeature(t){const{featureIndex:e,sourceLayerIndex:r}=t;this.loadVTLayers();const n=this.sourceLayerCoder.decode(r),i=this.vtFeatures[n];if(i[e])return i[e];const s=this.vtLayers[n].feature(e);return i[e]=s,s}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;return this.promoteId&&(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof r&&(r=Number(r))),r}}function nh(t,e,r,n,i){return M(t,((t,s)=>{const o=e instanceof Ui?e.get(s):null;return o&&o.evaluate?o.evaluate(r,n,i):o}))}function ih(t,e){return e-t}mr("FeatureIndex",rh,{omit:["rawTileData","sourceLayerCoder"]});class sh{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.image=new aa({width:t,height:e}),this.positions={},this.uploaded=!1}getDash(t,e){const r=this.getKey(t,e);return this.positions[r]}trim(){const t=this.width,e=this.height=(r=this.nextRow)<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2));var r;this.image.resize({width:t,height:e})}getKey(t,e){return t.join(",")+e}getDashRanges(t,e,r){const n=[];let i=t.length%2==1?-t[t.length-1]*r:0,s=t[0]*r,o=!0;n.push({left:i,right:s,isDash:o,zeroLength:0===t[0]});let a=t[0];for(let e=1;e<t.length;e++){o=!o;const l=t[e];i=a*r,a+=l,s=a*r,n.push({left:i,right:s,isDash:o,zeroLength:0===l})}return n}addRoundDash(t,e,r){const n=e/2;for(let e=-r;e<=r;e++){const i=this.width*(this.nextRow+r+e);let s=0,o=t[s];for(let a=0;a<this.width;a++){a/o.right>1&&(o=t[++s]);const l=Math.abs(a-o.left),u=Math.abs(a-o.right),c=Math.min(l,u);let h;const p=e/r*(n+1);if(o.isDash){const t=n-Math.abs(p);h=Math.sqrt(c*c+t*t)}else h=n-Math.sqrt(c*c+p*p);this.image.data[i+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t,e){for(let e=t.length-1;e>=0;--e){const r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1))}const r=t[0],n=t[t.length-1];r.isDash===n.isDash&&(r.left=n.left-this.width,n.right=r.right+this.width);const i=this.width*this.nextRow;let s=0,o=t[s];for(let r=0;r<this.width;r++){r/o.right>1&&(o=t[++s]);const n=Math.abs(r-o.left),a=Math.abs(r-o.right),l=Math.min(n,a);this.image.data[i+r]=Math.max(0,Math.min(255,(o.isDash?l:-l)+e+128))}}addDash(t,e){const r=this.getKey(t,e);if(this.positions[r])return this.positions[r];const n="round"===e,i=n?7:0,s=2*i+1;if(this.nextRow+s>this.height)return T("LineAtlas out of space"),null;0===t.length&&t.push(1);let o=0;for(let e=0;e<t.length;e++)t[e]<0&&(T("Negative value is found in line dasharray, replacing values with 0"),t[e]=0),o+=t[e];if(0!==o){const r=this.width/o,s=this.getDashRanges(t,this.width,r);n?this.addRoundDash(s,r,i):this.addRegularDash(s,"square"===e?.5*r:0)}const a=this.nextRow+i;this.nextRow+=s;const l={tl:[a,i],br:[o,0]};return this.positions[r]=l,l}}mr("LineAtlas",sh);class oh{constructor(t){const e={},r=[];for(const n in t){const i=t[n],s=e[n]={};for(const t in i.glyphs){const e=i.glyphs[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const n=e.metrics.localGlyph?2:1,o={x:0,y:0,w:e.bitmap.width+2*n,h:e.bitmap.height+2*n};r.push(o),s[t]=o}}const{w:n,h:i}=yu(r),s=new aa({width:n||1,height:i||1});for(const r in t){const n=t[r];for(const t in n.glyphs){const i=n.glyphs[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const o=e[r][t],a=i.metrics.localGlyph?2:1;aa.copy(i.bitmap,s,{x:0,y:0},{x:o.x+a,y:o.y+a},i.bitmap)}}this.image=s,this.positions=e}}mr("GlyphAtlas",oh);class ah{constructor(t){this.tileID=new Lc(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,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.enableTerrain=!!t.enableTerrain,this.isSymbolTile=t.isSymbolTile,this.tileTransform=Uc(t.tileID.canonical,t.projection),this.projection=t.projection}parse(t,e,r,n,i){this.status="parsing",this.data=t,this.collisionBoxArray=new Is;const s=new Bc(Object.keys(t.layers).sort()),o=new rh(this.tileID,this.promoteId);o.bucketLayerIDs=[];const a={},l=new sh(256,256),u={featureIndex:o,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:l,availableImages:r},c=e.familiesBySource[this.source];for(const e in c){const n=t.layers[e];if(!n)continue;let i=!1,l=!1;for(const t of c[e])"symbol"===t[0].type?i=!0:l=!0;if(!0===this.isSymbolTile&&!i)continue;if(!1===this.isSymbolTile&&!l)continue;1===n.version&&T(`Vector tile source "${this.source}" layer "${e}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const h=s.encode(e),p=[];for(let t=0;t<n.length;t++){const r=n.feature(t),i=o.getId(r,e);p.push({feature:r,id:i,index:t,sourceLayerIndex:h})}for(const t of c[e]){const e=t[0];void 0!==this.isSymbolTile&&"symbol"===e.type!==this.isSymbolTile||e.minzoom&&this.zoom<Math.floor(e.minzoom)||e.maxzoom&&this.zoom>=e.maxzoom||"none"!==e.visibility&&(lh(t,this.zoom,r),(a[e.id]=e.createBucket({index:o.bucketLayerIDs.length,layers:t,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:h,sourceID:this.source,enableTerrain:this.enableTerrain,availableImages:r})).populate(p,u,this.tileID.canonical,this.tileTransform),o.bucketLayerIDs.push(t.map((t=>t.id))))}}let h,p,f,d;l.trim();const y={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},m=M(u.glyphDependencies,(t=>Object.keys(t).map(Number)));Object.keys(m).length?n.send("getGlyphs",{uid:this.uid,stacks:m},((t,e)=>{h||(h=t,p=e,v.call(this))}),void 0,!1,y):p={};const g=Object.keys(u.iconDependencies);g.length?n.send("getImages",{icons:g,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{h||(h=t,f=e,v.call(this))}),void 0,!1,y):f={};const x=Object.keys(u.patternDependencies);function v(){if(h)return i(h);if(p&&f&&d){const t=new oh(p),e=new gu(f,d);for(const n in a){const i=a[n];i instanceof gc?(lh(i.layers,this.zoom,r),ec(i,p,t.positions,f,e.iconPositions,this.showCollisionBoxes,r,this.tileID.canonical,this.tileZoom,this.projection),i.projection=this.projection.name):i.hasPattern&&(i instanceof Ml||i instanceof Ja||i instanceof yl)&&(lh(i.layers,this.zoom,r),i.addFeatures(u,this.tileID.canonical,e.patternPositions,r))}this.status="done",i(null,{buckets:_(a).filter((t=>!t.isEmpty())),featureIndex:o,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,lineAtlas:l,imageAtlas:e,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?t.positions:null})}}x.length?n.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{h||(h=t,d=e,v.call(this))}),void 0,!1,y):d={},v.call(this)}}function lh(t,e,r){const n=new Di(e);for(const e of t)e.recalculate(n,r)}class uh{constructor(t){this.entries={},this.scheduler=t}request(t,e,r,n){const i=this.entries[t]=this.entries[t]||{callbacks:[]};if(i.result){const[t,r]=i.result;return this.scheduler?this.scheduler.add((()=>{n(t,r)}),e):n(t,r),()=>{}}return i.callbacks.push(n),i.cancel||(i.cancel=r(((r,n)=>{i.result=[r,n];for(const t of i.callbacks)this.scheduler?this.scheduler.add((()=>{t(r,n)}),e):t(r,n);setTimeout((()=>delete this.entries[t]),3e3)}))),()=>{i.result||(i.callbacks=i.callbacks.filter((t=>t!==n)),i.callbacks.length||(i.cancel(),delete this.entries[t]))}}}function ch(t,e,r){const n=JSON.stringify(t.request);return t.data&&(this.deduped.entries[n]={result:[null,t.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},(e=>{const n=function(t,e){return Pi(A(t,{type:"arrayBuffer"}),e)}(t.request,((t,n,i,s)=>{t?e(t):n&&e(null,{vectorTile:r?void 0:new cl.VectorTile(new Kl(n)),rawData:n,cacheControl:i,expires:s})}));return()=>{n.cancel(),e()}}),e)}class hh extends bn{constructor(t,e,r,n,i){super(),this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=i||ch,this.loading={},this.loaded={},this.deduped=new uh(t.scheduler),this.isSpriteLoaded=n,this.scheduler=t.scheduler}loadTile(t,e){const r=t.uid,n=t&&t.request,i=n&&n.collectResourceTiming,s=this.loading[r]=new ah(t);s.abort=this.loadVectorData(t,((o,a)=>{const l=!this.loading[r];if(delete this.loading[r],l||o||!a)return s.status="done",l||(this.loaded[r]=s),e(o);const u=a.rawData,c={};a.expires&&(c.expires=a.expires),a.cacheControl&&(c.cacheControl=a.cacheControl),s.vectorTile=a.vectorTile||new cl.VectorTile(new Kl(u));const h=()=>{s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,r)=>{if(t||!r)return e(t);const s={};if(i){const t=Ar(n);t.length>0&&(s.resourceTiming=JSON.parse(JSON.stringify(t)))}e(null,A({rawTileData:u.slice(0)},r,c,s))}))};this.isSpriteLoaded?h():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(h,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom}):h()})),this.loaded=this.loaded||{},this.loaded[r]=s}))}reloadTile(t,e){const r=this.loaded,n=t.uid,i=this;if(r&&r[n]){const s=r[n];s.showCollisionBoxes=t.showCollisionBoxes,s.enableTerrain=!!t.enableTerrain,s.projection=t.projection;const o=(t,r)=>{const n=s.reloadCallback;n&&(delete s.reloadCallback,s.parse(s.vectorTile,i.layerIndex,this.availableImages,i.actor,n)),e(t,r)};"parsing"===s.status?s.reloadCallback=o:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,o):o())}}abortTile(t,e){const r=t.uid,n=this.loading[r];n&&(n.abort&&n.abort(),delete this.loading[r]),e()}removeTile(t,e){const r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()}}const{ImageBitmap:ph}=s;class fh{loadTile(t,e){const{uid:r,encoding:n,rawImageData:i,padding:s,buildQuadTree:o}=t,a=ph&&i instanceof ph?this.getImageData(i,s):i;e(null,new th(r,a,n,s<1,o))}getImageData(t,e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);const r=this.offscreenCanvasContext.getImageData(-e,-e,t.width+2*e,t.height+2*e);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new la({width:r.width,height:r.height},r.data)}}var dh=function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n<e.features.length;n++)t(e.features[n],r);else if("GeometryCollection"===i)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],r);else if("Feature"===i)t(e.geometry,r);else if("Polygon"===i)yh(e.coordinates,r);else if("MultiPolygon"===i)for(n=0;n<e.coordinates.length;n++)yh(e.coordinates[n],r);return e};function yh(t,e){if(0!==t.length){mh(t[0],e);for(var r=1;r<t.length;r++)mh(t[r],!e)}}function mh(t,e){for(var r=0,n=0,i=0,s=t.length,o=s-1;i<s;o=i++){var a=(t[i][0]-t[o][0])*(t[o][1]+t[i][1]),l=r+a;n+=Math.abs(r)>=Math.abs(a)?r-l+a:a-l+r,r=l}r+n>=0!=!!e&&t.reverse()}const gh=cl.VectorTileFeature.prototype.toGeoJSON;class xh{constructor(t){this._feature=t,this.extent=mo,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const e of this._feature.geometry)t.push([new r(e[0],e[1])]);return t}{const t=[];for(const e of this._feature.geometry){const n=[];for(const t of e)n.push(new r(t[0],t[1]));t.push(n)}return t}}toGeoJSON(t,e,r){return gh.call(this,t,e,r)}}class vh{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=mo,this.length=t.length,this._features=t}feature(t){return new xh(this._features[t])}}var bh=cl.VectorTileFeature,wh=_h;function _h(t,e){this.options=e||{},this.features=t,this.length=t.length}function Ah(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}_h.prototype.feature=function(t){return new Ah(this.features[t],this.options.extent)},Ah.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var n=t[e],i=[],s=0;s<n.length;s++)i.push(new r(n[s][0],n[s][1]));this.geometry.push(i)}return this.geometry},Ah.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,s=0;s<t.length;s++)for(var o=t[s],a=0;a<o.length;a++){var l=o[a];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},Ah.prototype.toGeoJSON=bh.prototype.toGeoJSON;var Sh=Ih,kh=wh;function Ih(t){var e=new Kl;return function(t,e){for(var r in t.layers)e.writeMessage(3,zh,t.layers[r])}(t,e),e.finish()}function zh(t,e){var r;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,Mh,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var s=n.values;for(r=0;r<s.length;r++)e.writeMessage(4,Vh,s[r])}function Mh(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,Ph,t),e.writeVarintField(3,r.type),e.writeMessage(4,Bh,r)}function Ph(t,e){var r=t.feature,n=t.keys,i=t.values,s=t.keycache,o=t.valuecache;for(var a in r.properties){var l=r.properties[a],u=s[a];if(null!==l){void 0===u&&(n.push(a),s[a]=u=n.length-1),e.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=o[h];void 0===p&&(i.push(l),o[h]=p=i.length-1),e.writeVarint(p)}}}function Ch(t,e){return(e<<3)+(7&t)}function Th(t){return t<<1^t>>31}function Bh(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,s=0,o=r.length,a=0;a<o;a++){var l=r[a],u=1;1===n&&(u=l.length),e.writeVarint(Ch(1,u));for(var c=3===n?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==n&&e.writeVarint(Ch(2,c-1));var p=l[h].x-i,f=l[h].y-s;e.writeVarint(Th(p)),e.writeVarint(Th(f)),i+=p,s+=f}3===n&&e.writeVarint(Ch(7,1))}}function Vh(t,e){var r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}function Eh(t,e,r,n,i,s){if(i-n<=r)return;const o=n+i>>1;Dh(t,e,o,n,i,s%2),Eh(t,e,r,n,o-1,s+1),Eh(t,e,r,o+1,i,s+1)}function Dh(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const o=i-n+1,a=r-n+1,l=Math.log(o),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(o-u)/o)*(a-o/2<0?-1:1);Dh(t,e,r,Math.max(n,Math.floor(r-a*u/o+c)),Math.min(i,Math.floor(r+(o-a)*u/o+c)),s)}const o=e[2*r+s];let a=n,l=i;for(Fh(t,e,n,r),e[2*i+s]>o&&Fh(t,e,n,i);a<l;){for(Fh(t,e,a,l),a++,l--;e[2*a+s]<o;)a++;for(;e[2*l+s]>o;)l--}e[2*n+s]===o?Fh(t,e,n,l):(l++,Fh(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Fh(t,e,r,n){Lh(t,r,n),Lh(e,2*r,2*n),Lh(e,2*r+1,2*n+1)}function Lh(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function jh(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}Sh.fromVectorTileJs=Ih,Sh.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var n in t)r[n]=new wh(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Ih({layers:r})},Sh.GeoJSONWrapper=kh;const $h=t=>t[0],Oh=t=>t[1];class Rh{constructor(t,e=$h,r=Oh,n=64,i=Float64Array){this.nodeSize=n,this.points=t;const s=t.length<65536?Uint16Array:Uint32Array,o=this.ids=new s(t.length),a=this.coords=new i(2*t.length);for(let n=0;n<t.length;n++)o[n]=n,a[2*n]=e(t[n]),a[2*n+1]=r(t[n]);Eh(o,a,n,0,o.length-1,0)}range(t,e,r,n){return function(t,e,r,n,i,s,o){const a=[0,t.length-1,0],l=[];let u,c;for(;a.length;){const h=a.pop(),p=a.pop(),f=a.pop();if(p-f<=o){for(let o=f;o<=p;o++)u=e[2*o],c=e[2*o+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[o]);continue}const d=Math.floor((f+p)/2);u=e[2*d],c=e[2*d+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[d]);const y=(h+1)%2;(0===h?r<=u:n<=c)&&(a.push(f),a.push(d-1),a.push(y)),(0===h?i>=u:s>=c)&&(a.push(d+1),a.push(p),a.push(y))}return l}(this.ids,this.coords,t,e,r,n,this.nodeSize)}within(t,e,r){return function(t,e,r,n,i,s){const o=[0,t.length-1,0],a=[],l=i*i;for(;o.length;){const u=o.pop(),c=o.pop(),h=o.pop();if(c-h<=s){for(let i=h;i<=c;i++)jh(e[2*i],e[2*i+1],r,n)<=l&&a.push(t[i]);continue}const p=Math.floor((h+c)/2),f=e[2*p],d=e[2*p+1];jh(f,d,r,n)<=l&&a.push(t[p]);const y=(u+1)%2;(0===u?r-i<=f:n-i<=d)&&(o.push(h),o.push(p-1),o.push(y)),(0===u?r+i>=f:n+i>=d)&&(o.push(p+1),o.push(c),o.push(y))}return a}(this.ids,this.coords,t,e,r,this.nodeSize)}}const qh={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Uh=Math.fround||(Nh=new Float32Array(1),t=>(Nh[0]=+t,Nh[0]));var Nh;class Zh{constructor(t){this.options=Qh(Object.create(qh),t),this.trees=new Array(this.options.maxZoom+1)}load(t){const{log:e,minZoom:r,maxZoom:n,nodeSize:i}=this.options;e&&console.time("total time");const s=`prepare ${t.length} points`;e&&console.time(s),this.points=t;let o=[];for(let e=0;e<t.length;e++)t[e].geometry&&o.push(Gh(t[e],e));this.trees[n+1]=new Rh(o,tp,ep,i,Float32Array),e&&console.timeEnd(s);for(let t=n;t>=r;t--){const r=+Date.now();o=this._cluster(o,t),this.trees[t]=new Rh(o,tp,ep,i,Float32Array),e&&console.log("z%d: %d clusters in %dms",t,o.length,+Date.now()-r)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let i=180===t[2]?180:((t[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){const t=this.getClusters([r,n,180,s],e),o=this.getClusters([-180,n,i,s],e);return t.concat(o)}const o=this.trees[this._limitZoom(e)],a=o.range(Jh(r),Hh(s),Jh(i),Hh(n)),l=[];for(const t of a){const e=o.points[t];l.push(e.numPoints?Yh(e):this.points[e.index])}return l}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",i=this.trees[r];if(!i)throw new Error(n);const s=i.points[e];if(!s)throw new Error(n);const o=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=i.within(s.x,s.y,o),l=[];for(const e of a){const r=i.points[e];r.parentId===t&&l.push(r.numPoints?Yh(r):this.points[r.index])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,r){const n=[];return this._appendLeaves(n,t,e=e||10,r=r||0,0),n}getTile(t,e,r){const n=this.trees[this._limitZoom(t)],i=Math.pow(2,t),{extent:s,radius:o}=this.options,a=o/s,l=(r-a)/i,u=(r+1+a)/i,c={features:[]};return this._addTileFeatures(n.range((e-a)/i,l,(e+1+a)/i,u),n.points,e,r,i,c),0===e&&this._addTileFeatures(n.range(1-a/i,l,1,u),n.points,i,r,i,c),e===i-1&&this._addTileFeatures(n.range(0,l,a/i,u),n.points,-1,r,i,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,n,i){const s=this.getChildren(e);for(const e of s){const s=e.properties;if(s&&s.cluster?i+s.point_count<=n?i+=s.point_count:i=this._appendLeaves(t,s.cluster_id,r,n,i):i<n?i++:t.push(e),t.length===r)break}return i}_addTileFeatures(t,e,r,n,i,s){for(const o of t){const t=e[o],a=t.numPoints;let l,u,c;if(a)l=Kh(t),u=t.x,c=t.y;else{const e=this.points[t.index];l=e.properties,u=Jh(e.geometry.coordinates[0]),c=Hh(e.geometry.coordinates[1])}const h={type:1,geometry:[[Math.round(this.options.extent*(u*i-r)),Math.round(this.options.extent*(c*i-n))]],tags:l};let p;a?p=t.id:this.options.generateId?p=t.index:this.points[t.index].id&&(p=this.points[t.index].id),void 0!==p&&(h.id=p),s.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))}_cluster(t,e){const r=[],{radius:n,extent:i,reduce:s,minPoints:o}=this.options,a=n/(i*Math.pow(2,e));for(let n=0;n<t.length;n++){const i=t[n];if(i.zoom<=e)continue;i.zoom=e;const l=this.trees[e+1],u=l.within(i.x,i.y,a),c=i.numPoints||1;let h=c;for(const t of u){const r=l.points[t];r.zoom>e&&(h+=r.numPoints||1)}if(h>c&&h>=o){let t=i.x*c,o=i.y*c,a=s&&c>1?this._map(i,!0):null;const p=(n<<5)+(e+1)+this.points.length;for(const r of u){const n=l.points[r];if(n.zoom<=e)continue;n.zoom=e;const u=n.numPoints||1;t+=n.x*u,o+=n.y*u,n.parentId=p,s&&(a||(a=this._map(i,!0)),s(a,this._map(n)))}i.parentId=p,r.push(Xh(t/h,o/h,p,h,a))}else if(r.push(i),h>1)for(const t of u){const n=l.points[t];n.zoom<=e||(n.zoom=e,r.push(n))}}return r}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e){if(t.numPoints)return e?Qh({},t.properties):t.properties;const r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?Qh({},n):n}}function Xh(t,e,r,n,i){return{x:Uh(t),y:Uh(e),zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function Gh(t,e){const[r,n]=t.geometry.coordinates;return{x:Uh(Jh(r)),y:Uh(Hh(n)),zoom:1/0,index:e,parentId:-1}}function Yh(t){return{type:"Feature",id:t.id,properties:Kh(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),Wh(t.y)]}};var e}function Kh(t){const e=t.numPoints,r=e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?Math.round(e/100)/10+"k":e;return Qh(Qh({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function Jh(t){return t/360+.5}function Hh(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Wh(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Qh(t,e){for(const r in e)t[r]=e[r];return t}function tp(t){return t.x}function ep(t){return t.y}function rp(t,e,r,n){for(var i,s=n,o=r-e>>1,a=r-e,l=t[e],u=t[e+1],c=t[r],h=t[r+1],p=e+3;p<r;p+=3){var f=np(t[p],t[p+1],l,u,c,h);if(f>s)i=p,s=f;else if(f===s){var d=Math.abs(p-o);d<a&&(i=p,a=d)}}s>n&&(i-e>3&&rp(t,e,i,n),t[i+2]=s,r-i>3&&rp(t,i,r,n))}function np(t,e,r,n,i,s){var o=i-r,a=s-n;if(0!==o||0!==a){var l=((t-r)*o+(e-n)*a)/(o*o+a*a);l>1?(r=i,n=s):l>0&&(r+=o*l,n+=a*l)}return(o=t-r)*o+(a=e-n)*a}function ip(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)sp(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<e.length;n++)sp(t,e[n]);else if("MultiPolygon"===r)for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)sp(t,e[n][i])}(i),i}function sp(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function op(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,s=e.geometry.type,o=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),a=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),"Point"===s)ap(i,a);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)ap(i[u],a);else if("LineString"===s)lp(i,a,o,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(u=0;u<i.length;u++)lp(i[u],a=[],o,!1),t.push(ip(l,"LineString",a,e.properties));return}up(i,a,o,!1)}else if("Polygon"===s)up(i,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<e.geometry.geometries.length;u++)op(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<i.length;u++){var c=[];up(i[u],c,o,!0),a.push(c)}}t.push(ip(l,s,a,e.properties))}}function ap(t,e){e.push(cp(t[0])),e.push(hp(t[1])),e.push(0)}function lp(t,e,r,n){for(var i,s,o=0,a=0;a<t.length;a++){var l=cp(t[a][0]),u=hp(t[a][1]);e.push(l),e.push(u),e.push(0),a>0&&(o+=n?(i*u-l*s)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-s,2))),i=l,s=u}var c=e.length-3;e[2]=1,rp(e,0,c,r),e[c+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function up(t,e,r,n){for(var i=0;i<t.length;i++){var s=[];lp(t[i],s,r,n),e.push(s)}}function cp(t){return t/360+.5}function hp(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function pp(t,e,r,n,i,s,o,a){if(n/=e,s>=(r/=e)&&o<n)return t;if(o<r||s>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,f=0===i?c.minX:c.minY,d=0===i?c.maxX:c.maxY;if(f>=r&&d<n)l.push(c);else if(!(d<r||f>=n)){var y=[];if("Point"===p||"MultiPoint"===p)fp(h,y,r,n,i);else if("LineString"===p)dp(h,y,r,n,i,!1,a.lineMetrics);else if("MultiLineString"===p)mp(h,y,r,n,i,!1);else if("Polygon"===p)mp(h,y,r,n,i,!0);else if("MultiPolygon"===p)for(var m=0;m<h.length;m++){var g=[];mp(h[m],g,r,n,i,!0),g.length&&y.push(g)}if(y.length){if(a.lineMetrics&&"LineString"===p){for(m=0;m<y.length;m++)l.push(ip(c.id,p,y[m],c.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===y.length?(p="LineString",y=y[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===y.length?"Point":"MultiPoint"),l.push(ip(c.id,p,y,c.tags))}}}return l.length?l:null}function fp(t,e,r,n,i){for(var s=0;s<t.length;s+=3){var o=t[s+i];o>=r&&o<=n&&(e.push(t[s]),e.push(t[s+1]),e.push(t[s+2]))}}function dp(t,e,r,n,i,s,o){for(var a,l,u=yp(t),c=0===i?xp:vp,h=t.start,p=0;p<t.length-3;p+=3){var f=t[p],d=t[p+1],y=t[p+2],m=t[p+3],g=t[p+4],x=0===i?f:d,v=0===i?m:g,b=!1;o&&(a=Math.sqrt(Math.pow(f-m,2)+Math.pow(d-g,2))),x<r?v>r&&(l=c(u,f,d,m,g,r),o&&(u.start=h+a*l)):x>n?v<n&&(l=c(u,f,d,m,g,n),o&&(u.start=h+a*l)):gp(u,f,d,y),v<r&&x>=r&&(l=c(u,f,d,m,g,r),b=!0),v>n&&x<=n&&(l=c(u,f,d,m,g,n),b=!0),!s&&b&&(o&&(u.end=h+a*l),e.push(u),u=yp(t)),o&&(h+=a)}var w=t.length-3;f=t[w],d=t[w+1],y=t[w+2],(x=0===i?f:d)>=r&&x<=n&&gp(u,f,d,y),w=u.length-3,s&&w>=3&&(u[w]!==u[0]||u[w+1]!==u[1])&&gp(u,u[0],u[1],u[2]),u.length&&e.push(u)}function yp(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function mp(t,e,r,n,i,s){for(var o=0;o<t.length;o++)dp(t[o],e,r,n,i,s,!1)}function gp(t,e,r,n){t.push(e),t.push(r),t.push(n)}function xp(t,e,r,n,i,s){var o=(s-e)/(n-e);return t.push(s),t.push(r+(i-r)*o),t.push(1),o}function vp(t,e,r,n,i,s){var o=(s-r)/(i-r);return t.push(e+(n-e)*o),t.push(s),t.push(1),o}function bp(t,e){for(var r=[],n=0;n<t.length;n++){var i,s=t[n],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)i=wp(s.geometry,e);else if("MultiLineString"===o||"Polygon"===o){i=[];for(var a=0;a<s.geometry.length;a++)i.push(wp(s.geometry[a],e))}else if("MultiPolygon"===o)for(i=[],a=0;a<s.geometry.length;a++){for(var l=[],u=0;u<s.geometry[a].length;u++)l.push(wp(s.geometry[a][u],e));i.push(l)}r.push(ip(s.id,o,i,s.tags))}return r}function wp(t,e){var r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function _p(t,e){if(t.transformed)return t;var r,n,i,s=1<<t.z,o=t.x,a=t.y;for(r=0;r<t.features.length;r++){var l=t.features[r],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(Ap(u[n],u[n+1],e,s,o,a));else for(n=0;n<u.length;n++){var h=[];for(i=0;i<u[n].length;i+=2)h.push(Ap(u[n][i],u[n][i+1],e,s,o,a));l.geometry.push(h)}}return t.transformed=!0,t}function Ap(t,e,r,n,i,s){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-s))]}function Sp(t,e,r,n,i){for(var s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){o.numFeatures++,kp(o,t[a],s,i);var l=t[a].minX,u=t[a].minY,c=t[a].maxX,h=t[a].maxY;l<o.minX&&(o.minX=l),u<o.minY&&(o.minY=u),c>o.maxX&&(o.maxX=c),h>o.maxY&&(o.maxY=h)}return o}function kp(t,e,r,n){var i=e.geometry,s=e.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<i.length;a+=3)o.push(i[a]),o.push(i[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)Ip(o,i,t,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<i.length;a++)Ip(o,i[a],t,r,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var l=0;l<i.length;l++){var u=i[l];for(a=0;a<u.length;a++)Ip(o,u[a],t,r,!0,0===a)}if(o.length){var c=e.tags||null;if("LineString"===s&&n.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var p={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function Ip(t,e,r,n,i,s){var o=n*n;if(n>0&&e.size<(i?o:n))r.numPoints+=e.length/3;else{for(var a=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>o)&&(r.numSimplified++,a.push(e[l]),a.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,s=i-2;n<i;s=n,n+=2)r+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var o=t[n],a=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=o,t[i-1-n]=a}}(a,s),t.push(a)}}function zp(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)op(r,t.features[n],e,n);else op(r,"Feature"===t.type?t:{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(n=function(t,e){var r=e.buffer/e.extent,n=t,i=pp(t,1,-1-r,r,0,-1,2,e),s=pp(t,1,1-r,2+r,0,-1,2,e);return(i||s)&&(n=pp(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=bp(i,1).concat(n)),s&&(n=n.concat(bp(s,-1)))),n}(n,e)).length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Mp(t,e,r){return 32*((1<<t)*r+e)+t}function Pp(t,e){const r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);const n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return e(null,null);const i=new vh(n.features);let s=Sh(i);0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),e(null,{vectorTile:i,rawData:s.buffer})}zp.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},zp.prototype.splitTile=function(t,e,r,n,i,s,o){for(var a=[t,e,r,n],l=this.options,u=l.debug;a.length;){n=a.pop(),r=a.pop(),e=a.pop(),t=a.pop();var c=1<<e,h=Mp(e,r,n),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=Sp(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<<i-e;if(r!==Math.floor(s/d)||n!==Math.floor(o/d))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){u>1&&console.time("clipping");var y,m,g,x,v,b,w=.5*l.buffer/l.extent,_=.5-w,A=.5+w,S=1+w;y=m=g=x=null,v=pp(t,c,r-w,r+A,0,p.minX,p.maxX,l),b=pp(t,c,r+_,r+S,0,p.minX,p.maxX,l),t=null,v&&(y=pp(v,c,n-w,n+A,1,p.minY,p.maxY,l),m=pp(v,c,n+_,n+S,1,p.minY,p.maxY,l),v=null),b&&(g=pp(b,c,n-w,n+A,1,p.minY,p.maxY,l),x=pp(b,c,n+_,n+S,1,p.minY,p.maxY,l),b=null),u>1&&console.timeEnd("clipping"),a.push(y||[],e+1,2*r,2*n),a.push(m||[],e+1,2*r,2*n+1),a.push(g||[],e+1,2*r+1,2*n),a.push(x||[],e+1,2*r+1,2*n+1)}}},zp.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,s=n.debug;if(t<0||t>24)return null;var o=1<<t,a=Mp(t,e=(e%o+o)%o,r);if(this.tiles[a])return _p(this.tiles[a],i);s>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Mp(u,c,h)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,c,h),s>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,r),s>1&&console.timeEnd("drilling down"),this.tiles[a]?_p(this.tiles[a],i):null):null};class Cp extends hh{constructor(t,e,r,n,i){super(t,e,r,n,Pp),i&&(this.loadGeoJSON=i)}loadData(t,e){const r=t&&t.request,n=r&&r.collectResourceTiming;this.loadGeoJSON(t,((i,s)=>{if(i||!s)return e(i);if("object"!=typeof s)return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{dh(s,!0);try{if(t.filter){const e=ar(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const r=s.features.filter((t=>e.value.evaluate({zoom:0},t)));s={type:"FeatureCollection",features:r}}this._geoJSONIndex=t.cluster?new Zh(function({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;const r={},n={},i={accumulated:null,zoom:0},s={properties:null},o=Object.keys(e);for(const t of o){const[i,s]=e[t],o=ar(s),a=ar("string"==typeof i?[i,["accumulated"],["get",t]]:i);r[t]=o.value,n[t]=a.value}return t.map=t=>{s.properties=t;const e={};for(const t of o)e[t]=r[t].evaluate(i,s);return e},t.reduce=(t,e)=>{s.properties=e;for(const e of o)i.accumulated=t[e],t[e]=n[e].evaluate(i,s)},t}(t)).load(s.features):function(t,e){return new zp(t,e)}(s,t.geojsonVtOptions)}catch(i){return e(i)}this.loaded={};const o={};if(n){const e=Ar(r);e&&(o.resourceTiming={},o.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}e(null,o)}}))}reloadTile(t,e){const r=this.loaded;return r&&r[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}loadGeoJSON(t,e){if(t.request)!function(t,e){Pi(A(t,{type:"json"}),e)}(t.request,e);else{if("string"!=typeof t.data)return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return e(null,JSON.parse(t.data))}catch(r){return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}const Tp=a(new Float64Array(16));class Bp{constructor(t,e){this._tr=t,this._worldSize=e}createInversionMatrix(){return Tp}createTileMatrix(t){let e,r,n;const i=t.canonical,s=a(new Float64Array(16)),o=this._tr.projection;if(o.isReprojectedInTileSpace){const a=Uc(i,o);e=1,r=a.x+t.wrap*a.scale,n=a.y,l(s,s,[e/a.scale,e/a.scale,this._tr.pixelsPerMeter/this._worldSize])}else e=this._worldSize/this._tr.zoomScale(i.z),r=(i.x+Math.pow(2,i.z)*t.wrap)*e,n=i.y*e;return function(t,e,r){var n,i,s,o,a,l,u,c,h,p,f,d,y=r[0],m=r[1],g=r[2];e===t?(t[12]=e[0]*y+e[4]*m+e[8]*g+e[12],t[13]=e[1]*y+e[5]*m+e[9]*g+e[13],t[14]=e[2]*y+e[6]*m+e[10]*g+e[14],t[15]=e[3]*y+e[7]*m+e[11]*g+e[15]):(i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],t[0]=n=e[0],t[1]=i,t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=f,t[11]=d,t[12]=n*y+a*m+h*g+e[12],t[13]=i*y+l*m+p*g+e[13],t[14]=s*y+u*m+f*g+e[14],t[15]=o*y+c*m+d*g+e[15])}(s,s,[r,n,0]),l(s,s,[e/mo,e/mo,1]),s}pointCoordinate(t,e,n){const i=this._tr.horizonLineFromTop(!1),s=new r(t,Math.max(i,e));return this._tr.rayIntersectionCoordinate(this._tr.pointRayIntersection(s,n))}upVector(){return[0,0,1]}upVectorScale(){return 1}}var Vp={name:"albers",range:[4,7],center:[-96,37.5],parallels:[29.5,45.5],zAxisUnit:"meters",conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&y(this.parallels,this.constants.parallels))return;const t=Math.sin(x(this.parallels[0])),e=(t+Math.sin(x(this.parallels[1])))/2,r=1+t*(2*e-t),n=Math.sqrt(r)/e;this.constants={n:e,c:r,r0:n,parallels:this.parallels}},project(t,e){this.initializeConstants();const r=x(t-this.center[0]),n=x(e),{n:i,c:s,r0:o}=this.constants,a=Math.sqrt(s-2*i*Math.sin(n))/i;return{x:a*Math.sin(r*i),y:a*Math.cos(r*i)-o,z:0}},unproject(t,e){this.initializeConstants();const{n:r,c:n,r0:i}=this.constants,s=i+e;let o=Math.atan2(t,Math.abs(s))*Math.sign(s);s*r<0&&(o-=Math.PI*Math.sign(t)*Math.sign(s));const a=x(this.center[0])*r;o=w(o,-Math.PI-a,Math.PI-a);const l=v(o/r)+this.center[0],u=Math.asin(b((n-(t*t+s*s)*r*r)/(2*r),-1,1)),c=b(v(u),-85.051129,So);return new vo(l,c)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)};const Ep=1.340264,Dp=-.081106,Fp=893e-6,Lp=.003796,jp=Math.sqrt(3)/2;var $p={name:"equalEarth",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(t,e){e=e/180*Math.PI,t=t/180*Math.PI;const r=Math.asin(jp*Math.sin(e)),n=r*r,i=n*n*n;return{x:.5*(t*Math.cos(r)/(jp*(Ep+3*Dp*n+i*(7*Fp+9*Lp*n)))/Math.PI+.5),y:1-.5*(r*(Ep+Dp*n+i*(Fp+Lp*n))/Math.PI+1),z:0}},unproject(t,e){t=(2*t-.5)*Math.PI;let r=e=(2*(1-e)-1)*Math.PI,n=r*r,i=n*n*n;for(let t,s,o,a=0;a<12&&(s=r*(Ep+Dp*n+i*(Fp+Lp*n))-e,o=Ep+3*Dp*n+i*(7*Fp+9*Lp*n),t=s/o,r=b(r-t,-Math.PI/3,Math.PI/3),n=r*r,i=n*n*n,!(Math.abs(t)<1e-12));++a);const s=jp*t*(Ep+3*Dp*n+i*(7*Fp+9*Lp*n))/Math.cos(r),o=Math.asin(Math.sin(r)/jp),a=b(180*s/Math.PI,-180,180),l=b(180*o/Math.PI,-85.051129,So);return new vo(a,l)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)},Op={name:"equirectangular",supportsWorldCopies:!0,center:[0,0],range:[3.5,7],zAxisUnit:"meters",wrap:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project:(t,e)=>({x:.5+t/360,y:.5-e/360,z:0}),unproject(t,e){const r=360*(t-.5),n=b(360*(.5-e),-85.051129,So);return new vo(r,n)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)};const Rp=Math.PI/2;function qp(t){return Math.tan((Rp+t)/2)}var Up={name:"lambertConformalConic",range:[3.5,7],zAxisUnit:"meters",center:[0,30],parallels:[30,30],conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&y(this.parallels,this.constants.parallels))return;const t=x(this.parallels[0]),e=x(this.parallels[1]),r=Math.cos(t),n=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(qp(e)/qp(t)),i=r*Math.pow(qp(t),n)/n;this.constants={n:n,f:i,parallels:this.parallels}},project(t,e){this.initializeConstants(),e=x(e),t=x(t-this.center[0]);const r=1e-6,{n:n,f:i}=this.constants;i>0?e<-Rp+r&&(e=-Rp+r):e>Rp-r&&(e=Rp-r);const s=i/Math.pow(qp(e),n),o=s*Math.sin(n*t),a=i-s*Math.cos(n*t);return{x:.5*(o/Math.PI+.5),y:1-.5*(a/Math.PI+.5),z:0}},unproject(t,e){this.initializeConstants(),t=(2*t-.5)*Math.PI,e=(2*(1-e)-.5)*Math.PI;const{n:r,f:n}=this.constants,i=n-e,s=Math.sign(i),o=Math.sign(r)*Math.sqrt(t*t+i*i);let a=Math.atan2(t,Math.abs(i))*s;i*r<0&&(a-=Math.PI*Math.sign(t)*s);const l=b(v(a/r)+this.center[0],-180,180),u=b(v(2*Math.atan(Math.pow(n/o,1/r))-Rp),-85.051129,So);return new vo(l,u)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)},Np={name:"mercator",wrap:!0,requiresDraping:!1,supportsWorldCopies:!0,supportsTerrain:!0,supportsFog:!0,supportsFreeCamera:!0,zAxisUnit:"meters",center:[0,0],project:(t,e)=>({x:function(t){return(180+t)/360}(t),y:function(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}(e),z:0}),unproject(t,e){const r=_o(t),n=Ao(e);return new vo(r,n)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)};const Zp=x(So);var Xp={name:"naturalEarth",center:[0,0],range:[3.5,7],isReprojectedInTileSpace:!0,zAxisUnit:"meters",unsupportedLayers:["custom"],project(t,e){const r=(e=x(e))*e,n=r*r;return{x:.5*((t=x(t))*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))/Math.PI+1),z:0}},unproject(t,e){t=(2*t-.5)*Math.PI;let r=e=(2*(1-e)-1)*Math.PI,n=25,i=0,s=r*r;do{s=r*r;const t=s*s;i=(r*(1.007226+s*(.015085+t*(.028874*s-.044475-.005916*t)))-e)/(1.007226+s*(.045255+t*(.259866*s-.311325-.005916*11*t))),r=b(r-i,-Zp,Zp)}while(Math.abs(i)>1e-6&&--n>0);s=r*r;const o=b(v(t/(.8707+s*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))),-180,180),a=v(r);return new vo(o,a)},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)};const Gp=x(So),Yp={albers:Vp,equalEarth:$p,equirectangular:Op,lambertConformalConic:Up,mercator:Np,naturalEarth:Xp,winkelTripel:{name:"winkelTripel",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(t,e){e=x(e),t=x(t);const r=Math.cos(e),n=2/Math.PI,i=Math.acos(r*Math.cos(t/2)),s=Math.sin(i)/i,o=.5*(t*n+2*r*Math.sin(t/2)/s)||0,a=.5*(e+Math.sin(e)/s)||0;return{x:.5*(o/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}},unproject(t,e){let r=t=(2*t-.5)*Math.PI,n=e=(2*(1-e)-1)*Math.PI,i=25;const s=1e-6;let o=0,a=0;do{const i=Math.cos(n),s=Math.sin(n),l=2*s*i,u=s*s,c=i*i,h=Math.cos(r/2),p=Math.sin(r/2),f=2*h*p,d=p*p,y=1-c*h*h,m=y?1/y:0,g=y?Math.acos(i*h)*Math.sqrt(1/y):0,x=.5*(2*g*i*p+2*r/Math.PI)-t,v=.5*(g*s+n)-e,w=.5*m*(c*d+g*i*h*u)+1/Math.PI,_=m*(f*l/4-g*s*p),A=.125*m*(l*p-g*s*c*f),S=.5*m*(u*h+g*d*i)+.5,k=_*A-S*w;o=(v*_-x*S)/k,a=(x*A-v*w)/k,r=b(r-o,-Math.PI,Math.PI),n=b(n-a,-Gp,Gp)}while((Math.abs(o)>s||Math.abs(a)>s)&&--i>0);return new vo(v(r),v(n))},projectTilePoint:(t,e)=>({x:t,y:e,z:0}),locationPoint:(t,e)=>t._coordinatePoint(t.locationCoordinate(e),!1),pixelsPerMeter:(t,e)=>wo(1,t)*e,farthestPixelDistance(t){return $c(t,this.pixelsPerMeter(t.center.lat,t.worldSize))},createTileTransform:(t,e)=>new Bp(t,e)}};function Kp(t){const e=Yp[t.name];if(!e)throw new Error(`Invalid projection name: ${t.name}`);return e.conic?function(t,e){if(e.parallels&&Math.abs(e.parallels[0]+e.parallels[1])<.01){let r=function(t){const e=Math.max(.01,Math.cos(x(t))),r=1/(2*Math.max(Math.PI*e,1/e));return{wrap:!0,supportsWorldCopies:!0,unsupportedLayers:["custom"],project(t,n){const i=x(t)*e,s=Math.sin(x(n))/e;return{x:i*r+.5,y:-s*r+.5,z:0}},unproject(t,n){const i=-(n-.5)/r,s=b(v((t-.5)/r)/e,-180,180),o=Math.asin(b(i*e,-1,1)),a=b(v(o),-85.051129,So);return new vo(s,a)}}}(e.parallels[0]);if("lambertConformalConic"===e.name){const{project:t,unproject:e}=Yp.mercator;r={wrap:!0,supportsWorldCopies:!0,project:t,unproject:e}}return A({},t,e,r)}return A({},t,e)}(e,t):e}class Jp{constructor(t){this.self=t,this.actor=new kr(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=Kp({name:"mercator"}),this.workerSourceTypes={vector:hh,geojson:Cp},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=t=>{if(Ei.isParsed())throw new Error("RTL text plugin already registered.");Ei.applyArabicShaping=t.applyArabicShaping,Ei.processBidirectionalText=t.processBidirectionalText,Ei.processStyledBidirectionalText=t.processStyledBidirectionalText}}clearCaches(t,e,r){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],r()}checkIfReady(t,e,r){r()}setReferrer(t,e){this.referrer=e}spriteLoaded(t,e){this.isSpriteLoaded[t]=e;for(const r in this.workerSources[t]){const n=this.workerSources[t][r];for(const t in n)n[t]instanceof hh&&(n[t].isSpriteLoaded=e,n[t].fire(new xn("isSpriteLoaded")))}}setImages(t,e,r){this.availableImages[t]=e;for(const r in this.workerSources[t]){const n=this.workerSources[t][r];for(const t in n)n[t].availableImages=e}r()}enableTerrain(t,e,r){this.terrain=e,r()}setProjection(t,e){this.projections[t]=Kp(e)}setLayers(t,e,r){this.getLayerIndex(t).replace(e),r()}updateLayers(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()}loadTile(t,e,r){const n=this.enableTerrain?A({enableTerrain:this.terrain},e):e;n.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,e.type,e.source).loadTile(n,r)}loadDEMTile(t,e,r){const n=this.enableTerrain?A({buildQuadTree:this.terrain},e):e;this.getDEMWorkerSource(t,e.source).loadTile(n,r)}reloadTile(t,e,r){const n=this.enableTerrain?A({enableTerrain:this.terrain},e):e;n.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,e.type,e.source).reloadTile(n,r)}abortTile(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)}removeTile(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)}removeSource(t,e,r){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}loadWorkerSource(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}}syncRTLPluginState(t,e,r){try{Ei.setState(e);const t=Ei.getPluginURL();if(Ei.isLoaded()&&!Ei.isParsed()&&null!=t){this.self.importScripts(t);const e=Ei.isParsed();r(e?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),e)}}catch(t){r(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new Tc),e}getWorkerSource(t,e,r){return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][r]||(this.workerSources[t][e][r]=new this.workerSourceTypes[e]({send:(e,r,n,i,s,o)=>{this.actor.send(e,r,n,t,s,o)},scheduler:this.actor.scheduler},this.getLayerIndex(t),this.getAvailableImages(t),this.isSpriteLoaded[t])),this.workerSources[t][e][r]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new fh),this.demWorkerSources[t][e]}enforceCacheSizeLimit(t,e){!function(t){ki(),Ai&&Ai.then((e=>{e.keys().then((r=>{for(let n=0;n<r.length-t;n++)e.delete(r[n])}))}))}(e)}getWorkerPerformanceMetrics(t,e,r){r(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new Jp(self)),Jp}();
2
2
  //# sourceMappingURL=mapbox-gl-csp-worker.js.map