mapbox-gl 2.10.0-beta.1 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -6
- package/dist/mapbox-gl-csp-worker.js +1 -1
- package/dist/mapbox-gl-csp-worker.js.map +1 -1
- package/dist/mapbox-gl-csp.js +1 -1
- package/dist/mapbox-gl-csp.js.map +1 -1
- package/dist/mapbox-gl-dev.js +1 -1
- package/dist/mapbox-gl-unminified.js +1 -1
- package/dist/mapbox-gl.js +1 -1
- package/dist/mapbox-gl.js.map +1 -1
- package/package.json +1 -1
- package/src/style-spec/CHANGELOG.md +9 -0
- package/src/style-spec/package.json +1 -1
|
@@ -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,a;for(void 0===e&&(e=1e-6),i=t,a=0;a<8;a++){if(s=this.sampleCurveX(i)-t,Math.abs(s)<e)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=s/o}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="undefined"!=typeof self?self:{};const s=Math.PI/180,a=180/Math.PI;function o(t){return t*s}function l(t){return t*a}function u(t,e,r){return Math.min(r,Math.max(e,t))}function c(t,e,r){const n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function h(t){const e=[];for(const r in t)e.push(t[r]);return e}function p(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}new t(.25,.1,.25,1);let d=1;function f(){return function t(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function y(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 m(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}function g(t,e){return-1!==t.indexOf(e,t.length-e.length)}function x(t,e,r){const n={};for(const i in t)n[i]=e.call(r||this,t[i],i,t);return n}function v(t){return Array.isArray(t)?t.map(v):"object"==typeof t&&t?x(t,v):t}const b={};function _(t){b[t]||("undefined"!=typeof console&&console.warn(t),b[t]=!0)}function w(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function S(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i<s;a=i++)r=t[i],n=t[a],e+=(n.x-r.x)*(r.y+n.y);return e}function A(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function k(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 I=null;function M(t){if(null==I){const e=t.navigator?t.navigator.userAgent:null;I=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return I}function P(t){try{const e=i[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}function C(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}var T=z;function z(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 a=i[3+s],o=i[3+s+1];n.push(a===o?null:i.subarray(a,o))}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 E(t){var e={exports:{}};return t(e,e.exports),e.exports}z.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)},z.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},z.prototype._insertCell=function(t,e,r,n,i,s){this.cells[i].push(s)},z.prototype.query=function(t,e,r,n,i){var s=this.min,a=this.max;if(t<=s&&e<=s&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);var o=[];return this._forEachCell(t,e,r,n,this._queryCell,o,{},i),o},z.prototype._queryCell=function(t,e,r,n,i,s,a,o){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===a[p]){var d=4*p;(o?o(c[d+0],c[d+1],c[d+2],c[d+3]):t<=c[d+2]&&e<=c[d+3]&&r>=c[d+0]&&n>=c[d+1])?(a[p]=!0,s.push(u[p])):a[p]=!1}}},z.prototype._forEachCell=function(t,e,r,n,i,s,a,o){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 d=u;d<=h;d++){var f=this.d*d+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&i.call(this,t,e,r,n,f,s,a,o))return}},z.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},z.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},z.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,a=0;a<t.length;a++){var o=t[a];i[3+a]=s,i.set(o,s),s+=o.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 D=E((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 a(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,o=t.replace(/ /g,"").toLowerCase();if(o in r)return r[o].slice();if("#"===o[0])return 4===o.length?(e=parseInt(o.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===o.length&&(e=parseInt(o.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=o.indexOf("("),u=o.indexOf(")");if(-1!==l&&u+1===o.length){var c=o.substr(0,l),h=o.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 d=(parseFloat(h[0])%360+360)%360/360,f=s(h[1]),y=s(h[2]),m=y<=.5?y*(f+1):y+f-y*f,g=2*y-m;return[n(255*a(g,m,d+1/3)),n(255*a(g,m,d)),n(255*a(g,m,d-1/3)),p];default:return null}}return null}}catch(t){}}));class Color{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 Color)return t;if("string"!=typeof t)return;const e=D.parseCSSColor(t);return e?new Color(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]}toArray01(){const{r:t,g:e,b:r,a:n}=this;return 0===n?[0,0,0,0]:[t/n,e/n,r/n,n]}toArray01PremultipliedAlpha(){const{r:t,g:e,b:r,a:n}=this;return[t,e,r,n]}}Color.black=new Color(0,0,0,1),Color.white=new Color(1,1,1,1),Color.transparent=new Color(0,0,0,0),Color.red=new Color(1,0,0,1),Color.blue=new Color(0,0,1,1);var B=Color;function L(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}class ParsingError extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}var V=ParsingError;class Scope{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new Scope(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)}}var F=Scope;const R={kind:"null"},j={kind:"number"},O={kind:"string"},U={kind:"boolean"},$={kind:"color"},q={kind:"object"},N={kind:"value"},Z={kind:"collator"},G={kind:"formatted"},X={kind:"resolvedImage"};function Y(t,e){return{kind:"array",itemType:t,N:e}}function J(t){if("array"===t.kind){const e=J(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const K=[R,j,O,U,$,G,q,Y(N),X];function W(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!W(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 K)if(!W(t,e))return null}return`Expected ${J(t)} but found ${J(e)} instead.`}function H(t,e){return e.some((e=>e.kind===t.kind))}function Q(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 Collator{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 FormattedSection{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 Formatted{constructor(t){this.sections=t}static fromString(t){return new Formatted([new FormattedSection(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 Formatted?t:Formatted.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 ResolvedImage{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new ResolvedImage({name:t,available:!1}):null}serialize(){return["image",this.name]}}function tt(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 et(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 B)return!0;if(t instanceof Collator)return!0;if(t instanceof Formatted)return!0;if(t instanceof ResolvedImage)return!0;if(Array.isArray(t)){for(const e of t)if(!et(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!et(t[e]))return!1;return!0}return!1}function rt(t){if(null===t)return R;if("string"==typeof t)return O;if("boolean"==typeof t)return U;if("number"==typeof t)return j;if(t instanceof B)return $;if(t instanceof Collator)return Z;if(t instanceof Formatted)return G;if(t instanceof ResolvedImage)return X;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=rt(e);if(r){if(r===t)continue;r=N;break}r=t}return Y(r||N,e)}return q}function nt(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof B||t instanceof Formatted||t instanceof ResolvedImage?t.toString():JSON.stringify(t)}class Literal{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(!et(t[1]))return e.error("invalid value");const r=t[1];let n=rt(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 Literal(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 B?["rgba"].concat(this.value.toArray()):this.value instanceof Formatted?this.value.serialize():this.value}}var it=Literal,st=class RuntimeError{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const at={string:O,number:j,boolean:U,object:q};class Assertion{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in at)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=at[r],n++}else i=N;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=Y(i,s)}else r=at[i];const s=[];for(;n<t.length;n++){const r=e.parse(t[n],n,N);if(!r)return null;s.push(r)}return new Assertion(r,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!W(this.type,rt(r)))return r;if(e===this.args.length-1)throw new st(`Expected value to be of type ${J(this.type)}, but found ${J(rt(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())))}}var ot=Assertion;class FormatExpression{constructor(t){this.type=G,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,j),!t))return null;let r=null;if(s["text-font"]&&(r=e.parse(s["text-font"],1,Y(O)),!r))return null;let a=null;if(s["text-color"]&&(a=e.parse(s["text-color"],1,$),!a))return null;const o=n[n.length-1];o.scale=t,o.font=r,o.textColor=a}else{const s=e.parse(t[r],1,N);if(!s)return null;const a=s.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new FormatExpression(n)}evaluate(t){return new Formatted(this.sections.map((e=>{const r=e.content.evaluate(t);return rt(r)===X?new FormattedSection("",r,null,null,null):new FormattedSection(nt(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 ImageExpression{constructor(t){this.type=X,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,O);return r?new ImageExpression(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=ResolvedImage.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 lt={"to-boolean":U,"to-color":$,"to-number":j,"to-string":O};class Coercion{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=lt[r],i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],r,N);if(!n)return null;i.push(n)}return new Coercion(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 B)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.`:tt(e[0],e[1],e[2],e[3]),!r))return new B(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new st(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 st(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?Formatted.fromString(nt(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?ResolvedImage.fromString(nt(this.args[0].evaluate(t))):nt(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 FormatExpression([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ImageExpression(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}var ut=Coercion;const ct=["Unknown","Point","LineString","Polygon"];var ht=class EvaluationContext{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&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?ct[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}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]=B.parse(t)),e}};class CompoundExpression{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=CompoundExpression.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let o=null;for(const[n,s]of a){o=new Lt(e.registry,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const r=t[e],i=Array.isArray(n)?n[e-1]:n.type,s=o.parse(r,1+a.length,i);if(!s){l=!0;break}a.push(s)}if(!l)if(Array.isArray(n)&&n.length!==a.length)o.error(`Expected ${n.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=a[t];o.concat(t+1).checkSubtype(e,r.type)}if(0===o.errors.length)return new CompoundExpression(r,i,s,a)}}if(1===a.length)e.errors.push(...o.errors);else{const r=(a.length?a:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(J).join(", ")})`:`(${J(e.type)}...)`;var e})).join(" | "),n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],1+n.length);if(!i)return null;n.push(J(i.type))}e.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){CompoundExpression.definitions=e;for(const r in e)t[r]=CompoundExpression}}var pt=CompoundExpression;class CollatorExpression{constructor(t,e,r){this.type=Z,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,U);if(!n)return null;const i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,U);if(!i)return null;let s=null;return r.locale&&(s=e.parse(r.locale,1,O),!s)?null:new CollatorExpression(n,i,s)}evaluate(t){return new Collator(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 dt=8192;function ft(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function yt(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function mt(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*dt),Math.round(n*i*dt)]}function gt(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],a=t[1]-r[1];return n*a-s*i==0&&n*s<=0&&i*a<=0}function xt(t,e){let r=!1;for(let a=0,o=e.length;a<o;a++){const o=e[a];for(let e=0,a=o.length;e<a-1;e++){if(gt(t,o[e],o[e+1]))return!1;(i=o[e])[1]>(n=t)[1]!=(s=o[e+1])[1]>n[1]&&n[0]<(s[0]-i[0])*(n[1]-i[1])/(s[1]-i[1])+i[0]&&(r=!r)}}var n,i,s;return r}function vt(t,e){for(let r=0;r<e.length;r++)if(xt(t,e[r]))return!0;return!1}function bt(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],a=(t[0]-r[0])*s-i*(t[1]-r[1]),o=(e[0]-r[0])*s-i*(e[1]-r[1]);return a>0&&o<0||a<0&&o>0}function _t(t,e,r){for(const u of r)for(let r=0;r<u.length-1;++r)if(0!=(o=[(a=u[r+1])[0]-(s=u[r])[0],a[1]-s[1]])[0]*(l=[(i=e)[0]-(n=t)[0],i[1]-n[1]])[1]-o[1]*l[0]&&bt(n,i,s,a)&&bt(s,a,n,i))return!0;var n,i,s,a,o,l;return!1}function wt(t,e){for(let r=0;r<t.length;++r)if(!xt(t[r],e))return!1;for(let r=0;r<t.length-1;++r)if(_t(t[r],t[r+1],e))return!1;return!0}function St(t,e){for(let r=0;r<e.length;r++)if(wt(t,e[r]))return!0;return!1}function kt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=[];for(let n=0;n<t[i].length;n++){const a=mt(t[i][n],r);ft(e,a),s.push(a)}n.push(s)}return n}function It(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=kt(t[i],e,r);n.push(s)}return n}function Mt(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i}ft(e,t)}function Pt(t,e,r,n){const i=Math.pow(2,n.z)*dt,s=[n.x*dt,n.y*dt],a=[];if(!t)return a;for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];Mt(n,e,r,i),a.push(n)}return a}function Ct(t,e,r,n){const i=Math.pow(2,n.z)*dt,s=[n.x*dt,n.y*dt],a=[];if(!t)return a;for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];ft(e,r),t.push(r)}a.push(t)}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of a)for(const n of t)Mt(n,e,r,i)}var o;return a}class Within{constructor(t,e){this.type=U,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(et(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 Within(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Within(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Within(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(!i)return!1;if("Polygon"===e.type){const s=kt(e.coordinates,n,i),a=Pt(t.geometry(),r,n,i);if(!yt(r,n))return!1;for(const t of a)if(!xt(t,s))return!1}if("MultiPolygon"===e.type){const s=It(e.coordinates,n,i),a=Pt(t.geometry(),r,n,i);if(!yt(r,n))return!1;for(const t of a)if(!vt(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(!i)return!1;if("Polygon"===e.type){const s=kt(e.coordinates,n,i),a=Ct(t.geometry(),r,n,i);if(!yt(r,n))return!1;for(const t of a)if(!wt(t,s))return!1}if("MultiPolygon"===e.type){const s=It(e.coordinates,n,i),a=Ct(t.geometry(),r,n,i);if(!yt(r,n))return!1;for(const t of a)if(!St(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var Tt=Within;function zt(t){if(t instanceof pt){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 Tt)return!1;let e=!0;return t.eachChild((t=>{e&&!zt(t)&&(e=!1)})),e}function Et(t){if(t instanceof pt&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Et(t)&&(e=!1)})),e}function Dt(t,e){if(t instanceof pt&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!Dt(t,e)&&(r=!1)})),r}class Var{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 Var(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]}}var Bt=Var;class ParsingContext{constructor(t,e=[],r,n=new F,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 ot(e,[t]):"coerce"===r?new ut(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 it)&&"resolvedImage"!==n.type.kind&&Vt(n)){const t=new ht;try{n=new it(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 ParsingContext(this.registry,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new V(r,t))}checkSubtype(t,e){const r=W(t,e);return r&&this.error(r),r}}var Lt=ParsingContext;function Vt(t){if(t instanceof Bt)return Vt(t.boundExpression);if(t instanceof pt&&"error"===t.name)return!1;if(t instanceof CollatorExpression)return!1;if(t instanceof Tt)return!1;const e=t instanceof ut||t instanceof ot;let r=!0;return t.eachChild((t=>{r=e?r&&Vt(t):r&&t instanceof it})),!!r&&zt(t)&&Dt(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function Ft(t,e){const r=t.length-1;let n,i,s=0,a=r,o=0;for(;s<=a;)if(o=Math.floor((s+a)/2),n=t[o],i=t[o+1],n<=e){if(o===r||e<i)return o;s=o+1}else{if(!(n>e))throw new st("Input is not a number.");a=o-1}return 0}class Step{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,j);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r<t.length;r+=2){const s=1===r?-1/0:t[r],a=t[r+1],o=r,l=r+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,n.push([s,u])}return new Step(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[Ft(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}}var Rt=Step;function jt(t,e,r){return t*(1-r)+e*r}function Ot(t,e,r){return t.map(((t,n)=>jt(t,e[n],r)))}var Ut=Object.freeze({__proto__:null,number:jt,color:function(t,e,r){return new B(jt(t.r,e.r,r),jt(t.g,e.g,r),jt(t.b,e.b,r),jt(t.a,e.a,r))},array:Ot});const $t=.95047,qt=1.08883,Nt=4/29,Zt=6/29,Gt=3*Zt*Zt,Xt=Math.PI/180,Yt=180/Math.PI;function Jt(t){return t>.008856451679035631?Math.pow(t,1/3):t/Gt+Nt}function Kt(t){return t>Zt?t*t*t:Gt*(t-Nt)}function Wt(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Ht(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Qt(t){const e=Ht(t.r),r=Ht(t.g),n=Ht(t.b),i=Jt((.4124564*e+.3575761*r+.1804375*n)/$t),s=Jt((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-Jt((.0193339*e+.119192*r+.9503041*n)/qt)),alpha:t.a}}function te(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*Kt(e),r=$t*Kt(r),n=qt*Kt(n),new B(Wt(3.2404542*r-1.5371385*e-.4985314*n),Wt(-.969266*r+1.8760108*e+.041556*n),Wt(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function ee(t,e,r){const n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const re={forward:Qt,reverse:te,interpolate:function(t,e,r){return{l:jt(t.l,e.l,r),a:jt(t.a,e.a,r),b:jt(t.b,e.b,r),alpha:jt(t.alpha,e.alpha,r)}}},ne={forward:function(t){const{l:e,a:r,b:n}=Qt(t),i=Math.atan2(n,r)*Yt;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*Xt,r=t.c;return te({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:ee(t.h,e.h,r),c:jt(t.c,e.c,r),l:jt(t.l,e.l,r),alpha:jt(t.alpha,e.alpha,r)}}};var ie=Object.freeze({__proto__:null,lab:re,hcl:ne});class Interpolate{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=se(r,e.base,n,i);else if("linear"===e.name)s=se(r,1,n,i);else if("cubic-bezier"===e.name){const a=e.controlPoints;s=new t(a[0],a[1],a[2],a[3]).solve(se(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,j),!i)return null;const a=[];let o=null;"interpolate-hcl"===r||"interpolate-lab"===r?o=$:e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t<s.length;t+=2){const r=s[t],n=s[t+1],i=t+3,l=t+4;if("number"!=typeof r)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,a.push([r,u])}return"number"===o.kind||"color"===o.kind||"array"===o.kind&&"number"===o.itemType.kind&&"number"==typeof o.N?new Interpolate(o,r,n,i,a):e.error(`Type ${J(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=Ft(e,n),a=Interpolate.interpolationFactor(this.interpolation,n,e[s],e[s+1]),o=r[s].evaluate(t),l=r[s+1].evaluate(t);return"interpolate"===this.operator?Ut[this.type.kind.toLowerCase()](o,l,a):"interpolate-hcl"===this.operator?ne.reverse(ne.interpolate(ne.forward(o),ne.forward(l),a)):re.reverse(re.interpolate(re.forward(o),re.forward(l),a))}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 se(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)}var ae=Interpolate;class Coalesce{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=>W(n,t.type)));return new Coalesce(s?N:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args){if(n++,r=i.evaluate(t),r&&r instanceof ResolvedImage&&!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}}var oe=Coalesce;class Let{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 Let(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}}var le=Let;class At{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,j),n=e.parse(t[2],2,Y(e.expectedType||N));return r&&n?new At(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new st(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new st(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new st(`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()]}}var ue=At;class In{constructor(t,e){this.type=U,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,N),n=e.parse(t[2],2,N);return r&&n?H(r.type,[U,O,j,R,N])?new In(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${J(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(null==r)return!1;if(!Q(e,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${J(rt(e))} instead.`);if(!Q(r,["string","array"]))throw new st(`Expected second argument to be of type array or string, but found ${J(rt(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()]}}var ce=In;class IndexOf{constructor(t,e,r){this.type=j,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,N),n=e.parse(t[2],2,N);if(!r||!n)return null;if(!H(r.type,[U,O,j,R,N]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${J(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,j);return i?new IndexOf(r,n,i):null}return new IndexOf(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Q(e,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${J(rt(e))} instead.`);if(!Q(r,["string","array"]))throw new st(`Expected second argument to be of type array or string, but found ${J(rt(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()]}}var he=IndexOf;class Match{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let a=2;a<t.length-1;a+=2){let o=t[a];const l=t[a+1];Array.isArray(o)||(o=[o]);const u=e.concat(a);if(0===o.length)return u.error("Expected at least one branch label.");for(const t of o){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,rt(t)))return null}else r=rt(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,s.push(c)}const a=e.parse(t[1],1,N);if(!a)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new Match(r,n,a,i,s,o):null}evaluate(t){const e=this.input.evaluate(t);return(rt(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}}var pe=Match;class Case{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,U);if(!s)return null;const a=e.parse(t[i+1],i+1,r);if(!a)return null;n.push([s,a]),r=r||a.type}const i=e.parse(t[t.length-1],t.length-1,r);return i?new Case(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}}var de=Case;class Slice{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,N),n=e.parse(t[2],2,j);if(!r||!n)return null;if(!H(r.type,[Y(N),O,N]))return e.error(`Expected first argument to be of type array or string, but found ${J(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,j);return i?new Slice(r.type,r,n,i):null}return new Slice(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Q(e,["string","array"]))throw new st(`Expected first argument to be of type array or string, but found ${J(rt(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()]}}var fe=Slice;function ye(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 me(t,e,r,n){return 0===n.compare(e,r)}function ge(t,e,r){const n="=="!==t&&"!="!==t;return class Comparison{constructor(t,e,r){this.type=U,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 i=e.parse(t[1],1,N);if(!i)return null;if(!ye(r,i.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${J(i.type)}'.`);let s=e.parse(t[2],2,N);if(!s)return null;if(!ye(r,s.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${J(s.type)}'.`);if(i.type.kind!==s.type.kind&&"value"!==i.type.kind&&"value"!==s.type.kind)return e.error(`Cannot compare types '${J(i.type)}' and '${J(s.type)}'.`);n&&("value"===i.type.kind&&"value"!==s.type.kind?i=new ot(s.type,[i]):"value"!==i.type.kind&&"value"===s.type.kind&&(s=new ot(i.type,[s])));let a=null;if(4===t.length){if("string"!==i.type.kind&&"string"!==s.type.kind&&"value"!==i.type.kind&&"value"!==s.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,Z),!a)return null}return new Comparison(i,s,a)}evaluate(i){const s=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=rt(s),r=rt(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new st(`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=rt(s),r=rt(a);if("string"!==t.kind||"string"!==r.kind)return e(i,s,a)}return this.collator?r(i,s,a,this.collator.evaluate(i)):e(i,s,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const xe=ge("==",(function(t,e,r){return e===r}),me),ve=ge("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!me(0,e,r,n)})),be=ge("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),_e=ge(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),we=ge("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Se=ge(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class NumberFormat{constructor(t,e,r,n,i,s){this.type=O,this.number=t,this.locale=e,this.currency=r,this.unit=n,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,j);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,O),!i))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,O),!s))return null;let a=null;if(n.unit&&(a=e.parse(n.unit,1,O),!a))return null;let o=null;if(n["min-fraction-digits"]&&(o=e.parse(n["min-fraction-digits"],1,j),!o))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,j),!l)?null:new NumberFormat(r,i,s,a,o,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.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 Length{constructor(t){this.type=j,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${J(r.type)} instead.`):new Length(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 st(`Expected value to be of type string or array, but found ${J(rt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const Ae={"==":xe,"!=":ve,">":_e,"<":be,">=":Se,"<=":we,array:ot,at:ue,boolean:ot,case:de,coalesce:oe,collator:CollatorExpression,format:FormatExpression,image:ImageExpression,in:ce,"index-of":he,interpolate:ae,"interpolate-hcl":ae,"interpolate-lab":ae,length:Length,let:le,literal:it,match:pe,number:ot,"number-format":NumberFormat,object:ot,slice:fe,step:Rt,string:ot,"to-boolean":ut,"to-color":ut,"to-number":ut,"to-string":ut,var:Bt,within:Tt};function ke(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=tt(e,r,n,s);if(a)throw new st(a);return new B(e/255*s,r/255*s,n/255*s,s)}function Ie(t,e){return t in e}function Me(t,e){const r=e[t];return void 0===r?null:r}function Pe(t){return{type:t}}pt.register(Ae,{error:[{kind:"error"},[O],(t,[e])=>{throw new st(e.evaluate(t))}],typeof:[O,[N],(t,[e])=>J(rt(e.evaluate(t)))],"to-rgba":[Y(j,4),[$],(t,[e])=>e.evaluate(t).toArray()],rgb:[$,[j,j,j],ke],rgba:[$,[j,j,j,j],ke],has:{type:U,overloads:[[[O],(t,[e])=>Ie(e.evaluate(t),t.properties())],[[O,q],(t,[e,r])=>Ie(e.evaluate(t),r.evaluate(t))]]},get:{type:N,overloads:[[[O],(t,[e])=>Me(e.evaluate(t),t.properties())],[[O,q],(t,[e,r])=>Me(e.evaluate(t),r.evaluate(t))]]},"feature-state":[N,[O],(t,[e])=>Me(e.evaluate(t),t.featureState||{})],properties:[q,[],t=>t.properties()],"geometry-type":[O,[],t=>t.geometryType()],id:[N,[],t=>t.id()],zoom:[j,[],t=>t.globals.zoom],pitch:[j,[],t=>t.globals.pitch||0],"distance-from-center":[j,[],t=>t.distanceFromCenter()],"heatmap-density":[j,[],t=>t.globals.heatmapDensity||0],"line-progress":[j,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[j,[],t=>t.globals.skyRadialProgress||0],accumulated:[N,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[j,Pe(j),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[j,Pe(j),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:j,overloads:[[[j,j],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[j],(t,[e])=>-e.evaluate(t)]]},"/":[j,[j,j],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[j,[j,j],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[j,[],()=>Math.LN2],pi:[j,[],()=>Math.PI],e:[j,[],()=>Math.E],"^":[j,[j,j],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[j,[j],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[j,[j],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[j,[j],(t,[e])=>Math.log(e.evaluate(t))],log2:[j,[j],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[j,[j],(t,[e])=>Math.sin(e.evaluate(t))],cos:[j,[j],(t,[e])=>Math.cos(e.evaluate(t))],tan:[j,[j],(t,[e])=>Math.tan(e.evaluate(t))],asin:[j,[j],(t,[e])=>Math.asin(e.evaluate(t))],acos:[j,[j],(t,[e])=>Math.acos(e.evaluate(t))],atan:[j,[j],(t,[e])=>Math.atan(e.evaluate(t))],min:[j,Pe(j),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[j,Pe(j),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[j,[j],(t,[e])=>Math.abs(e.evaluate(t))],round:[j,[j],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[j,[j],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[j,[j],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[U,[O,N],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[U,[N],(t,[e])=>t.id()===e.value],"filter-type-==":[U,[O],(t,[e])=>t.geometryType()===e.value],"filter-<":[U,[O,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[U,[O,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[O,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[O,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[N],(t,[e])=>e.value in t.properties()],"filter-has-id":[U,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[U,[Y(O)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Y(N)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[O,Y(N)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[O,Y(N)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Pe(U),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Pe(U),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[U,[U],(t,[e])=>!e.evaluate(t)],"is-supported-script":[U,[O],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[O,[O],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[O,[O],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[O,Pe(N),(t,e)=>e.map((e=>nt(e.evaluate(t)))).join("")],"resolved-locale":[O,[Z],(t,[e])=>e.evaluate(t).resolvedLocale()]});var Ce=Ae;function Te(t){return{result:"success",value:t}}function ze(t){return{result:"error",value:t}}function Ee(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function De(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Be(t){return!!t.expression&&t.expression.interpolated}function Le(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Ve(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Fe(t){return t}function Re(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(Be(e)?"exponential":"interval");if(r&&((t=L({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],B.parse(t[1])]))),t.default=B.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!ie[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let a,o,l;if("exponential"===s)a=$e;else if("interval"===s)a=Ue;else if("categorical"===s){a=Oe,o=Object.create(null);for(const e of t.stops)o[e[0]]=e[1];l=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);a=qe}if(n){const r={},n=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],s=i[0].zoom;void 0===r[s]&&(r[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},n.push(s)),r[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of n)i.push([r[t].zoom,Re(r[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:ae.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>$e({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:ae.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>a(t,e,r,o,l)}}return{kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?je(t.default,e.default):a(t,e,i,o,l)}}}function je(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Oe(t,e,r,n,i){return je(typeof r===i?n[r]:void 0,t.default,e.default)}function Ue(t,e,r){if("number"!==Le(r))return je(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=Ft(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function $e(t,e,r){const n=void 0!==t.base?t.base:1;if("number"!==Le(r))return je(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=Ft(t.stops.map((t=>t[0])),r),a=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),o=t.stops[s][1],l=t.stops[s+1][1];let u=Ut[e.type]||Fe;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=ie[t.colorSpace];u=(t,r)=>e.reverse(e.interpolate(e.forward(t),e.forward(r),a))}return"function"==typeof o.evaluate?{evaluate(...t){const e=o.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==r)return u(e,r,a)}}:u(o,l,a)}function qe(t,e,r){return"color"===e.type?r=B.parse(r):"formatted"===e.type?r=Formatted.fromString(r.toString()):"resolvedImage"===e.type?r=ResolvedImage.fromString(r.toString()):Le(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),je(r,t.default,e.default)}class StyleExpression{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new ht,this._defaultValue=e?function(t){return"color"===t.type&&(Ve(t.default)||Array.isArray(t.default))?new B(0,0,0,0):"color"===t.type?B.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,a,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=o||null,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s,a,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=o||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 st(`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 Ne(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Ce}function Ze(t,e){const r=new Lt(Ce,[],e?function(t){const e={color:$,string:O,number:j,enum:O,boolean:U,formatted:G,resolvedImage:X};return"array"===t.type?Y(e[t.value]||N,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Te(new StyleExpression(n,e)):ze(r.errors)}class ZoomConstantExpression{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Et(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 ZoomDependentExpression{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Et(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?ae.interpolationFactor(this.interpolationType,t,e,r):0}}function Ge(t,e){if("error"===(t=Ze(t,e)).result)return t;const r=t.value.expression,n=zt(r);if(!n&&!Ee(e))return ze([new V("","data expressions not supported")]);const i=Dt(r,["zoom","pitch","distance-from-center"]);if(!i&&!De(e))return ze([new V("","zoom expressions not supported")]);const s=Xe(r);return s||i?s instanceof V?ze([s]):s instanceof ae&&!Be(e)?ze([new V("",'"interpolate" expressions cannot be used with this property')]):Te(s?new ZoomDependentExpression(n?"camera":"composite",t.value,s.labels,s instanceof ae?s.interpolation:void 0):new ZoomConstantExpression(n?"constant":"source",t.value)):ze([new V("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class StylePropertyFunction{constructor(t,e){this._parameters=t,this._specification=e,L(this,Re(this._parameters,this._specification))}static deserialize(t){return new StylePropertyFunction(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Xe(t){let e=null;if(t instanceof le)e=Xe(t.result);else if(t instanceof oe){for(const r of t.args)if(e=Xe(r),e)break}else(t instanceof Rt||t instanceof ae)&&t.input instanceof pt&&"zoom"===t.input.name&&(e=t);return e instanceof V||t.eachChild((t=>{const r=Xe(t);r instanceof V?e=r:!e&&r?e=new V("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new V("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}let Ye;const Je={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==Ye){const t=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{Ye=null!=process.env.API_URL_REGEX?new RegExp(process.env.API_URL_REGEX):t}catch(e){Ye=t}}return Ye},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},Ke={supported:!1,testSupport:function(t){!Qe&&He&&(tr?er(t):We=t)}};let We,He,Qe=!1,tr=!1;function er(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,He),t.isContextLost())return;Ke.supported=!0}catch(t){}t.deleteTexture(e),Qe=!0}i.document&&(He=i.document.createElement("img"),He.onload=function(){We&&er(We),We=null,tr=!0},He.onerror=function(){Qe=!0,We=null},He.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const rr="NO_ACCESS_TOKEN";function nr(t){return Je.API_URL_REGEX.test(t)}const ir=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function sr(t){const e=t.match(ir);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 ar(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}function or(t){if(!t)return null;const e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(i.atob(e[1]).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(t){return null}}class TelemetryEvent{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const e=or(Je.ACCESS_TOKEN);let r="";return r=e&&e.u?i.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=P("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{const t=i.localStorage.getItem(e);t&&(this.eventData=JSON.parse(t));const n=i.localStorage.getItem(r);n&&(this.anonId=n)}catch(t){_("Unable to read from LocalStorage")}}saveEventData(){const t=P("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{i.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&i.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){_("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,e,r,n){if(!Je.EVENTS_URL)return;const i=sr(Je.EVENTS_URL);i.params.push(`access_token=${n||Je.ACCESS_TOKEN||""}`);const s={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"2.10.0-beta.1",skuId:"01",userId:this.anonId},a=e?p(s,e):s,o={url:ar(i),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=br(o,(t=>{this.pendingRequest=null,r(t),this.saveEventData(),this.processRequests(n)}))}queueRequest(t,e){this.queue.push(t),this.processRequests(e)}}const lr=new class TurnstileEvent extends TelemetryEvent{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){Je.EVENTS_URL&&Je.ACCESS_TOKEN&&Array.isArray(t)&&t.some((t=>function(t){return 0===t.indexOf("mapbox:")}(t)||nr(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=or(Je.ACCESS_TOKEN),r=e?e.u:Je.ACCESS_TOKEN;let n=r!==this.eventData.tokenU;y(this.anonId)||(this.anonId=f(),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;n?this.postEvent(i,{"enabled.telemetry":!1},(t=>{t||(this.eventData.lastSuccess=i,this.eventData.tokenU=r)}),t):this.processRequests()}};lr.postTurnstileEvent.bind(lr);const ur=new class MapLoadEvent extends TelemetryEvent{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,r,n){this.skuToken=e,this.errorCb=n,Je.EVENTS_URL&&(r||Je.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(rr)))}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(),y(this.anonId)||(this.anonId=f()),this.postEvent(r,{skuToken:this.skuToken},(t=>{t?this.errorCb(t):e&&(this.success[e]=!0)}),t))}};ur.postMapLoadEvent.bind(ur);const cr=new class MapSessionAPI extends TelemetryEvent{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,e,r,n){const i=sr(Je.API_URL+Je.SESSION_PATH);i.params.push(`sku=${e||""}`),i.params.push(`access_token=${n||Je.ACCESS_TOKEN||""}`);const s={url:ar(i),headers:{"Content-Type":"text/plain"}};this.pendingRequest=_r(s,(t=>{this.pendingRequest=null,r(t),this.saveEventData(),this.processRequests(n)}))}getSessionAPI(t,e,r,n){this.skuToken=e,this.errorCb=n,r||Je.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(rr))}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)}};cr.getSessionAPI.bind(cr);let hr,pr={};function dr(t){const e=yr(t);let r,n;e&&e.forEach((t=>{const e=t.split("=");"language"===e[0]?r=e[1]:"worldview"===e[0]&&(n=e[1])}));let i="mapbox-tiles";return r&&(i+=`-${r}`),n&&(i+=`-${n}`),i}function fr(t){const e=function(){try{return i.caches}catch(t){}}();e&&!pr[t]&&(pr[t]=e.open(t))}function yr(t){const e=t.indexOf("?");return e>0?t.slice(e+1).split("&"):[]}function mr(t){const e=t.indexOf("?");if(e<0)return t;const r=yr(t).filter((t=>{const e=t.split("=");return"language"===e[0]||"worldview"===e[0]}));return r.length?`${t.slice(0,e)}?${r.join("&")}`:t.slice(0,e)}"function"==typeof Object.freeze&&Object.freeze({Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"});class AJAXError extends Error{constructor(t,e,r){401===e&&nr(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 gr=A()?()=>self.worker&&self.worker.referrer:()=>("blob:"===i.location.protocol?i.parent:i).location.href;const xr=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(gr())&&!/^\w+:/.test(r))){if(i.fetch&&i.Request&&i.AbortController&&i.Request.prototype.hasOwnProperty("signal"))return function(t,e){const r=new i.AbortController,n=new i.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:gr(),signal:r.signal});let s=!1,a=!1;const o=(l=n.url).indexOf("sku=")>0&&nr(l);var l;"json"===t.type&&n.headers.set("Accept","application/json");const u=(r,s,l)=>{if(a)return;if(r&&"SecurityError"!==r.message&&_(r),s&&l)return c(s);const u=Date.now();i.fetch(n).then((r=>{if(r.ok){const t=o?r.clone():null;return c(r,t,u)}return e(new AJAXError(r.statusText,r.status,t.url))})).catch((t=>{20!==t.code&&e(new Error(t.message))}))},c=(r,o,l)=>{("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{a||(o&&l&&function(t,e,r){const n=dr(t.url);if(fr(n),!pr[n])return;const s={status:e.status,statusText:e.statusText,headers:new i.Headers};e.headers.forEach(((t,e)=>s.headers.set(e,t)));const a=k(e.headers.get("Cache-Control")||"");if(a["no-store"])return;a["max-age"]&&s.headers.set("Expires",new Date(r+1e3*a["max-age"]).toUTCString());const o=s.headers.get("Expires");o&&(new Date(o).getTime()-r<42e4||function(t,e){if(void 0===hr)try{new Response(new ReadableStream),hr=!0}catch(t){hr=!1}hr?e(t.body):t.blob().then(e)}(e,(e=>{const r=new i.Response(e,s);fr(n),pr[n]&&pr[n].then((e=>e.put(mr(t.url),r))).catch((t=>_(t.message)))})))}(n,o,l),s=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((t=>{a||e(new Error(t.message))}))};return o?function(t,e){const r=dr(t.url);if(fr(r),!pr[r])return e(null);const n=mr(t.url);pr[r].then((t=>{t.match(n).then((r=>{const i=function(t){if(!t)return!1;const e=new Date(t.headers.get("Expires")||0),r=k(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(r);t.delete(n),i&&t.put(n,r.clone()),e(null,r,i)})).catch(e)})).catch(e)}(n,u):u(null,null),{cancel:()=>{a=!0,s||r.abort()}}}(t,e);if(A()&&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 i.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 AJAXError(r.statusText,r.status,t.url))},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},vr=function(t,e){return xr(p(t,{type:"arrayBuffer"}),e)},br=function(t,e){return xr(p(t,{method:"POST"}),e)},_r=function(t,e){return xr(p(t,{method:"GET"}),e)},wr={};function Sr(t,e,r={}){Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),wr[e]={klass:t,omit:r.omit||[]}}Sr(Object,"Object"),T.serialize=function(t,e){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}},T.deserialize=function(t){return new T(t.buffer)},Object.defineProperty(T,"name",{value:"Grid"}),Sr(T,"Grid"),Sr(B,"Color"),Sr(Error,"Error"),Sr(AJAXError,"AJAXError"),Sr(ResolvedImage,"ResolvedImage"),Sr(StylePropertyFunction,"StylePropertyFunction"),Sr(StyleExpression,"StyleExpression",{omit:["_evaluator"]}),Sr(ZoomDependentExpression,"ZoomDependentExpression"),Sr(ZoomConstantExpression,"ZoomConstantExpression"),Sr(pt,"CompoundExpression",{omit:["_evaluate"]});for(const t in Ce)wr[Ce[t]._classRegistryKey]||Sr(Ce[t],`Expression${t}`);function Ar(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function kr(t){return i.ImageBitmap&&t instanceof i.ImageBitmap}function Ir(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(Ar(t)||kr(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const r=t;return e&&e.push(r.buffer),r}if(t instanceof i.ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(Ir(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 ${n}`);const i=r.serialize?r.serialize(t,e):{};if(!r.serialize){for(const r in t)t.hasOwnProperty(r)&&(wr[n].omit.indexOf(r)>=0||(i[r]=Ir(t[r],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 Mr(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||Ar(t)||kr(t)||ArrayBuffer.isView(t)||t instanceof i.ImageData)return t;if(Array.isArray(t))return t.map(Mr);if("object"==typeof t){const e=t.$name||"Object",{klass:r}=wr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const e of Object.keys(t))"$name"!==e&&(n[e]=Mr(t[e]));return n}throw new Error("can't deserialize object of type "+typeof t)}class ThrottledInvoker{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(){this._channel=void 0,this._callback=()=>{}}}const Pr=i.performance;function Cr(t){const e=t?t.url.toString():void 0;return Pr.getEntriesByName(e)}class Scheduler{constructor(){this.tasks={},this.taskQueue=[],m(["process"],this),this.invoker=new ThrottledInvoker(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){A();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(){A();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 Actor{constructor(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.cancelCallbacks={},m(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=A()?t:i,this.scheduler=new Scheduler}send(t,e,r,n,i=!1,s){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=s,this.callbacks[a]=r);const o=M(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:Ir(e,o)},o),{cancel:()=>{r&&delete this.callbacks[a],this.target.postMessage({id:a,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||A()){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(Mr(e.error)):r(null,Mr(e.data)))}else{const r=M(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?Ir(e):null,data:Ir(n,r)},r)}:t=>{},i=Mr(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 Tr=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"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"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},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"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":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"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,"requires":["source"]}},"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"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"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"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"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"}}}');function zr(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function Er(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}class Event{constructor(t,e={}){p(this,e),this.type=t}}class ErrorEvent extends Event{constructor(t,e={}){super("error",p({error:t},e))}}class Evented{on(t,e){return this._listeners=this._listeners||{},zr(t,e,this._listeners),this}off(t,e){return Er(t,e,this._listeners),Er(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},zr(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new Event(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)Er(r,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(p(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t))}else t instanceof ErrorEvent&&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}}function Dr(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Br(t){if(Array.isArray(t))return t.map(Br);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=Br(t[r]);return e}return Dr(t)}class ValidationError{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function Lr(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,a=t.styleSpec;let o=[];const l=Le(r);if("object"!==l)return[new ValidationError(e,r,`object expected, ${l} found`)];for(const t in r){const l=t.split(".")[0],u=n[l]||n["*"];let c;i[l]?c=i[l]:n[l]?c=cn:i["*"]?c=i["*"]:n["*"]&&(c=cn),c?o=o.concat(c({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:u,style:s,styleSpec:a,object:r,objectKey:t},r)):o.push(new ValidationError(e,r[t],`unknown property "${t}"`))}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&o.push(new ValidationError(e,r,`missing required property "${t}"`));return o}function Vr(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,s=t.key,a=t.arrayElementValidator||cn;if("array"!==Le(e))return[new ValidationError(s,e,`array expected, ${Le(e)} found`)];if(r.length&&e.length!==r.length)return[new ValidationError(s,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new ValidationError(s,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let o={type:r.value,values:r.values,minimum:r.minimum,maximum:r.maximum,function:void 0};i.$version<7&&(o.function=r.function),"object"===Le(r.value)&&(o=r.value);let l=[];for(let t=0;t<e.length;t++)l=l.concat(a({array:e,arrayIndex:t,value:e[t],valueSpec:o,style:n,styleSpec:i,key:`${s}[${t}]`}));return l}function Fr(t){const e=t.key,r=t.value,n=t.valueSpec;let i=Le(r);if("number"===i&&r!=r&&(i="NaN"),"number"!==i)return[new ValidationError(e,r,`number expected, ${i} found`)];if("minimum"in n){let i=n.minimum;if("array"===Le(n.minimum)&&(i=n.minimum[t.arrayIndex]),r<i)return[new ValidationError(e,r,`${r} is less than the minimum value ${i}`)]}if("maximum"in n){let i=n.maximum;if("array"===Le(n.maximum)&&(i=n.maximum[t.arrayIndex]),r>i)return[new ValidationError(e,r,`${r} is greater than the maximum value ${i}`)]}return[]}function Rr(t){const e=t.valueSpec,r=Dr(t.value.type);let n,i,s,a={};const o="categorical"!==r&&void 0===t.value.property,l=!o,u="array"===Le(t.value.stops)&&"array"===Le(t.value.stops[0])&&"object"===Le(t.value.stops[0][0]),c=Lr({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 ValidationError(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Vr({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Le(n)&&0===n.length&&e.push(new ValidationError(t.key,n,"array must have at least one stop")),e},default:function(t){return cn({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&o&&c.push(new ValidationError(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||c.push(new ValidationError(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!Be(t.valueSpec)&&c.push(new ValidationError(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Ee(t.valueSpec)?c.push(new ValidationError(t.key,t.value,"property functions not supported")):o&&!De(t.valueSpec)&&c.push(new ValidationError(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||c.push(new ValidationError(t.key,t.value,'"property" property is required')),c;function h(t){let r=[];const n=t.value,o=t.key;if("array"!==Le(n))return[new ValidationError(o,n,`array expected, ${Le(n)} found`)];if(2!==n.length)return[new ValidationError(o,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==Le(n[0]))return[new ValidationError(o,n,`object expected, ${Le(n[0])} found`)];if(void 0===n[0].zoom)return[new ValidationError(o,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new ValidationError(o,n,"object stop key must have value")];const e=Dr(n[0].zoom);if("number"!=typeof e)return[new ValidationError(o,n[0].zoom,"stop zoom values must be numbers")];if(s&&s>e)return[new ValidationError(o,n[0].zoom,"stop zoom values must appear in ascending order")];e!==s&&(s=e,i=void 0,a={}),r=r.concat(Lr({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Fr,value:p}}))}else r=r.concat(p({key:`${o}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return Ne(Br(n[1]))?r.concat([new ValidationError(`${o}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(cn({key:`${o}[1]`,value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const o=Le(t.value),l=Dr(t.value),u=null!==t.value?t.value:s;if(n){if(o!==n)return[new ValidationError(t.key,u,`${o} stop domain type must match previous stop domain type ${n}`)]}else n=o;if("number"!==o&&"string"!==o&&"boolean"!==o&&"number"!=typeof l&&"string"!=typeof l&&"boolean"!=typeof l)return[new ValidationError(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==r){let n=`number expected, ${o} found`;return Ee(e)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ValidationError(t.key,u,n)]}return"categorical"!==r||"number"!==o||"number"==typeof l&&isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===o&&"number"==typeof l&&"number"==typeof i&&void 0!==i&&l<i?[new ValidationError(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===r&&l in a?[new ValidationError(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new ValidationError(t.key,u,`integer expected, found ${String(l)}`)]}}function jr(t){const e=("property"===t.expressionContext?Ge:Ze)(Br(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new ValidationError(`${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 ValidationError(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&&!Et(r))return[new ValidationError(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext)return Or(r,t);if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Dt(r,["zoom","feature-state"]))return[new ValidationError(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!zt(r))return[new ValidationError(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Or(t,e){const r=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(e.valueSpec&&e.valueSpec.expression)for(const t of e.valueSpec.expression.parameters)r.delete(t);if(0===r.size)return[];const n=[];return t instanceof pt&&r.has(t.name)?[new ValidationError(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(...Or(t,e))})),n)}function Ur(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(Dr(r))&&i.push(new ValidationError(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(Dr(r))&&i.push(new ValidationError(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function $r(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(!$r(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function qr(t,e="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};$r(t)||(t=Kr(t));const r=t;let n=!0;try{n=function(t){if(!Gr(t))return t;let e=Br(t);return Zr(e),e=Nr(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=Tr[`filter_${e}`],s=Ze(n,i);let a=null;if("error"===s.result)throw new Error(s.value.map((t=>`${t.key}: ${t.message}`)).join(", "));a=(t,e,r)=>s.value.evaluate(t,e,{},r);let o=null,l=null;if(n!==r){const t=Ze(r,i);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));o=(e,r,n,i,s)=>t.value.evaluate(e,r,{},n,void 0,void 0,i,s),l=!zt(t.value.expression)}return a=a,{filter:a,dynamicFilter:o||void 0,needGeometry:Jr(n),needFeature:!!l}}function Nr(t){if(!Array.isArray(t))return t;const e=function(t){if(Xr.has(t[0]))for(let e=1;e<t.length;e++)if(Gr(t[e]))return!0;return t}(t);return!0===e?e:e.map((t=>Nr(t)))}function Zr(t){let e=!1;const r=[];if("case"===t[0]){for(let n=1;n<t.length-1;n+=2)e=e||Gr(t[n]),r.push(t[n+1]);r.push(t[t.length-1])}else if("match"===t[0]){e=e||Gr(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||Gr(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++)Zr(t[e])}function Gr(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(Gr(t[e]))return!0;return!1}const Xr=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Yr(t,e){return t<e?-1:t>e?1:0}function Jr(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Jr(t[e]))return!0;return!1}function Kr(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Wr(t[1],t[2],"=="):"!="===e?tn(Wr(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Wr(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(Kr))):"all"===e?["all"].concat(t.slice(1).map(Kr)):"none"===e?["all"].concat(t.slice(1).map(Kr).map(tn)):"in"===e?Hr(t[1],t.slice(2)):"!in"===e?tn(Hr(t[1],t.slice(2))):"has"===e?Qr(t[1]):"!has"===e?tn(Qr(t[1])):"within"!==e||t;var r}function Wr(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 Hr(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(Yr)]]:["filter-in-small",t,["literal",e]]}}function Qr(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function tn(t){return["!",t]}function en(t){return $r(Br(t.value))?jr(L({},t,{expressionContext:"filter",valueSpec:t.styleSpec[`filter_${t.layerType||"fill"}`]})):rn(t)}function rn(t){const e=t.value,r=t.key;if("array"!==Le(e))return[new ValidationError(r,e,`array expected, ${Le(e)} found`)];const n=t.styleSpec;let i,s=[];if(e.length<1)return[new ValidationError(r,e,"filter array must have at least 1 element")];switch(s=s.concat(Ur({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Dr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Dr(e[1])&&s.push(new ValidationError(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new ValidationError(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=Le(e[1]),"string"!==i&&s.push(new ValidationError(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=Le(e[a]),"$type"===Dr(e[1])?s=s.concat(Ur({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new ValidationError(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(rn({key:`${r}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=Le(e[1]),2!==e.length?s.push(new ValidationError(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new ValidationError(`${r}[1]`,e[1],`string expected, ${i} found`));break;case"within":i=Le(e[1]),2!==e.length?s.push(new ValidationError(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==i&&s.push(new ValidationError(`${r}[1]`,e[1],`object expected, ${i} found`))}return s}function nn(t,e){const r=t.key,n=t.style,i=t.styleSpec,s=t.value,a=t.objectKey,o=i[`${e}_${t.layerType}`];if(!o)return[];const l=a.match(/^(.*)-transition$/);if("paint"===e&&l&&o[l[1]]&&o[l[1]].transition)return cn({key:r,value:s,valueSpec:i.transition,style:n,styleSpec:i});const u=t.valueSpec||o[a];if(!u)return[new ValidationError(r,s,`unknown property "${a}"`)];let c;if("string"===Le(s)&&Ee(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new ValidationError(r,s,`"${a}" 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"===a&&n&&!n.glyphs&&h.push(new ValidationError(r,s,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Ve(Br(s))&&"identity"===Dr(s.type)&&h.push(new ValidationError(r,s,'"text-font" does not support identity functions'))),h.concat(cn({key:t.key,value:s,valueSpec:u,style:n,styleSpec:i,expressionContext:"property",propertyType:e,propertyKey:a}))}function sn(t){return nn(t,"paint")}function an(t){return nn(t,"layout")}function on(t){const e=t.value,r=t.key,n=Le(e);return"string"!==n?[new ValidationError(r,e,`string expected, ${n} found`)]:[]}const ln={promoteId:function({key:t,value:e}){if("string"===Le(e))return on({key:t,value:e});{const r=[];for(const n in e)r.push(...on({key:`${t}.${n}`,value:e[n]}));return r}}},un={"*":()=>[],array:Vr,boolean:function(t){const e=t.value,r=t.key,n=Le(e);return"boolean"!==n?[new ValidationError(r,e,`boolean expected, ${n} found`)]:[]},number:Fr,color:function(t){const e=t.key,r=t.value,n=Le(r);return"string"!==n?[new ValidationError(e,r,`color expected, ${n} found`)]:null===D.parseCSSColor(r)?[new ValidationError(e,r,`color expected, "${r}" found`)]:[]},enum:Ur,filter:en,function:Rr,layer:function(t){let e=[];const r=t.value,n=t.key,i=t.style,s=t.styleSpec;r.type||r.ref||e.push(new ValidationError(n,r,'either "type" or "ref" is required'));let a=Dr(r.type);const o=Dr(r.ref);if(r.id){const s=Dr(r.id);for(let a=0;a<t.arrayIndex;a++){const t=i.layers[a];Dr(t.id)===s&&e.push(new ValidationError(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 ValidationError(n,r[t],`"${t}" is prohibited for ref layers`))})),i.layers.forEach((e=>{Dr(e.id)===o&&(t=e)})),t?t.ref?e.push(new ValidationError(n,r.ref,"ref cannot reference another ref layer")):a=Dr(t.type):"string"==typeof o&&e.push(new ValidationError(n,r.ref,`ref layer "${o}" not found`))}else if("background"!==a&&"sky"!==a)if(r.source){const t=i.sources&&i.sources[r.source],s=t&&Dr(t.type);t?"vector"===s&&"raster"===a?e.push(new ValidationError(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===s&&"raster"!==a?e.push(new ValidationError(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==a?e.push(new ValidationError(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!r.paint||!r.paint["line-gradient"]&&!r.paint["line-trim-offset"]||"geojson"===s&&t.lineMetrics||e.push(new ValidationError(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new ValidationError(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new ValidationError(n,r.source,`source "${r.source}" not found`))}else e.push(new ValidationError(n,r,'missing required property "source"'));return e=e.concat(Lr({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>cn({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:t=>en(L({layerType:a},t)),layout:t=>Lr({layer:r,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>an(L({layerType:a},t))}}),paint:t=>Lr({layer:r,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>sn(L({layerType:a},t))}})}})),e},object:Lr,source:function(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style;if(!e.type)return[new ValidationError(r,e,'"type" is required')];const s=Dr(e.type);let a;switch(s){case"vector":case"raster":case"raster-dem":return a=Lr({key:r,value:e,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:ln}),a;case"geojson":if(a=Lr({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,objectElementValidators:ln}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...jr({key:`${r}.${t}.map`,value:i,expressionContext:"cluster-map"})),a.push(...jr({key:`${r}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return a;case"video":return Lr({key:r,value:e,valueSpec:n.source_video,style:i,styleSpec:n});case"image":return Lr({key:r,value:e,valueSpec:n.source_image,style:i,styleSpec:n});case"canvas":return[new ValidationError(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ur({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:n})}},light:function(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let s=[];const a=Le(e);if(void 0===e)return s;if("object"!==a)return s=s.concat([new ValidationError("light",e,`object expected, ${a} found`)]),s;for(const t in e){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&n[a[1]]&&n[a[1]].transition?cn({key:t,value:e[t],valueSpec:r.transition,style:i,styleSpec:r}):n[t]?cn({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}):[new ValidationError(t,e[t],`unknown property "${t}"`)])}return s},terrain:function(t){const e=t.value,r=t.key,n=t.style,i=t.styleSpec,s=i.terrain;let a=[];const o=Le(e);if(void 0===e)return a;if("object"!==o)return a=a.concat([new ValidationError("terrain",e,`object expected, ${o} found`)]),a;for(const t in e){const r=t.match(/^(.*)-transition$/);a=a.concat(r&&s[r[1]]&&s[r[1]].transition?cn({key:t,value:e[t],valueSpec:i.transition,style:n,styleSpec:i}):s[t]?cn({key:t,value:e[t],valueSpec:s[t],style:n,styleSpec:i}):[new ValidationError(t,e[t],`unknown property "${t}"`)])}if(e.source){const t=n.sources&&n.sources[e.source],i=t&&Dr(t.type);t?"raster-dem"!==i&&a.push(new ValidationError(r,e.source,`terrain cannot be used with a source of type ${String(i)}, it only be used with a "raster-dem" source type`)):a.push(new ValidationError(r,e.source,`source "${e.source}" not found`))}else a.push(new ValidationError(r,e,'terrain is missing required property "source"'));return a},fog:function(t){const e=t.value,r=t.style,n=t.styleSpec,i=n.fog;let s=[];const a=Le(e);if(void 0===e)return s;if("object"!==a)return s=s.concat([new ValidationError("fog",e,`object expected, ${a} found`)]),s;for(const t in e){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&i[a[1]]&&i[a[1]].transition?cn({key:t,value:e[t],valueSpec:n.transition,style:r,styleSpec:n}):i[t]?cn({key:t,value:e[t],valueSpec:i[t],style:r,styleSpec:n}):[new ValidationError(t,e[t],`unknown property "${t}"`)])}return s},string:on,formatted:function(t){return 0===on(t).length?[]:jr(t)},resolvedImage:function(t){return 0===on(t).length?[]:jr(t)},projection:function(t){const e=t.value,r=t.styleSpec,n=r.projection,i=t.style;let s=[];const a=Le(e);if("object"===a)for(const t in e)s=s.concat(cn({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}));else"string"!==a&&(s=s.concat([new ValidationError("projection",e,`object or string expected, ${a} found`)]));return s}};function cn(t){const e=t.value,r=t.valueSpec,n=t.styleSpec;return r.expression&&Ve(Dr(e))?Rr(t):r.expression&&Ne(Br(e))?jr(t):r.type&&un[r.type]?un[r.type](t):Lr(L({},t,{valueSpec:r.type?n[r.type]:r}))}function hn(t){const e=t.value,r=t.key,n=on(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new ValidationError(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new ValidationError(r,e,'"glyphs" url must include a "{range}" token'))),n}function pn(t,e=Tr){return yn(cn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:hn,"*":()=>[]}}))}const dn=t=>yn(sn(t)),fn=t=>yn(an(t));function yn(t){return t.slice().sort(((t,e)=>t.line&&e.line?t.line-e.line:0))}class ZoomHistory{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 mn=t=>t>=1536&&t<=1791,gn=t=>t>=1872&&t<=1919,xn=t=>t>=2208&&t<=2303,vn=t=>t>=11904&&t<=12031,bn=t=>t>=12032&&t<=12255,_n=t=>t>=12272&&t<=12287,wn=t=>t>=12288&&t<=12351,Sn=t=>t>=12352&&t<=12447,An=t=>t>=12448&&t<=12543,kn=t=>t>=12544&&t<=12591,Mn=t=>t>=12704&&t<=12735,Pn=t=>t>=12736&&t<=12783,Cn=t=>t>=12784&&t<=12799,Tn=t=>t>=12800&&t<=13055,zn=t=>t>=13056&&t<=13311,En=t=>t>=13312&&t<=19903,Dn=t=>t>=19968&&t<=40959,Bn=t=>t>=40960&&t<=42127,Ln=t=>t>=42128&&t<=42191,Vn=t=>t>=63744&&t<=64255,Fn=t=>t>=64336&&t<=65023,Rn=t=>t>=65040&&t<=65055,jn=t=>t>=65072&&t<=65103,On=t=>t>=65104&&t<=65135,Un=t=>t>=65136&&t<=65279,$n=t=>t>=65280&&t<=65519;function qn(t){for(const e of t)if(Gn(e.charCodeAt(0)))return!0;return!1}function Nn(t){for(const e of t)if(!Zn(e.charCodeAt(0)))return!1;return!0}function Zn(t){return!(mn(t)||gn(t)||xn(t)||Fn(t)||Un(t))}function Gn(t){return!(746!==t&&747!==t&&(t<4352||!(Mn(t)||kn(t)||jn(t)&&!(t>=65097&&t<=65103)||Vn(t)||zn(t)||vn(t)||Pn(t)||!(!wn(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||En(t)||Dn(t)||Tn(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)||Sn(t)||_n(t)||(t=>t>=12688&&t<=12703)(t)||bn(t)||Cn(t)||An(t)&&12540!==t||!(!$n(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)||!(!On(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||Rn(t)||(t=>t>=19904&&t<=19967)(t)||Bn(t)||Ln(t))))}function Xn(t){return!(Gn(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)||wn(t)||An(t)||(t=>t>=57344&&t<=63743)(t)||jn(t)||On(t)||$n(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Yn(t){return t>=1424&&t<=2303||Fn(t)||Un(t)}function Jn(t,e){return!(!e&&Yn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||(t=>t>=6016&&t<=6143)(t))}function Kn(t){for(const e of t)if(Yn(e.charCodeAt(0)))return!0;return!1}let Wn,Hn,Qn,ti;const ei={now:()=>void 0!==Qn?Qn:i.performance.now(),setNow(t){Qn=t},restoreNow(){Qn=void 0},frame(t){const e=i.requestAnimationFrame(t);return{cancel:()=>i.cancelAnimationFrame(e)}},getImageData(t,e=0){const{width:r,height:n}=t;ti||(ti=i.document.createElement("canvas"));const s=ti.getContext("2d");if(!s)throw new Error("failed to create canvas 2d context");return(r>ti.width||n>ti.height)&&(ti.width=r,ti.height=n),s.clearRect(-e,-e,r+2*e,n+2*e),s.drawImage(t,0,0,r,n),s.getImageData(-e,-e,r+2*e,n+2*e)},resolveURL:t=>(Wn||(Wn=i.document.createElement("a")),Wn.href=t,Wn.href),get devicePixelRatio(){return i.devicePixelRatio},get prefersReducedMotion(){return!!i.matchMedia&&(null==Hn&&(Hn=i.matchMedia("(prefers-reduced-motion: reduce)")),Hn.matches)}},ri="loading",ni="loaded";let ii="unavailable",si=null;function ai(){oi.fire(new Event("pluginStateChange",{pluginStatus:ii,pluginURL:si}))}const oi=new Evented,li=function(){return ii},ui=function(){if("deferred"!==ii||!si)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ii=ri,ai(),si&&vr({url:si},(t=>{t?function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(ii="error")}(t):(ii=ni,ai())}))},ci={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>ii===ni||null!=ci.applyArabicShaping,isLoading:()=>ii===ri,setState(t){ii=t.pluginStatus,si=t.pluginURL},isParsed:()=>null!=ci.applyArabicShaping&&null!=ci.processBidirectionalText&&null!=ci.processStyledBidirectionalText,getPluginURL:()=>si};class EvaluationParameters{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 ZoomHistory,this.transition={},this.pitch=0)}isSupportedScript(t){return function(t,e){for(const r of t)if(!Jn(r.charCodeAt(0),e))return!1;return!0}(t,ci.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 PropertyValue{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Ve(t))return new StylePropertyFunction(t,e);if(Ne(t)){const r=Ge(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=B.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 TransitionablePropertyValue{constructor(t){this.property=t,this.value=new PropertyValue(t,void 0)}transitioned(t,e){return new TransitioningPropertyValue(this.property,this.value,e,p({},t.transition,this.transition),t.now)}untransitioned(){return new TransitioningPropertyValue(this.property,this.value,null,{},0)}}class Transitionable{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return v(this._values[t].value.value)}setValue(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new TransitionablePropertyValue(this._values[t].property)),this._values[t].value=new PropertyValue(this._values[t].property,null===e?void 0:v(e))}getTransition(t){return v(this._values[t].transition)}setTransition(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new TransitionablePropertyValue(this._values[t].property)),this._values[t].transition=v(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 Transitioning(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 Transitioning(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class TransitioningPropertyValue{constructor(t,e,r,n,i){const s=n.delay||0,a=n.duration||0;i=i||0,this.property=t,this.value=e,this.begin=i+s,this.end=this.begin+a,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return s.possiblyEvaluate(t,e,r);{const a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,r),i,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}}return i}}class Transitioning{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const n=new PossiblyEvaluated(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 Layout{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return v(this._values[t].value)}setValue(t,e){this._values[t]=new PropertyValue(this._values[t].property,null===e?void 0:v(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 PossiblyEvaluated(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class PossiblyEvaluatedPropertyValue{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 PossiblyEvaluated{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class DataConstantProperty{constructor(t){this.specification=t}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,r){const n=Ut[this.specification.type];return n?n(t,e,r):t}}class DataDrivenProperty{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,n){return new PossiblyEvaluatedPropertyValue(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 PossiblyEvaluatedPropertyValue(this,{kind:"constant",value:void 0},t.parameters);const n=Ut[this.specification.type];return n?new PossiblyEvaluatedPropertyValue(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 CrossFadedDataDrivenProperty extends DataDrivenProperty{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new PossiblyEvaluatedPropertyValue(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),s="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,a=this._calculate(s,s,s,e);return new PossiblyEvaluatedPropertyValue(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new PossiblyEvaluatedPropertyValue(this,{kind:"constant",value:r},e)}return new PossiblyEvaluatedPropertyValue(this,t.expression,e)}evaluate(t,e,r,n,i,s){if("source"===t.kind){const a=t.evaluate(e,r,n,i,s);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e,other:r}:{from:r,to:e,other:t}}interpolate(t){return t}}class CrossFadedProperty{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 EvaluationParameters(Math.floor(e.zoom-1),e)),t.expression.evaluate(new EvaluationParameters(Math.floor(e.zoom),e)),t.expression.evaluate(new EvaluationParameters(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 ColorRampProperty{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)}interpolate(){return!1}}class Properties{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const e=new EvaluationParameters(0,{});for(const r in t){const n=t[r];n.specification.overridable&&this.overridableProperties.push(r);const i=this.defaultPropertyValues[r]=new PropertyValue(n,void 0),s=this.defaultTransitionablePropertyValues[r]=new TransitionablePropertyValue(n);this.defaultTransitioningPropertyValues[r]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate(e)}}}function hi(t,e){return 256*(t=u(Math.floor(t),0,255))+u(Math.floor(e),0,255)}Sr(DataDrivenProperty,"DataDrivenProperty"),Sr(DataConstantProperty,"DataConstantProperty"),Sr(CrossFadedDataDrivenProperty,"CrossFadedDataDrivenProperty"),Sr(CrossFadedProperty,"CrossFadedProperty"),Sr(ColorRampProperty,"ColorRampProperty");const pi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Struct{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 StructArray{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")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function di(t,e=1){let r=0,n=0;return{members:t.map((t=>{const i=pi[t.type].BYTES_PER_ELEMENT,s=r=fi(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:s}})),size:fi(r,Math.max(n,e)),alignment:e}}function fi(t,e){return Math.ceil(t/e)*e}class StructArrayLayout2i4 extends StructArray{_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}}StructArrayLayout2i4.prototype.bytesPerElement=4,Sr(StructArrayLayout2i4,"StructArrayLayout2i4");class StructArrayLayout3i6 extends StructArray{_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}}StructArrayLayout3i6.prototype.bytesPerElement=6,Sr(StructArrayLayout3i6,"StructArrayLayout3i6");class StructArrayLayout4i8 extends StructArray{_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}}StructArrayLayout4i8.prototype.bytesPerElement=8,Sr(StructArrayLayout4i8,"StructArrayLayout4i8");class StructArrayLayout2i4ub1f12 extends StructArray{_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,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){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]=a,this.float32[c+2]=o,t}}StructArrayLayout2i4ub1f12.prototype.bytesPerElement=12,Sr(StructArrayLayout2i4ub1f12,"StructArrayLayout2i4ub1f12");class StructArrayLayout4f16 extends StructArray{_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}}StructArrayLayout4f16.prototype.bytesPerElement=16,Sr(StructArrayLayout4f16,"StructArrayLayout4f16");class StructArrayLayout10ui20 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,s,a,o,l,u)}emplace(t,e,r,n,i,s,a,o,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=s,this.uint16[h+5]=a,this.uint16[h+6]=o,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}StructArrayLayout10ui20.prototype.bytesPerElement=20,Sr(StructArrayLayout10ui20,"StructArrayLayout10ui20");class StructArrayLayout8ui16 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o){const l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,n,i,s,a,o)}emplace(t,e,r,n,i,s,a,o,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]=a,this.uint16[u+6]=o,this.uint16[u+7]=l,t}}StructArrayLayout8ui16.prototype.bytesPerElement=16,Sr(StructArrayLayout8ui16,"StructArrayLayout8ui16");class StructArrayLayout6i12 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}StructArrayLayout6i12.prototype.bytesPerElement=12,Sr(StructArrayLayout6i12,"StructArrayLayout6i12");class StructArrayLayout4i4ui4i24 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,a,o,l,u,c,h)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=n,this.int16[d+3]=i,this.uint16[d+4]=s,this.uint16[d+5]=a,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=p,t}}StructArrayLayout4i4ui4i24.prototype.bytesPerElement=24,Sr(StructArrayLayout4i4ui4i24,"StructArrayLayout4i4ui4i24");class StructArrayLayout3i3f20 extends StructArray{_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){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=10*t,l=5*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.float32[l+2]=i,this.float32[l+3]=s,this.float32[l+4]=a,t}}StructArrayLayout3i3f20.prototype.bytesPerElement=20,Sr(StructArrayLayout3i3f20,"StructArrayLayout3i3f20");class StructArrayLayout1ul4 extends StructArray{_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}}StructArrayLayout1ul4.prototype.bytesPerElement=4,Sr(StructArrayLayout1ul4,"StructArrayLayout1ul4");class StructArrayLayout5i4f1i1ul2ui40 extends StructArray{_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,a,o,l,u,c,h,p){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,r,n,i,s,a,o,l,u,c,h,p)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d){const f=20*t,y=10*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.int16[f+4]=s,this.float32[y+3]=a,this.float32[y+4]=o,this.float32[y+5]=l,this.float32[y+6]=u,this.int16[f+14]=c,this.uint32[y+8]=h,this.uint16[f+18]=p,this.uint16[f+19]=d,t}}StructArrayLayout5i4f1i1ul2ui40.prototype.bytesPerElement=40,Sr(StructArrayLayout5i4f1i1ul2ui40,"StructArrayLayout5i4f1i1ul2ui40");class StructArrayLayout3i2i2i16 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){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]=a,this.int16[l+7]=o,t}}StructArrayLayout3i2i2i16.prototype.bytesPerElement=16,Sr(StructArrayLayout3i2i2i16,"StructArrayLayout3i2i2i16");class StructArrayLayout2f1f2i16 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=4*t,o=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[o+6]=i,this.int16[o+7]=s,t}}StructArrayLayout2f1f2i16.prototype.bytesPerElement=16,Sr(StructArrayLayout2f1f2i16,"StructArrayLayout2f1f2i16");class StructArrayLayout2ub2f12 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=12*t,a=3*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t}}StructArrayLayout2ub2f12.prototype.bytesPerElement=12,Sr(StructArrayLayout2ub2f12,"StructArrayLayout2ub2f12");class StructArrayLayout3f12 extends StructArray{_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}}StructArrayLayout3f12.prototype.bytesPerElement=12,Sr(StructArrayLayout3f12,"StructArrayLayout3f12");class StructArrayLayout3ui6 extends StructArray{_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}}StructArrayLayout3ui6.prototype.bytesPerElement=6,Sr(StructArrayLayout3ui6,"StructArrayLayout3ui6");class StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60 extends StructArray{_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,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b,_){const w=30*t,S=15*t,A=60*t;return this.int16[w+0]=e,this.int16[w+1]=r,this.int16[w+2]=n,this.float32[S+2]=i,this.float32[S+3]=s,this.uint16[w+8]=a,this.uint16[w+9]=o,this.uint32[S+5]=l,this.uint32[S+6]=u,this.uint32[S+7]=c,this.uint16[w+16]=h,this.uint16[w+17]=p,this.uint16[w+18]=d,this.float32[S+10]=f,this.float32[S+11]=y,this.uint8[A+48]=m,this.uint8[A+49]=g,this.uint8[A+50]=x,this.uint32[S+13]=v,this.int16[w+28]=b,this.uint8[A+58]=_,t}}StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60.prototype.bytesPerElement=60,Sr(StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class StructArrayLayout3i2f6i15ui1ul3f76 extends StructArray{_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,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b,_,w,S,A,k,I,M,P,C){const T=this.length;return this.resize(T+1),this.emplace(T,t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b,_,w,S,A,k,I,M,P,C)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b,_,w,S,A,k,I,M,P,C,T){const z=38*t,E=19*t;return this.int16[z+0]=e,this.int16[z+1]=r,this.int16[z+2]=n,this.float32[E+2]=i,this.float32[E+3]=s,this.int16[z+8]=a,this.int16[z+9]=o,this.int16[z+10]=l,this.int16[z+11]=u,this.int16[z+12]=c,this.int16[z+13]=h,this.uint16[z+14]=p,this.uint16[z+15]=d,this.uint16[z+16]=f,this.uint16[z+17]=y,this.uint16[z+18]=m,this.uint16[z+19]=g,this.uint16[z+20]=x,this.uint16[z+21]=v,this.uint16[z+22]=b,this.uint16[z+23]=_,this.uint16[z+24]=w,this.uint16[z+25]=S,this.uint16[z+26]=A,this.uint16[z+27]=k,this.uint16[z+28]=I,this.uint32[E+15]=M,this.float32[E+16]=P,this.float32[E+17]=C,this.float32[E+18]=T,t}}StructArrayLayout3i2f6i15ui1ul3f76.prototype.bytesPerElement=76,Sr(StructArrayLayout3i2f6i15ui1ul3f76,"StructArrayLayout3i2f6i15ui1ul3f76");class StructArrayLayout1f4 extends StructArray{_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}}StructArrayLayout1f4.prototype.bytesPerElement=4,Sr(StructArrayLayout1f4,"StructArrayLayout1f4");class StructArrayLayout5f20 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=5*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,this.float32[a+4]=s,t}}StructArrayLayout5f20.prototype.bytesPerElement=20,Sr(StructArrayLayout5f20,"StructArrayLayout5f20");class StructArrayLayout1ul3ui12 extends StructArray{_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}}StructArrayLayout1ul3ui12.prototype.bytesPerElement=12,Sr(StructArrayLayout1ul3ui12,"StructArrayLayout1ul3ui12");class StructArrayLayout2ui4 extends StructArray{_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}}StructArrayLayout2ui4.prototype.bytesPerElement=4,Sr(StructArrayLayout2ui4,"StructArrayLayout2ui4");class StructArrayLayout1ui2 extends StructArray{_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}}StructArrayLayout1ui2.prototype.bytesPerElement=2,Sr(StructArrayLayout1ui2,"StructArrayLayout1ui2");class StructArrayLayout2f8 extends StructArray{_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}}StructArrayLayout2f8.prototype.bytesPerElement=8,Sr(StructArrayLayout2f8,"StructArrayLayout2f8");class FillExtrusionExtStruct extends Struct{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}FillExtrusionExtStruct.prototype.size=12;class FillExtrusionExtArray extends StructArrayLayout6i12{get(t){return new FillExtrusionExtStruct(this,t)}}Sr(FillExtrusionExtArray,"FillExtrusionExtArray");class CollisionBoxStruct extends Struct{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]}}CollisionBoxStruct.prototype.size=40;class CollisionBoxArray extends StructArrayLayout5i4f1i1ul2ui40{get(t){return new CollisionBoxStruct(this,t)}}Sr(CollisionBoxArray,"CollisionBoxArray");class PlacedSymbolStruct extends Struct{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}}PlacedSymbolStruct.prototype.size=60;class PlacedSymbolArray extends StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60{get(t){return new PlacedSymbolStruct(this,t)}}Sr(PlacedSymbolArray,"PlacedSymbolArray");class SymbolInstanceStruct extends Struct{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]}}SymbolInstanceStruct.prototype.size=76;class SymbolInstanceArray extends StructArrayLayout3i2f6i15ui1ul3f76{get(t){return new SymbolInstanceStruct(this,t)}}Sr(SymbolInstanceArray,"SymbolInstanceArray");class GlyphOffsetArray extends StructArrayLayout1f4{getoffsetX(t){return this.float32[1*t+0]}}Sr(GlyphOffsetArray,"GlyphOffsetArray");class SymbolLineVertexArray extends StructArrayLayout3i6{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Sr(SymbolLineVertexArray,"SymbolLineVertexArray");class FeatureIndexStruct extends Struct{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]}}FeatureIndexStruct.prototype.size=12;class FeatureIndexArray extends StructArrayLayout1ul3ui12{get(t){return new FeatureIndexStruct(this,t)}}Sr(FeatureIndexArray,"FeatureIndexArray");class FillExtrusionCentroidStruct extends Struct{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}FillExtrusionCentroidStruct.prototype.size=4;class FillExtrusionCentroidArray extends StructArrayLayout2ui4{get(t){return new FillExtrusionCentroidStruct(this,t)}}Sr(FillExtrusionCentroidArray,"FillExtrusionCentroidArray");class CircleGlobeExtStruct extends Struct{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}CircleGlobeExtStruct.prototype.size=12;class CircleGlobeExtArray extends StructArrayLayout6i12{get(t){return new CircleGlobeExtStruct(this,t)}}Sr(CircleGlobeExtArray,"CircleGlobeExtArray");const yi=di([{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"}]),mi=di([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]);var gi=E((function(t){t.exports=function(t,e){var r,n,i,s,a,o,l,u;for(n=t.length-(r=3&t.length),i=e,a=3432918353,o=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),xi=E((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}})),vi=gi,bi=xi;vi.murmur3=gi,vi.murmur2=bi;class FeaturePositionMap{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,n){this.ids.push(_i(t)),this.positions.push(e,r,n)}getPositions(t){const e=_i(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 wi(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new FeaturePositionMap;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function _i(t){const e=+t;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:vi(String(t))}function wi(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let s=r-1,a=n+1;for(;;){do{s++}while(t[s]<i);do{a--}while(t[a]>i);if(s>=a)break;Si(t,s,a),Si(e,3*s,3*a),Si(e,3*s+1,3*a+1),Si(e,3*s+2,3*a+2)}a-r<n-a?(wi(t,e,r,a),r=a+1):(wi(t,e,a+1,n),n=a)}}function Si(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}Sr(FeaturePositionMap,"FeaturePositionMap");class Uniform{constructor(t){this.gl=t.gl,this.initialized=!1}fetchUniformLocation(t,e){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(t,e),this.initialized=!0),!!this.location}}class Uniform1f extends Uniform{constructor(t){super(t),this.current=0}set(t,e,r){this.fetchUniformLocation(t,e)&&this.current!==r&&(this.current=r,this.gl.uniform1f(this.location,r))}}class Uniform4f extends Uniform{constructor(t){super(t),this.current=[0,0,0,0]}set(t,e,r){this.fetchUniformLocation(t,e)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]&&r[3]===this.current[3]||(this.current=r,this.gl.uniform4f(this.location,r[0],r[1],r[2],r[3])))}}class UniformColor extends Uniform{constructor(t){super(t),this.current=B.transparent}set(t,e,r){this.fetchUniformLocation(t,e)&&(r.r===this.current.r&&r.g===this.current.g&&r.b===this.current.b&&r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)))}}function Ai(t){return[hi(255*t.r,255*t.g),hi(255*t.b,255*t.a)]}class ConstantBinder{constructor(t,e,r){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r}setUniform(t,e,r,n,i){e.set(t,i,n.constantOr(this.value))}getBinding(t,e){return"color"===this.type?new UniformColor(t):new Uniform1f(t)}}class CrossFadedConstantBinder{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||1,this.pixelRatioTo=t.pixelRatio||1,this.patternFrom=e.tl.concat(e.br),this.patternTo=t.tl.concat(t.br)}setUniform(t,e,r,n,i){const s="u_pattern_to"===i||"u_dash_to"===i?this.patternTo:"u_pattern_from"===i||"u_dash_from"===i?this.patternFrom:"u_pixel_ratio_to"===i?this.pixelRatioTo:"u_pixel_ratio_from"===i?this.pixelRatioFrom:null;s&&e.set(t,i,s)}getBinding(t,e){return"u_pattern_from"===e||"u_pattern_to"===e||"u_dash_from"===e||"u_dash_to"===e?new Uniform4f(t):new Uniform1f(t)}}class SourceExpressionBinder{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 a=this.paintVertexArray.length,o=this.expression.evaluate(new EvaluationParameters(0),e,{},i,n,s);this.paintVertexArray.resize(t),this._setPaintValue(a,t,o)}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=Ai(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 CompositeExpressionBinder{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 a=this.expression.evaluate(new EvaluationParameters(this.zoom),e,{},i,n,s),o=this.expression.evaluate(new EvaluationParameters(this.zoom+1),e,{},i,n,s),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,a,o)}updatePaintArray(t,e,r,n,i){const s=this.expression.evaluate({zoom:this.zoom},r,n,void 0,i),a=this.expression.evaluate({zoom:this.zoom+1},r,n,void 0,i);this._setPaintValue(t,e,s,a)}_setPaintValue(t,e,r,n){if("color"===this.type){const i=Ai(r),s=Ai(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,r,n,i){const s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,a=u(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(t,i,a)}getBinding(t,e){return new Uniform1f(t)}}class CrossFadedCompositeBinder{constructor(t,e,r,n,i,s,a){this.expression=t,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.paintVertexAttributes=("array"===r?mi:yi).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:a}=r,o=n[i],l=n[s],u=n[a];if(o&&l&&u)for(let r=t;r<e;r++)this._setPaintValue(this.zoomInPaintVertexArray,r,l,o),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 ProgramConfiguration{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 PossiblyEvaluatedPropertyValue&&Ee(s.property.specification)))continue;const a=Ii(i,t.type),o=s.value,l=s.property.specification.type,u=s.property.useIntegerZoom,c=s.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c,p="line-dasharray"===String(i)&&"constant"!==t.layout.get("line-cap").value.kind;if("constant"!==o.kind||p)if("source"===o.kind||p||h){const r=Ci(i,l,"source");this.binders[i]=h?new CrossFadedCompositeBinder(o,a,l,u,e,r,t.id):new SourceExpressionBinder(o,a,l,r),n.push(`/a_${i}`)}else{const t=Ci(i,l,"composite");this.binders[i]=new CompositeExpressionBinder(o,a,l,u,e,t),n.push(`/z_${i}`)}else this.binders[i]=h?new CrossFadedConstantBinder(o.value,a):new ConstantBinder(o.value,a,l),n.push(`/u_${i}`)}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof SourceExpressionBinder||e instanceof CompositeExpressionBinder?e.maxValue:0}populatePaintArrays(t,e,r,n,i,s){for(const a in this.binders){const o=this.binders[a];(o instanceof SourceExpressionBinder||o instanceof CompositeExpressionBinder||o instanceof CrossFadedCompositeBinder)&&o.populatePaintArray(t,e,r,n,i,s)}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof CrossFadedConstantBinder&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,n,i,s){let a=!1;for(const o in t){const l=e.getPositions(o);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 SourceExpressionBinder||u instanceof CompositeExpressionBinder||u instanceof CrossFadedCompositeBinder)&&!0===u.expression.isStateDependent){const c=n.paint.get(r);u.expression=c.value,u.updatePaintArray(e.start,e.end,l,t[o],i,s),a=!0}}}}return a}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof ConstantBinder||r instanceof CrossFadedConstantBinder)&&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 SourceExpressionBinder||r instanceof CompositeExpressionBinder||r instanceof CrossFadedCompositeBinder)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 ConstantBinder||r instanceof CrossFadedConstantBinder||r instanceof CompositeExpressionBinder)for(const e of r.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t){const e=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof ConstantBinder||n instanceof CrossFadedConstantBinder||n instanceof CompositeExpressionBinder)for(const i of n.uniformNames)e.push({name:i,property:r,binding:n.getBinding(t,i)})}return e}setUniforms(t,e,r,n,i){for(const{name:e,property:s,binding:a}of r)this.binders[s].setUniform(t,a,i,n.get(s),e)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof CrossFadedCompositeBinder){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof SourceExpressionBinder||r instanceof CompositeExpressionBinder)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof SourceExpressionBinder||r instanceof CompositeExpressionBinder||r instanceof CrossFadedCompositeBinder)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof SourceExpressionBinder||e instanceof CompositeExpressionBinder||e instanceof CrossFadedCompositeBinder)&&e.destroy()}}}class ProgramConfigurationSet{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new ProgramConfiguration(n,e,r);this.needsUpload=!1,this._featureMap=new FeaturePositionMap,this._bufferOffset=0}populatePaintArrays(t,e,r,n,i,s,a){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s,a);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 ki={"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 Ii(t,e){return ki[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const Mi={"line-pattern":{source:StructArrayLayout10ui20,composite:StructArrayLayout10ui20},"fill-pattern":{source:StructArrayLayout10ui20,composite:StructArrayLayout10ui20},"fill-extrusion-pattern":{source:StructArrayLayout10ui20,composite:StructArrayLayout10ui20},"line-dasharray":{source:StructArrayLayout8ui16,composite:StructArrayLayout8ui16}},Pi={color:{source:StructArrayLayout2f8,composite:StructArrayLayout4f16},number:{source:StructArrayLayout1f4,composite:StructArrayLayout2f8}};function Ci(t,e,r){const n=Mi[t];return n&&n[r]||Pi[e][r]}Sr(ConstantBinder,"ConstantBinder"),Sr(CrossFadedConstantBinder,"CrossFadedConstantBinder"),Sr(SourceExpressionBinder,"SourceExpressionBinder"),Sr(CrossFadedCompositeBinder,"CrossFadedCompositeBinder"),Sr(CompositeExpressionBinder,"CompositeExpressionBinder"),Sr(ProgramConfiguration,"ProgramConfiguration",{omit:["_buffers"]}),Sr(ProgramConfigurationSet,"ProgramConfigurationSet");const Ti="-transition";class StyleLayer extends Evented{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 Layout(e.layout)),e.paint)){this._transitionablePaint=new Transitionable(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 PossiblyEvaluated(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(fn,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return g(t,Ti)?this._transitionablePaint.getTransition(t.slice(0,-Ti.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(dn,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(g(t,Ti))return this._transitionablePaint.setTransition(t.slice(0,-Ti.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 a=this._transitionablePaint._values[t].value;return a.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,s,a)}}_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 ErrorEvent(new Error(n.message))),r=!0;return r}(this,t.call(pn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:Tr,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 PossiblyEvaluatedPropertyValue&&Ee(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=qr(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const zi=di([{name:"a_pos",components:2,type:"Int16"}],4),Ei=di([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class SegmentVector{constructor(t=[]){this.segments=t}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>SegmentVector.MAX_VERTEX_ARRAY_LENGTH&&_(`Max vertices per segment is ${SegmentVector.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>SegmentVector.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 SegmentVector([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}SegmentVector.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Sr(SegmentVector,"SegmentVector");var Di=8192;class LngLatBounds{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 LngLat?new LngLat(t.lng,t.lat):LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof LngLat?new LngLat(t.lng,t.lat):LngLat.convert(t),this}extend(t){const e=this._sw,r=this._ne;let n,i;if(t instanceof LngLat)n=t,i=t;else{if(!(t instanceof LngLatBounds))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(LngLatBounds.convert(t)):this.extend(LngLat.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 LngLat(n.lng,n.lat),this._ne=new LngLat(i.lng,i.lat)),this}getCenter(){return new LngLat((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 LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new LngLat(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}=LngLat.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 LngLatBounds?t:new LngLatBounds(t)}}const Bi=6371008.8;class LngLat{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 LngLat(c(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 Bi*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 LngLatBounds(new LngLat(this.lng-r,this.lat-e),new LngLat(this.lng+r,this.lat+e))}static convert(t){if(t instanceof LngLat)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new LngLat(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new LngLat(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 Li=2*Math.PI*Bi;function Vi(t){return Li*Math.cos(t*Math.PI/180)}function Fi(t){return(180+t)/360}function Ri(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ji(t,e){return t/Vi(e)}function Oi(t){return 360*t-180}function Ui(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}const $i=85.051129;class MercatorCoordinate{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){const r=LngLat.convert(t);return new MercatorCoordinate(Fi(r.lng),Ri(r.lat),ji(e,r.lat))}toLngLat(){return new LngLat(Oi(this.x),Ui(this.y))}toAltitude(){return this.z*Vi(Ui(this.y))}meterInMercatorCoordinateUnits(){return 1/Li*(t=Ui(this.y),1/Math.cos(t*Math.PI/180));var t}}function qi(t,e,n,i,s,a,o,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 a=r-i,o=n-s;return Math.abs((n-e)*a-(r-t)*o)/Math.hypot(a,o)}(p.x,p.y,a.x,a.y,o.x,o.y)>=u?(qi(t,e,n,c,h,a,p,l,u),qi(t,c,h,i,s,p,o,l,u)):t.push(o)}function Ni(t,e,r){let n=t[0],i=n.x,s=n.y;e(n);const a=[n];for(let o=1;o<t.length;o++){const l=t[o],{x:u,y:c}=l;e(l),qi(a,i,s,u,c,n,l,e,r),i=u,s=c,n=l}return a}function Zi(t,e,r,n,i){if(i(e,r)){const s=e.add(r).mult(.5);n(s),Zi(t,e,s,n,i),Zi(t,s,r,n,i)}else t.push(r)}function Gi(t,e,r){let n=t[0];e(n);const i=[n];for(let s=1;s<t.length;s++){const a=t[s];e(a),Zi(i,n,a,e,r),n=a}return i}const Xi=Math.pow(2,14)-1,Yi=-Xi-1;function Ji(t,e){const r=Math.round(t.x*e),n=Math.round(t.y*e);return t.x=u(r,Yi,Xi),t.y=u(n,Yi,Xi),(r<t.x||r>t.x+1||n<t.y||n>t.y+1)&&_("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function Ki(t,e,r){const n=t.loadGeometry(),i=t.extent,s=Di/i;if(e&&r&&r.projection.isReprojectedInTileSpace){const s=1<<e.z,{scale:a,x:o,y:l,projection:u}=r,c=t=>{const r=Oi((e.x+t.x/i)/s),n=Ui((e.y+t.y/i)/s),c=u.project(r,n);t.x=(c.x*a-o)*i,t.y=(c.y*a-l)*i};for(let e=0;e<n.length;e++)if(1!==t.type)n[e]=Ni(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)Ji(e,s);return n}function Wi(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Ki(t):[]}}function Hi(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}function Qi(t,e,r){const n=16384;t.emplaceBack(e.x,e.y,e.z,r[0]*n,r[1]*n,r[2]*n)}class CircleBucket{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.projection=t.projection,this.layoutVertexArray=new StructArrayLayout2i4,this.indexArray=new StructArrayLayout3ui6,this.segments=new SegmentVector,this.programConfigurations=new ProgramConfigurationSet(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 a=null;"circle"===i.type&&(a=i.layout.get("circle-sort-key"));for(const{feature:e,id:i,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Wi(e,t);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),u,r))continue;const c=a?a.evaluate(u,{},r):void 0,h={id:i,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Ki(e,r,n),patterns:{},sortKey:c};s.push(h)}a&&s.sort(((t,e)=>t.sortKey-e.sortKey));let o=null;"globe"===n.projection.name&&(this.globeExtVertexArray=new CircleGlobeExtArray,o=n.projection);for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n,l=t[s].feature;this.addFeature(n,i,s,e.availableImages,r,o),e.featureIndex.insert(l,i,s,a,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,zi.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,Ei.members))),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(t,e,r,n,i,s){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=Di||n<0||n>=Di)continue;if(s){const t=s.projectTilePoint(r,n,i),e=s.upVector(i,r,n),a=this.globeExtVertexArray;Qi(a,t,e),Qi(a,t,e),Qi(a,t,e),Qi(a,t,e)}const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=a.vertexLength;Hi(this.layoutVertexArray,r,n,-1,-1),Hi(this.layoutVertexArray,r,n,1,-1),Hi(this.layoutVertexArray,r,n,1,1),Hi(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+2,o+3),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n,i)}}function ts(t,e){for(let r=0;r<t.length;r++)if(us(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(us(t,e[r]))return!0;return!!is(t,e)}function es(t,e,r){return!!us(t,e)||!!as(e,t,r)}function rs(t,e){if(1===t.length)return ls(e,t[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++)if(us(t,n[e]))return!0}for(let r=0;r<t.length;r++)if(ls(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(is(t,e[r]))return!0;return!1}function ns(t,e,r){if(t.length>1){if(is(t,e))return!0;for(let n=0;n<e.length;n++)if(as(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(as(t[n],e,r))return!0;return!1}function is(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(ss(n,i,e[t],e[t+1]))return!0}return!1}function ss(t,e,r,n){return w(t,r,n)!==w(e,r,n)&&w(t,e,r)!==w(t,e,n)}function as(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(os(t,e[r-1],e[r])<n)return!0;return!1}function os(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 ls(t,e){let r,n,i,s=!1;for(let a=0;a<t.length;a++){r=t[a];for(let t=0,a=r.length-1;t<r.length;a=t++)n=r[t],i=r[a],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s)}return s}function us(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const s=t[n],a=t[i];s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function cs(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=w(t,e,r[0]);return s!==w(t,e,r[1])||s!==w(t,e,r[2])||s!==w(t,e,r[3])}function hs(t,e,r){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function ps(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ds(t,e,n,i,s){if(!e[0]&&!e[1])return t;const a=r.convert(e)._mult(s);"viewport"===n&&a._rotate(-i);const o=[];for(let e=0;e<t.length;e++)o.push(t[e].sub(a));return o}function fs(t,e,n,i){const s=r.convert(t)._mult(i);return"viewport"===e&&s._rotate(-n),s}Sr(CircleBucket,"CircleBucket",{omit:["layers"]});const ys=new Properties({"circle-sort-key":new DataDrivenProperty(Tr.layout_circle["circle-sort-key"])});var ms={paint:new Properties({"circle-radius":new DataDrivenProperty(Tr.paint_circle["circle-radius"]),"circle-color":new DataDrivenProperty(Tr.paint_circle["circle-color"]),"circle-blur":new DataDrivenProperty(Tr.paint_circle["circle-blur"]),"circle-opacity":new DataDrivenProperty(Tr.paint_circle["circle-opacity"]),"circle-translate":new DataConstantProperty(Tr.paint_circle["circle-translate"]),"circle-translate-anchor":new DataConstantProperty(Tr.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new DataConstantProperty(Tr.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new DataConstantProperty(Tr.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new DataDrivenProperty(Tr.paint_circle["circle-stroke-width"]),"circle-stroke-color":new DataDrivenProperty(Tr.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new DataDrivenProperty(Tr.paint_circle["circle-stroke-opacity"])}),layout:ys},gs=1e-6,xs="undefined"!=typeof Float32Array?Float32Array:Array;function vs(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 bs(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],d=e[11],f=e[12],y=e[13],m=e[14],g=e[15],x=r*o-n*a,v=r*l-i*a,b=r*u-s*a,_=n*l-i*o,w=n*u-s*o,S=i*u-s*l,A=c*y-h*f,k=c*m-p*f,I=c*g-d*f,M=h*m-p*y,P=h*g-d*y,C=p*g-d*m,T=x*C-v*P+b*M+_*I-w*k+S*A;return T?(t[0]=(o*C-l*P+u*M)*(T=1/T),t[1]=(i*P-n*C-s*M)*T,t[2]=(y*S-m*w+g*_)*T,t[3]=(p*w-h*S-d*_)*T,t[4]=(l*I-a*C-u*k)*T,t[5]=(r*C-i*I+s*k)*T,t[6]=(m*b-f*S-g*v)*T,t[7]=(c*S-p*b+d*v)*T,t[8]=(a*P-o*I+u*A)*T,t[9]=(n*I-r*P-s*A)*T,t[10]=(f*w-y*b+g*x)*T,t[11]=(h*b-c*w-d*x)*T,t[12]=(o*k-a*M-l*A)*T,t[13]=(r*M-n*k+i*A)*T,t[14]=(y*v-f*_-m*x)*T,t[15]=(c*_-h*v+p*x)*T,t):null}function _s(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],y=e[12],m=e[13],g=e[14],x=e[15],v=r[0],b=r[1],_=r[2],w=r[3];return t[0]=v*n+b*o+_*h+w*y,t[1]=v*i+b*l+_*p+w*m,t[2]=v*s+b*u+_*d+w*g,t[3]=v*a+b*c+_*f+w*x,t[4]=(v=r[4])*n+(b=r[5])*o+(_=r[6])*h+(w=r[7])*y,t[5]=v*i+b*l+_*p+w*m,t[6]=v*s+b*u+_*d+w*g,t[7]=v*a+b*c+_*f+w*x,t[8]=(v=r[8])*n+(b=r[9])*o+(_=r[10])*h+(w=r[11])*y,t[9]=v*i+b*l+_*p+w*m,t[10]=v*s+b*u+_*d+w*g,t[11]=v*a+b*c+_*f+w*x,t[12]=(v=r[12])*n+(b=r[13])*o+(_=r[14])*h+(w=r[15])*y,t[13]=v*i+b*l+_*p+w*m,t[14]=v*s+b*u+_*d+w*g,t[15]=v*a+b*c+_*f+w*x,t}function ws(t,e,r){var n,i,s,a,o,l,u,c,h,p,d,f,y=r[0],m=r[1],g=r[2];return 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],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],t[0]=n=e[0],t[1]=i,t[2]=s,t[3]=a,t[4]=o,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=d,t[11]=f,t[12]=n*y+o*m+h*g+e[12],t[13]=i*y+l*m+p*g+e[13],t[14]=s*y+u*m+d*g+e[14],t[15]=a*y+c*m+f*g+e[15]),t}function Ss(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 As(){var t=new xs(3);return xs!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ks(t){var e=new xs(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Is(t){return Math.hypot(t[0],t[1],t[2])}function Ms(t,e,r){var n=new xs(3);return n[0]=t,n[1]=e,n[2]=r,n}function Ps(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function Cs(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function Ts(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 zs(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}function Es(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ds(t,e,r){var n=e[0],i=e[1],s=e[2],a=r[3]*n+r[7]*i+r[11]*s+r[15];return t[0]=(r[0]*n+r[4]*i+r[8]*s+r[12])/(a=a||1),t[1]=(r[1]*n+r[5]*i+r[9]*s+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*s+r[14])/a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Bs,Ls=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t};function Vs(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*a,t}function Fs(){var t=new xs(4);return xs!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}As(),function(){var t;t=new xs(4),xs!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),As(),Ms(1,0,0),Ms(0,1,0),Fs(),Fs(),Bs=new xs(9),xs!=Float32Array&&(Bs[1]=0,Bs[2]=0,Bs[3]=0,Bs[5]=0,Bs[6]=0,Bs[7]=0),Bs[0]=1,Bs[4]=1,Bs[8]=1;class Ray{constructor(t,e){this.pos=t,this.dir=e}intersectsPlane(t,e,r){const n=Es(e,this.dir);if(Math.abs(n)<1e-6)return!1;const i=((t[0]-this.pos[0])*e[0]+(t[1]-this.pos[1])*e[1]+(t[2]-this.pos[2])*e[2])/n;return r[0]=this.pos[0]+this.dir[0]*i,r[1]=this.pos[1]+this.dir[1]*i,r[2]=this.pos[2]+this.dir[2]*i,!0}closestPointOnSphere(t,e,r){if(function(t,e){var r=t[0],n=t[1],i=t[2],s=e[0],a=e[1],o=e[2];return Math.abs(r-s)<=gs*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-a)<=gs*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-o)<=gs*Math.max(1,Math.abs(i),Math.abs(o))}(this.pos,t)||0===e)return r[0]=r[1]=r[2]=0,!1;const[n,i,s]=this.dir,a=this.pos[0]-t[0],o=this.pos[1]-t[1],l=this.pos[2]-t[2],u=n*n+i*i+s*s,c=2*(a*n+o*i+l*s),h=c*c-4*u*(a*a+o*o+l*l-e*e);if(h<0){const t=Math.max(-c/2,0),u=a+n*t,h=o+i*t,p=l+s*t,d=Math.hypot(u,h,p);return r[0]=u*e/d,r[1]=h*e/d,r[2]=p*e/d,!1}{const t=(-c-Math.sqrt(h))/(2*u);if(t<0){const t=Math.hypot(a,o,l);return r[0]=a*e/t,r[1]=o*e/t,r[2]=l*e/t,!1}return r[0]=a+n*t,r[1]=o+i*t,r[2]=l+s*t,!0}}}class Aabb{static fromPoints(t){const e=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],r=[Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE];for(const n of t)e[0]=Math.min(e[0],n[0]),e[1]=Math.min(e[1],n[1]),e[2]=Math.min(e[2],n[2]),r[0]=Math.max(r[0],n[0]),r[1]=Math.max(r[1],n[1]),r[2]=Math.max(r[2],n[2]);return new Aabb(e,r)}constructor(t,e){this.min=t,this.max=e,this.center=Cs([],Ps([],this.min,this.max),.5)}quadrant(t){const e=[t%2==0,t<2],r=ks(this.min),n=ks(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 Aabb(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 n=0;n<t.planes.length;n++){const i=t.planes[n];let s=0;for(let t=0;t<e.length;t++)s+=Es(i,e[t])+i[3]>=0;if(0===s)return 0;s!==e.length&&(r=!1)}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 Rs(t,e,r,n,i,s,a,o,l){if(s&&t.queryGeometry.isAboveHorizon)return!1;s&&(l*=t.pixelToTileUnitsFactor);const u=t.tileID.canonical,c=r.projection.upVectorScale(u,r.center.lat,r.worldSize).metersToTile;for(const h of e)for(const e of h){const h=e.add(o),p=i&&r.elevation?r.elevation.exaggeration()*i.getElevationAt(h.x,h.y,!0):0,d=r.projection.projectTilePoint(h.x,h.y,u);if(p>0){const t=r.projection.upVector(u,h.x,h.y);d.x+=t[0]*c*p,d.y+=t[1]*c*p,d.z+=t[2]*c*p}const f=s?h:js(d.x,d.y,d.z,n),y=s?t.tilespaceRays.map((t=>$s(t,p))):t.queryGeometry.screenGeometry,m=Vs([],[d.x,d.y,d.z,1],n);if(!a&&s?l*=m[3]/r.cameraToCenterDistance:a&&!s&&(l*=r.cameraToCenterDistance/m[3]),s){const t=Ui((e.y/Di+u.y)/(1<<u.z));l/=r.projection.pixelsPerMeter(t,1)/ji(1,t)}if(es(y,f,l))return!0}return!1}function js(t,e,n,i){const s=Vs([],[t,e,n,1],i);return new r(s[0]/s[3],s[1]/s[3])}const Os=Ms(0,0,0),Us=Ms(0,0,1);function $s(t,e){const n=As();return Os[2]=e,t.intersectsPlane(Os,Us,n),new r(n[0],n[1])}class HeatmapBucket extends CircleBucket{}function qs(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError("mismatched image size")}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function Ns(t,e,r){const{width:n,height:i}=e;n===t.width&&i===t.height||(Zs(t,e,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},r),t.width=n,t.height=i,t.data=e.data)}function Zs(t,e,r,n,i,s){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,o=e.data;for(let l=0;l<i.height;l++){const u=((r.y+l)*t.width+r.x)*s,c=((n.y+l)*e.width+n.x)*s;for(let t=0;t<i.width*s;t++)o[c+t]=a[u+t]}return e}Sr(HeatmapBucket,"HeatmapBucket",{omit:["layers"]});class AlphaImage{constructor(t,e){qs(this,t,1,e)}resize(t){Ns(this,new AlphaImage(t),1)}clone(){return new AlphaImage({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){Zs(t,e,r,n,i,1)}}class RGBAImage{constructor(t,e){qs(this,t,4,e)}resize(t){Ns(this,new RGBAImage(t),4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new RGBAImage({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){Zs(t,e,r,n,i,4)}}Sr(AlphaImage,"AlphaImage"),Sr(RGBAImage,"RGBAImage");var Gs={paint:new Properties({"heatmap-radius":new DataDrivenProperty(Tr.paint_heatmap["heatmap-radius"]),"heatmap-weight":new DataDrivenProperty(Tr.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new DataConstantProperty(Tr.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ColorRampProperty(Tr.paint_heatmap["heatmap-color"]),"heatmap-opacity":new DataConstantProperty(Tr.paint_heatmap["heatmap-opacity"])})};function Xs(t){const e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new RGBAImage({width:r,height:n}),s=(r,n,s)=>{e[t.evaluationKey]=s;const a=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*a.r/a.a),i.data[r+n+1]=Math.floor(255*a.g/a.a),i.data[r+n+2]=Math.floor(255*a.b/a.a),i.data[r+n+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,a=0;n<r;n++,a+=4){const o=n/(r-1),{start:l,end:u}=t.clips[e];s(i,a,l*(1-o)+u*o)}else for(let t=0,e=0;t<r;t++,e+=4)s(0,e,t/(r-1));return i}var Ys={paint:new Properties({"hillshade-illumination-direction":new DataConstantProperty(Tr.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new DataConstantProperty(Tr.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new DataConstantProperty(Tr.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new DataConstantProperty(Tr.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new DataConstantProperty(Tr.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new DataConstantProperty(Tr.paint_hillshade["hillshade-accent-color"])})};const Js=di([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ks}=Js;var Ws=Qs,Hs=Qs;function Qs(t,e,r){r=r||2;var n,i,s,a,o,l,u,c=e&&e.length,h=c?e[0]*r:t.length,p=ta(t,0,h,r,!0),d=[];if(!p||p.next===p.prev)return d;if(c&&(p=function(t,e,r,n){var i,s,a,o=[];for(i=0,s=e.length;i<s;i++)(a=ta(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),o.push(ha(a));for(o.sort(oa),i=0;i<o.length;i++)r=la(o[i],r);return r}(t,e,p,r)),t.length>80*r){n=s=t[0],i=a=t[1];for(var f=r;f<h;f+=r)(o=t[f])<n&&(n=o),(l=t[f+1])<i&&(i=l),o>s&&(s=o),l>a&&(a=l);u=0!==(u=Math.max(s-n,a-i))?32767/u:0}return ra(p,d,r,n,i,u,0),d}function ta(t,e,r,n,i){var s,a;if(i===Aa(t,e,r,n)>0)for(s=e;s<r;s+=n)a=_a(s,t[s],t[s+1],a);else for(s=r-n;s>=e;s-=n)a=_a(s,t[s],t[s+1],a);return a&&ya(a,a.next)&&(wa(a),a=a.next),a}function ea(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!ya(n,n.next)&&0!==fa(n.prev,n,n.next))n=n.next;else{if(wa(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function ra(t,e,r,n,i,s,a){if(t){!a&&s&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=ca(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,s,a,o,l,u=1;do{for(r=t,t=null,s=null,a=0;r;){for(a++,n=r,o=0,e=0;e<u&&(o++,n=n.nextZ);e++);for(l=u;o>0||l>0&&n;)0!==o&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=n}s.nextZ=null,u*=2}while(a>1)}(i)}(t,n,i,s);for(var o,l,u=t;t.prev!==t.next;)if(o=t.prev,l=t.next,s?ia(t,n,i,s):na(t))e.push(o.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),wa(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?ra(t=sa(ea(t),e,r),e,r,n,i,s,2):2===a&&aa(t,e,r,n,i,s):ra(ea(t),e,r,n,i,s,1);break}}}function na(t){var e=t.prev,r=t,n=t.next;if(fa(e,r,n)>=0)return!1;for(var i=e.x,s=r.x,a=n.x,o=e.y,l=r.y,u=n.y,c=i<s?i<a?i:a:s<a?s:a,h=o<l?o<u?o:u:l<u?l:u,p=i>s?i>a?i:a:s>a?s:a,d=o>l?o>u?o:u:l>u?l:u,f=n.next;f!==e;){if(f.x>=c&&f.x<=p&&f.y>=h&&f.y<=d&&pa(i,o,s,l,a,u,f.x,f.y)&&fa(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function ia(t,e,r,n){var i=t.prev,s=t,a=t.next;if(fa(i,s,a)>=0)return!1;for(var o=i.x,l=s.x,u=a.x,c=i.y,h=s.y,p=a.y,d=o<l?o<u?o:u:l<u?l:u,f=c<h?c<p?c:p:h<p?h:p,y=o>l?o>u?o:u:l>u?l:u,m=c>h?c>p?c:p:h>p?h:p,g=ca(d,f,e,r,n),x=ca(y,m,e,r,n),v=t.prevZ,b=t.nextZ;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=d&&v.x<=y&&v.y>=f&&v.y<=m&&v!==i&&v!==a&&pa(o,c,l,h,u,p,v.x,v.y)&&fa(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,b.x>=d&&b.x<=y&&b.y>=f&&b.y<=m&&b!==i&&b!==a&&pa(o,c,l,h,u,p,b.x,b.y)&&fa(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=y&&v.y>=f&&v.y<=m&&v!==i&&v!==a&&pa(o,c,l,h,u,p,v.x,v.y)&&fa(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=d&&b.x<=y&&b.y>=f&&b.y<=m&&b!==i&&b!==a&&pa(o,c,l,h,u,p,b.x,b.y)&&fa(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function sa(t,e,r){var n=t;do{var i=n.prev,s=n.next.next;!ya(i,s)&&ma(i,n,n.next,s)&&va(i,s)&&va(s,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(s.i/r|0),wa(n),wa(n.next),n=t=s),n=n.next}while(n!==t);return ea(n)}function aa(t,e,r,n,i,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&da(a,o)){var l=ba(a,o);return a=ea(a,a.next),l=ea(l,l.next),ra(a,e,r,n,i,s,0),void ra(l,e,r,n,i,s,0)}o=o.next}a=a.next}while(a!==t)}function oa(t,e){return t.x-e.x}function la(t,e){var r=function(t,e){var r,n=e,i=t.x,s=t.y,a=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var o=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(o<=i&&o>a&&(a=o,r=n.x<n.next.x?n:n.next,o===i))return r}n=n.next}while(n!==e);if(!r)return null;var l,u=r,c=r.x,h=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&pa(s<h?i:a,s,c,h,s<h?a:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),va(n,t)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&ua(r,n)))&&(r=n,p=l)),n=n.next}while(n!==u);return r}(t,e);if(!r)return e;var n=ba(r,t);return ea(n,n.next),ea(r,r.next)}function ua(t,e){return fa(t.prev,t,e.prev)<0&&fa(e.next,t,t.next)<0}function ca(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ha(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,a,o){return(i-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(n-o)>=(r-a)*(e-o)&&(r-a)*(s-o)>=(i-a)*(n-o)}function da(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&ma(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(va(t,e)&&va(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)&&(fa(t.prev,t,e.prev)||fa(t,e.prev,e))||ya(t,e)&&fa(t.prev,t,t.next)>0&&fa(e.prev,e,e.next)>0)}function fa(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ya(t,e){return t.x===e.x&&t.y===e.y}function ma(t,e,r,n){var i=xa(fa(t,e,r)),s=xa(fa(t,e,n)),a=xa(fa(r,n,t)),o=xa(fa(r,n,e));return i!==s&&a!==o||!(0!==i||!ga(t,r,e))||!(0!==s||!ga(t,n,e))||!(0!==a||!ga(r,t,n))||!(0!==o||!ga(r,e,n))}function ga(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 xa(t){return t>0?1:t<0?-1:0}function va(t,e){return fa(t.prev,t,t.next)<0?fa(t,e,t.next)>=0&&fa(t,t.prev,e)>=0:fa(t,e,t.prev)<0||fa(t,t.next,e)<0}function ba(t,e){var r=new Sa(t.i,t.x,t.y),n=new Sa(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 _a(t,e,r,n){var i=new Sa(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 wa(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 Sa(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Aa(t,e,r,n){for(var i=0,s=e,a=r-n;s<r;s+=n)i+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return i}function ka(t,e,r,n,i){Ia(t,e,r||0,n||t.length-1,i||Pa)}function Ia(t,e,r,n,i){for(;n>r;){if(n-r>600){var s=n-r+1,a=e-r+1,o=Math.log(s),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(s-l)/s)*(a-s/2<0?-1:1);Ia(t,e,Math.max(r,Math.floor(e-a*l/s+u)),Math.min(n,Math.floor(e+(s-a)*l/s+u)),i)}var c=t[e],h=r,p=n;for(Ma(t,r,e),i(t[n],c)>0&&Ma(t,r,n);h<p;){for(Ma(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--}0===i(t[r],c)?Ma(t,r,p):Ma(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1)}}function Ma(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Pa(t,e){return t<e?-1:t>e?1:0}function Ca(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=S(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||(ka(n[t],e,1,n[t].length-1,Ta),n[t]=n[t].slice(0,e));return n}function Ta(t,e){return e.area-t.area}function za(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 Ea(t,e,r,n,i){const s=i.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},r,{},i.availableImages),o=e.evaluate({zoom:n},r,{},i.availableImages),l=e.evaluate({zoom:n+1},r,{},i.availableImages);t=t&&t.name?t.name:t,o=o&&o.name?o.name:o,l=l&&l.name?l.name:l,s[t]=!0,s[o]=!0,s[l]=!0,r.patterns[a.id]={min:t,mid:o,max:l}}}return r}Qs.deviation=function(t,e,r,n){var i=e&&e.length,s=Math.abs(Aa(t,0,i?e[0]*r:t.length,r));if(i)for(var a=0,o=e.length;a<o;a++)s-=Math.abs(Aa(t,e[a]*r,a<o-1?e[a+1]*r:t.length,r));var l=0;for(a=0;a<n.length;a+=3){var u=n[a]*r,c=n[a+1]*r,h=n[a+2]*r;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},Qs.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var a=0;a<e;a++)r.vertices.push(t[i][s][a]);i>0&&r.holes.push(n+=t[i-1].length)}return r},Ws.default=Hs;class FillBucket{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 StructArrayLayout2i4,this.indexArray=new StructArrayLayout3ui6,this.indexArray2=new StructArrayLayout2ui4,this.programConfigurations=new ProgramConfigurationSet(t.layers,t.zoom),this.segments=new SegmentVector,this.segments2=new SegmentVector,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.projection=t.projection}populate(t,e,r,n){this.hasPattern=za("fill",this.layers,e);const i=this.layers[0].layout.get("fill-sort-key"),s=[];for(const{feature:a,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Wi(a,t);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),c,r))continue;const h=i?i.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Ki(a,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:a}=n;if(this.hasPattern){const t=Ea("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,a,this.index)}}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}addFeatures(t,e,r,n,i){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,Ks),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 Ca(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),i.push(e[t].x),i.push(e[t].y);r.vertexLength+=e.length,r.primitiveLength+=e.length}const a=Ws(i,s);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(n+a[t],n+a[t+1],n+a[t+2]);r.vertexLength+=e,r.primitiveLength+=a.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n)}}Sr(FillBucket,"FillBucket",{omit:["layers","patternFeatures"]});const Da=new Properties({"fill-sort-key":new DataDrivenProperty(Tr.layout_fill["fill-sort-key"])});var Ba={paint:new Properties({"fill-antialias":new DataConstantProperty(Tr.paint_fill["fill-antialias"]),"fill-opacity":new DataDrivenProperty(Tr.paint_fill["fill-opacity"]),"fill-color":new DataDrivenProperty(Tr.paint_fill["fill-color"]),"fill-outline-color":new DataDrivenProperty(Tr.paint_fill["fill-outline-color"]),"fill-translate":new DataConstantProperty(Tr.paint_fill["fill-translate"]),"fill-translate-anchor":new DataConstantProperty(Tr.paint_fill["fill-translate-anchor"]),"fill-pattern":new CrossFadedDataDrivenProperty(Tr.paint_fill["fill-pattern"])}),layout:Da};const La=di([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Va=di([{name:"a_centroid_pos",components:2,type:"Uint16"}]),Fa=di([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:Ra}=La;var ja=Oa;function Oa(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(Ua,this,e)}function Ua(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 $a(t){for(var e,r,n=0,i=0,s=t.length,a=s-1;i<s;a=i++)n+=((r=t[a]).x-(e=t[i]).x)*(e.y+r.y);return n}Oa.types=["Unknown","Point","LineString","Polygon"],Oa.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,i=1,s=0,a=0,o=0,l=[];t.pos<n;){if(s<=0){var u=t.readVarint();i=7&u,s=u>>3}if(s--,1===i||2===i)a+=t.readSVarint(),o+=t.readSVarint(),1===i&&(e&&l.push(e),e=[]),e.push(new r(a,o));else{if(7!==i)throw new Error("unknown command "+i);e&&e.push(e[0].clone())}}return e&&l.push(e),l},Oa.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<a&&(a=i),i>o&&(o=i),(s+=t.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,o,u]},Oa.prototype.toGeoJSON=function(t,e,r){var n,i,s=this.extent*Math.pow(2,r),a=this.extent*t,o=this.extent*e,l=this.loadGeometry(),u=Oa.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+a)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+o)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],s=0;s<e;s++){var a=$a(t[s]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(r&&i.push(r),r=[t[s]]):r.push(t[s]))}return r&&i.push(r),i}(l),n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)c(l[n][i])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var qa=Na;function Na(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(Za,this,e),this.length=this._features.length}function Za(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 Ga(t,e,r){if(3===t){var n=new qa(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}Na.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 ja(this._pbf,e,this.extent,this._keys,this._values)};var Xa={VectorTile:function(t,e){this.layers=t.readFields(Ga,{},e)},VectorTileFeature:ja,VectorTileLayer:qa};function Ya(t,e,n,i){const s=[],a=0===i?(t,e,n,i,s,a)=>{t.push(new r(a,n+(a-e)/(i-e)*(s-n)))}:(t,e,n,i,s,a)=>{t.push(new r(e+(a-n)/(s-n)*(i-e),a))};for(const r of t){const t=[];for(const s of r){if(s.length<=2)continue;const r=[];for(let t=0;t<s.length-1;t++){const o=s[t].x,l=s[t].y,u=s[t+1].x,c=s[t+1].y,h=0===i?o:l,p=0===i?u:c;h<e?p>e&&a(r,o,l,u,c,e):h>n?p<n&&a(r,o,l,u,c,n):r.push(s[t]),p<e&&h>=e&&a(r,o,l,u,c,e),p>n&&h<=n&&a(r,o,l,u,c,n)}let o=s[s.length-1];const l=0===i?o.x:o.y;l>=e&&l<=n&&r.push(o),r.length&&(o=r[r.length-1],r[0].x===o.x&&r[0].y===o.y||r.push(r[0]),t.push(r))}t.length&&s.push(t)}return s}const Ja=Xa.VectorTileFeature.types,Ka=Math.pow(2,13);function Wa(t,e,r,n,i,s,a,o){t.emplaceBack((e<<1)+a,(r<<1)+s,(Math.floor(n*Ka)<<1)+i,Math.round(o))}function Ha(t,e,r){const n=16384;t.emplaceBack(e.x,e.y,e.z,r[0]*n,r[1]*n,r[2]*n)}class PartMetadata{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);const r=this.min,n=this.max;t.x<r.x?r.x=t.x:t.x>n.x&&(n.x=t.x),t.y<r.y?r.y=t.y:t.y>n.y&&(n.y=t.y),((0===t.x||t.x===Di)&&t.x===e.x)!=((0===t.y||t.y===Di)&&t.y===e.y)&&this.processBorderOverlap(t,e),e.x<0!=t.x<0&&this.addBorderIntersection(0,jt(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>Di!=t.x>Di&&this.addBorderIntersection(1,jt(e.y,t.y,(Di-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,jt(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>Di!=t.y>Di&&this.addBorderIntersection(3,jt(e.x,t.x,(Di-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 FillExtrusionBucket{constructor(t){this.zoom=t.zoom,this.canonical=t.canonical,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=t.projection,this.layoutVertexArray=new StructArrayLayout4i8,this.centroidVertexArray=new FillExtrusionCentroidArray,this.indexArray=new StructArrayLayout3ui6,this.programConfigurations=new ProgramConfigurationSet(t.layers,t.zoom),this.segments=new SegmentVector,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=za("fill-extrusion",this.layers,e),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-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)/Di/(1<<t.z)}(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;for(const{feature:i,id:s,index:a,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,l=Wi(i,t);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),l,r))continue;const u={id:s,sourceLayerIndex:o,index:a,geometry:t?l.geometry:Ki(i,r,n),properties:i.properties,type:i.type,patterns:{}},c=this.layoutVertexArray.length;this.hasPattern?this.features.push(Ea("fill-extrusion",this.layers,u,this.zoom,e)):this.addFeature(u,u.geometry,a,r,{},e.availableImages,n),e.featureIndex.insert(i,u.geometry,a,o,this.index,c)}this.sortBorders()}addFeatures(t,e,r,n,i){for(const t of this.features){const{geometry:s}=t;this.addFeature(t,s,t.index,e,r,n,i)}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,Ra),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=t.createVertexBuffer(this.layoutVertexExtArray,Fa.members,!0))),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,Va.members,!0),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,n,i,s,a,o){const l=[new r(0,0),new r(Di,Di)],u=o.projection,c="globe"===u.name,h=this.enableTerrain&&!c?new PartMetadata:null,p="Polygon"===Ja[t.type];c&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new FillExtrusionExtArray);const d=Ca(e,500);for(let t=d.length-1;t>=0;t--){const e=d[t];(0===e.length||(f=e[0]).every((t=>t.x<=0))||f.every((t=>t.x>=Di))||f.every((t=>t.y<=0))||f.every((t=>t.y>=Di)))&&d.splice(t,1)}var f;let y;if(c)y=so(d,l,i);else{y=[];for(const t of d)y.push({polygon:t,bounds:l})}const m=p?this.edgeRadius:0;for(const{polygon:t,bounds:e}of y){let r=0,n=0;for(const e of t)p&&!e[0].equals(e[e.length-1])&&e.push(e[0]),n+=p?e.length-1:e.length;const s=this.segments.prepareSegment((p?5:4)*n,this.layoutVertexArray,this.indexArray);if(p){const e=[],n=[];r=s.vertexLength;for(const r of t){let a,o;r.length&&r!==t[0]&&n.push(e.length/2),a=r[1].sub(r[0])._perp()._unit();for(let t=1;t<r.length;t++){const n=r[t],l=r[t===r.length-1?1:t+1];let{x:h,y:p}=n;if(m){o=l.sub(n)._perp()._unit();const t=a.add(o)._unit(),e=m*Math.min(4,1/(a.x*t.x+a.y*t.y));h+=e*t.x,p+=e*t.y,a=o}Wa(this.layoutVertexArray,h,p,0,0,1,1,0),s.vertexLength++,e.push(n.x,n.y),c&&Ha(this.layoutVertexExtArray,u.projectTilePoint(h,p,i),u.upVector(i,h,p))}}const a=Ws(e,n);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(r+a[t],r+a[t+2],r+a[t+1]),s.primitiveLength++}for(const n of t){h&&n.length&&h.startRing(n[0]);let t,a,o,l=n.length>4&&no(n[n.length-2],n[0],n[1]),d=m?to(n[n.length-2],n[0],n[1],m):0;a=n[1].sub(n[0])._perp()._unit();for(let f=1,y=0;f<n.length;f++){let g=n[f-1],x=n[f];const v=n[f===n.length-1?1:f+1];if(h&&p&&h.currentPolyCount.top++,ro(x,g,e)){m&&(a=v.sub(x)._perp()._unit());continue}h&&h.append(x,g);const b=x.sub(g)._perp(),_=b.x/(Math.abs(b.x)+Math.abs(b.y)),w=b.y>0?1:0,S=g.dist(x);if(y+S>32768&&(y=0),m){o=v.sub(x)._perp()._unit();let t=eo(g,x,v,Qa(a,o),m);isNaN(t)&&(t=0);const e=x.sub(g)._unit();g=g.add(e.mult(d))._round(),x=x.add(e.mult(-t))._round(),d=t,a=o}const A=s.vertexLength,k=n.length>4&&no(g,x,v);let I=io(y,l,!0);if(Wa(this.layoutVertexArray,g.x,g.y,_,w,0,0,I),Wa(this.layoutVertexArray,g.x,g.y,_,w,0,1,I),y+=S,I=io(y,k,!1),l=k,Wa(this.layoutVertexArray,x.x,x.y,_,w,0,0,I),Wa(this.layoutVertexArray,x.x,x.y,_,w,0,1,I),s.vertexLength+=4,this.indexArray.emplaceBack(A+0,A+1,A+2),this.indexArray.emplaceBack(A+1,A+3,A+2),s.primitiveLength+=2,m){const i=r+(1===f?n.length-2:f-2),a=1===f?r:i+1;if(this.indexArray.emplaceBack(A+1,i,A+3),this.indexArray.emplaceBack(i,a,A+3),s.primitiveLength+=2,void 0===t&&(t=A),!ro(v,n[f],e)){const e=f===n.length-1?t:s.vertexLength;this.indexArray.emplaceBack(A+2,A+3,e),this.indexArray.emplaceBack(A+3,e+1,e),this.indexArray.emplaceBack(A+3,a,e+1),s.primitiveLength+=3}}if(c){const t=this.layoutVertexExtArray,e=u.projectTilePoint(g.x,g.y,i),r=u.projectTilePoint(x.x,x.y,i),n=u.upVector(i,g.x,g.y),s=u.upVector(i,x.x,x.y);Ha(t,e,n),Ha(t,e,n),Ha(t,r,s),Ha(t,r,s)}}p&&(r+=n.length-1)}}if(h&&h.polyCount.length>0){if(h.borders){h.vertexArrayOffset=this.centroidVertexArray.length;const t=h.borders,e=this.featuresOnBorder.push(h)-1;for(let r=0;r<4;r++)t[r][0]!==Number.MAX_VALUE&&this.borders[r].push(e)}this.encodeCentroid(h.borders?void 0:h.centroid(),h)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,s,a,i)}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<t.top;e++)this.centroidVertexArray.emplace(s++,n,i);for(let e=0;e<2*t.edges;e++)this.centroidVertexArray.emplace(s++,0,i),this.centroidVertexArray.emplace(s++,n,i)}}}function Qa(t,e){const r=t.add(e)._unit();return t.x*r.x+t.y*r.y}function to(t,e,r,n){const i=e.sub(t)._perp()._unit(),s=r.sub(e)._perp()._unit();return eo(t,e,r,Qa(i,s),n)}function eo(t,e,r,n,i){const s=Math.sqrt(1-n*n);return Math.min(t.dist(e)/3,e.dist(r)/3,i*s/n)}function ro(t,e,r){return t.x<r[0].x&&e.x<r[0].x||t.x>r[1].x&&e.x>r[1].x||t.y<r[0].y&&e.y<r[0].y||t.y>r[1].y&&e.y>r[1].y}function no(t,e,r){if(t.x<0||t.x>=Di||e.x<0||e.x>=Di||r.x<0||r.x>=Di)return!1;const n=r.sub(e),i=n.perp(),s=t.sub(e);return(n.x*s.x+n.y*s.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(s.x*s.x+s.y*s.y))>-.866&&i.x*s.x+i.y*s.y<0}function io(t,e,r){const n=e?2|t:-3&t;return r?1|n:-2&n}function so(t,e,n){const i=1<<n.z,s=Oi(n.x/i),a=Oi((n.x+1)/i),o=Ui(n.y/i),l=Ui((n.y+1)/i);return function(t,e,n,i,s=0,a){const o=[];if(!t.length||!n||!i)return o;const l=(t,e)=>{for(const r of t)o.push({polygon:r,bounds:e})},u=Math.ceil(Math.log2(n)),c=Math.ceil(Math.log2(i)),h=u-c,p=[];for(let t=0;t<Math.abs(h);t++)p.push(h>0?0:1);for(let t=0;t<Math.min(u,c);t++)p.push(0),p.push(1);let d=t;if(d=Ya(d,e[0].y-s,e[1].y+s,1),d=Ya(d,e[0].x-s,e[1].x+s,0),!d.length)return o;const f=[];for(p.length?f.push({polygons:d,bounds:e,depth:0}):l(d,e);f.length;){const t=f.pop(),e=t.depth,n=p[e],i=t.bounds[0],o=t.bounds[1],u=0===n?i.x:i.y,c=0===n?o.x:o.y,h=a?a(n,u,c):.5*(u+c),d=Ya(t.polygons,u-s,h+s,n),y=Ya(t.polygons,h-s,c+s,n);if(d.length){const t=[i,new r(0===n?h:o.x,1===n?h:o.y)];p.length>e+1?f.push({polygons:d,bounds:t,depth:e+1}):l(d,t)}if(y.length){const t=[new r(0===n?h:i.x,1===n?h:i.y),o];p.length>e+1?f.push({polygons:y,bounds:t,depth:e+1}):l(y,t)}}return o}(t,e,Math.ceil((a-s)/11.25),Math.ceil((o-l)/11.25),1,((t,e,r)=>{if(0===t)return.5*(e+r);{const t=Ui((n.y+e/Di)/i);return(Ri(.5*(Ui((n.y+r/Di)/i)+t))*i-n.y)*Di}}))}Sr(FillExtrusionBucket,"FillExtrusionBucket",{omit:["layers","features"]}),Sr(PartMetadata,"PartMetadata");const ao=new Properties({"fill-extrusion-edge-radius":new DataConstantProperty(Tr["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var oo={paint:new Properties({"fill-extrusion-opacity":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new DataDrivenProperty(Tr["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new CrossFadedDataDrivenProperty(Tr["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new DataDrivenProperty(Tr["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new DataDrivenProperty(Tr["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:ao};function lo(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 CanonicalTileID{constructor(t,e,r){this.z=t,this.x=e,this.y=r,this.key=uo(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,a=lo(256*(n=this.x),256*(i=Math.pow(2,s)-i-1),s),o=lo(256*(n+1),256*(i+1),s),a[0]+","+a[1]+","+o[0]+","+o[1]);var n,i,s,a,o;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}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,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 UnwrappedTileID{constructor(t,e){this.wrap=t,this.canonical=e,this.key=uo(t,e.z,e.z,e.x,e.y)}}class OverscaledTileID{constructor(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new CanonicalTileID(r,+n,+i),this.key=0===e&&t===r?this.canonical.key:uo(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 OverscaledTileID(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new OverscaledTileID(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 uo(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-t;return uo(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 OverscaledTileID(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 OverscaledTileID(e,this.wrap,e,r,n),new OverscaledTileID(e,this.wrap,e,r+1,n),new OverscaledTileID(e,this.wrap,e,r,n+1),new OverscaledTileID(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 OverscaledTileID(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new OverscaledTileID(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 UnwrappedTileID(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function uo(t,e,r,n,i){const s=1<<Math.min(r,22);let a=s*(i%s)+n%s;return t&&r<22&&(a+=s*s*((t<0?-2*t-1:2*t)%(1<<2*(22-r)))),16*(32*a+r)+(e-r)}function co(t,e){return t.x*e.x+t.y*e.y}function ho(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){const s=e[r],a=t[0],o=i.sub(n),l=s.sub(n),u=a.sub(n),c=co(o,o),h=co(o,l),p=co(l,l),d=co(u,o),f=co(u,l),y=c*p-h*h,m=(p*d-h*f)/y,g=(c*f-h*d)/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 po(t){const e=new r(t[0],t[1]);return e.z=t[2],e}function fo(t,e,r,n,i,s,a,o){const l=a*i.getElevationAt(t,e,!0,!0),u=0!==s[0],c=u?0===s[1]?a*(s[0]/7-450):a*function(t,e,r){const n=Math.floor(e[0]/8),i=Math.floor(e[1]/8),s=10*(e[0]-8*n),a=10*(e[1]-8*i),o=t.getElevationAt(n,i,!0,!0),l=t.getMeterToDEM(r),u=Math.floor(.5*(s*l-1)),c=Math.floor(.5*(a*l-1)),h=t.tileCoordToPixel(n,i),p=2*u+1,d=2*c+1,f=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,d),y=Math.abs(f[0]-f[1]),m=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),x=Math.min(.25,.5*l*(y+m)/p),v=Math.min(.25,.5*l*g/d);return o+Math.max(x*s,v*a)}(i,s,o):l;return{base:l+(0===r)?-1:r,top:u?Math.max(c+n,l+r+2):l+n}}Sr(CanonicalTileID,"CanonicalTileID"),Sr(OverscaledTileID,"OverscaledTileID",{omit:["projMatrix"]});const yo=di([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:mo}=yo,go=di([{name:"a_packed",components:4,type:"Float32"}]),{members:xo}=go,vo=Xa.VectorTileFeature.types,bo=Math.cos(Math.PI/180*37.5);class LineBucket{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.projection=t.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new StructArrayLayout2i4ub1f12,this.layoutVertexArray2=new StructArrayLayout4f16,this.indexArray=new StructArrayLayout3ui6,this.programConfigurations=new ProgramConfigurationSet(t.layers,t.zoom),this.segments=new SegmentVector,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r,n){this.hasPattern=za("line",this.layers,e);const i=this.layers[0].layout.get("line-sort-key"),s=[];for(const{feature:e,id:a,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Wi(e,t);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),u,r))continue;const c=i?i.evaluate(u,{},r):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Ki(e,r,n),patterns:{},sortKey:c};s.push(h)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));const{lineAtlas:a,featureIndex:o}=e,l=this.addConstantDashes(a);for(const n of s){const{geometry:i,index:s,sourceLayerIndex:u}=n;if(l&&this.addFeatureDashes(n,a),this.hasPattern){const t=Ea("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,a.positions,e.availableImages);o.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 a,o,l,u,c,h;if("constant"===i.kind){const t=i.value;if(!t)continue;a=t.other||t.to,o=t.to,l=t.from}else a=i.evaluate({zoom:r-1},t),o=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(a,u),e.addDash(o,c),e.addDash(l,h);const p=e.getKey(a,u),d=e.getKey(o,c),f=e.getKey(l,h);t.patterns[n.id]={min:p,mid:d,max:f}}}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}addFeatures(t,e,r,n,i){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,xo)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,mo),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 a=this.layers[0].layout,o=a.get("line-join").evaluate(t,{}),l=a.get("line-cap").evaluate(t,{}),u=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,o,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 a="Polygon"===vo[e.type];let o=t.length;for(;o>=2&&t[o-1].equals(t[o-2]);)o--;let l=0;for(;l<o-1&&t[l].equals(t[l+1]);)l++;if(o<(a?3:2))return;"bevel"===r&&(i=1.05);const u=this.overscaling<=16?122880/(512*this.overscaling):0,c=this.segments.prepareSegment(10*o,this.layoutVertexArray,this.indexArray);let h,p,d,f,y;this.e1=this.e2=-1,a&&(h=t[o-2],y=t[l].sub(h)._unit()._perp());for(let e=l;e<o;e++){if(d=e===o-1?a?t[l+1]:void 0:t[e+1],d&&t[e].equals(d))continue;y&&(f=y),h&&(p=h),h=t[e],y=d?d.sub(h)._unit()._perp():f,f=f||y;let m=f.add(y);0===m.x&&0===m.y||m._unit();const g=f.x*y.x+f.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),_=x<bo&&p&&d,w=f.x*y.y-f.y*y.x>0;if(_&&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,f,0,0,c),p=e}}const S=p&&d;let A=S?r:a?"butt":n;if(S&&"round"===A&&(v<s?A="miter":v<=2&&(A="fakeround")),"miter"===A&&v>i&&(A="bevel"),"bevel"===A&&(v>2&&(A="flipbevel"),v<i&&(A="miter")),p&&this.updateDistance(p,h),"miter"===A)m._mult(v),this.addCurrentVertex(h,m,0,0,c);else if("flipbevel"===A){if(v>100)m=y.mult(-1);else{const t=v*f.add(y).mag()/f.sub(y).mag();m._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c)}else if("bevel"===A||"fakeround"===A){const t=-Math.sqrt(v*v-1),e=w?t:0,r=w?0:t;if(p&&this.addCurrentVertex(h,f,e,r,c),"fakeround"===A){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const n=y.sub(f)._mult(r)._add(f)._unit()._mult(w?-1:1);this.addHalfVertex(h,n.x,n.y,!1,w,0,c)}}d&&this.addCurrentVertex(h,y,-e,-r,c)}else if("butt"===A)this.addCurrentVertex(h,m,0,0,c);else if("square"===A){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"===A&&(p&&(this.addCurrentVertex(h,f,0,0,c),this.addCurrentVertex(h,f,1,1,c,!0)),d&&(this.addCurrentVertex(h,y,-1,-1,c,!0),this.addCurrentVertex(h,y,0,0,c)));if(_&&e<o-1){const t=h.dist(d);if(t>2*u){const e=h.add(d.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e}}}}addCurrentVertex(t,e,r,n,i,s=!1){const a=e.y*n-e.x,o=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,s,!1,r,i),this.addHalfVertex(t,a,o,s,!0,-n,i)}addHalfVertex({x:t,y:e},r,n,i,s,a,o){this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const l=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),o.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()}}Sr(LineBucket,"LineBucket",{omit:["layers","patternFeatures"]});const _o=new Properties({"line-cap":new DataDrivenProperty(Tr.layout_line["line-cap"]),"line-join":new DataDrivenProperty(Tr.layout_line["line-join"]),"line-miter-limit":new DataConstantProperty(Tr.layout_line["line-miter-limit"]),"line-round-limit":new DataConstantProperty(Tr.layout_line["line-round-limit"]),"line-sort-key":new DataDrivenProperty(Tr.layout_line["line-sort-key"])});var wo={paint:new Properties({"line-opacity":new DataDrivenProperty(Tr.paint_line["line-opacity"]),"line-color":new DataDrivenProperty(Tr.paint_line["line-color"]),"line-translate":new DataConstantProperty(Tr.paint_line["line-translate"]),"line-translate-anchor":new DataConstantProperty(Tr.paint_line["line-translate-anchor"]),"line-width":new DataDrivenProperty(Tr.paint_line["line-width"]),"line-gap-width":new DataDrivenProperty(Tr.paint_line["line-gap-width"]),"line-offset":new DataDrivenProperty(Tr.paint_line["line-offset"]),"line-blur":new DataDrivenProperty(Tr.paint_line["line-blur"]),"line-dasharray":new CrossFadedDataDrivenProperty(Tr.paint_line["line-dasharray"]),"line-pattern":new CrossFadedDataDrivenProperty(Tr.paint_line["line-pattern"]),"line-gradient":new ColorRampProperty(Tr.paint_line["line-gradient"]),"line-trim-offset":new DataConstantProperty(Tr.paint_line["line-trim-offset"])}),layout:_o};const So=new class LineFloorwidthProperty extends DataDrivenProperty{possiblyEvaluate(t,e){return e=new EvaluationParameters(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=p({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}(wo.paint.properties["line-width"].specification);function Ao(t,e){return e>0?e+2*t:t}So.useIntegerZoom=!0;const ko=di([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Io=di([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Mo=di([{name:"a_projected_pos",components:4,type:"Float32"}],4);di([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Po=di([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Co=di([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);di([{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 To=di([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);di([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),di([{name:"triangle",components:3,type:"Uint16"}]),di([{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"}]),di([{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"}]),di([{type:"Float32",name:"offsetX"}]),di([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var zo=24;const Eo=128;function Do(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new EvaluationParameters(t+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=r;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let s=i;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const a=e[i],o=e[s];return"composite"===r.kind?{kind:"composite",minZoom:a,maxZoom:o,interpolationType:n}:{kind:"camera",minZoom:a,maxZoom:o,minSize:r.evaluate(new EvaluationParameters(a)),maxSize:r.evaluate(new EvaluationParameters(o)),interpolationType:n}}}function Bo(t,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:i}){return"source"===t.kind?n/Eo:"composite"===t.kind?jt(n/Eo,i/Eo,r):e}function Lo(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:a}=t,o=i?u(ae.interpolationFactor(i,e,s,a),0,1):0;"camera"===t.kind?n=jt(t.minSize,t.maxSize,o):r=o}return{uSizeT:r,uSize:n}}function Vo(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()),ci.applyArabicShaping&&(t=ci.applyArabicShaping(t)),t}(t.text,e,r)})),t}const Fo={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Ro(t){return"︶"===t||"﹈"===t||"︸"===t||"﹄"===t||"﹂"===t||"︾"===t||"︼"===t||"︺"===t||"︘"===t||"﹀"===t||"︐"===t||"︓"===t||"︔"===t||"`"===t||" ̄"===t||"︑"===t||"︒"===t}function jo(t){return"︵"===t||"﹇"===t||"︷"===t||"﹃"===t||"﹁"===t||"︽"===t||"︻"===t||"︹"===t||"︗"===t||"︿"===t}var Oo=function(t,e,r,n,i){var s,a,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?i-1:0,p=r?-1:1,d=t[e+h];for(h+=p,s=d&(1<<-c)-1,d>>=-c,c+=o;c>0;s=256*s+t[e+h],h+=p,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===s)s=1-u;else{if(s===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),s-=u}return(d?-1:1)*a*Math.pow(2,s-n)},Uo=function(t,e,r,n,i,s){var a,o,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:s-1,f=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*l-1)*Math.pow(2,i),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&o,d+=f,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;t[r+d]=255&a,d+=f,a/=256,u-=8);t[r+d-f]|=128*y},$o=qo;function qo(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}qo.Varint=0,qo.Fixed64=1,qo.Bytes=2,qo.Fixed32=5;var No=4294967296,Zo=1/No,Go="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Xo(t){return t.type===qo.Bytes?t.readVarint()+t.pos:t.pos+1}function Yo(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Jo(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 Ko(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function Wo(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Ho(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Qo(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function tl(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function el(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function rl(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function nl(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function il(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function sl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function al(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function ol(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function ll(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}}qo.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=sl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=ol(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=sl(this.buf,this.pos)+sl(this.buf,this.pos+4)*No;return this.pos+=8,t},readSFixed64:function(){var t=sl(this.buf,this.pos)+ol(this.buf,this.pos+4)*No;return this.pos+=8,t},readFloat:function(){var t=Oo(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Oo(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,s=r.buf;if(n=(112&(i=s[r.pos++]))>>4,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<3,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<10,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<17,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<24,i<128)return Yo(t,n,e);if(n|=(1&(i=s[r.pos++]))<<31,i<128)return Yo(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Go?function(t,e,r){return Go.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i<r;){var s,a,o,l=t[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(a=t[i+2],128==(192&(s=t[i+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&s)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[i+2],o=t[i+3],128==(192&(s=t[i+1]))&&128==(192&a)&&128==(192&o)&&((u=(15&l)<<18|(63&s)<<12|(63&a)<<6|63&o)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==qo.Bytes)return t.push(this.readVarint(e));var r=Xo(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==qo.Bytes)return t.push(this.readSVarint());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==qo.Bytes)return t.push(this.readBoolean());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==qo.Bytes)return t.push(this.readFloat());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==qo.Bytes)return t.push(this.readDouble());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==qo.Bytes)return t.push(this.readFixed32());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==qo.Bytes)return t.push(this.readSFixed32());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==qo.Bytes)return t.push(this.readFixed64());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==qo.Bytes)return t.push(this.readSFixed64());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===qo.Varint)for(;this.buf[this.pos++]>127;);else if(e===qo.Bytes)this.pos=this.readVarint()+this.pos;else if(e===qo.Fixed32)this.pos+=4;else{if(e!==qo.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),al(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),al(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),al(this.buf,-1&t,this.pos),al(this.buf,Math.floor(t*Zo),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),al(this.buf,-1&t,this.pos),al(this.buf,Math.floor(t*Zo),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&&Jo(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Uo(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Uo(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&&Jo(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,qo.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Ko,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Wo,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Ho,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Qo,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,il,e)},writeBytesField:function(t,e){this.writeTag(t,qo.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,qo.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,qo.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,qo.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,qo.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,qo.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,qo.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,qo.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,qo.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,qo.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class ImagePosition{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 ImageAtlas{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:s,h:a}=ll(i),o=new RGBAImage({width:s||1,height:a||1});for(const e in t){const n=t[e],i=r[e].paddedRect;RGBAImage.copy(n.data,o,{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,a=i.y+1,l=r.data.width,u=r.data.height;RGBAImage.copy(r.data,o,{x:0,y:0},{x:s,y:a},r.data),RGBAImage.copy(r.data,o,{x:0,y:u-1},{x:s,y:a-1},{width:l,height:1}),RGBAImage.copy(r.data,o,{x:0,y:0},{x:s,y:a+u},{width:l,height:1}),RGBAImage.copy(r.data,o,{x:l-1,y:0},{x:s-1,y:a},{width:1,height:u}),RGBAImage.copy(r.data,o,{x:0,y:0},{x:s+l,y:a},{width:1,height:u})}this.image=o,this.iconPositions=r,this.patternPositions=n}addImages(t,e,r){for(const n in t){const i=t[n],s={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(s),e[n]=new ImagePosition(s,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((e=>t.hasImage(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})}}Sr(ImagePosition,"ImagePosition"),Sr(ImageAtlas,"ImageAtlas");const ul={horizontal:1,vertical:2,horizontalOnly:3};class SectionOptions{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const r=new SectionOptions;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new SectionOptions;return e.imageName=t,e}}class TaggedString{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const r=new TaggedString;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&&Xn(i)&&!Fo[t[n+1]]||s&&Xn(s)&&!Fo[t[n-1]])||!Fo[t[n]]?t[n]:Fo[t[n]]}return r}(this.text,t)}trim(){let t=0;for(let e=0;e<this.text.length&&hl[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&hl[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 TaggedString;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(SectionOptions.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 _("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(SectionOptions.forImage(e)),this.sectionIndex.push(this.sections.length-1)):_("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function cl(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y){const m=TaggedString.fromFeature(t,i);let g;h===ul.vertical&&m.verticalizePunctuation(p);const{processBidirectionalText:x,processStyledBidirectionalText:v}=ci;if(x&&1===m.sections.length){g=[];const t=x(m.toString(),xl(m,u,s,e,n,d,f));for(const e of t){const t=new TaggedString;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,xl(m,u,s,e,n,d,f));for(const e of t){const t=new TaggedString;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,xl(m,u,s,e,n,d,f));const b=[],_={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,a,o,l,u,c,h){let p=0,d=0,f=0;const y="right"===o?1:"left"===o?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 a of i){a.trim();const i=a.getMaxScale(),o=(i-1)*zo,v={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=v;const b=v.positionedGlyphs;let _=0;if(!a.length()){d+=s,++g;continue}let w=0,S=0;for(let s=0;s<a.length();s++){const o=a.getSection(s),f=a.getSectionIndex(s),y=a.getCharCode(s);let g=o.scale,v=null,A=null,k=null,I=zo,M=0;const P=!(l===ul.horizontal||!c&&!Gn(y)||c&&(hl[y]||(x=y,mn(x)||gn(x)||xn(x)||Fn(x)||Un(x))));if(o.imageName){const e=n[o.imageName];if(!e)continue;k=o.imageName,t.iconsInText=t.iconsInText||!0,A=e.paddedRect;const r=e.displaySize;g=g*zo/h,v={width:r[0],height:r[1],left:1,top:-3,advance:P?r[1]:r[0],localGlyph:!1},M=m?-v.height*g:i*zo-17-r[1]*g,I=v.advance;const s=(P?r[0]:r[1])*g-zo*i;s>0&&s>_&&(_=s)}else{const t=r[o.fontStack];if(!t)continue;t[y]&&(A=t[y]);const n=e[o.fontStack];if(!n)continue;const s=n.glyphs[y];if(!s)continue;if(v=s.metrics,I=8203!==y?zo: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;w<r&&(w=r,S=(t-e)/2*g),M=-t*g}else M=(i-g)*zo-17}P?(t.verticalizable=!0,b.push({glyph:y,imageName:k,x:p,y:d+M,vertical:P,scale:g,localGlyph:v.localGlyph,fontStack:o.fontStack,sectionIndex:f,metrics:v,rect:A}),p+=I*g+u):(b.push({glyph:y,imageName:k,x:p,y:d+M,vertical:P,scale:g,localGlyph:v.localGlyph,fontStack:o.fontStack,sectionIndex:f,metrics:v,rect:A}),p+=v.advance*g+u)}0!==b.length&&(f=Math.max(p-u,f),m?bl(b,y,_,S,s*i/2):bl(b,y,_,0,s/2)),p=0;const A=s*i+_;v.lineOffset=Math.max(_,o),d+=A,++g}var x;const v=d,{horizontalAlign:b,verticalAlign:_}=vl(a);(function(t,e,r,n,i,s){const a=(e-r)*i,o=-s*n;for(const e of t)for(const t of e.positionedGlyphs)t.x+=a,t.y+=o})(t.positionedLines,y,b,_,f,v),t.top+=-_*v,t.bottom=t.top+v,t.left+=-b*f,t.right=t.left+f,t.hasBaseline=m}(_,e,r,n,g,a,o,l,h,u,p,y),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&_}const hl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},pl={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 dl(t,e,r,n,i,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*zo/s+i:0}{const n=r[e.fontStack],s=n&&n.glyphs[t];return s?s.metrics.advance*e.scale+i:0}}function fl(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 yl(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 ml(t,e,r,n,i,s){let a=null,o=fl(e,r,i,s);for(const t of n){const n=fl(e-t.x,r,i,s)+t.badness;n<=o&&(a=t,o=n)}return{index:t,x:e,priorBreak:a,badness:o}}function gl(t){return t?gl(t.priorBreak).concat(t.index):[]}function xl(t,e,r,n,i,s,a){if("point"!==s)return[];if(!t)return[];const o=[],l=function(t,e,r,n,i,s){let a=0;for(let r=0;r<t.length();r++){const o=t.getSection(r);a+=dl(t.getCharCode(r),o,n,i,e,s)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,n,i,a),u=t.text.indexOf("")>=0;let c=0;for(let r=0;r<t.length();r++){const s=t.getSection(r),p=t.getCharCode(r);if(hl[p]||(c+=dl(p,s,n,i,e,a)),r<t.length()-1){const e=!((h=p)<11904||!(Mn(h)||kn(h)||jn(h)||Vn(h)||zn(h)||vn(h)||Pn(h)||wn(h)||En(h)||Dn(h)||Tn(h)||$n(h)||Sn(h)||_n(h)||bn(h)||Cn(h)||An(h)||Rn(h)||Ln(h)||Bn(h)));(pl[p]||e||s.imageName)&&o.push(ml(r+1,c,l,o,yl(p,t.getCharCode(r+1),e&&u),!1))}}var h;return gl(ml(t.length(),c,l,o,0,!0))}function vl(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 bl(t,e,r,n,i){if(!(e||r||n||i))return;const s=t.length-1,a=t[s],o=(a.x+a.metrics.advance*a.scale)*e;for(let e=0;e<=s;e++)t[e].x-=o,t[e].y+=r+n+i}function _l(t,e,r){const{horizontalAlign:n,verticalAlign:i}=vl(r),s=e[0]-t.displaySize[0]*n,a=e[1]-t.displaySize[1]*i;return{image:t,top:a,bottom:a+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function wl(t,e,r,n,i,s){const a=t.image;let o;if(a.content){const t=a.content,e=a.pixelRatio||1;o=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*s,u=e.right*s;let c,h,p,d;"width"===r||"both"===r?(d=i[0]+l-n[3],h=i[0]+u+n[1]):(d=i[0]+(l+u-a.displaySize[0])/2,h=d+a.displaySize[0]);const f=e.top*s,y=e.bottom*s;return"height"===r||"both"===r?(c=i[1]+f-n[0],p=i[1]+y+n[2]):(c=i[1]+(f+y-a.displaySize[1])/2,p=c+a.displaySize[1]),{image:a,top:c,right:h,bottom:p,left:d,collisionPadding:o}}class Anchor 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 Anchor(this.x,this.y,this.z,this.angle,this.segment)}}function Sl(t,e,r,n,i){if(void 0===e.segment)return!0;let s=e,a=e.segment+1,o=0;for(;o>-r/2;){if(a--,a<0)return!1;o-=t[a].dist(s),s=t[a]}o+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;o<r/2;){const e=t[a],r=t[a+1];if(!r)return!1;let s=t[a-1].angleTo(e)-e.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:s}),u+=s;o-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,o+=e.dist(r)}return!0}function Al(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function kl(t,e,r){return t?.6*e*r:0}function Il(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Ml(t,e,r,n,i,s){const a=kl(r,i,s),o=Il(r,n)*s;let l=0;const u=Al(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=jt(n.x,i.x,c),p=jt(n.y,i.y,c),d=new Anchor(h,p,0,i.angleTo(n),r);return!a||Sl(t,d,o,a,e)?d:void 0}l+=s}}function Pl(t,e,r,n,i,s,a,o,l){const u=kl(n,s,a),c=Il(n,i),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),Cl(t,p?e/2*o%e:(c/2+2*s)*a*o%e,e,u,r,h,p,!1,l)}function Cl(t,e,r,n,i,s,a,o,l){const u=s/2,c=Al(t);let h=0,p=e-r,d=[];for(let e=0;e<t.length-1;e++){const a=t[e],o=t[e+1],f=a.dist(o),y=o.angleTo(a);for(;p+r<h+f;){p+=r;const m=(p-h)/f,g=jt(a.x,o.x,m),x=jt(a.y,o.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new Anchor(g,x,0,y,e);r._round(),n&&!Sl(t,r,s,n,i)||d.push(r)}}h+=f}return o||d.length||a||(d=Cl(t,h/2,r,n,i,s,a,!0,l)),d}function Tl(t,e,n,i){const s=[],a=t.image,o=a.pixelRatio,l=a.paddedRect.w-2,u=a.paddedRect.h-2,c=t.right-t.left,h=t.bottom-t.top,p=a.stretchX||[[0,l]],d=a.stretchY||[[0,u]],f=(t,e)=>t+e[1]-e[0],y=p.reduce(f,0),m=d.reduce(f,0),g=l-y,x=u-m;let v=0,b=y,_=0,w=m,S=0,A=g,k=0,I=x;if(a.content&&i){const t=a.content;v=zl(p,0,t[0]),_=zl(d,0,t[1]),b=zl(p,t[0],t[2]),w=zl(d,t[1],t[3]),S=t[0]-v,k=t[1]-_,A=t[2]-t[0]-b,I=t[3]-t[1]-w}const M=(i,s,l,u)=>{const p=Dl(i.stretch-v,b,c,t.left),d=Bl(i.fixed-S,A,i.stretch,y),f=Dl(s.stretch-_,w,h,t.top),g=Bl(s.fixed-k,I,s.stretch,m),x=Dl(l.stretch-v,b,c,t.left),M=Bl(l.fixed-S,A,l.stretch,y),P=Dl(u.stretch-_,w,h,t.top),C=Bl(u.fixed-k,I,u.stretch,m),T=new r(p,f),z=new r(x,f),E=new r(x,P),D=new r(p,P),B=new r(d/o,g/o),L=new r(M/o,C/o),V=e*Math.PI/180;if(V){const t=Math.sin(V),e=Math.cos(V),r=[e,-t,t,e];T._matMult(r),z._matMult(r),D._matMult(r),E._matMult(r)}const F=i.stretch+i.fixed,R=s.stretch+s.fixed;return{tl:T,tr:z,bl:D,br:E,tex:{x:a.paddedRect.x+1+F,y:a.paddedRect.y+1+R,w:l.stretch+l.fixed-F,h:u.stretch+u.fixed-R},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:B,pixelOffsetBR:L,minFontScaleX:A/o/c,minFontScaleY:I/o/h,isSDF:n}};if(i&&(a.stretchX||a.stretchY)){const t=El(p,g,y),e=El(d,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(M(n,e[t],i,e[t+1]))}}else s.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return s}function zl(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 El(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 Dl(t,e,r,n){return t/e*r+n}function Bl(t,e,r,n){return t-e*r/n}function Ll(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}Sr(Anchor,"Anchor");class TinyQueue{constructor(t=[],e=Vl){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t<n;){let n=1+(t<<1),s=e[n];const a=n+1;if(a<this.length&&r(e[a],s)<0&&(n=a,s=e[a]),r(s,i)>=0)break;e[t]=s,t=n}e[t]=i}}function Vl(t,e){return t<e?-1:t>e?1:0}function Fl(t,e=1,n=!1){let i=1/0,s=1/0,a=-1/0,o=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<i)&&(i=e.x),(!t||e.y<s)&&(s=e.y),(!t||e.x>a)&&(a=e.x),(!t||e.y>o)&&(o=e.y)}const u=Math.min(a-i,o-s);let c=u/2;const h=new TinyQueue([],Rl);if(0===u)return new r(i,s);for(let e=i;e<a;e+=u)for(let r=s;r<o;r+=u)h.push(new jl(e+c,r+c,c,t));let p=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,s=i.length,a=s-1;t<s;a=t++){const s=i[t],o=i[a],l=s.x*o.y-o.x*s.y;r+=(s.x+o.x)*l,n+=(s.y+o.y)*l,e+=3*l}return new jl(r/e,n/e,0,t)}(t),d=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,d)),r.max-p.d<=e||(c=r.h/2,h.push(new jl(r.p.x-c,r.p.y-c,c,t)),h.push(new jl(r.p.x+c,r.p.y-c,c,t)),h.push(new jl(r.p.x-c,r.p.y+c,c,t)),h.push(new jl(r.p.x+c,r.p.y+c,c,t)),d+=4)}return n&&(console.log(`num probes: ${d}`),console.log(`best distance: ${p.d}`)),p.p}function Rl(t,e){return e.max-t.max}function jl(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,a=i-1;e<i;a=e++){const i=s[e],o=s[a];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,os(t,i,o))}}return(r?1:-1)*Math.sqrt(n)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}const Ol=Number.POSITIVE_INFINITY,Ul=Math.sqrt(2);function $l(t,e,r,n,i,s,a,o,l,u){t.createArrays(),t.tilePixelRatio=Di/(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 EvaluationParameters(e),o),h["text-size"].possiblyEvaluate(new EvaluationParameters(r),o)]}if("composite"===t.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.iconSizeData;p.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new EvaluationParameters(e),o),h["icon-size"].possiblyEvaluate(new EvaluationParameters(r),o)]}p.layoutTextSize=h["text-size"].possiblyEvaluate(new EvaluationParameters(l+1),o),p.layoutIconSize=h["icon-size"].possiblyEvaluate(new EvaluationParameters(l+1),o),p.textMaxSize=h["text-size"].possiblyEvaluate(new EvaluationParameters(18),o);const d="map"===c.get("text-rotation-alignment")&&"point"!==c.get("symbol-placement"),f=c.get("text-size");for(const s of t.features){const l=c.get("text-font").evaluate(s,{},o).join(","),h=f.evaluate(s,{},o),g=p.layoutTextSize.evaluate(s,{},o),x=(p.layoutIconSize.evaluate(s,{},o),{horizontal:{},vertical:void 0}),v=s.text;let b,w=[0,0];if(v){const n=v.toString(),a=c.get("text-letter-spacing").evaluate(s,{},o)*zo,u=c.get("text-line-height").evaluate(s,{},o)*zo,p=Nn(n)?a:0,f=c.get("text-anchor").evaluate(s,{},o),b=c.get("text-variable-anchor");if(!b){const t=c.get("text-radial-offset").evaluate(s,{},o);t?(y=f,w=(m=[t*zo,Ol])[1]!==Ol?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/Ul;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,{},o).map((t=>t*zo))}let _=d?"center":c.get("text-justify").evaluate(s,{},o);const S=c.get("symbol-placement"),A="point"===S,k="point"===S?c.get("text-max-width").evaluate(s,{},o)*zo:0,I=s=>{t.allowVerticalPlacement&&qn(n)&&(x.vertical=cl(v,e,r,i,l,k,u,f,s,p,w,ul.vertical,!0,S,g,h))};if(!d&&b){const t="auto"===_?b.map((t=>ql(t))):[_];let n=!1;for(let s=0;s<t.length;s++){const a=t[s];if(!x.horizontal[a])if(n)x.horizontal[a]=x.horizontal[0];else{const t=cl(v,e,r,i,l,k,u,"center",a,p,w,ul.horizontal,!1,S,g,h);t&&(x.horizontal[a]=t,n=1===t.positionedLines.length)}}I("left")}else{if("auto"===_&&(_=ql(f)),A||c.get("text-writing-mode").indexOf("horizontal")>=0||!qn(n)){const t=cl(v,e,r,i,l,k,u,f,_,p,w,ul.horizontal,!1,S,g,h);t&&(x.horizontal[_]=t)}I("point"===S?"left":_)}}let S=!1;if(s.icon&&s.icon.name){const e=n[s.icon.name];e&&(b=_l(i[s.icon.name],c.get("icon-offset").evaluate(s,{},o),c.get("icon-anchor").evaluate(s,{},o)),S=e.sdf,void 0===t.sdfIcons?t.sdfIcons=e.sdf:t.sdfIcons!==e.sdf&&_("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=Xl(x.horizontal)||x.vertical;t.iconsInText||(t.iconsInText=!!A&&A.iconsInText),(A||b)&&Nl(t,s,x,b,n,p,g,0,w,S,a,o,u)}var y,m;s&&t.generateCollisionDebugBuffers(l,t.collisionBoxArray)}function ql(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 Nl(t,e,n,i,s,a,l,u,c,h,p,d,f){let y=a.textMaxSize.evaluate(e,{},d);void 0===y&&(y=l);const m=t.layers[0].layout,g=m.get("icon-offset").evaluate(e,{},d),x=Xl(n.horizontal)||n.vertical,v="globe"===f.name,b=l/24,w=t.tilePixelRatio*y/24,S=(z=t.overscaling,t.zoom>18&&z>2&&(z>>=1),Math.max(Di/(512*z),1)*m.get("symbol-spacing")),A=m.get("text-padding")*t.tilePixelRatio,k=m.get("icon-padding")*t.tilePixelRatio,I=o(m.get("text-max-angle")),M="map"===m.get("text-rotation-alignment")&&"point"!==m.get("symbol-placement"),P="map"===m.get("icon-rotation-alignment")&&"point"!==m.get("symbol-placement"),C=m.get("symbol-placement"),T=S/2;var z;const E=m.get("icon-text-fit");let D;i&&"none"!==E&&(t.allowVerticalPlacement&&n.vertical&&(D=wl(i,n.vertical,E,m.get("icon-text-fit-padding"),g,b)),x&&(i=wl(i,x,E,m.get("icon-text-fit-padding"),g,b)));const B=(r,o,l)=>{if(o.x<0||o.x>=Di||o.y<0||o.y>=Di)return;let u=null;if(v){const{x:t,y:e,z:r}=f.projectTilePoint(o.x,o.y,l);u={anchor:new Anchor(t,e,r,0,void 0),up:f.upVector(l,o.x,o.y)}}!function(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b,w,S,A,k){const I=t.addToLineVertexArray(e,n);let M,P,C,T,z,E,D,B=0,L=0,V=0,F=0,R=-1,j=-1;const O={};let U=vi("");const $=r?r.anchor:e;let q=0,N=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[q,N]=l.layout.get("text-offset").evaluate(b,{},k).map((t=>t*zo)):(q=l.layout.get("text-radial-offset").evaluate(b,{},k)*zo,N=Ol),t.allowVerticalPlacement&&i.vertical){const t=i.vertical;if(f)E=Jl(t),o&&(D=Jl(o));else{const r=l.layout.get("text-rotate").evaluate(b,{},k)+90;C=Yl(u,$,e,c,h,p,t,d,r,y),o&&(T=Yl(u,$,e,c,h,p,o,g,r))}}if(s){const n=l.layout.get("icon-rotate").evaluate(b,{},k),i="none"!==l.layout.get("icon-text-fit"),a=Tl(s,n,S,i),d=o?Tl(o,n,S,i):void 0;P=Yl(u,$,e,c,h,p,s,g,n),B=4*a.length;const f=t.iconSizeData;let y=null;"source"===f.kind?(y=[Eo*l.layout.get("icon-size").evaluate(b,{},k)],y[0]>Zl&&_(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(y=[Eo*w.compositeIconSizes[0].evaluate(b,{},k),Eo*w.compositeIconSizes[1].evaluate(b,{},k)],(y[0]>Zl||y[1]>Zl)&&_(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,a,y,v,x,b,!1,r,e,I.lineStartIndex,I.lineLength,-1,A,k),R=t.icon.placedSymbolArray.length-1,d&&(L=4*d.length,t.addSymbols(t.icon,d,y,v,x,b,ul.vertical,r,e,I.lineStartIndex,I.lineLength,-1,A,k),j=t.icon.placedSymbolArray.length-1)}for(const n in i.horizontal){const s=i.horizontal[n];M||(U=vi(s.text),f?z=Jl(s):M=Yl(u,$,e,c,h,p,s,d,l.layout.get("text-rotate").evaluate(b,{},k),y));const o=1===s.positionedLines.length;if(V+=Gl(t,r,e,s,a,l,f,b,y,I,i.vertical?ul.horizontal:ul.horizontalOnly,o?Object.keys(i.horizontal):[n],O,R,w,A,k),o)break}i.vertical&&(F+=Gl(t,r,e,i.vertical,a,l,f,b,y,I,ul.vertical,["vertical"],O,j,w,A,k));let Z=-1;const G=(t,e)=>t?Math.max(t,e):e;Z=G(z,Z),Z=G(E,Z),Z=G(D,Z);const X=Z>-1?1:0;t.glyphOffsetArray.length>=SymbolBucket.MAX_GLYPHS&&_("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($.x,$.y,$.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,R,j,U,void 0!==M?M:t.collisionBoxArray.length,void 0!==M?M+1:t.collisionBoxArray.length,void 0!==C?C:t.collisionBoxArray.length,void 0!==C?C+1:t.collisionBoxArray.length,void 0!==P?P:t.collisionBoxArray.length,void 0!==P?P+1:t.collisionBoxArray.length,T||t.collisionBoxArray.length,T?T+1:t.collisionBoxArray.length,c,V,F,B,L,X,0,q,N,Z)}(t,o,u,r,n,i,s,D,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,A,M,c,0,k,P,g,e,a,h,p,d)};if("line"===C)for(const s of function(t,e,n,i,s){const a=[];for(let e=0;e<t.length;e++){const n=t[e];let o;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()),o&&e.equals(o[o.length-1])||(o=[e],a.push(o)),o.push(l)))))}}return a}(e.geometry,0,0,Di,Di)){const e=Pl(s,S,I,n.vertical||x,i,24,w,t.overscaling,Di);for(const r of e){const e=x;e&&Kl(t,e.text,T,r)||B(s,r,d)}}else if("line-center"===C){for(const t of e.geometry)if(t.length>1){const e=Ml(t,I,n.vertical||x,i,24,w);e&&B(t,e,d)}}else if("Polygon"===e.type)for(const t of Ca(e.geometry,0)){const e=Fl(t,16);B(t[0],new Anchor(e.x,e.y,0,0,void 0),d)}else if("LineString"===e.type)for(const t of e.geometry)B(t,new Anchor(t[0].x,t[0].y,0,0,void 0),d);else if("Point"===e.type)for(const t of e.geometry)for(const e of t)B([e],new Anchor(e.x,e.y,0,0,void 0),d)}const Zl=32640;function Gl(t,e,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g){const x=function(t,e,n,i,s,a,o,l){const u=[];if(0===e.positionedLines.length)return u;const c=i.layout.get("text-rotate").evaluate(a,{})*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 d=e.positionedLines.length,f=p/d;let y=e.top-n[1];for(let t=0;t<d;++t){const i=e.positionedLines[t];y=Ll(e,f,y,t);for(const t of i.positionedGlyphs){if(!t.rect)continue;const i=t.rect||{};let a=4,p=!0,d=1,f=0;if(t.imageName){const e=o[t.imageName];if(!e)continue;if(e.sdf){_("SDF images are not supported in formatted text and will be ignored.");continue}p=!1,d=e.pixelRatio,a=1/d}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&&(f=t.imageName?g-t.metrics.width*t.scale/2:0);const b=s?[t.x+g,t.y]:[0,0];let w=[0,0],S=[0,0],A=!1;s||(m?(S=[t.x+g+h[0],t.y+h[1]-f],A=!0):w=[t.x+g+n[0],t.y+n[1]-f]);const k=v.w*t.scale/(d*(t.localGlyph?2:1)),I=v.h*t.scale/(d*(t.localGlyph?2:1));let M,P,C,T;if(m){const e=t.y-y,n=new r(-g,g-e),i=-Math.PI/2,s=new r(...S);M=new r(-g+w[0],w[1]),M._rotateAround(i,n)._add(s),M.x+=-e+g,M.y-=(x.left-a)*t.scale;const o=t.imageName?x.advance*t.scale:zo*t.scale,l=String.fromCharCode(t.glyph);Ro(l)?M.x+=(1-a)*t.scale:jo(l)?M.x+=o-x.height*t.scale+(-a-1)*t.scale:M.x+=t.imageName||x.width+2*a===v.w&&x.height+2*a===v.h?(o-I)/2:(o-(x.height+2*a)*t.scale)/2,P=new r(M.x,M.y-k),C=new r(M.x+I,M.y),T=new r(M.x+I,M.y-k)}else{const e=(x.left-a)*t.scale-g+w[0],n=(-x.top-a)*t.scale+w[1],i=e+k,s=n+I;M=new r(e,n),P=new r(i,n),C=new r(e,s),T=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]),M._rotateAround(c,t),P._rotateAround(c,t),C._rotateAround(c,t),T._rotateAround(c,t)}const z=new r(0,0),E=new r(0,0);u.push({tl:M,tr:P,bl:C,br:T,tex:i,writingMode:e.writingMode,glyphOffset:b,sectionIndex:t.sectionIndex,isSDF:p,pixelOffsetTL:z,pixelOffsetBR:E,minFontScaleX:0,minFontScaleY:0})}}return u}(0,i,u,a,o,l,s,t.allowVerticalPlacement),v=t.textSizeData;let b=null;"source"===v.kind?(b=[Eo*a.layout.get("text-size").evaluate(l,{},g)],b[0]>Zl&&_(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===v.kind&&(b=[Eo*y.compositeTextSizes[0].evaluate(l,{},g),Eo*y.compositeTextSizes[1].evaluate(l,{},g)],(b[0]>Zl||b[1]>Zl)&&_(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,x,b,u,o,l,h,e,n,c.lineStartIndex,c.lineLength,f,m,g);for(const e of p)d[e]=t.text.placedSymbolArray.length-1;return 4*x.length}function Xl(t){for(const e in t)return t[e];return null}function Yl(t,e,n,i,s,a,l,u,c,h){let p=l.top,d=l.bottom,f=l.left,y=l.right;const m=l.collisionPadding;if(m&&(f-=m[0],p-=m[1],y+=m[2],d+=m[3]),c){const t=new r(f,p),e=new r(y,p),n=new r(f,d),i=new r(y,d),s=o(c);let a=new r(0,0);h&&(a=new r(h[0],h[1])),t._rotateAround(s,a),e._rotateAround(s,a),n._rotateAround(s,a),i._rotateAround(s,a),f=Math.min(t.x,e.x,n.x,i.x),y=Math.max(t.x,e.x,n.x,i.x),p=Math.min(t.y,e.y,n.y,i.y),d=Math.max(t.y,e.y,n.y,i.y)}return t.emplaceBack(e.x,e.y,e.z,n.x,n.y,f,p,y,d,u,i,s,a),t.length-1}function Jl(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 Kl(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}di([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);const Wl=di([{name:"a_pos_3",components:3,type:"Int16"}]);var Hl=di([{name:"a_pos",type:"Int16",components:2}]);const Ql=Di/Math.PI/2,tu=2*ji(1,0)*Ql*Math.PI,eu=-Ql,ru=Ql,nu=[new Aabb([eu,eu,eu],[ru,ru,ru]),new Aabb([eu,eu,eu],[0,0,ru]),new Aabb([0,eu,eu],[ru,0,ru]),new Aabb([eu,0,eu],[0,ru,ru]),new Aabb([0,0,eu],[ru,ru,ru])];function iu(t,e,r,n=!0){const i=Cs([],t._camera.position,t.worldSize),s=[e,r,1,1];Vs(s,s,t.pixelMatrixInverse),function(t,e,r){t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r}(s,s,1/s[3]);const a=zs([],Ls([],s,i)),o=t.globeMatrix,c=[o[12],o[13],o[14]],h=Ls([],c,i),p=Is(h),d=zs([],h),f=t.worldSize/(2*Math.PI),y=Es(d,a),m=Math.asin(f/p);if(m<Math.acos(y)){if(!n)return null;const t=[],e=[];Cs(t,a,p/y),zs(e,Ls(e,t,h)),zs(a,Ps(a,h,Cs(a,e,Math.tan(m)*p)))}const g=[];new Ray(i,a).closestPointOnSphere(c,f,g);const x=zs([],C(o,0)),v=zs([],C(o,1)),b=zs([],C(o,2)),_=Es(x,g),w=Es(v,g),S=Es(b,g),A=l(Math.asin(-w/f));let k=l(Math.atan2(_,S));k=t.center.lng+function(t,e){const r=(e-t+180)%360-180;return r<-180?r+360:r}(t.center.lng,k);const I=Fi(k),M=u(Ri(A),0,1);return new MercatorCoordinate(I,M)}function su(t){if(t.z<=1)return nu[t.z+2*t.y+t.x];const e=ou(au(t));return Aabb.fromPoints(e)}function au({x:t,y:e,z:r}){const n=1/(1<<r),i=new LngLat(Oi(t*n),Ui((e+1)*n)),s=new LngLat(Oi((t+1)*n),Ui(e*n));return new LngLatBounds(i,s)}function ou(t){const e=o(t.getNorth()),r=o(t.getSouth()),n=Math.cos(e),i=Math.cos(r),s=Math.sin(e),a=Math.sin(r),l=t.getWest(),u=t.getEast();return[lu(i,a,l),lu(i,a,u),lu(n,s,u),lu(n,s,l)]}function lu(t,e,r,n=Ql){return r=o(r),[t*Math.sin(r)*n,-e*n,t*Math.cos(r)*n]}function uu(t,e,r){return lu(Math.cos(o(t)),Math.sin(o(t)),e,r)}function cu(t,e,r,n){const i=1<<r.z,s=(t/Di+r.x)/i;return uu(Ui((e/Di+r.y)/i),Oi(s),n)}function hu({min:t,max:e}){return 16383/Math.max(e[0]-t[0],e[1]-t[1],e[2]-t[2])}const pu=new Float64Array(16);function du(t){const e=hu(t),r=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}(pu,[e,e,e]);return ws(r,r,function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}([],t.min))}function fu(t){return(e=u(((e=t)-5)/1,0,1))*e*(3-2*e);var e}function yu(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)),a=Math.sin(t._pitch)*s+i;return Math.min(1.01*a,i*(1/t._horizonShift))}function mu(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,a=(t.y+1)*r,o=Oi(n),l=Oi(i),u=Ui(s),c=Ui(a),h=e.project(o,u),p=e.project(l,u),d=e.project(l,c),f=e.project(o,c);let y=Math.min(h.x,p.x,d.x,f.x),m=Math.min(h.y,p.y,d.y,f.y),g=Math.max(h.x,p.x,d.x,f.x),x=Math.max(h.y,p.y,d.y,f.y);const v=r/16;function b(t,r,n,i,s,a){const o=(n+s)/2,l=(i+a)/2,u=e.project(Oi(o),Ui(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,o,l),b(u,r,o,l,s,a))}b(h,p,n,s,i,s),b(p,d,i,s,i,a),b(d,f,i,a,n,a),b(f,h,n,a,n,s),y-=v,m-=v,g+=v,x+=v;const _=1/Math.max(g-y,x-m);return{scale:_,x:y*_,y:m*_,x2:g*_,y2:x*_,projection:e}}const gu=vs(new Float32Array(16));class Projection{constructor(t){this.spec=t,this.name=t.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(t,e){return{x:0,y:0,z:0}}unproject(t,e){return new LngLat(0,0)}projectTilePoint(t,e,r){return{x:t,y:e,z:0}}locationPoint(t,e,r=!0){return t._coordinatePoint(t.locationCoordinate(e),r)}pixelsPerMeter(t,e){return ji(1,t)*e}pixelSpaceConversion(t,e,r){return 1}farthestPixelDistance(t){return yu(t,t.pixelsPerMeter)}pointCoordinate(t,e,n,i){const s=t.horizonLineFromTop(!1),a=new r(e,Math.max(s,n));return t.rayIntersectionCoordinate(t.pointRayIntersection(a,i))}pointCoordinate3D(t,e,n){const i=new r(e,n);if(t.elevation)return t.elevation.pointCoordinate(i);{const e=this.pointCoordinate(t,i.x,i.y,0);return[e.x,e.y,e.z]}}isPointAboveHorizon(t,e){if(t.elevation)return!this.pointCoordinate3D(t,e.x,e.y);const r=t.horizonLineFromTop();return e.y<r}createInversionMatrix(t,e){return gu}createTileMatrix(t,e,r){let n,i,s;const a=r.canonical,o=vs(new Float64Array(16));if(this.isReprojectedInTileSpace){const l=mu(a,this);n=1,i=l.x+r.wrap*l.scale,s=l.y,Ss(o,o,[n/l.scale,n/l.scale,t.pixelsPerMeter/e])}else n=e/t.zoomScale(a.z),i=(a.x+Math.pow(2,a.z)*r.wrap)*n,s=a.y*n;return ws(o,o,[i,s,0]),Ss(o,o,[n/Di,n/Di,1]),o}upVector(t,e,r){return[0,0,1]}upVectorScale(t,e,r){return{metersToTile:1}}}class Albers extends Projection{constructor(t){super(t),this.range=[4,7],this.center=t.center||[-96,37.5];const[e,r]=this.parallels=t.parallels||[29.5,45.5],n=Math.sin(o(e));this.n=(n+Math.sin(o(r)))/2,this.c=1+n*(2*this.n-n),this.r0=Math.sqrt(this.c)/this.n}project(t,e){const{n:r,c:n,r0:i}=this,s=o(t-this.center[0]),a=o(e),l=Math.sqrt(n-2*r*Math.sin(a))/r;return{x:l*Math.sin(s*r),y:l*Math.cos(s*r)-i,z:0}}unproject(t,e){const{n:r,c:n,r0:i}=this,s=i+e;let a=Math.atan2(t,Math.abs(s))*Math.sign(s);s*r<0&&(a-=Math.PI*Math.sign(t)*Math.sign(s));const h=o(this.center[0])*r;a=c(a,-Math.PI-h,Math.PI-h);const p=l(a/r)+this.center[0],d=Math.asin(u((n-(t*t+s*s)*r*r)/(2*r),-1,1)),f=u(l(d),-85.051129,$i);return new LngLat(p,f)}}const xu=1.340264,vu=-.081106,bu=893e-6,_u=.003796,wu=Math.sqrt(3)/2;class EqualEarth extends Projection{project(t,e){e=e/180*Math.PI,t=t/180*Math.PI;const r=Math.asin(wu*Math.sin(e)),n=r*r,i=n*n*n;return{x:.5*(t*Math.cos(r)/(wu*(xu+3*vu*n+i*(7*bu+9*_u*n)))/Math.PI+.5),y:1-.5*(r*(xu+vu*n+i*(bu+_u*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,a,o=0;o<12&&(s=r*(xu+vu*n+i*(bu+_u*n))-e,a=xu+3*vu*n+i*(7*bu+9*_u*n),t=s/a,r=u(r-t,-Math.PI/3,Math.PI/3),n=r*r,i=n*n*n,!(Math.abs(t)<1e-12));++o);const s=wu*t*(xu+3*vu*n+i*(7*bu+9*_u*n))/Math.cos(r),a=Math.asin(Math.sin(r)/wu),o=u(180*s/Math.PI,-180,180),l=u(180*a/Math.PI,-85.051129,$i);return new LngLat(o,l)}}class Equirectangular extends Projection{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0}project(t,e){return{x:.5+t/360,y:.5-e/360,z:0}}unproject(t,e){const r=360*(t-.5),n=u(360*(.5-e),-85.051129,$i);return new LngLat(r,n)}}const Su=Math.PI/2;function Au(t){return Math.tan((Su+t)/2)}class LambertConformalConic extends Projection{constructor(t){super(t),this.center=t.center||[0,30];const[e,r]=this.parallels=t.parallels||[30,30],n=o(e),i=o(r),s=Math.cos(n);this.n=n===i?Math.sin(n):Math.log(s/Math.cos(i))/Math.log(Au(i)/Au(n)),this.f=s*Math.pow(Au(n),this.n)/this.n}project(t,e){e=o(e),t=o(t-this.center[0]);const r=1e-6,{n:n,f:i}=this;i>0?e<-Su+r&&(e=-Su+r):e>Su-r&&(e=Su-r);const s=i/Math.pow(Au(e),n),a=s*Math.sin(n*t),l=i-s*Math.cos(n*t);return{x:.5*(a/Math.PI+.5),y:1-.5*(l/Math.PI+.5),z:0}}unproject(t,e){t=(2*t-.5)*Math.PI,e=(2*(1-e)-.5)*Math.PI;const{n:r,f:n}=this,i=n-e,s=Math.sign(i),a=Math.sign(r)*Math.sqrt(t*t+i*i);let o=Math.atan2(t,Math.abs(i))*s;i*r<0&&(o-=Math.PI*Math.sign(t)*s);const c=u(l(o/r)+this.center[0],-180,180),h=u(l(2*Math.atan(Math.pow(n/a,1/r))-Su),-85.051129,$i);return new LngLat(c,h)}}class Mercator extends Projection{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(t,e){return{x:Fi(t),y:Ri(e),z:0}}unproject(t,e){const r=Oi(t),n=Ui(e);return new LngLat(r,n)}}const ku=o($i);class NaturalEarth extends Projection{project(t,e){const r=(e=o(e))*e,n=r*r;return{x:.5*((t=o(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=u(r-i,-ku,ku)}while(Math.abs(i)>1e-6&&--n>0);s=r*r;const a=u(l(t/(.8707+s*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))),-180,180),o=l(r);return new LngLat(a,o)}}const Iu=o($i);class WinkelTripel extends Projection{project(t,e){e=o(e),t=o(t);const r=Math.cos(e),n=2/Math.PI,i=Math.acos(r*Math.cos(t/2)),s=Math.sin(i)/i,a=.5*(t*n+2*r*Math.sin(t/2)/s)||0,l=.5*(e+Math.sin(e)/s)||0;return{x:.5*(a/Math.PI+.5),y:1-.5*(l/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 a=0,o=0;do{const i=Math.cos(n),s=Math.sin(n),l=2*s*i,c=s*s,h=i*i,p=Math.cos(r/2),d=Math.sin(r/2),f=2*p*d,y=d*d,m=1-h*p*p,g=m?1/m:0,x=m?Math.acos(i*p)*Math.sqrt(1/m):0,v=.5*(2*x*i*d+2*r/Math.PI)-t,b=.5*(x*s+n)-e,_=.5*g*(h*y+x*i*p*c)+1/Math.PI,w=g*(f*l/4-x*s*d),S=.125*g*(l*d-x*s*h*f),A=.5*g*(c*p+x*y*i)+.5,k=w*S-A*_;a=(b*w-v*A)/k,o=(v*S-b*_)/k,r=u(r-a,-Math.PI,Math.PI),n=u(n-o,-Iu,Iu)}while((Math.abs(a)>s||Math.abs(o)>s)&&--i>0);return new LngLat(l(r),l(n))}}class CylindricalEqualArea extends Projection{constructor(t){super(t),this.center=t.center||[0,0],this.parallels=t.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(o(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(t,e){const{scale:r,cosPhi:n}=this;return{x:o(t)*n*r+.5,y:-Math.sin(o(e))/n*r+.5,z:0}}unproject(t,e){const{scale:r,cosPhi:n}=this,i=-(e-.5)/r,s=u(l((t-.5)/r)/n,-180,180),a=Math.asin(u(i*n,-1,1)),o=u(l(a),-85.051129,$i);return new LngLat(s,o)}}class Globe extends Mercator{constructor(t){super(t),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug","custom"],this.range=[3,5]}projectTilePoint(t,e,r){const n=cu(t,e,r);return Ds(n,n,du(su(r))),{x:n[0],y:n[1],z:n[2]}}locationPoint(t,e){const n=uu(e.lat,e.lng),i=zs([],n),s=t.elevation?t.elevation.getAtPointOrZero(t.locationCoordinate(e),t._centerAltitude):t._centerAltitude;Ts(n,n,i,ji(1,0)*Di*s);const a=vs(new Float64Array(16));return _s(a,t.pixelMatrix,t.globeMatrix),Ds(n,n,a),new r(n[0],n[1])}pixelsPerMeter(t,e){return ji(1,0)*e}pixelSpaceConversion(t,e,r){const n=jt(ji(1,45)*e,ji(1,t)*e,r);return this.pixelsPerMeter(t,e)/n}createTileMatrix(t,e,r){const n=function(t){const e=function(t,e){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]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}(pu,t.min),r=1/hu(t);return Ss(e,e,[r,r,r])}(su(r.canonical));return _s(new Float64Array(16),t.globeMatrix,n)}createInversionMatrix(t,e){const{center:r}=t,n=du(su(e));return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[0],a=e[1],o=e[2],l=e[3],u=e[8],c=e[9],h=e[10],p=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i-u*n,t[1]=a*i-c*n,t[2]=o*i-h*n,t[3]=l*i-p*n,t[8]=s*n+u*i,t[9]=a*n+c*i,t[10]=o*n+h*i,t[11]=l*n+p*i}(n,n,o(r.lng)),function(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[4],a=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*i+u*n,t[5]=a*i+c*n,t[6]=o*i+h*n,t[7]=l*i+p*n,t[8]=u*i-s*n,t[9]=c*i-a*n,t[10]=h*i-o*n,t[11]=p*i-l*n}(n,n,o(r.lat)),Ss(n,n,[t._pixelsPerMercatorPixel,t._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(t,e,r,n){return iu(t,e,r,!0)||new MercatorCoordinate(0,0)}pointCoordinate3D(t,e,r){const n=this.pointCoordinate(t,e,r,0);return[n.x,n.y,n.z]}isPointAboveHorizon(t,e){return!iu(t,e.x,e.y,!1)}farthestPixelDistance(t){const e=function(t,e){const r=t.cameraToCenterDistance,n=t._centerAltitude*e,i=t._camera,s=t._camera.forward(),a=Ps([],Cs([],s,-r),[0,0,n]),o=t.worldSize/(2*Math.PI),l=[0,0,-o],u=t.width/t.height,c=Math.tan(t.fovAboveCenter),h=Cs([],i.up(),c),p=Cs([],i.right(),c*u),d=zs([],Ps([],Ps([],s,h),p)),f=[];let y;if(new Ray(a,d).closestPointOnSphere(l,o,f)){const e=Ps([],f,l),r=Ls([],e,a);y=Math.cos(t.fovAboveCenter)*Is(r)}else{const t=Ls([],a,l),e=Ls([],l,a);zs(e,e);const r=Is(t)-o;y=Math.sqrt(r*(r+2*o));const n=Math.acos(y/(o+r))-Math.acos(Es(s,e));y*=Math.cos(n)}return 1.01*y}(t,this.pixelsPerMeter(t.center.lat,t.worldSize)),r=fu(t.zoom);if(r>0){const n=yu(t,ji(1,t.center.lat)*t.worldSize),i=t.worldSize/(2*Math.PI),s=Math.max(t.width,t.height)/t.worldSize*Math.PI;return jt(e,n+i*(1-Math.cos(s)),Math.pow(r,10))}return e}upVector(t,e,r){return cu(e,r,t,1)}upVectorScale(t){return{metersToTile:tu*hu(su(t))}}}function Mu(t){const e=t.parallels,r=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case"mercator":return new Mercator(t);case"equirectangular":return new Equirectangular(t);case"naturalEarth":return new NaturalEarth(t);case"equalEarth":return new EqualEarth(t);case"winkelTripel":return new WinkelTripel(t);case"albers":return r?new CylindricalEqualArea(t):new Albers(t);case"lambertConformalConic":return r?new CylindricalEqualArea(t):new LambertConformalConic(t);case"globe":return new Globe(t)}throw new Error(`Invalid projection name: ${t.name}`)}const Pu=Xa.VectorTileFeature.types,Cu=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Tu(t,e,r,n,i,s,a,o,l,u,c,h,p){const d=o?Math.min(Zl,Math.round(o[0])):0,f=o?Math.min(Zl,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),s,a,(d<<1)+(l?1:0),f,16*u,16*c,256*h,256*p)}function zu(t,e,r,n,i,s,a){t.emplaceBack(e,r,n,i,s,a)}function Eu(t,e,r,n,i){t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i)}function Du(t){for(const e of t.sections)if(Kn(e.text))return!0;return!1}class SymbolBuffers{constructor(t){this.layoutVertexArray=new StructArrayLayout4i4ui4i24,this.indexArray=new StructArrayLayout3ui6,this.programConfigurations=t,this.segments=new SegmentVector,this.dynamicLayoutVertexArray=new StructArrayLayout4f16,this.opacityVertexArray=new StructArrayLayout1ul4,this.placedSymbolArray=new PlacedSymbolArray,this.globeExtVertexArray=new StructArrayLayout3i3f20}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,ko.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Mo.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Cu,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,Io.members,!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(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}Sr(SymbolBuffers,"SymbolBuffers");class CollisionBuffers{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new SegmentVector,this.collisionVertexArray=new StructArrayLayout2ub2f12,this.collisionVertexArrayExt=new StructArrayLayout3f12}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Po.members,!0),this.collisionVertexBufferExt=t.createVertexBuffer(this.collisionVertexArrayExt,Co.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Sr(CollisionBuffers,"CollisionBuffers");class SymbolBucket{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=vs([]),this.placementViewportMatrix=vs([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Do(this.zoom,e["text-size"]),this.iconSizeData=Do(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=>ul[t])),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID,this.projection=t.projection}createArrays(){this.text=new SymbolBuffers(new ProgramConfigurationSet(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new SymbolBuffers(new ProgramConfigurationSet(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new GlyphOffsetArray,this.lineVertexArray=new SymbolLineVertexArray,this.symbolInstances=new SymbolInstanceArray}calculateGlyphDependencies(t,e,r,n,i){for(let r=0;r<t.length;r++)if(e[t.charCodeAt(r)]=!0,n&&i){const n=Fo[t.charAt(r)];n&&(e[n.charCodeAt(0)]=!0)}}populate(t,e,r,n){const i=this.layers[0],s=i.layout,a="globe"===this.projection.name,o=s.get("text-font"),l=s.get("text-field"),u=s.get("icon-image"),c=("constant"!==l.value.kind||l.value.value instanceof Formatted&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),h="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,p=s.get("symbol-sort-key");if(this.features=[],!c&&!h)return;const d=e.iconDependencies,f=e.glyphDependencies,y=e.availableImages,m=new EvaluationParameters(this.zoom);for(const{feature:e,id:l,index:u,sourceLayerIndex:g}of t){const t=i._featureFilter.needGeometry,x=Wi(e,t);if(!i._featureFilter.filter(m,x,r))continue;if(t||(x.geometry=Ki(e,r,n)),a&&1!==e.type&&r.z<=5){const t=x.geometry,e=.98078528056;for(let n=0;n<t.length;n++)t[n]=Gi(t[n],(t=>t),((t,n)=>Es(cu(t.x,t.y,r,1),cu(n.x,n.y,r,1))<e))}let v,b;if(c){const t=i.getValueAndResolveTokens("text-field",x,r,y),e=Formatted.factory(t);Du(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===li()||this.hasRTLText&&ci.isParsed())&&(v=Vo(e,i,x))}if(h){const t=i.getValueAndResolveTokens("icon-image",x,r,y);b=t instanceof ResolvedImage?t:ResolvedImage.fromString(t)}if(!v&&!b)continue;const _=this.sortFeaturesByKey?p.evaluate(x,{},r):void 0;if(this.features.push({id:l,text:v,icon:b,index:u,sourceLayerIndex:g,geometry:x.geometry,properties:e.properties,type:Pu[e.type],sortKey:_}),b&&(d[b.name]=!0),v){const t=o.evaluate(x,{},r).join(","),e="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(ul.vertical)>=0;for(const r of v.sections)if(r.image)d[r.image.name]=!0;else{const n=qn(v.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 a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const d=l(p,h),f=l(p,h,!0);if(d in r&&f in e&&r[d]!==e[f]){const t=o(d,f,h),i=a(d,f,n[t].geometry);delete e[d],delete r[f],r[l(p,n[i].geometry,!0)]=i,n[t].geometry=null}else d in r?a(d,f,h):f in e?o(d,f,h):(s(u),e[d]=i-1,r[f]=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()}getProjection(){return this.projectionInstance||(this.projectionInstance=Mu(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const r=this.lineVertexArray.length,n=t.segment;if(void 0!==n){let r=t.dist(e[n+1]),i=t.dist(e[n]);const s={};for(let t=n+1;t<e.length;t++)s[t]={x:e[t].x,y:e[t].y,tileUnitDistanceFromAnchor:r},t<e.length-1&&(r+=e[t+1].dist(e[t]));for(let t=n||0;t>=0;t--)s[t]={x:e[t].x,y:e[t].y,tileUnitDistanceFromAnchor:i},t>0&&(i+=e[t-1].dist(e[t]));for(let t=0;t<e.length;t++){const e=s[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,a,o,l,u,c,h,p,d){const f=t.indexArray,y=t.layoutVertexArray,m=t.globeExtVertexArray,g=t.segments.prepareSegment(4*e.length,y,f,this.canOverlap?s.sortKey:void 0),x=this.glyphOffsetArray.length,v=g.vertexLength,b=this.allowVerticalPlacement&&a===ul.vertical?Math.PI/2:0,_=s.text&&s.text.sections;for(let n=0;n<e.length;n++){const{tl:i,tr:a,bl:u,br:c,tex:h,pixelOffsetTL:x,pixelOffsetBR:v,minFontScaleX:w,minFontScaleY:S,glyphOffset:A,isSDF:k,sectionIndex:I}=e[n],M=g.vertexLength,P=A[1];if(Tu(y,l.x,l.y,i.x,P+i.y,h.x,h.y,r,k,x.x,x.y,w,S),Tu(y,l.x,l.y,a.x,P+a.y,h.x+h.w,h.y,r,k,v.x,x.y,w,S),Tu(y,l.x,l.y,u.x,P+u.y,h.x,h.y+h.h,r,k,x.x,v.y,w,S),Tu(y,l.x,l.y,c.x,P+c.y,h.x+h.w,h.y+h.h,r,k,v.x,v.y,w,S),o){const e=o.anchor,r=o.up;zu(m,e.x,e.y,e.z,r[0],r[1],r[2]),zu(m,e.x,e.y,e.z,r[0],r[1],r[2]),zu(m,e.x,e.y,e.z,r[0],r[1],r[2]),zu(m,e.x,e.y,e.z,r[0],r[1],r[2]),Eu(t.dynamicLayoutVertexArray,e.x,e.y,e.z,b)}else Eu(t.dynamicLayoutVertexArray,l.x,l.y,l.z,b);f.emplaceBack(M,M+1,M+2),f.emplaceBack(M+1,M+2,M+3),g.vertexLength+=4,g.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),n!==e.length-1&&I===e[n+1].sectionIndex||t.programConfigurations.populatePaintArrays(y.length,s,s.index,{},p,d,_&&_[I])}const w=o?o.anchor:l;t.placedSymbolArray.emplaceBack(w.x,w.y,w.z,l.x,l.y,x,this.glyphOffsetArray.length-x,v,u,c,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,h,0)}_commitLayoutVertex(t,e,r,n,i,s,a){t.emplaceBack(e,r,n,i,s,Math.round(a.x),Math.round(a.y))}_addCollisionDebugVertices(t,e,n,i,s,a,o){const l=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),u=l.vertexLength,c=o.tileAnchorX,h=o.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,a,c,h,new r(t.x1,t.y1)),this._commitLayoutVertex(n.layoutVertexArray,i,s,a,c,h,new r(t.x2,t.y1)),this._commitLayoutVertex(n.layoutVertexArray,i,s,a,c,h,new r(t.x2,t.y2)),this._commitLayoutVertex(n.layoutVertexArray,i,s,a,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 a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceTextSize(t,s,e,a);this._addCollisionDebugVertices(n,i,this.textCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(t,e,r,n,i,s){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceIconSize(t,e,a);this._addCollisionDebugVertices(n,i,this.iconCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}generateCollisionDebugBuffers(t,e){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new CollisionBuffers(StructArrayLayout3i2i2i16,To.members,StructArrayLayout2ui4),this.iconCollisionBox=new CollisionBuffers(StructArrayLayout3i2i2i16,To.members,StructArrayLayout2ui4);const r=Lo(this.iconSizeData,t),n=Lo(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=Bo(this.textSizeData,t,i)/zo;return this.tilePixelRatio*s}getSymbolInstanceIconSize(t,e,r){const n=this.icon.placedSymbolArray.get(r),i=Bo(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 a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceTextSize(t,s,e,a);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=Lo(this.iconSizeData,t),n=Lo(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,a,o,l){const u={};for(let n=e;n<r;n++){const e=t.get(n);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,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<a;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=o;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 a=this.symbolInstances.get(t);n.push(0|Math.round(e*a.tileAnchorX+r*a.tileAnchorY)),i.push(a.featureIndex)}return s.sort(((t,e)=>n[t]-n[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Sr(SymbolBucket,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),SymbolBucket.MAX_GLYPHS=65535,SymbolBucket.addDynamicAttributes=Eu;const Bu=new Properties({"symbol-placement":new DataConstantProperty(Tr.layout_symbol["symbol-placement"]),"symbol-spacing":new DataConstantProperty(Tr.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new DataConstantProperty(Tr.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new DataDrivenProperty(Tr.layout_symbol["symbol-sort-key"]),"symbol-z-order":new DataConstantProperty(Tr.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new DataConstantProperty(Tr.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new DataConstantProperty(Tr.layout_symbol["icon-ignore-placement"]),"icon-optional":new DataConstantProperty(Tr.layout_symbol["icon-optional"]),"icon-rotation-alignment":new DataConstantProperty(Tr.layout_symbol["icon-rotation-alignment"]),"icon-size":new DataDrivenProperty(Tr.layout_symbol["icon-size"]),"icon-text-fit":new DataConstantProperty(Tr.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new DataConstantProperty(Tr.layout_symbol["icon-text-fit-padding"]),"icon-image":new DataDrivenProperty(Tr.layout_symbol["icon-image"]),"icon-rotate":new DataDrivenProperty(Tr.layout_symbol["icon-rotate"]),"icon-padding":new DataConstantProperty(Tr.layout_symbol["icon-padding"]),"icon-keep-upright":new DataConstantProperty(Tr.layout_symbol["icon-keep-upright"]),"icon-offset":new DataDrivenProperty(Tr.layout_symbol["icon-offset"]),"icon-anchor":new DataDrivenProperty(Tr.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new DataConstantProperty(Tr.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new DataConstantProperty(Tr.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new DataConstantProperty(Tr.layout_symbol["text-rotation-alignment"]),"text-field":new DataDrivenProperty(Tr.layout_symbol["text-field"]),"text-font":new DataDrivenProperty(Tr.layout_symbol["text-font"]),"text-size":new DataDrivenProperty(Tr.layout_symbol["text-size"]),"text-max-width":new DataDrivenProperty(Tr.layout_symbol["text-max-width"]),"text-line-height":new DataDrivenProperty(Tr.layout_symbol["text-line-height"]),"text-letter-spacing":new DataDrivenProperty(Tr.layout_symbol["text-letter-spacing"]),"text-justify":new DataDrivenProperty(Tr.layout_symbol["text-justify"]),"text-radial-offset":new DataDrivenProperty(Tr.layout_symbol["text-radial-offset"]),"text-variable-anchor":new DataConstantProperty(Tr.layout_symbol["text-variable-anchor"]),"text-anchor":new DataDrivenProperty(Tr.layout_symbol["text-anchor"]),"text-max-angle":new DataConstantProperty(Tr.layout_symbol["text-max-angle"]),"text-writing-mode":new DataConstantProperty(Tr.layout_symbol["text-writing-mode"]),"text-rotate":new DataDrivenProperty(Tr.layout_symbol["text-rotate"]),"text-padding":new DataConstantProperty(Tr.layout_symbol["text-padding"]),"text-keep-upright":new DataConstantProperty(Tr.layout_symbol["text-keep-upright"]),"text-transform":new DataDrivenProperty(Tr.layout_symbol["text-transform"]),"text-offset":new DataDrivenProperty(Tr.layout_symbol["text-offset"]),"text-allow-overlap":new DataConstantProperty(Tr.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new DataConstantProperty(Tr.layout_symbol["text-ignore-placement"]),"text-optional":new DataConstantProperty(Tr.layout_symbol["text-optional"])});var Lu={paint:new Properties({"icon-opacity":new DataDrivenProperty(Tr.paint_symbol["icon-opacity"]),"icon-color":new DataDrivenProperty(Tr.paint_symbol["icon-color"]),"icon-halo-color":new DataDrivenProperty(Tr.paint_symbol["icon-halo-color"]),"icon-halo-width":new DataDrivenProperty(Tr.paint_symbol["icon-halo-width"]),"icon-halo-blur":new DataDrivenProperty(Tr.paint_symbol["icon-halo-blur"]),"icon-translate":new DataConstantProperty(Tr.paint_symbol["icon-translate"]),"icon-translate-anchor":new DataConstantProperty(Tr.paint_symbol["icon-translate-anchor"]),"text-opacity":new DataDrivenProperty(Tr.paint_symbol["text-opacity"]),"text-color":new DataDrivenProperty(Tr.paint_symbol["text-color"],{runtimeType:$,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new DataDrivenProperty(Tr.paint_symbol["text-halo-color"]),"text-halo-width":new DataDrivenProperty(Tr.paint_symbol["text-halo-width"]),"text-halo-blur":new DataDrivenProperty(Tr.paint_symbol["text-halo-blur"]),"text-translate":new DataConstantProperty(Tr.paint_symbol["text-translate"]),"text-translate-anchor":new DataConstantProperty(Tr.paint_symbol["text-translate-anchor"])}),layout:Bu};class FormatSectionOverride{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:R,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}}Sr(FormatSectionOverride,"FormatSectionOverride",{omit:["defaultValue"]});class SymbolStyleLayer extends StyleLayer{constructor(t){super(t,Lu)}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()||Ne(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 SymbolBucket(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of Lu.paint.overridableProperties){if(!SymbolStyleLayer.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new FormatSectionOverride(e),n=new StyleExpression(r,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new ZoomConstantExpression("source",n):new ZoomDependentExpression("composite",n,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new PossiblyEvaluatedPropertyValue(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&SymbolStyleLayer.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=Lu.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 Formatted)s(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof it&&rt(e.value)===G?s(e.value.sections):e instanceof FormatExpression?s(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return i}getProgramConfiguration(t){return new ProgramConfiguration(this,t)}}var Vu={paint:new Properties({"background-color":new DataConstantProperty(Tr.paint_background["background-color"]),"background-pattern":new CrossFadedProperty(Tr.paint_background["background-pattern"]),"background-opacity":new DataConstantProperty(Tr.paint_background["background-opacity"])})},Fu={paint:new Properties({"raster-opacity":new DataConstantProperty(Tr.paint_raster["raster-opacity"]),"raster-hue-rotate":new DataConstantProperty(Tr.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new DataConstantProperty(Tr.paint_raster["raster-brightness-min"]),"raster-brightness-max":new DataConstantProperty(Tr.paint_raster["raster-brightness-max"]),"raster-saturation":new DataConstantProperty(Tr.paint_raster["raster-saturation"]),"raster-contrast":new DataConstantProperty(Tr.paint_raster["raster-contrast"]),"raster-resampling":new DataConstantProperty(Tr.paint_raster["raster-resampling"]),"raster-fade-duration":new DataConstantProperty(Tr.paint_raster["raster-fade-duration"])})};class CustomStyleLayer extends StyleLayer{constructor(t){super(t,{}),this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}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 Ru={paint:new Properties({"sky-type":new DataConstantProperty(Tr.paint_sky["sky-type"]),"sky-atmosphere-sun":new DataConstantProperty(Tr.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new DataConstantProperty(Tr.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new DataConstantProperty(Tr.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new DataConstantProperty(Tr.paint_sky["sky-gradient-radius"]),"sky-gradient":new ColorRampProperty(Tr.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new DataConstantProperty(Tr.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new DataConstantProperty(Tr.paint_sky["sky-atmosphere-color"]),"sky-opacity":new DataConstantProperty(Tr.paint_sky["sky-opacity"])})};function ju(t,e,r){const n=[0,0,1],i=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}([]);return function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);t[0]=n*l-s*o,t[1]=i*l+a*o,t[2]=s*l+n*o,t[3]=a*l-i*o}(i,i,r?-o(t)+Math.PI:o(t)),function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);t[0]=n*l+a*o,t[1]=i*l+s*o,t[2]=s*l-i*o,t[3]=a*l-n*o}(i,i,-o(e)),function(t,e,r){var n=r[0],i=r[1],s=r[2],a=e[0],o=e[1],l=e[2],u=i*l-s*o,c=s*a-n*l,h=n*o-i*a,p=i*h-s*c,d=s*u-n*h,f=n*c-i*u,y=2*r[3];c*=y,h*=y,d*=2,f*=2,t[0]=a+(u*=y)+(p*=2),t[1]=o+c+d,t[2]=l+h+f}(n,n,i),zs(n,n)}const Ou={circle:class CircleStyleLayer extends StyleLayer{constructor(t){super(t,ms)}createBucket(t){return new CircleBucket(t)}queryRadius(t){const e=t;return hs("circle-radius",this,e)+hs("circle-stroke-width",this,e)+ps(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=fs(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 Rs(t,n,s,a,o,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,u)}getProgramIds(){return["circle"]}getProgramConfiguration(t){return new ProgramConfiguration(this,t)}},heatmap:class HeatmapStyleLayer extends StyleLayer{createBucket(t){return new HeatmapBucket(t)}constructor(t){super(t,Gs),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Xs({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 hs("heatmap-radius",this,t)}queryIntersectsFeature(t,e,n,i,s,a,o,l){const u=this.paint.get("heatmap-radius").evaluate(e,n);return Rs(t,i,a,o,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 ProgramConfiguration(this,t)}},hillshade:class HillshadeStyleLayer extends StyleLayer{constructor(t){super(t,Ys)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class FillStyleLayer extends StyleLayer{constructor(t){super(t,Ba)}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 ProgramConfiguration(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 FillBucket(t)}queryRadius(){return ps(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,r,n,i,s){return!t.queryGeometry.isAboveHorizon&&rs(ds(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),n)}isTileClipped(){return!0}},"fill-extrusion":class FillExtrusionStyleLayer extends StyleLayer{constructor(t){super(t,oo)}createBucket(t){return new FillExtrusionBucket(t)}queryRadius(){return ps(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 ProgramConfiguration(this,t)}queryIntersectsFeature(t,e,n,i,s,a,o,l,u){const c=fs(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.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],f=l&&a.elevation,y=a.elevation?a.elevation.exaggeration():1,m=t.tile.getBucket(this);if(f&&m instanceof FillExtrusionBucket){const t=m.centroidVertexArray,e=u+1;if(e<t.length){const r=t.get(e);d[0]=r.a_centroid_pos0,d[1]=r.a_centroid_pos1}}if(0===d[0]&&1===d[1])return!1;"globe"===a.projection.name&&(i=so([i],[new r(0,0),new r(Di,Di)],t.tileID.canonical).map((t=>t.polygon)).flat());const g=function(t,e,n,i,s,a,o,l,u,c,h){return"globe"===t.projection.name?function(t,e,r,n,i,s,a,o,l,u,c){const h=[],p=[],d=t.projection.upVectorScale(c,t.center.lat,t.worldSize).metersToTile,f=[0,0,0,1],y=[0,0,0,1],m=(t,e,r,n)=>{t[0]=e,t[1]=r,t[2]=n,t[3]=1},g=function(){const t=Math.PI/32,e=Math.tan(t),r=Bi;return r*Math.sqrt(1+2*e*e)-r}();r>0&&(r+=g),n+=g;for(const g of e){const e=[],x=[];for(const h of g){const p=h.x+i.x,g=h.y+i.y,v=t.projection.projectTilePoint(p,g,c),b=t.projection.upVector(c,h.x,h.y);let _=r,w=n;if(a){const t=fo(p,g,r,n,a,o,l,u);_+=t.base,w+=t.top}0!==r?m(f,v.x+b[0]*d*_,v.y+b[1]*d*_,v.z+b[2]*d*_):m(f,v.x,v.y,v.z),m(y,v.x+b[0]*d*w,v.y+b[1]*d*w,v.z+b[2]*d*w),Ds(f,f,s),Ds(y,y,s),e.push(po(f)),x.push(po(y))}h.push(e),p.push(x)}return[h,p]}(t,e,n,i,s,a,o,l,u,c,h):o?function(t,e,r,n,i,s,a,o,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,f=fo(c,p,e,r,s,a,o,l);h[0]=c,h[1]=p,h[2]=f.base,h[3]=1,Vs(h,h,i),h[3]=Math.max(h[3],1e-5);const y=po([h[0]/h[3],h[1]/h[3],h[2]/h[3]]);h[0]=c,h[1]=p,h[2]=f.top,h[3]=1,Vs(h,h,i),h[3]=Math.max(h[3],1e-5);const m=po([h[0]/h[3],h[1]/h[3],h[2]/h[3]]);t.push(y),d.push(m)}u.push(t),c.push(d)}return[u,c]}(e,n,i,s,a,o,l,u,c):function(t,e,n,i,s){const a=[],o=[],l=s[8]*e,u=s[9]*e,c=s[10]*e,h=s[11]*e,p=s[8]*n,d=s[9]*n,f=s[10]*n,y=s[11]*n;for(const e of t){const t=[],n=[];for(const a of e){const e=a.x+i.x,o=a.y+i.y,m=s[0]*e+s[4]*o+s[12],g=s[1]*e+s[5]*o+s[13],x=s[2]*e+s[6]*o+s[14],v=s[3]*e+s[7]*o+s[15],b=m+l,_=g+u,w=x+c,S=Math.max(v+h,1e-5),A=m+p,k=g+d,I=x+f,M=Math.max(v+y,1e-5),P=new r(b/S,_/S);P.z=w/S,t.push(P);const C=new r(A/M,k/M);C.z=I/M,n.push(C)}a.push(t),o.push(n)}return[a,o]}(e,n,i,s,a)}(a,i,p,h,c,o,f?l:null,d,y,a.center.lat,t.tileID.canonical),x=t.queryGeometry;return function(t,e,r){let n=1/0;rs(r,e)&&(n=ho(r,e[0]));for(let i=0;i<e.length;i++){const s=e[i],a=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],a[t+1],a[t],e];ts(r,i)&&(n=Math.min(n,ho(r,i)))}}return n!==1/0&&n}(g[0],g[1],x.isPointQuery()?x.screenBounds:x.screenGeometry)}},line:class LineStyleLayer extends StyleLayer{constructor(t){super(t,wo),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 Rt,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"]=So.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new LineBucket(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getProgramConfiguration(t){return new ProgramConfiguration(this,t)}queryRadius(t){const e=t,r=Ao(hs("line-width",this,e),hs("line-gap-width",this,e)),n=hs("line-offset",this,e);return r/2+Math.abs(n)+ps(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,n,i,s,a){if(t.queryGeometry.isAboveHorizon)return!1;const o=ds(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,t.pixelToTileUnitsFactor),l=t.pixelToTileUnitsFactor/2*Ao(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],a=[];for(let t=0;t<s.length;t++){const r=s[t-1],n=s[t],o=s[t+1],l=0===t?i:n.sub(r)._unit()._perp(),u=t===s.length-1?i:o.sub(n)._unit()._perp(),c=l._add(u)._unit();c._mult(1/(c.x*u.x+c.y*u.y)),a.push(c._mult(e)._add(n))}n.push(a)}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(us(t,i[e]))return!0;if(ns(t,i,r))return!0}return!1}(o,i,l)}isTileClipped(){return!0}},symbol:SymbolStyleLayer,background:class BackgroundStyleLayer extends StyleLayer{constructor(t){super(t,Vu)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class RasterStyleLayer extends StyleLayer{constructor(t){super(t,Fu)}getProgramIds(){return["raster"]}},sky:class SkyLayer extends StyleLayer{constructor(t){super(t,Ru),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=Xs({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}return!1}getCenter(t,e){if("atmosphere"===this.paint.get("sky-type")){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")&&_("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),n?ju(s.azimuthal,90-s.polar,e):ju(r[0],90-r[1],e)}const r=this.paint.get("sky-gradient-center");return ju(r[0],90-r[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 Uu=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function $u(t){if("number"==typeof t||"boolean"==typeof t||"string"==typeof t||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const r of t)e+=`${$u(r)},`;return`${e}]`}let e="{";for(const r of Object.keys(t).sort())e+=`${r}:${$u(t[r])},`;return`${e}}`}function qu(t){let e="";for(const r of Uu)e+=`/${$u(t[r])}`;return e}class StyleLayerIndex{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 CustomStyleLayer(r):new Ou[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]||qu(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}(h(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 a=i[s];a||(a=i[s]=[]),a.push(e)}}}class DictionaryCoder{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]}}const Nu=["tile","layer","source","sourceLayer","state"];class Feature{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,this._z=e,this._x=r,this._y=n,this.properties=t.properties,this.id=i}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={type:"Feature",geometry:this.geometry,properties:this.properties};void 0!==this.id&&(t.id=this.id);for(const e of Nu)void 0!==this[e]&&(t[e]=this[e]);return t}}class Texture{constructor(t,e,r,n){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,n)}update(t,e,r){const{width:n,height:s}=t,{context:a}=this,{gl:o}=a,{HTMLImageElement:l,HTMLCanvasElement:u,HTMLVideoElement:c,ImageData:h,ImageBitmap:p}=i;if(o.bindTexture(o.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA&&(!e||!1!==e.premultiply)),r||this.size&&this.size[0]===n&&this.size[1]===s){const{x:e,y:i}=r||{x:0,y:0};t instanceof l||t instanceof u||t instanceof c||t instanceof h||p&&t instanceof p?o.texSubImage2D(o.TEXTURE_2D,0,e,i,o.RGBA,o.UNSIGNED_BYTE,t):o.texSubImage2D(o.TEXTURE_2D,0,e,i,n,s,o.RGBA,o.UNSIGNED_BYTE,t.data)}else this.size=[n,s],t instanceof l||t instanceof u||t instanceof c||t instanceof h||p&&t instanceof p?o.texImage2D(o.TEXTURE_2D,0,this.format,this.format,o.UNSIGNED_BYTE,t):o.texImage2D(o.TEXTURE_2D,0,this.format,n,s,0,this.format,o.UNSIGNED_BYTE,t.data);this.useMipmap=Boolean(e&&e.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}bind(t,e){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap?t===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_NEAREST:t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}const Zu=32,Gu=33,Xu=new Uint16Array(8184);for(let t=0;t<2046;t++){let e=t+2,r=0,n=0,i=0,s=0,a=0,o=0;for(1&e?i=s=a=Zu:r=n=o=Zu;(e>>=1)>1;){const t=r+i>>1,l=n+s>>1;1&e?(i=r,s=n,r=a,n=o):(r=i,n=s,i=a,s=o),a=t,o=l}const l=4*t;Xu[l+0]=r,Xu[l+1]=n,Xu[l+2]=i,Xu[l+3]=s}const Yu=new Uint16Array(2178),Ju=new Uint8Array(1089),Ku=new Uint16Array(1089);function Wu(t){return 0===t?-.03125:32===t?.03125:0}var Hu=di([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const Qu={type:2,extent:Di,loadGeometry:()=>[[new r(0,0),new r(8193,0),new r(8193,8193),new r(0,8193),new r(0,0)]]};class Tile{constructor(t,e,r,n,i){this.tileID=t,this.uid=d++,this.uses=0,this.tileSize=e,this.tileZoom=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=i,this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(t){const e=t+this.timeAdded;e<ei.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=mu(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,e,r){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){const r={};if(!e)return r;for(const n of t){const t=n.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){n.layers=t,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)r[e.id]=n}}return r}(t.buckets,e.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const e=this.buckets[t];if(e instanceof SymbolBucket){if(this.hasSymbolBuckets=!0,!r)break;e.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const e=this.buckets[t];if(e instanceof SymbolBucket&&e.hasRTLText){this.hasRTLText=!0,ci.isLoading()||ci.isLoaded()||"deferred"!==li()||ui();break}}this.queryPadding=0;for(const t in this.buckets){const r=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(t).queryRadius(r))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas)}else this.collisionBoxArray=new CollisionBoxArray}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const r=this.buckets[e];r.uploadPending()&&r.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Texture(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Texture(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new Texture(t,this.lineAtlas.image,e.ALPHA),this.lineAtlas.uploaded=!0)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,r,n,i,s,a,o){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:n,pixelPosMatrix:a,transform:s,params:i,tileTransform:this.tileTransform},t,e,r):{}}querySourceFeatures(t,e){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),i=e?e.sourceLayer:"",s=n._geojsonTileLayer||n[i];if(!s)return;const a=qr(e&&e.filter),{z:o,x:l,y:u}=this.tileID.canonical,c={z:o,x:l,y:u};for(let e=0;e<s.length;e++){const n=s.feature(e);if(a.needGeometry){const t=Wi(n,!0);if(!a.filter(new EvaluationParameters(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!a.filter(new EvaluationParameters(this.tileID.overscaledZ),n))continue;const h=r.getId(n,i),p=new Feature(n,o,l,u,h);p.tile=c,t.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const e=this.expirationTime;if(t.cacheControl){const e=k(t.cacheControl);e["max-age"]&&(this.expirationTime=Date.now()+1e3*e["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const t=Date.now();let r=!1;if(this.expirationTime>t)r=!1;else if(e)if(this.expirationTime<e)r=!0;else{const n=this.expirationTime-e;n?this.expirationTime=t+Math.max(n,3e4):r=!0}else r=!0;r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length||!e)return;const r=this.latestFeatureIndex.loadVTLayers(),n=e.style.listImages();for(const i in this.buckets){if(!e.style.hasLayer(i))continue;const s=this.buckets[i],a=s.layers[0].sourceLayer||"_geojsonTileLayer",o=r[a],l=t[a];if(!o||!l||0===Object.keys(l).length)continue;if(s.update(l,o,n,this.imageAtlas&&this.imageAtlas.patternPositions||{}),s instanceof LineBucket||s instanceof FillBucket){const t=e.style._getSourceCache(s.layers[0].source);e._terrain&&e._terrain.enabled&&t&&s.programConfigurations.needsUpload&&e._terrain._clearRenderCacheForTile(t.id,this.tileID)}const u=e&&e.style&&e.style.getLayer(i);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(s)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ei.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=ei.now()+t}setTexture(t,e){const r=e.context,n=r.gl;this.texture=e.getTileTexture(t.width),this.texture?this.texture.update(t,{useMipmap:!0}):(this.texture=new Texture(r,t,n.RGBA,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),r.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax))}setDependencies(t,e){const r={};for(const t of e)r[t]=!0;this.dependencies[t]=r}hasDependency(t,e){for(const r of t){const t=this.dependencies[r];if(t)for(const r of e)if(t[r])return!0}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,e){if(!e||"mercator"===e.name||this._tileDebugBuffer)return;const r=Ki(Qu,this.tileID.canonical,this.tileTransform)[0],n=new StructArrayLayout2i4,i=new StructArrayLayout1ui2;for(let t=0;t<r.length;t++){const{x:e,y:s}=r[t];n.emplaceBack(e,s),i.emplaceBack(t)}i.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(i),this._tileDebugBuffer=t.createVertexBuffer(n,Hl.members),this._tileDebugSegments=SegmentVector.simpleSegment(0,0,n.length,i.length)}_makeTileBoundsBuffers(t,e){if(this._tileBoundsBuffer||!e||"mercator"===e.name)return;const r=Ki(Qu,this.tileID.canonical,this.tileTransform)[0];let n,i;if(this.isRaster){const t=function(t,e){const r=mu(t,e),n=Math.pow(2,t.z);for(let i=0;i<Gu;i++)for(let s=0;s<Gu;s++){const a=Oi((t.x+(s+Wu(s))/Zu)/n),o=Ui((t.y+(i+Wu(i))/Zu)/n),l=e.project(a,o),u=i*Gu+s;Yu[2*u+0]=Math.round((l.x*r.scale-r.x)*Di),Yu[2*u+1]=Math.round((l.y*r.scale-r.y)*Di)}Ju.fill(0),Ku.fill(0);for(let t=2045;t>=0;t--){const e=4*t,r=Xu[e+0],n=Xu[e+1],i=Xu[e+2],s=Xu[e+3],a=r+i>>1,o=n+s>>1,l=a+o-n,u=o+r-a,c=n*Gu+r,h=s*Gu+i,p=o*Gu+a,d=Math.hypot((Yu[2*c+0]+Yu[2*h+0])/2-Yu[2*p+0],(Yu[2*c+1]+Yu[2*h+1])/2-Yu[2*p+1])>=16;if(Ju[p]=Ju[p]||(d?1:0),t<1022){const t=(n+u>>1)*Gu+(r+l>>1),e=(s+u>>1)*Gu+(i+l>>1);Ju[p]=Ju[p]||Ju[t]||Ju[e]}}const i=new StructArrayLayout4i8,s=new StructArrayLayout3ui6;let a=0;function o(t,e){const r=e*Gu+t;return 0===Ku[r]&&(i.emplaceBack(Yu[2*r+0],Yu[2*r+1],t*Di/Zu,e*Di/Zu),Ku[r]=++a),Ku[r]-1}function l(t,e,r,n,i,a){const u=t+r>>1,c=e+n>>1;if(Math.abs(t-i)+Math.abs(e-a)>1&&Ju[c*Gu+u])l(i,a,t,e,u,c),l(r,n,i,a,u,c);else{const l=o(t,e),u=o(r,n),c=o(i,a);s.emplaceBack(l,u,c)}}return l(0,0,Zu,Zu,Zu,0),l(Zu,Zu,0,0,0,Zu),{vertices:i,indices:s}}(this.tileID.canonical,e);n=t.vertices,i=t.indices}else{n=new StructArrayLayout4i8,i=new StructArrayLayout3ui6;for(const{x:t,y:e}of r)n.emplaceBack(t,e,0,0);const t=Ws(n.int16,void 0,4);for(let e=0;e<t.length;e+=3)i.emplaceBack(t[e],t[e+1],t[e+2])}this._tileBoundsBuffer=t.createVertexBuffer(n,Hu.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(i),this._tileBoundsSegments=SegmentVector.simpleSegment(0,0,n.length,i.length)}_makeGlobeTileDebugBuffers(t,e){const r=e.projection;if(!r||"globe"!==r.name||e.freezeTileCoverage)return;const n=this.tileID.canonical,i=du(function(t,e){const r=fu(e.zoom);if(0===r)return su(t);const n=au(t),i=ou(n),s=Fi(n.getWest())*e.worldSize,a=Fi(n.getEast())*e.worldSize,o=Ri(n.getNorth())*e.worldSize,l=Ri(n.getSouth())*e.worldSize,u=[s,o,0],c=[a,o,0],h=[s,l,0],p=[a,l,0],d=bs([],e.globeMatrix);return Ds(u,u,d),Ds(c,c,d),Ds(h,h,d),Ds(p,p,d),i[0]=Ot(i[0],h,r),i[1]=Ot(i[1],p,r),i[2]=Ot(i[2],c,r),i[3]=Ot(i[3],u,r),Aabb.fromPoints(i)}(n,e)),s=fu(e.zoom);let a;s>0&&(a=bs(new Float64Array(16),e.globeMatrix));const o=(n.x+.5)/(1<<n.z)-Fi(e.center.lng);let l=0;o>.5?l=-1:o<-.5&&(l=1),this._makeGlobeTileDebugBorderBuffer(t,n,e,i,a,s,l),this._makeGlobeTileDebugTextBuffer(t,n,e,i,a,s,l)}_globePoint(t,e,r,n,i,s,a,o){let l=cu(t,e,r);if(s){const i=1<<r.z,u=[((t/Di+r.x)/i+o)*n,(e/Di+r.y)/i*n,0];Ds(u,u,s),l=Ot(l,u,a)}return Ds(l,l,i)}_makeGlobeTileDebugBorderBuffer(t,e,r,n,i,s,a){const o=new StructArrayLayout2i4,l=new StructArrayLayout1ui2,u=new StructArrayLayout3i6,c=(t,c,h,p,d)=>{const f=(h-t)/(d-1),y=(p-c)/(d-1),m=o.length;for(let h=0;h<d;h++){const p=t+h*f,d=c+h*y;o.emplaceBack(p,d);const g=this._globePoint(p,d,e,r.worldSize,n,i,s,a);u.emplaceBack(g[0],g[1],g[2]),l.emplaceBack(m+h)}},h=Di;c(0,0,h,0,16),c(h,0,h,h,16),c(h,h,0,h,16),c(0,h,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(l),this._tileDebugBuffer=t.createVertexBuffer(o,Hl.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(u,Wl.members),this._tileDebugSegments=SegmentVector.simpleSegment(0,0,o.length,l.length)}_makeGlobeTileDebugTextBuffer(t,e,r,n,i,s,a){const o=new StructArrayLayout2i4,l=new StructArrayLayout3ui6,u=new StructArrayLayout3i6,c=25;l.reserve(32),o.reserve(c),u.reserve(c);const h=(t,e)=>c*t+e;for(let t=0;t<c;t++){const l=2048*t;for(let t=0;t<c;t++){const c=2048*t;o.emplaceBack(c,l);const h=this._globePoint(c,l,e,r.worldSize,n,i,s,a);u.emplaceBack(h[0],h[1],h[2])}}for(let t=0;t<4;t++)for(let e=0;e<4;e++){const r=h(t,e),n=h(t,e+1),i=h(t+1,e),s=h(t+1,e+1);l.emplaceBack(r,n,i),l.emplaceBack(i,n,s)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(l),this._tileDebugTextBuffer=t.createVertexBuffer(o,Hl.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(u,Wl.members),this._tileDebugTextSegments=SegmentVector.simpleSegment(0,0,c,32)}}class SourceFeatureState{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,e,r){const n=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},p(this.stateChanges[t][n],r),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==n&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][n]){this.deletedStates[t][n]={};for(const e in this.state[t][n])r[e]||(this.deletedStates[t][n][e]=null)}else for(const e in r)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][e]&&delete this.deletedStates[t][n][e]}removeFeatureState(t,e,r){if(null===this.deletedStates[t])return;const n=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&void 0!==e)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][r]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][n])for(r in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][r]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}getState(t,e){const r=String(e),n=p({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const r=this.deletedStates[t][e];if(null===r)return{};for(const t in r)delete n[t]}return n}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,e){const r={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const e={};for(const r in this.stateChanges[t])this.state[t][r]||(this.state[t][r]={}),p(this.state[t][r],this.stateChanges[t][r]),e[r]=this.state[t][r];r[t]=e}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const e={};if(null===this.deletedStates[t])for(const r in this.state[t])e[r]={},this.state[t][r]={};else for(const r in this.deletedStates[t]){if(null===this.deletedStates[t][r])this.state[t][r]={};else for(const e of Object.keys(this.deletedStates[t][r]))delete this.state[t][r][e];e[r]=this.state[t][r]}r[t]=r[t]||{},p(r[t],e)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const n in t)t[n].setFeatureState(r,e)}}class MipLevel{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 tc(t,e,r,n){let i=0,s=Number.MAX_VALUE;for(let a=0;a<3;a++)if(Math.abs(n[a])<1e-15){if(r[a]<t[a]||r[a]>e[a])return null}else{const o=1/n[a];let l=(t[a]-r[a])*o,u=(e[a]-r[a])*o;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 ec(t,e,r,n,i,s,a,o,l,u,c){const h=n-t,p=i-e,d=s-r,f=a-t,y=o-e,m=l-r,g=c[1]*m-c[2]*y,x=c[2]*f-c[0]*m,v=c[0]*y-c[1]*f,b=h*g+p*x+d*v;if(Math.abs(b)<1e-15)return null;const _=1/b,w=u[0]-t,S=u[1]-e,A=u[2]-r,k=(w*g+S*x+A*v)*_;if(k<0||k>1)return null;const I=S*d-A*p,M=A*h-w*d,P=w*p-S*h,C=(c[0]*I+c[1]*M+c[2]*P)*_;return C<0||k+C>1?null:(f*I+y*M+m*P)*_}function rc(t,e,r){return(t-e)/(r-e)}function nc(t,e,r,n,i,s,a,o,l){const u=1<<r,c=s-n,h=a-i,p=(t+1)/u*c+n,d=(e+0)/u*h+i,f=(e+1)/u*h+i;o[0]=(t+0)/u*c+n,o[1]=d,l[0]=p,l[1]=f}class DemMinMaxQuadTree{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,a=(t+1)*r-s,o=e*r,l=(e+1)*r-s;i[0]=t*r,i[1]=o,i[2]=a,i[3]=l};let a=new MipLevel(n);const o=[];for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),i,!1,o);const r=sc(o[0],o[1],t),l=sc(o[2],o[1],t),u=sc(o[2],o[3],t),c=sc(o[0],o[3],t);a.minimums.push(Math.min(r,l,u,c)),a.maximums.push(Math.max(r,l,u,c)),a.leaves.push(1)}for(r.push(a),n/=2;n>=1;n/=2){const t=r[r.length-1];a=new MipLevel(n);for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),2,!0,o);const r=t.getElevation(o[0],o[1]),i=t.getElevation(o[2],o[1]),l=t.getElevation(o[2],o[3]),u=t.getElevation(o[0],o[3]),c=t.isLeaf(o[0],o[1]),h=t.isLeaf(o[2],o[1]),p=t.isLeaf(o[2],o[3]),d=t.isLeaf(o[0],o[3]),f=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&&d;a.maximums.push(y),a.minimums.push(f),a.leaves.push(y-f<=5&&m?1:0)}r.push(a)}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,a=1){return tc([t,e,-100],[r,n,this.maximums[0]*a],i,s)}raycast(t,e,r,n,i,s,a=1){if(!this.nodeCount)return null;const o=this.raycastRoot(t,e,r,n,i,s,a);if(null==o)return null;const l=[],u=[],c=[],h=[],p=[{idx:0,t:o,nodex:0,nodey:0,depth:0}];for(;p.length>0;){const{idx:o,t:d,nodex:f,nodey:y,depth:m}=p.pop();if(this.leaves[o]){nc(f,y,m,t,e,r,n,c,h);const o=1<<m,l=(f+0)/o,u=(f+1)/o,p=(y+0)/o,g=(y+1)/o,x=sc(l,p,this.dem)*a,v=sc(u,p,this.dem)*a,b=sc(u,g,this.dem)*a,_=sc(l,g,this.dem)*a,w=ec(c[0],c[1],x,h[0],c[1],v,h[0],h[1],b,i,s),S=ec(h[0],h[1],b,c[0],h[1],_,c[0],c[1],x,i,s),A=Math.min(null!==w?w:Number.MAX_VALUE,null!==S?S:Number.MAX_VALUE);if(A!==Number.MAX_VALUE)return A;{const t=Ts([],i,s,d);if(ic(x,v,_,b,rc(t[0],c[0],h[0]),rc(t[1],c[1],h[1]))>=t[2])return d}continue}let g=0;for(let p=0;p<this._siblingOffset.length;p++){nc((f<<1)+this._siblingOffset[p][0],(y<<1)+this._siblingOffset[p][1],m+1,t,e,r,n,c,h),c[2]=-100,h[2]=this.maximums[this.childOffsets[o]+p]*a;const d=tc(c,h,i,s);if(null!=d){const t=d;l[p]=t;let e=!1;for(let r=0;r<g&&!e;r++)t>=l[u[r]]&&(u.splice(r,0,p),e=!0);e||(u[g]=p),g++}}for(let t=0;t<g;t++){const e=u[t];p.push({idx:this.childOffsets[o]+e,t:l[e],nodex:(f<<1)+this._siblingOffset[e][0],nodey:(y<<1)+this._siblingOffset[e][1],depth:m+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,a=t[s];let o=0,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=a.getElevation(n,i),u=a.isLeaf(n,i),c=this._addNode(s.min,s.max,u);u&&(o|=1<<t),l||(l=c)}for(let n=0;n<this._siblingOffset.length;n++)o&1<<n||this._construct(t,2*e+this._siblingOffset[n][0],2*r+this._siblingOffset[n][1],s,l+n)}}function ic(t,e,r,n,i,s){return jt(jt(t,r,s),jt(e,n,s),i)}function sc(t,e,r){const n=r.dim,i=u(t*n-.5,0,n-1),s=u(e*n-.5,0,n-1),a=Math.floor(i),o=Math.floor(s),l=Math.min(a+1,n-1),c=Math.min(o+1,n-1);return ic(r.get(a,o),r.get(l,o),r.get(a,c),r.get(l,c),i-a,s-o)}const ac={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};class DEMData{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 _(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const s=this.dim=e.height-2,a=new Uint32Array(e.data.buffer);if(this.pixels=new Uint8Array(e.data.buffer),this.encoding=r||"mapbox",this.borderReady=n,!n){for(let t=0;t<s;t++)a[this._idx(-1,t)]=a[this._idx(0,t)],a[this._idx(s,t)]=a[this._idx(s-1,t)],a[this._idx(t,-1)]=a[this._idx(t,0)],a[this._idx(t,s)]=a[this._idx(t,s-1)];a[this._idx(-1,-1)]=a[this._idx(0,0)],a[this._idx(s,-1)]=a[this._idx(s-1,0)],a[this._idx(-1,s)]=a[this._idx(0,s-1)],a[this._idx(s,s)]=a[this._idx(s-1,s-1)],i&&this._buildQuadTree()}}_buildQuadTree(){this._tree=new DemMinMaxQuadTree(this)}get(t,e,r=!1){r&&(t=u(t,-1,this.dim),e=u(e,-1,this.dim));const n=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(this.pixels[n],this.pixels[n+1],this.pixels[n+2])}static getUnpackVector(t){return ac[t]}get unpackVector(){return ac[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=DEMData.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 RGBAImage({width:this.stride,height:this.stride},this.pixels)}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=a-1;break;case 1:a=s+1}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e<a;e++)for(let r=n;r<i;r++){const n=4*this._idx(r,e),i=4*this._idx(r+o,e+l);this.pixels[n+0]=t.pixels[i+0],this.pixels[n+1]=t.pixels[i+1],this.pixels[n+2]=t.pixels[i+2],this.pixels[n+3]=t.pixels[i+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}Sr(DEMData,"DEMData"),Sr(DemMinMaxQuadTree,"DemMinMaxQuadTree",{omit:["dem"]});class TileCache{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,r){const n=t.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);const i={value:e,timeout:void 0};if(void 0!==r&&(i.timeout=setTimeout((()=>{this.remove(t,i)}),r)),this.data[n].push(i),this.order.push(n),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const r in this.data)for(const n of this.data[r])t(n.value)||e.push(n);for(const t of e)this.remove(t.value.tileID,t)}}class ColorMode{constructor(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r}}ColorMode.Replace=[1,0],ColorMode.disabled=new ColorMode(ColorMode.Replace,B.transparent,[!1,!1,!1,!1]),ColorMode.unblended=new ColorMode(ColorMode.Replace,B.transparent,[!0,!0,!0,!0]),ColorMode.alphaBlended=new ColorMode([1,771],B.transparent,[!0,!0,!0,!0]);class SourceCache extends Evented{constructor(t,e,r){super(),this.id=t,this._onlySymbols=r,e.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),e.on("error",(()=>{this._sourceErrored=!0})),this._source=e,this._tiles={},this._cache=new TileCache(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=e.minTileCacheSize,this._maxTileCacheSize=e.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new SourceFeatureState,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(t){this.map=t,this._minTileCacheSize=void 0===this._minTileCacheSize&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,e){return t.isSymbolTile=this._onlySymbols,this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t,(()=>{}))}serialize(){return this._source.serialize()}prepare(t){if(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._source.prepareTile)for(const e in this._tiles){const r=this._tiles[e];this._source.prepareTile(r)&&this.map.painter.terrain&&this.map.painter.terrain._clearRenderCacheForTile(this.id,r.tileID),r.upload(t),r.prepare(this.map.style.imageManager)}else for(const e in this._tiles){const r=this._tiles[e];r.upload(t),r.prepare(this.map.style.imageManager)}}getIds(){return h(this._tiles).map((t=>t.tileID)).sort(oc).map((t=>t.key))}getRenderableIds(t){const e=[];for(const r in this._tiles)this._isIdRenderable(+r,t)&&e.push(this._tiles[r]);return t?e.sort(((t,e)=>{const n=t.tileID,i=e.tileID,s=new r(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),a=new r(i.canonical.x,i.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-i.overscaledZ||a.y-s.y||a.x-s.x})).map((t=>t.tileID.key)):e.map((t=>t.tileID)).sort(oc).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(+t,"reloading")}}_reloadTile(t,e){const r=this._tiles[t];r&&("loading"!==r.state&&(r.state=e),this._loadTile(r,this._tileLoaded.bind(this,r,t,e)))}_tileLoaded(t,e,r,n){if(n)if(t.state="errored",404!==n.status)this._source.fire(new ErrorEvent(n,{tile:t}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const t=this.map.painter.terrain;this.update(this.transform,t.getScaledDemTileSize(),!0),t.resetTileLookupCache(this.id)}else this.update(this.transform);else t.timeAdded=ei.now(),"expired"===r&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(e,t),"raster-dem"===this._source.type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new Event("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const e=this.getRenderableIds();for(let n=0;n<e.length;n++){const i=e[n];if(t.neighboringTiles&&t.neighboringTiles[i]){const e=this.getTileByID(i);r(t,e),r(e,t)}}function r(t,e){if(!t.dem||t.dem.borderReady)return;t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0;let r=e.tileID.canonical.x-t.tileID.canonical.x;const n=e.tileID.canonical.y-t.tileID.canonical.y,i=Math.pow(2,t.tileID.canonical.z),s=e.tileID.key;0===r&&0===n||Math.abs(n)>1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[s]&&(t.neighboringTiles[s].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,r,n){for(const i in this._tiles){let s=this._tiles[i];if(n[i]||!s.hasData()||s.tileID.overscaledZ<=e||s.tileID.overscaledZ>r)continue;let a=s.tileID;for(;s&&s.tileID.overscaledZ>e+1;){const t=s.tileID.scaledTo(s.tileID.overscaledZ-1);s=this._tiles[t.key],s&&s.hasData()&&(a=t)}let o=a;for(;o.overscaledZ>e;)if(o=o.scaledTo(o.overscaledZ-1),t[o.key]){n[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(let r=t.overscaledZ-1;r>=e;r--){const e=t.scaledTo(r),n=this._getLoadedTile(e);if(n)return n}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,e){e=e||this._source.tileSize;const r=Math.ceil(t.width/e)+1,n=Math.ceil(t.height/e)+1,i=Math.floor(r*n*5),s="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,i):i,a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(a)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const r in this._tiles){const n=this._tiles[r];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),t[n.tileID.key]=n}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(+t,this._tiles[t])}}update(t,e,r){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!r)return;let n;this.updateCacheSize(t,e),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new OverscaledTileID(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(n=t.coveringTiles({tileSize:e||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(n=n.filter((t=>this._source.hasTile(t))))):n=[];const i=this._updateRetainedTiles(n);if(lc(this._source.type)&&0!==n.length){const t={},e={},r=Object.keys(i);for(const n of r){const r=i[n],s=this._tiles[n];if(!s||s.fadeEndTime&&s.fadeEndTime<=ei.now())continue;const a=this.findLoadedParent(r,Math.max(r.overscaledZ-SourceCache.maxOverzooming,this._source.minzoom));a&&(this._addTile(a.tileID),t[a.tileID.key]=a.tileID),e[n]=r}const s=n[n.length-1].overscaledZ;for(const t in this._tiles){const r=this._tiles[t];if(i[t]||!r.hasData())continue;let n=r.tileID;for(;n.overscaledZ>s;){n=n.scaledTo(n.overscaledZ-1);const s=this._tiles[n.key];if(s&&s.hasData()&&e[n.key]){i[t]=r.tileID;break}}}for(const e in t)i[e]||(this._coveredTiles[e]=!0,i[e]=t[e])}for(const t in i)this._tiles[t].clearFadeHold();const s=function(t,e){const r=[];for(const n in t)n in e||r.push(n);return r}(this._tiles,i);for(const t of s){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(+t)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const e={};if(0===t.length)return e;const r={},n=t.reduce(((t,e)=>Math.min(t,e.overscaledZ)),1/0),i=t[0].overscaledZ,s=Math.max(i-SourceCache.maxOverzooming,this._source.minzoom),a=Math.max(i+SourceCache.maxUnderzooming,this._source.minzoom),o={};for(const r of t){const t=this._addTile(r);e[r.key]=r,t.hasData()||n<this._source.maxzoom&&(o[r.key]=r)}this._retainLoadedChildren(o,n,a,e);for(const n of t){let t=this._tiles[n.key];if(t.hasData())continue;if(n.canonical.z>=this._source.maxzoom){const t=n.children(this._source.maxzoom)[0],r=this.getTile(t);if(r&&r.hasData()){e[t.key]=t;continue}}else{const t=n.children(this._source.maxzoom);if(e[t[0].key]&&e[t[1].key]&&e[t[2].key]&&e[t[3].key])continue}let i=t.wasRequested();for(let a=n.overscaledZ-1;a>=s;--a){const s=n.scaledTo(a);if(r[s.key])break;if(r[s.key]=!0,t=this.getTile(s),!t&&i&&(t=this._addTile(s)),t&&(e[s.key]=s,i=t.wasRequested(),t.hasData()))break}}return e}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let r,n=this._tiles[t].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}e.push(n.key);const t=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(t),r)break;n=t}for(const t of e)this._loadedParentTiles[t]=r}}_addTile(t){let e=this._tiles[t.key];if(e)return this._source.prepareTile&&this._source.prepareTile(e),e;e=this._cache.getAndRemove(t),e&&(this._setTileReloadTimer(t.key,e),e.tileID=t,this._state.initializeTileState(e,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,e)));const r=Boolean(e);if(!r){const r=this.map?this.map.painter:null;e=new Tile(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom,r,this._isRaster),this._source.prepareTile&&this._source.prepareTile(e)||this._loadTile(e,this._tileLoaded.bind(this,e,t.key,e.state))}return e?(e.uses++,this._tiles[t.key]=e,r||this._source.fire(new Event("dataloading",{tile:e,coord:e.tileID,dataType:"source"})),e):null}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const r=e.getExpiryTimeout();r&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),r))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,e,r){const n=[],i=this.transform;if(!i)return n;const s="globe"===i.projection.name,a=Fi(i.center.lng);for(const o in this._tiles){const l=this._tiles[o];if(r&&l.clearQueryDebugViz(),l.holdingForFade())continue;let c;if(s){const t=l.tileID.canonical;if(0===t.z){const e=[Math.abs(u(a,...uc(t,-1))-a),Math.abs(u(a,...uc(t,1))-a)];c=[0,2*e.indexOf(Math.min(...e))-1]}else{const e=[Math.abs(u(a,...uc(t,-1))-a),Math.abs(u(a,...uc(t,0))-a),Math.abs(u(a,...uc(t,1))-a)];c=[e.indexOf(Math.min(...e))-1]}}else c=[0];for(const r of c){const s=t.containsTile(l,i,e,r);s&&n.push(s)}}return n}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.projMatrix=this.transform.calculateProjMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(lc(this._source.type))for(const t in this._tiles){const e=this._tiles[t];if(void 0!==e.fadeEndTime&&e.fadeEndTime>=ei.now())return!0}return!1}setFeatureState(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)}removeFeatureState(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,r){const n=this._tiles[t];n&&n.setDependencies(e,r)}reloadTilesForDependencies(t,e){for(const r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(+r,"reloading");this._cache.filter((r=>!r.hasDependency(t,e)))}_preloadTiles(t,e){const r=new Map,n=Array.isArray(t)?t:[t],i=this.map.painter.terrain,s=this.usedForTerrain&&i?i.getScaledDemTileSize():this._source.tileSize;for(const t of n){const e=t.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const t of e)r.set(t.key,t);this.usedForTerrain&&t.updateElevation(!1)}!function(t,e,r){if(!t.length)return r(null,[]);let n=t.length;const i=new Array(t.length);let s=null;t.forEach(((t,a)=>{e(t,((t,e)=>{t&&(s=t),i[a]=e,0==--n&&r(s,i)}))}))}(Array.from(r.values()),((t,e)=>{const r=new Tile(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(r,(t=>{"raster-dem"===this._source.type&&r.dem&&this._backfillDEM(r),e(t,r)}))}),e)}}function oc(t,e){const r=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function lc(t){return"raster"===t||"image"===t||"video"===t}function uc(t,e){const r=1<<t.z;return[t.x/r+e,(t.x+1)/r+e]}SourceCache.maxOverzooming=10,SourceCache.maxUnderzooming=3;class DEMSampler{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,a=1<<e.canonical.z-s.canonical.z;return new DEMSampler(n,n.tileSize/Di/a,[(e.canonical.x/a-s.canonical.x)*i.dim,(e.canonical.y/a-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],a=Math.floor(i),o=Math.floor(s),l=this._dem;return n=!!n,r?jt(jt(l.get(a,o,n),l.get(a,o+1,n),s-o),jt(l.get(a+1,o,n),l.get(a+1,o+1,n),s-o),i-a):l.get(a,o,n)}getElevationAtPixel(t,e,r){return this._dem.get(t,e,!!r)}getMeterToDEM(t){return(1<<this._demTile.tileID.canonical.z)*ji(1,t)*this._dem.stride}}class FeatureIndex{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new T(Di,16,0),this.featureIndexArray=new FeatureIndexArray,this.promoteId=e}insert(t,e,r,n,i,s=0){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i,s);const o=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]<Di&&n[1]<Di&&n[2]>=0&&n[3]>=0&&o.insert(a,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Xa.VectorTile(new $o(this.rawTileData)).layers,this.sourceLayerCoder=new DictionaryCoder(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||{},a=qr(s.filter),o=t.tileResult,l=t.transform,u=o.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 a=[new r(e,n),new r(e,s),new r(i,s),new r(i,n)];if(t.length>2)for(const e of a)if(us(t,e))return!0;for(let e=0;e<t.length-1;e++)if(cs(t[e],t[e+1],a))return!0;return!1}(o.bufferedTilespaceGeometry,t,e,n,i)));c.sort(hc);let h=null;l.elevation&&c.length>0&&(h=DEMSampler.create(l.elevation,this.tileID));const p={};let d;for(let r=0;r<c.length;r++){const l=c[r];if(l===d)continue;d=l;const u=this.featureIndexArray.get(l);let f=null;this.loadMatchingFeature(p,u,a,s.layers,s.availableImages,e,n,i,((e,r,n,i=0)=>(f||(f=Ki(e,this.tileID.canonical,t.tileTransform)),r.queryIntersectsFeature(o,e,n,f,this.z,t.transform,t.pixelPosMatrix,h,i))))}return p}loadMatchingFeature(t,e,r,n,i,s,a,o,l){const{featureIndex:u,bucketIndex:c,sourceLayerIndex:h,layoutVertexArrayOffset:d}=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 y=this.sourceLayerCoder.decode(h),m=this.vtLayers[y].feature(u);if(r.needGeometry){const t=Wi(m,!0);if(!r.filter(new EvaluationParameters(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!r.filter(new EvaluationParameters(this.tileID.overscaledZ),m))return;const g=this.getId(m,y);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!==g&&o&&(h=o.getState(c.sourceLayer||"_geojsonTileLayer",g));const y=p({},a[r]);y.paint=cc(y.paint,c.paint,m,h,i),y.layout=cc(y.layout,c.layout,m,h,i);const x=!l||l(m,c,h,d);if(!x)continue;const v=new Feature(m,this.z,this.x,this.y,g);v.layer=y;let b=t[r];void 0===b&&(b=t[r]=[]),b.push({featureIndex:u,feature:v,intersectionZ:x})}}lookupSymbolFeatures(t,e,r,n,i,s,a,o){const l={};this.loadVTLayers();const u=qr(i);for(const i of t)this.loadMatchingFeature(l,{bucketIndex:r,sourceLayerIndex:n,featureIndex:i,layoutVertexArrayOffset:0},u,s,a,o,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 cc(t,e,r,n,i){return x(t,((t,s)=>{const a=e instanceof PossiblyEvaluated?e.get(s):null;return a&&a.evaluate?a.evaluate(r,n,i):a}))}function hc(t,e){return e-t}Sr(FeatureIndex,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class LineAtlas{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.image=new AlphaImage({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,a=!0;n.push({left:i,right:s,isDash:a,zeroLength:0===t[0]});let o=t[0];for(let e=1;e<t.length;e++){a=!a;const l=t[e];i=o*r,o+=l,s=o*r,n.push({left:i,right:s,isDash:a,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,a=t[s];for(let o=0;o<this.width;o++){o/a.right>1&&(a=t[++s]);const l=Math.abs(o-a.left),u=Math.abs(o-a.right),c=Math.min(l,u);let h;const p=e/r*(n+1);if(a.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+o]=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,a=t[s];for(let r=0;r<this.width;r++){r/a.right>1&&(a=t[++s]);const n=Math.abs(r-a.left),o=Math.abs(r-a.right),l=Math.min(n,o);this.image.data[i+r]=Math.max(0,Math.min(255,(a.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 _("LineAtlas out of space"),null;0===t.length&&t.push(1);let a=0;for(let e=0;e<t.length;e++)t[e]<0&&(_("Negative value is found in line dasharray, replacing values with 0"),t[e]=0),a+=t[e];if(0!==a){const r=this.width/a,s=this.getDashRanges(t,this.width,r);n?this.addRoundDash(s,r,i):this.addRegularDash(s,"square"===e?.5*r:0)}const o=this.nextRow+i;this.nextRow+=s;const l={tl:[o,i],br:[a,0]};return this.positions[r]=l,l}}Sr(LineAtlas,"LineAtlas");class GlyphAtlas{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,a={x:0,y:0,w:e.bitmap.width+2*n,h:e.bitmap.height+2*n};r.push(a),s[t]=a}}const{w:n,h:i}=ll(r),s=new AlphaImage({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 a=e[r][t],o=i.metrics.localGlyph?2:1;AlphaImage.copy(i.bitmap,s,{x:0,y:0},{x:a.x+o,y:a.y+o},i.bitmap)}}this.image=s,this.positions=e}}Sr(GlyphAtlas,"GlyphAtlas");class WorkerTile{constructor(t){this.tileID=new OverscaledTileID(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=mu(t.tileID.canonical,t.projection),this.projection=t.projection}parse(t,e,r,n,i){this.status="parsing",this.data=t,this.collisionBoxArray=new CollisionBoxArray;const s=new DictionaryCoder(Object.keys(t.layers).sort()),a=new FeatureIndex(this.tileID,this.promoteId);a.bucketLayerIDs=[];const o={},l=new LineAtlas(256,256),u={featureIndex:a,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&&_(`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=a.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&&(pc(t,this.zoom,r),(o[e.id]=e.createBucket({index:a.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,projection:this.projection.spec,availableImages:r})).populate(p,u,this.tileID.canonical,this.tileTransform),a.bucketLayerIDs.push(t.map((t=>t.id))))}}let p,d,f,y;l.trim();const m={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},g=x(u.glyphDependencies,(t=>Object.keys(t).map(Number)));Object.keys(g).length?n.send("getGlyphs",{uid:this.uid,stacks:g},((t,e)=>{p||(p=t,d=e,w.call(this))}),void 0,!1,m):d={};const v=Object.keys(u.iconDependencies);v.length?n.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{p||(p=t,f=e,w.call(this))}),void 0,!1,m):f={};const b=Object.keys(u.patternDependencies);function w(){if(p)return i(p);if(d&&f&&y){const t=new GlyphAtlas(d),e=new ImageAtlas(f,y);for(const n in o){const i=o[n];i instanceof SymbolBucket?(pc(i.layers,this.zoom,r),$l(i,d,t.positions,f,e.iconPositions,this.showCollisionBoxes,r,this.tileID.canonical,this.tileZoom,this.projection)):i.hasPattern&&(i instanceof LineBucket||i instanceof FillBucket||i instanceof FillExtrusionBucket)&&(pc(i.layers,this.zoom,r),i.addFeatures(u,this.tileID.canonical,e.patternPositions,r,this.tileTransform))}this.status="done",i(null,{buckets:h(o).filter((t=>!t.isEmpty())),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,lineAtlas:l,imageAtlas:e,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?t.positions:null})}}b.length?n.send("getImages",{icons:b,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{p||(p=t,y=e,w.call(this))}),void 0,!1,m):y={},w.call(this)}}function pc(t,e,r){const n=new EvaluationParameters(e);for(const e of t)e.recalculate(n,r)}class DedupedRequest{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 dc(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=vr(t.request,((t,n,i,s)=>{t?e(t):n&&e(null,{vectorTile:r?void 0:new Xa.VectorTile(new $o(n)),rawData:n,cacheControl:i,expires:s})}));return()=>{n.cancel(),e()}}),e)}class VectorTileWorkerSource extends Evented{constructor(t,e,r,n,i){super(),this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=i||dc,this.loading={},this.loaded={},this.deduped=new DedupedRequest(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 WorkerTile(t);s.abort=this.loadVectorData(t,((a,o)=>{const l=!this.loading[r];if(delete this.loading[r],l||a||!o)return s.status="done",l||(this.loaded[r]=s),e(a);const u=o.rawData,c={};o.expires&&(c.expires=o.expires),o.cacheControl&&(c.cacheControl=o.cacheControl),s.vectorTile=o.vectorTile||new Xa.VectorTile(new $o(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=Cr(n);t.length>0&&(s.resourceTiming=JSON.parse(JSON.stringify(t)))}e(null,p({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,s.tileTransform=mu(t.tileID.canonical,t.projection);const a=(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=a:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}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()}}class RasterDEMTileWorkerSource{loadTile(t,e){const{uid:r,encoding:n,rawImageData:s,padding:a,buildQuadTree:o}=t,l=i.ImageBitmap&&s instanceof i.ImageBitmap?this.getImageData(s,a):s;e(null,new DEMData(r,l,n,a<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),r}}var fc=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)yc(e.coordinates,r);else if("MultiPolygon"===i)for(n=0;n<e.coordinates.length;n++)yc(e.coordinates[n],r);return e};function yc(t,e){if(0!==t.length){mc(t[0],e);for(var r=1;r<t.length;r++)mc(t[r],!e)}}function mc(t,e){for(var r=0,n=0,i=0,s=t.length,a=s-1;i<s;a=i++){var o=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+o;n+=Math.abs(r)>=Math.abs(o)?r-l+o:o-l+r,r=l}r+n>=0!=!!e&&t.reverse()}const gc=Xa.VectorTileFeature.prototype.toGeoJSON;class FeatureWrapper$1{constructor(t){this._feature=t,this.extent=Di,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 gc.call(this,t,e,r)}}class GeoJSONWrapper$1{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=Di,this.length=t.length,this._features=t}feature(t){return new FeatureWrapper$1(this._features[t])}}var xc=Xa.VectorTileFeature,vc=bc;function bc(t,e){this.options=e||{},this.features=t,this.length=t.length}function _c(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}bc.prototype.feature=function(t){return new _c(this.features[t],this.options.extent)},_c.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var 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},_c.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,s=0;s<t.length;s++)for(var a=t[s],o=0;o<a.length;o++){var l=a[o];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},_c.prototype.toGeoJSON=xc.prototype.toGeoJSON;var wc=Ac,Sc=vc;function Ac(t){var e=new $o;return function(t,e){for(var r in t.layers)e.writeMessage(3,kc,t.layers[r])}(t,e),e.finish()}function kc(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,Ic,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,zc,s[r])}function Ic(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,Mc,t),e.writeVarintField(3,r.type),e.writeMessage(4,Tc,r)}function Mc(t,e){var r=t.feature,n=t.keys,i=t.values,s=t.keycache,a=t.valuecache;for(var o in r.properties){var l=r.properties[o],u=s[o];if(null!==l){void 0===u&&(n.push(o),s[o]=u=n.length-1),e.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=a[h];void 0===p&&(i.push(l),a[h]=p=i.length-1),e.writeVarint(p)}}}function Pc(t,e){return(e<<3)+(7&t)}function Cc(t){return t<<1^t>>31}function Tc(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,s=0,a=r.length,o=0;o<a;o++){var l=r[o],u=1;1===n&&(u=l.length),e.writeVarint(Pc(1,u));for(var c=3===n?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==n&&e.writeVarint(Pc(2,c-1));var p=l[h].x-i,d=l[h].y-s;e.writeVarint(Cc(p)),e.writeVarint(Cc(d)),i+=p,s+=d}3===n&&e.writeVarint(Pc(7,1))}}function zc(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 Ec(t,e,r,n,i,s){if(i-n<=r)return;const a=n+i>>1;Dc(t,e,a,n,i,s%2),Ec(t,e,r,n,a-1,s+1),Ec(t,e,r,a+1,i,s+1)}function Dc(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const a=i-n+1,o=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(o-a/2<0?-1:1);Dc(t,e,r,Math.max(n,Math.floor(r-o*u/a+c)),Math.min(i,Math.floor(r+(a-o)*u/a+c)),s)}const a=e[2*r+s];let o=n,l=i;for(Bc(t,e,n,r),e[2*i+s]>a&&Bc(t,e,n,i);o<l;){for(Bc(t,e,o,l),o++,l--;e[2*o+s]<a;)o++;for(;e[2*l+s]>a;)l--}e[2*n+s]===a?Bc(t,e,n,l):(l++,Bc(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Bc(t,e,r,n){Lc(t,r,n),Lc(e,2*r,2*n),Lc(e,2*r+1,2*n+1)}function Lc(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function Vc(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}wc.fromVectorTileJs=Ac,wc.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var n in t)r[n]=new vc(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Ac({layers:r})},wc.GeoJSONWrapper=Sc;const Fc=t=>t[0],Rc=t=>t[1];class KDBush{constructor(t,e=Fc,r=Rc,n=64,i=Float64Array){this.nodeSize=n,this.points=t;const s=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new s(t.length),o=this.coords=new i(2*t.length);for(let n=0;n<t.length;n++)a[n]=n,o[2*n]=e(t[n]),o[2*n+1]=r(t[n]);Ec(a,o,n,0,a.length-1,0)}range(t,e,r,n){return function(t,e,r,n,i,s,a){const o=[0,t.length-1,0],l=[];let u,c;for(;o.length;){const h=o.pop(),p=o.pop(),d=o.pop();if(p-d<=a){for(let a=d;a<=p;a++)u=e[2*a],c=e[2*a+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[a]);continue}const f=Math.floor((d+p)/2);u=e[2*f],c=e[2*f+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[f]);const y=(h+1)%2;(0===h?r<=u:n<=c)&&(o.push(d),o.push(f-1),o.push(y)),(0===h?i>=u:s>=c)&&(o.push(f+1),o.push(p),o.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 a=[0,t.length-1,0],o=[],l=i*i;for(;a.length;){const u=a.pop(),c=a.pop(),h=a.pop();if(c-h<=s){for(let i=h;i<=c;i++)Vc(e[2*i],e[2*i+1],r,n)<=l&&o.push(t[i]);continue}const p=Math.floor((h+c)/2),d=e[2*p],f=e[2*p+1];Vc(d,f,r,n)<=l&&o.push(t[p]);const y=(u+1)%2;(0===u?r-i<=d:n-i<=f)&&(a.push(h),a.push(p-1),a.push(y)),(0===u?r+i>=d:n+i>=f)&&(a.push(p+1),a.push(c),a.push(y))}return o}(this.ids,this.coords,t,e,r,this.nodeSize)}}const jc={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Oc=Math.fround||(Uc=new Float32Array(1),t=>(Uc[0]=+t,Uc[0]));var Uc;class Supercluster{constructor(t){this.options=Jc(Object.create(jc),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 a=[];for(let e=0;e<t.length;e++)t[e].geometry&&a.push(qc(t[e],e));this.trees[n+1]=new KDBush(a,Kc,Wc,i,Float32Array),e&&console.timeEnd(s);for(let t=n;t>=r;t--){const r=+Date.now();a=this._cluster(a,t),this.trees[t]=new KDBush(a,Kc,Wc,i,Float32Array),e&&console.log("z%d: %d clusters in %dms",t,a.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),a=this.getClusters([-180,n,i,s],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],o=a.range(Gc(r),Xc(s),Gc(i),Xc(n)),l=[];for(const t of o){const e=a.points[t];l.push(e.numPoints?Nc(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 a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),o=i.within(s.x,s.y,a),l=[];for(const e of o){const r=i.points[e];r.parentId===t&&l.push(r.numPoints?Nc(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:a}=this.options,o=a/s,l=(r-o)/i,u=(r+1+o)/i,c={features:[]};return this._addTileFeatures(n.range((e-o)/i,l,(e+1+o)/i,u),n.points,e,r,i,c),0===e&&this._addTileFeatures(n.range(1-o/i,l,1,u),n.points,i,r,i,c),e===i-1&&this._addTileFeatures(n.range(0,l,o/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 a of t){const t=e[a],o=t.numPoints;let l,u,c;if(o)l=Zc(t),u=t.x,c=t.y;else{const e=this.points[t.index];l=e.properties,u=Gc(e.geometry.coordinates[0]),c=Xc(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;o?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:a}=this.options,o=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,o),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>=a){let t=i.x*c,a=i.y*c,o=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,a+=n.y*u,n.parentId=p,s&&(o||(o=this._map(i,!0)),s(o,this._map(n)))}i.parentId=p,r.push($c(t/h,a/h,p,h,o))}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?Jc({},t.properties):t.properties;const r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?Jc({},n):n}}function $c(t,e,r,n,i){return{x:Oc(t),y:Oc(e),zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function qc(t,e){const[r,n]=t.geometry.coordinates;return{x:Oc(Gc(r)),y:Oc(Xc(n)),zoom:1/0,index:e,parentId:-1}}function Nc(t){return{type:"Feature",id:t.id,properties:Zc(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),Yc(t.y)]}};var e}function Zc(t){const e=t.numPoints,r=e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?Math.round(e/100)/10+"k":e;return Jc(Jc({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function Gc(t){return t/360+.5}function Xc(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 Yc(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Jc(t,e){for(const r in e)t[r]=e[r];return t}function Kc(t){return t.x}function Wc(t){return t.y}function Hc(t,e,r,n){for(var i,s=n,a=r-e>>1,o=r-e,l=t[e],u=t[e+1],c=t[r],h=t[r+1],p=e+3;p<r;p+=3){var d=Qc(t[p],t[p+1],l,u,c,h);if(d>s)i=p,s=d;else if(d===s){var f=Math.abs(p-a);f<o&&(i=p,o=f)}}s>n&&(i-e>3&&Hc(t,e,i,n),t[i+2]=s,r-i>3&&Hc(t,i,r,n))}function Qc(t,e,r,n,i,s){var a=i-r,o=s-n;if(0!==a||0!==o){var l=((t-r)*a+(e-n)*o)/(a*a+o*o);l>1?(r=i,n=s):l>0&&(r+=a*l,n+=o*l)}return(a=t-r)*a+(o=e-n)*o}function th(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)eh(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<e.length;n++)eh(t,e[n]);else if("MultiPolygon"===r)for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)eh(t,e[n][i])}(i),i}function eh(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 rh(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,s=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),o=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),"Point"===s)nh(i,o);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)nh(i[u],o);else if("LineString"===s)ih(i,o,a,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(u=0;u<i.length;u++)ih(i[u],o=[],a,!1),t.push(th(l,"LineString",o,e.properties));return}sh(i,o,a,!1)}else if("Polygon"===s)sh(i,o,a,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<e.geometry.geometries.length;u++)rh(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=[];sh(i[u],c,a,!0),o.push(c)}}t.push(th(l,s,o,e.properties))}}function nh(t,e){e.push(ah(t[0])),e.push(oh(t[1])),e.push(0)}function ih(t,e,r,n){for(var i,s,a=0,o=0;o<t.length;o++){var l=ah(t[o][0]),u=oh(t[o][1]);e.push(l),e.push(u),e.push(0),o>0&&(a+=n?(i*u-l*s)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-s,2))),i=l,s=u}var c=e.length-3;e[2]=1,Hc(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function sh(t,e,r,n){for(var i=0;i<t.length;i++){var s=[];ih(t[i],s,r,n),e.push(s)}}function ah(t){return t/360+.5}function oh(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 lh(t,e,r,n,i,s,a,o){if(n/=e,s>=(r/=e)&&a<n)return t;if(a<r||s>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,d=0===i?c.minX:c.minY,f=0===i?c.maxX:c.maxY;if(d>=r&&f<n)l.push(c);else if(!(f<r||d>=n)){var y=[];if("Point"===p||"MultiPoint"===p)uh(h,y,r,n,i);else if("LineString"===p)ch(h,y,r,n,i,!1,o.lineMetrics);else if("MultiLineString"===p)ph(h,y,r,n,i,!1);else if("Polygon"===p)ph(h,y,r,n,i,!0);else if("MultiPolygon"===p)for(var m=0;m<h.length;m++){var g=[];ph(h[m],g,r,n,i,!0),g.length&&y.push(g)}if(y.length){if(o.lineMetrics&&"LineString"===p){for(m=0;m<y.length;m++)l.push(th(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(th(c.id,p,y,c.tags))}}}return l.length?l:null}function uh(t,e,r,n,i){for(var s=0;s<t.length;s+=3){var a=t[s+i];a>=r&&a<=n&&(e.push(t[s]),e.push(t[s+1]),e.push(t[s+2]))}}function ch(t,e,r,n,i,s,a){for(var o,l,u=hh(t),c=0===i?fh:yh,h=t.start,p=0;p<t.length-3;p+=3){var d=t[p],f=t[p+1],y=t[p+2],m=t[p+3],g=t[p+4],x=0===i?d:f,v=0===i?m:g,b=!1;a&&(o=Math.sqrt(Math.pow(d-m,2)+Math.pow(f-g,2))),x<r?v>r&&(l=c(u,d,f,m,g,r),a&&(u.start=h+o*l)):x>n?v<n&&(l=c(u,d,f,m,g,n),a&&(u.start=h+o*l)):dh(u,d,f,y),v<r&&x>=r&&(l=c(u,d,f,m,g,r),b=!0),v>n&&x<=n&&(l=c(u,d,f,m,g,n),b=!0),!s&&b&&(a&&(u.end=h+o*l),e.push(u),u=hh(t)),a&&(h+=o)}var _=t.length-3;d=t[_],f=t[_+1],y=t[_+2],(x=0===i?d:f)>=r&&x<=n&&dh(u,d,f,y),_=u.length-3,s&&_>=3&&(u[_]!==u[0]||u[_+1]!==u[1])&&dh(u,u[0],u[1],u[2]),u.length&&e.push(u)}function hh(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function ph(t,e,r,n,i,s){for(var a=0;a<t.length;a++)ch(t[a],e,r,n,i,s,!1)}function dh(t,e,r,n){t.push(e),t.push(r),t.push(n)}function fh(t,e,r,n,i,s){var a=(s-e)/(n-e);return t.push(s),t.push(r+(i-r)*a),t.push(1),a}function yh(t,e,r,n,i,s){var a=(s-r)/(i-r);return t.push(e+(n-e)*a),t.push(s),t.push(1),a}function mh(t,e){for(var r=[],n=0;n<t.length;n++){var i,s=t[n],a=s.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)i=gh(s.geometry,e);else if("MultiLineString"===a||"Polygon"===a){i=[];for(var o=0;o<s.geometry.length;o++)i.push(gh(s.geometry[o],e))}else if("MultiPolygon"===a)for(i=[],o=0;o<s.geometry.length;o++){for(var l=[],u=0;u<s.geometry[o].length;u++)l.push(gh(s.geometry[o][u],e));i.push(l)}r.push(th(s.id,a,i,s.tags))}return r}function gh(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 xh(t,e){if(t.transformed)return t;var r,n,i,s=1<<t.z,a=t.x,o=t.y;for(r=0;r<t.features.length;r++){var l=t.features[r],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(vh(u[n],u[n+1],e,s,a,o));else for(n=0;n<u.length;n++){var h=[];for(i=0;i<u[n].length;i+=2)h.push(vh(u[n][i],u[n][i+1],e,s,a,o));l.geometry.push(h)}}return t.transformed=!0,t}function vh(t,e,r,n,i,s){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-s))]}function bh(t,e,r,n,i){for(var s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},o=0;o<t.length;o++){a.numFeatures++,_h(a,t[o],s,i);var l=t[o].minX,u=t[o].minY,c=t[o].maxX,h=t[o].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function _h(t,e,r,n){var i=e.geometry,s=e.type,a=[];if("Point"===s||"MultiPoint"===s)for(var o=0;o<i.length;o+=3)a.push(i[o]),a.push(i[o+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)wh(a,i,t,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(o=0;o<i.length;o++)wh(a,i[o],t,r,"Polygon"===s,0===o);else if("MultiPolygon"===s)for(var l=0;l<i.length;l++){var u=i[l];for(o=0;o<u.length;o++)wh(a,u[o],t,r,!0,0===o)}if(a.length){var c=e.tags||null;if("LineString"===s&&n.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var p={geometry:a,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function wh(t,e,r,n,i,s){var a=n*n;if(n>0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var o=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>a)&&(r.numSimplified++,o.push(e[l]),o.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,s=i-2;n<i;s=n,n+=2)r+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var a=t[n],o=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=o}}(o,s),t.push(o)}}function Sh(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++)rh(r,t.features[n],e,n);else rh(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=lh(t,1,-1-r,r,0,-1,2,e),s=lh(t,1,1-r,2+r,0,-1,2,e);return(i||s)&&(n=lh(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=mh(i,1).concat(n)),s&&(n=n.concat(mh(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 Ah(t,e,r){return 32*((1<<t)*r+e)+t}function kh(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 GeoJSONWrapper$1(n.features);let s=wc(i);0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),e(null,{vectorTile:i,rawData:s.buffer})}Sh.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Sh.prototype.splitTile=function(t,e,r,n,i,s,a){for(var o=[t,e,r,n],l=this.options,u=l.debug;o.length;){n=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();var c=1<<e,h=Ah(e,r,n),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=bh(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 d="z"+e;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(p.source=t,i){if(e===l.maxZoom||e===i)continue;var f=1<<i-e;if(r!==Math.floor(s/f)||n!==Math.floor(a/f))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,_=.5*l.buffer/l.extent,w=.5-_,S=.5+_,A=1+_;y=m=g=x=null,v=lh(t,c,r-_,r+S,0,p.minX,p.maxX,l),b=lh(t,c,r+w,r+A,0,p.minX,p.maxX,l),t=null,v&&(y=lh(v,c,n-_,n+S,1,p.minY,p.maxY,l),m=lh(v,c,n+w,n+A,1,p.minY,p.maxY,l),v=null),b&&(g=lh(b,c,n-_,n+S,1,p.minY,p.maxY,l),x=lh(b,c,n+w,n+A,1,p.minY,p.maxY,l),b=null),u>1&&console.timeEnd("clipping"),o.push(y||[],e+1,2*r,2*n),o.push(m||[],e+1,2*r,2*n+1),o.push(g||[],e+1,2*r+1,2*n),o.push(x||[],e+1,2*r+1,2*n+1)}}},Sh.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,s=n.debug;if(t<0||t>24)return null;var a=1<<t,o=Ah(t,e=(e%a+a)%a,r);if(this.tiles[o])return xh(this.tiles[o],i);s>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Ah(u,c,h)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,c,h),s>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,r),s>1&&console.timeEnd("drilling down"),this.tiles[o]?xh(this.tiles[o],i):null):null};class GeoJSONWorkerSource extends VectorTileWorkerSource{constructor(t,e,r,n,i){super(t,e,r,n,kh),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.`));{fc(s,!0);try{if(t.filter){const e=Ze(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 Supercluster(function({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;const r={},n={},i={accumulated:null,zoom:0},s={properties:null},a=Object.keys(e);for(const t of a){const[i,s]=e[t],a=Ze(s),o=Ze("string"==typeof i?[i,["accumulated"],["get",t]]:i);r[t]=a.value,n[t]=o.value}return t.map=t=>{s.properties=t;const e={};for(const t of a)e[t]=r[t].evaluate(i,s);return e},t.reduce=(t,e)=>{s.properties=e;for(const e of a)i.accumulated=t[e],t[e]=n[e].evaluate(i,s)},t}(t)).load(s.features):function(t,e){return new Sh(t,e)}(s,t.geojsonVtOptions)}catch(i){return e(i)}this.loaded={};const a={};if(n){const e=Cr(r);e&&(a.resourceTiming={},a.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}e(null,a)}}))}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){xr(p(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)}}}class Worker{constructor(t){this.self=t,this.actor=new Actor(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=Mu({name:"mercator"}),this.workerSourceTypes={vector:VectorTileWorkerSource,geojson:GeoJSONWorkerSource},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(ci.isParsed())throw new Error("RTL text plugin already registered.");ci.applyArabicShaping=t.applyArabicShaping,ci.processBidirectionalText=t.processBidirectionalText,ci.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 VectorTileWorkerSource&&(n[t].isSpriteLoaded=e,n[t].fire(new Event("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]=Mu(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?p({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?p({buildQuadTree:this.terrain},e):e;this.getDEMWorkerSource(t,e.source).loadTile(n,r)}reloadTile(t,e,r){const n=this.enableTerrain?p({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{ci.setState(e);const t=ci.getPluginURL();if(ci.isLoaded()&&!ci.isParsed()&&null!=t){this.self.importScripts(t);const e=ci.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 StyleLayerIndex),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,a)=>{this.actor.send(e,r,n,t,s,a)},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 RasterDEMTileWorkerSource),this.demWorkerSources[t][e]}enforceCacheSizeLimit(t,e){!function(t){for(const e in pr)fr(e),pr[e].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 Worker(self)),Worker}();
|
|
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,a;for(void 0===e&&(e=1e-6),i=t,a=0;a<8;a++){if(s=this.sampleCurveX(i)-t,Math.abs(s)<e)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=s/o}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="undefined"!=typeof self?self:{};const s=Math.PI/180,a=180/Math.PI;function o(t){return t*s}function l(t){return t*a}function u(t,e,r){return Math.min(r,Math.max(e,t))}function c(t,e,r){const n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function h(t){const e=[];for(const r in t)e.push(t[r]);return e}function p(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}new t(.25,.1,.25,1);let d=1;function f(){return function t(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function y(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 m(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}function g(t,e){return-1!==t.indexOf(e,t.length-e.length)}function x(t,e,r){const n={};for(const i in t)n[i]=e.call(r||this,t[i],i,t);return n}function v(t){return Array.isArray(t)?t.map(v):"object"==typeof t&&t?x(t,v):t}const b={};function _(t){b[t]||("undefined"!=typeof console&&console.warn(t),b[t]=!0)}function w(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function S(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i<s;a=i++)r=t[i],n=t[a],e+=(n.x-r.x)*(r.y+n.y);return e}function A(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function k(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 I=null;function M(t){if(null==I){const e=t.navigator?t.navigator.userAgent:null;I=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return I}function P(t){try{const e=i[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}function C(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}var T=z;function z(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 a=i[3+s],o=i[3+s+1];n.push(a===o?null:i.subarray(a,o))}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 E(t){var e={exports:{}};return t(e,e.exports),e.exports}z.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)},z.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},z.prototype._insertCell=function(t,e,r,n,i,s){this.cells[i].push(s)},z.prototype.query=function(t,e,r,n,i){var s=this.min,a=this.max;if(t<=s&&e<=s&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);var o=[];return this._forEachCell(t,e,r,n,this._queryCell,o,{},i),o},z.prototype._queryCell=function(t,e,r,n,i,s,a,o){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===a[p]){var d=4*p;(o?o(c[d+0],c[d+1],c[d+2],c[d+3]):t<=c[d+2]&&e<=c[d+3]&&r>=c[d+0]&&n>=c[d+1])?(a[p]=!0,s.push(u[p])):a[p]=!1}}},z.prototype._forEachCell=function(t,e,r,n,i,s,a,o){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 d=u;d<=h;d++){var f=this.d*d+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&i.call(this,t,e,r,n,f,s,a,o))return}},z.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},z.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},z.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,a=0;a<t.length;a++){var o=t[a];i[3+a]=s,i.set(o,s),s+=o.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 D=E((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 a(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,o=t.replace(/ /g,"").toLowerCase();if(o in r)return r[o].slice();if("#"===o[0])return 4===o.length?(e=parseInt(o.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===o.length&&(e=parseInt(o.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=o.indexOf("("),u=o.indexOf(")");if(-1!==l&&u+1===o.length){var c=o.substr(0,l),h=o.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 d=(parseFloat(h[0])%360+360)%360/360,f=s(h[1]),y=s(h[2]),m=y<=.5?y*(f+1):y+f-y*f,g=2*y-m;return[n(255*a(g,m,d+1/3)),n(255*a(g,m,d)),n(255*a(g,m,d-1/3)),p];default:return null}}return null}}catch(t){}}));class Color{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 Color)return t;if("string"!=typeof t)return;const e=D.parseCSSColor(t);return e?new Color(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]}toArray01(){const{r:t,g:e,b:r,a:n}=this;return 0===n?[0,0,0,0]:[t/n,e/n,r/n,n]}toArray01PremultipliedAlpha(){const{r:t,g:e,b:r,a:n}=this;return[t,e,r,n]}}Color.black=new Color(0,0,0,1),Color.white=new Color(1,1,1,1),Color.transparent=new Color(0,0,0,0),Color.red=new Color(1,0,0,1),Color.blue=new Color(0,0,1,1);var B=Color;function L(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}class ParsingError extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}var V=ParsingError;class Scope{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new Scope(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)}}var F=Scope;const R={kind:"null"},j={kind:"number"},O={kind:"string"},U={kind:"boolean"},$={kind:"color"},q={kind:"object"},N={kind:"value"},Z={kind:"collator"},G={kind:"formatted"},X={kind:"resolvedImage"};function Y(t,e){return{kind:"array",itemType:t,N:e}}function J(t){if("array"===t.kind){const e=J(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const K=[R,j,O,U,$,G,q,Y(N),X];function W(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!W(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 K)if(!W(t,e))return null}return`Expected ${J(t)} but found ${J(e)} instead.`}function H(t,e){return e.some((e=>e.kind===t.kind))}function Q(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 Collator{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 FormattedSection{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 Formatted{constructor(t){this.sections=t}static fromString(t){return new Formatted([new FormattedSection(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 Formatted?t:Formatted.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 ResolvedImage{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new ResolvedImage({name:t,available:!1}):null}serialize(){return["image",this.name]}}function tt(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 et(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 B)return!0;if(t instanceof Collator)return!0;if(t instanceof Formatted)return!0;if(t instanceof ResolvedImage)return!0;if(Array.isArray(t)){for(const e of t)if(!et(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!et(t[e]))return!1;return!0}return!1}function rt(t){if(null===t)return R;if("string"==typeof t)return O;if("boolean"==typeof t)return U;if("number"==typeof t)return j;if(t instanceof B)return $;if(t instanceof Collator)return Z;if(t instanceof Formatted)return G;if(t instanceof ResolvedImage)return X;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=rt(e);if(r){if(r===t)continue;r=N;break}r=t}return Y(r||N,e)}return q}function nt(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof B||t instanceof Formatted||t instanceof ResolvedImage?t.toString():JSON.stringify(t)}class Literal{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(!et(t[1]))return e.error("invalid value");const r=t[1];let n=rt(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 Literal(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 B?["rgba"].concat(this.value.toArray()):this.value instanceof Formatted?this.value.serialize():this.value}}var it=Literal,st=class RuntimeError{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const at={string:O,number:j,boolean:U,object:q};class Assertion{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in at)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=at[r],n++}else i=N;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=Y(i,s)}else r=at[i];const s=[];for(;n<t.length;n++){const r=e.parse(t[n],n,N);if(!r)return null;s.push(r)}return new Assertion(r,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!W(this.type,rt(r)))return r;if(e===this.args.length-1)throw new st(`Expected value to be of type ${J(this.type)}, but found ${J(rt(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())))}}var ot=Assertion;class FormatExpression{constructor(t){this.type=G,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,j),!t))return null;let r=null;if(s["text-font"]&&(r=e.parse(s["text-font"],1,Y(O)),!r))return null;let a=null;if(s["text-color"]&&(a=e.parse(s["text-color"],1,$),!a))return null;const o=n[n.length-1];o.scale=t,o.font=r,o.textColor=a}else{const s=e.parse(t[r],1,N);if(!s)return null;const a=s.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new FormatExpression(n)}evaluate(t){return new Formatted(this.sections.map((e=>{const r=e.content.evaluate(t);return rt(r)===X?new FormattedSection("",r,null,null,null):new FormattedSection(nt(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 ImageExpression{constructor(t){this.type=X,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,O);return r?new ImageExpression(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=ResolvedImage.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 lt={"to-boolean":U,"to-color":$,"to-number":j,"to-string":O};class Coercion{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=lt[r],i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],r,N);if(!n)return null;i.push(n)}return new Coercion(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 B)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.`:tt(e[0],e[1],e[2],e[3]),!r))return new B(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new st(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 st(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?Formatted.fromString(nt(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?ResolvedImage.fromString(nt(this.args[0].evaluate(t))):nt(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 FormatExpression([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ImageExpression(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}var ut=Coercion;const ct=["Unknown","Point","LineString","Polygon"];var ht=class EvaluationContext{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&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?ct[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}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]=B.parse(t)),e}};class CompoundExpression{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=CompoundExpression.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let o=null;for(const[n,s]of a){o=new Lt(e.registry,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const r=t[e],i=Array.isArray(n)?n[e-1]:n.type,s=o.parse(r,1+a.length,i);if(!s){l=!0;break}a.push(s)}if(!l)if(Array.isArray(n)&&n.length!==a.length)o.error(`Expected ${n.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=a[t];o.concat(t+1).checkSubtype(e,r.type)}if(0===o.errors.length)return new CompoundExpression(r,i,s,a)}}if(1===a.length)e.errors.push(...o.errors);else{const r=(a.length?a:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(J).join(", ")})`:`(${J(e.type)}...)`;var e})).join(" | "),n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],1+n.length);if(!i)return null;n.push(J(i.type))}e.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){CompoundExpression.definitions=e;for(const r in e)t[r]=CompoundExpression}}var pt=CompoundExpression;class CollatorExpression{constructor(t,e,r){this.type=Z,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,U);if(!n)return null;const i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,U);if(!i)return null;let s=null;return r.locale&&(s=e.parse(r.locale,1,O),!s)?null:new CollatorExpression(n,i,s)}evaluate(t){return new Collator(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 dt=8192;function ft(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function yt(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function mt(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*dt),Math.round(n*i*dt)]}function gt(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],a=t[1]-r[1];return n*a-s*i==0&&n*s<=0&&i*a<=0}function xt(t,e){let r=!1;for(let a=0,o=e.length;a<o;a++){const o=e[a];for(let e=0,a=o.length;e<a-1;e++){if(gt(t,o[e],o[e+1]))return!1;(i=o[e])[1]>(n=t)[1]!=(s=o[e+1])[1]>n[1]&&n[0]<(s[0]-i[0])*(n[1]-i[1])/(s[1]-i[1])+i[0]&&(r=!r)}}var n,i,s;return r}function vt(t,e){for(let r=0;r<e.length;r++)if(xt(t,e[r]))return!0;return!1}function bt(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],a=(t[0]-r[0])*s-i*(t[1]-r[1]),o=(e[0]-r[0])*s-i*(e[1]-r[1]);return a>0&&o<0||a<0&&o>0}function _t(t,e,r){for(const u of r)for(let r=0;r<u.length-1;++r)if(0!=(o=[(a=u[r+1])[0]-(s=u[r])[0],a[1]-s[1]])[0]*(l=[(i=e)[0]-(n=t)[0],i[1]-n[1]])[1]-o[1]*l[0]&&bt(n,i,s,a)&&bt(s,a,n,i))return!0;var n,i,s,a,o,l;return!1}function wt(t,e){for(let r=0;r<t.length;++r)if(!xt(t[r],e))return!1;for(let r=0;r<t.length-1;++r)if(_t(t[r],t[r+1],e))return!1;return!0}function St(t,e){for(let r=0;r<e.length;r++)if(wt(t,e[r]))return!0;return!1}function kt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=[];for(let n=0;n<t[i].length;n++){const a=mt(t[i][n],r);ft(e,a),s.push(a)}n.push(s)}return n}function It(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=kt(t[i],e,r);n.push(s)}return n}function Mt(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i}ft(e,t)}function Pt(t,e,r,n){const i=Math.pow(2,n.z)*dt,s=[n.x*dt,n.y*dt],a=[];if(!t)return a;for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];Mt(n,e,r,i),a.push(n)}return a}function Ct(t,e,r,n){const i=Math.pow(2,n.z)*dt,s=[n.x*dt,n.y*dt],a=[];if(!t)return a;for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];ft(e,r),t.push(r)}a.push(t)}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of a)for(const n of t)Mt(n,e,r,i)}var o;return a}class Within{constructor(t,e){this.type=U,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(et(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 Within(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Within(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Within(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(!i)return!1;if("Polygon"===e.type){const s=kt(e.coordinates,n,i),a=Pt(t.geometry(),r,n,i);if(!yt(r,n))return!1;for(const t of a)if(!xt(t,s))return!1}if("MultiPolygon"===e.type){const s=It(e.coordinates,n,i),a=Pt(t.geometry(),r,n,i);if(!yt(r,n))return!1;for(const t of a)if(!vt(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(!i)return!1;if("Polygon"===e.type){const s=kt(e.coordinates,n,i),a=Ct(t.geometry(),r,n,i);if(!yt(r,n))return!1;for(const t of a)if(!wt(t,s))return!1}if("MultiPolygon"===e.type){const s=It(e.coordinates,n,i),a=Ct(t.geometry(),r,n,i);if(!yt(r,n))return!1;for(const t of a)if(!St(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var Tt=Within;function zt(t){if(t instanceof pt){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 Tt)return!1;let e=!0;return t.eachChild((t=>{e&&!zt(t)&&(e=!1)})),e}function Et(t){if(t instanceof pt&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Et(t)&&(e=!1)})),e}function Dt(t,e){if(t instanceof pt&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!Dt(t,e)&&(r=!1)})),r}class Var{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 Var(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]}}var Bt=Var;class ParsingContext{constructor(t,e=[],r,n=new F,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 ot(e,[t]):"coerce"===r?new ut(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 it)&&"resolvedImage"!==n.type.kind&&Vt(n)){const t=new ht;try{n=new it(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 ParsingContext(this.registry,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new V(r,t))}checkSubtype(t,e){const r=W(t,e);return r&&this.error(r),r}}var Lt=ParsingContext;function Vt(t){if(t instanceof Bt)return Vt(t.boundExpression);if(t instanceof pt&&"error"===t.name)return!1;if(t instanceof CollatorExpression)return!1;if(t instanceof Tt)return!1;const e=t instanceof ut||t instanceof ot;let r=!0;return t.eachChild((t=>{r=e?r&&Vt(t):r&&t instanceof it})),!!r&&zt(t)&&Dt(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function Ft(t,e){const r=t.length-1;let n,i,s=0,a=r,o=0;for(;s<=a;)if(o=Math.floor((s+a)/2),n=t[o],i=t[o+1],n<=e){if(o===r||e<i)return o;s=o+1}else{if(!(n>e))throw new st("Input is not a number.");a=o-1}return 0}class Step{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,j);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r<t.length;r+=2){const s=1===r?-1/0:t[r],a=t[r+1],o=r,l=r+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,n.push([s,u])}return new Step(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[Ft(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}}var Rt=Step;function jt(t,e,r){return t*(1-r)+e*r}function Ot(t,e,r){return t.map(((t,n)=>jt(t,e[n],r)))}var Ut=Object.freeze({__proto__:null,number:jt,color:function(t,e,r){return new B(jt(t.r,e.r,r),jt(t.g,e.g,r),jt(t.b,e.b,r),jt(t.a,e.a,r))},array:Ot});const $t=.95047,qt=1.08883,Nt=4/29,Zt=6/29,Gt=3*Zt*Zt,Xt=Math.PI/180,Yt=180/Math.PI;function Jt(t){return t>.008856451679035631?Math.pow(t,1/3):t/Gt+Nt}function Kt(t){return t>Zt?t*t*t:Gt*(t-Nt)}function Wt(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Ht(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Qt(t){const e=Ht(t.r),r=Ht(t.g),n=Ht(t.b),i=Jt((.4124564*e+.3575761*r+.1804375*n)/$t),s=Jt((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-Jt((.0193339*e+.119192*r+.9503041*n)/qt)),alpha:t.a}}function te(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*Kt(e),r=$t*Kt(r),n=qt*Kt(n),new B(Wt(3.2404542*r-1.5371385*e-.4985314*n),Wt(-.969266*r+1.8760108*e+.041556*n),Wt(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function ee(t,e,r){const n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const re={forward:Qt,reverse:te,interpolate:function(t,e,r){return{l:jt(t.l,e.l,r),a:jt(t.a,e.a,r),b:jt(t.b,e.b,r),alpha:jt(t.alpha,e.alpha,r)}}},ne={forward:function(t){const{l:e,a:r,b:n}=Qt(t),i=Math.atan2(n,r)*Yt;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*Xt,r=t.c;return te({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:ee(t.h,e.h,r),c:jt(t.c,e.c,r),l:jt(t.l,e.l,r),alpha:jt(t.alpha,e.alpha,r)}}};var ie=Object.freeze({__proto__:null,lab:re,hcl:ne});class Interpolate{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=se(r,e.base,n,i);else if("linear"===e.name)s=se(r,1,n,i);else if("cubic-bezier"===e.name){const a=e.controlPoints;s=new t(a[0],a[1],a[2],a[3]).solve(se(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,j),!i)return null;const a=[];let o=null;"interpolate-hcl"===r||"interpolate-lab"===r?o=$:e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t<s.length;t+=2){const r=s[t],n=s[t+1],i=t+3,l=t+4;if("number"!=typeof r)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,a.push([r,u])}return"number"===o.kind||"color"===o.kind||"array"===o.kind&&"number"===o.itemType.kind&&"number"==typeof o.N?new Interpolate(o,r,n,i,a):e.error(`Type ${J(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=Ft(e,n),a=Interpolate.interpolationFactor(this.interpolation,n,e[s],e[s+1]),o=r[s].evaluate(t),l=r[s+1].evaluate(t);return"interpolate"===this.operator?Ut[this.type.kind.toLowerCase()](o,l,a):"interpolate-hcl"===this.operator?ne.reverse(ne.interpolate(ne.forward(o),ne.forward(l),a)):re.reverse(re.interpolate(re.forward(o),re.forward(l),a))}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 se(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)}var ae=Interpolate;class Coalesce{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=>W(n,t.type)));return new Coalesce(s?N:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args){if(n++,r=i.evaluate(t),r&&r instanceof ResolvedImage&&!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}}var oe=Coalesce;class Let{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 Let(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}}var le=Let;class At{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,j),n=e.parse(t[2],2,Y(e.expectedType||N));return r&&n?new At(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new st(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new st(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new st(`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()]}}var ue=At;class In{constructor(t,e){this.type=U,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,N),n=e.parse(t[2],2,N);return r&&n?H(r.type,[U,O,j,R,N])?new In(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${J(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(null==r)return!1;if(!Q(e,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${J(rt(e))} instead.`);if(!Q(r,["string","array"]))throw new st(`Expected second argument to be of type array or string, but found ${J(rt(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()]}}var ce=In;class IndexOf{constructor(t,e,r){this.type=j,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,N),n=e.parse(t[2],2,N);if(!r||!n)return null;if(!H(r.type,[U,O,j,R,N]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${J(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,j);return i?new IndexOf(r,n,i):null}return new IndexOf(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Q(e,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${J(rt(e))} instead.`);if(!Q(r,["string","array"]))throw new st(`Expected second argument to be of type array or string, but found ${J(rt(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()]}}var he=IndexOf;class Match{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let a=2;a<t.length-1;a+=2){let o=t[a];const l=t[a+1];Array.isArray(o)||(o=[o]);const u=e.concat(a);if(0===o.length)return u.error("Expected at least one branch label.");for(const t of o){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,rt(t)))return null}else r=rt(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,s.push(c)}const a=e.parse(t[1],1,N);if(!a)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new Match(r,n,a,i,s,o):null}evaluate(t){const e=this.input.evaluate(t);return(rt(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}}var pe=Match;class Case{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,U);if(!s)return null;const a=e.parse(t[i+1],i+1,r);if(!a)return null;n.push([s,a]),r=r||a.type}const i=e.parse(t[t.length-1],t.length-1,r);return i?new Case(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}}var de=Case;class Slice{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,N),n=e.parse(t[2],2,j);if(!r||!n)return null;if(!H(r.type,[Y(N),O,N]))return e.error(`Expected first argument to be of type array or string, but found ${J(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,j);return i?new Slice(r.type,r,n,i):null}return new Slice(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Q(e,["string","array"]))throw new st(`Expected first argument to be of type array or string, but found ${J(rt(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()]}}var fe=Slice;function ye(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 me(t,e,r,n){return 0===n.compare(e,r)}function ge(t,e,r){const n="=="!==t&&"!="!==t;return class Comparison{constructor(t,e,r){this.type=U,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 i=e.parse(t[1],1,N);if(!i)return null;if(!ye(r,i.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${J(i.type)}'.`);let s=e.parse(t[2],2,N);if(!s)return null;if(!ye(r,s.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${J(s.type)}'.`);if(i.type.kind!==s.type.kind&&"value"!==i.type.kind&&"value"!==s.type.kind)return e.error(`Cannot compare types '${J(i.type)}' and '${J(s.type)}'.`);n&&("value"===i.type.kind&&"value"!==s.type.kind?i=new ot(s.type,[i]):"value"!==i.type.kind&&"value"===s.type.kind&&(s=new ot(i.type,[s])));let a=null;if(4===t.length){if("string"!==i.type.kind&&"string"!==s.type.kind&&"value"!==i.type.kind&&"value"!==s.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,Z),!a)return null}return new Comparison(i,s,a)}evaluate(i){const s=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=rt(s),r=rt(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new st(`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=rt(s),r=rt(a);if("string"!==t.kind||"string"!==r.kind)return e(i,s,a)}return this.collator?r(i,s,a,this.collator.evaluate(i)):e(i,s,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const xe=ge("==",(function(t,e,r){return e===r}),me),ve=ge("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!me(0,e,r,n)})),be=ge("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),_e=ge(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),we=ge("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Se=ge(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class NumberFormat{constructor(t,e,r,n,i,s){this.type=O,this.number=t,this.locale=e,this.currency=r,this.unit=n,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,j);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,O),!i))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,O),!s))return null;let a=null;if(n.unit&&(a=e.parse(n.unit,1,O),!a))return null;let o=null;if(n["min-fraction-digits"]&&(o=e.parse(n["min-fraction-digits"],1,j),!o))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,j),!l)?null:new NumberFormat(r,i,s,a,o,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.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 Length{constructor(t){this.type=j,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${J(r.type)} instead.`):new Length(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 st(`Expected value to be of type string or array, but found ${J(rt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const Ae={"==":xe,"!=":ve,">":_e,"<":be,">=":Se,"<=":we,array:ot,at:ue,boolean:ot,case:de,coalesce:oe,collator:CollatorExpression,format:FormatExpression,image:ImageExpression,in:ce,"index-of":he,interpolate:ae,"interpolate-hcl":ae,"interpolate-lab":ae,length:Length,let:le,literal:it,match:pe,number:ot,"number-format":NumberFormat,object:ot,slice:fe,step:Rt,string:ot,"to-boolean":ut,"to-color":ut,"to-number":ut,"to-string":ut,var:Bt,within:Tt};function ke(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=tt(e,r,n,s);if(a)throw new st(a);return new B(e/255*s,r/255*s,n/255*s,s)}function Ie(t,e){return t in e}function Me(t,e){const r=e[t];return void 0===r?null:r}function Pe(t){return{type:t}}pt.register(Ae,{error:[{kind:"error"},[O],(t,[e])=>{throw new st(e.evaluate(t))}],typeof:[O,[N],(t,[e])=>J(rt(e.evaluate(t)))],"to-rgba":[Y(j,4),[$],(t,[e])=>e.evaluate(t).toArray()],rgb:[$,[j,j,j],ke],rgba:[$,[j,j,j,j],ke],has:{type:U,overloads:[[[O],(t,[e])=>Ie(e.evaluate(t),t.properties())],[[O,q],(t,[e,r])=>Ie(e.evaluate(t),r.evaluate(t))]]},get:{type:N,overloads:[[[O],(t,[e])=>Me(e.evaluate(t),t.properties())],[[O,q],(t,[e,r])=>Me(e.evaluate(t),r.evaluate(t))]]},"feature-state":[N,[O],(t,[e])=>Me(e.evaluate(t),t.featureState||{})],properties:[q,[],t=>t.properties()],"geometry-type":[O,[],t=>t.geometryType()],id:[N,[],t=>t.id()],zoom:[j,[],t=>t.globals.zoom],pitch:[j,[],t=>t.globals.pitch||0],"distance-from-center":[j,[],t=>t.distanceFromCenter()],"heatmap-density":[j,[],t=>t.globals.heatmapDensity||0],"line-progress":[j,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[j,[],t=>t.globals.skyRadialProgress||0],accumulated:[N,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[j,Pe(j),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[j,Pe(j),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:j,overloads:[[[j,j],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[j],(t,[e])=>-e.evaluate(t)]]},"/":[j,[j,j],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[j,[j,j],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[j,[],()=>Math.LN2],pi:[j,[],()=>Math.PI],e:[j,[],()=>Math.E],"^":[j,[j,j],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[j,[j],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[j,[j],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[j,[j],(t,[e])=>Math.log(e.evaluate(t))],log2:[j,[j],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[j,[j],(t,[e])=>Math.sin(e.evaluate(t))],cos:[j,[j],(t,[e])=>Math.cos(e.evaluate(t))],tan:[j,[j],(t,[e])=>Math.tan(e.evaluate(t))],asin:[j,[j],(t,[e])=>Math.asin(e.evaluate(t))],acos:[j,[j],(t,[e])=>Math.acos(e.evaluate(t))],atan:[j,[j],(t,[e])=>Math.atan(e.evaluate(t))],min:[j,Pe(j),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[j,Pe(j),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[j,[j],(t,[e])=>Math.abs(e.evaluate(t))],round:[j,[j],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[j,[j],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[j,[j],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[U,[O,N],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[U,[N],(t,[e])=>t.id()===e.value],"filter-type-==":[U,[O],(t,[e])=>t.geometryType()===e.value],"filter-<":[U,[O,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[U,[O,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[O,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[O,N],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[N],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[N],(t,[e])=>e.value in t.properties()],"filter-has-id":[U,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[U,[Y(O)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Y(N)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[O,Y(N)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[O,Y(N)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Pe(U),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Pe(U),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[U,[U],(t,[e])=>!e.evaluate(t)],"is-supported-script":[U,[O],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[O,[O],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[O,[O],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[O,Pe(N),(t,e)=>e.map((e=>nt(e.evaluate(t)))).join("")],"resolved-locale":[O,[Z],(t,[e])=>e.evaluate(t).resolvedLocale()]});var Ce=Ae;function Te(t){return{result:"success",value:t}}function ze(t){return{result:"error",value:t}}function Ee(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function De(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Be(t){return!!t.expression&&t.expression.interpolated}function Le(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Ve(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Fe(t){return t}function Re(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(Be(e)?"exponential":"interval");if(r&&((t=L({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],B.parse(t[1])]))),t.default=B.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!ie[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let a,o,l;if("exponential"===s)a=$e;else if("interval"===s)a=Ue;else if("categorical"===s){a=Oe,o=Object.create(null);for(const e of t.stops)o[e[0]]=e[1];l=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);a=qe}if(n){const r={},n=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],s=i[0].zoom;void 0===r[s]&&(r[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},n.push(s)),r[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of n)i.push([r[t].zoom,Re(r[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:ae.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>$e({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:ae.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>a(t,e,r,o,l)}}return{kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?je(t.default,e.default):a(t,e,i,o,l)}}}function je(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Oe(t,e,r,n,i){return je(typeof r===i?n[r]:void 0,t.default,e.default)}function Ue(t,e,r){if("number"!==Le(r))return je(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=Ft(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function $e(t,e,r){const n=void 0!==t.base?t.base:1;if("number"!==Le(r))return je(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=Ft(t.stops.map((t=>t[0])),r),a=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),o=t.stops[s][1],l=t.stops[s+1][1];let u=Ut[e.type]||Fe;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=ie[t.colorSpace];u=(t,r)=>e.reverse(e.interpolate(e.forward(t),e.forward(r),a))}return"function"==typeof o.evaluate?{evaluate(...t){const e=o.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==r)return u(e,r,a)}}:u(o,l,a)}function qe(t,e,r){return"color"===e.type?r=B.parse(r):"formatted"===e.type?r=Formatted.fromString(r.toString()):"resolvedImage"===e.type?r=ResolvedImage.fromString(r.toString()):Le(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),je(r,t.default,e.default)}class StyleExpression{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new ht,this._defaultValue=e?function(t){return"color"===t.type&&(Ve(t.default)||Array.isArray(t.default))?new B(0,0,0,0):"color"===t.type?B.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,a,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=o||null,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s,a,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=o||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 st(`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 Ne(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Ce}function Ze(t,e){const r=new Lt(Ce,[],e?function(t){const e={color:$,string:O,number:j,enum:O,boolean:U,formatted:G,resolvedImage:X};return"array"===t.type?Y(e[t.value]||N,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Te(new StyleExpression(n,e)):ze(r.errors)}class ZoomConstantExpression{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Et(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 ZoomDependentExpression{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Et(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?ae.interpolationFactor(this.interpolationType,t,e,r):0}}function Ge(t,e){if("error"===(t=Ze(t,e)).result)return t;const r=t.value.expression,n=zt(r);if(!n&&!Ee(e))return ze([new V("","data expressions not supported")]);const i=Dt(r,["zoom","pitch","distance-from-center"]);if(!i&&!De(e))return ze([new V("","zoom expressions not supported")]);const s=Xe(r);return s||i?s instanceof V?ze([s]):s instanceof ae&&!Be(e)?ze([new V("",'"interpolate" expressions cannot be used with this property')]):Te(s?new ZoomDependentExpression(n?"camera":"composite",t.value,s.labels,s instanceof ae?s.interpolation:void 0):new ZoomConstantExpression(n?"constant":"source",t.value)):ze([new V("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class StylePropertyFunction{constructor(t,e){this._parameters=t,this._specification=e,L(this,Re(this._parameters,this._specification))}static deserialize(t){return new StylePropertyFunction(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Xe(t){let e=null;if(t instanceof le)e=Xe(t.result);else if(t instanceof oe){for(const r of t.args)if(e=Xe(r),e)break}else(t instanceof Rt||t instanceof ae)&&t.input instanceof pt&&"zoom"===t.input.name&&(e=t);return e instanceof V||t.eachChild((t=>{const r=Xe(t);r instanceof V?e=r:!e&&r?e=new V("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new V("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}let Ye;const Je={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==Ye){const t=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{Ye=null!=process.env.API_URL_REGEX?new RegExp(process.env.API_URL_REGEX):t}catch(e){Ye=t}}return Ye},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},Ke={supported:!1,testSupport:function(t){!Qe&&He&&(tr?er(t):We=t)}};let We,He,Qe=!1,tr=!1;function er(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,He),t.isContextLost())return;Ke.supported=!0}catch(t){}t.deleteTexture(e),Qe=!0}i.document&&(He=i.document.createElement("img"),He.onload=function(){We&&er(We),We=null,tr=!0},He.onerror=function(){Qe=!0,We=null},He.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const rr="NO_ACCESS_TOKEN";function nr(t){return Je.API_URL_REGEX.test(t)}const ir=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function sr(t){const e=t.match(ir);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 ar(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}function or(t){if(!t)return null;const e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(i.atob(e[1]).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(t){return null}}class TelemetryEvent{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const e=or(Je.ACCESS_TOKEN);let r="";return r=e&&e.u?i.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=P("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{const t=i.localStorage.getItem(e);t&&(this.eventData=JSON.parse(t));const n=i.localStorage.getItem(r);n&&(this.anonId=n)}catch(t){_("Unable to read from LocalStorage")}}saveEventData(){const t=P("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{i.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&i.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){_("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,e,r,n){if(!Je.EVENTS_URL)return;const i=sr(Je.EVENTS_URL);i.params.push(`access_token=${n||Je.ACCESS_TOKEN||""}`);const s={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"2.10.0",skuId:"01",userId:this.anonId},a=e?p(s,e):s,o={url:ar(i),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=br(o,(t=>{this.pendingRequest=null,r(t),this.saveEventData(),this.processRequests(n)}))}queueRequest(t,e){this.queue.push(t),this.processRequests(e)}}const lr=new class TurnstileEvent extends TelemetryEvent{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){Je.EVENTS_URL&&Je.ACCESS_TOKEN&&Array.isArray(t)&&t.some((t=>function(t){return 0===t.indexOf("mapbox:")}(t)||nr(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=or(Je.ACCESS_TOKEN),r=e?e.u:Je.ACCESS_TOKEN;let n=r!==this.eventData.tokenU;y(this.anonId)||(this.anonId=f(),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;n?this.postEvent(i,{"enabled.telemetry":!1},(t=>{t||(this.eventData.lastSuccess=i,this.eventData.tokenU=r)}),t):this.processRequests()}};lr.postTurnstileEvent.bind(lr);const ur=new class MapLoadEvent extends TelemetryEvent{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,r,n){this.skuToken=e,this.errorCb=n,Je.EVENTS_URL&&(r||Je.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(rr)))}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(),y(this.anonId)||(this.anonId=f()),this.postEvent(r,{skuToken:this.skuToken},(t=>{t?this.errorCb(t):e&&(this.success[e]=!0)}),t))}};ur.postMapLoadEvent.bind(ur);const cr=new class MapSessionAPI extends TelemetryEvent{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,e,r,n){const i=sr(Je.API_URL+Je.SESSION_PATH);i.params.push(`sku=${e||""}`),i.params.push(`access_token=${n||Je.ACCESS_TOKEN||""}`);const s={url:ar(i),headers:{"Content-Type":"text/plain"}};this.pendingRequest=_r(s,(t=>{this.pendingRequest=null,r(t),this.saveEventData(),this.processRequests(n)}))}getSessionAPI(t,e,r,n){this.skuToken=e,this.errorCb=n,r||Je.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(rr))}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)}};cr.getSessionAPI.bind(cr);let hr,pr={};function dr(t){const e=yr(t);let r,n;e&&e.forEach((t=>{const e=t.split("=");"language"===e[0]?r=e[1]:"worldview"===e[0]&&(n=e[1])}));let i="mapbox-tiles";return r&&(i+=`-${r}`),n&&(i+=`-${n}`),i}function fr(t){const e=function(){try{return i.caches}catch(t){}}();e&&!pr[t]&&(pr[t]=e.open(t))}function yr(t){const e=t.indexOf("?");return e>0?t.slice(e+1).split("&"):[]}function mr(t){const e=t.indexOf("?");if(e<0)return t;const r=yr(t).filter((t=>{const e=t.split("=");return"language"===e[0]||"worldview"===e[0]}));return r.length?`${t.slice(0,e)}?${r.join("&")}`:t.slice(0,e)}"function"==typeof Object.freeze&&Object.freeze({Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"});class AJAXError extends Error{constructor(t,e,r){401===e&&nr(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 gr=A()?()=>self.worker&&self.worker.referrer:()=>("blob:"===i.location.protocol?i.parent:i).location.href;const xr=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(gr())&&!/^\w+:/.test(r))){if(i.fetch&&i.Request&&i.AbortController&&i.Request.prototype.hasOwnProperty("signal"))return function(t,e){const r=new i.AbortController,n=new i.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:gr(),signal:r.signal});let s=!1,a=!1;const o=(l=n.url).indexOf("sku=")>0&&nr(l);var l;"json"===t.type&&n.headers.set("Accept","application/json");const u=(r,s,l)=>{if(a)return;if(r&&"SecurityError"!==r.message&&_(r),s&&l)return c(s);const u=Date.now();i.fetch(n).then((r=>{if(r.ok){const t=o?r.clone():null;return c(r,t,u)}return e(new AJAXError(r.statusText,r.status,t.url))})).catch((t=>{20!==t.code&&e(new Error(t.message))}))},c=(r,o,l)=>{("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{a||(o&&l&&function(t,e,r){const n=dr(t.url);if(fr(n),!pr[n])return;const s={status:e.status,statusText:e.statusText,headers:new i.Headers};e.headers.forEach(((t,e)=>s.headers.set(e,t)));const a=k(e.headers.get("Cache-Control")||"");if(a["no-store"])return;a["max-age"]&&s.headers.set("Expires",new Date(r+1e3*a["max-age"]).toUTCString());const o=s.headers.get("Expires");o&&(new Date(o).getTime()-r<42e4||function(t,e){if(void 0===hr)try{new Response(new ReadableStream),hr=!0}catch(t){hr=!1}hr?e(t.body):t.blob().then(e)}(e,(e=>{const r=new i.Response(e,s);fr(n),pr[n]&&pr[n].then((e=>e.put(mr(t.url),r))).catch((t=>_(t.message)))})))}(n,o,l),s=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((t=>{a||e(new Error(t.message))}))};return o?function(t,e){const r=dr(t.url);if(fr(r),!pr[r])return e(null);const n=mr(t.url);pr[r].then((t=>{t.match(n).then((r=>{const i=function(t){if(!t)return!1;const e=new Date(t.headers.get("Expires")||0),r=k(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(r);t.delete(n),i&&t.put(n,r.clone()),e(null,r,i)})).catch(e)})).catch(e)}(n,u):u(null,null),{cancel:()=>{a=!0,s||r.abort()}}}(t,e);if(A()&&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 i.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 AJAXError(r.statusText,r.status,t.url))},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},vr=function(t,e){return xr(p(t,{type:"arrayBuffer"}),e)},br=function(t,e){return xr(p(t,{method:"POST"}),e)},_r=function(t,e){return xr(p(t,{method:"GET"}),e)},wr={};function Sr(t,e,r={}){Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),wr[e]={klass:t,omit:r.omit||[]}}Sr(Object,"Object"),T.serialize=function(t,e){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}},T.deserialize=function(t){return new T(t.buffer)},Object.defineProperty(T,"name",{value:"Grid"}),Sr(T,"Grid"),Sr(B,"Color"),Sr(Error,"Error"),Sr(AJAXError,"AJAXError"),Sr(ResolvedImage,"ResolvedImage"),Sr(StylePropertyFunction,"StylePropertyFunction"),Sr(StyleExpression,"StyleExpression",{omit:["_evaluator"]}),Sr(ZoomDependentExpression,"ZoomDependentExpression"),Sr(ZoomConstantExpression,"ZoomConstantExpression"),Sr(pt,"CompoundExpression",{omit:["_evaluate"]});for(const t in Ce)wr[Ce[t]._classRegistryKey]||Sr(Ce[t],`Expression${t}`);function Ar(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function kr(t){return i.ImageBitmap&&t instanceof i.ImageBitmap}function Ir(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(Ar(t)||kr(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const r=t;return e&&e.push(r.buffer),r}if(t instanceof i.ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(Ir(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 ${n}`);const i=r.serialize?r.serialize(t,e):{};if(!r.serialize){for(const r in t)t.hasOwnProperty(r)&&(wr[n].omit.indexOf(r)>=0||(i[r]=Ir(t[r],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 Mr(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||Ar(t)||kr(t)||ArrayBuffer.isView(t)||t instanceof i.ImageData)return t;if(Array.isArray(t))return t.map(Mr);if("object"==typeof t){const e=t.$name||"Object",{klass:r}=wr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const e of Object.keys(t))"$name"!==e&&(n[e]=Mr(t[e]));return n}throw new Error("can't deserialize object of type "+typeof t)}class ThrottledInvoker{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(){this._channel=void 0,this._callback=()=>{}}}const Pr=i.performance;function Cr(t){const e=t?t.url.toString():void 0;return Pr.getEntriesByName(e)}class Scheduler{constructor(){this.tasks={},this.taskQueue=[],m(["process"],this),this.invoker=new ThrottledInvoker(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){A();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(){A();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 Actor{constructor(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.cancelCallbacks={},m(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=A()?t:i,this.scheduler=new Scheduler}send(t,e,r,n,i=!1,s){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=s,this.callbacks[a]=r);const o=M(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:Ir(e,o)},o),{cancel:()=>{r&&delete this.callbacks[a],this.target.postMessage({id:a,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||A()){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(Mr(e.error)):r(null,Mr(e.data)))}else{const r=M(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?Ir(e):null,data:Ir(n,r)},r)}:t=>{},i=Mr(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 Tr=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"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"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},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"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":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"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,"requires":["source"]}},"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"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"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"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"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"}}}');function zr(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function Er(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}class Event{constructor(t,e={}){p(this,e),this.type=t}}class ErrorEvent extends Event{constructor(t,e={}){super("error",p({error:t},e))}}class Evented{on(t,e){return this._listeners=this._listeners||{},zr(t,e,this._listeners),this}off(t,e){return Er(t,e,this._listeners),Er(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},zr(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new Event(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)Er(r,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(p(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t))}else t instanceof ErrorEvent&&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}}function Dr(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Br(t){if(Array.isArray(t))return t.map(Br);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=Br(t[r]);return e}return Dr(t)}class ValidationError{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function Lr(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,a=t.styleSpec;let o=[];const l=Le(r);if("object"!==l)return[new ValidationError(e,r,`object expected, ${l} found`)];for(const t in r){const l=t.split(".")[0],u=n[l]||n["*"];let c;i[l]?c=i[l]:n[l]?c=cn:i["*"]?c=i["*"]:n["*"]&&(c=cn),c?o=o.concat(c({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:u,style:s,styleSpec:a,object:r,objectKey:t},r)):o.push(new ValidationError(e,r[t],`unknown property "${t}"`))}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&o.push(new ValidationError(e,r,`missing required property "${t}"`));return o}function Vr(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,s=t.key,a=t.arrayElementValidator||cn;if("array"!==Le(e))return[new ValidationError(s,e,`array expected, ${Le(e)} found`)];if(r.length&&e.length!==r.length)return[new ValidationError(s,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new ValidationError(s,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let o={type:r.value,values:r.values,minimum:r.minimum,maximum:r.maximum,function:void 0};i.$version<7&&(o.function=r.function),"object"===Le(r.value)&&(o=r.value);let l=[];for(let t=0;t<e.length;t++)l=l.concat(a({array:e,arrayIndex:t,value:e[t],valueSpec:o,style:n,styleSpec:i,key:`${s}[${t}]`}));return l}function Fr(t){const e=t.key,r=t.value,n=t.valueSpec;let i=Le(r);if("number"===i&&r!=r&&(i="NaN"),"number"!==i)return[new ValidationError(e,r,`number expected, ${i} found`)];if("minimum"in n){let i=n.minimum;if("array"===Le(n.minimum)&&(i=n.minimum[t.arrayIndex]),r<i)return[new ValidationError(e,r,`${r} is less than the minimum value ${i}`)]}if("maximum"in n){let i=n.maximum;if("array"===Le(n.maximum)&&(i=n.maximum[t.arrayIndex]),r>i)return[new ValidationError(e,r,`${r} is greater than the maximum value ${i}`)]}return[]}function Rr(t){const e=t.valueSpec,r=Dr(t.value.type);let n,i,s,a={};const o="categorical"!==r&&void 0===t.value.property,l=!o,u="array"===Le(t.value.stops)&&"array"===Le(t.value.stops[0])&&"object"===Le(t.value.stops[0][0]),c=Lr({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 ValidationError(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Vr({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Le(n)&&0===n.length&&e.push(new ValidationError(t.key,n,"array must have at least one stop")),e},default:function(t){return cn({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&o&&c.push(new ValidationError(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||c.push(new ValidationError(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!Be(t.valueSpec)&&c.push(new ValidationError(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Ee(t.valueSpec)?c.push(new ValidationError(t.key,t.value,"property functions not supported")):o&&!De(t.valueSpec)&&c.push(new ValidationError(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||c.push(new ValidationError(t.key,t.value,'"property" property is required')),c;function h(t){let r=[];const n=t.value,o=t.key;if("array"!==Le(n))return[new ValidationError(o,n,`array expected, ${Le(n)} found`)];if(2!==n.length)return[new ValidationError(o,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==Le(n[0]))return[new ValidationError(o,n,`object expected, ${Le(n[0])} found`)];if(void 0===n[0].zoom)return[new ValidationError(o,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new ValidationError(o,n,"object stop key must have value")];const e=Dr(n[0].zoom);if("number"!=typeof e)return[new ValidationError(o,n[0].zoom,"stop zoom values must be numbers")];if(s&&s>e)return[new ValidationError(o,n[0].zoom,"stop zoom values must appear in ascending order")];e!==s&&(s=e,i=void 0,a={}),r=r.concat(Lr({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Fr,value:p}}))}else r=r.concat(p({key:`${o}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return Ne(Br(n[1]))?r.concat([new ValidationError(`${o}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(cn({key:`${o}[1]`,value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const o=Le(t.value),l=Dr(t.value),u=null!==t.value?t.value:s;if(n){if(o!==n)return[new ValidationError(t.key,u,`${o} stop domain type must match previous stop domain type ${n}`)]}else n=o;if("number"!==o&&"string"!==o&&"boolean"!==o&&"number"!=typeof l&&"string"!=typeof l&&"boolean"!=typeof l)return[new ValidationError(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==r){let n=`number expected, ${o} found`;return Ee(e)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ValidationError(t.key,u,n)]}return"categorical"!==r||"number"!==o||"number"==typeof l&&isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===o&&"number"==typeof l&&"number"==typeof i&&void 0!==i&&l<i?[new ValidationError(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===r&&l in a?[new ValidationError(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new ValidationError(t.key,u,`integer expected, found ${String(l)}`)]}}function jr(t){const e=("property"===t.expressionContext?Ge:Ze)(Br(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new ValidationError(`${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 ValidationError(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&&!Et(r))return[new ValidationError(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext)return Or(r,t);if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Dt(r,["zoom","feature-state"]))return[new ValidationError(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!zt(r))return[new ValidationError(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Or(t,e){const r=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(e.valueSpec&&e.valueSpec.expression)for(const t of e.valueSpec.expression.parameters)r.delete(t);if(0===r.size)return[];const n=[];return t instanceof pt&&r.has(t.name)?[new ValidationError(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(...Or(t,e))})),n)}function Ur(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(Dr(r))&&i.push(new ValidationError(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(Dr(r))&&i.push(new ValidationError(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function $r(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(!$r(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function qr(t,e="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};$r(t)||(t=Kr(t));const r=t;let n=!0;try{n=function(t){if(!Gr(t))return t;let e=Br(t);return Zr(e),e=Nr(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=Tr[`filter_${e}`],s=Ze(n,i);let a=null;if("error"===s.result)throw new Error(s.value.map((t=>`${t.key}: ${t.message}`)).join(", "));a=(t,e,r)=>s.value.evaluate(t,e,{},r);let o=null,l=null;if(n!==r){const t=Ze(r,i);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));o=(e,r,n,i,s)=>t.value.evaluate(e,r,{},n,void 0,void 0,i,s),l=!zt(t.value.expression)}return a=a,{filter:a,dynamicFilter:o||void 0,needGeometry:Jr(n),needFeature:!!l}}function Nr(t){if(!Array.isArray(t))return t;const e=function(t){if(Xr.has(t[0]))for(let e=1;e<t.length;e++)if(Gr(t[e]))return!0;return t}(t);return!0===e?e:e.map((t=>Nr(t)))}function Zr(t){let e=!1;const r=[];if("case"===t[0]){for(let n=1;n<t.length-1;n+=2)e=e||Gr(t[n]),r.push(t[n+1]);r.push(t[t.length-1])}else if("match"===t[0]){e=e||Gr(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||Gr(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++)Zr(t[e])}function Gr(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(Gr(t[e]))return!0;return!1}const Xr=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Yr(t,e){return t<e?-1:t>e?1:0}function Jr(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Jr(t[e]))return!0;return!1}function Kr(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Wr(t[1],t[2],"=="):"!="===e?tn(Wr(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Wr(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(Kr))):"all"===e?["all"].concat(t.slice(1).map(Kr)):"none"===e?["all"].concat(t.slice(1).map(Kr).map(tn)):"in"===e?Hr(t[1],t.slice(2)):"!in"===e?tn(Hr(t[1],t.slice(2))):"has"===e?Qr(t[1]):"!has"===e?tn(Qr(t[1])):"within"!==e||t;var r}function Wr(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 Hr(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(Yr)]]:["filter-in-small",t,["literal",e]]}}function Qr(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function tn(t){return["!",t]}function en(t){return $r(Br(t.value))?jr(L({},t,{expressionContext:"filter",valueSpec:t.styleSpec[`filter_${t.layerType||"fill"}`]})):rn(t)}function rn(t){const e=t.value,r=t.key;if("array"!==Le(e))return[new ValidationError(r,e,`array expected, ${Le(e)} found`)];const n=t.styleSpec;let i,s=[];if(e.length<1)return[new ValidationError(r,e,"filter array must have at least 1 element")];switch(s=s.concat(Ur({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Dr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Dr(e[1])&&s.push(new ValidationError(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new ValidationError(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=Le(e[1]),"string"!==i&&s.push(new ValidationError(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=Le(e[a]),"$type"===Dr(e[1])?s=s.concat(Ur({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new ValidationError(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(rn({key:`${r}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=Le(e[1]),2!==e.length?s.push(new ValidationError(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new ValidationError(`${r}[1]`,e[1],`string expected, ${i} found`));break;case"within":i=Le(e[1]),2!==e.length?s.push(new ValidationError(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==i&&s.push(new ValidationError(`${r}[1]`,e[1],`object expected, ${i} found`))}return s}function nn(t,e){const r=t.key,n=t.style,i=t.styleSpec,s=t.value,a=t.objectKey,o=i[`${e}_${t.layerType}`];if(!o)return[];const l=a.match(/^(.*)-transition$/);if("paint"===e&&l&&o[l[1]]&&o[l[1]].transition)return cn({key:r,value:s,valueSpec:i.transition,style:n,styleSpec:i});const u=t.valueSpec||o[a];if(!u)return[new ValidationError(r,s,`unknown property "${a}"`)];let c;if("string"===Le(s)&&Ee(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new ValidationError(r,s,`"${a}" 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"===a&&n&&!n.glyphs&&h.push(new ValidationError(r,s,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Ve(Br(s))&&"identity"===Dr(s.type)&&h.push(new ValidationError(r,s,'"text-font" does not support identity functions'))),h.concat(cn({key:t.key,value:s,valueSpec:u,style:n,styleSpec:i,expressionContext:"property",propertyType:e,propertyKey:a}))}function sn(t){return nn(t,"paint")}function an(t){return nn(t,"layout")}function on(t){const e=t.value,r=t.key,n=Le(e);return"string"!==n?[new ValidationError(r,e,`string expected, ${n} found`)]:[]}const ln={promoteId:function({key:t,value:e}){if("string"===Le(e))return on({key:t,value:e});{const r=[];for(const n in e)r.push(...on({key:`${t}.${n}`,value:e[n]}));return r}}},un={"*":()=>[],array:Vr,boolean:function(t){const e=t.value,r=t.key,n=Le(e);return"boolean"!==n?[new ValidationError(r,e,`boolean expected, ${n} found`)]:[]},number:Fr,color:function(t){const e=t.key,r=t.value,n=Le(r);return"string"!==n?[new ValidationError(e,r,`color expected, ${n} found`)]:null===D.parseCSSColor(r)?[new ValidationError(e,r,`color expected, "${r}" found`)]:[]},enum:Ur,filter:en,function:Rr,layer:function(t){let e=[];const r=t.value,n=t.key,i=t.style,s=t.styleSpec;r.type||r.ref||e.push(new ValidationError(n,r,'either "type" or "ref" is required'));let a=Dr(r.type);const o=Dr(r.ref);if(r.id){const s=Dr(r.id);for(let a=0;a<t.arrayIndex;a++){const t=i.layers[a];Dr(t.id)===s&&e.push(new ValidationError(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 ValidationError(n,r[t],`"${t}" is prohibited for ref layers`))})),i.layers.forEach((e=>{Dr(e.id)===o&&(t=e)})),t?t.ref?e.push(new ValidationError(n,r.ref,"ref cannot reference another ref layer")):a=Dr(t.type):"string"==typeof o&&e.push(new ValidationError(n,r.ref,`ref layer "${o}" not found`))}else if("background"!==a&&"sky"!==a)if(r.source){const t=i.sources&&i.sources[r.source],s=t&&Dr(t.type);t?"vector"===s&&"raster"===a?e.push(new ValidationError(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===s&&"raster"!==a?e.push(new ValidationError(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==a?e.push(new ValidationError(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!r.paint||!r.paint["line-gradient"]&&!r.paint["line-trim-offset"]||"geojson"===s&&t.lineMetrics||e.push(new ValidationError(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new ValidationError(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new ValidationError(n,r.source,`source "${r.source}" not found`))}else e.push(new ValidationError(n,r,'missing required property "source"'));return e=e.concat(Lr({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>cn({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:t=>en(L({layerType:a},t)),layout:t=>Lr({layer:r,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>an(L({layerType:a},t))}}),paint:t=>Lr({layer:r,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>sn(L({layerType:a},t))}})}})),e},object:Lr,source:function(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style;if(!e.type)return[new ValidationError(r,e,'"type" is required')];const s=Dr(e.type);let a;switch(s){case"vector":case"raster":case"raster-dem":return a=Lr({key:r,value:e,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:ln}),a;case"geojson":if(a=Lr({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,objectElementValidators:ln}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...jr({key:`${r}.${t}.map`,value:i,expressionContext:"cluster-map"})),a.push(...jr({key:`${r}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return a;case"video":return Lr({key:r,value:e,valueSpec:n.source_video,style:i,styleSpec:n});case"image":return Lr({key:r,value:e,valueSpec:n.source_image,style:i,styleSpec:n});case"canvas":return[new ValidationError(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ur({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:n})}},light:function(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let s=[];const a=Le(e);if(void 0===e)return s;if("object"!==a)return s=s.concat([new ValidationError("light",e,`object expected, ${a} found`)]),s;for(const t in e){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&n[a[1]]&&n[a[1]].transition?cn({key:t,value:e[t],valueSpec:r.transition,style:i,styleSpec:r}):n[t]?cn({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}):[new ValidationError(t,e[t],`unknown property "${t}"`)])}return s},terrain:function(t){const e=t.value,r=t.key,n=t.style,i=t.styleSpec,s=i.terrain;let a=[];const o=Le(e);if(void 0===e)return a;if("object"!==o)return a=a.concat([new ValidationError("terrain",e,`object expected, ${o} found`)]),a;for(const t in e){const r=t.match(/^(.*)-transition$/);a=a.concat(r&&s[r[1]]&&s[r[1]].transition?cn({key:t,value:e[t],valueSpec:i.transition,style:n,styleSpec:i}):s[t]?cn({key:t,value:e[t],valueSpec:s[t],style:n,styleSpec:i}):[new ValidationError(t,e[t],`unknown property "${t}"`)])}if(e.source){const t=n.sources&&n.sources[e.source],i=t&&Dr(t.type);t?"raster-dem"!==i&&a.push(new ValidationError(r,e.source,`terrain cannot be used with a source of type ${String(i)}, it only be used with a "raster-dem" source type`)):a.push(new ValidationError(r,e.source,`source "${e.source}" not found`))}else a.push(new ValidationError(r,e,'terrain is missing required property "source"'));return a},fog:function(t){const e=t.value,r=t.style,n=t.styleSpec,i=n.fog;let s=[];const a=Le(e);if(void 0===e)return s;if("object"!==a)return s=s.concat([new ValidationError("fog",e,`object expected, ${a} found`)]),s;for(const t in e){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&i[a[1]]&&i[a[1]].transition?cn({key:t,value:e[t],valueSpec:n.transition,style:r,styleSpec:n}):i[t]?cn({key:t,value:e[t],valueSpec:i[t],style:r,styleSpec:n}):[new ValidationError(t,e[t],`unknown property "${t}"`)])}return s},string:on,formatted:function(t){return 0===on(t).length?[]:jr(t)},resolvedImage:function(t){return 0===on(t).length?[]:jr(t)},projection:function(t){const e=t.value,r=t.styleSpec,n=r.projection,i=t.style;let s=[];const a=Le(e);if("object"===a)for(const t in e)s=s.concat(cn({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}));else"string"!==a&&(s=s.concat([new ValidationError("projection",e,`object or string expected, ${a} found`)]));return s}};function cn(t){const e=t.value,r=t.valueSpec,n=t.styleSpec;return r.expression&&Ve(Dr(e))?Rr(t):r.expression&&Ne(Br(e))?jr(t):r.type&&un[r.type]?un[r.type](t):Lr(L({},t,{valueSpec:r.type?n[r.type]:r}))}function hn(t){const e=t.value,r=t.key,n=on(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new ValidationError(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new ValidationError(r,e,'"glyphs" url must include a "{range}" token'))),n}function pn(t,e=Tr){return yn(cn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:hn,"*":()=>[]}}))}const dn=t=>yn(sn(t)),fn=t=>yn(an(t));function yn(t){return t.slice().sort(((t,e)=>t.line&&e.line?t.line-e.line:0))}class ZoomHistory{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 mn=t=>t>=1536&&t<=1791,gn=t=>t>=1872&&t<=1919,xn=t=>t>=2208&&t<=2303,vn=t=>t>=11904&&t<=12031,bn=t=>t>=12032&&t<=12255,_n=t=>t>=12272&&t<=12287,wn=t=>t>=12288&&t<=12351,Sn=t=>t>=12352&&t<=12447,An=t=>t>=12448&&t<=12543,kn=t=>t>=12544&&t<=12591,Mn=t=>t>=12704&&t<=12735,Pn=t=>t>=12736&&t<=12783,Cn=t=>t>=12784&&t<=12799,Tn=t=>t>=12800&&t<=13055,zn=t=>t>=13056&&t<=13311,En=t=>t>=13312&&t<=19903,Dn=t=>t>=19968&&t<=40959,Bn=t=>t>=40960&&t<=42127,Ln=t=>t>=42128&&t<=42191,Vn=t=>t>=63744&&t<=64255,Fn=t=>t>=64336&&t<=65023,Rn=t=>t>=65040&&t<=65055,jn=t=>t>=65072&&t<=65103,On=t=>t>=65104&&t<=65135,Un=t=>t>=65136&&t<=65279,$n=t=>t>=65280&&t<=65519;function qn(t){for(const e of t)if(Gn(e.charCodeAt(0)))return!0;return!1}function Nn(t){for(const e of t)if(!Zn(e.charCodeAt(0)))return!1;return!0}function Zn(t){return!(mn(t)||gn(t)||xn(t)||Fn(t)||Un(t))}function Gn(t){return!(746!==t&&747!==t&&(t<4352||!(Mn(t)||kn(t)||jn(t)&&!(t>=65097&&t<=65103)||Vn(t)||zn(t)||vn(t)||Pn(t)||!(!wn(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||En(t)||Dn(t)||Tn(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)||Sn(t)||_n(t)||(t=>t>=12688&&t<=12703)(t)||bn(t)||Cn(t)||An(t)&&12540!==t||!(!$n(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)||!(!On(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||Rn(t)||(t=>t>=19904&&t<=19967)(t)||Bn(t)||Ln(t))))}function Xn(t){return!(Gn(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)||wn(t)||An(t)||(t=>t>=57344&&t<=63743)(t)||jn(t)||On(t)||$n(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Yn(t){return t>=1424&&t<=2303||Fn(t)||Un(t)}function Jn(t,e){return!(!e&&Yn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||(t=>t>=6016&&t<=6143)(t))}function Kn(t){for(const e of t)if(Yn(e.charCodeAt(0)))return!0;return!1}let Wn,Hn,Qn,ti;const ei={now:()=>void 0!==Qn?Qn:i.performance.now(),setNow(t){Qn=t},restoreNow(){Qn=void 0},frame(t){const e=i.requestAnimationFrame(t);return{cancel:()=>i.cancelAnimationFrame(e)}},getImageData(t,e=0){const{width:r,height:n}=t;ti||(ti=i.document.createElement("canvas"));const s=ti.getContext("2d");if(!s)throw new Error("failed to create canvas 2d context");return(r>ti.width||n>ti.height)&&(ti.width=r,ti.height=n),s.clearRect(-e,-e,r+2*e,n+2*e),s.drawImage(t,0,0,r,n),s.getImageData(-e,-e,r+2*e,n+2*e)},resolveURL:t=>(Wn||(Wn=i.document.createElement("a")),Wn.href=t,Wn.href),get devicePixelRatio(){return i.devicePixelRatio},get prefersReducedMotion(){return!!i.matchMedia&&(null==Hn&&(Hn=i.matchMedia("(prefers-reduced-motion: reduce)")),Hn.matches)}},ri="loading",ni="loaded";let ii="unavailable",si=null;function ai(){oi.fire(new Event("pluginStateChange",{pluginStatus:ii,pluginURL:si}))}const oi=new Evented,li=function(){return ii},ui=function(){if("deferred"!==ii||!si)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ii=ri,ai(),si&&vr({url:si},(t=>{t?function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(ii="error")}(t):(ii=ni,ai())}))},ci={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>ii===ni||null!=ci.applyArabicShaping,isLoading:()=>ii===ri,setState(t){ii=t.pluginStatus,si=t.pluginURL},isParsed:()=>null!=ci.applyArabicShaping&&null!=ci.processBidirectionalText&&null!=ci.processStyledBidirectionalText,getPluginURL:()=>si};class EvaluationParameters{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 ZoomHistory,this.transition={},this.pitch=0)}isSupportedScript(t){return function(t,e){for(const r of t)if(!Jn(r.charCodeAt(0),e))return!1;return!0}(t,ci.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 PropertyValue{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Ve(t))return new StylePropertyFunction(t,e);if(Ne(t)){const r=Ge(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=B.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 TransitionablePropertyValue{constructor(t){this.property=t,this.value=new PropertyValue(t,void 0)}transitioned(t,e){return new TransitioningPropertyValue(this.property,this.value,e,p({},t.transition,this.transition),t.now)}untransitioned(){return new TransitioningPropertyValue(this.property,this.value,null,{},0)}}class Transitionable{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return v(this._values[t].value.value)}setValue(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new TransitionablePropertyValue(this._values[t].property)),this._values[t].value=new PropertyValue(this._values[t].property,null===e?void 0:v(e))}getTransition(t){return v(this._values[t].transition)}setTransition(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new TransitionablePropertyValue(this._values[t].property)),this._values[t].transition=v(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 Transitioning(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 Transitioning(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class TransitioningPropertyValue{constructor(t,e,r,n,i){const s=n.delay||0,a=n.duration||0;i=i||0,this.property=t,this.value=e,this.begin=i+s,this.end=this.begin+a,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return s.possiblyEvaluate(t,e,r);{const a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,r),i,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}}return i}}class Transitioning{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const n=new PossiblyEvaluated(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 Layout{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return v(this._values[t].value)}setValue(t,e){this._values[t]=new PropertyValue(this._values[t].property,null===e?void 0:v(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 PossiblyEvaluated(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class PossiblyEvaluatedPropertyValue{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 PossiblyEvaluated{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class DataConstantProperty{constructor(t){this.specification=t}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,r){const n=Ut[this.specification.type];return n?n(t,e,r):t}}class DataDrivenProperty{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,n){return new PossiblyEvaluatedPropertyValue(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 PossiblyEvaluatedPropertyValue(this,{kind:"constant",value:void 0},t.parameters);const n=Ut[this.specification.type];return n?new PossiblyEvaluatedPropertyValue(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 CrossFadedDataDrivenProperty extends DataDrivenProperty{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new PossiblyEvaluatedPropertyValue(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),s="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,a=this._calculate(s,s,s,e);return new PossiblyEvaluatedPropertyValue(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new PossiblyEvaluatedPropertyValue(this,{kind:"constant",value:r},e)}return new PossiblyEvaluatedPropertyValue(this,t.expression,e)}evaluate(t,e,r,n,i,s){if("source"===t.kind){const a=t.evaluate(e,r,n,i,s);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e,other:r}:{from:r,to:e,other:t}}interpolate(t){return t}}class CrossFadedProperty{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 EvaluationParameters(Math.floor(e.zoom-1),e)),t.expression.evaluate(new EvaluationParameters(Math.floor(e.zoom),e)),t.expression.evaluate(new EvaluationParameters(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 ColorRampProperty{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)}interpolate(){return!1}}class Properties{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const e=new EvaluationParameters(0,{});for(const r in t){const n=t[r];n.specification.overridable&&this.overridableProperties.push(r);const i=this.defaultPropertyValues[r]=new PropertyValue(n,void 0),s=this.defaultTransitionablePropertyValues[r]=new TransitionablePropertyValue(n);this.defaultTransitioningPropertyValues[r]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate(e)}}}function hi(t,e){return 256*(t=u(Math.floor(t),0,255))+u(Math.floor(e),0,255)}Sr(DataDrivenProperty,"DataDrivenProperty"),Sr(DataConstantProperty,"DataConstantProperty"),Sr(CrossFadedDataDrivenProperty,"CrossFadedDataDrivenProperty"),Sr(CrossFadedProperty,"CrossFadedProperty"),Sr(ColorRampProperty,"ColorRampProperty");const pi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Struct{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 StructArray{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")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function di(t,e=1){let r=0,n=0;return{members:t.map((t=>{const i=pi[t.type].BYTES_PER_ELEMENT,s=r=fi(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:s}})),size:fi(r,Math.max(n,e)),alignment:e}}function fi(t,e){return Math.ceil(t/e)*e}class StructArrayLayout2i4 extends StructArray{_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}}StructArrayLayout2i4.prototype.bytesPerElement=4,Sr(StructArrayLayout2i4,"StructArrayLayout2i4");class StructArrayLayout3i6 extends StructArray{_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}}StructArrayLayout3i6.prototype.bytesPerElement=6,Sr(StructArrayLayout3i6,"StructArrayLayout3i6");class StructArrayLayout4i8 extends StructArray{_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}}StructArrayLayout4i8.prototype.bytesPerElement=8,Sr(StructArrayLayout4i8,"StructArrayLayout4i8");class StructArrayLayout2i4ub1f12 extends StructArray{_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,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){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]=a,this.float32[c+2]=o,t}}StructArrayLayout2i4ub1f12.prototype.bytesPerElement=12,Sr(StructArrayLayout2i4ub1f12,"StructArrayLayout2i4ub1f12");class StructArrayLayout4f16 extends StructArray{_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}}StructArrayLayout4f16.prototype.bytesPerElement=16,Sr(StructArrayLayout4f16,"StructArrayLayout4f16");class StructArrayLayout10ui20 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,s,a,o,l,u)}emplace(t,e,r,n,i,s,a,o,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=s,this.uint16[h+5]=a,this.uint16[h+6]=o,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}StructArrayLayout10ui20.prototype.bytesPerElement=20,Sr(StructArrayLayout10ui20,"StructArrayLayout10ui20");class StructArrayLayout8ui16 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o){const l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,n,i,s,a,o)}emplace(t,e,r,n,i,s,a,o,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]=a,this.uint16[u+6]=o,this.uint16[u+7]=l,t}}StructArrayLayout8ui16.prototype.bytesPerElement=16,Sr(StructArrayLayout8ui16,"StructArrayLayout8ui16");class StructArrayLayout6i12 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}StructArrayLayout6i12.prototype.bytesPerElement=12,Sr(StructArrayLayout6i12,"StructArrayLayout6i12");class StructArrayLayout4i4ui4i24 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,a,o,l,u,c,h)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=n,this.int16[d+3]=i,this.uint16[d+4]=s,this.uint16[d+5]=a,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=p,t}}StructArrayLayout4i4ui4i24.prototype.bytesPerElement=24,Sr(StructArrayLayout4i4ui4i24,"StructArrayLayout4i4ui4i24");class StructArrayLayout3i3f20 extends StructArray{_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){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=10*t,l=5*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.float32[l+2]=i,this.float32[l+3]=s,this.float32[l+4]=a,t}}StructArrayLayout3i3f20.prototype.bytesPerElement=20,Sr(StructArrayLayout3i3f20,"StructArrayLayout3i3f20");class StructArrayLayout1ul4 extends StructArray{_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}}StructArrayLayout1ul4.prototype.bytesPerElement=4,Sr(StructArrayLayout1ul4,"StructArrayLayout1ul4");class StructArrayLayout5i4f1i1ul2ui40 extends StructArray{_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,a,o,l,u,c,h,p){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,r,n,i,s,a,o,l,u,c,h,p)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d){const f=20*t,y=10*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.int16[f+4]=s,this.float32[y+3]=a,this.float32[y+4]=o,this.float32[y+5]=l,this.float32[y+6]=u,this.int16[f+14]=c,this.uint32[y+8]=h,this.uint16[f+18]=p,this.uint16[f+19]=d,t}}StructArrayLayout5i4f1i1ul2ui40.prototype.bytesPerElement=40,Sr(StructArrayLayout5i4f1i1ul2ui40,"StructArrayLayout5i4f1i1ul2ui40");class StructArrayLayout3i2i2i16 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){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]=a,this.int16[l+7]=o,t}}StructArrayLayout3i2i2i16.prototype.bytesPerElement=16,Sr(StructArrayLayout3i2i2i16,"StructArrayLayout3i2i2i16");class StructArrayLayout2f1f2i16 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=4*t,o=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[o+6]=i,this.int16[o+7]=s,t}}StructArrayLayout2f1f2i16.prototype.bytesPerElement=16,Sr(StructArrayLayout2f1f2i16,"StructArrayLayout2f1f2i16");class StructArrayLayout2ub2f12 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=12*t,a=3*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t}}StructArrayLayout2ub2f12.prototype.bytesPerElement=12,Sr(StructArrayLayout2ub2f12,"StructArrayLayout2ub2f12");class StructArrayLayout3f12 extends StructArray{_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}}StructArrayLayout3f12.prototype.bytesPerElement=12,Sr(StructArrayLayout3f12,"StructArrayLayout3f12");class StructArrayLayout3ui6 extends StructArray{_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}}StructArrayLayout3ui6.prototype.bytesPerElement=6,Sr(StructArrayLayout3ui6,"StructArrayLayout3ui6");class StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60 extends StructArray{_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,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b,_){const w=30*t,S=15*t,A=60*t;return this.int16[w+0]=e,this.int16[w+1]=r,this.int16[w+2]=n,this.float32[S+2]=i,this.float32[S+3]=s,this.uint16[w+8]=a,this.uint16[w+9]=o,this.uint32[S+5]=l,this.uint32[S+6]=u,this.uint32[S+7]=c,this.uint16[w+16]=h,this.uint16[w+17]=p,this.uint16[w+18]=d,this.float32[S+10]=f,this.float32[S+11]=y,this.uint8[A+48]=m,this.uint8[A+49]=g,this.uint8[A+50]=x,this.uint32[S+13]=v,this.int16[w+28]=b,this.uint8[A+58]=_,t}}StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60.prototype.bytesPerElement=60,Sr(StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class StructArrayLayout3i2f6i15ui1ul3f76 extends StructArray{_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,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b,_,w,S,A,k,I,M,P,C){const T=this.length;return this.resize(T+1),this.emplace(T,t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b,_,w,S,A,k,I,M,P,C)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b,_,w,S,A,k,I,M,P,C,T){const z=38*t,E=19*t;return this.int16[z+0]=e,this.int16[z+1]=r,this.int16[z+2]=n,this.float32[E+2]=i,this.float32[E+3]=s,this.int16[z+8]=a,this.int16[z+9]=o,this.int16[z+10]=l,this.int16[z+11]=u,this.int16[z+12]=c,this.int16[z+13]=h,this.uint16[z+14]=p,this.uint16[z+15]=d,this.uint16[z+16]=f,this.uint16[z+17]=y,this.uint16[z+18]=m,this.uint16[z+19]=g,this.uint16[z+20]=x,this.uint16[z+21]=v,this.uint16[z+22]=b,this.uint16[z+23]=_,this.uint16[z+24]=w,this.uint16[z+25]=S,this.uint16[z+26]=A,this.uint16[z+27]=k,this.uint16[z+28]=I,this.uint32[E+15]=M,this.float32[E+16]=P,this.float32[E+17]=C,this.float32[E+18]=T,t}}StructArrayLayout3i2f6i15ui1ul3f76.prototype.bytesPerElement=76,Sr(StructArrayLayout3i2f6i15ui1ul3f76,"StructArrayLayout3i2f6i15ui1ul3f76");class StructArrayLayout1f4 extends StructArray{_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}}StructArrayLayout1f4.prototype.bytesPerElement=4,Sr(StructArrayLayout1f4,"StructArrayLayout1f4");class StructArrayLayout5f20 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=5*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,this.float32[a+4]=s,t}}StructArrayLayout5f20.prototype.bytesPerElement=20,Sr(StructArrayLayout5f20,"StructArrayLayout5f20");class StructArrayLayout1ul3ui12 extends StructArray{_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}}StructArrayLayout1ul3ui12.prototype.bytesPerElement=12,Sr(StructArrayLayout1ul3ui12,"StructArrayLayout1ul3ui12");class StructArrayLayout2ui4 extends StructArray{_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}}StructArrayLayout2ui4.prototype.bytesPerElement=4,Sr(StructArrayLayout2ui4,"StructArrayLayout2ui4");class StructArrayLayout1ui2 extends StructArray{_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}}StructArrayLayout1ui2.prototype.bytesPerElement=2,Sr(StructArrayLayout1ui2,"StructArrayLayout1ui2");class StructArrayLayout2f8 extends StructArray{_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}}StructArrayLayout2f8.prototype.bytesPerElement=8,Sr(StructArrayLayout2f8,"StructArrayLayout2f8");class FillExtrusionExtStruct extends Struct{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}FillExtrusionExtStruct.prototype.size=12;class FillExtrusionExtArray extends StructArrayLayout6i12{get(t){return new FillExtrusionExtStruct(this,t)}}Sr(FillExtrusionExtArray,"FillExtrusionExtArray");class CollisionBoxStruct extends Struct{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]}}CollisionBoxStruct.prototype.size=40;class CollisionBoxArray extends StructArrayLayout5i4f1i1ul2ui40{get(t){return new CollisionBoxStruct(this,t)}}Sr(CollisionBoxArray,"CollisionBoxArray");class PlacedSymbolStruct extends Struct{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}}PlacedSymbolStruct.prototype.size=60;class PlacedSymbolArray extends StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60{get(t){return new PlacedSymbolStruct(this,t)}}Sr(PlacedSymbolArray,"PlacedSymbolArray");class SymbolInstanceStruct extends Struct{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]}}SymbolInstanceStruct.prototype.size=76;class SymbolInstanceArray extends StructArrayLayout3i2f6i15ui1ul3f76{get(t){return new SymbolInstanceStruct(this,t)}}Sr(SymbolInstanceArray,"SymbolInstanceArray");class GlyphOffsetArray extends StructArrayLayout1f4{getoffsetX(t){return this.float32[1*t+0]}}Sr(GlyphOffsetArray,"GlyphOffsetArray");class SymbolLineVertexArray extends StructArrayLayout3i6{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Sr(SymbolLineVertexArray,"SymbolLineVertexArray");class FeatureIndexStruct extends Struct{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]}}FeatureIndexStruct.prototype.size=12;class FeatureIndexArray extends StructArrayLayout1ul3ui12{get(t){return new FeatureIndexStruct(this,t)}}Sr(FeatureIndexArray,"FeatureIndexArray");class FillExtrusionCentroidStruct extends Struct{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}FillExtrusionCentroidStruct.prototype.size=4;class FillExtrusionCentroidArray extends StructArrayLayout2ui4{get(t){return new FillExtrusionCentroidStruct(this,t)}}Sr(FillExtrusionCentroidArray,"FillExtrusionCentroidArray");class CircleGlobeExtStruct extends Struct{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}CircleGlobeExtStruct.prototype.size=12;class CircleGlobeExtArray extends StructArrayLayout6i12{get(t){return new CircleGlobeExtStruct(this,t)}}Sr(CircleGlobeExtArray,"CircleGlobeExtArray");const yi=di([{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"}]),mi=di([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]);var gi=E((function(t){t.exports=function(t,e){var r,n,i,s,a,o,l,u;for(n=t.length-(r=3&t.length),i=e,a=3432918353,o=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),xi=E((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}})),vi=gi,bi=xi;vi.murmur3=gi,vi.murmur2=bi;class FeaturePositionMap{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,n){this.ids.push(_i(t)),this.positions.push(e,r,n)}getPositions(t){const e=_i(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 wi(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new FeaturePositionMap;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function _i(t){const e=+t;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:vi(String(t))}function wi(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let s=r-1,a=n+1;for(;;){do{s++}while(t[s]<i);do{a--}while(t[a]>i);if(s>=a)break;Si(t,s,a),Si(e,3*s,3*a),Si(e,3*s+1,3*a+1),Si(e,3*s+2,3*a+2)}a-r<n-a?(wi(t,e,r,a),r=a+1):(wi(t,e,a+1,n),n=a)}}function Si(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}Sr(FeaturePositionMap,"FeaturePositionMap");class Uniform{constructor(t){this.gl=t.gl,this.initialized=!1}fetchUniformLocation(t,e){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(t,e),this.initialized=!0),!!this.location}}class Uniform1f extends Uniform{constructor(t){super(t),this.current=0}set(t,e,r){this.fetchUniformLocation(t,e)&&this.current!==r&&(this.current=r,this.gl.uniform1f(this.location,r))}}class Uniform4f extends Uniform{constructor(t){super(t),this.current=[0,0,0,0]}set(t,e,r){this.fetchUniformLocation(t,e)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]&&r[3]===this.current[3]||(this.current=r,this.gl.uniform4f(this.location,r[0],r[1],r[2],r[3])))}}class UniformColor extends Uniform{constructor(t){super(t),this.current=B.transparent}set(t,e,r){this.fetchUniformLocation(t,e)&&(r.r===this.current.r&&r.g===this.current.g&&r.b===this.current.b&&r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)))}}function Ai(t){return[hi(255*t.r,255*t.g),hi(255*t.b,255*t.a)]}class ConstantBinder{constructor(t,e,r){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r}setUniform(t,e,r,n,i){e.set(t,i,n.constantOr(this.value))}getBinding(t,e){return"color"===this.type?new UniformColor(t):new Uniform1f(t)}}class CrossFadedConstantBinder{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||1,this.pixelRatioTo=t.pixelRatio||1,this.patternFrom=e.tl.concat(e.br),this.patternTo=t.tl.concat(t.br)}setUniform(t,e,r,n,i){const s="u_pattern_to"===i||"u_dash_to"===i?this.patternTo:"u_pattern_from"===i||"u_dash_from"===i?this.patternFrom:"u_pixel_ratio_to"===i?this.pixelRatioTo:"u_pixel_ratio_from"===i?this.pixelRatioFrom:null;s&&e.set(t,i,s)}getBinding(t,e){return"u_pattern_from"===e||"u_pattern_to"===e||"u_dash_from"===e||"u_dash_to"===e?new Uniform4f(t):new Uniform1f(t)}}class SourceExpressionBinder{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 a=this.paintVertexArray.length,o=this.expression.evaluate(new EvaluationParameters(0),e,{},i,n,s);this.paintVertexArray.resize(t),this._setPaintValue(a,t,o)}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=Ai(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 CompositeExpressionBinder{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 a=this.expression.evaluate(new EvaluationParameters(this.zoom),e,{},i,n,s),o=this.expression.evaluate(new EvaluationParameters(this.zoom+1),e,{},i,n,s),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,a,o)}updatePaintArray(t,e,r,n,i){const s=this.expression.evaluate({zoom:this.zoom},r,n,void 0,i),a=this.expression.evaluate({zoom:this.zoom+1},r,n,void 0,i);this._setPaintValue(t,e,s,a)}_setPaintValue(t,e,r,n){if("color"===this.type){const i=Ai(r),s=Ai(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,r,n,i){const s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,a=u(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(t,i,a)}getBinding(t,e){return new Uniform1f(t)}}class CrossFadedCompositeBinder{constructor(t,e,r,n,i,s,a){this.expression=t,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.paintVertexAttributes=("array"===r?mi:yi).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:a}=r,o=n[i],l=n[s],u=n[a];if(o&&l&&u)for(let r=t;r<e;r++)this._setPaintValue(this.zoomInPaintVertexArray,r,l,o),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 ProgramConfiguration{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 PossiblyEvaluatedPropertyValue&&Ee(s.property.specification)))continue;const a=Ii(i,t.type),o=s.value,l=s.property.specification.type,u=s.property.useIntegerZoom,c=s.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c,p="line-dasharray"===String(i)&&"constant"!==t.layout.get("line-cap").value.kind;if("constant"!==o.kind||p)if("source"===o.kind||p||h){const r=Ci(i,l,"source");this.binders[i]=h?new CrossFadedCompositeBinder(o,a,l,u,e,r,t.id):new SourceExpressionBinder(o,a,l,r),n.push(`/a_${i}`)}else{const t=Ci(i,l,"composite");this.binders[i]=new CompositeExpressionBinder(o,a,l,u,e,t),n.push(`/z_${i}`)}else this.binders[i]=h?new CrossFadedConstantBinder(o.value,a):new ConstantBinder(o.value,a,l),n.push(`/u_${i}`)}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof SourceExpressionBinder||e instanceof CompositeExpressionBinder?e.maxValue:0}populatePaintArrays(t,e,r,n,i,s){for(const a in this.binders){const o=this.binders[a];(o instanceof SourceExpressionBinder||o instanceof CompositeExpressionBinder||o instanceof CrossFadedCompositeBinder)&&o.populatePaintArray(t,e,r,n,i,s)}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof CrossFadedConstantBinder&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,n,i,s){let a=!1;for(const o in t){const l=e.getPositions(o);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 SourceExpressionBinder||u instanceof CompositeExpressionBinder||u instanceof CrossFadedCompositeBinder)&&!0===u.expression.isStateDependent){const c=n.paint.get(r);u.expression=c.value,u.updatePaintArray(e.start,e.end,l,t[o],i,s),a=!0}}}}return a}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof ConstantBinder||r instanceof CrossFadedConstantBinder)&&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 SourceExpressionBinder||r instanceof CompositeExpressionBinder||r instanceof CrossFadedCompositeBinder)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 ConstantBinder||r instanceof CrossFadedConstantBinder||r instanceof CompositeExpressionBinder)for(const e of r.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t){const e=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof ConstantBinder||n instanceof CrossFadedConstantBinder||n instanceof CompositeExpressionBinder)for(const i of n.uniformNames)e.push({name:i,property:r,binding:n.getBinding(t,i)})}return e}setUniforms(t,e,r,n,i){for(const{name:e,property:s,binding:a}of r)this.binders[s].setUniform(t,a,i,n.get(s),e)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof CrossFadedCompositeBinder){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof SourceExpressionBinder||r instanceof CompositeExpressionBinder)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof SourceExpressionBinder||r instanceof CompositeExpressionBinder||r instanceof CrossFadedCompositeBinder)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof SourceExpressionBinder||e instanceof CompositeExpressionBinder||e instanceof CrossFadedCompositeBinder)&&e.destroy()}}}class ProgramConfigurationSet{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new ProgramConfiguration(n,e,r);this.needsUpload=!1,this._featureMap=new FeaturePositionMap,this._bufferOffset=0}populatePaintArrays(t,e,r,n,i,s,a){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s,a);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 ki={"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 Ii(t,e){return ki[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const Mi={"line-pattern":{source:StructArrayLayout10ui20,composite:StructArrayLayout10ui20},"fill-pattern":{source:StructArrayLayout10ui20,composite:StructArrayLayout10ui20},"fill-extrusion-pattern":{source:StructArrayLayout10ui20,composite:StructArrayLayout10ui20},"line-dasharray":{source:StructArrayLayout8ui16,composite:StructArrayLayout8ui16}},Pi={color:{source:StructArrayLayout2f8,composite:StructArrayLayout4f16},number:{source:StructArrayLayout1f4,composite:StructArrayLayout2f8}};function Ci(t,e,r){const n=Mi[t];return n&&n[r]||Pi[e][r]}Sr(ConstantBinder,"ConstantBinder"),Sr(CrossFadedConstantBinder,"CrossFadedConstantBinder"),Sr(SourceExpressionBinder,"SourceExpressionBinder"),Sr(CrossFadedCompositeBinder,"CrossFadedCompositeBinder"),Sr(CompositeExpressionBinder,"CompositeExpressionBinder"),Sr(ProgramConfiguration,"ProgramConfiguration",{omit:["_buffers"]}),Sr(ProgramConfigurationSet,"ProgramConfigurationSet");const Ti="-transition";class StyleLayer extends Evented{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 Layout(e.layout)),e.paint)){this._transitionablePaint=new Transitionable(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 PossiblyEvaluated(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(fn,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return g(t,Ti)?this._transitionablePaint.getTransition(t.slice(0,-Ti.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(dn,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(g(t,Ti))return this._transitionablePaint.setTransition(t.slice(0,-Ti.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 a=this._transitionablePaint._values[t].value;return a.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,s,a)}}_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 ErrorEvent(new Error(n.message))),r=!0;return r}(this,t.call(pn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:Tr,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 PossiblyEvaluatedPropertyValue&&Ee(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=qr(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const zi=di([{name:"a_pos",components:2,type:"Int16"}],4),Ei=di([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class SegmentVector{constructor(t=[]){this.segments=t}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>SegmentVector.MAX_VERTEX_ARRAY_LENGTH&&_(`Max vertices per segment is ${SegmentVector.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>SegmentVector.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 SegmentVector([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}SegmentVector.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Sr(SegmentVector,"SegmentVector");var Di=8192;class LngLatBounds{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 LngLat?new LngLat(t.lng,t.lat):LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof LngLat?new LngLat(t.lng,t.lat):LngLat.convert(t),this}extend(t){const e=this._sw,r=this._ne;let n,i;if(t instanceof LngLat)n=t,i=t;else{if(!(t instanceof LngLatBounds))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(LngLatBounds.convert(t)):this.extend(LngLat.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 LngLat(n.lng,n.lat),this._ne=new LngLat(i.lng,i.lat)),this}getCenter(){return new LngLat((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 LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new LngLat(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}=LngLat.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 LngLatBounds?t:new LngLatBounds(t)}}const Bi=6371008.8;class LngLat{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 LngLat(c(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 Bi*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 LngLatBounds(new LngLat(this.lng-r,this.lat-e),new LngLat(this.lng+r,this.lat+e))}static convert(t){if(t instanceof LngLat)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new LngLat(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new LngLat(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 Li=2*Math.PI*Bi;function Vi(t){return Li*Math.cos(t*Math.PI/180)}function Fi(t){return(180+t)/360}function Ri(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ji(t,e){return t/Vi(e)}function Oi(t){return 360*t-180}function Ui(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}const $i=85.051129;class MercatorCoordinate{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){const r=LngLat.convert(t);return new MercatorCoordinate(Fi(r.lng),Ri(r.lat),ji(e,r.lat))}toLngLat(){return new LngLat(Oi(this.x),Ui(this.y))}toAltitude(){return this.z*Vi(Ui(this.y))}meterInMercatorCoordinateUnits(){return 1/Li*(t=Ui(this.y),1/Math.cos(t*Math.PI/180));var t}}function qi(t,e,n,i,s,a,o,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 a=r-i,o=n-s;return Math.abs((n-e)*a-(r-t)*o)/Math.hypot(a,o)}(p.x,p.y,a.x,a.y,o.x,o.y)>=u?(qi(t,e,n,c,h,a,p,l,u),qi(t,c,h,i,s,p,o,l,u)):t.push(o)}function Ni(t,e,r){let n=t[0],i=n.x,s=n.y;e(n);const a=[n];for(let o=1;o<t.length;o++){const l=t[o],{x:u,y:c}=l;e(l),qi(a,i,s,u,c,n,l,e,r),i=u,s=c,n=l}return a}function Zi(t,e,r,n,i){if(i(e,r)){const s=e.add(r).mult(.5);n(s),Zi(t,e,s,n,i),Zi(t,s,r,n,i)}else t.push(r)}function Gi(t,e,r){let n=t[0];e(n);const i=[n];for(let s=1;s<t.length;s++){const a=t[s];e(a),Zi(i,n,a,e,r),n=a}return i}const Xi=Math.pow(2,14)-1,Yi=-Xi-1;function Ji(t,e){const r=Math.round(t.x*e),n=Math.round(t.y*e);return t.x=u(r,Yi,Xi),t.y=u(n,Yi,Xi),(r<t.x||r>t.x+1||n<t.y||n>t.y+1)&&_("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function Ki(t,e,r){const n=t.loadGeometry(),i=t.extent,s=Di/i;if(e&&r&&r.projection.isReprojectedInTileSpace){const s=1<<e.z,{scale:a,x:o,y:l,projection:u}=r,c=t=>{const r=Oi((e.x+t.x/i)/s),n=Ui((e.y+t.y/i)/s),c=u.project(r,n);t.x=(c.x*a-o)*i,t.y=(c.y*a-l)*i};for(let e=0;e<n.length;e++)if(1!==t.type)n[e]=Ni(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)Ji(e,s);return n}function Wi(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Ki(t):[]}}function Hi(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}function Qi(t,e,r){const n=16384;t.emplaceBack(e.x,e.y,e.z,r[0]*n,r[1]*n,r[2]*n)}class CircleBucket{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.projection=t.projection,this.layoutVertexArray=new StructArrayLayout2i4,this.indexArray=new StructArrayLayout3ui6,this.segments=new SegmentVector,this.programConfigurations=new ProgramConfigurationSet(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 a=null;"circle"===i.type&&(a=i.layout.get("circle-sort-key"));for(const{feature:e,id:i,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Wi(e,t);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),u,r))continue;const c=a?a.evaluate(u,{},r):void 0,h={id:i,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Ki(e,r,n),patterns:{},sortKey:c};s.push(h)}a&&s.sort(((t,e)=>t.sortKey-e.sortKey));let o=null;"globe"===n.projection.name&&(this.globeExtVertexArray=new CircleGlobeExtArray,o=n.projection);for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n,l=t[s].feature;this.addFeature(n,i,s,e.availableImages,r,o),e.featureIndex.insert(l,i,s,a,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,zi.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,Ei.members))),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(t,e,r,n,i,s){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=Di||n<0||n>=Di)continue;if(s){const t=s.projectTilePoint(r,n,i),e=s.upVector(i,r,n),a=this.globeExtVertexArray;Qi(a,t,e),Qi(a,t,e),Qi(a,t,e),Qi(a,t,e)}const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=a.vertexLength;Hi(this.layoutVertexArray,r,n,-1,-1),Hi(this.layoutVertexArray,r,n,1,-1),Hi(this.layoutVertexArray,r,n,1,1),Hi(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+2,o+3),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n,i)}}function ts(t,e){for(let r=0;r<t.length;r++)if(us(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(us(t,e[r]))return!0;return!!is(t,e)}function es(t,e,r){return!!us(t,e)||!!as(e,t,r)}function rs(t,e){if(1===t.length)return ls(e,t[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++)if(us(t,n[e]))return!0}for(let r=0;r<t.length;r++)if(ls(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(is(t,e[r]))return!0;return!1}function ns(t,e,r){if(t.length>1){if(is(t,e))return!0;for(let n=0;n<e.length;n++)if(as(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(as(t[n],e,r))return!0;return!1}function is(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(ss(n,i,e[t],e[t+1]))return!0}return!1}function ss(t,e,r,n){return w(t,r,n)!==w(e,r,n)&&w(t,e,r)!==w(t,e,n)}function as(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(os(t,e[r-1],e[r])<n)return!0;return!1}function os(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 ls(t,e){let r,n,i,s=!1;for(let a=0;a<t.length;a++){r=t[a];for(let t=0,a=r.length-1;t<r.length;a=t++)n=r[t],i=r[a],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s)}return s}function us(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const s=t[n],a=t[i];s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function cs(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=w(t,e,r[0]);return s!==w(t,e,r[1])||s!==w(t,e,r[2])||s!==w(t,e,r[3])}function hs(t,e,r){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function ps(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ds(t,e,n,i,s){if(!e[0]&&!e[1])return t;const a=r.convert(e)._mult(s);"viewport"===n&&a._rotate(-i);const o=[];for(let e=0;e<t.length;e++)o.push(t[e].sub(a));return o}function fs(t,e,n,i){const s=r.convert(t)._mult(i);return"viewport"===e&&s._rotate(-n),s}Sr(CircleBucket,"CircleBucket",{omit:["layers"]});const ys=new Properties({"circle-sort-key":new DataDrivenProperty(Tr.layout_circle["circle-sort-key"])});var ms={paint:new Properties({"circle-radius":new DataDrivenProperty(Tr.paint_circle["circle-radius"]),"circle-color":new DataDrivenProperty(Tr.paint_circle["circle-color"]),"circle-blur":new DataDrivenProperty(Tr.paint_circle["circle-blur"]),"circle-opacity":new DataDrivenProperty(Tr.paint_circle["circle-opacity"]),"circle-translate":new DataConstantProperty(Tr.paint_circle["circle-translate"]),"circle-translate-anchor":new DataConstantProperty(Tr.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new DataConstantProperty(Tr.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new DataConstantProperty(Tr.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new DataDrivenProperty(Tr.paint_circle["circle-stroke-width"]),"circle-stroke-color":new DataDrivenProperty(Tr.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new DataDrivenProperty(Tr.paint_circle["circle-stroke-opacity"])}),layout:ys},gs=1e-6,xs="undefined"!=typeof Float32Array?Float32Array:Array;function vs(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 bs(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],d=e[11],f=e[12],y=e[13],m=e[14],g=e[15],x=r*o-n*a,v=r*l-i*a,b=r*u-s*a,_=n*l-i*o,w=n*u-s*o,S=i*u-s*l,A=c*y-h*f,k=c*m-p*f,I=c*g-d*f,M=h*m-p*y,P=h*g-d*y,C=p*g-d*m,T=x*C-v*P+b*M+_*I-w*k+S*A;return T?(t[0]=(o*C-l*P+u*M)*(T=1/T),t[1]=(i*P-n*C-s*M)*T,t[2]=(y*S-m*w+g*_)*T,t[3]=(p*w-h*S-d*_)*T,t[4]=(l*I-a*C-u*k)*T,t[5]=(r*C-i*I+s*k)*T,t[6]=(m*b-f*S-g*v)*T,t[7]=(c*S-p*b+d*v)*T,t[8]=(a*P-o*I+u*A)*T,t[9]=(n*I-r*P-s*A)*T,t[10]=(f*w-y*b+g*x)*T,t[11]=(h*b-c*w-d*x)*T,t[12]=(o*k-a*M-l*A)*T,t[13]=(r*M-n*k+i*A)*T,t[14]=(y*v-f*_-m*x)*T,t[15]=(c*_-h*v+p*x)*T,t):null}function _s(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],y=e[12],m=e[13],g=e[14],x=e[15],v=r[0],b=r[1],_=r[2],w=r[3];return t[0]=v*n+b*o+_*h+w*y,t[1]=v*i+b*l+_*p+w*m,t[2]=v*s+b*u+_*d+w*g,t[3]=v*a+b*c+_*f+w*x,t[4]=(v=r[4])*n+(b=r[5])*o+(_=r[6])*h+(w=r[7])*y,t[5]=v*i+b*l+_*p+w*m,t[6]=v*s+b*u+_*d+w*g,t[7]=v*a+b*c+_*f+w*x,t[8]=(v=r[8])*n+(b=r[9])*o+(_=r[10])*h+(w=r[11])*y,t[9]=v*i+b*l+_*p+w*m,t[10]=v*s+b*u+_*d+w*g,t[11]=v*a+b*c+_*f+w*x,t[12]=(v=r[12])*n+(b=r[13])*o+(_=r[14])*h+(w=r[15])*y,t[13]=v*i+b*l+_*p+w*m,t[14]=v*s+b*u+_*d+w*g,t[15]=v*a+b*c+_*f+w*x,t}function ws(t,e,r){var n,i,s,a,o,l,u,c,h,p,d,f,y=r[0],m=r[1],g=r[2];return 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],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],t[0]=n=e[0],t[1]=i,t[2]=s,t[3]=a,t[4]=o,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=d,t[11]=f,t[12]=n*y+o*m+h*g+e[12],t[13]=i*y+l*m+p*g+e[13],t[14]=s*y+u*m+d*g+e[14],t[15]=a*y+c*m+f*g+e[15]),t}function Ss(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 As(){var t=new xs(3);return xs!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ks(t){var e=new xs(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Is(t){return Math.hypot(t[0],t[1],t[2])}function Ms(t,e,r){var n=new xs(3);return n[0]=t,n[1]=e,n[2]=r,n}function Ps(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function Cs(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function Ts(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 zs(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}function Es(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ds(t,e,r){var n=e[0],i=e[1],s=e[2],a=r[3]*n+r[7]*i+r[11]*s+r[15];return t[0]=(r[0]*n+r[4]*i+r[8]*s+r[12])/(a=a||1),t[1]=(r[1]*n+r[5]*i+r[9]*s+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*s+r[14])/a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Bs,Ls=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t};function Vs(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*a,t}function Fs(){var t=new xs(4);return xs!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}As(),function(){var t;t=new xs(4),xs!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),As(),Ms(1,0,0),Ms(0,1,0),Fs(),Fs(),Bs=new xs(9),xs!=Float32Array&&(Bs[1]=0,Bs[2]=0,Bs[3]=0,Bs[5]=0,Bs[6]=0,Bs[7]=0),Bs[0]=1,Bs[4]=1,Bs[8]=1;class Ray{constructor(t,e){this.pos=t,this.dir=e}intersectsPlane(t,e,r){const n=Es(e,this.dir);if(Math.abs(n)<1e-6)return!1;const i=((t[0]-this.pos[0])*e[0]+(t[1]-this.pos[1])*e[1]+(t[2]-this.pos[2])*e[2])/n;return r[0]=this.pos[0]+this.dir[0]*i,r[1]=this.pos[1]+this.dir[1]*i,r[2]=this.pos[2]+this.dir[2]*i,!0}closestPointOnSphere(t,e,r){if(function(t,e){var r=t[0],n=t[1],i=t[2],s=e[0],a=e[1],o=e[2];return Math.abs(r-s)<=gs*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-a)<=gs*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-o)<=gs*Math.max(1,Math.abs(i),Math.abs(o))}(this.pos,t)||0===e)return r[0]=r[1]=r[2]=0,!1;const[n,i,s]=this.dir,a=this.pos[0]-t[0],o=this.pos[1]-t[1],l=this.pos[2]-t[2],u=n*n+i*i+s*s,c=2*(a*n+o*i+l*s),h=c*c-4*u*(a*a+o*o+l*l-e*e);if(h<0){const t=Math.max(-c/2,0),u=a+n*t,h=o+i*t,p=l+s*t,d=Math.hypot(u,h,p);return r[0]=u*e/d,r[1]=h*e/d,r[2]=p*e/d,!1}{const t=(-c-Math.sqrt(h))/(2*u);if(t<0){const t=Math.hypot(a,o,l);return r[0]=a*e/t,r[1]=o*e/t,r[2]=l*e/t,!1}return r[0]=a+n*t,r[1]=o+i*t,r[2]=l+s*t,!0}}}class Aabb{static fromPoints(t){const e=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],r=[Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE];for(const n of t)e[0]=Math.min(e[0],n[0]),e[1]=Math.min(e[1],n[1]),e[2]=Math.min(e[2],n[2]),r[0]=Math.max(r[0],n[0]),r[1]=Math.max(r[1],n[1]),r[2]=Math.max(r[2],n[2]);return new Aabb(e,r)}constructor(t,e){this.min=t,this.max=e,this.center=Cs([],Ps([],this.min,this.max),.5)}quadrant(t){const e=[t%2==0,t<2],r=ks(this.min),n=ks(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 Aabb(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 n=0;n<t.planes.length;n++){const i=t.planes[n];let s=0;for(let t=0;t<e.length;t++)s+=Es(i,e[t])+i[3]>=0;if(0===s)return 0;s!==e.length&&(r=!1)}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 Rs(t,e,r,n,i,s,a,o,l){if(s&&t.queryGeometry.isAboveHorizon)return!1;s&&(l*=t.pixelToTileUnitsFactor);const u=t.tileID.canonical,c=r.projection.upVectorScale(u,r.center.lat,r.worldSize).metersToTile;for(const h of e)for(const e of h){const h=e.add(o),p=i&&r.elevation?r.elevation.exaggeration()*i.getElevationAt(h.x,h.y,!0):0,d=r.projection.projectTilePoint(h.x,h.y,u);if(p>0){const t=r.projection.upVector(u,h.x,h.y);d.x+=t[0]*c*p,d.y+=t[1]*c*p,d.z+=t[2]*c*p}const f=s?h:js(d.x,d.y,d.z,n),y=s?t.tilespaceRays.map((t=>$s(t,p))):t.queryGeometry.screenGeometry,m=Vs([],[d.x,d.y,d.z,1],n);if(!a&&s?l*=m[3]/r.cameraToCenterDistance:a&&!s&&(l*=r.cameraToCenterDistance/m[3]),s){const t=Ui((e.y/Di+u.y)/(1<<u.z));l/=r.projection.pixelsPerMeter(t,1)/ji(1,t)}if(es(y,f,l))return!0}return!1}function js(t,e,n,i){const s=Vs([],[t,e,n,1],i);return new r(s[0]/s[3],s[1]/s[3])}const Os=Ms(0,0,0),Us=Ms(0,0,1);function $s(t,e){const n=As();return Os[2]=e,t.intersectsPlane(Os,Us,n),new r(n[0],n[1])}class HeatmapBucket extends CircleBucket{}function qs(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError("mismatched image size")}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function Ns(t,e,r){const{width:n,height:i}=e;n===t.width&&i===t.height||(Zs(t,e,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},r),t.width=n,t.height=i,t.data=e.data)}function Zs(t,e,r,n,i,s){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,o=e.data;for(let l=0;l<i.height;l++){const u=((r.y+l)*t.width+r.x)*s,c=((n.y+l)*e.width+n.x)*s;for(let t=0;t<i.width*s;t++)o[c+t]=a[u+t]}return e}Sr(HeatmapBucket,"HeatmapBucket",{omit:["layers"]});class AlphaImage{constructor(t,e){qs(this,t,1,e)}resize(t){Ns(this,new AlphaImage(t),1)}clone(){return new AlphaImage({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){Zs(t,e,r,n,i,1)}}class RGBAImage{constructor(t,e){qs(this,t,4,e)}resize(t){Ns(this,new RGBAImage(t),4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new RGBAImage({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){Zs(t,e,r,n,i,4)}}Sr(AlphaImage,"AlphaImage"),Sr(RGBAImage,"RGBAImage");var Gs={paint:new Properties({"heatmap-radius":new DataDrivenProperty(Tr.paint_heatmap["heatmap-radius"]),"heatmap-weight":new DataDrivenProperty(Tr.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new DataConstantProperty(Tr.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ColorRampProperty(Tr.paint_heatmap["heatmap-color"]),"heatmap-opacity":new DataConstantProperty(Tr.paint_heatmap["heatmap-opacity"])})};function Xs(t){const e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new RGBAImage({width:r,height:n}),s=(r,n,s)=>{e[t.evaluationKey]=s;const a=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*a.r/a.a),i.data[r+n+1]=Math.floor(255*a.g/a.a),i.data[r+n+2]=Math.floor(255*a.b/a.a),i.data[r+n+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,a=0;n<r;n++,a+=4){const o=n/(r-1),{start:l,end:u}=t.clips[e];s(i,a,l*(1-o)+u*o)}else for(let t=0,e=0;t<r;t++,e+=4)s(0,e,t/(r-1));return i}var Ys={paint:new Properties({"hillshade-illumination-direction":new DataConstantProperty(Tr.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new DataConstantProperty(Tr.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new DataConstantProperty(Tr.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new DataConstantProperty(Tr.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new DataConstantProperty(Tr.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new DataConstantProperty(Tr.paint_hillshade["hillshade-accent-color"])})};const Js=di([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ks}=Js;var Ws=Qs,Hs=Qs;function Qs(t,e,r){r=r||2;var n,i,s,a,o,l,u,c=e&&e.length,h=c?e[0]*r:t.length,p=ta(t,0,h,r,!0),d=[];if(!p||p.next===p.prev)return d;if(c&&(p=function(t,e,r,n){var i,s,a,o=[];for(i=0,s=e.length;i<s;i++)(a=ta(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),o.push(ha(a));for(o.sort(oa),i=0;i<o.length;i++)r=la(o[i],r);return r}(t,e,p,r)),t.length>80*r){n=s=t[0],i=a=t[1];for(var f=r;f<h;f+=r)(o=t[f])<n&&(n=o),(l=t[f+1])<i&&(i=l),o>s&&(s=o),l>a&&(a=l);u=0!==(u=Math.max(s-n,a-i))?32767/u:0}return ra(p,d,r,n,i,u,0),d}function ta(t,e,r,n,i){var s,a;if(i===Aa(t,e,r,n)>0)for(s=e;s<r;s+=n)a=_a(s,t[s],t[s+1],a);else for(s=r-n;s>=e;s-=n)a=_a(s,t[s],t[s+1],a);return a&&ya(a,a.next)&&(wa(a),a=a.next),a}function ea(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!ya(n,n.next)&&0!==fa(n.prev,n,n.next))n=n.next;else{if(wa(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function ra(t,e,r,n,i,s,a){if(t){!a&&s&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=ca(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,s,a,o,l,u=1;do{for(r=t,t=null,s=null,a=0;r;){for(a++,n=r,o=0,e=0;e<u&&(o++,n=n.nextZ);e++);for(l=u;o>0||l>0&&n;)0!==o&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=n}s.nextZ=null,u*=2}while(a>1)}(i)}(t,n,i,s);for(var o,l,u=t;t.prev!==t.next;)if(o=t.prev,l=t.next,s?ia(t,n,i,s):na(t))e.push(o.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),wa(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?ra(t=sa(ea(t),e,r),e,r,n,i,s,2):2===a&&aa(t,e,r,n,i,s):ra(ea(t),e,r,n,i,s,1);break}}}function na(t){var e=t.prev,r=t,n=t.next;if(fa(e,r,n)>=0)return!1;for(var i=e.x,s=r.x,a=n.x,o=e.y,l=r.y,u=n.y,c=i<s?i<a?i:a:s<a?s:a,h=o<l?o<u?o:u:l<u?l:u,p=i>s?i>a?i:a:s>a?s:a,d=o>l?o>u?o:u:l>u?l:u,f=n.next;f!==e;){if(f.x>=c&&f.x<=p&&f.y>=h&&f.y<=d&&pa(i,o,s,l,a,u,f.x,f.y)&&fa(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function ia(t,e,r,n){var i=t.prev,s=t,a=t.next;if(fa(i,s,a)>=0)return!1;for(var o=i.x,l=s.x,u=a.x,c=i.y,h=s.y,p=a.y,d=o<l?o<u?o:u:l<u?l:u,f=c<h?c<p?c:p:h<p?h:p,y=o>l?o>u?o:u:l>u?l:u,m=c>h?c>p?c:p:h>p?h:p,g=ca(d,f,e,r,n),x=ca(y,m,e,r,n),v=t.prevZ,b=t.nextZ;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=d&&v.x<=y&&v.y>=f&&v.y<=m&&v!==i&&v!==a&&pa(o,c,l,h,u,p,v.x,v.y)&&fa(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,b.x>=d&&b.x<=y&&b.y>=f&&b.y<=m&&b!==i&&b!==a&&pa(o,c,l,h,u,p,b.x,b.y)&&fa(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=y&&v.y>=f&&v.y<=m&&v!==i&&v!==a&&pa(o,c,l,h,u,p,v.x,v.y)&&fa(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=d&&b.x<=y&&b.y>=f&&b.y<=m&&b!==i&&b!==a&&pa(o,c,l,h,u,p,b.x,b.y)&&fa(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function sa(t,e,r){var n=t;do{var i=n.prev,s=n.next.next;!ya(i,s)&&ma(i,n,n.next,s)&&va(i,s)&&va(s,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(s.i/r|0),wa(n),wa(n.next),n=t=s),n=n.next}while(n!==t);return ea(n)}function aa(t,e,r,n,i,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&da(a,o)){var l=ba(a,o);return a=ea(a,a.next),l=ea(l,l.next),ra(a,e,r,n,i,s,0),void ra(l,e,r,n,i,s,0)}o=o.next}a=a.next}while(a!==t)}function oa(t,e){return t.x-e.x}function la(t,e){var r=function(t,e){var r,n=e,i=t.x,s=t.y,a=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var o=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(o<=i&&o>a&&(a=o,r=n.x<n.next.x?n:n.next,o===i))return r}n=n.next}while(n!==e);if(!r)return null;var l,u=r,c=r.x,h=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&pa(s<h?i:a,s,c,h,s<h?a:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),va(n,t)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&ua(r,n)))&&(r=n,p=l)),n=n.next}while(n!==u);return r}(t,e);if(!r)return e;var n=ba(r,t);return ea(n,n.next),ea(r,r.next)}function ua(t,e){return fa(t.prev,t,e.prev)<0&&fa(e.next,t,t.next)<0}function ca(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ha(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,a,o){return(i-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(n-o)>=(r-a)*(e-o)&&(r-a)*(s-o)>=(i-a)*(n-o)}function da(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&ma(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(va(t,e)&&va(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)&&(fa(t.prev,t,e.prev)||fa(t,e.prev,e))||ya(t,e)&&fa(t.prev,t,t.next)>0&&fa(e.prev,e,e.next)>0)}function fa(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ya(t,e){return t.x===e.x&&t.y===e.y}function ma(t,e,r,n){var i=xa(fa(t,e,r)),s=xa(fa(t,e,n)),a=xa(fa(r,n,t)),o=xa(fa(r,n,e));return i!==s&&a!==o||!(0!==i||!ga(t,r,e))||!(0!==s||!ga(t,n,e))||!(0!==a||!ga(r,t,n))||!(0!==o||!ga(r,e,n))}function ga(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 xa(t){return t>0?1:t<0?-1:0}function va(t,e){return fa(t.prev,t,t.next)<0?fa(t,e,t.next)>=0&&fa(t,t.prev,e)>=0:fa(t,e,t.prev)<0||fa(t,t.next,e)<0}function ba(t,e){var r=new Sa(t.i,t.x,t.y),n=new Sa(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 _a(t,e,r,n){var i=new Sa(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 wa(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 Sa(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Aa(t,e,r,n){for(var i=0,s=e,a=r-n;s<r;s+=n)i+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return i}function ka(t,e,r,n,i){Ia(t,e,r||0,n||t.length-1,i||Pa)}function Ia(t,e,r,n,i){for(;n>r;){if(n-r>600){var s=n-r+1,a=e-r+1,o=Math.log(s),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(s-l)/s)*(a-s/2<0?-1:1);Ia(t,e,Math.max(r,Math.floor(e-a*l/s+u)),Math.min(n,Math.floor(e+(s-a)*l/s+u)),i)}var c=t[e],h=r,p=n;for(Ma(t,r,e),i(t[n],c)>0&&Ma(t,r,n);h<p;){for(Ma(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--}0===i(t[r],c)?Ma(t,r,p):Ma(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1)}}function Ma(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Pa(t,e){return t<e?-1:t>e?1:0}function Ca(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=S(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||(ka(n[t],e,1,n[t].length-1,Ta),n[t]=n[t].slice(0,e));return n}function Ta(t,e){return e.area-t.area}function za(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 Ea(t,e,r,n,i){const s=i.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},r,{},i.availableImages),o=e.evaluate({zoom:n},r,{},i.availableImages),l=e.evaluate({zoom:n+1},r,{},i.availableImages);t=t&&t.name?t.name:t,o=o&&o.name?o.name:o,l=l&&l.name?l.name:l,s[t]=!0,s[o]=!0,s[l]=!0,r.patterns[a.id]={min:t,mid:o,max:l}}}return r}Qs.deviation=function(t,e,r,n){var i=e&&e.length,s=Math.abs(Aa(t,0,i?e[0]*r:t.length,r));if(i)for(var a=0,o=e.length;a<o;a++)s-=Math.abs(Aa(t,e[a]*r,a<o-1?e[a+1]*r:t.length,r));var l=0;for(a=0;a<n.length;a+=3){var u=n[a]*r,c=n[a+1]*r,h=n[a+2]*r;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},Qs.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var a=0;a<e;a++)r.vertices.push(t[i][s][a]);i>0&&r.holes.push(n+=t[i-1].length)}return r},Ws.default=Hs;class FillBucket{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 StructArrayLayout2i4,this.indexArray=new StructArrayLayout3ui6,this.indexArray2=new StructArrayLayout2ui4,this.programConfigurations=new ProgramConfigurationSet(t.layers,t.zoom),this.segments=new SegmentVector,this.segments2=new SegmentVector,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.projection=t.projection}populate(t,e,r,n){this.hasPattern=za("fill",this.layers,e);const i=this.layers[0].layout.get("fill-sort-key"),s=[];for(const{feature:a,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Wi(a,t);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),c,r))continue;const h=i?i.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Ki(a,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:a}=n;if(this.hasPattern){const t=Ea("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,a,this.index)}}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}addFeatures(t,e,r,n,i){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,Ks),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 Ca(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),i.push(e[t].x),i.push(e[t].y);r.vertexLength+=e.length,r.primitiveLength+=e.length}const a=Ws(i,s);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(n+a[t],n+a[t+1],n+a[t+2]);r.vertexLength+=e,r.primitiveLength+=a.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n)}}Sr(FillBucket,"FillBucket",{omit:["layers","patternFeatures"]});const Da=new Properties({"fill-sort-key":new DataDrivenProperty(Tr.layout_fill["fill-sort-key"])});var Ba={paint:new Properties({"fill-antialias":new DataConstantProperty(Tr.paint_fill["fill-antialias"]),"fill-opacity":new DataDrivenProperty(Tr.paint_fill["fill-opacity"]),"fill-color":new DataDrivenProperty(Tr.paint_fill["fill-color"]),"fill-outline-color":new DataDrivenProperty(Tr.paint_fill["fill-outline-color"]),"fill-translate":new DataConstantProperty(Tr.paint_fill["fill-translate"]),"fill-translate-anchor":new DataConstantProperty(Tr.paint_fill["fill-translate-anchor"]),"fill-pattern":new CrossFadedDataDrivenProperty(Tr.paint_fill["fill-pattern"])}),layout:Da};const La=di([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Va=di([{name:"a_centroid_pos",components:2,type:"Uint16"}]),Fa=di([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:Ra}=La;var ja=Oa;function Oa(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(Ua,this,e)}function Ua(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 $a(t){for(var e,r,n=0,i=0,s=t.length,a=s-1;i<s;a=i++)n+=((r=t[a]).x-(e=t[i]).x)*(e.y+r.y);return n}Oa.types=["Unknown","Point","LineString","Polygon"],Oa.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,i=1,s=0,a=0,o=0,l=[];t.pos<n;){if(s<=0){var u=t.readVarint();i=7&u,s=u>>3}if(s--,1===i||2===i)a+=t.readSVarint(),o+=t.readSVarint(),1===i&&(e&&l.push(e),e=[]),e.push(new r(a,o));else{if(7!==i)throw new Error("unknown command "+i);e&&e.push(e[0].clone())}}return e&&l.push(e),l},Oa.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<a&&(a=i),i>o&&(o=i),(s+=t.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,o,u]},Oa.prototype.toGeoJSON=function(t,e,r){var n,i,s=this.extent*Math.pow(2,r),a=this.extent*t,o=this.extent*e,l=this.loadGeometry(),u=Oa.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+a)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+o)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],s=0;s<e;s++){var a=$a(t[s]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(r&&i.push(r),r=[t[s]]):r.push(t[s]))}return r&&i.push(r),i}(l),n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)c(l[n][i])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var qa=Na;function Na(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(Za,this,e),this.length=this._features.length}function Za(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 Ga(t,e,r){if(3===t){var n=new qa(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}Na.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 ja(this._pbf,e,this.extent,this._keys,this._values)};var Xa={VectorTile:function(t,e){this.layers=t.readFields(Ga,{},e)},VectorTileFeature:ja,VectorTileLayer:qa};function Ya(t,e,n,i){const s=[],a=0===i?(t,e,n,i,s,a)=>{t.push(new r(a,n+(a-e)/(i-e)*(s-n)))}:(t,e,n,i,s,a)=>{t.push(new r(e+(a-n)/(s-n)*(i-e),a))};for(const r of t){const t=[];for(const s of r){if(s.length<=2)continue;const r=[];for(let t=0;t<s.length-1;t++){const o=s[t].x,l=s[t].y,u=s[t+1].x,c=s[t+1].y,h=0===i?o:l,p=0===i?u:c;h<e?p>e&&a(r,o,l,u,c,e):h>n?p<n&&a(r,o,l,u,c,n):r.push(s[t]),p<e&&h>=e&&a(r,o,l,u,c,e),p>n&&h<=n&&a(r,o,l,u,c,n)}let o=s[s.length-1];const l=0===i?o.x:o.y;l>=e&&l<=n&&r.push(o),r.length&&(o=r[r.length-1],r[0].x===o.x&&r[0].y===o.y||r.push(r[0]),t.push(r))}t.length&&s.push(t)}return s}const Ja=Xa.VectorTileFeature.types,Ka=Math.pow(2,13);function Wa(t,e,r,n,i,s,a,o){t.emplaceBack((e<<1)+a,(r<<1)+s,(Math.floor(n*Ka)<<1)+i,Math.round(o))}function Ha(t,e,r){const n=16384;t.emplaceBack(e.x,e.y,e.z,r[0]*n,r[1]*n,r[2]*n)}class PartMetadata{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);const r=this.min,n=this.max;t.x<r.x?r.x=t.x:t.x>n.x&&(n.x=t.x),t.y<r.y?r.y=t.y:t.y>n.y&&(n.y=t.y),((0===t.x||t.x===Di)&&t.x===e.x)!=((0===t.y||t.y===Di)&&t.y===e.y)&&this.processBorderOverlap(t,e),e.x<0!=t.x<0&&this.addBorderIntersection(0,jt(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>Di!=t.x>Di&&this.addBorderIntersection(1,jt(e.y,t.y,(Di-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,jt(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>Di!=t.y>Di&&this.addBorderIntersection(3,jt(e.x,t.x,(Di-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 FillExtrusionBucket{constructor(t){this.zoom=t.zoom,this.canonical=t.canonical,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=t.projection,this.layoutVertexArray=new StructArrayLayout4i8,this.centroidVertexArray=new FillExtrusionCentroidArray,this.indexArray=new StructArrayLayout3ui6,this.programConfigurations=new ProgramConfigurationSet(t.layers,t.zoom),this.segments=new SegmentVector,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=za("fill-extrusion",this.layers,e),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-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)/Di/(1<<t.z)}(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;for(const{feature:i,id:s,index:a,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,l=Wi(i,t);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),l,r))continue;const u={id:s,sourceLayerIndex:o,index:a,geometry:t?l.geometry:Ki(i,r,n),properties:i.properties,type:i.type,patterns:{}},c=this.layoutVertexArray.length;this.hasPattern?this.features.push(Ea("fill-extrusion",this.layers,u,this.zoom,e)):this.addFeature(u,u.geometry,a,r,{},e.availableImages,n),e.featureIndex.insert(i,u.geometry,a,o,this.index,c)}this.sortBorders()}addFeatures(t,e,r,n,i){for(const t of this.features){const{geometry:s}=t;this.addFeature(t,s,t.index,e,r,n,i)}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,Ra),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=t.createVertexBuffer(this.layoutVertexExtArray,Fa.members,!0))),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,Va.members,!0),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,n,i,s,a,o){const l=[new r(0,0),new r(Di,Di)],u=o.projection,c="globe"===u.name,h=this.enableTerrain&&!c?new PartMetadata:null,p="Polygon"===Ja[t.type];c&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new FillExtrusionExtArray);const d=Ca(e,500);for(let t=d.length-1;t>=0;t--){const e=d[t];(0===e.length||(f=e[0]).every((t=>t.x<=0))||f.every((t=>t.x>=Di))||f.every((t=>t.y<=0))||f.every((t=>t.y>=Di)))&&d.splice(t,1)}var f;let y;if(c)y=so(d,l,i);else{y=[];for(const t of d)y.push({polygon:t,bounds:l})}const m=p?this.edgeRadius:0;for(const{polygon:t,bounds:e}of y){let r=0,n=0;for(const e of t)p&&!e[0].equals(e[e.length-1])&&e.push(e[0]),n+=p?e.length-1:e.length;const s=this.segments.prepareSegment((p?5:4)*n,this.layoutVertexArray,this.indexArray);if(p){const e=[],n=[];r=s.vertexLength;for(const r of t){let a,o;r.length&&r!==t[0]&&n.push(e.length/2),a=r[1].sub(r[0])._perp()._unit();for(let t=1;t<r.length;t++){const n=r[t],l=r[t===r.length-1?1:t+1];let{x:h,y:p}=n;if(m){o=l.sub(n)._perp()._unit();const t=a.add(o)._unit(),e=m*Math.min(4,1/(a.x*t.x+a.y*t.y));h+=e*t.x,p+=e*t.y,a=o}Wa(this.layoutVertexArray,h,p,0,0,1,1,0),s.vertexLength++,e.push(n.x,n.y),c&&Ha(this.layoutVertexExtArray,u.projectTilePoint(h,p,i),u.upVector(i,h,p))}}const a=Ws(e,n);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(r+a[t],r+a[t+2],r+a[t+1]),s.primitiveLength++}for(const n of t){h&&n.length&&h.startRing(n[0]);let t,a,o,l=n.length>4&&no(n[n.length-2],n[0],n[1]),d=m?to(n[n.length-2],n[0],n[1],m):0;a=n[1].sub(n[0])._perp()._unit();for(let f=1,y=0;f<n.length;f++){let g=n[f-1],x=n[f];const v=n[f===n.length-1?1:f+1];if(h&&p&&h.currentPolyCount.top++,ro(x,g,e)){m&&(a=v.sub(x)._perp()._unit());continue}h&&h.append(x,g);const b=x.sub(g)._perp(),_=b.x/(Math.abs(b.x)+Math.abs(b.y)),w=b.y>0?1:0,S=g.dist(x);if(y+S>32768&&(y=0),m){o=v.sub(x)._perp()._unit();let t=eo(g,x,v,Qa(a,o),m);isNaN(t)&&(t=0);const e=x.sub(g)._unit();g=g.add(e.mult(d))._round(),x=x.add(e.mult(-t))._round(),d=t,a=o}const A=s.vertexLength,k=n.length>4&&no(g,x,v);let I=io(y,l,!0);if(Wa(this.layoutVertexArray,g.x,g.y,_,w,0,0,I),Wa(this.layoutVertexArray,g.x,g.y,_,w,0,1,I),y+=S,I=io(y,k,!1),l=k,Wa(this.layoutVertexArray,x.x,x.y,_,w,0,0,I),Wa(this.layoutVertexArray,x.x,x.y,_,w,0,1,I),s.vertexLength+=4,this.indexArray.emplaceBack(A+0,A+1,A+2),this.indexArray.emplaceBack(A+1,A+3,A+2),s.primitiveLength+=2,m){const i=r+(1===f?n.length-2:f-2),a=1===f?r:i+1;if(this.indexArray.emplaceBack(A+1,i,A+3),this.indexArray.emplaceBack(i,a,A+3),s.primitiveLength+=2,void 0===t&&(t=A),!ro(v,n[f],e)){const e=f===n.length-1?t:s.vertexLength;this.indexArray.emplaceBack(A+2,A+3,e),this.indexArray.emplaceBack(A+3,e+1,e),this.indexArray.emplaceBack(A+3,a,e+1),s.primitiveLength+=3}}if(c){const t=this.layoutVertexExtArray,e=u.projectTilePoint(g.x,g.y,i),r=u.projectTilePoint(x.x,x.y,i),n=u.upVector(i,g.x,g.y),s=u.upVector(i,x.x,x.y);Ha(t,e,n),Ha(t,e,n),Ha(t,r,s),Ha(t,r,s)}}p&&(r+=n.length-1)}}if(h&&h.polyCount.length>0){if(h.borders){h.vertexArrayOffset=this.centroidVertexArray.length;const t=h.borders,e=this.featuresOnBorder.push(h)-1;for(let r=0;r<4;r++)t[r][0]!==Number.MAX_VALUE&&this.borders[r].push(e)}this.encodeCentroid(h.borders?void 0:h.centroid(),h)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,s,a,i)}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<t.top;e++)this.centroidVertexArray.emplace(s++,n,i);for(let e=0;e<2*t.edges;e++)this.centroidVertexArray.emplace(s++,0,i),this.centroidVertexArray.emplace(s++,n,i)}}}function Qa(t,e){const r=t.add(e)._unit();return t.x*r.x+t.y*r.y}function to(t,e,r,n){const i=e.sub(t)._perp()._unit(),s=r.sub(e)._perp()._unit();return eo(t,e,r,Qa(i,s),n)}function eo(t,e,r,n,i){const s=Math.sqrt(1-n*n);return Math.min(t.dist(e)/3,e.dist(r)/3,i*s/n)}function ro(t,e,r){return t.x<r[0].x&&e.x<r[0].x||t.x>r[1].x&&e.x>r[1].x||t.y<r[0].y&&e.y<r[0].y||t.y>r[1].y&&e.y>r[1].y}function no(t,e,r){if(t.x<0||t.x>=Di||e.x<0||e.x>=Di||r.x<0||r.x>=Di)return!1;const n=r.sub(e),i=n.perp(),s=t.sub(e);return(n.x*s.x+n.y*s.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(s.x*s.x+s.y*s.y))>-.866&&i.x*s.x+i.y*s.y<0}function io(t,e,r){const n=e?2|t:-3&t;return r?1|n:-2&n}function so(t,e,n){const i=1<<n.z,s=Oi(n.x/i),a=Oi((n.x+1)/i),o=Ui(n.y/i),l=Ui((n.y+1)/i);return function(t,e,n,i,s=0,a){const o=[];if(!t.length||!n||!i)return o;const l=(t,e)=>{for(const r of t)o.push({polygon:r,bounds:e})},u=Math.ceil(Math.log2(n)),c=Math.ceil(Math.log2(i)),h=u-c,p=[];for(let t=0;t<Math.abs(h);t++)p.push(h>0?0:1);for(let t=0;t<Math.min(u,c);t++)p.push(0),p.push(1);let d=t;if(d=Ya(d,e[0].y-s,e[1].y+s,1),d=Ya(d,e[0].x-s,e[1].x+s,0),!d.length)return o;const f=[];for(p.length?f.push({polygons:d,bounds:e,depth:0}):l(d,e);f.length;){const t=f.pop(),e=t.depth,n=p[e],i=t.bounds[0],o=t.bounds[1],u=0===n?i.x:i.y,c=0===n?o.x:o.y,h=a?a(n,u,c):.5*(u+c),d=Ya(t.polygons,u-s,h+s,n),y=Ya(t.polygons,h-s,c+s,n);if(d.length){const t=[i,new r(0===n?h:o.x,1===n?h:o.y)];p.length>e+1?f.push({polygons:d,bounds:t,depth:e+1}):l(d,t)}if(y.length){const t=[new r(0===n?h:i.x,1===n?h:i.y),o];p.length>e+1?f.push({polygons:y,bounds:t,depth:e+1}):l(y,t)}}return o}(t,e,Math.ceil((a-s)/11.25),Math.ceil((o-l)/11.25),1,((t,e,r)=>{if(0===t)return.5*(e+r);{const t=Ui((n.y+e/Di)/i);return(Ri(.5*(Ui((n.y+r/Di)/i)+t))*i-n.y)*Di}}))}Sr(FillExtrusionBucket,"FillExtrusionBucket",{omit:["layers","features"]}),Sr(PartMetadata,"PartMetadata");const ao=new Properties({"fill-extrusion-edge-radius":new DataConstantProperty(Tr["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var oo={paint:new Properties({"fill-extrusion-opacity":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new DataDrivenProperty(Tr["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new CrossFadedDataDrivenProperty(Tr["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new DataDrivenProperty(Tr["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new DataDrivenProperty(Tr["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new DataConstantProperty(Tr["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:ao};function lo(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 CanonicalTileID{constructor(t,e,r){this.z=t,this.x=e,this.y=r,this.key=uo(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,a=lo(256*(n=this.x),256*(i=Math.pow(2,s)-i-1),s),o=lo(256*(n+1),256*(i+1),s),a[0]+","+a[1]+","+o[0]+","+o[1]);var n,i,s,a,o;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}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,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 UnwrappedTileID{constructor(t,e){this.wrap=t,this.canonical=e,this.key=uo(t,e.z,e.z,e.x,e.y)}}class OverscaledTileID{constructor(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new CanonicalTileID(r,+n,+i),this.key=0===e&&t===r?this.canonical.key:uo(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 OverscaledTileID(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new OverscaledTileID(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 uo(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-t;return uo(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 OverscaledTileID(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 OverscaledTileID(e,this.wrap,e,r,n),new OverscaledTileID(e,this.wrap,e,r+1,n),new OverscaledTileID(e,this.wrap,e,r,n+1),new OverscaledTileID(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 OverscaledTileID(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new OverscaledTileID(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 UnwrappedTileID(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function uo(t,e,r,n,i){const s=1<<Math.min(r,22);let a=s*(i%s)+n%s;return t&&r<22&&(a+=s*s*((t<0?-2*t-1:2*t)%(1<<2*(22-r)))),16*(32*a+r)+(e-r)}function co(t,e){return t.x*e.x+t.y*e.y}function ho(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){const s=e[r],a=t[0],o=i.sub(n),l=s.sub(n),u=a.sub(n),c=co(o,o),h=co(o,l),p=co(l,l),d=co(u,o),f=co(u,l),y=c*p-h*h,m=(p*d-h*f)/y,g=(c*f-h*d)/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 po(t){const e=new r(t[0],t[1]);return e.z=t[2],e}function fo(t,e,r,n,i,s,a,o){const l=a*i.getElevationAt(t,e,!0,!0),u=0!==s[0],c=u?0===s[1]?a*(s[0]/7-450):a*function(t,e,r){const n=Math.floor(e[0]/8),i=Math.floor(e[1]/8),s=10*(e[0]-8*n),a=10*(e[1]-8*i),o=t.getElevationAt(n,i,!0,!0),l=t.getMeterToDEM(r),u=Math.floor(.5*(s*l-1)),c=Math.floor(.5*(a*l-1)),h=t.tileCoordToPixel(n,i),p=2*u+1,d=2*c+1,f=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,d),y=Math.abs(f[0]-f[1]),m=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),x=Math.min(.25,.5*l*(y+m)/p),v=Math.min(.25,.5*l*g/d);return o+Math.max(x*s,v*a)}(i,s,o):l;return{base:l+(0===r)?-1:r,top:u?Math.max(c+n,l+r+2):l+n}}Sr(CanonicalTileID,"CanonicalTileID"),Sr(OverscaledTileID,"OverscaledTileID",{omit:["projMatrix"]});const yo=di([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:mo}=yo,go=di([{name:"a_packed",components:4,type:"Float32"}]),{members:xo}=go,vo=Xa.VectorTileFeature.types,bo=Math.cos(Math.PI/180*37.5);class LineBucket{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.projection=t.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new StructArrayLayout2i4ub1f12,this.layoutVertexArray2=new StructArrayLayout4f16,this.indexArray=new StructArrayLayout3ui6,this.programConfigurations=new ProgramConfigurationSet(t.layers,t.zoom),this.segments=new SegmentVector,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r,n){this.hasPattern=za("line",this.layers,e);const i=this.layers[0].layout.get("line-sort-key"),s=[];for(const{feature:e,id:a,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Wi(e,t);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),u,r))continue;const c=i?i.evaluate(u,{},r):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Ki(e,r,n),patterns:{},sortKey:c};s.push(h)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));const{lineAtlas:a,featureIndex:o}=e,l=this.addConstantDashes(a);for(const n of s){const{geometry:i,index:s,sourceLayerIndex:u}=n;if(l&&this.addFeatureDashes(n,a),this.hasPattern){const t=Ea("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,a.positions,e.availableImages);o.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 a,o,l,u,c,h;if("constant"===i.kind){const t=i.value;if(!t)continue;a=t.other||t.to,o=t.to,l=t.from}else a=i.evaluate({zoom:r-1},t),o=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(a,u),e.addDash(o,c),e.addDash(l,h);const p=e.getKey(a,u),d=e.getKey(o,c),f=e.getKey(l,h);t.patterns[n.id]={min:p,mid:d,max:f}}}update(t,e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r,n)}addFeatures(t,e,r,n,i){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,xo)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,mo),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 a=this.layers[0].layout,o=a.get("line-join").evaluate(t,{}),l=a.get("line-cap").evaluate(t,{}),u=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,o,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 a="Polygon"===vo[e.type];let o=t.length;for(;o>=2&&t[o-1].equals(t[o-2]);)o--;let l=0;for(;l<o-1&&t[l].equals(t[l+1]);)l++;if(o<(a?3:2))return;"bevel"===r&&(i=1.05);const u=this.overscaling<=16?122880/(512*this.overscaling):0,c=this.segments.prepareSegment(10*o,this.layoutVertexArray,this.indexArray);let h,p,d,f,y;this.e1=this.e2=-1,a&&(h=t[o-2],y=t[l].sub(h)._unit()._perp());for(let e=l;e<o;e++){if(d=e===o-1?a?t[l+1]:void 0:t[e+1],d&&t[e].equals(d))continue;y&&(f=y),h&&(p=h),h=t[e],y=d?d.sub(h)._unit()._perp():f,f=f||y;let m=f.add(y);0===m.x&&0===m.y||m._unit();const g=f.x*y.x+f.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),_=x<bo&&p&&d,w=f.x*y.y-f.y*y.x>0;if(_&&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,f,0,0,c),p=e}}const S=p&&d;let A=S?r:a?"butt":n;if(S&&"round"===A&&(v<s?A="miter":v<=2&&(A="fakeround")),"miter"===A&&v>i&&(A="bevel"),"bevel"===A&&(v>2&&(A="flipbevel"),v<i&&(A="miter")),p&&this.updateDistance(p,h),"miter"===A)m._mult(v),this.addCurrentVertex(h,m,0,0,c);else if("flipbevel"===A){if(v>100)m=y.mult(-1);else{const t=v*f.add(y).mag()/f.sub(y).mag();m._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c)}else if("bevel"===A||"fakeround"===A){const t=-Math.sqrt(v*v-1),e=w?t:0,r=w?0:t;if(p&&this.addCurrentVertex(h,f,e,r,c),"fakeround"===A){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const n=y.sub(f)._mult(r)._add(f)._unit()._mult(w?-1:1);this.addHalfVertex(h,n.x,n.y,!1,w,0,c)}}d&&this.addCurrentVertex(h,y,-e,-r,c)}else if("butt"===A)this.addCurrentVertex(h,m,0,0,c);else if("square"===A){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"===A&&(p&&(this.addCurrentVertex(h,f,0,0,c),this.addCurrentVertex(h,f,1,1,c,!0)),d&&(this.addCurrentVertex(h,y,-1,-1,c,!0),this.addCurrentVertex(h,y,0,0,c)));if(_&&e<o-1){const t=h.dist(d);if(t>2*u){const e=h.add(d.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e}}}}addCurrentVertex(t,e,r,n,i,s=!1){const a=e.y*n-e.x,o=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,s,!1,r,i),this.addHalfVertex(t,a,o,s,!0,-n,i)}addHalfVertex({x:t,y:e},r,n,i,s,a,o){this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const l=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),o.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()}}Sr(LineBucket,"LineBucket",{omit:["layers","patternFeatures"]});const _o=new Properties({"line-cap":new DataDrivenProperty(Tr.layout_line["line-cap"]),"line-join":new DataDrivenProperty(Tr.layout_line["line-join"]),"line-miter-limit":new DataConstantProperty(Tr.layout_line["line-miter-limit"]),"line-round-limit":new DataConstantProperty(Tr.layout_line["line-round-limit"]),"line-sort-key":new DataDrivenProperty(Tr.layout_line["line-sort-key"])});var wo={paint:new Properties({"line-opacity":new DataDrivenProperty(Tr.paint_line["line-opacity"]),"line-color":new DataDrivenProperty(Tr.paint_line["line-color"]),"line-translate":new DataConstantProperty(Tr.paint_line["line-translate"]),"line-translate-anchor":new DataConstantProperty(Tr.paint_line["line-translate-anchor"]),"line-width":new DataDrivenProperty(Tr.paint_line["line-width"]),"line-gap-width":new DataDrivenProperty(Tr.paint_line["line-gap-width"]),"line-offset":new DataDrivenProperty(Tr.paint_line["line-offset"]),"line-blur":new DataDrivenProperty(Tr.paint_line["line-blur"]),"line-dasharray":new CrossFadedDataDrivenProperty(Tr.paint_line["line-dasharray"]),"line-pattern":new CrossFadedDataDrivenProperty(Tr.paint_line["line-pattern"]),"line-gradient":new ColorRampProperty(Tr.paint_line["line-gradient"]),"line-trim-offset":new DataConstantProperty(Tr.paint_line["line-trim-offset"])}),layout:_o};const So=new class LineFloorwidthProperty extends DataDrivenProperty{possiblyEvaluate(t,e){return e=new EvaluationParameters(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=p({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}(wo.paint.properties["line-width"].specification);function Ao(t,e){return e>0?e+2*t:t}So.useIntegerZoom=!0;const ko=di([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Io=di([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Mo=di([{name:"a_projected_pos",components:4,type:"Float32"}],4);di([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Po=di([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Co=di([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);di([{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 To=di([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);di([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),di([{name:"triangle",components:3,type:"Uint16"}]),di([{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"}]),di([{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"}]),di([{type:"Float32",name:"offsetX"}]),di([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var zo=24;const Eo=128;function Do(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new EvaluationParameters(t+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=r;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let s=i;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const a=e[i],o=e[s];return"composite"===r.kind?{kind:"composite",minZoom:a,maxZoom:o,interpolationType:n}:{kind:"camera",minZoom:a,maxZoom:o,minSize:r.evaluate(new EvaluationParameters(a)),maxSize:r.evaluate(new EvaluationParameters(o)),interpolationType:n}}}function Bo(t,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:i}){return"source"===t.kind?n/Eo:"composite"===t.kind?jt(n/Eo,i/Eo,r):e}function Lo(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:a}=t,o=i?u(ae.interpolationFactor(i,e,s,a),0,1):0;"camera"===t.kind?n=jt(t.minSize,t.maxSize,o):r=o}return{uSizeT:r,uSize:n}}function Vo(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()),ci.applyArabicShaping&&(t=ci.applyArabicShaping(t)),t}(t.text,e,r)})),t}const Fo={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Ro(t){return"︶"===t||"﹈"===t||"︸"===t||"﹄"===t||"﹂"===t||"︾"===t||"︼"===t||"︺"===t||"︘"===t||"﹀"===t||"︐"===t||"︓"===t||"︔"===t||"`"===t||" ̄"===t||"︑"===t||"︒"===t}function jo(t){return"︵"===t||"﹇"===t||"︷"===t||"﹃"===t||"﹁"===t||"︽"===t||"︻"===t||"︹"===t||"︗"===t||"︿"===t}var Oo=function(t,e,r,n,i){var s,a,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?i-1:0,p=r?-1:1,d=t[e+h];for(h+=p,s=d&(1<<-c)-1,d>>=-c,c+=o;c>0;s=256*s+t[e+h],h+=p,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===s)s=1-u;else{if(s===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),s-=u}return(d?-1:1)*a*Math.pow(2,s-n)},Uo=function(t,e,r,n,i,s){var a,o,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:s-1,f=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*l-1)*Math.pow(2,i),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&o,d+=f,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;t[r+d]=255&a,d+=f,a/=256,u-=8);t[r+d-f]|=128*y},$o=qo;function qo(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}qo.Varint=0,qo.Fixed64=1,qo.Bytes=2,qo.Fixed32=5;var No=4294967296,Zo=1/No,Go="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Xo(t){return t.type===qo.Bytes?t.readVarint()+t.pos:t.pos+1}function Yo(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Jo(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 Ko(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function Wo(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Ho(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Qo(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function tl(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function el(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function rl(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function nl(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function il(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function sl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function al(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function ol(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function ll(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}}qo.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=sl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=ol(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=sl(this.buf,this.pos)+sl(this.buf,this.pos+4)*No;return this.pos+=8,t},readSFixed64:function(){var t=sl(this.buf,this.pos)+ol(this.buf,this.pos+4)*No;return this.pos+=8,t},readFloat:function(){var t=Oo(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Oo(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,s=r.buf;if(n=(112&(i=s[r.pos++]))>>4,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<3,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<10,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<17,i<128)return Yo(t,n,e);if(n|=(127&(i=s[r.pos++]))<<24,i<128)return Yo(t,n,e);if(n|=(1&(i=s[r.pos++]))<<31,i<128)return Yo(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Go?function(t,e,r){return Go.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i<r;){var s,a,o,l=t[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(a=t[i+2],128==(192&(s=t[i+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&s)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[i+2],o=t[i+3],128==(192&(s=t[i+1]))&&128==(192&a)&&128==(192&o)&&((u=(15&l)<<18|(63&s)<<12|(63&a)<<6|63&o)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==qo.Bytes)return t.push(this.readVarint(e));var r=Xo(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==qo.Bytes)return t.push(this.readSVarint());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==qo.Bytes)return t.push(this.readBoolean());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==qo.Bytes)return t.push(this.readFloat());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==qo.Bytes)return t.push(this.readDouble());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==qo.Bytes)return t.push(this.readFixed32());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==qo.Bytes)return t.push(this.readSFixed32());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==qo.Bytes)return t.push(this.readFixed64());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==qo.Bytes)return t.push(this.readSFixed64());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===qo.Varint)for(;this.buf[this.pos++]>127;);else if(e===qo.Bytes)this.pos=this.readVarint()+this.pos;else if(e===qo.Fixed32)this.pos+=4;else{if(e!==qo.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),al(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),al(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),al(this.buf,-1&t,this.pos),al(this.buf,Math.floor(t*Zo),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),al(this.buf,-1&t,this.pos),al(this.buf,Math.floor(t*Zo),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&&Jo(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Uo(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Uo(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&&Jo(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,qo.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Ko,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Wo,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Ho,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Qo,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,il,e)},writeBytesField:function(t,e){this.writeTag(t,qo.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,qo.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,qo.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,qo.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,qo.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,qo.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,qo.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,qo.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,qo.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,qo.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class ImagePosition{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 ImageAtlas{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:s,h:a}=ll(i),o=new RGBAImage({width:s||1,height:a||1});for(const e in t){const n=t[e],i=r[e].paddedRect;RGBAImage.copy(n.data,o,{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,a=i.y+1,l=r.data.width,u=r.data.height;RGBAImage.copy(r.data,o,{x:0,y:0},{x:s,y:a},r.data),RGBAImage.copy(r.data,o,{x:0,y:u-1},{x:s,y:a-1},{width:l,height:1}),RGBAImage.copy(r.data,o,{x:0,y:0},{x:s,y:a+u},{width:l,height:1}),RGBAImage.copy(r.data,o,{x:l-1,y:0},{x:s-1,y:a},{width:1,height:u}),RGBAImage.copy(r.data,o,{x:0,y:0},{x:s+l,y:a},{width:1,height:u})}this.image=o,this.iconPositions=r,this.patternPositions=n}addImages(t,e,r){for(const n in t){const i=t[n],s={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(s),e[n]=new ImagePosition(s,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((e=>t.hasImage(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})}}Sr(ImagePosition,"ImagePosition"),Sr(ImageAtlas,"ImageAtlas");const ul={horizontal:1,vertical:2,horizontalOnly:3};class SectionOptions{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const r=new SectionOptions;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new SectionOptions;return e.imageName=t,e}}class TaggedString{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const r=new TaggedString;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&&Xn(i)&&!Fo[t[n+1]]||s&&Xn(s)&&!Fo[t[n-1]])||!Fo[t[n]]?t[n]:Fo[t[n]]}return r}(this.text,t)}trim(){let t=0;for(let e=0;e<this.text.length&&hl[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&hl[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 TaggedString;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(SectionOptions.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 _("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(SectionOptions.forImage(e)),this.sectionIndex.push(this.sections.length-1)):_("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function cl(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y){const m=TaggedString.fromFeature(t,i);let g;h===ul.vertical&&m.verticalizePunctuation(p);const{processBidirectionalText:x,processStyledBidirectionalText:v}=ci;if(x&&1===m.sections.length){g=[];const t=x(m.toString(),xl(m,u,s,e,n,d,f));for(const e of t){const t=new TaggedString;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,xl(m,u,s,e,n,d,f));for(const e of t){const t=new TaggedString;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,xl(m,u,s,e,n,d,f));const b=[],_={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,a,o,l,u,c,h){let p=0,d=0,f=0;const y="right"===o?1:"left"===o?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 a of i){a.trim();const i=a.getMaxScale(),o=(i-1)*zo,v={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=v;const b=v.positionedGlyphs;let _=0;if(!a.length()){d+=s,++g;continue}let w=0,S=0;for(let s=0;s<a.length();s++){const o=a.getSection(s),f=a.getSectionIndex(s),y=a.getCharCode(s);let g=o.scale,v=null,A=null,k=null,I=zo,M=0;const P=!(l===ul.horizontal||!c&&!Gn(y)||c&&(hl[y]||(x=y,mn(x)||gn(x)||xn(x)||Fn(x)||Un(x))));if(o.imageName){const e=n[o.imageName];if(!e)continue;k=o.imageName,t.iconsInText=t.iconsInText||!0,A=e.paddedRect;const r=e.displaySize;g=g*zo/h,v={width:r[0],height:r[1],left:1,top:-3,advance:P?r[1]:r[0],localGlyph:!1},M=m?-v.height*g:i*zo-17-r[1]*g,I=v.advance;const s=(P?r[0]:r[1])*g-zo*i;s>0&&s>_&&(_=s)}else{const t=r[o.fontStack];if(!t)continue;t[y]&&(A=t[y]);const n=e[o.fontStack];if(!n)continue;const s=n.glyphs[y];if(!s)continue;if(v=s.metrics,I=8203!==y?zo: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;w<r&&(w=r,S=(t-e)/2*g),M=-t*g}else M=(i-g)*zo-17}P?(t.verticalizable=!0,b.push({glyph:y,imageName:k,x:p,y:d+M,vertical:P,scale:g,localGlyph:v.localGlyph,fontStack:o.fontStack,sectionIndex:f,metrics:v,rect:A}),p+=I*g+u):(b.push({glyph:y,imageName:k,x:p,y:d+M,vertical:P,scale:g,localGlyph:v.localGlyph,fontStack:o.fontStack,sectionIndex:f,metrics:v,rect:A}),p+=v.advance*g+u)}0!==b.length&&(f=Math.max(p-u,f),m?bl(b,y,_,S,s*i/2):bl(b,y,_,0,s/2)),p=0;const A=s*i+_;v.lineOffset=Math.max(_,o),d+=A,++g}var x;const v=d,{horizontalAlign:b,verticalAlign:_}=vl(a);(function(t,e,r,n,i,s){const a=(e-r)*i,o=-s*n;for(const e of t)for(const t of e.positionedGlyphs)t.x+=a,t.y+=o})(t.positionedLines,y,b,_,f,v),t.top+=-_*v,t.bottom=t.top+v,t.left+=-b*f,t.right=t.left+f,t.hasBaseline=m}(_,e,r,n,g,a,o,l,h,u,p,y),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&_}const hl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},pl={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 dl(t,e,r,n,i,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*zo/s+i:0}{const n=r[e.fontStack],s=n&&n.glyphs[t];return s?s.metrics.advance*e.scale+i:0}}function fl(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 yl(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 ml(t,e,r,n,i,s){let a=null,o=fl(e,r,i,s);for(const t of n){const n=fl(e-t.x,r,i,s)+t.badness;n<=o&&(a=t,o=n)}return{index:t,x:e,priorBreak:a,badness:o}}function gl(t){return t?gl(t.priorBreak).concat(t.index):[]}function xl(t,e,r,n,i,s,a){if("point"!==s)return[];if(!t)return[];const o=[],l=function(t,e,r,n,i,s){let a=0;for(let r=0;r<t.length();r++){const o=t.getSection(r);a+=dl(t.getCharCode(r),o,n,i,e,s)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,n,i,a),u=t.text.indexOf("")>=0;let c=0;for(let r=0;r<t.length();r++){const s=t.getSection(r),p=t.getCharCode(r);if(hl[p]||(c+=dl(p,s,n,i,e,a)),r<t.length()-1){const e=!((h=p)<11904||!(Mn(h)||kn(h)||jn(h)||Vn(h)||zn(h)||vn(h)||Pn(h)||wn(h)||En(h)||Dn(h)||Tn(h)||$n(h)||Sn(h)||_n(h)||bn(h)||Cn(h)||An(h)||Rn(h)||Ln(h)||Bn(h)));(pl[p]||e||s.imageName)&&o.push(ml(r+1,c,l,o,yl(p,t.getCharCode(r+1),e&&u),!1))}}var h;return gl(ml(t.length(),c,l,o,0,!0))}function vl(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 bl(t,e,r,n,i){if(!(e||r||n||i))return;const s=t.length-1,a=t[s],o=(a.x+a.metrics.advance*a.scale)*e;for(let e=0;e<=s;e++)t[e].x-=o,t[e].y+=r+n+i}function _l(t,e,r){const{horizontalAlign:n,verticalAlign:i}=vl(r),s=e[0]-t.displaySize[0]*n,a=e[1]-t.displaySize[1]*i;return{image:t,top:a,bottom:a+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function wl(t,e,r,n,i,s){const a=t.image;let o;if(a.content){const t=a.content,e=a.pixelRatio||1;o=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*s,u=e.right*s;let c,h,p,d;"width"===r||"both"===r?(d=i[0]+l-n[3],h=i[0]+u+n[1]):(d=i[0]+(l+u-a.displaySize[0])/2,h=d+a.displaySize[0]);const f=e.top*s,y=e.bottom*s;return"height"===r||"both"===r?(c=i[1]+f-n[0],p=i[1]+y+n[2]):(c=i[1]+(f+y-a.displaySize[1])/2,p=c+a.displaySize[1]),{image:a,top:c,right:h,bottom:p,left:d,collisionPadding:o}}class Anchor 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 Anchor(this.x,this.y,this.z,this.angle,this.segment)}}function Sl(t,e,r,n,i){if(void 0===e.segment)return!0;let s=e,a=e.segment+1,o=0;for(;o>-r/2;){if(a--,a<0)return!1;o-=t[a].dist(s),s=t[a]}o+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;o<r/2;){const e=t[a],r=t[a+1];if(!r)return!1;let s=t[a-1].angleTo(e)-e.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:s}),u+=s;o-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,o+=e.dist(r)}return!0}function Al(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function kl(t,e,r){return t?.6*e*r:0}function Il(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Ml(t,e,r,n,i,s){const a=kl(r,i,s),o=Il(r,n)*s;let l=0;const u=Al(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=jt(n.x,i.x,c),p=jt(n.y,i.y,c),d=new Anchor(h,p,0,i.angleTo(n),r);return!a||Sl(t,d,o,a,e)?d:void 0}l+=s}}function Pl(t,e,r,n,i,s,a,o,l){const u=kl(n,s,a),c=Il(n,i),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),Cl(t,p?e/2*o%e:(c/2+2*s)*a*o%e,e,u,r,h,p,!1,l)}function Cl(t,e,r,n,i,s,a,o,l){const u=s/2,c=Al(t);let h=0,p=e-r,d=[];for(let e=0;e<t.length-1;e++){const a=t[e],o=t[e+1],f=a.dist(o),y=o.angleTo(a);for(;p+r<h+f;){p+=r;const m=(p-h)/f,g=jt(a.x,o.x,m),x=jt(a.y,o.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new Anchor(g,x,0,y,e);r._round(),n&&!Sl(t,r,s,n,i)||d.push(r)}}h+=f}return o||d.length||a||(d=Cl(t,h/2,r,n,i,s,a,!0,l)),d}function Tl(t,e,n,i){const s=[],a=t.image,o=a.pixelRatio,l=a.paddedRect.w-2,u=a.paddedRect.h-2,c=t.right-t.left,h=t.bottom-t.top,p=a.stretchX||[[0,l]],d=a.stretchY||[[0,u]],f=(t,e)=>t+e[1]-e[0],y=p.reduce(f,0),m=d.reduce(f,0),g=l-y,x=u-m;let v=0,b=y,_=0,w=m,S=0,A=g,k=0,I=x;if(a.content&&i){const t=a.content;v=zl(p,0,t[0]),_=zl(d,0,t[1]),b=zl(p,t[0],t[2]),w=zl(d,t[1],t[3]),S=t[0]-v,k=t[1]-_,A=t[2]-t[0]-b,I=t[3]-t[1]-w}const M=(i,s,l,u)=>{const p=Dl(i.stretch-v,b,c,t.left),d=Bl(i.fixed-S,A,i.stretch,y),f=Dl(s.stretch-_,w,h,t.top),g=Bl(s.fixed-k,I,s.stretch,m),x=Dl(l.stretch-v,b,c,t.left),M=Bl(l.fixed-S,A,l.stretch,y),P=Dl(u.stretch-_,w,h,t.top),C=Bl(u.fixed-k,I,u.stretch,m),T=new r(p,f),z=new r(x,f),E=new r(x,P),D=new r(p,P),B=new r(d/o,g/o),L=new r(M/o,C/o),V=e*Math.PI/180;if(V){const t=Math.sin(V),e=Math.cos(V),r=[e,-t,t,e];T._matMult(r),z._matMult(r),D._matMult(r),E._matMult(r)}const F=i.stretch+i.fixed,R=s.stretch+s.fixed;return{tl:T,tr:z,bl:D,br:E,tex:{x:a.paddedRect.x+1+F,y:a.paddedRect.y+1+R,w:l.stretch+l.fixed-F,h:u.stretch+u.fixed-R},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:B,pixelOffsetBR:L,minFontScaleX:A/o/c,minFontScaleY:I/o/h,isSDF:n}};if(i&&(a.stretchX||a.stretchY)){const t=El(p,g,y),e=El(d,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(M(n,e[t],i,e[t+1]))}}else s.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return s}function zl(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 El(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 Dl(t,e,r,n){return t/e*r+n}function Bl(t,e,r,n){return t-e*r/n}function Ll(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}Sr(Anchor,"Anchor");class TinyQueue{constructor(t=[],e=Vl){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t<n;){let n=1+(t<<1),s=e[n];const a=n+1;if(a<this.length&&r(e[a],s)<0&&(n=a,s=e[a]),r(s,i)>=0)break;e[t]=s,t=n}e[t]=i}}function Vl(t,e){return t<e?-1:t>e?1:0}function Fl(t,e=1,n=!1){let i=1/0,s=1/0,a=-1/0,o=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<i)&&(i=e.x),(!t||e.y<s)&&(s=e.y),(!t||e.x>a)&&(a=e.x),(!t||e.y>o)&&(o=e.y)}const u=Math.min(a-i,o-s);let c=u/2;const h=new TinyQueue([],Rl);if(0===u)return new r(i,s);for(let e=i;e<a;e+=u)for(let r=s;r<o;r+=u)h.push(new jl(e+c,r+c,c,t));let p=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,s=i.length,a=s-1;t<s;a=t++){const s=i[t],o=i[a],l=s.x*o.y-o.x*s.y;r+=(s.x+o.x)*l,n+=(s.y+o.y)*l,e+=3*l}return new jl(r/e,n/e,0,t)}(t),d=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,d)),r.max-p.d<=e||(c=r.h/2,h.push(new jl(r.p.x-c,r.p.y-c,c,t)),h.push(new jl(r.p.x+c,r.p.y-c,c,t)),h.push(new jl(r.p.x-c,r.p.y+c,c,t)),h.push(new jl(r.p.x+c,r.p.y+c,c,t)),d+=4)}return n&&(console.log(`num probes: ${d}`),console.log(`best distance: ${p.d}`)),p.p}function Rl(t,e){return e.max-t.max}function jl(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,a=i-1;e<i;a=e++){const i=s[e],o=s[a];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,os(t,i,o))}}return(r?1:-1)*Math.sqrt(n)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}const Ol=Number.POSITIVE_INFINITY,Ul=Math.sqrt(2);function $l(t,e,r,n,i,s,a,o,l,u){t.createArrays(),t.tilePixelRatio=Di/(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 EvaluationParameters(e),o),h["text-size"].possiblyEvaluate(new EvaluationParameters(r),o)]}if("composite"===t.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.iconSizeData;p.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new EvaluationParameters(e),o),h["icon-size"].possiblyEvaluate(new EvaluationParameters(r),o)]}p.layoutTextSize=h["text-size"].possiblyEvaluate(new EvaluationParameters(l+1),o),p.layoutIconSize=h["icon-size"].possiblyEvaluate(new EvaluationParameters(l+1),o),p.textMaxSize=h["text-size"].possiblyEvaluate(new EvaluationParameters(18),o);const d="map"===c.get("text-rotation-alignment")&&"point"!==c.get("symbol-placement"),f=c.get("text-size");for(const s of t.features){const l=c.get("text-font").evaluate(s,{},o).join(","),h=f.evaluate(s,{},o),g=p.layoutTextSize.evaluate(s,{},o),x=(p.layoutIconSize.evaluate(s,{},o),{horizontal:{},vertical:void 0}),v=s.text;let b,w=[0,0];if(v){const n=v.toString(),a=c.get("text-letter-spacing").evaluate(s,{},o)*zo,u=c.get("text-line-height").evaluate(s,{},o)*zo,p=Nn(n)?a:0,f=c.get("text-anchor").evaluate(s,{},o),b=c.get("text-variable-anchor");if(!b){const t=c.get("text-radial-offset").evaluate(s,{},o);t?(y=f,w=(m=[t*zo,Ol])[1]!==Ol?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/Ul;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,{},o).map((t=>t*zo))}let _=d?"center":c.get("text-justify").evaluate(s,{},o);const S=c.get("symbol-placement"),A="point"===S,k="point"===S?c.get("text-max-width").evaluate(s,{},o)*zo:0,I=s=>{t.allowVerticalPlacement&&qn(n)&&(x.vertical=cl(v,e,r,i,l,k,u,f,s,p,w,ul.vertical,!0,S,g,h))};if(!d&&b){const t="auto"===_?b.map((t=>ql(t))):[_];let n=!1;for(let s=0;s<t.length;s++){const a=t[s];if(!x.horizontal[a])if(n)x.horizontal[a]=x.horizontal[0];else{const t=cl(v,e,r,i,l,k,u,"center",a,p,w,ul.horizontal,!1,S,g,h);t&&(x.horizontal[a]=t,n=1===t.positionedLines.length)}}I("left")}else{if("auto"===_&&(_=ql(f)),A||c.get("text-writing-mode").indexOf("horizontal")>=0||!qn(n)){const t=cl(v,e,r,i,l,k,u,f,_,p,w,ul.horizontal,!1,S,g,h);t&&(x.horizontal[_]=t)}I("point"===S?"left":_)}}let S=!1;if(s.icon&&s.icon.name){const e=n[s.icon.name];e&&(b=_l(i[s.icon.name],c.get("icon-offset").evaluate(s,{},o),c.get("icon-anchor").evaluate(s,{},o)),S=e.sdf,void 0===t.sdfIcons?t.sdfIcons=e.sdf:t.sdfIcons!==e.sdf&&_("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=Xl(x.horizontal)||x.vertical;t.iconsInText||(t.iconsInText=!!A&&A.iconsInText),(A||b)&&Nl(t,s,x,b,n,p,g,0,w,S,a,o,u)}var y,m;s&&t.generateCollisionDebugBuffers(l,t.collisionBoxArray)}function ql(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 Nl(t,e,n,i,s,a,l,u,c,h,p,d,f){let y=a.textMaxSize.evaluate(e,{},d);void 0===y&&(y=l);const m=t.layers[0].layout,g=m.get("icon-offset").evaluate(e,{},d),x=Xl(n.horizontal)||n.vertical,v="globe"===f.name,b=l/24,w=t.tilePixelRatio*y/24,S=(z=t.overscaling,t.zoom>18&&z>2&&(z>>=1),Math.max(Di/(512*z),1)*m.get("symbol-spacing")),A=m.get("text-padding")*t.tilePixelRatio,k=m.get("icon-padding")*t.tilePixelRatio,I=o(m.get("text-max-angle")),M="map"===m.get("text-rotation-alignment")&&"point"!==m.get("symbol-placement"),P="map"===m.get("icon-rotation-alignment")&&"point"!==m.get("symbol-placement"),C=m.get("symbol-placement"),T=S/2;var z;const E=m.get("icon-text-fit");let D;i&&"none"!==E&&(t.allowVerticalPlacement&&n.vertical&&(D=wl(i,n.vertical,E,m.get("icon-text-fit-padding"),g,b)),x&&(i=wl(i,x,E,m.get("icon-text-fit-padding"),g,b)));const B=(r,o,l)=>{if(o.x<0||o.x>=Di||o.y<0||o.y>=Di)return;let u=null;if(v){const{x:t,y:e,z:r}=f.projectTilePoint(o.x,o.y,l);u={anchor:new Anchor(t,e,r,0,void 0),up:f.upVector(l,o.x,o.y)}}!function(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g,x,v,b,w,S,A,k){const I=t.addToLineVertexArray(e,n);let M,P,C,T,z,E,D,B=0,L=0,V=0,F=0,R=-1,j=-1;const O={};let U=vi("");const $=r?r.anchor:e;let q=0,N=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[q,N]=l.layout.get("text-offset").evaluate(b,{},k).map((t=>t*zo)):(q=l.layout.get("text-radial-offset").evaluate(b,{},k)*zo,N=Ol),t.allowVerticalPlacement&&i.vertical){const t=i.vertical;if(f)E=Jl(t),o&&(D=Jl(o));else{const r=l.layout.get("text-rotate").evaluate(b,{},k)+90;C=Yl(u,$,e,c,h,p,t,d,r,y),o&&(T=Yl(u,$,e,c,h,p,o,g,r))}}if(s){const n=l.layout.get("icon-rotate").evaluate(b,{},k),i="none"!==l.layout.get("icon-text-fit"),a=Tl(s,n,S,i),d=o?Tl(o,n,S,i):void 0;P=Yl(u,$,e,c,h,p,s,g,n),B=4*a.length;const f=t.iconSizeData;let y=null;"source"===f.kind?(y=[Eo*l.layout.get("icon-size").evaluate(b,{},k)],y[0]>Zl&&_(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(y=[Eo*w.compositeIconSizes[0].evaluate(b,{},k),Eo*w.compositeIconSizes[1].evaluate(b,{},k)],(y[0]>Zl||y[1]>Zl)&&_(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,a,y,v,x,b,!1,r,e,I.lineStartIndex,I.lineLength,-1,A,k),R=t.icon.placedSymbolArray.length-1,d&&(L=4*d.length,t.addSymbols(t.icon,d,y,v,x,b,ul.vertical,r,e,I.lineStartIndex,I.lineLength,-1,A,k),j=t.icon.placedSymbolArray.length-1)}for(const n in i.horizontal){const s=i.horizontal[n];M||(U=vi(s.text),f?z=Jl(s):M=Yl(u,$,e,c,h,p,s,d,l.layout.get("text-rotate").evaluate(b,{},k),y));const o=1===s.positionedLines.length;if(V+=Gl(t,r,e,s,a,l,f,b,y,I,i.vertical?ul.horizontal:ul.horizontalOnly,o?Object.keys(i.horizontal):[n],O,R,w,A,k),o)break}i.vertical&&(F+=Gl(t,r,e,i.vertical,a,l,f,b,y,I,ul.vertical,["vertical"],O,j,w,A,k));let Z=-1;const G=(t,e)=>t?Math.max(t,e):e;Z=G(z,Z),Z=G(E,Z),Z=G(D,Z);const X=Z>-1?1:0;t.glyphOffsetArray.length>=SymbolBucket.MAX_GLYPHS&&_("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($.x,$.y,$.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,R,j,U,void 0!==M?M:t.collisionBoxArray.length,void 0!==M?M+1:t.collisionBoxArray.length,void 0!==C?C:t.collisionBoxArray.length,void 0!==C?C+1:t.collisionBoxArray.length,void 0!==P?P:t.collisionBoxArray.length,void 0!==P?P+1:t.collisionBoxArray.length,T||t.collisionBoxArray.length,T?T+1:t.collisionBoxArray.length,c,V,F,B,L,X,0,q,N,Z)}(t,o,u,r,n,i,s,D,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,A,M,c,0,k,P,g,e,a,h,p,d)};if("line"===C)for(const s of function(t,e,n,i,s){const a=[];for(let e=0;e<t.length;e++){const n=t[e];let o;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()),o&&e.equals(o[o.length-1])||(o=[e],a.push(o)),o.push(l)))))}}return a}(e.geometry,0,0,Di,Di)){const e=Pl(s,S,I,n.vertical||x,i,24,w,t.overscaling,Di);for(const r of e){const e=x;e&&Kl(t,e.text,T,r)||B(s,r,d)}}else if("line-center"===C){for(const t of e.geometry)if(t.length>1){const e=Ml(t,I,n.vertical||x,i,24,w);e&&B(t,e,d)}}else if("Polygon"===e.type)for(const t of Ca(e.geometry,0)){const e=Fl(t,16);B(t[0],new Anchor(e.x,e.y,0,0,void 0),d)}else if("LineString"===e.type)for(const t of e.geometry)B(t,new Anchor(t[0].x,t[0].y,0,0,void 0),d);else if("Point"===e.type)for(const t of e.geometry)for(const e of t)B([e],new Anchor(e.x,e.y,0,0,void 0),d)}const Zl=32640;function Gl(t,e,n,i,s,a,o,l,u,c,h,p,d,f,y,m,g){const x=function(t,e,n,i,s,a,o,l){const u=[];if(0===e.positionedLines.length)return u;const c=i.layout.get("text-rotate").evaluate(a,{})*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 d=e.positionedLines.length,f=p/d;let y=e.top-n[1];for(let t=0;t<d;++t){const i=e.positionedLines[t];y=Ll(e,f,y,t);for(const t of i.positionedGlyphs){if(!t.rect)continue;const i=t.rect||{};let a=4,p=!0,d=1,f=0;if(t.imageName){const e=o[t.imageName];if(!e)continue;if(e.sdf){_("SDF images are not supported in formatted text and will be ignored.");continue}p=!1,d=e.pixelRatio,a=1/d}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&&(f=t.imageName?g-t.metrics.width*t.scale/2:0);const b=s?[t.x+g,t.y]:[0,0];let w=[0,0],S=[0,0],A=!1;s||(m?(S=[t.x+g+h[0],t.y+h[1]-f],A=!0):w=[t.x+g+n[0],t.y+n[1]-f]);const k=v.w*t.scale/(d*(t.localGlyph?2:1)),I=v.h*t.scale/(d*(t.localGlyph?2:1));let M,P,C,T;if(m){const e=t.y-y,n=new r(-g,g-e),i=-Math.PI/2,s=new r(...S);M=new r(-g+w[0],w[1]),M._rotateAround(i,n)._add(s),M.x+=-e+g,M.y-=(x.left-a)*t.scale;const o=t.imageName?x.advance*t.scale:zo*t.scale,l=String.fromCharCode(t.glyph);Ro(l)?M.x+=(1-a)*t.scale:jo(l)?M.x+=o-x.height*t.scale+(-a-1)*t.scale:M.x+=t.imageName||x.width+2*a===v.w&&x.height+2*a===v.h?(o-I)/2:(o-(x.height+2*a)*t.scale)/2,P=new r(M.x,M.y-k),C=new r(M.x+I,M.y),T=new r(M.x+I,M.y-k)}else{const e=(x.left-a)*t.scale-g+w[0],n=(-x.top-a)*t.scale+w[1],i=e+k,s=n+I;M=new r(e,n),P=new r(i,n),C=new r(e,s),T=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]),M._rotateAround(c,t),P._rotateAround(c,t),C._rotateAround(c,t),T._rotateAround(c,t)}const z=new r(0,0),E=new r(0,0);u.push({tl:M,tr:P,bl:C,br:T,tex:i,writingMode:e.writingMode,glyphOffset:b,sectionIndex:t.sectionIndex,isSDF:p,pixelOffsetTL:z,pixelOffsetBR:E,minFontScaleX:0,minFontScaleY:0})}}return u}(0,i,u,a,o,l,s,t.allowVerticalPlacement),v=t.textSizeData;let b=null;"source"===v.kind?(b=[Eo*a.layout.get("text-size").evaluate(l,{},g)],b[0]>Zl&&_(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===v.kind&&(b=[Eo*y.compositeTextSizes[0].evaluate(l,{},g),Eo*y.compositeTextSizes[1].evaluate(l,{},g)],(b[0]>Zl||b[1]>Zl)&&_(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,x,b,u,o,l,h,e,n,c.lineStartIndex,c.lineLength,f,m,g);for(const e of p)d[e]=t.text.placedSymbolArray.length-1;return 4*x.length}function Xl(t){for(const e in t)return t[e];return null}function Yl(t,e,n,i,s,a,l,u,c,h){let p=l.top,d=l.bottom,f=l.left,y=l.right;const m=l.collisionPadding;if(m&&(f-=m[0],p-=m[1],y+=m[2],d+=m[3]),c){const t=new r(f,p),e=new r(y,p),n=new r(f,d),i=new r(y,d),s=o(c);let a=new r(0,0);h&&(a=new r(h[0],h[1])),t._rotateAround(s,a),e._rotateAround(s,a),n._rotateAround(s,a),i._rotateAround(s,a),f=Math.min(t.x,e.x,n.x,i.x),y=Math.max(t.x,e.x,n.x,i.x),p=Math.min(t.y,e.y,n.y,i.y),d=Math.max(t.y,e.y,n.y,i.y)}return t.emplaceBack(e.x,e.y,e.z,n.x,n.y,f,p,y,d,u,i,s,a),t.length-1}function Jl(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 Kl(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}di([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);const Wl=di([{name:"a_pos_3",components:3,type:"Int16"}]);var Hl=di([{name:"a_pos",type:"Int16",components:2}]);const Ql=Di/Math.PI/2,tu=2*ji(1,0)*Ql*Math.PI,eu=-Ql,ru=Ql,nu=[new Aabb([eu,eu,eu],[ru,ru,ru]),new Aabb([eu,eu,eu],[0,0,ru]),new Aabb([0,eu,eu],[ru,0,ru]),new Aabb([eu,0,eu],[0,ru,ru]),new Aabb([0,0,eu],[ru,ru,ru])];function iu(t,e,r,n=!0){const i=Cs([],t._camera.position,t.worldSize),s=[e,r,1,1];Vs(s,s,t.pixelMatrixInverse),function(t,e,r){t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r}(s,s,1/s[3]);const a=zs([],Ls([],s,i)),o=t.globeMatrix,c=[o[12],o[13],o[14]],h=Ls([],c,i),p=Is(h),d=zs([],h),f=t.worldSize/(2*Math.PI),y=Es(d,a),m=Math.asin(f/p);if(m<Math.acos(y)){if(!n)return null;const t=[],e=[];Cs(t,a,p/y),zs(e,Ls(e,t,h)),zs(a,Ps(a,h,Cs(a,e,Math.tan(m)*p)))}const g=[];new Ray(i,a).closestPointOnSphere(c,f,g);const x=zs([],C(o,0)),v=zs([],C(o,1)),b=zs([],C(o,2)),_=Es(x,g),w=Es(v,g),S=Es(b,g),A=l(Math.asin(-w/f));let k=l(Math.atan2(_,S));k=t.center.lng+function(t,e){const r=(e-t+180)%360-180;return r<-180?r+360:r}(t.center.lng,k);const I=Fi(k),M=u(Ri(A),0,1);return new MercatorCoordinate(I,M)}function su(t){if(t.z<=1)return nu[t.z+2*t.y+t.x];const e=ou(au(t));return Aabb.fromPoints(e)}function au({x:t,y:e,z:r}){const n=1/(1<<r),i=new LngLat(Oi(t*n),Ui((e+1)*n)),s=new LngLat(Oi((t+1)*n),Ui(e*n));return new LngLatBounds(i,s)}function ou(t){const e=o(t.getNorth()),r=o(t.getSouth()),n=Math.cos(e),i=Math.cos(r),s=Math.sin(e),a=Math.sin(r),l=t.getWest(),u=t.getEast();return[lu(i,a,l),lu(i,a,u),lu(n,s,u),lu(n,s,l)]}function lu(t,e,r,n=Ql){return r=o(r),[t*Math.sin(r)*n,-e*n,t*Math.cos(r)*n]}function uu(t,e,r){return lu(Math.cos(o(t)),Math.sin(o(t)),e,r)}function cu(t,e,r,n){const i=1<<r.z,s=(t/Di+r.x)/i;return uu(Ui((e/Di+r.y)/i),Oi(s),n)}function hu({min:t,max:e}){return 16383/Math.max(e[0]-t[0],e[1]-t[1],e[2]-t[2])}const pu=new Float64Array(16);function du(t){const e=hu(t),r=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}(pu,[e,e,e]);return ws(r,r,function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}([],t.min))}function fu(t){return(e=u(((e=t)-5)/1,0,1))*e*(3-2*e);var e}function yu(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)),a=Math.sin(t._pitch)*s+i;return Math.min(1.01*a,i*(1/t._horizonShift))}function mu(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,a=(t.y+1)*r,o=Oi(n),l=Oi(i),u=Ui(s),c=Ui(a),h=e.project(o,u),p=e.project(l,u),d=e.project(l,c),f=e.project(o,c);let y=Math.min(h.x,p.x,d.x,f.x),m=Math.min(h.y,p.y,d.y,f.y),g=Math.max(h.x,p.x,d.x,f.x),x=Math.max(h.y,p.y,d.y,f.y);const v=r/16;function b(t,r,n,i,s,a){const o=(n+s)/2,l=(i+a)/2,u=e.project(Oi(o),Ui(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,o,l),b(u,r,o,l,s,a))}b(h,p,n,s,i,s),b(p,d,i,s,i,a),b(d,f,i,a,n,a),b(f,h,n,a,n,s),y-=v,m-=v,g+=v,x+=v;const _=1/Math.max(g-y,x-m);return{scale:_,x:y*_,y:m*_,x2:g*_,y2:x*_,projection:e}}const gu=vs(new Float32Array(16));class Projection{constructor(t){this.spec=t,this.name=t.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(t,e){return{x:0,y:0,z:0}}unproject(t,e){return new LngLat(0,0)}projectTilePoint(t,e,r){return{x:t,y:e,z:0}}locationPoint(t,e,r=!0){return t._coordinatePoint(t.locationCoordinate(e),r)}pixelsPerMeter(t,e){return ji(1,t)*e}pixelSpaceConversion(t,e,r){return 1}farthestPixelDistance(t){return yu(t,t.pixelsPerMeter)}pointCoordinate(t,e,n,i){const s=t.horizonLineFromTop(!1),a=new r(e,Math.max(s,n));return t.rayIntersectionCoordinate(t.pointRayIntersection(a,i))}pointCoordinate3D(t,e,n){const i=new r(e,n);if(t.elevation)return t.elevation.pointCoordinate(i);{const e=this.pointCoordinate(t,i.x,i.y,0);return[e.x,e.y,e.z]}}isPointAboveHorizon(t,e){if(t.elevation)return!this.pointCoordinate3D(t,e.x,e.y);const r=t.horizonLineFromTop();return e.y<r}createInversionMatrix(t,e){return gu}createTileMatrix(t,e,r){let n,i,s;const a=r.canonical,o=vs(new Float64Array(16));if(this.isReprojectedInTileSpace){const l=mu(a,this);n=1,i=l.x+r.wrap*l.scale,s=l.y,Ss(o,o,[n/l.scale,n/l.scale,t.pixelsPerMeter/e])}else n=e/t.zoomScale(a.z),i=(a.x+Math.pow(2,a.z)*r.wrap)*n,s=a.y*n;return ws(o,o,[i,s,0]),Ss(o,o,[n/Di,n/Di,1]),o}upVector(t,e,r){return[0,0,1]}upVectorScale(t,e,r){return{metersToTile:1}}}class Albers extends Projection{constructor(t){super(t),this.range=[4,7],this.center=t.center||[-96,37.5];const[e,r]=this.parallels=t.parallels||[29.5,45.5],n=Math.sin(o(e));this.n=(n+Math.sin(o(r)))/2,this.c=1+n*(2*this.n-n),this.r0=Math.sqrt(this.c)/this.n}project(t,e){const{n:r,c:n,r0:i}=this,s=o(t-this.center[0]),a=o(e),l=Math.sqrt(n-2*r*Math.sin(a))/r;return{x:l*Math.sin(s*r),y:l*Math.cos(s*r)-i,z:0}}unproject(t,e){const{n:r,c:n,r0:i}=this,s=i+e;let a=Math.atan2(t,Math.abs(s))*Math.sign(s);s*r<0&&(a-=Math.PI*Math.sign(t)*Math.sign(s));const h=o(this.center[0])*r;a=c(a,-Math.PI-h,Math.PI-h);const p=l(a/r)+this.center[0],d=Math.asin(u((n-(t*t+s*s)*r*r)/(2*r),-1,1)),f=u(l(d),-85.051129,$i);return new LngLat(p,f)}}const xu=1.340264,vu=-.081106,bu=893e-6,_u=.003796,wu=Math.sqrt(3)/2;class EqualEarth extends Projection{project(t,e){e=e/180*Math.PI,t=t/180*Math.PI;const r=Math.asin(wu*Math.sin(e)),n=r*r,i=n*n*n;return{x:.5*(t*Math.cos(r)/(wu*(xu+3*vu*n+i*(7*bu+9*_u*n)))/Math.PI+.5),y:1-.5*(r*(xu+vu*n+i*(bu+_u*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,a,o=0;o<12&&(s=r*(xu+vu*n+i*(bu+_u*n))-e,a=xu+3*vu*n+i*(7*bu+9*_u*n),t=s/a,r=u(r-t,-Math.PI/3,Math.PI/3),n=r*r,i=n*n*n,!(Math.abs(t)<1e-12));++o);const s=wu*t*(xu+3*vu*n+i*(7*bu+9*_u*n))/Math.cos(r),a=Math.asin(Math.sin(r)/wu),o=u(180*s/Math.PI,-180,180),l=u(180*a/Math.PI,-85.051129,$i);return new LngLat(o,l)}}class Equirectangular extends Projection{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0}project(t,e){return{x:.5+t/360,y:.5-e/360,z:0}}unproject(t,e){const r=360*(t-.5),n=u(360*(.5-e),-85.051129,$i);return new LngLat(r,n)}}const Su=Math.PI/2;function Au(t){return Math.tan((Su+t)/2)}class LambertConformalConic extends Projection{constructor(t){super(t),this.center=t.center||[0,30];const[e,r]=this.parallels=t.parallels||[30,30],n=o(e),i=o(r),s=Math.cos(n);this.n=n===i?Math.sin(n):Math.log(s/Math.cos(i))/Math.log(Au(i)/Au(n)),this.f=s*Math.pow(Au(n),this.n)/this.n}project(t,e){e=o(e),t=o(t-this.center[0]);const r=1e-6,{n:n,f:i}=this;i>0?e<-Su+r&&(e=-Su+r):e>Su-r&&(e=Su-r);const s=i/Math.pow(Au(e),n),a=s*Math.sin(n*t),l=i-s*Math.cos(n*t);return{x:.5*(a/Math.PI+.5),y:1-.5*(l/Math.PI+.5),z:0}}unproject(t,e){t=(2*t-.5)*Math.PI,e=(2*(1-e)-.5)*Math.PI;const{n:r,f:n}=this,i=n-e,s=Math.sign(i),a=Math.sign(r)*Math.sqrt(t*t+i*i);let o=Math.atan2(t,Math.abs(i))*s;i*r<0&&(o-=Math.PI*Math.sign(t)*s);const c=u(l(o/r)+this.center[0],-180,180),h=u(l(2*Math.atan(Math.pow(n/a,1/r))-Su),-85.051129,$i);return new LngLat(c,h)}}class Mercator extends Projection{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(t,e){return{x:Fi(t),y:Ri(e),z:0}}unproject(t,e){const r=Oi(t),n=Ui(e);return new LngLat(r,n)}}const ku=o($i);class NaturalEarth extends Projection{project(t,e){const r=(e=o(e))*e,n=r*r;return{x:.5*((t=o(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=u(r-i,-ku,ku)}while(Math.abs(i)>1e-6&&--n>0);s=r*r;const a=u(l(t/(.8707+s*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))),-180,180),o=l(r);return new LngLat(a,o)}}const Iu=o($i);class WinkelTripel extends Projection{project(t,e){e=o(e),t=o(t);const r=Math.cos(e),n=2/Math.PI,i=Math.acos(r*Math.cos(t/2)),s=Math.sin(i)/i,a=.5*(t*n+2*r*Math.sin(t/2)/s)||0,l=.5*(e+Math.sin(e)/s)||0;return{x:.5*(a/Math.PI+.5),y:1-.5*(l/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 a=0,o=0;do{const i=Math.cos(n),s=Math.sin(n),l=2*s*i,c=s*s,h=i*i,p=Math.cos(r/2),d=Math.sin(r/2),f=2*p*d,y=d*d,m=1-h*p*p,g=m?1/m:0,x=m?Math.acos(i*p)*Math.sqrt(1/m):0,v=.5*(2*x*i*d+2*r/Math.PI)-t,b=.5*(x*s+n)-e,_=.5*g*(h*y+x*i*p*c)+1/Math.PI,w=g*(f*l/4-x*s*d),S=.125*g*(l*d-x*s*h*f),A=.5*g*(c*p+x*y*i)+.5,k=w*S-A*_;a=(b*w-v*A)/k,o=(v*S-b*_)/k,r=u(r-a,-Math.PI,Math.PI),n=u(n-o,-Iu,Iu)}while((Math.abs(a)>s||Math.abs(o)>s)&&--i>0);return new LngLat(l(r),l(n))}}class CylindricalEqualArea extends Projection{constructor(t){super(t),this.center=t.center||[0,0],this.parallels=t.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(o(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(t,e){const{scale:r,cosPhi:n}=this;return{x:o(t)*n*r+.5,y:-Math.sin(o(e))/n*r+.5,z:0}}unproject(t,e){const{scale:r,cosPhi:n}=this,i=-(e-.5)/r,s=u(l((t-.5)/r)/n,-180,180),a=Math.asin(u(i*n,-1,1)),o=u(l(a),-85.051129,$i);return new LngLat(s,o)}}class Globe extends Mercator{constructor(t){super(t),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug","custom"],this.range=[3,5]}projectTilePoint(t,e,r){const n=cu(t,e,r);return Ds(n,n,du(su(r))),{x:n[0],y:n[1],z:n[2]}}locationPoint(t,e){const n=uu(e.lat,e.lng),i=zs([],n),s=t.elevation?t.elevation.getAtPointOrZero(t.locationCoordinate(e),t._centerAltitude):t._centerAltitude;Ts(n,n,i,ji(1,0)*Di*s);const a=vs(new Float64Array(16));return _s(a,t.pixelMatrix,t.globeMatrix),Ds(n,n,a),new r(n[0],n[1])}pixelsPerMeter(t,e){return ji(1,0)*e}pixelSpaceConversion(t,e,r){const n=jt(ji(1,45)*e,ji(1,t)*e,r);return this.pixelsPerMeter(t,e)/n}createTileMatrix(t,e,r){const n=function(t){const e=function(t,e){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]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}(pu,t.min),r=1/hu(t);return Ss(e,e,[r,r,r])}(su(r.canonical));return _s(new Float64Array(16),t.globeMatrix,n)}createInversionMatrix(t,e){const{center:r}=t,n=du(su(e));return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[0],a=e[1],o=e[2],l=e[3],u=e[8],c=e[9],h=e[10],p=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i-u*n,t[1]=a*i-c*n,t[2]=o*i-h*n,t[3]=l*i-p*n,t[8]=s*n+u*i,t[9]=a*n+c*i,t[10]=o*n+h*i,t[11]=l*n+p*i}(n,n,o(r.lng)),function(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[4],a=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*i+u*n,t[5]=a*i+c*n,t[6]=o*i+h*n,t[7]=l*i+p*n,t[8]=u*i-s*n,t[9]=c*i-a*n,t[10]=h*i-o*n,t[11]=p*i-l*n}(n,n,o(r.lat)),Ss(n,n,[t._pixelsPerMercatorPixel,t._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(t,e,r,n){return iu(t,e,r,!0)||new MercatorCoordinate(0,0)}pointCoordinate3D(t,e,r){const n=this.pointCoordinate(t,e,r,0);return[n.x,n.y,n.z]}isPointAboveHorizon(t,e){return!iu(t,e.x,e.y,!1)}farthestPixelDistance(t){const e=function(t,e){const r=t.cameraToCenterDistance,n=t._centerAltitude*e,i=t._camera,s=t._camera.forward(),a=Ps([],Cs([],s,-r),[0,0,n]),o=t.worldSize/(2*Math.PI),l=[0,0,-o],u=t.width/t.height,c=Math.tan(t.fovAboveCenter),h=Cs([],i.up(),c),p=Cs([],i.right(),c*u),d=zs([],Ps([],Ps([],s,h),p)),f=[];let y;if(new Ray(a,d).closestPointOnSphere(l,o,f)){const e=Ps([],f,l),r=Ls([],e,a);y=Math.cos(t.fovAboveCenter)*Is(r)}else{const t=Ls([],a,l),e=Ls([],l,a);zs(e,e);const r=Is(t)-o;y=Math.sqrt(r*(r+2*o));const n=Math.acos(y/(o+r))-Math.acos(Es(s,e));y*=Math.cos(n)}return 1.01*y}(t,this.pixelsPerMeter(t.center.lat,t.worldSize)),r=fu(t.zoom);if(r>0){const n=yu(t,ji(1,t.center.lat)*t.worldSize),i=t.worldSize/(2*Math.PI),s=Math.max(t.width,t.height)/t.worldSize*Math.PI;return jt(e,n+i*(1-Math.cos(s)),Math.pow(r,10))}return e}upVector(t,e,r){return cu(e,r,t,1)}upVectorScale(t){return{metersToTile:tu*hu(su(t))}}}function Mu(t){const e=t.parallels,r=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case"mercator":return new Mercator(t);case"equirectangular":return new Equirectangular(t);case"naturalEarth":return new NaturalEarth(t);case"equalEarth":return new EqualEarth(t);case"winkelTripel":return new WinkelTripel(t);case"albers":return r?new CylindricalEqualArea(t):new Albers(t);case"lambertConformalConic":return r?new CylindricalEqualArea(t):new LambertConformalConic(t);case"globe":return new Globe(t)}throw new Error(`Invalid projection name: ${t.name}`)}const Pu=Xa.VectorTileFeature.types,Cu=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Tu(t,e,r,n,i,s,a,o,l,u,c,h,p){const d=o?Math.min(Zl,Math.round(o[0])):0,f=o?Math.min(Zl,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),s,a,(d<<1)+(l?1:0),f,16*u,16*c,256*h,256*p)}function zu(t,e,r,n,i,s,a){t.emplaceBack(e,r,n,i,s,a)}function Eu(t,e,r,n,i){t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i)}function Du(t){for(const e of t.sections)if(Kn(e.text))return!0;return!1}class SymbolBuffers{constructor(t){this.layoutVertexArray=new StructArrayLayout4i4ui4i24,this.indexArray=new StructArrayLayout3ui6,this.programConfigurations=t,this.segments=new SegmentVector,this.dynamicLayoutVertexArray=new StructArrayLayout4f16,this.opacityVertexArray=new StructArrayLayout1ul4,this.placedSymbolArray=new PlacedSymbolArray,this.globeExtVertexArray=new StructArrayLayout3i3f20}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,ko.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Mo.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Cu,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,Io.members,!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(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}Sr(SymbolBuffers,"SymbolBuffers");class CollisionBuffers{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new SegmentVector,this.collisionVertexArray=new StructArrayLayout2ub2f12,this.collisionVertexArrayExt=new StructArrayLayout3f12}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Po.members,!0),this.collisionVertexBufferExt=t.createVertexBuffer(this.collisionVertexArrayExt,Co.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Sr(CollisionBuffers,"CollisionBuffers");class SymbolBucket{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=vs([]),this.placementViewportMatrix=vs([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Do(this.zoom,e["text-size"]),this.iconSizeData=Do(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=>ul[t])),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID,this.projection=t.projection}createArrays(){this.text=new SymbolBuffers(new ProgramConfigurationSet(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new SymbolBuffers(new ProgramConfigurationSet(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new GlyphOffsetArray,this.lineVertexArray=new SymbolLineVertexArray,this.symbolInstances=new SymbolInstanceArray}calculateGlyphDependencies(t,e,r,n,i){for(let r=0;r<t.length;r++)if(e[t.charCodeAt(r)]=!0,n&&i){const n=Fo[t.charAt(r)];n&&(e[n.charCodeAt(0)]=!0)}}populate(t,e,r,n){const i=this.layers[0],s=i.layout,a="globe"===this.projection.name,o=s.get("text-font"),l=s.get("text-field"),u=s.get("icon-image"),c=("constant"!==l.value.kind||l.value.value instanceof Formatted&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),h="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,p=s.get("symbol-sort-key");if(this.features=[],!c&&!h)return;const d=e.iconDependencies,f=e.glyphDependencies,y=e.availableImages,m=new EvaluationParameters(this.zoom);for(const{feature:e,id:l,index:u,sourceLayerIndex:g}of t){const t=i._featureFilter.needGeometry,x=Wi(e,t);if(!i._featureFilter.filter(m,x,r))continue;if(t||(x.geometry=Ki(e,r,n)),a&&1!==e.type&&r.z<=5){const t=x.geometry,e=.98078528056;for(let n=0;n<t.length;n++)t[n]=Gi(t[n],(t=>t),((t,n)=>Es(cu(t.x,t.y,r,1),cu(n.x,n.y,r,1))<e))}let v,b;if(c){const t=i.getValueAndResolveTokens("text-field",x,r,y),e=Formatted.factory(t);Du(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===li()||this.hasRTLText&&ci.isParsed())&&(v=Vo(e,i,x))}if(h){const t=i.getValueAndResolveTokens("icon-image",x,r,y);b=t instanceof ResolvedImage?t:ResolvedImage.fromString(t)}if(!v&&!b)continue;const _=this.sortFeaturesByKey?p.evaluate(x,{},r):void 0;if(this.features.push({id:l,text:v,icon:b,index:u,sourceLayerIndex:g,geometry:x.geometry,properties:e.properties,type:Pu[e.type],sortKey:_}),b&&(d[b.name]=!0),v){const t=o.evaluate(x,{},r).join(","),e="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(ul.vertical)>=0;for(const r of v.sections)if(r.image)d[r.image.name]=!0;else{const n=qn(v.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 a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const d=l(p,h),f=l(p,h,!0);if(d in r&&f in e&&r[d]!==e[f]){const t=o(d,f,h),i=a(d,f,n[t].geometry);delete e[d],delete r[f],r[l(p,n[i].geometry,!0)]=i,n[t].geometry=null}else d in r?a(d,f,h):f in e?o(d,f,h):(s(u),e[d]=i-1,r[f]=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()}getProjection(){return this.projectionInstance||(this.projectionInstance=Mu(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const r=this.lineVertexArray.length,n=t.segment;if(void 0!==n){let r=t.dist(e[n+1]),i=t.dist(e[n]);const s={};for(let t=n+1;t<e.length;t++)s[t]={x:e[t].x,y:e[t].y,tileUnitDistanceFromAnchor:r},t<e.length-1&&(r+=e[t+1].dist(e[t]));for(let t=n||0;t>=0;t--)s[t]={x:e[t].x,y:e[t].y,tileUnitDistanceFromAnchor:i},t>0&&(i+=e[t-1].dist(e[t]));for(let t=0;t<e.length;t++){const e=s[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,a,o,l,u,c,h,p,d){const f=t.indexArray,y=t.layoutVertexArray,m=t.globeExtVertexArray,g=t.segments.prepareSegment(4*e.length,y,f,this.canOverlap?s.sortKey:void 0),x=this.glyphOffsetArray.length,v=g.vertexLength,b=this.allowVerticalPlacement&&a===ul.vertical?Math.PI/2:0,_=s.text&&s.text.sections;for(let n=0;n<e.length;n++){const{tl:i,tr:a,bl:u,br:c,tex:h,pixelOffsetTL:x,pixelOffsetBR:v,minFontScaleX:w,minFontScaleY:S,glyphOffset:A,isSDF:k,sectionIndex:I}=e[n],M=g.vertexLength,P=A[1];if(Tu(y,l.x,l.y,i.x,P+i.y,h.x,h.y,r,k,x.x,x.y,w,S),Tu(y,l.x,l.y,a.x,P+a.y,h.x+h.w,h.y,r,k,v.x,x.y,w,S),Tu(y,l.x,l.y,u.x,P+u.y,h.x,h.y+h.h,r,k,x.x,v.y,w,S),Tu(y,l.x,l.y,c.x,P+c.y,h.x+h.w,h.y+h.h,r,k,v.x,v.y,w,S),o){const e=o.anchor,r=o.up;zu(m,e.x,e.y,e.z,r[0],r[1],r[2]),zu(m,e.x,e.y,e.z,r[0],r[1],r[2]),zu(m,e.x,e.y,e.z,r[0],r[1],r[2]),zu(m,e.x,e.y,e.z,r[0],r[1],r[2]),Eu(t.dynamicLayoutVertexArray,e.x,e.y,e.z,b)}else Eu(t.dynamicLayoutVertexArray,l.x,l.y,l.z,b);f.emplaceBack(M,M+1,M+2),f.emplaceBack(M+1,M+2,M+3),g.vertexLength+=4,g.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),n!==e.length-1&&I===e[n+1].sectionIndex||t.programConfigurations.populatePaintArrays(y.length,s,s.index,{},p,d,_&&_[I])}const w=o?o.anchor:l;t.placedSymbolArray.emplaceBack(w.x,w.y,w.z,l.x,l.y,x,this.glyphOffsetArray.length-x,v,u,c,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,h,0)}_commitLayoutVertex(t,e,r,n,i,s,a){t.emplaceBack(e,r,n,i,s,Math.round(a.x),Math.round(a.y))}_addCollisionDebugVertices(t,e,n,i,s,a,o){const l=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),u=l.vertexLength,c=o.tileAnchorX,h=o.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,a,c,h,new r(t.x1,t.y1)),this._commitLayoutVertex(n.layoutVertexArray,i,s,a,c,h,new r(t.x2,t.y1)),this._commitLayoutVertex(n.layoutVertexArray,i,s,a,c,h,new r(t.x2,t.y2)),this._commitLayoutVertex(n.layoutVertexArray,i,s,a,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 a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceTextSize(t,s,e,a);this._addCollisionDebugVertices(n,i,this.textCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(t,e,r,n,i,s){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceIconSize(t,e,a);this._addCollisionDebugVertices(n,i,this.iconCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}generateCollisionDebugBuffers(t,e){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new CollisionBuffers(StructArrayLayout3i2i2i16,To.members,StructArrayLayout2ui4),this.iconCollisionBox=new CollisionBuffers(StructArrayLayout3i2i2i16,To.members,StructArrayLayout2ui4);const r=Lo(this.iconSizeData,t),n=Lo(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=Bo(this.textSizeData,t,i)/zo;return this.tilePixelRatio*s}getSymbolInstanceIconSize(t,e,r){const n=this.icon.placedSymbolArray.get(r),i=Bo(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 a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceTextSize(t,s,e,a);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=Lo(this.iconSizeData,t),n=Lo(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,a,o,l){const u={};for(let n=e;n<r;n++){const e=t.get(n);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,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<a;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=o;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 a=this.symbolInstances.get(t);n.push(0|Math.round(e*a.tileAnchorX+r*a.tileAnchorY)),i.push(a.featureIndex)}return s.sort(((t,e)=>n[t]-n[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Sr(SymbolBucket,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),SymbolBucket.MAX_GLYPHS=65535,SymbolBucket.addDynamicAttributes=Eu;const Bu=new Properties({"symbol-placement":new DataConstantProperty(Tr.layout_symbol["symbol-placement"]),"symbol-spacing":new DataConstantProperty(Tr.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new DataConstantProperty(Tr.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new DataDrivenProperty(Tr.layout_symbol["symbol-sort-key"]),"symbol-z-order":new DataConstantProperty(Tr.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new DataConstantProperty(Tr.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new DataConstantProperty(Tr.layout_symbol["icon-ignore-placement"]),"icon-optional":new DataConstantProperty(Tr.layout_symbol["icon-optional"]),"icon-rotation-alignment":new DataConstantProperty(Tr.layout_symbol["icon-rotation-alignment"]),"icon-size":new DataDrivenProperty(Tr.layout_symbol["icon-size"]),"icon-text-fit":new DataConstantProperty(Tr.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new DataConstantProperty(Tr.layout_symbol["icon-text-fit-padding"]),"icon-image":new DataDrivenProperty(Tr.layout_symbol["icon-image"]),"icon-rotate":new DataDrivenProperty(Tr.layout_symbol["icon-rotate"]),"icon-padding":new DataConstantProperty(Tr.layout_symbol["icon-padding"]),"icon-keep-upright":new DataConstantProperty(Tr.layout_symbol["icon-keep-upright"]),"icon-offset":new DataDrivenProperty(Tr.layout_symbol["icon-offset"]),"icon-anchor":new DataDrivenProperty(Tr.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new DataConstantProperty(Tr.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new DataConstantProperty(Tr.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new DataConstantProperty(Tr.layout_symbol["text-rotation-alignment"]),"text-field":new DataDrivenProperty(Tr.layout_symbol["text-field"]),"text-font":new DataDrivenProperty(Tr.layout_symbol["text-font"]),"text-size":new DataDrivenProperty(Tr.layout_symbol["text-size"]),"text-max-width":new DataDrivenProperty(Tr.layout_symbol["text-max-width"]),"text-line-height":new DataDrivenProperty(Tr.layout_symbol["text-line-height"]),"text-letter-spacing":new DataDrivenProperty(Tr.layout_symbol["text-letter-spacing"]),"text-justify":new DataDrivenProperty(Tr.layout_symbol["text-justify"]),"text-radial-offset":new DataDrivenProperty(Tr.layout_symbol["text-radial-offset"]),"text-variable-anchor":new DataConstantProperty(Tr.layout_symbol["text-variable-anchor"]),"text-anchor":new DataDrivenProperty(Tr.layout_symbol["text-anchor"]),"text-max-angle":new DataConstantProperty(Tr.layout_symbol["text-max-angle"]),"text-writing-mode":new DataConstantProperty(Tr.layout_symbol["text-writing-mode"]),"text-rotate":new DataDrivenProperty(Tr.layout_symbol["text-rotate"]),"text-padding":new DataConstantProperty(Tr.layout_symbol["text-padding"]),"text-keep-upright":new DataConstantProperty(Tr.layout_symbol["text-keep-upright"]),"text-transform":new DataDrivenProperty(Tr.layout_symbol["text-transform"]),"text-offset":new DataDrivenProperty(Tr.layout_symbol["text-offset"]),"text-allow-overlap":new DataConstantProperty(Tr.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new DataConstantProperty(Tr.layout_symbol["text-ignore-placement"]),"text-optional":new DataConstantProperty(Tr.layout_symbol["text-optional"])});var Lu={paint:new Properties({"icon-opacity":new DataDrivenProperty(Tr.paint_symbol["icon-opacity"]),"icon-color":new DataDrivenProperty(Tr.paint_symbol["icon-color"]),"icon-halo-color":new DataDrivenProperty(Tr.paint_symbol["icon-halo-color"]),"icon-halo-width":new DataDrivenProperty(Tr.paint_symbol["icon-halo-width"]),"icon-halo-blur":new DataDrivenProperty(Tr.paint_symbol["icon-halo-blur"]),"icon-translate":new DataConstantProperty(Tr.paint_symbol["icon-translate"]),"icon-translate-anchor":new DataConstantProperty(Tr.paint_symbol["icon-translate-anchor"]),"text-opacity":new DataDrivenProperty(Tr.paint_symbol["text-opacity"]),"text-color":new DataDrivenProperty(Tr.paint_symbol["text-color"],{runtimeType:$,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new DataDrivenProperty(Tr.paint_symbol["text-halo-color"]),"text-halo-width":new DataDrivenProperty(Tr.paint_symbol["text-halo-width"]),"text-halo-blur":new DataDrivenProperty(Tr.paint_symbol["text-halo-blur"]),"text-translate":new DataConstantProperty(Tr.paint_symbol["text-translate"]),"text-translate-anchor":new DataConstantProperty(Tr.paint_symbol["text-translate-anchor"])}),layout:Bu};class FormatSectionOverride{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:R,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}}Sr(FormatSectionOverride,"FormatSectionOverride",{omit:["defaultValue"]});class SymbolStyleLayer extends StyleLayer{constructor(t){super(t,Lu)}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()||Ne(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 SymbolBucket(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of Lu.paint.overridableProperties){if(!SymbolStyleLayer.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new FormatSectionOverride(e),n=new StyleExpression(r,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new ZoomConstantExpression("source",n):new ZoomDependentExpression("composite",n,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new PossiblyEvaluatedPropertyValue(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&SymbolStyleLayer.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=Lu.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 Formatted)s(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof it&&rt(e.value)===G?s(e.value.sections):e instanceof FormatExpression?s(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return i}getProgramConfiguration(t){return new ProgramConfiguration(this,t)}}var Vu={paint:new Properties({"background-color":new DataConstantProperty(Tr.paint_background["background-color"]),"background-pattern":new CrossFadedProperty(Tr.paint_background["background-pattern"]),"background-opacity":new DataConstantProperty(Tr.paint_background["background-opacity"])})},Fu={paint:new Properties({"raster-opacity":new DataConstantProperty(Tr.paint_raster["raster-opacity"]),"raster-hue-rotate":new DataConstantProperty(Tr.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new DataConstantProperty(Tr.paint_raster["raster-brightness-min"]),"raster-brightness-max":new DataConstantProperty(Tr.paint_raster["raster-brightness-max"]),"raster-saturation":new DataConstantProperty(Tr.paint_raster["raster-saturation"]),"raster-contrast":new DataConstantProperty(Tr.paint_raster["raster-contrast"]),"raster-resampling":new DataConstantProperty(Tr.paint_raster["raster-resampling"]),"raster-fade-duration":new DataConstantProperty(Tr.paint_raster["raster-fade-duration"])})};class CustomStyleLayer extends StyleLayer{constructor(t){super(t,{}),this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}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 Ru={paint:new Properties({"sky-type":new DataConstantProperty(Tr.paint_sky["sky-type"]),"sky-atmosphere-sun":new DataConstantProperty(Tr.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new DataConstantProperty(Tr.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new DataConstantProperty(Tr.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new DataConstantProperty(Tr.paint_sky["sky-gradient-radius"]),"sky-gradient":new ColorRampProperty(Tr.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new DataConstantProperty(Tr.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new DataConstantProperty(Tr.paint_sky["sky-atmosphere-color"]),"sky-opacity":new DataConstantProperty(Tr.paint_sky["sky-opacity"])})};function ju(t,e,r){const n=[0,0,1],i=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}([]);return function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);t[0]=n*l-s*o,t[1]=i*l+a*o,t[2]=s*l+n*o,t[3]=a*l-i*o}(i,i,r?-o(t)+Math.PI:o(t)),function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);t[0]=n*l+a*o,t[1]=i*l+s*o,t[2]=s*l-i*o,t[3]=a*l-n*o}(i,i,-o(e)),function(t,e,r){var n=r[0],i=r[1],s=r[2],a=e[0],o=e[1],l=e[2],u=i*l-s*o,c=s*a-n*l,h=n*o-i*a,p=i*h-s*c,d=s*u-n*h,f=n*c-i*u,y=2*r[3];c*=y,h*=y,d*=2,f*=2,t[0]=a+(u*=y)+(p*=2),t[1]=o+c+d,t[2]=l+h+f}(n,n,i),zs(n,n)}const Ou={circle:class CircleStyleLayer extends StyleLayer{constructor(t){super(t,ms)}createBucket(t){return new CircleBucket(t)}queryRadius(t){const e=t;return hs("circle-radius",this,e)+hs("circle-stroke-width",this,e)+ps(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=fs(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 Rs(t,n,s,a,o,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,u)}getProgramIds(){return["circle"]}getProgramConfiguration(t){return new ProgramConfiguration(this,t)}},heatmap:class HeatmapStyleLayer extends StyleLayer{createBucket(t){return new HeatmapBucket(t)}constructor(t){super(t,Gs),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Xs({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 hs("heatmap-radius",this,t)}queryIntersectsFeature(t,e,n,i,s,a,o,l){const u=this.paint.get("heatmap-radius").evaluate(e,n);return Rs(t,i,a,o,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 ProgramConfiguration(this,t)}},hillshade:class HillshadeStyleLayer extends StyleLayer{constructor(t){super(t,Ys)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class FillStyleLayer extends StyleLayer{constructor(t){super(t,Ba)}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 ProgramConfiguration(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 FillBucket(t)}queryRadius(){return ps(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,r,n,i,s){return!t.queryGeometry.isAboveHorizon&&rs(ds(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),n)}isTileClipped(){return!0}},"fill-extrusion":class FillExtrusionStyleLayer extends StyleLayer{constructor(t){super(t,oo)}createBucket(t){return new FillExtrusionBucket(t)}queryRadius(){return ps(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 ProgramConfiguration(this,t)}queryIntersectsFeature(t,e,n,i,s,a,o,l,u){const c=fs(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.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],f=l&&a.elevation,y=a.elevation?a.elevation.exaggeration():1,m=t.tile.getBucket(this);if(f&&m instanceof FillExtrusionBucket){const t=m.centroidVertexArray,e=u+1;if(e<t.length){const r=t.get(e);d[0]=r.a_centroid_pos0,d[1]=r.a_centroid_pos1}}if(0===d[0]&&1===d[1])return!1;"globe"===a.projection.name&&(i=so([i],[new r(0,0),new r(Di,Di)],t.tileID.canonical).map((t=>t.polygon)).flat());const g=function(t,e,n,i,s,a,o,l,u,c,h){return"globe"===t.projection.name?function(t,e,r,n,i,s,a,o,l,u,c){const h=[],p=[],d=t.projection.upVectorScale(c,t.center.lat,t.worldSize).metersToTile,f=[0,0,0,1],y=[0,0,0,1],m=(t,e,r,n)=>{t[0]=e,t[1]=r,t[2]=n,t[3]=1},g=function(){const t=Math.PI/32,e=Math.tan(t),r=Bi;return r*Math.sqrt(1+2*e*e)-r}();r>0&&(r+=g),n+=g;for(const g of e){const e=[],x=[];for(const h of g){const p=h.x+i.x,g=h.y+i.y,v=t.projection.projectTilePoint(p,g,c),b=t.projection.upVector(c,h.x,h.y);let _=r,w=n;if(a){const t=fo(p,g,r,n,a,o,l,u);_+=t.base,w+=t.top}0!==r?m(f,v.x+b[0]*d*_,v.y+b[1]*d*_,v.z+b[2]*d*_):m(f,v.x,v.y,v.z),m(y,v.x+b[0]*d*w,v.y+b[1]*d*w,v.z+b[2]*d*w),Ds(f,f,s),Ds(y,y,s),e.push(po(f)),x.push(po(y))}h.push(e),p.push(x)}return[h,p]}(t,e,n,i,s,a,o,l,u,c,h):o?function(t,e,r,n,i,s,a,o,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,f=fo(c,p,e,r,s,a,o,l);h[0]=c,h[1]=p,h[2]=f.base,h[3]=1,Vs(h,h,i),h[3]=Math.max(h[3],1e-5);const y=po([h[0]/h[3],h[1]/h[3],h[2]/h[3]]);h[0]=c,h[1]=p,h[2]=f.top,h[3]=1,Vs(h,h,i),h[3]=Math.max(h[3],1e-5);const m=po([h[0]/h[3],h[1]/h[3],h[2]/h[3]]);t.push(y),d.push(m)}u.push(t),c.push(d)}return[u,c]}(e,n,i,s,a,o,l,u,c):function(t,e,n,i,s){const a=[],o=[],l=s[8]*e,u=s[9]*e,c=s[10]*e,h=s[11]*e,p=s[8]*n,d=s[9]*n,f=s[10]*n,y=s[11]*n;for(const e of t){const t=[],n=[];for(const a of e){const e=a.x+i.x,o=a.y+i.y,m=s[0]*e+s[4]*o+s[12],g=s[1]*e+s[5]*o+s[13],x=s[2]*e+s[6]*o+s[14],v=s[3]*e+s[7]*o+s[15],b=m+l,_=g+u,w=x+c,S=Math.max(v+h,1e-5),A=m+p,k=g+d,I=x+f,M=Math.max(v+y,1e-5),P=new r(b/S,_/S);P.z=w/S,t.push(P);const C=new r(A/M,k/M);C.z=I/M,n.push(C)}a.push(t),o.push(n)}return[a,o]}(e,n,i,s,a)}(a,i,p,h,c,o,f?l:null,d,y,a.center.lat,t.tileID.canonical),x=t.queryGeometry;return function(t,e,r){let n=1/0;rs(r,e)&&(n=ho(r,e[0]));for(let i=0;i<e.length;i++){const s=e[i],a=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],a[t+1],a[t],e];ts(r,i)&&(n=Math.min(n,ho(r,i)))}}return n!==1/0&&n}(g[0],g[1],x.isPointQuery()?x.screenBounds:x.screenGeometry)}},line:class LineStyleLayer extends StyleLayer{constructor(t){super(t,wo),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 Rt,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"]=So.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new LineBucket(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getProgramConfiguration(t){return new ProgramConfiguration(this,t)}queryRadius(t){const e=t,r=Ao(hs("line-width",this,e),hs("line-gap-width",this,e)),n=hs("line-offset",this,e);return r/2+Math.abs(n)+ps(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,n,i,s,a){if(t.queryGeometry.isAboveHorizon)return!1;const o=ds(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,t.pixelToTileUnitsFactor),l=t.pixelToTileUnitsFactor/2*Ao(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],a=[];for(let t=0;t<s.length;t++){const r=s[t-1],n=s[t],o=s[t+1],l=0===t?i:n.sub(r)._unit()._perp(),u=t===s.length-1?i:o.sub(n)._unit()._perp(),c=l._add(u)._unit();c._mult(1/(c.x*u.x+c.y*u.y)),a.push(c._mult(e)._add(n))}n.push(a)}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(us(t,i[e]))return!0;if(ns(t,i,r))return!0}return!1}(o,i,l)}isTileClipped(){return!0}},symbol:SymbolStyleLayer,background:class BackgroundStyleLayer extends StyleLayer{constructor(t){super(t,Vu)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class RasterStyleLayer extends StyleLayer{constructor(t){super(t,Fu)}getProgramIds(){return["raster"]}},sky:class SkyLayer extends StyleLayer{constructor(t){super(t,Ru),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=Xs({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}return!1}getCenter(t,e){if("atmosphere"===this.paint.get("sky-type")){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")&&_("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),n?ju(s.azimuthal,90-s.polar,e):ju(r[0],90-r[1],e)}const r=this.paint.get("sky-gradient-center");return ju(r[0],90-r[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 Uu=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function $u(t){if("number"==typeof t||"boolean"==typeof t||"string"==typeof t||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const r of t)e+=`${$u(r)},`;return`${e}]`}let e="{";for(const r of Object.keys(t).sort())e+=`${r}:${$u(t[r])},`;return`${e}}`}function qu(t){let e="";for(const r of Uu)e+=`/${$u(t[r])}`;return e}class StyleLayerIndex{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 CustomStyleLayer(r):new Ou[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]||qu(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}(h(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 a=i[s];a||(a=i[s]=[]),a.push(e)}}}class DictionaryCoder{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]}}const Nu=["tile","layer","source","sourceLayer","state"];class Feature{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,this._z=e,this._x=r,this._y=n,this.properties=t.properties,this.id=i}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={type:"Feature",geometry:this.geometry,properties:this.properties};void 0!==this.id&&(t.id=this.id);for(const e of Nu)void 0!==this[e]&&(t[e]=this[e]);return t}}class Texture{constructor(t,e,r,n){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,n)}update(t,e,r){const{width:n,height:s}=t,{context:a}=this,{gl:o}=a,{HTMLImageElement:l,HTMLCanvasElement:u,HTMLVideoElement:c,ImageData:h,ImageBitmap:p}=i;if(o.bindTexture(o.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA&&(!e||!1!==e.premultiply)),r||this.size&&this.size[0]===n&&this.size[1]===s){const{x:e,y:i}=r||{x:0,y:0};t instanceof l||t instanceof u||t instanceof c||t instanceof h||p&&t instanceof p?o.texSubImage2D(o.TEXTURE_2D,0,e,i,o.RGBA,o.UNSIGNED_BYTE,t):o.texSubImage2D(o.TEXTURE_2D,0,e,i,n,s,o.RGBA,o.UNSIGNED_BYTE,t.data)}else this.size=[n,s],t instanceof l||t instanceof u||t instanceof c||t instanceof h||p&&t instanceof p?o.texImage2D(o.TEXTURE_2D,0,this.format,this.format,o.UNSIGNED_BYTE,t):o.texImage2D(o.TEXTURE_2D,0,this.format,n,s,0,this.format,o.UNSIGNED_BYTE,t.data);this.useMipmap=Boolean(e&&e.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}bind(t,e){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap?t===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_NEAREST:t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}const Zu=32,Gu=33,Xu=new Uint16Array(8184);for(let t=0;t<2046;t++){let e=t+2,r=0,n=0,i=0,s=0,a=0,o=0;for(1&e?i=s=a=Zu:r=n=o=Zu;(e>>=1)>1;){const t=r+i>>1,l=n+s>>1;1&e?(i=r,s=n,r=a,n=o):(r=i,n=s,i=a,s=o),a=t,o=l}const l=4*t;Xu[l+0]=r,Xu[l+1]=n,Xu[l+2]=i,Xu[l+3]=s}const Yu=new Uint16Array(2178),Ju=new Uint8Array(1089),Ku=new Uint16Array(1089);function Wu(t){return 0===t?-.03125:32===t?.03125:0}var Hu=di([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const Qu={type:2,extent:Di,loadGeometry:()=>[[new r(0,0),new r(8193,0),new r(8193,8193),new r(0,8193),new r(0,0)]]};class Tile{constructor(t,e,r,n,i){this.tileID=t,this.uid=d++,this.uses=0,this.tileSize=e,this.tileZoom=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=i,this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(t){const e=t+this.timeAdded;e<ei.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=mu(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,e,r){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){const r={};if(!e)return r;for(const n of t){const t=n.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){n.layers=t,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)r[e.id]=n}}return r}(t.buckets,e.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const e=this.buckets[t];if(e instanceof SymbolBucket){if(this.hasSymbolBuckets=!0,!r)break;e.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const e=this.buckets[t];if(e instanceof SymbolBucket&&e.hasRTLText){this.hasRTLText=!0,ci.isLoading()||ci.isLoaded()||"deferred"!==li()||ui();break}}this.queryPadding=0;for(const t in this.buckets){const r=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(t).queryRadius(r))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas)}else this.collisionBoxArray=new CollisionBoxArray}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const r=this.buckets[e];r.uploadPending()&&r.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Texture(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Texture(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new Texture(t,this.lineAtlas.image,e.ALPHA),this.lineAtlas.uploaded=!0)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,r,n,i,s,a,o){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:n,pixelPosMatrix:a,transform:s,params:i,tileTransform:this.tileTransform},t,e,r):{}}querySourceFeatures(t,e){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),i=e?e.sourceLayer:"",s=n._geojsonTileLayer||n[i];if(!s)return;const a=qr(e&&e.filter),{z:o,x:l,y:u}=this.tileID.canonical,c={z:o,x:l,y:u};for(let e=0;e<s.length;e++){const n=s.feature(e);if(a.needGeometry){const t=Wi(n,!0);if(!a.filter(new EvaluationParameters(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!a.filter(new EvaluationParameters(this.tileID.overscaledZ),n))continue;const h=r.getId(n,i),p=new Feature(n,o,l,u,h);p.tile=c,t.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const e=this.expirationTime;if(t.cacheControl){const e=k(t.cacheControl);e["max-age"]&&(this.expirationTime=Date.now()+1e3*e["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const t=Date.now();let r=!1;if(this.expirationTime>t)r=!1;else if(e)if(this.expirationTime<e)r=!0;else{const n=this.expirationTime-e;n?this.expirationTime=t+Math.max(n,3e4):r=!0}else r=!0;r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length||!e)return;const r=this.latestFeatureIndex.loadVTLayers(),n=e.style.listImages();for(const i in this.buckets){if(!e.style.hasLayer(i))continue;const s=this.buckets[i],a=s.layers[0].sourceLayer||"_geojsonTileLayer",o=r[a],l=t[a];if(!o||!l||0===Object.keys(l).length)continue;if(s.update(l,o,n,this.imageAtlas&&this.imageAtlas.patternPositions||{}),s instanceof LineBucket||s instanceof FillBucket){const t=e.style._getSourceCache(s.layers[0].source);e._terrain&&e._terrain.enabled&&t&&s.programConfigurations.needsUpload&&e._terrain._clearRenderCacheForTile(t.id,this.tileID)}const u=e&&e.style&&e.style.getLayer(i);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(s)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ei.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=ei.now()+t}setTexture(t,e){const r=e.context,n=r.gl;this.texture=e.getTileTexture(t.width),this.texture?this.texture.update(t,{useMipmap:!0}):(this.texture=new Texture(r,t,n.RGBA,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),r.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax))}setDependencies(t,e){const r={};for(const t of e)r[t]=!0;this.dependencies[t]=r}hasDependency(t,e){for(const r of t){const t=this.dependencies[r];if(t)for(const r of e)if(t[r])return!0}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,e){if(!e||"mercator"===e.name||this._tileDebugBuffer)return;const r=Ki(Qu,this.tileID.canonical,this.tileTransform)[0],n=new StructArrayLayout2i4,i=new StructArrayLayout1ui2;for(let t=0;t<r.length;t++){const{x:e,y:s}=r[t];n.emplaceBack(e,s),i.emplaceBack(t)}i.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(i),this._tileDebugBuffer=t.createVertexBuffer(n,Hl.members),this._tileDebugSegments=SegmentVector.simpleSegment(0,0,n.length,i.length)}_makeTileBoundsBuffers(t,e){if(this._tileBoundsBuffer||!e||"mercator"===e.name)return;const r=Ki(Qu,this.tileID.canonical,this.tileTransform)[0];let n,i;if(this.isRaster){const t=function(t,e){const r=mu(t,e),n=Math.pow(2,t.z);for(let i=0;i<Gu;i++)for(let s=0;s<Gu;s++){const a=Oi((t.x+(s+Wu(s))/Zu)/n),o=Ui((t.y+(i+Wu(i))/Zu)/n),l=e.project(a,o),u=i*Gu+s;Yu[2*u+0]=Math.round((l.x*r.scale-r.x)*Di),Yu[2*u+1]=Math.round((l.y*r.scale-r.y)*Di)}Ju.fill(0),Ku.fill(0);for(let t=2045;t>=0;t--){const e=4*t,r=Xu[e+0],n=Xu[e+1],i=Xu[e+2],s=Xu[e+3],a=r+i>>1,o=n+s>>1,l=a+o-n,u=o+r-a,c=n*Gu+r,h=s*Gu+i,p=o*Gu+a,d=Math.hypot((Yu[2*c+0]+Yu[2*h+0])/2-Yu[2*p+0],(Yu[2*c+1]+Yu[2*h+1])/2-Yu[2*p+1])>=16;if(Ju[p]=Ju[p]||(d?1:0),t<1022){const t=(n+u>>1)*Gu+(r+l>>1),e=(s+u>>1)*Gu+(i+l>>1);Ju[p]=Ju[p]||Ju[t]||Ju[e]}}const i=new StructArrayLayout4i8,s=new StructArrayLayout3ui6;let a=0;function o(t,e){const r=e*Gu+t;return 0===Ku[r]&&(i.emplaceBack(Yu[2*r+0],Yu[2*r+1],t*Di/Zu,e*Di/Zu),Ku[r]=++a),Ku[r]-1}function l(t,e,r,n,i,a){const u=t+r>>1,c=e+n>>1;if(Math.abs(t-i)+Math.abs(e-a)>1&&Ju[c*Gu+u])l(i,a,t,e,u,c),l(r,n,i,a,u,c);else{const l=o(t,e),u=o(r,n),c=o(i,a);s.emplaceBack(l,u,c)}}return l(0,0,Zu,Zu,Zu,0),l(Zu,Zu,0,0,0,Zu),{vertices:i,indices:s}}(this.tileID.canonical,e);n=t.vertices,i=t.indices}else{n=new StructArrayLayout4i8,i=new StructArrayLayout3ui6;for(const{x:t,y:e}of r)n.emplaceBack(t,e,0,0);const t=Ws(n.int16,void 0,4);for(let e=0;e<t.length;e+=3)i.emplaceBack(t[e],t[e+1],t[e+2])}this._tileBoundsBuffer=t.createVertexBuffer(n,Hu.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(i),this._tileBoundsSegments=SegmentVector.simpleSegment(0,0,n.length,i.length)}_makeGlobeTileDebugBuffers(t,e){const r=e.projection;if(!r||"globe"!==r.name||e.freezeTileCoverage)return;const n=this.tileID.canonical,i=du(function(t,e){const r=fu(e.zoom);if(0===r)return su(t);const n=au(t),i=ou(n),s=Fi(n.getWest())*e.worldSize,a=Fi(n.getEast())*e.worldSize,o=Ri(n.getNorth())*e.worldSize,l=Ri(n.getSouth())*e.worldSize,u=[s,o,0],c=[a,o,0],h=[s,l,0],p=[a,l,0],d=bs([],e.globeMatrix);return Ds(u,u,d),Ds(c,c,d),Ds(h,h,d),Ds(p,p,d),i[0]=Ot(i[0],h,r),i[1]=Ot(i[1],p,r),i[2]=Ot(i[2],c,r),i[3]=Ot(i[3],u,r),Aabb.fromPoints(i)}(n,e)),s=fu(e.zoom);let a;s>0&&(a=bs(new Float64Array(16),e.globeMatrix));const o=(n.x+.5)/(1<<n.z)-Fi(e.center.lng);let l=0;o>.5?l=-1:o<-.5&&(l=1),this._makeGlobeTileDebugBorderBuffer(t,n,e,i,a,s,l),this._makeGlobeTileDebugTextBuffer(t,n,e,i,a,s,l)}_globePoint(t,e,r,n,i,s,a,o){let l=cu(t,e,r);if(s){const i=1<<r.z,u=[((t/Di+r.x)/i+o)*n,(e/Di+r.y)/i*n,0];Ds(u,u,s),l=Ot(l,u,a)}return Ds(l,l,i)}_makeGlobeTileDebugBorderBuffer(t,e,r,n,i,s,a){const o=new StructArrayLayout2i4,l=new StructArrayLayout1ui2,u=new StructArrayLayout3i6,c=(t,c,h,p,d)=>{const f=(h-t)/(d-1),y=(p-c)/(d-1),m=o.length;for(let h=0;h<d;h++){const p=t+h*f,d=c+h*y;o.emplaceBack(p,d);const g=this._globePoint(p,d,e,r.worldSize,n,i,s,a);u.emplaceBack(g[0],g[1],g[2]),l.emplaceBack(m+h)}},h=Di;c(0,0,h,0,16),c(h,0,h,h,16),c(h,h,0,h,16),c(0,h,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(l),this._tileDebugBuffer=t.createVertexBuffer(o,Hl.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(u,Wl.members),this._tileDebugSegments=SegmentVector.simpleSegment(0,0,o.length,l.length)}_makeGlobeTileDebugTextBuffer(t,e,r,n,i,s,a){const o=new StructArrayLayout2i4,l=new StructArrayLayout3ui6,u=new StructArrayLayout3i6,c=25;l.reserve(32),o.reserve(c),u.reserve(c);const h=(t,e)=>c*t+e;for(let t=0;t<c;t++){const l=2048*t;for(let t=0;t<c;t++){const c=2048*t;o.emplaceBack(c,l);const h=this._globePoint(c,l,e,r.worldSize,n,i,s,a);u.emplaceBack(h[0],h[1],h[2])}}for(let t=0;t<4;t++)for(let e=0;e<4;e++){const r=h(t,e),n=h(t,e+1),i=h(t+1,e),s=h(t+1,e+1);l.emplaceBack(r,n,i),l.emplaceBack(i,n,s)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(l),this._tileDebugTextBuffer=t.createVertexBuffer(o,Hl.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(u,Wl.members),this._tileDebugTextSegments=SegmentVector.simpleSegment(0,0,c,32)}}class SourceFeatureState{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,e,r){const n=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},p(this.stateChanges[t][n],r),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==n&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][n]){this.deletedStates[t][n]={};for(const e in this.state[t][n])r[e]||(this.deletedStates[t][n][e]=null)}else for(const e in r)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][e]&&delete this.deletedStates[t][n][e]}removeFeatureState(t,e,r){if(null===this.deletedStates[t])return;const n=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&void 0!==e)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][r]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][n])for(r in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][r]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}getState(t,e){const r=String(e),n=p({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const r=this.deletedStates[t][e];if(null===r)return{};for(const t in r)delete n[t]}return n}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,e){const r={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const e={};for(const r in this.stateChanges[t])this.state[t][r]||(this.state[t][r]={}),p(this.state[t][r],this.stateChanges[t][r]),e[r]=this.state[t][r];r[t]=e}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const e={};if(null===this.deletedStates[t])for(const r in this.state[t])e[r]={},this.state[t][r]={};else for(const r in this.deletedStates[t]){if(null===this.deletedStates[t][r])this.state[t][r]={};else for(const e of Object.keys(this.deletedStates[t][r]))delete this.state[t][r][e];e[r]=this.state[t][r]}r[t]=r[t]||{},p(r[t],e)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const n in t)t[n].setFeatureState(r,e)}}class MipLevel{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 tc(t,e,r,n){let i=0,s=Number.MAX_VALUE;for(let a=0;a<3;a++)if(Math.abs(n[a])<1e-15){if(r[a]<t[a]||r[a]>e[a])return null}else{const o=1/n[a];let l=(t[a]-r[a])*o,u=(e[a]-r[a])*o;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 ec(t,e,r,n,i,s,a,o,l,u,c){const h=n-t,p=i-e,d=s-r,f=a-t,y=o-e,m=l-r,g=c[1]*m-c[2]*y,x=c[2]*f-c[0]*m,v=c[0]*y-c[1]*f,b=h*g+p*x+d*v;if(Math.abs(b)<1e-15)return null;const _=1/b,w=u[0]-t,S=u[1]-e,A=u[2]-r,k=(w*g+S*x+A*v)*_;if(k<0||k>1)return null;const I=S*d-A*p,M=A*h-w*d,P=w*p-S*h,C=(c[0]*I+c[1]*M+c[2]*P)*_;return C<0||k+C>1?null:(f*I+y*M+m*P)*_}function rc(t,e,r){return(t-e)/(r-e)}function nc(t,e,r,n,i,s,a,o,l){const u=1<<r,c=s-n,h=a-i,p=(t+1)/u*c+n,d=(e+0)/u*h+i,f=(e+1)/u*h+i;o[0]=(t+0)/u*c+n,o[1]=d,l[0]=p,l[1]=f}class DemMinMaxQuadTree{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,a=(t+1)*r-s,o=e*r,l=(e+1)*r-s;i[0]=t*r,i[1]=o,i[2]=a,i[3]=l};let a=new MipLevel(n);const o=[];for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),i,!1,o);const r=sc(o[0],o[1],t),l=sc(o[2],o[1],t),u=sc(o[2],o[3],t),c=sc(o[0],o[3],t);a.minimums.push(Math.min(r,l,u,c)),a.maximums.push(Math.max(r,l,u,c)),a.leaves.push(1)}for(r.push(a),n/=2;n>=1;n/=2){const t=r[r.length-1];a=new MipLevel(n);for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),2,!0,o);const r=t.getElevation(o[0],o[1]),i=t.getElevation(o[2],o[1]),l=t.getElevation(o[2],o[3]),u=t.getElevation(o[0],o[3]),c=t.isLeaf(o[0],o[1]),h=t.isLeaf(o[2],o[1]),p=t.isLeaf(o[2],o[3]),d=t.isLeaf(o[0],o[3]),f=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&&d;a.maximums.push(y),a.minimums.push(f),a.leaves.push(y-f<=5&&m?1:0)}r.push(a)}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,a=1){return tc([t,e,-100],[r,n,this.maximums[0]*a],i,s)}raycast(t,e,r,n,i,s,a=1){if(!this.nodeCount)return null;const o=this.raycastRoot(t,e,r,n,i,s,a);if(null==o)return null;const l=[],u=[],c=[],h=[],p=[{idx:0,t:o,nodex:0,nodey:0,depth:0}];for(;p.length>0;){const{idx:o,t:d,nodex:f,nodey:y,depth:m}=p.pop();if(this.leaves[o]){nc(f,y,m,t,e,r,n,c,h);const o=1<<m,l=(f+0)/o,u=(f+1)/o,p=(y+0)/o,g=(y+1)/o,x=sc(l,p,this.dem)*a,v=sc(u,p,this.dem)*a,b=sc(u,g,this.dem)*a,_=sc(l,g,this.dem)*a,w=ec(c[0],c[1],x,h[0],c[1],v,h[0],h[1],b,i,s),S=ec(h[0],h[1],b,c[0],h[1],_,c[0],c[1],x,i,s),A=Math.min(null!==w?w:Number.MAX_VALUE,null!==S?S:Number.MAX_VALUE);if(A!==Number.MAX_VALUE)return A;{const t=Ts([],i,s,d);if(ic(x,v,_,b,rc(t[0],c[0],h[0]),rc(t[1],c[1],h[1]))>=t[2])return d}continue}let g=0;for(let p=0;p<this._siblingOffset.length;p++){nc((f<<1)+this._siblingOffset[p][0],(y<<1)+this._siblingOffset[p][1],m+1,t,e,r,n,c,h),c[2]=-100,h[2]=this.maximums[this.childOffsets[o]+p]*a;const d=tc(c,h,i,s);if(null!=d){const t=d;l[p]=t;let e=!1;for(let r=0;r<g&&!e;r++)t>=l[u[r]]&&(u.splice(r,0,p),e=!0);e||(u[g]=p),g++}}for(let t=0;t<g;t++){const e=u[t];p.push({idx:this.childOffsets[o]+e,t:l[e],nodex:(f<<1)+this._siblingOffset[e][0],nodey:(y<<1)+this._siblingOffset[e][1],depth:m+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,a=t[s];let o=0,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=a.getElevation(n,i),u=a.isLeaf(n,i),c=this._addNode(s.min,s.max,u);u&&(o|=1<<t),l||(l=c)}for(let n=0;n<this._siblingOffset.length;n++)o&1<<n||this._construct(t,2*e+this._siblingOffset[n][0],2*r+this._siblingOffset[n][1],s,l+n)}}function ic(t,e,r,n,i,s){return jt(jt(t,r,s),jt(e,n,s),i)}function sc(t,e,r){const n=r.dim,i=u(t*n-.5,0,n-1),s=u(e*n-.5,0,n-1),a=Math.floor(i),o=Math.floor(s),l=Math.min(a+1,n-1),c=Math.min(o+1,n-1);return ic(r.get(a,o),r.get(l,o),r.get(a,c),r.get(l,c),i-a,s-o)}const ac={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};class DEMData{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 _(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const s=this.dim=e.height-2,a=new Uint32Array(e.data.buffer);if(this.pixels=new Uint8Array(e.data.buffer),this.encoding=r||"mapbox",this.borderReady=n,!n){for(let t=0;t<s;t++)a[this._idx(-1,t)]=a[this._idx(0,t)],a[this._idx(s,t)]=a[this._idx(s-1,t)],a[this._idx(t,-1)]=a[this._idx(t,0)],a[this._idx(t,s)]=a[this._idx(t,s-1)];a[this._idx(-1,-1)]=a[this._idx(0,0)],a[this._idx(s,-1)]=a[this._idx(s-1,0)],a[this._idx(-1,s)]=a[this._idx(0,s-1)],a[this._idx(s,s)]=a[this._idx(s-1,s-1)],i&&this._buildQuadTree()}}_buildQuadTree(){this._tree=new DemMinMaxQuadTree(this)}get(t,e,r=!1){r&&(t=u(t,-1,this.dim),e=u(e,-1,this.dim));const n=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(this.pixels[n],this.pixels[n+1],this.pixels[n+2])}static getUnpackVector(t){return ac[t]}get unpackVector(){return ac[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=DEMData.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 RGBAImage({width:this.stride,height:this.stride},this.pixels)}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=a-1;break;case 1:a=s+1}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e<a;e++)for(let r=n;r<i;r++){const n=4*this._idx(r,e),i=4*this._idx(r+o,e+l);this.pixels[n+0]=t.pixels[i+0],this.pixels[n+1]=t.pixels[i+1],this.pixels[n+2]=t.pixels[i+2],this.pixels[n+3]=t.pixels[i+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}Sr(DEMData,"DEMData"),Sr(DemMinMaxQuadTree,"DemMinMaxQuadTree",{omit:["dem"]});class TileCache{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,r){const n=t.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);const i={value:e,timeout:void 0};if(void 0!==r&&(i.timeout=setTimeout((()=>{this.remove(t,i)}),r)),this.data[n].push(i),this.order.push(n),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const r in this.data)for(const n of this.data[r])t(n.value)||e.push(n);for(const t of e)this.remove(t.value.tileID,t)}}class ColorMode{constructor(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r}}ColorMode.Replace=[1,0],ColorMode.disabled=new ColorMode(ColorMode.Replace,B.transparent,[!1,!1,!1,!1]),ColorMode.unblended=new ColorMode(ColorMode.Replace,B.transparent,[!0,!0,!0,!0]),ColorMode.alphaBlended=new ColorMode([1,771],B.transparent,[!0,!0,!0,!0]);class SourceCache extends Evented{constructor(t,e,r){super(),this.id=t,this._onlySymbols=r,e.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),e.on("error",(()=>{this._sourceErrored=!0})),this._source=e,this._tiles={},this._cache=new TileCache(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=e.minTileCacheSize,this._maxTileCacheSize=e.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new SourceFeatureState,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(t){this.map=t,this._minTileCacheSize=void 0===this._minTileCacheSize&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,e){return t.isSymbolTile=this._onlySymbols,this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t,(()=>{}))}serialize(){return this._source.serialize()}prepare(t){if(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._source.prepareTile)for(const e in this._tiles){const r=this._tiles[e];this._source.prepareTile(r)&&this.map.painter.terrain&&this.map.painter.terrain._clearRenderCacheForTile(this.id,r.tileID),r.upload(t),r.prepare(this.map.style.imageManager)}else for(const e in this._tiles){const r=this._tiles[e];r.upload(t),r.prepare(this.map.style.imageManager)}}getIds(){return h(this._tiles).map((t=>t.tileID)).sort(oc).map((t=>t.key))}getRenderableIds(t){const e=[];for(const r in this._tiles)this._isIdRenderable(+r,t)&&e.push(this._tiles[r]);return t?e.sort(((t,e)=>{const n=t.tileID,i=e.tileID,s=new r(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),a=new r(i.canonical.x,i.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-i.overscaledZ||a.y-s.y||a.x-s.x})).map((t=>t.tileID.key)):e.map((t=>t.tileID)).sort(oc).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(+t,"reloading")}}_reloadTile(t,e){const r=this._tiles[t];r&&("loading"!==r.state&&(r.state=e),this._loadTile(r,this._tileLoaded.bind(this,r,t,e)))}_tileLoaded(t,e,r,n){if(n)if(t.state="errored",404!==n.status)this._source.fire(new ErrorEvent(n,{tile:t}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const t=this.map.painter.terrain;this.update(this.transform,t.getScaledDemTileSize(),!0),t.resetTileLookupCache(this.id)}else this.update(this.transform);else t.timeAdded=ei.now(),"expired"===r&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(e,t),"raster-dem"===this._source.type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new Event("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const e=this.getRenderableIds();for(let n=0;n<e.length;n++){const i=e[n];if(t.neighboringTiles&&t.neighboringTiles[i]){const e=this.getTileByID(i);r(t,e),r(e,t)}}function r(t,e){if(!t.dem||t.dem.borderReady)return;t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0;let r=e.tileID.canonical.x-t.tileID.canonical.x;const n=e.tileID.canonical.y-t.tileID.canonical.y,i=Math.pow(2,t.tileID.canonical.z),s=e.tileID.key;0===r&&0===n||Math.abs(n)>1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[s]&&(t.neighboringTiles[s].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,r,n){for(const i in this._tiles){let s=this._tiles[i];if(n[i]||!s.hasData()||s.tileID.overscaledZ<=e||s.tileID.overscaledZ>r)continue;let a=s.tileID;for(;s&&s.tileID.overscaledZ>e+1;){const t=s.tileID.scaledTo(s.tileID.overscaledZ-1);s=this._tiles[t.key],s&&s.hasData()&&(a=t)}let o=a;for(;o.overscaledZ>e;)if(o=o.scaledTo(o.overscaledZ-1),t[o.key]){n[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(let r=t.overscaledZ-1;r>=e;r--){const e=t.scaledTo(r),n=this._getLoadedTile(e);if(n)return n}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,e){e=e||this._source.tileSize;const r=Math.ceil(t.width/e)+1,n=Math.ceil(t.height/e)+1,i=Math.floor(r*n*5),s="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,i):i,a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(a)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const r in this._tiles){const n=this._tiles[r];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),t[n.tileID.key]=n}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(+t,this._tiles[t])}}update(t,e,r){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!r)return;let n;this.updateCacheSize(t,e),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new OverscaledTileID(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(n=t.coveringTiles({tileSize:e||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(n=n.filter((t=>this._source.hasTile(t))))):n=[];const i=this._updateRetainedTiles(n);if(lc(this._source.type)&&0!==n.length){const t={},e={},r=Object.keys(i);for(const n of r){const r=i[n],s=this._tiles[n];if(!s||s.fadeEndTime&&s.fadeEndTime<=ei.now())continue;const a=this.findLoadedParent(r,Math.max(r.overscaledZ-SourceCache.maxOverzooming,this._source.minzoom));a&&(this._addTile(a.tileID),t[a.tileID.key]=a.tileID),e[n]=r}const s=n[n.length-1].overscaledZ;for(const t in this._tiles){const r=this._tiles[t];if(i[t]||!r.hasData())continue;let n=r.tileID;for(;n.overscaledZ>s;){n=n.scaledTo(n.overscaledZ-1);const s=this._tiles[n.key];if(s&&s.hasData()&&e[n.key]){i[t]=r.tileID;break}}}for(const e in t)i[e]||(this._coveredTiles[e]=!0,i[e]=t[e])}for(const t in i)this._tiles[t].clearFadeHold();const s=function(t,e){const r=[];for(const n in t)n in e||r.push(n);return r}(this._tiles,i);for(const t of s){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(+t)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const e={};if(0===t.length)return e;const r={},n=t.reduce(((t,e)=>Math.min(t,e.overscaledZ)),1/0),i=t[0].overscaledZ,s=Math.max(i-SourceCache.maxOverzooming,this._source.minzoom),a=Math.max(i+SourceCache.maxUnderzooming,this._source.minzoom),o={};for(const r of t){const t=this._addTile(r);e[r.key]=r,t.hasData()||n<this._source.maxzoom&&(o[r.key]=r)}this._retainLoadedChildren(o,n,a,e);for(const n of t){let t=this._tiles[n.key];if(t.hasData())continue;if(n.canonical.z>=this._source.maxzoom){const t=n.children(this._source.maxzoom)[0],r=this.getTile(t);if(r&&r.hasData()){e[t.key]=t;continue}}else{const t=n.children(this._source.maxzoom);if(e[t[0].key]&&e[t[1].key]&&e[t[2].key]&&e[t[3].key])continue}let i=t.wasRequested();for(let a=n.overscaledZ-1;a>=s;--a){const s=n.scaledTo(a);if(r[s.key])break;if(r[s.key]=!0,t=this.getTile(s),!t&&i&&(t=this._addTile(s)),t&&(e[s.key]=s,i=t.wasRequested(),t.hasData()))break}}return e}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let r,n=this._tiles[t].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}e.push(n.key);const t=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(t),r)break;n=t}for(const t of e)this._loadedParentTiles[t]=r}}_addTile(t){let e=this._tiles[t.key];if(e)return this._source.prepareTile&&this._source.prepareTile(e),e;e=this._cache.getAndRemove(t),e&&(this._setTileReloadTimer(t.key,e),e.tileID=t,this._state.initializeTileState(e,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,e)));const r=Boolean(e);if(!r){const r=this.map?this.map.painter:null;e=new Tile(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom,r,this._isRaster),this._source.prepareTile&&this._source.prepareTile(e)||this._loadTile(e,this._tileLoaded.bind(this,e,t.key,e.state))}return e?(e.uses++,this._tiles[t.key]=e,r||this._source.fire(new Event("dataloading",{tile:e,coord:e.tileID,dataType:"source"})),e):null}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const r=e.getExpiryTimeout();r&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),r))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,e,r){const n=[],i=this.transform;if(!i)return n;const s="globe"===i.projection.name,a=Fi(i.center.lng);for(const o in this._tiles){const l=this._tiles[o];if(r&&l.clearQueryDebugViz(),l.holdingForFade())continue;let c;if(s){const t=l.tileID.canonical;if(0===t.z){const e=[Math.abs(u(a,...uc(t,-1))-a),Math.abs(u(a,...uc(t,1))-a)];c=[0,2*e.indexOf(Math.min(...e))-1]}else{const e=[Math.abs(u(a,...uc(t,-1))-a),Math.abs(u(a,...uc(t,0))-a),Math.abs(u(a,...uc(t,1))-a)];c=[e.indexOf(Math.min(...e))-1]}}else c=[0];for(const r of c){const s=t.containsTile(l,i,e,r);s&&n.push(s)}}return n}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.projMatrix=this.transform.calculateProjMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(lc(this._source.type))for(const t in this._tiles){const e=this._tiles[t];if(void 0!==e.fadeEndTime&&e.fadeEndTime>=ei.now())return!0}return!1}setFeatureState(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)}removeFeatureState(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,r){const n=this._tiles[t];n&&n.setDependencies(e,r)}reloadTilesForDependencies(t,e){for(const r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(+r,"reloading");this._cache.filter((r=>!r.hasDependency(t,e)))}_preloadTiles(t,e){const r=new Map,n=Array.isArray(t)?t:[t],i=this.map.painter.terrain,s=this.usedForTerrain&&i?i.getScaledDemTileSize():this._source.tileSize;for(const t of n){const e=t.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const t of e)r.set(t.key,t);this.usedForTerrain&&t.updateElevation(!1)}!function(t,e,r){if(!t.length)return r(null,[]);let n=t.length;const i=new Array(t.length);let s=null;t.forEach(((t,a)=>{e(t,((t,e)=>{t&&(s=t),i[a]=e,0==--n&&r(s,i)}))}))}(Array.from(r.values()),((t,e)=>{const r=new Tile(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(r,(t=>{"raster-dem"===this._source.type&&r.dem&&this._backfillDEM(r),e(t,r)}))}),e)}}function oc(t,e){const r=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function lc(t){return"raster"===t||"image"===t||"video"===t}function uc(t,e){const r=1<<t.z;return[t.x/r+e,(t.x+1)/r+e]}SourceCache.maxOverzooming=10,SourceCache.maxUnderzooming=3;class DEMSampler{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,a=1<<e.canonical.z-s.canonical.z;return new DEMSampler(n,n.tileSize/Di/a,[(e.canonical.x/a-s.canonical.x)*i.dim,(e.canonical.y/a-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],a=Math.floor(i),o=Math.floor(s),l=this._dem;return n=!!n,r?jt(jt(l.get(a,o,n),l.get(a,o+1,n),s-o),jt(l.get(a+1,o,n),l.get(a+1,o+1,n),s-o),i-a):l.get(a,o,n)}getElevationAtPixel(t,e,r){return this._dem.get(t,e,!!r)}getMeterToDEM(t){return(1<<this._demTile.tileID.canonical.z)*ji(1,t)*this._dem.stride}}class FeatureIndex{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new T(Di,16,0),this.featureIndexArray=new FeatureIndexArray,this.promoteId=e}insert(t,e,r,n,i,s=0){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i,s);const o=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]<Di&&n[1]<Di&&n[2]>=0&&n[3]>=0&&o.insert(a,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Xa.VectorTile(new $o(this.rawTileData)).layers,this.sourceLayerCoder=new DictionaryCoder(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||{},a=qr(s.filter),o=t.tileResult,l=t.transform,u=o.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 a=[new r(e,n),new r(e,s),new r(i,s),new r(i,n)];if(t.length>2)for(const e of a)if(us(t,e))return!0;for(let e=0;e<t.length-1;e++)if(cs(t[e],t[e+1],a))return!0;return!1}(o.bufferedTilespaceGeometry,t,e,n,i)));c.sort(hc);let h=null;l.elevation&&c.length>0&&(h=DEMSampler.create(l.elevation,this.tileID));const p={};let d;for(let r=0;r<c.length;r++){const l=c[r];if(l===d)continue;d=l;const u=this.featureIndexArray.get(l);let f=null;this.loadMatchingFeature(p,u,a,s.layers,s.availableImages,e,n,i,((e,r,n,i=0)=>(f||(f=Ki(e,this.tileID.canonical,t.tileTransform)),r.queryIntersectsFeature(o,e,n,f,this.z,t.transform,t.pixelPosMatrix,h,i))))}return p}loadMatchingFeature(t,e,r,n,i,s,a,o,l){const{featureIndex:u,bucketIndex:c,sourceLayerIndex:h,layoutVertexArrayOffset:d}=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 y=this.sourceLayerCoder.decode(h),m=this.vtLayers[y].feature(u);if(r.needGeometry){const t=Wi(m,!0);if(!r.filter(new EvaluationParameters(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!r.filter(new EvaluationParameters(this.tileID.overscaledZ),m))return;const g=this.getId(m,y);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!==g&&o&&(h=o.getState(c.sourceLayer||"_geojsonTileLayer",g));const y=p({},a[r]);y.paint=cc(y.paint,c.paint,m,h,i),y.layout=cc(y.layout,c.layout,m,h,i);const x=!l||l(m,c,h,d);if(!x)continue;const v=new Feature(m,this.z,this.x,this.y,g);v.layer=y;let b=t[r];void 0===b&&(b=t[r]=[]),b.push({featureIndex:u,feature:v,intersectionZ:x})}}lookupSymbolFeatures(t,e,r,n,i,s,a,o){const l={};this.loadVTLayers();const u=qr(i);for(const i of t)this.loadMatchingFeature(l,{bucketIndex:r,sourceLayerIndex:n,featureIndex:i,layoutVertexArrayOffset:0},u,s,a,o,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 cc(t,e,r,n,i){return x(t,((t,s)=>{const a=e instanceof PossiblyEvaluated?e.get(s):null;return a&&a.evaluate?a.evaluate(r,n,i):a}))}function hc(t,e){return e-t}Sr(FeatureIndex,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class LineAtlas{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.image=new AlphaImage({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,a=!0;n.push({left:i,right:s,isDash:a,zeroLength:0===t[0]});let o=t[0];for(let e=1;e<t.length;e++){a=!a;const l=t[e];i=o*r,o+=l,s=o*r,n.push({left:i,right:s,isDash:a,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,a=t[s];for(let o=0;o<this.width;o++){o/a.right>1&&(a=t[++s]);const l=Math.abs(o-a.left),u=Math.abs(o-a.right),c=Math.min(l,u);let h;const p=e/r*(n+1);if(a.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+o]=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,a=t[s];for(let r=0;r<this.width;r++){r/a.right>1&&(a=t[++s]);const n=Math.abs(r-a.left),o=Math.abs(r-a.right),l=Math.min(n,o);this.image.data[i+r]=Math.max(0,Math.min(255,(a.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 _("LineAtlas out of space"),null;0===t.length&&t.push(1);let a=0;for(let e=0;e<t.length;e++)t[e]<0&&(_("Negative value is found in line dasharray, replacing values with 0"),t[e]=0),a+=t[e];if(0!==a){const r=this.width/a,s=this.getDashRanges(t,this.width,r);n?this.addRoundDash(s,r,i):this.addRegularDash(s,"square"===e?.5*r:0)}const o=this.nextRow+i;this.nextRow+=s;const l={tl:[o,i],br:[a,0]};return this.positions[r]=l,l}}Sr(LineAtlas,"LineAtlas");class GlyphAtlas{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,a={x:0,y:0,w:e.bitmap.width+2*n,h:e.bitmap.height+2*n};r.push(a),s[t]=a}}const{w:n,h:i}=ll(r),s=new AlphaImage({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 a=e[r][t],o=i.metrics.localGlyph?2:1;AlphaImage.copy(i.bitmap,s,{x:0,y:0},{x:a.x+o,y:a.y+o},i.bitmap)}}this.image=s,this.positions=e}}Sr(GlyphAtlas,"GlyphAtlas");class WorkerTile{constructor(t){this.tileID=new OverscaledTileID(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=mu(t.tileID.canonical,t.projection),this.projection=t.projection}parse(t,e,r,n,i){this.status="parsing",this.data=t,this.collisionBoxArray=new CollisionBoxArray;const s=new DictionaryCoder(Object.keys(t.layers).sort()),a=new FeatureIndex(this.tileID,this.promoteId);a.bucketLayerIDs=[];const o={},l=new LineAtlas(256,256),u={featureIndex:a,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&&_(`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=a.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&&(pc(t,this.zoom,r),(o[e.id]=e.createBucket({index:a.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,projection:this.projection.spec,availableImages:r})).populate(p,u,this.tileID.canonical,this.tileTransform),a.bucketLayerIDs.push(t.map((t=>t.id))))}}let p,d,f,y;l.trim();const m={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},g=x(u.glyphDependencies,(t=>Object.keys(t).map(Number)));Object.keys(g).length?n.send("getGlyphs",{uid:this.uid,stacks:g},((t,e)=>{p||(p=t,d=e,w.call(this))}),void 0,!1,m):d={};const v=Object.keys(u.iconDependencies);v.length?n.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{p||(p=t,f=e,w.call(this))}),void 0,!1,m):f={};const b=Object.keys(u.patternDependencies);function w(){if(p)return i(p);if(d&&f&&y){const t=new GlyphAtlas(d),e=new ImageAtlas(f,y);for(const n in o){const i=o[n];i instanceof SymbolBucket?(pc(i.layers,this.zoom,r),$l(i,d,t.positions,f,e.iconPositions,this.showCollisionBoxes,r,this.tileID.canonical,this.tileZoom,this.projection)):i.hasPattern&&(i instanceof LineBucket||i instanceof FillBucket||i instanceof FillExtrusionBucket)&&(pc(i.layers,this.zoom,r),i.addFeatures(u,this.tileID.canonical,e.patternPositions,r,this.tileTransform))}this.status="done",i(null,{buckets:h(o).filter((t=>!t.isEmpty())),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,lineAtlas:l,imageAtlas:e,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?t.positions:null})}}b.length?n.send("getImages",{icons:b,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{p||(p=t,y=e,w.call(this))}),void 0,!1,m):y={},w.call(this)}}function pc(t,e,r){const n=new EvaluationParameters(e);for(const e of t)e.recalculate(n,r)}class DedupedRequest{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 dc(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=vr(t.request,((t,n,i,s)=>{t?e(t):n&&e(null,{vectorTile:r?void 0:new Xa.VectorTile(new $o(n)),rawData:n,cacheControl:i,expires:s})}));return()=>{n.cancel(),e()}}),e)}class VectorTileWorkerSource extends Evented{constructor(t,e,r,n,i){super(),this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=i||dc,this.loading={},this.loaded={},this.deduped=new DedupedRequest(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 WorkerTile(t);s.abort=this.loadVectorData(t,((a,o)=>{const l=!this.loading[r];if(delete this.loading[r],l||a||!o)return s.status="done",l||(this.loaded[r]=s),e(a);const u=o.rawData,c={};o.expires&&(c.expires=o.expires),o.cacheControl&&(c.cacheControl=o.cacheControl),s.vectorTile=o.vectorTile||new Xa.VectorTile(new $o(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=Cr(n);t.length>0&&(s.resourceTiming=JSON.parse(JSON.stringify(t)))}e(null,p({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,s.tileTransform=mu(t.tileID.canonical,t.projection);const a=(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=a:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}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()}}class RasterDEMTileWorkerSource{loadTile(t,e){const{uid:r,encoding:n,rawImageData:s,padding:a,buildQuadTree:o}=t,l=i.ImageBitmap&&s instanceof i.ImageBitmap?this.getImageData(s,a):s;e(null,new DEMData(r,l,n,a<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),r}}var fc=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)yc(e.coordinates,r);else if("MultiPolygon"===i)for(n=0;n<e.coordinates.length;n++)yc(e.coordinates[n],r);return e};function yc(t,e){if(0!==t.length){mc(t[0],e);for(var r=1;r<t.length;r++)mc(t[r],!e)}}function mc(t,e){for(var r=0,n=0,i=0,s=t.length,a=s-1;i<s;a=i++){var o=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+o;n+=Math.abs(r)>=Math.abs(o)?r-l+o:o-l+r,r=l}r+n>=0!=!!e&&t.reverse()}const gc=Xa.VectorTileFeature.prototype.toGeoJSON;class FeatureWrapper$1{constructor(t){this._feature=t,this.extent=Di,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 gc.call(this,t,e,r)}}class GeoJSONWrapper$1{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=Di,this.length=t.length,this._features=t}feature(t){return new FeatureWrapper$1(this._features[t])}}var xc=Xa.VectorTileFeature,vc=bc;function bc(t,e){this.options=e||{},this.features=t,this.length=t.length}function _c(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}bc.prototype.feature=function(t){return new _c(this.features[t],this.options.extent)},_c.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var 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},_c.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,s=0;s<t.length;s++)for(var a=t[s],o=0;o<a.length;o++){var l=a[o];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},_c.prototype.toGeoJSON=xc.prototype.toGeoJSON;var wc=Ac,Sc=vc;function Ac(t){var e=new $o;return function(t,e){for(var r in t.layers)e.writeMessage(3,kc,t.layers[r])}(t,e),e.finish()}function kc(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,Ic,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,zc,s[r])}function Ic(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,Mc,t),e.writeVarintField(3,r.type),e.writeMessage(4,Tc,r)}function Mc(t,e){var r=t.feature,n=t.keys,i=t.values,s=t.keycache,a=t.valuecache;for(var o in r.properties){var l=r.properties[o],u=s[o];if(null!==l){void 0===u&&(n.push(o),s[o]=u=n.length-1),e.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=a[h];void 0===p&&(i.push(l),a[h]=p=i.length-1),e.writeVarint(p)}}}function Pc(t,e){return(e<<3)+(7&t)}function Cc(t){return t<<1^t>>31}function Tc(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,s=0,a=r.length,o=0;o<a;o++){var l=r[o],u=1;1===n&&(u=l.length),e.writeVarint(Pc(1,u));for(var c=3===n?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==n&&e.writeVarint(Pc(2,c-1));var p=l[h].x-i,d=l[h].y-s;e.writeVarint(Cc(p)),e.writeVarint(Cc(d)),i+=p,s+=d}3===n&&e.writeVarint(Pc(7,1))}}function zc(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 Ec(t,e,r,n,i,s){if(i-n<=r)return;const a=n+i>>1;Dc(t,e,a,n,i,s%2),Ec(t,e,r,n,a-1,s+1),Ec(t,e,r,a+1,i,s+1)}function Dc(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const a=i-n+1,o=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(o-a/2<0?-1:1);Dc(t,e,r,Math.max(n,Math.floor(r-o*u/a+c)),Math.min(i,Math.floor(r+(a-o)*u/a+c)),s)}const a=e[2*r+s];let o=n,l=i;for(Bc(t,e,n,r),e[2*i+s]>a&&Bc(t,e,n,i);o<l;){for(Bc(t,e,o,l),o++,l--;e[2*o+s]<a;)o++;for(;e[2*l+s]>a;)l--}e[2*n+s]===a?Bc(t,e,n,l):(l++,Bc(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Bc(t,e,r,n){Lc(t,r,n),Lc(e,2*r,2*n),Lc(e,2*r+1,2*n+1)}function Lc(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function Vc(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}wc.fromVectorTileJs=Ac,wc.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var n in t)r[n]=new vc(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Ac({layers:r})},wc.GeoJSONWrapper=Sc;const Fc=t=>t[0],Rc=t=>t[1];class KDBush{constructor(t,e=Fc,r=Rc,n=64,i=Float64Array){this.nodeSize=n,this.points=t;const s=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new s(t.length),o=this.coords=new i(2*t.length);for(let n=0;n<t.length;n++)a[n]=n,o[2*n]=e(t[n]),o[2*n+1]=r(t[n]);Ec(a,o,n,0,a.length-1,0)}range(t,e,r,n){return function(t,e,r,n,i,s,a){const o=[0,t.length-1,0],l=[];let u,c;for(;o.length;){const h=o.pop(),p=o.pop(),d=o.pop();if(p-d<=a){for(let a=d;a<=p;a++)u=e[2*a],c=e[2*a+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[a]);continue}const f=Math.floor((d+p)/2);u=e[2*f],c=e[2*f+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[f]);const y=(h+1)%2;(0===h?r<=u:n<=c)&&(o.push(d),o.push(f-1),o.push(y)),(0===h?i>=u:s>=c)&&(o.push(f+1),o.push(p),o.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 a=[0,t.length-1,0],o=[],l=i*i;for(;a.length;){const u=a.pop(),c=a.pop(),h=a.pop();if(c-h<=s){for(let i=h;i<=c;i++)Vc(e[2*i],e[2*i+1],r,n)<=l&&o.push(t[i]);continue}const p=Math.floor((h+c)/2),d=e[2*p],f=e[2*p+1];Vc(d,f,r,n)<=l&&o.push(t[p]);const y=(u+1)%2;(0===u?r-i<=d:n-i<=f)&&(a.push(h),a.push(p-1),a.push(y)),(0===u?r+i>=d:n+i>=f)&&(a.push(p+1),a.push(c),a.push(y))}return o}(this.ids,this.coords,t,e,r,this.nodeSize)}}const jc={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Oc=Math.fround||(Uc=new Float32Array(1),t=>(Uc[0]=+t,Uc[0]));var Uc;class Supercluster{constructor(t){this.options=Jc(Object.create(jc),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 a=[];for(let e=0;e<t.length;e++)t[e].geometry&&a.push(qc(t[e],e));this.trees[n+1]=new KDBush(a,Kc,Wc,i,Float32Array),e&&console.timeEnd(s);for(let t=n;t>=r;t--){const r=+Date.now();a=this._cluster(a,t),this.trees[t]=new KDBush(a,Kc,Wc,i,Float32Array),e&&console.log("z%d: %d clusters in %dms",t,a.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),a=this.getClusters([-180,n,i,s],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],o=a.range(Gc(r),Xc(s),Gc(i),Xc(n)),l=[];for(const t of o){const e=a.points[t];l.push(e.numPoints?Nc(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 a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),o=i.within(s.x,s.y,a),l=[];for(const e of o){const r=i.points[e];r.parentId===t&&l.push(r.numPoints?Nc(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:a}=this.options,o=a/s,l=(r-o)/i,u=(r+1+o)/i,c={features:[]};return this._addTileFeatures(n.range((e-o)/i,l,(e+1+o)/i,u),n.points,e,r,i,c),0===e&&this._addTileFeatures(n.range(1-o/i,l,1,u),n.points,i,r,i,c),e===i-1&&this._addTileFeatures(n.range(0,l,o/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 a of t){const t=e[a],o=t.numPoints;let l,u,c;if(o)l=Zc(t),u=t.x,c=t.y;else{const e=this.points[t.index];l=e.properties,u=Gc(e.geometry.coordinates[0]),c=Xc(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;o?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:a}=this.options,o=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,o),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>=a){let t=i.x*c,a=i.y*c,o=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,a+=n.y*u,n.parentId=p,s&&(o||(o=this._map(i,!0)),s(o,this._map(n)))}i.parentId=p,r.push($c(t/h,a/h,p,h,o))}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?Jc({},t.properties):t.properties;const r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?Jc({},n):n}}function $c(t,e,r,n,i){return{x:Oc(t),y:Oc(e),zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function qc(t,e){const[r,n]=t.geometry.coordinates;return{x:Oc(Gc(r)),y:Oc(Xc(n)),zoom:1/0,index:e,parentId:-1}}function Nc(t){return{type:"Feature",id:t.id,properties:Zc(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),Yc(t.y)]}};var e}function Zc(t){const e=t.numPoints,r=e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?Math.round(e/100)/10+"k":e;return Jc(Jc({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function Gc(t){return t/360+.5}function Xc(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 Yc(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Jc(t,e){for(const r in e)t[r]=e[r];return t}function Kc(t){return t.x}function Wc(t){return t.y}function Hc(t,e,r,n){for(var i,s=n,a=r-e>>1,o=r-e,l=t[e],u=t[e+1],c=t[r],h=t[r+1],p=e+3;p<r;p+=3){var d=Qc(t[p],t[p+1],l,u,c,h);if(d>s)i=p,s=d;else if(d===s){var f=Math.abs(p-a);f<o&&(i=p,o=f)}}s>n&&(i-e>3&&Hc(t,e,i,n),t[i+2]=s,r-i>3&&Hc(t,i,r,n))}function Qc(t,e,r,n,i,s){var a=i-r,o=s-n;if(0!==a||0!==o){var l=((t-r)*a+(e-n)*o)/(a*a+o*o);l>1?(r=i,n=s):l>0&&(r+=a*l,n+=o*l)}return(a=t-r)*a+(o=e-n)*o}function th(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)eh(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<e.length;n++)eh(t,e[n]);else if("MultiPolygon"===r)for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)eh(t,e[n][i])}(i),i}function eh(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 rh(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,s=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),o=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),"Point"===s)nh(i,o);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)nh(i[u],o);else if("LineString"===s)ih(i,o,a,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(u=0;u<i.length;u++)ih(i[u],o=[],a,!1),t.push(th(l,"LineString",o,e.properties));return}sh(i,o,a,!1)}else if("Polygon"===s)sh(i,o,a,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<e.geometry.geometries.length;u++)rh(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=[];sh(i[u],c,a,!0),o.push(c)}}t.push(th(l,s,o,e.properties))}}function nh(t,e){e.push(ah(t[0])),e.push(oh(t[1])),e.push(0)}function ih(t,e,r,n){for(var i,s,a=0,o=0;o<t.length;o++){var l=ah(t[o][0]),u=oh(t[o][1]);e.push(l),e.push(u),e.push(0),o>0&&(a+=n?(i*u-l*s)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-s,2))),i=l,s=u}var c=e.length-3;e[2]=1,Hc(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function sh(t,e,r,n){for(var i=0;i<t.length;i++){var s=[];ih(t[i],s,r,n),e.push(s)}}function ah(t){return t/360+.5}function oh(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 lh(t,e,r,n,i,s,a,o){if(n/=e,s>=(r/=e)&&a<n)return t;if(a<r||s>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,d=0===i?c.minX:c.minY,f=0===i?c.maxX:c.maxY;if(d>=r&&f<n)l.push(c);else if(!(f<r||d>=n)){var y=[];if("Point"===p||"MultiPoint"===p)uh(h,y,r,n,i);else if("LineString"===p)ch(h,y,r,n,i,!1,o.lineMetrics);else if("MultiLineString"===p)ph(h,y,r,n,i,!1);else if("Polygon"===p)ph(h,y,r,n,i,!0);else if("MultiPolygon"===p)for(var m=0;m<h.length;m++){var g=[];ph(h[m],g,r,n,i,!0),g.length&&y.push(g)}if(y.length){if(o.lineMetrics&&"LineString"===p){for(m=0;m<y.length;m++)l.push(th(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(th(c.id,p,y,c.tags))}}}return l.length?l:null}function uh(t,e,r,n,i){for(var s=0;s<t.length;s+=3){var a=t[s+i];a>=r&&a<=n&&(e.push(t[s]),e.push(t[s+1]),e.push(t[s+2]))}}function ch(t,e,r,n,i,s,a){for(var o,l,u=hh(t),c=0===i?fh:yh,h=t.start,p=0;p<t.length-3;p+=3){var d=t[p],f=t[p+1],y=t[p+2],m=t[p+3],g=t[p+4],x=0===i?d:f,v=0===i?m:g,b=!1;a&&(o=Math.sqrt(Math.pow(d-m,2)+Math.pow(f-g,2))),x<r?v>r&&(l=c(u,d,f,m,g,r),a&&(u.start=h+o*l)):x>n?v<n&&(l=c(u,d,f,m,g,n),a&&(u.start=h+o*l)):dh(u,d,f,y),v<r&&x>=r&&(l=c(u,d,f,m,g,r),b=!0),v>n&&x<=n&&(l=c(u,d,f,m,g,n),b=!0),!s&&b&&(a&&(u.end=h+o*l),e.push(u),u=hh(t)),a&&(h+=o)}var _=t.length-3;d=t[_],f=t[_+1],y=t[_+2],(x=0===i?d:f)>=r&&x<=n&&dh(u,d,f,y),_=u.length-3,s&&_>=3&&(u[_]!==u[0]||u[_+1]!==u[1])&&dh(u,u[0],u[1],u[2]),u.length&&e.push(u)}function hh(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function ph(t,e,r,n,i,s){for(var a=0;a<t.length;a++)ch(t[a],e,r,n,i,s,!1)}function dh(t,e,r,n){t.push(e),t.push(r),t.push(n)}function fh(t,e,r,n,i,s){var a=(s-e)/(n-e);return t.push(s),t.push(r+(i-r)*a),t.push(1),a}function yh(t,e,r,n,i,s){var a=(s-r)/(i-r);return t.push(e+(n-e)*a),t.push(s),t.push(1),a}function mh(t,e){for(var r=[],n=0;n<t.length;n++){var i,s=t[n],a=s.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)i=gh(s.geometry,e);else if("MultiLineString"===a||"Polygon"===a){i=[];for(var o=0;o<s.geometry.length;o++)i.push(gh(s.geometry[o],e))}else if("MultiPolygon"===a)for(i=[],o=0;o<s.geometry.length;o++){for(var l=[],u=0;u<s.geometry[o].length;u++)l.push(gh(s.geometry[o][u],e));i.push(l)}r.push(th(s.id,a,i,s.tags))}return r}function gh(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 xh(t,e){if(t.transformed)return t;var r,n,i,s=1<<t.z,a=t.x,o=t.y;for(r=0;r<t.features.length;r++){var l=t.features[r],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(vh(u[n],u[n+1],e,s,a,o));else for(n=0;n<u.length;n++){var h=[];for(i=0;i<u[n].length;i+=2)h.push(vh(u[n][i],u[n][i+1],e,s,a,o));l.geometry.push(h)}}return t.transformed=!0,t}function vh(t,e,r,n,i,s){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-s))]}function bh(t,e,r,n,i){for(var s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},o=0;o<t.length;o++){a.numFeatures++,_h(a,t[o],s,i);var l=t[o].minX,u=t[o].minY,c=t[o].maxX,h=t[o].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function _h(t,e,r,n){var i=e.geometry,s=e.type,a=[];if("Point"===s||"MultiPoint"===s)for(var o=0;o<i.length;o+=3)a.push(i[o]),a.push(i[o+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)wh(a,i,t,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(o=0;o<i.length;o++)wh(a,i[o],t,r,"Polygon"===s,0===o);else if("MultiPolygon"===s)for(var l=0;l<i.length;l++){var u=i[l];for(o=0;o<u.length;o++)wh(a,u[o],t,r,!0,0===o)}if(a.length){var c=e.tags||null;if("LineString"===s&&n.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var p={geometry:a,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function wh(t,e,r,n,i,s){var a=n*n;if(n>0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var o=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>a)&&(r.numSimplified++,o.push(e[l]),o.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,s=i-2;n<i;s=n,n+=2)r+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var a=t[n],o=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=o}}(o,s),t.push(o)}}function Sh(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++)rh(r,t.features[n],e,n);else rh(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=lh(t,1,-1-r,r,0,-1,2,e),s=lh(t,1,1-r,2+r,0,-1,2,e);return(i||s)&&(n=lh(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=mh(i,1).concat(n)),s&&(n=n.concat(mh(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 Ah(t,e,r){return 32*((1<<t)*r+e)+t}function kh(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 GeoJSONWrapper$1(n.features);let s=wc(i);0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),e(null,{vectorTile:i,rawData:s.buffer})}Sh.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Sh.prototype.splitTile=function(t,e,r,n,i,s,a){for(var o=[t,e,r,n],l=this.options,u=l.debug;o.length;){n=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();var c=1<<e,h=Ah(e,r,n),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=bh(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 d="z"+e;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(p.source=t,i){if(e===l.maxZoom||e===i)continue;var f=1<<i-e;if(r!==Math.floor(s/f)||n!==Math.floor(a/f))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,_=.5*l.buffer/l.extent,w=.5-_,S=.5+_,A=1+_;y=m=g=x=null,v=lh(t,c,r-_,r+S,0,p.minX,p.maxX,l),b=lh(t,c,r+w,r+A,0,p.minX,p.maxX,l),t=null,v&&(y=lh(v,c,n-_,n+S,1,p.minY,p.maxY,l),m=lh(v,c,n+w,n+A,1,p.minY,p.maxY,l),v=null),b&&(g=lh(b,c,n-_,n+S,1,p.minY,p.maxY,l),x=lh(b,c,n+w,n+A,1,p.minY,p.maxY,l),b=null),u>1&&console.timeEnd("clipping"),o.push(y||[],e+1,2*r,2*n),o.push(m||[],e+1,2*r,2*n+1),o.push(g||[],e+1,2*r+1,2*n),o.push(x||[],e+1,2*r+1,2*n+1)}}},Sh.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,s=n.debug;if(t<0||t>24)return null;var a=1<<t,o=Ah(t,e=(e%a+a)%a,r);if(this.tiles[o])return xh(this.tiles[o],i);s>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Ah(u,c,h)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,c,h),s>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,r),s>1&&console.timeEnd("drilling down"),this.tiles[o]?xh(this.tiles[o],i):null):null};class GeoJSONWorkerSource extends VectorTileWorkerSource{constructor(t,e,r,n,i){super(t,e,r,n,kh),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.`));{fc(s,!0);try{if(t.filter){const e=Ze(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 Supercluster(function({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;const r={},n={},i={accumulated:null,zoom:0},s={properties:null},a=Object.keys(e);for(const t of a){const[i,s]=e[t],a=Ze(s),o=Ze("string"==typeof i?[i,["accumulated"],["get",t]]:i);r[t]=a.value,n[t]=o.value}return t.map=t=>{s.properties=t;const e={};for(const t of a)e[t]=r[t].evaluate(i,s);return e},t.reduce=(t,e)=>{s.properties=e;for(const e of a)i.accumulated=t[e],t[e]=n[e].evaluate(i,s)},t}(t)).load(s.features):function(t,e){return new Sh(t,e)}(s,t.geojsonVtOptions)}catch(i){return e(i)}this.loaded={};const a={};if(n){const e=Cr(r);e&&(a.resourceTiming={},a.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}e(null,a)}}))}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){xr(p(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)}}}class Worker{constructor(t){this.self=t,this.actor=new Actor(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=Mu({name:"mercator"}),this.workerSourceTypes={vector:VectorTileWorkerSource,geojson:GeoJSONWorkerSource},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(ci.isParsed())throw new Error("RTL text plugin already registered.");ci.applyArabicShaping=t.applyArabicShaping,ci.processBidirectionalText=t.processBidirectionalText,ci.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 VectorTileWorkerSource&&(n[t].isSpriteLoaded=e,n[t].fire(new Event("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]=Mu(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?p({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?p({buildQuadTree:this.terrain},e):e;this.getDEMWorkerSource(t,e.source).loadTile(n,r)}reloadTile(t,e,r){const n=this.enableTerrain?p({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{ci.setState(e);const t=ci.getPluginURL();if(ci.isLoaded()&&!ci.isParsed()&&null!=t){this.self.importScripts(t);const e=ci.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 StyleLayerIndex),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,a)=>{this.actor.send(e,r,n,t,s,a)},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 RasterDEMTileWorkerSource),this.demWorkerSources[t][e]}enforceCacheSizeLimit(t,e){!function(t){for(const e in pr)fr(e),pr[e].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 Worker(self)),Worker}();
|
|
2
2
|
//# sourceMappingURL=mapbox-gl-csp-worker.js.map
|