@mappedin/maplibre-overlay 6.0.1-beta.56 → 6.0.1-beta.57
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/lib/esm/GLTFExporter-O644PVLV.js +1 -0
- package/lib/esm/GLTFLoader-AZWCPJ6N.js +1 -0
- package/lib/esm/chunk-5BCZO6LI.js +1 -0
- package/lib/esm/chunk-LUJQR5EH.js +1 -0
- package/lib/esm/chunk-QNFLY3SM.js +1 -0
- package/lib/esm/chunk-ZGSGFTWM.js +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/{roboto-regular-JDPVYXT5.js → roboto-regular-NXH7N2CY.js} +1 -1
- package/lib/esm/text3d-X7BWPJT4.js +1 -0
- package/package.json +3 -16
- package/lib/esm/GLTFExporter-BPHG4XL7.js +0 -1
- package/lib/esm/GLTFLoader-5XXRE2UW.js +0 -1
- package/lib/esm/chunk-6UGO67X2.js +0 -1
- package/lib/esm/chunk-BI3F3KS7.js +0 -1
- package/lib/esm/chunk-CU2O7JF6.js +0 -1
- package/lib/esm/chunk-F44NIQPP.js +0 -1
- package/lib/esm/chunk-IYKJ3SDZ.js +0 -1
- package/lib/esm/chunk-Q3N6EADX.js +0 -1
- package/lib/esm/outdoor-context-v5-FSCVFUVV.js +0 -1
- package/lib/esm/text3d-YQOBP3BF.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as y}from"./chunk-F44NIQPP.js";import{a as $e,b as St,c as l,f as cr,g as Hn,h as oe}from"./chunk-CU2O7JF6.js";var ue=cr((Y3,jv)=>{"use strict";y();jv.exports=Oi;function Oi(r,e){this.x=r,this.y=e}l(Oi,"Point");Oi.prototype={clone:l(function(){return new Oi(this.x,this.y)},"clone"),add:l(function(r){return this.clone()._add(r)},"add"),sub:l(function(r){return this.clone()._sub(r)},"sub"),multByPoint:l(function(r){return this.clone()._multByPoint(r)},"multByPoint"),divByPoint:l(function(r){return this.clone()._divByPoint(r)},"divByPoint"),mult:l(function(r){return this.clone()._mult(r)},"mult"),div:l(function(r){return this.clone()._div(r)},"div"),rotate:l(function(r){return this.clone()._rotate(r)},"rotate"),rotateAround:l(function(r,e){return this.clone()._rotateAround(r,e)},"rotateAround"),matMult:l(function(r){return this.clone()._matMult(r)},"matMult"),unit:l(function(){return this.clone()._unit()},"unit"),perp:l(function(){return this.clone()._perp()},"perp"),round:l(function(){return this.clone()._round()},"round"),mag:l(function(){return Math.sqrt(this.x*this.x+this.y*this.y)},"mag"),equals:l(function(r){return this.x===r.x&&this.y===r.y},"equals"),dist:l(function(r){return Math.sqrt(this.distSqr(r))},"dist"),distSqr:l(function(r){var e=r.x-this.x,t=r.y-this.y;return e*e+t*t},"distSqr"),angle:l(function(){return Math.atan2(this.y,this.x)},"angle"),angleTo:l(function(r){return Math.atan2(this.y-r.y,this.x-r.x)},"angleTo"),angleWith:l(function(r){return this.angleWithSep(r.x,r.y)},"angleWith"),angleWithSep:l(function(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},"angleWithSep"),_matMult:l(function(r){var e=r[0]*this.x+r[1]*this.y,t=r[2]*this.x+r[3]*this.y;return this.x=e,this.y=t,this},"_matMult"),_add:l(function(r){return this.x+=r.x,this.y+=r.y,this},"_add"),_sub:l(function(r){return this.x-=r.x,this.y-=r.y,this},"_sub"),_mult:l(function(r){return this.x*=r,this.y*=r,this},"_mult"),_div:l(function(r){return this.x/=r,this.y/=r,this},"_div"),_multByPoint:l(function(r){return this.x*=r.x,this.y*=r.y,this},"_multByPoint"),_divByPoint:l(function(r){return this.x/=r.x,this.y/=r.y,this},"_divByPoint"),_unit:l(function(){return this._div(this.mag()),this},"_unit"),_perp:l(function(){var r=this.y;return this.y=this.x,this.x=-r,this},"_perp"),_rotate:l(function(r){var e=Math.cos(r),t=Math.sin(r),n=e*this.x-t*this.y,i=t*this.x+e*this.y;return this.x=n,this.y=i,this},"_rotate"),_rotateAround:l(function(r,e){var t=Math.cos(r),n=Math.sin(r),i=e.x+t*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+t*(this.y-e.y);return this.x=i,this.y=o,this},"_rotateAround"),_round:l(function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},"_round")};Oi.convert=function(r){return r instanceof Oi?r:Array.isArray(r)?new Oi(r[0],r[1]):r}});var Zv=cr((Q3,Gv)=>{"use strict";y();Gv.exports=Nv;function Nv(r,e,t,n){this.cx=3*r,this.bx=3*(t-r)-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=r,this.p1y=e,this.p2x=t,this.p2y=n}l(Nv,"UnitBezier");Nv.prototype={sampleCurveX:l(function(r){return((this.ax*r+this.bx)*r+this.cx)*r},"sampleCurveX"),sampleCurveY:l(function(r){return((this.ay*r+this.by)*r+this.cy)*r},"sampleCurveY"),sampleCurveDerivativeX:l(function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},"sampleCurveDerivativeX"),solveCurveX:l(function(r,e){if(e===void 0&&(e=1e-6),r<0)return 0;if(r>1)return 1;for(var t=r,n=0;n<8;n++){var i=this.sampleCurveX(t)-r;if(Math.abs(i)<e)return t;var o=this.sampleCurveDerivativeX(t);if(Math.abs(o)<1e-6)break;t=t-i/o}var a=0,s=1;for(t=r,n=0;n<20&&(i=this.sampleCurveX(t),!(Math.abs(i-r)<e));n++)r>i?a=t:s=t,t=(s-a)*.5+a;return t},"solveCurveX"),solve:l(function(r,e){return this.sampleCurveY(this.solveCurveX(r,e))},"solve")}});var Ew=cr((n4,_y)=>{y();function YD(r,e){var t,n,i,o,a,s,u,c,p,h;for(t=r.length&3,n=r.length-t,i=e,a=3432918353,u=461845907,h=0;h<n;)p=r.charCodeAt(h)&255|(r.charCodeAt(++h)&255)<<8|(r.charCodeAt(++h)&255)<<16|(r.charCodeAt(++h)&255)<<24,++h,p=(p&65535)*a+(((p>>>16)*a&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*u+(((p>>>16)*u&65535)<<16)&4294967295,i^=p,i=i<<13|i>>>19,o=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(p=0,t){case 3:p^=(r.charCodeAt(h+2)&255)<<16;case 2:p^=(r.charCodeAt(h+1)&255)<<8;case 1:p^=r.charCodeAt(h)&255,p=(p&65535)*a+(((p>>>16)*a&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*u+(((p>>>16)*u&65535)<<16)&4294967295,i^=p}return i^=r.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}l(YD,"murmurhash3_32_gc");typeof _y<"u"&&(_y.exports=YD)});var Lw=cr((a4,by)=>{y();function KD(r,e){for(var t=r.length,n=e^t,i=0,o;t>=4;)o=r.charCodeAt(i)&255|(r.charCodeAt(++i)&255)<<8|(r.charCodeAt(++i)&255)<<16|(r.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^o,t-=4,++i;switch(t){case 3:n^=(r.charCodeAt(i+2)&255)<<16;case 2:n^=(r.charCodeAt(i+1)&255)<<8;case 1:n^=r.charCodeAt(i)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}l(KD,"murmurhash2_32_gc");typeof by!==void 0&&(by.exports=KD)});var vy=cr((u4,dc)=>{y();var kw=Ew(),JD=Lw();dc.exports=kw;dc.exports.murmur3=kw;dc.exports.murmur2=JD});var cg=cr((oN,xP)=>{"use strict";y();var UF=ue();xP.exports=go;function go(r,e,t,n,i){this.properties={},this.extent=t,this.type=0,this._pbf=r,this._geometry=-1,this._keys=n,this._values=i,r.readFields(jF,this,e)}l(go,"VectorTileFeature");function jF(r,e,t){r==1?e.id=t.readVarint():r==2?NF(t,e):r==3?e.type=t.readVarint():r==4&&(e._geometry=t.pos)}l(jF,"readFeature");function NF(r,e){for(var t=r.readVarint()+r.pos;r.pos<t;){var n=e._keys[r.readVarint()],i=e._values[r.readVarint()];e.properties[n]=i}}l(NF,"readTag");go.types=["Unknown","Point","LineString","Polygon"];go.prototype.loadGeometry=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,t=1,n=0,i=0,o=0,a=[],s;r.pos<e;){if(n<=0){var u=r.readVarint();t=u&7,n=u>>3}if(n--,t===1||t===2)i+=r.readSVarint(),o+=r.readSVarint(),t===1&&(s&&a.push(s),s=[]),s.push(new UF(i,o));else if(t===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+t)}return s&&a.push(s),a};go.prototype.bbox=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,t=1,n=0,i=0,o=0,a=1/0,s=-1/0,u=1/0,c=-1/0;r.pos<e;){if(n<=0){var p=r.readVarint();t=p&7,n=p>>3}if(n--,t===1||t===2)i+=r.readSVarint(),o+=r.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<u&&(u=o),o>c&&(c=o);else if(t!==7)throw new Error("unknown command "+t)}return[a,u,s,c]};go.prototype.toGeoJSON=function(r,e,t){var n=this.extent*Math.pow(2,t),i=this.extent*r,o=this.extent*e,a=this.loadGeometry(),s=go.types[this.type],u,c;function p(f){for(var d=0;d<f.length;d++){var g=f[d],x=180-(g.y+o)*360/n;f[d]=[(g.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(x*Math.PI/180))-90]}}switch(l(p,"project"),this.type){case 1:var h=[];for(u=0;u<a.length;u++)h[u]=a[u][0];a=h,p(a);break;case 2:for(u=0;u<a.length;u++)p(a[u]);break;case 3:for(a=GF(a),u=0;u<a.length;u++)for(c=0;c<a[u].length;c++)p(a[u][c]);break}a.length===1?a=a[0]:s="Multi"+s;var m={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(m.id=this.id),m};function GF(r){var e=r.length;if(e<=1)return[r];for(var t=[],n,i,o=0;o<e;o++){var a=ZF(r[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&t.push(n),n=[r[o]]):n.push(r[o]))}return n&&t.push(n),t}l(GF,"classifyRings");function ZF(r){for(var e=0,t=0,n=r.length,i=n-1,o,a;t<n;i=t++)o=r[t],a=r[i],e+=(a.x-o.x)*(o.y+a.y);return e}l(ZF,"signedArea")});var pg=cr((lN,bP)=>{"use strict";y();var qF=cg();bP.exports=_P;function _P(r,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=r,this._keys=[],this._values=[],this._features=[],r.readFields(HF,this,e),this.length=this._features.length}l(_P,"VectorTileLayer");function HF(r,e,t){r===15?e.version=t.readVarint():r===1?e.name=t.readString():r===5?e.extent=t.readVarint():r===2?e._features.push(t.pos):r===3?e._keys.push(t.readString()):r===4&&e._values.push(WF(t))}l(HF,"readLayer");function WF(r){for(var e=null,t=r.readVarint()+r.pos;r.pos<t;){var n=r.readVarint()>>3;e=n===1?r.readString():n===2?r.readFloat():n===3?r.readDouble():n===4?r.readVarint64():n===5?r.readVarint():n===6?r.readSVarint():n===7?r.readBoolean():null}return e}l(WF,"readValueMessage");_P.prototype.feature=function(r){if(r<0||r>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[r];var e=this._pbf.readVarint()+this._pbf.pos;return new qF(this._pbf,e,this.extent,this._keys,this._values)}});var wP=cr((pN,vP)=>{"use strict";y();var $F=pg();vP.exports=XF;function XF(r,e){this.layers=r.readFields(YF,{},e)}l(XF,"VectorTile");function YF(r,e,t){if(r===3){var n=new $F(t,t.readVarint()+t.pos);n.length&&(e[n.name]=n)}}l(YF,"readTile")});var fs=cr((fN,Dc)=>{y();Dc.exports.VectorTile=wP();Dc.exports.VectorTileFeature=cg();Dc.exports.VectorTileLayer=pg()});var HP=cr(vg=>{y();vg.read=function(r,e,t,n,i){var o,a,s=i*8-n-1,u=(1<<s)-1,c=u>>1,p=-7,h=t?i-1:0,m=t?-1:1,f=r[e+h];for(h+=m,o=f&(1<<-p)-1,f>>=-p,p+=s;p>0;o=o*256+r[e+h],h+=m,p-=8);for(a=o&(1<<-p)-1,o>>=-p,p+=n;p>0;a=a*256+r[e+h],h+=m,p-=8);if(o===0)o=1-c;else{if(o===u)return a?NaN:(f?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-c}return(f?-1:1)*a*Math.pow(2,o-n)};vg.write=function(r,e,t,n,i,o){var a,s,u,c=o*8-i-1,p=(1<<c)-1,h=p>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+h>=1?e+=m/u:e+=m*Math.pow(2,1-h),e*u>=2&&(a++,u/=2),a+h>=p?(s=0,a=p):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a=a+h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;r[t+f]=s&255,f+=d,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;r[t+f]=a&255,f+=d,a/=256,c-=8);r[t+f-d]|=g*128}});var Pg=cr((d8,KP)=>{"use strict";y();KP.exports=Fe;var Vc=HP();function Fe(r){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(r)?r:new Uint8Array(r||0),this.pos=0,this.type=0,this.length=this.buf.length}l(Fe,"Pbf");Fe.Varint=0;Fe.Fixed64=1;Fe.Bytes=2;Fe.Fixed32=5;var wg=65536*65536,WP=1/wg,dz=12,YP=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");Fe.prototype={destroy:l(function(){this.buf=null},"destroy"),readFields:l(function(r,e,t){for(t=t||this.length;this.pos<t;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,r(i,e,this),this.pos===o&&this.skip(n)}return e},"readFields"),readMessage:l(function(r,e){return this.readFields(r,e,this.readVarint()+this.pos)},"readMessage"),readFixed32:l(function(){var r=Uc(this.buf,this.pos);return this.pos+=4,r},"readFixed32"),readSFixed32:l(function(){var r=XP(this.buf,this.pos);return this.pos+=4,r},"readSFixed32"),readFixed64:l(function(){var r=Uc(this.buf,this.pos)+Uc(this.buf,this.pos+4)*wg;return this.pos+=8,r},"readFixed64"),readSFixed64:l(function(){var r=Uc(this.buf,this.pos)+XP(this.buf,this.pos+4)*wg;return this.pos+=8,r},"readSFixed64"),readFloat:l(function(){var r=Vc.read(this.buf,this.pos,!0,23,4);return this.pos+=4,r},"readFloat"),readDouble:l(function(){var r=Vc.read(this.buf,this.pos,!0,52,8);return this.pos+=8,r},"readDouble"),readVarint:l(function(r){var e=this.buf,t,n;return n=e[this.pos++],t=n&127,n<128||(n=e[this.pos++],t|=(n&127)<<7,n<128)||(n=e[this.pos++],t|=(n&127)<<14,n<128)||(n=e[this.pos++],t|=(n&127)<<21,n<128)?t:(n=e[this.pos],t|=(n&15)<<28,yz(t,r,this))},"readVarint"),readVarint64:l(function(){return this.readVarint(!0)},"readVarint64"),readSVarint:l(function(){var r=this.readVarint();return r%2===1?(r+1)/-2:r/2},"readSVarint"),readBoolean:l(function(){return!!this.readVarint()},"readBoolean"),readString:l(function(){var r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=dz&&YP?Ez(this.buf,e,r):Iz(this.buf,e,r)},"readString"),readBytes:l(function(){var r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e},"readBytes"),readPackedVarint:l(function(r,e){if(this.type!==Fe.Bytes)return r.push(this.readVarint(e));var t=Yr(this);for(r=r||[];this.pos<t;)r.push(this.readVarint(e));return r},"readPackedVarint"),readPackedSVarint:l(function(r){if(this.type!==Fe.Bytes)return r.push(this.readSVarint());var e=Yr(this);for(r=r||[];this.pos<e;)r.push(this.readSVarint());return r},"readPackedSVarint"),readPackedBoolean:l(function(r){if(this.type!==Fe.Bytes)return r.push(this.readBoolean());var e=Yr(this);for(r=r||[];this.pos<e;)r.push(this.readBoolean());return r},"readPackedBoolean"),readPackedFloat:l(function(r){if(this.type!==Fe.Bytes)return r.push(this.readFloat());var e=Yr(this);for(r=r||[];this.pos<e;)r.push(this.readFloat());return r},"readPackedFloat"),readPackedDouble:l(function(r){if(this.type!==Fe.Bytes)return r.push(this.readDouble());var e=Yr(this);for(r=r||[];this.pos<e;)r.push(this.readDouble());return r},"readPackedDouble"),readPackedFixed32:l(function(r){if(this.type!==Fe.Bytes)return r.push(this.readFixed32());var e=Yr(this);for(r=r||[];this.pos<e;)r.push(this.readFixed32());return r},"readPackedFixed32"),readPackedSFixed32:l(function(r){if(this.type!==Fe.Bytes)return r.push(this.readSFixed32());var e=Yr(this);for(r=r||[];this.pos<e;)r.push(this.readSFixed32());return r},"readPackedSFixed32"),readPackedFixed64:l(function(r){if(this.type!==Fe.Bytes)return r.push(this.readFixed64());var e=Yr(this);for(r=r||[];this.pos<e;)r.push(this.readFixed64());return r},"readPackedFixed64"),readPackedSFixed64:l(function(r){if(this.type!==Fe.Bytes)return r.push(this.readSFixed64());var e=Yr(this);for(r=r||[];this.pos<e;)r.push(this.readSFixed64());return r},"readPackedSFixed64"),skip:l(function(r){var e=r&7;if(e===Fe.Varint)for(;this.buf[this.pos++]>127;);else if(e===Fe.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Fe.Fixed32)this.pos+=4;else if(e===Fe.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},"skip"),writeTag:l(function(r,e){this.writeVarint(r<<3|e)},"writeTag"),realloc:l(function(r){for(var e=this.length||16;e<this.pos+r;)e*=2;if(e!==this.length){var t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.length=e}},"realloc"),finish:l(function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},"finish"),writeFixed32:l(function(r){this.realloc(4),_o(this.buf,r,this.pos),this.pos+=4},"writeFixed32"),writeSFixed32:l(function(r){this.realloc(4),_o(this.buf,r,this.pos),this.pos+=4},"writeSFixed32"),writeFixed64:l(function(r){this.realloc(8),_o(this.buf,r&-1,this.pos),_o(this.buf,Math.floor(r*WP),this.pos+4),this.pos+=8},"writeFixed64"),writeSFixed64:l(function(r){this.realloc(8),_o(this.buf,r&-1,this.pos),_o(this.buf,Math.floor(r*WP),this.pos+4),this.pos+=8},"writeSFixed64"),writeVarint:l(function(r){if(r=+r||0,r>268435455||r<0){gz(r,this);return}this.realloc(4),this.buf[this.pos++]=r&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=(r>>>=7)&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=(r>>>=7)&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=r>>>7&127)))},"writeVarint"),writeSVarint:l(function(r){this.writeVarint(r<0?-r*2-1:r*2)},"writeSVarint"),writeBoolean:l(function(r){this.writeVarint(!!r)},"writeBoolean"),writeString:l(function(r){r=String(r),this.realloc(r.length*4),this.pos++;var e=this.pos;this.pos=Lz(this.buf,r,this.pos);var t=this.pos-e;t>=128&&$P(e,t,this),this.pos=e-1,this.writeVarint(t),this.pos+=t},"writeString"),writeFloat:l(function(r){this.realloc(4),Vc.write(this.buf,r,this.pos,!0,23,4),this.pos+=4},"writeFloat"),writeDouble:l(function(r){this.realloc(8),Vc.write(this.buf,r,this.pos,!0,52,8),this.pos+=8},"writeDouble"),writeBytes:l(function(r){var e=r.length;this.writeVarint(e),this.realloc(e);for(var t=0;t<e;t++)this.buf[this.pos++]=r[t]},"writeBytes"),writeRawMessage:l(function(r,e){this.pos++;var t=this.pos;r(e,this);var n=this.pos-t;n>=128&&$P(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},"writeRawMessage"),writeMessage:l(function(r,e,t){this.writeTag(r,Fe.Bytes),this.writeRawMessage(e,t)},"writeMessage"),writePackedVarint:l(function(r,e){e.length&&this.writeMessage(r,bz,e)},"writePackedVarint"),writePackedSVarint:l(function(r,e){e.length&&this.writeMessage(r,vz,e)},"writePackedSVarint"),writePackedBoolean:l(function(r,e){e.length&&this.writeMessage(r,Tz,e)},"writePackedBoolean"),writePackedFloat:l(function(r,e){e.length&&this.writeMessage(r,wz,e)},"writePackedFloat"),writePackedDouble:l(function(r,e){e.length&&this.writeMessage(r,Pz,e)},"writePackedDouble"),writePackedFixed32:l(function(r,e){e.length&&this.writeMessage(r,Sz,e)},"writePackedFixed32"),writePackedSFixed32:l(function(r,e){e.length&&this.writeMessage(r,Mz,e)},"writePackedSFixed32"),writePackedFixed64:l(function(r,e){e.length&&this.writeMessage(r,Cz,e)},"writePackedFixed64"),writePackedSFixed64:l(function(r,e){e.length&&this.writeMessage(r,Az,e)},"writePackedSFixed64"),writeBytesField:l(function(r,e){this.writeTag(r,Fe.Bytes),this.writeBytes(e)},"writeBytesField"),writeFixed32Field:l(function(r,e){this.writeTag(r,Fe.Fixed32),this.writeFixed32(e)},"writeFixed32Field"),writeSFixed32Field:l(function(r,e){this.writeTag(r,Fe.Fixed32),this.writeSFixed32(e)},"writeSFixed32Field"),writeFixed64Field:l(function(r,e){this.writeTag(r,Fe.Fixed64),this.writeFixed64(e)},"writeFixed64Field"),writeSFixed64Field:l(function(r,e){this.writeTag(r,Fe.Fixed64),this.writeSFixed64(e)},"writeSFixed64Field"),writeVarintField:l(function(r,e){this.writeTag(r,Fe.Varint),this.writeVarint(e)},"writeVarintField"),writeSVarintField:l(function(r,e){this.writeTag(r,Fe.Varint),this.writeSVarint(e)},"writeSVarintField"),writeStringField:l(function(r,e){this.writeTag(r,Fe.Bytes),this.writeString(e)},"writeStringField"),writeFloatField:l(function(r,e){this.writeTag(r,Fe.Fixed32),this.writeFloat(e)},"writeFloatField"),writeDoubleField:l(function(r,e){this.writeTag(r,Fe.Fixed64),this.writeDouble(e)},"writeDoubleField"),writeBooleanField:l(function(r,e){this.writeVarintField(r,!!e)},"writeBooleanField")};function yz(r,e,t){var n=t.buf,i,o;if(o=n[t.pos++],i=(o&112)>>4,o<128||(o=n[t.pos++],i|=(o&127)<<3,o<128)||(o=n[t.pos++],i|=(o&127)<<10,o<128)||(o=n[t.pos++],i|=(o&127)<<17,o<128)||(o=n[t.pos++],i|=(o&127)<<24,o<128)||(o=n[t.pos++],i|=(o&1)<<31,o<128))return xo(r,i,e);throw new Error("Expected varint not more than 10 bytes")}l(yz,"readVarintRemainder");function Yr(r){return r.type===Fe.Bytes?r.readVarint()+r.pos:r.pos+1}l(Yr,"readPackedEnd");function xo(r,e,t){return t?e*4294967296+(r>>>0):(e>>>0)*4294967296+(r>>>0)}l(xo,"toNum");function gz(r,e){var t,n;if(r>=0?(t=r%4294967296|0,n=r/4294967296|0):(t=~(-r%4294967296),n=~(-r/4294967296),t^4294967295?t=t+1|0:(t=0,n=n+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),xz(t,n,e),_z(n,e)}l(gz,"writeBigVarint");function xz(r,e,t){t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos]=r&127}l(xz,"writeBigVarintLow");function _z(r,e){var t=(r&7)<<4;e.buf[e.pos++]|=t|((r>>>=3)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127)))))}l(_z,"writeBigVarintHigh");function $P(r,e,t){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(n);for(var i=t.pos-1;i>=r;i--)t.buf[i+n]=t.buf[i]}l($P,"makeRoomForExtraLength");function bz(r,e){for(var t=0;t<r.length;t++)e.writeVarint(r[t])}l(bz,"writePackedVarint");function vz(r,e){for(var t=0;t<r.length;t++)e.writeSVarint(r[t])}l(vz,"writePackedSVarint");function wz(r,e){for(var t=0;t<r.length;t++)e.writeFloat(r[t])}l(wz,"writePackedFloat");function Pz(r,e){for(var t=0;t<r.length;t++)e.writeDouble(r[t])}l(Pz,"writePackedDouble");function Tz(r,e){for(var t=0;t<r.length;t++)e.writeBoolean(r[t])}l(Tz,"writePackedBoolean");function Sz(r,e){for(var t=0;t<r.length;t++)e.writeFixed32(r[t])}l(Sz,"writePackedFixed32");function Mz(r,e){for(var t=0;t<r.length;t++)e.writeSFixed32(r[t])}l(Mz,"writePackedSFixed32");function Cz(r,e){for(var t=0;t<r.length;t++)e.writeFixed64(r[t])}l(Cz,"writePackedFixed64");function Az(r,e){for(var t=0;t<r.length;t++)e.writeSFixed64(r[t])}l(Az,"writePackedSFixed64");function Uc(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+r[e+3]*16777216}l(Uc,"readUInt32");function _o(r,e,t){r[t]=e,r[t+1]=e>>>8,r[t+2]=e>>>16,r[t+3]=e>>>24}l(_o,"writeInt32");function XP(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+(r[e+3]<<24)}l(XP,"readInt32");function Iz(r,e,t){for(var n="",i=e;i<t;){var o=r[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>t)break;var u,c,p;s===1?o<128&&(a=o):s===2?(u=r[i+1],(u&192)===128&&(a=(o&31)<<6|u&63,a<=127&&(a=null))):s===3?(u=r[i+1],c=r[i+2],(u&192)===128&&(c&192)===128&&(a=(o&15)<<12|(u&63)<<6|c&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(u=r[i+1],c=r[i+2],p=r[i+3],(u&192)===128&&(c&192)===128&&(p&192)===128&&(a=(o&15)<<18|(u&63)<<12|(c&63)<<6|p&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}l(Iz,"readUtf8");function Ez(r,e,t){return YP.decode(r.subarray(e,t))}l(Ez,"readUtf8TextDecoder");function Lz(r,e,t){for(var n=0,i,o;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){r[t++]=239,r[t++]=191,r[t++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===e.length?(r[t++]=239,r[t++]=191,r[t++]=189):o=i;continue}else o&&(r[t++]=239,r[t++]=191,r[t++]=189,o=null);i<128?r[t++]=i:(i<2048?r[t++]=i>>6|192:(i<65536?r[t++]=i>>12|224:(r[t++]=i>>18|240,r[t++]=i>>12&63|128),r[t++]=i>>6&63|128),r[t++]=i&63|128)}return t}l(Lz,"writeUtf8")});y();var Il={name:"@packages/internal",private:!0,version:"6.0.1-beta.51",dependencies:{"@turf/boolean-point-in-polygon":"6.5.0","@turf/destination":"6.5.0","@turf/distance":"6.5.0"},files:["./common/","./outdoor-context-4/","./geojson-navigator/","./quad-tree/","./shave-text","./clipper-lib"]};y();y();var D0=oe(ue(),1),F0=oe(Zv(),1);y();y();var Tm;function El(){return Tm==null&&(Tm=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Tm}l(El,"offscreenCanvasSupported");var Ll;function Sm(){if(Ll==null&&(Ll=!1,El())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let i=0;i<5*5;i++){let o=i*4;t.fillStyle="rgb(".concat(o,",").concat(o+1,",").concat(o+2,")"),t.fillRect(i%5,Math.floor(i/5),1,1)}let n=t.getImageData(0,0,5,5).data;for(let i=0;i<5*5*4;i++)if(i%4!==3&&n[i]!==i){Ll=!0;break}}}return Ll||!1}l(Sm,"isOffscreenCanvasDistorted");y();y();var ae=1e-6,Te=typeof Float32Array<"u"?Float32Array:Array,Mt=Math.random;var uO=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var an={};Hn(an,{LDU:()=>dA,add:()=>yA,adjoint:()=>sA,clone:()=>eA,copy:()=>tA,create:()=>QC,determinant:()=>lA,equals:()=>xA,exactEquals:()=>gA,frob:()=>fA,fromRotation:()=>pA,fromScaling:()=>hA,fromValues:()=>nA,identity:()=>rA,invert:()=>aA,mul:()=>vA,multiply:()=>qv,multiplyScalar:()=>_A,multiplyScalarAndAdd:()=>bA,rotate:()=>uA,scale:()=>cA,set:()=>iA,str:()=>mA,sub:()=>wA,subtract:()=>Hv,transpose:()=>oA});y();function QC(){var r=new Te(4);return Te!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r}l(QC,"create");function eA(r){var e=new Te(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}l(eA,"clone");function tA(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}l(tA,"copy");function rA(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r}l(rA,"identity");function nA(r,e,t,n){var i=new Te(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}l(nA,"fromValues");function iA(r,e,t,n,i){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r}l(iA,"set");function oA(r,e){if(r===e){var t=e[1];r[1]=e[2],r[2]=t}else r[0]=e[0],r[1]=e[2],r[2]=e[1],r[3]=e[3];return r}l(oA,"transpose");function aA(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=t*o-i*n;return a?(a=1/a,r[0]=o*a,r[1]=-n*a,r[2]=-i*a,r[3]=t*a,r):null}l(aA,"invert");function sA(r,e){var t=e[0];return r[0]=e[3],r[1]=-e[1],r[2]=-e[2],r[3]=t,r}l(sA,"adjoint");function lA(r){return r[0]*r[3]-r[2]*r[1]}l(lA,"determinant");function qv(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=t[0],u=t[1],c=t[2],p=t[3];return r[0]=n*s+o*u,r[1]=i*s+a*u,r[2]=n*c+o*p,r[3]=i*c+a*p,r}l(qv,"multiply");function uA(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u+o*s,r[1]=i*u+a*s,r[2]=n*-s+o*u,r[3]=i*-s+a*u,r}l(uA,"rotate");function cA(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=t[0],u=t[1];return r[0]=n*s,r[1]=i*s,r[2]=o*u,r[3]=a*u,r}l(cA,"scale");function pA(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=-t,r[3]=n,r}l(pA,"fromRotation");function hA(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=e[1],r}l(hA,"fromScaling");function mA(r){return"mat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}l(mA,"str");function fA(r){return Math.hypot(r[0],r[1],r[2],r[3])}l(fA,"frob");function dA(r,e,t,n){return r[2]=n[2]/n[0],t[0]=n[0],t[1]=n[1],t[3]=n[3]-r[2]*t[1],[r,e,t]}l(dA,"LDU");function yA(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}l(yA,"add");function Hv(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}l(Hv,"subtract");function gA(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}l(gA,"exactEquals");function xA(r,e){var t=r[0],n=r[1],i=r[2],o=r[3],a=e[0],s=e[1],u=e[2],c=e[3];return Math.abs(t-a)<=ae*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(n-s)<=ae*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=ae*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(o-c)<=ae*Math.max(1,Math.abs(o),Math.abs(c))}l(xA,"equals");function _A(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}l(_A,"multiplyScalar");function bA(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r}l(bA,"multiplyScalarAndAdd");var vA=qv,wA=Hv;var Ur={};Hn(Ur,{add:()=>qA,adjoint:()=>LA,clone:()=>TA,copy:()=>SA,create:()=>Mm,determinant:()=>kA,equals:()=>XA,exactEquals:()=>$A,frob:()=>ZA,fromMat2d:()=>VA,fromMat4:()=>PA,fromQuat:()=>UA,fromRotation:()=>BA,fromScaling:()=>OA,fromTranslation:()=>zA,fromValues:()=>MA,identity:()=>AA,invert:()=>EA,mul:()=>YA,multiply:()=>Wv,multiplyScalar:()=>HA,multiplyScalarAndAdd:()=>WA,normalFromMat4:()=>jA,projection:()=>NA,rotate:()=>DA,scale:()=>FA,set:()=>CA,str:()=>GA,sub:()=>KA,subtract:()=>$v,translate:()=>RA,transpose:()=>IA});y();function Mm(){var r=new Te(9);return Te!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}l(Mm,"create");function PA(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r}l(PA,"fromMat4");function TA(r){var e=new Te(9);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e}l(TA,"clone");function SA(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}l(SA,"copy");function MA(r,e,t,n,i,o,a,s,u){var c=new Te(9);return c[0]=r,c[1]=e,c[2]=t,c[3]=n,c[4]=i,c[5]=o,c[6]=a,c[7]=s,c[8]=u,c}l(MA,"fromValues");function CA(r,e,t,n,i,o,a,s,u,c){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=o,r[5]=a,r[6]=s,r[7]=u,r[8]=c,r}l(CA,"set");function AA(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}l(AA,"identity");function IA(r,e){if(r===e){var t=e[1],n=e[2],i=e[5];r[1]=e[3],r[2]=e[6],r[3]=t,r[5]=e[7],r[6]=n,r[7]=i}else r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8];return r}l(IA,"transpose");function EA(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],p=e[8],h=p*a-s*c,m=-p*o+s*u,f=c*o-a*u,d=t*h+n*m+i*f;return d?(d=1/d,r[0]=h*d,r[1]=(-p*n+i*c)*d,r[2]=(s*n-i*a)*d,r[3]=m*d,r[4]=(p*t-i*u)*d,r[5]=(-s*t+i*o)*d,r[6]=f*d,r[7]=(-c*t+n*u)*d,r[8]=(a*t-n*o)*d,r):null}l(EA,"invert");function LA(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],p=e[8];return r[0]=a*p-s*c,r[1]=i*c-n*p,r[2]=n*s-i*a,r[3]=s*u-o*p,r[4]=t*p-i*u,r[5]=i*o-t*s,r[6]=o*c-a*u,r[7]=n*u-t*c,r[8]=t*a-n*o,r}l(LA,"adjoint");function kA(r){var e=r[0],t=r[1],n=r[2],i=r[3],o=r[4],a=r[5],s=r[6],u=r[7],c=r[8];return e*(c*o-a*u)+t*(-c*i+a*s)+n*(u*i-o*s)}l(kA,"determinant");function Wv(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],p=e[7],h=e[8],m=t[0],f=t[1],d=t[2],g=t[3],x=t[4],_=t[5],b=t[6],v=t[7],w=t[8];return r[0]=m*n+f*a+d*c,r[1]=m*i+f*s+d*p,r[2]=m*o+f*u+d*h,r[3]=g*n+x*a+_*c,r[4]=g*i+x*s+_*p,r[5]=g*o+x*u+_*h,r[6]=b*n+v*a+w*c,r[7]=b*i+v*s+w*p,r[8]=b*o+v*u+w*h,r}l(Wv,"multiply");function RA(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],p=e[7],h=e[8],m=t[0],f=t[1];return r[0]=n,r[1]=i,r[2]=o,r[3]=a,r[4]=s,r[5]=u,r[6]=m*n+f*a+c,r[7]=m*i+f*s+p,r[8]=m*o+f*u+h,r}l(RA,"translate");function DA(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],p=e[7],h=e[8],m=Math.sin(t),f=Math.cos(t);return r[0]=f*n+m*a,r[1]=f*i+m*s,r[2]=f*o+m*u,r[3]=f*a-m*n,r[4]=f*s-m*i,r[5]=f*u-m*o,r[6]=c,r[7]=p,r[8]=h,r}l(DA,"rotate");function FA(r,e,t){var n=t[0],i=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=i*e[3],r[4]=i*e[4],r[5]=i*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}l(FA,"scale");function zA(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=e[0],r[7]=e[1],r[8]=1,r}l(zA,"fromTranslation");function BA(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=0,r[3]=-t,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}l(BA,"fromRotation");function OA(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=e[1],r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}l(OA,"fromScaling");function VA(r,e){return r[0]=e[0],r[1]=e[1],r[2]=0,r[3]=e[2],r[4]=e[3],r[5]=0,r[6]=e[4],r[7]=e[5],r[8]=1,r}l(VA,"fromMat2d");function UA(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=t+t,s=n+n,u=i+i,c=t*a,p=n*a,h=n*s,m=i*a,f=i*s,d=i*u,g=o*a,x=o*s,_=o*u;return r[0]=1-h-d,r[3]=p-_,r[6]=m+x,r[1]=p+_,r[4]=1-c-d,r[7]=f-g,r[2]=m-x,r[5]=f+g,r[8]=1-c-h,r}l(UA,"fromQuat");function jA(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],p=e[8],h=e[9],m=e[10],f=e[11],d=e[12],g=e[13],x=e[14],_=e[15],b=t*s-n*a,v=t*u-i*a,w=t*c-o*a,T=n*u-i*s,S=n*c-o*s,A=i*c-o*u,M=p*g-h*d,I=p*x-m*d,L=p*_-f*d,D=h*x-m*g,F=h*_-f*g,U=m*_-f*x,C=b*U-v*F+w*D+T*L-S*I+A*M;return C?(C=1/C,r[0]=(s*U-u*F+c*D)*C,r[1]=(u*L-a*U-c*I)*C,r[2]=(a*F-s*L+c*M)*C,r[3]=(i*F-n*U-o*D)*C,r[4]=(t*U-i*L+o*I)*C,r[5]=(n*L-t*F-o*M)*C,r[6]=(g*A-x*S+_*T)*C,r[7]=(x*w-d*A-_*v)*C,r[8]=(d*S-g*w+_*b)*C,r):null}l(jA,"normalFromMat4");function NA(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}l(NA,"projection");function GA(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}l(GA,"str");function ZA(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])}l(ZA,"frob");function qA(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r}l(qA,"add");function $v(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r}l($v,"subtract");function HA(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r}l(HA,"multiplyScalar");function WA(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r[6]=e[6]+t[6]*n,r[7]=e[7]+t[7]*n,r[8]=e[8]+t[8]*n,r}l(WA,"multiplyScalarAndAdd");function $A(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]}l($A,"exactEquals");function XA(r,e){var t=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],p=r[8],h=e[0],m=e[1],f=e[2],d=e[3],g=e[4],x=e[5],_=e[6],b=e[7],v=e[8];return Math.abs(t-h)<=ae*Math.max(1,Math.abs(t),Math.abs(h))&&Math.abs(n-m)<=ae*Math.max(1,Math.abs(n),Math.abs(m))&&Math.abs(i-f)<=ae*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(o-d)<=ae*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(a-g)<=ae*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(s-x)<=ae*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(u-_)<=ae*Math.max(1,Math.abs(u),Math.abs(_))&&Math.abs(c-b)<=ae*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(p-v)<=ae*Math.max(1,Math.abs(p),Math.abs(v))}l(XA,"equals");var YA=Wv,KA=$v;var z={};Hn(z,{add:()=>FI,adjoint:()=>oI,clone:()=>QA,copy:()=>eI,create:()=>JA,determinant:()=>aI,equals:()=>VI,exactEquals:()=>OI,frob:()=>DI,fromQuat:()=>TI,fromQuat2:()=>_I,fromRotation:()=>dI,fromRotationTranslation:()=>Kv,fromRotationTranslationScale:()=>wI,fromRotationTranslationScaleOrigin:()=>PI,fromScaling:()=>fI,fromTranslation:()=>mI,fromValues:()=>tI,fromXRotation:()=>yI,fromYRotation:()=>gI,fromZRotation:()=>xI,frustum:()=>SI,getRotation:()=>vI,getScaling:()=>Jv,getTranslation:()=>bI,identity:()=>Xv,invert:()=>iI,lookAt:()=>LI,mul:()=>UI,multiply:()=>Yv,multiplyScalar:()=>zI,multiplyScalarAndAdd:()=>BI,ortho:()=>II,orthoNO:()=>e0,orthoZO:()=>EI,perspective:()=>MI,perspectiveFromFieldOfView:()=>AI,perspectiveNO:()=>Qv,perspectiveZO:()=>CI,rotate:()=>uI,rotateX:()=>cI,rotateY:()=>pI,rotateZ:()=>hI,scale:()=>lI,set:()=>rI,str:()=>RI,sub:()=>jI,subtract:()=>t0,targetTo:()=>kI,translate:()=>sI,transpose:()=>nI});y();function JA(){var r=new Te(16);return Te!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}l(JA,"create");function QA(r){var e=new Te(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}l(QA,"clone");function eI(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}l(eI,"copy");function tI(r,e,t,n,i,o,a,s,u,c,p,h,m,f,d,g){var x=new Te(16);return x[0]=r,x[1]=e,x[2]=t,x[3]=n,x[4]=i,x[5]=o,x[6]=a,x[7]=s,x[8]=u,x[9]=c,x[10]=p,x[11]=h,x[12]=m,x[13]=f,x[14]=d,x[15]=g,x}l(tI,"fromValues");function rI(r,e,t,n,i,o,a,s,u,c,p,h,m,f,d,g,x){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=o,r[5]=a,r[6]=s,r[7]=u,r[8]=c,r[9]=p,r[10]=h,r[11]=m,r[12]=f,r[13]=d,r[14]=g,r[15]=x,r}l(rI,"set");function Xv(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(Xv,"identity");function nI(r,e){if(r===e){var t=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=o,r[11]=e[14],r[12]=i,r[13]=a,r[14]=s}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r}l(nI,"transpose");function iI(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],p=e[8],h=e[9],m=e[10],f=e[11],d=e[12],g=e[13],x=e[14],_=e[15],b=t*s-n*a,v=t*u-i*a,w=t*c-o*a,T=n*u-i*s,S=n*c-o*s,A=i*c-o*u,M=p*g-h*d,I=p*x-m*d,L=p*_-f*d,D=h*x-m*g,F=h*_-f*g,U=m*_-f*x,C=b*U-v*F+w*D+T*L-S*I+A*M;return C?(C=1/C,r[0]=(s*U-u*F+c*D)*C,r[1]=(i*F-n*U-o*D)*C,r[2]=(g*A-x*S+_*T)*C,r[3]=(m*S-h*A-f*T)*C,r[4]=(u*L-a*U-c*I)*C,r[5]=(t*U-i*L+o*I)*C,r[6]=(x*w-d*A-_*v)*C,r[7]=(p*A-m*w+f*v)*C,r[8]=(a*F-s*L+c*M)*C,r[9]=(n*L-t*F-o*M)*C,r[10]=(d*S-g*w+_*b)*C,r[11]=(h*w-p*S-f*b)*C,r[12]=(s*I-a*D-u*M)*C,r[13]=(t*D-n*I+i*M)*C,r[14]=(g*v-d*T-x*b)*C,r[15]=(p*T-h*v+m*b)*C,r):null}l(iI,"invert");function oI(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],p=e[8],h=e[9],m=e[10],f=e[11],d=e[12],g=e[13],x=e[14],_=e[15];return r[0]=s*(m*_-f*x)-h*(u*_-c*x)+g*(u*f-c*m),r[1]=-(n*(m*_-f*x)-h*(i*_-o*x)+g*(i*f-o*m)),r[2]=n*(u*_-c*x)-s*(i*_-o*x)+g*(i*c-o*u),r[3]=-(n*(u*f-c*m)-s*(i*f-o*m)+h*(i*c-o*u)),r[4]=-(a*(m*_-f*x)-p*(u*_-c*x)+d*(u*f-c*m)),r[5]=t*(m*_-f*x)-p*(i*_-o*x)+d*(i*f-o*m),r[6]=-(t*(u*_-c*x)-a*(i*_-o*x)+d*(i*c-o*u)),r[7]=t*(u*f-c*m)-a*(i*f-o*m)+p*(i*c-o*u),r[8]=a*(h*_-f*g)-p*(s*_-c*g)+d*(s*f-c*h),r[9]=-(t*(h*_-f*g)-p*(n*_-o*g)+d*(n*f-o*h)),r[10]=t*(s*_-c*g)-a*(n*_-o*g)+d*(n*c-o*s),r[11]=-(t*(s*f-c*h)-a*(n*f-o*h)+p*(n*c-o*s)),r[12]=-(a*(h*x-m*g)-p*(s*x-u*g)+d*(s*m-u*h)),r[13]=t*(h*x-m*g)-p*(n*x-i*g)+d*(n*m-i*h),r[14]=-(t*(s*x-u*g)-a*(n*x-i*g)+d*(n*u-i*s)),r[15]=t*(s*m-u*h)-a*(n*m-i*h)+p*(n*u-i*s),r}l(oI,"adjoint");function aI(r){var e=r[0],t=r[1],n=r[2],i=r[3],o=r[4],a=r[5],s=r[6],u=r[7],c=r[8],p=r[9],h=r[10],m=r[11],f=r[12],d=r[13],g=r[14],x=r[15],_=e*a-t*o,b=e*s-n*o,v=e*u-i*o,w=t*s-n*a,T=t*u-i*a,S=n*u-i*s,A=c*d-p*f,M=c*g-h*f,I=c*x-m*f,L=p*g-h*d,D=p*x-m*d,F=h*x-m*g;return _*F-b*D+v*L+w*I-T*M+S*A}l(aI,"determinant");function Yv(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],p=e[7],h=e[8],m=e[9],f=e[10],d=e[11],g=e[12],x=e[13],_=e[14],b=e[15],v=t[0],w=t[1],T=t[2],S=t[3];return r[0]=v*n+w*s+T*h+S*g,r[1]=v*i+w*u+T*m+S*x,r[2]=v*o+w*c+T*f+S*_,r[3]=v*a+w*p+T*d+S*b,v=t[4],w=t[5],T=t[6],S=t[7],r[4]=v*n+w*s+T*h+S*g,r[5]=v*i+w*u+T*m+S*x,r[6]=v*o+w*c+T*f+S*_,r[7]=v*a+w*p+T*d+S*b,v=t[8],w=t[9],T=t[10],S=t[11],r[8]=v*n+w*s+T*h+S*g,r[9]=v*i+w*u+T*m+S*x,r[10]=v*o+w*c+T*f+S*_,r[11]=v*a+w*p+T*d+S*b,v=t[12],w=t[13],T=t[14],S=t[15],r[12]=v*n+w*s+T*h+S*g,r[13]=v*i+w*u+T*m+S*x,r[14]=v*o+w*c+T*f+S*_,r[15]=v*a+w*p+T*d+S*b,r}l(Yv,"multiply");function sI(r,e,t){var n=t[0],i=t[1],o=t[2],a,s,u,c,p,h,m,f,d,g,x,_;return e===r?(r[12]=e[0]*n+e[4]*i+e[8]*o+e[12],r[13]=e[1]*n+e[5]*i+e[9]*o+e[13],r[14]=e[2]*n+e[6]*i+e[10]*o+e[14],r[15]=e[3]*n+e[7]*i+e[11]*o+e[15]):(a=e[0],s=e[1],u=e[2],c=e[3],p=e[4],h=e[5],m=e[6],f=e[7],d=e[8],g=e[9],x=e[10],_=e[11],r[0]=a,r[1]=s,r[2]=u,r[3]=c,r[4]=p,r[5]=h,r[6]=m,r[7]=f,r[8]=d,r[9]=g,r[10]=x,r[11]=_,r[12]=a*n+p*i+d*o+e[12],r[13]=s*n+h*i+g*o+e[13],r[14]=u*n+m*i+x*o+e[14],r[15]=c*n+f*i+_*o+e[15]),r}l(sI,"translate");function lI(r,e,t){var n=t[0],i=t[1],o=t[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*i,r[5]=e[5]*i,r[6]=e[6]*i,r[7]=e[7]*i,r[8]=e[8]*o,r[9]=e[9]*o,r[10]=e[10]*o,r[11]=e[11]*o,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}l(lI,"scale");function uI(r,e,t,n){var i=n[0],o=n[1],a=n[2],s=Math.hypot(i,o,a),u,c,p,h,m,f,d,g,x,_,b,v,w,T,S,A,M,I,L,D,F,U,C,k;return s<ae?null:(s=1/s,i*=s,o*=s,a*=s,u=Math.sin(t),c=Math.cos(t),p=1-c,h=e[0],m=e[1],f=e[2],d=e[3],g=e[4],x=e[5],_=e[6],b=e[7],v=e[8],w=e[9],T=e[10],S=e[11],A=i*i*p+c,M=o*i*p+a*u,I=a*i*p-o*u,L=i*o*p-a*u,D=o*o*p+c,F=a*o*p+i*u,U=i*a*p+o*u,C=o*a*p-i*u,k=a*a*p+c,r[0]=h*A+g*M+v*I,r[1]=m*A+x*M+w*I,r[2]=f*A+_*M+T*I,r[3]=d*A+b*M+S*I,r[4]=h*L+g*D+v*F,r[5]=m*L+x*D+w*F,r[6]=f*L+_*D+T*F,r[7]=d*L+b*D+S*F,r[8]=h*U+g*C+v*k,r[9]=m*U+x*C+w*k,r[10]=f*U+_*C+T*k,r[11]=d*U+b*C+S*k,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}l(uI,"rotate");function cI(r,e,t){var n=Math.sin(t),i=Math.cos(t),o=e[4],a=e[5],s=e[6],u=e[7],c=e[8],p=e[9],h=e[10],m=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=o*i+c*n,r[5]=a*i+p*n,r[6]=s*i+h*n,r[7]=u*i+m*n,r[8]=c*i-o*n,r[9]=p*i-a*n,r[10]=h*i-s*n,r[11]=m*i-u*n,r}l(cI,"rotateX");function pI(r,e,t){var n=Math.sin(t),i=Math.cos(t),o=e[0],a=e[1],s=e[2],u=e[3],c=e[8],p=e[9],h=e[10],m=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=o*i-c*n,r[1]=a*i-p*n,r[2]=s*i-h*n,r[3]=u*i-m*n,r[8]=o*n+c*i,r[9]=a*n+p*i,r[10]=s*n+h*i,r[11]=u*n+m*i,r}l(pI,"rotateY");function hI(r,e,t){var n=Math.sin(t),i=Math.cos(t),o=e[0],a=e[1],s=e[2],u=e[3],c=e[4],p=e[5],h=e[6],m=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=o*i+c*n,r[1]=a*i+p*n,r[2]=s*i+h*n,r[3]=u*i+m*n,r[4]=c*i-o*n,r[5]=p*i-a*n,r[6]=h*i-s*n,r[7]=m*i-u*n,r}l(hI,"rotateZ");function mI(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}l(mI,"fromTranslation");function fI(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(fI,"fromScaling");function dI(r,e,t){var n=t[0],i=t[1],o=t[2],a=Math.hypot(n,i,o),s,u,c;return a<ae?null:(a=1/a,n*=a,i*=a,o*=a,s=Math.sin(e),u=Math.cos(e),c=1-u,r[0]=n*n*c+u,r[1]=i*n*c+o*s,r[2]=o*n*c-i*s,r[3]=0,r[4]=n*i*c-o*s,r[5]=i*i*c+u,r[6]=o*i*c+n*s,r[7]=0,r[8]=n*o*c+i*s,r[9]=i*o*c-n*s,r[10]=o*o*c+u,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}l(dI,"fromRotation");function yI(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=n,r[6]=t,r[7]=0,r[8]=0,r[9]=-t,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(yI,"fromXRotation");function gI(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=0,r[2]=-t,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=t,r[9]=0,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(gI,"fromYRotation");function xI(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=0,r[3]=0,r[4]=-t,r[5]=n,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(xI,"fromZRotation");function Kv(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,u=i+i,c=o+o,p=n*s,h=n*u,m=n*c,f=i*u,d=i*c,g=o*c,x=a*s,_=a*u,b=a*c;return r[0]=1-(f+g),r[1]=h+b,r[2]=m-_,r[3]=0,r[4]=h-b,r[5]=1-(p+g),r[6]=d+x,r[7]=0,r[8]=m+_,r[9]=d-x,r[10]=1-(p+f),r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}l(Kv,"fromRotationTranslation");function _I(r,e){var t=new Te(3),n=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],p=e[7],h=n*n+i*i+o*o+a*a;return h>0?(t[0]=(s*a+p*n+u*o-c*i)*2/h,t[1]=(u*a+p*i+c*n-s*o)*2/h,t[2]=(c*a+p*o+s*i-u*n)*2/h):(t[0]=(s*a+p*n+u*o-c*i)*2,t[1]=(u*a+p*i+c*n-s*o)*2,t[2]=(c*a+p*o+s*i-u*n)*2),Kv(r,e,t),r}l(_I,"fromQuat2");function bI(r,e){return r[0]=e[12],r[1]=e[13],r[2]=e[14],r}l(bI,"getTranslation");function Jv(r,e){var t=e[0],n=e[1],i=e[2],o=e[4],a=e[5],s=e[6],u=e[8],c=e[9],p=e[10];return r[0]=Math.hypot(t,n,i),r[1]=Math.hypot(o,a,s),r[2]=Math.hypot(u,c,p),r}l(Jv,"getScaling");function vI(r,e){var t=new Te(3);Jv(t,e);var n=1/t[0],i=1/t[1],o=1/t[2],a=e[0]*n,s=e[1]*i,u=e[2]*o,c=e[4]*n,p=e[5]*i,h=e[6]*o,m=e[8]*n,f=e[9]*i,d=e[10]*o,g=a+p+d,x=0;return g>0?(x=Math.sqrt(g+1)*2,r[3]=.25*x,r[0]=(h-f)/x,r[1]=(m-u)/x,r[2]=(s-c)/x):a>p&&a>d?(x=Math.sqrt(1+a-p-d)*2,r[3]=(h-f)/x,r[0]=.25*x,r[1]=(s+c)/x,r[2]=(m+u)/x):p>d?(x=Math.sqrt(1+p-a-d)*2,r[3]=(m-u)/x,r[0]=(s+c)/x,r[1]=.25*x,r[2]=(h+f)/x):(x=Math.sqrt(1+d-a-p)*2,r[3]=(s-c)/x,r[0]=(m+u)/x,r[1]=(h+f)/x,r[2]=.25*x),r}l(vI,"getRotation");function wI(r,e,t,n){var i=e[0],o=e[1],a=e[2],s=e[3],u=i+i,c=o+o,p=a+a,h=i*u,m=i*c,f=i*p,d=o*c,g=o*p,x=a*p,_=s*u,b=s*c,v=s*p,w=n[0],T=n[1],S=n[2];return r[0]=(1-(d+x))*w,r[1]=(m+v)*w,r[2]=(f-b)*w,r[3]=0,r[4]=(m-v)*T,r[5]=(1-(h+x))*T,r[6]=(g+_)*T,r[7]=0,r[8]=(f+b)*S,r[9]=(g-_)*S,r[10]=(1-(h+d))*S,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}l(wI,"fromRotationTranslationScale");function PI(r,e,t,n,i){var o=e[0],a=e[1],s=e[2],u=e[3],c=o+o,p=a+a,h=s+s,m=o*c,f=o*p,d=o*h,g=a*p,x=a*h,_=s*h,b=u*c,v=u*p,w=u*h,T=n[0],S=n[1],A=n[2],M=i[0],I=i[1],L=i[2],D=(1-(g+_))*T,F=(f+w)*T,U=(d-v)*T,C=(f-w)*S,k=(1-(m+_))*S,H=(x+b)*S,$=(d+v)*A,K=(x-b)*A,me=(1-(m+g))*A;return r[0]=D,r[1]=F,r[2]=U,r[3]=0,r[4]=C,r[5]=k,r[6]=H,r[7]=0,r[8]=$,r[9]=K,r[10]=me,r[11]=0,r[12]=t[0]+M-(D*M+C*I+$*L),r[13]=t[1]+I-(F*M+k*I+K*L),r[14]=t[2]+L-(U*M+H*I+me*L),r[15]=1,r}l(PI,"fromRotationTranslationScaleOrigin");function TI(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=t+t,s=n+n,u=i+i,c=t*a,p=n*a,h=n*s,m=i*a,f=i*s,d=i*u,g=o*a,x=o*s,_=o*u;return r[0]=1-h-d,r[1]=p+_,r[2]=m-x,r[3]=0,r[4]=p-_,r[5]=1-c-d,r[6]=f+g,r[7]=0,r[8]=m+x,r[9]=f-g,r[10]=1-c-h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(TI,"fromQuat");function SI(r,e,t,n,i,o,a){var s=1/(t-e),u=1/(i-n),c=1/(o-a);return r[0]=o*2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o*2*u,r[6]=0,r[7]=0,r[8]=(t+e)*s,r[9]=(i+n)*u,r[10]=(a+o)*c,r[11]=-1,r[12]=0,r[13]=0,r[14]=a*o*2*c,r[15]=0,r}l(SI,"frustum");function Qv(r,e,t,n,i){var o=1/Math.tan(e/2),a;return r[0]=o/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(a=1/(n-i),r[10]=(i+n)*a,r[14]=2*i*n*a):(r[10]=-1,r[14]=-2*n),r}l(Qv,"perspectiveNO");var MI=Qv;function CI(r,e,t,n,i){var o=1/Math.tan(e/2),a;return r[0]=o/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(a=1/(n-i),r[10]=i*a,r[14]=i*n*a):(r[10]=-1,r[14]=-n),r}l(CI,"perspectiveZO");function AI(r,e,t,n){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),u=2/(a+s),c=2/(i+o);return r[0]=u,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=c,r[6]=0,r[7]=0,r[8]=-((a-s)*u*.5),r[9]=(i-o)*c*.5,r[10]=n/(t-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*t/(t-n),r[15]=0,r}l(AI,"perspectiveFromFieldOfView");function e0(r,e,t,n,i,o,a){var s=1/(e-t),u=1/(n-i),c=1/(o-a);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*c,r[11]=0,r[12]=(e+t)*s,r[13]=(i+n)*u,r[14]=(a+o)*c,r[15]=1,r}l(e0,"orthoNO");var II=e0;function EI(r,e,t,n,i,o,a){var s=1/(e-t),u=1/(n-i),c=1/(o-a);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=c,r[11]=0,r[12]=(e+t)*s,r[13]=(i+n)*u,r[14]=o*c,r[15]=1,r}l(EI,"orthoZO");function LI(r,e,t,n){var i,o,a,s,u,c,p,h,m,f,d=e[0],g=e[1],x=e[2],_=n[0],b=n[1],v=n[2],w=t[0],T=t[1],S=t[2];return Math.abs(d-w)<ae&&Math.abs(g-T)<ae&&Math.abs(x-S)<ae?Xv(r):(p=d-w,h=g-T,m=x-S,f=1/Math.hypot(p,h,m),p*=f,h*=f,m*=f,i=b*m-v*h,o=v*p-_*m,a=_*h-b*p,f=Math.hypot(i,o,a),f?(f=1/f,i*=f,o*=f,a*=f):(i=0,o=0,a=0),s=h*a-m*o,u=m*i-p*a,c=p*o-h*i,f=Math.hypot(s,u,c),f?(f=1/f,s*=f,u*=f,c*=f):(s=0,u=0,c=0),r[0]=i,r[1]=s,r[2]=p,r[3]=0,r[4]=o,r[5]=u,r[6]=h,r[7]=0,r[8]=a,r[9]=c,r[10]=m,r[11]=0,r[12]=-(i*d+o*g+a*x),r[13]=-(s*d+u*g+c*x),r[14]=-(p*d+h*g+m*x),r[15]=1,r)}l(LI,"lookAt");function kI(r,e,t,n){var i=e[0],o=e[1],a=e[2],s=n[0],u=n[1],c=n[2],p=i-t[0],h=o-t[1],m=a-t[2],f=p*p+h*h+m*m;f>0&&(f=1/Math.sqrt(f),p*=f,h*=f,m*=f);var d=u*m-c*h,g=c*p-s*m,x=s*h-u*p;return f=d*d+g*g+x*x,f>0&&(f=1/Math.sqrt(f),d*=f,g*=f,x*=f),r[0]=d,r[1]=g,r[2]=x,r[3]=0,r[4]=h*x-m*g,r[5]=m*d-p*x,r[6]=p*g-h*d,r[7]=0,r[8]=p,r[9]=h,r[10]=m,r[11]=0,r[12]=i,r[13]=o,r[14]=a,r[15]=1,r}l(kI,"targetTo");function RI(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}l(RI,"str");function DI(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}l(DI,"frob");function FI(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r}l(FI,"add");function t0(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r}l(t0,"subtract");function zI(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r}l(zI,"multiplyScalar");function BI(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r[6]=e[6]+t[6]*n,r[7]=e[7]+t[7]*n,r[8]=e[8]+t[8]*n,r[9]=e[9]+t[9]*n,r[10]=e[10]+t[10]*n,r[11]=e[11]+t[11]*n,r[12]=e[12]+t[12]*n,r[13]=e[13]+t[13]*n,r[14]=e[14]+t[14]*n,r[15]=e[15]+t[15]*n,r}l(BI,"multiplyScalarAndAdd");function OI(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]}l(OI,"exactEquals");function VI(r,e){var t=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],p=r[8],h=r[9],m=r[10],f=r[11],d=r[12],g=r[13],x=r[14],_=r[15],b=e[0],v=e[1],w=e[2],T=e[3],S=e[4],A=e[5],M=e[6],I=e[7],L=e[8],D=e[9],F=e[10],U=e[11],C=e[12],k=e[13],H=e[14],$=e[15];return Math.abs(t-b)<=ae*Math.max(1,Math.abs(t),Math.abs(b))&&Math.abs(n-v)<=ae*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(i-w)<=ae*Math.max(1,Math.abs(i),Math.abs(w))&&Math.abs(o-T)<=ae*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(a-S)<=ae*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(s-A)<=ae*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(u-M)<=ae*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(c-I)<=ae*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(p-L)<=ae*Math.max(1,Math.abs(p),Math.abs(L))&&Math.abs(h-D)<=ae*Math.max(1,Math.abs(h),Math.abs(D))&&Math.abs(m-F)<=ae*Math.max(1,Math.abs(m),Math.abs(F))&&Math.abs(f-U)<=ae*Math.max(1,Math.abs(f),Math.abs(U))&&Math.abs(d-C)<=ae*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(g-k)<=ae*Math.max(1,Math.abs(g),Math.abs(k))&&Math.abs(x-H)<=ae*Math.max(1,Math.abs(x),Math.abs(H))&&Math.abs(_-$)<=ae*Math.max(1,Math.abs(_),Math.abs($))}l(VI,"equals");var UI=Yv,jI=t0;var sn={};Hn(sn,{add:()=>lL,calculateW:()=>KE,clone:()=>iL,conjugate:()=>tL,copy:()=>aL,create:()=>Um,dot:()=>v0,equals:()=>fL,exactEquals:()=>mL,exp:()=>g0,fromEuler:()=>rL,fromMat3:()=>_0,fromValues:()=>oL,getAngle:()=>WE,getAxisAngle:()=>HE,identity:()=>qE,invert:()=>eL,len:()=>pL,length:()=>w0,lerp:()=>cL,ln:()=>x0,mul:()=>uL,multiply:()=>y0,normalize:()=>jm,pow:()=>JE,random:()=>QE,rotateX:()=>$E,rotateY:()=>XE,rotateZ:()=>YE,rotationTo:()=>dL,scale:()=>b0,set:()=>sL,setAxes:()=>gL,setAxisAngle:()=>d0,slerp:()=>Bl,sqlerp:()=>yL,sqrLen:()=>hL,squaredLength:()=>P0,str:()=>nL});y();var V={};Hn(V,{add:()=>qI,angle:()=>pE,bezier:()=>nE,ceil:()=>HI,clone:()=>NI,copy:()=>GI,create:()=>kl,cross:()=>Zo,dist:()=>_E,distance:()=>a0,div:()=>xE,divide:()=>o0,dot:()=>Dl,equals:()=>dE,exactEquals:()=>fE,floor:()=>WI,forEach:()=>wE,fromValues:()=>Rl,hermite:()=>rE,inverse:()=>eE,len:()=>Am,length:()=>r0,lerp:()=>tE,max:()=>XI,min:()=>$I,mul:()=>gE,multiply:()=>i0,negate:()=>QI,normalize:()=>Cm,random:()=>iE,rotateX:()=>lE,rotateY:()=>uE,rotateZ:()=>cE,round:()=>YI,scale:()=>KI,scaleAndAdd:()=>JI,set:()=>ZI,sqrDist:()=>bE,sqrLen:()=>vE,squaredDistance:()=>s0,squaredLength:()=>l0,str:()=>mE,sub:()=>yE,subtract:()=>n0,transformMat3:()=>aE,transformMat4:()=>oE,transformQuat:()=>sE,zero:()=>hE});y();function kl(){var r=new Te(3);return Te!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}l(kl,"create");function NI(r){var e=new Te(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}l(NI,"clone");function r0(r){var e=r[0],t=r[1],n=r[2];return Math.hypot(e,t,n)}l(r0,"length");function Rl(r,e,t){var n=new Te(3);return n[0]=r,n[1]=e,n[2]=t,n}l(Rl,"fromValues");function GI(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}l(GI,"copy");function ZI(r,e,t,n){return r[0]=e,r[1]=t,r[2]=n,r}l(ZI,"set");function qI(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}l(qI,"add");function n0(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}l(n0,"subtract");function i0(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}l(i0,"multiply");function o0(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}l(o0,"divide");function HI(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}l(HI,"ceil");function WI(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}l(WI,"floor");function $I(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}l($I,"min");function XI(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}l(XI,"max");function YI(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r}l(YI,"round");function KI(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}l(KI,"scale");function JI(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r}l(JI,"scaleAndAdd");function a0(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return Math.hypot(t,n,i)}l(a0,"distance");function s0(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return t*t+n*n+i*i}l(s0,"squaredDistance");function l0(r){var e=r[0],t=r[1],n=r[2];return e*e+t*t+n*n}l(l0,"squaredLength");function QI(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}l(QI,"negate");function eE(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}l(eE,"inverse");function Cm(r,e){var t=e[0],n=e[1],i=e[2],o=t*t+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),r[0]=e[0]*o,r[1]=e[1]*o,r[2]=e[2]*o,r}l(Cm,"normalize");function Dl(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}l(Dl,"dot");function Zo(r,e,t){var n=e[0],i=e[1],o=e[2],a=t[0],s=t[1],u=t[2];return r[0]=i*u-o*s,r[1]=o*a-n*u,r[2]=n*s-i*a,r}l(Zo,"cross");function tE(r,e,t,n){var i=e[0],o=e[1],a=e[2];return r[0]=i+n*(t[0]-i),r[1]=o+n*(t[1]-o),r[2]=a+n*(t[2]-a),r}l(tE,"lerp");function rE(r,e,t,n,i,o){var a=o*o,s=a*(2*o-3)+1,u=a*(o-2)+o,c=a*(o-1),p=a*(3-2*o);return r[0]=e[0]*s+t[0]*u+n[0]*c+i[0]*p,r[1]=e[1]*s+t[1]*u+n[1]*c+i[1]*p,r[2]=e[2]*s+t[2]*u+n[2]*c+i[2]*p,r}l(rE,"hermite");function nE(r,e,t,n,i,o){var a=1-o,s=a*a,u=o*o,c=s*a,p=3*o*s,h=3*u*a,m=u*o;return r[0]=e[0]*c+t[0]*p+n[0]*h+i[0]*m,r[1]=e[1]*c+t[1]*p+n[1]*h+i[1]*m,r[2]=e[2]*c+t[2]*p+n[2]*h+i[2]*m,r}l(nE,"bezier");function iE(r,e){e=e||1;var t=Mt()*2*Math.PI,n=Mt()*2-1,i=Math.sqrt(1-n*n)*e;return r[0]=Math.cos(t)*i,r[1]=Math.sin(t)*i,r[2]=n*e,r}l(iE,"random");function oE(r,e,t){var n=e[0],i=e[1],o=e[2],a=t[3]*n+t[7]*i+t[11]*o+t[15];return a=a||1,r[0]=(t[0]*n+t[4]*i+t[8]*o+t[12])/a,r[1]=(t[1]*n+t[5]*i+t[9]*o+t[13])/a,r[2]=(t[2]*n+t[6]*i+t[10]*o+t[14])/a,r}l(oE,"transformMat4");function aE(r,e,t){var n=e[0],i=e[1],o=e[2];return r[0]=n*t[0]+i*t[3]+o*t[6],r[1]=n*t[1]+i*t[4]+o*t[7],r[2]=n*t[2]+i*t[5]+o*t[8],r}l(aE,"transformMat3");function sE(r,e,t){var n=t[0],i=t[1],o=t[2],a=t[3],s=e[0],u=e[1],c=e[2],p=i*c-o*u,h=o*s-n*c,m=n*u-i*s,f=i*m-o*h,d=o*p-n*m,g=n*h-i*p,x=a*2;return p*=x,h*=x,m*=x,f*=2,d*=2,g*=2,r[0]=s+p+f,r[1]=u+h+d,r[2]=c+m+g,r}l(sE,"transformQuat");function lE(r,e,t,n){var i=[],o=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}l(lE,"rotateX");function uE(r,e,t,n){var i=[],o=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}l(uE,"rotateY");function cE(r,e,t,n){var i=[],o=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}l(cE,"rotateZ");function pE(r,e){var t=r[0],n=r[1],i=r[2],o=e[0],a=e[1],s=e[2],u=Math.sqrt(t*t+n*n+i*i),c=Math.sqrt(o*o+a*a+s*s),p=u*c,h=p&&Dl(r,e)/p;return Math.acos(Math.min(Math.max(h,-1),1))}l(pE,"angle");function hE(r){return r[0]=0,r[1]=0,r[2]=0,r}l(hE,"zero");function mE(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}l(mE,"str");function fE(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}l(fE,"exactEquals");function dE(r,e){var t=r[0],n=r[1],i=r[2],o=e[0],a=e[1],s=e[2];return Math.abs(t-o)<=ae*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(n-a)<=ae*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-s)<=ae*Math.max(1,Math.abs(i),Math.abs(s))}l(dE,"equals");var yE=n0,gE=i0,xE=o0,_E=a0,bE=s0,Am=r0,vE=l0,wE=function(){var r=kl();return function(e,t,n,i,o,a){var s,u;for(t||(t=3),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],o(r,r,a),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2];return e}}();var Re={};Hn(Re,{add:()=>Rm,ceil:()=>PE,clone:()=>Im,copy:()=>Lm,create:()=>u0,cross:()=>LE,dist:()=>UE,distance:()=>m0,div:()=>VE,divide:()=>h0,dot:()=>zm,equals:()=>Vm,exactEquals:()=>Om,floor:()=>TE,forEach:()=>ZE,fromValues:()=>Em,inverse:()=>EE,len:()=>NE,length:()=>Fl,lerp:()=>Bm,max:()=>ME,min:()=>SE,mul:()=>OE,multiply:()=>p0,negate:()=>IE,normalize:()=>Fm,random:()=>kE,round:()=>CE,scale:()=>Dm,scaleAndAdd:()=>AE,set:()=>km,sqrDist:()=>jE,sqrLen:()=>GE,squaredDistance:()=>f0,squaredLength:()=>zl,str:()=>zE,sub:()=>BE,subtract:()=>c0,transformMat4:()=>RE,transformQuat:()=>DE,zero:()=>FE});y();function u0(){var r=new Te(4);return Te!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}l(u0,"create");function Im(r){var e=new Te(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}l(Im,"clone");function Em(r,e,t,n){var i=new Te(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}l(Em,"fromValues");function Lm(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}l(Lm,"copy");function km(r,e,t,n,i){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r}l(km,"set");function Rm(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}l(Rm,"add");function c0(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}l(c0,"subtract");function p0(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r[3]=e[3]*t[3],r}l(p0,"multiply");function h0(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r[3]=e[3]/t[3],r}l(h0,"divide");function PE(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r[3]=Math.ceil(e[3]),r}l(PE,"ceil");function TE(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r[3]=Math.floor(e[3]),r}l(TE,"floor");function SE(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r[3]=Math.min(e[3],t[3]),r}l(SE,"min");function ME(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r[3]=Math.max(e[3],t[3]),r}l(ME,"max");function CE(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r[3]=Math.round(e[3]),r}l(CE,"round");function Dm(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}l(Dm,"scale");function AE(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r}l(AE,"scaleAndAdd");function m0(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2],o=e[3]-r[3];return Math.hypot(t,n,i,o)}l(m0,"distance");function f0(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2],o=e[3]-r[3];return t*t+n*n+i*i+o*o}l(f0,"squaredDistance");function Fl(r){var e=r[0],t=r[1],n=r[2],i=r[3];return Math.hypot(e,t,n,i)}l(Fl,"length");function zl(r){var e=r[0],t=r[1],n=r[2],i=r[3];return e*e+t*t+n*n+i*i}l(zl,"squaredLength");function IE(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r}l(IE,"negate");function EE(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r[3]=1/e[3],r}l(EE,"inverse");function Fm(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=t*t+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),r[0]=t*a,r[1]=n*a,r[2]=i*a,r[3]=o*a,r}l(Fm,"normalize");function zm(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}l(zm,"dot");function LE(r,e,t,n){var i=t[0]*n[1]-t[1]*n[0],o=t[0]*n[2]-t[2]*n[0],a=t[0]*n[3]-t[3]*n[0],s=t[1]*n[2]-t[2]*n[1],u=t[1]*n[3]-t[3]*n[1],c=t[2]*n[3]-t[3]*n[2],p=e[0],h=e[1],m=e[2],f=e[3];return r[0]=h*c-m*u+f*s,r[1]=-(p*c)+m*a-f*o,r[2]=p*u-h*a+f*i,r[3]=-(p*s)+h*o-m*i,r}l(LE,"cross");function Bm(r,e,t,n){var i=e[0],o=e[1],a=e[2],s=e[3];return r[0]=i+n*(t[0]-i),r[1]=o+n*(t[1]-o),r[2]=a+n*(t[2]-a),r[3]=s+n*(t[3]-s),r}l(Bm,"lerp");function kE(r,e){e=e||1;var t,n,i,o,a,s;do t=Mt()*2-1,n=Mt()*2-1,a=t*t+n*n;while(a>=1);do i=Mt()*2-1,o=Mt()*2-1,s=i*i+o*o;while(s>=1);var u=Math.sqrt((1-a)/s);return r[0]=e*t,r[1]=e*n,r[2]=e*i*u,r[3]=e*o*u,r}l(kE,"random");function RE(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3];return r[0]=t[0]*n+t[4]*i+t[8]*o+t[12]*a,r[1]=t[1]*n+t[5]*i+t[9]*o+t[13]*a,r[2]=t[2]*n+t[6]*i+t[10]*o+t[14]*a,r[3]=t[3]*n+t[7]*i+t[11]*o+t[15]*a,r}l(RE,"transformMat4");function DE(r,e,t){var n=e[0],i=e[1],o=e[2],a=t[0],s=t[1],u=t[2],c=t[3],p=c*n+s*o-u*i,h=c*i+u*n-a*o,m=c*o+a*i-s*n,f=-a*n-s*i-u*o;return r[0]=p*c+f*-a+h*-u-m*-s,r[1]=h*c+f*-s+m*-a-p*-u,r[2]=m*c+f*-u+p*-s-h*-a,r[3]=e[3],r}l(DE,"transformQuat");function FE(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}l(FE,"zero");function zE(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}l(zE,"str");function Om(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}l(Om,"exactEquals");function Vm(r,e){var t=r[0],n=r[1],i=r[2],o=r[3],a=e[0],s=e[1],u=e[2],c=e[3];return Math.abs(t-a)<=ae*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(n-s)<=ae*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=ae*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(o-c)<=ae*Math.max(1,Math.abs(o),Math.abs(c))}l(Vm,"equals");var BE=c0,OE=p0,VE=h0,UE=m0,jE=f0,NE=Fl,GE=zl,ZE=function(){var r=u0();return function(e,t,n,i,o,a){var s,u;for(t||(t=4),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],r[3]=e[s+3],o(r,r,a),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2],e[s+3]=r[3];return e}}();function Um(){var r=new Te(4);return Te!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}l(Um,"create");function qE(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}l(qE,"identity");function d0(r,e,t){t=t*.5;var n=Math.sin(t);return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=Math.cos(t),r}l(d0,"setAxisAngle");function HE(r,e){var t=Math.acos(e[3])*2,n=Math.sin(t/2);return n>ae?(r[0]=e[0]/n,r[1]=e[1]/n,r[2]=e[2]/n):(r[0]=1,r[1]=0,r[2]=0),t}l(HE,"getAxisAngle");function WE(r,e){var t=v0(r,e);return Math.acos(2*t*t-1)}l(WE,"getAngle");function y0(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=t[0],u=t[1],c=t[2],p=t[3];return r[0]=n*p+a*s+i*c-o*u,r[1]=i*p+a*u+o*s-n*c,r[2]=o*p+a*c+n*u-i*s,r[3]=a*p-n*s-i*u-o*c,r}l(y0,"multiply");function $E(r,e,t){t*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u+a*s,r[1]=i*u+o*s,r[2]=o*u-i*s,r[3]=a*u-n*s,r}l($E,"rotateX");function XE(r,e,t){t*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u-o*s,r[1]=i*u+a*s,r[2]=o*u+n*s,r[3]=a*u-i*s,r}l(XE,"rotateY");function YE(r,e,t){t*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u+i*s,r[1]=i*u-n*s,r[2]=o*u+a*s,r[3]=a*u-o*s,r}l(YE,"rotateZ");function KE(r,e){var t=e[0],n=e[1],i=e[2];return r[0]=t,r[1]=n,r[2]=i,r[3]=Math.sqrt(Math.abs(1-t*t-n*n-i*i)),r}l(KE,"calculateW");function g0(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=Math.sqrt(t*t+n*n+i*i),s=Math.exp(o),u=a>0?s*Math.sin(a)/a:0;return r[0]=t*u,r[1]=n*u,r[2]=i*u,r[3]=s*Math.cos(a),r}l(g0,"exp");function x0(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=Math.sqrt(t*t+n*n+i*i),s=a>0?Math.atan2(a,o)/a:0;return r[0]=t*s,r[1]=n*s,r[2]=i*s,r[3]=.5*Math.log(t*t+n*n+i*i+o*o),r}l(x0,"ln");function JE(r,e,t){return x0(r,e),b0(r,r,t),g0(r,r),r}l(JE,"pow");function Bl(r,e,t,n){var i=e[0],o=e[1],a=e[2],s=e[3],u=t[0],c=t[1],p=t[2],h=t[3],m,f,d,g,x;return f=i*u+o*c+a*p+s*h,f<0&&(f=-f,u=-u,c=-c,p=-p,h=-h),1-f>ae?(m=Math.acos(f),d=Math.sin(m),g=Math.sin((1-n)*m)/d,x=Math.sin(n*m)/d):(g=1-n,x=n),r[0]=g*i+x*u,r[1]=g*o+x*c,r[2]=g*a+x*p,r[3]=g*s+x*h,r}l(Bl,"slerp");function QE(r){var e=Mt(),t=Mt(),n=Mt(),i=Math.sqrt(1-e),o=Math.sqrt(e);return r[0]=i*Math.sin(2*Math.PI*t),r[1]=i*Math.cos(2*Math.PI*t),r[2]=o*Math.sin(2*Math.PI*n),r[3]=o*Math.cos(2*Math.PI*n),r}l(QE,"random");function eL(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=t*t+n*n+i*i+o*o,s=a?1/a:0;return r[0]=-t*s,r[1]=-n*s,r[2]=-i*s,r[3]=o*s,r}l(eL,"invert");function tL(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r}l(tL,"conjugate");function _0(r,e){var t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),r[3]=.5*n,n=.5/n,r[0]=(e[5]-e[7])*n,r[1]=(e[6]-e[2])*n,r[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;n=Math.sqrt(e[i*3+i]-e[o*3+o]-e[a*3+a]+1),r[i]=.5*n,n=.5/n,r[3]=(e[o*3+a]-e[a*3+o])*n,r[o]=(e[o*3+i]+e[i*3+o])*n,r[a]=(e[a*3+i]+e[i*3+a])*n}return r}l(_0,"fromMat3");function rL(r,e,t,n){var i=.5*Math.PI/180;e*=i,t*=i,n*=i;var o=Math.sin(e),a=Math.cos(e),s=Math.sin(t),u=Math.cos(t),c=Math.sin(n),p=Math.cos(n);return r[0]=o*u*p-a*s*c,r[1]=a*s*p+o*u*c,r[2]=a*u*c-o*s*p,r[3]=a*u*p+o*s*c,r}l(rL,"fromEuler");function nL(r){return"quat("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}l(nL,"str");var iL=Im,oL=Em,aL=Lm,sL=km,lL=Rm,uL=y0,b0=Dm,v0=zm,cL=Bm,w0=Fl,pL=w0,P0=zl,hL=P0,jm=Fm,mL=Om,fL=Vm,dL=function(){var r=kl(),e=Rl(1,0,0),t=Rl(0,1,0);return function(n,i,o){var a=Dl(i,o);return a<-.999999?(Zo(r,e,i),Am(r)<1e-6&&Zo(r,t,i),Cm(r,r),d0(n,r,Math.PI),n):a>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Zo(r,i,o),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+a,jm(n,n))}}(),yL=function(){var r=Um(),e=Um();return function(t,n,i,o,a,s){return Bl(r,n,a,s),Bl(e,i,o,s),Bl(t,r,e,2*s*(1-s)),t}}(),gL=function(){var r=Mm();return function(e,t,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-t[0],r[5]=-t[1],r[8]=-t[2],jm(e,_0(e,r))}}();var lt={};Hn(lt,{add:()=>wL,angle:()=>NL,ceil:()=>PL,clone:()=>xL,copy:()=>bL,create:()=>T0,cross:()=>DL,dist:()=>KL,distance:()=>A0,div:()=>YL,divide:()=>C0,dot:()=>RL,equals:()=>HL,exactEquals:()=>qL,floor:()=>TL,forEach:()=>ek,fromValues:()=>_L,inverse:()=>LL,len:()=>WL,length:()=>E0,lerp:()=>FL,max:()=>ML,min:()=>SL,mul:()=>XL,multiply:()=>M0,negate:()=>EL,normalize:()=>kL,random:()=>zL,rotate:()=>jL,round:()=>CL,scale:()=>AL,scaleAndAdd:()=>IL,set:()=>vL,sqrDist:()=>JL,sqrLen:()=>QL,squaredDistance:()=>I0,squaredLength:()=>L0,str:()=>ZL,sub:()=>$L,subtract:()=>S0,transformMat2:()=>BL,transformMat2d:()=>OL,transformMat3:()=>VL,transformMat4:()=>UL,zero:()=>GL});y();function T0(){var r=new Te(2);return Te!=Float32Array&&(r[0]=0,r[1]=0),r}l(T0,"create");function xL(r){var e=new Te(2);return e[0]=r[0],e[1]=r[1],e}l(xL,"clone");function _L(r,e){var t=new Te(2);return t[0]=r,t[1]=e,t}l(_L,"fromValues");function bL(r,e){return r[0]=e[0],r[1]=e[1],r}l(bL,"copy");function vL(r,e,t){return r[0]=e,r[1]=t,r}l(vL,"set");function wL(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}l(wL,"add");function S0(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}l(S0,"subtract");function M0(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r}l(M0,"multiply");function C0(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r}l(C0,"divide");function PL(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r}l(PL,"ceil");function TL(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r}l(TL,"floor");function SL(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}l(SL,"min");function ML(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}l(ML,"max");function CL(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r}l(CL,"round");function AL(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}l(AL,"scale");function IL(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r}l(IL,"scaleAndAdd");function A0(r,e){var t=e[0]-r[0],n=e[1]-r[1];return Math.hypot(t,n)}l(A0,"distance");function I0(r,e){var t=e[0]-r[0],n=e[1]-r[1];return t*t+n*n}l(I0,"squaredDistance");function E0(r){var e=r[0],t=r[1];return Math.hypot(e,t)}l(E0,"length");function L0(r){var e=r[0],t=r[1];return e*e+t*t}l(L0,"squaredLength");function EL(r,e){return r[0]=-e[0],r[1]=-e[1],r}l(EL,"negate");function LL(r,e){return r[0]=1/e[0],r[1]=1/e[1],r}l(LL,"inverse");function kL(r,e){var t=e[0],n=e[1],i=t*t+n*n;return i>0&&(i=1/Math.sqrt(i)),r[0]=e[0]*i,r[1]=e[1]*i,r}l(kL,"normalize");function RL(r,e){return r[0]*e[0]+r[1]*e[1]}l(RL,"dot");function DL(r,e,t){var n=e[0]*t[1]-e[1]*t[0];return r[0]=r[1]=0,r[2]=n,r}l(DL,"cross");function FL(r,e,t,n){var i=e[0],o=e[1];return r[0]=i+n*(t[0]-i),r[1]=o+n*(t[1]-o),r}l(FL,"lerp");function zL(r,e){e=e||1;var t=Mt()*2*Math.PI;return r[0]=Math.cos(t)*e,r[1]=Math.sin(t)*e,r}l(zL,"random");function BL(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i,r[1]=t[1]*n+t[3]*i,r}l(BL,"transformMat2");function OL(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i+t[4],r[1]=t[1]*n+t[3]*i+t[5],r}l(OL,"transformMat2d");function VL(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[3]*i+t[6],r[1]=t[1]*n+t[4]*i+t[7],r}l(VL,"transformMat3");function UL(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[4]*i+t[12],r[1]=t[1]*n+t[5]*i+t[13],r}l(UL,"transformMat4");function jL(r,e,t,n){var i=e[0]-t[0],o=e[1]-t[1],a=Math.sin(n),s=Math.cos(n);return r[0]=i*s-o*a+t[0],r[1]=i*a+o*s+t[1],r}l(jL,"rotate");function NL(r,e){var t=r[0],n=r[1],i=e[0],o=e[1],a=Math.sqrt(t*t+n*n)*Math.sqrt(i*i+o*o),s=a&&(t*i+n*o)/a;return Math.acos(Math.min(Math.max(s,-1),1))}l(NL,"angle");function GL(r){return r[0]=0,r[1]=0,r}l(GL,"zero");function ZL(r){return"vec2("+r[0]+", "+r[1]+")"}l(ZL,"str");function qL(r,e){return r[0]===e[0]&&r[1]===e[1]}l(qL,"exactEquals");function HL(r,e){var t=r[0],n=r[1],i=e[0],o=e[1];return Math.abs(t-i)<=ae*Math.max(1,Math.abs(t),Math.abs(i))&&Math.abs(n-o)<=ae*Math.max(1,Math.abs(n),Math.abs(o))}l(HL,"equals");var WL=E0,$L=S0,XL=M0,YL=C0,KL=A0,JL=I0,QL=L0,ek=function(){var r=T0();return function(e,t,n,i,o,a){var s,u;for(t||(t=2),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],o(r,r,a),e[s]=r[0],e[s+1]=r[1];return e}}();y();y();function nt(r,e,t){return e*(8192/(r.tileSize*Math.pow(2,t-r.tileID.overscaledZ)))}l(nt,"pixelsToTileUnits");function Vi(){return new Float64Array(4)}l(Vi,"createVec4f64");function Ge(){return new Float64Array(3)}l(Ge,"createVec3f64");function pr(){return new Float64Array(16)}l(pr,"createMat4f64");function ln(){let r=new Float64Array(16);return z.identity(r),r}l(ln,"createIdentityMat4f64");function Ol(){let r=new Float32Array(16);return z.identity(r),r}l(Ol,"createIdentityMat4f32");function Ct(r,e,t,n,i=!1){if(!t[0]&&!t[1])return[0,0];let o=i?n==="map"?-r.bearingInRadians:0:n==="viewport"?r.bearingInRadians:0;if(o){let a=Math.sin(o),s=Math.cos(o);t=[t[0]*s-t[1]*a,t[0]*a+t[1]*s]}return[i?t[0]:nt(e,t[0],r.zoom),i?t[1]:nt(e,t[1],r.zoom)]}l(Ct,"translatePosition");function qo(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]}l(qo,"pointPlaneSignedDistance");function Vt(r,e,t){let n=Ur.determinant([r[0],r[1],r[2],e[0],e[1],e[2],t[0],t[1],t[2]]);if(n===0)return null;let i=V.cross([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),o=V.cross([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),a=V.cross([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),s=V.scale([],i,-r[3]);return V.add(s,s,V.scale([],o,-e[3])),V.add(s,s,V.scale([],a,-t[3])),V.scale(s,s,1/n),s}l(Vt,"threePlaneIntersection");function z0(r,e,t){let n=r[0]*t[0]+r[1]*t[1]+r[2]*t[2],i=e[0]*t[0]+e[1]*t[1]+e[2]*t[2];return i===0?null:(-n-t[3])/i}l(z0,"rayPlaneIntersection");function Ho(r,e,t,n){let i=Math.sqrt(r*r+e*e),o=Math.sqrt(t*t+n*n);r/=i,e/=i,t/=o,n/=o;let a=r*t+e*n,s=Math.acos(a);return-e*t+r*n>0?s:-s}l(Ho,"angleToRotateBetweenVectors2D");function vt(r,e){let t=Xn(r,360),n=Xn(e,360),i=n-t,o=n>t?i-360:i+360;return Math.abs(i)<Math.abs(o)?i:o}l(vt,"differenceOfAnglesDegrees");function Wo(r,e){let t=Xn(r,Math.PI*2),n=Xn(e,Math.PI*2);return Math.min(Math.abs(t-n),Math.abs(t-n+Math.PI*2),Math.abs(t-n-Math.PI*2))}l(Wo,"distanceOfAnglesRadians");function Xn(r,e){return(r%e+e)%e}l(Xn,"mod");function Ui(r,e,t,n,i){let o=se((r-e)/(t-e),0,1);return jr(n,i,o)}l(Ui,"remapSaturate");function jr(r,e,t){return r*(1-t)+e*t}l(jr,"lerp");function B0(r){let e=1/0,t=1/0,n=-1/0,i=-1/0;for(let o of r)e=Math.min(e,o.x),t=Math.min(t,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y);return[e,t,n,i]}l(B0,"getAABB");function Vl(r){if(r<=0)return 0;if(r>=1)return 1;let e=r*r,t=e*r;return 4*(r<.5?t:3*(r-e)+t-.75)}l(Vl,"easeCubicInOut");function $o(r,e,t,n){let i=new F0.default(r,e,t,n);return o=>i.solve(o)}l($o,"bezier");var Xo=$o(.25,.1,.25,1);function se(r,e,t){return Math.min(t,Math.max(e,r))}l(se,"clamp");function Qt(r,e,t){let n=t-e,i=((r-e)%n+n)%n+e;return i===e?t:i}l(Qt,"wrap");function O0(r,e){let t=[];for(let n in r)n in e||t.push(n);return t}l(O0,"keysDifference");function G(r,...e){for(let t of e)for(let n in t)r[n]=t[n];return r}l(G,"extend");function Sr(r,e){let t={};for(let n=0;n<e.length;n++){let i=e[n];i in r&&(t[i]=r[i])}return t}l(Sr,"pick");var tk=1;function Ul(){return tk++}l(Ul,"uniqueId");function V0(r){return Math.log(r)/Math.LN2%1===0}l(V0,"isPowerOfTwo");function U0(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}l(U0,"nextPowerOfTwo");function Ye(r){return Math.pow(2,r)}l(Ye,"zoomScale");function Ze(r){return Math.log(r)/Math.LN2}l(Ze,"scaleZoom");function Yo(r,e,t){let n={};for(let i in r)n[i]=e.call(t||this,r[i],i,r);return n}l(Yo,"mapObject");function jl(r,e,t){let n={};for(let i in r)e.call(t||this,r[i],i,r)&&(n[i]=r[i]);return n}l(jl,"filterObject");function Jt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Jt(r[t],e[t]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(let n in r)if(!Jt(r[n],e[n]))return!1;return!0}return r===e}l(Jt,"deepEqual");function yt(r){return Array.isArray(r)?r.map(yt):typeof r=="object"&&r?Yo(r,yt):r}l(yt,"clone");var k0={};function ce(r){k0[r]||(typeof console<"u"&&console.warn(r),k0[r]=!0)}l(ce,"warnOnce");function Nr(r,e,t){return(t.y-r.y)*(e.x-r.x)>(e.y-r.y)*(t.x-r.x)}l(Nr,"isCounterClockwise");function j0(r,e,t,n){let i=e.y-r.y,o=e.x-r.x,a=n.y-t.y,s=n.x-t.x,u=a*o-s*i;if(u===0)return null;let c=r.y-t.y,p=r.x-t.x,h=(s*c-a*p)/u;return new D0.default(r.x+h*o,r.y+h*i)}l(j0,"findLineIntersection");function N0([r,e,t]){return e+=90,e*=Math.PI/180,t*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(t),y:r*Math.sin(e)*Math.sin(t),z:r*Math.cos(t)}}l(N0,"sphericalToCartesian");function Gr(r){return typeof WorkerGlobalScope<"u"&&typeof r<"u"&&r instanceof WorkerGlobalScope}l(Gr,"isWorker");function G0(r){let e=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,t={};if(r.replace(e,(n,i,o,a)=>{let s=o||a;return t[i]=s?s.toLowerCase():!0,""}),t["max-age"]){let n=parseInt(t["max-age"],10);isNaN(n)?delete t["max-age"]:t["max-age"]=n}return t}l(G0,"parseCacheControl");var Nm=null;function Z0(r){if(Nm==null){let e=r.navigator?r.navigator.userAgent:null;Nm=!!r.safari||!!(e&&(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Nm}l(Z0,"isSafari");function At(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}l(At,"isImageBitmap");var q0=l(async r=>{if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));let e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error("Could not load image because of ".concat(t.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}},"arrayBufferToImageBitmap"),R0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",H0=l(r=>new Promise((e,t)=>{let n=new Image;n.onload=()=>{e(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>{n.src=R0})},n.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let i=new Blob([new Uint8Array(r)],{type:"image/png"});n.src=r.byteLength?URL.createObjectURL(i):R0}),"arrayBufferToImage");function rk(r,e,t,n,i){let o=Math.max(-e,0)*4,u=(Math.max(0,t)-t)*n*4+o,c=n*4,p=Math.max(0,e),h=Math.max(0,t),m=Math.min(r.width,e+n),f=Math.min(r.height,t+i);return{rect:{x:p,y:h,width:m-p,height:f-h},layout:[{offset:u,stride:c}]}}l(rk,"computeVideoFrameParameters");async function W0(r,e,t,n,i){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(r,{timestamp:0});try{let a=o==null?void 0:o.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error("Unrecognized format ".concat(a));let s=a.startsWith("BGR"),u=new Uint8ClampedArray(n*i*4);if(await o.copyTo(u,rk(r,e,t,n,i)),s)for(let c=0;c<u.length;c+=4){let p=u[c];u[c]=u[c+2],u[c+2]=p}return u}finally{o.close()}}l(W0,"readImageUsingVideoFrame");function Ko(r,e,t,n){return r.addEventListener(e,t,n),{unsubscribe:l(()=>{r.removeEventListener(e,t,n)},"unsubscribe")}}l(Ko,"subscribe");function Le(r){return r*Math.PI/180}l(Le,"degreesToRadians");function $n(r){return r/Math.PI*180}l($n,"radiansToDegrees");function Nl(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing}l(Nl,"rollPitchBearingEqual");function $0(r){let e=new Float64Array(9);Ur.fromQuat(e,r);let t=$n(-Math.asin(se(e[2],-1,1))),n,i;return Math.hypot(e[5],e[8])<.001?(n=0,i=-$n(Math.atan2(e[3],e[4]))):(n=$n(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),i=$n(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:n,pitch:t+90,bearing:i}}l($0,"getRollPitchBearing");function Gl(r,e,t){let n=lt.fromValues(e.x-t.x,e.y-t.y),i=lt.fromValues(r.x-t.x,r.y-t.y),o=n[0]*i[1]-n[1]*i[0],a=Math.atan2(o,lt.dot(n,i));return $n(a)}l(Gl,"getAngleDelta");function Gm(r,e,t){let n=new Float64Array(4);return sn.fromEuler(n,r,e-90,t),n}l(Gm,"rollPitchBearingToQuat");var Yn=25,Jo=0,wt=85.051129,X0={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Y0={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function K0(r,e){return X0[e]&&"touches"in r}l(K0,"isTouchableEvent");function J0(r,e){return Y0[e]&&(r instanceof MouseEvent||r instanceof WheelEvent)}l(J0,"isPointableEvent");function Q0(r){return X0[r]||Y0[r]}l(Q0,"isTouchableOrPointableType");y();y();var e1="AbortError";function t1(r){return r.message===e1}l(t1,"isAbortError");function Kn(){return new Error(e1)}l(Kn,"createAbortError");var nk=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),Zl,Zm,ne={now:nk,frame(r,e,t){let n=requestAnimationFrame(o=>{i(),e(o)}),{unsubscribe:i}=Ko(r.signal,"abort",()=>{i(),cancelAnimationFrame(n),t(Kn())},!1)},frameAsync(r){return new Promise((e,t)=>{this.frame(r,e,t)})},getImageData(r,e=0){return this.getImageCanvasContext(r).getImageData(-e,-e,r.width+2*e,r.height+2*e)},getImageCanvasContext(r){let e=window.document.createElement("canvas"),t=e.getContext("2d",{willReadFrequently:!0});if(!t)throw new Error("failed to create canvas 2d context");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0,r.width,r.height),t},resolveURL(r){return Zl||(Zl=document.createElement("a")),Zl.href=r,Zl.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Zm==null&&(Zm=matchMedia("(prefers-reduced-motion: reduce)")),Zm.matches):!1}};y();var r1=oe(ue(),1);var Ce=class Ce{static testProp(e){if(!Ce.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in Ce.docStyle)return e[t];return e[0]}static create(e,t,n){let i=window.document.createElement(e);return t!==void 0&&(i.className=t),n&&n.appendChild(i),i}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){Ce.docStyle&&Ce.selectProp&&(Ce.userSelect=Ce.docStyle[Ce.selectProp],Ce.docStyle[Ce.selectProp]="none")}static enableDrag(){Ce.docStyle&&Ce.selectProp&&(Ce.docStyle[Ce.selectProp]=Ce.userSelect)}static setTransform(e,t){e.style[Ce.transformProp]=t}static addEventListener(e,t,n,i={}){"passive"in i?e.addEventListener(t,n,i):e.addEventListener(t,n,i.capture)}static removeEventListener(e,t,n,i={}){"passive"in i?e.removeEventListener(t,n,i):e.removeEventListener(t,n,i.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",Ce.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Ce.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Ce.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,t,n){let i=t.boundingClientRect;return new r1.default((n.clientX-i.left)/t.x-e.clientLeft,(n.clientY-i.top)/t.y-e.clientTop)}static mousePos(e,t){let n=Ce.getScale(e);return Ce.getPoint(e,n,t)}static touchPos(e,t){let n=[],i=Ce.getScale(e);for(let o=0;o<t.length;o++)n.push(Ce.getPoint(e,i,t[o]));return n}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){let i=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),o=i.querySelectorAll("script");for(let a of o)a.remove();return Ce.clean(i),i.innerHTML}static isPossiblyDangerous(e,t){let n=t.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(e)&&(n.includes("javascript:")||n.includes("data:"))||e.startsWith("on"))return!0}static clean(e){let t=e.children;for(let n of t)Ce.removeAttributes(n),Ce.clean(n)}static removeAttributes(e){for(let{name:t,value:n}of e.attributes)Ce.isPossiblyDangerous(t,n)&&e.removeAttribute(t)}};l(Ce,"DOM"),Ce.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Ce.selectProp=Ce.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Ce.transformProp=Ce.testProp(["transform","WebkitTransform"]);var O=Ce;y();y();y();var ut={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ql(r){return ut.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}l(ql,"getProtocol");function ik(r,e){ut.REGISTERED_PROTOCOLS[r]=e}l(ik,"addProtocol");function ok(r){delete ut.REGISTERED_PROTOCOLS[r]}l(ok,"removeProtocol");y();var Hl="global-dispatcher",Hm=class Hm extends Error{constructor(e,t,n,i){super("AJAXError: ".concat(t," (").concat(e,"): ").concat(n)),this.status=e,this.statusText=t,this.url=n,this.body=i}};l(Hm,"AJAXError");var un=Hm,Wl=l(()=>Gr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,"getReferrer"),ak=l(r=>/^file:/.test(r)||/^file:/.test(Wl())&&!/^\w+:/.test(r),"isFileURL");async function sk(r,e){let t=new Request(r.url,{method:r.method||"GET",body:r.body,credentials:r.credentials,headers:r.headers,cache:r.cache,referrer:Wl(),signal:e.signal});r.type==="json"&&!t.headers.has("Accept")&&t.headers.set("Accept","application/json");let n;try{n=await fetch(t)}catch(a){throw new un(0,a.message,r.url,new Blob)}if(!n.ok){let a=await n.blob();throw new un(n.status,n.statusText,r.url,a)}let i;r.type==="arrayBuffer"||r.type==="image"?i=n.arrayBuffer():r.type==="json"?i=n.json():i=n.text();let o=await i;if(e.signal.aborted)throw Kn();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}l(sk,"makeFetchRequest");function lk(r,e){return new Promise((t,n)=>{var o;let i=new XMLHttpRequest;i.open(r.method||"GET",r.url,!0),(r.type==="arrayBuffer"||r.type==="image")&&(i.responseType="arraybuffer");for(let a in r.headers)i.setRequestHeader(a,r.headers[a]);r.type==="json"&&(i.responseType="text",(o=r.headers)!=null&&o.Accept||i.setRequestHeader("Accept","application/json")),i.withCredentials=r.credentials==="include",i.onerror=()=>{n(new Error(i.statusText))},i.onload=()=>{if(!e.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let a=i.response;if(r.type==="json")try{a=JSON.parse(i.response)}catch(s){n(s);return}t({data:a,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let a=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new un(i.status,i.statusText,r.url,a))}},e.signal.addEventListener("abort",()=>{i.abort(),n(Kn())}),i.send(r.body)})}l(lk,"makeXMLHttpRequest");var ji=l(function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){let t=ql(r.url);if(t)return t(r,e);if(Gr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Hl},e)}if(!ak(r.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return sk(r,e);if(Gr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Hl},e)}return lk(r,e)},"makeRequest"),cn=l((r,e)=>ji(G(r,{type:"json"}),e),"getJSON"),n1=l((r,e)=>ji(G(r,{type:"arrayBuffer"}),e),"getArrayBuffer");function qm(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;let e=new URL(r),t=window.location;return e.protocol===t.protocol&&e.host===t.host}l(qm,"sameOrigin");var i1=l(r=>{let e=window.document.createElement("video");return e.muted=!0,new Promise(t=>{e.onloadstart=()=>{t(e)};for(let n of r){let i=window.document.createElement("source");qm(n)||(e.crossOrigin="Anonymous"),i.src=n,e.appendChild(i)}})},"getVideo");y();y();var ea={supported:!1,testSupport:uk},Qo,Wm=!1,Ni,o1=!1;typeof document<"u"&&(Ni=document.createElement("img"),Ni.onload=()=>{Qo&&a1(Qo),Qo=null,o1=!0},Ni.onerror=()=>{Wm=!0,Qo=null},Ni.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function uk(r){Wm||!Ni||(o1?a1(r):Qo=r)}l(uk,"testSupport");function a1(r){let e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,Ni),r.isContextLost())return;ea.supported=!0}catch(t){}r.deleteTexture(e),Wm=!0}l(a1,"testWebpTextureUpload");var Pt;(f=>{let r,e,t,n;f.resetRequestQueue=l(()=>{r=[],e=0,t=0,n={}},"resetRequestQueue"),f.addThrottleControl=l(d=>{let g=t++;return n[g]=d,g},"addThrottleControl"),f.removeThrottleControl=l(d=>{delete n[d],h()},"removeThrottleControl");let s=l(()=>{for(let d of Object.keys(n))if(n[d]())return!0;return!1},"isThrottled");f.getImage=l((d,g,x=!0)=>new Promise((_,b)=>{ea.supported&&(d.headers||(d.headers={}),d.headers.accept="image/webp,*/*"),G(d,{type:"image"});let v={abortController:g,requestParameters:d,supportImageRefresh:x,state:"queued",onError:l(w=>{b(w)},"onError"),onSuccess:l(w=>{_(w)},"onSuccess")};r.push(v),h()}),"getImage");let c=l(d=>typeof createImageBitmap=="function"?q0(d):H0(d),"arrayBufferToCanvasImageSource"),p=l(async d=>{d.state="running";let{requestParameters:g,supportImageRefresh:x,onError:_,onSuccess:b,abortController:v}=d,w=x===!1&&!Gr(self)&&!ql(g.url)&&(!g.headers||Object.keys(g.headers).reduce((S,A)=>S&&A==="accept",!0));e++;let T=w?m(g,v):ji(g,v);try{let S=await T;if(delete d.abortController,d.state="completed",S.data instanceof HTMLImageElement||At(S.data))b(S);else if(S.data){let A=await c(S.data);b({data:A,cacheControl:S.cacheControl,expires:S.expires})}}catch(S){delete d.abortController,_(S)}finally{e--,h()}},"doImageRequest"),h=l(()=>{let d=s()?ut.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:ut.MAX_PARALLEL_IMAGE_REQUESTS;for(let g=e;g<d&&r.length>0;g++){let x=r.shift();if(x.abortController.signal.aborted){g--;continue}p(x)}},"processQueue"),m=l((d,g)=>new Promise((x,_)=>{let b=new Image,v=d.url,w=d.credentials;w&&w==="include"?b.crossOrigin="use-credentials":(w&&w==="same-origin"||!qm(v))&&(b.crossOrigin="anonymous"),g.signal.addEventListener("abort",()=>{b.src="",_(Kn())}),b.fetchPriority="high",b.onload=()=>{b.onerror=b.onload=null,x({data:b})},b.onerror=()=>{b.onerror=b.onload=null,!g.signal.aborted&&_(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},b.src=v}),"getImageUsingHtmlImage")})(Pt||(Pt={}));Pt.resetRequestQueue();y();var $m=class $m{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn?this._transformRequestFn(e,t)||{url:e}:{url:e}}setTransformRequest(e){this._transformRequestFn=e}};l($m,"RequestManager");var $l=$m;y();y();function s1(r,e,t){t[r]&&t[r].indexOf(e)!==-1||(t[r]=t[r]||[],t[r].push(e))}l(s1,"_addEventListener");function Xm(r,e,t){if(t&&t[r]){let n=t[r].indexOf(e);n!==-1&&t[r].splice(n,1)}}l(Xm,"_removeEventListener");var Ym=class Ym{constructor(e,t={}){G(this,t),this.type=e}};l(Ym,"Event");var B=Ym,Km=class Km extends B{constructor(e,t={}){super("error",G({error:e},t))}};l(Km,"ErrorEvent");var J=Km,Jm=class Jm{on(e,t){return this._listeners=this._listeners||{},s1(e,t,this._listeners),{unsubscribe:l(()=>{this.off(e,t)},"unsubscribe")}}off(e,t){return Xm(e,t,this._listeners),Xm(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},s1(e,t,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,t){typeof e=="string"&&(e=new B(e,t||{}));let n=e.type;if(this.listens(n)){e.target=this;let i=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let s of i)s.call(this,e);let o=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let s of o)Xm(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(G(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof J&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}};l(Jm,"Evented");var be=Jm;y();y();y();y();var ck=8,pk={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},hk={"*":{type:"source"}},mk=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],fk={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},dk={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},yk={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},gk={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},xk={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},_k={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},bk={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},vk=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],wk={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Pk={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Tk={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Sk={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Mk={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ck={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ak={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ik={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ek={type:"array",value:"*"},Lk={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},kk={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},Rk={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},Dk={type:"array",value:"*",minimum:1},Fk={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},zk={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},Bk={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},Ok={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},Vk=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],Uk={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},jk={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},Nk={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},Gk={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Zk={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},qk={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Hk={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},Wk={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},$k={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},Xk={"*":{type:"string"}},E={$version:ck,$root:pk,sources:hk,source:mk,source_vector:fk,source_raster:dk,source_raster_dem:yk,source_geojson:gk,source_video:xk,source_image:_k,layer:bk,layout:vk,layout_background:wk,layout_fill:Pk,layout_circle:Tk,layout_heatmap:Sk,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Mk,layout_symbol:Ck,layout_raster:Ak,layout_hillshade:Ik,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:Ek,filter_operator:Lk,geometry_type:kk,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:Rk,expression:Dk,light:Fk,sky:zk,terrain:Bk,projection:Ok,paint:Vk,paint_fill:Uk,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:jk,paint_circle:Nk,paint_heatmap:Gk,paint_symbol:Zk,paint_raster:qk,paint_hillshade:Hk,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:Wk,transition:$k,"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:Xk},Yk=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Kk(r,e){let t={};for(let n in r)n!=="ref"&&(t[n]=r[n]);return Yk.forEach(n=>{n in e&&(t[n]=e[n])}),t}l(Kk,"deref");function Mf(r){r=r.slice();let e=Object.create(null);for(let t=0;t<r.length;t++)e[r[t].id]=r[t];for(let t=0;t<r.length;t++)"ref"in r[t]&&(r[t]=Kk(r[t],e[r[t].ref]));return r}l(Mf,"derefLayers");function De(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!De(r[t],e[t]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(let n in r)if(!De(r[n],e[n]))return!1;return!0}return r===e}l(De,"deepEqual");function er(r,e){r.push(e)}l(er,"addCommand");function E1(r,e,t){er(t,{command:"addSource",args:[r,e[r]]})}l(E1,"addSource");function L1(r,e,t){er(e,{command:"removeSource",args:[r]}),t[r]=!0}l(L1,"removeSource");function Jk(r,e,t,n){L1(r,t,n),E1(r,e,t)}l(Jk,"updateSource");function Qk(r,e,t){let n;for(n in r[t])if(Object.prototype.hasOwnProperty.call(r[t],n)&&n!=="data"&&!De(r[t][n],e[t][n]))return!1;for(n in e[t])if(Object.prototype.hasOwnProperty.call(e[t],n)&&n!=="data"&&!De(r[t][n],e[t][n]))return!1;return!0}l(Qk,"canUpdateGeoJSON");function eR(r,e,t,n){r=r||{},e=e||{};let i;for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(Object.prototype.hasOwnProperty.call(e,i)||L1(i,t,n));for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(r,i)?De(r[i],e[i])||(r[i].type==="geojson"&&e[i].type==="geojson"&&Qk(r,e,i)?er(t,{command:"setGeoJSONSourceData",args:[i,e[i].data]}):Jk(i,e,t,n)):E1(i,e,t))}l(eR,"diffSources");function Xl(r,e,t,n,i,o){r=r||{},e=e||{};for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&(De(r[a],e[a])||t.push({command:o,args:[n,a,e[a],i]}));for(let a in e)!Object.prototype.hasOwnProperty.call(e,a)||Object.prototype.hasOwnProperty.call(r,a)||De(r[a],e[a])||t.push({command:o,args:[n,a,e[a],i]})}l(Xl,"diffLayerPropertyChanges");function l1(r){return r.id}l(l1,"pluckId");function u1(r,e){return r[e.id]=e,r}l(u1,"indexById");function tR(r,e,t){r=r||[],e=e||[];let n=r.map(l1),i=e.map(l1),o=r.reduce(u1,{}),a=e.reduce(u1,{}),s=n.slice(),u=Object.create(null),c,p,h,m,f;for(let d=0,g=0;d<n.length;d++)c=n[d],Object.prototype.hasOwnProperty.call(a,c)?g++:(er(t,{command:"removeLayer",args:[c]}),s.splice(s.indexOf(c,g),1));for(let d=0,g=0;d<i.length;d++)c=i[i.length-1-d],s[s.length-1-d]!==c&&(Object.prototype.hasOwnProperty.call(o,c)?(er(t,{command:"removeLayer",args:[c]}),s.splice(s.lastIndexOf(c,s.length-g),1)):g++,m=s[s.length-d],er(t,{command:"addLayer",args:[a[c],m]}),s.splice(s.length-d,0,c),u[c]=!0);for(let d=0;d<i.length;d++)if(c=i[d],p=o[c],h=a[c],!(u[c]||De(p,h))){if(!De(p.source,h.source)||!De(p["source-layer"],h["source-layer"])||!De(p.type,h.type)){er(t,{command:"removeLayer",args:[c]}),m=s[s.lastIndexOf(c)+1],er(t,{command:"addLayer",args:[h,m]});continue}Xl(p.layout,h.layout,t,c,null,"setLayoutProperty"),Xl(p.paint,h.paint,t,c,null,"setPaintProperty"),De(p.filter,h.filter)||er(t,{command:"setFilter",args:[c,h.filter]}),(!De(p.minzoom,h.minzoom)||!De(p.maxzoom,h.maxzoom))&&er(t,{command:"setLayerZoomRange",args:[c,h.minzoom,h.maxzoom]});for(f in p)Object.prototype.hasOwnProperty.call(p,f)&&(f==="layout"||f==="paint"||f==="filter"||f==="metadata"||f==="minzoom"||f==="maxzoom"||(f.indexOf("paint.")===0?Xl(p[f],h[f],t,c,f.slice(6),"setPaintProperty"):De(p[f],h[f])||er(t,{command:"setLayerProperty",args:[c,f,h[f]]})));for(f in h)!Object.prototype.hasOwnProperty.call(h,f)||Object.prototype.hasOwnProperty.call(p,f)||f==="layout"||f==="paint"||f==="filter"||f==="metadata"||f==="minzoom"||f==="maxzoom"||(f.indexOf("paint.")===0?Xl(p[f],h[f],t,c,f.slice(6),"setPaintProperty"):De(p[f],h[f])||er(t,{command:"setLayerProperty",args:[c,f,h[f]]}))}}l(tR,"diffLayers");function k1(r,e){if(!r)return[{command:"setStyle",args:[e]}];let t=[];try{if(!De(r.version,e.version))return[{command:"setStyle",args:[e]}];De(r.center,e.center)||t.push({command:"setCenter",args:[e.center]}),De(r.state,e.state)||t.push({command:"setGlobalState",args:[e.state]}),De(r.centerAltitude,e.centerAltitude)||t.push({command:"setCenterAltitude",args:[e.centerAltitude]}),De(r.zoom,e.zoom)||t.push({command:"setZoom",args:[e.zoom]}),De(r.bearing,e.bearing)||t.push({command:"setBearing",args:[e.bearing]}),De(r.pitch,e.pitch)||t.push({command:"setPitch",args:[e.pitch]}),De(r.roll,e.roll)||t.push({command:"setRoll",args:[e.roll]}),De(r.sprite,e.sprite)||t.push({command:"setSprite",args:[e.sprite]}),De(r.glyphs,e.glyphs)||t.push({command:"setGlyphs",args:[e.glyphs]}),De(r.transition,e.transition)||t.push({command:"setTransition",args:[e.transition]}),De(r.light,e.light)||t.push({command:"setLight",args:[e.light]}),De(r.terrain,e.terrain)||t.push({command:"setTerrain",args:[e.terrain]}),De(r.sky,e.sky)||t.push({command:"setSky",args:[e.sky]}),De(r.projection,e.projection)||t.push({command:"setProjection",args:[e.projection]});let n={},i=[];eR(r.sources,e.sources,i,n);let o=[];r.layers&&r.layers.forEach(a=>{"source"in a&&n[a.source]?t.push({command:"removeLayer",args:[a.id]}):o.push(a)}),t=t.concat(i),tR(o,e.layers,t)}catch(n){console.warn("Unable to compute style diff:",n),t=[{command:"setStyle",args:[e]}]}return t}l(k1,"diff");var Bf=class Bf{constructor(e,t,n,i){this.message=(e?"".concat(e,": "):"")+n,i&&(this.identifier=i),t!=null&&t.__line__&&(this.line=t.__line__)}};l(Bf,"ValidationError");var N=Bf;function Yi(r,...e){for(let t of e)for(let n in t)r[n]=t[n];return r}l(Yi,"extendBy");var Of=class Of extends Error{constructor(e,t){super(t),this.message=t,this.key=e}};l(Of,"ExpressionParsingError");var tr=Of,fu=class fu{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[n,i]of t)this.bindings[n]=i}concat(e){return new fu(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error("".concat(e," not found in scope."))}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}};l(fu,"Scope");var uf=fu,eo={kind:"null"},W={kind:"number"},ge={kind:"string"},fe={kind:"boolean"},nr={kind:"color"},Du={kind:"projectionDefinition"},oi={kind:"object"},pe={kind:"value"},rR={kind:"error"},Fu={kind:"collator"},to={kind:"formatted"},zu={kind:"padding"},la={kind:"colorArray"},Bu={kind:"numberArray"},wa={kind:"resolvedImage"},Ou={kind:"variableAnchorOffsetCollection"};function Ut(r,e){return{kind:"array",itemType:r,N:e}}l(Ut,"array");function qe(r){if(r.kind==="array"){let e=qe(r.itemType);return typeof r.N=="number"?"array<".concat(e,", ").concat(r.N,">"):r.itemType.kind==="value"?"array":"array<".concat(e,">")}else return r.kind}l(qe,"typeToString");var nR=[eo,W,ge,fe,nr,Du,to,oi,Ut(pe),zu,Bu,la,wa,Ou];function ua(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ua(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(let t of nR)if(!ua(t,e))return null}}return"Expected ".concat(qe(r)," but found ").concat(qe(e)," instead.")}l(ua,"checkSubtype");function Cf(r,e){return e.some(t=>t.kind===r.kind)}l(Cf,"isValidType");function ai(r,e){return e.some(t=>t==="null"?r===null:t==="array"?Array.isArray(r):t==="object"?r&&!Array.isArray(r)&&typeof r=="object":t===typeof r)}l(ai,"isValidNativeType");function pn(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}l(pn,"verifyType");var R1=.96422,D1=1,F1=.82521,z1=4/29,Xi=6/29,B1=3*Xi*Xi,iR=Xi*Xi*Xi,oR=Math.PI/180,aR=180/Math.PI;function O1(r){return r=r%360,r<0&&(r+=360),r}l(O1,"constrainAngle");function V1([r,e,t,n]){r=Qm(r),e=Qm(e),t=Qm(t);let i,o,a=ef((.2225045*r+.7168786*e+.0606169*t)/D1);r===e&&e===t?i=o=a:(i=ef((.4360747*r+.3850649*e+.1430804*t)/R1),o=ef((.0139322*r+.0971045*e+.7141733*t)/F1));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}l(V1,"rgbToLab");function Qm(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}l(Qm,"rgb2xyz");function ef(r){return r>iR?Math.pow(r,1/3):r/B1+z1}l(ef,"xyz2lab");function U1([r,e,t,n]){let i=(r+16)/116,o=isNaN(e)?i:i+e/500,a=isNaN(t)?i:i-t/200;return i=D1*rf(i),o=R1*rf(o),a=F1*rf(a),[tf(3.1338561*o-1.6168667*i-.4906146*a),tf(-.9787684*o+1.9161415*i+.033454*a),tf(.0719453*o-.2289914*i+1.4052427*a),n]}l(U1,"labToRgb");function tf(r){return r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055,r<0?0:r>1?1:r}l(tf,"xyz2rgb");function rf(r){return r>Xi?r*r*r:B1*(r-z1)}l(rf,"lab2xyz");function sR(r){let[e,t,n,i]=V1(r),o=Math.sqrt(t*t+n*n);return[Math.round(o*1e4)?O1(Math.atan2(n,t)*aR):NaN,o,e,i]}l(sR,"rgbToHcl");function lR([r,e,t,n]){return r=isNaN(r)?0:r*oR,U1([t,Math.cos(r)*e,Math.sin(r)*e,n])}l(lR,"hclToRgb");function uR([r,e,t,n]){r=O1(r),e/=100,t/=100;function i(o){let a=(o+r/30)%12,s=e*Math.min(t,1-t);return t-s*Math.max(-1,Math.min(a-3,9-a,1))}return l(i,"f"),[i(0),i(8),i(4),n]}l(uR,"hslToRgb");var cR=Object.hasOwn||l(function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},"hasOwnProperty");function ra(r,e){return cR(r,e)?r[e]:void 0}l(ra,"getOwn");function pR(r){if(r=r.toLowerCase().trim(),r==="transparent")return[0,0,0,0];let e=ra(hR,r);if(e){let[i,o,a]=e;return[i/255,o/255,a/255,1]}if(r.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(r)){let o=r.length<6?1:2,a=1;return[Yl(r.slice(a,a+=o)),Yl(r.slice(a,a+=o)),Yl(r.slice(a,a+=o)),Yl(r.slice(a,a+o)||"ff")]}if(r.startsWith("rgb")){let i=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,o=r.match(i);if(o){let[a,s,u,c,p,h,m,f,d,g,x,_]=o,b=[c||" ",m||" ",g].join("");if(b===" "||b===" /"||b===",,"||b===",,,"){let v=[u,h,d].join(""),w=v==="%%%"?100:v===""?255:0;if(w){let T=[Gi(+s/w,0,1),Gi(+p/w,0,1),Gi(+f/w,0,1),x?c1(+x,_):1];if(p1(T))return T}}return}}let t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,n=r.match(t);if(n){let[i,o,a,s,u,c,p,h,m]=n,f=[a||" ",u||" ",p].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){let d=[+o,Gi(+s,0,100),Gi(+c,0,100),h?c1(+h,m):1];if(p1(d))return uR(d)}}}l(pR,"parseCssColor");function Yl(r){return parseInt(r.padEnd(2,r),16)/255}l(Yl,"parseHex");function c1(r,e){return Gi(e?r/100:r,0,1)}l(c1,"parseAlpha");function Gi(r,e,t){return Math.min(Math.max(e,r),t)}l(Gi,"clamp");function p1(r){return!r.some(Number.isNaN)}l(p1,"validateNumbers");var hR={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function dn(r,e,t){return r+t*(e-r)}l(dn,"interpolateNumber");function Ki(r,e,t){return r.map((n,i)=>dn(n,e[i],t))}l(Ki,"interpolateArray");function mR(r){return r==="rgb"||r==="hcl"||r==="lab"}l(mR,"isSupportedInterpolationColorSpace");var hn=class hn{constructor(e,t,n,i=1,o=!0){this.r=e,this.g=t,this.b=n,this.a=i,o||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,t,n,i]))}static parse(e){if(e instanceof hn)return e;if(typeof e!="string")return;let t=pR(e);if(t)return new hn(...t,!1)}get rgb(){let{r:e,g:t,b:n,a:i}=this,o=i||1/0;return this.overwriteGetter("rgb",[e/o,t/o,n/o,i])}get hcl(){return this.overwriteGetter("hcl",sR(this.rgb))}get lab(){return this.overwriteGetter("lab",V1(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,n,i]=this.rgb;return"rgba(".concat([e,t,n].map(o=>Math.round(o*255)).join(","),",").concat(i,")")}static interpolate(e,t,n,i="rgb"){switch(i){case"rgb":{let[o,a,s,u]=Ki(e.rgb,t.rgb,n);return new hn(o,a,s,u,!1)}case"hcl":{let[o,a,s,u]=e.hcl,[c,p,h,m]=t.hcl,f,d;if(!isNaN(o)&&!isNaN(c)){let v=c-o;c>o&&v>180?v-=360:c<o&&o-c>180&&(v+=360),f=o+n*v}else isNaN(o)?isNaN(c)?f=NaN:(f=c,(s===1||s===0)&&(d=p)):(f=o,(h===1||h===0)&&(d=a));let[g,x,_,b]=lR([f,d!=null?d:dn(a,p,n),dn(s,h,n),dn(u,m,n)]);return new hn(g,x,_,b,!1)}case"lab":{let[o,a,s,u]=U1(Ki(e.lab,t.lab,n));return new hn(o,a,s,u,!1)}}}};l(hn,"Color");var Y=hn;Y.black=new Y(0,0,0,1);Y.white=new Y(1,1,1,1);Y.transparent=new Y(0,0,0,0);Y.red=new Y(1,0,0,1);var Vf=class Vf{constructor(e,t,n){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};l(Vf,"Collator");var ca=Vf,fR=["bottom","center","top"],Uf=class Uf{constructor(e,t,n,i,o,a){this.text=e,this.image=t,this.scale=n,this.fontStack=i,this.textColor=o,this.verticalAlign=a}};l(Uf,"FormattedSection");var pa=Uf,qi=class qi{constructor(e){this.sections=e}static fromString(e){return new qi([new pa(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof qi?e:qi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}};l(qi,"Formatted");var jt=qi,ei=class ei{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ei)return e;if(typeof e=="number")return new ei([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new ei(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new ei(Ki(e.values,t.values,n))}};l(ei,"Padding");var ir=ei,ti=class ti{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ti)return e;if(typeof e=="number")return new ti([e]);if(Array.isArray(e)){for(let t of e)if(typeof t!="number")return;return new ti(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new ti(Ki(e.values,t.values,n))}};l(ti,"NumberArray");var or=ti,ri=class ri{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ri)return e;if(typeof e=="string"){let n=Y.parse(e);return n?new ri([n]):void 0}if(!Array.isArray(e))return;let t=[];for(let n of e){if(typeof n!="string")return;let i=Y.parse(n);if(!i)return;t.push(i)}return new ri(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,i="rgb"){let o=[];if(e.values.length!=t.values.length)throw new Error("colorArray: Arrays have mismatched length (".concat(e.values.length," vs. ").concat(t.values.length,"), cannot interpolate."));for(let a=0;a<e.values.length;a++)o.push(Y.interpolate(e.values[a],t.values[a],n,i));return new ri(o)}};l(ri,"ColorArray");var It=ri,jf=class jf extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}};l(jf,"RuntimeError");var Ue=jf,dR=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Hi=class Hi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Hi)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){let n=e[t],i=e[t+1];if(typeof n!="string"||!dR.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new Hi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){let i=e.values,o=t.values;if(i.length!==o.length)throw new Ue("Cannot interpolate values of different length. from: ".concat(e.toString(),", to: ").concat(t.toString()));let a=[];for(let s=0;s<i.length;s+=2){if(i[s]!==o[s])throw new Ue("Cannot interpolate values containing mismatched anchors. from[".concat(s,"]: ").concat(i[s],", to[").concat(s,"]: ").concat(o[s]));a.push(i[s]);let[u,c]=i[s+1],[p,h]=o[s+1];a.push([dn(u,p,n),dn(c,h,n)])}return new Hi(a)}};l(Hi,"VariableAnchorOffsetCollection");var Cr=Hi,du=class du{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new du({name:e,available:!1}):null}};l(du,"ResolvedImage");var Et=du,mn=class mn{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new mn(e,t,n)}static parse(e){if(e instanceof mn)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new mn(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new mn(e.from,e.to,e.transition);if(typeof e=="string")return new mn(e,e,1)}};l(mn,"ProjectionDefinition");var Ar=mn;function j1(r,e,t,n){if(!(typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255)){let i=typeof n=="number"?[r,e,t,n]:[r,e,t];return"Invalid rgba value [".concat(i.join(", "),"]: 'r', 'g', and 'b' must be between 0 and 255.")}return typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:"Invalid rgba value [".concat([r,e,t,n].join(", "),"]: 'a' must be between 0 and 1.")}l(j1,"validateRGBA");function ha(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Ar||r instanceof Y||r instanceof ca||r instanceof jt||r instanceof ir||r instanceof or||r instanceof It||r instanceof Cr||r instanceof Et)return!0;if(Array.isArray(r)){for(let e of r)if(!ha(e))return!1;return!0}else if(typeof r=="object"){for(let e in r)if(!ha(r[e]))return!1;return!0}else return!1}l(ha,"isValue");function Je(r){if(r===null)return eo;if(typeof r=="string")return ge;if(typeof r=="boolean")return fe;if(typeof r=="number")return W;if(r instanceof Y)return nr;if(r instanceof Ar)return Du;if(r instanceof ca)return Fu;if(r instanceof jt)return to;if(r instanceof ir)return zu;if(r instanceof or)return Bu;if(r instanceof It)return la;if(r instanceof Cr)return Ou;if(r instanceof Et)return wa;if(Array.isArray(r)){let e=r.length,t;for(let n of r){let i=Je(n);if(!t)t=i;else{if(t===i)continue;t=pe;break}}return Ut(t||pe,e)}else return oi}l(Je,"typeOf");function na(r){let e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof Y||r instanceof Ar||r instanceof jt||r instanceof ir||r instanceof or||r instanceof It||r instanceof Cr||r instanceof Et?r.toString():JSON.stringify(r)}l(na,"valueToString");var yu=class yu{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error("'literal' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(!ha(e[1]))return t.error("invalid value");let n=e[1],i=Je(n),o=t.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new yu(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};l(yu,"Literal");var yn=yu,Kl={string:ge,number:W,boolean:fe,object:oi},gu=class gu{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=1,i,o=e[0];if(o==="array"){let s;if(e.length>2){let c=e[1];if(typeof c!="string"||!(c in Kl)||c==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);s=Kl[c],n++}else s=pe;let u;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);u=e[2],n++}i=Ut(s,u)}else{if(!Kl[o])throw new Error("Types doesn't contain name = ".concat(o));i=Kl[o]}let a=[];for(;n<e.length;n++){let s=t.parse(e[n],n,pe);if(!s)return null;a.push(s)}return new gu(i,a)}evaluate(e){for(let t=0;t<this.args.length;t++){let n=this.args[t].evaluate(e);if(ua(this.type,Je(n))){if(t===this.args.length-1)throw new Ue("Expected value to be of type ".concat(qe(this.type),", but found ").concat(qe(Je(n))," instead."))}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};l(gu,"Assertion");var hr=gu,h1={"to-boolean":fe,"to-color":nr,"to-number":W,"to-string":ge},xu=class xu{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=e[0];if(!h1[n])throw new Error("Can't parse ".concat(n," as it is not part of the known types"));if((n==="to-boolean"||n==="to-string")&&e.length!==2)return t.error("Expected one argument.");let i=h1[n],o=[];for(let a=1;a<e.length;a++){let s=t.parse(e[a],a,pe);if(!s)return null;o.push(s)}return new xu(i,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,n;for(let i of this.args){if(t=i.evaluate(e),n=null,t instanceof Y)return t;if(typeof t=="string"){let o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?n="Invalid rgba value ".concat(JSON.stringify(t),": expected an array containing either three or four numeric values."):n=j1(t[0],t[1],t[2],t[3]),!n))return new Y(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Ue(n||"Could not parse color from value '".concat(typeof t=="string"?t:JSON.stringify(t),"'"))}case"padding":{let t;for(let n of this.args){t=n.evaluate(e);let i=ir.parse(t);if(i)return i}throw new Ue("Could not parse padding from value '".concat(typeof t=="string"?t:JSON.stringify(t),"'"))}case"numberArray":{let t;for(let n of this.args){t=n.evaluate(e);let i=or.parse(t);if(i)return i}throw new Ue("Could not parse numberArray from value '".concat(typeof t=="string"?t:JSON.stringify(t),"'"))}case"colorArray":{let t;for(let n of this.args){t=n.evaluate(e);let i=It.parse(t);if(i)return i}throw new Ue("Could not parse colorArray from value '".concat(typeof t=="string"?t:JSON.stringify(t),"'"))}case"variableAnchorOffsetCollection":{let t;for(let n of this.args){t=n.evaluate(e);let i=Cr.parse(t);if(i)return i}throw new Ue("Could not parse variableAnchorOffsetCollection from value '".concat(typeof t=="string"?t:JSON.stringify(t),"'"))}case"number":{let t=null;for(let n of this.args){if(t=n.evaluate(e),t===null)return 0;let i=Number(t);if(!isNaN(i))return i}throw new Ue("Could not convert ".concat(JSON.stringify(t)," to number."))}case"formatted":return jt.fromString(na(this.args[0].evaluate(e)));case"resolvedImage":return Et.fromString(na(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return na(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};l(xu,"Coercion");var fn=xu,yR=["Unknown","Point","LineString","Polygon"],Nf=class Nf{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?yR[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=Y.parse(e),this._parseColorCache.set(e,t)),t}};l(Nf,"EvaluationContext");var tu=Nf,_u=class _u{constructor(e,t,n=[],i,o=new uf,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>"[".concat(s,"]")).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=t}parse(e,t,n,i,o={}){return t?this.concat(t,n,i)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,o,a){return a==="assert"?new hr(o,[i]):a==="coerce"?new fn(o,[i]):i}if(l(n,"annotate"),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let i=e[0];if(typeof i!="string")return this.error("Expression name must be a string, but found ".concat(typeof i,' instead. If you wanted a literal array, use ["literal", [...]].'),0),null;let o=this.registry[i];if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,u=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&u.kind==="value")a=n(a,s,t.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(u.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(u.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(u.kind)||s.kind==="colorArray"&&["value","string","array"].includes(u.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(u.kind))a=n(a,s,t.typeAnnotation||"coerce");else if(this.checkSubtype(s,u))return null}if(!(a instanceof yn)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new tu;try{a=new yn(a.type,a.evaluate(s))}catch(u){return this.error(u.message),null}}return a}return this.error('Unknown expression "'.concat(i,'". If you wanted a literal array, use ["literal", [...]].'),0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found ".concat(typeof e," instead."))}concat(e,t,n){let i=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new _u(this.registry,this._isConstant,i,t||null,o,this.errors)}error(e,...t){let n="".concat(this.key).concat(t.map(i=>"[".concat(i,"]")).join(""));this.errors.push(new tr(n,e))}checkSubtype(e,t){let n=ua(e,t);return n&&this.error(n),n}};l(_u,"ParsingContext");var ru=_u,bu=class bu{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found ".concat(e.length-1," instead."));let n=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return t.error("Expected string, but found ".concat(typeof a," instead."),o);if(/[^a-zA-Z0-9_]/.test(a))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);let s=t.parse(e[o+1],o+1);if(!s)return null;n.push([a,s])}let i=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return i?new bu(n,i):null}outputDefined(){return this.result.outputDefined()}};l(bu,"Let");var nu=bu,vu=class vu{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");let n=e[1];return t.scope.has(n)?new vu(n,t.scope.get(n)):t.error('Unknown variable "'.concat(n,'". Make sure "').concat(n,'" has been bound in an enclosing "let" expression before using it.'),1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}};l(vu,"Var");var iu=vu,wu=class wu{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let n=t.parse(e[1],1,W),i=t.parse(e[2],2,Ut(t.expectedType||pe));if(!n||!i)return null;let o=i.type;return new wu(o.itemType,n,i)}evaluate(e){let t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new Ue("Array index out of bounds: ".concat(t," < 0."));if(t>=n.length)throw new Ue("Array index out of bounds: ".concat(t," > ").concat(n.length-1,"."));if(t!==Math.floor(t))throw new Ue("Array index must be an integer, but found ".concat(t," instead."));return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}};l(wu,"At");var cf=wu,Pu=class Pu{constructor(e,t){this.type=fe,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let n=t.parse(e[1],1,pe),i=t.parse(e[2],2,pe);return!n||!i?null:Cf(n.type,[fe,ge,W,eo,pe])?new Pu(n,i):t.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(qe(n.type)," instead"))}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!ai(t,["boolean","string","number","null"]))throw new Ue("Expected first argument to be of type boolean, string, number or null, but found ".concat(qe(Je(t))," instead."));if(!ai(n,["string","array"]))throw new Ue("Expected second argument to be of type array or string, but found ".concat(qe(Je(n))," instead."));return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}};l(Pu,"In");var pf=Pu,ia=class ia{constructor(e,t,n){this.type=W,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let n=t.parse(e[1],1,pe),i=t.parse(e[2],2,pe);if(!n||!i)return null;if(!Cf(n.type,[fe,ge,W,eo,pe]))return t.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(qe(n.type)," instead"));if(e.length===4){let o=t.parse(e[3],3,W);return o?new ia(n,i,o):null}else return new ia(n,i)}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!ai(t,["boolean","string","number","null"]))throw new Ue("Expected first argument to be of type boolean, string, number or null, but found ".concat(qe(Je(t))," instead."));let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),ai(n,["string"])){let o=n.indexOf(t,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(ai(n,["array"]))return n.indexOf(t,i);throw new Ue("Expected second argument to be of type array or string, but found ".concat(qe(Je(n))," instead."))}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}};l(ia,"IndexOf");var hf=ia,Tu=class Tu{constructor(e,t,n,i,o,a){this.inputType=e,this.type=t,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==1)return t.error("Expected an even number of arguments.");let n,i;t.expectedType&&t.expectedType.kind!=="value"&&(i=t.expectedType);let o={},a=[];for(let c=2;c<e.length-1;c+=2){let p=e[c],h=e[c+1];Array.isArray(p)||(p=[p]);let m=t.concat(c);if(p.length===0)return m.error("Expected at least one branch label.");for(let d of p){if(typeof d!="number"&&typeof d!="string")return m.error("Branch labels must be numbers or strings.");if(typeof d=="number"&&Math.abs(d)>Number.MAX_SAFE_INTEGER)return m.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof d=="number"&&Math.floor(d)!==d)return m.error("Numeric branch labels must be integer values.");if(!n)n=Je(d);else if(m.checkSubtype(n,Je(d)))return null;if(typeof o[String(d)]<"u")return m.error("Branch labels must be unique.");o[String(d)]=a.length}let f=t.parse(h,c,i);if(!f)return null;i=i||f.type,a.push(f)}let s=t.parse(e[1],1,pe);if(!s)return null;let u=t.parse(e[e.length-1],e.length-1,i);return!u||s.type.kind!=="value"&&t.concat(1).checkSubtype(n,s.type)?null:new Tu(n,i,s,o,a,u)}evaluate(e){let t=this.input.evaluate(e);return(Je(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}};l(Tu,"Match");var mf=Tu,Su=class Su{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);let i=[];for(let a=1;a<e.length-1;a+=2){let s=t.parse(e[a],a,fe);if(!s)return null;let u=t.parse(e[a+1],a+1,n);if(!u)return null;i.push([s,u]),n=n||u.type}let o=t.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can't infer output type");return new Su(n,i,o)}evaluate(e){for(let[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}};l(Su,"Case");var ff=Su,oa=class oa{constructor(e,t,n,i){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let n=t.parse(e[1],1,pe),i=t.parse(e[2],2,W);if(!n||!i)return null;if(!Cf(n.type,[Ut(pe),ge,pe]))return t.error("Expected first argument to be of type array or string, but found ".concat(qe(n.type)," instead"));if(e.length===4){let o=t.parse(e[3],3,W);return o?new oa(n.type,n,i,o):null}else return new oa(n.type,n,i)}evaluate(e){let t=this.input.evaluate(e),n=this.beginIndex.evaluate(e),i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),ai(t,["string"]))return[...t].slice(n,i).join("");if(ai(t,["array"]))return t.slice(n,i);throw new Ue("Expected first argument to be of type array or string, but found ".concat(qe(Je(t))," instead."))}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};l(oa,"Slice");var df=oa;function Vu(r,e){let t=r.length-1,n=0,i=t,o=0,a,s;for(;n<=i;)if(o=Math.floor((n+i)/2),a=r[o],s=r[o+1],a<=e){if(o===t||e<s)return o;n=o+1}else if(a>e)i=o-1;else throw new Ue("Input is not a number.");return 0}l(Vu,"findStopLessThanOrEqualTo");var Mu=class Mu{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(e,t){if(e.length-1<4)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");let n=t.parse(e[1],1,W);if(!n)return null;let i=[],o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.expectedType);for(let a=1;a<e.length;a+=2){let s=a===1?-1/0:e[a],u=e[a+1],c=a,p=a+1;if(typeof s!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(i.length&&i[i.length-1][0]>=s)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);let h=t.parse(u,p,o);if(!h)return null;o=o||h.type,i.push([s,h])}return new Mu(o,n,i)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=t[0])return n[0].evaluate(e);let o=t.length;if(i>=t[o-1])return n[o-1].evaluate(e);let a=Vu(t,i);return n[a].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};l(Mu,"Step");var Ji=Mu;function gR(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}l(gR,"getDefaultExportFromCjs");var nf,m1;function xR(){if(m1)return nf;m1=1,nf=r;function r(e,t,n,i){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=i}return l(r,"UnitBezier"),r.prototype={sampleCurveX:l(function(e){return((this.ax*e+this.bx)*e+this.cx)*e},"sampleCurveX"),sampleCurveY:l(function(e){return((this.ay*e+this.by)*e+this.cy)*e},"sampleCurveY"),sampleCurveDerivativeX:l(function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},"sampleCurveDerivativeX"),solveCurveX:l(function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,i=0;i<8;i++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<t)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n=n-o/a}var s=0,u=1;for(n=e,i=0;i<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<t));i++)e>o?s=n:u=n,n=(u-s)*.5+s;return n},"solveCurveX"),solve:l(function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))},"solve")},nf}l(xR,"requireUnitbezier");var _R=xR(),bR=gR(_R),aa=class aa{constructor(e,t,n,i,o){this.type=e,this.operator=t,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(e,t,n,i){let o=0;if(e.name==="exponential")o=of(t,e.base,n,i);else if(e.name==="linear")o=of(t,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new bR(a[0],a[1],a[2],a[3]).solve(of(t,1,n,i))}return o}static parse(e,t){let[n,i,o,...a]=e;if(!Array.isArray(i)||i.length===0)return t.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let c=i[1];if(typeof c!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:c}}else if(i[0]==="cubic-bezier"){let c=i.slice(1);if(c.length!==4||c.some(p=>typeof p!="number"||p<0||p>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:c}}else return t.error("Unknown interpolation type ".concat(String(i[0])),1,0);if(e.length-1<4)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,W),!o)return null;let s=[],u=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&t.expectedType!=la?u=nr:t.expectedType&&t.expectedType.kind!=="value"&&(u=t.expectedType);for(let c=0;c<a.length;c+=2){let p=a[c],h=a[c+1],m=c+3,f=c+4;if(typeof p!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',m);if(s.length&&s[s.length-1][0]>=p)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',m);let d=t.parse(h,f,u);if(!d)return null;u=u||d.type,s.push([p,d])}return!pn(u,W)&&!pn(u,Du)&&!pn(u,nr)&&!pn(u,zu)&&!pn(u,Bu)&&!pn(u,la)&&!pn(u,Ou)&&!pn(u,Ut(W))?t.error("Type ".concat(qe(u)," is not interpolatable.")):new aa(u,n,i,o,s)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=t[0])return n[0].evaluate(e);let o=t.length;if(i>=t[o-1])return n[o-1].evaluate(e);let a=Vu(t,i),s=t[a],u=t[a+1],c=aa.interpolationFactor(this.interpolation,i,s,u),p=n[a].evaluate(e),h=n[a+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return dn(p,h,c);case"color":return Y.interpolate(p,h,c);case"padding":return ir.interpolate(p,h,c);case"colorArray":return It.interpolate(p,h,c);case"numberArray":return or.interpolate(p,h,c);case"variableAnchorOffsetCollection":return Cr.interpolate(p,h,c);case"array":return Ki(p,h,c);case"projectionDefinition":return Ar.interpolate(p,h,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return Y.interpolate(p,h,c,"hcl");case"colorArray":return It.interpolate(p,h,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Y.interpolate(p,h,c,"lab");case"colorArray":return It.interpolate(p,h,c,"lab")}}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};l(aa,"Interpolate");var Tt=aa;function of(r,e,t,n){let i=n-t,o=r-t;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}l(of,"exponentialInterpolation");var Ae={color:Y.interpolate,number:dn,padding:ir.interpolate,numberArray:or.interpolate,colorArray:It.interpolate,variableAnchorOffsetCollection:Cr.interpolate,array:Ki},sa=class sa{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=null,i=t.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of e.slice(1)){let u=t.parse(s,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!u)return null;n=n||u.type,o.push(u)}if(!n)throw new Error("No output type");return i&&o.some(s=>ua(i,s.type))?new sa(pe,o):new sa(n,o)}evaluate(e){let t=null,n=0,i;for(let o of this.args)if(n++,t=o.evaluate(e),t&&t instanceof Et&&!t.available&&(i||(i=t.name),t=null,n===this.args.length&&(t=i)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};l(sa,"Coalesce");var ou=sa;function f1(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}l(f1,"isComparableType");function vR(r,e,t){return e===t}l(vR,"eq");function wR(r,e,t){return e!==t}l(wR,"neq");function PR(r,e,t){return e<t}l(PR,"lt");function TR(r,e,t){return e>t}l(TR,"gt");function SR(r,e,t){return e<=t}l(SR,"lteq");function MR(r,e,t){return e>=t}l(MR,"gteq");function N1(r,e,t,n){return n.compare(e,t)===0}l(N1,"eqCollate");function CR(r,e,t,n){return!N1(r,e,t,n)}l(CR,"neqCollate");function AR(r,e,t,n){return n.compare(e,t)<0}l(AR,"ltCollate");function IR(r,e,t,n){return n.compare(e,t)>0}l(IR,"gtCollate");function ER(r,e,t,n){return n.compare(e,t)<=0}l(ER,"lteqCollate");function LR(r,e,t,n){return n.compare(e,t)>=0}l(LR,"gteqCollate");function ro(r,e,t){var i;let n=r!=="=="&&r!=="!=";return i=class{constructor(a,s,u){this.type=fe,this.lhs=a,this.rhs=s,this.collator=u,this.hasUntypedArgument=a.type.kind==="value"||s.type.kind==="value"}static parse(a,s){if(a.length!==3&&a.length!==4)return s.error("Expected two or three arguments.");let u=a[0],c=s.parse(a[1],1,pe);if(!c)return null;if(!f1(u,c.type))return s.concat(1).error('"'.concat(u,"\" comparisons are not supported for type '").concat(qe(c.type),"'."));let p=s.parse(a[2],2,pe);if(!p)return null;if(!f1(u,p.type))return s.concat(2).error('"'.concat(u,"\" comparisons are not supported for type '").concat(qe(p.type),"'."));if(c.type.kind!==p.type.kind&&c.type.kind!=="value"&&p.type.kind!=="value")return s.error("Cannot compare types '".concat(qe(c.type),"' and '").concat(qe(p.type),"'."));n&&(c.type.kind==="value"&&p.type.kind!=="value"?c=new hr(p.type,[c]):c.type.kind!=="value"&&p.type.kind==="value"&&(p=new hr(c.type,[p])));let h=null;if(a.length===4){if(c.type.kind!=="string"&&p.type.kind!=="string"&&c.type.kind!=="value"&&p.type.kind!=="value")return s.error("Cannot use collator to compare non-string types.");if(h=s.parse(a[3],3,Fu),!h)return null}return new i(c,p,h)}evaluate(a){let s=this.lhs.evaluate(a),u=this.rhs.evaluate(a);if(n&&this.hasUntypedArgument){let c=Je(s),p=Je(u);if(c.kind!==p.kind||!(c.kind==="string"||c.kind==="number"))throw new Ue('Expected arguments for "'.concat(r,'" to be (string, string) or (number, number), but found (').concat(c.kind,", ").concat(p.kind,") instead."))}if(this.collator&&!n&&this.hasUntypedArgument){let c=Je(s),p=Je(u);if(c.kind!=="string"||p.kind!=="string")return e(a,s,u)}return this.collator?t(a,s,u,this.collator.evaluate(a)):e(a,s,u)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}},l(i,"Comparison"),i}l(ro,"makeComparison");var kR=ro("==",vR,N1),RR=ro("!=",wR,CR),DR=ro("<",PR,AR),FR=ro(">",TR,IR),zR=ro("<=",SR,ER),BR=ro(">=",MR,LR),Cu=class Cu{constructor(e,t,n){this.type=Fu,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");let n=e[1];if(typeof n!="object"||Array.isArray(n))return t.error("Collator options argument must be an object.");let i=t.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,fe);if(!i)return null;let o=t.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,fe);if(!o)return null;let a=null;return n.locale&&(a=t.parse(n.locale,1,ge),!a)?null:new Cu(i,o,a)}evaluate(e){return new ca(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}};l(Cu,"CollatorExpression");var au=Cu,Au=class Au{constructor(e,t,n,i,o){this.type=ge,this.number=e,this.locale=t,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");let n=t.parse(e[1],1,W);if(!n)return null;let i=e[2];if(typeof i!="object"||Array.isArray(i))return t.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=t.parse(i.locale,1,ge),!o))return null;let a=null;if(i.currency&&(a=t.parse(i.currency,1,ge),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=t.parse(i["min-fraction-digits"],1,W),!s))return null;let u=null;return i["max-fraction-digits"]&&(u=t.parse(i["max-fraction-digits"],1,W),!u)?null:new Au(n,o,a,s,u)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}};l(Au,"NumberFormat");var yf=Au,Iu=class Iu{constructor(e){this.type=to,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=e[1];if(!Array.isArray(n)&&typeof n=="object")return t.error("First argument must be an image or text section.");let i=[],o=!1;for(let a=1;a<=e.length-1;++a){let s=e[a];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let u=null;if(s["font-scale"]&&(u=t.parse(s["font-scale"],1,W),!u))return null;let c=null;if(s["text-font"]&&(c=t.parse(s["text-font"],1,Ut(ge)),!c))return null;let p=null;if(s["text-color"]&&(p=t.parse(s["text-color"],1,nr),!p))return null;let h=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!fR.includes(s["vertical-align"]))return t.error("'vertical-align' must be one of: 'bottom', 'center', 'top' but found '".concat(s["vertical-align"],"' instead."));if(h=t.parse(s["vertical-align"],1,ge),!h)return null}let m=i[i.length-1];m.scale=u,m.font=c,m.textColor=p,m.verticalAlign=h}else{let u=t.parse(e[a],1,pe);if(!u)return null;let c=u.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,i.push({content:u,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Iu(i)}evaluate(e){let t=l(n=>{let i=n.content.evaluate(e);return Je(i)===wa?new pa("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new pa(na(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)},"evaluateSection");return new jt(this.sections.map(t))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}};l(Iu,"FormatExpression");var ma=Iu,Eu=class Eu{constructor(e){this.type=wa,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");let n=t.parse(e[1],1,ge);return n?new Eu(n):t.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),n=Et.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}};l(Eu,"ImageExpression");var gf=Eu,Lu=class Lu{constructor(e){this.type=W,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected 1 argument, but found ".concat(e.length-1," instead."));let n=t.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?t.error("Expected argument of type string or array, but found ".concat(qe(n.type)," instead.")):new Lu(n):null}evaluate(e){let t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new Ue("Expected value to be of type string or array, but found ".concat(qe(Je(t))," instead."))}eachChild(e){e(this.input)}outputDefined(){return!1}};l(Lu,"Length");var xf=Lu,Mr=8192;function OR(r,e){let t=VR(r[0]),n=jR(r[1]),i=Math.pow(2,e.z);return[Math.round(t*i*Mr),Math.round(n*i*Mr)]}l(OR,"getTileCoordinates");function Af(r,e){let t=Math.pow(2,e.z),n=(r[0]/Mr+e.x)/t,i=(r[1]/Mr+e.y)/t;return[UR(n),NR(i)]}l(Af,"getLngLatFromTileCoord");function VR(r){return(180+r)/360}l(VR,"mercatorXfromLng");function UR(r){return r*360-180}l(UR,"lngFromMercatorXfromLng");function jR(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}l(jR,"mercatorYfromLat");function NR(r){return 360/Math.PI*Math.atan(Math.exp((180-r*360)*Math.PI/180))-90}l(NR,"latFromMercatorY");function Pa(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}l(Pa,"updateBBox");function fa(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}l(fa,"boxWithinBox");function GR(r,e,t){return e[1]>r[1]!=t[1]>r[1]&&r[0]<(t[0]-e[0])*(r[1]-e[1])/(t[1]-e[1])+e[0]}l(GR,"rayIntersect");function ZR(r,e,t){let n=r[0]-e[0],i=r[1]-e[1],o=r[0]-t[0],a=r[1]-t[1];return n*a-o*i===0&&n*o<=0&&i*a<=0}l(ZR,"pointOnBoundary");function Uu(r,e,t,n){let i=[e[0]-r[0],e[1]-r[1]],o=[n[0]-t[0],n[1]-t[1]];return $R(o,i)===0?!1:!!(d1(r,e,t,n)&&d1(t,n,r,e))}l(Uu,"segmentIntersectSegment");function qR(r,e,t){for(let n of t)for(let i=0;i<n.length-1;++i)if(Uu(r,e,n[i],n[i+1]))return!0;return!1}l(qR,"lineIntersectPolygon");function no(r,e,t=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(ZR(r,i[o],i[o+1]))return t;GR(r,i[o],i[o+1])&&(n=!n)}return n}l(no,"pointWithinPolygon");function HR(r,e){for(let t of e)if(no(r,t))return!0;return!1}l(HR,"pointWithinPolygons");function G1(r,e){for(let t of r)if(!no(t,e))return!1;for(let t=0;t<r.length-1;++t)if(qR(r[t],r[t+1],e))return!1;return!0}l(G1,"lineStringWithinPolygon");function WR(r,e){for(let t of e)if(G1(r,t))return!0;return!1}l(WR,"lineStringWithinPolygons");function $R(r,e){return r[0]*e[1]-r[1]*e[0]}l($R,"perp");function d1(r,e,t,n){let i=r[0]-t[0],o=r[1]-t[1],a=e[0]-t[0],s=e[1]-t[1],u=n[0]-t[0],c=n[1]-t[1],p=i*c-u*o,h=a*c-u*s;return p>0&&h<0||p<0&&h>0}l(d1,"twoSided");function If(r,e,t){let n=[];for(let i=0;i<r.length;i++){let o=[];for(let a=0;a<r[i].length;a++){let s=OR(r[i][a],t);Pa(e,s),o.push(s)}n.push(o)}return n}l(If,"getTilePolygon");function Z1(r,e,t){let n=[];for(let i=0;i<r.length;i++){let o=If(r[i],e,t);n.push(o)}return n}l(Z1,"getTilePolygons");function q1(r,e,t,n){if(r[0]<t[0]||r[0]>t[2]){let i=n*.5,o=r[0]-t[0]>i?-n:t[0]-r[0]>i?n:0;o===0&&(o=r[0]-t[2]>i?-n:t[2]-r[0]>i?n:0),r[0]+=o}Pa(e,r)}l(q1,"updatePoint");function XR(r){r[0]=r[1]=1/0,r[2]=r[3]=-1/0}l(XR,"resetBBox");function y1(r,e,t,n){let i=Math.pow(2,n.z)*Mr,o=[n.x*Mr,n.y*Mr],a=[];for(let s of r)for(let u of s){let c=[u.x+o[0],u.y+o[1]];q1(c,e,t,i),a.push(c)}return a}l(y1,"getTilePoints");function g1(r,e,t,n){let i=Math.pow(2,n.z)*Mr,o=[n.x*Mr,n.y*Mr],a=[];for(let s of r){let u=[];for(let c of s){let p=[c.x+o[0],c.y+o[1]];Pa(e,p),u.push(p)}a.push(u)}if(e[2]-e[0]<=i/2){XR(e);for(let s of a)for(let u of s)q1(u,e,t,i)}return a}l(g1,"getTileLines");function YR(r,e){let t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=r.canonicalID();if(e.type==="Polygon"){let o=If(e.coordinates,n,i),a=y1(r.geometry(),t,n,i);if(!fa(t,n))return!1;for(let s of a)if(!no(s,o))return!1}if(e.type==="MultiPolygon"){let o=Z1(e.coordinates,n,i),a=y1(r.geometry(),t,n,i);if(!fa(t,n))return!1;for(let s of a)if(!HR(s,o))return!1}return!0}l(YR,"pointsWithinPolygons");function KR(r,e){let t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=r.canonicalID();if(e.type==="Polygon"){let o=If(e.coordinates,n,i),a=g1(r.geometry(),t,n,i);if(!fa(t,n))return!1;for(let s of a)if(!G1(s,o))return!1}if(e.type==="MultiPolygon"){let o=Z1(e.coordinates,n,i),a=g1(r.geometry(),t,n,i);if(!fa(t,n))return!1;for(let s of a)if(!WR(s,o))return!1}return!0}l(KR,"linesWithinPolygons");var Wi=class Wi{constructor(e,t){this.type=fe,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error("'within' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(ha(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let i=[];for(let o of n.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&i.push(s),a==="MultiPolygon"&&i.push(...s)}if(i.length){let o={type:"MultiPolygon",coordinates:i};return new Wi(n,o)}}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new Wi(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Wi(n,n)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return YR(e,this.geometries);if(e.geometryType()==="LineString")return KR(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}};l(Wi,"Within");var da=Wi,Gf=class Gf{constructor(e=[],t=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,i=t[e];for(;e>0;){let o=e-1>>1,a=t[o];if(n(i,a)>=0)break;t[e]=a,e=o}t[e]=i}_down(e){let{data:t,compare:n}=this,i=this.length>>1,o=t[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(t[s],t[a])<0&&(a=s),n(t[a],o)>=0)break;t[e]=t[a],e=a}t[e]=o}};l(Gf,"TinyQueue");var su=Gf;function H1(r,e,t=0,n=r.length-1,i=JR){for(;n>t;){if(n-t>600){let u=n-t+1,c=e-t+1,p=Math.log(u),h=.5*Math.exp(2*p/3),m=.5*Math.sqrt(p*h*(u-h)/u)*(c-u/2<0?-1:1),f=Math.max(t,Math.floor(e-c*h/u+m)),d=Math.min(n,Math.floor(e+(u-c)*h/u+m));H1(r,e,f,d,i)}let o=r[e],a=t,s=n;for(ta(r,t,e),i(r[n],o)>0&&ta(r,t,n);a<s;){for(ta(r,a,s),a++,s--;i(r[a],o)<0;)a++;for(;i(r[s],o)>0;)s--}i(r[t],o)===0?ta(r,t,s):(s++,ta(r,s,n)),s<=e&&(t=s+1),e<=s&&(n=s-1)}}l(H1,"quickselect");function ta(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}l(ta,"swap");function JR(r,e){return r<e?-1:r>e?1:0}l(JR,"defaultCompare");function Ta(r,e){if(r.length<=1)return[r];let n=[],i,o;for(let a of r){let s=eD(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[a]):i.push(a))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(H1(n[a],e,1,n[a].length-1,QR),n[a]=n[a].slice(0,e));return n}l(Ta,"classifyRings");function QR(r,e){return e.area-r.area}l(QR,"compareAreas");function eD(r){let e=0;for(let t=0,n=r.length,i=n-1,o,a;t<n;i=t++)o=r[t],a=r[i],e+=(a.x-o.x)*(o.y+a.y);return e}l(eD,"calculateSignedArea");var tD=6378.137,x1=1/298.257223563,_1=x1*(2-x1),b1=Math.PI/180,Zf=class Zf{constructor(e){let t=b1*tD*1e3,n=Math.cos(e*b1),i=1/(1-_1*(1-n*n)),o=Math.sqrt(i);this.kx=t*o*n,this.ky=t*o*i*(1-_1)}distance(e,t){let n=this.wrap(e[0]-t[0])*this.kx,i=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+i*i)}pointOnLine(e,t){let n=1/0,i,o,a,s;for(let u=0;u<e.length-1;u++){let c=e[u][0],p=e[u][1],h=this.wrap(e[u+1][0]-c)*this.kx,m=(e[u+1][1]-p)*this.ky,f=0;(h!==0||m!==0)&&(f=(this.wrap(t[0]-c)*this.kx*h+(t[1]-p)*this.ky*m)/(h*h+m*m),f>1?(c=e[u+1][0],p=e[u+1][1]):f>0&&(c+=h/this.kx*f,p+=m/this.ky*f)),h=this.wrap(t[0]-c)*this.kx,m=(t[1]-p)*this.ky;let d=h*h+m*m;d<n&&(n=d,i=c,o=p,a=u,s=f)}return{point:[i,o],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}};l(Zf,"CheapRuler");var ya=Zf,_f=100,bf=50;function W1(r,e){return e[0]-r[0]}l(W1,"compareDistPair");function lu(r){return r[1]-r[0]+1}l(lu,"getRangeSize");function Zr(r,e){return r[1]>=r[0]&&r[1]<e}l(Zr,"isRangeSafe");function vf(r,e){if(r[0]>r[1])return[null,null];let t=lu(r);if(e){if(t===2)return[r,null];let i=Math.floor(t/2);return[[r[0],r[0]+i],[r[0]+i,r[1]]]}if(t===1)return[r,null];let n=Math.floor(t/2)-1;return[[r[0],r[0]+n],[r[0]+n+1,r[1]]]}l(vf,"splitRange");function wf(r,e){if(!Zr(e,r.length))return[1/0,1/0,-1/0,-1/0];let t=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)Pa(t,r[n]);return t}l(wf,"getBBox");function Pf(r){let e=[1/0,1/0,-1/0,-1/0];for(let t of r)for(let n of t)Pa(e,n);return e}l(Pf,"getPolygonBBox");function v1(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}l(v1,"isValidBBox");function Ef(r,e,t){if(!v1(r)||!v1(e))return NaN;let n=0,i=0;return r[2]<e[0]&&(n=e[0]-r[2]),r[0]>e[2]&&(n=r[0]-e[2]),r[1]>e[3]&&(i=r[1]-e[3]),r[3]<e[1]&&(i=e[1]-r[3]),t.distance([0,0],[n,i])}l(Ef,"bboxToBBoxDistance");function ii(r,e,t){let n=t.pointOnLine(e,r);return t.distance(r,n.point)}l(ii,"pointToLineDistance");function Lf(r,e,t,n,i){let o=Math.min(ii(r,[t,n],i),ii(e,[t,n],i)),a=Math.min(ii(t,[r,e],i),ii(n,[r,e],i));return Math.min(o,a)}l(Lf,"segmentToSegmentDistance");function rD(r,e,t,n,i){if(!(Zr(e,r.length)&&Zr(n,t.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let u=r[s],c=r[s+1];for(let p=n[0];p<n[1];++p){let h=t[p],m=t[p+1];if(Uu(u,c,h,m))return 0;a=Math.min(a,Lf(u,c,h,m,i))}}return a}l(rD,"lineToLineDistance");function nD(r,e,t,n,i){if(!(Zr(e,r.length)&&Zr(n,t.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let u=n[0];u<=n[1];++u)if(a=Math.min(a,i.distance(r[s],t[u])),a===0)return a;return a}l(nD,"pointsToPointsDistance");function iD(r,e,t){if(no(r,e,!0))return 0;let n=1/0;for(let i of e){let o=i[0],a=i[i.length-1];if(o!==a&&(n=Math.min(n,ii(r,[a,o],t)),n===0))return n;let s=t.pointOnLine(i,r);if(n=Math.min(n,t.distance(r,s.point)),n===0)return n}return n}l(iD,"pointToPolygonDistance");function oD(r,e,t,n){if(!Zr(e,r.length))return NaN;for(let o=e[0];o<=e[1];++o)if(no(r[o],t,!0))return 0;let i=1/0;for(let o=e[0];o<e[1];++o){let a=r[o],s=r[o+1];for(let u of t)for(let c=0,p=u.length,h=p-1;c<p;h=c++){let m=u[h],f=u[c];if(Uu(a,s,m,f))return 0;i=Math.min(i,Lf(a,s,m,f,n))}}return i}l(oD,"lineToPolygonDistance");function w1(r,e){for(let t of r)for(let n of t)if(no(n,e,!0))return!0;return!1}l(w1,"polygonIntersect");function aD(r,e,t,n=1/0){let i=Pf(r),o=Pf(e);if(n!==1/0&&Ef(i,o,t)>=n)return n;if(fa(i,o)){if(w1(r,e))return 0}else if(w1(e,r))return 0;let a=1/0;for(let s of r)for(let u=0,c=s.length,p=c-1;u<c;p=u++){let h=s[p],m=s[u];for(let f of e)for(let d=0,g=f.length,x=g-1;d<g;x=d++){let _=f[x],b=f[d];if(Uu(h,m,_,b))return 0;a=Math.min(a,Lf(h,m,_,b,t))}}return a}l(aD,"polygonToPolygonDistance");function P1(r,e,t,n,i,o){if(!o)return;let a=Ef(wf(n,o),i,t);a<e&&r.push([a,o,[0,0]])}l(P1,"updateQueue");function Jl(r,e,t,n,i,o,a){if(!o||!a)return;let s=Ef(wf(n,o),wf(i,a),t);s<e&&r.push([s,o,a])}l(Jl,"updateQueueTwoSets");function uu(r,e,t,n,i=1/0){let o=Math.min(n.distance(r[0],t[0][0]),i);if(o===0)return o;let a=new su([[0,[0,r.length-1],[0,0]]],W1),s=Pf(t);for(;a.length>0;){let u=a.pop();if(u[0]>=o)continue;let c=u[1],p=e?bf:_f;if(lu(c)<=p){if(!Zr(c,r.length))return NaN;if(e){let h=oD(r,c,t,n);if(isNaN(h)||h===0)return h;o=Math.min(o,h)}else for(let h=c[0];h<=c[1];++h){let m=iD(r[h],t,n);if(o=Math.min(o,m),o===0)return 0}}else{let h=vf(c,e);P1(a,o,n,r,s,h[0]),P1(a,o,n,r,s,h[1])}}return o}l(uu,"pointsToPolygonDistance");function cu(r,e,t,n,i,o=1/0){let a=Math.min(o,i.distance(r[0],t[0]));if(a===0)return a;let s=new su([[0,[0,r.length-1],[0,t.length-1]]],W1);for(;s.length>0;){let u=s.pop();if(u[0]>=a)continue;let c=u[1],p=u[2],h=e?bf:_f,m=n?bf:_f;if(lu(c)<=h&&lu(p)<=m){if(!Zr(c,r.length)&&Zr(p,t.length))return NaN;let f;if(e&&n)f=rD(r,c,t,p,i),a=Math.min(a,f);else if(e&&!n){let d=r.slice(c[0],c[1]+1);for(let g=p[0];g<=p[1];++g)if(f=ii(t[g],d,i),a=Math.min(a,f),a===0)return a}else if(!e&&n){let d=t.slice(p[0],p[1]+1);for(let g=c[0];g<=c[1];++g)if(f=ii(r[g],d,i),a=Math.min(a,f),a===0)return a}else f=nD(r,c,t,p,i),a=Math.min(a,f)}else{let f=vf(c,e),d=vf(p,n);Jl(s,a,i,r,t,f[0],d[0]),Jl(s,a,i,r,t,f[0],d[1]),Jl(s,a,i,r,t,f[1],d[0]),Jl(s,a,i,r,t,f[1],d[1])}}return a}l(cu,"pointSetToPointSetDistance");function sD(r,e){let t=r.geometry(),n=t.flat().map(a=>Af([a.x,a.y],r.canonical));if(t.length===0)return NaN;let i=new ya(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,cu(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,cu(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,uu(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}l(sD,"pointToGeometryDistance");function lD(r,e){let t=r.geometry(),n=t.flat().map(a=>Af([a.x,a.y],r.canonical));if(t.length===0)return NaN;let i=new ya(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,cu(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,cu(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,uu(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}l(lD,"lineStringToGeometryDistance");function uD(r,e){let t=r.geometry();if(t.length===0||t[0].length===0)return NaN;let n=Ta(t,0).map(a=>a.map(s=>s.map(u=>Af([u.x,u.y],r.canonical)))),i=new ya(n[0][0][0][1]),o=1/0;for(let a of e)for(let s of n){switch(a.type){case"Point":o=Math.min(o,uu([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,uu(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,aD(s,a.coordinates,i,o));break}if(o===0)return o}return o}l(uD,"polygonToGeometryDistance");function af(r){return r.type==="MultiPolygon"?r.coordinates.map(e=>({type:"Polygon",coordinates:e})):r.type==="MultiLineString"?r.coordinates.map(e=>({type:"LineString",coordinates:e})):r.type==="MultiPoint"?r.coordinates.map(e=>({type:"Point",coordinates:e})):[r]}l(af,"toSimpleGeometry");var $i=class $i{constructor(e,t){this.type=W,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error("'distance' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(ha(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new $i(n,n.features.map(i=>af(i.geometry)).flat());if(n.type==="Feature")return new $i(n,af(n.geometry));if("type"in n&&"coordinates"in n)return new $i(n,af(n))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return sD(e,this.geometries);if(e.geometryType()==="LineString")return lD(e,this.geometries);if(e.geometryType()==="Polygon")return uD(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}};l($i,"Distance");var ga=$i,ku=class ku{constructor(e){this.type=pe,this.key=e}static parse(e,t){if(e.length!==2)return t.error("Expected 1 argument, but found ".concat(e.length-1," instead."));let n=e[1];return n==null?t.error("Global state property must be defined."):typeof n!="string"?t.error("Global state property must be string, but found ".concat(typeof e[1]," instead.")):new ku(n)}evaluate(e){var t;let n=(t=e.globals)===null||t===void 0?void 0:t.globalState;return!n||Object.keys(n).length===0?null:ra(n,this.key)}eachChild(){}outputDefined(){return!1}};l(ku,"GlobalState");var xa=ku,ci={"==":kR,"!=":RR,">":FR,"<":DR,">=":BR,"<=":zR,array:hr,at:cf,boolean:hr,case:ff,coalesce:ou,collator:au,format:ma,image:gf,in:pf,"index-of":hf,interpolate:Tt,"interpolate-hcl":Tt,"interpolate-lab":Tt,length:xf,let:nu,literal:yn,match:mf,number:hr,"number-format":yf,object:hr,slice:df,step:Ji,string:hr,"to-boolean":fn,"to-color":fn,"to-number":fn,"to-string":fn,var:iu,within:da,distance:ga,"global-state":xa},ni=class ni{constructor(e,t,n,i){this.name=e,this.type=t,this._evaluate=n,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let n=e[0],i=ni.definitions[n];if(!i)return t.error('Unknown expression "'.concat(n,'". If you wanted a literal array, use ["literal", [...]].'),0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([c])=>!Array.isArray(c)||c.length===e.length-1),u=null;for(let[c,p]of s){u=new ru(t.registry,pu,t.path,null,t.scope);let h=[],m=!1;for(let f=1;f<e.length;f++){let d=e[f],g=Array.isArray(c)?c[f-1]:c.type,x=u.parse(d,1+h.length,g);if(!x){m=!0;break}h.push(x)}if(!m){if(Array.isArray(c)&&c.length!==h.length){u.error("Expected ".concat(c.length," arguments, but found ").concat(h.length," instead."));continue}for(let f=0;f<h.length;f++){let d=Array.isArray(c)?c[f]:c.type,g=h[f];u.concat(f+1).checkSubtype(d,g.type)}if(u.errors.length===0)return new ni(n,o,p,h)}}if(s.length===1)t.errors.push(...u.errors);else{let p=(s.length?s:a).map(([m])=>pD(m)).join(" | "),h=[];for(let m=1;m<e.length;m++){let f=t.parse(e[m],1+h.length);if(!f)return null;h.push(qe(f.type))}t.error("Expected arguments of type ".concat(p,", but found (").concat(h.join(", "),") instead."))}return null}static register(e,t){ni.definitions=t;for(let n in t)e[n]=ni}};l(ni,"CompoundExpression");var Ir=ni;function T1(r,[e,t,n,i]){e=e.evaluate(r),t=t.evaluate(r),n=n.evaluate(r);let o=i?i.evaluate(r):1,a=j1(e,t,n,o);if(a)throw new Ue(a);return new Y(e/255,t/255,n/255,o,!1)}l(T1,"rgba");function S1(r,e){return r in e}l(S1,"has");function sf(r,e){let t=e[r];return typeof t>"u"?null:t}l(sf,"get");function cD(r,e,t,n){for(;t<=n;){let i=t+n>>1;if(e[i]===r)return!0;e[i]>r?n=i-1:t=i+1}return!1}l(cD,"binarySearch");function Qn(r){return{type:r}}l(Qn,"varargs");Ir.register(ci,{error:[rR,[ge],(r,[e])=>{throw new Ue(e.evaluate(r))}],typeof:[ge,[pe],(r,[e])=>qe(Je(e.evaluate(r)))],"to-rgba":[Ut(W,4),[nr],(r,[e])=>{let[t,n,i,o]=e.evaluate(r).rgb;return[t*255,n*255,i*255,o]}],rgb:[nr,[W,W,W],T1],rgba:[nr,[W,W,W,W],T1],has:{type:fe,overloads:[[[ge],(r,[e])=>S1(e.evaluate(r),r.properties())],[[ge,oi],(r,[e,t])=>S1(e.evaluate(r),t.evaluate(r))]]},get:{type:pe,overloads:[[[ge],(r,[e])=>sf(e.evaluate(r),r.properties())],[[ge,oi],(r,[e,t])=>sf(e.evaluate(r),t.evaluate(r))]]},"feature-state":[pe,[ge],(r,[e])=>sf(e.evaluate(r),r.featureState||{})],properties:[oi,[],r=>r.properties()],"geometry-type":[ge,[],r=>r.geometryType()],id:[pe,[],r=>r.id()],zoom:[W,[],r=>r.globals.zoom],"heatmap-density":[W,[],r=>r.globals.heatmapDensity||0],elevation:[W,[],r=>r.globals.elevation||0],"line-progress":[W,[],r=>r.globals.lineProgress||0],accumulated:[pe,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[W,Qn(W),(r,e)=>{let t=0;for(let n of e)t+=n.evaluate(r);return t}],"*":[W,Qn(W),(r,e)=>{let t=1;for(let n of e)t*=n.evaluate(r);return t}],"-":{type:W,overloads:[[[W,W],(r,[e,t])=>e.evaluate(r)-t.evaluate(r)],[[W],(r,[e])=>-e.evaluate(r)]]},"/":[W,[W,W],(r,[e,t])=>e.evaluate(r)/t.evaluate(r)],"%":[W,[W,W],(r,[e,t])=>e.evaluate(r)%t.evaluate(r)],ln2:[W,[],()=>Math.LN2],pi:[W,[],()=>Math.PI],e:[W,[],()=>Math.E],"^":[W,[W,W],(r,[e,t])=>Math.pow(e.evaluate(r),t.evaluate(r))],sqrt:[W,[W],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[W,[W],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[W,[W],(r,[e])=>Math.log(e.evaluate(r))],log2:[W,[W],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[W,[W],(r,[e])=>Math.sin(e.evaluate(r))],cos:[W,[W],(r,[e])=>Math.cos(e.evaluate(r))],tan:[W,[W],(r,[e])=>Math.tan(e.evaluate(r))],asin:[W,[W],(r,[e])=>Math.asin(e.evaluate(r))],acos:[W,[W],(r,[e])=>Math.acos(e.evaluate(r))],atan:[W,[W],(r,[e])=>Math.atan(e.evaluate(r))],min:[W,Qn(W),(r,e)=>Math.min(...e.map(t=>t.evaluate(r)))],max:[W,Qn(W),(r,e)=>Math.max(...e.map(t=>t.evaluate(r)))],abs:[W,[W],(r,[e])=>Math.abs(e.evaluate(r))],round:[W,[W],(r,[e])=>{let t=e.evaluate(r);return t<0?-Math.round(-t):Math.round(t)}],floor:[W,[W],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[W,[W],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[fe,[ge,pe],(r,[e,t])=>r.properties()[e.value]===t.value],"filter-id-==":[fe,[pe],(r,[e])=>r.id()===e.value],"filter-type-==":[fe,[ge],(r,[e])=>r.geometryType()===e.value],"filter-<":[fe,[ge,pe],(r,[e,t])=>{let n=r.properties()[e.value],i=t.value;return typeof n==typeof i&&n<i}],"filter-id-<":[fe,[pe],(r,[e])=>{let t=r.id(),n=e.value;return typeof t==typeof n&&t<n}],"filter->":[fe,[ge,pe],(r,[e,t])=>{let n=r.properties()[e.value],i=t.value;return typeof n==typeof i&&n>i}],"filter-id->":[fe,[pe],(r,[e])=>{let t=r.id(),n=e.value;return typeof t==typeof n&&t>n}],"filter-<=":[fe,[ge,pe],(r,[e,t])=>{let n=r.properties()[e.value],i=t.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[fe,[pe],(r,[e])=>{let t=r.id(),n=e.value;return typeof t==typeof n&&t<=n}],"filter->=":[fe,[ge,pe],(r,[e,t])=>{let n=r.properties()[e.value],i=t.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[fe,[pe],(r,[e])=>{let t=r.id(),n=e.value;return typeof t==typeof n&&t>=n}],"filter-has":[fe,[pe],(r,[e])=>e.value in r.properties()],"filter-has-id":[fe,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[fe,[Ut(ge)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[fe,[Ut(pe)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[fe,[ge,Ut(pe)],(r,[e,t])=>t.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[fe,[ge,Ut(pe)],(r,[e,t])=>cD(r.properties()[e.value],t.value,0,t.value.length-1)],all:{type:fe,overloads:[[[fe,fe],(r,[e,t])=>e.evaluate(r)&&t.evaluate(r)],[Qn(fe),(r,e)=>{for(let t of e)if(!t.evaluate(r))return!1;return!0}]]},any:{type:fe,overloads:[[[fe,fe],(r,[e,t])=>e.evaluate(r)||t.evaluate(r)],[Qn(fe),(r,e)=>{for(let t of e)if(t.evaluate(r))return!0;return!1}]]},"!":[fe,[fe],(r,[e])=>!e.evaluate(r)],"is-supported-script":[fe,[ge],(r,[e])=>{let t=r.globals&&r.globals.isSupportedScript;return t?t(e.evaluate(r)):!0}],upcase:[ge,[ge],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[ge,[ge],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[ge,Qn(pe),(r,e)=>e.map(t=>na(t.evaluate(r))).join("")],"resolved-locale":[ge,[Fu],(r,[e])=>e.evaluate(r).resolvedLocale()]});function pD(r){return Array.isArray(r)?"(".concat(r.map(qe).join(", "),")"):"(".concat(qe(r.type),"...)")}l(pD,"stringifySignature");function pu(r){if(r instanceof iu)return pu(r.boundExpression);if(r instanceof Ir&&r.name==="error")return!1;if(r instanceof au)return!1;if(r instanceof da)return!1;if(r instanceof ga)return!1;if(r instanceof xa)return!1;let e=r instanceof fn||r instanceof hr,t=!0;return r.eachChild(n=>{e?t=t&&pu(n):t=t&&n instanceof yn}),t?ju(r)&&Nu(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}l(pu,"isExpressionConstant");function ju(r){if(r instanceof Ir){if(r.name==="get"&&r.args.length===1)return!1;if(r.name==="feature-state")return!1;if(r.name==="has"&&r.args.length===1)return!1;if(r.name==="properties"||r.name==="geometry-type"||r.name==="id")return!1;if(/^filter-/.test(r.name))return!1}if(r instanceof da||r instanceof ga)return!1;let e=!0;return r.eachChild(t=>{e&&!ju(t)&&(e=!1)}),e}l(ju,"isFeatureConstant");function _a(r){if(r instanceof Ir&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(t=>{e&&!_a(t)&&(e=!1)}),e}l(_a,"isStateConstant");function Nu(r,e){if(r instanceof Ir&&e.indexOf(r.name)>=0)return!1;let t=!0;return r.eachChild(n=>{t&&!Nu(n,e)&&(t=!1)}),t}l(Nu,"isGlobalPropertyConstant");function Tf(r){return{result:"success",value:r}}l(Tf,"success");function Zi(r){return{result:"error",value:r}}l(Zi,"error");function gn(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}l(gn,"supportsPropertyExpression");function $1(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}l($1,"supportsZoomExpression");function kf(r){return!!r.expression&&r.expression.interpolated}l(kf,"supportsInterpolation");function xe(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}l(xe,"getType");function Gu(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Je(r)===oi}l(Gu,"isFunction$1");function hD(r){return r}l(hD,"identityFunction");function mD(r){switch(r.type){case"color":return Y.parse;case"padding":return ir.parse;case"numberArray":return or.parse;case"colorArray":return It.parse;default:return null}}l(mD,"getParseFunction");function fD(r){switch(r){case"exponential":return Y1;case"interval":return yD;case"categorical":return dD;case"identity":return gD;default:throw new Error('Unknown function type "'.concat(r,'"'))}}l(fD,"getInnerFunction");function X1(r,e){let t=r.stops&&typeof r.stops[0][0]=="object",n=t||r.property!==void 0,i=t||!n,o=r.type||(kf(e)?"exponential":"interval"),a=mD(e);if(a&&(r=Yi({},r),r.stops&&(r.stops=r.stops.map(p=>[p[0],a(p[1])])),r.default?r.default=a(r.default):r.default=a(e.default)),r.colorSpace&&!mR(r.colorSpace))throw new Error('Unknown color space: "'.concat(r.colorSpace,'"'));let s=fD(o),u,c;if(o==="categorical"){u=Object.create(null);for(let p of r.stops)u[p[0]]=p[1];c=typeof r.stops[0][0]}if(t){let p={},h=[];for(let d=0;d<r.stops.length;d++){let g=r.stops[d],x=g[0].zoom;p[x]===void 0&&(p[x]={zoom:x,type:r.type,property:r.property,default:r.default,stops:[]},h.push(x)),p[x].stops.push([g[0].value,g[1]])}let m=[];for(let d of h)m.push([p[d].zoom,X1(p[d],e)]);let f={name:"linear"};return{kind:"composite",interpolationType:f,interpolationFactor:Tt.interpolationFactor.bind(void 0,f),zoomStops:m.map(d=>d[0]),evaluate({zoom:d},g){return Y1({stops:m,base:r.base},e,d).evaluate(d,g)}}}else if(i){let p=o==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:p,interpolationFactor:Tt.interpolationFactor.bind(void 0,p),zoomStops:r.stops.map(h=>h[0]),evaluate:l(({zoom:h})=>s(r,e,h,u,c),"evaluate")}}else return{kind:"source",evaluate(p,h){let m=h&&h.properties?h.properties[r.property]:void 0;return m===void 0?Sa(r.default,e.default):s(r,e,m,u,c)}}}l(X1,"createFunction");function Sa(r,e,t){if(r!==void 0)return r;if(e!==void 0)return e;if(t!==void 0)return t}l(Sa,"coalesce$1");function dD(r,e,t,n,i){let o=typeof t===i?n[t]:void 0;return Sa(o,r.default,e.default)}l(dD,"evaluateCategoricalFunction");function yD(r,e,t){if(xe(t)!=="number")return Sa(r.default,e.default);let n=r.stops.length;if(n===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[n-1][0])return r.stops[n-1][1];let i=Vu(r.stops.map(o=>o[0]),t);return r.stops[i][1]}l(yD,"evaluateIntervalFunction");function Y1(r,e,t){let n=r.base!==void 0?r.base:1;if(xe(t)!=="number")return Sa(r.default,e.default);let i=r.stops.length;if(i===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[i-1][0])return r.stops[i-1][1];let o=Vu(r.stops.map(p=>p[0]),t),a=xD(t,n,r.stops[o][0],r.stops[o+1][0]),s=r.stops[o][1],u=r.stops[o+1][1],c=Ae[e.type]||hD;return typeof s.evaluate=="function"?{evaluate(...p){let h=s.evaluate.apply(void 0,p),m=u.evaluate.apply(void 0,p);if(!(h===void 0||m===void 0))return c(h,m,a,r.colorSpace)}}:c(s,u,a,r.colorSpace)}l(Y1,"evaluateExponentialFunction");function gD(r,e,t){switch(e.type){case"color":t=Y.parse(t);break;case"formatted":t=jt.fromString(t.toString());break;case"resolvedImage":t=Et.fromString(t.toString());break;case"padding":t=ir.parse(t);break;case"colorArray":t=It.parse(t);break;case"numberArray":t=or.parse(t);break;default:xe(t)!==e.type&&(e.type!=="enum"||!e.values[t])&&(t=void 0)}return Sa(t,r.default,e.default)}l(gD,"evaluateIdentityFunction");function xD(r,e,t,n){let i=n-t,o=r-t;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}l(xD,"interpolationFactor");var qf=class qf{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new tu,this._defaultValue=t?bD(t):null,this._enumValues=t&&t.type==="enum"?t.values:null}evaluateWithoutErrorHandling(e,t,n,i,o,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,i,o,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new Ue("Expected value to be one of ".concat(Object.keys(this._enumValues).map(u=>JSON.stringify(u)).join(", "),", but found ").concat(JSON.stringify(s)," instead."));return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};l(qf,"StyleExpression");var si=qf;function Ma(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in ci}l(Ma,"isExpression");function Rf(r,e){let t=new ru(ci,pu,[],e?_D(e):void 0),n=t.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Tf(new si(n,e)):Zi(t.errors)}l(Rf,"createExpression");var Hf=class Hf{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!_a(t.expression),this.globalStateRefs=Zu(t.expression)}evaluateWithoutErrorHandling(e,t,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,i,o,a)}evaluate(e,t,n,i,o,a){return this._styleExpression.evaluate(e,t,n,i,o,a)}};l(Hf,"ZoomConstantExpression");var Er=Hf,Wf=class Wf{constructor(e,t,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!_a(t.expression),this.globalStateRefs=Zu(t.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,t,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,i,o,a)}evaluate(e,t,n,i,o,a){return this._styleExpression.evaluate(e,t,n,i,o,a)}interpolationFactor(e,t,n){return this.interpolationType?Tt.interpolationFactor(this.interpolationType,e,t,n):0}};l(Wf,"ZoomDependentExpression");var xn=Wf;function K1(r){return r._styleExpression!==void 0}l(K1,"isZoomExpression");function J1(r,e){let t=Rf(r,e);if(t.result==="error")return t;let n=t.value.expression,i=ju(n);if(!i&&!gn(e))return Zi([new tr("","data expressions not supported")]);let o=Nu(n,["zoom"]);if(!o&&!$1(e))return Zi([new tr("","zoom expressions not supported")]);let a=eu(n);if(!a&&!o)return Zi([new tr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof tr)return Zi([a]);if(a instanceof Tt&&!kf(e))return Zi([new tr("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Tf(i?new Er("constant",t.value):new Er("source",t.value));let s=a instanceof Tt?a.interpolation:void 0;return Tf(i?new xn("camera",t.value,a.labels,s):new xn("composite",t.value,a.labels,s))}l(J1,"createPropertyExpression");var Ru=class Ru{constructor(e,t){this._parameters=e,this._specification=t,Yi(this,X1(this._parameters,this._specification))}static deserialize(e){return new Ru(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};l(Ru,"StylePropertyFunction");var ba=Ru;function Q1(r,e){if(Gu(r))return new ba(r,e);if(Ma(r)){let t=J1(r,e);if(t.result==="error")throw new Error(t.value.map(n=>"".concat(n.key,": ").concat(n.message)).join(", "));return t.value}else{let t=r;return e.type==="color"&&typeof r=="string"?t=Y.parse(r):e.type==="padding"&&(typeof r=="number"||Array.isArray(r))?t=ir.parse(r):e.type==="numberArray"&&(typeof r=="number"||Array.isArray(r))?t=or.parse(r):e.type==="colorArray"&&(typeof r=="string"||Array.isArray(r))?t=It.parse(r):e.type==="variableAnchorOffsetCollection"&&Array.isArray(r)?t=Cr.parse(r):e.type==="projectionDefinition"&&typeof r=="string"&&(t=Ar.parse(r)),{globalStateRefs:new Set,kind:"constant",evaluate:l(()=>t,"evaluate")}}}l(Q1,"normalizePropertyExpression");function eu(r){let e=null;if(r instanceof nu)e=eu(r.result);else if(r instanceof ou){for(let t of r.args)if(e=eu(t),e)break}else(r instanceof Ji||r instanceof Tt)&&r.input instanceof Ir&&r.input.name==="zoom"&&(e=r);return e instanceof tr||r.eachChild(t=>{let n=eu(t);n instanceof tr?e=n:!e&&n?e=new tr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new tr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}l(eu,"findZoomCurve");function Zu(r,e=new Set){return r instanceof xa&&e.add(r.key),r.eachChild(t=>{Zu(t,e)}),e}l(Zu,"findGlobalStateRefs");function _D(r){let e={color:nr,string:ge,number:W,enum:ge,boolean:fe,formatted:to,padding:zu,numberArray:Bu,colorArray:la,projectionDefinition:Du,resolvedImage:wa,variableAnchorOffsetCollection:Ou};return r.type==="array"?Ut(e[r.value]||pe,r.length):e[r.type]}l(_D,"getExpectedType");function bD(r){if(r.type==="color"&&Gu(r.default))return new Y(0,0,0,0);switch(r.type){case"color":return Y.parse(r.default)||null;case"padding":return ir.parse(r.default)||null;case"numberArray":return or.parse(r.default)||null;case"colorArray":return It.parse(r.default)||null;case"variableAnchorOffsetCollection":return Cr.parse(r.default)||null;case"projectionDefinition":return Ar.parse(r.default)||null;default:return r.default===void 0?null:r.default}}l(bD,"getDefaultValue");function Df(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(let e of r.slice(1))if(!Df(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}l(Df,"isExpressionFilter");var vD={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function _n(r){if(r==null)return{filter:l(()=>!0,"filter"),needGeometry:!1,getGlobalStateRefs:l(()=>new Set,"getGlobalStateRefs")};Df(r)||(r=hu(r));let e=Rf(r,vD);if(e.result==="error")throw new Error(e.value.map(t=>"".concat(t.key,": ").concat(t.message)).join(", "));{let t=ew(r);return{filter:l((n,i,o)=>e.value.evaluate(n,i,{},o),"filter"),needGeometry:t,getGlobalStateRefs:l(()=>Zu(e.value.expression),"getGlobalStateRefs")}}}l(_n,"featureFilter");function wD(r,e){return r<e?-1:r>e?1:0}l(wD,"compare");function ew(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(ew(r[e]))return!0;return!1}l(ew,"geometryNeeded");function hu(r){if(!r)return!0;let e=r[0];return r.length<=1?e!=="any":e==="=="?lf(r[1],r[2],"=="):e==="!="?Ql(lf(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?lf(r[1],r[2],e):e==="any"?PD(r.slice(1)):e==="all"?["all"].concat(r.slice(1).map(hu)):e==="none"?["all"].concat(r.slice(1).map(hu).map(Ql)):e==="in"?M1(r[1],r.slice(2)):e==="!in"?Ql(M1(r[1],r.slice(2))):e==="has"?C1(r[1]):e==="!has"?Ql(C1(r[1])):!0}l(hu,"convertFilter$1");function lf(r,e,t){switch(r){case"$type":return["filter-type-".concat(t),e];case"$id":return["filter-id-".concat(t),e];default:return["filter-".concat(t),r,e]}}l(lf,"convertComparisonOp$1");function PD(r){return["any"].concat(r.map(hu))}l(PD,"convertDisjunctionOp");function M1(r,e){if(e.length===0)return!1;switch(r){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",r,["literal",e.sort(wD)]]:["filter-in-small",r,["literal",e]]}}l(M1,"convertInOp$1");function C1(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}l(C1,"convertHasOp$1");function Ql(r){return["!",r]}l(Ql,"convertNegation");function tw(){let r={},e=E.$version;for(let t in E.$root){let n=E.$root[t];if(n.required){let i=null;t==="version"?i=e:n.type==="array"?i=[]:i={},i!=null&&(r[t]=i)}}return r}l(tw,"emptyStyle");function rw(r){let e=r.key,t=r.value;return t?[new N(e,t,"constants have been deprecated as of v8")]:[]}l(rw,"validateConstants");function Ke(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}l(Ke,"unbundle");function li(r){if(Array.isArray(r))return r.map(li);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){let e={};for(let t in r)e[t]=li(r[t]);return e}return Ke(r)}l(li,"deepUnbundle");function rr(r){let e=r.key,t=r.value,n=r.valueSpec||{},i=r.objectElementValidators||{},o=r.style,a=r.styleSpec,s=r.validateSpec,u=[],c=xe(t);if(c!=="object")return[new N(e,t,"object expected, ".concat(c," found"))];for(let p in t){let h=p.split(".")[0],m=ra(n,h)||n["*"],f;if(ra(i,h))f=i[h];else if(ra(n,h))f=s;else if(i["*"])f=i["*"];else if(n["*"])f=s;else{u.push(new N(e,t[p],'unknown property "'.concat(p,'"')));continue}u=u.concat(f({key:(e&&"".concat(e,"."))+p,value:t[p],valueSpec:m,style:o,styleSpec:a,object:t,objectKey:p,validateSpec:s},t))}for(let p in n)i[p]||n[p].required&&n[p].default===void 0&&t[p]===void 0&&u.push(new N(e,t,'missing required property "'.concat(p,'"')));return u}l(rr,"validateObject");function Ff(r){let e=r.value,t=r.valueSpec,n=r.validateSpec,i=r.style,o=r.styleSpec,a=r.key,s=r.arrayElementValidator||n;if(xe(e)!=="array")return[new N(a,e,"array expected, ".concat(xe(e)," found"))];if(t.length&&e.length!==t.length)return[new N(a,e,"array length ".concat(t.length," expected, length ").concat(e.length," found"))];if(t["min-length"]&&e.length<t["min-length"])return[new N(a,e,"array length at least ".concat(t["min-length"]," expected, length ").concat(e.length," found"))];let u={type:t.value,values:t.values};o.$version<7&&(u.function=t.function),xe(t.value)==="object"&&(u=t.value);let c=[];for(let p=0;p<e.length;p++)c=c.concat(s({array:e,arrayIndex:p,value:e[p],valueSpec:u,validateSpec:r.validateSpec,style:i,styleSpec:o,key:"".concat(a,"[").concat(p,"]")}));return c}l(Ff,"validateArray");function qu(r){let e=r.key,t=r.value,n=r.valueSpec,i=xe(t);return i==="number"&&t!==t&&(i="NaN"),i!=="number"?[new N(e,t,"number expected, ".concat(i," found"))]:"minimum"in n&&t<n.minimum?[new N(e,t,"".concat(t," is less than the minimum value ").concat(n.minimum))]:"maximum"in n&&t>n.maximum?[new N(e,t,"".concat(t," is greater than the maximum value ").concat(n.maximum))]:[]}l(qu,"validateNumber");function nw(r){let e=r.valueSpec,t=Ke(r.value.type),n,i={},o,a,s=t!=="categorical"&&r.value.property===void 0,u=!s,c=xe(r.value.stops)==="array"&&xe(r.value.stops[0])==="array"&&xe(r.value.stops[0][0])==="object",p=rr({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:h,default:d}});return t==="identity"&&s&&p.push(new N(r.key,r.value,'missing required property "property"')),t!=="identity"&&!r.value.stops&&p.push(new N(r.key,r.value,'missing required property "stops"')),t==="exponential"&&r.valueSpec.expression&&!kf(r.valueSpec)&&p.push(new N(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(u&&!gn(r.valueSpec)?p.push(new N(r.key,r.value,"property functions not supported")):s&&!$1(r.valueSpec)&&p.push(new N(r.key,r.value,"zoom functions not supported"))),(t==="categorical"||c)&&r.value.property===void 0&&p.push(new N(r.key,r.value,'"property" property is required')),p;function h(g){if(t==="identity")return[new N(g.key,g.value,'identity function may not have a "stops" property')];let x=[],_=g.value;return x=x.concat(Ff({key:g.key,value:_,valueSpec:g.valueSpec,validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec,arrayElementValidator:m})),xe(_)==="array"&&_.length===0&&x.push(new N(g.key,_,"array must have at least one stop")),x}l(h,"validateFunctionStops");function m(g){let x=[],_=g.value,b=g.key;if(xe(_)!=="array")return[new N(b,_,"array expected, ".concat(xe(_)," found"))];if(_.length!==2)return[new N(b,_,"array length 2 expected, length ".concat(_.length," found"))];if(c){if(xe(_[0])!=="object")return[new N(b,_,"object expected, ".concat(xe(_[0])," found"))];if(_[0].zoom===void 0)return[new N(b,_,"object stop key must have zoom")];if(_[0].value===void 0)return[new N(b,_,"object stop key must have value")];if(a&&a>Ke(_[0].zoom))return[new N(b,_[0].zoom,"stop zoom values must appear in ascending order")];Ke(_[0].zoom)!==a&&(a=Ke(_[0].zoom),o=void 0,i={}),x=x.concat(rr({key:"".concat(b,"[0]"),value:_[0],valueSpec:{zoom:{}},validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{zoom:qu,value:f}}))}else x=x.concat(f({key:"".concat(b,"[0]"),value:_[0],validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec},_));return Ma(li(_[1]))?x.concat([new N("".concat(b,"[1]"),_[1],"expressions are not allowed in function stops.")]):x.concat(g.validateSpec({key:"".concat(b,"[1]"),value:_[1],valueSpec:e,validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec}))}l(m,"validateFunctionStop");function f(g,x){let _=xe(g.value),b=Ke(g.value),v=g.value!==null?g.value:x;if(!n)n=_;else if(_!==n)return[new N(g.key,v,"".concat(_," stop domain type must match previous stop domain type ").concat(n))];if(_!=="number"&&_!=="string"&&_!=="boolean")return[new N(g.key,v,"stop domain value must be a number, string, or boolean")];if(_!=="number"&&t!=="categorical"){let w="number expected, ".concat(_," found");return gn(e)&&t===void 0&&(w+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new N(g.key,v,w)]}return t==="categorical"&&_==="number"&&(!isFinite(b)||Math.floor(b)!==b)?[new N(g.key,v,"integer expected, found ".concat(b))]:t!=="categorical"&&_==="number"&&o!==void 0&&b<o?[new N(g.key,v,"stop domain values must appear in ascending order")]:(o=b,t==="categorical"&&b in i?[new N(g.key,v,"stop domain values must be unique")]:(i[b]=!0,[]))}l(f,"validateStopDomainValue");function d(g){return g.validateSpec({key:g.key,value:g.value,valueSpec:e,validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec})}l(d,"validateFunctionDefault")}l(nw,"validateFunction");function Qi(r){let e=(r.expressionContext==="property"?J1:Rf)(li(r.value),r.valueSpec);if(e.result==="error")return e.value.map(n=>new N("".concat(r.key).concat(n.key),r.value,n.message));let t=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!t.outputDefined())return[new N(r.key,r.value,'Invalid data expression for "'.concat(r.propertyKey,'". Output values must be contained as literals within the expression.'))];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!_a(t))return[new N(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!_a(t))return[new N(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Nu(t,["zoom","feature-state"]))return[new N(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!ju(t))return[new N(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}l(Qi,"validateExpression");function TD(r){let e=r.value,t=r.key,n=xe(e);return n!=="boolean"?[new N(t,e,"boolean expected, ".concat(n," found"))]:[]}l(TD,"validateBoolean");function Sf(r){let e=r.key,t=r.value,n=xe(t);return n!=="string"?[new N(e,t,"color expected, ".concat(n," found"))]:Y.parse(String(t))?[]:[new N(e,t,'color expected, "'.concat(t,'" found'))]}l(Sf,"validateColor");function va(r){let e=r.key,t=r.value,n=r.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(Ke(t))===-1&&i.push(new N(e,t,"expected one of [".concat(n.values.join(", "),"], ").concat(JSON.stringify(t)," found"))):Object.keys(n.values).indexOf(Ke(t))===-1&&i.push(new N(e,t,"expected one of [".concat(Object.keys(n.values).join(", "),"], ").concat(JSON.stringify(t)," found"))),i}l(va,"validateEnum");function zf(r){return Df(li(r.value))?Qi(Yi({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):iw(r)}l(zf,"validateFilter");function iw(r){let e=r.value,t=r.key;if(xe(e)!=="array")return[new N(t,e,"array expected, ".concat(xe(e)," found"))];let n=r.styleSpec,i,o=[];if(e.length<1)return[new N(t,e,"filter array must have at least 1 element")];switch(o=o.concat(va({key:"".concat(t,"[0]"),value:e[0],valueSpec:n.filter_operator,style:r.style,styleSpec:r.styleSpec})),Ke(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ke(e[1])==="$type"&&o.push(new N(t,e,'"$type" cannot be use with operator "'.concat(e[0],'"')));case"==":case"!=":e.length!==3&&o.push(new N(t,e,'filter array for operator "'.concat(e[0],'" must have 3 elements')));case"in":case"!in":e.length>=2&&(i=xe(e[1]),i!=="string"&&o.push(new N("".concat(t,"[1]"),e[1],"string expected, ".concat(i," found"))));for(let a=2;a<e.length;a++)i=xe(e[a]),Ke(e[1])==="$type"?o=o.concat(va({key:"".concat(t,"[").concat(a,"]"),value:e[a],valueSpec:n.geometry_type,style:r.style,styleSpec:r.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new N("".concat(t,"[").concat(a,"]"),e[a],"string, number, or boolean expected, ".concat(i," found")));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(iw({key:"".concat(t,"[").concat(a,"]"),value:e[a],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":i=xe(e[1]),e.length!==2?o.push(new N(t,e,'filter array for "'.concat(e[0],'" operator must have 2 elements'))):i!=="string"&&o.push(new N("".concat(t,"[1]"),e[1],"string expected, ".concat(i," found")));break}return o}l(iw,"validateNonExpressionFilter");function ow(r,e){let t=r.key,n=r.validateSpec,i=r.style,o=r.styleSpec,a=r.value,s=r.objectKey,u=o["".concat(e,"_").concat(r.layerType)];if(!u)return[];let c=s.match(/^(.*)-transition$/);if(e==="paint"&&c&&u[c[1]]&&u[c[1]].transition)return n({key:t,value:a,valueSpec:o.transition,style:i,styleSpec:o});let p=r.valueSpec||u[s];if(!p)return[new N(t,a,'unknown property "'.concat(s,'"'))];let h;if(xe(a)==="string"&&gn(p)&&!p.tokens&&(h=/^{([^}]+)}$/.exec(a)))return[new N(t,a,'"'.concat(s,'" does not support interpolation syntax\n')+'Use an identity property function instead: `{ "type": "identity", "property": '.concat(JSON.stringify(h[1])," }`."))];let m=[];return r.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&m.push(new N(t,a,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&Gu(li(a))&&Ke(a.type)==="identity"&&m.push(new N(t,a,'"text-font" does not support identity functions'))),m.concat(n({key:r.key,value:a,valueSpec:p,style:i,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}l(ow,"validateProperty");function aw(r){return ow(r,"paint")}l(aw,"validatePaintProperty");function sw(r){return ow(r,"layout")}l(sw,"validateLayoutProperty");function lw(r){let e=[],t=r.value,n=r.key,i=r.style,o=r.styleSpec;if(xe(t)!=="object")return[new N(n,t,"object expected, ".concat(xe(t)," found"))];!t.type&&!t.ref&&e.push(new N(n,t,'either "type" or "ref" is required'));let a=Ke(t.type),s=Ke(t.ref);if(t.id){let u=Ke(t.id);for(let c=0;c<r.arrayIndex;c++){let p=i.layers[c];Ke(p.id)===u&&e.push(new N(n,t.id,'duplicate layer id "'.concat(t.id,'", previously used at line ').concat(p.id.__line__)))}}if("ref"in t){["type","source","source-layer","filter","layout"].forEach(c=>{c in t&&e.push(new N(n,t[c],'"'.concat(c,'" is prohibited for ref layers')))});let u;i.layers.forEach(c=>{Ke(c.id)===s&&(u=c)}),u?u.ref?e.push(new N(n,t.ref,"ref cannot reference another ref layer")):a=Ke(u.type):e.push(new N(n,t.ref,'ref layer "'.concat(s,'" not found')))}else if(a!=="background")if(!t.source)e.push(new N(n,t,'missing required property "source"'));else{let u=i.sources&&i.sources[t.source],c=u&&Ke(u.type);u?c==="vector"&&a==="raster"?e.push(new N(n,t.source,'layer "'.concat(t.id,'" requires a raster source'))):c!=="raster-dem"&&a==="hillshade"?e.push(new N(n,t.source,'layer "'.concat(t.id,'" requires a raster-dem source'))):c!=="raster-dem"&&a==="color-relief"?e.push(new N(n,t.source,'layer "'.concat(t.id,'" requires a raster-dem source'))):c==="raster"&&a!=="raster"?e.push(new N(n,t.source,'layer "'.concat(t.id,'" requires a vector source'))):c==="vector"&&!t["source-layer"]?e.push(new N(n,t,'layer "'.concat(t.id,'" must specify a "source-layer"'))):c==="raster-dem"&&a!=="hillshade"&&a!=="color-relief"?e.push(new N(n,t.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):a==="line"&&t.paint&&t.paint["line-gradient"]&&(c!=="geojson"||!u.lineMetrics)&&e.push(new N(n,t,'layer "'.concat(t.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):e.push(new N(n,t.source,'source "'.concat(t.source,'" not found')))}return e=e.concat(rr({key:n,value:t,valueSpec:o.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*"(){return[]},type(){return r.validateSpec({key:"".concat(n,".type"),value:t.type,valueSpec:o.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:t,objectKey:"type"})},filter:zf,layout(u){return rr({layer:t,key:u.key,value:u.value,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*"(c){return sw(Yi({layerType:a},c))}}})},paint(u){return rr({layer:t,key:u.key,value:u.value,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*"(c){return aw(Yi({layerType:a},c))}}})}}})),e}l(lw,"validateLayer");function ui(r){let e=r.value,t=r.key,n=xe(e);return n!=="string"?[new N(t,e,"string expected, ".concat(n," found"))]:[]}l(ui,"validateString");function SD(r){var e;let t=(e=r.sourceName)!==null&&e!==void 0?e:"",n=r.value,i=r.styleSpec,o=i.source_raster_dem,a=r.style,s=[],u=xe(n);if(n===void 0)return s;if(u!=="object")return s.push(new N("source_raster_dem",n,"object expected, ".concat(u," found"))),s;let p=Ke(n.encoding)==="custom",h=["redFactor","greenFactor","blueFactor","baseShift"],m=r.value.encoding?'"'.concat(r.value.encoding,'"'):"Default";for(let f in n)!p&&h.includes(f)?s.push(new N(f,n[f],'In "'.concat(t,'": "').concat(f,'" is only valid when "encoding" is set to "custom". ').concat(m," encoding found"))):o[f]?s=s.concat(r.validateSpec({key:f,value:n[f],valueSpec:o[f],validateSpec:r.validateSpec,style:a,styleSpec:i})):s.push(new N(f,n[f],'unknown property "'.concat(f,'"')));return s}l(SD,"validateRasterDEMSource");var A1={promoteId:MD};function uw(r){let e=r.value,t=r.key,n=r.styleSpec,i=r.style,o=r.validateSpec;if(!e.type)return[new N(t,e,'"type" is required')];let a=Ke(e.type),s;switch(a){case"vector":case"raster":return s=rr({key:t,value:e,valueSpec:n["source_".concat(a.replace("-","_"))],style:r.style,styleSpec:n,objectElementValidators:A1,validateSpec:o}),s;case"raster-dem":return s=SD({sourceName:t,value:e,style:r.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=rr({key:t,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:A1}),e.cluster)for(let u in e.clusterProperties){let[c,p]=e.clusterProperties[u],h=typeof c=="string"?[c,["accumulated"],["get",u]]:c;s.push(...Qi({key:"".concat(t,".").concat(u,".map"),value:p,expressionContext:"cluster-map"})),s.push(...Qi({key:"".concat(t,".").concat(u,".reduce"),value:h,expressionContext:"cluster-reduce"}))}return s;case"video":return rr({key:t,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return rr({key:t,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new N(t,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return va({key:"".concat(t,".type"),value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}l(uw,"validateSource");function MD({key:r,value:e}){if(xe(e)==="string")return ui({key:r,value:e});{let t=[];for(let n in e)t.push(...ui({key:"".concat(r,".").concat(n),value:e[n]}));return t}}l(MD,"validatePromoteId");function cw(r){let e=r.value,t=r.styleSpec,n=t.light,i=r.style,o=[],a=xe(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new N("light",e,"object expected, ".concat(a," found"))]),o;for(let s in e){let u=s.match(/^(.*)-transition$/);u&&n[u[1]]&&n[u[1]].transition?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:t.transition,validateSpec:r.validateSpec,style:i,styleSpec:t})):n[s]?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:r.validateSpec,style:i,styleSpec:t})):o=o.concat([new N(s,e[s],'unknown property "'.concat(s,'"'))])}return o}l(cw,"validateLight");function pw(r){let e=r.value,t=r.styleSpec,n=t.sky,i=r.style,o=xe(e);if(e===void 0)return[];if(o!=="object")return[new N("sky",e,"object expected, ".concat(o," found"))];let a=[];for(let s in e)n[s]?a=a.concat(r.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:t})):a=a.concat([new N(s,e[s],'unknown property "'.concat(s,'"'))]);return a}l(pw,"validateSky");function hw(r){let e=r.value,t=r.styleSpec,n=t.terrain,i=r.style,o=[],a=xe(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new N("terrain",e,"object expected, ".concat(a," found"))]),o;for(let s in e)n[s]?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:r.validateSpec,style:i,styleSpec:t})):o=o.concat([new N(s,e[s],'unknown property "'.concat(s,'"'))]);return o}l(hw,"validateTerrain");function CD(r){return ui(r).length===0?[]:Qi(r)}l(CD,"validateFormatted");function AD(r){return ui(r).length===0?[]:Qi(r)}l(AD,"validateImage");function ID(r){let e=r.key,t=r.value;if(xe(t)==="array"){if(t.length<1||t.length>4)return[new N(e,t,"padding requires 1 to 4 values; ".concat(t.length," values found"))];let i={type:"number"},o=[];for(let a=0;a<t.length;a++)o=o.concat(r.validateSpec({key:"".concat(e,"[").concat(a,"]"),value:t[a],validateSpec:r.validateSpec,valueSpec:i}));return o}else return qu({key:e,value:t,valueSpec:{}})}l(ID,"validatePadding");function ED(r){let e=r.key,t=r.value;if(xe(t)==="array"){let i={type:"number"};if(t.length<1)return[new N(e,t,"array length at least 1 expected, length 0 found")];let o=[];for(let a=0;a<t.length;a++)o=o.concat(r.validateSpec({key:"".concat(e,"[").concat(a,"]"),value:t[a],validateSpec:r.validateSpec,valueSpec:i}));return o}else return qu({key:e,value:t,valueSpec:{}})}l(ED,"validateNumberArray");function LD(r){let e=r.key,t=r.value;if(xe(t)==="array"){if(t.length<1)return[new N(e,t,"array length at least 1 expected, length 0 found")];let i=[];for(let o=0;o<t.length;o++)i=i.concat(Sf({key:"".concat(e,"[").concat(o,"]"),value:t[o]}));return i}else return Sf({key:e,value:t})}l(LD,"validateColorArray");function kD(r){let e=r.key,t=r.value,n=xe(t),i=r.styleSpec;if(n!=="array"||t.length<1||t.length%2!==0)return[new N(e,t,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<t.length;a+=2)o=o.concat(va({key:"".concat(e,"[").concat(a,"]"),value:t[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(Ff({key:"".concat(e,"[").concat(a+1,"]"),value:t[a+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:i}));return o}l(kD,"validateVariableAnchorOffsetCollection");function mw(r){let e=[],t=r.value,n=r.key;if(Array.isArray(t)){let i=[],o=[];for(let a in t){t[a].id&&i.includes(t[a].id)&&e.push(new N(n,t,"all the sprites' ids must be unique, but ".concat(t[a].id," is duplicated"))),i.push(t[a].id),t[a].url&&o.includes(t[a].url)&&e.push(new N(n,t,"all the sprites' URLs must be unique, but ".concat(t[a].url," is duplicated"))),o.push(t[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(rr({key:"".concat(n,"[").concat(a,"]"),value:t[a],valueSpec:s,validateSpec:r.validateSpec}))}return e}else return ui({key:n,value:t})}l(mw,"validateSprite");function RD(r){let e=r.value,t=r.styleSpec,n=t.projection,i=r.style,o=xe(e);if(e===void 0)return[];if(o!=="object")return[new N("projection",e,"object expected, ".concat(o," found"))];let a=[];for(let s in e)n[s]?a=a.concat(r.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:t})):a=a.concat([new N(s,e[s],'unknown property "'.concat(s,'"'))]);return a}l(RD,"validateProjection");function DD(r){let e=r.key,t=r.value;t=t instanceof String?t.valueOf():t;let n=xe(t);return n==="array"&&!zD(t)&&!FD(t)?[new N(e,t,"projection expected, invalid array ".concat(JSON.stringify(t)," found"))]:["array","string"].includes(n)?[]:[new N(e,t,'projection expected, invalid type "'.concat(n,'" found'))]}l(DD,"validateProjectionDefinition");function FD(r){return!!["interpolate","step","literal"].includes(r[0])}l(FD,"isPropertyValueSpecification");function zD(r){return Array.isArray(r)&&r.length===3&&typeof r[0]=="string"&&typeof r[1]=="string"&&typeof r[2]=="number"}l(zD,"isProjectionDefinitionValue");function BD(r){return!!r&&r.constructor===Object}l(BD,"isObjectLiteral");function fw(r){return BD(r.value)?[]:[new N(r.key,r.value,"object expected, ".concat(xe(r.value)," found"))]}l(fw,"validateState");var I1={"*"(){return[]},array:Ff,boolean:TD,number:qu,color:Sf,constants:rw,enum:va,filter:zf,function:nw,layer:lw,object:rr,source:uw,light:cw,sky:pw,terrain:hw,projection:RD,projectionDefinition:DD,string:ui,formatted:CD,resolvedImage:AD,padding:ID,numberArray:ED,colorArray:LD,variableAnchorOffsetCollection:kD,sprite:mw,state:fw};function mu(r){let e=r.value,t=r.valueSpec,n=r.styleSpec;return r.validateSpec=mu,t.expression&&Gu(Ke(e))?nw(r):t.expression&&Ma(li(e))?Qi(r):t.type&&I1[t.type]?I1[t.type](r):rr(Yi({},r,{valueSpec:t.type?n[t.type]:t}))}l(mu,"validate");function dw(r){let e=r.value,t=r.key,n=ui(r);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new N(t,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&n.push(new N(t,e,'"glyphs" url must include a "{range}" token'))),n}l(dw,"validateGlyphsUrl");function Nt(r,e=E){let t=[];return t=t.concat(mu({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:mu,objectElementValidators:{glyphs:dw,"*"(){return[]}}})),r.constants&&(t=t.concat(rw({key:"constants",value:r.constants}))),yw(t)}l(Nt,"validateStyleMin");Nt.source=fr(mr(uw));Nt.sprite=fr(mr(mw));Nt.glyphs=fr(mr(dw));Nt.light=fr(mr(cw));Nt.sky=fr(mr(pw));Nt.terrain=fr(mr(hw));Nt.state=fr(mr(fw));Nt.layer=fr(mr(lw));Nt.filter=fr(mr(zf));Nt.paintProperty=fr(mr(aw));Nt.layoutProperty=fr(mr(sw));function mr(r){return function(e){return r(St($e({},e),{validateSpec:mu}))}}l(mr,"injectValidateSpec");function yw(r){return[].concat(r).sort((e,t)=>e.line-t.line)}l(yw,"sortErrors");function fr(r){return function(...e){return yw(r.apply(this,e))}}l(fr,"wrapCleanErrors");y();var je=Nt,FV=je.source,gw=je.light,xw=je.sky,zV=je.terrain,BV=je.filter,_w=je.paintProperty,bw=je.layoutProperty;function bn(r,e){let t=!1;if(e&&e.length)for(let n of e)r.fire(new J(new Error(n.message))),t=!0;return t}l(bn,"emitValidationErrors");y();y();y();var Hu=class Hu{constructor(e,t,n){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],t=a[1],n=a[2],this.d=t+2*n;for(let c=0;c<this.d*this.d;c++){let p=a[3+c],h=a[3+c+1];i.push(p===h?null:a.subarray(p,h))}let s=a[3+i.length],u=a[3+i.length+1];this.keys=a.subarray(s,u),this.bboxes=a.subarray(u),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;let o=n/t*e;this.min=-o,this.max=e+o}insert(e,t,n,i,o){this._forEachCell(t,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,n,i,o,a){this.cells[o].push(a)}query(e,t,n,i,o){let a=this.min,s=this.max;if(e<=a&&t<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let u=[],c={};return this._forEachCell(e,t,n,i,this._queryCell,u,c,o),u}}_queryCell(e,t,n,i,o,a,s,u){let c=this.cells[o];if(c!==null){let p=this.keys,h=this.bboxes;for(let m=0;m<c.length;m++){let f=c[m];if(s[f]===void 0){let d=f*4;(u?u(h[d+0],h[d+1],h[d+2],h[d+3]):e<=h[d+2]&&t<=h[d+3]&&n>=h[d+0]&&i>=h[d+1])?(s[f]=!0,a.push(p[f])):s[f]=!1}}}}_forEachCell(e,t,n,i,o,a,s,u){let c=this._convertToCellCoord(e),p=this._convertToCellCoord(t),h=this._convertToCellCoord(n),m=this._convertToCellCoord(i);for(let f=c;f<=h;f++)for(let d=p;d<=m;d++){let g=this.d*d+f;if(!(u&&!u(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&o.call(this,e,t,n,i,g,a,s,u))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,t=3+this.cells.length+1+1,n=0;for(let a=0;a<this.cells.length;a++)n+=this.cells[a].length;let i=new Int32Array(t+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=t;for(let a=0;a<e.length;a++){let s=e[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+e.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+e.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(e,t){let n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new Hu(e.buffer)}};l(Hu,"TransferableGridIndex");var pi=Hu;var qr={};function Z(r,e,t={}){if(qr[r])throw new Error("".concat(r," is already registered."));Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),qr[r]={klass:e,omit:t.omit||[],shallow:t.shallow||[]}}l(Z,"register");Z("Object",Object);Z("Set",Set);Z("TransferableGridIndex",pi);Z("Color",Y);Z("Error",Error);Z("AJAXError",un);Z("ResolvedImage",Et);Z("StylePropertyFunction",ba);Z("StyleExpression",si,{omit:["_evaluator"]});Z("ZoomDependentExpression",xn);Z("ZoomConstantExpression",Er);Z("CompoundExpression",Ir,{omit:["_evaluate"]});for(let r in ci)ci[r]._classRegistryKey||Z("Expression_".concat(r),ci[r]);function vw(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}l(vw,"isArrayBuffer");function $f(r){let e=r.constructor;return r.$name||e._classRegistryKey}l($f,"getClassRegistryKey");function OD(r){if(r===null||typeof r!="object")return!1;let e=$f(r);return!!(e&&e!=="Object")}l(OD,"isRegistered");function ww(r){return!OD(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||vw(r)||At(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}l(ww,"isSerializeHandledByBuiltin");function io(r,e){if(ww(r)){if((vw(r)||At(r))&&e&&e.push(r),ArrayBuffer.isView(r)){let o=r;e&&e.push(o.buffer)}return r instanceof ImageData&&e&&e.push(r.data.buffer),r}if(Array.isArray(r)){let o=[];for(let a of r)o.push(io(a,e));return o}if(typeof r!="object")throw new Error("can't serialize object of type ".concat(typeof r));let t=$f(r);if(!t)throw new Error("can't serialize object of unregistered class ".concat(r.constructor.name));if(!qr[t])throw new Error("".concat(t," is not registered."));let{klass:n}=qr[t],i=n.serialize?n.serialize(r,e):{};if(n.serialize){if(e&&i===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let o in r){if(!r.hasOwnProperty(o)||qr[t].omit.indexOf(o)>=0)continue;let a=r[o];i[o]=qr[t].shallow.indexOf(o)>=0?a:io(a,e)}r instanceof Error&&(i.message=r.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return t!=="Object"&&(i.$name=t),i}l(io,"serialize");function oo(r){if(ww(r))return r;if(Array.isArray(r))return r.map(oo);if(typeof r!="object")throw new Error("can't deserialize object of type ".concat(typeof r));let e=$f(r)||"Object";if(!qr[e])throw new Error("can't deserialize unregistered class ".concat(e));let{klass:t}=qr[e];if(!t)throw new Error("can't deserialize unregistered class ".concat(e));if(t.deserialize)return t.deserialize(r);let n=Object.create(t.prototype);for(let i of Object.keys(r)){if(i==="$name")continue;let o=r[i];n[i]=qr[e].shallow.indexOf(i)>=0?o:oo(o)}return n}l(oo,"deserialize");y();y();var Xf=class Xf{constructor(){this.first=!0}update(e,t){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=t),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=n,!0):!1)}};l(Xf,"ZoomHistory");var hi=Xf;y();y();var et={"Latin-1 Supplement":l(r=>r>=128&&r<=255,"Latin-1 Supplement"),"Hangul Jamo":l(r=>r>=4352&&r<=4607,"Hangul Jamo"),Khmer:l(r=>r>=6016&&r<=6143,"Khmer"),"General Punctuation":l(r=>r>=8192&&r<=8303,"General Punctuation"),"Letterlike Symbols":l(r=>r>=8448&&r<=8527,"Letterlike Symbols"),"Number Forms":l(r=>r>=8528&&r<=8591,"Number Forms"),"Miscellaneous Technical":l(r=>r>=8960&&r<=9215,"Miscellaneous Technical"),"Control Pictures":l(r=>r>=9216&&r<=9279,"Control Pictures"),"Optical Character Recognition":l(r=>r>=9280&&r<=9311,"Optical Character Recognition"),"Enclosed Alphanumerics":l(r=>r>=9312&&r<=9471,"Enclosed Alphanumerics"),"Geometric Shapes":l(r=>r>=9632&&r<=9727,"Geometric Shapes"),"Miscellaneous Symbols":l(r=>r>=9728&&r<=9983,"Miscellaneous Symbols"),"Miscellaneous Symbols and Arrows":l(r=>r>=11008&&r<=11263,"Miscellaneous Symbols and Arrows"),"Ideographic Description Characters":l(r=>r>=12272&&r<=12287,"Ideographic Description Characters"),"CJK Symbols and Punctuation":l(r=>r>=12288&&r<=12351,"CJK Symbols and Punctuation"),Hiragana:l(r=>r>=12352&&r<=12447,"Hiragana"),Katakana:l(r=>r>=12448&&r<=12543,"Katakana"),Kanbun:l(r=>r>=12688&&r<=12703,"Kanbun"),"CJK Strokes":l(r=>r>=12736&&r<=12783,"CJK Strokes"),"Enclosed CJK Letters and Months":l(r=>r>=12800&&r<=13055,"Enclosed CJK Letters and Months"),"CJK Compatibility":l(r=>r>=13056&&r<=13311,"CJK Compatibility"),"Yijing Hexagram Symbols":l(r=>r>=19904&&r<=19967,"Yijing Hexagram Symbols"),"CJK Unified Ideographs":l(r=>r>=19968&&r<=40959,"CJK Unified Ideographs"),"Hangul Syllables":l(r=>r>=44032&&r<=55215,"Hangul Syllables"),"Private Use Area":l(r=>r>=57344&&r<=63743,"Private Use Area"),"Vertical Forms":l(r=>r>=65040&&r<=65055,"Vertical Forms"),"CJK Compatibility Forms":l(r=>r>=65072&&r<=65103,"CJK Compatibility Forms"),"Small Form Variants":l(r=>r>=65104&&r<=65135,"Small Form Variants"),"Halfwidth and Fullwidth Forms":l(r=>r>=65280&&r<=65519,"Halfwidth and Fullwidth Forms")};function Yf(r){for(let e of r)if(Pw(e.charCodeAt(0)))return!0;return!1}l(Yf,"allowsVerticalWritingMode");function Kf(r){let e=r.map(t=>{try{return new RegExp("\\p{sc=".concat(t,"}"),"u").source}catch(n){return null}}).filter(t=>t);return new RegExp(e.join("|"),"u")}l(Kf,"sanitizedRegExpFromScriptCodes");var VD=["Arab","Dupl","Mong","Ougr","Syrc"],iU=Kf(VD);var UD=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],jD=Kf(UD);function Pw(r){return r===746||r===747?!0:r<4352?!1:!!(et["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||et["CJK Compatibility"](r)||et["CJK Strokes"](r)||et["CJK Symbols and Punctuation"](r)&&!(r>=12296&&r<=12305)&&!(r>=12308&&r<=12319)&&r!==12336||et["Enclosed CJK Letters and Months"](r)||et["Ideographic Description Characters"](r)||et.Kanbun(r)||et.Katakana(r)&&r!==12540||et["Halfwidth and Fullwidth Forms"](r)&&r!==65288&&r!==65289&&r!==65293&&!(r>=65306&&r<=65310)&&r!==65339&&r!==65341&&r!==65343&&!(r>=65371&&r<=65503)&&r!==65507&&!(r>=65512&&r<=65519)||et["Small Form Variants"](r)&&!(r>=65112&&r<=65118)&&!(r>=65123&&r<=65126)||et["Vertical Forms"](r)||et["Yijing Hexagram Symbols"](r)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(r))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(r))||jD.test(String.fromCodePoint(r)))}l(Pw,"charHasUprightVerticalOrientation");var ND=["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"],GD=Kf(ND);function Tw(r){return GD.test(String.fromCodePoint(r))}l(Tw,"charInRTLScript");function ZD(r,e){return!(!e&&Tw(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||et.Khmer(r))}l(ZD,"charInSupportedScript");function Sw(r){for(let e of r)if(Tw(e.charCodeAt(0)))return!0;return!1}l(Sw,"stringContainsRTLText");function Mw(r,e){for(let t of r)if(!ZD(t.charCodeAt(0),e))return!1;return!0}l(Mw,"isStringInSupportedScript");y();var Qf=class Qf{constructor(){this.TIMEOUT=5e3;this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null;this.loadScriptResolve=l(()=>{},"loadScriptResolve")}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Lr.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let n=e.pluginURL,i=new Promise(s=>{this.loadScriptResolve=s});t(n);let o=new Promise(s=>setTimeout(()=>s(),this.TIMEOUT));if(await Promise.race([i,o]),this.isParsed()){let s={pluginStatus:"loaded",pluginURL:n};return this.setState(s),s}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error("RTL Text Plugin failed to import scripts from ".concat(n))}};l(Qf,"RTLWorkerPlugin");var Jf=Qf,Lr=new Jf;var ed=class ed{constructor(e,t){this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new hi,this.transition=t.transition||{},this.globalState=t.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new hi,this.transition={},this.globalState={})}isSupportedScript(e){return Mw(e,Lr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*t}}};l(ed,"EvaluationParameters");var ve=ed;var td=class td{constructor(e,t){this.property=e,this.value=t,this.expression=Q1(t===void 0?e.specification.default:t,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}};l(td,"PropertyValue");var ao=td,rd=class rd{constructor(e){this.property=e,this.value=new ao(e,void 0)}transitioned(e,t){return new Wu(this.property,this.value,t,G({},e.transition,this.transition),e.now)}untransitioned(){return new Wu(this.property,this.value,null,{},0)}};l(rd,"TransitionablePropertyValue");var Ca=rd,nd=class nd{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return yt(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ca(this._values[e].property)),this._values[e].value=new ao(this._values[e].property,t===null?void 0:yt(t))}getTransition(e){return yt(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ca(this._values[e].property)),this._values[e].transition=yt(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n);let i=this.getTransition(t);i!==void 0&&(e["".concat(t,"-transition")]=i)}return e}transitioned(e,t){let n=new $u(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(e,t._values[i]);return n}untransitioned(){let e=new $u(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}};l(nd,"Transitionable");var kr=nd,id=class id{constructor(e,t,n,i,o){this.property=e,this.value=t,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){let i=e.now||0,o=this.value.possiblyEvaluate(e,t,n),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(e,t,n);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,n),o,Vl(s))}}else return o}};l(id,"TransitioningPropertyValue");var Wu=id,od=class od{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){let i=new vn(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,t,n);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}};l(od,"Transitioning");var $u=od,ad=class ad{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return yt(this._values[e].value)}setValue(e,t){this._values[e]=new ao(this._values[e].property,t===null?void 0:yt(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n)}return e}possiblyEvaluate(e,t,n){let i=new vn(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,t,n);return i}};l(ad,"Layout");var Xu=ad,sd=class sd{constructor(e,t,n){this.property=e,this.value=t,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,t,n,i){return this.property.evaluate(this.value,this.parameters,e,t,n,i)}};l(sd,"PossiblyEvaluatedPropertyValue");var gt=sd,ld=class ld{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}};l(ld,"PossiblyEvaluated");var vn=ld,ud=class ud{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,n){let i=this.specification.type,o=Ae[i];return o?o(e,t,n):e}};l(ud,"DataConstantProperty");var q=ud,cd=class cd{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,i){return e.expression.kind==="constant"||e.expression.kind==="camera"?new gt(this,{kind:"constant",value:e.expression.evaluate(t,null,{},n,i)},t):new gt(this,e.expression,t)}interpolate(e,t,n){if(e.value.kind!=="constant"||t.value.kind!=="constant")return e;if(e.value.value===void 0||t.value.value===void 0)return new gt(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=Ae[i];if(o){let a=o(e.value.value,t.value.value,n);return new gt(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,t,n,i,o,a){return e.kind==="constant"?e.value:e.evaluate(t,n,i,o,a)}};l(cd,"DataDrivenProperty");var ee=cd,pd=class pd extends ee{possiblyEvaluate(e,t,n,i){if(e.value===void 0)return new gt(this,{kind:"constant",value:void 0},t);if(e.expression.kind==="constant"){let o=e.expression.evaluate(t,null,{},n,i),s=e.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,u=this._calculate(s,s,s,t);return new gt(this,{kind:"constant",value:u},t)}else if(e.expression.kind==="camera"){let o=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new gt(this,{kind:"constant",value:o},t)}else return new gt(this,e.expression,t)}evaluate(e,t,n,i,o,a){if(e.kind==="source"){let s=e.evaluate(t,n,i,o,a);return this._calculate(s,s,s,t)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,i),e.evaluate({zoom:Math.floor(t.zoom)},n,i),e.evaluate({zoom:Math.floor(t.zoom)+1},n,i),t):e.value}_calculate(e,t,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}};l(pd,"CrossFadedDataDrivenProperty");var Hr=pd,hd=class hd{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,i){if(e.value!==void 0)if(e.expression.kind==="constant"){let o=e.expression.evaluate(t,null,{},n,i);return this._calculate(o,o,o,t)}else return this._calculate(e.expression.evaluate(new ve(Math.floor(t.zoom-1),t)),e.expression.evaluate(new ve(Math.floor(t.zoom),t)),e.expression.evaluate(new ve(Math.floor(t.zoom+1),t)),t)}_calculate(e,t,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}};l(hd,"CrossFadedProperty");var mi=hd,md=class md{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,i){return!!e.expression.evaluate(t,null,{},n,i)}interpolate(){return!1}};l(md,"ColorRampProperty");var Wr=md,fd=class fd{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let n=e[t];n.specification.overridable&&this.overridableProperties.push(t);let i=this.defaultPropertyValues[t]=new ao(n,void 0),o=this.defaultTransitionablePropertyValues[t]=new Ca(n);this.defaultTransitioningPropertyValues[t]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=i.possiblyEvaluate({})}}};l(fd,"Properties");var ke=fd;Z("DataDrivenProperty",ee);Z("DataConstantProperty",q);Z("CrossFadedDataDrivenProperty",Hr);Z("CrossFadedProperty",mi);Z("ColorRampProperty",Wr);var Yu="-transition",dd=class dd extends be{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:l(()=>!0,"filter"),needGeometry:!1,getGlobalStateRefs:l(()=>new Set,"getGlobalStateRefs")},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=_n(e.filter)),t.layout&&(this._unevaluatedLayout=new Xu(t.layout)),t.paint)){this._transitionablePaint=new kr(t.paint);for(let n in e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(let n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new vn(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=_n(e)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let n=this._unevaluatedLayout._values[t];for(let i of n.getGlobalStateRefs())e.add(i)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}setLayoutProperty(e,t,n={}){if(t!=null){let i="layers.".concat(this.id,".layout.").concat(e);if(this._validate(bw,i,e,t,n))return}if(e==="visibility"){this.visibility=t;return}this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){return e.endsWith(Yu)?this._transitionablePaint.getTransition(e.slice(0,-Yu.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(t!=null){let i="layers.".concat(this.id,".paint.").concat(e);if(this._validate(_w,i,e,t,n))return!1}if(e.endsWith(Yu))return this._transitionablePaint.setTransition(e.slice(0,-Yu.length),t||void 0),!1;{let i=this._transitionablePaint._values[e],o=i.property.specification["property-type"]==="cross-faded-data-driven",a=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let u=this._transitionablePaint._values[e].value;return u.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(e,s,u)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),jl(e,(t,n)=>t!==void 0&&!(n==="layout"&&!Object.keys(t).length)&&!(n==="paint"&&!Object.keys(t).length))}_validate(e,t,n,i,o={}){return o&&o.validate===!1?!1:bn(this,e.call(je,{key:t,layerType:this.type,objectKey:n,value:i,styleSpec:E,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(!(!(t instanceof gt)||!gn(t.property.specification))&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}return!1}};l(dd,"StyleLayer");var He=dd;y();y();y();var qD={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},yd=class yd{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}};l(yd,"Struct");var wn=yd,HD=128,WD=5,gd=class gd{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*WD),HD),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};l(gd,"StructArray");var Be=gd;function Ee(r,e=1){let t=0,n=0,i=r.map(a=>{let s=$D(a.type),u=t=Cw(t,Math.max(e,s)),c=a.components||1;return n=Math.max(n,s),t+=s*c,{name:a.name,type:a.type,components:c,offset:u}}),o=Cw(t,Math.max(n,e));return{members:i,size:o,alignment:e}}l(Ee,"createLayout");function $D(r){return qD[r].BYTES_PER_ELEMENT}l($D,"sizeOf");function Cw(r,e){return Math.ceil(r/e)*e}l(Cw,"align");var Aw=oe(ue(),1);var xd=class xd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let i=e*2;return this.int16[i+0]=t,this.int16[i+1]=n,e}};l(xd,"StructArrayLayout2i4");var fi=xd;fi.prototype.bytesPerElement=4;Z("StructArrayLayout2i4",fi);var _d=class _d extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n)}emplace(e,t,n,i){let o=e*3;return this.int16[o+0]=t,this.int16[o+1]=n,this.int16[o+2]=i,e}};l(_d,"StructArrayLayout3i6");var so=_d;so.prototype.bytesPerElement=6;Z("StructArrayLayout3i6",so);var bd=class bd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,i)}emplace(e,t,n,i,o){let a=e*4;return this.int16[a+0]=t,this.int16[a+1]=n,this.int16[a+2]=i,this.int16[a+3]=o,e}};l(bd,"StructArrayLayout4i8");var Aa=bd;Aa.prototype.bytesPerElement=8;Z("StructArrayLayout4i8",Aa);var vd=class vd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,n,i,o,a)}emplace(e,t,n,i,o,a,s){let u=e*6;return this.int16[u+0]=t,this.int16[u+1]=n,this.int16[u+2]=i,this.int16[u+3]=o,this.int16[u+4]=a,this.int16[u+5]=s,e}};l(vd,"StructArrayLayout2i4i12");var Ia=vd;Ia.prototype.bytesPerElement=12;Z("StructArrayLayout2i4i12",Ia);var wd=class wd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,n,i,o,a)}emplace(e,t,n,i,o,a,s){let u=e*4,c=e*8;return this.int16[u+0]=t,this.int16[u+1]=n,this.uint8[c+4]=i,this.uint8[c+5]=o,this.uint8[c+6]=a,this.uint8[c+7]=s,e}};l(wd,"StructArrayLayout2i4ub8");var Ea=wd;Ea.prototype.bytesPerElement=8;Z("StructArrayLayout2i4ub8",Ea);var Pd=class Pd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let i=e*2;return this.float32[i+0]=t,this.float32[i+1]=n,e}};l(Pd,"StructArrayLayout2f8");var Pn=Pd;Pn.prototype.bytesPerElement=8;Z("StructArrayLayout2f8",Pn);var Td=class Td extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a,s,u,c,p){let h=this.length;return this.resize(h+1),this.emplace(h,e,t,n,i,o,a,s,u,c,p)}emplace(e,t,n,i,o,a,s,u,c,p,h){let m=e*10;return this.uint16[m+0]=t,this.uint16[m+1]=n,this.uint16[m+2]=i,this.uint16[m+3]=o,this.uint16[m+4]=a,this.uint16[m+5]=s,this.uint16[m+6]=u,this.uint16[m+7]=c,this.uint16[m+8]=p,this.uint16[m+9]=h,e}};l(Td,"StructArrayLayout10ui20");var La=Td;La.prototype.bytesPerElement=20;Z("StructArrayLayout10ui20",La);var Sd=class Sd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a,s,u,c,p,h,m){let f=this.length;return this.resize(f+1),this.emplace(f,e,t,n,i,o,a,s,u,c,p,h,m)}emplace(e,t,n,i,o,a,s,u,c,p,h,m,f){let d=e*12;return this.int16[d+0]=t,this.int16[d+1]=n,this.int16[d+2]=i,this.int16[d+3]=o,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=u,this.uint16[d+7]=c,this.int16[d+8]=p,this.int16[d+9]=h,this.int16[d+10]=m,this.int16[d+11]=f,e}};l(Sd,"StructArrayLayout4i4ui4i24");var ka=Sd;ka.prototype.bytesPerElement=24;Z("StructArrayLayout4i4ui4i24",ka);var Md=class Md extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n)}emplace(e,t,n,i){let o=e*3;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=i,e}};l(Md,"StructArrayLayout3f12");var Ra=Md;Ra.prototype.bytesPerElement=12;Z("StructArrayLayout3f12",Ra);var Cd=class Cd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let n=e*1;return this.uint32[n+0]=t,e}};l(Cd,"StructArrayLayout1ul4");var Da=Cd;Da.prototype.bytesPerElement=4;Z("StructArrayLayout1ul4",Da);var Ad=class Ad extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a,s,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,i,o,a,s,u,c)}emplace(e,t,n,i,o,a,s,u,c,p){let h=e*10,m=e*5;return this.int16[h+0]=t,this.int16[h+1]=n,this.int16[h+2]=i,this.int16[h+3]=o,this.int16[h+4]=a,this.int16[h+5]=s,this.uint32[m+3]=u,this.uint16[h+8]=c,this.uint16[h+9]=p,e}};l(Ad,"StructArrayLayout6i1ul2ui20");var Fa=Ad;Fa.prototype.bytesPerElement=20;Z("StructArrayLayout6i1ul2ui20",Fa);var Id=class Id extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,n,i,o,a)}emplace(e,t,n,i,o,a,s){let u=e*6;return this.int16[u+0]=t,this.int16[u+1]=n,this.int16[u+2]=i,this.int16[u+3]=o,this.int16[u+4]=a,this.int16[u+5]=s,e}};l(Id,"StructArrayLayout2i2i2i12");var za=Id;za.prototype.bytesPerElement=12;Z("StructArrayLayout2i2i2i12",za);var Ed=class Ed extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,i,o)}emplace(e,t,n,i,o,a){let s=e*4,u=e*8;return this.float32[s+0]=t,this.float32[s+1]=n,this.float32[s+2]=i,this.int16[u+6]=o,this.int16[u+7]=a,e}};l(Ed,"StructArrayLayout2f1f2i16");var Ba=Ed;Ba.prototype.bytesPerElement=16;Z("StructArrayLayout2f1f2i16",Ba);var Ld=class Ld extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,n,i,o,a)}emplace(e,t,n,i,o,a,s){let u=e*16,c=e*4,p=e*8;return this.uint8[u+0]=t,this.uint8[u+1]=n,this.float32[c+1]=i,this.float32[c+2]=o,this.int16[p+6]=a,this.int16[p+7]=s,e}};l(Ld,"StructArrayLayout2ub2f2i16");var Oa=Ld;Oa.prototype.bytesPerElement=16;Z("StructArrayLayout2ub2f2i16",Oa);var kd=class kd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n)}emplace(e,t,n,i){let o=e*3;return this.uint16[o+0]=t,this.uint16[o+1]=n,this.uint16[o+2]=i,e}};l(kd,"StructArrayLayout3ui6");var lo=kd;lo.prototype.bytesPerElement=6;Z("StructArrayLayout3ui6",lo);var Rd=class Rd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a,s,u,c,p,h,m,f,d,g,x,_){let b=this.length;return this.resize(b+1),this.emplace(b,e,t,n,i,o,a,s,u,c,p,h,m,f,d,g,x,_)}emplace(e,t,n,i,o,a,s,u,c,p,h,m,f,d,g,x,_,b){let v=e*24,w=e*12,T=e*48;return this.int16[v+0]=t,this.int16[v+1]=n,this.uint16[v+2]=i,this.uint16[v+3]=o,this.uint32[w+2]=a,this.uint32[w+3]=s,this.uint32[w+4]=u,this.uint16[v+10]=c,this.uint16[v+11]=p,this.uint16[v+12]=h,this.float32[w+7]=m,this.float32[w+8]=f,this.uint8[T+36]=d,this.uint8[T+37]=g,this.uint8[T+38]=x,this.uint32[w+10]=_,this.int16[v+22]=b,e}};l(Rd,"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48");var Va=Rd;Va.prototype.bytesPerElement=48;Z("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Va);var Dd=class Dd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a,s,u,c,p,h,m,f,d,g,x,_,b,v,w,T,S,A,M,I,L,D,F){let U=this.length;return this.resize(U+1),this.emplace(U,e,t,n,i,o,a,s,u,c,p,h,m,f,d,g,x,_,b,v,w,T,S,A,M,I,L,D,F)}emplace(e,t,n,i,o,a,s,u,c,p,h,m,f,d,g,x,_,b,v,w,T,S,A,M,I,L,D,F,U){let C=e*32,k=e*16;return this.int16[C+0]=t,this.int16[C+1]=n,this.int16[C+2]=i,this.int16[C+3]=o,this.int16[C+4]=a,this.int16[C+5]=s,this.int16[C+6]=u,this.int16[C+7]=c,this.uint16[C+8]=p,this.uint16[C+9]=h,this.uint16[C+10]=m,this.uint16[C+11]=f,this.uint16[C+12]=d,this.uint16[C+13]=g,this.uint16[C+14]=x,this.uint16[C+15]=_,this.uint16[C+16]=b,this.uint16[C+17]=v,this.uint16[C+18]=w,this.uint16[C+19]=T,this.uint16[C+20]=S,this.uint16[C+21]=A,this.uint16[C+22]=M,this.uint32[k+12]=I,this.float32[k+13]=L,this.float32[k+14]=D,this.uint16[C+30]=F,this.uint16[C+31]=U,e}};l(Dd,"StructArrayLayout8i15ui1ul2f2ui64");var Ua=Dd;Ua.prototype.bytesPerElement=64;Z("StructArrayLayout8i15ui1ul2f2ui64",Ua);var Fd=class Fd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let n=e*1;return this.float32[n+0]=t,e}};l(Fd,"StructArrayLayout1f4");var di=Fd;di.prototype.bytesPerElement=4;Z("StructArrayLayout1f4",di);var zd=class zd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n)}emplace(e,t,n,i){let o=e*6,a=e*3;return this.uint16[o+0]=t,this.float32[a+1]=n,this.float32[a+2]=i,e}};l(zd,"StructArrayLayout1ui2f12");var ja=zd;ja.prototype.bytesPerElement=12;Z("StructArrayLayout1ui2f12",ja);var Bd=class Bd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n)}emplace(e,t,n,i){let o=e*2,a=e*4;return this.uint32[o+0]=t,this.uint16[a+2]=n,this.uint16[a+3]=i,e}};l(Bd,"StructArrayLayout1ul2ui8");var Na=Bd;Na.prototype.bytesPerElement=8;Z("StructArrayLayout1ul2ui8",Na);var Od=class Od extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let i=e*2;return this.uint16[i+0]=t,this.uint16[i+1]=n,e}};l(Od,"StructArrayLayout2ui4");var Ga=Od;Ga.prototype.bytesPerElement=4;Z("StructArrayLayout2ui4",Ga);var Vd=class Vd extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let n=e*1;return this.uint16[n+0]=t,e}};l(Vd,"StructArrayLayout1ui2");var Za=Vd;Za.prototype.bytesPerElement=2;Z("StructArrayLayout1ui2",Za);var Ud=class Ud extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,i)}emplace(e,t,n,i,o){let a=e*4;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=i,this.float32[a+3]=o,e}};l(Ud,"StructArrayLayout4f16");var uo=Ud;uo.prototype.bytesPerElement=16;Z("StructArrayLayout4f16",uo);var jd=class jd extends wn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Aw.default(this.anchorPointX,this.anchorPointY)}};l(jd,"CollisionBoxStruct");var Ku=jd;Ku.prototype.size=20;var Nd=class Nd extends Fa{get(e){return new Ku(this,e)}};l(Nd,"CollisionBoxArray");var qa=Nd;Z("CollisionBoxArray",qa);var Gd=class Gd extends wn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};l(Gd,"PlacedSymbolStruct");var Ju=Gd;Ju.prototype.size=48;var Zd=class Zd extends Va{get(e){return new Ju(this,e)}};l(Zd,"PlacedSymbolArray");var Ha=Zd;Z("PlacedSymbolArray",Ha);var qd=class qd extends wn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};l(qd,"SymbolInstanceStruct");var Qu=qd;Qu.prototype.size=64;var Hd=class Hd extends Ua{get(e){return new Qu(this,e)}};l(Hd,"SymbolInstanceArray");var Wa=Hd;Z("SymbolInstanceArray",Wa);var Wd=class Wd extends di{getoffsetX(e){return this.float32[e*1+0]}};l(Wd,"GlyphOffsetArray");var $a=Wd;Z("GlyphOffsetArray",$a);var $d=class $d extends so{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};l($d,"SymbolLineVertexArray");var Xa=$d;Z("SymbolLineVertexArray",Xa);var Xd=class Xd extends wn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};l(Xd,"TextAnchorOffsetStruct");var ec=Xd;ec.prototype.size=12;var Yd=class Yd extends ja{get(e){return new ec(this,e)}};l(Yd,"TextAnchorOffsetArray");var Ya=Yd;Z("TextAnchorOffsetArray",Ya);var Kd=class Kd extends wn{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]}};l(Kd,"FeatureIndexStruct");var tc=Kd;tc.prototype.size=8;var Jd=class Jd extends Na{get(e){return new tc(this,e)}};l(Jd,"FeatureIndexArray");var Ka=Jd;Z("FeatureIndexArray",Ka);var Qd=class Qd extends fi{};l(Qd,"PosArray");var mt=Qd,ey=class ey extends so{};l(ey,"Pos3dArray");var rc=ey,ty=class ty extends Aa{};l(ty,"RasterBoundsArray");var nc=ty,ry=class ry extends fi{};l(ry,"CircleLayoutArray");var ic=ry,ny=class ny extends fi{};l(ny,"FillLayoutArray");var oc=ny,iy=class iy extends Ia{};l(iy,"FillExtrusionLayoutArray");var ac=iy;var oy=class oy extends Ea{};l(oy,"LineLayoutArray");var sc=oy,ay=class ay extends Pn{};l(ay,"LineExtLayoutArray");var lc=ay,sy=class sy extends La{};l(sy,"PatternLayoutArray");var $r=sy,ly=class ly extends ka{};l(ly,"SymbolLayoutArray");var uc=ly,uy=class uy extends Ra{};l(uy,"SymbolDynamicLayoutArray");var cc=uy,cy=class cy extends Da{};l(cy,"SymbolOpacityArray");var pc=cy,py=class py extends za{};l(py,"CollisionBoxLayoutArray");var Ja=py,hy=class hy extends Ba{};l(hy,"CollisionCircleLayoutArray");var hc=hy,my=class my extends Oa{};l(my,"CollisionVertexArray");var mc=my,fy=class fy extends lo{};l(fy,"QuadTriangleArray");var fc=fy,dy=class dy extends lo{};l(dy,"TriangleIndexArray");var Ne=dy,yy=class yy extends Ga{};l(yy,"LineIndexArray");var Tn=yy,gy=class gy extends Za{};l(gy,"LineStripIndexArray");var Qa=gy;y();var XD=Ee([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Iw,size:jU,alignment:NU}=XD;y();var Sn=class Sn{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1;this.segments=e}prepareSegment(e,t,n,i){let o=this.segments[this.segments.length-1];return e>Sn.MAX_VERTEX_ARRAY_LENGTH&&ce("Max vertices per segment is ".concat(Sn.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(e,". Consider using the `fillLargeMeshArrays` function if you require meshes with more than ").concat(Sn.MAX_VERTEX_ARRAY_LENGTH," vertices.")),this._forceNewSegmentOnNextPrepare||!o||o.vertexLength+e>Sn.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i?this.createNewSegment(t,n,i):o}createNewSegment(e,t,n){let i={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return n!==void 0&&(i.sortKey=n),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(e,t,n){return this.prepareSegment(0,e,t,n)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,i){return new Sn([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};l(Sn,"SegmentVector");var he=Sn;he.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;Z("SegmentVector",he);y();y();function xy(r,e){return r=se(Math.floor(r),0,255),e=se(Math.floor(e),0,255),256*r+e}l(xy,"packUint8ToFloat");y();var es=Ee([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);y();var Dw=oe(vy(),1);var gc=class gc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,i){this.ids.push(Rw(e)),this.positions.push(t,n,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let t=Rw(e),n=0,i=this.ids.length-1;for(;n<i;){let a=n+i>>1;this.ids[a]>=t?i=a:n=a+1}let o=[];for(;this.ids[n]===t;){let a=this.positions[3*n],s=this.positions[3*n+1],u=this.positions[3*n+2];o.push({index:a,start:s,end:u}),n++}return o}static serialize(e,t){let n=new Float64Array(e.ids),i=new Uint32Array(e.positions);return wy(n,i,0,n.length-1),t&&t.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(e){let t=new gc;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}};l(gc,"FeaturePositionMap");var ts=gc;function Rw(r){let e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,Dw.default)(String(r))}l(Rw,"getNumericId");function wy(r,e,t,n){for(;t<n;){let i=r[t+n>>1],o=t-1,a=n+1;for(;;){do o++;while(r[o]<i);do a--;while(r[a]>i);if(o>=a)break;yc(r,o,a),yc(e,3*o,3*a),yc(e,3*o+1,3*a+1),yc(e,3*o+2,3*a+2)}a-t<n-a?(wy(r,e,t,a),t=a+1):(wy(r,e,a+1,n),n=a)}}l(wy,"sort");function yc(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}l(yc,"swap");Z("FeaturePositionMap",ts);y();var Py=class Py{constructor(e,t){this.gl=e.gl,this.location=t}};l(Py,"Uniform");var dr=Py,Ty=class Ty extends dr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}};l(Ty,"Uniform1i");var te=Ty,Sy=class Sy extends dr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};l(Sy,"Uniform1f");var j=Sy,My=class My extends dr{constructor(e,t){super(e,t),this.current=[0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1])&&(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}};l(My,"Uniform2f");var Q=My,Cy=class Cy extends dr{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2])&&(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}};l(Cy,"Uniform3f");var it=Cy,Ay=class Ay extends dr{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}};l(Ay,"Uniform4f");var xt=Ay,Iy=class Iy extends dr{constructor(e,t){super(e,t),this.current=Y.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}};l(Iy,"UniformColor");var _t=Iy,Ey=class Ey extends dr{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e.length*4);for(let n=0;n<e.length;n++)t[4*n]=e[n].r,t[4*n+1]=e[n].g,t[4*n+2]=e[n].b,t[4*n+3]=e[n].a;this.gl.uniform4fv(this.location,t)}}};l(Ey,"UniformColorArray");var rs=Ey,Ly=class Ly extends dr{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}};l(Ly,"UniformFloatArray");var ns=Ly,QD=new Float32Array(16),ky=class ky extends dr{constructor(e,t){super(e,t),this.current=QD}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);return}for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};l(ky,"UniformMatrix4f");var tt=ky;function Ry(r){return[xy(255*r.r,255*r.g),xy(255*r.b,255*r.a)]}l(Ry,"packColor");var Dy=class Dy{constructor(e,t,n){this.value=e,this.uniformNames=t.map(i=>"u_".concat(i)),this.type=n}setUniform(e,t,n){e.set(n.constantOr(this.value))}getBinding(e,t,n){return this.type==="color"?new _t(e,t):new j(e,t)}};l(Dy,"ConstantBinder");var yi=Dy,Fy=class Fy{constructor(e,t){this.uniformNames=t.map(n=>"u_".concat(n)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,t,n){return n.substr(0,9)==="u_pattern"?new xt(e,t):new j(e,t)}};l(Fy,"CrossFadedConstantBinder");var Mn=Fy,zy=class zy{constructor(e,t,n,i){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map(o=>({name:"a_".concat(o),type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,t,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new ve(0),t,{},i,[],o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,t,n,i){let o=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(e,t,o)}_setPaintValue(e,t,n){if(this.type==="color"){let i=Ry(n);for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}};l(zy,"SourceExpressionBinder");var yr=zy,By=class By{constructor(e,t,n,i,o,a){this.expression=e,this.uniformNames=t.map(s=>"u_".concat(s,"_t")),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=t.map(s=>({name:"a_".concat(s),type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,n,i,o){let a=this.expression.evaluate(new ve(this.zoom),t,{},i,[],o),s=this.expression.evaluate(new ve(this.zoom+1),t,{},i,[],o),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,a,s)}updatePaintArray(e,t,n,i){let o=this.expression.evaluate({zoom:this.zoom},n,i),a=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(e,t,o,a)}_setPaintValue(e,t,n,i){if(this.type==="color"){let o=Ry(n),a=Ry(i);for(let s=e;s<t;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,n,i);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let n=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,i=se(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,t,n){return new j(e,t)}};l(By,"CompositeExpressionBinder");var Gt=By,Oy=class Oy{constructor(e,t,n,i,o,a){this.expression=e,this.type=t,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(e,t,n){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,t.patterns&&t.patterns[this.layerId],n)}updatePaintArray(e,t,n,i,o){this._setPaintValues(e,t,n.patterns&&n.patterns[this.layerId],o)}_setPaintValues(e,t,n,i){if(!i||!n)return;let{min:o,mid:a,max:s}=n,u=i[o],c=i[a],p=i[s];if(!(!u||!c||!p))for(let h=e;h<t;h++)this.zoomInPaintVertexArray.emplace(h,c.tl[0],c.tl[1],c.br[0],c.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],c.pixelRatio,u.pixelRatio),this.zoomOutPaintVertexArray.emplace(h,c.tl[0],c.tl[1],c.br[0],c.br[1],p.tl[0],p.tl[1],p.br[0],p.br[1],c.pixelRatio,p.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,es.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,es.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}};l(Oy,"CrossFadedCompositeBinder");var Rr=Oy,Vy=class Vy{constructor(e,t,n){this.binders={},this._buffers=[];let i=[];for(let o in e.paint._values){if(!n(o))continue;let a=e.paint.get(o);if(!(a instanceof gt)||!gn(a.property.specification))continue;let s=eF(o,e.type),u=a.value,c=a.property.specification.type,p=a.property.useIntegerZoom,h=a.property.specification["property-type"],m=h==="cross-faded"||h==="cross-faded-data-driven";if(u.kind==="constant")this.binders[o]=m?new Mn(u.value,s):new yi(u.value,s,c),i.push("/u_".concat(o));else if(u.kind==="source"||m){let f=Fw(o,c,"source");this.binders[o]=m?new Rr(u,c,p,t,f,e.id):new yr(u,s,c,f),i.push("/a_".concat(o))}else{let f=Fw(o,c,"composite");this.binders[o]=new Gt(u,s,c,p,t,f),i.push("/z_".concat(o))}}this.cacheKey=i.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof yr||t instanceof Gt?t.maxValue:0}populatePaintArrays(e,t,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof yr||s instanceof Gt||s instanceof Rr)&&s.populatePaintArray(e,t,n,i,o)}}setConstantPatternPositions(e,t){for(let n in this.binders){let i=this.binders[n];i instanceof Mn&&i.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,n,i,o){let a=!1;for(let s in e){let u=t.getPositions(s);for(let c of u){let p=n.feature(c.index);for(let h in this.binders){let m=this.binders[h];if((m instanceof yr||m instanceof Gt||m instanceof Rr)&&m.expression.isStateDependent===!0){let f=i.paint.get(h);m.expression=f.value,m.updatePaintArray(c.start,c.end,p,e[s],o),a=!0}}}}return a}defines(){let e=[];for(let t in this.binders){let n=this.binders[t];(n instanceof yi||n instanceof Mn)&&e.push(...n.uniformNames.map(i=>"#define HAS_UNIFORM_".concat(i)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof yr||n instanceof Gt)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof Rr)for(let i=0;i<es.members.length;i++)e.push(es.members[i].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof yi||n instanceof Mn||n instanceof Gt)for(let i of n.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let n=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof yi||o instanceof Mn||o instanceof Gt){for(let a of o.uniformNames)if(t[a]){let s=o.getBinding(e,t[a],a);n.push({name:a,property:i,binding:s})}}}return n}setUniforms(e,t,n,i){for(let{name:o,property:a,binding:s}of t)this.binders[a].setUniform(s,i,n.get(a),o)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let n=this.binders[t];if(e&&n instanceof Rr){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof yr||n instanceof Gt)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let t in this.binders){let n=this.binders[t];(n instanceof yr||n instanceof Gt||n instanceof Rr)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof yr||t instanceof Gt||t instanceof Rr)&&t.destroy()}}};l(Vy,"ProgramConfiguration");var xc=Vy,Uy=class Uy{constructor(e,t,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new xc(i,t,n);this.needsUpload=!1,this._featureMap=new ts,this._bufferOffset=0}populatePaintArrays(e,t,n,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,t,i,o,a);t.id!==void 0&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,i){for(let o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,t,o,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};l(Uy,"ProgramConfigurationSet");var Lt=Uy;function eF(r,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace("".concat(e,"-"),"").replace(/-/g,"_")]}l(eF,"paintAttributeNames");function tF(r){return{"line-pattern":{source:$r,composite:$r},"fill-pattern":{source:$r,composite:$r},"fill-extrusion-pattern":{source:$r,composite:$r}}[r]}l(tF,"getLayoutException");function Fw(r,e,t){let n={color:{source:Pn,composite:uo},number:{source:di,composite:Pn}},i=tF(r);return i&&i[t]||n[e][t]}l(Fw,"layoutType");Z("ConstantBinder",yi);Z("CrossFadedConstantBinder",Mn);Z("SourceExpressionBinder",yr);Z("CrossFadedCompositeBinder",Rr);Z("CompositeExpressionBinder",Gt);Z("ProgramConfiguration",xc,{omit:["_buffers"]});Z("ProgramConfigurationSet",Lt);y();y();var rF=15,jy=Math.pow(2,rF-1)-1,zw=-jy-1;function kt(r){let e=8192/r.extent,t=r.loadGeometry();for(let n=0;n<t.length;n++){let i=t[n];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*e),u=Math.round(a.y*e);a.x=se(s,zw,jy),a.y=se(u,zw,jy),(s<a.x||s>a.x+1||u<a.y||u>a.y+1)&&ce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return t}l(kt,"loadGeometry");y();function Rt(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?kt(r):[]}}l(Rt,"toEvaluationFeature");var Bw=-32768;function nF(r,e,t,n,i){r.emplaceBack(Bw+e*8+n,Bw+t*8+i)}l(nF,"addCircleVertex");var Ny=class Ny{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new ic,this.indexArray=new Ne,this.segments=new he,this.programConfigurations=new Lt(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,n){let i=this.layers[0],o=[],a=null,s=!1,u=i.type==="heatmap";if(i.type==="circle"){let p=i;a=p.layout.get("circle-sort-key"),s=!a.isConstant(),u=u||p.paint.get("circle-pitch-alignment")==="map"}let c=u?t.subdivisionGranularity.circle:1;for(let{feature:p,id:h,index:m,sourceLayerIndex:f}of e){let d=this.layers[0]._featureFilter.needGeometry,g=Rt(p,d);if(!this.layers[0]._featureFilter.filter(new ve(this.zoom,{globalState:this.globalState}),g,n))continue;let x=s?a.evaluate(g,{},n):void 0,_={id:h,properties:p.properties,type:p.type,sourceLayerIndex:f,index:m,geometry:d?g.geometry:kt(p),patterns:{},sortKey:x};o.push(_)}s&&o.sort((p,h)=>p.sortKey-h.sortKey);for(let p of o){let{geometry:h,index:m,sourceLayerIndex:f}=p,d=e[m].feature;this.addFeature(p,h,m,n,c),t.featureIndex.insert(d,h,m,f,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Iw),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,n,i,o=1){let a;switch(o){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw new Error("Invalid circle bucket granularity: ".concat(o,"; valid values are 1, 3, 5, 7."))}let s=a.length;for(let u of t)for(let c of u){let p=c.x,h=c.y;if(p<0||p>=8192||h<0||h>=8192)continue;let m=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),f=m.vertexLength;for(let d=0;d<s;d++)for(let g=0;g<s;g++)nF(this.layoutVertexArray,p,h,a[g],a[d]);for(let d=0;d<s-1;d++)for(let g=0;g<s-1;g++){let x=f+d*s+g,_=f+(d+1)*s+g;this.indexArray.emplaceBack(x,_+1,x+1),this.indexArray.emplaceBack(x,_,_+1)}m.vertexLength+=s*s,m.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};l(Ny,"CircleBucket");var gi=Ny;Z("CircleBucket",gi,{omit:["layers"]});y();var is=oe(ue(),1);function _c(r,e){for(let t=0;t<r.length;t++)if(co(e,r[t]))return!0;for(let t=0;t<e.length;t++)if(co(r,e[t]))return!0;return!!Zy(r,e)}l(_c,"polygonIntersectsPolygon");function Vw(r,e,t){return!!(co(r,e)||Gy(e,r,t))}l(Vw,"polygonIntersectsBufferedPoint");function bc(r,e){if(r.length===1)return Ow(e,r[0]);for(let t=0;t<e.length;t++){let n=e[t];for(let i=0;i<n.length;i++)if(co(r,n[i]))return!0}for(let t=0;t<r.length;t++)if(Ow(e,r[t]))return!0;for(let t=0;t<e.length;t++)if(Zy(r,e[t]))return!0;return!1}l(bc,"polygonIntersectsMultiPolygon");function Uw(r,e,t){for(let n=0;n<e.length;n++){let i=e[n];if(r.length>=3){for(let o=0;o<i.length;o++)if(co(r,i[o]))return!0}if(iF(r,i,t))return!0}return!1}l(Uw,"polygonIntersectsBufferedMultiLine");function iF(r,e,t){if(r.length>1){if(Zy(r,e))return!0;for(let n=0;n<e.length;n++)if(Gy(e[n],r,t))return!0}for(let n=0;n<r.length;n++)if(Gy(r[n],e,t))return!0;return!1}l(iF,"lineIntersectsBufferedLine");function Zy(r,e){if(r.length===0||e.length===0)return!1;for(let t=0;t<r.length-1;t++){let n=r[t],i=r[t+1];for(let o=0;o<e.length-1;o++){let a=e[o],s=e[o+1];if(oF(n,i,a,s))return!0}}return!1}l(Zy,"lineIntersectsLine");function oF(r,e,t,n){return Nr(r,t,n)!==Nr(e,t,n)&&Nr(r,e,t)!==Nr(r,e,n)}l(oF,"lineSegmentIntersectsLineSegment");function Gy(r,e,t){let n=t*t;if(e.length===1)return r.distSqr(e[0])<n;for(let i=1;i<e.length;i++){let o=e[i-1],a=e[i];if(jw(r,o,a)<n)return!0}return!1}l(Gy,"pointIntersectsBufferedLine");function jw(r,e,t){let n=e.distSqr(t);if(n===0)return r.distSqr(e);let i=((r.x-e.x)*(t.x-e.x)+(r.y-e.y)*(t.y-e.y))/n;return i<0?r.distSqr(e):i>1?r.distSqr(t):r.distSqr(t.sub(e)._mult(i)._add(e))}l(jw,"distToSegmentSquared");function Ow(r,e){let t=!1,n,i,o;for(let a=0;a<r.length;a++){n=r[a];for(let s=0,u=n.length-1;s<n.length;u=s++)i=n[s],o=n[u],i.y>e.y!=o.y>e.y&&e.x<(o.x-i.x)*(e.y-i.y)/(o.y-i.y)+i.x&&(t=!t)}return t}l(Ow,"multiPolygonContainsPoint");function co(r,e){let t=!1;for(let n=0,i=r.length-1;n<r.length;i=n++){let o=r[n],a=r[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(t=!t)}return t}l(co,"polygonContainsPoint");function Nw(r,e,t,n,i){for(let a of r)if(e<=a.x&&t<=a.y&&n>=a.x&&i>=a.y)return!0;let o=[new is.default(e,t),new is.default(e,i),new is.default(n,i),new is.default(n,t)];if(r.length>2){for(let a of o)if(co(r,a))return!0}for(let a=0;a<r.length-1;a++){let s=r[a],u=r[a+1];if(aF(s,u,o))return!0}return!1}l(Nw,"polygonIntersectsBox");function aF(r,e,t){let n=t[0],i=t[2];if(r.x<n.x&&e.x<n.x||r.x>i.x&&e.x>i.x||r.y<n.y&&e.y<n.y||r.y>i.y&&e.y>i.y)return!1;let o=Nr(r,e,t[0]);return o!==Nr(r,e,t[1])||o!==Nr(r,e,t[2])||o!==Nr(r,e,t[3])}l(aF,"edgeIntersectsBox");y();var vc=oe(ue(),1);function xi(r,e,t){let n=e.paint.get(r).value;return n.kind==="constant"?n.value:t.programConfigurations.get(e.id).getMaxValue(r)}l(xi,"getMaximumPaintValue");function Cn(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}l(Cn,"translateDistance");function An(r,e,t,n,i){if(!e[0]&&!e[1])return r;let o=vc.default.convert(e)._mult(i);t==="viewport"&&o._rotate(-n);let a=[];for(let s=0;s<r.length;s++){let u=r[s];a.push(u.sub(o))}return a}l(An,"translate");function Gw(r,e){let t=[];for(let n=0;n<r.length;n++){let i=r[n],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],u=i[a],c=i[a+1],p=a===0?new vc.default(0,0):u.sub(s)._unit()._perp(),h=a===i.length-1?new vc.default(0,0):c.sub(u)._unit()._perp(),m=p._add(h)._unit(),f=m.x*h.x+m.y*h.y;f!==0&&m._mult(1/f),o.push(m._mult(e)._add(u))}t.push(o)}return t}l(Gw,"offsetLine");y();var Zw,lF=l(()=>Zw=Zw||new ke({"circle-sort-key":new ee(E.layout_circle["circle-sort-key"])}),"getLayout"),qw,uF=l(()=>qw=qw||new ke({"circle-radius":new ee(E.paint_circle["circle-radius"]),"circle-color":new ee(E.paint_circle["circle-color"]),"circle-blur":new ee(E.paint_circle["circle-blur"]),"circle-opacity":new ee(E.paint_circle["circle-opacity"]),"circle-translate":new q(E.paint_circle["circle-translate"]),"circle-translate-anchor":new q(E.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new q(E.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new q(E.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ee(E.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ee(E.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ee(E.paint_circle["circle-stroke-opacity"])}),"getPaint"),Hw={get paint(){return uF()},get layout(){return lF()}};var Ww=oe(ue(),1);var $w=l(r=>r.type==="circle","isCircleStyleLayer"),qy=class qy extends He{constructor(e){super(e,Hw)}createBucket(e){return new gi(e)}queryRadius(e){let t=e;return xi("circle-radius",this,t)+xi("circle-stroke-width",this,t)+Cn(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:u}){let c=An(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-o.bearingInRadians,a),p=this.paint.get("circle-radius").evaluate(t,n),h=this.paint.get("circle-stroke-width").evaluate(t,n),m=p+h,f=this.paint.get("circle-pitch-alignment")==="map",d=f?c:cF(c,o,s,u),g=f?m*a:m;for(let x of i)for(let _ of x){let b=f?_:Xw(_,o,s,u),v=g,w=o.projectTileCoordinates(_.x,_.y,s,u).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?v*=w/o.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(v*=o.cameraToCenterDistance/w),Vw(d,b,v))return!0}return!1}};l(qy,"CircleStyleLayer");var wc=qy;function Xw(r,e,t,n){let i=e.projectTileCoordinates(r.x,r.y,t,n).point;return new Ww.default((i.x*.5+.5)*e.width,(-i.y*.5+.5)*e.height)}l(Xw,"projectPoint");function cF(r,e,t,n){return r.map(i=>Xw(i,e,t,n))}l(cF,"projectQueryGeometry");y();y();var Hy=class Hy extends gi{};l(Hy,"HeatmapBucket");var os=Hy;Z("HeatmapBucket",os,{omit:["layers"]});y();var Yw,pF=l(()=>Yw=Yw||new ke({"heatmap-radius":new ee(E.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ee(E.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new q(E.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Wr(E.paint_heatmap["heatmap-color"]),"heatmap-opacity":new q(E.paint_heatmap["heatmap-opacity"])}),"getPaint"),Kw={get paint(){return pF()}};y();y();function Wy(r,{width:e,height:t},n,i){if(!i)i=new Uint8Array(e*t*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*t*n)throw new RangeError("mismatched image size. expected: ".concat(i.length," but got: ").concat(e*t*n));return r.width=e,r.height=t,r.data=i,r}l(Wy,"createImage");function Jw(r,{width:e,height:t},n){if(e===r.width&&t===r.height)return;let i=Wy({},{width:e,height:t},n);$y(r,i,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,t)},n),r.width=e,r.height=t,r.data=i.data}l(Jw,"resizeImage");function $y(r,e,t,n,i,o){if(i.width===0||i.height===0)return e;if(i.width>r.width||i.height>r.height||t.x>r.width-i.width||t.y>r.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");let a=r.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let u=0;u<i.height;u++){let c=((t.y+u)*r.width+t.x)*o,p=((n.y+u)*e.width+n.x)*o;for(let h=0;h<i.width*o;h++)s[p+h]=a[c+h]}return e}l($y,"copyImage");var Pc=class Pc{constructor(e,t){Wy(this,e,1,t)}resize(e){Jw(this,e,1)}clone(){return new Pc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,i,o){$y(e,t,n,i,o,1)}};l(Pc,"AlphaImage");var _i=Pc,Tc=class Tc{constructor(e,t){Wy(this,e,4,t)}resize(e){Jw(this,e,4)}replace(e,t){t?this.data.set(e):e instanceof Uint8ClampedArray?this.data=new Uint8Array(e.buffer):this.data=e}clone(){return new Tc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,i,o){$y(e,t,n,i,o,4)}setPixel(e,t,n){let i=(e*this.width+t)*4;this.data[i+0]=Math.round(n.r*255/n.a),this.data[i+1]=Math.round(n.g*255/n.a),this.data[i+2]=Math.round(n.b*255/n.a),this.data[i+3]=Math.round(n.a*255)}};l(Tc,"RGBAImage");var Se=Tc;Z("AlphaImage",_i);Z("RGBAImage",Se);function Sc(r){let e={},t=r.resolution||256,n=r.clips?r.clips.length:1,i=r.image||new Se({width:t,height:n});if(!V0(t))throw new Error("width is not a power of 2 - ".concat(t));let o=l((a,s,u)=>{e[r.evaluationKey]=u;let c=r.expression.evaluate(e);i.setPixel(a/4/t,s/4,c)},"renderPixel");if(r.clips)for(let a=0,s=0;a<n;++a,s+=t*4)for(let u=0,c=0;u<t;u++,c+=4){let p=u/(t-1),{start:h,end:m}=r.clips[a],f=h*(1-p)+m*p;o(s,c,f)}else for(let a=0,s=0;a<t;a++,s+=4){let u=a/(t-1);o(0,s,u)}return i}l(Sc,"renderColorRamp");var po="big-fb",Qw=l(r=>r.type==="heatmap","isHeatmapStyleLayer"),Xy=class Xy extends He{createBucket(e){return new os(e)}constructor(e){super(e,Kw),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Sc({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(po)&&this.heatmapFbos.delete(po)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};l(Xy,"HeatmapStyleLayer");var Mc=Xy;y();y();var eP,hF=l(()=>eP=eP||new ke({"hillshade-illumination-direction":new q(E.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new q(E.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new q(E.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new q(E.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new q(E.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new q(E.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new q(E.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new q(E.paint_hillshade["hillshade-method"])}),"getPaint"),tP={get paint(){return hF()}};var rP=l(r=>r.type==="hillshade","isHillshadeStyleLayer"),Yy=class Yy extends He{constructor(e){super(e,tP),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,t=this.paint.get("hillshade-illumination-altitude").values,n=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,o=Math.max(e.length,t.length,n.length,i.length);e=e.concat(Array(o-e.length).fill(e.at(-1))),t=t.concat(Array(o-t.length).fill(t.at(-1))),n=n.concat(Array(o-n.length).fill(n.at(-1))),i=i.concat(Array(o-i.length).fill(i.at(-1)));let a=t.map(Le);return{directionRadians:e.map(Le),altitudeRadians:a,shadowColor:i,highlightColor:n}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};l(Yy,"HillshadeStyleLayer");var Cc=Yy;y();y();var nP,mF=l(()=>nP=nP||new ke({"color-relief-opacity":new q(E["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Wr(E["paint_color-relief"]["color-relief-color"])}),"getPaint"),iP={get paint(){return mF()}};y();var Ky=class Ky{constructor(e,t,n,i){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(t,i)}update(e,t,n){let{width:i,height:o}=e,a=(!this.size||this.size[0]!==i||this.size[1]!==o)&&!n,{context:s}=this,{gl:u}=s;if(this.useMipmap=!!(t&&t.useMipmap),u.bindTexture(u.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===u.RGBA&&(!t||t.premultiply!==!1)),a)this.size=[i,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||At(e)?u.texImage2D(u.TEXTURE_2D,0,this.format,this.format,u.UNSIGNED_BYTE,e):u.texImage2D(u.TEXTURE_2D,0,this.format,i,o,0,this.format,u.UNSIGNED_BYTE,e.data);else{let{x:c,y:p}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||At(e)?u.texSubImage2D(u.TEXTURE_2D,0,c,p,u.RGBA,u.UNSIGNED_BYTE,e):u.texSubImage2D(u.TEXTURE_2D,0,c,p,i,o,u.RGBA,u.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&u.generateMipmap(u.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,n){let{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_2D,this.texture),n===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(n=o.LINEAR),e!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,t),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}};l(Ky,"Texture");var we=Ky;y();var eg=class eg{constructor(e,t,n,i=1,o=1,a=1,s=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n)){ce('"'.concat(n,'" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".'));return}this.stride=t.height;let u=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;case"mapbox":default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let c=0;c<u;c++)this.data[this._idx(-1,c)]=this.data[this._idx(0,c)],this.data[this._idx(u,c)]=this.data[this._idx(u-1,c)],this.data[this._idx(c,-1)]=this.data[this._idx(c,0)],this.data[this._idx(c,u)]=this.data[this._idx(c,u-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(u,-1)]=this.data[this._idx(u-1,0)],this.data[this._idx(-1,u)]=this.data[this._idx(0,u-1)],this.data[this._idx(u,u)]=this.data[this._idx(u-1,u-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let c=0;c<u;c++)for(let p=0;p<u;p++){let h=this.get(c,p);h>this.max&&(this.max=h),h<this.min&&(this.min=h)}}get(e,t){let n=new Uint8Array(this.data.buffer),i=this._idx(e,t)*4;return this.unpack(n[i],n[i+1],n[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}unpack(e,t,n){return e*this.redFactor+t*this.greenFactor+n*this.blueFactor-this.baseShift}pack(e){return Qy(e,this.getUnpackVector())}getPixels(){return new Se({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=t*this.dim,o=t*this.dim+this.dim,a=n*this.dim,s=n*this.dim+this.dim;switch(t){case-1:i=o-1;break;case 1:o=i+1;break}switch(n){case-1:a=s-1;break;case 1:s=a+1;break}let u=-t*this.dim,c=-n*this.dim;for(let p=a;p<s;p++)for(let h=i;h<o;h++)this.data[this._idx(h,p)]=e.data[this._idx(h+u,p+c)]}};l(eg,"DEMData");var Jy=eg;function Qy(r,e){let t=e[0],n=e[1],i=e[2],o=e[3],a=Math.min(t,n,i),s=Math.round((r+o)/a);return{r:Math.floor(s*a/t)%256,g:Math.floor(s*a/n)%256,b:Math.floor(s*a/i)%256}}l(Qy,"packDEMData");Z("DEMData",Jy);var oP=l(r=>r.type==="color-relief","isColorReliefStyleLayer"),tg=class tg extends He{constructor(e){super(e,iP)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values["color-relief-color"].value.expression;if(n instanceof Er&&n._styleExpression.expression instanceof Tt){this.colorRampExpression=n;let a=n._styleExpression.expression;t.elevationStops=a.labels,t.colorStops=[];for(let s of t.elevationStops)t.colorStops.push(a.evaluate({globals:{elevation:s}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[Y.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let i={elevationStops:[],colorStops:[]},o=(t.elevationStops.length-1)/(e-1);for(let a=0;a<t.elevationStops.length-.5;a+=o)i.elevationStops.push(t.elevationStops[Math.round(a)]),i.colorStops.push(t.colorStops[Math.round(a)]);return ce("Too many colors in specification of ".concat(this.id," color-relief layer, may not render properly.")),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,n){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(t),o=new Se({width:i.colorStops.length,height:1}),a=new Se({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let u=Qy(i.elevationStops[s],n);a.setPixel(0,s,new Y(u.r/255,u.g/255,u.b/255,1)),o.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new we(e,a,e.gl.RGBA),colorTexture:new we(e,o,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}};l(tg,"ColorReliefStyleLayer");var Ac=tg;y();y();y();var fF=Ee([{name:"a_pos",components:2,type:"Int16"}],4);var{members:aP,size:K6,alignment:J6}=fF;y();function ho(r,e,t){let n=t.patternDependencies,i=!1;for(let o of e){let a=o.paint.get("".concat(r,"-pattern"));a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}l(ho,"hasPattern");function mo(r,e,t,n,i){let o=i.patternDependencies;for(let a of e){let u=a.paint.get("".concat(r,"-pattern")).value;if(u.kind!=="constant"){let c=u.evaluate({zoom:n-1},t,{},i.availableImages),p=u.evaluate({zoom:n},t,{},i.availableImages),h=u.evaluate({zoom:n+1},t,{},i.availableImages);c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,h=h&&h.name?h.name:h,o[c]=!0,o[p]=!0,o[h]=!0,t.patterns[a.id]={min:c,mid:p,max:h}}}return t}l(mo,"addPatternDependencies");y();var ps=oe(ue(),1);y();function ig(r,e,t=2){let n=e&&e.length,i=n?e[0]*t:r.length,o=lP(r,0,i,t,!0),a=[];if(!o||o.next===o.prev)return a;let s,u,c;if(n&&(o=_F(r,e,o,t)),r.length>80*t){s=1/0,u=1/0;let p=-1/0,h=-1/0;for(let m=t;m<i;m+=t){let f=r[m],d=r[m+1];f<s&&(s=f),d<u&&(u=d),f>p&&(p=f),d>h&&(h=d)}c=Math.max(p-s,h-u),c=c!==0?32767/c:0}return ss(o,a,t,s,u,c,0),a}l(ig,"earcut");function lP(r,e,t,n,i){let o;if(i===EF(r,e,t,n)>0)for(let a=e;a<t;a+=n)o=sP(a/n|0,r[a],r[a+1],o);else for(let a=t-n;a>=e;a-=n)o=sP(a/n|0,r[a],r[a+1],o);return o&&fo(o,o.next)&&(us(o),o=o.next),o}l(lP,"linkedList");function bi(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(fo(t,t.next)||Xe(t.prev,t,t.next)===0)){if(us(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}l(bi,"filterPoints");function ss(r,e,t,n,i,o,a){if(!r)return;!a&&o&&TF(r,n,i,o);let s=r;for(;r.prev!==r.next;){let u=r.prev,c=r.next;if(o?yF(r,n,i,o):dF(r)){e.push(u.i,r.i,c.i),us(r),r=c.next,s=c.next;continue}if(r=c,r===s){a?a===1?(r=gF(bi(r),e),ss(r,e,t,n,i,o,2)):a===2&&xF(r,e,t,n,i,o):ss(bi(r),e,t,n,i,o,1);break}}}l(ss,"earcutLinked");function dF(r){let e=r.prev,t=r,n=r.next;if(Xe(e,t,n)>=0)return!1;let i=e.x,o=t.x,a=n.x,s=e.y,u=t.y,c=n.y,p=Math.min(i,o,a),h=Math.min(s,u,c),m=Math.max(i,o,a),f=Math.max(s,u,c),d=n.next;for(;d!==e;){if(d.x>=p&&d.x<=m&&d.y>=h&&d.y<=f&&as(i,s,o,u,a,c,d.x,d.y)&&Xe(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}l(dF,"isEar");function yF(r,e,t,n){let i=r.prev,o=r,a=r.next;if(Xe(i,o,a)>=0)return!1;let s=i.x,u=o.x,c=a.x,p=i.y,h=o.y,m=a.y,f=Math.min(s,u,c),d=Math.min(p,h,m),g=Math.max(s,u,c),x=Math.max(p,h,m),_=rg(f,d,e,t,n),b=rg(g,x,e,t,n),v=r.prevZ,w=r.nextZ;for(;v&&v.z>=_&&w&&w.z<=b;){if(v.x>=f&&v.x<=g&&v.y>=d&&v.y<=x&&v!==i&&v!==a&&as(s,p,u,h,c,m,v.x,v.y)&&Xe(v.prev,v,v.next)>=0||(v=v.prevZ,w.x>=f&&w.x<=g&&w.y>=d&&w.y<=x&&w!==i&&w!==a&&as(s,p,u,h,c,m,w.x,w.y)&&Xe(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;v&&v.z>=_;){if(v.x>=f&&v.x<=g&&v.y>=d&&v.y<=x&&v!==i&&v!==a&&as(s,p,u,h,c,m,v.x,v.y)&&Xe(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;w&&w.z<=b;){if(w.x>=f&&w.x<=g&&w.y>=d&&w.y<=x&&w!==i&&w!==a&&as(s,p,u,h,c,m,w.x,w.y)&&Xe(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}l(yF,"isEarHashed");function gF(r,e){let t=r;do{let n=t.prev,i=t.next.next;!fo(n,i)&&cP(n,t,t.next,i)&&ls(n,i)&&ls(i,n)&&(e.push(n.i,t.i,i.i),us(t),us(t.next),t=r=i),t=t.next}while(t!==r);return bi(t)}l(gF,"cureLocalIntersections");function xF(r,e,t,n,i,o){let a=r;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&CF(a,s)){let u=pP(a,s);a=bi(a,a.next),u=bi(u,u.next),ss(a,e,t,n,i,o,0),ss(u,e,t,n,i,o,0);return}s=s.next}a=a.next}while(a!==r)}l(xF,"splitEarcut");function _F(r,e,t,n){let i=[];for(let o=0,a=e.length;o<a;o++){let s=e[o]*n,u=o<a-1?e[o+1]*n:r.length,c=lP(r,s,u,n,!1);c===c.next&&(c.steiner=!0),i.push(MF(c))}i.sort(bF);for(let o=0;o<i.length;o++)t=vF(i[o],t);return t}l(_F,"eliminateHoles");function bF(r,e){let t=r.x-e.x;if(t===0&&(t=r.y-e.y,t===0)){let n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}l(bF,"compareXYSlope");function vF(r,e){let t=wF(r,e);if(!t)return e;let n=pP(t,r);return bi(n,n.next),bi(t,t.next)}l(vF,"eliminateHole");function wF(r,e){let t=e,n=r.x,i=r.y,o=-1/0,a;if(fo(r,t))return t;do{if(fo(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){let h=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=n&&h>o&&(o=h,a=t.x<t.next.x?t:t.next,h===n))return a}t=t.next}while(t!==e);if(!a)return null;let s=a,u=a.x,c=a.y,p=1/0;t=a;do{if(n>=t.x&&t.x>=u&&n!==t.x&&uP(i<c?n:o,i,u,c,i<c?o:n,i,t.x,t.y)){let h=Math.abs(i-t.y)/(n-t.x);ls(t,r)&&(h<p||h===p&&(t.x>a.x||t.x===a.x&&PF(a,t)))&&(a=t,p=h)}t=t.next}while(t!==s);return a}l(wF,"findHoleBridge");function PF(r,e){return Xe(r.prev,r,e.prev)<0&&Xe(e.next,r,r.next)<0}l(PF,"sectorContainsSector");function TF(r,e,t,n){let i=r;do i.z===0&&(i.z=rg(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,SF(i)}l(TF,"indexCurve");function SF(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let a=n,s=0;for(let c=0;c<t&&(s++,a=a.nextZ,!!a);c++);let u=t;for(;s>0||u>0&&a;)s!==0&&(u===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,s--):(i=a,a=a.nextZ,u--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=a}o.nextZ=null,t*=2}while(e>1);return r}l(SF,"sortLinked");function rg(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}l(rg,"zOrder");function MF(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}l(MF,"getLeftmost");function uP(r,e,t,n,i,o,a,s){return(i-a)*(e-s)>=(r-a)*(o-s)&&(r-a)*(n-s)>=(t-a)*(e-s)&&(t-a)*(o-s)>=(i-a)*(n-s)}l(uP,"pointInTriangle");function as(r,e,t,n,i,o,a,s){return!(r===a&&e===s)&&uP(r,e,t,n,i,o,a,s)}l(as,"pointInTriangleExceptFirst");function CF(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!AF(r,e)&&(ls(r,e)&&ls(e,r)&&IF(r,e)&&(Xe(r.prev,r,e.prev)||Xe(r,e.prev,e))||fo(r,e)&&Xe(r.prev,r,r.next)>0&&Xe(e.prev,e,e.next)>0)}l(CF,"isValidDiagonal");function Xe(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}l(Xe,"area");function fo(r,e){return r.x===e.x&&r.y===e.y}l(fo,"equals");function cP(r,e,t,n){let i=Ec(Xe(r,e,t)),o=Ec(Xe(r,e,n)),a=Ec(Xe(t,n,r)),s=Ec(Xe(t,n,e));return!!(i!==o&&a!==s||i===0&&Ic(r,t,e)||o===0&&Ic(r,n,e)||a===0&&Ic(t,r,n)||s===0&&Ic(t,e,n))}l(cP,"intersects");function Ic(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}l(Ic,"onSegment");function Ec(r){return r>0?1:r<0?-1:0}l(Ec,"sign");function AF(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&cP(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}l(AF,"intersectsPolygon");function ls(r,e){return Xe(r.prev,r,r.next)<0?Xe(r,e,r.next)>=0&&Xe(r,r.prev,e)>=0:Xe(r,e,r.prev)<0||Xe(r,r.next,e)<0}l(ls,"locallyInside");function IF(r,e){let t=r,n=!1,i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}l(IF,"middleInside");function pP(r,e){let t=ng(r.i,r.x,r.y),n=ng(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}l(pP,"splitPolygon");function sP(r,e,t,n){let i=ng(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}l(sP,"insertNode");function us(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}l(us,"removeNode");function ng(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}l(ng,"createNode");function EF(r,e,t,n){let i=0;for(let o=e,a=t-n;o<t;o+=n)i+=(r[a]-r[o])*(r[o+1]+r[a+1]),a=o;return i}l(EF,"signedArea");y();var og=class og{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){let t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}};l(og,"SubdivisionGranularityExpression");var Zt=og,cs=class cs{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};l(cs,"SubdivisionGranularitySetting"),cs.noSubdivision=new cs({fill:new Zt(0,0),line:new Zt(0,0),tile:new Zt(0,0),stencil:new Zt(0,0),circle:1});var In=cs;Z("SubdivisionGranularityExpression",Zt);Z("SubdivisionGranularitySetting",In);var Dr=-32768,Xr=32767,sg=class sg{constructor(e,t){this._vertexBuffer=[];this._vertexDictionary=new Map;this._used=!1;this._granularity=e,this._granularityCellSize=8192/e,this._canonical=t}_getKey(e,t){return e=e+32768,t=t+32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let n=Math.round(e)|0,i=Math.round(t)|0,o=this._getKey(n,i);if(this._vertexDictionary.has(o))return this._vertexDictionary.get(o);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(o,a),this._vertexBuffer.push(n,i),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return kF(this._vertexBuffer,e);let t=[],n=e.length;for(let i=0;i<n;i+=3){let o=[e[i+0],e[i+1],e[i+2]],a=[this._vertexBuffer[e[i+0]*2+0],this._vertexBuffer[e[i+0]*2+1],this._vertexBuffer[e[i+1]*2+0],this._vertexBuffer[e[i+1]*2+1],this._vertexBuffer[e[i+2]*2+0],this._vertexBuffer[e[i+2]*2+1]],s=1/0,u=1/0,c=-1/0,p=-1/0;for(let g=0;g<3;g++){let x=a[g*2],_=a[g*2+1];s=Math.min(s,x),c=Math.max(c,x),u=Math.min(u,_),p=Math.max(p,_)}if(s===c||u===p)continue;let h=Math.floor(s/this._granularityCellSize),m=Math.ceil(c/this._granularityCellSize),f=Math.floor(u/this._granularityCellSize),d=Math.ceil(p/this._granularityCellSize);if(h===m&&f===d){t.push(...o);continue}for(let g=f;g<d;g++){let x=this._scanlineGenerateVertexRingForCellRow(g,a,o);RF(this._vertexBuffer,x,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,n){let i=e*this._granularityCellSize,o=i+this._granularityCellSize,a=[];for(let s=0;s<3;s++){let u=t[s*2],c=t[s*2+1],p=t[(s+1)*2%6],h=t[((s+1)*2+1)%6],m=t[(s+2)*2%6],f=t[((s+2)*2+1)%6],d=p-u,g=h-c,x=d===0,_=g===0,b=(i-c)/g,v=(o-c)/g,w=Math.min(b,v),T=Math.max(b,v);if(!_&&(w>=1||T<=0)||_&&(c<i||c>o)){h>=i&&h<=o&&a.push(n[(s+1)%3]);continue}if(!_&&w>0){let M=u+d*w,I=c+g*w;a.push(this._vertexToIndex(M,I))}let S=u+d*Math.max(w,0),A=u+d*Math.min(T,1);if(x||this._generateIntraEdgeVertices(a,u,c,p,h,S,A),!_&&T<1){let M=u+d*T,I=c+g*T;a.push(this._vertexToIndex(M,I))}(_||h>=i&&h<=o)&&a.push(n[(s+1)%3]),!_&&(h<=i||h>=o)&&this._generateInterEdgeVertices(a,u,c,p,h,m,f,A,i,o)}return a}_generateIntraEdgeVertices(e,t,n,i,o,a,s){let u=i-t,c=o-n,p=c===0,h=p?Math.min(t,i):Math.min(a,s),m=p?Math.max(t,i):Math.max(a,s),f=Math.floor(h/this._granularityCellSize)+1,d=Math.ceil(m/this._granularityCellSize)-1;if(p?t<i:a<s)for(let x=f;x<=d;x++){let _=x*this._granularityCellSize,b=n+c*(_-t)/u;e.push(this._vertexToIndex(_,b))}else for(let x=d;x>=f;x--){let _=x*this._granularityCellSize,b=n+c*(_-t)/u;e.push(this._vertexToIndex(_,b))}}_generateInterEdgeVertices(e,t,n,i,o,a,s,u,c,p){let h=o-n,m=a-i,f=s-o,d=(c-o)/f,g=(p-o)/f,x=Math.min(d,g),_=Math.max(d,g),b=i+m*x,v=Math.floor(Math.min(b,u)/this._granularityCellSize)+1,w=Math.ceil(Math.max(b,u)/this._granularityCellSize)-1,T=u<b,S=f===0;if(S&&(s===c||s===p))return;if(S||x>=1||_<=0){let M=t-a,I=n-s,L=(c-s)/I,D=(p-s)/I,F=Math.min(L,D),U=a+M*F;v=Math.floor(Math.min(U,u)/this._granularityCellSize)+1,w=Math.ceil(Math.max(U,u)/this._granularityCellSize)-1,T=u<U}let A=h>0?p:c;if(T)for(let M=v;M<=w;M++){let I=M*this._granularityCellSize;e.push(this._vertexToIndex(I,A))}else for(let M=w;M>=v;M--){let I=M*this._granularityCellSize;e.push(this._vertexToIndex(I,A))}}_generateOutline(e){let t=[];for(let n of e){let i=yo(n,this._granularity,!0),o=this._pointArrayToIndices(i),a=[];for(let s=1;s<o.length;s++)a.push(o[s-1]),a.push(o[s]);t.push(a)}return t}_handlePoles(e){let t=!1,n=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(t||n)&&this._fillPoles(e,t,n)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let n=e[t+1];n===Dr&&(e[t+1]=Dr+1),n===Xr&&(e[t+1]=Xr-1)}}_generatePoleQuad(e,t,n,i,o,a){i>o!=(a===Dr)?(e.push(t),e.push(n),e.push(this._vertexToIndex(i,a)),e.push(n),e.push(this._vertexToIndex(o,a)),e.push(this._vertexToIndex(i,a))):(e.push(n),e.push(t),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(o,a)),e.push(n),e.push(this._vertexToIndex(i,a)))}_fillPoles(e,t,n){let i=this._vertexBuffer,o=0,a=8192,s=e.length;for(let u=2;u<s;u+=3){let c=e[u-2],p=e[u-1],h=e[u],m=i[c*2],f=i[c*2+1],d=i[p*2],g=i[p*2+1],x=i[h*2],_=i[h*2+1];t&&(f===o&&g===o&&this._generatePoleQuad(e,c,p,m,d,Dr),g===o&&_===o&&this._generatePoleQuad(e,p,h,d,x,Dr),_===o&&f===o&&this._generatePoleQuad(e,h,c,x,m,Dr)),n&&(f===a&&g===a&&this._generatePoleQuad(e,c,p,m,d,Xr),g===a&&_===a&&this._generatePoleQuad(e,p,h,d,x,Xr),_===a&&f===a&&this._generatePoleQuad(e,h,c,x,m,Xr))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:n,holeIndices:i}=LF(e);this._initializeVertices(n);let o;try{let s=ig(n,i),u=this._convertIndices(n,s);o=this._subdivideTrianglesScanline(u)}catch(s){console.error(s)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(o),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:a}}_convertIndices(e,t){let n=[];for(let i=0;i<t.length;i++){let o=e[t[i]*2],a=e[t[i]*2+1];n.push(this._vertexToIndex(o,a))}return n}_pointArrayToIndices(e){let t=[];for(let n=0;n<e.length;n++){let i=e[n];t.push(this._vertexToIndex(i.x,i.y))}return t}};l(sg,"Subdivider");var ag=sg;function Lc(r,e,t,n=!0){return new ag(t,e).subdividePolygonInternal(r,n)}l(Lc,"subdividePolygon");function yo(r,e,t=!1){if(!r||r.length<1)return[];if(r.length<2)return[];let n=r[0],i=r[r.length-1],o=t&&(n.x!==i.x||n.y!==i.y);if(e<2)return o?[...r,r[0]]:[...r];let a=Math.floor(8192/e),s=[];s.push(new ps.default(r[0].x,r[0].y));let u=r.length,c=o?u:u-1;for(let p=0;p<c;p++){let h=r[p],m=p<u-1?r[p+1]:r[0],f=h.x,d=h.y,g=m.x,x=m.y,_=f!==g,b=d!==x;if(!_&&!b)continue;let v=g-f,w=x-d,T=Math.abs(v),S=Math.abs(w),A=f,M=d;for(;;){let L=v>0?(Math.floor(A/a)+1)*a:(Math.ceil(A/a)-1)*a,D=w>0?(Math.floor(M/a)+1)*a:(Math.ceil(M/a)-1)*a,F=Math.abs(A-L),U=Math.abs(M-D),C=Math.abs(A-g),k=Math.abs(M-x),H=_?F/T:Number.POSITIVE_INFINITY,$=b?U/S:Number.POSITIVE_INFINITY;if((C<=F||!_)&&(k<=U||!b))break;if(H<$&&_||!b){A=L,M=M+w*H;let K=new ps.default(A,Math.round(M));(s[s.length-1].x!==K.x||s[s.length-1].y!==K.y)&&s.push(K)}else{A=A+v*$,M=D;let K=new ps.default(Math.round(A),M);(s[s.length-1].x!==K.x||s[s.length-1].y!==K.y)&&s.push(K)}}let I=new ps.default(g,x);(s[s.length-1].x!==I.x||s[s.length-1].y!==I.y)&&s.push(I)}return s}l(yo,"subdivideVertexLine");function LF(r){let e=[],t=[];for(let n of r)if(n.length!==0){n!==r[0]&&e.push(t.length/2);for(let i=0;i<n.length;i++)t.push(n[i].x),t.push(n[i].y)}return{flattened:t,holeIndices:e}}l(LF,"flatten");function kF(r,e){let t=[];for(let n=0;n<e.length;n+=3){let i=e[n],o=e[n+1],a=e[n+2],s=r[i*2],u=r[i*2+1],c=r[o*2],p=r[o*2+1],h=r[a*2],m=r[a*2+1],f=c-s,d=p-u,g=h-s,x=m-u;f*x-d*g>0?(t.push(i),t.push(a),t.push(o)):(t.push(i),t.push(o),t.push(a))}return t}l(kF,"fixWindingOrder");function RF(r,e,t){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let n=0,i=r[e[0]*2];for(let u=1;u<e.length;u++){let c=r[e[u]*2];c<i&&(i=c,n=u)}let o=e.length,a=n,s=(a+1)%o;for(;;){let u=a-1>=0?a-1:o-1,c=(s+1)%o,p=r[e[u]*2],h=r[e[u]*2+1],m=r[e[c]*2],f=r[e[c]*2+1],d=r[e[a]*2],g=r[e[a]*2+1],x=r[e[s]*2],_=r[e[s]*2+1],b=!1;if(p<m)b=!0;else if(p>m)b=!1;else{let v=x-d,T=_-g,S=-v,A=g<_?1:-1,M=((p-d)*T+(h-g)*S)*A,I=((m-d)*T+(f-g)*S)*A;M>I&&(b=!0)}if(b){let v=e[u],w=e[a],T=e[s];v!==w&&v!==T&&w!==T&&t.push(T,w,v),a--,a<0&&(a=o-1)}else{let v=e[c],w=e[a],T=e[s];v!==w&&v!==T&&w!==T&&t.push(T,w,v),s++,s>=o&&(s=0)}if(u===c)break}}l(RF,"scanlineTriangulateVertexRing");y();function kc(r,e,t,n,i,o,a,s,u){let c=i.length/2,p=a&&s&&u;if(c<he.MAX_VERTEX_ARRAY_LENGTH){let h=e.prepareSegment(c,t,n),m=h.vertexLength;for(let g=0;g<o.length;g+=3)n.emplaceBack(m+o[g],m+o[g+1],m+o[g+2]);h.vertexLength+=c,h.primitiveLength+=o.length/3;let f,d;p&&(d=a.prepareSegment(c,t,s),f=d.vertexLength,d.vertexLength+=c);for(let g=0;g<i.length;g+=2)r(i[g],i[g+1]);if(p)for(let g=0;g<u.length;g++){let x=u[g];for(let _=1;_<x.length;_+=2)s.emplaceBack(f+x[_-1],f+x[_]);d.primitiveLength+=x.length/2}}else DF(e,t,n,i,o,r),p&&FF(a,t,s,i,u,r),e.forceNewSegmentOnNextPrepare(),a==null||a.forceNewSegmentOnNextPrepare()}l(kc,"fillLargeMeshArrays");function hs(r,e,t,n,i,o,a){if(o){let s=n.count;return t(e[i*2],e[i*2+1]),r[i]=n.count,n.count++,a.vertexLength++,s}else return r[i]}l(hs,"copyOrReuseVertex");function DF(r,e,t,n,i,o){let a=[];for(let h=0;h<n.length/2;h++)a.push(-1);let s={count:0},u=0,c=r.getOrCreateLatestSegment(e,t),p=c.vertexLength;for(let h=2;h<i.length;h+=3){let m=i[h-2],f=i[h-1],d=i[h],g=a[m]<u,x=a[f]<u,_=a[d]<u,b=(g?1:0)+(x?1:0)+(_?1:0);c.vertexLength+b>he.MAX_VERTEX_ARRAY_LENGTH&&(c=r.createNewSegment(e,t),u=s.count,g=!0,x=!0,_=!0,p=0);let v=hs(a,n,o,s,m,g,c),w=hs(a,n,o,s,f,x,c),T=hs(a,n,o,s,d,_,c);t.emplaceBack(p+v-u,p+w-u,p+T-u),c.primitiveLength++}}l(DF,"fillSegmentsTriangles");function FF(r,e,t,n,i,o){let a=[];for(let h=0;h<n.length/2;h++)a.push(-1);let s={count:0},u=0,c=r.getOrCreateLatestSegment(e,t),p=c.vertexLength;for(let h=0;h<i.length;h++){let m=i[h];for(let f=1;f<i[h].length;f+=2){let d=m[f-1],g=m[f],x=a[d]<u,_=a[g]<u,b=(x?1:0)+(_?1:0);c.vertexLength+b>he.MAX_VERTEX_ARRAY_LENGTH&&(c=r.createNewSegment(e,t),u=s.count,x=!0,_=!0,p=0);let v=hs(a,n,o,s,d,x,c),w=hs(a,n,o,s,g,_,c);t.emplaceBack(p+v-u,p+w-u),c.primitiveLength++}}}l(FF,"fillSegmentsLines");var zF=500,lg=class lg{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new oc,this.indexArray=new Ne,this.indexArray2=new Tn,this.programConfigurations=new Lt(e.layers,e.zoom),this.segments=new he,this.segments2=new he,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,n){this.hasPattern=ho("fill",this.layers,t);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:u,index:c,sourceLayerIndex:p}of e){let h=this.layers[0]._featureFilter.needGeometry,m=Rt(s,h);if(!this.layers[0]._featureFilter.filter(new ve(this.zoom,{globalState:this.globalState}),m,n))continue;let f=o?i.evaluate(m,{},n,t.availableImages):void 0,d={id:u,properties:s.properties,type:s.type,sourceLayerIndex:p,index:c,geometry:h?m.geometry:kt(s),patterns:{},sortKey:f};a.push(d)}o&&a.sort((s,u)=>s.sortKey-u.sortKey);for(let s of a){let{geometry:u,index:c,sourceLayerIndex:p}=s;if(this.hasPattern){let m=mo("fill",this.layers,s,this.zoom,t);this.patternFeatures.push(m)}else this.addFeature(s,u,c,n,{},t.subdivisionGranularity);let h=e[c].feature;t.featureIndex.insert(h,u,c,p,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,aP),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,n,i,o,a){for(let s of Ta(t,zF)){let u=Lc(s,i,a.fill.getGranularityForZoomLevel(i.z)),c=this.layoutVertexArray;kc((p,h)=>{c.emplaceBack(p,h)},this.segments,this.layoutVertexArray,this.indexArray,u.verticesFlattened,u.indicesTriangles,this.segments2,this.indexArray2,u.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};l(lg,"FillBucket");var ms=lg;Z("FillBucket",ms,{omit:["layers","patternFeatures"]});y();var hP,BF=l(()=>hP=hP||new ke({"fill-sort-key":new ee(E.layout_fill["fill-sort-key"])}),"getLayout"),mP,OF=l(()=>mP=mP||new ke({"fill-antialias":new q(E.paint_fill["fill-antialias"]),"fill-opacity":new ee(E.paint_fill["fill-opacity"]),"fill-color":new ee(E.paint_fill["fill-color"]),"fill-outline-color":new ee(E.paint_fill["fill-outline-color"]),"fill-translate":new q(E.paint_fill["fill-translate"]),"fill-translate-anchor":new q(E.paint_fill["fill-translate-anchor"]),"fill-pattern":new Hr(E.paint_fill["fill-pattern"])}),"getPaint"),fP={get paint(){return OF()},get layout(){return BF()}};var dP=l(r=>r.type==="fill","isFillStyleLayer"),ug=class ug extends He{constructor(e){super(e,fP)}recalculate(e,t){super.recalculate(e,t);let n=this.paint._values["fill-outline-color"];n.value.kind==="constant"&&n.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new ms(e)}queryRadius(){return Cn(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:n,pixelsToTileUnits:i}){let o=An(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-n.bearingInRadians,i);return bc(o,t)}isTileClipped(){return!0}};l(ug,"FillStyleLayer");var Rc=ug;y();y();y();var VF=Ee([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),yP=Ee([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:gP,size:tN,alignment:rN}=VF;var TP=oe(fs(),1);var KF=TP.default.VectorTileFeature.types,JF=500,hg=Math.pow(2,13);function ds(r,e,t,n,i,o,a,s){r.emplaceBack(e,t,Math.floor(n*hg)*2+a,i*hg*2,o*hg*2,Math.round(s))}l(ds,"addVertex");var mg=class mg{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new ac,this.centroidVertexArray=new mt,this.indexArray=new Ne,this.programConfigurations=new Lt(e.layers,e.zoom),this.segments=new he,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,n){this.features=[],this.hasPattern=ho("fill-extrusion",this.layers,t);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of e){let u=this.layers[0]._featureFilter.needGeometry,c=Rt(i,u);if(!this.layers[0]._featureFilter.filter(new ve(this.zoom,{globalState:this.globalState}),c,n))continue;let p={id:o,sourceLayerIndex:s,index:a,geometry:u?c.geometry:kt(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(mo("fill-extrusion",this.layers,p,this.zoom,t)):this.addFeature(p,p.geometry,a,n,{},t.subdivisionGranularity),t.featureIndex.insert(i,p.geometry,a,s,this.index,!0)}}addFeatures(e,t,n){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,t,n,e.subdivisionGranularity)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,gP),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,yP.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,n,i,o,a){for(let s of Ta(t,JF)){let u={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(u,i,e,s,a);let p=this.layoutVertexArray.length-c,h=Math.floor(u.x/u.sampleCount),m=Math.floor(u.y/u.sampleCount);for(let f=0;f<p;f++)this.centroidVertexArray.emplaceBack(h,m)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}processPolygon(e,t,n,i,o){if(i.length<1||PP(i[0]))return;for(let h of i)h.length!==0&&QF(e,h);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=o.fill.getGranularityForZoomLevel(t.z),u=KF[n.type]==="Polygon";for(let h of i){if(h.length===0||PP(h))continue;let m=yo(h,s,u);this._generateSideFaces(m,a)}if(!u)return;let c=Lc(i,t,s,!1),p=this.layoutVertexArray;kc((h,m)=>{ds(p,h,m,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,c.verticesFlattened,c.indicesTriangles)}_generateSideFaces(e,t){let n=0;for(let i=1;i<e.length;i++){let o=e[i],a=e[i-1];if(ez(o,a))continue;t.segment.vertexLength+4>he.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=o.sub(a)._perp()._unit(),u=a.dist(o);n+u>32768&&(n=0),ds(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,n),ds(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,n),n+=u,ds(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,n),ds(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,n);let c=t.segment.vertexLength;this.indexArray.emplaceBack(c,c+2,c+1),this.indexArray.emplaceBack(c+1,c+2,c+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}};l(mg,"FillExtrusionBucket");var ys=mg;function QF(r,e){for(let t=0;t<e.length;t++){let n=e[t];t===e.length-1&&e[0].x===n.x&&e[0].y===n.y||(r.x+=n.x,r.y+=n.y,r.sampleCount++)}}l(QF,"accumulatePointsToCentroid");Z("FillExtrusionBucket",ys,{omit:["layers","features"]});function ez(r,e){return r.x===e.x&&(r.x<0||r.x>8192)||r.y===e.y&&(r.y<0||r.y>8192)}l(ez,"isBoundaryEdge");function PP(r){return r.every(e=>e.x<0)||r.every(e=>e.x>8192)||r.every(e=>e.y<0)||r.every(e=>e.y>8192)}l(PP,"isEntirelyOutside");y();var SP,tz=l(()=>SP=SP||new ke({"fill-extrusion-opacity":new q(E["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ee(E["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new q(E["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new q(E["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Hr(E["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ee(E["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ee(E["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new q(E["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),"getPaint"),MP={get paint(){return tz()}};var Fc=oe(ue(),1);var AP=l(r=>r.type==="fill-extrusion","isFillExtrusionStyleLayer"),fg=class fg extends He{constructor(e){super(e,MP)}createBucket(e){return new ys(e)}queryRadius(){return Cn(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){let u=An(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),c=this.paint.get("fill-extrusion-height").evaluate(t,n),p=this.paint.get("fill-extrusion-base").evaluate(t,n),h=iz(u,s,0),m=nz(i,p,c,s),f=m[0],d=m[1];return rz(f,d,h)}};l(fg,"FillExtrusionStyleLayer");var zc=fg;function gs(r,e){return r.x*e.x+r.y*e.y}l(gs,"dot");function CP(r,e){if(r.length===1){let t=0,n=e[t++],i;for(;!i||n.equals(i);)if(i=e[t++],!i)return 1/0;for(;t<e.length;t++){let o=e[t],a=r[0],s=i.sub(n),u=o.sub(n),c=a.sub(n),p=gs(s,s),h=gs(s,u),m=gs(u,u),f=gs(c,s),d=gs(c,u),g=p*m-h*h,x=(m*f-h*d)/g,_=(p*d-h*f)/g,b=1-x-_,v=n.z*b+i.z*x+o.z*_;if(isFinite(v))return v}return 1/0}else{let t=1/0;for(let n of e)t=Math.min(t,n.z);return t}}l(CP,"getIntersectionDistance");function rz(r,e,t){let n=1/0;bc(t,e)&&(n=CP(t,e[0]));for(let i=0;i<e.length;i++){let o=e[i],a=r[i];for(let s=0;s<o.length-1;s++){let u=o[s],c=o[s+1],p=a[s],h=a[s+1],m=[u,c,h,p,u];_c(t,m)&&(n=Math.min(n,CP(t,m)))}}return n===1/0?!1:n}l(rz,"checkIntersection");function nz(r,e,t,n){let i=[],o=[],a=n[8]*e,s=n[9]*e,u=n[10]*e,c=n[11]*e,p=n[8]*t,h=n[9]*t,m=n[10]*t,f=n[11]*t;for(let d of r){let g=[],x=[];for(let _ of d){let b=_.x,v=_.y,w=n[0]*b+n[4]*v+n[12],T=n[1]*b+n[5]*v+n[13],S=n[2]*b+n[6]*v+n[14],A=n[3]*b+n[7]*v+n[15],M=w+a,I=T+s,L=S+u,D=A+c,F=w+p,U=T+h,C=S+m,k=A+f,H=new Fc.default(M/D,I/D);H.z=L/D,g.push(H);let $=new Fc.default(F/k,U/k);$.z=C/k,x.push($)}i.push(g),o.push(x)}return[i,o]}l(nz,"projectExtrusion");function iz(r,e,t){let n=[];for(let i of r){let o=[i.x,i.y,t,1];Re.transformMat4(o,o,e),n.push(new Fc.default(o[0]/o[3],o[1]/o[3]))}return n}l(iz,"projectQueryGeometry");y();y();y();var oz=Ee([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:IP,size:JN,alignment:QN}=oz;y();var az=Ee([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:EP,size:nG,alignment:iG}=az;var RP=oe(fs(),1);var sz=RP.default.VectorTileFeature.types,LP=63,lz=Math.cos(75/2*(Math.PI/180)),uz=15,cz=20,pz=15,DP=1/2,kP=Math.pow(2,pz-1)/DP,dg=class dg{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new sc,this.layoutVertexArray2=new lc,this.indexArray=new Ne,this.programConfigurations=new Lt(e.layers,e.zoom),this.segments=new he,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,n){this.hasPattern=ho("line",this.layers,t);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:u,index:c,sourceLayerIndex:p}of e){let h=this.layers[0]._featureFilter.needGeometry,m=Rt(s,h);if(!this.layers[0]._featureFilter.filter(new ve(this.zoom,{globalState:this.globalState}),m,n))continue;let f=o?i.evaluate(m,{},n):void 0,d={id:u,properties:s.properties,type:s.type,sourceLayerIndex:p,index:c,geometry:h?m.geometry:kt(s),patterns:{},sortKey:f};a.push(d)}o&&a.sort((s,u)=>s.sortKey-u.sortKey);for(let s of a){let{geometry:u,index:c,sourceLayerIndex:p}=s;if(this.hasPattern){let m=mo("line",this.layers,s,this.zoom,t);this.patternFeatures.push(m)}else this.addFeature(s,u,c,n,{},t.subdivisionGranularity);let h=e[c].feature;t.featureIndex.insert(h,u,c,p,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,EP)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,IP),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let t=+e.properties.mapbox_clip_start,n=+e.properties.mapbox_clip_end;return{start:t,end:n}}}addFeature(e,t,n,i,o,a){let s=this.layers[0].layout,u=s.get("line-join").evaluate(e,{}),c=s.get("line-cap"),p=s.get("line-miter-limit"),h=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let m of t)this.addLine(m,e,u,c,p,h,i,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}addLine(e,t,n,i,o,a,s,u){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let c=s?u.line.getGranularityForZoomLevel(s.z):1;if(e=yo(e,c),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let w=0;w<e.length-1;w++)this.totalDistance+=e[w].dist(e[w+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let p=sz[t.type]==="Polygon",h=e.length;for(;h>=2&&e[h-1].equals(e[h-2]);)h--;let m=0;for(;m<h-1&&e[m].equals(e[m+1]);)m++;if(h<(p?3:2))return;n==="bevel"&&(o=1.05);let f=this.overscaling<=16?uz*8192/(512*this.overscaling):0,d=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),g,x,_,b,v;this.e1=this.e2=-1,p&&(g=e[h-2],v=e[m].sub(g)._unit()._perp());for(let w=m;w<h;w++){if(_=w===h-1?p?e[m+1]:void 0:e[w+1],_&&e[w].equals(_))continue;v&&(b=v),g&&(x=g),g=e[w],v=_?_.sub(g)._unit()._perp():b,b=b||v;let T=b.add(v);(T.x!==0||T.y!==0)&&T._unit();let S=b.x*v.x+b.y*v.y,A=T.x*v.x+T.y*v.y,M=A!==0?1/A:1/0,I=2*Math.sqrt(2-2*A),L=A<lz&&x&&_,D=b.x*v.y-b.y*v.x>0;if(L&&w>m){let C=g.dist(x);if(C>2*f){let k=g.sub(g.sub(x)._mult(f/C)._round());this.updateDistance(x,k),this.addCurrentVertex(k,b,0,0,d),x=k}}let F=x&&_,U=F?n:p?"butt":i;if(F&&U==="round"&&(M<a?U="miter":M<=2&&(U="fakeround")),U==="miter"&&M>o&&(U="bevel"),U==="bevel"&&(M>2&&(U="flipbevel"),M<o&&(U="miter")),x&&this.updateDistance(x,g),U==="miter")T._mult(M),this.addCurrentVertex(g,T,0,0,d);else if(U==="flipbevel"){if(M>100)T=v.mult(-1);else{let C=M*b.add(v).mag()/b.sub(v).mag();T._perp()._mult(C*(D?-1:1))}this.addCurrentVertex(g,T,0,0,d),this.addCurrentVertex(g,T.mult(-1),0,0,d)}else if(U==="bevel"||U==="fakeround"){let C=-Math.sqrt(M*M-1),k=D?C:0,H=D?0:C;if(x&&this.addCurrentVertex(g,b,k,H,d),U==="fakeround"){let $=Math.round(I*180/Math.PI/cz);for(let K=1;K<$;K++){let me=K/$;if(me!==.5){let _e=me-.5,ye=1.0904+S*(-3.2452+S*(3.55645-S*1.43519)),We=.848013+S*(-1.06021+S*.215638);me=me+me*_e*(me-1)*(ye*_e*_e+We)}let Ve=v.sub(b)._mult(me)._add(b)._unit()._mult(D?-1:1);this.addHalfVertex(g,Ve.x,Ve.y,!1,D,0,d)}}_&&this.addCurrentVertex(g,v,-k,-H,d)}else if(U==="butt")this.addCurrentVertex(g,T,0,0,d);else if(U==="square"){let C=x?1:-1;this.addCurrentVertex(g,T,C,C,d)}else U==="round"&&(x&&(this.addCurrentVertex(g,b,0,0,d),this.addCurrentVertex(g,b,1,1,d,!0)),_&&(this.addCurrentVertex(g,v,-1,-1,d,!0),this.addCurrentVertex(g,v,0,0,d)));if(L&&w<h-1){let C=g.dist(_);if(C>2*f){let k=g.add(_.sub(g)._mult(f/C)._round());this.updateDistance(g,k),this.addCurrentVertex(k,v,0,0,d),g=k}}}}addCurrentVertex(e,t,n,i,o,a=!1){let s=t.x+t.y*n,u=t.y-t.x*n,c=-t.x+t.y*i,p=-t.y-t.x*i;this.addHalfVertex(e,s,u,a,!1,n,o),this.addHalfVertex(e,c,p,a,!0,-i,o),this.distance>kP/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,n,i,o,a))}addHalfVertex({x:e,y:t},n,i,o,a,s,u){let p=(this.lineClips?this.scaledDistance*(kP-1):this.scaledDistance)*DP;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(t<<1)+(a?1:0),Math.round(LP*n)+128,Math.round(LP*i)+128,(s===0?0:s<0?-1:1)+1|(p&63)<<2,p>>6),this.lineClips){let m=this.scaledDistance-this.lineClips.start,f=this.lineClips.end-this.lineClips.start,d=m/f;this.layoutVertexArray2.emplaceBack(d,this.lineClipsArray.length)}let h=u.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,h,this.e2),u.primitiveLength++),a?this.e2=h:this.e1=h}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}};l(dg,"LineBucket");var xs=dg;Z("LineBucket",xs,{omit:["layers","patternFeatures"]});y();var FP,hz=l(()=>FP=FP||new ke({"line-cap":new q(E.layout_line["line-cap"]),"line-join":new ee(E.layout_line["line-join"]),"line-miter-limit":new q(E.layout_line["line-miter-limit"]),"line-round-limit":new q(E.layout_line["line-round-limit"]),"line-sort-key":new ee(E.layout_line["line-sort-key"])}),"getLayout"),zP,mz=l(()=>zP=zP||new ke({"line-opacity":new ee(E.paint_line["line-opacity"]),"line-color":new ee(E.paint_line["line-color"]),"line-translate":new q(E.paint_line["line-translate"]),"line-translate-anchor":new q(E.paint_line["line-translate-anchor"]),"line-width":new ee(E.paint_line["line-width"]),"line-gap-width":new ee(E.paint_line["line-gap-width"]),"line-offset":new ee(E.paint_line["line-offset"]),"line-blur":new ee(E.paint_line["line-blur"]),"line-dasharray":new mi(E.paint_line["line-dasharray"]),"line-pattern":new Hr(E.paint_line["line-pattern"]),"line-gradient":new Wr(E.paint_line["line-gradient"])}),"getPaint"),yg={get paint(){return mz()},get layout(){return hz()}};var xg=class xg extends ee{possiblyEvaluate(e,t){return t=new ve(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,i){return t=G({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,i)}};l(xg,"LineFloorwidthProperty");var gg=xg,Bc,OP=l(r=>r.type==="line","isLineStyleLayer"),_g=class _g extends He{constructor(e){super(e,yg),this.gradientVersion=0,Bc||(Bc=new gg(yg.paint.properties["line-width"].specification),Bc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();K1(t)?this.stepInterpolant=t._styleExpression.expression instanceof Ji:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=Bc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new xs(e)}queryRadius(e){let t=e,n=BP(xi("line-width",this,t),xi("line-gap-width",this,t)),i=xi("line-offset",this,t);return n/2+Math.abs(i)+Cn(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a}){let s=An(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),u=a/2*BP(this.paint.get("line-width").evaluate(t,n),this.paint.get("line-gap-width").evaluate(t,n)),c=this.paint.get("line-offset").evaluate(t,n);return c&&(i=Gw(i,c*a)),Uw(s,i,u)}isTileClipped(){return!0}};l(_g,"LineStyleLayer");var Oc=_g;function BP(r,e){return e>0?e+2*r:r}l(BP,"getLineWidth");y();y();y();var VP=Ee([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),UP=Ee([{name:"a_projected_pos",components:3,type:"Float32"}],4),GG=Ee([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),jP=Ee([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),ZG=Ee([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),bg=Ee([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),NP=Ee([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),qG=Ee([{name:"triangle",components:3,type:"Uint16"}]),HG=Ee([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),WG=Ee([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),$G=Ee([{type:"Float32",name:"offsetX"}]),XG=Ee([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),YG=Ee([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var vs=oe(ue(),1);y();function fz(r,e,t){let n=e.layout.get("text-transform").evaluate(t,{});return n==="uppercase"?r=r.toLocaleUpperCase():n==="lowercase"&&(r=r.toLocaleLowerCase()),Lr.applyArabicShaping&&(r=Lr.applyArabicShaping(r)),r}l(fz,"transformTextInternal");function GP(r,e,t){return r.sections.forEach(n=>{n.text=fz(n.text,e,t)}),r}l(GP,"transformText");y();function ZP(r){let e={},t={},n=[],i=0;function o(c){n.push(r[c]),i++}l(o,"add");function a(c,p,h){let m=t[c];return delete t[c],t[p]=m,n[m].geometry[0].pop(),n[m].geometry[0]=n[m].geometry[0].concat(h[0]),m}l(a,"mergeFromRight");function s(c,p,h){let m=e[p];return delete e[p],e[c]=m,n[m].geometry[0].shift(),n[m].geometry[0]=h[0].concat(n[m].geometry[0]),m}l(s,"mergeFromLeft");function u(c,p,h){let m=h?p[0][p[0].length-1]:p[0][0];return"".concat(c,":").concat(m.x,":").concat(m.y)}l(u,"getKey");for(let c=0;c<r.length;c++){let p=r[c],h=p.geometry,m=p.text?p.text.toString():null;if(!m){o(c);continue}let f=u(m,h),d=u(m,h,!0);if(f in t&&d in e&&t[f]!==e[d]){let g=s(f,d,h),x=a(f,d,n[g].geometry);delete e[f],delete t[d],t[u(m,n[x].geometry,!0)]=x,n[g].geometry=null}else f in t?a(f,d,h):d in e?s(f,d,h):(o(c),e[f]=i-1,t[d]=i-1)}return n.filter(c=>c.geometry)}l(ZP,"mergeLines");y();y();var qP={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};y();var En=24;y();var QP=oe(Pg(),1);var JP=3;function kz(r,e,t){r===1&&t.readMessage(Rz,e)}l(kz,"readFontstacks");function Rz(r,e,t){if(r===3){let{id:n,bitmap:i,width:o,height:a,left:s,top:u,advance:c}=t.readMessage(Dz,{});e.push({id:n,bitmap:new _i({width:o+2*JP,height:a+2*JP},i),metrics:{width:o,height:a,left:s,top:u,advance:c}})}}l(Rz,"readFontstack");function Dz(r,e,t){r===1?e.id=t.readVarint():r===2?e.bitmap=t.readBytes():r===3?e.width=t.readVarint():r===4?e.height=t.readVarint():r===5?e.left=t.readSVarint():r===6?e.top=t.readSVarint():r===7&&(e.advance=t.readVarint())}l(Dz,"readGlyph");function eT(r){return new QP.default(r).readFields(kz,[])}l(eT,"parseGlyphPbf");y();function tT(r){let{userImage:e}=r;return e&&e.render&&e.render()?(r.data.replace(new Uint8Array(e.data.buffer)),!0):!1}l(tT,"renderStyleImage");y();y();function _s(r){let e=0,t=0;for(let s of r)e+=s.w*s.h,t=Math.max(t,s.w);r.sort((s,u)=>u.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),t),h:1/0}],o=0,a=0;for(let s of r)for(let u=i.length-1;u>=0;u--){let c=i[u];if(!(s.w>c.w||s.h>c.h)){if(s.x=c.x,s.y=c.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===c.w&&s.h===c.h){let p=i.pop();u<i.length&&(i[u]=p)}else s.h===c.h?(c.x+=s.w,c.w-=s.w):s.w===c.w?(c.y+=s.h,c.h-=s.h):(i.push({x:c.x+s.w,y:c.y,w:c.w-s.w,h:s.h}),c.y+=s.h,c.h-=s.h);break}}return{w:o,h:a,fill:e/(o*a)||0}}l(_s,"potpack");var Dt=1;var Sg=class Sg{constructor(e,{pixelRatio:t,version:n,stretchX:i,stretchY:o,content:a,textFitWidth:s,textFitHeight:u}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n,this.textFitWidth=s,this.textFitHeight=u}get tl(){return[this.paddedRect.x+Dt,this.paddedRect.y+Dt]}get br(){return[this.paddedRect.x+this.paddedRect.w-Dt,this.paddedRect.y+this.paddedRect.h-Dt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-Dt*2)/this.pixelRatio,(this.paddedRect.h-Dt*2)/this.pixelRatio]}};l(Sg,"ImagePosition");var bo=Sg,Mg=class Mg{constructor(e,t){let n={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,n,o),this.addImages(t,i,o);let{w:a,h:s}=_s(o),u=new Se({width:a||1,height:s||1});for(let c in e){let p=e[c],h=n[c].paddedRect;Se.copy(p.data,u,{x:0,y:0},{x:h.x+Dt,y:h.y+Dt},p.data)}for(let c in t){let p=t[c],h=i[c].paddedRect,m=h.x+Dt,f=h.y+Dt,d=p.data.width,g=p.data.height;Se.copy(p.data,u,{x:0,y:0},{x:m,y:f},p.data),Se.copy(p.data,u,{x:0,y:g-1},{x:m,y:f-1},{width:d,height:1}),Se.copy(p.data,u,{x:0,y:0},{x:m,y:f+g},{width:d,height:1}),Se.copy(p.data,u,{x:d-1,y:0},{x:m-1,y:f},{width:1,height:g}),Se.copy(p.data,u,{x:0,y:0},{x:m+d,y:f},{width:1,height:g})}this.image=u,this.iconPositions=n,this.patternPositions=i}addImages(e,t,n){for(let i in e){let o=e[i],a={x:0,y:0,w:o.data.width+2*Dt,h:o.data.height+2*Dt};n.push(a),t[i]=new bo(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),t),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),t)}patchUpdatedImage(e,t,n){if(!e||!t||e.version===t.version)return;e.version=t.version;let[i,o]=e.tl;n.update(t.data,void 0,{x:i,y:o})}};l(Mg,"ImageAtlas");var Tg=Mg;Z("ImagePosition",bo);Z("ImageAtlas",Tg);var vi=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(vi||{});function jc(r){let e=.5,t=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0;break}switch(r){case"bottom":case"bottom-right":case"bottom-left":t=1;break;case"top":case"top-right":case"top-left":t=0;break}return{horizontalAlign:e,verticalAlign:t}}l(jc,"getAnchorAlignment");var iT=oe(fs(),1);y();var rT=255,bs=128,Nc=rT*bs;function Cg(r,e){let{expression:t}=e;if(t.kind==="constant")return{kind:"constant",layoutSize:t.evaluate(new ve(r+1))};if(t.kind==="source")return{kind:"source"};{let{zoomStops:n,interpolationType:i}=t,o=0;for(;o<n.length&&n[o]<=r;)o++;o=Math.max(0,o-1);let a=o;for(;a<n.length&&n[a]<r+1;)a++;a=Math.min(n.length-1,a);let s=n[o],u=n[a];if(t.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:u,interpolationType:i};let c=t.evaluate(new ve(s)),p=t.evaluate(new ve(u));return{kind:"camera",minZoom:s,maxZoom:u,minSize:c,maxSize:p,interpolationType:i}}}l(Cg,"getSizeData");function vo(r,{uSize:e,uSizeT:t},{lowerSize:n,upperSize:i}){return r.kind==="source"?n/bs:r.kind==="composite"?Ae.number(n/bs,i/bs,t):e}l(vo,"evaluateSizeForFeature");function wi(r,e){let t=0,n=0;if(r.kind==="constant")n=r.layoutSize;else if(r.kind!=="source"){let{interpolationType:i,minZoom:o,maxZoom:a}=r,s=i?se(Tt.interpolationFactor(i,e,o,a),0,1):0;r.kind==="camera"?n=Ae.number(r.minSize,r.maxSize,s):t=s}return{uSizeT:t,uSize:n}}l(wi,"evaluateSizeForZoom");y();function wo(r,e,t){let n="never",i=r.get(e);return i?n=i:r.get(t)&&(n="always"),n}l(wo,"getOverlapMode");var zz=iT.default.VectorTileFeature.types,Bz=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Gc(r,e,t,n,i,o,a,s,u,c,p,h,m){let f=s?Math.min(Nc,Math.round(s[0])):0,d=s?Math.min(Nc,Math.round(s[1])):0;r.emplaceBack(e,t,Math.round(n*32),Math.round(i*32),o,a,(f<<1)+(u?1:0),d,c*16,p*16,h*256,m*256)}l(Gc,"addVertex");function Pi(r,e,t){r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t)}l(Pi,"addDynamicAttributes");function Oz(r){for(let e of r.sections)if(Sw(e.text))return!0;return!1}l(Oz,"containsRTLText");var Ag=class Ag{constructor(e){this.layoutVertexArray=new uc,this.indexArray=new Ne,this.programConfigurations=e,this.segments=new he,this.dynamicLayoutVertexArray=new cc,this.opacityVertexArray=new pc,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ha}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,VP.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,UP.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Bz,!0),this.opacityVertexBuffer.itemSize=1),(n||i)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};l(Ag,"SymbolBuffers");var ws=Ag;Z("SymbolBuffers",ws);var Ig=class Ig{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new he,this.collisionVertexArray=new mc}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,jP.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};l(Ig,"CollisionBuffers");var Ps=Ig;Z("CollisionBuffers",Ps);var Eg=class Eg{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(u=>u.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cg(this.zoom,n["text-size"]),this.iconSizeData=Cg(this.zoom,n["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=wo(i,"text-overlap","text-allow-overlap")!=="never"||wo(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(u=>vi[u])),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.sourceID=e.sourceID}createArrays(){this.text=new ws(new Lt(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new ws(new Lt(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new $a,this.lineVertexArray=new Xa,this.symbolInstances=new Wa,this.textAnchorOffsets=new Ya}calculateGlyphDependencies(e,t,n,i,o){for(let a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,(n||i)&&o){let s=qP[e.charAt(a)];s&&(t[s.charCodeAt(0)]=!0)}}populate(e,t,n){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),u=o.get("icon-image"),c=(s.value.kind!=="constant"||s.value.value instanceof jt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),p=u.value.kind!=="constant"||!!u.value.value||Object.keys(u.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!c&&!p)return;let m=t.iconDependencies,f=t.glyphDependencies,d=t.availableImages,g=new ve(this.zoom,{globalState:this.globalState});for(let{feature:x,id:_,index:b,sourceLayerIndex:v}of e){let w=i._featureFilter.needGeometry,T=Rt(x,w);if(!i._featureFilter.filter(g,T,n))continue;w||(T.geometry=kt(x));let S;if(c){let L=i.getValueAndResolveTokens("text-field",T,n,d),D=jt.factory(L),F=this.hasRTLText=this.hasRTLText||Oz(D);(!F||Lr.getRTLTextPluginStatus()==="unavailable"||F&&Lr.isParsed())&&(S=GP(D,i,T))}let A;if(p){let L=i.getValueAndResolveTokens("icon-image",T,n,d);L instanceof Et?A=L:A=Et.fromString(L)}if(!S&&!A)continue;let M=this.sortFeaturesByKey?h.evaluate(T,{},n):void 0,I={id:_,text:S,icon:A,index:b,sourceLayerIndex:v,geometry:T.geometry,properties:x.properties,type:zz[x.type],sortKey:M};if(this.features.push(I),A&&(m[A.name]=!0),S){let L=a.evaluate(T,{},n).join(","),D=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let F of S.sections)if(F.image)m[F.image.name]=!0;else{let U=Yf(S.toString()),C=F.fontStack||L,k=f[C]=f[C]||{};this.calculateGlyphDependencies(F.text,k,D,this.allowVerticalPlacement,U)}}}o.get("symbol-placement")==="line"&&(this.features=ZP(this.features)),this.sortFeaturesByKey&&this.features.sort((x,_)=>x.sortKey-_.sortKey)}update(e,t,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let n=this.lineVertexArray.length;if(e.segment!==void 0){let i=e.dist(t[e.segment+1]),o=e.dist(t[e.segment]),a={};for(let s=e.segment+1;s<t.length;s++)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:i},s<t.length-1&&(i+=t[s+1].dist(t[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=t[s-1].dist(t[s]));for(let s=0;s<t.length;s++){let u=a[s];this.lineVertexArray.emplaceBack(u.x,u.y,u.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,t,n,i,o,a,s,u,c,p,h,m){let f=e.indexArray,d=e.layoutVertexArray,g=e.segments.prepareSegment(4*t.length,d,f,this.canOverlap?a.sortKey:void 0),x=this.glyphOffsetArray.length,_=g.vertexLength,b=this.allowVerticalPlacement&&s===2?Math.PI/2:0,v=a.text&&a.text.sections;for(let w=0;w<t.length;w++){let{tl:T,tr:S,bl:A,br:M,tex:I,pixelOffsetTL:L,pixelOffsetBR:D,minFontScaleX:F,minFontScaleY:U,glyphOffset:C,isSDF:k,sectionIndex:H}=t[w],$=g.vertexLength,K=C[1];Gc(d,u.x,u.y,T.x,K+T.y,I.x,I.y,n,k,L.x,L.y,F,U),Gc(d,u.x,u.y,S.x,K+S.y,I.x+I.w,I.y,n,k,D.x,L.y,F,U),Gc(d,u.x,u.y,A.x,K+A.y,I.x,I.y+I.h,n,k,L.x,D.y,F,U),Gc(d,u.x,u.y,M.x,K+M.y,I.x+I.w,I.y+I.h,n,k,D.x,D.y,F,U),Pi(e.dynamicLayoutVertexArray,u,b),f.emplaceBack($,$+2,$+1),f.emplaceBack($+1,$+2,$+3),g.vertexLength+=4,g.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(C[0]),(w===t.length-1||H!==t[w+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,a,a.index,{},m,v&&v[H])}e.placedSymbolArray.emplaceBack(u.x,u.y,x,this.glyphOffsetArray.length-x,_,c,p,u.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],s,0,!1,0,h)}_addCollisionDebugVertex(e,t,n,i,o,a){return t.emplaceBack(0,0),e.emplaceBack(n.x,n.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,n,i,o,a,s){let u=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=u.vertexLength,p=o.layoutVertexArray,h=o.collisionVertexArray,m=s.anchorX,f=s.anchorY;this._addCollisionDebugVertex(p,h,a,m,f,new vs.default(e,t)),this._addCollisionDebugVertex(p,h,a,m,f,new vs.default(n,t)),this._addCollisionDebugVertex(p,h,a,m,f,new vs.default(n,i)),this._addCollisionDebugVertex(p,h,a,m,f,new vs.default(e,i)),u.vertexLength+=4;let d=o.indexArray;d.emplaceBack(c,c+1),d.emplaceBack(c+1,c+2),d.emplaceBack(c+2,c+3),d.emplaceBack(c+3,c),u.primitiveLength+=4}addDebugCollisionBoxes(e,t,n,i){for(let o=e;o<t;o++){let a=this.collisionBoxArray.get(o),s=a.x1,u=a.y1,c=a.x2,p=a.y2;this.addCollisionDebugVertices(s,u,c,p,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ps(Ja,bg.members,Tn),this.iconCollisionBox=new Ps(Ja,bg.members,Tn);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,n,i,o,a,s,u,c){let p={};for(let h=t;h<n;h++){let m=e.get(h);p.textBox={x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2,anchorPointX:m.anchorPointX,anchorPointY:m.anchorPointY},p.textFeatureIndex=m.featureIndex;break}for(let h=i;h<o;h++){let m=e.get(h);p.verticalTextBox={x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2,anchorPointX:m.anchorPointX,anchorPointY:m.anchorPointY},p.verticalTextFeatureIndex=m.featureIndex;break}for(let h=a;h<s;h++){let m=e.get(h);p.iconBox={x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2,anchorPointX:m.anchorPointX,anchorPointY:m.anchorPointY},p.iconFeatureIndex=m.featureIndex;break}for(let h=u;h<c;h++){let m=e.get(h);p.verticalIconBox={x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2,anchorPointX:m.anchorPointX,anchorPointY:m.anchorPointY},p.verticalIconFeatureIndex=m.featureIndex;break}return p}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let n=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let n=e.placedSymbolArray.get(t),i=n.vertexStartIndex+n.numGlyphs*4;for(let o=n.vertexStartIndex;o<i;o+=4)e.indexArray.emplaceBack(o,o+2,o+1),e.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),n=Math.cos(e),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let u=this.symbolInstances.get(s);i.push(Math.round(t*u.anchorX+n*u.anchorY)|0),o.push(u.featureIndex)}return a.sort((s,u)=>i[s]-i[u]||o[u]-o[s]),a}addToSortKeyRanges(e,t){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let t of this.symbolInstanceIndexes){let n=this.symbolInstances.get(t);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};l(Eg,"SymbolBucket");var gr=Eg;Z("SymbolBucket",gr,{omit:["layers","collisionBoxArray","features","compareText"]});gr.MAX_GLYPHS=65535;gr.addDynamicAttributes=Pi;y();function oT(r,e){return e.replace(/{([^{}]+)}/g,(t,n)=>r&&n in r?String(r[n]):"")}l(oT,"resolveTokens");y();var aT,Vz=l(()=>aT=aT||new ke({"symbol-placement":new q(E.layout_symbol["symbol-placement"]),"symbol-spacing":new q(E.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new q(E.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ee(E.layout_symbol["symbol-sort-key"]),"symbol-z-order":new q(E.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new q(E.layout_symbol["icon-allow-overlap"]),"icon-overlap":new q(E.layout_symbol["icon-overlap"]),"icon-ignore-placement":new q(E.layout_symbol["icon-ignore-placement"]),"icon-optional":new q(E.layout_symbol["icon-optional"]),"icon-rotation-alignment":new q(E.layout_symbol["icon-rotation-alignment"]),"icon-size":new ee(E.layout_symbol["icon-size"]),"icon-text-fit":new q(E.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new q(E.layout_symbol["icon-text-fit-padding"]),"icon-image":new ee(E.layout_symbol["icon-image"]),"icon-rotate":new ee(E.layout_symbol["icon-rotate"]),"icon-padding":new ee(E.layout_symbol["icon-padding"]),"icon-keep-upright":new q(E.layout_symbol["icon-keep-upright"]),"icon-offset":new ee(E.layout_symbol["icon-offset"]),"icon-anchor":new ee(E.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new q(E.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new q(E.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new q(E.layout_symbol["text-rotation-alignment"]),"text-field":new ee(E.layout_symbol["text-field"]),"text-font":new ee(E.layout_symbol["text-font"]),"text-size":new ee(E.layout_symbol["text-size"]),"text-max-width":new ee(E.layout_symbol["text-max-width"]),"text-line-height":new q(E.layout_symbol["text-line-height"]),"text-letter-spacing":new ee(E.layout_symbol["text-letter-spacing"]),"text-justify":new ee(E.layout_symbol["text-justify"]),"text-radial-offset":new ee(E.layout_symbol["text-radial-offset"]),"text-variable-anchor":new q(E.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ee(E.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ee(E.layout_symbol["text-anchor"]),"text-max-angle":new q(E.layout_symbol["text-max-angle"]),"text-writing-mode":new q(E.layout_symbol["text-writing-mode"]),"text-rotate":new ee(E.layout_symbol["text-rotate"]),"text-padding":new q(E.layout_symbol["text-padding"]),"text-keep-upright":new q(E.layout_symbol["text-keep-upright"]),"text-transform":new ee(E.layout_symbol["text-transform"]),"text-offset":new ee(E.layout_symbol["text-offset"]),"text-allow-overlap":new q(E.layout_symbol["text-allow-overlap"]),"text-overlap":new q(E.layout_symbol["text-overlap"]),"text-ignore-placement":new q(E.layout_symbol["text-ignore-placement"]),"text-optional":new q(E.layout_symbol["text-optional"])}),"getLayout"),sT,Uz=l(()=>sT=sT||new ke({"icon-opacity":new ee(E.paint_symbol["icon-opacity"]),"icon-color":new ee(E.paint_symbol["icon-color"]),"icon-halo-color":new ee(E.paint_symbol["icon-halo-color"]),"icon-halo-width":new ee(E.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ee(E.paint_symbol["icon-halo-blur"]),"icon-translate":new q(E.paint_symbol["icon-translate"]),"icon-translate-anchor":new q(E.paint_symbol["icon-translate-anchor"]),"text-opacity":new ee(E.paint_symbol["text-opacity"]),"text-color":new ee(E.paint_symbol["text-color"],{runtimeType:nr,getOverride:l(r=>r.textColor,"getOverride"),hasOverride:l(r=>!!r.textColor,"hasOverride")}),"text-halo-color":new ee(E.paint_symbol["text-halo-color"]),"text-halo-width":new ee(E.paint_symbol["text-halo-width"]),"text-halo-blur":new ee(E.paint_symbol["text-halo-blur"]),"text-translate":new q(E.paint_symbol["text-translate"]),"text-translate-anchor":new q(E.paint_symbol["text-translate-anchor"])}),"getPaint"),Zc={get paint(){return Uz()},get layout(){return Vz()}};y();var Lg=class Lg{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:eo,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let t=this.defaultValue.value;e(t._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};l(Lg,"FormatSectionOverride");var Ts=Lg;Z("FormatSectionOverride",Ts,{omit:["defaultValue"]});var lT=l(r=>r.type==="symbol","isSymbolStyleLayer"),Ss=class Ss extends He{constructor(e){super(e,Zc)}recalculate(e,t){if(super.recalculate(e,t),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let i=[];for(let o of n)i.indexOf(o)<0&&i.push(o);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,n,i){let o=this.layout.get(e).evaluate(t,{},n,i),a=this._unevaluatedLayout._values[e];return!a.isDataDriven()&&!Ma(a.value)&&o?oT(t.properties,o):o}createBucket(e){return new gr(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Zc.paint.overridableProperties){if(!Ss.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),n=new Ts(t),i=new si(n,t.property.specification),o=null;t.value.kind==="constant"||t.value.kind==="source"?o=new Er("source",i):o=new xn("composite",i,t.value.zoomStops),this.paint._values[e]=new gt(t.property,o,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!this.layout||t.isDataDriven()||n.isDataDriven()?!1:Ss.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let n=e.get("text-field"),i=Zc.paint.properties[t],o=!1,a=l(s=>{for(let u of s)if(i.overrides&&i.overrides.hasOverride(u)){o=!0;return}},"checkSections");if(n.value.kind==="constant"&&n.value.value instanceof jt)a(n.value.value.sections);else if(n.value.kind==="source"){let s=l(c=>{if(!o)if(c instanceof yn&&Je(c.value)===to){let p=c.value;a(p.sections)}else c instanceof ma?a(c.sections):c.eachChild(s)},"checkExpression"),u=n.value;u._styleExpression&&s(u._styleExpression.expression)}return o}};l(Ss,"SymbolStyleLayer");var qc=Ss;y();y();var uT,jz=l(()=>uT=uT||new ke({"background-color":new q(E.paint_background["background-color"]),"background-pattern":new mi(E.paint_background["background-pattern"]),"background-opacity":new q(E.paint_background["background-opacity"])}),"getPaint"),cT={get paint(){return jz()}};var pT=l(r=>r.type==="background","isBackgroundStyleLayer"),kg=class kg extends He{constructor(e){super(e,cT)}};l(kg,"BackgroundStyleLayer");var Hc=kg;y();y();var hT,Nz=l(()=>hT=hT||new ke({"raster-opacity":new q(E.paint_raster["raster-opacity"]),"raster-hue-rotate":new q(E.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new q(E.paint_raster["raster-brightness-min"]),"raster-brightness-max":new q(E.paint_raster["raster-brightness-max"]),"raster-saturation":new q(E.paint_raster["raster-saturation"]),"raster-contrast":new q(E.paint_raster["raster-contrast"]),"raster-resampling":new q(E.paint_raster["raster-resampling"]),"raster-fade-duration":new q(E.paint_raster["raster-fade-duration"])}),"getPaint"),mT={get paint(){return Nz()}};var fT=l(r=>r.type==="raster","isRasterStyleLayer"),Rg=class Rg extends He{constructor(e){super(e,mT)}};l(Rg,"RasterStyleLayer");var Wc=Rg;y();function dT(r){let e=[],t=r.id;return t===void 0&&e.push({message:"layers.".concat(t,': missing required property "id"')}),r.render===void 0&&e.push({message:"layers.".concat(t,': missing required method "render"')}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:"layers.".concat(t,': property "renderingMode" must be either "2d" or "3d"')}),e}l(dT,"validateCustomStyleLayer");var yT=l(r=>r.type==="custom","isCustomStyleLayer"),Dg=class Dg extends He{constructor(t){super(t,{});this.onAdd=l(t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},"onAdd");this.onRemove=l(t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},"onRemove");this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};l(Dg,"CustomStyleLayer");var $c=Dg;function Xc(r){if(r.type==="custom")return new $c(r);switch(r.type){case"background":return new Hc(r);case"circle":return new wc(r);case"color-relief":return new Ac(r);case"fill":return new Rc(r);case"fill-extrusion":return new zc(r);case"heatmap":return new Mc(r);case"hillshade":return new Cc(r);case"line":return new Oc(r);case"raster":return new Wc(r);case"symbol":return new qc(r)}}l(Xc,"createStyleLayer");y();y();function Po(r){let e=[];if(typeof r=="string")e.push({id:"default",url:r});else if(r&&r.length>0){let t=[];for(let{id:n,url:i}of r){let o="".concat(n).concat(i);t.indexOf(o)===-1&&(t.push(o),e.push({id:n,url:i}))}}return e}l(Po,"coerceSpriteToArray");function gT(r,e,t){try{let n=new URL(r);return n.pathname+="".concat(e).concat(t),n.toString()}catch(n){throw new Error('Invalid sprite URL "'.concat(r,'", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically'))}}l(gT,"normalizeSpriteURL");async function xT(r,e,t,n){let i=Po(r),o=t>1?"@2x":"",a={},s={};for(let{id:u,url:c}of i){let p=e.transformRequest(gT(c,o,".json"),"SpriteJSON");a[u]=cn(p,n);let h=e.transformRequest(gT(c,o,".png"),"SpriteImage");s[u]=Pt.getImage(h,n)}return await Promise.all([...Object.values(a),...Object.values(s)]),Gz(a,s)}l(xT,"loadSprite");async function Gz(r,e){let t={};for(let n in r){t[n]={};let i=ne.getImageCanvasContext((await e[n]).data),o=(await r[n]).data;for(let a in o){let{width:s,height:u,x:c,y:p,sdf:h,pixelRatio:m,stretchX:f,stretchY:d,content:g,textFitWidth:x,textFitHeight:_}=o[a],b={width:s,height:u,x:c,y:p,context:i};t[n][a]={data:null,pixelRatio:m,sdf:h,stretchX:f,stretchY:d,content:g,textFitWidth:x,textFitHeight:_,spriteData:b}}}return t}l(Gz,"doOnceCompleted");y();var Yc=1,Fg=class Fg extends be{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new Se({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:t,promiseResolve:n}of this.requestors)n(this._getImagesForIds(t));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let n=t.spriteData;t.data=new Se({width:n.width,height:n.height},n.context.getImageData(n.x,n.y,n.width,n.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw new Error("Image id ".concat(e," already exist, use updateImage instead"));this._validate(e,t)&&(this.images[e]=t)}_validate(e,t){let n=!0,i=t.data||t.spriteData;return this._validateStretch(t.stretchX,i&&i.width)||(this.fire(new J(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),n=!1),this._validateStretch(t.stretchY,i&&i.height)||(this.fire(new J(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),n=!1),this._validateContent(t.content,t)||(this.fire(new J(new Error('Image "'.concat(e,'" has invalid "content" value')))),n=!1),n}_validateStretch(e,t){if(!e)return!0;let n=0;for(let i of e){if(i[0]<n||i[1]<i[0]||t<i[1])return!1;n=i[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let n=t.spriteData,i=n&&n.width||t.data.width,o=n&&n.height||t.data.height;return!(e[0]<0||i<e[0]||e[1]<0||o<e[1]||e[2]<0||i<e[2]||e[3]<0||o<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,n=!0){let i=this.getImage(e);if(n&&(i.data.width!==t.data.width||i.data.height!==t.data.height))throw new Error("size mismatch between old image (".concat(i.data.width,"x").concat(i.data.height,") and new image (").concat(t.data.width,"x").concat(t.data.height,")."));t.version=i.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){let t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((t,n)=>{let i=!0;if(!this.isLoaded())for(let o of e)this.images[o]||(i=!1);this.isLoaded()||i?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){let t={};for(let n of e){let i=this.getImage(n);i||(this.fire(new B("styleimagemissing",{id:n})),i=this.getImage(n)),i?t[n]={data:i.data.clone(),pixelRatio:i.pixelRatio,sdf:i.sdf,version:i.version,stretchX:i.stretchX,stretchY:i.stretchY,content:i.content,textFitWidth:i.textFitWidth,textFitHeight:i.textFitHeight,hasRenderCallback:!!(i.userImage&&i.userImage.render)}:ce('Image "'.concat(n,'" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.'))}return t}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let t=this.patterns[e],n=this.getImage(e);if(!n)return null;if(t&&t.position.version===n.version)return t.position;if(t)t.position.version=n.version;else{let i=n.data.width+Yc*2,o=n.data.height+Yc*2,a={w:i,h:o,x:0,y:0},s=new bo(a,n);this.patterns[e]={bin:a,position:s}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new we(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let o in this.patterns)e.push(this.patterns[o].bin);let{w:t,h:n}=_s(e),i=this.atlasImage;i.resize({width:t||1,height:n||1});for(let o in this.patterns){let{bin:a}=this.patterns[o],s=a.x+Yc,u=a.y+Yc,c=this.getImage(o).data,p=c.width,h=c.height;Se.copy(c,i,{x:0,y:0},{x:s,y:u},{width:p,height:h}),Se.copy(c,i,{x:0,y:h-1},{x:s,y:u-1},{width:p,height:1}),Se.copy(c,i,{x:0,y:0},{x:s,y:u+h},{width:p,height:1}),Se.copy(c,i,{x:p-1,y:0},{x:s-1,y:u},{width:1,height:h}),Se.copy(c,i,{x:0,y:0},{x:s+p,y:u},{width:1,height:h})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this.callbackDispatchedThisFrame[t])continue;this.callbackDispatchedThisFrame[t]=!0;let n=this.getImage(t);n||ce('Image with ID: "'.concat(t,'" was not found')),tT(n)&&this.updateImage(t,n)}}};l(Fg,"ImageManager");var Kc=Fg;y();y();async function _T(r,e,t,n){let i=e*256,o=i+255,a=n.transformRequest(t.replace("{fontstack}",r).replace("{range}","".concat(i,"-").concat(o)),"Glyphs"),s=await n1(a,new AbortController);if(!s||!s.data)throw new Error("Could not load glyph range. range: ".concat(e,", ").concat(i,"-").concat(o));let u={};for(let c of eT(s.data))u[c.id]=c;return u}l(_T,"loadGlyphRange");y();var zg=class zg{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:i=.25,fontFamily:o="sans-serif",fontWeight:a="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=i,this.radius=n;let u=this.size=e+t*4,c=this._createCanvas(u),p=this.ctx=c.getContext("2d",{willReadFrequently:!0});p.font="".concat(s," ").concat(a," ").concat(e,"px ").concat(o),p.textBaseline="alphabetic",p.textAlign="left",p.fillStyle="black",this.gridOuter=new Float64Array(u*u),this.gridInner=new Float64Array(u*u),this.f=new Float64Array(u),this.z=new Float64Array(u+1),this.v=new Uint16Array(u)}_createCanvas(e){let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:i,actualBoundingBoxLeft:o,actualBoundingBoxRight:a}=this.ctx.measureText(e),s=Math.ceil(n),u=0,c=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-o))),p=Math.min(this.size-this.buffer,s+Math.ceil(i)),h=c+2*this.buffer,m=p+2*this.buffer,f=Math.max(h*m,0),d=new Uint8ClampedArray(f),g={data:d,width:h,height:m,glyphWidth:c,glyphHeight:p,glyphTop:s,glyphLeft:u,glyphAdvance:t};if(c===0||p===0)return g;let{ctx:x,buffer:_,gridInner:b,gridOuter:v}=this;x.clearRect(_,_,c,p),x.fillText(e,_,_+s);let w=x.getImageData(_,_,c,p);v.fill(1e20,0,f),b.fill(0,0,f);for(let T=0;T<p;T++)for(let S=0;S<c;S++){let A=w.data[4*(T*c+S)+3]/255;if(A===0)continue;let M=(T+_)*h+S+_;if(A===1)v[M]=0,b[M]=1e20;else{let I=.5-A;v[M]=I>0?I*I:0,b[M]=I<0?I*I:0}}bT(v,0,0,h,m,h,this.f,this.v,this.z),bT(b,_,_,c,p,h,this.f,this.v,this.z);for(let T=0;T<f;T++){let S=Math.sqrt(v[T])-Math.sqrt(b[T]);d[T]=Math.round(255-255*(S/this.radius+this.cutoff))}return g}};l(zg,"TinySDF");var Ms=zg;function bT(r,e,t,n,i,o,a,s,u){for(let c=e;c<e+n;c++)vT(r,t*o+c,o,i,a,s,u);for(let c=t;c<t+i;c++)vT(r,c*o+e,1,n,a,s,u)}l(bT,"edt");function vT(r,e,t,n,i,o,a){o[0]=0,a[0]=-1e20,a[1]=1e20,i[0]=r[e];for(let s=1,u=0,c=0;s<n;s++){i[s]=r[e+s*t];let p=s*s;do{let h=o[u];c=(i[s]-i[h]+p-h*h)/(s-h)/2}while(c<=a[u]&&--u>-1);u++,o[u]=s,a[u]=c,a[u+1]=1e20}for(let s=0,u=0;s<n;s++){for(;a[u+1]<s;)u++;let c=o[u],p=s-c;r[e+s*t]=i[c]+p*p}}l(vT,"edt1d");var Ti=class Ti{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}async getGlyphs(e){let t=[];for(let o in e)for(let a of e[o])t.push(this._getAndCacheGlyphsPromise(o,a));let n=await Promise.all(t),i={};for(let{stack:o,id:a,glyph:s}of n)i[o]||(i[o]={}),i[o][a]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return i}async _getAndCacheGlyphsPromise(e,t){let n=this.entries[e];n||(n=this.entries[e]={glyphs:{},requests:{},ranges:{}});let i=n.glyphs[t];if(i!==void 0)return{stack:e,id:t,glyph:i};if(i=this._tinySDF(n,e,t),i)return n.glyphs[t]=i,{stack:e,id:t,glyph:i};let o=Math.floor(t/256);if(o*256>65535)throw new Error("glyphs > 65535 not supported");if(n.ranges[o])return{stack:e,id:t,glyph:i};if(!this.url)throw new Error("glyphsUrl is not set");if(!n.requests[o]){let s=Ti.loadGlyphRange(e,o,this.url,this.requestManager);n.requests[o]=s}let a=await n.requests[o];for(let s in a)this._doesCharSupportLocalGlyph(+s)||(n.glyphs[+s]=a[+s]);return n.ranges[o]=!0,{stack:e,id:t,glyph:a[t]||null}}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||et["CJK Unified Ideographs"](e)||et["Hangul Syllables"](e)||et.Hiragana(e)||et.Katakana(e)||et["CJK Symbols and Punctuation"](e)||et["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,t,n){let i=this.localIdeographFontFamily;if(!i||!this._doesCharSupportLocalGlyph(n))return;let o=2,a=e.tinySDF;if(!a){let p="400";/bold/i.test(t)?p="900":/medium/i.test(t)?p="500":/light/i.test(t)&&(p="200"),a=e.tinySDF=new Ti.TinySDF({fontSize:24*o,buffer:3*o,radius:8*o,cutoff:.25,fontFamily:i,fontWeight:p})}let s=a.draw(String.fromCharCode(n));return{id:n,bitmap:new _i({width:s.width||30*o,height:s.height||30*o},s.data),metrics:{width:s.glyphWidth/o||24,height:s.glyphHeight/o||24,left:s.glyphLeft/o+.5||0,top:s.glyphTop/o-27.5||-8,advance:s.glyphAdvance/o||24,isDoubleResolution:!0}}}};l(Ti,"GlyphManager"),Ti.loadGlyphRange=_T,Ti.TinySDF=Ms;var Jc=Ti;y();var Vg=class Vg{constructor(){this.specification=E.light.position}possiblyEvaluate(e,t){return N0(e.expression.evaluate(t))}interpolate(e,t,n){return{x:Ae.number(e.x,t.x,n),y:Ae.number(e.y,t.y,n),z:Ae.number(e.z,t.z,n)}}};l(Vg,"LightPositionProperty");var Og=Vg,wT="-transition",Bg,Ug=class Ug extends be{constructor(e){super(),Bg=Bg||new ke({anchor:new q(E.light.anchor),position:new Og,color:new q(E.light.color),intensity:new q(E.light.intensity)}),this._transitionable=new kr(Bg),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t={}){if(!this._validate(gw,e,t))for(let n in e){let i=e[n];n.endsWith(wT)?this._transitionable.setTransition(n.slice(0,-wT.length),i):this._transitionable.setValue(n,i)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,n){return n&&n.validate===!1?!1:bn(this,e.call(je,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:E}))}};l(Ug,"Light");var Qc=Ug;y();var Zz=new ke({"sky-color":new q(E.sky["sky-color"]),"horizon-color":new q(E.sky["horizon-color"]),"fog-color":new q(E.sky["fog-color"]),"fog-ground-blend":new q(E.sky["fog-ground-blend"]),"horizon-fog-blend":new q(E.sky["horizon-fog-blend"]),"sky-horizon-blend":new q(E.sky["sky-horizon-blend"]),"atmosphere-blend":new q(E.sky["atmosphere-blend"])}),PT="-transition",jg=class jg extends be{constructor(e){super(),this._transitionable=new kr(Zz),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new ve(0))}setSky(e,t={}){if(!this._validate(xw,e,t)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let n in e){let i=e[n];n.endsWith(PT)?this._transitionable.setTransition(n.slice(0,-PT.length),i):this._transitionable.setValue(n,i)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,n={}){return(n==null?void 0:n.validate)===!1?!1:bn(this,e.call(je,G({value:t,style:{glyphs:!0,sprite:!0},styleSpec:E})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}};l(jg,"Sky");var ep=jg;y();var Ng=class Ng{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let n=e.join(",")+String(t);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(e,t)),this.dashEntry[n]}getDashRanges(e,t,n){let i=e.length%2===1,o=[],a=i?-e[e.length-1]*n:0,s=e[0]*n,u=!0;o.push({left:a,right:s,isDash:u,zeroLength:e[0]===0});let c=e[0];for(let p=1;p<e.length;p++){u=!u;let h=e[p];a=c*n,c+=h,s=c*n,o.push({left:a,right:s,isDash:u,zeroLength:h===0})}return o}addRoundDash(e,t,n){let i=t/2;for(let o=-n;o<=n;o++){let a=this.nextRow+n+o,s=this.width*a,u=0,c=e[u];for(let p=0;p<this.width;p++){p/c.right>1&&(c=e[++u]);let h=Math.abs(p-c.left),m=Math.abs(p-c.right),f=Math.min(h,m),d,g=o/n*(i+1);if(c.isDash){let x=i-Math.abs(g);d=Math.sqrt(f*f+x*x)}else d=i-Math.sqrt(f*f+g*g);this.data[s+p]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let s=e.length-1;s>=0;--s){let u=e[s],c=e[s+1];u.zeroLength?e.splice(s,1):c&&c.isDash===u.isDash&&(c.left=u.left,e.splice(s,1))}let t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);let i=this.width*this.nextRow,o=0,a=e[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=e[++o]);let u=Math.abs(s-a.left),c=Math.abs(s-a.right),p=Math.min(u,c),h=a.isDash?p:-p;this.data[i+s]=Math.max(0,Math.min(255,h+128))}}addDash(e,t){let n=t?7:0,i=2*n+1;if(this.nextRow+i>this.height)return ce("LineAtlas out of space"),null;let o=0;for(let s=0;s<e.length;s++)o+=e[s];if(o!==0){let s=this.width/o,u=this.getDashRanges(e,this.width,s);t?this.addRoundDash(u,s,n):this.addRegularDash(u)}let a={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:o};return this.nextRow+=i,this.dirty=!0,a}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};l(Ng,"LineAtlas");var tp=Ng;y();y();y();var Gg=class Gg{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};l(Gg,"ThrottledInvoker");var rp=Gg;var qz={once:!0},Zg=class Zg{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new rp(()=>this.process()),this.subscription=Ko(this.target,"message",n=>this.receive(n),!1),this.globalScope=Gr(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise((n,i)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=t?Ko(t.signal,"abort",()=>{a==null||a.unsubscribe(),delete this.resolveRejects[o];let c={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(c)},qz):null;this.resolveRejects[o]={resolve:l(c=>{a==null||a.unsubscribe(),n(c)},"resolve"),reject:l(c=>{a==null||a.unsubscribe(),i(c)},"reject")};let s=[],u=St($e({},e),{id:o,sourceMapId:this.mapId,origin:location.origin,data:io(e.data,s)});this.target.postMessage(u,{transfer:s})})}receive(e){let t=e.data,n=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[n];let i=this.abortControllers[n];delete this.abortControllers[n],i&&i.abort();return}if(Gr(self)||t.mustQueue){this.tasks[n]=t,this.taskQueue.push(n),this.invoker.trigger();return}this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}async processTask(e,t){if(t.type==="<response>"){let o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;t.error?o.reject(oo(t.error)):o.resolve(oo(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,new Error("Could not find a registered handler for ".concat(t.type,", map ID: ").concat(this.mapId,", available handlers: ").concat(Object.keys(this.messageHandlers).join(", "))));return}let n=oo(t.data),i=new AbortController;this.abortControllers[e]=i;try{let o=await this.messageHandlers[t.type](t.sourceMapId,n,i);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,t,n){let i=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?io(t):null,data:io(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};l(Zg,"Actor");var np=Zg;y();y();y();y();var TT='(()=>{var Xy=Object.create;var Wi=Object.defineProperty,Hy=Object.defineProperties,Zy=Object.getOwnPropertyDescriptor,Jy=Object.getOwnPropertyDescriptors,Yy=Object.getOwnPropertyNames,lu=Object.getOwnPropertySymbols,Ky=Object.getPrototypeOf,cu=Object.prototype.hasOwnProperty,Qy=Object.prototype.propertyIsEnumerable;var uu=(t,e,r)=>e in t?Wi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$t=(t,e)=>{for(var r in e||(e={}))cu.call(e,r)&&uu(t,r,e[r]);if(lu)for(var r of lu(e))Qy.call(e,r)&&uu(t,r,e[r]);return t},Xi=(t,e)=>Hy(t,Jy(e));var ve=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),em=(t,e)=>{for(var r in e)Wi(t,r,{get:e[r],enumerable:!0})},tm=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Yy(e))!cu.call(t,i)&&i!==r&&Wi(t,i,{get:()=>e[i],enumerable:!(n=Zy(e,i))||n.enumerable});return t};var Y=(t,e,r)=>(r=t!=null?Xy(Ky(t)):{},tm(e||!t||!t.__esModule?Wi(r,"default",{value:t,enumerable:!0}):r,t));var ye=ve((x0,pu)=>{"use strict";pu.exports=dr;function dr(t,e){this.x=t,this.y=e}dr.prototype={clone:function(){return new dr(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[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,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=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};dr.convert=function(t){return t instanceof dr?t:Array.isArray(t)?new dr(t[0],t[1]):t}});var mu=ve((b0,yu)=>{"use strict";yu.exports=fu;function fu(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}fu.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(e===void 0&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-i/o}var a=0,s=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:s=r,r=(s-a)*.5+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}}});var cp=ve((Hv,rl)=>{function kg(t,e){var r,n,i,o,a,s,l,u,c,p;for(r=t.length&3,n=t.length-r,i=e,a=3432918353,l=461845907,p=0;p<n;)c=t.charCodeAt(p)&255|(t.charCodeAt(++p)&255)<<8|(t.charCodeAt(++p)&255)<<16|(t.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c,i=i<<13|i>>>19,o=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(c=0,r){case 3:c^=(t.charCodeAt(p+2)&255)<<16;case 2:c^=(t.charCodeAt(p+1)&255)<<8;case 1:c^=t.charCodeAt(p)&255,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c}return i^=t.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}typeof rl<"u"&&(rl.exports=kg)});var pp=ve((Zv,nl)=>{function Fg(t,e){for(var r=t.length,n=e^r,i=0,o;r>=4;)o=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^o,r-=4,++i;switch(r){case 3:n^=(t.charCodeAt(i+2)&255)<<16;case 2:n^=(t.charCodeAt(i+1)&255)<<8;case 1:n^=t.charCodeAt(i)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}typeof nl!==void 0&&(nl.exports=Fg)});var il=ve((Jv,ia)=>{var fp=cp(),Eg=pp();ia.exports=fp;ia.exports.murmur3=fp;ia.exports.murmur2=Eg});var xl=ve((NS,Zp)=>{"use strict";var gx=ye();Zp.exports=zr;function zr(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(xx,this,e)}function xx(t,e,r){t==1?e.id=r.readVarint():t==2?bx(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function bx(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}}zr.types=["Unknown","Point","LineString","Polygon"];zr.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=[],s;t.pos<e;){if(n<=0){var l=t.readVarint();r=l&7,n=l>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(s&&a.push(s),s=[]),s.push(new gx(i,o));else if(r===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+r)}return s&&a.push(s),a};zr.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=c&7,n=c>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error("unknown command "+r)}return[a,l,s,u]};zr.prototype.toGeoJSON=function(t,e,r){var n=this.extent*Math.pow(2,r),i=this.extent*t,o=this.extent*e,a=this.loadGeometry(),s=zr.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var h=y[m],g=180-(h.y+o)*360/n;y[m]=[(h.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(g*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(l=0;l<a.length;l++)p[l]=a[l][0];a=p,c(a);break;case 2:for(l=0;l<a.length;l++)c(a[l]);break;case 3:for(a=vx(a),l=0;l<a.length;l++)for(u=0;u<a[l].length;u++)c(a[l][u]);break}a.length===1?a=a[0]:s="Multi"+s;var f={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(f.id=this.id),f};function vx(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=Px(t[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[t[o]]):n.push(t[o]))}return n&&r.push(n),r}function Px(t){for(var e=0,r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}});var bl=ve((US,Yp)=>{"use strict";var Sx=xl();Yp.exports=Jp;function Jp(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(wx,this,e),this.length=this._features.length}function wx(t,e,r){t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(Ax(r))}function Ax(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}Jp.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 Sx(this._pbf,e,this.extent,this._keys,this._values)}});var Qp=ve(($S,Kp)=>{"use strict";var _x=bl();Kp.exports=Ix;function Ix(t,e){this.layers=t.readFields(Tx,{},e)}function Tx(t,e,r){if(t===3){var n=new _x(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var Rt=ve((jS,Sa)=>{Sa.exports.VectorTile=Qp();Sa.exports.VectorTileFeature=xl();Sa.exports.VectorTileLayer=bl()});var Pf=ve(Al=>{Al.read=function(t,e,r,n,i){var o,a,s=i*8-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=r?i-1:0,f=r?-1:1,y=t[e+p];for(p+=f,o=y&(1<<-c)-1,y>>=-c,c+=s;c>0;o=o*256+t[e+p],p+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+t[e+p],p+=f,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(y?-1:1)*a*Math.pow(2,o-n)};Al.write=function(t,e,r,n,i,o){var a,s,l,u=o*8-i-1,c=(1<<u)-1,p=c>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:o-1,m=n?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?e+=f/l:e+=f*Math.pow(2,1-p),e*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(e*l-1)*Math.pow(2,i),a=a+p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[r+y]=s&255,y+=m,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+y]=a&255,y+=m,a/=256,u-=8);t[r+y-m]|=h*128}});var hi=ve((PA,If)=>{"use strict";If.exports=J;var Ta=Pf();function J(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}J.Varint=0;J.Fixed64=1;J.Bytes=2;J.Fixed32=5;var _l=65536*65536,Sf=1/_l,Wx=12,_f=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");J.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,o=this.pos;this.type=n&7,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Ca(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Af(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ca(this.buf,this.pos)+Ca(this.buf,this.pos+4)*_l;return this.pos+=8,t},readSFixed64:function(){var t=Ca(this.buf,this.pos)+Af(this.buf,this.pos+4)*_l;return this.pos+=8,t},readFloat:function(){var t=Ta.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Ta.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,Xx(r,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!!this.readVarint()},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Wx&&_f?sb(this.buf,e,t):ab(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!==J.Bytes)return t.push(this.readVarint(e));var r=mt(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==J.Bytes)return t.push(this.readSVarint());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==J.Bytes)return t.push(this.readBoolean());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==J.Bytes)return t.push(this.readFloat());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==J.Bytes)return t.push(this.readDouble());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed32());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed32());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed64());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed64());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===J.Varint)for(;this.buf[this.pos++]>127;);else if(e===J.Bytes)this.pos=this.readVarint()+this.pos;else if(e===J.Fixed32)this.pos+=4;else if(e===J.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},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),Nr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Nr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Nr(this.buf,t&-1,this.pos),Nr(this.buf,Math.floor(t*Sf),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Nr(this.buf,t&-1,this.pos),Nr(this.buf,Math.floor(t*Sf),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Hx(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(!!t)},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=lb(this.buf,t,this.pos);var r=this.pos-e;r>=128&&wf(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Ta.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Ta.write(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&&wf(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,J.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Yx,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Kx,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,tb,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Qx,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,eb,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,rb,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,nb,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,ib,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,ob,e)},writeBytesField:function(t,e){this.writeTag(t,J.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,J.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,J.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,J.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};function Xx(t,e,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return Gr(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function mt(t){return t.type===J.Bytes?t.readVarint()+t.pos:t.pos+1}function Gr(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Hx(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),Zx(r,n,e),Jx(n,e)}function Zx(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Jx(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function wf(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Yx(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function Kx(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Qx(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function eb(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function tb(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function rb(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function nb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function ib(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function ob(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Ca(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Nr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function Af(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function ab(t,e,r){for(var n="",i=e;i<r;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=t[i+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(a=(o&15)<<12|(l&63)<<6|u&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(l=t[i+1],u=t[i+2],c=t[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(a=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function sb(t,e,r){return _f.decode(t.subarray(e,r))}function lb(t,e,r){for(var n=0,i,o;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):o=i;continue}else o&&(t[r++]=239,t[r++]=191,t[r++]=189,o=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=i&63|128)}return r}});var Sy=ve((yT,Py)=>{Py.exports=Ya;function Ya(t,e){var r=t&&t.type,n;if(r==="FeatureCollection")for(n=0;n<t.features.length;n++)Ya(t.features[n],e);else if(r==="GeometryCollection")for(n=0;n<t.geometries.length;n++)Ya(t.geometries[n],e);else if(r==="Feature")Ya(t.geometry,e);else if(r==="Polygon")by(t.coordinates,e);else if(r==="MultiPolygon")for(n=0;n<t.coordinates.length;n++)by(t.coordinates[n],e);return t}function by(t,e){if(t.length!==0){vy(t[0],e);for(var r=1;r<t.length;r++)vy(t[r],!e)}}function vy(t,e){for(var r=0,n=0,i=0,o=t.length,a=o-1;i<o;a=i++){var s=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+s;n+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+n>=0!=!!e&&t.reverse()}});var Iy=ve((dT,_y)=>{"use strict";var Zb=ye(),Jb=Rt().VectorTileFeature;_y.exports=Ay;function Ay(t,e){this.options=e||{},this.features=t,this.length=t.length}Ay.prototype.feature=function(t){return new Qa(this.features[t],this.options.extent)};function Qa(t,e){this.id=typeof t.id=="number"?t.id:void 0,this.type=t.type,this.rawGeometry=t.type===1?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}Qa.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new Zb(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};Qa.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];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]};Qa.prototype.toGeoJSON=Jb.prototype.toGeoJSON});var ky=ve((gT,Di)=>{var Yb=hi(),Cy=Iy();Di.exports=jl;Di.exports.fromVectorTileJs=jl;Di.exports.fromGeojsonVt=Kb;Di.exports.GeoJSONWrapper=Cy;function jl(t){var e=new Yb;return Qb(t,e),e.finish()}function Kb(t,e){e=e||{};var r={};for(var n in t)r[n]=new Cy(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return jl({layers:r})}function Qb(t,e){for(var r in t.layers)e.writeMessage(3,e0,t.layers[r])}function e0(t,e){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r,n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,t0,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)e.writeMessage(4,i0,o[r])}function t0(t,e){var r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,r0,t),e.writeVarintField(3,r.type),e.writeMessage(4,n0,r)}function r0(t,e){var r=t.feature,n=t.keys,i=t.values,o=t.keycache,a=t.valuecache;for(var s in r.properties){var l=r.properties[s],u=o[s];if(l!==null){typeof u>"u"&&(n.push(s),u=n.length-1,o[s]=u),e.writeVarint(u);var c=typeof l;c!=="string"&&c!=="boolean"&&c!=="number"&&(l=JSON.stringify(l));var p=c+":"+l,f=a[p];typeof f>"u"&&(i.push(l),f=i.length-1,a[p]=f),e.writeVarint(f)}}}function $l(t,e){return(e<<3)+(t&7)}function Ty(t){return t<<1^t>>31}function n0(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;s<a;s++){var l=r[s],u=1;n===1&&(u=l.length),e.writeVarint($l(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&e.writeVarint($l(2,c-1));var f=l[p].x-i,y=l[p].y-o;e.writeVarint(Ty(f)),e.writeVarint(Ty(y)),i+=f,o+=y}n===3&&e.writeVarint($l(7,1))}}function i0(t,e){var r=typeof t;r==="string"?e.writeStringField(1,t):r==="boolean"?e.writeBooleanField(7,t):r==="number"&&(t%1!==0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}});var Vm=Y(ye(),1),Iu=Y(mu(),1);var cs;function hu(){return cs==null&&(cs=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),cs}var Hi;function du(){if(Hi==null&&(Hi=!1,hu())){let r=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(r){for(let i=0;i<5*5;i++){let o=i*4;r.fillStyle="rgb(".concat(o,",").concat(o+1,",").concat(o+2,")"),r.fillRect(i%5,Math.floor(i/5),1,1)}let n=r.getImageData(0,0,5,5).data;for(let i=0;i<5*5*4;i++)if(i%4!==3&&n[i]!==i){Hi=!0;break}}}return Hi||!1}var Yr=1e-6,Kr=typeof Float32Array<"u"?Float32Array:Array,Qr=Math.random;var w0=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Zi={};em(Zi,{add:()=>sm,ceil:()=>lm,clone:()=>nm,copy:()=>om,create:()=>gu,cross:()=>bm,dist:()=>Em,distance:()=>Pu,div:()=>Fm,divide:()=>vu,dot:()=>xm,equals:()=>Tm,exactEquals:()=>Im,floor:()=>um,forEach:()=>Bm,fromValues:()=>im,inverse:()=>dm,len:()=>Lm,length:()=>wu,lerp:()=>vm,max:()=>pm,min:()=>cm,mul:()=>km,multiply:()=>bu,negate:()=>hm,normalize:()=>gm,random:()=>Pm,round:()=>fm,scale:()=>ym,scaleAndAdd:()=>mm,set:()=>am,sqrDist:()=>Mm,sqrLen:()=>Dm,squaredDistance:()=>Su,squaredLength:()=>Au,str:()=>_m,sub:()=>Cm,subtract:()=>xu,transformMat4:()=>Sm,transformQuat:()=>wm,zero:()=>Am});function gu(){var t=new Kr(4);return Kr!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function nm(t){var e=new Kr(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function im(t,e,r,n){var i=new Kr(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function om(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function am(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function sm(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function xu(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function bu(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function vu(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function lm(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function um(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function cm(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function pm(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function fm(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function ym(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function mm(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[3]=e[3]+r[3]*n,t}function Pu(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.hypot(r,n,i,o)}function Su(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o}function wu(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function Au(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function hm(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function dm(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function gm(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a,t}function xm(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function bm(t,e,r,n){var i=r[0]*n[1]-r[1]*n[0],o=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],l=r[1]*n[3]-r[3]*n[1],u=r[2]*n[3]-r[3]*n[2],c=e[0],p=e[1],f=e[2],y=e[3];return t[0]=p*u-f*l+y*s,t[1]=-(c*u)+f*a-y*o,t[2]=c*l-p*a+y*i,t[3]=-(c*s)+p*o-f*i,t}function vm(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t}function Pm(t,e){e=e||1;var r,n,i,o,a,s;do r=Qr()*2-1,n=Qr()*2-1,a=r*r+n*n;while(a>=1);do i=Qr()*2-1,o=Qr()*2-1,s=i*i+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return t[0]=e*r,t[1]=e*n,t[2]=e*i*l,t[3]=e*o*l,t}function Sm(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function wm(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,p=u*i+l*n-a*o,f=u*o+a*i-s*n,y=-a*n-s*i-l*o;return t[0]=c*u+y*-a+p*-l-f*-s,t[1]=p*u+y*-s+f*-a-c*-l,t[2]=f*u+y*-l+c*-s-p*-a,t[3]=e[3],t}function Am(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function _m(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function Im(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function Tm(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(r-a)<=Yr*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=Yr*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=Yr*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=Yr*Math.max(1,Math.abs(o),Math.abs(u))}var Cm=xu,km=bu,Fm=vu,Em=Pu,Mm=Su,Lm=wu,Dm=Au,Bm=function(){var t=gu();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),i?l=Math.min(i*r+n,e.length):l=e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}();function Tu(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Rm(t,e,r,n){let i=new Iu.default(t,e,r,n);return o=>i.solve(o)}var E0=Rm(.25,.1,.25,1);function it(t,e,r){return Math.min(r,Math.max(e,t))}function Cu(t,e,r){let n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function de(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}function ku(t){return Math.log(t)/Math.LN2%1===0}function rn(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function Fu(t,e,r){let n={};for(let i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function nt(t){return Array.isArray(t)?t.map(nt):typeof t=="object"&&t?rn(t,nt):t}var _u={};function ce(t){_u[t]||(typeof console<"u"&&console.warn(t),_u[t]=!0)}function ot(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function at(t){return typeof WorkerGlobalScope<"u"&&typeof t<"u"&&t instanceof WorkerGlobalScope}function vt(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function zm(t,e,r,n,i){let o=Math.max(-e,0)*4,l=(Math.max(0,r)-r)*n*4+o,u=n*4,c=Math.max(0,e),p=Math.max(0,r),f=Math.min(t.width,e+n),y=Math.min(t.height,r+i);return{rect:{x:c,y:p,width:f-c,height:y-p},layout:[{offset:l,stride:u}]}}async function Om(t,e,r,n,i){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(t,{timestamp:0});try{let a=o==null?void 0:o.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error("Unrecognized format ".concat(a));let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,zm(t,e,r,n,i)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{o.close()}}var en,tn;function Gm(t,e,r,n,i){let o=t.width,a=t.height;(!en||!tn)&&(en=new OffscreenCanvas(o,a),tn=en.getContext("2d",{willReadFrequently:!0})),en.width=o,en.height=a,tn.drawImage(t,0,0,o,a);let s=tn.getImageData(e,r,n,i);return tn.clearRect(0,0,o,a),s.data}async function Eu(t,e,r,n,i){if(du())try{return await Om(t,e,r,n,i)}catch(o){}return Gm(t,e,r,n,i)}function ps(t,e,r,n){return t.addEventListener(e,r,n),{unsubscribe:()=>{t.removeEventListener(e,r,n)}}}function fs(t){return t*Math.PI/180}var Ji=25,Yi=0;var jt=class t{constructor(e,r,n){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],r=a[1],n=a[2],this.d=r+2*n;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=n,this.scale=r/e,this.uid=0;let o=n/r*e;this.min=-o,this.max=e+o}insert(e,r,n,i,o){this._forEachCell(r,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,n,i,o,a){this.cells[o].push(a)}query(e,r,n,i,o){let a=this.min,s=this.max;if(e<=a&&r<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(e,r,n,i,this._queryCell,l,u,o),l}}_queryCell(e,r,n,i,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let f=0;f<u.length;f++){let y=u[f];if(s[y]===void 0){let m=y*4;(l?l(p[m+0],p[m+1],p[m+2],p[m+3]):e<=p[m+2]&&r<=p[m+3]&&n>=p[m+0]&&i>=p[m+1])?(s[y]=!0,a.push(c[y])):s[y]=!1}}}}_forEachCell(e,r,n,i,o,a,s,l){let u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),f=this._convertToCellCoord(i);for(let y=u;y<=p;y++)for(let m=c;m<=f;m++){let h=this.d*m+y;if(!(l&&!l(this._convertFromCellCoord(y),this._convertFromCellCoord(m),this._convertFromCellCoord(y+1),this._convertFromCellCoord(m+1)))&&o.call(this,e,r,n,i,h,a,s,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,n=0;for(let a=0;a<this.cells.length;a++)n+=this.cells[a].length;let i=new Int32Array(r+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=r;for(let a=0;a<e.length;a++){let s=e[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+e.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+e.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(e,r){let n=e.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(e){return new t(e.buffer)}};var Nm=8,Um={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},$m={"*":{type:"source"}},jm=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],qm={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Wm={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Xm={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Hm={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},Zm={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Jm={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Ym={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},Km=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],Qm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},eh={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},th={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},rh={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},nh={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ih={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},oh={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ah={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},sh={type:"array",value:"*"},lh={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},uh={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},ch={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},ph={type:"array",value:"*",minimum:1},fh={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},yh={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},mh={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},hh={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},dh=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],gh={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},xh={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},bh={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},vh={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Ph={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},Sh={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},wh={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},Ah={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},_h={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},Ih={"*":{type:"string"}},P={$version:Nm,$root:Um,sources:$m,source:jm,source_vector:qm,source_raster:Wm,source_raster_dem:Xm,source_geojson:Hm,source_video:Zm,source_image:Jm,layer:Ym,layout:Km,layout_background:Qm,layout_fill:eh,layout_circle:th,layout_heatmap:rh,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:nh,layout_symbol:ih,layout_raster:oh,layout_hillshade:ah,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:sh,filter_operator:lh,geometry_type:uh,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:ch,expression:ph,light:fh,sky:yh,terrain:mh,projection:hh,paint:dh,paint_fill:gh,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:xh,paint_circle:bh,paint_heatmap:vh,paint_symbol:Ph,paint_raster:Sh,paint_hillshade:wh,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:Ah,transition:_h,"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:Ih},Th=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var C=class{constructor(e,r,n,i){this.message=(e?"".concat(e,": "):"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function vr(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}var Ve=class extends Error{constructor(e,r){super(r),this.message=r,this.key=e}},Ss=class t{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(e){return new t(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error("".concat(e," not found in scope."))}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},Ar={kind:"null"},k={kind:"number"},$={kind:"string"},U={kind:"boolean"},ze={kind:"color"},go={kind:"projectionDefinition"},Xt={kind:"object"},N={kind:"value"},Ch={kind:"error"},xo={kind:"collator"},_r={kind:"formatted"},bo={kind:"padding"},sn={kind:"colorArray"},vo={kind:"numberArray"},Pn={kind:"resolvedImage"},Po={kind:"variableAnchorOffsetCollection"};function Ce(t,e){return{kind:"array",itemType:t,N:e}}function ie(t){if(t.kind==="array"){let e=ie(t.itemType);return typeof t.N=="number"?"array<".concat(e,", ").concat(t.N,">"):t.itemType.kind==="value"?"array":"array<".concat(e,">")}else return t.kind}var kh=[Ar,k,$,U,ze,go,_r,Xt,Ce(N),bo,vo,sn,Pn,Po];function ln(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ln(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of kh)if(!ln(r,e))return null}}return"Expected ".concat(ie(t)," but found ").concat(ie(e)," instead.")}function Gs(t,e){return e.some(r=>r.kind===t.kind)}function Ht(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function Pt(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var Ku=.96422,Qu=1,ec=.82521,tc=4/29,br=6/29,rc=3*br*br,Fh=br*br*br,Eh=Math.PI/180,Mh=180/Math.PI;function nc(t){return t=t%360,t<0&&(t+=360),t}function ic([t,e,r,n]){t=ys(t),e=ys(e),r=ys(r);let i,o,a=ms((.2225045*t+.7168786*e+.0606169*r)/Qu);t===e&&e===r?i=o=a:(i=ms((.4360747*t+.3850649*e+.1430804*r)/Ku),o=ms((.0139322*t+.0971045*e+.7141733*r)/ec));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function ys(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ms(t){return t>Fh?Math.pow(t,1/3):t/rc+tc}function oc([t,e,r,n]){let i=(t+16)/116,o=isNaN(e)?i:i+e/500,a=isNaN(r)?i:i-r/200;return i=Qu*ds(i),o=Ku*ds(o),a=ec*ds(a),[hs(3.1338561*o-1.6168667*i-.4906146*a),hs(-.9787684*o+1.9161415*i+.033454*a),hs(.0719453*o-.2289914*i+1.4052427*a),n]}function hs(t){return t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055,t<0?0:t>1?1:t}function ds(t){return t>br?t*t*t:rc*(t-tc)}function Lh(t){let[e,r,n,i]=ic(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?nc(Math.atan2(n,r)*Mh):NaN,o,e,i]}function Dh([t,e,r,n]){return t=isNaN(t)?0:t*Eh,oc([r,Math.cos(t)*e,Math.sin(t)*e,n])}function Bh([t,e,r,n]){t=nc(t),e/=100,r/=100;function i(o){let a=(o+t/30)%12,s=e*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4),n]}var Vh=Object.hasOwn||function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};function on(t,e){return Vh(t,e)?t[e]:void 0}function Rh(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=on(zh,t);if(e){let[i,o,a]=e;return[i/255,o/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let o=t.length<6?1:2,a=1;return[Ki(t.slice(a,a+=o)),Ki(t.slice(a,a+=o)),Ki(t.slice(a,a+=o)),Ki(t.slice(a,a+o)||"ff")]}if(t.startsWith("rgb")){let i=/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,o=t.match(i);if(o){let[a,s,l,u,c,p,f,y,m,h,g,d]=o,b=[u||" ",f||" ",h].join("");if(b===" "||b===" /"||b===",,"||b===",,,"){let x=[l,p,m].join(""),v=x==="%%%"?100:x===""?255:0;if(v){let S=[gr(+s/v,0,1),gr(+c/v,0,1),gr(+y/v,0,1),g?Mu(+g,d):1];if(Lu(S))return S}}return}}let r=/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,n=t.match(r);if(n){let[i,o,a,s,l,u,c,p,f]=n,y=[a||" ",l||" ",c].join("");if(y===" "||y===" /"||y===",,"||y===",,,"){let m=[+o,gr(+s,0,100),gr(+u,0,100),p?Mu(+p,f):1];if(Lu(m))return Bh(m)}}}function Ki(t){return parseInt(t.padEnd(2,t),16)/255}function Mu(t,e){return gr(e?t/100:t,0,1)}function gr(t,e,r){return Math.min(Math.max(e,t),r)}function Lu(t){return!t.some(Number.isNaN)}var zh={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function wt(t,e,r){return t+r*(e-t)}function Pr(t,e,r){return t.map((n,i)=>wt(n,e[i],r))}function Oh(t){return t==="rgb"||t==="hcl"||t==="lab"}var H=class t{constructor(e,r,n,i=1,o=!0){this.r=e,this.g=r,this.b=n,this.a=i,o||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,r,n,i]))}static parse(e){if(e instanceof t)return e;if(typeof e!="string")return;let r=Rh(e);if(r)return new t(...r,!1)}get rgb(){let{r:e,g:r,b:n,a:i}=this,o=i||1/0;return this.overwriteGetter("rgb",[e/o,r/o,n/o,i])}get hcl(){return this.overwriteGetter("hcl",Lh(this.rgb))}get lab(){return this.overwriteGetter("lab",ic(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return"rgba(".concat([e,r,n].map(o=>Math.round(o*255)).join(","),",").concat(i,")")}static interpolate(e,r,n,i="rgb"){switch(i){case"rgb":{let[o,a,s,l]=Pr(e.rgb,r.rgb,n);return new t(o,a,s,l,!1)}case"hcl":{let[o,a,s,l]=e.hcl,[u,c,p,f]=r.hcl,y,m;if(!isNaN(o)&&!isNaN(u)){let x=u-o;u>o&&x>180?x-=360:u<o&&o-u>180&&(x+=360),y=o+n*x}else isNaN(o)?isNaN(u)?y=NaN:(y=u,(s===1||s===0)&&(m=c)):(y=o,(p===1||p===0)&&(m=a));let[h,g,d,b]=Dh([y,m!=null?m:wt(a,c,n),wt(s,p,n),wt(l,f,n)]);return new t(h,g,d,b,!1)}case"lab":{let[o,a,s,l]=oc(Pr(e.lab,r.lab,n));return new t(o,a,s,l,!1)}}}};H.black=new H(0,0,0,1);H.white=new H(1,1,1,1);H.transparent=new H(0,0,0,0);H.red=new H(1,0,0,1);var un=class{constructor(e,r,n){e?this.sensitivity=r?"variant":"case":this.sensitivity=r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Gh=["bottom","center","top"],cn=class{constructor(e,r,n,i,o,a){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o,this.verticalAlign=a}},Fe=class t{constructor(e){this.sections=e}static fromString(e){return new t([new cn(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof t?e:t.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Oe=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(Pr(e.values,r.values,n))}},Ge=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(Pr(e.values,r.values,n))}},Pe=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="string"){let n=H.parse(e);return n?new t([n]):void 0}if(!Array.isArray(e))return;let r=[];for(let n of e){if(typeof n!="string")return;let i=H.parse(n);if(!i)return;r.push(i)}return new t(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n,i="rgb"){let o=[];if(e.values.length!=r.values.length)throw new Error("colorArray: Arrays have mismatched length (".concat(e.values.length," vs. ").concat(r.values.length,"), cannot interpolate."));for(let a=0;a<e.values.length;a++)o.push(H.interpolate(e.values[a],r.values[a],n,i));return new t(o)}},ne=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},Nh=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Ee=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let r=0;r<e.length;r+=2){let n=e[r],i=e[r+1];if(typeof n!="string"||!Nh.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){let i=e.values,o=r.values;if(i.length!==o.length)throw new ne("Cannot interpolate values of different length. from: ".concat(e.toString(),", to: ").concat(r.toString()));let a=[];for(let s=0;s<i.length;s+=2){if(i[s]!==o[s])throw new ne("Cannot interpolate values containing mismatched anchors. from[".concat(s,"]: ").concat(i[s],", to[").concat(s,"]: ").concat(o[s]));a.push(i[s]);let[l,u]=i[s+1],[c,p]=o[s+1];a.push([wt(l,c,n),wt(u,p,n)])}return new t(a)}},Se=class t{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new t({name:e,available:!1}):null}},At=class t{constructor(e,r,n){this.from=e,this.to=r,this.transition=n}static interpolate(e,r,n){return new t(e,r,n)}static parse(e){if(e instanceof t)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new t(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new t(e.from,e.to,e.transition);if(typeof e=="string")return new t(e,e,1)}};function ac(t,e,r,n){if(!(typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255)){let i=typeof n=="number"?[t,e,r,n]:[t,e,r];return"Invalid rgba value [".concat(i.join(", "),"]: \'r\', \'g\', and \'b\' must be between 0 and 255.")}return typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:"Invalid rgba value [".concat([t,e,r,n].join(", "),"]: \'a\' must be between 0 and 1.")}function pn(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof At||t instanceof H||t instanceof un||t instanceof Fe||t instanceof Oe||t instanceof Ge||t instanceof Pe||t instanceof Ee||t instanceof Se)return!0;if(Array.isArray(t)){for(let e of t)if(!pn(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!pn(t[e]))return!1;return!0}else return!1}function ue(t){if(t===null)return Ar;if(typeof t=="string")return $;if(typeof t=="boolean")return U;if(typeof t=="number")return k;if(t instanceof H)return ze;if(t instanceof At)return go;if(t instanceof un)return xo;if(t instanceof Fe)return _r;if(t instanceof Oe)return bo;if(t instanceof Ge)return vo;if(t instanceof Pe)return sn;if(t instanceof Ee)return Po;if(t instanceof Se)return Pn;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=ue(n);if(!r)r=i;else{if(r===i)continue;r=N;break}}return Ce(r||N,e)}else return Xt}function an(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof H||t instanceof At||t instanceof Fe||t instanceof Oe||t instanceof Ge||t instanceof Pe||t instanceof Ee||t instanceof Se?t.toString():JSON.stringify(t)}var _t=class t{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error("\'literal\' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(!pn(e[1]))return r.error("invalid value");let n=e[1],i=ue(n),o=r.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new t(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Qi={string:$,number:k,boolean:U,object:Xt},$e=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=1,i,o=e[0];if(o==="array"){let s;if(e.length>2){let u=e[1];if(typeof u!="string"||!(u in Qi)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=Qi[u],n++}else s=N;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=e[2],n++}i=Ce(s,l)}else{if(!Qi[o])throw new Error("Types doesn\'t contain name = ".concat(o));i=Qi[o]}let a=[];for(;n<e.length;n++){let s=r.parse(e[n],n,N);if(!s)return null;a.push(s)}return new t(i,a)}evaluate(e){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(e);if(ln(this.type,ue(n))){if(r===this.args.length-1)throw new ne("Expected value to be of type ".concat(ie(this.type),", but found ").concat(ie(ue(n))," instead."))}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Du={"to-boolean":U,"to-color":ze,"to-number":k,"to-string":$},St=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[0];if(!Du[n])throw new Error("Can\'t parse ".concat(n," as it is not part of the known types"));if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=Du[n],o=[];for(let a=1;a<e.length;a++){let s=r.parse(e[a],a,N);if(!s)return null;o.push(s)}return new t(i,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,n;for(let i of this.args){if(r=i.evaluate(e),n=null,r instanceof H)return r;if(typeof r=="string"){let o=e.parseColor(r);if(o)return o}else if(Array.isArray(r)&&(r.length<3||r.length>4?n="Invalid rgba value ".concat(JSON.stringify(r),": expected an array containing either three or four numeric values."):n=ac(r[0],r[1],r[2],r[3]),!n))return new H(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ne(n||"Could not parse color from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"padding":{let r;for(let n of this.args){r=n.evaluate(e);let i=Oe.parse(r);if(i)return i}throw new ne("Could not parse padding from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"numberArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ge.parse(r);if(i)return i}throw new ne("Could not parse numberArray from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"colorArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=Pe.parse(r);if(i)return i}throw new ne("Could not parse colorArray from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ee.parse(r);if(i)return i}throw new ne("Could not parse variableAnchorOffsetCollection from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(e),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new ne("Could not convert ".concat(JSON.stringify(r)," to number."))}case"formatted":return Fe.fromString(an(this.args[0].evaluate(e)));case"resolvedImage":return Se.fromString(an(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return an(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Uh=["Unknown","Point","LineString","Polygon"],no=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Uh[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache.get(e);return r||(r=H.parse(e),this._parseColorCache.set(e,r)),r}},io=class t{constructor(e,r,n=[],i,o=new Ss,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>"[".concat(s,"]")).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=r}parse(e,r,n,i,o={}){return r?this.concat(r,n,i)._parse(e,o):this._parse(e,o)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,o,a){return a==="assert"?new $e(o,[i]):a==="coerce"?new St(o,[i]):i}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let i=e[0];if(typeof i!="string")return this.error("Expression name must be a string, but found ".concat(typeof i,\' instead. If you wanted a literal array, use ["literal", [...]].\'),0),null;let o=this.registry[i];if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=n(a,s,r.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(l.kind)||s.kind==="colorArray"&&["value","string","array"].includes(l.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof _t)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new no;try{a=new _t(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(\'Unknown expression "\'.concat(i,\'". If you wanted a literal array, use ["literal", [...]].\'),0)}else return typeof e>"u"?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error("Expected an array, but found ".concat(typeof e," instead."))}concat(e,r,n){let i=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new t(this.registry,this._isConstant,i,r||null,o,this.errors)}error(e,...r){let n="".concat(this.key).concat(r.map(i=>"[".concat(i,"]")).join(""));this.errors.push(new Ve(n,e))}checkSubtype(e,r){let n=ln(e,r);return n&&this.error(n),n}},oo=class t{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error("Expected at least 3 arguments, but found ".concat(e.length-1," instead."));let n=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return r.error("Expected string, but found ".concat(typeof a," instead."),o);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or \'_\'.",o);let s=r.parse(e[o+1],o+1);if(!s)return null;n.push([a,s])}let i=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return i?new t(n,i):null}outputDefined(){return this.result.outputDefined()}},ao=class t{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("\'var\' expression requires exactly one string literal argument.");let n=e[1];return r.scope.has(n)?new t(n,r.scope.get(n)):r.error(\'Unknown variable "\'.concat(n,\'". Make sure "\').concat(n,\'" has been bound in an enclosing "let" expression before using it.\'),1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},ws=class t{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,k),i=r.parse(e[2],2,Ce(r.expectedType||N));if(!n||!i)return null;let o=i.type;return new t(o.itemType,n,i)}evaluate(e){let r=this.index.evaluate(e),n=this.input.evaluate(e);if(r<0)throw new ne("Array index out of bounds: ".concat(r," < 0."));if(r>=n.length)throw new ne("Array index out of bounds: ".concat(r," > ").concat(n.length-1,"."));if(r!==Math.floor(r))throw new ne("Array index must be an integer, but found ".concat(r," instead."));return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},As=class t{constructor(e,r){this.type=U,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,N),i=r.parse(e[2],2,N);return!n||!i?null:Gs(n.type,[U,$,k,Ar,N])?new t(n,i):r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ie(n.type)," instead"))}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!Ht(r,["boolean","string","number","null"]))throw new ne("Expected first argument to be of type boolean, string, number or null, but found ".concat(ie(ue(r))," instead."));if(!Ht(n,["string","array"]))throw new ne("Expected second argument to be of type array or string, but found ".concat(ie(ue(n))," instead."));return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},_s=class t{constructor(e,r,n){this.type=k,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,N),i=r.parse(e[2],2,N);if(!n||!i)return null;if(!Gs(n.type,[U,$,k,Ar,N]))return r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ie(n.type)," instead"));if(e.length===4){let o=r.parse(e[3],3,k);return o?new t(n,i,o):null}else return new t(n,i)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!Ht(r,["boolean","string","number","null"]))throw new ne("Expected first argument to be of type boolean, string, number or null, but found ".concat(ie(ue(r))," instead."));let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),Ht(n,["string"])){let o=n.indexOf(r,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(Ht(n,["array"]))return n.indexOf(r,i);throw new ne("Expected second argument to be of type array or string, but found ".concat(ie(ue(n))," instead."))}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},Is=class t{constructor(e,r,n,i,o,a){this.inputType=e,this.type=r,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(e,r){if(e.length<5)return r.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let o={},a=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let f=r.concat(u);if(c.length===0)return f.error("Expected at least one branch label.");for(let m of c){if(typeof m!="number"&&typeof m!="string")return f.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return f.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof m=="number"&&Math.floor(m)!==m)return f.error("Numeric branch labels must be integer values.");if(!n)n=ue(m);else if(f.checkSubtype(n,ue(m)))return null;if(typeof o[String(m)]<"u")return f.error("Branch labels must be unique.");o[String(m)]=a.length}let y=r.parse(p,u,i);if(!y)return null;i=i||y.type,a.push(y)}let s=r.parse(e[1],1,N);if(!s)return null;let l=r.parse(e[e.length-1],e.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new t(n,i,s,o,a,l)}evaluate(e){let r=this.input.evaluate(e);return(ue(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},Ts=class t{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error("Expected at least 3 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let a=1;a<e.length-1;a+=2){let s=r.parse(e[a],a,U);if(!s)return null;let l=r.parse(e[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=r.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can\'t infer output type");return new t(n,i,o)}evaluate(e){for(let[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},Cs=class t{constructor(e,r,n,i){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(e,r){if(e.length<=2||e.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,N),i=r.parse(e[2],2,k);if(!n||!i)return null;if(!Gs(n.type,[Ce(N),$,N]))return r.error("Expected first argument to be of type array or string, but found ".concat(ie(n.type)," instead"));if(e.length===4){let o=r.parse(e[3],3,k);return o?new t(n.type,n,i,o):null}else return new t(n.type,n,i)}evaluate(e){let r=this.input.evaluate(e),n=this.beginIndex.evaluate(e),i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),Ht(r,["string"]))return[...r].slice(n,i).join("");if(Ht(r,["array"]))return r.slice(n,i);throw new ne("Expected first argument to be of type array or string, but found ".concat(ie(ue(r))," instead."))}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function So(t,e){let r=t.length-1,n=0,i=r,o=0,a,s;for(;n<=i;)if(o=Math.floor((n+i)/2),a=t[o],s=t[o+1],a<=e){if(o===r||e<s)return o;n=o+1}else if(a>e)i=o-1;else throw new ne("Input is not a number.");return 0}var Sr=class t{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(e,r){if(e.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(e[1],1,k);if(!n)return null;let i=[],o=null;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);for(let a=1;a<e.length;a+=2){let s=a===1?-1/0:e[a],l=e[a+1],u=a,c=a+1;if(typeof s!="number")return r.error(\'Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',u);if(i.length&&i[i.length-1][0]>=s)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let p=r.parse(l,c,o);if(!p)return null;o=o||p.type,i.push([s,p])}return new t(o,n,i)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=So(r,i);return n[a].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function $h(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var gs,Bu;function jh(){if(Bu)return gs;Bu=1,gs=t;function t(e,r,n,i){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(i-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=n,this.p2y=i}return t.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,r){if(r===void 0&&(r=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,i=0;i<8;i++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<r)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n=n-o/a}var s=0,l=1;for(n=e,i=0;i<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<r));i++)e>o?s=n:l=n,n=(l-s)*.5+s;return n},solve:function(e,r){return this.sampleCurveY(this.solveCurveX(e,r))}},gs}var qh=jh(),Wh=$h(qh),ke=class t{constructor(e,r,n,i,o){this.type=e,this.operator=r,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(e,r,n,i){let o=0;if(e.name==="exponential")o=xs(r,e.base,n,i);else if(e.name==="linear")o=xs(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new Wh(a[0],a[1],a[2],a[3]).solve(xs(r,1,n,i))}return o}static parse(e,r){let[n,i,o,...a]=e;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error("Unknown interpolation type ".concat(String(i[0])),1,0);if(e.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,k),!o)return null;let s=[],l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&r.expectedType!=sn?l=ze:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],f=u+3,y=u+4;if(typeof c!="number")return r.error(\'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',f);if(s.length&&s[s.length-1][0]>=c)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',f);let m=r.parse(p,y,l);if(!m)return null;l=l||m.type,s.push([c,m])}return!Pt(l,k)&&!Pt(l,go)&&!Pt(l,ze)&&!Pt(l,bo)&&!Pt(l,vo)&&!Pt(l,sn)&&!Pt(l,Po)&&!Pt(l,Ce(k))?r.error("Type ".concat(ie(l)," is not interpolatable.")):new t(l,n,i,o,s)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=So(r,i),s=r[a],l=r[a+1],u=t.interpolationFactor(this.interpolation,i,s,l),c=n[a].evaluate(e),p=n[a+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return wt(c,p,u);case"color":return H.interpolate(c,p,u);case"padding":return Oe.interpolate(c,p,u);case"colorArray":return Pe.interpolate(c,p,u);case"numberArray":return Ge.interpolate(c,p,u);case"variableAnchorOffsetCollection":return Ee.interpolate(c,p,u);case"array":return Pr(c,p,u);case"projectionDefinition":return At.interpolate(c,p,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return H.interpolate(c,p,u,"hcl");case"colorArray":return Pe.interpolate(c,p,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return H.interpolate(c,p,u,"lab");case"colorArray":return Pe.interpolate(c,p,u,"lab")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function xs(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var lt={color:H.interpolate,number:wt,padding:Oe.interpolate,numberArray:Ge.interpolate,colorArray:Pe.interpolate,variableAnchorOffsetCollection:Ee.interpolate,array:Pr},so=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of e.slice(1)){let l=r.parse(s,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return i&&o.some(s=>ln(i,s.type))?new t(N,o):new t(n,o)}evaluate(e){let r=null,n=0,i;for(let o of this.args)if(n++,r=o.evaluate(e),r&&r instanceof Se&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function Vu(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Xh(t,e,r){return e===r}function Hh(t,e,r){return e!==r}function Zh(t,e,r){return e<r}function Jh(t,e,r){return e>r}function Yh(t,e,r){return e<=r}function Kh(t,e,r){return e>=r}function sc(t,e,r,n){return n.compare(e,r)===0}function Qh(t,e,r,n){return!sc(t,e,r,n)}function ed(t,e,r,n){return n.compare(e,r)<0}function td(t,e,r,n){return n.compare(e,r)>0}function rd(t,e,r,n){return n.compare(e,r)<=0}function nd(t,e,r,n){return n.compare(e,r)>=0}function Ir(t,e,r){let n=t!=="=="&&t!=="!=";return class lc{constructor(o,a,s){this.type=U,this.lhs=o,this.rhs=a,this.collator=s,this.hasUntypedArgument=o.type.kind==="value"||a.type.kind==="value"}static parse(o,a){if(o.length!==3&&o.length!==4)return a.error("Expected two or three arguments.");let s=o[0],l=a.parse(o[1],1,N);if(!l)return null;if(!Vu(s,l.type))return a.concat(1).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(ie(l.type),"\'."));let u=a.parse(o[2],2,N);if(!u)return null;if(!Vu(s,u.type))return a.concat(2).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(ie(u.type),"\'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot compare types \'".concat(ie(l.type),"\' and \'").concat(ie(u.type),"\'."));n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new $e(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new $e(l.type,[u])));let c=null;if(o.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(c=a.parse(o[3],3,xo),!c)return null}return new lc(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new ne(\'Expected arguments for "\'.concat(t,\'" to be (string, string) or (number, number), but found (\').concat(l.kind,", ").concat(u.kind,") instead."))}if(this.collator&&!n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!=="string"||u.kind!=="string")return e(o,a,s)}return this.collator?r(o,a,s,this.collator.evaluate(o)):e(o,a,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}var id=Ir("==",Xh,sc),od=Ir("!=",Hh,Qh),ad=Ir("<",Zh,ed),sd=Ir(">",Jh,td),ld=Ir("<=",Yh,rd),ud=Ir(">=",Kh,nd),lo=class t{constructor(e,r,n){this.type=xo,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,U);if(!i)return null;let o=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,U);if(!o)return null;let a=null;return n.locale&&(a=r.parse(n.locale,1,$),!a)?null:new t(i,o,a)}evaluate(e){return new un(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},ks=class t{constructor(e,r,n,i,o){this.type=$,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let n=r.parse(e[1],1,k);if(!n)return null;let i=e[2];if(typeof i!="object"||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=r.parse(i.locale,1,$),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,$),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,k),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,k),!l)?null:new t(n,o,a,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},fn=class t{constructor(e){this.type=_r,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");let i=[],o=!1;for(let a=1;a<=e.length-1;++a){let s=e[a];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let l=null;if(s["font-scale"]&&(l=r.parse(s["font-scale"],1,k),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Ce($)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,ze),!c))return null;let p=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!Gh.includes(s["vertical-align"]))return r.error("\'vertical-align\' must be one of: \'bottom\', \'center\', \'top\' but found \'".concat(s["vertical-align"],"\' instead."));if(p=r.parse(s["vertical-align"],1,$),!p)return null}let f=i[i.length-1];f.scale=l,f.font=u,f.textColor=c,f.verticalAlign=p}else{let l=r.parse(e[a],1,N);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");o=!0,i.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new t(i)}evaluate(e){let r=n=>{let i=n.content.evaluate(e);return ue(i)===Pn?new cn("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new cn(an(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new Fe(this.sections.map(r))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}},Fs=class t{constructor(e){this.type=Pn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,$);return n?new t(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Se.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},Es=class t{constructor(e){this.type=k,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected 1 argument, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error("Expected argument of type string or array, but found ".concat(ie(n.type)," instead.")):new t(n):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ne("Expected value to be of type string or array, but found ".concat(ie(ue(r))," instead."))}eachChild(e){e(this.input)}outputDefined(){return!1}},He=8192;function cd(t,e){let r=pd(t[0]),n=yd(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*He),Math.round(n*i*He)]}function Ns(t,e){let r=Math.pow(2,e.z),n=(t[0]/He+e.x)/r,i=(t[1]/He+e.y)/r;return[fd(n),md(i)]}function pd(t){return(180+t)/360}function fd(t){return t*360-180}function yd(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function md(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function Sn(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 yn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function hd(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function dd(t,e,r){let n=t[0]-e[0],i=t[1]-e[1],o=t[0]-r[0],a=t[1]-r[1];return n*a-o*i===0&&n*o<=0&&i*a<=0}function wo(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return vd(o,i)===0?!1:!!(Ru(t,e,r,n)&&Ru(r,n,t,e))}function gd(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(wo(t,e,n[i],n[i+1]))return!0;return!1}function Tr(t,e,r=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(dd(t,i[o],i[o+1]))return r;hd(t,i[o],i[o+1])&&(n=!n)}return n}function xd(t,e){for(let r of e)if(Tr(t,r))return!0;return!1}function uc(t,e){for(let r of t)if(!Tr(r,e))return!1;for(let r=0;r<t.length-1;++r)if(gd(t[r],t[r+1],e))return!1;return!0}function bd(t,e){for(let r of e)if(uc(t,r))return!0;return!1}function vd(t,e){return t[0]*e[1]-t[1]*e[0]}function Ru(t,e,r,n){let i=t[0]-r[0],o=t[1]-r[1],a=e[0]-r[0],s=e[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function Us(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=[];for(let a=0;a<t[i].length;a++){let s=cd(t[i][a],r);Sn(e,s),o.push(s)}n.push(o)}return n}function cc(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=Us(t[i],e,r);n.push(o)}return n}function pc(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){let i=n*.5,o=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;o===0&&(o=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=o}Sn(e,t)}function Pd(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function zu(t,e,r,n){let i=Math.pow(2,n.z)*He,o=[n.x*He,n.y*He],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];pc(u,e,r,i),a.push(u)}return a}function Ou(t,e,r,n){let i=Math.pow(2,n.z)*He,o=[n.x*He,n.y*He],a=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Sn(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){Pd(e);for(let s of a)for(let l of s)pc(l,e,r,i)}return a}function Sd(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=Us(e.coordinates,n,i),a=zu(t.geometry(),r,n,i);if(!yn(r,n))return!1;for(let s of a)if(!Tr(s,o))return!1}if(e.type==="MultiPolygon"){let o=cc(e.coordinates,n,i),a=zu(t.geometry(),r,n,i);if(!yn(r,n))return!1;for(let s of a)if(!xd(s,o))return!1}return!0}function wd(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=Us(e.coordinates,n,i),a=Ou(t.geometry(),r,n,i);if(!yn(r,n))return!1;for(let s of a)if(!uc(s,o))return!1}if(e.type==="MultiPolygon"){let o=cc(e.coordinates,n,i),a=Ou(t.geometry(),r,n,i);if(!yn(r,n))return!1;for(let s of a)if(!bd(s,o))return!1}return!0}var mn=class t{constructor(e,r){this.type=U,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error("\'within\' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(pn(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let i=[];for(let o of n.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&i.push(s),a==="MultiPolygon"&&i.push(...s)}if(i.length){let o={type:"MultiPolygon",coordinates:i};return new t(n,o)}}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new t(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new t(n,n)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Sd(e,this.geometries);if(e.geometryType()==="LineString")return wd(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},uo=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};function fc(t,e,r=0,n=t.length-1,i=Ad){for(;n>r;){if(n-r>600){let l=n-r+1,u=e-r+1,c=Math.log(l),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(l-p)/l)*(u-l/2<0?-1:1),y=Math.max(r,Math.floor(e-u*p/l+f)),m=Math.min(n,Math.floor(e+(l-u)*p/l+f));fc(t,e,y,m,i)}let o=t[e],a=r,s=n;for(nn(t,r,e),i(t[n],o)>0&&nn(t,r,n);a<s;){for(nn(t,a,s),a++,s--;i(t[a],o)<0;)a++;for(;i(t[s],o)>0;)s--}i(t[r],o)===0?nn(t,r,s):(s++,nn(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}}function nn(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function Ad(t,e){return t<e?-1:t>e?1:0}function Kt(t,e){if(t.length<=1)return[t];let n=[],i,o;for(let a of t){let s=Id(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[a]):i.push(a))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(fc(n[a],e,1,n[a].length-1,_d),n[a]=n[a].slice(0,e));return n}function _d(t,e){return e.area-t.area}function Id(t){let e=0;for(let r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}var Td=6378.137,Gu=1/298.257223563,Nu=Gu*(2-Gu),Uu=Math.PI/180,hn=class{constructor(e){let r=Uu*Td*1e3,n=Math.cos(e*Uu),i=1/(1-Nu*(1-n*n)),o=Math.sqrt(i);this.kx=r*o*n,this.ky=r*o*i*(1-Nu)}distance(e,r){let n=this.wrap(e[0]-r[0])*this.kx,i=(e[1]-r[1])*this.ky;return Math.sqrt(n*n+i*i)}pointOnLine(e,r){let n=1/0,i,o,a,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,f=(e[l+1][1]-c)*this.ky,y=0;(p!==0||f!==0)&&(y=(this.wrap(r[0]-u)*this.kx*p+(r[1]-c)*this.ky*f)/(p*p+f*f),y>1?(u=e[l+1][0],c=e[l+1][1]):y>0&&(u+=p/this.kx*y,c+=f/this.ky*y)),p=this.wrap(r[0]-u)*this.kx,f=(r[1]-c)*this.ky;let m=p*p+f*f;m<n&&(n=m,i=u,o=c,a=l,s=y)}return{point:[i,o],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},Ms=100,Ls=50;function yc(t,e){return e[0]-t[0]}function co(t){return t[1]-t[0]+1}function st(t,e){return t[1]>=t[0]&&t[1]<e}function Ds(t,e){if(t[0]>t[1])return[null,null];let r=co(t);if(e){if(r===2)return[t,null];let i=Math.floor(r/2);return[[t[0],t[0]+i],[t[0]+i,t[1]]]}if(r===1)return[t,null];let n=Math.floor(r/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function Bs(t,e){if(!st(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)Sn(r,t[n]);return r}function Vs(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)Sn(e,n);return e}function $u(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function $s(t,e,r){if(!$u(t)||!$u(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function Wt(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function js(t,e,r,n,i){let o=Math.min(Wt(t,[r,n],i),Wt(e,[r,n],i)),a=Math.min(Wt(r,[t,e],i),Wt(n,[t,e],i));return Math.min(o,a)}function Cd(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let l=t[s],u=t[s+1];for(let c=n[0];c<n[1];++c){let p=r[c],f=r[c+1];if(wo(l,u,p,f))return 0;a=Math.min(a,js(l,u,p,f,i))}}return a}function kd(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let l=n[0];l<=n[1];++l)if(a=Math.min(a,i.distance(t[s],r[l])),a===0)return a;return a}function Fd(t,e,r){if(Tr(t,e,!0))return 0;let n=1/0;for(let i of e){let o=i[0],a=i[i.length-1];if(o!==a&&(n=Math.min(n,Wt(t,[a,o],r)),n===0))return n;let s=r.pointOnLine(i,t);if(n=Math.min(n,r.distance(t,s.point)),n===0)return n}return n}function Ed(t,e,r,n){if(!st(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Tr(t[o],r,!0))return 0;let i=1/0;for(let o=e[0];o<e[1];++o){let a=t[o],s=t[o+1];for(let l of r)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let f=l[p],y=l[u];if(wo(a,s,f,y))return 0;i=Math.min(i,js(a,s,f,y,n))}}return i}function ju(t,e){for(let r of t)for(let n of r)if(Tr(n,e,!0))return!0;return!1}function Md(t,e,r,n=1/0){let i=Vs(t),o=Vs(e);if(n!==1/0&&$s(i,o,r)>=n)return n;if(yn(i,o)){if(ju(t,e))return 0}else if(ju(e,t))return 0;let a=1/0;for(let s of t)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],f=s[l];for(let y of e)for(let m=0,h=y.length,g=h-1;m<h;g=m++){let d=y[g],b=y[m];if(wo(p,f,d,b))return 0;a=Math.min(a,js(p,f,d,b,r))}}return a}function qu(t,e,r,n,i,o){if(!o)return;let a=$s(Bs(n,o),i,r);a<e&&t.push([a,o,[0,0]])}function eo(t,e,r,n,i,o,a){if(!o||!a)return;let s=$s(Bs(n,o),Bs(i,a),r);s<e&&t.push([s,o,a])}function po(t,e,r,n,i=1/0){let o=Math.min(n.distance(t[0],r[0][0]),i);if(o===0)return o;let a=new uo([[0,[0,t.length-1],[0,0]]],yc),s=Vs(r);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?Ls:Ms;if(co(u)<=c){if(!st(u,t.length))return NaN;if(e){let p=Ed(t,u,r,n);if(isNaN(p)||p===0)return p;o=Math.min(o,p)}else for(let p=u[0];p<=u[1];++p){let f=Fd(t[p],r,n);if(o=Math.min(o,f),o===0)return 0}}else{let p=Ds(u,e);qu(a,o,n,t,s,p[0]),qu(a,o,n,t,s,p[1])}}return o}function fo(t,e,r,n,i,o=1/0){let a=Math.min(o,i.distance(t[0],r[0]));if(a===0)return a;let s=new uo([[0,[0,t.length-1],[0,r.length-1]]],yc);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?Ls:Ms,f=n?Ls:Ms;if(co(u)<=p&&co(c)<=f){if(!st(u,t.length)&&st(c,r.length))return NaN;let y;if(e&&n)y=Cd(t,u,r,c,i),a=Math.min(a,y);else if(e&&!n){let m=t.slice(u[0],u[1]+1);for(let h=c[0];h<=c[1];++h)if(y=Wt(r[h],m,i),a=Math.min(a,y),a===0)return a}else if(!e&&n){let m=r.slice(c[0],c[1]+1);for(let h=u[0];h<=u[1];++h)if(y=Wt(t[h],m,i),a=Math.min(a,y),a===0)return a}else y=kd(t,u,r,c,i),a=Math.min(a,y)}else{let y=Ds(u,e),m=Ds(c,n);eo(s,a,i,t,r,y[0],m[0]),eo(s,a,i,t,r,y[0],m[1]),eo(s,a,i,t,r,y[1],m[0]),eo(s,a,i,t,r,y[1],m[1])}}return a}function Ld(t,e){let r=t.geometry(),n=r.flat().map(a=>Ns([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new hn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,fo(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,fo(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,po(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function Dd(t,e){let r=t.geometry(),n=r.flat().map(a=>Ns([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new hn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,fo(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,fo(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,po(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function Bd(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=Kt(r,0).map(a=>a.map(s=>s.map(l=>Ns([l.x,l.y],t.canonical)))),i=new hn(n[0][0][0][1]),o=1/0;for(let a of e)for(let s of n){switch(a.type){case"Point":o=Math.min(o,po([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,po(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,Md(s,a.coordinates,i,o));break}if(o===0)return o}return o}function bs(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var dn=class t{constructor(e,r){this.type=k,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error("\'distance\' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(pn(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>bs(i.geometry)).flat());if(n.type==="Feature")return new t(n,bs(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,bs(n))}return r.error("\'distance\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Ld(e,this.geometries);if(e.geometryType()==="LineString")return Dd(e,this.geometries);if(e.geometryType()==="Polygon")return Bd(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},gn=class t{constructor(e){this.type=N,this.key=e}static parse(e,r){if(e.length!==2)return r.error("Expected 1 argument, but found ".concat(e.length-1," instead."));let n=e[1];return n==null?r.error("Global state property must be defined."):typeof n!="string"?r.error("Global state property must be string, but found ".concat(typeof e[1]," instead.")):new t(n)}evaluate(e){var r;let n=(r=e.globals)===null||r===void 0?void 0:r.globalState;return!n||Object.keys(n).length===0?null:on(n,this.key)}eachChild(){}outputDefined(){return!1}},Qt={"==":id,"!=":od,">":sd,"<":ad,">=":ud,"<=":ld,array:$e,at:ws,boolean:$e,case:Ts,coalesce:so,collator:lo,format:fn,image:Fs,in:As,"index-of":_s,interpolate:ke,"interpolate-hcl":ke,"interpolate-lab":ke,length:Es,let:oo,literal:_t,match:Is,number:$e,"number-format":ks,object:$e,slice:Cs,step:Sr,string:$e,"to-boolean":St,"to-color":St,"to-number":St,"to-string":St,var:ao,within:mn,distance:dn,"global-state":gn},Ze=class t{constructor(e,r,n,i){this.name=e,this.type=r,this._evaluate=n,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let n=e[0],i=t.definitions[n];if(!i)return r.error(\'Unknown expression "\'.concat(n,\'". If you wanted a literal array, use ["literal", [...]].\'),0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new io(r.registry,yo,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<e.length;y++){let m=e[y],h=Array.isArray(u)?u[y-1]:u.type,g=l.parse(m,1+p.length,h);if(!g){f=!0;break}p.push(g)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(p.length," instead."));continue}for(let y=0;y<p.length;y++){let m=Array.isArray(u)?u[y]:u.type,h=p[y];l.concat(y+1).checkSubtype(m,h.type)}if(l.errors.length===0)return new t(n,o,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:a).map(([f])=>Rd(f)).join(" | "),p=[];for(let f=1;f<e.length;f++){let y=r.parse(e[f],1+p.length);if(!y)return null;p.push(ie(y.type))}r.error("Expected arguments of type ".concat(c,", but found (").concat(p.join(", "),") instead."))}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function Wu(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);let o=i?i.evaluate(t):1,a=ac(e,r,n,o);if(a)throw new ne(a);return new H(e/255,r/255,n/255,o,!1)}function Xu(t,e){return t in e}function vs(t,e){let r=e[t];return typeof r>"u"?null:r}function Vd(t,e,r,n){for(;r<=n;){let i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}function qt(t){return{type:t}}Ze.register(Qt,{error:[Ch,[$],(t,[e])=>{throw new ne(e.evaluate(t))}],typeof:[$,[N],(t,[e])=>ie(ue(e.evaluate(t)))],"to-rgba":[Ce(k,4),[ze],(t,[e])=>{let[r,n,i,o]=e.evaluate(t).rgb;return[r*255,n*255,i*255,o]}],rgb:[ze,[k,k,k],Wu],rgba:[ze,[k,k,k,k],Wu],has:{type:U,overloads:[[[$],(t,[e])=>Xu(e.evaluate(t),t.properties())],[[$,Xt],(t,[e,r])=>Xu(e.evaluate(t),r.evaluate(t))]]},get:{type:N,overloads:[[[$],(t,[e])=>vs(e.evaluate(t),t.properties())],[[$,Xt],(t,[e,r])=>vs(e.evaluate(t),r.evaluate(t))]]},"feature-state":[N,[$],(t,[e])=>vs(e.evaluate(t),t.featureState||{})],properties:[Xt,[],t=>t.properties()],"geometry-type":[$,[],t=>t.geometryType()],id:[N,[],t=>t.id()],zoom:[k,[],t=>t.globals.zoom],"heatmap-density":[k,[],t=>t.globals.heatmapDensity||0],elevation:[k,[],t=>t.globals.elevation||0],"line-progress":[k,[],t=>t.globals.lineProgress||0],accumulated:[N,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[k,qt(k),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[k,qt(k),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:k,overloads:[[[k,k],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[k],(t,[e])=>-e.evaluate(t)]]},"/":[k,[k,k],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[k,[k,k],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[k,[],()=>Math.LN2],pi:[k,[],()=>Math.PI],e:[k,[],()=>Math.E],"^":[k,[k,k],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[k,[k],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[k,[k],(t,[e])=>Math.log(e.evaluate(t))],log2:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[k,[k],(t,[e])=>Math.sin(e.evaluate(t))],cos:[k,[k],(t,[e])=>Math.cos(e.evaluate(t))],tan:[k,[k],(t,[e])=>Math.tan(e.evaluate(t))],asin:[k,[k],(t,[e])=>Math.asin(e.evaluate(t))],acos:[k,[k],(t,[e])=>Math.acos(e.evaluate(t))],atan:[k,[k],(t,[e])=>Math.atan(e.evaluate(t))],min:[k,qt(k),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[k,qt(k),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[k,[k],(t,[e])=>Math.abs(e.evaluate(t))],round:[k,[k],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[k,[k],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[k,[k],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[U,[$,N],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[U,[N],(t,[e])=>t.id()===e.value],"filter-type-==":[U,[$],(t,[e])=>t.geometryType()===e.value],"filter-<":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[N],(t,[e])=>{let 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=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[U,[Ce($)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Ce(N)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[$,Ce(N)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[$,Ce(N)],(t,[e,r])=>Vd(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)],[qt(U),(t,e)=>{for(let 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)],[qt(U),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[U,[U],(t,[e])=>!e.evaluate(t)],"is-supported-script":[U,[$],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[$,[$],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[$,[$],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[$,qt(N),(t,e)=>e.map(r=>an(r.evaluate(t))).join("")],"resolved-locale":[$,[xo],(t,[e])=>e.evaluate(t).resolvedLocale()]});function Rd(t){return Array.isArray(t)?"(".concat(t.map(ie).join(", "),")"):"(".concat(ie(t.type),"...)")}function yo(t){if(t instanceof ao)return yo(t.boundExpression);if(t instanceof Ze&&t.name==="error")return!1;if(t instanceof lo)return!1;if(t instanceof mn)return!1;if(t instanceof dn)return!1;if(t instanceof gn)return!1;let e=t instanceof St||t instanceof $e,r=!0;return t.eachChild(n=>{e?r=r&&yo(n):r=r&&n instanceof _t}),r?Ao(t)&&_o(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Ao(t){if(t instanceof Ze){if(t.name==="get"&&t.args.length===1)return!1;if(t.name==="feature-state")return!1;if(t.name==="has"&&t.args.length===1)return!1;if(t.name==="properties"||t.name==="geometry-type"||t.name==="id")return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof mn||t instanceof dn)return!1;let e=!0;return t.eachChild(r=>{e&&!Ao(r)&&(e=!1)}),e}function xn(t){if(t instanceof Ze&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!xn(r)&&(e=!1)}),e}function _o(t,e){if(t instanceof Ze&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!_o(n,e)&&(r=!1)}),r}function Rs(t){return{result:"success",value:t}}function xr(t){return{result:"error",value:t}}function It(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function mc(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function qs(t){return!!t.expression&&t.expression.interpolated}function j(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function Io(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&ue(t)===Xt}function zd(t){return t}function Od(t){switch(t.type){case"color":return H.parse;case"padding":return Oe.parse;case"numberArray":return Ge.parse;case"colorArray":return Pe.parse;default:return null}}function Gd(t){switch(t){case"exponential":return dc;case"interval":return Ud;case"categorical":return Nd;case"identity":return $d;default:throw new Error(\'Unknown function type "\'.concat(t,\'"\'))}}function hc(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",n=r||t.property!==void 0,i=r||!n,o=t.type||(qs(e)?"exponential":"interval"),a=Od(e);if(a&&(t=vr({},t),t.stops&&(t.stops=t.stops.map(c=>[c[0],a(c[1])])),t.default?t.default=a(t.default):t.default=a(e.default)),t.colorSpace&&!Oh(t.colorSpace))throw new Error(\'Unknown color space: "\'.concat(t.colorSpace,\'"\'));let s=Gd(o),l,u;if(o==="categorical"){l=Object.create(null);for(let c of t.stops)l[c[0]]=c[1];u=typeof t.stops[0][0]}if(r){let c={},p=[];for(let m=0;m<t.stops.length;m++){let h=t.stops[m],g=h[0].zoom;c[g]===void 0&&(c[g]={zoom:g,type:t.type,property:t.property,default:t.default,stops:[]},p.push(g)),c[g].stops.push([h[0].value,h[1]])}let f=[];for(let m of p)f.push([c[m].zoom,hc(c[m],e)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:ke.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},h){return dc({stops:f,base:t.base},e,m).evaluate(m,h)}}}else if(i){let c=o==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:ke.interpolationFactor.bind(void 0,c),zoomStops:t.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(t,e,p,l,u)}}else return{kind:"source",evaluate(c,p){let f=p&&p.properties?p.properties[t.property]:void 0;return f===void 0?wn(t.default,e.default):s(t,e,f,l,u)}}}function wn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Nd(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return wn(o,t.default,e.default)}function Ud(t,e,r){if(j(r)!=="number")return wn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let i=So(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function dc(t,e,r){let n=t.base!==void 0?t.base:1;if(j(r)!=="number")return wn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let o=So(t.stops.map(c=>c[0]),r),a=jd(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=lt[e.type]||zd;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),f=l.evaluate.apply(void 0,c);if(!(p===void 0||f===void 0))return u(p,f,a,t.colorSpace)}}:u(s,l,a,t.colorSpace)}function $d(t,e,r){switch(e.type){case"color":r=H.parse(r);break;case"formatted":r=Fe.fromString(r.toString());break;case"resolvedImage":r=Se.fromString(r.toString());break;case"padding":r=Oe.parse(r);break;case"colorArray":r=Pe.parse(r);break;case"numberArray":r=Ge.parse(r);break;default:j(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return wn(r,t.default,e.default)}function jd(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var Zt=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new no,this._defaultValue=r?Wd(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,i,o,a){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ne("Expected value to be one of ".concat(Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", "),", but found ").concat(JSON.stringify(s)," instead."));return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function An(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Qt}function er(t,e){let r=new io(Qt,yo,[],e?qd(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Rs(new Zt(n,e)):xr(r.errors)}var Je=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!xn(r.expression),this.globalStateRefs=To(r.expression)}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}},Tt=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!xn(r.expression),this.globalStateRefs=To(r.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}interpolationFactor(e,r,n){return this.interpolationType?ke.interpolationFactor(this.interpolationType,e,r,n):0}};function gc(t){return t._styleExpression!==void 0}function xc(t,e){let r=er(t,e);if(r.result==="error")return r;let n=r.value.expression,i=Ao(n);if(!i&&!It(e))return xr([new Ve("","data expressions not supported")]);let o=_o(n,["zoom"]);if(!o&&!mc(e))return xr([new Ve("","zoom expressions not supported")]);let a=ro(n);if(!a&&!o)return xr([new Ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Ve)return xr([a]);if(a instanceof ke&&!qs(e))return xr([new Ve("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return Rs(i?new Je("constant",r.value):new Je("source",r.value));let s=a instanceof ke?a.interpolation:void 0;return Rs(i?new Tt("camera",r.value,a.labels,s):new Tt("composite",r.value,a.labels,s))}var bn=class t{constructor(e,r){this._parameters=e,this._specification=r,vr(this,hc(this._parameters,this._specification))}static deserialize(e){return new t(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function bc(t,e){if(Io(t))return new bn(t,e);if(An(t)){let r=xc(t,e);if(r.result==="error")throw new Error(r.value.map(n=>"".concat(n.key,": ").concat(n.message)).join(", "));return r.value}else{let r=t;return e.type==="color"&&typeof t=="string"?r=H.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=Oe.parse(t):e.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?r=Ge.parse(t):e.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?r=Pe.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?r=Ee.parse(t):e.type==="projectionDefinition"&&typeof t=="string"&&(r=At.parse(t)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}function ro(t){let e=null;if(t instanceof oo)e=ro(t.result);else if(t instanceof so){for(let r of t.args)if(e=ro(r),e)break}else(t instanceof Sr||t instanceof ke)&&t.input instanceof Ze&&t.input.name==="zoom"&&(e=t);return e instanceof Ve||t.eachChild(r=>{let n=ro(r);n instanceof Ve?e=n:!e&&n?e=new Ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&n&&e!==n&&(e=new Ve("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function To(t,e=new Set){return t instanceof gn&&e.add(t.key),t.eachChild(r=>{To(r,e)}),e}function qd(t){let e={color:ze,string:$,number:k,enum:$,boolean:U,formatted:_r,padding:bo,numberArray:vo,colorArray:sn,projectionDefinition:go,resolvedImage:Pn,variableAnchorOffsetCollection:Po};return t.type==="array"?Ce(e[t.value]||N,t.length):e[t.type]}function Wd(t){if(t.type==="color"&&Io(t.default))return new H(0,0,0,0);switch(t.type){case"color":return H.parse(t.default)||null;case"padding":return Oe.parse(t.default)||null;case"numberArray":return Ge.parse(t.default)||null;case"colorArray":return Pe.parse(t.default)||null;case"variableAnchorOffsetCollection":return Ee.parse(t.default)||null;case"projectionDefinition":return At.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function Ws(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let e of t.slice(1))if(!Ws(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var Xd={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ct(t){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Ws(t)||(t=mo(t));let e=er(t,Xd);if(e.result==="error")throw new Error(e.value.map(r=>"".concat(r.key,": ").concat(r.message)).join(", "));{let r=vc(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r,getGlobalStateRefs:()=>To(e.value.expression)}}}function Hd(t,e){return t<e?-1:t>e?1:0}function vc(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(vc(t[e]))return!0;return!1}function mo(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?Ps(t[1],t[2],"=="):e==="!="?to(Ps(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Ps(t[1],t[2],e):e==="any"?Zd(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(mo)):e==="none"?["all"].concat(t.slice(1).map(mo).map(to)):e==="in"?Hu(t[1],t.slice(2)):e==="!in"?to(Hu(t[1],t.slice(2))):e==="has"?Zu(t[1]):e==="!has"?to(Zu(t[1])):!0}function Ps(t,e,r){switch(t){case"$type":return["filter-type-".concat(r),e];case"$id":return["filter-id-".concat(r),e];default:return["filter-".concat(r),t,e]}}function Zd(t){return["any"].concat(t.map(mo))}function Hu(t,e){if(e.length===0)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(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Hd)]]:["filter-in-small",t,["literal",e]]}}function Zu(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function to(t){return["!",t]}function zs(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t===void 0||t===null)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(let o of t)i+="".concat(zs(o),",");return"".concat(i,"]")}let r=Object.keys(t).sort(),n="{";for(let i=0;i<r.length;i++)n+="".concat(JSON.stringify(r[i]),":").concat(zs(t[r[i]]),",");return"".concat(n,"}")}function Jd(t){let e="";for(let r of Th)e+="/".concat(zs(t[r]));return e}function Pc(t,e){let r={};for(let i=0;i<t.length;i++){let o=e&&e[t[i].id]||Jd(t[i]);e&&(e[t[i].id]=o);let a=r[o];a||(a=r[o]=[]),a.push(t[i])}let n=[];for(let i in r)n.push(r[i]);return n}function Sc(t){let e=t.key,r=t.value;return r?[new C(e,r,"constants have been deprecated as of v8")]:[]}function le(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Jt(t){if(Array.isArray(t))return t.map(Jt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Jt(t[r]);return e}return le(t)}function Re(t){let e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=t.validateSpec,l=[],u=j(r);if(u!=="object")return[new C(e,r,"object expected, ".concat(u," found"))];for(let c in r){let p=c.split(".")[0],f=on(n,p)||n["*"],y;if(on(i,p))y=i[p];else if(on(n,p))y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new C(e,r[c],\'unknown property "\'.concat(c,\'"\')));continue}l=l.concat(y({key:(e&&"".concat(e,"."))+c,value:r[c],valueSpec:f,style:o,styleSpec:a,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new C(e,r,\'missing required property "\'.concat(c,\'"\')));return l}function Xs(t){let e=t.value,r=t.valueSpec,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.key,s=t.arrayElementValidator||n;if(j(e)!=="array")return[new C(a,e,"array expected, ".concat(j(e)," found"))];if(r.length&&e.length!==r.length)return[new C(a,e,"array length ".concat(r.length," expected, length ").concat(e.length," found"))];if(r["min-length"]&&e.length<r["min-length"])return[new C(a,e,"array length at least ".concat(r["min-length"]," expected, length ").concat(e.length," found"))];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),j(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<e.length;c++)u=u.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:l,validateSpec:t.validateSpec,style:i,styleSpec:o,key:"".concat(a,"[").concat(c,"]")}));return u}function Co(t){let e=t.key,r=t.value,n=t.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new C(e,r,"number expected, ".concat(i," found"))]:"minimum"in n&&r<n.minimum?[new C(e,r,"".concat(r," is less than the minimum value ").concat(n.minimum))]:"maximum"in n&&r>n.maximum?[new C(e,r,"".concat(r," is greater than the maximum value ").concat(n.maximum))]:[]}function wc(t){let e=t.valueSpec,r=le(t.value.type),n,i={},o,a,s=r!=="categorical"&&t.value.property===void 0,l=!s,u=j(t.value.stops)==="array"&&j(t.value.stops[0])==="array"&&j(t.value.stops[0][0])==="object",c=Re({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:p,default:m}});return r==="identity"&&s&&c.push(new C(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&c.push(new C(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!qs(t.valueSpec)&&c.push(new C(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!It(t.valueSpec)?c.push(new C(t.key,t.value,"property functions not supported")):s&&!mc(t.valueSpec)&&c.push(new C(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new C(t.key,t.value,\'"property" property is required\')),c;function p(h){if(r==="identity")return[new C(h.key,h.value,\'identity function may not have a "stops" property\')];let g=[],d=h.value;return g=g.concat(Xs({key:h.key,value:d,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:f})),j(d)==="array"&&d.length===0&&g.push(new C(h.key,d,"array must have at least one stop")),g}function f(h){let g=[],d=h.value,b=h.key;if(j(d)!=="array")return[new C(b,d,"array expected, ".concat(j(d)," found"))];if(d.length!==2)return[new C(b,d,"array length 2 expected, length ".concat(d.length," found"))];if(u){if(j(d[0])!=="object")return[new C(b,d,"object expected, ".concat(j(d[0])," found"))];if(d[0].zoom===void 0)return[new C(b,d,"object stop key must have zoom")];if(d[0].value===void 0)return[new C(b,d,"object stop key must have value")];if(a&&a>le(d[0].zoom))return[new C(b,d[0].zoom,"stop zoom values must appear in ascending order")];le(d[0].zoom)!==a&&(a=le(d[0].zoom),o=void 0,i={}),g=g.concat(Re({key:"".concat(b,"[0]"),value:d[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:Co,value:y}}))}else g=g.concat(y({key:"".concat(b,"[0]"),value:d[0],validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},d));return An(Jt(d[1]))?g.concat([new C("".concat(b,"[1]"),d[1],"expressions are not allowed in function stops.")]):g.concat(h.validateSpec({key:"".concat(b,"[1]"),value:d[1],valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,g){let d=j(h.value),b=le(h.value),x=h.value!==null?h.value:g;if(!n)n=d;else if(d!==n)return[new C(h.key,x,"".concat(d," stop domain type must match previous stop domain type ").concat(n))];if(d!=="number"&&d!=="string"&&d!=="boolean")return[new C(h.key,x,"stop domain value must be a number, string, or boolean")];if(d!=="number"&&r!=="categorical"){let v="number expected, ".concat(d," found");return It(e)&&r===void 0&&(v+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new C(h.key,x,v)]}return r==="categorical"&&d==="number"&&(!isFinite(b)||Math.floor(b)!==b)?[new C(h.key,x,"integer expected, found ".concat(b))]:r!=="categorical"&&d==="number"&&o!==void 0&&b<o?[new C(h.key,x,"stop domain values must appear in ascending order")]:(o=b,r==="categorical"&&b in i?[new C(h.key,x,"stop domain values must be unique")]:(i[b]=!0,[]))}function m(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function wr(t){let e=(t.expressionContext==="property"?xc:er)(Jt(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new C("".concat(t.key).concat(n.key),t.value,n.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new C(t.key,t.value,\'Invalid data expression for "\'.concat(t.propertyKey,\'". Output values must be contained as literals within the expression.\'))];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!xn(r))return[new C(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!xn(r))return[new C(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!_o(r,["zoom","feature-state"]))return[new C(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Ao(r))return[new C(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Yd(t){let e=t.value,r=t.key,n=j(e);return n!=="boolean"?[new C(r,e,"boolean expected, ".concat(n," found"))]:[]}function Os(t){let e=t.key,r=t.value,n=j(r);return n!=="string"?[new C(e,r,"color expected, ".concat(n," found"))]:H.parse(String(r))?[]:[new C(e,r,\'color expected, "\'.concat(r,\'" found\'))]}function vn(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(le(r))===-1&&i.push(new C(e,r,"expected one of [".concat(n.values.join(", "),"], ").concat(JSON.stringify(r)," found"))):Object.keys(n.values).indexOf(le(r))===-1&&i.push(new C(e,r,"expected one of [".concat(Object.keys(n.values).join(", "),"], ").concat(JSON.stringify(r)," found"))),i}function Hs(t){return Ws(Jt(t.value))?wr(vr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ac(t)}function Ac(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new C(r,e,"array expected, ".concat(j(e)," found"))];let n=t.styleSpec,i,o=[];if(e.length<1)return[new C(r,e,"filter array must have at least 1 element")];switch(o=o.concat(vn({key:"".concat(r,"[0]"),value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),le(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&le(e[1])==="$type"&&o.push(new C(r,e,\'"$type" cannot be use with operator "\'.concat(e[0],\'"\')));case"==":case"!=":e.length!==3&&o.push(new C(r,e,\'filter array for operator "\'.concat(e[0],\'" must have 3 elements\')));case"in":case"!in":e.length>=2&&(i=j(e[1]),i!=="string"&&o.push(new C("".concat(r,"[1]"),e[1],"string expected, ".concat(i," found"))));for(let a=2;a<e.length;a++)i=j(e[a]),le(e[1])==="$type"?o=o.concat(vn({key:"".concat(r,"[").concat(a,"]"),value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new C("".concat(r,"[").concat(a,"]"),e[a],"string, number, or boolean expected, ".concat(i," found")));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(Ac({key:"".concat(r,"[").concat(a,"]"),value:e[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=j(e[1]),e.length!==2?o.push(new C(r,e,\'filter array for "\'.concat(e[0],\'" operator must have 2 elements\'))):i!=="string"&&o.push(new C("".concat(r,"[1]"),e[1],"string expected, ".concat(i," found")));break}return o}function _c(t,e){let r=t.key,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o["".concat(e,"_").concat(t.layerType)];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=t.valueSpec||l[s];if(!c)return[new C(r,a,\'unknown property "\'.concat(s,\'"\'))];let p;if(j(a)==="string"&&It(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new C(r,a,\'"\'.concat(s,\'" does not support interpolation syntax\\n\')+\'Use an identity property function instead: `{ "type": "identity", "property": \'.concat(JSON.stringify(p[1])," }`."))];let f=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new C(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&Io(Jt(a))&&le(a.type)==="identity"&&f.push(new C(r,a,\'"text-font" does not support identity functions\'))),f.concat(n({key:t.key,value:a,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function Ic(t){return _c(t,"paint")}function Tc(t){return _c(t,"layout")}function Cc(t){let e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;if(j(r)!=="object")return[new C(n,r,"object expected, ".concat(j(r)," found"))];!r.type&&!r.ref&&e.push(new C(n,r,\'either "type" or "ref" is required\'));let a=le(r.type),s=le(r.ref);if(r.id){let l=le(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];le(c.id)===l&&e.push(new C(n,r.id,\'duplicate layer id "\'.concat(r.id,\'", previously used at line \').concat(c.id.__line__)))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&e.push(new C(n,r[u],\'"\'.concat(u,\'" is prohibited for ref layers\')))});let l;i.layers.forEach(u=>{le(u.id)===s&&(l=u)}),l?l.ref?e.push(new C(n,r.ref,"ref cannot reference another ref layer")):a=le(l.type):e.push(new C(n,r.ref,\'ref layer "\'.concat(s,\'" not found\')))}else if(a!=="background")if(!r.source)e.push(new C(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&le(l.type);l?u==="vector"&&a==="raster"?e.push(new C(n,r.source,\'layer "\'.concat(r.id,\'" requires a raster source\'))):u!=="raster-dem"&&a==="hillshade"?e.push(new C(n,r.source,\'layer "\'.concat(r.id,\'" requires a raster-dem source\'))):u!=="raster-dem"&&a==="color-relief"?e.push(new C(n,r.source,\'layer "\'.concat(r.id,\'" requires a raster-dem source\'))):u==="raster"&&a!=="raster"?e.push(new C(n,r.source,\'layer "\'.concat(r.id,\'" requires a vector source\'))):u==="vector"&&!r["source-layer"]?e.push(new C(n,r,\'layer "\'.concat(r.id,\'" must specify a "source-layer"\'))):u==="raster-dem"&&a!=="hillshade"&&a!=="color-relief"?e.push(new C(n,r.source,"raster-dem source can only be used with layer type \'hillshade\' or \'color-relief\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new C(n,r,\'layer "\'.concat(r.id,\'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.\'))):e.push(new C(n,r.source,\'source "\'.concat(r.source,\'" not found\')))}return e=e.concat(Re({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:"".concat(n,".type"),value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Hs,layout(l){return Re({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Tc(vr({layerType:a},u))}}})},paint(l){return Re({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Ic(vr({layerType:a},u))}}})}}})),e}function Yt(t){let e=t.value,r=t.key,n=j(e);return n!=="string"?[new C(r,e,"string expected, ".concat(n," found"))]:[]}function Kd(t){var e;let r=(e=t.sourceName)!==null&&e!==void 0?e:"",n=t.value,i=t.styleSpec,o=i.source_raster_dem,a=t.style,s=[],l=j(n);if(n===void 0)return s;if(l!=="object")return s.push(new C("source_raster_dem",n,"object expected, ".concat(l," found"))),s;let c=le(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],f=t.value.encoding?\'"\'.concat(t.value.encoding,\'"\'):"Default";for(let y in n)!c&&p.includes(y)?s.push(new C(y,n[y],\'In "\'.concat(r,\'": "\').concat(y,\'" is only valid when "encoding" is set to "custom". \').concat(f," encoding found"))):o[y]?s=s.concat(t.validateSpec({key:y,value:n[y],valueSpec:o[y],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new C(y,n[y],\'unknown property "\'.concat(y,\'"\')));return s}var Ju={promoteId:Qd};function kc(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new C(r,e,\'"type" is required\')];let a=le(e.type),s;switch(a){case"vector":case"raster":return s=Re({key:r,value:e,valueSpec:n["source_".concat(a.replace("-","_"))],style:t.style,styleSpec:n,objectElementValidators:Ju,validateSpec:o}),s;case"raster-dem":return s=Kd({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=Re({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:Ju}),e.cluster)for(let l in e.clusterProperties){let[u,c]=e.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...wr({key:"".concat(r,".").concat(l,".map"),value:c,expressionContext:"cluster-map"})),s.push(...wr({key:"".concat(r,".").concat(l,".reduce"),value:p,expressionContext:"cluster-reduce"}))}return s;case"video":return Re({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return Re({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new C(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return vn({key:"".concat(r,".type"),value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Qd({key:t,value:e}){if(j(e)==="string")return Yt({key:t,value:e});{let r=[];for(let n in e)r.push(...Yt({key:"".concat(t,".").concat(n),value:e[n]}));return r}}function Fc(t){let e=t.value,r=t.styleSpec,n=r.light,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new C("light",e,"object expected, ".concat(a," found"))]),o;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r})):n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new C(s,e[s],\'unknown property "\'.concat(s,\'"\'))])}return o}function Ec(t){let e=t.value,r=t.styleSpec,n=r.sky,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new C("sky",e,"object expected, ".concat(o," found"))];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new C(s,e[s],\'unknown property "\'.concat(s,\'"\'))]);return a}function Mc(t){let e=t.value,r=t.styleSpec,n=r.terrain,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new C("terrain",e,"object expected, ".concat(a," found"))]),o;for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new C(s,e[s],\'unknown property "\'.concat(s,\'"\'))]);return o}function eg(t){return Yt(t).length===0?[]:wr(t)}function tg(t){return Yt(t).length===0?[]:wr(t)}function rg(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new C(e,r,"padding requires 1 to 4 values; ".concat(r.length," values found"))];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:"".concat(e,"[").concat(a,"]"),value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return Co({key:e,value:r,valueSpec:{}})}function ng(t){let e=t.key,r=t.value;if(j(r)==="array"){let i={type:"number"};if(r.length<1)return[new C(e,r,"array length at least 1 expected, length 0 found")];let o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:"".concat(e,"[").concat(a,"]"),value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return Co({key:e,value:r,valueSpec:{}})}function ig(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1)return[new C(e,r,"array length at least 1 expected, length 0 found")];let i=[];for(let o=0;o<r.length;o++)i=i.concat(Os({key:"".concat(e,"[").concat(o,"]"),value:r[o]}));return i}else return Os({key:e,value:r})}function og(t){let e=t.key,r=t.value,n=j(r),i=t.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new C(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(vn({key:"".concat(e,"[").concat(a,"]"),value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(Xs({key:"".concat(e,"[").concat(a+1,"]"),value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function Lc(t){let e=[],r=t.value,n=t.key;if(Array.isArray(r)){let i=[],o=[];for(let a in r){r[a].id&&i.includes(r[a].id)&&e.push(new C(n,r,"all the sprites\' ids must be unique, but ".concat(r[a].id," is duplicated"))),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new C(n,r,"all the sprites\' URLs must be unique, but ".concat(r[a].url," is duplicated"))),o.push(r[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Re({key:"".concat(n,"[").concat(a,"]"),value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return Yt({key:n,value:r})}function ag(t){let e=t.value,r=t.styleSpec,n=r.projection,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new C("projection",e,"object expected, ".concat(o," found"))];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new C(s,e[s],\'unknown property "\'.concat(s,\'"\'))]);return a}function sg(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let n=j(r);return n==="array"&&!ug(r)&&!lg(r)?[new C(e,r,"projection expected, invalid array ".concat(JSON.stringify(r)," found"))]:["array","string"].includes(n)?[]:[new C(e,r,\'projection expected, invalid type "\'.concat(n,\'" found\'))]}function lg(t){return!!["interpolate","step","literal"].includes(t[0])}function ug(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function cg(t){return!!t&&t.constructor===Object}function Dc(t){return cg(t.value)?[]:[new C(t.key,t.value,"object expected, ".concat(j(t.value)," found"))]}var Yu={"*"(){return[]},array:Xs,boolean:Yd,number:Co,color:Os,constants:Sc,enum:vn,filter:Hs,function:wc,layer:Cc,object:Re,source:kc,light:Fc,sky:Ec,terrain:Mc,projection:ag,projectionDefinition:sg,string:Yt,formatted:eg,resolvedImage:tg,padding:rg,numberArray:ng,colorArray:ig,variableAnchorOffsetCollection:og,sprite:Lc,state:Dc};function ho(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=ho,r.expression&&Io(le(e))?wc(t):r.expression&&An(Jt(e))?wr(t):r.type&&Yu[r.type]?Yu[r.type](t):Re(vr({},t,{valueSpec:r.type?n[r.type]:r}))}function Bc(t){let e=t.value,r=t.key,n=Yt(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new C(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&n.push(new C(r,e,\'"glyphs" url must include a "{range}" token\'))),n}function Me(t,e=P){let r=[];return r=r.concat(ho({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:ho,objectElementValidators:{glyphs:Bc,"*"(){return[]}}})),t.constants&&(r=r.concat(Sc({key:"constants",value:t.constants}))),Vc(r)}Me.source=qe(je(kc));Me.sprite=qe(je(Lc));Me.glyphs=qe(je(Bc));Me.light=qe(je(Fc));Me.sky=qe(je(Ec));Me.terrain=qe(je(Mc));Me.state=qe(je(Dc));Me.layer=qe(je(Cc));Me.filter=qe(je(Hs));Me.paintProperty=qe(je(Ic));Me.layoutProperty=qe(je(Tc));function je(t){return function(e){return t(Xi($t({},e),{validateSpec:ho}))}}function Vc(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function qe(t){return function(...e){return Vc(t.apply(this,e))}}var Rc="AbortError";function zc(t){return t.message===Rc}function Zs(){return new Error(Rc)}var ko={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Oc(t){return ko.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function Gc(t,e){ko.REGISTERED_PROTOCOLS[t]=e}function Nc(t){delete ko.REGISTERED_PROTOCOLS[t]}var Uc="global-dispatcher",tr=class extends Error{constructor(e,r,n,i){super("AJAXError: ".concat(r," (").concat(e,"): ").concat(n)),this.status=e,this.statusText=r,this.url=n,this.body=i}},jc=()=>at(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,pg=t=>/^file:/.test(t)||/^file:/.test(jc())&&!/^\\w+:/.test(t);async function fg(t,e){let r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:jc(),signal:e.signal});t.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let n;try{n=await fetch(r)}catch(a){throw new tr(0,a.message,t.url,new Blob)}if(!n.ok){let a=await n.blob();throw new tr(n.status,n.statusText,t.url,a)}let i;t.type==="arrayBuffer"||t.type==="image"?i=n.arrayBuffer():t.type==="json"?i=n.json():i=n.text();let o=await i;if(e.signal.aborted)throw Zs();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function yg(t,e){return new Promise((r,n)=>{var o;let i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(i.responseType="arraybuffer");for(let a in t.headers)i.setRequestHeader(a,t.headers[a]);t.type==="json"&&(i.responseType="text",(o=t.headers)!=null&&o.Accept||i.setRequestHeader("Accept","application/json")),i.withCredentials=t.credentials==="include",i.onerror=()=>{n(new Error(i.statusText))},i.onload=()=>{if(!e.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let a=i.response;if(t.type==="json")try{a=JSON.parse(i.response)}catch(s){n(s);return}r({data:a,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let a=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new tr(i.status,i.statusText,t.url,a))}},e.signal.addEventListener("abort",()=>{i.abort(),n(Zs())}),i.send(t.body)})}var qc=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=Oc(t.url);if(r)return r(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:Uc},e)}if(!pg(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return fg(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:Uc},e)}return yg(t,e)},Wc=(t,e)=>qc(de(t,{type:"json"}),e),Xc=(t,e)=>qc(de(t,{type:"arrayBuffer"}),e);var ut={};function I(t,e,r={}){if(ut[t])throw new Error("".concat(t," is already registered."));Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ut[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}I("Object",Object);I("Set",Set);I("TransferableGridIndex",jt);I("Color",H);I("Error",Error);I("AJAXError",tr);I("ResolvedImage",Se);I("StylePropertyFunction",bn);I("StyleExpression",Zt,{omit:["_evaluator"]});I("ZoomDependentExpression",Tt);I("ZoomConstantExpression",Je);I("CompoundExpression",Ze,{omit:["_evaluate"]});for(let t in Qt)Qt[t]._classRegistryKey||I("Expression_".concat(t),Qt[t]);function Hc(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function Js(t){let e=t.constructor;return t.$name||e._classRegistryKey}function mg(t){if(t===null||typeof t!="object")return!1;let e=Js(t);return!!(e&&e!=="Object")}function Zc(t){return!mg(t)&&(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||Hc(t)||vt(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function Cr(t,e){if(Zc(t)){if((Hc(t)||vt(t))&&e&&e.push(t),ArrayBuffer.isView(t)){let o=t;e&&e.push(o.buffer)}return t instanceof ImageData&&e&&e.push(t.data.buffer),t}if(Array.isArray(t)){let o=[];for(let a of t)o.push(Cr(a,e));return o}if(typeof t!="object")throw new Error("can\'t serialize object of type ".concat(typeof t));let r=Js(t);if(!r)throw new Error("can\'t serialize object of unregistered class ".concat(t.constructor.name));if(!ut[r])throw new Error("".concat(r," is not registered."));let{klass:n}=ut[r],i=n.serialize?n.serialize(t,e):{};if(n.serialize){if(e&&i===e[e.length-1])throw new Error("statically serialized object won\'t survive transfer of $name property")}else{for(let o in t){if(!t.hasOwnProperty(o)||ut[r].omit.indexOf(o)>=0)continue;let a=t[o];i[o]=ut[r].shallow.indexOf(o)>=0?a:Cr(a,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(i.$name=r),i}function kr(t){if(Zc(t))return t;if(Array.isArray(t))return t.map(kr);if(typeof t!="object")throw new Error("can\'t deserialize object of type ".concat(typeof t));let e=Js(t)||"Object";if(!ut[e])throw new Error("can\'t deserialize unregistered class ".concat(e));let{klass:r}=ut[e];if(!r)throw new Error("can\'t deserialize unregistered class ".concat(e));if(r.deserialize)return r.deserialize(t);let n=Object.create(r.prototype);for(let i of Object.keys(t)){if(i==="$name")continue;let o=t[i];n[i]=ut[e].shallow.indexOf(i)>=0?o:kr(o)}return n}var Fo=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};var hg={once:!0},Eo=class{constructor(e,r){this.target=e,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Fo(()=>this.process()),this.subscription=ps(this.target,"message",n=>this.receive(n),!1),this.globalScope=at(self)?e:window}registerMessageHandler(e,r){this.messageHandlers[e]=r}sendAsync(e,r){return new Promise((n,i)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=r?ps(r.signal,"abort",()=>{a==null||a.unsubscribe(),delete this.resolveRejects[o];let u={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(u)},hg):null;this.resolveRejects[o]={resolve:u=>{a==null||a.unsubscribe(),n(u)},reject:u=>{a==null||a.unsubscribe(),i(u)}};let s=[],l=Xi($t({},e),{id:o,sourceMapId:this.mapId,origin:location.origin,data:Cr(e.data,s)});this.target.postMessage(l,{transfer:s})})}receive(e){let r=e.data,n=r.id;if(!(r.origin!=="file://"&&location.origin!=="file://"&&r.origin!=="resource://android"&&location.origin!=="resource://android"&&r.origin!==location.origin)&&!(r.targetMapId&&this.mapId!==r.targetMapId)){if(r.type==="<cancel>"){delete this.tasks[n];let i=this.abortControllers[n];delete this.abortControllers[n],i&&i.abort();return}if(at(self)||r.mustQueue){this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger();return}this.processTask(n,r)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),r=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),r&&this.processTask(e,r)}async processTask(e,r){if(r.type==="<response>"){let o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;r.error?o.reject(kr(r.error)):o.resolve(kr(r.data));return}if(!this.messageHandlers[r.type]){this.completeTask(e,new Error("Could not find a registered handler for ".concat(r.type,", map ID: ").concat(this.mapId,", available handlers: ").concat(Object.keys(this.messageHandlers).join(", "))));return}let n=kr(r.data),i=new AbortController;this.abortControllers[e]=i;try{let o=await this.messageHandlers[r.type](r.sourceMapId,n,i);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,r,n){let i=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:r?Cr(r):null,data:Cr(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function Jc(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function Ys(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var Mo=class{constructor(e,r={}){de(this,r),this.type=e}},_n=class extends Mo{constructor(e,r={}){super("error",de({error:e},r))}},Lo=class{on(e,r){return this._listeners=this._listeners||{},Jc(e,r,this._listeners),{unsubscribe:()=>{this.off(e,r)}}}off(e,r){return Ys(e,r,this._listeners),Ys(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Jc(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new Mo(e,r||{}));let n=e.type;if(this.listens(n)){e.target=this;let i=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let s of i)s.call(this,e);let o=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let s of o)Ys(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(de(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof _n&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}};var ct=Me,sv=ct.source,lv=ct.light,uv=ct.sky,cv=ct.terrain,pv=ct.filter,Yc=ct.paintProperty,Kc=ct.layoutProperty;function Qc(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new _n(new Error(n.message))),r=!0;return r}var In=class{constructor(){this.first=!0}update(e,r){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=n,!0):!1)}};var q={"Latin-1 Supplement":t=>t>=128&&t<=255,"Hangul Jamo":t=>t>=4352&&t<=4607,Khmer:t=>t>=6016&&t<=6143,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Kanbun:t=>t>=12688&&t<=12703,"CJK Strokes":t=>t>=12736&&t<=12783,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Hangul Syllables":t=>t>=44032&&t<=55215,"Private Use Area":t=>t>=57344&&t<=63743,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function Tn(t){for(let e of t)if(Do(e.charCodeAt(0)))return!0;return!1}function ep(t){for(let e of t)if(!xg(e.charCodeAt(0)))return!1;return!0}function Ks(t){let e=t.map(r=>{try{return new RegExp("\\\\p{sc=".concat(r,"}"),"u").source}catch(n){return null}}).filter(r=>r);return new RegExp(e.join("|"),"u")}var dg=["Arab","Dupl","Mong","Ougr","Syrc"],gg=Ks(dg);function xg(t){return!gg.test(String.fromCodePoint(t))}var bg=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],tp=Ks(bg);function rp(t){return t<11904?!1:q["CJK Compatibility Forms"](t)||q["CJK Compatibility"](t)||q["CJK Strokes"](t)||q["CJK Symbols and Punctuation"](t)||q["Enclosed CJK Letters and Months"](t)||q["Halfwidth and Fullwidth Forms"](t)||q["Ideographic Description Characters"](t)||q["Vertical Forms"](t)?!0:tp.test(String.fromCodePoint(t))}function Do(t){return t===746||t===747?!0:t<4352?!1:!!(q["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||q["CJK Compatibility"](t)||q["CJK Strokes"](t)||q["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||q["Enclosed CJK Letters and Months"](t)||q["Ideographic Description Characters"](t)||q.Kanbun(t)||q.Katakana(t)&&t!==12540||q["Halfwidth and Fullwidth Forms"](t)&&t!==65288&&t!==65289&&t!==65293&&!(t>=65306&&t<=65310)&&t!==65339&&t!==65341&&t!==65343&&!(t>=65371&&t<=65503)&&t!==65507&&!(t>=65512&&t<=65519)||q["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||q["Vertical Forms"](t)||q["Yijing Hexagram Symbols"](t)||new RegExp("\\\\p{sc=Cans}","u").test(String.fromCodePoint(t))||new RegExp("\\\\p{sc=Hang}","u").test(String.fromCodePoint(t))||tp.test(String.fromCodePoint(t)))}function vg(t){return!!(q["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||q["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||q["Letterlike Symbols"](t)||q["Number Forms"](t)||q["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||q["Control Pictures"](t)&&t!==9251||q["Optical Character Recognition"](t)||q["Enclosed Alphanumerics"](t)||q["Geometric Shapes"](t)||q["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||q["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||q["CJK Symbols and Punctuation"](t)||q.Katakana(t)||q["Private Use Area"](t)||q["CJK Compatibility Forms"](t)||q["Small Form Variants"](t)||q["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}function Qs(t){return!(Do(t)||vg(t))}function np(t){return new RegExp("\\\\p{sc=Arab}","u").test(String.fromCodePoint(t))}var Pg=["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"],Sg=Ks(Pg);function ip(t){return Sg.test(String.fromCodePoint(t))}function wg(t,e){return!(!e&&ip(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||q.Khmer(t))}function op(t){for(let e of t)if(ip(e.charCodeAt(0)))return!0;return!1}function ap(t,e){for(let r of t)if(!wg(r.charCodeAt(0),e))return!1;return!0}var el=class{constructor(){this.TIMEOUT=5e3;this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null;this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(we.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,r){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let n=e.pluginURL,i=new Promise(s=>{this.loadScriptResolve=s});r(n);let o=new Promise(s=>setTimeout(()=>s(),this.TIMEOUT));if(await Promise.race([i,o]),this.isParsed()){let s={pluginStatus:"loaded",pluginURL:n};return this.setState(s),s}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error("RTL Text Plugin failed to import scripts from ".concat(n))}},we=new el;var W=class{constructor(e,r){this.zoom=e,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new In,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new In,this.transition={},this.globalState={})}isSupportedScript(e){return ap(e,we.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,r=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}};var Fr=class{constructor(e,r){this.property=e,this.value=r,this.expression=bc(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}},Cn=class{constructor(e){this.property=e,this.value=new Fr(e,void 0)}transitioned(e,r){return new Vo(this.property,this.value,r,de({},e.transition,this.transition),e.now)}untransitioned(){return new Vo(this.property,this.value,null,{},0)}},Bo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return nt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Cn(this._values[e].property)),this._values[e].value=new Fr(this._values[e].property,r===null?void 0:nt(r))}getTransition(e){return nt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Cn(this._values[e].property)),this._values[e].transition=nt(r)||void 0}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n);let i=this.getTransition(r);i!==void 0&&(e["".concat(r,"-transition")]=i)}return e}transitioned(e,r){let n=new Ro(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(e,r._values[i]);return n}untransitioned(){let e=new Ro(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},Vo=class{constructor(e,r,n,i,o){this.property=e,this.value=r,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(e,r,n){let i=e.now||0,o=this.value.possiblyEvaluate(e,r,n),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(e,r,n);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,r,n),o,Tu(s))}}else return o}},Ro=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){let i=new kt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},zo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return nt(this._values[e].value)}setValue(e,r){this._values[e]=new Fr(this._values[e].property,r===null?void 0:nt(r))}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n)}return e}possiblyEvaluate(e,r,n){let i=new kt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},ge=class{constructor(e,r,n){this.property=e,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,n,i){return this.property.evaluate(this.value,this.parameters,e,r,n,i)}},kt=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},F=class{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,n){let i=this.specification.type,o=lt[i];return o?o(e,r,n):e}},L=class{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,n,i){return e.expression.kind==="constant"||e.expression.kind==="camera"?new ge(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new ge(this,e.expression,r)}interpolate(e,r,n){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new ge(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=lt[i];if(o){let a=o(e.value.value,r.value.value,n);return new ge(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,r,n,i,o,a){return e.kind==="constant"?e.value:e.evaluate(r,n,i,o,a)}},pt=class extends L{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new ge(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i),s=e.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,r);return new ge(this,{kind:"constant",value:l},r)}else if(e.expression.kind==="camera"){let o=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new ge(this,{kind:"constant",value:o},r)}else return new ge(this,e.expression,r)}evaluate(e,r,n,i,o,a){if(e.kind==="source"){let s=e.evaluate(r,n,i,o,a);return this._calculate(s,s,s,r)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},n,i),e.evaluate({zoom:Math.floor(r.zoom)},n,i),e.evaluate({zoom:Math.floor(r.zoom)+1},n,i),r):e.value}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},rr=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){if(e.value!==void 0)if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i);return this._calculate(o,o,o,r)}else return this._calculate(e.expression.evaluate(new W(Math.floor(r.zoom-1),r)),e.expression.evaluate(new W(Math.floor(r.zoom),r)),e.expression.evaluate(new W(Math.floor(r.zoom+1),r)),r)}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},ft=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){return!!e.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},ee=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in e){let n=e[r];n.specification.overridable&&this.overridableProperties.push(r);let i=this.defaultPropertyValues[r]=new Fr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new Cn(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};I("DataDrivenProperty",L);I("DataConstantProperty",F);I("CrossFadedDataDrivenProperty",pt);I("CrossFadedProperty",rr);I("ColorRampProperty",ft);var Oo="-transition",oe=class extends Lo{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Ct(e.filter)),r.layout&&(this._unevaluatedLayout=new zo(r.layout)),r.paint)){this._transitionablePaint=new Bo(r.paint);for(let n in e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(let n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new kt(r.paint)}}setFilter(e){this.filter=e,this._featureFilter=Ct(e)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;if(this._unevaluatedLayout)for(let r in this._unevaluatedLayout._values){let n=this._unevaluatedLayout._values[r];for(let i of n.getGlobalStateRefs())e.add(i)}for(let r of this._featureFilter.getGlobalStateRefs())e.add(r);return e}setLayoutProperty(e,r,n={}){if(r!=null){let i="layers.".concat(this.id,".layout.").concat(e);if(this._validate(Kc,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(Oo)?this._transitionablePaint.getTransition(e.slice(0,-Oo.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i="layers.".concat(this.id,".paint.").concat(e);if(this._validate(Yc,i,e,r,n))return!1}if(e.endsWith(Oo))return this._transitionablePaint.setTransition(e.slice(0,-Oo.length),r||void 0),!1;{let i=this._transitionablePaint._values[e],o=i.property.specification["property-type"]==="cross-faded-data-driven",a=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);let l=this._transitionablePaint._values[e].value;return l.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(e,s,l)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,n){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Fu(e,(r,n)=>r!==void 0&&!(n==="layout"&&!Object.keys(r).length)&&!(n==="paint"&&!Object.keys(r).length))}_validate(e,r,n,i,o={}){return o&&o.validate===!1?!1:Qc(this,e.call(ct,{key:r,layerType:this.type,objectKey:n,value:i,styleSpec:P,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let r=this.paint.get(e);if(!(!(r instanceof ge)||!It(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};var Ag={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Ft=class{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},_g=128,Ig=5,te=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*Ig),_g),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function Q(t,e=1){let r=0,n=0,i=t.map(a=>{let s=Tg(a.type),l=r=sp(r,Math.max(e,s)),u=a.components||1;return n=Math.max(n,s),r+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=sp(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function Tg(t){return Ag[t].BYTES_PER_ELEMENT}function sp(t,e){return Math.ceil(t/e)*e}var lp=Y(ye(),1),nr=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.int16[i+0]=r,this.int16[i+1]=n,e}};nr.prototype.bytesPerElement=4;I("StructArrayLayout2i4",nr);var kn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.int16[o+0]=r,this.int16[o+1]=n,this.int16[o+2]=i,e}};kn.prototype.bytesPerElement=6;I("StructArrayLayout3i6",kn);var Go=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.int16[a+0]=r,this.int16[a+1]=n,this.int16[a+2]=i,this.int16[a+3]=o,e}};Go.prototype.bytesPerElement=8;I("StructArrayLayout4i8",Go);var Fn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};Fn.prototype.bytesPerElement=12;I("StructArrayLayout2i4i12",Fn);var En=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*4,u=e*8;return this.int16[l+0]=r,this.int16[l+1]=n,this.uint8[u+4]=i,this.uint8[u+5]=o,this.uint8[u+6]=a,this.uint8[u+7]=s,e}};En.prototype.bytesPerElement=8;I("StructArrayLayout2i4ub8",En);var Et=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.float32[i+0]=r,this.float32[i+1]=n,e}};Et.prototype.bytesPerElement=8;I("StructArrayLayout2f8",Et);var Mn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,r,n,i,o,a,s,l,u,c)}emplace(e,r,n,i,o,a,s,l,u,c,p){let f=e*10;return this.uint16[f+0]=r,this.uint16[f+1]=n,this.uint16[f+2]=i,this.uint16[f+3]=o,this.uint16[f+4]=a,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=u,this.uint16[f+8]=c,this.uint16[f+9]=p,e}};Mn.prototype.bytesPerElement=20;I("StructArrayLayout10ui20",Mn);var Ln=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f){let y=this.length;return this.resize(y+1),this.emplace(y,e,r,n,i,o,a,s,l,u,c,p,f)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y){let m=e*12;return this.int16[m+0]=r,this.int16[m+1]=n,this.int16[m+2]=i,this.int16[m+3]=o,this.uint16[m+4]=a,this.uint16[m+5]=s,this.uint16[m+6]=l,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=p,this.int16[m+10]=f,this.int16[m+11]=y,e}};Ln.prototype.bytesPerElement=24;I("StructArrayLayout4i4ui4i24",Ln);var Dn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.float32[o+0]=r,this.float32[o+1]=n,this.float32[o+2]=i,e}};Dn.prototype.bytesPerElement=12;I("StructArrayLayout3f12",Dn);var Bn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint32[n+0]=r,e}};Bn.prototype.bytesPerElement=4;I("StructArrayLayout1ul4",Bn);var Vn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,r,n,i,o,a,s,l,u)}emplace(e,r,n,i,o,a,s,l,u,c){let p=e*10,f=e*5;return this.int16[p+0]=r,this.int16[p+1]=n,this.int16[p+2]=i,this.int16[p+3]=o,this.int16[p+4]=a,this.int16[p+5]=s,this.uint32[f+3]=l,this.uint16[p+8]=u,this.uint16[p+9]=c,e}};Vn.prototype.bytesPerElement=20;I("StructArrayLayout6i1ul2ui20",Vn);var Rn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};Rn.prototype.bytesPerElement=12;I("StructArrayLayout2i2i2i12",Rn);var No=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,n,i,o)}emplace(e,r,n,i,o,a){let s=e*4,l=e*8;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=i,this.int16[l+6]=o,this.int16[l+7]=a,e}};No.prototype.bytesPerElement=16;I("StructArrayLayout2f1f2i16",No);var zn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*16,u=e*4,c=e*8;return this.uint8[l+0]=r,this.uint8[l+1]=n,this.float32[u+1]=i,this.float32[u+2]=o,this.int16[c+6]=a,this.int16[c+7]=s,e}};zn.prototype.bytesPerElement=16;I("StructArrayLayout2ub2f2i16",zn);var On=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.uint16[o+0]=r,this.uint16[o+1]=n,this.uint16[o+2]=i,e}};On.prototype.bytesPerElement=6;I("StructArrayLayout3ui6",On);var Gn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d){let b=this.length;return this.resize(b+1),this.emplace(b,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,b){let x=e*24,v=e*12,S=e*48;return this.int16[x+0]=r,this.int16[x+1]=n,this.uint16[x+2]=i,this.uint16[x+3]=o,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=l,this.uint16[x+10]=u,this.uint16[x+11]=c,this.uint16[x+12]=p,this.float32[v+7]=f,this.float32[v+8]=y,this.uint8[S+36]=m,this.uint8[S+37]=h,this.uint8[S+38]=g,this.uint32[v+10]=d,this.int16[x+22]=b,e}};Gn.prototype.bytesPerElement=48;I("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Gn);var Nn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,b,x,v,S,A,w,T,E,D,B,z){let M=this.length;return this.resize(M+1),this.emplace(M,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,b,x,v,S,A,w,T,E,D,B,z)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,b,x,v,S,A,w,T,E,D,B,z,M){let _=e*32,V=e*16;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=i,this.int16[_+3]=o,this.int16[_+4]=a,this.int16[_+5]=s,this.int16[_+6]=l,this.int16[_+7]=u,this.uint16[_+8]=c,this.uint16[_+9]=p,this.uint16[_+10]=f,this.uint16[_+11]=y,this.uint16[_+12]=m,this.uint16[_+13]=h,this.uint16[_+14]=g,this.uint16[_+15]=d,this.uint16[_+16]=b,this.uint16[_+17]=x,this.uint16[_+18]=v,this.uint16[_+19]=S,this.uint16[_+20]=A,this.uint16[_+21]=w,this.uint16[_+22]=T,this.uint32[V+12]=E,this.float32[V+13]=D,this.float32[V+14]=B,this.uint16[_+30]=z,this.uint16[_+31]=M,e}};Nn.prototype.bytesPerElement=64;I("StructArrayLayout8i15ui1ul2f2ui64",Nn);var ir=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.float32[n+0]=r,e}};ir.prototype.bytesPerElement=4;I("StructArrayLayout1f4",ir);var Un=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*6,a=e*3;return this.uint16[o+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,e}};Un.prototype.bytesPerElement=12;I("StructArrayLayout1ui2f12",Un);var $n=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*2,a=e*4;return this.uint32[o+0]=r,this.uint16[a+2]=n,this.uint16[a+3]=i,e}};$n.prototype.bytesPerElement=8;I("StructArrayLayout1ul2ui8",$n);var jn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.uint16[i+0]=r,this.uint16[i+1]=n,e}};jn.prototype.bytesPerElement=4;I("StructArrayLayout2ui4",jn);var Uo=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint16[n+0]=r,e}};Uo.prototype.bytesPerElement=2;I("StructArrayLayout1ui2",Uo);var Er=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.float32[a+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,this.float32[a+3]=o,e}};Er.prototype.bytesPerElement=16;I("StructArrayLayout4f16",Er);var $o=class extends Ft{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new lp.default(this.anchorPointX,this.anchorPointY)}};$o.prototype.size=20;var qn=class extends Vn{get(e){return new $o(this,e)}};I("CollisionBoxArray",qn);var jo=class extends Ft{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};jo.prototype.size=48;var Wn=class extends Gn{get(e){return new jo(this,e)}};I("PlacedSymbolArray",Wn);var qo=class extends Ft{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};qo.prototype.size=64;var Xn=class extends Nn{get(e){return new qo(this,e)}};I("SymbolInstanceArray",Xn);var Hn=class extends ir{getoffsetX(e){return this.float32[e*1+0]}};I("GlyphOffsetArray",Hn);var Zn=class extends kn{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};I("SymbolLineVertexArray",Zn);var Wo=class extends Ft{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};Wo.prototype.size=12;var Jn=class extends Un{get(e){return new Wo(this,e)}};I("TextAnchorOffsetArray",Jn);var Xo=class extends Ft{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]}};Xo.prototype.size=8;var Yn=class extends $n{get(e){return new Xo(this,e)}};I("FeatureIndexArray",Yn);var Ho=class extends nr{};var Zo=class extends nr{},Jo=class extends nr{},Yo=class extends Fn{};var Ko=class extends En{},Qo=class extends Et{},yt=class extends Mn{},ea=class extends Ln{},ta=class extends Dn{},ra=class extends Bn{},Kn=class extends Rn{};var na=class extends zn{};var Le=class extends On{},Mt=class extends jn{};var Cg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:up,size:zv,alignment:Ov}=Cg;var pe=class t{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1;this.segments=e}prepareSegment(e,r,n,i){let o=this.segments[this.segments.length-1];return e>t.MAX_VERTEX_ARRAY_LENGTH&&ce("Max vertices per segment is ".concat(t.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(e,". Consider using the `fillLargeMeshArrays` function if you require meshes with more than ").concat(t.MAX_VERTEX_ARRAY_LENGTH," vertices.")),this._forceNewSegmentOnNextPrepare||!o||o.vertexLength+e>t.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i?this.createNewSegment(r,n,i):o}createNewSegment(e,r,n){let i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return n!==void 0&&(i.sortKey=n),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(e,r,n){return this.prepareSegment(0,e,r,n)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,n,i){return new t([{vertexOffset:e,primitiveOffset:r,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};pe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;I("SegmentVector",pe);function tl(t,e){return t=it(Math.floor(t),0,255),e=it(Math.floor(e),0,255),256*t+e}var Qn=Q([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var mp=Y(il(),1);var ei=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(yp(e)),this.positions.push(r,n,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=yp(e),n=0,i=this.ids.length-1;for(;n<i;){let a=n+i>>1;this.ids[a]>=r?i=a:n=a+1}let o=[];for(;this.ids[n]===r;){let a=this.positions[3*n],s=this.positions[3*n+1],l=this.positions[3*n+2];o.push({index:a,start:s,end:l}),n++}return o}static serialize(e,r){let n=new Float64Array(e.ids),i=new Uint32Array(e.positions);return ol(n,i,0,n.length-1),r&&r.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(e){let r=new t;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function yp(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,mp.default)(String(t))}function ol(t,e,r,n){for(;r<n;){let i=t[r+n>>1],o=r-1,a=n+1;for(;;){do o++;while(t[o]<i);do a--;while(t[a]>i);if(o>=a)break;oa(t,o,a),oa(e,3*o,3*a),oa(e,3*o+1,3*a+1),oa(e,3*o+2,3*a+2)}a-r<n-a?(ol(t,e,r,a),r=a+1):(ol(t,e,a+1,n),n=a)}}function oa(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}I("FeaturePositionMap",ei);var ti=class{constructor(e,r){this.gl=e.gl,this.location=r}};var Mr=class extends ti{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};var aa=class extends ti{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}},sa=class extends ti{constructor(e,r){super(e,r),this.current=H.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}};var eP=new Float32Array(16);function al(t){return[tl(255*t.r,255*t.g),tl(255*t.b,255*t.a)]}var or=class{constructor(e,r,n){this.value=e,this.uniformNames=r.map(i=>"u_".concat(i)),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new sa(e,r):new Mr(e,r)}},Lt=class{constructor(e,r){this.uniformNames=r.map(n=>"u_".concat(n)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,r,n){return n.substr(0,9)==="u_pattern"?new aa(e,r):new Mr(e,r)}},We=class{constructor(e,r,n,i){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:"a_".concat(o),type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,r,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new W(0),r,{},i,[],o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(e,r,o)}_setPaintValue(e,r,n){if(this.type==="color"){let i=al(n);for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=e;i<r;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},De=class{constructor(e,r,n,i,o,a){this.expression=e,this.uniformNames=r.map(s=>"u_".concat(s,"_t")),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:"a_".concat(s),type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,r,n,i,o){let a=this.expression.evaluate(new W(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new W(this.zoom+1),r,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,a,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:this.zoom},n,i),a=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(e,r,o,a)}_setPaintValue(e,r,n,i){if(this.type==="color"){let o=al(n),a=al(i);for(let s=e;s<r;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,n,i);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){let n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,i=it(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,r,n){return new Mr(e,r)}},Ye=class{constructor(e,r,n,i,o,a){this.expression=e,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(e,r,n){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(e,r,n,i,o){this._setPaintValues(e,r,n.patterns&&n.patterns[this.layerId],o)}_setPaintValues(e,r,n,i){if(!i||!n)return;let{min:o,mid:a,max:s}=n,l=i[o],u=i[a],c=i[s];if(!(!l||!u||!c))for(let p=e;p<r;p++)this.zoomInPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],u.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],u.pixelRatio,c.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Qn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Qn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},la=class{constructor(e,r,n){this.binders={},this._buffers=[];let i=[];for(let o in e.paint._values){if(!n(o))continue;let a=e.paint.get(o);if(!(a instanceof ge)||!It(a.property.specification))continue;let s=Mg(o,e.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],f=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=f?new Lt(l.value,s):new or(l.value,s,u),i.push("/u_".concat(o));else if(l.kind==="source"||f){let y=hp(o,u,"source");this.binders[o]=f?new Ye(l,u,c,r,y,e.id):new We(l,s,u,y),i.push("/a_".concat(o))}else{let y=hp(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push("/z_".concat(o))}}this.cacheKey=i.sort().join("")}getMaxValue(e){let r=this.binders[e];return r instanceof We||r instanceof De?r.maxValue:0}populatePaintArrays(e,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof We||s instanceof De||s instanceof Ye)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof Lt&&i.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,n,i,o){let a=!1;for(let s in e){let l=r.getPositions(s);for(let u of l){let c=n.feature(u.index);for(let p in this.binders){let f=this.binders[p];if((f instanceof We||f instanceof De||f instanceof Ye)&&f.expression.isStateDependent===!0){let y=i.paint.get(p);f.expression=y.value,f.updatePaintArray(u.start,u.end,c,e[s],o),a=!0}}}}return a}defines(){let e=[];for(let r in this.binders){let n=this.binders[r];(n instanceof or||n instanceof Lt)&&e.push(...n.uniformNames.map(i=>"#define HAS_UNIFORM_".concat(i)))}return e}getBinderAttributes(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof We||n instanceof De)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof Ye)for(let i=0;i<Qn.members.length;i++)e.push(Qn.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof or||n instanceof Lt||n instanceof De)for(let i of n.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){let n=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof or||o instanceof Lt||o instanceof De){for(let a of o.uniformNames)if(r[a]){let s=o.getBinding(e,r[a],a);n.push({name:a,property:i,binding:s})}}}return n}setUniforms(e,r,n,i){for(let{name:o,property:a,binding:s}of r)this.binders[a].setUniform(s,i,n.get(a),o)}updatePaintBuffers(e){this._buffers=[];for(let r in this.binders){let n=this.binders[r];if(e&&n instanceof Ye){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof We||n instanceof De)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let r in this.binders){let n=this.binders[r];(n instanceof We||n instanceof De||n instanceof Ye)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let r=this.binders[e];(r instanceof We||r instanceof De||r instanceof Ye)&&r.destroy()}}},Ae=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new la(i,r,n);this.needsUpload=!1,this._featureMap=new ei,this._bufferOffset=0}populatePaintArrays(e,r,n,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,r,i,o,a);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,n,i){for(let o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,r,o,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function Mg(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace("".concat(e,"-"),"").replace(/-/g,"_")]}function Lg(t){return{"line-pattern":{source:yt,composite:yt},"fill-pattern":{source:yt,composite:yt},"fill-extrusion-pattern":{source:yt,composite:yt}}[t]}function hp(t,e,r){let n={color:{source:Et,composite:Er},number:{source:ir,composite:Et}},i=Lg(t);return i&&i[r]||n[e][r]}I("ConstantBinder",or);I("CrossFadedConstantBinder",Lt);I("SourceExpressionBinder",We);I("CrossFadedCompositeBinder",Ye);I("CompositeExpressionBinder",De);I("ProgramConfiguration",la,{omit:["_buffers"]});I("ProgramConfigurationSet",Ae);var Dg=15,sl=Math.pow(2,Dg-1)-1,dp=-sl-1;function _e(t){let e=8192/t.extent,r=t.loadGeometry();for(let n=0;n<r.length;n++){let i=r[n];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=it(s,dp,sl),a.y=it(l,dp,sl),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ne(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?_e(t):[]}}var gp=-32768;function Bg(t,e,r,n,i){t.emplaceBack(gp+e*8+n,gp+r*8+i)}var ar=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Zo,this.indexArray=new Le,this.segments=new pe,this.programConfigurations=new Ae(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){let i=this.layers[0],o=[],a=null,s=!1,l=i.type==="heatmap";if(i.type==="circle"){let c=i;a=c.layout.get("circle-sort-key"),s=!a.isConstant(),l=l||c.paint.get("circle-pitch-alignment")==="map"}let u=l?r.subdivisionGranularity.circle:1;for(let{feature:c,id:p,index:f,sourceLayerIndex:y}of e){let m=this.layers[0]._featureFilter.needGeometry,h=Ne(c,m);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),h,n))continue;let g=s?a.evaluate(h,{},n):void 0,d={id:p,properties:c.properties,type:c.type,sourceLayerIndex:y,index:f,geometry:m?h.geometry:_e(c),patterns:{},sortKey:g};o.push(d)}s&&o.sort((c,p)=>c.sortKey-p.sortKey);for(let c of o){let{geometry:p,index:f,sourceLayerIndex:y}=c,m=e[f].feature;this.addFeature(c,p,f,n,u),r.featureIndex.insert(m,p,f,y,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,up),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,n,i,o=1){let a;switch(o){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw new Error("Invalid circle bucket granularity: ".concat(o,"; valid values are 1, 3, 5, 7."))}let s=a.length;for(let l of r)for(let u of l){let c=u.x,p=u.y;if(c<0||c>=8192||p<0||p>=8192)continue;let f=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),y=f.vertexLength;for(let m=0;m<s;m++)for(let h=0;h<s;h++)Bg(this.layoutVertexArray,c,p,a[h],a[m]);for(let m=0;m<s-1;m++)for(let h=0;h<s-1;h++){let g=y+m*s+h,d=y+(m+1)*s+h;this.indexArray.emplaceBack(g,d+1,g+1),this.indexArray.emplaceBack(g,d,d+1)}f.vertexLength+=s*s,f.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};I("CircleBucket",ar,{omit:["layers"]});var ri=Y(ye(),1);function bp(t,e){for(let r=0;r<t.length;r++)if(Lr(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Lr(t,e[r]))return!0;return!!ul(t,e)}function vp(t,e,r){return!!(Lr(t,e)||ll(e,t,r))}function ua(t,e){if(t.length===1)return xp(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(Lr(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(xp(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(ul(t,e[r]))return!0;return!1}function Pp(t,e,r){for(let n=0;n<e.length;n++){let i=e[n];if(t.length>=3){for(let o=0;o<i.length;o++)if(Lr(t,i[o]))return!0}if(Vg(t,i,r))return!0}return!1}function Vg(t,e,r){if(t.length>1){if(ul(t,e))return!0;for(let n=0;n<e.length;n++)if(ll(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(ll(t[n],e,r))return!0;return!1}function ul(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1];for(let o=0;o<e.length-1;o++){let a=e[o],s=e[o+1];if(Rg(n,i,a,s))return!0}}return!1}function Rg(t,e,r,n){return ot(t,r,n)!==ot(e,r,n)&&ot(t,e,r)!==ot(t,e,n)}function ll(t,e,r){let n=r*r;if(e.length===1)return t.distSqr(e[0])<n;for(let i=1;i<e.length;i++){let o=e[i-1],a=e[i];if(cl(t,o,a)<n)return!0}return!1}function cl(t,e,r){let n=e.distSqr(r);if(n===0)return t.distSqr(e);let i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return i<0?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function xp(t,e){let r=!1,n,i,o;for(let a=0;a<t.length;a++){n=t[a];for(let s=0,l=n.length-1;s<n.length;l=s++)i=n[s],o=n[l],i.y>e.y!=o.y>e.y&&e.x<(o.x-i.x)*(e.y-i.y)/(o.y-i.y)+i.x&&(r=!r)}return r}function Lr(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){let o=t[n],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function Sp(t,e,r,n,i){for(let a of t)if(e<=a.x&&r<=a.y&&n>=a.x&&i>=a.y)return!0;let o=[new ri.default(e,r),new ri.default(e,i),new ri.default(n,i),new ri.default(n,r)];if(t.length>2){for(let a of o)if(Lr(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(zg(s,l,o))return!0}return!1}function zg(t,e,r){let 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;let o=ot(t,e,r[0]);return o!==ot(t,e,r[1])||o!==ot(t,e,r[2])||o!==ot(t,e,r[3])}var ca=Y(ye(),1);function sr(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Dt(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Bt(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=ca.default.convert(e)._mult(i);r==="viewport"&&o._rotate(-n);let a=[];for(let s=0;s<t.length;s++){let l=t[s];a.push(l.sub(o))}return a}function wp(t,e){let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],u=i[a+1],c=a===0?new ca.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new ca.default(0,0):u.sub(l)._unit()._perp(),f=c._add(p)._unit(),y=f.x*p.x+f.y*p.y;y!==0&&f._mult(1/y),o.push(f._mult(e)._add(l))}r.push(o)}return r}var Ap,Og=()=>Ap=Ap||new ee({"circle-sort-key":new L(P.layout_circle["circle-sort-key"])}),_p,Gg=()=>_p=_p||new ee({"circle-radius":new L(P.paint_circle["circle-radius"]),"circle-color":new L(P.paint_circle["circle-color"]),"circle-blur":new L(P.paint_circle["circle-blur"]),"circle-opacity":new L(P.paint_circle["circle-opacity"]),"circle-translate":new F(P.paint_circle["circle-translate"]),"circle-translate-anchor":new F(P.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new F(P.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new F(P.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new L(P.paint_circle["circle-stroke-width"]),"circle-stroke-color":new L(P.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new L(P.paint_circle["circle-stroke-opacity"])}),Ip={get paint(){return Gg()},get layout(){return Og()}};var Tp=Y(ye(),1);var pa=class extends oe{constructor(e){super(e,Ip)}createBucket(e){return new ar(e)}queryRadius(e){let r=e;return sr("circle-radius",this,r)+sr("circle-stroke-width",this,r)+Dt(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:l}){let u=Bt(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-o.bearingInRadians,a),c=this.paint.get("circle-radius").evaluate(r,n),p=this.paint.get("circle-stroke-width").evaluate(r,n),f=c+p,y=this.paint.get("circle-pitch-alignment")==="map",m=y?u:Ng(u,o,s,l),h=y?f*a:f;for(let g of i)for(let d of g){let b=y?d:Cp(d,o,s,l),x=h,v=o.projectTileCoordinates(d.x,d.y,s,l).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?x*=v/o.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(x*=o.cameraToCenterDistance/v),vp(m,b,x))return!0}return!1}};function Cp(t,e,r,n){let i=e.projectTileCoordinates(t.x,t.y,r,n).point;return new Tp.default((i.x*.5+.5)*e.width,(-i.y*.5+.5)*e.height)}function Ng(t,e,r,n){return t.map(i=>Cp(i,e,r,n))}var ni=class extends ar{};I("HeatmapBucket",ni,{omit:["layers"]});var kp,Ug=()=>kp=kp||new ee({"heatmap-radius":new L(P.paint_heatmap["heatmap-radius"]),"heatmap-weight":new L(P.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new F(P.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ft(P.paint_heatmap["heatmap-color"]),"heatmap-opacity":new F(P.paint_heatmap["heatmap-opacity"])}),Fp={get paint(){return Ug()}};function pl(t,{width:e,height:r},n,i){if(!i)i=new Uint8Array(e*r*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError("mismatched image size. expected: ".concat(i.length," but got: ").concat(e*r*n));return t.width=e,t.height=r,t.data=i,t}function Ep(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=pl({},{width:e,height:r},n);fl(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function fl(t,e,r,n,i,o){if(i.width===0||i.height===0)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");let a=t.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let u=((r.y+l)*t.width+r.x)*o,c=((n.y+l)*e.width+n.x)*o;for(let p=0;p<i.width*o;p++)s[c+p]=a[u+p]}return e}var lr=class t{constructor(e,r){pl(this,e,1,r)}resize(e){Ep(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){fl(e,r,n,i,o,1)}},fe=class t{constructor(e,r){pl(this,e,4,r)}resize(e){Ep(this,e,4)}replace(e,r){r?this.data.set(e):e instanceof Uint8ClampedArray?this.data=new Uint8Array(e.buffer):this.data=e}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){fl(e,r,n,i,o,4)}setPixel(e,r,n){let i=(e*this.width+r)*4;this.data[i+0]=Math.round(n.r*255/n.a),this.data[i+1]=Math.round(n.g*255/n.a),this.data[i+2]=Math.round(n.b*255/n.a),this.data[i+3]=Math.round(n.a*255)}};I("AlphaImage",lr);I("RGBAImage",fe);function Mp(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new fe({width:r,height:n});if(!ku(r))throw new Error("width is not a power of 2 - ".concat(r));let o=(a,s,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);i.setPixel(a/4/r,s/4,u)};if(t.clips)for(let a=0,s=0;a<n;++a,s+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let c=l/(r-1),{start:p,end:f}=t.clips[a],y=p*(1-c)+f*c;o(s,u,y)}else for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1);o(0,s,l)}return i}var Lp="big-fb";var fa=class extends oe{createBucket(e){return new ni(e)}constructor(e){super(e,Fp),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Mp({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Lp)&&this.heatmapFbos.delete(Lp)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var Dp,$g=()=>Dp=Dp||new ee({"hillshade-illumination-direction":new F(P.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new F(P.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new F(P.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new F(P.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new F(P.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new F(P.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new F(P.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new F(P.paint_hillshade["hillshade-method"])}),Bp={get paint(){return $g()}};var ya=class extends oe{constructor(e){super(e,Bp),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,n=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,o=Math.max(e.length,r.length,n.length,i.length);e=e.concat(Array(o-e.length).fill(e.at(-1))),r=r.concat(Array(o-r.length).fill(r.at(-1))),n=n.concat(Array(o-n.length).fill(n.at(-1))),i=i.concat(Array(o-i.length).fill(i.at(-1)));let a=r.map(fs);return{directionRadians:e.map(fs),altitudeRadians:a,shadowColor:i,highlightColor:n}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Vp,jg=()=>Vp=Vp||new ee({"color-relief-opacity":new F(P["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new ft(P["paint_color-relief"]["color-relief-color"])}),Rp={get paint(){return jg()}};var ii=class{constructor(e,r,n,i){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(r,i)}update(e,r,n){let{width:i,height:o}=e,a=(!this.size||this.size[0]!==i||this.size[1]!==o)&&!n,{context:s}=this,{gl:l}=s;if(this.useMipmap=!!(r&&r.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!r||r.premultiply!==!1)),a)this.size=[i,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||vt(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,i,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{let{x:u,y:c}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||vt(e)?l.texSubImage2D(l.TEXTURE_2D,0,u,c,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,u,c,i,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,r,n){let{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_2D,this.texture),n===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(n=o.LINEAR),e!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,n||e),this.filter=e),r!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,r),this.wrap=r)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}};var oi=class{constructor(e,r,n,i=1,o=1,a=1,s=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n)){ce(\'"\'.concat(n,\'" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".\'));return}this.stride=r.height;let l=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;case"mapbox":default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let c=0;c<l;c++){let p=this.get(u,c);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(e,r){let n=new Uint8Array(this.data.buffer),i=this._idx(e,r)*4;return this.unpack(n[i],n[i+1],n[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,n){return e*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}pack(e){return yl(e,this.getUnpackVector())}getPixels(){return new fe({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=r*this.dim,o=r*this.dim+this.dim,a=n*this.dim,s=n*this.dim+this.dim;switch(r){case-1:i=o-1;break;case 1:o=i+1;break}switch(n){case-1:a=s-1;break;case 1:s=a+1;break}let l=-r*this.dim,u=-n*this.dim;for(let c=a;c<s;c++)for(let p=i;p<o;p++)this.data[this._idx(p,c)]=e.data[this._idx(p+l,c+u)]}};function yl(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],a=Math.min(r,n,i),s=Math.round((t+o)/a);return{r:Math.floor(s*a/r)%256,g:Math.floor(s*a/n)%256,b:Math.floor(s*a/i)%256}}I("DEMData",oi);var ma=class extends oe{constructor(e){super(e,Rp)}_createColorRamp(e){let r={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values["color-relief-color"].value.expression;if(n instanceof Je&&n._styleExpression.expression instanceof ke){this.colorRampExpression=n;let a=n._styleExpression.expression;r.elevationStops=a.labels,r.colorStops=[];for(let s of r.elevationStops)r.colorStops.push(a.evaluate({globals:{elevation:s}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[H.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=e)return r;let i={elevationStops:[],colorStops:[]},o=(r.elevationStops.length-1)/(e-1);for(let a=0;a<r.elevationStops.length-.5;a+=o)i.elevationStops.push(r.elevationStops[Math.round(a)]),i.colorStops.push(r.colorStops[Math.round(a)]);return ce("Too many colors in specification of ".concat(this.id," color-relief layer, may not render properly.")),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,r,n){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(r),o=new fe({width:i.colorStops.length,height:1}),a=new fe({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let l=yl(i.elevationStops[s],n);a.setPixel(0,s,new H(l.r/255,l.g/255,l.b/255,1)),o.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new ii(e,a,e.gl.RGBA),colorTexture:new ii(e,o,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}};var qg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:zp,size:Y1,alignment:K1}=qg;function Dr(t,e,r){let n=r.patternDependencies,i=!1;for(let o of e){let a=o.paint.get("".concat(t,"-pattern"));a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Br(t,e,r,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get("".concat(t,"-pattern")).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},r,{},i.availableImages),c=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,r.patterns[a.id]={min:u,mid:c,max:p}}}return r}var pi=Y(ye(),1);function dl(t,e,r=2){let n=e&&e.length,i=n?e[0]*r:t.length,o=Gp(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;let s,l,u;if(n&&(o=Jg(t,e,o,r)),t.length>80*r){s=1/0,l=1/0;let c=-1/0,p=-1/0;for(let f=r;f<i;f+=r){let y=t[f],m=t[f+1];y<s&&(s=y),m<l&&(l=m),y>c&&(c=y),m>p&&(p=m)}u=Math.max(c-s,p-l),u=u!==0?32767/u:0}return si(o,a,r,s,l,u,0),a}function Gp(t,e,r,n,i){let o;if(i===sx(t,e,r,n)>0)for(let a=e;a<r;a+=n)o=Op(a/n|0,t[a],t[a+1],o);else for(let a=r-n;a>=e;a-=n)o=Op(a/n|0,t[a],t[a+1],o);return o&&Vr(o,o.next)&&(ui(o),o=o.next),o}function ur(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(Vr(r,r.next)||se(r.prev,r,r.next)===0)){if(ui(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function si(t,e,r,n,i,o,a){if(!t)return;!a&&o&&tx(t,n,i,o);let s=t;for(;t.prev!==t.next;){let l=t.prev,u=t.next;if(o?Xg(t,n,i,o):Wg(t)){e.push(l.i,t.i,u.i),ui(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=Hg(ur(t),e),si(t,e,r,n,i,o,2)):a===2&&Zg(t,e,r,n,i,o):si(ur(t),e,r,n,i,o,1);break}}}function Wg(t){let e=t.prev,r=t,n=t.next;if(se(e,r,n)>=0)return!1;let i=e.x,o=r.x,a=n.x,s=e.y,l=r.y,u=n.y,c=Math.min(i,o,a),p=Math.min(s,l,u),f=Math.max(i,o,a),y=Math.max(s,l,u),m=n.next;for(;m!==e;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&ai(i,s,o,l,a,u,m.x,m.y)&&se(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Xg(t,e,r,n){let i=t.prev,o=t,a=t.next;if(se(i,o,a)>=0)return!1;let s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=Math.min(s,l,u),m=Math.min(c,p,f),h=Math.max(s,l,u),g=Math.max(c,p,f),d=ml(y,m,e,r,n),b=ml(h,g,e,r,n),x=t.prevZ,v=t.nextZ;for(;x&&x.z>=d&&v&&v.z<=b;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&ai(s,c,l,p,u,f,x.x,x.y)&&se(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&ai(s,c,l,p,u,f,v.x,v.y)&&se(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=d;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&ai(s,c,l,p,u,f,x.x,x.y)&&se(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=b;){if(v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&ai(s,c,l,p,u,f,v.x,v.y)&&se(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Hg(t,e){let r=t;do{let n=r.prev,i=r.next.next;!Vr(n,i)&&Up(n,r,r.next,i)&&li(n,i)&&li(i,n)&&(e.push(n.i,r.i,i.i),ui(r),ui(r.next),r=t=i),r=r.next}while(r!==t);return ur(r)}function Zg(t,e,r,n,i,o){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&ix(a,s)){let l=$p(a,s);a=ur(a,a.next),l=ur(l,l.next),si(a,e,r,n,i,o,0),si(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function Jg(t,e,r,n){let i=[];for(let o=0,a=e.length;o<a;o++){let s=e[o]*n,l=o<a-1?e[o+1]*n:t.length,u=Gp(t,s,l,n,!1);u===u.next&&(u.steiner=!0),i.push(nx(u))}i.sort(Yg);for(let o=0;o<i.length;o++)r=Kg(i[o],r);return r}function Yg(t,e){let r=t.x-e.x;if(r===0&&(r=t.y-e.y,r===0)){let n=(t.next.y-t.y)/(t.next.x-t.x),i=(e.next.y-e.y)/(e.next.x-e.x);r=n-i}return r}function Kg(t,e){let r=Qg(t,e);if(!r)return e;let n=$p(r,t);return ur(n,n.next),ur(r,r.next)}function Qg(t,e){let r=e,n=t.x,i=t.y,o=-1/0,a;if(Vr(t,r))return r;do{if(Vr(t,r.next))return r.next;if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){let p=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(p<=n&&p>o&&(o=p,a=r.x<r.next.x?r:r.next,p===n))return a}r=r.next}while(r!==e);if(!a)return null;let s=a,l=a.x,u=a.y,c=1/0;r=a;do{if(n>=r.x&&r.x>=l&&n!==r.x&&Np(i<u?n:o,i,l,u,i<u?o:n,i,r.x,r.y)){let p=Math.abs(i-r.y)/(n-r.x);li(r,t)&&(p<c||p===c&&(r.x>a.x||r.x===a.x&&ex(a,r)))&&(a=r,c=p)}r=r.next}while(r!==s);return a}function ex(t,e){return se(t.prev,t,e.prev)<0&&se(e.next,t,t.next)<0}function tx(t,e,r,n){let i=t;do i.z===0&&(i.z=ml(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,rx(i)}function rx(t){let e,r=1;do{let n=t,i;t=null;let o=null;for(e=0;n;){e++;let a=n,s=0;for(let u=0;u<r&&(s++,a=a.nextZ,!!a);u++);let l=r;for(;s>0||l>0&&a;)s!==0&&(l===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,s--):(i=a,a=a.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=a}o.nextZ=null,r*=2}while(e>1);return t}function ml(t,e,r,n,i){return t=(t-r)*i|0,e=(e-n)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function nx(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function Np(t,e,r,n,i,o,a,s){return(i-a)*(e-s)>=(t-a)*(o-s)&&(t-a)*(n-s)>=(r-a)*(e-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function ai(t,e,r,n,i,o,a,s){return!(t===a&&e===s)&&Np(t,e,r,n,i,o,a,s)}function ix(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!ox(t,e)&&(li(t,e)&&li(e,t)&&ax(t,e)&&(se(t.prev,t,e.prev)||se(t,e.prev,e))||Vr(t,e)&&se(t.prev,t,t.next)>0&&se(e.prev,e,e.next)>0)}function se(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Vr(t,e){return t.x===e.x&&t.y===e.y}function Up(t,e,r,n){let i=da(se(t,e,r)),o=da(se(t,e,n)),a=da(se(r,n,t)),s=da(se(r,n,e));return!!(i!==o&&a!==s||i===0&&ha(t,r,e)||o===0&&ha(t,n,e)||a===0&&ha(r,t,n)||s===0&&ha(r,e,n))}function ha(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function da(t){return t>0?1:t<0?-1:0}function ox(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Up(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function li(t,e){return se(t.prev,t,t.next)<0?se(t,e,t.next)>=0&&se(t,t.prev,e)>=0:se(t,e,t.prev)<0||se(t,t.next,e)<0}function ax(t,e){let r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==t);return n}function $p(t,e){let r=hl(t.i,t.x,t.y),n=hl(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Op(t,e,r,n){let i=hl(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 ui(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 hl(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function sx(t,e,r,n){let i=0;for(let o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}var Vt=class{constructor(e,r){if(r>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=r}getGranularityForZoomLevel(e){let r=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/r),this._minGranularity,1)}},xa=class xa{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};xa.noSubdivision=new xa({fill:new Vt(0,0),line:new Vt(0,0),tile:new Vt(0,0),stencil:new Vt(0,0),circle:1});var ga=xa;I("SubdivisionGranularityExpression",Vt);I("SubdivisionGranularitySetting",ga);var Rr=-32768,ci=32767,gl=class{constructor(e,r){this._vertexBuffer=[];this._vertexDictionary=new Map;this._used=!1;this._granularity=e,this._granularityCellSize=8192/e,this._canonical=r}_getKey(e,r){return e=e+32768,r=r+32768,e<<16|r<<0}_vertexToIndex(e,r){if(e<-32768||r<-32768||e>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let n=Math.round(e)|0,i=Math.round(r)|0,o=this._getKey(n,i);if(this._vertexDictionary.has(o))return this._vertexDictionary.get(o);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(o,a),this._vertexBuffer.push(n,i),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return ux(this._vertexBuffer,e);let r=[],n=e.length;for(let i=0;i<n;i+=3){let o=[e[i+0],e[i+1],e[i+2]],a=[this._vertexBuffer[e[i+0]*2+0],this._vertexBuffer[e[i+0]*2+1],this._vertexBuffer[e[i+1]*2+0],this._vertexBuffer[e[i+1]*2+1],this._vertexBuffer[e[i+2]*2+0],this._vertexBuffer[e[i+2]*2+1]],s=1/0,l=1/0,u=-1/0,c=-1/0;for(let h=0;h<3;h++){let g=a[h*2],d=a[h*2+1];s=Math.min(s,g),u=Math.max(u,g),l=Math.min(l,d),c=Math.max(c,d)}if(s===u||l===c)continue;let p=Math.floor(s/this._granularityCellSize),f=Math.ceil(u/this._granularityCellSize),y=Math.floor(l/this._granularityCellSize),m=Math.ceil(c/this._granularityCellSize);if(p===f&&y===m){r.push(...o);continue}for(let h=y;h<m;h++){let g=this._scanlineGenerateVertexRingForCellRow(h,a,o);cx(this._vertexBuffer,g,r)}}return r}_scanlineGenerateVertexRingForCellRow(e,r,n){let i=e*this._granularityCellSize,o=i+this._granularityCellSize,a=[];for(let s=0;s<3;s++){let l=r[s*2],u=r[s*2+1],c=r[(s+1)*2%6],p=r[((s+1)*2+1)%6],f=r[(s+2)*2%6],y=r[((s+2)*2+1)%6],m=c-l,h=p-u,g=m===0,d=h===0,b=(i-u)/h,x=(o-u)/h,v=Math.min(b,x),S=Math.max(b,x);if(!d&&(v>=1||S<=0)||d&&(u<i||u>o)){p>=i&&p<=o&&a.push(n[(s+1)%3]);continue}if(!d&&v>0){let T=l+m*v,E=u+h*v;a.push(this._vertexToIndex(T,E))}let A=l+m*Math.max(v,0),w=l+m*Math.min(S,1);if(g||this._generateIntraEdgeVertices(a,l,u,c,p,A,w),!d&&S<1){let T=l+m*S,E=u+h*S;a.push(this._vertexToIndex(T,E))}(d||p>=i&&p<=o)&&a.push(n[(s+1)%3]),!d&&(p<=i||p>=o)&&this._generateInterEdgeVertices(a,l,u,c,p,f,y,w,i,o)}return a}_generateIntraEdgeVertices(e,r,n,i,o,a,s){let l=i-r,u=o-n,c=u===0,p=c?Math.min(r,i):Math.min(a,s),f=c?Math.max(r,i):Math.max(a,s),y=Math.floor(p/this._granularityCellSize)+1,m=Math.ceil(f/this._granularityCellSize)-1;if(c?r<i:a<s)for(let g=y;g<=m;g++){let d=g*this._granularityCellSize,b=n+u*(d-r)/l;e.push(this._vertexToIndex(d,b))}else for(let g=m;g>=y;g--){let d=g*this._granularityCellSize,b=n+u*(d-r)/l;e.push(this._vertexToIndex(d,b))}}_generateInterEdgeVertices(e,r,n,i,o,a,s,l,u,c){let p=o-n,f=a-i,y=s-o,m=(u-o)/y,h=(c-o)/y,g=Math.min(m,h),d=Math.max(m,h),b=i+f*g,x=Math.floor(Math.min(b,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(b,l)/this._granularityCellSize)-1,S=l<b,A=y===0;if(A&&(s===u||s===c))return;if(A||g>=1||d<=0){let T=r-a,E=n-s,D=(u-s)/E,B=(c-s)/E,z=Math.min(D,B),M=a+T*z;x=Math.floor(Math.min(M,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(M,l)/this._granularityCellSize)-1,S=l<M}let w=p>0?c:u;if(S)for(let T=x;T<=v;T++){let E=T*this._granularityCellSize;e.push(this._vertexToIndex(E,w))}else for(let T=v;T>=x;T--){let E=T*this._granularityCellSize;e.push(this._vertexToIndex(E,w))}}_generateOutline(e){let r=[];for(let n of e){let i=Ke(n,this._granularity,!0),o=this._pointArrayToIndices(i),a=[];for(let s=1;s<o.length;s++)a.push(o[s-1]),a.push(o[s]);r.push(a)}return r}_handlePoles(e){let r=!1,n=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(r||n)&&this._fillPoles(e,r,n)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let r=0;r<e.length;r+=2){let n=e[r+1];n===Rr&&(e[r+1]=Rr+1),n===ci&&(e[r+1]=ci-1)}}_generatePoleQuad(e,r,n,i,o,a){i>o!=(a===Rr)?(e.push(r),e.push(n),e.push(this._vertexToIndex(i,a)),e.push(n),e.push(this._vertexToIndex(o,a)),e.push(this._vertexToIndex(i,a))):(e.push(n),e.push(r),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(o,a)),e.push(n),e.push(this._vertexToIndex(i,a)))}_fillPoles(e,r,n){let i=this._vertexBuffer,o=0,a=8192,s=e.length;for(let l=2;l<s;l+=3){let u=e[l-2],c=e[l-1],p=e[l],f=i[u*2],y=i[u*2+1],m=i[c*2],h=i[c*2+1],g=i[p*2],d=i[p*2+1];r&&(y===o&&h===o&&this._generatePoleQuad(e,u,c,f,m,Rr),h===o&&d===o&&this._generatePoleQuad(e,c,p,m,g,Rr),d===o&&y===o&&this._generatePoleQuad(e,p,u,g,f,Rr)),n&&(y===a&&h===a&&this._generatePoleQuad(e,u,c,f,m,ci),h===a&&d===a&&this._generatePoleQuad(e,c,p,m,g,ci),d===a&&y===a&&this._generatePoleQuad(e,p,u,g,f,ci))}}_initializeVertices(e){for(let r=0;r<e.length;r+=2)this._vertexToIndex(e[r],e[r+1])}subdividePolygonInternal(e,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:n,holeIndices:i}=lx(e);this._initializeVertices(n);let o;try{let s=dl(n,i),l=this._convertIndices(n,s);o=this._subdivideTrianglesScanline(l)}catch(s){console.error(s)}let a=[];return r&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(o),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:a}}_convertIndices(e,r){let n=[];for(let i=0;i<r.length;i++){let o=e[r[i]*2],a=e[r[i]*2+1];n.push(this._vertexToIndex(o,a))}return n}_pointArrayToIndices(e){let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(this._vertexToIndex(i.x,i.y))}return r}};function ba(t,e,r,n=!0){return new gl(r,e).subdividePolygonInternal(t,n)}function Ke(t,e,r=!1){if(!t||t.length<1)return[];if(t.length<2)return[];let n=t[0],i=t[t.length-1],o=r&&(n.x!==i.x||n.y!==i.y);if(e<2)return o?[...t,t[0]]:[...t];let a=Math.floor(8192/e),s=[];s.push(new pi.default(t[0].x,t[0].y));let l=t.length,u=o?l:l-1;for(let c=0;c<u;c++){let p=t[c],f=c<l-1?t[c+1]:t[0],y=p.x,m=p.y,h=f.x,g=f.y,d=y!==h,b=m!==g;if(!d&&!b)continue;let x=h-y,v=g-m,S=Math.abs(x),A=Math.abs(v),w=y,T=m;for(;;){let D=x>0?(Math.floor(w/a)+1)*a:(Math.ceil(w/a)-1)*a,B=v>0?(Math.floor(T/a)+1)*a:(Math.ceil(T/a)-1)*a,z=Math.abs(w-D),M=Math.abs(T-B),_=Math.abs(w-h),V=Math.abs(T-g),G=d?z/S:Number.POSITIVE_INFINITY,O=b?M/A:Number.POSITIVE_INFINITY;if((_<=z||!d)&&(V<=M||!b))break;if(G<O&&d||!b){w=D,T=T+v*G;let R=new pi.default(w,Math.round(T));(s[s.length-1].x!==R.x||s[s.length-1].y!==R.y)&&s.push(R)}else{w=w+x*O,T=B;let R=new pi.default(Math.round(w),T);(s[s.length-1].x!==R.x||s[s.length-1].y!==R.y)&&s.push(R)}}let E=new pi.default(h,g);(s[s.length-1].x!==E.x||s[s.length-1].y!==E.y)&&s.push(E)}return s}function lx(t){let e=[],r=[];for(let n of t)if(n.length!==0){n!==t[0]&&e.push(r.length/2);for(let i=0;i<n.length;i++)r.push(n[i].x),r.push(n[i].y)}return{flattened:r,holeIndices:e}}function ux(t,e){let r=[];for(let n=0;n<e.length;n+=3){let i=e[n],o=e[n+1],a=e[n+2],s=t[i*2],l=t[i*2+1],u=t[o*2],c=t[o*2+1],p=t[a*2],f=t[a*2+1],y=u-s,m=c-l,h=p-s,g=f-l;y*g-m*h>0?(r.push(i),r.push(a),r.push(o)):(r.push(i),r.push(o),r.push(a))}return r}function cx(t,e,r){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let n=0,i=t[e[0]*2];for(let l=1;l<e.length;l++){let u=t[e[l]*2];u<i&&(i=u,n=l)}let o=e.length,a=n,s=(a+1)%o;for(;;){let l=a-1>=0?a-1:o-1,u=(s+1)%o,c=t[e[l]*2],p=t[e[l]*2+1],f=t[e[u]*2],y=t[e[u]*2+1],m=t[e[a]*2],h=t[e[a]*2+1],g=t[e[s]*2],d=t[e[s]*2+1],b=!1;if(c<f)b=!0;else if(c>f)b=!1;else{let x=g-m,S=d-h,A=-x,w=h<d?1:-1,T=((c-m)*S+(p-h)*A)*w,E=((f-m)*S+(y-h)*A)*w;T>E&&(b=!0)}if(b){let x=e[l],v=e[a],S=e[s];x!==v&&x!==S&&v!==S&&r.push(S,v,x),a--,a<0&&(a=o-1)}else{let x=e[u],v=e[a],S=e[s];x!==v&&x!==S&&v!==S&&r.push(S,v,x),s++,s>=o&&(s=0)}if(l===u)break}}function va(t,e,r,n,i,o,a,s,l){let u=i.length/2,c=a&&s&&l;if(u<pe.MAX_VERTEX_ARRAY_LENGTH){let p=e.prepareSegment(u,r,n),f=p.vertexLength;for(let h=0;h<o.length;h+=3)n.emplaceBack(f+o[h],f+o[h+1],f+o[h+2]);p.vertexLength+=u,p.primitiveLength+=o.length/3;let y,m;c&&(m=a.prepareSegment(u,r,s),y=m.vertexLength,m.vertexLength+=u);for(let h=0;h<i.length;h+=2)t(i[h],i[h+1]);if(c)for(let h=0;h<l.length;h++){let g=l[h];for(let d=1;d<g.length;d+=2)s.emplaceBack(y+g[d-1],y+g[d]);m.primitiveLength+=g.length/2}}else px(e,r,n,i,o,t),c&&fx(a,r,s,i,l,t),e.forceNewSegmentOnNextPrepare(),a==null||a.forceNewSegmentOnNextPrepare()}function fi(t,e,r,n,i,o,a){if(o){let s=n.count;return r(e[i*2],e[i*2+1]),t[i]=n.count,n.count++,a.vertexLength++,s}else return t[i]}function px(t,e,r,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(let p=2;p<i.length;p+=3){let f=i[p-2],y=i[p-1],m=i[p],h=a[f]<l,g=a[y]<l,d=a[m]<l,b=(h?1:0)+(g?1:0)+(d?1:0);u.vertexLength+b>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,h=!0,g=!0,d=!0,c=0);let x=fi(a,n,o,s,f,h,u),v=fi(a,n,o,s,y,g,u),S=fi(a,n,o,s,m,d,u);r.emplaceBack(c+x-l,c+v-l,c+S-l),u.primitiveLength++}}function fx(t,e,r,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(let p=0;p<i.length;p++){let f=i[p];for(let y=1;y<i[p].length;y+=2){let m=f[y-1],h=f[y],g=a[m]<l,d=a[h]<l,b=(g?1:0)+(d?1:0);u.vertexLength+b>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,g=!0,d=!0,c=0);let x=fi(a,n,o,s,m,g,u),v=fi(a,n,o,s,h,d,u);r.emplaceBack(c+x-l,c+v-l),u.primitiveLength++}}}var yx=500,cr=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Jo,this.indexArray=new Le,this.indexArray2=new Mt,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.segments2=new pe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Dr("fill",this.layers,r);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),f,n))continue;let y=o?i.evaluate(f,{},n,r.availableImages):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:_e(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Br("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{},r.subdivisionGranularity);let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,zp),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,n,i,o,a){for(let s of Kt(r,yx)){let l=ba(s,i,a.fill.getGranularityForZoomLevel(i.z)),u=this.layoutVertexArray;va((c,p)=>{u.emplaceBack(c,p)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles,this.segments2,this.indexArray2,l.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};I("FillBucket",cr,{omit:["layers","patternFeatures"]});var jp,mx=()=>jp=jp||new ee({"fill-sort-key":new L(P.layout_fill["fill-sort-key"])}),qp,hx=()=>qp=qp||new ee({"fill-antialias":new F(P.paint_fill["fill-antialias"]),"fill-opacity":new L(P.paint_fill["fill-opacity"]),"fill-color":new L(P.paint_fill["fill-color"]),"fill-outline-color":new L(P.paint_fill["fill-outline-color"]),"fill-translate":new F(P.paint_fill["fill-translate"]),"fill-translate-anchor":new F(P.paint_fill["fill-translate-anchor"]),"fill-pattern":new pt(P.paint_fill["fill-pattern"])}),Wp={get paint(){return hx()},get layout(){return mx()}};var Pa=class extends oe{constructor(e){super(e,Wp)}recalculate(e,r){super.recalculate(e,r);let n=this.paint._values["fill-outline-color"];n.value.kind==="constant"&&n.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new cr(e)}queryRadius(){return Dt(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:r,transform:n,pixelsToTileUnits:i}){let o=Bt(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-n.bearingInRadians,i);return ua(o,r)}isTileClipped(){return!0}};var dx=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Xp=Q([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:Hp,size:zS,alignment:OS}=dx;var tf=Y(Rt(),1);var Cx=tf.default.VectorTileFeature.types,kx=500,vl=Math.pow(2,13);function yi(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*vl)*2+a,i*vl*2,o*vl*2,Math.round(s))}var pr=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Yo,this.centroidVertexArray=new Ho,this.indexArray=new Le,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=Dr("fill-extrusion",this.layers,r);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of e){let l=this.layers[0]._featureFilter.needGeometry,u=Ne(i,l);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:_e(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Br("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{},r.subdivisionGranularity),r.featureIndex.insert(i,c.geometry,a,s,this.index,!0)}}addFeatures(e,r,n){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,r,n,e.subdivisionGranularity)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Hp),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Xp.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,n,i,o,a){for(let s of Kt(r,kx)){let l={x:0,y:0,sampleCount:0},u=this.layoutVertexArray.length;this.processPolygon(l,i,e,s,a);let c=this.layoutVertexArray.length-u,p=Math.floor(l.x/l.sampleCount),f=Math.floor(l.y/l.sampleCount);for(let y=0;y<c;y++)this.centroidVertexArray.emplaceBack(p,f)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}processPolygon(e,r,n,i,o){if(i.length<1||ef(i[0]))return;for(let p of i)p.length!==0&&Fx(e,p);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=o.fill.getGranularityForZoomLevel(r.z),l=Cx[n.type]==="Polygon";for(let p of i){if(p.length===0||ef(p))continue;let f=Ke(p,s,l);this._generateSideFaces(f,a)}if(!l)return;let u=ba(i,r,s,!1),c=this.layoutVertexArray;va((p,f)=>{yi(c,p,f,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,u.verticesFlattened,u.indicesTriangles)}_generateSideFaces(e,r){let n=0;for(let i=1;i<e.length;i++){let o=e[i],a=e[i-1];if(Ex(o,a))continue;r.segment.vertexLength+4>pe.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=o.sub(a)._perp()._unit(),l=a.dist(o);n+l>32768&&(n=0),yi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,n),yi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,n),n+=l,yi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,n),yi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,n);let u=r.segment.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}};function Fx(t,e){for(let r=0;r<e.length;r++){let n=e[r];r===e.length-1&&e[0].x===n.x&&e[0].y===n.y||(t.x+=n.x,t.y+=n.y,t.sampleCount++)}}I("FillExtrusionBucket",pr,{omit:["layers","features"]});function Ex(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function ef(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var rf,Mx=()=>rf=rf||new ee({"fill-extrusion-opacity":new F(P["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new L(P["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new F(P["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new F(P["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new pt(P["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new L(P["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new L(P["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new F(P["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),nf={get paint(){return Mx()}};var wa=Y(ye(),1);var Aa=class extends oe{constructor(e){super(e,nf)}createBucket(e){return new pr(e)}queryRadius(){return Dt(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){let l=Bt(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),u=this.paint.get("fill-extrusion-height").evaluate(r,n),c=this.paint.get("fill-extrusion-base").evaluate(r,n),p=Bx(l,s,0),f=Dx(i,c,u,s),y=f[0],m=f[1];return Lx(y,m,p)}};function mi(t,e){return t.x*e.x+t.y*e.y}function of(t,e){if(t.length===1){let r=0,n=e[r++],i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){let o=e[r],a=t[0],s=i.sub(n),l=o.sub(n),u=a.sub(n),c=mi(s,s),p=mi(s,l),f=mi(l,l),y=mi(u,s),m=mi(u,l),h=c*f-p*p,g=(f*y-p*m)/h,d=(c*m-p*y)/h,b=1-g-d,x=n.z*b+i.z*g+o.z*d;if(isFinite(x))return x}return 1/0}else{let r=1/0;for(let n of e)r=Math.min(r,n.z);return r}}function Lx(t,e,r){let n=1/0;ua(r,e)&&(n=of(r,e[0]));for(let i=0;i<e.length;i++){let o=e[i],a=t[i];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=a[s],p=a[s+1],f=[l,u,p,c,l];bp(r,f)&&(n=Math.min(n,of(r,f)))}}return n===1/0?!1:n}function Dx(t,e,r,n){let i=[],o=[],a=n[8]*e,s=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*r,p=n[9]*r,f=n[10]*r,y=n[11]*r;for(let m of t){let h=[],g=[];for(let d of m){let b=d.x,x=d.y,v=n[0]*b+n[4]*x+n[12],S=n[1]*b+n[5]*x+n[13],A=n[2]*b+n[6]*x+n[14],w=n[3]*b+n[7]*x+n[15],T=v+a,E=S+s,D=A+l,B=w+u,z=v+c,M=S+p,_=A+f,V=w+y,G=new wa.default(T/B,E/B);G.z=D/B,h.push(G);let O=new wa.default(z/V,M/V);O.z=_/V,g.push(O)}i.push(h),o.push(g)}return[i,o]}function Bx(t,e,r){let n=[];for(let i of t){let o=[i.x,i.y,r,1];Zi.transformMat4(o,o,e),n.push(new wa.default(o[0]/o[3],o[1]/o[3]))}return n}var Vx=Q([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:af,size:Pw,alignment:Sw}=Vx;var Rx=Q([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:sf,size:_w,alignment:Iw}=Rx;var cf=Y(Rt(),1);var zx=cf.default.VectorTileFeature.types,lf=63,Ox=Math.cos(75/2*(Math.PI/180)),Gx=15,Nx=20,Ux=15,pf=1/2,uf=Math.pow(2,Ux-1)/pf,fr=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Ko,this.layoutVertexArray2=new Qo,this.indexArray=new Le,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Dr("line",this.layers,r);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),f,n))continue;let y=o?i.evaluate(f,{},n):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:_e(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Br("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{},r.subdivisionGranularity);let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,sf)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,af),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let r=+e.properties.mapbox_clip_start,n=+e.properties.mapbox_clip_end;return{start:r,end:n}}}addFeature(e,r,n,i,o,a){let s=this.layers[0].layout,l=s.get("line-join").evaluate(e,{}),u=s.get("line-cap"),c=s.get("line-miter-limit"),p=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let f of r)this.addLine(f,e,l,u,c,p,i,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}addLine(e,r,n,i,o,a,s,l){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let u=s?l.line.getGranularityForZoomLevel(s.z):1;if(e=Ke(e,u),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<e.length-1;v++)this.totalDistance+=e[v].dist(e[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c=zx[r.type]==="Polygon",p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let f=0;for(;f<p-1&&e[f].equals(e[f+1]);)f++;if(p<(c?3:2))return;n==="bevel"&&(o=1.05);let y=this.overscaling<=16?Gx*8192/(512*this.overscaling):0,m=this.segments.prepareSegment(p*10,this.layoutVertexArray,this.indexArray),h,g,d,b,x;this.e1=this.e2=-1,c&&(h=e[p-2],x=e[f].sub(h)._unit()._perp());for(let v=f;v<p;v++){if(d=v===p-1?c?e[f+1]:void 0:e[v+1],d&&e[v].equals(d))continue;x&&(b=x),h&&(g=h),h=e[v],x=d?d.sub(h)._unit()._perp():b,b=b||x;let S=b.add(x);(S.x!==0||S.y!==0)&&S._unit();let A=b.x*x.x+b.y*x.y,w=S.x*x.x+S.y*x.y,T=w!==0?1/w:1/0,E=2*Math.sqrt(2-2*w),D=w<Ox&&g&&d,B=b.x*x.y-b.y*x.x>0;if(D&&v>f){let _=h.dist(g);if(_>2*y){let V=h.sub(h.sub(g)._mult(y/_)._round());this.updateDistance(g,V),this.addCurrentVertex(V,b,0,0,m),g=V}}let z=g&&d,M=z?n:c?"butt":i;if(z&&M==="round"&&(T<a?M="miter":T<=2&&(M="fakeround")),M==="miter"&&T>o&&(M="bevel"),M==="bevel"&&(T>2&&(M="flipbevel"),T<o&&(M="miter")),g&&this.updateDistance(g,h),M==="miter")S._mult(T),this.addCurrentVertex(h,S,0,0,m);else if(M==="flipbevel"){if(T>100)S=x.mult(-1);else{let _=T*b.add(x).mag()/b.sub(x).mag();S._perp()._mult(_*(B?-1:1))}this.addCurrentVertex(h,S,0,0,m),this.addCurrentVertex(h,S.mult(-1),0,0,m)}else if(M==="bevel"||M==="fakeround"){let _=-Math.sqrt(T*T-1),V=B?_:0,G=B?0:_;if(g&&this.addCurrentVertex(h,b,V,G,m),M==="fakeround"){let O=Math.round(E*180/Math.PI/Nx);for(let R=1;R<O;R++){let K=R/O;if(K!==.5){let re=K-.5,me=1.0904+A*(-3.2452+A*(3.55645-A*1.43519)),Ut=.848013+A*(-1.06021+A*.215638);K=K+K*re*(K-1)*(me*re*re+Ut)}let X=x.sub(b)._mult(K)._add(b)._unit()._mult(B?-1:1);this.addHalfVertex(h,X.x,X.y,!1,B,0,m)}}d&&this.addCurrentVertex(h,x,-V,-G,m)}else if(M==="butt")this.addCurrentVertex(h,S,0,0,m);else if(M==="square"){let _=g?1:-1;this.addCurrentVertex(h,S,_,_,m)}else M==="round"&&(g&&(this.addCurrentVertex(h,b,0,0,m),this.addCurrentVertex(h,b,1,1,m,!0)),d&&(this.addCurrentVertex(h,x,-1,-1,m,!0),this.addCurrentVertex(h,x,0,0,m)));if(D&&v<p-1){let _=h.dist(d);if(_>2*y){let V=h.add(d.sub(h)._mult(y/_)._round());this.updateDistance(h,V),this.addCurrentVertex(V,x,0,0,m),h=V}}}}addCurrentVertex(e,r,n,i,o,a=!1){let s=r.x+r.y*n,l=r.y-r.x*n,u=-r.x+r.y*i,c=-r.y-r.x*i;this.addHalfVertex(e,s,l,a,!1,n,o),this.addHalfVertex(e,u,c,a,!0,-i,o),this.distance>uf/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,n,i,o,a))}addHalfVertex({x:e,y:r},n,i,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(uf-1):this.scaledDistance)*pf;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(lf*n)+128,Math.round(lf*i)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let f=this.scaledDistance-this.lineClips.start,y=this.lineClips.end-this.lineClips.start,m=f/y;this.layoutVertexArray2.emplaceBack(m,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,p,this.e2),l.primitiveLength++),a?this.e2=p:this.e1=p}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}};I("LineBucket",fr,{omit:["layers","patternFeatures"]});var ff,$x=()=>ff=ff||new ee({"line-cap":new F(P.layout_line["line-cap"]),"line-join":new L(P.layout_line["line-join"]),"line-miter-limit":new F(P.layout_line["line-miter-limit"]),"line-round-limit":new F(P.layout_line["line-round-limit"]),"line-sort-key":new L(P.layout_line["line-sort-key"])}),yf,jx=()=>yf=yf||new ee({"line-opacity":new L(P.paint_line["line-opacity"]),"line-color":new L(P.paint_line["line-color"]),"line-translate":new F(P.paint_line["line-translate"]),"line-translate-anchor":new F(P.paint_line["line-translate-anchor"]),"line-width":new L(P.paint_line["line-width"]),"line-gap-width":new L(P.paint_line["line-gap-width"]),"line-offset":new L(P.paint_line["line-offset"]),"line-blur":new L(P.paint_line["line-blur"]),"line-dasharray":new rr(P.paint_line["line-dasharray"]),"line-pattern":new pt(P.paint_line["line-pattern"]),"line-gradient":new ft(P.paint_line["line-gradient"])}),Pl={get paint(){return jx()},get layout(){return $x()}};var Sl=class extends L{possiblyEvaluate(e,r){return r=new W(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,n,i){return r=de({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,i)}},_a;var Ia=class extends oe{constructor(e){super(e,Pl),this.gradientVersion=0,_a||(_a=new Sl(Pl.paint.properties["line-width"].specification),_a.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();gc(r)?this.stepInterpolant=r._styleExpression.expression instanceof Sr:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=_a.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new fr(e)}queryRadius(e){let r=e,n=mf(sr("line-width",this,r),sr("line-gap-width",this,r)),i=sr("line-offset",this,r);return n/2+Math.abs(i)+Dt(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a}){let s=Bt(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*mf(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),u=this.paint.get("line-offset").evaluate(r,n);return u&&(i=wp(i,u*a)),Pp(s,i,l)}isTileClipped(){return!0}};function mf(t,e){return e>0?e+2*t:t}var hf=Q([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),df=Q([{name:"a_projected_pos",components:3,type:"Float32"}],4),iA=Q([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),gf=Q([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),oA=Q([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),wl=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),aA=Q([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),sA=Q([{name:"triangle",components:3,type:"Uint16"}]),lA=Q([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),uA=Q([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),cA=Q([{type:"Float32",name:"offsetX"}]),pA=Q([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),fA=Q([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Pi=Y(ye(),1);function qx(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),we.applyArabicShaping&&(t=we.applyArabicShaping(t)),t}function xf(t,e,r){return t.sections.forEach(n=>{n.text=qx(n.text,e,r)}),t}function bf(t){let e={},r={},n=[],i=0;function o(u){n.push(t[u]),i++}function a(u,c,p){let f=r[u];return delete r[u],r[c]=f,n[f].geometry[0].pop(),n[f].geometry[0]=n[f].geometry[0].concat(p[0]),f}function s(u,c,p){let f=e[c];return delete e[c],e[u]=f,n[f].geometry[0].shift(),n[f].geometry[0]=p[0].concat(n[f].geometry[0]),f}function l(u,c,p){let f=p?c[0][c[0].length-1]:c[0][0];return"".concat(u,":").concat(f.x,":").concat(f.y)}for(let u=0;u<t.length;u++){let c=t[u],p=c.geometry,f=c.text?c.text.toString():null;if(!f){o(u);continue}let y=l(f,p),m=l(f,p,!0);if(y in r&&m in e&&r[y]!==e[m]){let h=s(y,m,p),g=a(y,m,n[h].geometry);delete e[y],delete r[m],r[l(f,n[g].geometry,!0)]=g,n[h].geometry=null}else y in r?a(y,m,p):m in e?s(y,m,p):(o(u),e[y]=i-1,r[m]=i-1)}return n.filter(u=>u.geometry)}var Or={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function vf(t){let e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;(!n||!Qs(n)||Or[t[r+1]])&&(!i||!Qs(i)||Or[t[r-1]])&&Or[t[r]]?e+=Or[t[r]]:e+=t[r]}return e}var ae=24;var ub=Y(hi(),1),cb=3;var ka=cb;function di(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,l)=>l.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],o=0,a=0;for(let s of t)for(let l=i.length-1;l>=0;l--){let u=i[l];if(!(s.w>u.w||s.h>u.h)){if(s.x=u.x,s.y=u.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===u.w&&s.h===u.h){let c=i.pop();l<i.length&&(i[l]=c)}else s.h===u.h?(u.x+=s.w,u.w-=s.w):s.w===u.w?(u.y+=s.h,u.h-=s.h):(i.push({x:u.x+s.w,y:u.y,w:u.w-s.w,h:s.h}),u.y+=s.h,u.h-=s.h);break}}return{w:o,h:a,fill:e/(o*a)||0}}var he=1;var Fa=class{constructor(e,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a,textFitWidth:s,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n,this.textFitWidth=s,this.textFitHeight=l}get tl(){return[this.paddedRect.x+he,this.paddedRect.y+he]}get br(){return[this.paddedRect.x+this.paddedRect.w-he,this.paddedRect.y+this.paddedRect.h-he]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-he*2)/this.pixelRatio,(this.paddedRect.h-he*2)/this.pixelRatio]}},gi=class{constructor(e,r){let n={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,n,o),this.addImages(r,i,o);let{w:a,h:s}=di(o),l=new fe({width:a||1,height:s||1});for(let u in e){let c=e[u],p=n[u].paddedRect;fe.copy(c.data,l,{x:0,y:0},{x:p.x+he,y:p.y+he},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+he,y=p.y+he,m=c.data.width,h=c.data.height;fe.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),fe.copy(c.data,l,{x:0,y:h-1},{x:f,y:y-1},{width:m,height:1}),fe.copy(c.data,l,{x:0,y:0},{x:f,y:y+h},{width:m,height:1}),fe.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:h}),fe.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:h})}this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(e,r,n){for(let i in e){let o=e[i],a={x:0,y:0,w:o.data.width+2*he,h:o.data.height+2*he};n.push(a),r[i]=new Fa(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),r)}patchUpdatedImage(e,r,n){if(!e||!r||e.version===r.version)return;e.version=r.version;let[i,o]=e.tl;n.update(r.data,void 0,{x:i,y:o})}};I("ImagePosition",Fa);I("ImageAtlas",gi);var La=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(La||{}),bi=-17;function pb(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}var Tf=57344,Cf=63743,Ea=class t{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(e,r,n){let i=new t;return i.scale=e||1,i.fontStack=r,i.verticalAlign=n||"bottom",i}static forImage(e,r){let n=new t;return n.imageName=e,n.verticalAlign=r||"bottom",n}},xi=class t{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){let n=new t;for(let i=0;i<e.sections.length;i++){let o=e.sections[i];o.image?n.addImageSection(o):n.addTextSection(o,r)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=vf(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&Ma[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&Ma[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){let n=new t;return n.text=this.text.substring(e,r),n.sectionIndex=this.sectionIndex.slice(e,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,n=0;for(let i=0;i<this.length();i++){let o=this.getSection(i);if(o.imageName){let a=e[o.imageName];if(!a)continue;let s=a.displaySize;r=Math.max(r,s[0]),n=Math.max(n,s[1])}}return{maxImageWidth:r,maxImageHeight:n}}addTextSection(e,r){this.text+=e.text,this.sections.push(Ea.forText(e.scale,e.fontStack||r,e.verticalAlign));let n=this.sections.length-1;for(let i=0;i<e.text.length;++i)this.sectionIndex.push(n)}addImageSection(e){let r=e.image?e.image.name:"";if(r.length===0){ce("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){ce("Reached maximum number of images ".concat(Cf-Tf+2));return}this.text+=String.fromCharCode(n),this.sections.push(Ea.forImage(r,e.verticalAlign)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=Cf?null:++this.imageSectionID:(this.imageSectionID=Tf,this.imageSectionID)}};function fb(t,e){let r=[],n=t.text,i=0;for(let o of e)r.push(t.substring(i,o)),i=o;return i<n.length&&r.push(t.substring(i,n.length)),r}function vi(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=xi.fromFeature(t,i);p===2&&h.verticalizePunctuation();let g,{processBidirectionalText:d,processStyledBidirectionalText:b}=we;if(d&&h.sections.length===1){g=[];let S=d(h.toString(),Il(h,u,o,e,n,y));for(let A of S){let w=new xi;w.text=A,w.sections=h.sections;for(let T=0;T<A.length;T++)w.sectionIndex.push(0);g.push(w)}}else if(b){g=[];let S=b(h.text,h.sectionIndex,Il(h,u,o,e,n,y));for(let A of S){let w=new xi;w.text=A[0],w.sectionIndex=A[1],w.sections=h.sections,g.push(w)}}else g=fb(h,Il(h,u,o,e,n,y));let x=[],v={positionedLines:x,text:h.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return vb(v,e,r,n,g,a,s,l,p,u,f,m),pb(x)?!1:v}var Ma={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},yb={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},mb={40:!0};function Ef(t,e,r,n,i,o){if(e.imageName){let a=n[e.imageName];return a?a.displaySize[0]*e.scale*ae/o+i:0}else{let a=r[e.fontStack],s=a&&a[t];return s?s.metrics.advance*e.scale+i:0}}function hb(t,e,r,n,i,o){let a=0;for(let l=0;l<t.length();l++){let u=t.getSection(l);a+=Ef(t.getCharCode(l),u,n,i,e,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function kf(t,e,r,n){let i=Math.pow(t-e,2);return n?t<e?i/2:i*2:i+Math.abs(r)*r}function db(t,e,r){let n=0;return t===10&&(n-=1e4),r&&(n+=150),(t===40||t===65288)&&(n+=50),(e===41||e===65289)&&(n+=50),n}function Ff(t,e,r,n,i,o){let a=null,s=kf(e,r,i,o);for(let l of n){let u=e-l.x,c=kf(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:t,x:e,priorBreak:a,badness:s}}function Mf(t){return t?Mf(t.priorBreak).concat(t.index):[]}function Il(t,e,r,n,i,o){if(!t)return[];let a=[],s=hb(t,e,r,n,i,o),l=t.text.indexOf("\\u200B")>=0,u=0;for(let c=0;c<t.length();c++){let p=t.getSection(c),f=t.getCharCode(c);if(Ma[f]||(u+=Ef(f,p,n,i,e,o)),c<t.length()-1){let y=rp(f);(yb[f]||y||p.imageName||c!==t.length()-2&&mb[t.getCharCode(c+1)])&&a.push(Ff(c+1,u,s,a,db(f,t.getCharCode(c+1),y&&l),!1))}}return Mf(Ff(t.length(),u,s,a,0,!0))}function Lf(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;break}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0;break}return{horizontalAlign:e,verticalAlign:r}}function gb(t,e,r){let n=e.getMaxScale()*ae,{maxImageWidth:i,maxImageHeight:o}=e.getMaxImageSize(t),a=Math.max(n,o*r);return{verticalLineContentWidth:Math.max(n,i*r),horizontalLineContentHeight:a}}function Df(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function xb(t,e,r,n){if(t&&t.rect)return t;let i=e[r.fontStack],o=i&&i[n];return o?{rect:null,metrics:o.metrics}:null}function bb(t,e,r){return!(t===1||!e&&!Do(r)||e&&(Ma[r]||np(r)))}function vb(t,e,r,n,i,o,a,s,l,u,c,p){let f=0,y=0,m=0,h=0,g=s==="right"?1:s==="left"?0:.5,d=ae/p,b=0;for(let S of i){S.trim();let A=S.getMaxScale(),w={positionedGlyphs:[],lineOffset:0};t.positionedLines[b]=w;let T=w.positionedGlyphs,E=0;if(!S.length()){y+=o,++b;continue}let D=gb(n,S,d);for(let M=0;M<S.length();M++){let _=S.getSection(M),V=S.getSectionIndex(M),G=S.getCharCode(M),O=bb(l,c,G),R;if(_.imageName){if(t.iconsInText=!0,_.scale=_.scale*d,R=Sb(_,O,A,D,n),!R)continue;E=Math.max(E,R.imageOffset)}else if(R=Pb(_,G,O,D,e,r),!R)continue;let{rect:K,metrics:X,baselineOffset:re}=R;if(T.push({glyph:G,imageName:_.imageName,x:f,y:y+re+bi,vertical:O,scale:_.scale,fontStack:_.fontStack,sectionIndex:V,metrics:X,rect:K}),!O)f+=X.advance*_.scale+u;else{t.verticalizable=!0;let me=_.imageName?X.advance:ae;f+=me*_.scale+u}}if(T.length!==0){let M=f-u;m=Math.max(M,m),wb(T,0,T.length-1,g)}f=0;let B=(A-1)*ae;w.lineOffset=Math.max(E,B);let z=o*A+E;y+=z,h=Math.max(z,h),++b}let{horizontalAlign:x,verticalAlign:v}=Lf(a);Ab(t.positionedLines,g,x,v,m,h,o,y,i.length),t.top+=-v*y,t.bottom=t.top+y,t.left+=-x*m,t.right=t.left+m}function Pb(t,e,r,n,i,o){let a=o[t.fontStack],s=a&&a[e],l=xb(s,i,t,e);if(l===null)return null;let u;if(r)u=n.verticalLineContentWidth-t.scale*ae;else{let c=Df(t.verticalAlign);u=(n.horizontalLineContentHeight-t.scale*ae)*c}return{rect:l.rect,metrics:l.metrics,baselineOffset:u}}function Sb(t,e,r,n,i){let o=i[t.imageName];if(!o)return null;let a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:he,top:-ka,advance:e?s[1]:s[0]},u;if(e)u=n.verticalLineContentWidth-s[1]*t.scale;else{let p=Df(t.verticalAlign);u=(n.horizontalLineContentHeight-s[1]*t.scale)*p}let c=(e?s[0]:s[1])*t.scale-ae*r;return{rect:a,metrics:l,baselineOffset:u,imageOffset:c}}function wb(t,e,r,n){if(n===0)return;let i=t[r],o=i.metrics.advance*i.scale,a=(t[r].x+o)*n;for(let s=e;s<=r;s++)t[s].x-=a}function Ab(t,e,r,n,i,o,a,s,l){let u=(e-r)*i,c=0;o!==a?c=-s*n-bi:c=-n*l*a+.5*a;for(let p of t)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function Bf(t,e,r){let{horizontalAlign:n,verticalAlign:i}=Lf(r),o=e[0],a=e[1],s=o-t.displaySize[0]*n,l=s+t.displaySize[0],u=a-t.displaySize[1]*i,c=u+t.displaySize[1];return{image:t,top:u,bottom:c,left:s,right:l}}function Da(t){var c,p;let e=t.left,r=t.top,n=t.right-e,i=t.bottom-r,o=t.image.content[2]-t.image.content[0],a=t.image.content[3]-t.image.content[1],s=(c=t.image.textFitWidth)!=null?c:"stretchOrShrink",l=(p=t.image.textFitHeight)!=null?p:"stretchOrShrink",u=o/a;if(l==="proportional"){if(s==="stretchOnly"&&n/i<u||s==="proportional"){let f=Math.ceil(i*u);e*=f/n,n=f}}else if(s==="proportional"&&l==="stretchOnly"&&u!==0&&n/i>u){let f=Math.ceil(n/u);r*=f/i,i=f}return{x1:e,y1:r,x2:e+n,y2:r+i}}function Tl(t,e,r,n,i,o){let a=t.image,s;if(a.content){let g=a.content,d=a.pixelRatio||1;s=[g[0]/d,g[1]/d,a.displaySize[0]-g[2]/d,a.displaySize[1]-g[3]/d]}let l=e.left*o,u=e.right*o,c,p,f,y;r==="width"||r==="both"?(y=i[0]+l-n[3],p=i[0]+u+n[1]):(y=i[0]+(l+u-a.displaySize[0])/2,p=y+a.displaySize[0]);let m=e.top*o,h=e.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+h+n[2]):(c=i[1]+(m+h-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var Vf=Y(Rt(),1);var Ur=255,zt=128,Qe=Ur*zt;function Cl(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new W(t+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:n,interpolationType:i}=r,o=0;for(;o<n.length&&n[o]<=t;)o++;o=Math.max(0,o-1);let a=o;for(;a<n.length&&n[a]<t+1;)a++;a=Math.min(n.length-1,a);let s=n[o],l=n[a];if(r.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let u=r.evaluate(new W(s)),c=r.evaluate(new W(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function kl(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var _b=Vf.default.VectorTileFeature.types,Ib=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ba(t,e,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(Qe,Math.round(s[0])):0,m=s?Math.min(Qe,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(n*32),Math.round(i*32),o,a,(y<<1)+(l?1:0),m,u*16,c*16,p*256,f*256)}function Rf(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function Tb(t){for(let e of t.sections)if(op(e.text))return!0;return!1}var Si=class{constructor(e){this.layoutVertexArray=new ea,this.indexArray=new Le,this.programConfigurations=e,this.segments=new pe,this.dynamicLayoutVertexArray=new ta,this.opacityVertexArray=new ra,this.hasVisibleVertices=!1,this.placedSymbolArray=new Wn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,df.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Ib,!0),this.opacityVertexBuffer.itemSize=1),(n||i)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};I("SymbolBuffers",Si);var wi=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new pe,this.collisionVertexArray=new na}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,gf.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};I("CollisionBuffers",wi);var Xe=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(l=>l.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cl(this.zoom,n["text-size"]),this.iconSizeData=Cl(this.zoom,n["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=kl(i,"text-overlap","text-allow-overlap")!=="never"||kl(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>La[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new Si(new Ae(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Si(new Ae(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Hn,this.lineVertexArray=new Zn,this.symbolInstances=new Xn,this.textAnchorOffsets=new Jn}calculateGlyphDependencies(e,r,n,i,o){for(let a=0;a<e.length;a++)if(r[e.charCodeAt(a)]=!0,(n||i)&&o){let s=Or[e.charAt(a)];s&&(r[s.charCodeAt(0)]=!0)}}populate(e,r,n){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=(s.value.kind!=="constant"||s.value.value instanceof Fe&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=r.iconDependencies,y=r.glyphDependencies,m=r.availableImages,h=new W(this.zoom,{globalState:this.globalState});for(let{feature:g,id:d,index:b,sourceLayerIndex:x}of e){let v=i._featureFilter.needGeometry,S=Ne(g,v);if(!i._featureFilter.filter(h,S,n))continue;v||(S.geometry=_e(g));let A;if(u){let D=i.getValueAndResolveTokens("text-field",S,n,m),B=Fe.factory(D),z=this.hasRTLText=this.hasRTLText||Tb(B);(!z||we.getRTLTextPluginStatus()==="unavailable"||z&&we.isParsed())&&(A=xf(B,i,S))}let w;if(c){let D=i.getValueAndResolveTokens("icon-image",S,n,m);D instanceof Se?w=D:w=Se.fromString(D)}if(!A&&!w)continue;let T=this.sortFeaturesByKey?p.evaluate(S,{},n):void 0,E={id:d,text:A,icon:w,index:b,sourceLayerIndex:x,geometry:S.geometry,properties:g.properties,type:_b[g.type],sortKey:T};if(this.features.push(E),w&&(f[w.name]=!0),A){let D=a.evaluate(S,{},n).join(","),B=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let z of A.sections)if(z.image)f[z.image.name]=!0;else{let M=Tn(A.toString()),_=z.fontStack||D,V=y[_]=y[_]||{};this.calculateGlyphDependencies(z.text,V,B,this.allowVerticalPlacement,M)}}}o.get("symbol-placement")==="line"&&(this.features=bf(this.features)),this.sortFeaturesByKey&&this.features.sort((g,d)=>g.sortKey-d.sortKey)}update(e,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){let n=this.lineVertexArray.length;if(e.segment!==void 0){let i=e.dist(r[e.segment+1]),o=e.dist(r[e.segment]),a={};for(let s=e.segment+1;s<r.length;s++)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:i},s<r.length-1&&(i+=r[s+1].dist(r[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=r[s-1].dist(r[s]));for(let s=0;s<r.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,r,n,i,o,a,s,l,u,c,p,f){let y=e.indexArray,m=e.layoutVertexArray,h=e.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,d=h.vertexLength,b=this.allowVerticalPlacement&&s===2?Math.PI/2:0,x=a.text&&a.text.sections;for(let v=0;v<r.length;v++){let{tl:S,tr:A,bl:w,br:T,tex:E,pixelOffsetTL:D,pixelOffsetBR:B,minFontScaleX:z,minFontScaleY:M,glyphOffset:_,isSDF:V,sectionIndex:G}=r[v],O=h.vertexLength,R=_[1];Ba(m,l.x,l.y,S.x,R+S.y,E.x,E.y,n,V,D.x,D.y,z,M),Ba(m,l.x,l.y,A.x,R+A.y,E.x+E.w,E.y,n,V,B.x,D.y,z,M),Ba(m,l.x,l.y,w.x,R+w.y,E.x,E.y+E.h,n,V,D.x,B.y,z,M),Ba(m,l.x,l.y,T.x,R+T.y,E.x+E.w,E.y+E.h,n,V,B.x,B.y,z,M),Rf(e.dynamicLayoutVertexArray,l,b),y.emplaceBack(O,O+2,O+1),y.emplaceBack(O+1,O+2,O+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(_[0]),(v===r.length-1||G!==r[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,x&&x[G])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,d,u,c,l.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],s,0,!1,0,p)}_addCollisionDebugVertex(e,r,n,i,o,a){return r.emplaceBack(0,0),e.emplaceBack(n.x,n.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,r,n,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,f=s.anchorX,y=s.anchorY;this._addCollisionDebugVertex(c,p,a,f,y,new Pi.default(e,r)),this._addCollisionDebugVertex(c,p,a,f,y,new Pi.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new Pi.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new Pi.default(e,i)),l.vertexLength+=4;let m=o.indexArray;m.emplaceBack(u,u+1),m.emplaceBack(u+1,u+2),m.emplaceBack(u+2,u+3),m.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(e,r,n,i){for(let o=e;o<r;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,u=a.x2,c=a.y2;this.addCollisionDebugVertices(s,l,u,c,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new wi(Kn,wl.members,Mt),this.iconCollisionBox=new wi(Kn,wl.members,Mt);for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,n,i,o,a,s,l,u){let c={};for(let p=r;p<n;p++){let f=e.get(p);c.textBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.textFeatureIndex=f.featureIndex;break}for(let p=i;p<o;p++){let f=e.get(p);c.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalTextFeatureIndex=f.featureIndex;break}for(let p=a;p<s;p++){let f=e.get(p);c.iconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.iconFeatureIndex=f.featureIndex;break}for(let p=l;p<u;p++){let f=e.get(p);c.verticalIconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalIconFeatureIndex=f.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){let n=e.placedSymbolArray.get(r),i=n.vertexStartIndex+n.numGlyphs*4;for(let o=n.vertexStartIndex;o<i;o+=4)e.indexArray.emplaceBack(o,o+2,o+1),e.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(e),n=Math.cos(e),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(r*l.anchorX+n*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||o[l]-o[s]),a}addToSortKeyRanges(e,r){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};I("SymbolBucket",Xe,{omit:["layers","collisionBoxArray","features","compareText"]});Xe.MAX_GLYPHS=65535;Xe.addDynamicAttributes=Rf;function zf(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>t&&n in t?String(t[n]):"")}var Of,Cb=()=>Of=Of||new ee({"symbol-placement":new F(P.layout_symbol["symbol-placement"]),"symbol-spacing":new F(P.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new F(P.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new L(P.layout_symbol["symbol-sort-key"]),"symbol-z-order":new F(P.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new F(P.layout_symbol["icon-allow-overlap"]),"icon-overlap":new F(P.layout_symbol["icon-overlap"]),"icon-ignore-placement":new F(P.layout_symbol["icon-ignore-placement"]),"icon-optional":new F(P.layout_symbol["icon-optional"]),"icon-rotation-alignment":new F(P.layout_symbol["icon-rotation-alignment"]),"icon-size":new L(P.layout_symbol["icon-size"]),"icon-text-fit":new F(P.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new F(P.layout_symbol["icon-text-fit-padding"]),"icon-image":new L(P.layout_symbol["icon-image"]),"icon-rotate":new L(P.layout_symbol["icon-rotate"]),"icon-padding":new L(P.layout_symbol["icon-padding"]),"icon-keep-upright":new F(P.layout_symbol["icon-keep-upright"]),"icon-offset":new L(P.layout_symbol["icon-offset"]),"icon-anchor":new L(P.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new F(P.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new F(P.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new F(P.layout_symbol["text-rotation-alignment"]),"text-field":new L(P.layout_symbol["text-field"]),"text-font":new L(P.layout_symbol["text-font"]),"text-size":new L(P.layout_symbol["text-size"]),"text-max-width":new L(P.layout_symbol["text-max-width"]),"text-line-height":new F(P.layout_symbol["text-line-height"]),"text-letter-spacing":new L(P.layout_symbol["text-letter-spacing"]),"text-justify":new L(P.layout_symbol["text-justify"]),"text-radial-offset":new L(P.layout_symbol["text-radial-offset"]),"text-variable-anchor":new F(P.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new L(P.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new L(P.layout_symbol["text-anchor"]),"text-max-angle":new F(P.layout_symbol["text-max-angle"]),"text-writing-mode":new F(P.layout_symbol["text-writing-mode"]),"text-rotate":new L(P.layout_symbol["text-rotate"]),"text-padding":new F(P.layout_symbol["text-padding"]),"text-keep-upright":new F(P.layout_symbol["text-keep-upright"]),"text-transform":new L(P.layout_symbol["text-transform"]),"text-offset":new L(P.layout_symbol["text-offset"]),"text-allow-overlap":new F(P.layout_symbol["text-allow-overlap"]),"text-overlap":new F(P.layout_symbol["text-overlap"]),"text-ignore-placement":new F(P.layout_symbol["text-ignore-placement"]),"text-optional":new F(P.layout_symbol["text-optional"])}),Gf,kb=()=>Gf=Gf||new ee({"icon-opacity":new L(P.paint_symbol["icon-opacity"]),"icon-color":new L(P.paint_symbol["icon-color"]),"icon-halo-color":new L(P.paint_symbol["icon-halo-color"]),"icon-halo-width":new L(P.paint_symbol["icon-halo-width"]),"icon-halo-blur":new L(P.paint_symbol["icon-halo-blur"]),"icon-translate":new F(P.paint_symbol["icon-translate"]),"icon-translate-anchor":new F(P.paint_symbol["icon-translate-anchor"]),"text-opacity":new L(P.paint_symbol["text-opacity"]),"text-color":new L(P.paint_symbol["text-color"],{runtimeType:ze,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new L(P.paint_symbol["text-halo-color"]),"text-halo-width":new L(P.paint_symbol["text-halo-width"]),"text-halo-blur":new L(P.paint_symbol["text-halo-blur"]),"text-translate":new F(P.paint_symbol["text-translate"]),"text-translate-anchor":new F(P.paint_symbol["text-translate-anchor"])}),Va={get paint(){return kb()},get layout(){return Cb()}};var Ai=class{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Ar,this.defaultValue=e}evaluate(e){if(e.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let r=this.defaultValue.value;e(r._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};I("FormatSectionOverride",Ai,{omit:["defaultValue"]});var Ra=class t extends oe{constructor(e){super(e,Va)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let i=[];for(let o of n)i.indexOf(o)<0&&i.push(o);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,n,i){let o=this.layout.get(e).evaluate(r,{},n,i),a=this._unevaluatedLayout._values[e];return!a.isDataDriven()&&!An(a.value)&&o?zf(r.properties,o):o}createBucket(e){return new Xe(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Va.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new Ai(r),i=new Zt(n,r.property.specification),o=null;r.value.kind==="constant"||r.value.kind==="source"?o=new Je("source",i):o=new Tt("composite",i,r.value.zoomStops),this.paint._values[e]=new ge(r.property,o,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,n){return!this.layout||r.isDataDriven()||n.isDataDriven()?!1:t.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let n=e.get("text-field"),i=Va.paint.properties[r],o=!1,a=s=>{for(let l of s)if(i.overrides&&i.overrides.hasOverride(l)){o=!0;return}};if(n.value.kind==="constant"&&n.value.value instanceof Fe)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof _t&&ue(u.value)===_r){let c=u.value;a(c.sections)}else u instanceof fn?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};function Nf(t,e,r,n=1){let i=t.get("icon-padding").evaluate(e,{},r),o=i&&i.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}var Uf,Fb=()=>Uf=Uf||new ee({"background-color":new F(P.paint_background["background-color"]),"background-pattern":new rr(P.paint_background["background-pattern"]),"background-opacity":new F(P.paint_background["background-opacity"])}),$f={get paint(){return Fb()}};var za=class extends oe{constructor(e){super(e,$f)}};var jf,Eb=()=>jf=jf||new ee({"raster-opacity":new F(P.paint_raster["raster-opacity"]),"raster-hue-rotate":new F(P.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new F(P.paint_raster["raster-brightness-min"]),"raster-brightness-max":new F(P.paint_raster["raster-brightness-max"]),"raster-saturation":new F(P.paint_raster["raster-saturation"]),"raster-contrast":new F(P.paint_raster["raster-contrast"]),"raster-resampling":new F(P.paint_raster["raster-resampling"]),"raster-fade-duration":new F(P.paint_raster["raster-fade-duration"])}),qf={get paint(){return Eb()}};var Oa=class extends oe{constructor(e){super(e,qf)}};var Ga=class extends oe{constructor(r){super(r,{});this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)};this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)};this.implementation=r}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function Wf(t){if(t.type==="custom")return new Ga(t);switch(t.type){case"background":return new za(t);case"circle":return new pa(t);case"color-relief":return new ma(t);case"fill":return new Pa(t);case"fill-extrusion":return new Aa(t);case"heatmap":return new fa(t);case"hillshade":return new ya(t);case"line":return new Ia(t);case"raster":return new Oa(t);case"symbol":return new Ra(t)}}var Na=class{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(e,r){for(let i of e){this._layerConfigs[i.id]=i;let o=this._layers[i.id]=Wf(i);o._featureFilter=Ct(o.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(let i of r)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];this.familiesBySource={};let n=Pc(Object.values(this._layerConfigs),this.keyCache);for(let i of n){let o=i.map(p=>this._layers[p.id]),a=o[0];if(a.visibility==="none")continue;let s=a.source||"",l=this.familiesBySource[s];l||(l=this.familiesBySource[s]={});let u=a.sourceLayer||"_geojsonTileLayer",c=l[u];c||(c=l[u]=[]),c.push(o)}}};var gy=Y(Rt(),1),xy=Y(hi(),1);var $r=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){let n=e[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(e," can\'t be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[e]}};var Hf=Y(Rt(),1),Zf=Y(hi(),1);var Ua=class{constructor(e,r,n,i,o){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=n,e._y=i,this.properties=e.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let r in this)r==="_geometry"||r==="_vectorTileFeature"||(e[r]=this[r]);return e}};var _i=Y(ye(),1),yr=class t{constructor(){this.minX=1/0;this.maxX=-1/0;this.minY=1/0;this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let r=new t;return r.extend(e(new _i.default(this.minX,this.minY))),r.extend(e(new _i.default(this.maxX,this.minY))),r.extend(e(new _i.default(this.minX,this.maxY))),r.extend(e(new _i.default(this.maxX,this.maxY))),r}static fromPoints(e){let r=new t;for(let n of e)r.extend(n);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}};var Ii=class{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new jt(8192,16,0),this.grid3D=new jt(8192,16,0),this.featureIndexArray=new Yn,this.promoteId=r}insert(e,r,n,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,i,o);let l=a?this.grid3D:this.grid;for(let u=0;u<r.length;u++){let c=r[u],p=[1/0,1/0,-1/0,-1/0];for(let f=0;f<c.length;f++){let y=c[f];p[0]=Math.min(p[0],y.x),p[1]=Math.min(p[1],y.y),p[2]=Math.max(p[2],y.x),p[3]=Math.max(p[3],y.y)}p[0]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Hf.default.VectorTile(new Zf.default(this.rawTileData)).layers,this.sourceLayerCoder=new $r(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,n,i){this.loadVTLayers();let o=e.params,a=8192/e.tileSize/e.scale,s=Ct(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=yr.fromPoints(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=yr.fromPoints(e.cameraQueryGeometry).expandBy(u),y=this.grid3D.query(f.minX,f.minY,f.maxX,f.maxY,(g,d,b,x)=>Sp(e.cameraQueryGeometry,g-u,d-u,b+u,x+u));for(let g of y)p.push(g);p.sort(Mb);let m={},h;for(let g=0;g<p.length;g++){let d=p[g];if(d===h)continue;h=d;let b=this.featureIndexArray.get(d),x=null;this.loadMatchingFeature(m,b.bucketIndex,b.sourceLayerIndex,b.featureIndex,s,o.layers,o.availableImages,r,n,i,(v,S,A)=>(x||(x=_e(v)),S.queryIntersectsFeature({queryGeometry:l,feature:v,featureState:A,geometry:x,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return m}loadMatchingFeature(e,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!f.some(d=>a.has(d)))return;let y=this.sourceLayerCoder.decode(n),h=this.vtLayers[y].feature(i);if(o.needGeometry){let d=Ne(h,!0);if(!o.filter(new W(this.tileID.overscaledZ),d,this.tileID.canonical))return}else if(!o.filter(new W(this.tileID.overscaledZ),h))return;let g=this.getId(h,y);for(let d=0;d<f.length;d++){let b=f[d];if(a&&!a.has(b))continue;let x=l[b];if(!x)continue;let v={};g&&c&&(v=c.getState(x.sourceLayer||"_geojsonTileLayer",g));let S=de({},u[b]);S.paint=Xf(S.paint,x.paint,h,v,s),S.layout=Xf(S.layout,x.layout,h,v,s);let A=!p||p(h,x,v);if(!A)continue;let w=new Ua(h,this.z,this.x,this.y,g);w.layer=S;let T=e[b];T===void 0&&(T=e[b]=[]),T.push({featureIndex:i,feature:w,intersectionZ:A})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=Ct(o);for(let p of e)this.loadMatchingFeature(u,n,i,p,c,a,s,l,r);return u}hasLayer(e){for(let r of this.bucketLayerIDs)for(let n of r)if(e===n)return!0;return!1}getId(e,r){var i;let n=e.id;if(this.promoteId){let o=typeof this.promoteId=="string"?this.promoteId:this.promoteId[r];n=e.properties[o],typeof n=="boolean"&&(n=Number(n)),n===void 0&&((i=e.properties)!=null&&i.cluster)&&this.promoteId&&(n=Number(e.properties.cluster_id))}return n}};I("FeatureIndex",Ii,{omit:["rawTileData","sourceLayerCoder"]});function Xf(t,e,r,n,i){return rn(t,(o,a)=>{let s=e instanceof kt?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function Mb(t,e){return e-t}var Jf=Y(ye(),1);var et=class t extends Jf.default{constructor(e,r,n,i){super(e,r),this.angle=n,i!==void 0&&(this.segment=i)}clone(){return new t(this.x,this.y,this.angle,this.segment)}};I("Anchor",et);function Fl(t,e,r,n,i){if(e.segment===void 0||r===0)return!0;let o=e,a=e.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;let l=[],u=0;for(;s<r/2;){let c=t[a-1],p=t[a],f=t[a+1];if(!f)return!1;let y=c.angleTo(p)-p.angleTo(f);for(y=Math.abs((y+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:s,angleDelta:y}),u+=y;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=p.dist(f)}return!0}function Yf(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Kf(t,e,r){return t?3/5*e*r:0}function Qf(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function ey(t,e,r,n,i,o){let a=Kf(r,i,o),s=Qf(r,n)*o,l=0,u=Yf(t)/2;for(let c=0;c<t.length-1;c++){let p=t[c],f=t[c+1],y=p.dist(f);if(l+y>u){let m=(u-l)/y,h=lt.number(p.x,f.x,m),g=lt.number(p.y,f.y,m),d=new et(h,g,f.angleTo(p),c);return d._round(),!a||Fl(t,d,s,a,e)?d:void 0}l+=y}}function ty(t,e,r,n,i,o,a,s,l){let u=Kf(n,o,a),c=Qf(n,i),p=c*a,f=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-p<e/4&&(e=p+e/4);let y=o*2,m=f?e/2*s%e:(c/2+y)*a*s%e;return ry(t,m,e,u,r,p,f,!1,l)}function ry(t,e,r,n,i,o,a,s,l){let u=o/2,c=Yf(t),p=0,f=e-r,y=[];for(let m=0;m<t.length-1;m++){let h=t[m],g=t[m+1],d=h.dist(g),b=g.angleTo(h);for(;f+r<p+d;){f+=r;let x=(f-p)/d,v=lt.number(h.x,g.x,x),S=lt.number(h.y,g.y,x);if(v>=0&&v<l&&S>=0&&S<l&&f-u>=0&&f+u<=c){let A=new et(v,S,b,m);A._round(),(!n||Fl(t,A,o,n,i))&&y.push(A)}}p+=d}return!s&&!y.length&&!a&&(y=ry(t,p/2,r,n,i,o,a,!0,l)),y}var ht=Y(ye(),1);function ny(t,e,r,n,i){let o=[];for(let a=0;a<t.length;a++){let s=t[a],l;for(let u=0;u<s.length-1;u++){let c=s[u],p=s[u+1];c.x<e&&p.x<e||(c.x<e?c=new ht.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new ht.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round()),!(c.y<r&&p.y<r)&&(c.y<r?c=new ht.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new ht.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round()),!(c.x>=n&&p.x>=n)&&(c.x>=n?c=new ht.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new ht.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round()),!(c.y>=i&&p.y>=i)&&(c.y>=i?c=new ht.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new ht.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round()),(!l||!c.equals(l[l.length-1]))&&(l=[c],o.push(l)),l.push(p)))))}}return o}var xe=Y(ye(),1);var jr=he;function El(t,e,r,n){let i=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*jr,l=o.paddedRect.h-2*jr,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},c=o.stretchX||[[0,s]],p=o.stretchY||[[0,l]],f=(_,V)=>_+V[1]-V[0],y=c.reduce(f,0),m=p.reduce(f,0),h=s-y,g=l-m,d=0,b=y,x=0,v=m,S=0,A=h,w=0,T=g;if(o.content&&n){let _=o.content,V=_[2]-_[0],G=_[3]-_[1];(o.textFitWidth||o.textFitHeight)&&(u=Da(t)),d=$a(c,0,_[0]),x=$a(p,0,_[1]),b=$a(c,_[0],_[2]),v=$a(p,_[1],_[3]),S=_[0]-d,w=_[1]-x,A=V-b,T=G-v}let E=u.x1,D=u.y1,B=u.x2-E,z=u.y2-D,M=(_,V,G,O)=>{let R=ja(_.stretch-d,b,B,E),K=qa(_.fixed-S,A,_.stretch,y),X=ja(V.stretch-x,v,z,D),re=qa(V.fixed-w,T,V.stretch,m),me=ja(G.stretch-d,b,B,E),Ut=qa(G.fixed-S,A,G.stretch,y),tt=ja(O.stretch-x,v,z,D),gt=qa(O.fixed-w,T,O.stretch,m),Ni=new xe.default(R,X),Ui=new xe.default(me,X),$i=new xe.default(me,tt),ji=new xe.default(R,tt),ss=new xe.default(K/a,re/a),Ie=new xe.default(Ut/a,gt/a),xt=e*Math.PI/180;if(xt){let bt=Math.sin(xt),Jr=Math.cos(xt),Be=[Jr,-bt,bt,Jr];Ni._matMult(Be),Ui._matMult(Be),ji._matMult(Be),$i._matMult(Be)}let Zr=_.stretch+_.fixed,ls=G.stretch+G.fixed,qi=V.stretch+V.fixed,us=O.stretch+O.fixed,Te={x:o.paddedRect.x+jr+Zr,y:o.paddedRect.y+jr+qi,w:ls-Zr,h:us-qi},be=A/a/B,rt=T/a/z;return{tl:Ni,tr:Ui,bl:ji,br:$i,tex:Te,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ss,pixelOffsetBR:Ie,minFontScaleX:be,minFontScaleY:rt,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let _=iy(c,h,y),V=iy(p,g,m);for(let G=0;G<_.length-1;G++){let O=_[G],R=_[G+1];for(let K=0;K<V.length-1;K++){let X=V[K],re=V[K+1];i.push(M(O,X,R,re))}}}return i}function $a(t,e,r){let n=0;for(let i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function iy(t,e,r){let n=[{fixed:-jr,stretch:0}];for(let[i,o]of t){let a=n[n.length-1];n.push({fixed:i-a.stretch,stretch:a.stretch}),n.push({fixed:i-a.stretch,stretch:a.stretch+(o-i)})}return n.push({fixed:e+jr,stretch:r}),n}function ja(t,e,r,n){return t/e*r+n}function qa(t,e,r,n){return t-e*r/n}function oy(t,e,r,n,i,o,a,s){let l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(let c of e.positionedLines)for(let p of c.positionedGlyphs){if(!p.rect)continue;let f=p.rect||{},m=ka+1,h=!0,g=1,d=0,b=(i||s)&&p.vertical,x=p.metrics.advance*p.scale/2;if(s&&e.verticalizable){let X=(p.scale-1)*ae,re=(ae-p.metrics.width*p.scale)/2;d=c.lineOffset/2-(p.imageName?-re:X)}if(p.imageName){let X=a[p.imageName];h=X.sdf,g=X.pixelRatio,m=he/g}let v=i?[p.x+x,p.y]:[0,0],S=i?[0,0]:[p.x+x+r[0],p.y+r[1]-d],A=[0,0];b&&(A=S,S=[0,0]);let w=p.metrics.isDoubleResolution?2:1,T=(p.metrics.left-m)*p.scale-x+S[0],E=(-p.metrics.top-m)*p.scale+S[1],D=T+f.w/w*p.scale/g,B=E+f.h/w*p.scale/g,z=new xe.default(T,E),M=new xe.default(D,E),_=new xe.default(T,B),V=new xe.default(D,B);if(b){let X=new xe.default(-x,x-bi),re=-Math.PI/2,me=ae/2-x,Ut=p.imageName?me:0,tt=new xe.default(5-bi-me,-Ut),gt=new xe.default(...A);z._rotateAround(re,X)._add(tt)._add(gt),M._rotateAround(re,X)._add(tt)._add(gt),_._rotateAround(re,X)._add(tt)._add(gt),V._rotateAround(re,X)._add(tt)._add(gt)}if(l){let X=Math.sin(l),re=Math.cos(l),me=[re,-X,X,re];z._matMult(me),M._matMult(me),_._matMult(me),V._matMult(me)}let G=new xe.default(0,0),O=new xe.default(0,0);u.push({tl:z,tr:M,bl:_,br:V,tex:f,writingMode:e.writingMode,glyphOffset:v,sectionIndex:p.sectionIndex,isSDF:h,pixelOffsetTL:G,pixelOffsetBR:O,minFontScaleX:0,minFontScaleY:0})}return u}var Ti=Y(ye(),1);var mr=class{constructor(e,r,n,i,o,a,s,l,u,c){var p;if(this.boxStartIndex=e.length,u){let f=a.top,y=a.bottom,m=a.collisionPadding;m&&(f-=m[1],y+=m[3]);let h=y-f;h>0&&(h=Math.max(10,h),this.circleDiameter=h)}else{let f=(p=a.image)!=null&&p.content&&(a.image.textFitWidth||a.image.textFitHeight)?Da(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};f.y1=f.y1*s-l[0],f.y2=f.y2*s+l[2],f.x1=f.x1*s-l[3],f.x2=f.x2*s+l[1];let y=a.collisionPadding;if(y&&(f.x1-=y[0]*s,f.y1-=y[1]*s,f.x2+=y[2]*s,f.y2+=y[3]*s),c){let m=new Ti.default(f.x1,f.y1),h=new Ti.default(f.x2,f.y1),g=new Ti.default(f.x1,f.y2),d=new Ti.default(f.x2,f.y2),b=c*Math.PI/180;m._rotate(b),h._rotate(b),g._rotate(b),d._rotate(b),f.x1=Math.min(m.x,h.x,g.x,d.x),f.x2=Math.max(m.x,h.x,g.x,d.x),f.y1=Math.min(m.y,h.y,g.y,d.y),f.y2=Math.max(m.y,h.y,g.y,d.y)}e.emplaceBack(r.x,r.y,f.x1,f.y1,f.x2,f.y2,n,i,o)}this.boxEndIndex=e.length}};var Ci=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};var Ml=Y(ye(),1);function ay(t,e=1,r=!1){let n=yr.fromPoints(t[0]),i=Math.min(n.width(),n.height()),o=i/2,a=new Ci([],Lb),{minX:s,minY:l,maxX:u,maxY:c}=n;if(i===0)return new Ml.default(s,l);for(let y=s;y<u;y+=i)for(let m=l;m<c;m+=i)a.push(new qr(y+o,m+o,o,t));let p=Bb(t),f=a.length;for(;a.length;){let y=a.pop();(y.d>p.d||!p.d)&&(p=y,r&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,f)),!(y.max-p.d<=e)&&(o=y.h/2,a.push(new qr(y.p.x-o,y.p.y-o,o,t)),a.push(new qr(y.p.x+o,y.p.y-o,o,t)),a.push(new qr(y.p.x-o,y.p.y+o,o,t)),a.push(new qr(y.p.x+o,y.p.y+o,o,t)),f+=4)}return r&&(console.log("num probes: ".concat(f)),console.log("best distance: ".concat(p.d))),p.p}function Lb(t,e){return e.max-t.max}function qr(t,e,r,n){this.p=new Ml.default(t,e),this.h=r,this.d=Db(this.p,n),this.max=this.d+this.h*Math.SQRT2}function Db(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){let o=e[i];for(let a=0,s=o.length,l=s-1;a<s;l=a++){let u=o[a],c=o[l];u.y>t.y!=c.y>t.y&&t.x<(c.x-u.x)*(t.y-u.y)/(c.y-u.y)+u.x&&(r=!r),n=Math.min(n,cl(t,u,c))}}return(r?1:-1)*Math.sqrt(n)}function Bb(t){let e=0,r=0,n=0,i=t[0];for(let o=0,a=i.length,s=a-1;o<a;s=o++){let l=i[o],u=i[s],c=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*c,n+=(l.y+u.y)*c,e+=c*3}return new qr(r/e,n/e,0,t)}var Vl=Y(il(),1);var Ll=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(Ll||{}),Ot=7,Wa=Number.POSITIVE_INFINITY;function Dl(t,e){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.SQRT2;switch(i){case"top-right":case"top-left":s=l-Ot;break;case"bottom-right":case"bottom-left":s=-l+Ot;break;case"bottom":s=-o+Ot;break;case"top":s=o-Ot;break}switch(i){case"top-right":case"bottom-right":a=-l;break;case"top-left":case"bottom-left":a=l;break;case"left":a=o;break;case"right":a=-o;break}return[a,s]}function n(i,o,a){let s=0,l=0;switch(o=Math.abs(o),a=Math.abs(a),i){case"top-right":case"top-left":case"top":l=a-Ot;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+Ot;break}switch(i){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o;break}return[s,l]}return e[1]!==Wa?n(t,e[0],e[1]):r(t,e[0])}function Bl(t,e,r){var a;let n=t.layout,i=(a=n.get("text-variable-anchor-offset"))==null?void 0:a.evaluate(e,{},r);if(i){let s=i.values,l=[];for(let u=0;u<s.length;u+=2){let c=l[u]=s[u],p=s[u+1].map(f=>f*ae);c.startsWith("top")?p[1]-=Ot:c.startsWith("bottom")&&(p[1]+=Ot),l[u+1]=p}return new Ee(l)}let o=n.get("text-variable-anchor");if(o){let s;t._unevaluatedLayout.getValue("text-radial-offset")!==void 0?s=[n.get("text-radial-offset").evaluate(e,{},r)*ae,Wa]:s=n.get("text-offset").evaluate(e,{},r).map(c=>c*ae);let u=[];for(let c of o)u.push(c,Dl(c,s));return new Ee(u)}return null}function uy(t){t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=8192/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],n=r.layout,i=r._unevaluatedLayout._values,o={layoutIconSize:i["icon-size"].possiblyEvaluate(new W(t.bucket.zoom+1),t.canonical),layoutTextSize:i["text-size"].possiblyEvaluate(new W(t.bucket.zoom+1),t.canonical),textMaxSize:i["text-size"].possiblyEvaluate(new W(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.textSizeData;o.compositeTextSizes=[i["text-size"].possiblyEvaluate(new W(c),t.canonical),i["text-size"].possiblyEvaluate(new W(p),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.iconSizeData;o.compositeIconSizes=[i["icon-size"].possiblyEvaluate(new W(c),t.canonical),i["icon-size"].possiblyEvaluate(new W(p),t.canonical)]}let a=n.get("text-line-height")*ae,s=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",l=n.get("text-keep-upright"),u=n.get("text-size");for(let c of t.bucket.features){let p=n.get("text-font").evaluate(c,{},t.canonical).join(","),f=u.evaluate(c,{},t.canonical),y=o.layoutTextSize.evaluate(c,{},t.canonical),m=o.layoutIconSize.evaluate(c,{},t.canonical),h={horizontal:{},vertical:void 0},g=c.text,d=[0,0];if(g){let S=g.toString(),A=n.get("text-letter-spacing").evaluate(c,{},t.canonical)*ae,w=ep(S)?A:0,T=n.get("text-anchor").evaluate(c,{},t.canonical),E=Bl(r,c,t.canonical);if(!E){let _=n.get("text-radial-offset").evaluate(c,{},t.canonical);_?d=Dl(T,[_*ae,Wa]):d=n.get("text-offset").evaluate(c,{},t.canonical).map(V=>V*ae)}let D=s?"center":n.get("text-justify").evaluate(c,{},t.canonical),z=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(c,{},t.canonical)*ae:1/0,M=()=>{t.bucket.allowVerticalPlacement&&Tn(S)&&(h.vertical=vi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,"left",w,d,2,!0,y,f))};if(!s&&E){let _=new Set;if(D==="auto")for(let G=0;G<E.values.length;G+=2)_.add(sy(E.values[G]));else _.add(D);let V=!1;for(let G of _)if(!h.horizontal[G])if(V)h.horizontal[G]=h.horizontal[0];else{let O=vi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,"center",G,w,d,1,!1,y,f);O&&(h.horizontal[G]=O,V=O.positionedLines.length===1)}M()}else{D==="auto"&&(D=sy(T));let _=vi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,1,!1,y,f);_&&(h.horizontal[D]=_),M(),Tn(S)&&s&&l&&(h.vertical=vi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,2,!1,y,f))}}let b,x=!1;if(c.icon&&c.icon.name){let S=t.imageMap[c.icon.name];S&&(b=Bf(t.imagePositions[c.icon.name],n.get("icon-offset").evaluate(c,{},t.canonical),n.get("icon-anchor").evaluate(c,{},t.canonical)),x=!!S.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=x:t.bucket.sdfIcons!==x&&ce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(S.pixelRatio!==t.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let v=cy(h.horizontal)||h.vertical;t.bucket.iconsInText=v?v.iconsInText:!1,(v||b)&&Vb(t.bucket,c,h,b,t.imageMap,o,y,m,d,x,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function sy(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 Vb(t,e,r,n,i,o,a,s,l,u,c,p){let f=o.textMaxSize.evaluate(e,{});f===void 0&&(f=a);let y=t.layers[0].layout,m=y.get("icon-offset").evaluate(e,{},c),h=cy(r.horizontal),g=24,d=a/g,b=t.tilePixelRatio*d,x=t.tilePixelRatio*f/g,v=t.tilePixelRatio*s,S=t.tilePixelRatio*y.get("symbol-spacing"),A=y.get("text-padding")*t.tilePixelRatio,w=Nf(y,e,c,t.tilePixelRatio),T=y.get("text-max-angle")/180*Math.PI,E=y.get("text-rotation-alignment")!=="viewport"&&y.get("symbol-placement")!=="point",D=y.get("icon-rotation-alignment")==="map"&&y.get("symbol-placement")!=="point",B=y.get("symbol-placement"),z=S/2,M=y.get("icon-text-fit"),_;n&&M!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(_=Tl(n,r.vertical,M,y.get("icon-text-fit-padding"),m,d)),h&&(n=Tl(n,h,M,y.get("icon-text-fit-padding"),m,d)));let V=c?p.line.getGranularityForZoomLevel(c.z):1,G=(O,R)=>{R.x<0||R.x>=8192||R.y<0||R.y>=8192||zb(t,R,O,r,n,i,_,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,b,[A,A,A,A],E,l,v,w,D,m,e,o,u,c,a)};if(B==="line")for(let O of ny(e.geometry,0,0,8192,8192)){let R=Ke(O,V),K=ty(R,S,T,r.vertical||h,n,g,x,t.overscaling,8192);for(let X of K){let re=h;(!re||!Ob(t,re.text,z,X))&&G(R,X)}}else if(B==="line-center"){for(let O of e.geometry)if(O.length>1){let R=Ke(O,V),K=ey(R,T,r.vertical||h,n,g,x);K&&G(R,K)}}else if(e.type==="Polygon")for(let O of Kt(e.geometry,0)){let R=ay(O,16),K=Ke(O[0],V,!0);G(K,new et(R.x,R.y,0))}else if(e.type==="LineString")for(let O of e.geometry){let R=Ke(O,V);G(R,new et(R[0].x,R[0].y,0))}else if(e.type==="Point")for(let O of e.geometry)for(let R of O)G([R],new et(R.x,R.y,0))}function Rb(t,e){let r=t.length,n=e==null?void 0:e.values;if((n==null?void 0:n.length)>0)for(let i=0;i<n.length;i+=2){let o=Ll[n[i]],a=n[i+1];t.emplaceBack(o,a[0],a[1])}return[r,t.length]}function ly(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=oy(e,r,s,i,o,a,n,t.allowVerticalPlacement),g=t.textSizeData,d=null;g.kind==="source"?(d=[zt*i.layout.get("text-size").evaluate(a,{})],d[0]>Qe&&ce("".concat(t.layerIds[0],\': Value for "text-size" is >= \').concat(Ur,\'. Reduce your "text-size".\'))):g.kind==="composite"&&(d=[zt*y.compositeTextSizes[0].evaluate(a,{},m),zt*y.compositeTextSizes[1].evaluate(a,{},m)],(d[0]>Qe||d[1]>Qe)&&ce("".concat(t.layerIds[0],\': Value for "text-size" is >= \').concat(Ur,\'. Reduce your "text-size".\'))),t.addSymbols(t.text,h,d,s,o,a,u,e,l.lineStartIndex,l.lineLength,f,m);for(let b of c)p[b]=t.text.placedSymbolArray.length-1;return h.length*4}function cy(t){for(let e in t)return t[e];return null}function zb(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,b,x,v,S,A,w,T){let E=t.addToLineVertexArray(e,r),D,B,z,M,_=0,V=0,G=0,O=0,R=-1,K=-1,X={},re=(0,Vl.default)("");if(t.allowVerticalPlacement&&n.vertical){let be=s.layout.get("text-rotate").evaluate(v,{},w)+90,rt=n.vertical;z=new mr(l,e,u,c,p,rt,f,y,m,be),a&&(M=new mr(l,e,u,c,p,a,g,d,m,be))}if(i){let Te=s.layout.get("icon-rotate").evaluate(v,{}),be=s.layout.get("icon-text-fit")!=="none",rt=El(i,Te,A,be),bt=a?El(a,Te,A,be):void 0;B=new mr(l,e,u,c,p,i,g,d,!1,Te),_=rt.length*4;let Jr=t.iconSizeData,Be=null;Jr.kind==="source"?(Be=[zt*s.layout.get("icon-size").evaluate(v,{})],Be[0]>Qe&&ce("".concat(t.layerIds[0],\': Value for "icon-size" is >= \').concat(Ur,\'. Reduce your "icon-size".\'))):Jr.kind==="composite"&&(Be=[zt*S.compositeIconSizes[0].evaluate(v,{},w),zt*S.compositeIconSizes[1].evaluate(v,{},w)],(Be[0]>Qe||Be[1]>Qe)&&ce("".concat(t.layerIds[0],\': Value for "icon-size" is >= \').concat(Ur,\'. Reduce your "icon-size".\'))),t.addSymbols(t.icon,rt,Be,x,b,v,0,e,E.lineStartIndex,E.lineLength,-1,w),R=t.icon.placedSymbolArray.length-1,bt&&(V=bt.length*4,t.addSymbols(t.icon,bt,Be,x,b,v,2,e,E.lineStartIndex,E.lineLength,-1,w),K=t.icon.placedSymbolArray.length-1)}let me=Object.keys(n.horizontal);for(let Te of me){let be=n.horizontal[Te];if(!D){re=(0,Vl.default)(be.text);let bt=s.layout.get("text-rotate").evaluate(v,{},w);D=new mr(l,e,u,c,p,be,f,y,m,bt)}let rt=be.positionedLines.length===1;if(G+=ly(t,e,be,o,s,m,v,h,E,n.vertical?1:3,rt?me:[Te],X,R,S,w),rt)break}n.vertical&&(O+=ly(t,e,n.vertical,o,s,m,v,h,E,2,["vertical"],X,K,S,w));let Ut=D?D.boxStartIndex:t.collisionBoxArray.length,tt=D?D.boxEndIndex:t.collisionBoxArray.length,gt=z?z.boxStartIndex:t.collisionBoxArray.length,Ni=z?z.boxEndIndex:t.collisionBoxArray.length,Ui=B?B.boxStartIndex:t.collisionBoxArray.length,$i=B?B.boxEndIndex:t.collisionBoxArray.length,ji=M?M.boxStartIndex:t.collisionBoxArray.length,ss=M?M.boxEndIndex:t.collisionBoxArray.length,Ie=-1,xt=(Te,be)=>Te&&Te.circleDiameter?Math.max(Te.circleDiameter,be):be;Ie=xt(D,Ie),Ie=xt(z,Ie),Ie=xt(B,Ie),Ie=xt(M,Ie);let Zr=Ie>-1?1:0;Zr&&(Ie*=T/ae),t.glyphOffsetArray.length>=Xe.MAX_GLYPHS&&ce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),v.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey);let ls=Bl(s,v,w),[qi,us]=Rb(t.textAnchorOffsets,ls);t.symbolInstances.emplaceBack(e.x,e.y,X.right>=0?X.right:-1,X.center>=0?X.center:-1,X.left>=0?X.left:-1,X.vertical||-1,R,K,re,Ut,tt,gt,Ni,Ui,$i,ji,ss,u,G,O,_,V,Zr,0,f,Ie,qi,us)}function Ob(t,e,r,n){let i=t.compareText;if(!(e in i))i[e]=[];else{let o=i[e];for(let a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}return i[e].push(n),!1}var Xa=1,ki=class{constructor(e){let r={},n=[];for(let s in e){let l=e[s],u=r[s]={};for(let c in l){let p=l[+c];if(!p||p.bitmap.width===0||p.bitmap.height===0)continue;let f={x:0,y:0,w:p.bitmap.width+2*Xa,h:p.bitmap.height+2*Xa};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=di(n),a=new lr({width:i||1,height:o||1});for(let s in e){let l=e[s];for(let u in l){let c=l[+u];if(!c||c.bitmap.width===0||c.bitmap.height===0)continue;let p=r[s][u].rect;lr.copy(c.bitmap,a,{x:0,y:0},{x:p.x+Xa,y:p.y+Xa},c.bitmap)}}this.image=a,this.positions=r}};I("GlyphAtlas",ki);function fy(t,e,r){e=Math.pow(2,r)-e-1;var n=py(t*256,e*256,r),i=py((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function py(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),i=t*n-2*Math.PI*6378137/2,o=e*n-2*Math.PI*6378137/2;return[i,o]}var dy=Y(ye(),1);var Rl=63710088e-1,Fi=class t{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error("Invalid LngLat object: (".concat(e,", ").concat(r,")"));if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new t(Cu(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(e){let r=Math.PI/180,n=this.lat*r,i=e.lat*r,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-this.lng)*r);return Rl*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof t)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new t(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new t(Number("lng"in e?e.lng:e.lon),Number(e.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>]")}};var yy=2*Math.PI*Rl;function my(t){return yy*Math.cos(t*Math.PI/180)}function Gb(t){return(180+t)/360}function Nb(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Ub(t,e){return t/my(e)}function $b(t){return t*360-180}function zl(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function jb(t,e){return t*my(zl(e))}function qb(t){return 1/Math.cos(t*Math.PI/180)}var Ei=class t{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=Fi.convert(e);return new t(Gb(n.lng),Nb(n.lat),Ub(r,n.lat))}toLngLat(){return new Fi($b(this.x),zl(this.y))}toAltitude(){return jb(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/yy*qb(zl(this.y))}};function hy(t,e,r){return!(t<Yi||t>Ji||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}var Ha=class{constructor(e,r,n){if(!hy(e,r,n))throw new Error("x=".concat(r,", y=").concat(n,", z=").concat(e," outside of bounds. 0<=x<").concat(Math.pow(2,e),", 0<=y<").concat(Math.pow(2,e)," ").concat(Yi,"<=z<=").concat(Ji," "));this.z=e,this.x=r,this.y=n,this.key=Mi(0,e,e,r,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,n){let i=fy(this.x,this.y,this.z),o=Wb(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){let r=Math.pow(2,this.z);return new dy.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},Ol=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Mi(e,r.z,r.z,r.x,r.y)}},Li=class t{constructor(e,r,n,i,o){this.terrainRttPosMatrix32f=null;if(e<n)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(e,"; z = ").concat(n));this.overscaledZ=e,this.wrap=r,this.canonical=new Ha(n,+i,+o),this.key=Mi(r,e,n,i,o)}clone(){return new t(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-e;return e>this.canonical.z?new t(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new t(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let n=this.canonical.z-e;return e>this.canonical.z?Mi(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Mi(this.wrap*+r,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new t(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=this.canonical.x*2,i=this.canonical.y*2;return[new t(r,this.wrap,r,n,i),new t(r,this.wrap,r,n+1,i),new t(r,this.wrap,r,n,i+1),new t(r,this.wrap,r,n+1,i+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new t(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new t(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Ol(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(e){return this.canonical.getTilePoint(new Ei(e.x-this.wrap,e.y))}};function Mi(t,e,r,n,i){t*=2,t<0&&(t=t*-1-1);let o=1<<r;return(o*o*t+o*i+n).toString(36)+r.toString(36)+e.toString(36)}function Wb(t,e,r){let n="",i;for(let o=t;o>0;o--)i=1<<o-1,n+=(e&i?1:0)+(r&i?2:0);return n}I("CanonicalTileID",Ha);I("OverscaledTileID",Li,{omit:["terrainRttPosMatrix32f"]});var Za=class{constructor(e){this.tileID=new Li(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[],this.globalState=e.globalState}async parse(e,r,n,i,o){this.status="parsing",this.data=e,this.collisionBoxArray=new qn;let a=new $r(Object.keys(e.layers).sort()),s=new Ii(this.tileID,this.promoteId);s.bucketLayerIDs=[];let l={},u={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n,subdivisionGranularity:o},c=r.familiesBySource[this.source];for(let A in c){let w=e.layers[A];if(!w)continue;w.version===1&&ce(\'Vector tile source "\'.concat(this.source,\'" layer "\').concat(A,\'" \')+"does not use vector tile spec v2 and therefore may have some rendering errors.");let T=a.encode(A),E=[];for(let D=0;D<w.length;D++){let B=w.feature(D),z=s.getId(B,A);E.push({feature:B,id:z,index:D,sourceLayerIndex:T})}for(let D of c[A]){let B=D[0];if(B.source!==this.source&&ce("layer.source = ".concat(B.source," does not equal this.source = ").concat(this.source)),B.minzoom&&this.zoom<Math.floor(B.minzoom)||B.maxzoom&&this.zoom>=B.maxzoom||B.visibility==="none")continue;Gl(D,this.zoom,n),(l[B.id]=B.createBucket({index:s.bucketLayerIDs.length,layers:D,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:T,sourceID:this.source,globalState:this.globalState})).populate(E,u,this.tileID.canonical),s.bucketLayerIDs.push(D.map(M=>M.id))}}let p=rn(u.glyphDependencies,A=>Object.keys(A).map(Number));this.inFlightDependencies.forEach(A=>A==null?void 0:A.abort()),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){let A=new AbortController;this.inFlightDependencies.push(A),f=i.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},A)}let y=Object.keys(u.iconDependencies),m=Promise.resolve({});if(y.length){let A=new AbortController;this.inFlightDependencies.push(A),m=i.sendAsync({type:"GI",data:{icons:y,source:this.source,tileID:this.tileID,type:"icons"}},A)}let h=Object.keys(u.patternDependencies),g=Promise.resolve({});if(h.length){let A=new AbortController;this.inFlightDependencies.push(A),g=i.sendAsync({type:"GI",data:{icons:h,source:this.source,tileID:this.tileID,type:"patterns"}},A)}let[d,b,x]=await Promise.all([f,m,g]),v=new ki(d),S=new gi(b,x);for(let A in l){let w=l[A];w instanceof Xe?(Gl(w.layers,this.zoom,n),uy({bucket:w,glyphMap:d,glyphPositions:v.positions,imageMap:b,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:u.subdivisionGranularity})):w.hasPattern&&(w instanceof fr||w instanceof cr||w instanceof pr)&&(Gl(w.layers,this.zoom,n),w.addFeatures(u,this.tileID.canonical,S.patternPositions))}return this.status="done",{buckets:Object.values(l).filter(A=>!A.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:v.image,imageAtlas:S,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?b:null,glyphPositions:this.returnDependencies?v.positions:null}}};function Gl(t,e,r){let n=new W(e);for(let i of t)i.recalculate(n,r)}var Xb=60,rT=1e3/Xb;var Wr=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return e.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}};var Xr=class{constructor(e,r,n){this.actor=e,this.layerIndex=r,this.availableImages=n,this.fetching={},this.loading={},this.loaded={}}async loadVectorTile(e,r){let n=await Xc(e.request,r);try{return{vectorTile:new gy.default.VectorTile(new xy.default(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires}}catch(i){let o=new Uint8Array(n.data),a=o[0]===31&&o[1]===139,s="Unable to parse the tile at ".concat(e.request.url,", ");throw a?s+="please make sure the data is not gzipped and that you have configured the relevant header in the server":s+="got error: ".concat(i.message),new Error(s)}}async loadTile(e){let r=e.uid,n=e&&e.request&&e.request.collectResourceTiming?new Wr(e.request):!1,i=new Za(e);this.loading[r]=i;let o=new AbortController;i.abort=o;try{let a=await this.loadVectorTile(e,o);if(delete this.loading[r],!a)return null;let s=a.rawData,l={};a.expires&&(l.expires=a.expires),a.cacheControl&&(l.cacheControl=a.cacheControl);let u={};if(n){let p=n.finish();p&&(u.resourceTiming=JSON.parse(JSON.stringify(p)))}i.vectorTile=a.vectorTile;let c=i.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);this.loaded[r]=i,this.fetching[r]={rawTileData:s,cacheControl:l,resourceTiming:u};try{let p=await c;return de({rawTileData:s.slice(0)},p,l,u)}finally{delete this.fetching[r]}}catch(a){throw delete this.loading[r],i.status="done",this.loaded[r]=i,a}}async reloadTile(e){let r=e.uid;if(!this.loaded||!this.loaded[r])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let n=this.loaded[r];if(n.showCollisionBoxes=e.showCollisionBoxes,n.globalState=e.globalState,n.status==="parsing"){let i=await n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity),o;if(this.fetching[r]){let{rawTileData:a,cacheControl:s,resourceTiming:l}=this.fetching[r];delete this.fetching[r],o=de({rawTileData:a.slice(0)},i,s,l)}else o=i;return o}if(n.status==="done"&&n.vectorTile)return n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity)}async abortTile(e){let r=this.loading,n=e.uid;r&&r[n]&&r[n].abort&&(r[n].abort.abort(),delete r[n])}async removeTile(e){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]}};var Ja=class{constructor(){this.loaded={}}async loadTile(e){let{uid:r,encoding:n,rawImageData:i,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=e,u=i.width+2,c=i.height+2,p=vt(i)?new fe({width:u,height:c},await Eu(i,-1,-1,u,c)):i,f=new oi(r,p,n,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=f,f}removeTile(e){let r=this.loaded,n=e.uid;r&&r[n]&&delete r[n]}};var qy=Y(Sy(),1);var Nl=Y(ye(),1),wy=Y(Rt(),1);var Hb=wy.default.VectorTileFeature.prototype.toGeoJSON,Ul=class{constructor(e){this._feature=e,this.extent=8192,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(this._feature.type===1){let e=[];for(let r of this._feature.geometry)e.push([new Nl.default(r[0],r[1])]);return e}else{let e=[];for(let r of this._feature.geometry){let n=[];for(let i of r)n.push(new Nl.default(i[0],i[1]));e.push(n)}return e}}toGeoJSON(e,r,n){return Hb.call(this,e,r,n)}},Ka=class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=e.length,this._features=e}feature(e){return new Ul(this._features[e])}};var Wy=Y(ky(),1);var Fy=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ql=1,Bi=8,Ri=class t{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,n]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(i!==ql)throw new Error("Got v".concat(i," data when expected v").concat(ql,"."));let o=Fy[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new t(s,a,o,e)}constructor(e,r=64,n=Float64Array,i){if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=Fy.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error("Unexpected typed array class: ".concat(n,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,Bi,e),this.coords=new this.ArrayType(this.data,Bi+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(Bi+a+s+l),this.ids=new this.IndexArrayType(this.data,Bi,e),this.coords=new this.ArrayType(this.data,Bi+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(ql<<4)+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return Xl(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,l=[0,o.length-1,0],u=[];for(;l.length;){let c=l.pop()||0,p=l.pop()||0,f=l.pop()||0;if(p-f<=s){for(let g=f;g<=p;g++){let d=a[2*g],b=a[2*g+1];d>=e&&d<=n&&b>=r&&b<=i&&u.push(o[g])}continue}let y=f+p>>1,m=a[2*y],h=a[2*y+1];m>=e&&m<=n&&h>=r&&h<=i&&u.push(o[y]),(c===0?e<=m:r<=h)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=h)&&(l.push(y+1),l.push(p),l.push(1-c))}return u}within(e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:o,nodeSize:a}=this,s=[0,i.length-1,0],l=[],u=n*n;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,f=s.pop()||0;if(p-f<=a){for(let g=f;g<=p;g++)Ey(o[2*g],o[2*g+1],e,r)<=u&&l.push(i[g]);continue}let y=f+p>>1,m=o[2*y],h=o[2*y+1];Ey(m,h,e,r)<=u&&l.push(i[y]),(c===0?e-n<=m:r-n<=h)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?e+n>=m:r+n>=h)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function Xl(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;My(t,e,a,n,i,o),Xl(t,e,r,n,a-1,1-o),Xl(t,e,r,a+1,i,1-o)}function My(t,e,r,n,i,o){for(;i>n;){if(i-n>600){let u=i-n+1,c=r-n+1,p=Math.log(u),f=.5*Math.exp(2*p/3),y=.5*Math.sqrt(p*f*(u-f)/u)*(c-u/2<0?-1:1),m=Math.max(n,Math.floor(r-c*f/u+y)),h=Math.min(i,Math.floor(r+(u-c)*f/u+y));My(t,e,r,m,h,o)}let a=e[2*r+o],s=n,l=i;for(Vi(t,e,n,r),e[2*i+o]>a&&Vi(t,e,n,i);s<l;){for(Vi(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?Vi(t,e,n,l):(l++,Vi(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Vi(t,e,r,n){Wl(t,r,n),Wl(e,2*r,2*n),Wl(e,2*r+1,2*n+1)}function Wl(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function Ey(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var o0={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Ly=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),hr=2,Nt=3,Hl=4,Gt=5,By=6,zi=class{constructor(e){this.options=Object.assign(Object.create(o0),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:r,minZoom:n,maxZoom:i}=this.options;r&&console.time("total time");let o="prepare ".concat(e.length," points");r&&console.time(o),this.points=e;let a=[];for(let l=0;l<e.length;l++){let u=e[l];if(!u.geometry)continue;let[c,p]=u.geometry.coordinates,f=Ly(es(c)),y=Ly(ts(p));a.push(f,y,1/0,l,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this._createTree(a);r&&console.timeEnd(o);for(let l=i;l>=n;l--){let u=+Date.now();s=this.trees[l]=this._createTree(this._cluster(s,l)),r&&console.log("z%d: %d clusters in %dms",l,s.numItems,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(e,r){let n=((e[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,e[1])),o=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,o=180;else if(n>o){let p=this.getClusters([n,i,180,a],r),f=this.getClusters([-180,i,o,a],r);return p.concat(f)}let s=this.trees[this._limitZoom(r)],l=s.range(es(n),ts(a),es(o),ts(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+Gt]>1?Dy(u,f,this.clusterProps):this.points[u[f+Nt]])}return c}getChildren(e){let r=this._getOriginId(e),n=this._getOriginZoom(e),i="No cluster with the specified id.",o=this.trees[n];if(!o)throw new Error(i);let a=o.data;if(r*this.stride>=a.length)throw new Error(i);let s=this.options.radius/(this.options.extent*Math.pow(2,n-1)),l=a[r*this.stride],u=a[r*this.stride+1],c=o.within(l,u,s),p=[];for(let f of c){let y=f*this.stride;a[y+Hl]===e&&p.push(a[y+Gt]>1?Dy(a,y,this.clusterProps):this.points[a[y+Nt]])}if(p.length===0)throw new Error(i);return p}getLeaves(e,r,n){r=r||10,n=n||0;let i=[];return this._appendLeaves(i,e,r,n,0),i}getTile(e,r,n){let i=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:a,radius:s}=this.options,l=s/a,u=(n-l)/o,c=(n+1+l)/o,p={features:[]};return this._addTileFeatures(i.range((r-l)/o,u,(r+1+l)/o,c),i.data,r,n,o,p),r===0&&this._addTileFeatures(i.range(1-l/o,u,1,c),i.data,o,n,o,p),r===o-1&&this._addTileFeatures(i.range(0,u,l/o,c),i.data,-1,n,o,p),p.features.length?p:null}getClusterExpansionZoom(e){let r=this._getOriginZoom(e)-1;for(;r<=this.options.maxZoom;){let n=this.getChildren(e);if(r++,n.length!==1)break;e=n[0].properties.cluster_id}return r}_appendLeaves(e,r,n,i,o){let a=this.getChildren(r);for(let s of a){let l=s.properties;if(l&&l.cluster?o+l.point_count<=i?o+=l.point_count:o=this._appendLeaves(e,l.cluster_id,n,i,o):o<i?o++:e.push(s),e.length===n)break}return o}_createTree(e){let r=new Ri(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<e.length;n+=this.stride)r.add(e[n],e[n+1]);return r.finish(),r.data=e,r}_addTileFeatures(e,r,n,i,o,a){for(let s of e){let l=s*this.stride,u=r[l+Gt]>1,c,p,f;if(u)c=Vy(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let h=this.points[r[l+Nt]];c=h.properties;let[g,d]=h.geometry.coordinates;p=es(g),f=ts(d)}let y={type:1,geometry:[[Math.round(this.options.extent*(p*o-n)),Math.round(this.options.extent*(f*o-i))]],tags:c},m;u||this.options.generateId?m=r[l+Nt]:m=this.points[r[l+Nt]].id,m!==void 0&&(y.id=m),a.features.push(y)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,r){let{radius:n,extent:i,reduce:o,minPoints:a}=this.options,s=n/(i*Math.pow(2,r)),l=e.data,u=[],c=this.stride;for(let p=0;p<l.length;p+=c){if(l[p+hr]<=r)continue;l[p+hr]=r;let f=l[p],y=l[p+1],m=e.within(l[p],l[p+1],s),h=l[p+Gt],g=h;for(let d of m){let b=d*c;l[b+hr]>r&&(g+=l[b+Gt])}if(g>h&&g>=a){let d=f*h,b=y*h,x,v=-1,S=((p/c|0)<<5)+(r+1)+this.points.length;for(let A of m){let w=A*c;if(l[w+hr]<=r)continue;l[w+hr]=r;let T=l[w+Gt];d+=l[w]*T,b+=l[w+1]*T,l[w+Hl]=S,o&&(x||(x=this._map(l,p,!0),v=this.clusterProps.length,this.clusterProps.push(x)),o(x,this._map(l,w)))}l[p+Hl]=S,u.push(d/g,b/g,1/0,S,-1,g),o&&u.push(v)}else{for(let d=0;d<c;d++)u.push(l[p+d]);if(g>1)for(let d of m){let b=d*c;if(!(l[b+hr]<=r)){l[b+hr]=r;for(let x=0;x<c;x++)u.push(l[b+x])}}}}return u}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,r,n){if(e[r+Gt]>1){let a=this.clusterProps[e[r+By]];return n?Object.assign({},a):a}let i=this.points[e[r+Nt]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function Dy(t,e,r){return{type:"Feature",id:t[e+Nt],properties:Vy(t,e,r),geometry:{type:"Point",coordinates:[a0(t[e]),s0(t[e+1])]}}}function Vy(t,e,r){let n=t[e+Gt],i=n>=1e4?"".concat(Math.round(n/1e3),"k"):n>=1e3?"".concat(Math.round(n/100)/10,"k"):n,o=t[e+By],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Nt],point_count:n,point_count_abbreviated:i})}function es(t){return t/360+.5}function ts(t){let 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 a0(t){return(t-.5)*360}function s0(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Oi(t,e,r,n){let i=n,o=e+(r-e>>1),a=r-e,s,l=t[e],u=t[e+1],c=t[r],p=t[r+1];for(let f=e+3;f<r;f+=3){let y=l0(t[f],t[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){let m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-e>3&&Oi(t,e,s,n),t[s+2]=i,r-s>3&&Oi(t,s,r,n))}function l0(t,e,r,n,i,o){let a=i-r,s=o-n;if(a!==0||s!==0){let l=((t-r)*a+(e-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return a=t-r,s=e-n,a*a+s*s}function dt(t,e,r,n){let i={id:t==null?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(e==="Point"||e==="MultiPoint"||e==="LineString")rs(i,r);else if(e==="Polygon")rs(i,r[0]);else if(e==="MultiLineString")for(let o of r)rs(i,o);else if(e==="MultiPolygon")for(let o of r)rs(i,o[0]);return i}function rs(t,e){for(let r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function Yl(t,e){let r=[];if(t.type==="FeatureCollection")for(let n=0;n<t.features.length;n++)ns(r,t.features[n],e,n);else t.type==="Feature"?ns(r,t,e):ns(r,{geometry:t},e);return r}function ns(t,e,r,n){if(!e.geometry)return;let i=e.geometry.coordinates;if(i&&i.length===0)return;let o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),o==="Point")Ry(i,s);else if(o==="MultiPoint")for(let u of i)Ry(u,s);else if(o==="LineString")Jl(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(let u of i)s=[],Jl(u,s,a,!1),t.push(dt(l,"LineString",s,e.properties));return}else Zl(i,s,a,!1);else if(o==="Polygon")Zl(i,s,a,!0);else if(o==="MultiPolygon")for(let u of i){let c=[];Zl(u,c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(let u of e.geometry.geometries)ns(t,{id:l,geometry:u,properties:e.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");t.push(dt(l,o,s,e.properties))}function Ry(t,e){e.push(zy(t[0]),Oy(t[1]),0)}function Jl(t,e,r,n){let i,o,a=0;for(let l=0;l<t.length;l++){let u=zy(t[l][0]),c=Oy(t[l][1]);e.push(u,c,0),l>0&&(n?a+=(i*c-u*o)/2:a+=Math.sqrt(Math.pow(u-i,2)+Math.pow(c-o,2))),i=u,o=c}let s=e.length-3;e[2]=1,Oi(e,0,s,r),e[s+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Zl(t,e,r,n){for(let i=0;i<t.length;i++){let o=[];Jl(t[i],o,r,n),e.push(o)}}function zy(t){return t/360+.5}function Oy(t){let 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 Ue(t,e,r,n,i,o,a,s){if(r/=e,n/=e,o>=r&&a<n)return t;if(a<r||o>=n)return null;let l=[];for(let u of t){let c=u.geometry,p=u.type,f=i===0?u.minX:u.minY,y=i===0?u.maxX:u.maxY;if(f>=r&&y<n){l.push(u);continue}else if(y<r||f>=n)continue;let m=[];if(p==="Point"||p==="MultiPoint")u0(c,m,r,n,i);else if(p==="LineString")Ny(c,m,r,n,i,!1,s.lineMetrics);else if(p==="MultiLineString")Kl(c,m,r,n,i,!1);else if(p==="Polygon")Kl(c,m,r,n,i,!0);else if(p==="MultiPolygon")for(let h of c){let g=[];Kl(h,g,r,n,i,!0),g.length&&m.push(g)}if(m.length){if(s.lineMetrics&&p==="LineString"){for(let h of m)l.push(dt(u.id,p,h,u.tags));continue}(p==="LineString"||p==="MultiLineString")&&(m.length===1?(p="LineString",m=m[0]):p="MultiLineString"),(p==="Point"||p==="MultiPoint")&&(p=m.length===3?"Point":"MultiPoint"),l.push(dt(u.id,p,m,u.tags))}}return l.length?l:null}function u0(t,e,r,n,i){for(let o=0;o<t.length;o+=3){let a=t[o+i];a>=r&&a<=n&&Hr(e,t[o],t[o+1],t[o+2])}}function Ny(t,e,r,n,i,o,a){let s=Gy(t),l=i===0?c0:p0,u=t.start,c,p;for(let d=0;d<t.length-3;d+=3){let b=t[d],x=t[d+1],v=t[d+2],S=t[d+3],A=t[d+4],w=i===0?b:x,T=i===0?S:A,E=!1;a&&(c=Math.sqrt(Math.pow(b-S,2)+Math.pow(x-A,2))),w<r?T>r&&(p=l(s,b,x,S,A,r),a&&(s.start=u+c*p)):w>n?T<n&&(p=l(s,b,x,S,A,n),a&&(s.start=u+c*p)):Hr(s,b,x,v),T<r&&w>=r&&(p=l(s,b,x,S,A,r),E=!0),T>n&&w<=n&&(p=l(s,b,x,S,A,n),E=!0),!o&&E&&(a&&(s.end=u+c*p),e.push(s),s=Gy(t)),a&&(u+=c)}let f=t.length-3,y=t[f],m=t[f+1],h=t[f+2],g=i===0?y:m;g>=r&&g<=n&&Hr(s,y,m,h),f=s.length-3,o&&f>=3&&(s[f]!==s[0]||s[f+1]!==s[1])&&Hr(s,s[0],s[1],s[2]),s.length&&e.push(s)}function Gy(t){let e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Kl(t,e,r,n,i,o){for(let a of t)Ny(a,e,r,n,i,o,!1)}function Hr(t,e,r,n){t.push(e,r,n)}function c0(t,e,r,n,i,o){let a=(o-e)/(n-e);return Hr(t,o,r+(i-r)*a,1),a}function p0(t,e,r,n,i,o){let a=(o-r)/(i-r);return Hr(t,e+(n-e)*a,o,1),a}function eu(t,e){let r=e.buffer/e.extent,n=t,i=Ue(t,1,-1-r,r,0,-1,2,e),o=Ue(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=Ue(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=Uy(i,1).concat(n)),o&&(n=n.concat(Uy(o,-1)))),n}function Uy(t,e){let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Ql(i.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(let s of i.geometry)a.push(Ql(s,e))}else if(o==="MultiPolygon"){a=[];for(let s of i.geometry){let l=[];for(let u of s)l.push(Ql(u,e));a.push(l)}}r.push(dt(i.id,o,a,i.tags))}return r}function Ql(t,e){let r=[];r.size=t.size,t.start!==void 0&&(r.start=t.start,r.end=t.end);for(let n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function is(t,e){if(t.transformed)return t;let r=1<<t.z,n=t.x,i=t.y;for(let o of t.features){let a=o.geometry,s=o.type;if(o.geometry=[],s===1)for(let l=0;l<a.length;l+=2)o.geometry.push($y(a[l],a[l+1],e,r,n,i));else for(let l=0;l<a.length;l++){let u=[];for(let c=0;c<a[l].length;c+=2)u.push($y(a[l][c],a[l][c+1],e,r,n,i));o.geometry.push(u)}}return t.transformed=!0,t}function $y(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function ru(t,e,r,n,i){let o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let s of t)f0(a,s,o,i);return a}function f0(t,e,r,n){let i=e.geometry,o=e.type,a=[];if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),o==="Point"||o==="MultiPoint")for(let s=0;s<i.length;s+=3)a.push(i[s],i[s+1]),t.numPoints++,t.numSimplified++;else if(o==="LineString")tu(a,i,t,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(let s=0;s<i.length;s++)tu(a,i[s],t,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(let s=0;s<i.length;s++){let l=i[s];for(let u=0;u<l.length;u++)tu(a,l[u],t,r,!0,u===0)}if(a.length){let s=e.tags||null;if(o==="LineString"&&n.lineMetrics){s={};for(let u in e.tags)s[u]=e.tags[u];s.mapbox_clip_start=i.start/i.size,s.mapbox_clip_end=i.end/i.size}let l={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:s};e.id!==null&&(l.id=e.id),t.features.push(l)}}function tu(t,e,r,n,i,o){let a=n*n;if(n>0&&e.size<(i?a:n)){r.numPoints+=e.length/3;return}let s=[];for(let l=0;l<e.length;l+=3)(n===0||e[l+2]>a)&&(r.numSimplified++,s.push(e[l],e[l+1])),r.numPoints++;i&&y0(s,o),t.push(s)}function y0(t,e){let r=0;for(let n=0,i=t.length,o=i-2;n<i;o=n,n+=2)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===e)for(let n=0,i=t.length;n<i/2;n+=2){let o=t[n],a=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=o,t[i-1-n]=a}}var m0={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},iu=class{constructor(e,r){r=this.options=h0(Object.create(m0),r);let n=r.debug;if(n&&console.time("preprocess data"),r.maxZoom<0||r.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=Yl(e,r);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",r.indexMaxZoom,r.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=eu(i,r),i.length&&this.splitTile(i,0,0,0),n&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,r,n,i,o,a,s){let l=[e,r,n,i],u=this.options,c=u.debug;for(;l.length;){i=l.pop(),n=l.pop(),r=l.pop(),e=l.pop();let p=1<<r,f=nu(r,n,i),y=this.tiles[f];if(!y&&(c>1&&console.time("creation"),y=this.tiles[f]=ru(e,r,n,i,u),this.tileCoords.push({z:r,x:n,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,i,y.numFeatures,y.numPoints,y.numSimplified),console.timeEnd("creation"));let T="z".concat(r);this.stats[T]=(this.stats[T]||0)+1,this.total++}if(y.source=e,o==null){if(r===u.indexMaxZoom||y.numPoints<=u.indexMaxPoints)continue}else{if(r===u.maxZoom||r===o)continue;if(o!=null){let T=o-r;if(n!==a>>T||i!==s>>T)continue}}if(y.source=null,e.length===0)continue;c>1&&console.time("clipping");let m=.5*u.buffer/u.extent,h=.5-m,g=.5+m,d=1+m,b=null,x=null,v=null,S=null,A=Ue(e,p,n-m,n+g,0,y.minX,y.maxX,u),w=Ue(e,p,n+h,n+d,0,y.minX,y.maxX,u);e=null,A&&(b=Ue(A,p,i-m,i+g,1,y.minY,y.maxY,u),x=Ue(A,p,i+h,i+d,1,y.minY,y.maxY,u),A=null),w&&(v=Ue(w,p,i-m,i+g,1,y.minY,y.maxY,u),S=Ue(w,p,i+h,i+d,1,y.minY,y.maxY,u),w=null),c>1&&console.timeEnd("clipping"),l.push(b||[],r+1,n*2,i*2),l.push(x||[],r+1,n*2,i*2+1),l.push(v||[],r+1,n*2+1,i*2),l.push(S||[],r+1,n*2+1,i*2+1)}}getTile(e,r,n){e=+e,r=+r,n=+n;let i=this.options,{extent:o,debug:a}=i;if(e<0||e>24)return null;let s=1<<e;r=r+s&s-1;let l=nu(e,r,n);if(this.tiles[l])return is(this.tiles[l],o);a>1&&console.log("drilling down to z%d-%d-%d",e,r,n);let u=e,c=r,p=n,f;for(;!f&&u>0;)u--,c=c>>1,p=p>>1,f=this.tiles[nu(u,c,p)];return!f||!f.source?null:(a>1&&(console.log("found parent tile z%d-%d-%d",u,c,p),console.time("drilling down")),this.splitTile(f.source,u,c,p,e,r,n),a>1&&console.timeEnd("drilling down"),this.tiles[l]?is(this.tiles[l],o):null)}};function nu(t,e,r){return((1<<t)*r+e)*32+t}function h0(t,e){for(let r in e)t[r]=e[r];return t}function ou(t,e){return new iu(t,e)}function Gi(t,e){return e?t.properties[e]:t.id}function au(t,e){if(t==null)return!0;if(t.type==="Feature")return Gi(t,e)!=null;if(t.type==="FeatureCollection"){let r=new Set;for(let n of t.features){let i=Gi(n,e);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function su(t,e){let r=new Map;if(t!=null)if(t.type==="Feature")r.set(Gi(t,e),t);else for(let n of t.features)r.set(Gi(n,e),n);return r}function jy(t,e,r){var n,i,o,a;if(e.removeAll&&t.clear(),e.remove)for(let s of e.remove)t.delete(s);if(e.add)for(let s of e.add){let l=Gi(s,r);l!=null&&t.set(l,s)}if(e.update)for(let s of e.update){let l=t.get(s.id);if(l==null)continue;let u=s.newGeometry||s.removeAllProperties,c=!s.removeAllProperties&&(((n=s.removeProperties)==null?void 0:n.length)>0||((i=s.addOrUpdateProperties)==null?void 0:i.length)>0);if((u||c)&&(l=$t({},l),t.set(s.id,l),c&&(l.properties=$t({},l.properties))),s.newGeometry&&(l.geometry=s.newGeometry),s.removeAllProperties)l.properties={};else if(((o=s.removeProperties)==null?void 0:o.length)>0)for(let p of s.removeProperties)Object.prototype.hasOwnProperty.call(l.properties,p)&&delete l.properties[p];if(((a=s.addOrUpdateProperties)==null?void 0:a.length)>0)for(let{key:p,value:f}of s.addOrUpdateProperties)l.properties[p]=f}}var os=class extends Xr{constructor(){super(...arguments);this._dataUpdateable=new Map}async loadVectorTile(r,n){let i=r.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let o=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!o)return null;let a=new Ka(o.features),s=(0,Wy.default)(a);return(s.byteOffset!==0||s.byteLength!==s.buffer.byteLength)&&(s=new Uint8Array(s)),{vectorTile:a,rawData:s.buffer}}async loadData(r){var i;(i=this._pendingRequest)==null||i.abort();let n=r&&r.request&&r.request.collectResourceTiming?new Wr(r.request):!1;this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(r,this._pendingRequest),this._geoJSONIndex=r.cluster?new zi(d0(r)).load((await this._pendingData).features):ou(await this._pendingData,r.geojsonVtOptions),this.loaded={};let o={};if(n){let a=n.finish();a&&(o.resourceTiming={},o.resourceTiming[r.source]=JSON.parse(JSON.stringify(a)))}return o}catch(o){if(delete this._pendingRequest,zc(o))return{abandoned:!0};throw o}}async getData(){return this._pendingData}reloadTile(r){let n=this.loaded,i=r.uid;return n&&n[i]?super.reloadTile(r):this.loadTile(r)}async loadAndProcessGeoJSON(r,n){let i=await this.loadGeoJSON(r,n);if(delete this._pendingRequest,typeof i!="object")throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."));if((0,qy.default)(i,!0),r.filter){let o=er(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(o.result==="error")throw new Error(o.value.map(s=>"".concat(s.key,": ").concat(s.message)).join(", "));i={type:"FeatureCollection",features:i.features.filter(s=>o.value.evaluate({zoom:0},s))}}return i}async loadGeoJSON(r,n){let{promoteId:i}=r;if(r.request){let o=await Wc(r.request,n);return this._dataUpdateable=au(o.data,i)?su(o.data,i):void 0,o.data}if(typeof r.data=="string")try{let o=JSON.parse(r.data);return this._dataUpdateable=au(o,i)?su(o,i):void 0,o}catch(o){throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."))}if(!r.dataDiff)throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."));if(!this._dataUpdateable)throw new Error("Cannot update existing geojson data in ".concat(r.source));return jy(this._dataUpdateable,r.dataDiff,i),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}async removeSource(r){this._pendingRequest&&this._pendingRequest.abort()}getClusterExpansionZoom(r){return this._geoJSONIndex.getClusterExpansionZoom(r.clusterId)}getClusterChildren(r){return this._geoJSONIndex.getChildren(r.clusterId)}getClusterLeaves(r){return this._geoJSONIndex.getLeaves(r.clusterId,r.limit,r.offset)}};function d0({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;let r={},n={},i={accumulated:null,zoom:0},o={properties:null},a=Object.keys(e);for(let s of a){let[l,u]=e[s],c=er(u),p=er(typeof l=="string"?[l,["accumulated"],["get",s]]:l);r[s]=c.value,n[s]=p.value}return t.map=s=>{o.properties=s;let l={};for(let u of a)l[u]=r[u].evaluate(i,o);return l},t.reduce=(s,l)=>{o.properties=l;for(let u of a)i.accumulated=s[u],s[u]=n[u].evaluate(i,o)},t}var as=class{constructor(e){this.self=e,this.actor=new Eo(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(r,n)=>{if(this.externalWorkerSourceTypes[r])throw new Error(\'Worker source with name "\'.concat(r,\'" already registered.\'));this.externalWorkerSourceTypes[r]=n},this.self.addProtocol=Gc,this.self.removeProtocol=Nc,this.self.registerRTLTextPlugin=r=>{we.setMethods(r)},this.actor.registerMessageHandler("LDT",(r,n)=>this._getDEMWorkerSource(r,n.source).loadTile(n)),this.actor.registerMessageHandler("RDT",async(r,n)=>{this._getDEMWorkerSource(r,n.source).removeTile(n)}),this.actor.registerMessageHandler("GCEZ",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterExpansionZoom(n)),this.actor.registerMessageHandler("GCC",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterChildren(n)),this.actor.registerMessageHandler("GCL",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterLeaves(n)),this.actor.registerMessageHandler("LD",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadData(n)),this.actor.registerMessageHandler("GD",(r,n)=>this._getWorkerSource(r,n.type,n.source).getData()),this.actor.registerMessageHandler("LT",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadTile(n)),this.actor.registerMessageHandler("RT",(r,n)=>this._getWorkerSource(r,n.type,n.source).reloadTile(n)),this.actor.registerMessageHandler("AT",(r,n)=>this._getWorkerSource(r,n.type,n.source).abortTile(n)),this.actor.registerMessageHandler("RMT",(r,n)=>this._getWorkerSource(r,n.type,n.source).removeTile(n)),this.actor.registerMessageHandler("RS",async(r,n)=>{if(!this.workerSources[r]||!this.workerSources[r][n.type]||!this.workerSources[r][n.type][n.source])return;let i=this.workerSources[r][n.type][n.source];delete this.workerSources[r][n.type][n.source],i.removeSource!==void 0&&i.removeSource(n)}),this.actor.registerMessageHandler("RM",async r=>{delete this.layerIndexes[r],delete this.availableImages[r],delete this.workerSources[r],delete this.demWorkerSources[r]}),this.actor.registerMessageHandler("SR",async(r,n)=>{this.referrer=n}),this.actor.registerMessageHandler("SRPS",(r,n)=>this._syncRTLPluginState(r,n)),this.actor.registerMessageHandler("IS",async(r,n)=>{this.self.importScripts(n)}),this.actor.registerMessageHandler("SI",(r,n)=>this._setImages(r,n)),this.actor.registerMessageHandler("UL",async(r,n)=>{this._getLayerIndex(r).update(n.layers,n.removedIds)}),this.actor.registerMessageHandler("SL",async(r,n)=>{this._getLayerIndex(r).replace(n)})}async _setImages(e,r){this.availableImages[e]=r;for(let n in this.workerSources[e]){let i=this.workerSources[e][n];for(let o in i)i[o].availableImages=r}}async _syncRTLPluginState(e,r){return await we.syncState(r,this.self.importScripts)}_getAvailableImages(e){let r=this.availableImages[e];return r||(r=[]),r}_getLayerIndex(e){let r=this.layerIndexes[e];return r||(r=this.layerIndexes[e]=new Na),r}_getWorkerSource(e,r,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][r]||(this.workerSources[e][r]={}),!this.workerSources[e][r][n]){let i={sendAsync:(o,a)=>(o.targetMapId=e,this.actor.sendAsync(o,a))};switch(r){case"vector":this.workerSources[e][r][n]=new Xr(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][r][n]=new os(i,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][r][n]=new this.externalWorkerSourceTypes[r](i,this._getLayerIndex(e),this._getAvailableImages(e));break}}return this.workerSources[e][r][n]}_getDEMWorkerSource(e,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]=new Ja),this.demWorkerSources[e][r]}};at(self)&&(self.worker=new as(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n';var Hz=l(()=>ut.WORKER_URL?ut.WORKER_URL:URL.createObjectURL(new Blob([TT],{type:"text/javascript"})),"getWorkerURL");function ST(){return new Worker(Hz())}l(ST,"workerFactory");var op="maplibre_preloaded_worker_pool",ip=class ip{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<ip.workerCount;)this.workers.push(ST());return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(t=>{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[op]}numActive(){return Object.keys(this.active).length}};l(ip,"WorkerPool");var Ln=ip,Wz=Math.floor(ne.hardwareConcurrency/2);Ln.workerCount=Z0(globalThis)?Math.max(Math.min(Wz,3),1):1;var Cs;function As(){return Cs||(Cs=new Ln),Cs}l(As,"getGlobalWorkerPool");function $z(){As().acquire(op)}l($z,"prewarm");function Xz(){let r=Cs;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(op),Cs=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))}l(Xz,"clearPrewarmedResources");var qg=class qg{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t;let n=this.workerPool.acquire(t);for(let i=0;i<n.length;i++){let o=n[i],a=new np(o,t);a.name="Worker ".concat(i),this.actors.push(a)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){let n=[];for(let i of this.actors)n.push(i.sendAsync({type:e,data:t}));return Promise.all(n)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(t=>{t.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let n of this.actors)n.registerMessageHandler(e,t)}};l(qg,"Dispatcher");var Is=qg,ap;function sp(){return ap||(ap=new Is(As(),Hl),ap.registerMessageHandler("GR",(r,e,t)=>ji(e,t))),ap}l(sp,"getGlobalDispatcher");y();function Yz(r,e){let t=z.create();return z.translate(t,t,[1,1,0]),z.scale(t,t,[r.width*.5,r.height*.5,1]),r.calculatePosMatrix?z.multiply(t,t,r.calculatePosMatrix(e.toUnwrapped())):t}l(Yz,"getPixelPosMatrix");function Kz(r,e,t){if(r)for(let n of r){let i=e[n];if(i&&i.source===t&&i.type==="fill-extrusion")return!0}else for(let n in e){let i=e[n];if(i.source===t&&i.type==="fill-extrusion")return!0}return!1}l(Kz,"queryIncludes3DLayer");function MT(r,e,t,n,i,o,a){var m;let s=Kz((m=i==null?void 0:i.layers)!=null?m:null,e,r.id),u=o.maxPitchScaleFactor(),c=r.tilesIn(n,u,s);c.sort(IT);let p=[];for(let f of c)p.push({wrappedTileID:f.tileID.wrapped().key,queryResults:f.tile.queryRenderedFeatures(e,t,r._state,f.queryGeometry,f.cameraQueryGeometry,f.scale,i,o,u,Yz(r.transform,f.tileID),a?(d,g)=>a(f.tileID,d,g):void 0)});let h=Jz(p);return Qz(h,r)}l(MT,"queryRenderedFeatures");function CT(r,e,t,n,i,o,a){let s={},u=o.queryRenderedSymbols(n),c=[];for(let p of Object.keys(u).map(Number))c.push(a[p]);c.sort(IT);for(let p of c){let h=p.featureIndex.lookupSymbolFeatures(u[p.bucketInstanceId],e,p.bucketIndex,p.sourceLayerIndex,i.filter,i.layers,i.availableImages,r);for(let m in h){let f=s[m]=s[m]||[],d=h[m];d.sort((g,x)=>{let _=p.featureSortOrder;if(_){let b=_.indexOf(g.featureIndex);return _.indexOf(x.featureIndex)-b}else return x.featureIndex-g.featureIndex});for(let g of d)f.push(g)}}return eB(s,r,t)}l(CT,"queryRenderedSymbols");function AT(r,e){let t=r.getRenderableIds().map(o=>r.getTileByID(o)),n=[],i={};for(let o=0;o<t.length;o++){let a=t[o],s=a.tileID.canonical.key;i[s]||(i[s]=!0,a.querySourceFeatures(n,e))}return n}l(AT,"querySourceFeatures");function IT(r,e){let t=r.tileID,n=e.tileID;return t.overscaledZ-n.overscaledZ||t.canonical.y-n.canonical.y||t.wrap-n.wrap||t.canonical.x-n.canonical.x}l(IT,"sortTilesIn");function Jz(r){let e={},t={};for(let n of r){let i=n.queryResults,o=n.wrappedTileID,a=t[o]=t[o]||{};for(let s in i){let u=i[s],c=a[s]=a[s]||{},p=e[s]=e[s]||[];for(let h of u)c[h.featureIndex]||(c[h.featureIndex]=!0,p.push(h))}}return e}l(Jz,"mergeRenderedFeatureLayers");function Qz(r,e){for(let t in r)for(let n of r[t])ET(n,e);return r}l(Qz,"convertFeaturesToMapFeatures");function eB(r,e,t){for(let n in r)for(let i of r[n]){let o=e[n],a=t[o.source];ET(i,a)}return r}l(eB,"convertFeaturesToMapFeaturesMultiple");function ET(r,e){let t=r.feature,n=e.getFeatureState(t.layer["source-layer"],t.id);t.source=t.layer.source,t.layer["source-layer"]&&(t.sourceLayer=t.layer["source-layer"]),t.state=n}l(ET,"convertFeatureToMapFeature");y();y();y();y();async function lp(r,e,t){let n=r;if(r.url?n=(await cn(e.transformRequest(r.url,"Source"),t)).data:await ne.frameAsync(t),!n)return null;let i=Sr(G(n,r),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(i.vectorLayerIds=n.vector_layers.map(o=>o.id)),i}l(lp,"loadTileJson");y();y();y();var Ft=63710088e-1,Si=class Si{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid LngLat object: (".concat(e,", ").concat(t,")"));if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Si(Qt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(e){let t=Math.PI/180,n=this.lat*t,i=e.lat*t,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-this.lng)*t);return Ft*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof Si)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Si(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Si(Number("lng"in e?e.lng:e.lon),Number(e.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>]")}};l(Si,"LngLat");var X=Si;var zr=class zr{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof X?new X(e.lng,e.lat):X.convert(e),this}setSouthWest(e){return this._sw=e instanceof X?new X(e.lng,e.lat):X.convert(e),this}extend(e){let t=this._sw,n=this._ne,i,o;if(e instanceof X)i=e,o=e;else if(e instanceof zr){if(i=e._sw,o=e._ne,!i||!o)return this}else{if(Array.isArray(e))if(e.length===4||e.every(Array.isArray)){let a=e;return this.extend(zr.convert(a))}else{let a=e;return this.extend(X.convert(a))}else if(e&&("lng"in e||"lon"in e)&&"lat"in e)return this.extend(X.convert(e));return this}return!t&&!n?(this._sw=new X(i.lng,i.lat),this._ne=new X(o.lng,o.lat)):(t.lng=Math.min(i.lng,t.lng),t.lat=Math.min(i.lat,t.lat),n.lng=Math.max(o.lng,n.lng),n.lat=Math.max(o.lat,n.lat)),this}getCenter(){return new X((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 X(this.getWest(),this.getNorth())}getSouthEast(){return new X(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(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:t,lat:n}=X.convert(e),i=this._sw.lat<=n&&n<=this._ne.lat,o=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=t&&t>=this._ne.lng),i&&o}static convert(e){return e instanceof zr||!e?e:new zr(e)}static fromLngLat(e,t=0){let i=360*t/40075017,o=i/Math.cos(Math.PI/180*e.lat);return new zr(new X(e.lng-o,e.lat-i),new X(e.lng+o,e.lat+i))}adjustAntiMeridian(){let e=new X(this._sw.lng,this._sw.lat),t=new X(this._ne.lng,this._ne.lat);return e.lng>t.lng?new zr(e,new X(t.lng+360,t.lat)):new zr(e,t)}};l(zr,"LngLatBounds");var ot=zr;y();var LT=2*Math.PI*Ft;function kT(r){return LT*Math.cos(r*Math.PI/180)}l(kT,"circumferenceAtLatitude");function Kr(r){return(180+r)/360}l(Kr,"mercatorXfromLng");function xr(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}l(xr,"mercatorYfromLat");function Br(r,e){return r/kT(e)}l(Br,"mercatorZfromAltitude");function tB(r){return r*360-180}l(tB,"lngFromMercatorX");function Hg(r){let e=180-r*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}l(Hg,"latFromMercatorY");function cp(r,e){return r*kT(Hg(e))}l(cp,"altitudeFromMercatorZ");function rB(r){return 1/Math.cos(r*Math.PI/180)}l(rB,"mercatorScale");var up=class up{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){let n=X.convert(e);return new up(Kr(n.lng),xr(n.lat),Br(t,n.lat))}toLngLat(){return new X(tB(this.x),Hg(this.y))}toAltitude(){return cp(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/LT*rB(Hg(this.y))}};l(up,"MercatorCoordinate");var de=up;var Wg=class Wg{constructor(e,t,n){this.bounds=ot.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=n||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t=Math.pow(2,e.z),n={minX:Math.floor(Kr(this.bounds.getWest())*t),minY:Math.floor(xr(this.bounds.getNorth())*t),maxX:Math.ceil(Kr(this.bounds.getEast())*t),maxY:Math.ceil(xr(this.bounds.getSouth())*t)};return e.x>=n.minX&&e.x<n.maxX&&e.y>=n.minY&&e.y<n.maxY}};l(Wg,"TileBounds");var To=Wg;var $g=class $g extends be{constructor(e,t,n,i){if(super(),this.id=e,this.dispatcher=n,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,G(this,Sr(t,["url","scheme","tileSize","promoteId"])),this._options=G({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(i)}async load(){this._loaded=!1,this.fire(new B("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await lp(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(G(this,e),e.bounds&&(this.tileBounds=new To(e.bounds,this.minzoom,this.maxzoom)),this.fire(new B("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new B("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new J(e))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return G({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};n.request.collectResourceTiming=this._collectResourceTiming;let i="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getActor(),i="LT";else if(e.state==="loading")return new Promise((o,a)=>{e.reloadPromise={resolve:o,reject:a}});e.abortController=new AbortController;try{let o=await e.actor.sendAsync({type:i,data:n},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,o)}catch(o){if(delete e.abortController,e.aborted)return;if(o&&o.status!==404)throw o;this._afterTileLoadWorkerResponse(e,null)}}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){let n=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(n.resolve).catch(n.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}};l($g,"VectorTileSource");var Es=$g;y();var Xg=class Xg extends be{constructor(e,t,n,i){super(),this.id=e,this.dispatcher=n,this.setEventedParent(i),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=G({type:"raster"},t),G(this,Sr(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new B("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let t=await lp(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(G(this,t),t.bounds&&(this.tileBounds=new To(t.bounds,this.minzoom,this.maxzoom)),this.fire(new B("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new B("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this.fire(new J(t))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return G({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let n=await Pt.getImage(this.map._requestManager.transformRequest(t,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(n&&n.data){this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let i=this.map.painter.context,o=i.gl,a=n.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new we(i,a,o.RGBA,{useMipmap:!0}),e.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(n){if(delete e.abortController,e.aborted)e.state="unloaded";else if(n)throw e.state="errored",n}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}};l(Xg,"RasterTileSource");var Mi=Xg;y();y();y();function DT(r,e,t){e=Math.pow(2,t)-e-1;var n=RT(r*256,e*256,t),i=RT((r+1)*256,(e+1)*256,t);return n[0]+","+n[1]+","+i[0]+","+i[1]}l(DT,"getTileBBox");function RT(r,e,t){var n=2*Math.PI*6378137/256/Math.pow(2,t),i=r*n-2*Math.PI*6378137/2,o=e*n-2*Math.PI*6378137/2;return[i,o]}l(RT,"getMercCoords");var BT=oe(ue(),1);y();function FT(r,e,t){return!(r<Jo||r>Yn||t<0||t>=Math.pow(2,r)||e<0||e>=Math.pow(2,r))}l(FT,"isInBoundsForTileZoomXY");function zT(r,e){let{x:t,y:n}=de.fromLngLat(e);return!(r<Jo||r>Yn||n<0||n>=1||t<0||t>=1)}l(zT,"isInBoundsForZoomLngLat");var Yg=class Yg{constructor(e,t,n){if(!FT(e,t,n))throw new Error("x=".concat(t,", y=").concat(n,", z=").concat(e," outside of bounds. 0<=x<").concat(Math.pow(2,e),", 0<=y<").concat(Math.pow(2,e)," ").concat(Jo,"<=z<=").concat(Yn," "));this.z=e,this.x=t,this.y=n,this.key=Ci(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,n){let i=DT(this.x,this.y,this.z),o=nB(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=Math.pow(2,this.z);return new BT.default((e.x*t-this.x)*8192,(e.y*t-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}};l(Yg,"CanonicalTileID");var kn=Yg,Kg=class Kg{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Ci(e,t.z,t.z,t.x,t.y)}};l(Kg,"UnwrappedTileID");var Rn=Kg,qt=class qt{constructor(e,t,n,i,o){this.terrainRttPosMatrix32f=null;if(e<n)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(e,"; z = ").concat(n));this.overscaledZ=e,this.wrap=t,this.canonical=new kn(n,+i,+o),this.key=Ci(t,e,n,i,o)}clone(){return new qt(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let t=this.canonical.z-e;return e>this.canonical.z?new qt(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new qt(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let n=this.canonical.z-e;return e>this.canonical.z?Ci(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Ci(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let t=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new qt(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,n=this.canonical.x*2,i=this.canonical.y*2;return[new qt(t,this.wrap,t,n,i),new qt(t,this.wrap,t,n+1,i),new qt(t,this.wrap,t,n,i+1),new qt(t,this.wrap,t,n+1,i+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new qt(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new qt(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Rn(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(e){return this.canonical.getTilePoint(new de(e.x-this.wrap,e.y))}};l(qt,"OverscaledTileID");var Oe=qt;function Ci(r,e,t,n,i){r*=2,r<0&&(r=r*-1-1);let o=1<<t;return(o*o*r+o*i+n).toString(36)+t.toString(36)+e.toString(36)}l(Ci,"calculateTileKey");function nB(r,e,t){let n="",i;for(let o=r;o>0;o--)i=1<<o-1,n+=(e&i?1:0)+(t&i?2:0);return n}l(nB,"getQuadkey");Z("CanonicalTileID",kn);Z("OverscaledTileID",Oe,{omit:["terrainRttPosMatrix32f"]});var Jg=class Jg extends Mi{constructor(e,t,n,i){super(e,t,n,i),this.type="raster-dem",this.maxzoom=22,this._options=G({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n=this.map._requestManager.transformRequest(t,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let i=await Pt.getImage(n,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(i&&i.data){let o=i.data;this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let s=At(o)&&El()?o:await this.readImageNow(o),u={type:this.type,uid:e.uid,source:this.id,rawImageData:s,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let c=await e.actor.sendAsync({type:"LDT",data:u});e.dem=c,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(i){if(delete e.abortController,e.aborted)e.state="unloaded";else if(i)throw e.state="errored",i}}async readImageNow(e){if(typeof VideoFrame<"u"&&Sm()){let t=e.width+2,n=e.height+2;try{return new Se({width:t,height:n},await W0(e,-1,-1,t,n))}catch(i){}}return ne.getImageData(e,1)}_getNeighboringTiles(e){let t=e.canonical,n=Math.pow(2,t.z),i=(t.x-1+n)%n,o=t.x===0?e.wrap-1:e.wrap,a=(t.x+1+n)%n,s=t.x+1===n?e.wrap+1:e.wrap,u={};return u[new Oe(e.overscaledZ,o,t.z,i,t.y).key]={backfilled:!1},u[new Oe(e.overscaledZ,s,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(u[new Oe(e.overscaledZ,o,t.z,i,t.y-1).key]={backfilled:!1},u[new Oe(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},u[new Oe(e.overscaledZ,s,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<n&&(u[new Oe(e.overscaledZ,o,t.z,i,t.y+1).key]={backfilled:!1},u[new Oe(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},u[new Oe(e.overscaledZ,s,t.z,a,t.y+1).key]={backfilled:!1}),u}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}};l(Jg,"RasterDEMTileSource");var Ls=Jg;y();var Qg=class Qg extends be{constructor(e,t,n,i){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=n.getActor(),this.setEventedParent(i),this._data=t.data,this._options=G({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,t.clusterMaxZoom!==void 0&&this.maxzoom<=t.clusterMaxZoom&&ce('The maxzoom value "'.concat(this.maxzoom,'" is expected to be greater than the clusterMaxZoom value "').concat(t.clusterMaxZoom,'".')),this.workerOptions=G({source:this.id,cluster:t.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(t.buffer!==void 0?t.buffer:128),tolerance:this._pixelsToTileUnits(t.tolerance!==void 0?t.tolerance:.375),extent:8192,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:8192,radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(8192/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||ce("Integer expected for option 'clusterMaxZoom': provided value \"".concat(e,'" rounded to "').concat(t,'"')),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}async getData(){let e=G({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(t=>t.coordinates).flat(1/0):e.coordinates.flat(1/0)}async getBounds(){let e=new ot,t=await this.getData(),n;switch(t.type){case"FeatureCollection":n=t.features.map(i=>this.getCoordinatesFromGeometry(i.geometry)).flat(1/0);break;case"Feature":n=this.getCoordinatesFromGeometry(t.geometry);break;default:n=this.getCoordinatesFromGeometry(t);break}if(n.length==0)return e;for(let i=0;i<n.length-1;i+=2)e.extend([n[i],n[i+1]]);return e}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom))),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,n){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:n}})}async _updateWorkerData(e){let t=G({type:this.type},this.workerOptions);e?t.dataDiff=e:typeof this._data=="string"?(t.request=this.map._requestManager.transformRequest(ne.resolveURL(this._data),"Source"),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new B("dataloading",{dataType:"source"}));try{let n=await this.actor.sendAsync({type:"LD",data:t});if(this._pendingLoads--,this._removed||n.abandoned){this.fire(new B("dataabort",{dataType:"source"}));return}let i=null;n.resourceTiming&&n.resourceTiming[this.id]&&(i=n.resourceTiming[this.id].slice(0));let o={dataType:"source"};this._collectResourceTiming&&i&&i.length>0&&G(o,{resourceTiming:i}),this.fire(new B("data",St($e({},o),{sourceDataType:"metadata"}))),this.fire(new B("data",St($e({},o),{sourceDataType:"content"})))}catch(n){if(this._pendingLoads--,this._removed){this.fire(new B("dataabort",{dataType:"source"}));return}this.fire(new J(n))}}loaded(){return this._pendingLoads===0}async loadTile(e){let t=e.actor?"RT":"LT";e.actor=this.actor;let n={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};e.abortController=new AbortController;let i=await this.actor.sendAsync({type:t,data:n},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(i,this.map.painter,t==="RT")}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return G({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}};l(Qg,"GeoJSONSource");var ks=Qg;y();y();y();var Rs=oe(ue(),1);var Ds=class Ds{constructor(){this.minX=1/0;this.maxX=-1/0;this.minY=1/0;this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let t=new Ds;return t.extend(e(new Rs.default(this.minX,this.minY))),t.extend(e(new Rs.default(this.maxX,this.minY))),t.extend(e(new Rs.default(this.minX,this.maxY))),t.extend(e(new Rs.default(this.maxX,this.maxY))),t}static fromPoints(e){let t=new Ds;for(let n of e)t.extend(n);return t}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}};l(Ds,"Bounds");var ct=Ds;var ex=class ex extends be{constructor(t,n,i,o){super();this.flippedWindingOrder=!1;this.id=t,this.dispatcher=i,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=n}async load(t){this._loaded=!1,this.fire(new B("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let n=await Pt.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new J(n))}}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new B("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;let n=t.map(de.fromLngLat);return this.tileID=iB(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map(i=>this.tileID.getTilePoint(i)._round()),this.flippedWindingOrder=oB(this.tileCoords),this.fire(new B("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let t=this.map.painter.context,n=t.gl;this.texture||(this.texture=new we(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let i=!1;for(let o in this.tiles){let a=this.tiles[o];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new B("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}async loadTile(t){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){let{minX:n,minY:i,maxX:o,maxY:a}=ct.fromPoints(t),s={};for(let u=0;u<=Yn;u++){let c=Math.pow(2,u),p=Math.floor(n*c),h=Math.floor(i*c),m=Math.floor(o*c),f=Math.floor(a*c);s[u]={minTileX:p,minTileY:h,maxTileX:m,maxTileY:f}}return s}};l(ex,"ImageSource");var Ht=ex;function iB(r){let e=ct.fromPoints(r),t=e.width(),n=e.height(),i=Math.max(t,n),o=Math.max(0,Math.floor(-Math.log(i)/Math.LN2)),a=Math.pow(2,o);return new kn(o,Math.floor((e.minX+e.maxX)/2*a),Math.floor((e.minY+e.maxY)/2*a))}l(iB,"getCoordinatesCenterTileID");function oB(r){let e=r[1].x-r[0].x,t=r[1].y-r[0].y,n=r[2].x-r[0].x,i=r[2].y-r[0].y;return e*i-t*n<0}l(oB,"hasWrongWindingOrder");var tx=class tx extends Ht{constructor(e,t,n,i){super(e,t,n,i),this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{let t=await i1(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new J(t))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new J(new N("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(t.start(0)," and ").concat(t.end(0),"-second mark.")))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new we(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let n=!1;for(let i in this.tiles){let o=this.tiles[i];o.state!=="loaded"&&(o.state="loaded",o.texture=this.texture,n=!0)}n&&this.fire(new B("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}};l(tx,"VideoSource");var Fs=tx;y();var rx=class rx extends Ht{constructor(e,t,n,i){super(e,t,n,i),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(o=>!Array.isArray(o)||o.length!==2||o.some(a=>typeof a!="number")))&&this.fire(new J(new N("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new J(new N("sources.".concat(e),null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new J(new N("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas!="string"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new J(new N("sources.".concat(e),null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new J(new N("sources.".concat(e),null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate!==void 0?t.animate:!0}async load(){if(this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()){this.fire(new J(new Error("Canvas dimensions cannot be less than or equal to zero.")));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading()}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let t=this.map.painter.context,n=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new we(t,this.canvas,n.RGBA,{premultiply:!0});let i=!1;for(let o in this.tiles){let a=this.tiles[o];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new B("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};l(rx,"CanvasSource");var zs=rx;var OT={},VT=l((r,e,t,n)=>{let i=UT(e.type),o=new i(r,e,t,n);if(o.id!==r)throw new Error("Expected Source id to be ".concat(r," instead of ").concat(o.id));return o},"create"),UT=l(r=>{switch(r){case"geojson":return ks;case"image":return Ht;case"raster":return Mi;case"raster-dem":return Ls;case"vector":return Es;case"video":return Fs;case"canvas":return zs}return OT[r]},"getSourceType"),aB=l((r,e)=>{OT[r]=e},"setSourceType"),sB=l(async(r,e)=>{if(UT(r))throw new Error('A source type called "'.concat(r,'" already exists.'));aB(r,e)},"addSourceType");y();y();function jT(r,e){let t={};if(!e)return t;for(let n of r){let i=n.layerIds.map(o=>e.getLayer(o)).filter(Boolean);if(i.length!==0){n.layers=i,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(o=>i.filter(a=>a.id===o)[0]));for(let o of i)t[o.id]=n}}return t}l(jT,"deserialize");y();y();var nx=class nx{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let n=e[t];this._stringToNumber[n]=t,this._numberToString[t]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(e," can't be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[e]}};l(nx,"DictionaryCoder");var pp=nx;var GT=oe(fs(),1),ZT=oe(Pg(),1);y();var ix=class ix{constructor(e,t,n,i,o){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=n,e._y=i,this.properties=e.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t==="_geometry"||t==="_vectorTileFeature"||(e[t]=this[t]);return e}};l(ix,"GeoJSONFeature");var So=ix;var ax=class ax{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new pi(8192,16,0),this.grid3D=new pi(8192,16,0),this.featureIndexArray=new Ka,this.promoteId=t}insert(e,t,n,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,i,o);let u=a?this.grid3D:this.grid;for(let c=0;c<t.length;c++){let p=t[c],h=[1/0,1/0,-1/0,-1/0];for(let m=0;m<p.length;m++){let f=p[m];h[0]=Math.min(h[0],f.x),h[1]=Math.min(h[1],f.y),h[2]=Math.max(h[2],f.x),h[3]=Math.max(h[3],f.y)}h[0]<8192&&h[1]<8192&&h[2]>=0&&h[3]>=0&&u.insert(s,h[0],h[1],h[2],h[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new GT.default.VectorTile(new ZT.default(this.rawTileData)).layers,this.sourceLayerCoder=new pp(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,n,i){this.loadVTLayers();let o=e.params,a=8192/e.tileSize/e.scale,s=_n(o.filter),u=e.queryGeometry,c=e.queryPadding*a,p=ct.fromPoints(u),h=this.grid.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c),m=ct.fromPoints(e.cameraQueryGeometry).expandBy(c),f=this.grid3D.query(m.minX,m.minY,m.maxX,m.maxY,(x,_,b,v)=>Nw(e.cameraQueryGeometry,x-c,_-c,b+c,v+c));for(let x of f)h.push(x);h.sort(lB);let d={},g;for(let x=0;x<h.length;x++){let _=h[x];if(_===g)continue;g=_;let b=this.featureIndexArray.get(_),v=null;this.loadMatchingFeature(d,b.bucketIndex,b.sourceLayerIndex,b.featureIndex,s,o.layers,o.availableImages,t,n,i,(w,T,S)=>(v||(v=kt(w)),T.queryIntersectsFeature({queryGeometry:u,feature:w,featureState:S,geometry:v,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return d}loadMatchingFeature(e,t,n,i,o,a,s,u,c,p,h){let m=this.bucketLayerIDs[t];if(a&&!m.some(_=>a.has(_)))return;let f=this.sourceLayerCoder.decode(n),g=this.vtLayers[f].feature(i);if(o.needGeometry){let _=Rt(g,!0);if(!o.filter(new ve(this.tileID.overscaledZ),_,this.tileID.canonical))return}else if(!o.filter(new ve(this.tileID.overscaledZ),g))return;let x=this.getId(g,f);for(let _=0;_<m.length;_++){let b=m[_];if(a&&!a.has(b))continue;let v=u[b];if(!v)continue;let w={};x&&p&&(w=p.getState(v.sourceLayer||"_geojsonTileLayer",x));let T=G({},c[b]);T.paint=NT(T.paint,v.paint,g,w,s),T.layout=NT(T.layout,v.layout,g,w,s);let S=!h||h(g,v,w);if(!S)continue;let A=new So(g,this.z,this.x,this.y,x);A.layer=T;let M=e[b];M===void 0&&(M=e[b]=[]),M.push({featureIndex:i,feature:A,intersectionZ:S})}}lookupSymbolFeatures(e,t,n,i,o,a,s,u){let c={};this.loadVTLayers();let p=_n(o);for(let h of e)this.loadMatchingFeature(c,n,i,h,p,a,s,u,t);return c}hasLayer(e){for(let t of this.bucketLayerIDs)for(let n of t)if(e===n)return!0;return!1}getId(e,t){var i;let n=e.id;if(this.promoteId){let o=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];n=e.properties[o],typeof n=="boolean"&&(n=Number(n)),n===void 0&&((i=e.properties)!=null&&i.cluster)&&this.promoteId&&(n=Number(e.properties.cluster_id))}return n}};l(ax,"FeatureIndex");var ox=ax;Z("FeatureIndex",ox,{omit:["rawTileData","sourceLayerCoder"]});function NT(r,e,t,n,i){return Yo(r,(o,a)=>{let s=e instanceof vn?e.get(a):null;return s&&s.evaluate?s.evaluate(t,n,i):s})}l(NT,"evaluateProperties");function lB(r,e){return e-r}l(lB,"topDownFeatureComparator");y();y();var Bs="RTLPluginLoaded";var ux=class ux extends be{constructor(){super(...arguments);this.status="unavailable";this.url=null;this.dispatcher=sp()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(t,n=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=ne.resolveURL(t),!this.url)throw new Error("requested url ".concat(t," is invalid"));if(this.status==="unavailable")if(n)this.status="deferred",this._syncState(this.status);else return this._requestImport();else if(this.status==="requested")return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new B(Bs))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}};l(ux,"RTLMainThreadPlugin");var lx=ux,sx=null;function Dn(){return sx||(sx=new lx),sx}l(Dn,"rtlMainThreadPluginFactory");var uB=3e4,cx=class cx{constructor(e,t){this.timeAdded=0;this.fadeEndTime=0;this.tileID=e,this.uid=Ul(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,t,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e){this.collisionBoxArray=new qa;return}e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=jT(e.buckets,t==null?void 0:t.style),this.hasSymbolBuckets=!1;for(let i in this.buckets){let o=this.buckets[i];if(o instanceof gr)if(this.hasSymbolBuckets=!0,n)o.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let o=this.buckets[i];if(o instanceof gr&&o.hasRTLText){this.hasRTLText=!0,Dn().lazyLoad();break}}this.queryPadding=0;for(let i in this.buckets){let o=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(i).queryRadius(o))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let n in this.buckets){let i=this.buckets[n];i.uploadPending()&&i.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new we(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new we(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,i,o,a,s,u,c,p,h){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:o,scale:a,tileSize:this.tileSize,pixelPosMatrix:p,transform:u,params:s,queryPadding:this.queryPadding*c,getElevation:h},e,t,n)}querySourceFeatures(e,t){let n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;let i=n.loadVTLayers(),o=t&&t.sourceLayer?t.sourceLayer:"",a=i._geojsonTileLayer||i[o];if(!a)return;let s=_n(t&&t.filter),{z:u,x:c,y:p}=this.tileID.canonical,h={z:u,x:c,y:p};for(let m=0;m<a.length;m++){let f=a.feature(m);if(s.needGeometry){let x=Rt(f,!0);if(!s.filter(new ve(this.tileID.overscaledZ),x,this.tileID.canonical))continue}else if(!s.filter(new ve(this.tileID.overscaledZ),f))continue;let d=n.getId(f,o),g=new So(f,u,c,p,d);g.tile=h,e.push(g)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let n=G0(e.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+n["max-age"]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let n=Date.now(),i=!1;if(this.expirationTime>n)i=!1;else if(!t)i=!0;else if(this.expirationTime<t)i=!0;else{let o=this.expirationTime-t;o?this.expirationTime=n+Math.max(o,uB):i=!0}i?(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(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let n=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!t.style.hasLayer(i))continue;let o=this.buckets[i],a=o.layers[0].sourceLayer||"_geojsonTileLayer",s=n[a],u=e[a];if(!s||!u||Object.keys(u).length===0)continue;o.update(u,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let c=t&&t.style&&t.style.getLayer(i);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(o)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ne.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=ne.now()+e}setDependencies(e,t){let n={};for(let i of t)n[i]=!0;this.dependencies[e]=n}hasDependency(e,t){for(let n of e){let i=this.dependencies[n];if(i){for(let o of t)if(i[o])return!0}}return!1}};l(cx,"Tile");var Mo=cx;y();var px=class px{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,n){let i=e.wrapped().key;this.data[i]===void 0&&(this.data[i]=[]);let o={value:t,timeout:void 0};if(n!==void 0&&(o.timeout=setTimeout(()=>{this.remove(e,o)},n)),this.data[i].push(o),this.order.push(i),this.order.length>this.max){let a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let n=e.wrapped().key,i=t===void 0?0:this.data[n].indexOf(t),o=this.data[n][i];return this.data[n].splice(i,1),o.timeout&&clearTimeout(o.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(o.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(e){let t=[];for(let n in this.data)for(let i of this.data[n])e(i.value)||t.push(i);for(let n of t)this.remove(n.value.tileID,n)}};l(px,"TileCache");var hp=px;var fx=oe(ue(),1);y();var hx=class hx{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,n){let i=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][i]=this.stateChanges[e][i]||{},G(this.stateChanges[e][i],n),this.deletedStates[e]===null){this.deletedStates[e]={};for(let o in this.state[e])o!==i&&(this.deletedStates[e][o]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][i]===null){this.deletedStates[e][i]={};for(let a in this.state[e][i])n[a]||(this.deletedStates[e][i][a]=null)}else for(let a in n)this.deletedStates[e]&&this.deletedStates[e][i]&&this.deletedStates[e][i][a]===null&&delete this.deletedStates[e][i][a]}removeFeatureState(e,t,n){if(this.deletedStates[e]===null)return;let o=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&t!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][n]=null);else if(t!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o]){this.deletedStates[e][o]={};for(n in this.stateChanges[e][o])this.deletedStates[e][o][n]=null}else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,t){let n=String(t),i=this.state[e]||{},o=this.stateChanges[e]||{},a=G({},i[n],o[n]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let s=this.deletedStates[e][t];if(s===null)return{};for(let u in s)delete a[u]}return a}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,t){let n={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let o={};for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]={}),G(this.state[i][a],this.stateChanges[i][a]),o[a]=this.state[i][a];n[i]=o}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let o={};if(this.deletedStates[i]===null)for(let a in this.state[i])o[a]={},this.state[i][a]={};else for(let a in this.deletedStates[i]){if(this.deletedStates[i][a]===null)this.state[i][a]={};else for(let u of Object.keys(this.deletedStates[i][a]))delete this.state[i][a][u];o[a]=this.state[i][a]}n[i]=n[i]||{},G(n[i],o)}if(this.stateChanges={},this.deletedStates={},Object.keys(n).length!==0)for(let i in e)e[i].setFeatureState(n,t)}};l(hx,"SourceFeatureState");var mp=hx;y();y();var qT=oe(ue(),1);var Fn=89.25;function HT(r,e,t){let n=1/(1<<t.z);return new de(r/8192*n+t.x*n,e/8192*n+t.y*n)}l(HT,"tileCoordinatesToMercatorCoordinates");function Wt(r,e){let t=se(e.lat,-wt,wt);return new qT.default(Kr(e.lng)*r,xr(t)*r)}l(Wt,"projectToWorldCoordinates");function zn(r,e){return new de(e.x/r,e.y/r).toLngLat()}l(zn,"unprojectFromWorldCoordinates");function Co(r){return r.cameraToCenterDistance*Math.min(Math.tan(Le(90-r.pitch))*.85,Math.tan(Le(Fn-r.pitch)))}l(Co,"getMercatorHorizon");function fp(r,e){let t=r.canonical,n=e/Ye(t.z),i=t.x+Math.pow(2,t.z)*r.wrap,o=z.identity(new Float64Array(16));return z.translate(o,o,[i*n,t.y*n,0]),z.scale(o,o,[n/8192,n/8192,1]),o}l(fp,"calculateTileMatrix");function Os(r,e,t,n,i){let o=de.fromLngLat(r,e),a=Br(1,r.lat),s=i*a,u=s*Math.cos(Le(t)),c=Math.sqrt(s*s-u*u),p=c*Math.sin(Le(-n)),h=c*Math.cos(Le(-n));return new de(o.x+p,o.y+h,o.z+u)}l(Os,"cameraMercatorCoordinateFromCenterAndRotation");y();function cB(r,e,t){let n=e.intersectsFrustum(r);if(!t||n===0)return n;let i=e.intersectsPlane(t);return i===0?0:n===2&&i===2?2:1}l(cB,"isTileVisible");function WT(r,e,t){let i=0,o=(t-e)/10;for(let a=0;a<10;a++){let s=e+(a+.5)/10*(t-e);i+=o*Math.pow(Math.cos(s),r)}return i}l(WT,"integralOfCosXByP");function dp(r,e){return function(t,n,i,o,a){let s=2*((r-1)/Ze(Math.cos(Le(Fn-a))/Math.cos(Le(Fn)))-1),u=Math.acos(i/o),c=2*WT(s-1,0,Le(a/2)),p=Math.min(Le(Fn),u+Le(a/2)),h=Math.min(p,u-Le(a/2)),m=WT(s-1,h,p),f=Math.atan(n/i),d=Math.hypot(n,i),g=t;return g=g+Ze(o/d/Math.max(.5,Math.cos(Le(a/2)))),g+=s*Ze(Math.cos(f))/2,g-=Ze(Math.max(1,m/c/e))/2,g}}l(dp,"createCalculateTileZoomFunction");var pB=9.314,hB=3,mB=dp(pB,hB);function Ai(r,e){let t=(e.roundZoom?Math.round:Math.floor)(r.zoom+Ze(r.tileSize/e.tileSize));return Math.max(0,t)}l(Ai,"coveringZoomLevel");function Bn(r,e){let t=r.getCameraFrustum(),n=r.getClippingPlane(),i=r.screenPointToMercatorCoordinate(r.getCameraPoint()),o=de.fromLngLat(r.center,r.elevation);i.z=o.z+Math.cos(r.pitchInRadians)*r.cameraToCenterDistance/r.worldSize;let a=r.getCoveringTilesDetailsProvider(),s=a.allowVariableZoom(r,e),u=Ai(r,e),c=e.minzoom||0,p=e.maxzoom!==void 0?e.maxzoom:r.maxZoom,h=Math.min(Math.max(0,u),p),m=Math.pow(2,h),f=[m*i.x,m*i.y,0],d=[m*o.x,m*o.y,0],g=Math.hypot(o.x-i.x,o.y-i.y),x=Math.abs(o.z-i.z),_=Math.hypot(g,x),b=l(T=>({zoom:0,x:0,y:0,wrap:T,fullyVisible:!1}),"newRootTile"),v=[],w=[];if(r.renderWorldCopies&&a.allowWorldCopies())for(let T=1;T<=3;T++)v.push(b(-T)),v.push(b(T));for(v.push(b(0));v.length>0;){let T=v.pop(),S=T.x,A=T.y,M=T.fullyVisible,I={x:S,y:A,z:T.zoom},L=a.getTileBoundingVolume(I,T.wrap,r.elevation,e);if(!M){let C=cB(t,L,n);if(C===0)continue;M=C===2}let D=a.distanceToTile2d(i.x,i.y,I,L),F=u;s&&(F=(e.calculateTileZoom||mB)(r.zoom+Ze(r.tileSize/e.tileSize),D,x,_,r.fov)),F=(e.roundZoom?Math.round:Math.floor)(F),F=Math.max(0,F);let U=Math.min(F,p);if(T.wrap=a.getWrap(o,I,T.wrap),T.zoom>=U){if(T.zoom<c)continue;let C=h-T.zoom,k=f[0]-.5-(S<<C),H=f[1]-.5-(A<<C),$=e.reparseOverscaled?Math.max(T.zoom,F):T.zoom;w.push({tileID:new Oe(T.zoom===p?$:T.zoom,T.wrap,T.zoom,S,A),distanceSq:lt.sqrLen([d[0]-.5-S,d[1]-.5-A]),tileDistanceToCamera:Math.sqrt(k*k+H*H)});continue}for(let C=0;C<4;C++){let k=(S<<1)+C%2,H=(A<<1)+(C>>1),$=T.zoom+1;v.push({zoom:$,x:k,y:H,wrap:T.wrap,fullyVisible:M})}}return w.sort((T,S)=>T.distanceSq-S.distanceSq).map(T=>T.tileID)}l(Bn,"coveringTiles");y();var mx=oe(ue(),1);var XT=ct.fromPoints([new mx.default(0,0),new mx.default(8192,8192)]);var Ii=class Ii extends be{constructor(e,t,n){super(),this.id=e,this.dispatcher=n,this.on("data",i=>this._dataHandler(i)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=VT(e,t,n,this),this._tiles={},this._cache=new hp(0,i=>this._unloadTile(i)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new mp,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let e in this._tiles){let t=this._tiles[e];if(t.state!=="loaded"&&t.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(e,t,n){try{await this._source.loadTile(e),this._tileLoaded(e,t,n)}catch(i){e.state="errored",i.status!==404?this._source.fire(new J(i,{tile:e})):this.update(this.transform,this.terrain)}}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new B("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let t in this._tiles){let n=this._tiles[t];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(YT).map(e=>e.key)}getRenderableIds(e){let t=[];for(let n in this._tiles)this._isIdRenderable(n,e)&&t.push(this._tiles[n]);return e?t.sort((n,i)=>{let o=n.tileID,a=i.tileID,s=new fx.default(o.canonical.x,o.canonical.y)._rotate(-this.transform.bearingInRadians),u=new fx.default(a.canonical.x,a.canonical.y)._rotate(-this.transform.bearingInRadians);return o.overscaledZ-a.overscaledZ||u.y-s.y||u.x-s.x}).map(n=>n.tileID.key):t.map(n=>n.tileID).sort(YT).map(n=>n.key)}hasRenderableParent(e){let t=this.findLoadedParent(e,0);return t?this._isIdRenderable(t.tileID.key):!1}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(e){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let t in this._tiles)e?this._reloadTile(t,"expired"):this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}async _reloadTile(e,t){let n=this._tiles[e];n&&(n.state!=="loading"&&(n.state=t),await this._loadTile(n,e,t))}_tileLoaded(e,t,n){e.timeAdded=ne.now(),n==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new B("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let t=this.getRenderableIds();for(let i=0;i<t.length;i++){let o=t[i];if(e.neighboringTiles&&e.neighboringTiles[o]){let a=this.getTileByID(o);n(e,a),n(a,e)}}function n(i,o){i.needsHillshadePrepare=!0,i.needsTerrainPrepare=!0;let a=o.tileID.canonical.x-i.tileID.canonical.x,s=o.tileID.canonical.y-i.tileID.canonical.y,u=Math.pow(2,i.tileID.canonical.z),c=o.tileID.key;a===0&&s===0||Math.abs(s)>1||(Math.abs(a)>1&&(Math.abs(a+u)===1?a+=u:Math.abs(a-u)===1&&(a-=u)),!(!o.dem||!i.dem)&&(i.dem.backfillBorder(o.dem,a,s),i.neighboringTiles&&i.neighboringTiles[c]&&(i.neighboringTiles[c].backfilled=!0)))}l(n,"fillBorder")}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,n,i){for(let o in this._tiles){let a=this._tiles[o];if(i[o]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>n)continue;let s=a.tileID;for(;a&&a.tileID.overscaledZ>t+1;){let c=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[c.key],a&&a.hasData()&&(s=c)}let u=s;for(;u.overscaledZ>t;)if(u=u.scaledTo(u.overscaledZ-1),e[u.key]||e[u.canonical.key]){i[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){let n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=t?n:null}for(let n=e.overscaledZ-1;n>=t;n--){let i=e.scaledTo(n),o=this._getLoadedTile(i);if(o)return o}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let t=Math.ceil(e.width/this._source.tileSize)+1,n=Math.ceil(e.height/this._source.tileSize)+1,i=t*n,o=this._maxTileCacheZoomLevels===null?ut.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,a=Math.floor(i*o),s=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(s)}handleWrapJump(e){let t=this._prevLng===void 0?e:this._prevLng,i=(e-t)/360,o=Math.round(i);if(this._prevLng=e,o){let a={};for(let s in this._tiles){let u=this._tiles[s];u.tileID=u.tileID.unwrapTo(u.tileID.wrap+o),a[u.tileID.key]=u}this._tiles=a;for(let s in this._timers)clearTimeout(this._timers[s]),delete this._timers[s];for(let s in this._tiles){let u=this._tiles[s];this._setTileReloadTimer(s,u)}}}_updateCoveredAndRetainedTiles(e,t,n,i,o,a){let s={},u={},c=Object.keys(e),p=ne.now();for(let h of c){let m=e[h],f=this._tiles[h];if(!f||f.fadeEndTime!==0&&f.fadeEndTime<=p)continue;let d=this.findLoadedParent(m,t),g=this.findLoadedSibling(m),x=d||g||null;x&&(this._addTile(x.tileID),s[x.tileID.key]=x.tileID),u[h]=m}this._retainLoadedChildren(u,i,n,e);for(let h in s)e[h]||(this._coveredTiles[h]=!0,e[h]=s[h]);if(a){let h={},m={};for(let f of o)this._tiles[f.key].hasData()?h[f.key]=f:m[f.key]=f;for(let f in m){let d=m[f].children(this._source.maxzoom);this._tiles[d[0].key]&&this._tiles[d[1].key]&&this._tiles[d[2].key]&&this._tiles[d[3].key]&&(h[d[0].key]=e[d[0].key]=d[0],h[d[1].key]=e[d[1].key]=d[1],h[d[2].key]=e[d[2].key]=d[2],h[d[3].key]=e[d[3].key]=d[3],delete m[f])}for(let f in m){let d=m[f],g=this.findLoadedParent(d,this._source.minzoom),x=this.findLoadedSibling(d),_=g||x||null;if(_){h[_.tileID.key]=e[_.tileID.key]=_.tileID;for(let b in h)h[b].isChildOf(_.tileID)&&delete h[b]}}for(let f in this._tiles)h[f]||(this._coveredTiles[f]=!0)}}update(e,t){if(!this._sourceLoaded||this._paused)return;this.transform=e,this.terrain=t,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};let n;!this.used&&!this.usedForTerrain?n=[]:this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(p=>new Oe(p.canonical.z,p.wrap,p.canonical.z,p.canonical.x,p.canonical.y)):(n=Bn(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this.usedForTerrain?!1:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:t,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(n=n.filter(p=>this._source.hasTile(p))));let i=Ai(e,this._source),o=Math.max(i-Ii.maxOverzooming,this._source.minzoom),a=Math.max(i+Ii.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let p={};for(let h of n)if(h.canonical.z>this._source.minzoom){let m=h.scaledTo(h.canonical.z-1);p[m.key]=m;let f=h.scaledTo(Math.max(this._source.minzoom,Math.min(h.canonical.z,5)));p[f.key]=f}n=n.concat(Object.values(p))}let s=n.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new B("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let u=this._updateRetainedTiles(n,i);KT(this._source.type)&&this._updateCoveredAndRetainedTiles(u,o,a,i,n,t);for(let p in u)this._tiles[p].clearFadeHold();let c=O0(this._tiles,u);for(let p of c){let h=this._tiles[p];h.hasSymbolBuckets&&!h.holdingForFade()?h.setHoldDuration(this.map._fadeDuration):(!h.hasSymbolBuckets||h.symbolFadeFinished())&&this._removeTile(p)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){var u;let n={},i={},o=Math.max(t-Ii.maxOverzooming,this._source.minzoom),a=Math.max(t+Ii.maxUnderzooming,this._source.minzoom),s={};for(let c of e){let p=this._addTile(c);n[c.key]=c,!p.hasData()&&t<this._source.maxzoom&&(s[c.key]=c)}this._retainLoadedChildren(s,t,a,n);for(let c of e){let p=this._tiles[c.key];if(p.hasData())continue;if(t+1>this._source.maxzoom){let m=c.children(this._source.maxzoom)[0],f=this.getTile(m);if(f&&f.hasData()){n[m.key]=m;continue}}else{let m=c.children(this._source.maxzoom);if(n[m[0].key]&&n[m[1].key]&&n[m[2].key]&&n[m[3].key])continue}let h=p.wasRequested();for(let m=c.overscaledZ-1;m>=o;--m){let f=c.scaledTo(m);if(i[f.key])break;if(i[f.key]=!0,p=this.getTile(f),!p&&h&&(p=this._addTile(f)),p){let d=p.hasData();if((d||!((u=this.map)!=null&&u.cancelPendingTileRequestsWhileZooming)||h)&&(n[f.key]=f),h=p.wasRequested(),d)break}}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let t=[],n,i=this._tiles[e].tileID;for(;i.overscaledZ>0;){if(i.key in this._loadedParentTiles){n=this._loadedParentTiles[i.key];break}t.push(i.key);let o=i.scaledTo(i.overscaledZ-1);if(n=this._getLoadedTile(o),n)break;i=o}for(let o of t)this._loadedParentTiles[o]=n}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let e in this._tiles){let t=this._tiles[e].tileID,n=this._getLoadedTile(t);this._loadedSiblingTiles[t.key]=n}}_addTile(e){let t=this._tiles[e.key];if(t)return t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));let n=t;return t||(t=new Mo(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,e.key,t.state)),t.uses++,this._tiles[e.key]=t,n||this._source.fire(new B("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},n))}refreshTiles(e){for(let t in this._tiles)!this._isIdRenderable(t)&&this._tiles[t].state!="errored"||e.some(n=>n.equals(this._tiles[t].tileID.canonical))&&this._reloadTile(t,"expired")}_removeTile(e){let t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(t.uses>0)&&(t.hasData()&&t.state!=="reloading"?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){let t=e.sourceDataType;e.dataType==="source"&&t==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&t==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,t,n){let i=[],o=this.transform;if(!o)return i;let a=o.getCoveringTilesDetailsProvider().allowWorldCopies(),s=n?o.getCameraQueryGeometry(e):e,u=l(f=>o.screenPointToMercatorCoordinate(f,this.terrain),"project"),c=this.transformBbox(e,u,!a),p=this.transformBbox(s,u,!a),h=this.getIds(),m=ct.fromPoints(p);for(let f=0;f<h.length;f++){let d=this._tiles[h[f]];if(d.holdingForFade())continue;let g=a?[d.tileID]:[d.tileID.unwrapTo(-1),d.tileID.unwrapTo(0)],x=Math.pow(2,o.zoom-d.tileID.overscaledZ),_=t*d.queryPadding*8192/d.tileSize/x;for(let b of g){let v=m.map(w=>b.getTilePoint(new de(w.x,w.y)));if(v.expandBy(_),v.intersects(XT)){let w=c.map(S=>b.getTilePoint(S)),T=p.map(S=>b.getTilePoint(S));i.push({tile:d,tileID:a?b:b.unwrapTo(0),queryGeometry:w,cameraQueryGeometry:T,scale:x})}}}return i}transformBbox(e,t,n){let i=e.map(t);if(n){let o=ct.fromPoints(e);o.shrinkBy(Math.min(o.width(),o.height())*.001);let a=o.map(t);ct.fromPoints(i).covers(a)||(i=i.map(u=>u.x>.5?new de(u.x-1,u.y,u.z):u))}return i}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(n=>this._tiles[n].tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){if(this._source.hasTransition())return!0;if(KT(this._source.type)){let e=ne.now();for(let t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,n){e=e||"_geojsonTileLayer",this._state.updateState(e,t,n)}removeFeatureState(e,t,n){e=e||"_geojsonTileLayer",this._state.removeFeatureState(e,t,n)}getFeatureState(e,t){return e=e||"_geojsonTileLayer",this._state.getState(e,t)}setDependencies(e,t,n){let i=this._tiles[e];i&&i.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(let n in this._tiles)this._tiles[n].hasDependency(e,t)&&this._reloadTile(n,"reloading");this._cache.filter(n=>!n.hasDependency(e,t))}};l(Ii,"SourceCache");var Jr=Ii;Jr.maxOverzooming=10;Jr.maxUnderzooming=3;function YT(r,e){let t=Math.abs(r.wrap*2)-+(r.wrap<0),n=Math.abs(e.wrap*2)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||n-t||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x}l(YT,"compareTileId");function KT(r){return r==="raster"||r==="image"||r==="video"}l(KT,"isRasterType");y();y();y();var _r=oe(ue(),1);y();var Qr=oe(ue(),1);function dx(r,e,t,n,i){let o=[];for(let a=0;a<r.length;a++){let s=r[a],u;for(let c=0;c<s.length-1;c++){let p=s[c],h=s[c+1];p.x<e&&h.x<e||(p.x<e?p=new Qr.default(e,p.y+(h.y-p.y)*((e-p.x)/(h.x-p.x)))._round():h.x<e&&(h=new Qr.default(e,p.y+(h.y-p.y)*((e-p.x)/(h.x-p.x)))._round()),!(p.y<t&&h.y<t)&&(p.y<t?p=new Qr.default(p.x+(h.x-p.x)*((t-p.y)/(h.y-p.y)),t)._round():h.y<t&&(h=new Qr.default(p.x+(h.x-p.x)*((t-p.y)/(h.y-p.y)),t)._round()),!(p.x>=n&&h.x>=n)&&(p.x>=n?p=new Qr.default(n,p.y+(h.y-p.y)*((n-p.x)/(h.x-p.x)))._round():h.x>=n&&(h=new Qr.default(n,p.y+(h.y-p.y)*((n-p.x)/(h.x-p.x)))._round()),!(p.y>=i&&h.y>=i)&&(p.y>=i?p=new Qr.default(p.x+(h.x-p.x)*((i-p.y)/(h.y-p.y)),i)._round():h.y>=i&&(h=new Qr.default(p.x+(h.x-p.x)*((i-p.y)/(h.y-p.y)),i)._round()),(!u||!p.equals(u[u.length-1]))&&(u=[p],o.push(u)),u.push(h)))))}}return o}l(dx,"clipLine");y();var yx=class yx{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let n=1;n<this.points.length;n++)this._distances[n]=this._distances[n-1]+this.points[n].dist(this.points[n-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=se(e,0,1);let t=1,n=this._distances[t],i=e*this.paddedLength+this.padding;for(;n<i&&t<this._distances.length;)n=this._distances[++t];let o=t-1,a=this._distances[o],s=n-a,u=s>0?(i-a)/s:0;return this.points[o].mult(1-u).add(this.points[t].mult(u))}};l(yx,"PathInterpolator");var yp=yx;y();function gp(r,e){let t=!0;return r==="always"||(r==="never"||e==="never")&&(t=!1),t}l(gp,"overlapAllowed");var gx=class gx{constructor(e,t,n){let i=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let a=0;a<this.xCellCount*this.yCellCount;a++)i.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,i,o){this._forEachCell(t,n,i,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}insertCircle(e,t,n,i){this._forEachCell(t-i,n-i,t+i,n+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(i)}_insertBoxCell(e,t,n,i,o,a){this.boxCells[o].push(a)}_insertCircleCell(e,t,n,i,o,a){this.circleCells[o].push(a)}_query(e,t,n,i,o,a,s){if(n<0||e>this.width||i<0||t>this.height)return[];let u=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=i){if(o)return[{key:null,x1:e,y1:t,x2:n,y2:i}];for(let c=0;c<this.boxKeys.length;c++)u.push({key:this.boxKeys[c],x1:this.bboxes[c*4],y1:this.bboxes[c*4+1],x2:this.bboxes[c*4+2],y2:this.bboxes[c*4+3]});for(let c=0;c<this.circleKeys.length;c++){let p=this.circles[c*3],h=this.circles[c*3+1],m=this.circles[c*3+2];u.push({key:this.circleKeys[c],x1:p-m,y1:h-m,x2:p+m,y2:h+m})}}else{let c={hitTest:o,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,n,i,this._queryCell,u,c,s)}return u}query(e,t,n,i){return this._query(e,t,n,i,!1,null)}hitTest(e,t,n,i,o,a){return this._query(e,t,n,i,!0,o,a).length>0}hitTestCircle(e,t,n,i,o){let a=e-n,s=e+n,u=t-n,c=t+n;if(s<0||a>this.width||c<0||u>this.height)return!1;let p=[],h={hitTest:!0,overlapMode:i,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}};return this._forEachCell(a,u,s,c,this._queryCellCircle,p,h,o),p.length>0}_queryCell(e,t,n,i,o,a,s,u){let{seenUids:c,hitTest:p,overlapMode:h}=s,m=this.boxCells[o];if(m!==null){let d=this.bboxes;for(let g of m)if(!c.box[g]){c.box[g]=!0;let x=g*4,_=this.boxKeys[g];if(e<=d[x+2]&&t<=d[x+3]&&n>=d[x+0]&&i>=d[x+1]&&(!u||u(_))&&(!p||!gp(h,_.overlapMode))&&(a.push({key:_,x1:d[x],y1:d[x+1],x2:d[x+2],y2:d[x+3]}),p))return!0}}let f=this.circleCells[o];if(f!==null){let d=this.circles;for(let g of f)if(!c.circle[g]){c.circle[g]=!0;let x=g*3,_=this.circleKeys[g];if(this._circleAndRectCollide(d[x],d[x+1],d[x+2],e,t,n,i)&&(!u||u(_))&&(!p||!gp(h,_.overlapMode))){let b=d[x],v=d[x+1],w=d[x+2];if(a.push({key:_,x1:b-w,y1:v-w,x2:b+w,y2:v+w}),p)return!0}}}return!1}_queryCellCircle(e,t,n,i,o,a,s,u){let{circle:c,seenUids:p,overlapMode:h}=s,m=this.boxCells[o];if(m!==null){let d=this.bboxes;for(let g of m)if(!p.box[g]){p.box[g]=!0;let x=g*4,_=this.boxKeys[g];if(this._circleAndRectCollide(c.x,c.y,c.radius,d[x+0],d[x+1],d[x+2],d[x+3])&&(!u||u(_))&&!gp(h,_.overlapMode))return a.push(!0),!0}}let f=this.circleCells[o];if(f!==null){let d=this.circles;for(let g of f)if(!p.circle[g]){p.circle[g]=!0;let x=g*3,_=this.circleKeys[g];if(this._circlesCollide(d[x],d[x+1],d[x+2],c.x,c.y,c.radius)&&(!u||u(_))&&!gp(h,_.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,n,i,o,a,s,u){let c=this._convertToXCellCoord(e),p=this._convertToYCellCoord(t),h=this._convertToXCellCoord(n),m=this._convertToYCellCoord(i);for(let f=c;f<=h;f++)for(let d=p;d<=m;d++){let g=this.xCellCount*d+f;if(o.call(this,e,t,n,i,g,a,s,u))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,i,o,a){let s=i-e,u=o-t,c=n+a;return c*c>s*s+u*u}_circleAndRectCollide(e,t,n,i,o,a,s){let u=(a-i)/2,c=Math.abs(e-(i+u));if(c>u+n)return!1;let p=(s-o)/2,h=Math.abs(t-(o+p));if(h>p+n)return!1;if(c<=u||h<=p)return!0;let m=c-u,f=h-p;return m*m+f*f<=n*n}};l(gx,"GridIndex");var Vs=gx;y();var Ao=oe(ue(),1);function Us(r,e,t){let n=z.create();if(!r){let{vecSouth:i,vecEast:o}=bp(e),a=an.create();a[0]=o[0],a[1]=o[1],a[2]=i[0],a[3]=i[1],an.invert(a,a),n[0]=a[0],n[1]=a[1],n[4]=a[2],n[5]=a[3]}return z.scale(n,n,[1/t,1/t,1]),n}l(Us,"getPitchedLabelPlaneMatrix");function eS(r,e,t,n){if(r){let i=z.create();if(!e){let{vecSouth:o,vecEast:a}=bp(t);i[0]=a[0],i[1]=a[1],i[4]=o[0],i[5]=o[1]}return z.scale(i,i,[n,n,1]),i}else return t.pixelsToClipSpaceMatrix}l(eS,"getGlCoordMatrix");function bp(r){let e=Math.cos(r.rollInRadians),t=Math.sin(r.rollInRadians),n=Math.cos(r.pitchInRadians),i=Math.cos(r.bearingInRadians),o=Math.sin(r.bearingInRadians),a=lt.create();a[0]=-i*n*t-o*e,a[1]=-o*n*t+i*e;let s=lt.length(a);s<1e-9?lt.zero(a):lt.scale(a,a,1/s);let u=lt.create();u[0]=i*n*e-o*t,u[1]=o*n*e+i*t;let c=lt.length(u);return c<1e-9?lt.zero(u):lt.scale(u,u,1/c),{vecEast:u,vecSouth:a}}l(bp,"getTileSkewVectors");function vp(r,e,t,n){let i;n?(i=[r,e,n(r,e),1],Re.transformMat4(i,i,t)):(i=[r,e,0,1],js(i,i,t));let o=i[3];return{point:new Ao.default(i[0]/o,i[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}l(vp,"projectWithMatrix");function bx(r,e){return .5+.5*(r/e)}l(bx,"getPerspectiveRatio");function fB(r,e){return r.x>=-e[0]&&r.x<=e[0]&&r.y>=-e[1]&&r.y<=e[1]}l(fB,"isVisible");function tS(r,e,t,n,i,o,a,s,u,c,p,h,m){let f=t?r.textSizeData:r.iconSizeData,d=wi(f,e.transform.zoom),g=[256/e.width*2+1,256/e.height*2+1],x=t?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;x.clear();let _=r.lineVertexArray,b=t?r.text.placedSymbolArray:r.icon.placedSymbolArray,v=e.transform.width/e.transform.height,w=!1;for(let T=0;T<b.length;T++){let S=b.get(T);if(S.hidden||S.writingMode===2&&!w){Ei(S.numGlyphs,x);continue}w=!1;let A=new Ao.default(S.anchorX,S.anchorY),I={getElevation:m,pitchedLabelPlaneMatrix:n,lineVertexArray:_,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:A,unwrappedTileID:u,width:c,height:p,translation:h},L=wx(S.anchorX,S.anchorY,I);if(!fB(L.point,g)){Ei(S.numGlyphs,x);continue}let D=L.signedDistanceFromCamera,F=bx(e.transform.cameraToCenterDistance,D),U=vo(f,d,S),C=o?U*e.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,u)/F:U*F,k=QT({projectionContext:I,pitchedLabelPlaneMatrixInverse:i,symbol:S,fontSize:C,flip:!1,keepUpright:a,glyphOffsetArray:r.glyphOffsetArray,dynamicLayoutVertexArray:x,aspectRatio:v,rotateToLine:s});w=k.useVertical,(k.notEnoughRoom||w||k.needsFlipping&&QT({projectionContext:I,pitchedLabelPlaneMatrixInverse:i,symbol:S,fontSize:C,flip:!0,keepUpright:a,glyphOffsetArray:r.glyphOffsetArray,dynamicLayoutVertexArray:x,aspectRatio:v,rotateToLine:s}).notEnoughRoom)&&Ei(S.numGlyphs,x)}t?r.text.dynamicLayoutVertexBuffer.updateData(x):r.icon.dynamicLayoutVertexBuffer.updateData(x)}l(tS,"updateLineLabels");function vx(r,e,t,n,i,o,a,s){let u=o.glyphStartIndex+o.numGlyphs,c=o.lineStartIndex,p=o.lineStartIndex+o.lineLength,h=e.getoffsetX(o.glyphStartIndex),m=e.getoffsetX(u-1),f=_p(r*h,t,n,i,o.segment,c,p,s,a);if(!f)return null;let d=_p(r*m,t,n,i,o.segment,c,p,s,a);return!d||s.projectionCache.anyProjectionOccluded?null:{first:f,last:d}}l(vx,"placeFirstAndLastGlyph");function JT(r,e,t,n){if(r===1){let i=Math.abs(t.y-e.y),o=Math.abs(t.x-e.x)*n;if(i>o)return{useVertical:!0}}return(r===2?e.y<t.y:e.x>t.x)?{needsFlipping:!0}:null}l(JT,"requiresOrientationChange");function QT(r){let{projectionContext:e,pitchedLabelPlaneMatrixInverse:t,symbol:n,fontSize:i,flip:o,keepUpright:a,glyphOffsetArray:s,dynamicLayoutVertexArray:u,aspectRatio:c,rotateToLine:p}=r,h=i/24,m=n.lineOffsetX*h,f=n.lineOffsetY*h,d;if(n.numGlyphs>1){let g=n.glyphStartIndex+n.numGlyphs,x=n.lineStartIndex,_=n.lineStartIndex+n.lineLength,b=vx(h,s,m,f,o,n,p,e);if(!b)return{notEnoughRoom:!0};let v=xp(b.first.point.x,b.first.point.y,e,t),w=xp(b.last.point.x,b.last.point.y,e,t);if(a&&!o){let T=JT(n.writingMode,v,w,c);if(T)return T}d=[b.first];for(let T=n.glyphStartIndex+1;T<g-1;T++){let S=_p(h*s.getoffsetX(T),m,f,o,n.segment,x,_,e,p);if(!S)return{notEnoughRoom:!0};d.push(S)}d.push(b.last)}else{if(a&&!o){let x=On(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,_=n.lineStartIndex+n.segment+1,b=new Ao.default(e.lineVertexArray.getx(_),e.lineVertexArray.gety(_)),v=On(b.x,b.y,e),w=v.signedDistanceFromCamera>0?v.point:rS(e.tileAnchorPoint,b,x,1,e),T=xp(x.x,x.y,e,t),S=xp(w.x,w.y,e,t),A=JT(n.writingMode,T,S,c);if(A)return A}let g=_p(h*s.getoffsetX(n.glyphStartIndex),m,f,o,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,e,p);if(!g||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};d=[g]}for(let g of d)Pi(u,g.point,g.angle);return{}}l(QT,"placeGlyphsAlongLine");function rS(r,e,t,n,i){let o=r.add(r.sub(e)._unit()),a=On(o.x,o.y,i).point,s=t.sub(a);return t.add(s._mult(n/s.mag()))}l(rS,"projectTruncatedLineSegmentToLabelPlane");function xx(r,e,t){let n=e.projectionCache;if(n.projections[r])return n.projections[r];let i=new Ao.default(e.lineVertexArray.getx(r),e.lineVertexArray.gety(r)),o=On(i.x,i.y,e);if(o.signedDistanceFromCamera>0)return n.projections[r]=o.point,n.anyProjectionOccluded=n.anyProjectionOccluded||o.isOccluded,o.point;let a=r-t.direction,s=t.distanceFromAnchor===0?e.tileAnchorPoint:new Ao.default(e.lineVertexArray.getx(a),e.lineVertexArray.gety(a)),u=t.absOffsetX-t.distanceFromAnchor+1;return rS(s,i,t.previousVertex,u,e)}l(xx,"projectLineVertexToLabelPlane");function On(r,e,t){let n=r+t.translation[0],i=e+t.translation[1],o;return t.pitchWithMap?(o=vp(n,i,t.pitchedLabelPlaneMatrix,t.getElevation),o.isOccluded=!1):(o=t.transform.projectTileCoordinates(n,i,t.unwrappedTileID,t.getElevation),o.point.x=(o.point.x*.5+.5)*t.width,o.point.y=(-o.point.y*.5+.5)*t.height),o}l(On,"projectTileCoordinatesToLabelPlane");function xp(r,e,t,n){if(t.pitchWithMap){let i=[r,e,0,1];return Re.transformMat4(i,i,n),t.transform.projectTileCoordinates(i[0]/i[3],i[1]/i[3],t.unwrappedTileID,t.getElevation).point}else return{x:r/t.width*2-1,y:e/t.height*2-1}}l(xp,"projectFromLabelPlaneToClipSpace");function wx(r,e,t){return t.transform.projectTileCoordinates(r,e,t.unwrappedTileID,t.getElevation)}l(wx,"projectTileCoordinatesToClipSpace");function _x(r,e,t){return r._unit()._perp()._mult(e*t)}l(_x,"transformToOffsetNormal");function dB(r,e,t,n,i,o,a,s,u){if(s.projectionCache.offsets[r])return s.projectionCache.offsets[r];let c=t.add(e);if(r+u.direction<n||r+u.direction>=i)return s.projectionCache.offsets[r]=c,c;let p=xx(r+u.direction,s,u),h=_x(p.sub(t),a,u.direction),m=t.add(h),f=p.add(h);return s.projectionCache.offsets[r]=j0(o,c,m,f)||c,s.projectionCache.offsets[r]}l(dB,"findOffsetIntersectionPoint");function _p(r,e,t,n,i,o,a,s,u){let c=n?r-e:r+e,p=c>0?1:-1,h=0;n&&(p*=-1,h=Math.PI),p<0&&(h+=Math.PI);let m=p>0?o+i:o+i+1,f;s.projectionCache.cachedAnchorPoint?f=s.projectionCache.cachedAnchorPoint:(f=On(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=f);let d=f,g=f,x,_,b=0,v=0,w=Math.abs(c),T=[],S;do{if(m+=p,m<o||m>=a)return null;b+=v,g=d,_=x;let L={absOffsetX:w,direction:p,distanceFromAnchor:b,previousVertex:g};if(d=xx(m,s,L),t===0)T.push(g),S=d.sub(g);else{let D,F=d.sub(g);if(F.mag()===0){let U=xx(m+p,s,L);D=_x(U.sub(d),t,p)}else D=_x(F,t,p);_||(_=g.add(D)),x=dB(m,D,d,o,a,_,t,s,L),T.push(_),S=x.sub(_)}v=S.mag()}while(b+v<=w);let A=(w-b)/v,M=S._mult(A)._add(_||g),I=h+Math.atan2(d.y-g.y,d.x-g.x);return T.push(M),{point:M,angle:u?I:0,path:T}}l(_p,"placeGlyphAlongLine");var yB=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ei(r,e){for(let t=0;t<r;t++){let n=e.length;e.resize(n+4),e.float32.set(yB,n*3)}}l(Ei,"hideGlyphs");function js(r,e,t){let n=e[0],i=e[1];return r[0]=t[0]*n+t[4]*i+t[12],r[1]=t[1]*n+t[5]*i+t[13],r[3]=t[3]*n+t[7]*i+t[15],r}l(js,"xyTransformMat4");function nS(r,e){let t=z.create();return z.invert(t,e.pitchedLabelPlaneMatrix),r.map(n=>{let i=vp(n.x,n.y,t,e.getElevation),o=e.transform.projectTileCoordinates(i.point.x,i.point.y,e.unwrappedTileID,e.getElevation);return o.point.x=(o.point.x*.5+.5)*e.width,o.point.y=(-o.point.y*.5+.5)*e.height,o})}l(nS,"projectPathSpecialProjection");function iS(r){let e=0,t=0,n=0,i=0;for(let o=0;o<r.length;o++)r[o].isOccluded?(n=o+1,i=0):(i++,i>t&&(t=i,e=n));return r.slice(e,e+t)}l(iS,"pathSlicedToLongestUnoccluded");var ze=100,Px=class Px{constructor(e,t=new Vs(e.width+2*ze,e.height+2*ze,25),n=new Vs(e.width+2*ze,e.height+2*ze,25)){this.transform=e,this.grid=t,this.ignoredGrid=n,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+ze,this.screenBottomBoundary=e.height+ze,this.gridRightBoundary=e.width+2*ze,this.gridBottomBoundary=e.height+2*ze,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,n,i,o,a,s,u,c,p,h,m){let f=e.anchorPointX+u[0],d=e.anchorPointY+u[1],g=this.projectAndGetPerspectiveRatio(f,d,o,p,m),x=n*g.perspectiveRatio,_;if(!a&&!s){let M=g.x+(h?h.x*x:0),I=g.y+(h?h.y*x:0);_={allPointsOccluded:!1,box:[M+e.x1*x,I+e.y1*x,M+e.x2*x,I+e.y2*x]}}else _=this._projectCollisionBox(e,x,i,o,a,s,u,g,p,h,m);let[b,v,w,T]=_.box,S=a?_.allPointsOccluded:g.isOccluded,A=S;return A||(A=g.perspectiveRatio<this.perspectiveRatioCutoff),A||(A=!this.isInsideGrid(b,v,w,T)),A||t!=="always"&&this.grid.hitTest(b,v,w,T,t,c)?{box:[b,v,w,T],placeable:!1,offscreen:!1,occluded:S}:{box:[b,v,w,T],placeable:!0,offscreen:this.isOffscreen(b,v,w,T),occluded:S}}placeCollisionCircles(e,t,n,i,o,a,s,u,c,p,h,m,f,d){let g=[],x=new _r.default(t.anchorX,t.anchorY),_=this.getPerspectiveRatio(x.x,x.y,a,d),v=(c?o*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,a)/_:o*_)/En,w={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},T=t.lineOffsetX*v,S=t.lineOffsetY*v,A={getElevation:d,pitchedLabelPlaneMatrix:s,lineVertexArray:n,pitchWithMap:c,projectionCache:w,transform:this.transform,tileAnchorPoint:x,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:f},M=vx(v,i,T,S,!1,t,!1,A),I=!1,L=!1,D=!0;if(M){let F=h*.5*_+m,U=new _r.default(-ze,-ze),C=new _r.default(this.screenRightBoundary,this.screenBottomBoundary),k=new yp,H=M.first,$=M.last,K=[];for(let _e=H.path.length-1;_e>=1;_e--)K.push(H.path[_e]);for(let _e=1;_e<$.path.length;_e++)K.push($.path[_e]);let me=F*2.5;if(c){let _e=this.projectPathToScreenSpace(K,A);_e.some(ye=>ye.signedDistanceFromCamera<=0)?K=[]:K=_e.map(ye=>ye.point)}let Ve=[];if(K.length>0){let _e=K[0].clone(),ye=K[0].clone();for(let We=1;We<K.length;We++)_e.x=Math.min(_e.x,K[We].x),_e.y=Math.min(_e.y,K[We].y),ye.x=Math.max(ye.x,K[We].x),ye.y=Math.max(ye.y,K[We].y);_e.x>=U.x&&ye.x<=C.x&&_e.y>=U.y&&ye.y<=C.y?Ve=[K]:ye.x<U.x||_e.x>C.x||ye.y<U.y||_e.y>C.y?Ve=[]:Ve=dx([K],U.x,U.y,C.x,C.y)}for(let _e of Ve){k.reset(_e,F*.25);let ye=0;k.length<=.5*F?ye=1:ye=Math.ceil(k.paddedLength/me)+1;for(let We=0;We<ye;We++){let rt=We/Math.max(ye-1,1),bt=k.lerp(rt),st=bt.x+ze,Yt=bt.y+ze;g.push(st,Yt,F,0);let wr=st-F,on=Yt-F,sr=st+F,Pr=Yt+F;if(D=D&&this.isOffscreen(wr,on,sr,Pr),L=L||this.isInsideGrid(wr,on,sr,Pr),e!=="always"&&this.grid.hitTestCircle(st,Yt,F,e,p)&&(I=!0,!u))return{circles:[],offscreen:!1,collisionDetected:I}}}}return{circles:!u&&I||!L||_<this.perspectiveRatioCutoff?[]:g,offscreen:D,collisionDetected:I}}projectPathToScreenSpace(e,t){let n=nS(e,t);return iS(n)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],n=new ct;for(let h of e){let m=new _r.default(h.x+ze,h.y+ze);n.extend(m),t.push(m)}let{minX:i,minY:o,maxX:a,maxY:s}=n,u=this.grid.query(i,o,a,s).concat(this.ignoredGrid.query(i,o,a,s)),c={},p={};for(let h of u){let m=h.key;if(c[m.bucketInstanceId]===void 0&&(c[m.bucketInstanceId]={}),c[m.bucketInstanceId][m.featureIndex])continue;let f=[new _r.default(h.x1,h.y1),new _r.default(h.x2,h.y1),new _r.default(h.x2,h.y2),new _r.default(h.x1,h.y2)];_c(t,f)&&(c[m.bucketInstanceId][m.featureIndex]=!0,p[m.bucketInstanceId]===void 0&&(p[m.bucketInstanceId]=[]),p[m.bucketInstanceId].push(m.featureIndex))}return p}insertCollisionBox(e,t,n,i,o,a){let s=n?this.ignoredGrid:this.grid,u={bucketInstanceId:i,featureIndex:o,collisionGroupID:a,overlapMode:t};s.insert(u,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,i,o,a){let s=n?this.ignoredGrid:this.grid,u={bucketInstanceId:i,featureIndex:o,collisionGroupID:a,overlapMode:t};for(let c=0;c<e.length;c+=4)s.insertCircle(u,e[c],e[c+1],e[c+2])}projectAndGetPerspectiveRatio(e,t,n,i,o){if(o){let a;i?(a=[e,t,i(e,t),1],Re.transformMat4(a,a,o)):(a=[e,t,0,1],js(a,a,o));let s=a[3];return{x:(a[0]/s+1)/2*this.transform.width+ze,y:(-a[1]/s+1)/2*this.transform.height+ze,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/s),isOccluded:!1,signedDistanceFromCamera:s}}else{let a=this.transform.projectTileCoordinates(e,t,n,i);return{x:(a.point.x+1)/2*this.transform.width+ze,y:(-a.point.y+1)/2*this.transform.height+ze,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera),isOccluded:a.isOccluded,signedDistanceFromCamera:a.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,n,i){let o=this.transform.projectTileCoordinates(e,t,n,i);return .5+.5*(this.transform.cameraToCenterDistance/o.signedDistanceFromCamera)}isOffscreen(e,t,n,i){return n<ze||e>=this.screenRightBoundary||i<ze||t>this.screenBottomBoundary}isInsideGrid(e,t,n,i){return n>=0&&e<this.gridRightBoundary&&i>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=z.identity([]);return z.translate(e,e,[-ze,-ze,0]),e}_projectCollisionBox(e,t,n,i,o,a,s,u,c,p,h){let m=1,f=0,d=0,g=1,x=e.anchorPointX+s[0],_=e.anchorPointY+s[1];if(a&&!o){let C=this.projectAndGetPerspectiveRatio(x+1,_,i,c,h),k=C.x-u.x,H=C.y-u.y,$=Math.atan(H/k)+(k<0?Math.PI:0),K=Math.sin($),me=Math.cos($);m=me,f=K,d=-K,g=me}else if(!a&&o){let C=bp(this.transform);m=C.vecEast[0],f=C.vecEast[1],d=C.vecSouth[0],g=C.vecSouth[1]}let b=u.x,v=u.y,w=t;if(o){b=x,v=_;let C=this.transform.zoom-n.overscaledZ;if(w=Math.pow(2,-C),w*=this.transform.getPitchedTextCorrection(x,_,i),!p){let k=u.signedDistanceFromCamera/this.transform.cameraToCenterDistance,H=se(.5+.5*k,0,4);w*=H}}p&&(b+=m*p.x*w+d*p.y*w,v+=f*p.x*w+g*p.y*w);let T=e.x1*w,S=e.x2*w,A=(T+S)/2,M=e.y1*w,I=e.y2*w,L=(M+I)/2,D=[{offsetX:T,offsetY:M},{offsetX:A,offsetY:M},{offsetX:S,offsetY:M},{offsetX:S,offsetY:L},{offsetX:S,offsetY:I},{offsetX:A,offsetY:I},{offsetX:T,offsetY:I},{offsetX:T,offsetY:L}],F=[];for(let{offsetX:C,offsetY:k}of D)F.push(new _r.default(b+m*C+d*k,v+f*C+g*k));let U=!1;if(o){let C=F.map(k=>this.projectAndGetPerspectiveRatio(k.x,k.y,i,c,h));U=C.some(k=>!k.isOccluded),F=C.map(k=>new _r.default(k.x,k.y))}else U=!0;return{box:B0(F),allPointsOccluded:!U}}};l(Px,"CollisionIndex");var wp=Px;y();y();var oS=oe(ue(),1);var Pp=class Pp extends oS.default{constructor(e,t,n,i){super(e,t),this.angle=n,i!==void 0&&(this.segment=i)}clone(){return new Pp(this.x,this.y,this.angle,this.segment)}};l(Pp,"Anchor");var Ns=Pp;Z("Anchor",Ns);y();y();y();var _B=oe(ue(),1);y();var bB=oe(ue(),1);y();y();var vB=oe(ue(),1);var PB=oe(vy(),1);y();var Gs=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(Gs||{});var wB=Number.POSITIVE_INFINITY;function aS(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}l(aS,"getAnchorJustification");var Mx=oe(ue(),1);var Cx=class Cx{constructor(e,t,n,i){e?this.opacity=Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):this.opacity=i&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}};l(Cx,"OpacityState");var Tp=Cx,Ax=class Ax{constructor(e,t,n,i,o){this.text=new Tp(e?e.text:null,t,n,o),this.icon=new Tp(e?e.icon:null,t,i,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}};l(Ax,"JointOpacityState");var Li=Ax,Ix=class Ix{constructor(e,t,n){this.text=e,this.icon=t,this.skipFade=n}};l(Ix,"JointPlacement");var Sp=Ix,Ex=class Ex{constructor(e,t,n,i,o){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=i,this.tileID=o}};l(Ex,"RetainedQueryData");var Tx=Ex,Lx=class Lx{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:l(n=>n.collisionGroupID===t,"predicate")}}return this.collisionGroups[e]}};l(Lx,"CollisionGroups");var Sx=Lx;function sS(r,e,t,n,i){let{horizontalAlign:o,verticalAlign:a}=jc(r),s=-(o-.5)*e,u=-(a-.5)*t;return new Mx.default(s+n[0]*i,u+n[1]*i)}l(sS,"calculateVariableLayoutShift");var kx=class kx{constructor(e,t,n,i,o){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new wp(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new Sx(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;return t?(n,i)=>t.getElevation(e,n,i):null}getBucketParts(e,t,n,i){let o=n.getBucket(t),a=n.latestFeatureIndex;if(!o||!a||t.id!==o.layerIds[0])return;let s=n.collisionBoxArray,u=o.layers[0].layout,c=o.layers[0].paint,p=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),h=n.tileSize/8192,m=n.tileID.toUnwrapped(),f=u.get("text-rotation-alignment")==="map",d=nt(n,1,this.transform.zoom),g=Ct(this.collisionIndex.transform,n,c.get("text-translate"),c.get("text-translate-anchor")),x=Ct(this.collisionIndex.transform,n,c.get("icon-translate"),c.get("icon-translate-anchor")),_=Us(f,this.transform,d);this.retainedQueryData[o.bucketInstanceId]=new Tx(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,n.tileID);let b={bucket:o,layout:u,translationText:g,translationIcon:x,unwrappedTileID:m,pitchedLabelPlaneMatrix:_,scale:p,textPixelRatio:h,holdingForFade:n.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:wi(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(i)for(let v of o.sortKeyRanges){let{sortKey:w,symbolInstanceStart:T,symbolInstanceEnd:S}=v;e.push({sortKey:w,symbolInstanceStart:T,symbolInstanceEnd:S,parameters:b})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:b})}attemptAnchorPlacement(e,t,n,i,o,a,s,u,c,p,h,m,f,d,g,x,_,b,v,w){let T=Gs[e.textAnchor],S=[e.textOffset0,e.textOffset1],A=sS(T,n,i,S,o),M=this.collisionIndex.placeCollisionBox(t,m,u,c,p,s,a,x,h.predicate,v,A,w);if(!(b&&!this.collisionIndex.placeCollisionBox(b,m,u,c,p,s,a,_,h.predicate,v,A,w).placeable)&&M.placeable){let I;if(this.prevPlacement&&this.prevPlacement.variableOffsets[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID].text&&(I=this.prevPlacement.variableOffsets[f.crossTileID].anchor),f.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[f.crossTileID]={textOffset:S,width:n,height:i,anchor:T,textBoxScale:o,prevAnchor:I},this.markUsedJustification(d,T,f,g),d.allowVerticalPlacement&&(this.markUsedOrientation(d,g,f),this.placedOrientations[f.crossTileID]=g),{shift:A,placedGlyphBoxes:M}}}placeLayerBucketPart(e,t,n){let{bucket:i,layout:o,translationText:a,translationIcon:s,unwrappedTileID:u,pitchedLabelPlaneMatrix:c,textPixelRatio:p,holdingForFade:h,collisionBoxArray:m,partiallyEvaluatedTextSize:f,collisionGroup:d}=e.parameters,g=o.get("text-optional"),x=o.get("icon-optional"),_=wo(o,"text-overlap","text-allow-overlap"),b=_==="always",v=wo(o,"icon-overlap","icon-allow-overlap"),w=v==="always",T=o.get("text-rotation-alignment")==="map",S=o.get("text-pitch-alignment")==="map",A=o.get("icon-text-fit")!=="none",M=o.get("symbol-z-order")==="viewport-y",I=b&&(w||!i.hasIconData()||x),L=w&&(b||!i.hasTextData()||g);!i.collisionArrays&&m&&i.deserializeCollisionBoxes(m);let D=this.retainedQueryData[i.bucketInstanceId].tileID,F=this._getTerrainElevationFunc(D),U=this.transform.getFastPathSimpleProjectionMatrix(D),C=l((k,H,$)=>{var _m,Bi;if(t[k.crossTileID])return;if(h){this.placements[k.crossTileID]=new Sp(!1,!1,!1);return}let K=!1,me=!1,Ve=!0,_e=null,ye={box:null,placeable:!1,offscreen:null,occluded:!1},We={box:null,placeable:!1,offscreen:null},rt=null,bt=null,st=null,Yt=0,wr=0,on=0;H.textFeatureIndex?Yt=H.textFeatureIndex:k.useRuntimeCollisionCircles&&(Yt=k.featureIndex),H.verticalTextFeatureIndex&&(wr=H.verticalTextFeatureIndex);let sr=H.textBox;if(sr){let Tr=l(pt=>{let ur=1;if(i.allowVerticalPlacement&&!pt&&this.prevPlacement){let Vr=this.prevPlacement.placedOrientations[k.crossTileID];Vr&&(this.placedOrientations[k.crossTileID]=Vr,ur=Vr,this.markUsedOrientation(i,ur,k))}return ur},"updatePreviousOrientationIfNotPlaced"),lr=l((pt,ur)=>{if(i.allowVerticalPlacement&&k.numVerticalGlyphVertices>0&&H.verticalTextBox){for(let Vr of i.writingModes)if(Vr===2?(ye=ur(),We=ye):ye=pt(),ye&&ye.placeable)break}else ye=pt()},"placeTextForPlacementModes"),Zn=k.textAnchorOffsetStartIndex,Kt=k.textAnchorOffsetEndIndex;if(Kt===Zn){let pt=l((Go,Al)=>{let dt=this.collisionIndex.placeCollisionBox(Go,_,p,D,u,S,T,a,d.predicate,F,void 0,U);return dt&&dt.placeable&&(this.markUsedOrientation(i,Al,k),this.placedOrientations[k.crossTileID]=Al),dt},"placeBox");lr(l(()=>pt(sr,1),"placeHorizontal"),l(()=>{let Go=H.verticalTextBox;return i.allowVerticalPlacement&&k.numVerticalGlyphVertices>0&&Go?pt(Go,2):{box:null,offscreen:null}},"placeVertical")),Tr(ye&&ye.placeable)}else{let pt=Gs[(Bi=(_m=this.prevPlacement)==null?void 0:_m.variableOffsets[k.crossTileID])==null?void 0:Bi.anchor],ur=l((dt,bm,WC)=>{let $C=dt.x2-dt.x1,XC=dt.y2-dt.y1,YC=k.textBoxScale,KC=A&&v==="never"?bm:null,qn=null,Ov=_==="never"?1:2,Vv="never";pt&&Ov++;for(let vm=0;vm<Ov;vm++){for(let wm=Zn;wm<Kt;wm++){let Uv=i.textAnchorOffsets.get(wm);if(pt&&Uv.textAnchor!==pt)continue;let Pm=this.attemptAnchorPlacement(Uv,dt,$C,XC,YC,T,S,p,D,u,d,Vv,k,i,WC,a,s,KC,F);if(Pm&&(qn=Pm.placedGlyphBoxes,qn&&qn.placeable))return K=!0,_e=Pm.shift,qn}pt?pt=null:Vv=_}return n&&!qn&&(qn={box:this.collisionIndex.placeCollisionBox(sr,"always",p,D,u,S,T,a,d.predicate,F,void 0,U).box,offscreen:!1,placeable:!1,occluded:!1}),qn},"placeBoxForVariableAnchors");lr(l(()=>ur(sr,H.iconBox,1),"placeHorizontal"),l(()=>{let dt=H.verticalTextBox,bm=ye&&ye.placeable;return i.allowVerticalPlacement&&!bm&&k.numVerticalGlyphVertices>0&&dt?ur(dt,H.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}},"placeVertical")),ye&&(K=ye.placeable,Ve=ye.offscreen);let Al=Tr(ye&&ye.placeable);if(!K&&this.prevPlacement){let dt=this.prevPlacement.variableOffsets[k.crossTileID];dt&&(this.variableOffsets[k.crossTileID]=dt,this.markUsedJustification(i,dt.anchor,k,Al))}}}if(rt=ye,K=rt&&rt.placeable,Ve=rt&&rt.offscreen,k.useRuntimeCollisionCircles){let Tr=i.text.placedSymbolArray.get(k.centerJustifiedTextSymbolIndex),lr=vo(i.textSizeData,f,Tr),Zn=o.get("text-padding"),Kt=k.collisionCircleDiameter;bt=this.collisionIndex.placeCollisionCircles(_,Tr,i.lineVertexArray,i.glyphOffsetArray,lr,u,c,n,S,d.predicate,Kt,Zn,a,F),bt.circles.length&&bt.collisionDetected&&!n&&ce("Collisions detected, but collision boxes are not shown"),K=b||bt.circles.length>0&&!bt.collisionDetected,Ve=Ve&&bt.offscreen}if(H.iconFeatureIndex&&(on=H.iconFeatureIndex),H.iconBox){let Tr=l(lr=>this.collisionIndex.placeCollisionBox(lr,v,p,D,u,S,T,s,d.predicate,F,A&&_e?_e:void 0,U),"placeIconFeature");We&&We.placeable&&H.verticalIconBox?(st=Tr(H.verticalIconBox),me=st.placeable):(st=Tr(H.iconBox),me=st.placeable),Ve=Ve&&st.offscreen}let Pr=g||k.numHorizontalGlyphVertices===0&&k.numVerticalGlyphVertices===0,Cl=x||k.numIconVertices===0;!Pr&&!Cl?me=K=me&&K:Cl?Pr||(me=me&&K):K=me&&K;let ym=K&&rt.placeable,gm=me&&st.placeable;if(ym&&(We&&We.placeable&&wr?this.collisionIndex.insertCollisionBox(rt.box,_,o.get("text-ignore-placement"),i.bucketInstanceId,wr,d.ID):this.collisionIndex.insertCollisionBox(rt.box,_,o.get("text-ignore-placement"),i.bucketInstanceId,Yt,d.ID)),gm&&this.collisionIndex.insertCollisionBox(st.box,v,o.get("icon-ignore-placement"),i.bucketInstanceId,on,d.ID),bt&&K&&this.collisionIndex.insertCollisionCircles(bt.circles,_,o.get("text-ignore-placement"),i.bucketInstanceId,Yt,d.ID),n&&this.storeCollisionData(i.bucketInstanceId,$,H,rt,st,bt),k.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(i.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");let zi=(K||I)&&!(rt!=null&&rt.occluded),xm=(me||L)&&!(st!=null&&st.occluded);this.placements[k.crossTileID]=new Sp(zi,xm,Ve||i.justReloaded),t[k.crossTileID]=!0},"placeSymbol");if(M){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let k=i.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let H=k.length-1;H>=0;--H){let $=k[H];C(i.symbolInstances.get($),i.collisionArrays[$],$)}}else for(let k=e.symbolInstanceStart;k<e.symbolInstanceEnd;k++)C(i.symbolInstances.get(k),i.collisionArrays[k],k);i.justReloaded=!1}storeCollisionData(e,t,n,i,o,a){if(n.textBox||n.iconBox){let s;this.collisionBoxArrays.has(e)?s=this.collisionBoxArrays.get(e):(s=new Map,this.collisionBoxArrays.set(e,s));let u;s.has(t)?u=s.get(t):(u={text:null,icon:null},s.set(t,u)),n.textBox&&(u.text=i.box),n.iconBox&&(u.icon=o.box)}if(a){let s=this.collisionCircleArrays[e];s===void 0&&(s=this.collisionCircleArrays[e]=[]);for(let u=0;u<a.circles.length;u+=4)s.push(a.circles[u+0]-ze),s.push(a.circles[u+1]-ze),s.push(a.circles[u+2]),s.push(a.collisionDetected?1:0)}}markUsedJustification(e,t,n,i){let o={left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex},a;i===2?a=n.verticalPlacedTextSymbolIndex:a=o[aS(t)];let s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(let u of s)u>=0&&(a>=0&&u!==a?e.text.placedSymbolArray.get(u).crossTileID=0:e.text.placedSymbolArray.get(u).crossTileID=n.crossTileID)}markUsedOrientation(e,t,n){let i=t===1||t===3?t:0,o=t===2?t:0,a=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(let s of a)e.text.placedSymbolArray.get(s).placedOrientation=i;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let i=t?t.symbolFadeChange(e):1,o=t?t.opacities:{},a=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let u in this.placements){let c=this.placements[u],p=o[u];p?(this.opacities[u]=new Li(p,i,c.text,c.icon),n=n||c.text!==p.text.placed||c.icon!==p.icon.placed):(this.opacities[u]=new Li(null,i,c.text,c.icon,c.skipFade),n=n||c.text||c.icon)}for(let u in o){let c=o[u];if(!this.opacities[u]){let p=new Li(c,i,!1,!1);p.isHidden()||(this.opacities[u]=p,n=n||c.text.placed||c.icon.placed)}}for(let u in a)!this.variableOffsets[u]&&this.opacities[u]&&!this.opacities[u].isHidden()&&(this.variableOffsets[u]=a[u]);for(let u in s)!this.placedOrientations[u]&&this.opacities[u]&&!this.opacities[u].isHidden()&&(this.placedOrientations[u]=s[u]);if(t&&t.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");n?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let n={};for(let i of t){let o=i.getBucket(e);o&&i.latestFeatureIndex&&e.id===o.layerIds[0]&&this.updateBucketOpacities(o,i.tileID,n,i.collisionBoxArray)}}updateBucketOpacities(e,t,n,i){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let o=e.layers[0],a=o.layout,s=new Li(null,0,!1,!1,!0),u=a.get("text-allow-overlap"),c=a.get("icon-allow-overlap"),p=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h=a.get("text-rotation-alignment")==="map",m=a.get("text-pitch-alignment")==="map",f=a.get("icon-text-fit")!=="none",d=new Li(null,0,u&&(c||!e.hasIconData()||a.get("icon-optional")),c&&(u||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let g=l((_,b,v)=>{for(let w=0;w<b/4;w++)_.opacityVertexArray.emplaceBack(v);_.hasVisibleVertices=_.hasVisibleVertices||v!==Zs},"addOpacities"),x=this.collisionBoxArrays.get(e.bucketInstanceId);for(let _=0;_<e.symbolInstances.length;_++){let b=e.symbolInstances.get(_),{numHorizontalGlyphVertices:v,numVerticalGlyphVertices:w,crossTileID:T}=b,S=n[T],A=this.opacities[T];S?A=s:A||(A=d,this.opacities[T]=A),n[T]=!0;let M=v>0||w>0,I=b.numIconVertices>0,L=this.placedOrientations[b.crossTileID],D=L===2,F=L===1||L===3;if(M){let C=uS(A.text),k=D?Zs:C;g(e.text,v,k);let H=F?Zs:C;g(e.text,w,H);let $=A.text.isHidden();[b.rightJustifiedTextSymbolIndex,b.centerJustifiedTextSymbolIndex,b.leftJustifiedTextSymbolIndex].forEach(Ve=>{Ve>=0&&(e.text.placedSymbolArray.get(Ve).hidden=$||D?1:0)}),b.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(b.verticalPlacedTextSymbolIndex).hidden=$||F?1:0);let K=this.variableOffsets[b.crossTileID];K&&this.markUsedJustification(e,K.anchor,b,L);let me=this.placedOrientations[b.crossTileID];me&&(this.markUsedJustification(e,"left",b,me),this.markUsedOrientation(e,me,b))}if(I){let C=uS(A.icon),k=!(f&&b.verticalPlacedIconSymbolIndex&&D);if(b.placedIconSymbolIndex>=0){let H=k?C:Zs;g(e.icon,b.numIconVertices,H),e.icon.placedSymbolArray.get(b.placedIconSymbolIndex).hidden=A.icon.isHidden()}if(b.verticalPlacedIconSymbolIndex>=0){let H=k?Zs:C;g(e.icon,b.numVerticalIconVertices,H),e.icon.placedSymbolArray.get(b.verticalPlacedIconSymbolIndex).hidden=A.icon.isHidden()}}let U=x&&x.has(_)?x.get(_):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let C=e.collisionArrays[_];if(C){let k=new Mx.default(0,0);if(C.textBox||C.verticalTextBox){let H=!0;if(p){let $=this.variableOffsets[T];$?(k=sS($.anchor,$.width,$.height,$.textOffset,$.textBoxScale),h&&k._rotate(m?-this.transform.bearingInRadians:this.transform.bearingInRadians)):H=!1}if(C.textBox||C.verticalTextBox){let $;C.textBox&&($=D),C.verticalTextBox&&($=F),lS(e.textCollisionBox.collisionVertexArray,A.text.placed,!H||$,U.text,k.x,k.y)}}if(C.iconBox||C.verticalIconBox){let H=!!(!F&&C.verticalIconBox),$;C.iconBox&&($=H),C.verticalIconBox&&($=!H),lS(e.iconCollisionBox.collisionVertexArray,A.icon.placed,$,U.icon,f?k.x:0,f?k.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error("bucket.text.opacityVertexArray.length (= ".concat(e.text.opacityVertexArray.length,") !== bucket.text.layoutVertexArray.length (= ").concat(e.text.layoutVertexArray.length,") / 4"));if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error("bucket.icon.opacityVertexArray.length (= ".concat(e.icon.opacityVertexArray.length,") !== bucket.icon.layoutVertexArray.length (= ").concat(e.icon.layoutVertexArray.length,") / 4"));e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let n=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}};l(kx,"Placement");var Mp=kx;function lS(r,e,t,n,i,o){(!n||n.length===0)&&(n=[0,0,0,0]);let a=n[0]-ze,s=n[1]-ze,u=n[2]-ze,c=n[3]-ze;r.emplaceBack(e?1:0,t?1:0,i||0,o||0,a,s),r.emplaceBack(e?1:0,t?1:0,i||0,o||0,u,s),r.emplaceBack(e?1:0,t?1:0,i||0,o||0,u,c),r.emplaceBack(e?1:0,t?1:0,i||0,o||0,a,c)}l(lS,"updateCollisionVertices");var TB=Math.pow(2,25),SB=Math.pow(2,24),MB=Math.pow(2,17),CB=Math.pow(2,16),AB=Math.pow(2,9),IB=Math.pow(2,8),EB=Math.pow(2,1);function uS(r){if(r.opacity===0&&!r.placed)return 0;if(r.opacity===1&&r.placed)return 4294967295;let e=r.placed?1:0,t=Math.floor(r.opacity*127);return t*TB+e*SB+t*MB+e*CB+t*AB+e*IB+t*EB+e}l(uS,"packOpacity");var Zs=0;var Dx=class Dx{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,i,o){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let s=e[this._currentTileIndex];if(t.getBucketParts(a,i,s,this._sortAcrossTiles),this._currentTileIndex++,o())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((s,u)=>s.sortKey-u.sortKey));this._currentPartIndex<a.length;){let s=a[this._currentPartIndex];if(t.placeLayerBucketPart(s,this._seenCrossTileIDs,n),this._currentPartIndex++,o())return!0}return!1}};l(Dx,"LayerPlacement");var Rx=Dx,Fx=class Fx{constructor(e,t,n,i,o,a,s,u){this.placement=new Mp(e,t,a,s,u),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=o,this._done=!1}isDone(){return this._done}continuePlacement(e,t,n){let i=ne.now(),o=l(()=>this._forceFullPlacement?!1:ne.now()-i>2,"shouldPausePlacement");for(;this._currentPlacementIndex>=0;){let a=e[this._currentPlacementIndex],s=t[a],u=this.placement.collisionIndex.transform.zoom;if(s.type==="symbol"&&(!s.minzoom||s.minzoom<=u)&&(!s.maxzoom||s.maxzoom>u)){if(this._inProgressLayer||(this._inProgressLayer=new Rx(s)),this._inProgressLayer.continuePlacement(n[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};l(Fx,"PauseablePlacement");var Cp=Fx;y();y();var cS=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],zx=1,qs=8,Ap=class Ap{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[t,n]=new Uint8Array(e,0,2);if(t!==219)throw new Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(i!==zx)throw new Error("Got v".concat(i," data when expected v").concat(zx,"."));let o=cS[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new Ap(s,a,o,e)}constructor(e,t=64,n=Float64Array,i){if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=cS.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-s%8)%8;if(o<0)throw new Error("Unexpected typed array class: ".concat(n,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,qs,e),this.coords=new this.ArrayType(this.data,qs+s+u,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(qs+a+s+u),this.ids=new this.IndexArrayType(this.data,qs,e),this.coords=new this.ArrayType(this.data,qs+s+u,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(zx<<4)+o]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return Ox(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,u=[0,o.length-1,0],c=[];for(;u.length;){let p=u.pop()||0,h=u.pop()||0,m=u.pop()||0;if(h-m<=s){for(let x=m;x<=h;x++){let _=a[2*x],b=a[2*x+1];_>=e&&_<=n&&b>=t&&b<=i&&c.push(o[x])}continue}let f=m+h>>1,d=a[2*f],g=a[2*f+1];d>=e&&d<=n&&g>=t&&g<=i&&c.push(o[f]),(p===0?e<=d:t<=g)&&(u.push(m),u.push(f-1),u.push(1-p)),(p===0?n>=d:i>=g)&&(u.push(f+1),u.push(h),u.push(1-p))}return c}within(e,t,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:o,nodeSize:a}=this,s=[0,i.length-1,0],u=[],c=n*n;for(;s.length;){let p=s.pop()||0,h=s.pop()||0,m=s.pop()||0;if(h-m<=a){for(let x=m;x<=h;x++)pS(o[2*x],o[2*x+1],e,t)<=c&&u.push(i[x]);continue}let f=m+h>>1,d=o[2*f],g=o[2*f+1];pS(d,g,e,t)<=c&&u.push(i[f]),(p===0?e-n<=d:t-n<=g)&&(s.push(m),s.push(f-1),s.push(1-p)),(p===0?e+n>=d:t+n>=g)&&(s.push(f+1),s.push(h),s.push(1-p))}return u}};l(Ap,"KDBush");var Ws=Ap;function Ox(r,e,t,n,i,o){if(i-n<=t)return;let a=n+i>>1;hS(r,e,a,n,i,o),Ox(r,e,t,n,a-1,1-o),Ox(r,e,t,a+1,i,1-o)}l(Ox,"sort");function hS(r,e,t,n,i,o){for(;i>n;){if(i-n>600){let c=i-n+1,p=t-n+1,h=Math.log(c),m=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*m*(c-m)/c)*(p-c/2<0?-1:1),d=Math.max(n,Math.floor(t-p*m/c+f)),g=Math.min(i,Math.floor(t+(c-p)*m/c+f));hS(r,e,t,d,g,o)}let a=e[2*t+o],s=n,u=i;for(Hs(r,e,n,t),e[2*i+o]>a&&Hs(r,e,n,i);s<u;){for(Hs(r,e,s,u),s++,u--;e[2*s+o]<a;)s++;for(;e[2*u+o]>a;)u--}e[2*n+o]===a?Hs(r,e,n,u):(u++,Hs(r,e,u,i)),u<=t&&(n=u+1),t<=u&&(i=u-1)}}l(hS,"select");function Hs(r,e,t,n){Bx(r,t,n),Bx(e,2*t,2*n),Bx(e,2*t+1,2*n+1)}l(Hs,"swapItem");function Bx(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}l(Bx,"swap");function pS(r,e,t,n){let i=r-t,o=e-n;return i*i+o*o}l(pS,"sqDist");var $s=512/8192/2,LB=128,Nx=class Nx{constructor(e,t,n){this.tileID=e;this.bucketInstanceId=n;this._symbolsByKey={};let i=new Map;for(let o=0;o<t.length;o++){let a=t.get(o),s=a.key,u=i.get(s);u?u.push(a):i.set(s,[a])}for(let[o,a]of i){let s=a.map(p=>({x:Math.floor(p.anchorX*$s),y:Math.floor(p.anchorY*$s)})),u=a.map(p=>p.crossTileID),c={positions:s,crossTileIDs:u};if(c.positions.length>LB){let p=new Ws(c.positions.length,16,Uint16Array);for(let{x:h,y:m}of c.positions)p.add(h,m);p.finish(),delete c.positions,c.index=p}this._symbolsByKey[o]=c}}getScaledCoordinates(e,t){let{x:n,y:i,z:o}=this.tileID.canonical,{x:a,y:s,z:u}=t.canonical,c=u-o,p=$s/Math.pow(2,c),h=(a*8192+e.anchorX)*p,m=(s*8192+e.anchorY)*p,f=n*8192*$s,d=i*8192*$s;return{x:Math.floor(h-f),y:Math.floor(m-d)}}findMatches(e,t,n){let i=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let o=0;o<e.length;o++){let a=e.get(o);if(a.crossTileID)continue;let s=this._symbolsByKey[a.key];if(!s)continue;let u=this.getScaledCoordinates(a,t);if(s.index){let c=s.index.range(u.x-i,u.y-i,u.x+i,u.y+i).sort();for(let p of c){let h=s.crossTileIDs[p];if(!n[h]){n[h]=!0,a.crossTileID=h;break}}}else if(s.positions)for(let c=0;c<s.positions.length;c++){let p=s.positions[c],h=s.crossTileIDs[c];if(Math.abs(p.x-u.x)<=i&&Math.abs(p.y-u.y)<=i&&!n[h]){n[h]=!0,a.crossTileID=h;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}};l(Nx,"TileLayerIndex");var Vx=Nx,Gx=class Gx{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}};l(Gx,"CrossTileIDs");var Ux=Gx,Zx=class Zx{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let n in this.indexes){let i=this.indexes[n],o={};for(let a in i){let s=i[a];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+t),o[s.tileID.key]=s}this.indexes[n]=o}this.lng=e}addBucket(e,t,n){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let o=0;o<t.symbolInstances.length;o++){let a=t.symbolInstances.get(o);a.crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let i=this.usedCrossTileIDs[e.overscaledZ];for(let o in this.indexes){let a=this.indexes[o];if(Number(o)>e.overscaledZ)for(let s in a){let u=a[s];u.tileID.isChildOf(e)&&u.findMatches(t.symbolInstances,e,i)}else{let s=e.scaledTo(Number(o)),u=a[s.key];u&&u.findMatches(t.symbolInstances,e,i)}}for(let o=0;o<t.symbolInstances.length;o++){let a=t.symbolInstances.get(o);a.crossTileID||(a.crossTileID=n.generate(),i[a.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Vx(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let n of t.getCrossTileIDsLists())for(let i of n)delete this.usedCrossTileIDs[e][i]}removeStaleBuckets(e){let t=!1;for(let n in this.indexes){let i=this.indexes[n];for(let o in i)e[i[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,i[o]),delete i[o],t=!0)}return t}};l(Zx,"CrossTileSymbolLayerIndex");var jx=Zx,qx=class qx{constructor(){this.layerIndexes={},this.crossTileIDs=new Ux,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let i=this.layerIndexes[e.id];i===void 0&&(i=this.layerIndexes[e.id]=new jx);let o=!1,a={};i.handleWrapJump(n);for(let s of t){let u=s.getBucket(e);!u||e.id!==u.layerIds[0]||(u.bucketInstanceId||(u.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(s.tileID,u,this.crossTileIDs)&&(o=!0),a[u.bucketInstanceId]=!0)}return i.removeStaleBuckets(a)&&(o=!0),o}pruneUnusedLayers(e){let t={};e.forEach(n=>{t[n]=!0});for(let n in this.layerIndexes)t[n]||delete this.layerIndexes[n]}};l(qx,"CrossTileSymbolIndex");var Io=qx;y();y();y();y();var mS="#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;";y();var fS="#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;";y();var dS="uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var yS="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}";y();var gS="uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var xS="uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}";y();var _S="in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var bS="uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}";y();var Hx="void main() {fragColor=vec4(1.0);}";y();var vS="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}";y();var wS="uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var PS="uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}";y();var TS="uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}";y();var SS="uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}";y();var MS="in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}";y();var CS="in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}";y();var AS="in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}";y();var IS="in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}";y();var ES="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(textureSize(u_elevation_stops,0)[0]);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int num_elevation_stops=textureSize(u_elevation_stops,0)[0];int r=(num_elevation_stops-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(textureSize(u_color_stops,0)[0]);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var LS="uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}";y();var kS="uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}";y();var RS="in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}";y();var DS="in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}";y();var FS="#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var zS="uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}";y();var BS="in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var OS="uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}";y();var VS="uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var US="uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}";y();var jS="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var NS="uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}";y();var GS="in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var ZS="uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}";y();var qS="uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var HS="uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}";y();var WS="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var $S="uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}";y();var XS="uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;switch(u_method){case BASIC:\nbasic_hillshade(deriv);break;case COMBINED:\ncombined_hillshade(deriv);break;case IGOR:\nigor_hillshade(deriv);break;case MULTIDIRECTIONAL:\nmultidirectional_hillshade(deriv);break;case STANDARD:\ndefault:\nstandard_hillshade(deriv);break;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var YS="uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}";y();var KS="uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var JS="\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";y();var QS="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var e2="\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";y();var t2="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var r2="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}";y();var n2="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var i2="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}";y();var o2="uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var a2="uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}";y();var s2="uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var l2="in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}";y();var u2="#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var c2="in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}";y();var p2="#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";y();var h2="in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}";y();var m2="in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}";y();var f2="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}";y();var d2="uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}";y();var y2="in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}";y();var g2="in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}";y();var x2="in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}";y();var _2="in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}";y();var b2="in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}";y();var v2="float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}";y();var w2="#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}";y();var P2="in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}";y();var T2="in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}";y();var S2="uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}";y();var M2="in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}";var zt={prelude:Pe(mS,fS),projectionMercator:Pe("",v2),projectionGlobe:Pe("",w2),background:Pe(dS,yS),backgroundPattern:Pe(gS,xS),circle:Pe(_S,bS),clippingMask:Pe(Hx,vS),heatmap:Pe(wS,PS),heatmapTexture:Pe(TS,SS),collisionBox:Pe(MS,CS),collisionCircle:Pe(AS,IS),colorRelief:Pe(ES,LS),debug:Pe(kS,RS),depth:Pe(Hx,DS),fill:Pe(FS,zS),fillOutline:Pe(BS,OS),fillOutlinePattern:Pe(VS,US),fillPattern:Pe(jS,NS),fillExtrusion:Pe(GS,ZS),fillExtrusionPattern:Pe(qS,HS),hillshadePrepare:Pe(WS,$S),hillshade:Pe(XS,YS),line:Pe(KS,JS),lineGradient:Pe(QS,e2),linePattern:Pe(t2,r2),lineSDF:Pe(n2,i2),raster:Pe(o2,a2),symbolIcon:Pe(s2,l2),symbolSDF:Pe(u2,c2),symbolTextAndIcon:Pe(p2,h2),terrain:Pe(d2,y2),terrainDepth:Pe(m2,g2),terrainCoords:Pe(f2,x2),projectionErrorMeasurement:Pe(b2,_2),atmosphere:Pe(P2,T2),sky:Pe(S2,M2)};function Pe(r,e){let t=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/in ([\w]+) ([\w]+)/g),i=r.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(i):i,s={};return r=r.replace(t,(u,c,p,h,m)=>(s[m]=!0,c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(m,"\nin ").concat(p," ").concat(h," ").concat(m,";\n#else\nuniform ").concat(p," ").concat(h," u_").concat(m,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(m,"\n ").concat(p," ").concat(h," ").concat(m," = u_").concat(m,";\n#endif\n"))),e=e.replace(t,(u,c,p,h,m)=>{let f=h==="float"?"vec2":"vec4",d=m.match(/color/)?"color":f;return s[m]?c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(m,"\nuniform lowp float u_").concat(m,"_t;\nin ").concat(p," ").concat(f," a_").concat(m,";\nout ").concat(p," ").concat(h," ").concat(m,";\n#else\nuniform ").concat(p," ").concat(h," u_").concat(m,";\n#endif\n"):d==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(m,"\n ").concat(m," = a_").concat(m,";\n#else\n ").concat(p," ").concat(h," ").concat(m," = u_").concat(m,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(m,"\n ").concat(m," = unpack_mix_").concat(d,"(a_").concat(m,", u_").concat(m,"_t);\n#else\n ").concat(p," ").concat(h," ").concat(m," = u_").concat(m,";\n#endif\n"):c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(m,"\nuniform lowp float u_").concat(m,"_t;\nin ").concat(p," ").concat(f," a_").concat(m,";\n#else\nuniform ").concat(p," ").concat(h," u_").concat(m,";\n#endif\n"):d==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(m,"\n ").concat(p," ").concat(h," ").concat(m," = a_").concat(m,";\n#else\n ").concat(p," ").concat(h," ").concat(m," = u_").concat(m,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(m,"\n ").concat(p," ").concat(h," ").concat(m," = unpack_mix_").concat(d,"(a_").concat(m,", u_").concat(m,"_t);\n#else\n ").concat(p," ").concat(h," ").concat(m," = u_").concat(m,";\n#endif\n")}),{fragmentSource:r,vertexSource:e,staticAttributes:n,staticUniforms:a}}l(Pe,"prepare");function C2(r){return r.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}l(C2,"transpileVertexShaderToWebGL1");function A2(r){return r.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}l(A2,"transpileFragmentShaderToWebGL1");y();var Wx=class Wx{constructor(e,t,n){this.vertexBuffer=e,this.indexBuffer=t,this.segments=n}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};l(Wx,"Mesh");var Bt=Wx;y();var $t=Ee([{name:"a_pos",type:"Int16",components:2}]);var $x="#define PROJECTION_MERCATOR",Xx="mercator",Yx=class Yx{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Xx}get shaderDefine(){return $x}get shaderPreludeCode(){return zt.projectionMercator}get vertexShaderPreludeCode(){return zt.projectionMercator.vertexSource}get subdivisionGranularity(){return In.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,t,n,i,o){if(this._cachedMesh)return this._cachedMesh;let a=new mt;a.emplaceBack(0,0),a.emplaceBack(8192,0),a.emplaceBack(0,8192),a.emplaceBack(8192,8192);let s=e.createVertexBuffer(a,$t.members),u=he.simpleSegment(0,0,4,2),c=new Ne;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);let p=e.createIndexBuffer(c);return this._cachedMesh=new Bt(s,p,u),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}};l(Yx,"MercatorProjection");var ki=Yx;y();var Ot=oe(ue(),1);y();var Vn=oe(ue(),1);y();var I2=oe(ue(),1);var Ip=class Ip{constructor(e=0,t=0,n=0,i=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(n)||n<0||isNaN(i)||i<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=n,this.right=i}interpolate(e,t,n){return t.top!=null&&e.top!=null&&(this.top=Ae.number(e.top,t.top,n)),t.bottom!=null&&e.bottom!=null&&(this.bottom=Ae.number(e.bottom,t.bottom,n)),t.left!=null&&e.left!=null&&(this.left=Ae.number(e.left,t.left,n)),t.right!=null&&e.right!=null&&(this.right=Ae.number(e.right,t.right,n)),this}getCenter(e,t){let n=se((this.left+e-this.right)/2,0,e),i=se((this.top+t-this.bottom)/2,0,t);return new I2.default(n,i)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Ip(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};l(Ip,"EdgeInsets");var Eo=Ip;function Lo(r,e){if(!r.renderWorldCopies||r.lngRange)return;let t=e.lng-r.center.lng;e.lng+=t>180?-360:t<-180?360:0}l(Lo,"normalizeCenter");function E2(r){return Math.max(0,Math.floor(r))}l(E2,"getTileZoom");var Kx=class Kx{constructor(e,t,n,i,o,a){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=a===void 0?!0:!!a,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=i==null?0:i,this._maxPitch=o==null?60:o,this.setMaxBounds(),this._width=0,this._height=0,this._center=new X(0,0),this._elevation=0,this._zoom=0,this._tileZoom=E2(this._zoom),this._scale=Ye(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Eo,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,n){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=E2(this._zoom),this._scale=Ye(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new Eo(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!n&&e.autoCalculateNearFarZ,t&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Vn.default(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=Qt(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=an.create(),an.rotate(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=se(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return $n(this._fovInRadians)}setFov(e){e=se(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Le(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.getConstrained(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=Ye(t),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,n){this._unmodified=!1,this._edgeInsets.interpolate(e,t,n),this._constrain(),this._calcMatrices()}resize(e,t,n=!0){this._width=e,this._height=t,n&&this._constrain(),this._calcMatrices()}getMaxBounds(){return!this._latRange||this._latRange.length!==2||!this._lngRange||this._lngRange.length!==2?null:new ot([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-wt,wt])}getConstrained(e,t){return this._callbacks.getConstrained(e,t)}getCameraQueryGeometry(e,t){if(t.length===1)return[t[0],e];{let{minX:n,minY:i,maxX:o,maxY:a}=ct.fromPoints(t).extend(e);return[new Vn.default(n,i),new Vn.default(o,i),new Vn.default(o,a),new Vn.default(n,a),new Vn.default(n,i)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:n}=this.getConstrained(this.center,this.zoom);this.setCenter(t),this.setZoom(n),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=z.identity(new Float64Array(16));z.scale(e,e,[this._width/2,-this._height/2,1]),z.translate(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=z.identity(new Float64Array(16)),z.scale(e,e,[1,-1,1]),z.translate(e,e,[-1,-1,0]),z.scale(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,n,i){let o=n!==void 0?n:this.bearing,a=i=i!==void 0?i:this.pitch,s=de.fromLngLat(e,t),u=-Math.cos(Le(a)),c=Math.sin(Le(a)),p=c*Math.sin(Le(o)),h=-c*Math.cos(Le(o)),m=this.elevation,f=t-m,d;u*f>=0||Math.abs(u)<.1?(d=1e4,m=t+d*u):d=-f/u;let g=cp(1,s.y),x,_,b=0,v=10;do{if(b+=1,b>v)break;_=d/g;let S=p*_,A=h*_;x=new de(s.x+S,s.y+A),g=1/x.meterInMercatorCoordinateUnits()}while(Math.abs(d-_*g)>1e-12);let w=x.toLngLat(),T=Ze(this.height/2/Math.tan(this.fovInRadians/2)/_/this.tileSize);return{center:w,elevation:m,zoom:T}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=Br(1,this.center.lat)*this.worldSize,n=this.cameraToCenterDistance/t,i=de.fromLngLat(this.center,this.elevation),o=Os(this.center,this.elevation,this.pitch,this.bearing,n);this._elevation=e;let a=this.calculateCenterFromCameraLngLatAlt(o.toLngLat(),cp(o.z,i.y),this.bearing,this.pitch);this._elevation=a.elevation,this._center=a.center,this.setZoom(a.zoom)}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Vn.default(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let e=Br(1,this.center.lat)*this.worldSize,t=this.cameraToCenterDistance/e;return Os(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/t,e.canonical.y/t,1/t/8192,1/t/8192]}};l(Kx,"TransformHelper");var Un=Kx;y();y();var Ep=class Ep{constructor(e,t){this.min=e,this.max=t,this.center=V.scale([],V.add([],this.min,this.max),.5)}quadrant(e){let t=[e%2===0,e<2],n=V.clone(this.min),i=V.clone(this.max);for(let o=0;o<t.length;o++)n[o]=t[o]?this.min[o]:this.center[o],i[o]=t[o]?this.center[o]:this.max[o];return i[2]=this.max[2],new Ep(n,i)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let n=0;n<e.planes.length;n++){let i=this.intersectsPlane(e.planes[n]);if(i===0)return 0;i===1&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],n=e[3];for(let i=0;i<3;i++)e[i]>0?(t+=e[i]*this.min[i],n+=e[i]*this.max[i]):(n+=e[i]*this.min[i],t+=e[i]*this.max[i]);return t>=0?2:n<0?0:1}};l(Ep,"Aabb");var ko=Ep;var Jx=class Jx{distanceToTile2d(e,t,n,i){let o=i.distanceX([e,t]),a=i.distanceY([e,t]);return Math.hypot(o,a)}getWrap(e,t,n){return n}getTileBoundingVolume(e,t,n,i){var u,c;let o=0,a=0;if(i!=null&&i.terrain){let p=new Oe(e.z,t,e.z,e.x,e.y),h=i.terrain.getMinMaxElevation(p);o=(u=h.minElevation)!=null?u:Math.min(0,n),a=(c=h.maxElevation)!=null?c:Math.max(0,n)}let s=1<<e.z;return new ko([t+e.x/s,e.y/s,o],[t+(e.x+1)/s,(e.y+1)/s,a])}allowVariableZoom(e,t){let n=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,i=se(78.5-n/2,0,60);return!!t.terrain||e.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}};l(Jx,"MercatorCoveringTilesDetailsProvider");var Lp=Jx;y();var kp=class kp{constructor(e,t,n){this.points=e;this.planes=t;this.aabb=n}static fromInvProjectionMatrix(e,t=1,n=0,i,o){let a=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]],s=o?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],u=Math.pow(2,n),c=a.map(f=>kB(f,e,t,u));i&&RB(c,s[0],i,o);let p=s.map(f=>{let d=V.sub([],c[f[0]],c[f[1]]),g=V.sub([],c[f[2]],c[f[1]]),x=V.normalize([],V.cross([],d,g)),_=-V.dot(x,c[f[1]]);return x.concat(_)}),h=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],m=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let f of c)for(let d=0;d<3;d++)h[d]=Math.min(h[d],f[d]),m[d]=Math.max(m[d],f[d]);return new kp(c,p,new ko(h,m))}};l(kp,"Frustum");var Ro=kp;function kB(r,e,t,n){let i=Re.transformMat4([],r,e),o=1/i[3]/t*n;return Re.mul(i,i,[o,o,1/i[3],o])}l(kB,"unprojectClipSpacePoint");function RB(r,e,t,n){let i=n?4:0,o=n?0:4,a=0,s=[],u=[];for(let h=0;h<4;h++){let m=V.sub([],r[h+o],r[h+i]),f=V.length(m);V.scale(m,m,1/f),s.push(f),u.push(m)}for(let h=0;h<4;h++){let m=z0(r[h+i],u[h],t);m!==null&&m>=0?a=Math.max(a,m):a=Math.max(a,s[h])}let c=DB(r,e),p=FB(t,c);if(p!==null){let h=p/V.dot(u[0],c);a=Math.min(a,h)}for(let h=0;h<4;h++){let m=Math.min(a,s[h]),f=[r[h+i][0]+u[h][0]*m,r[h+i][1]+u[h][1]*m,r[h+i][2]+u[h][2]*m,1];r[h+o]=f}}l(RB,"adjustFarPlaneByHorizonPlane");function DB(r,e){let t=V.sub([],r[e[0]],r[e[1]]),n=V.sub([],r[e[2]],r[e[1]]),i=[0,0,0,0];return V.normalize(i,V.cross([],t,n)),i[3]=-V.dot(i,r[e[0]]),i}l(DB,"getNormalizedNearPlane");function FB(r,e){let t=V.len(r),n=Re.scale([],r,1/t),i=V.sub([],e,V.scale([],n,V.dot(e,n))),o=V.len(i);if(o>0){let a=Math.sqrt(1-n[3]*n[3]),s=V.scale([],n,-n[3]),u=V.add([],s,V.scale([],i,a/o));return qo(e,u)}else return null}l(FB,"getIdealNearFarPlaneDistance");var Rp=class Rp{constructor(e,t,n,i,o){this._posMatrixCache=new Map;this._alignedPosMatrixCache=new Map;this._fogMatrixCacheF32=new Map;this._helper=new Un({calcMatrices:l(()=>{this._calcMatrices()},"calcMatrices"),getConstrained:l((a,s)=>this.getConstrained(a,s),"getConstrained")},e,t,n,i,o),this._coveringTilesDetailsProvider=new Lp}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){return this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,n=!0){this._helper.resize(e,t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}clone(){let e=new Rp;return e.apply(this),e}apply(e,t,n){this._helper.apply(e,t,n)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){let t=[new Rn(0,e)];if(this._helper._renderWorldCopies){let n=this.screenPointToMercatorCoordinate(new Ot.default(0,0)),i=this.screenPointToMercatorCoordinate(new Ot.default(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new Ot.default(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new Ot.default(0,this._helper._height)),s=Math.floor(Math.min(n.x,i.x,o.x,a.x)),u=Math.floor(Math.max(n.x,i.x,o.x,a.x)),c=1;for(let p=s-c;p<=u+c;p++)p!==0&&t.push(new Rn(p,e))}return t}getCameraFrustum(){return Ro.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){let t=this.screenPointToLocation(this.centerPoint,e),n=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(n)}setLocationAtPoint(e,t){let n=Br(this.elevation,this.center.lat),i=this.screenPointToMercatorCoordinateAtZ(t,n),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,n),a=de.fromLngLat(e),s=new de(a.x-(i.x-o.x),a.y-(i.y-o.y));this.setCenter(s==null?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,t){return t?this.coordinatePoint(de.fromLngLat(e),t.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(de.fromLngLat(e))}screenPointToLocation(e,t){var n;return(n=this.screenPointToMercatorCoordinate(e,t))==null?void 0:n.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){let n=t.pointCoordinate(e);if(n!=null)return n}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,t){let n=t||0,i=[e.x,e.y,0,1],o=[e.x,e.y,1,1];Re.transformMat4(i,i,this._pixelMatrixInverse),Re.transformMat4(o,o,this._pixelMatrixInverse);let a=i[3],s=o[3],u=i[0]/a,c=o[0]/s,p=i[1]/a,h=o[1]/s,m=i[2]/a,f=o[2]/s,d=m===f?0:(n-m)/(f-m);return new de(Ae.number(u,c,d)/this.worldSize,Ae.number(p,h,d)/this.worldSize,n)}coordinatePoint(e,t=0,n=this._pixelMatrix){let i=[e.x*this.worldSize,e.y*this.worldSize,t,1];return Re.transformMat4(i,i,n),new Ot.default(i[0]/i[3],i[1]/i[3])}getBounds(){let e=Math.max(0,this._helper._height/2-Co(this));return new ot().extend(this.screenPointToLocation(new Ot.default(0,e))).extend(this.screenPointToLocation(new Ot.default(this._helper._width,e))).extend(this.screenPointToLocation(new Ot.default(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new Ot.default(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?t.pointCoordinate(e)!=null:e.y>this.height/2-Co(this)}calculatePosMatrix(e,t=!1,n){var u;let i=(u=e.key)!=null?u:Ci(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),o=t?this._alignedPosMatrixCache:this._posMatrixCache;if(o.has(i)){let c=o.get(i);return n?c.f32:c.f64}let a=fp(e,this.worldSize);z.multiply(a,t?this._alignedProjMatrix:this._viewProjMatrix,a);let s={f64:a,f32:new Float32Array(a)};return o.set(i,s),n?s.f32:s.f64}calculateFogMatrix(e){let t=e.key,n=this._fogMatrixCacheF32;if(n.has(t))return n.get(t);let i=fp(e,this.worldSize);return z.multiply(i,this._fogMatrix,i),n.set(t,new Float32Array(i)),n.get(t)}getConstrained(e,t){t=se(+t,this.minZoom,this.maxZoom);let n={center:new X(e.lng,e.lat),zoom:t},i=this._helper._lngRange;if(!this._helper._renderWorldCopies&&i===null){let v=179.9999999999;i=[-v,v]}let o=this.tileSize*Ye(n.zoom),a=0,s=o,u=0,c=o,p=0,h=0,{x:m,y:f}=this.size;if(this._helper._latRange){let v=this._helper._latRange;a=xr(v[1])*o,s=xr(v[0])*o,s-a<f&&(p=f/(s-a))}i&&(u=Qt(Kr(i[0])*o,0,o),c=Qt(Kr(i[1])*o,0,o),c<u&&(c+=o),c-u<m&&(h=m/(c-u)));let{x:d,y:g}=Wt(o,e),x,_,b=Math.max(h||0,p||0);if(b){let v=new Ot.default(h?(c+u)/2:d,p?(s+a)/2:g);return n.center=zn(o,v).wrap(),n.zoom+=Ze(b),n}if(this._helper._latRange){let v=f/2;g-v<a&&(_=a+v),g+v>s&&(_=s-v)}if(i){let v=(u+c)/2,w=d;this._helper._renderWorldCopies&&(w=Qt(d,v-o/2,v+o/2));let T=m/2;w-T<u&&(x=u+T),w+T>c&&(x=c-T)}if(x!==void 0||_!==void 0){let v=new Ot.default(x!=null?x:d,_!=null?_:g);n.center=zn(o,v).wrap()}return n}calculateCenterFromCameraLngLatAlt(e,t,n,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,i)}_calculateNearFarZIfNeeded(e,t,n){if(!this._helper.autoCalculateNearFarZ)return;let o=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=e-o*this._helper._pixelPerMeter/Math.cos(t),s=o<0?a:e,u=Math.PI/2+this.pitchInRadians,p=Le(this.fov)*(Math.abs(Math.cos(Le(this.roll)))*this.height+Math.abs(Math.sin(Le(this.roll)))*this.width)/this.height*(.5+n.y/this.height),h=Math.sin(p)*s/Math.sin(se(Math.PI-u-p,.01,Math.PI-.01)),m=Co(this),f=Math.atan(m/this._helper.cameraToCenterDistance),d=Le(90-Fn),g=f>d?2*f*(.5+n.y/(m*2)):d,x=Math.sin(g)*s/Math.sin(se(Math.PI-u-g,.01,Math.PI-.01)),_=Math.min(h,x);this._helper._farZ=(Math.cos(Math.PI/2-t)*_+s)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let e=this.centerOffset,t=Wt(this.worldSize,this.center),n=t.x,i=t.y;this._helper._pixelPerMeter=Br(1,this.center.lat)*this.worldSize;let o=Le(Math.min(this.pitch,Fn)),a=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));this._calculateNearFarZIfNeeded(a,o,e);let s;s=new Float64Array(16),z.perspective(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),z.invert(this._invProjMatrix,s),s[8]=-e.x*2/this._helper._width,s[9]=e.y*2/this._helper._height,this._projectionMatrix=z.clone(s),z.scale(s,s,[1,-1,1]),z.translate(s,s,[0,0,-this._helper.cameraToCenterDistance]),z.rotateZ(s,s,-this.rollInRadians),z.rotateX(s,s,this.pitchInRadians),z.rotateZ(s,s,-this.bearingInRadians),z.translate(s,s,[-n,-i,0]),this._mercatorMatrix=z.scale([],s,[this.worldSize,this.worldSize,this.worldSize]),z.scale(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=z.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),z.translate(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=z.invert([],s);let u=[0,0,-1,1];Re.transformMat4(u,u,this._invViewProjMatrix),this._cameraPosition=[u[0]/u[3],u[1]/u[3],u[2]/u[3]],this._fogMatrix=new Float64Array(16),z.perspective(this._fogMatrix,this.fovInRadians,this.width/this.height,a,this._helper._farZ),this._fogMatrix[8]=-e.x*2/this.width,this._fogMatrix[9]=e.y*2/this.height,z.scale(this._fogMatrix,this._fogMatrix,[1,-1,1]),z.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),z.rotateZ(this._fogMatrix,this._fogMatrix,-this.rollInRadians),z.rotateX(this._fogMatrix,this._fogMatrix,this.pitchInRadians),z.rotateZ(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),z.translate(this._fogMatrix,this._fogMatrix,[-n,-i,0]),z.scale(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),z.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=z.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);let c=this._helper._width%2/2,p=this._helper._height%2/2,h=Math.cos(this.bearingInRadians),m=Math.sin(-this.bearingInRadians),f=n-Math.round(n)+h*c+m*p,d=i-Math.round(i)+h*p+m*c,g=new Float64Array(s);if(z.translate(g,g,[f>.5?f-1:f,d>.5?d-1:d,0]),this._alignedProjMatrix=g,s=z.invert(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let e=this.screenPointToMercatorCoordinate(new Ot.default(0,0)),t=[e.x*this.worldSize,e.y*this.worldSize,0,1];return Re.transformMat4(t,t,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let e=Br(1,this.center.lat)*this.worldSize,t=this._helper.cameraToCenterDistance/e;return Os(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}lngLatToCameraDepth(e,t){let n=de.fromLngLat(e),i=[n.x*this.worldSize,n.y*this.worldSize,t,1];return Re.transformMat4(i,i,this._viewProjMatrix),i[2]/i[3]}getProjectionData(e){let{overscaledTileID:t,aligned:n,applyTerrainMatrix:i}=e,o=this._helper.getMercatorTileCoordinates(t),a=t?this.calculatePosMatrix(t,n,!0):null,s;return t&&t.terrainRttPosMatrix32f&&i?s=t.terrainRttPosMatrix32f:a?s=a:s=Ol(),{mainMatrix:s,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,n){return 1}transformLightDirection(e){return V.clone(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,t,n,i){let o=this.calculatePosMatrix(n),a;i?(a=[e,t,i(e,t),1],Re.transformMat4(a,a,o)):(a=[e,t,0,1],js(a,a,o));let s=a[3];return{point:new Ot.default(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(e){for(let t of e)this.calculatePosMatrix(t)}getMatrixForModel(e,t){let n=de.fromLngLat(e,t),i=n.meterInMercatorCoordinateUnits(),o=ln();return z.translate(o,o,[n.x,n.y,n.z]),z.rotateZ(o,o,Math.PI),z.rotateX(o,o,Math.PI/2),z.scale(o,o,[-i,i,i]),o}getProjectionDataForCustomLayer(e=!0){let t=new Oe(0,0,0,0,0),n=this.getProjectionData({overscaledTileID:t,applyGlobeMatrix:e}),i=fp(t,this.worldSize);z.multiply(i,this._viewProjMatrix,i),n.tileMercatorCoords=[0,0,1,1];let o=[8192,8192,this.worldSize/this._helper.pixelsPerMeter],a=pr();return z.scale(a,i,o),n.fallbackMatrix=a,n.mainMatrix=a,n}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}};l(Rp,"MercatorTransform");var en=Rp;y();y();var Xs=oe(ue(),1);function Qx(){ce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}l(Qx,"cameraBoundsWarning");function Dp(r){if(r.useSlerp)if(r.k<1){let e=Gm(r.startEulerAngles.roll,r.startEulerAngles.pitch,r.startEulerAngles.bearing),t=Gm(r.endEulerAngles.roll,r.endEulerAngles.pitch,r.endEulerAngles.bearing),n=new Float64Array(4);sn.slerp(n,e,t,r.k);let i=$0(n);r.tr.setRoll(i.roll),r.tr.setPitch(i.pitch),r.tr.setBearing(i.bearing)}else r.tr.setRoll(r.endEulerAngles.roll),r.tr.setPitch(r.endEulerAngles.pitch),r.tr.setBearing(r.endEulerAngles.bearing);else r.tr.setRoll(Ae.number(r.startEulerAngles.roll,r.endEulerAngles.roll,r.k)),r.tr.setPitch(Ae.number(r.startEulerAngles.pitch,r.endEulerAngles.pitch,r.k)),r.tr.setBearing(Ae.number(r.startEulerAngles.bearing,r.endEulerAngles.bearing,r.k))}l(Dp,"updateRotation");function Fp(r,e,t,n,i){let o=i.padding,a=Wt(i.worldSize,t.getNorthWest()),s=Wt(i.worldSize,t.getNorthEast()),u=Wt(i.worldSize,t.getSouthEast()),c=Wt(i.worldSize,t.getSouthWest()),p=Le(-n),h=a.rotate(p),m=s.rotate(p),f=u.rotate(p),d=c.rotate(p),g=new Xs.default(Math.max(h.x,m.x,d.x,f.x),Math.max(h.y,m.y,d.y,f.y)),x=new Xs.default(Math.min(h.x,m.x,d.x,f.x),Math.min(h.y,m.y,d.y,f.y)),_=g.sub(x),b=i.width-(o.left+o.right+e.left+e.right),v=i.height-(o.top+o.bottom+e.top+e.bottom),w=b/_.x,T=v/_.y;if(T<0||w<0){Qx();return}let S=Math.min(Ze(i.scale*Math.min(w,T)),r.maxZoom),A=Xs.default.convert(r.offset),M=(e.left-e.right)/2,I=(e.top-e.bottom)/2,D=new Xs.default(M,I).rotate(Le(n)),U=A.add(D).mult(i.scale/Ye(S));return{center:zn(i.worldSize,a.add(u).div(2).sub(U)),zoom:S,bearing:n}}l(Fp,"cameraForBoxAndBearing");var e_=class e_{get useGlobeControls(){return!1}handlePanInertia(e,t){return{easingOffset:e,easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,n){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(n,e.around)}cameraForBoxAndBearing(e,t,n,i,o){return Fp(e,t,n,i,o)}handleJumpToCenterZoom(e,t){let i=typeof t.zoom<"u"?+t.zoom:e.zoom;e.zoom!==i&&e.setZoom(+t.zoom),t.center!==void 0&&e.setCenter(X.convert(t.center))}handleEaseTo(e,t){let n=e.zoom,i=e.padding,o={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a=t.roll===void 0?e.roll:t.roll,s=t.pitch===void 0?e.pitch:t.pitch,u=t.bearing===void 0?e.bearing:t.bearing,c={roll:a,pitch:s,bearing:u},p=typeof t.zoom<"u",h=!e.isPaddingEqual(t.padding),m=!1,f=p?+t.zoom:e.zoom,d=e.centerPoint.add(t.offsetAsPoint),g=e.screenPointToLocation(d),{center:x,zoom:_}=e.getConstrained(X.convert(t.center||g),f!=null?f:n);Lo(e,x);let b=Wt(e.worldSize,g),v=Wt(e.worldSize,x).sub(b),w=Ye(_-n);return m=_!==n,{easeFunc:l(S=>{if(m&&e.setZoom(Ae.number(n,_,S)),Nl(o,c)||Dp({startEulerAngles:o,endEulerAngles:c,tr:e,k:S,useSlerp:o.roll!=c.roll}),h&&(e.interpolatePadding(i,t.padding,S),d=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let A=Ye(e.zoom-n),M=_>n?Math.min(2,w):Math.max(.5,w),I=Math.pow(M,1-S),L=zn(e.worldSize,b.add(v.mult(S*I)).mult(A));e.setLocationAtPoint(e.renderWorldCopies?L.wrap():L,d)}},"easeFunc"),isZooming:m,elevationCenter:x}}handleFlyTo(e,t){let n=typeof t.zoom<"u",i=e.zoom,o=e.getConstrained(X.convert(t.center||t.locationAtOffset),n?+t.zoom:i),a=o.center,s=o.zoom;Lo(e,a);let u=Wt(e.worldSize,t.locationAtOffset),c=Wt(e.worldSize,a).sub(u),p=c.mag(),h=Ye(s-i),m=typeof t.minZoom<"u",f;if(m){let g=Math.min(+t.minZoom,i,s),x=e.getConstrained(a,g).zoom;f=Ye(x-i)}return{easeFunc:l((g,x,_,b)=>{e.setZoom(g===1?s:i+Ze(x));let v=g===1?a:zn(e.worldSize,u.add(c.mult(_)).mult(x));e.setLocationAtPoint(e.renderWorldCopies?v.wrap():v,b)},"easeFunc"),scaleOfZoom:h,targetCenter:a,scaleOfMinZoom:f,pixelPathLength:p}}};l(e_,"MercatorCameraHelper");var tn=e_;y();y();y();y();var zB=0,L2=1,BB=771,t_=class t_{constructor(e,t,n){this.blendFunction=e,this.blendColor=t,this.mask=n}};l(t_,"ColorMode");var Me=t_;Me.Replace=[L2,zB];Me.disabled=new Me(Me.Replace,Y.transparent,[!1,!1,!1,!1]);Me.unblended=new Me(Me.Replace,Y.transparent,[!0,!0,!0,!0]);Me.alphaBlended=new Me([L2,BB],Y.transparent,[!0,!0,!0,!0]);y();var r_=class r_{constructor(e,t,n){this.enable=e,this.mode=t,this.frontFace=n}};l(r_,"CullFaceMode");var ie=r_;ie.disabled=new ie(!1,1029,2305);ie.backCCW=new ie(!0,1029,2305);ie.frontCCW=new ie(!0,1028,2305);y();var n_=class n_{constructor(e,t,n){this.func=e,this.mask=t,this.range=n}};l(n_,"DepthMode");var re=n_;re.ReadOnly=!1;re.ReadWrite=!0;re.disabled=new re(519,re.ReadOnly,[0,1]);y();var i_=class i_{constructor(e,t,n,i,o,a){this.test=e,this.ref=t,this.mask=n,this.fail=i,this.depthFail=o,this.pass=a}};l(i_,"StencilMode");var le=i_;le.disabled=new le({func:519,mask:0},0,0,7680,7680,7680);y();var k2=l((r,e)=>({u_input:new j(r,e.u_input),u_output_expected:new j(r,e.u_output_expected)}),"projectionErrorMeasurementUniforms"),R2=l((r,e)=>({u_input:r,u_output_expected:e}),"projectionErrorMeasurementUniformValues");y();var o_=new WeakMap;function Xt(r){var e;if(o_.has(r))return o_.get(r);{let t=(e=r.getParameter(r.VERSION))==null?void 0:e.startsWith("WebGL 2.0");return o_.set(r,t),t}}l(Xt,"isWebGL2");var Bp=class Bp{constructor(e){this._readbackWaitFrames=4;this._measureWaitFrames=6;this._texWidth=1;this._texHeight=1;this._measuredError=0;this._updateCount=0;this._lastReadbackFrame=-1e3;this._readbackQueue=null;this._cachedRenderContext=e;let t=e.context,n=t.gl;this._texFormat=n.RGBA,this._texType=n.UNSIGNED_BYTE;let i=new mt;i.emplaceBack(-1,-1),i.emplaceBack(2,-1),i.emplaceBack(-1,2);let o=new Ne;o.emplaceBack(0,1,2),this._fullscreenTriangle=new Bt(t.createVertexBuffer(i,$t.members),t.createIndexBuffer(o),he.simpleSegment(0,0,i.length,o.length)),this._resultBuffer=new Uint8Array(4),t.activeTexture.set(n.TEXTURE1);let a=n.createTexture();n.bindTexture(n.TEXTURE_2D,a),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST),n.texImage2D(n.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=t.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(a),Xt(n)&&(this._pbo=n.createBuffer(),n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.bufferData(n.PIXEL_PACK_BUFFER,4,n.STREAM_READ),n.bindBuffer(n.PIXEL_PACK_BUFFER,null))}get awaitingQuery(){return!!this._readbackQueue}destroy(){let e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,t){let n=this._updateCount;return this._readbackQueue?n>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():n>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,t),this._updateCount++,this._measuredError}_bindFramebuffer(){let e=this._cachedRenderContext.context,t=e.gl;e.activeTexture.set(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,t){let n=this._cachedRenderContext.context,i=n.gl;if(this._bindFramebuffer(),n.viewport.set([0,0,this._texWidth,this._texHeight]),n.clear({color:Y.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(n,i.TRIANGLES,re.disabled,le.disabled,Me.unblended,ie.disabled,R2(e,t),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Xt(i)){i.bindBuffer(i.PIXEL_PACK_BUFFER,this._pbo),i.readBuffer(i.COLOR_ATTACHMENT0),i.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),i.bindBuffer(i.PIXEL_PACK_BUFFER,null);let a=i.fenceSync(i.SYNC_GPU_COMMANDS_COMPLETE,0);i.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:a}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Xt(e)){let t=e.clientWaitSync(this._readbackQueue.sync,0,0);if(t===e.WAIT_FAILED){ce("WebGL2 clientWaitSync failed."),this._readbackQueue=null,this._lastReadbackFrame=this._updateCount;return}if(t===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Bp._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let t=0;return t+=e[0]/256,t+=e[1]/65536,t+=e[2]/16777216,e[3]<127&&(t=-t),t/128}};l(Bp,"ProjectionErrorMeasurement");var zp=Bp;y();var Op=8192/128;function D2(r,e){let t=F2(e,"16bit"),n=mt.deserialize({arrayBuffer:t.vertices,length:t.vertices.byteLength/2/2}),i=Ne.deserialize({arrayBuffer:t.indices,length:t.indices.byteLength/2/3});return new Bt(r.createVertexBuffer(n,$t.members),r.createIndexBuffer(i),he.simpleSegment(0,0,n.length,i.length))}l(D2,"createTileMeshWithBuffers");function F2(r,e){let t=r.granularity!==void 0?Math.max(r.granularity,1):1,n=t+(r.generateBorders?2:0),i=t+(r.extendToNorthPole||r.generateBorders?1:0)+(r.extendToSouthPole||r.generateBorders?1:0),o=n+1,a=i+1,s=r.generateBorders?-1:0,u=r.generateBorders||r.extendToNorthPole?-1:0,c=t+(r.generateBorders?1:0),p=t+(r.generateBorders||r.extendToSouthPole?1:0),h=o*a,m=n*i*6,f=o*a>65536;if(f&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let d=f||e==="32bit",g=new Int16Array(h*2),x=0;for(let v=u;v<=p;v++)for(let w=s;w<=c;w++){let T=w/t*8192;w===-1&&(T=-Op),w===t+1&&(T=8192+Op);let S=v/t*8192;v===-1&&(S=r.extendToNorthPole?Dr:-Op),v===t+1&&(S=r.extendToSouthPole?Xr:8192+Op),g[x++]=T,g[x++]=S}let _=d?new Uint32Array(m):new Uint16Array(m),b=0;for(let v=0;v<i;v++)for(let w=0;w<n;w++){let T=w+v*o,S=w+1+v*o,A=w+(v+1)*o,M=w+1+(v+1)*o;_[b++]=T,_[b++]=A,_[b++]=S,_[b++]=S,_[b++]=A,_[b++]=M}return{vertices:g.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:d}}l(F2,"createTileMesh");var OB="#define GLOBE",VB="globe",z2={errorTransitionTimeSeconds:.5},a_=new In({fill:new Zt(128,2),line:new Zt(512,0),tile:new Zt(128,32),stencil:new Zt(128,1),circle:3}),s_=class s_{constructor(){this._tileMeshCache={};this._errorCorrectionUsable=0;this._errorMeasurementLastValue=0;this._errorCorrectionPreviousValue=0;this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return VB}get shaderDefine(){return OB}get shaderPreludeCode(){return zt.projectionGlobe}get vertexShaderPreludeCode(){return zt.projectionMercator.vertexSource}get subdivisionGranularity(){return a_}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new zp(e));let t=xr(this._errorQueryLatitudeDegrees),n=2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5,i=this._errorMeasurement.updateErrorLoop(t,n),o=ne.now();i!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=i,this._errorMeasurementLastChangeTime=o);let a=(o-this._errorMeasurementLastChangeTime)/1e3,s=Math.min(Math.max(a/z2.errorTransitionTimeSeconds,0),1),u=-this._errorMeasurementLastValue;this._errorCorrectionUsable=jr(this._errorCorrectionPreviousValue,u,Vl(s))}_getMeshKey(e){return"".concat(e.granularity.toString(36),"_").concat(e.generateBorders?"b":"").concat(e.extendToNorthPole?"n":"").concat(e.extendToSouthPole?"s":"")}getMeshFromTileID(e,t,n,i,o){let s=(o==="stencil"?a_.stencil:a_.tile).getGranularityForZoomLevel(t.z),u=t.y===0&&i,c=t.y===(1<<t.z)-1&&i;return this._getMesh(e,{granularity:s,generateBorders:n,extendToNorthPole:u,extendToSouthPole:c})}_getMesh(e,t){let n=this._getMeshKey(t);if(n in this._tileMeshCache)return this._tileMeshCache[n];let i=D2(e,t);return this._tileMeshCache[n]=i,i}recalculate(e){}hasTransition(){let e=ne.now(),t=!1;return t=t||(e-this._errorMeasurementLastChangeTime)/1e3<z2.errorTransitionTimeSeconds+.2,t=t||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,t}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}};l(s_,"VerticalPerspectiveProjection");var Do=s_;var UB=new ke({type:new q(E.projection.type)}),l_=class l_ extends be{constructor(e){super(),this._transitionable=new kr(UB),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new ve(0)),this._mercatorProjection=new ki,this._verticalPerspectiveProjection=new Do}get transitionState(){let e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof Ar){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,n,i,o){return this.currentProjection.getMeshFromTileID(e,t,n,i,o)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}};l(l_,"GlobeProjection");var Ys=l_;y();y();var br=oe(ue(),1);y();function B2(r){let e=Ri(r.worldSize,r.center.lat);return 2*Math.PI*e}l(B2,"getGlobeCircumferencePixels");function O2(r,e,t){let n=ht(e),i=ht(t),o=V.dot(n,i),a=Math.acos(o),s=B2(r);return a/(2*Math.PI)*s}l(O2,"globeDistanceOfLocationsPixels");function V2(r,e){let t=Xn(r*Math.PI*2+Math.PI,Math.PI*2),n=2*Math.atan(Math.exp(Math.PI-e*Math.PI*2))-Math.PI*.5;return[t,n]}l(V2,"mercatorCoordinatesToAngularCoordinatesRadians");function jB(r,e){let t=Math.cos(e),n=new Float64Array(3);return n[0]=Math.sin(r)*t,n[1]=Math.sin(e),n[2]=Math.cos(r)*t,n}l(jB,"angularCoordinatesRadiansToVector");function Or(r,e,t,n,i){let o=1/(1<<i),a=r/8192*o+t*o,s=e/8192*o+n*o,u=Xn(a*Math.PI*2+Math.PI,Math.PI*2),c=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-Math.PI*.5,p=Math.cos(c),h=new Float64Array(3);return h[0]=Math.sin(u)*p,h[1]=Math.sin(c),h[2]=Math.cos(u)*p,h}l(Or,"projectTileCoordinatesToSphere");function ht(r){return jB(r.lng*Math.PI/180,r.lat*Math.PI/180)}l(ht,"angularCoordinatesToSurfaceVector");function Ri(r,e){return r/(2*Math.PI)/Math.cos(e*Math.PI/180)}l(Ri,"getGlobeRadiusPixels");function c_(r){let t=Math.asin(r[1])/Math.PI*180,n=Math.sqrt(r[0]*r[0]+r[2]*r[2]);if(n>1e-6){let i=r[0]/n,o=r[2]/n,a=Math.acos(o),u=(i>0?a:-a)/Math.PI*180;return new X(Qt(u,-180,180),t)}else return new X(0,t)}l(c_,"sphereSurfacePointToCoordinates");function U2(r){let e=Ge();e[0]=r[0]*-r[3],e[1]=r[1]*-r[3],e[2]=r[2]*-r[3];let t=Math.sqrt(1-r[3]*r[3]);return{center:e,radius:t}}l(U2,"horizonPlaneToCenterAndRadius");function j2(r,e,t){let n=Ge();V.sub(n,t,r);let i=Ge();return V.scaleAndAdd(i,r,n,e/V.len(n)),i}l(j2,"clampToSphere");function Vp(r){return Math.cos(r*Math.PI/180)}l(Vp,"planetScaleAtLatitude");function at(r,e){let t=Vp(r),n=Vp(e);return Ze(n/t)}l(at,"getZoomAdjustment");function NB(r,e){return 360/B2({worldSize:r,center:{lat:e}})}l(NB,"getDegreesPerPixel");function p_(r,e){let t=r.rotate(e.bearingInRadians),n=e.zoom+at(e.center.lat,0),i=jr(1/Vp(e.center.lat),1/Vp(Math.min(Math.abs(e.center.lat),60)),Ui(n,7,3,0,1)),o=NB(e.worldSize,e.center.lat);return new X(e.center.lng-t.x*o*i,se(e.center.lat+t.y*o,-wt,wt))}l(p_,"computeGlobePanCenter");function u_(r){let e=.5*r,t=Math.sin(e),n=Math.cos(e);return Math.log(t+n)-Math.log(n-t)}l(u_,"integrateSecX");function h_(r,e,t,n){let i=r.lat+t*n;if(Math.abs(t)>1){let o=r.lat+t,s=(Math.sign(o)!==Math.sign(r.lat)?-Math.abs(r.lat):Math.abs(r.lat))*Math.PI/180,u=Math.abs(r.lat+t)*Math.PI/180,c=u_(s+n*(u-s)),p=u_(s),h=u_(u),m=(c-p)/(h-p),f=r.lng+e*m;return new X(f,i)}else{let o=r.lng+e*n;return new X(o,i)}}l(h_,"interpolateLngLatForGlobe");y();y();var m_=class m_{constructor(e){this._cachePrevious=new Map;this._cache=new Map;this._hadAnyChanges=!1;this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,n,i){let o="".concat(e.z,"_").concat(e.x,"_").concat(e.y,"_").concat(i!=null&&i.terrain?"t":""),a=this._cache.get(o);if(a)return a;let s=this._cachePrevious.get(o);if(s)return this._cache.set(o,s),s;let u=this._boundingVolumeFactory(e,t,n,i);return this._cache.set(o,u),this._hadAnyChanges=!0,u}};l(m_,"BoundingVolumeCache");var Up=m_;y();var Ks=class Ks{constructor(e,t,n,i){this.min=n,this.max=i,this.points=e,this.planes=t}static fromAabb(e,t){let n=[];for(let i=0;i<8;i++)n.push([(i>>0&1)===1?t[0]:e[0],(i>>1&1)===1?t[1]:e[1],(i>>2&1)===1?t[2]:e[2]]);return new Ks(n,[[-1,0,0,t[0]],[1,0,0,-e[0]],[0,-1,0,t[1]],[0,1,0,-e[1]],[0,0,-1,t[2]],[0,0,1,-e[2]]],e,t)}static fromCenterSizeAngles(e,t,n){let i=sn.fromEuler([],n[0],n[1],n[2]),o=V.transformQuat([],[t[0],0,0],i),a=V.transformQuat([],[0,t[1],0],i),s=V.transformQuat([],[0,0,t[2]],i),u=[...e],c=[...e];for(let h=0;h<8;h++)for(let m=0;m<3;m++){let f=e[m]+o[m]*((h>>0&1)===1?1:-1)+a[m]*((h>>1&1)===1?1:-1)+s[m]*((h>>2&1)===1?1:-1);u[m]=Math.min(u[m],f),c[m]=Math.max(c[m],f)}let p=[];for(let h=0;h<8;h++){let m=[...e];V.add(m,m,V.scale([],o,(h>>0&1)===1?1:-1)),V.add(m,m,V.scale([],a,(h>>1&1)===1?1:-1)),V.add(m,m,V.scale([],s,(h>>2&1)===1?1:-1)),p.push(m)}return new Ks(p,[[...o,-V.dot(o,p[0])],[...a,-V.dot(a,p[0])],[...s,-V.dot(s,p[0])],[-o[0],-o[1],-o[2],-V.dot(o,p[7])],[-a[0],-a[1],-a[2],-V.dot(a,p[7])],[-s[0],-s[1],-s[2],-V.dot(s,p[7])]],u,c)}intersectsFrustum(e){let t=!0,n=this.points.length,i=this.planes.length,o=e.planes.length,a=e.points.length;for(let s=0;s<o;s++){let u=e.planes[s],c=0;for(let p=0;p<n;p++){let h=this.points[p];u[0]*h[0]+u[1]*h[1]+u[2]*h[2]+u[3]>=0&&c++}if(c===0)return 0;c<n&&(t=!1)}if(t)return 2;for(let s=0;s<i;s++){let u=this.planes[s],c=0;for(let p=0;p<a;p++){let h=e.points[p];u[0]*h[0]+u[1]*h[1]+u[2]*h[2]+u[3]>=0&&c++}if(c===0)return 0}return 1}intersectsPlane(e){let t=this.points.length,n=0;for(let i=0;i<t;i++){let o=this.points[i];e[0]*o[0]+e[1]*o[1]+e[2]*o[2]+e[3]>=0&&n++}return n===t?2:n===0?0:1}};l(Ks,"ConvexVolume");var Fo=Ks;function jp(r,e,t){let n=r-e;return n<0?-n:Math.max(0,n-t)}l(jp,"distanceToTileSimple");function f_(r,e,t,n,i){let o=r-t,a;return o<0?a=Math.min(-o,1+o-i):o>1?a=Math.min(Math.max(o-i,0),1-o):a=0,Math.max(a,jp(e,n,i))}l(f_,"distanceToTileWrapX");var d_=class d_{constructor(){this._boundingVolumeCache=new Up(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,n,i){let o=1<<n.z,a=1/o,s=n.x/o,u=n.y/o,c=1,p=.5*c,h=2*c;return h=Math.min(h,f_(e,t,s,u,a)),h=Math.min(h,f_(e,t,s+p,-u-a,a)),h=Math.min(h,f_(e,t,s+p,c+c-u-a,a)),h}getWrap(e,t,n){let i=1<<t.z,o=1/i,a=t.x/i,s=jp(e.x,a,o),u=jp(e.x,a-1,o),c=jp(e.x,a+1,o),p=Math.min(s,u,c);return p===c?1:p===u?-1:0}allowVariableZoom(e,t){return Ai(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,n,i){return this._boundingVolumeCache.getTileBoundingVolume(e,t,n,i)}_computeTileBoundingVolume(e,t,n,i){var s,u;let o=0,a=0;if(i!=null&&i.terrain){let c=new Oe(e.z,t,e.z,e.x,e.y),p=i.terrain.getMinMaxElevation(c);o=(s=p.minElevation)!=null?s:Math.min(0,n),a=(u=p.maxElevation)!=null?u:Math.max(0,n)}if(o/=Ft,a/=Ft,o+=1,a+=1,e.z<=0)return Fo.fromAabb([-a,-a,-a],[a,a,a]);if(e.z===1)return Fo.fromAabb([e.x===0?-a:0,e.y===0?0:-a,-a],[e.x===0?0:a,e.y===0?a:0,a]);{let c=[Or(0,0,e.x,e.y,e.z),Or(8192,0,e.x,e.y,e.z),Or(8192,8192,e.x,e.y,e.z),Or(0,8192,e.x,e.y,e.z)],p=[];for(let D of c)p.push(V.scale([],D,a));if(a!==o)for(let D of c)p.push(V.scale([],D,o));e.y===0&&p.push([0,1,0]),e.y===(1<<e.z)-1&&p.push([0,-1,0]);let h=[1,1,1],m=[-1,-1,-1];for(let D of p)for(let F=0;F<3;F++)h[F]=Math.min(h[F],D[F]),m[F]=Math.max(m[F],D[F]);let f=Or(8192/2,8192/2,e.x,e.y,e.z),d=V.cross([],[0,1,0],f);V.normalize(d,d);let g=V.cross([],f,d);V.normalize(g,g);let x=V.cross([],c[2],c[1]);V.normalize(x,x);let _=V.cross([],c[0],c[3]);V.normalize(_,_),p.push(V.scale([],f,a)),e.y>=(1<<e.z)/2&&p.push(V.scale([],Or(8192/2,0,e.x,e.y,e.z),a)),e.y<(1<<e.z)/2&&p.push(V.scale([],Or(8192/2,8192,e.x,e.y,e.z),a));let b=N2(f,p),v=N2(g,p),w=[-f[0],-f[1],-f[2],b.max],T=[f[0],f[1],f[2],-b.min],S=[-g[0],-g[1],-g[2],v.max],A=[g[0],g[1],g[2],-v.min],M=[...x,0],I=[..._,0],L=[];return e.y===0?L.push(Vt(I,M,w),Vt(I,M,T)):L.push(Vt(S,M,w),Vt(S,M,T),Vt(S,I,w),Vt(S,I,T)),e.y===(1<<e.z)-1?L.push(Vt(I,M,w),Vt(I,M,T)):L.push(Vt(A,M,w),Vt(A,M,T),Vt(A,I,w),Vt(A,I,T)),new Fo(L,[w,T,S,A,M,I],h,m)}}};l(d_,"GlobeCoveringTilesDetailsProvider");var Np=d_;function N2(r,e){let t=1/0,n=-1/0;for(let i of e){let o=V.dot(r,i);t=Math.min(t,o),n=Math.max(n,o)}return{min:t,max:n}}l(N2,"findAxisMinMax");var Gp=class Gp{constructor(){this._cachedClippingPlane=Vi();this._projectionMatrix=ln();this._globeViewProjMatrix32f=Ol();this._globeViewProjMatrixNoCorrection=ln();this._globeViewProjMatrixNoCorrectionInverted=ln();this._globeProjMatrixInverted=ln();this._cameraPosition=Ge();this._globeLatitudeErrorCorrectionRadians=0;this._helper=new Un({calcMatrices:l(()=>{this._calcMatrices()},"calcMatrices"),getConstrained:l((e,t)=>this.getConstrained(e,t),"getConstrained")}),this._coveringTilesDetailsProvider=new Np}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){return this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}clone(){let e=new Gp;return e.apply(this),e}apply(e,t){this._globeLatitudeErrorCorrectionRadians=t||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let e=Ge();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){let{overscaledTileID:t,applyGlobeMatrix:n}=e,i=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:i,clippingPlane:this._cachedClippingPlane,projectionTransition:n?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){let t=this.pitchInRadians,n=this.cameraToCenterDistance/e,i=1,o=Math.sin(t)*n,a=Math.cos(t)*n+i,s=Math.sqrt(o*o+a*a),c=i/s*i,p=-o,h=a,m=Math.sqrt(p*p+h*h);p/=m,h/=m;let f=[0,p,h];V.rotateZ(f,f,[0,0,0],-this.bearingInRadians),V.rotateX(f,f,[0,0,0],-1*this.center.lat*Math.PI/180),V.rotateY(f,f,[0,0,0],this.center.lng*Math.PI/180);let d=1/V.length(f);return V.scale(f,f,d),[...f,-c*d]}isLocationOccluded(e){return!this.isSurfacePointVisible(ht(e))}transformLightDirection(e){let t=this._helper._center.lng*Math.PI/180,n=this._helper._center.lat*Math.PI/180,i=Math.cos(n),o=[Math.sin(t)*i,Math.sin(n),Math.cos(t)*i],a=[o[2],0,-o[0]],s=[0,0,0];V.cross(s,a,o),V.normalize(a,a),V.normalize(s,s);let u=[a[0]*e[0]+s[0]*e[1]+o[0]*e[2],a[1]*e[0]+s[1]*e[1]+o[1]*e[2],a[2]*e[0]+s[2]*e[1]+o[2]*e[2]],c=[0,0,0];return V.normalize(c,u),c}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,t,n){let i=HT(e,t,n.canonical),o=V2(i.x,i.y);return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(e,t,n,i){let o=n.canonical,a=Or(e,t,o.x,o.y,o.z),u=1+(i?i(e,t):0)/Ft,c=[a[0]*u,a[1]*u,a[2]*u,1];Re.transformMat4(c,c,this._globeViewProjMatrixNoCorrection);let p=this._cachedClippingPlane,m=p[0]*a[0]+p[1]*a[1]+p[2]*a[2]+p[3]<0;return{point:new br.default(c[0]/c[3],c[1]/c[3]),signedDistanceFromCamera:c[3],isOccluded:m}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let e=Ri(this.worldSize,this.center.lat),t=pr(),n=pr();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+e*2),z.perspective(t,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let i=this.centerOffset;t[8]=-i.x*2/this._helper._width,t[9]=i.y*2/this._helper._height,this._projectionMatrix=z.clone(t),this._globeProjMatrixInverted=pr(),z.invert(this._globeProjMatrixInverted,t),z.translate(t,t,[0,0,-this.cameraToCenterDistance]),z.rotateZ(t,t,this.rollInRadians),z.rotateX(t,t,-this.pitchInRadians),z.rotateZ(t,t,this.bearingInRadians),z.translate(t,t,[0,0,-e]);let o=Ge();o[0]=e,o[1]=e,o[2]=e,z.rotateX(n,t,this.center.lat*Math.PI/180),z.rotateY(n,n,-this.center.lng*Math.PI/180),z.scale(n,n,o),this._globeViewProjMatrixNoCorrection=n,z.rotateX(t,t,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),z.rotateY(t,t,-this.center.lng*Math.PI/180),z.scale(t,t,o),this._globeViewProjMatrix32f=new Float32Array(t),this._globeViewProjMatrixNoCorrectionInverted=pr(),z.invert(this._globeViewProjMatrixNoCorrectionInverted,n);let a=Ge();this._cameraPosition=Ge(),this._cameraPosition[2]=this.cameraToCenterDistance/e,V.rotateZ(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),V.rotateX(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),V.rotateZ(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),V.add(this._cameraPosition,this._cameraPosition,[0,0,1]),V.rotateX(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),V.rotateY(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);let s=z.clone(this._globeViewProjMatrixNoCorrectionInverted);z.scale(s,s,[1,1,-1]),this._cachedFrustum=Ro.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){ce("calculateFogMatrix is not supported on globe projection.");let t=pr();return z.identity(t),t}getVisibleUnwrappedCoordinates(e){return[new Rn(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&ce("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){if(!this._globeViewProjMatrixNoCorrection)return 1;let n=ht(e);V.scale(n,n,1+t/Ft);let i=Vi();return Re.transformMat4(i,[n[0],n[1],n[2],1],this._globeViewProjMatrixNoCorrection),i[2]/i[3]}populateCache(e){}getBounds(){let e=this.width*.5,t=this.height*.5,n=[new br.default(0,0),new br.default(e,0),new br.default(this.width,0),new br.default(this.width,t),new br.default(this.width,this.height),new br.default(e,this.height),new br.default(0,this.height),new br.default(0,t)],i=[];for(let h of n)i.push(this.unprojectScreenPoint(h));let o=0,a=0,s=0,u=0,c=this.center;for(let h of i){let m=vt(c.lng,h.lng),f=vt(c.lat,h.lat);m<a&&(a=m),m>o&&(o=m),f<u&&(u=f),f>s&&(s=f)}let p=[c.lng+a,c.lat+u,c.lng+o,c.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(p[3]=90,p[0]=-180,p[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(p[1]=-90,p[0]=-180,p[2]=180),new ot(p)}getConstrained(e,t){let n=se(e.lat,-wt,wt),i=se(+t,this.minZoom+at(0,n),this.maxZoom);return{center:new X(e.lng,n),zoom:i}}calculateCenterFromCameraLngLatAlt(e,t,n,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,i)}setLocationAtPoint(e,t){let n=this.unprojectScreenPoint(t),i=ht(n),o=ht(e),a=Ge();V.zero(a);let s=Ge();V.rotateY(s,i,a,-this.center.lng*Math.PI/180),V.rotateX(s,s,a,this.center.lat*Math.PI/180);let u=o[0]*o[0]+o[2]*o[2],c=s[0]*s[0];if(u<c)return;let p=Math.sqrt(u-c),h=-p,m=Ho(o[0],o[2],s[0],p),f=Ho(o[0],o[2],s[0],h),d=Ge();V.rotateY(d,o,a,-m);let g=Ho(d[1],d[2],s[1],s[2]),x=Ge();V.rotateY(x,o,a,-f);let _=Ho(x[1],x[2],s[1],s[2]),b=Math.PI*.5,v=g>=-b&&g<=b,w=_>=-b&&_<=b,T,S;if(v&&w){let L=this.center.lng*Math.PI/180,D=this.center.lat*Math.PI/180,F=Wo(m,L),U=Wo(g,D),C=Wo(f,L),k=Wo(_,D);F+U<C+k?(T=m,S=g):(T=f,S=_)}else if(v)T=m,S=g;else if(w)T=f,S=_;else return;let A=T/Math.PI*180,M=S/Math.PI*180,I=this.center.lat;this.setCenter(new X(A,se(M,-90,90))),this.setZoom(this.zoom+at(I,this.center.lat))}locationToScreenPoint(e,t){let n=ht(e);if(t){let i=t.getElevationForLngLatZoom(e,this._helper._tileZoom);V.scale(n,n,1+i/Ft)}return this._projectSurfacePointToScreen(n)}_projectSurfacePointToScreen(e){let t=Vi();return Re.transformMat4(t,[...e,1],this._globeViewProjMatrixNoCorrection),t[0]/=t[3],t[1]/=t[3],new br.default((t[0]*.5+.5)*this.width,(-t[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(e,t){if(t){let n=t.pointCoordinate(e);if(n)return n}return de.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,t){var n;return(n=this.screenPointToMercatorCoordinate(e,t))==null?void 0:n.toLngLat()}isPointOnMapSurface(e,t){let n=this._cameraPosition,i=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(n,i)}getRayDirectionFromPixel(e){let t=Vi();t[0]=e.x/this.width*2-1,t[1]=(e.y/this.height*2-1)*-1,t[2]=1,t[3]=1,Re.transformMat4(t,t,this._globeViewProjMatrixNoCorrectionInverted),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3];let n=Ge();n[0]=t[0]-this._cameraPosition[0],n[1]=t[1]-this._cameraPosition[1],n[2]=t[2]-this._cameraPosition[2];let i=Ge();return V.normalize(i,n),i}isSurfacePointVisible(e){let t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;let t=Vi();return Re.transformMat4(t,[...e,1],this._globeViewProjMatrixNoCorrection),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3],t[0]>-1&&t[0]<1&&t[1]>-1&&t[1]<1&&t[2]>-1&&t[2]<1}rayPlanetIntersection(e,t){let n=V.dot(e,t),i=1,o=Ge(),a=Ge();V.scale(a,t,n),V.sub(o,e,a);let s=i-V.dot(o,o);if(s<0)return null;let u=V.dot(e,e)-i,c=-n+(n<0?1:-1)*Math.sqrt(s),p=u/c,h=c,m=Math.min(p,h),f=Math.max(p,h);return{tMin:m,tMax:f}}unprojectScreenPoint(e){let t=this._cameraPosition,n=this.getRayDirectionFromPixel(e),i=this.rayPlanetIntersection(t,n);if(i){let f=Ge();V.add(f,t,[n[0]*i.tMin,n[1]*i.tMin,n[2]*i.tMin]);let d=Ge();return V.normalize(d,f),c_(d)}let o=this._cachedClippingPlane,a=o[0]*n[0]+o[1]*n[1]+o[2]*n[2],u=-qo(o,t)/a,c=2,p=Ge();if(u>0)V.add(p,t,[n[0]*u,n[1]*u,n[2]*u]);else{let f=Ge();V.add(f,t,[n[0]*c,n[1]*c,n[2]*c]);let d=qo(this._cachedClippingPlane,f);V.sub(p,f,[this._cachedClippingPlane[0]*d,this._cachedClippingPlane[1]*d,this._cachedClippingPlane[2]*d])}let h=U2(o),m=j2(h.center,h.radius,p);return c_(m)}getMatrixForModel(e,t){let n=X.convert(e),i=1/Ft,o=ln();return z.rotateY(o,o,n.lng/180*Math.PI),z.rotateX(o,o,-n.lat/180*Math.PI),z.translate(o,o,[0,0,1+t/Ft]),z.rotateX(o,o,Math.PI*.5),z.scale(o,o,[i,i,i]),o}getProjectionDataForCustomLayer(e=!0){let t=this.getProjectionData({overscaledTileID:new Oe(0,0,0,0,0),applyGlobeMatrix:e});return t.tileMercatorCoords=[0,0,1,1],t}getFastPathSimpleProjectionMatrix(e){}};l(Gp,"VerticalPerspectiveTransform");var zo=Gp;var Zp=class Zp{constructor(){this._globeLatitudeErrorCorrectionRadians=0;this._globeness=1;this._helper=new Un({calcMatrices:l(()=>{this._calcMatrices()},"calcMatrices"),getConstrained:l((e,t)=>this.getConstrained(e,t),"getConstrained")}),this._globeness=1,this._mercatorTransform=new en,this._verticalPerspectiveTransform=new zo}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){return this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,n=!0){this._helper.resize(e,t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,t){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}clone(){let e=new Zp;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){let t=this._mercatorTransform.getProjectionData(e),n=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?n.mainMatrix:t.mainMatrix,clippingPlane:n.clippingPlane,tileMercatorCoords:n.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return jr(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return jr(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,t,n){let i=this._mercatorTransform.getPitchedTextCorrection(e,t,n),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,t,n);return jr(i,o,this._globeness)}projectTileCoordinates(e,t,n,i){return this.currentTransform.projectTileCoordinates(e,t,n,i)}_calcMatrices(){!this._helper._width||!this._helper._height||(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,t){return this.currentTransform.getConstrained(e,t)}calculateCenterFromCameraLngLatAlt(e,t,n,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,i)}setLocationAtPoint(e,t){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(e,t),this.apply(this._mercatorTransform);return}this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,t){return this.currentTransform.getMatrixForModel(e,t)}getProjectionDataForCustomLayer(e=!0){let t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;let n=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return n.fallbackMatrix=t.mainMatrix,n}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}};l(Zp,"GlobeTransform");var Js=Zp;y();y();var qp=oe(ue(),1);var vr=class vr{get useGlobeControls(){return!0}handlePanInertia(e,t){let n=p_(e,t);return Math.abs(n.lng-t.center.lng)>180&&(n.lng=t.center.lng+179.5*Math.sign(n.lng-t.center.lng)),{easingCenter:n,easingOffset:new qp.default(0,0)}}handleMapControlsRollPitchBearingZoom(e,t){let n=e.around,i=t.screenPointToLocation(n);e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta);let o=t.zoom;e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta);let a=t.zoom-o;if(a===0)return;let s=.3,u=.5,c=45,p=85,h=.25,m=.75,f=.35,d=.9,g=.5,x=.25,_=vt(t.center.lng,i.lng),b=_/(Math.abs(_/180)+1),v=vt(t.center.lat,i.lat),w=t.getRayDirectionFromPixel(n),T=t.cameraPosition,S=V.dot(T,w)*-1,A=Ge();V.add(A,T,[w[0]*S,w[1]*S,w[2]*S]);let M=V.length(A)-1,I=Math.exp(-Math.max(M-s,0)*u),L=Ri(t.worldSize,t.center.lat)/Math.min(t.width,t.height),D=Ui(L,d,g,1,x),F=(1-Ye(-a))*Math.min(I,D),U=t.center.lat,C=t.zoom,k=new X(t.center.lng+b*F,se(t.center.lat+v*F,-wt,wt));t.setLocationAtPoint(i,n);let H=t.center,$=Ui(Math.abs(_),c,p,0,1),K=Ui(L,m,f,0,1),me=Math.pow(Math.max($,K),h),Ve=vt(H.lng,k.lng),_e=vt(H.lat,k.lat);t.setCenter(new X(H.lng+Ve*me,H.lat+_e*me).wrap()),t.setZoom(C+at(U,t.center.lat))}handleMapControlsPan(e,t,n){if(!e.panDelta)return;let i=t.center.lat,o=t.zoom;t.setCenter(p_(e.panDelta,t).wrap()),t.setZoom(o+at(i,t.center.lat))}cameraForBoxAndBearing(e,t,n,i,o){let a=Fp(e,t,n,i,o),s=t.left/o.width*2-1,u=(o.width-t.right)/o.width*2-1,c=t.top/o.height*-2+1,p=(o.height-t.bottom)/o.height*-2+1,h=vt(n.getWest(),n.getEast())<0,m=h?n.getEast():n.getWest(),f=h?n.getWest():n.getEast(),d=Math.max(n.getNorth(),n.getSouth()),g=Math.min(n.getNorth(),n.getSouth()),x=m+vt(m,f)*.5,_=d+vt(d,g)*.5,b=o.clone();b.setCenter(a.center),b.setBearing(a.bearing),b.setPitch(0),b.setRoll(0),b.setZoom(a.zoom);let v=b.modelViewProjectionMatrix,w=[ht(n.getNorthWest()),ht(n.getNorthEast()),ht(n.getSouthWest()),ht(n.getSouthEast()),ht(new X(f,_)),ht(new X(m,_)),ht(new X(x,d)),ht(new X(x,g))],T=ht(a.center),S=Number.POSITIVE_INFINITY;for(let A of w)s<0&&(S=vr.getLesserNonNegativeNonNull(S,vr.solveVectorScale(A,T,v,"x",s))),u>0&&(S=vr.getLesserNonNegativeNonNull(S,vr.solveVectorScale(A,T,v,"x",u))),c>0&&(S=vr.getLesserNonNegativeNonNull(S,vr.solveVectorScale(A,T,v,"y",c))),p<0&&(S=vr.getLesserNonNegativeNonNull(S,vr.solveVectorScale(A,T,v,"y",p)));if(!Number.isFinite(S)||S===0){Qx();return}return a.zoom=b.zoom+Ze(S),a}handleJumpToCenterZoom(e,t){let n=e.center.lat,i=e.getConstrained(t.center?X.convert(t.center):e.center,e.zoom).center;e.setCenter(i.wrap());let o=typeof t.zoom<"u"?+t.zoom:e.zoom+at(n,i.lat);e.zoom!==o&&e.setZoom(o)}handleEaseTo(e,t){let n=e.zoom,i=e.center,o=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s=t.roll===void 0?e.roll:t.roll,u=t.pitch===void 0?e.pitch:t.pitch,c=t.bearing===void 0?e.bearing:t.bearing,p={roll:s,pitch:u,bearing:c},h=typeof t.zoom<"u",m=!e.isPaddingEqual(t.padding),f=!1,d=t.center?X.convert(t.center):i,g=e.getConstrained(d,n).center;Lo(e,g);let x=e.clone();x.setCenter(g),x.setZoom(h?+t.zoom:n+at(i.lat,d.lat)),x.setBearing(t.bearing);let _=new qp.default(se(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),se(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));x.setLocationAtPoint(g,_);let b=(t.offset&&t.offsetAsPoint.mag())>0?x.center:g,v=h?+t.zoom:n+at(i.lat,b.lat),w=n+at(i.lat,0),T=v+at(b.lat,0),S=vt(i.lng,b.lng),A=vt(i.lat,b.lat),M=Ye(T-w);return f=v!==n,{easeFunc:l(L=>{if(Nl(a,p)||Dp({startEulerAngles:a,endEulerAngles:p,tr:e,k:L,useSlerp:a.roll!=p.roll}),m&&e.interpolatePadding(o,t.padding,L),t.around)ce("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(t.around,t.aroundPoint);else{let D=T>w?Math.min(2,M):Math.max(.5,M),F=Math.pow(D,1-L),U=L*F,C=h_(i,S,A,U);e.setCenter(C.wrap())}if(f){let F=Ae.number(w,T,L)+at(0,e.center.lat);e.setZoom(F)}},"easeFunc"),isZooming:f,elevationCenter:b}}handleFlyTo(e,t){let n=typeof t.zoom<"u",i=e.center,o=e.zoom,a=e.padding,s=!e.isPaddingEqual(t.padding),u=e.getConstrained(X.convert(t.center||t.locationAtOffset),o).center,c=n?+t.zoom:e.zoom+at(e.center.lat,u.lat),p=e.clone();p.setCenter(u),p.setZoom(c),p.setBearing(t.bearing);let h=new qp.default(se(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),se(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));p.setLocationAtPoint(u,h);let m=p.center;Lo(e,m);let f=O2(e,i,m),d=o+at(i.lat,0),g=c+at(m.lat,0),x=Ye(g-d),_=typeof t.minZoom=="number",b;if(_){let S=+t.minZoom+at(m.lat,0),M=Math.min(S,d,g)+at(0,m.lat),L=e.getConstrained(m,M).zoom+at(m.lat,0);b=Ye(L-d)}let v=vt(i.lng,m.lng),w=vt(i.lat,m.lat);return{easeFunc:l((S,A,M,I)=>{let L=h_(i,v,w,M);s&&e.interpolatePadding(a,t.padding,S);let D=S===1?m:L;e.setCenter(D.wrap());let F=d+Ze(A);e.setZoom(S===1?c:F+at(0,D.lat))},"easeFunc"),scaleOfZoom:x,targetCenter:m,scaleOfMinZoom:b,pixelPathLength:f}}static solveVectorScale(e,t,n,i,o){let a=o,s=i==="x"?[n[0],n[4],n[8],n[12]]:[n[1],n[5],n[9],n[13]],u=[n[3],n[7],n[11],n[15]],c=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],p=e[0]*u[0]+e[1]*u[1]+e[2]*u[2],h=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],m=t[0]*u[0]+t[1]*u[1]+t[2]*u[2],f=(h+s[3]-a*m-a*u[3])/(h-c-a*m+a*p);return h+a*p===c+a*m||u[3]*(c-h)+s[3]*(m-p)+c*m===h*p?null:f}static getLesserNonNegativeNonNull(e,t){return t!==null&&t>=0&&t<e?t:e}};l(vr,"VerticalPerspectiveCameraHelper");var Bo=vr;var y_=class y_{constructor(e){this._globe=e,this._mercatorCameraHelper=new tn,this._verticalPerspectiveCameraHelper=new Bo}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,n){this.currentHelper.handleMapControlsPan(e,t,n)}cameraForBoxAndBearing(e,t,n,i,o){return this.currentHelper.cameraForBoxAndBearing(e,t,n,i,o)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};l(y_,"GlobeCameraHelper");var Qs=y_;function G2(r){if(Array.isArray(r)){let e=new Ys({type:r});return{projection:e,transform:new Js,cameraHelper:new Qs(e)}}switch(r){case"mercator":return{projection:new ki,transform:new en,cameraHelper:new tn};case"globe":{let e=new Ys({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new Js,cameraHelper:new Qs(e)}}case"vertical-perspective":return{projection:new Do,transform:new zo,cameraHelper:new Bo};default:return ce("Unknown projection name: ".concat(r,". Falling back to mercator projection.")),{projection:new ki,transform:new en,cameraHelper:new tn}}}l(G2,"createProjectionFromName");var Hp=l((r,e)=>bn(r,e&&e.filter(t=>t.identifier!=="source.canvas")),"emitValidationErrors"),GB=tw(),g_=class g_ extends be{constructor(t,n={}){super();this._rtlPluginLoaded=l(()=>{for(let t in this.sourceCaches){let n=this.sourceCaches[t].getSource().type;(n==="vector"||n==="geojson")&&this.sourceCaches[t].reload()}},"_rtlPluginLoaded");this.map=t,this.dispatcher=new Is(As(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(i,o)=>this.getGlyphs(i,o)),this.dispatcher.registerMessageHandler("GI",(i,o)=>this.getImages(i,o)),this.imageManager=new Kc,this.imageManager.setEventedParent(this),this.glyphManager=new Jc(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new tp(256,512),this.crossTileSymbolIndex=new Io,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new hi,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",Wl()),Dn().on(Bs,this._rtlPluginLoaded),this.on("data",i=>{if(i.dataType!=="source"||i.sourceDataType!=="metadata")return;let o=this.sourceCaches[i.sourceId];if(!o)return;let a=o.getSource();if(!(!a||!a.vectorLayerIds))for(let s in this._layers){let u=this._layers[s];u.source===a.id&&this._validateLayer(u)}})}setGlobalStateProperty(t,n){var a,s,u;this._checkLoaded();let i=n===null?(u=(s=(a=this.stylesheet.state)==null?void 0:a[t])==null?void 0:s.default)!=null?u:null:n;if(Jt(i,this._globalState[t]))return this;this._globalState[t]=i;let o=this._findGlobalStateAffectedSources([t]);for(let c in this.sourceCaches)o.has(c)&&(this._reloadSource(c),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let n=[];for(let o in t)!Jt(this._globalState[o],t[o].default)&&(n.push(o),this._globalState[o]=t[o].default);let i=this._findGlobalStateAffectedSources(n);for(let o in this.sourceCaches)i.has(o)&&(this._reloadSource(o),this._changed=!0)}_findGlobalStateAffectedSources(t){if(t.length===0)return new Set;let n=new Set;for(let i in this._layers){let o=this._layers[i],a=o.getLayoutAffectingGlobalStateRefs();for(let s of t)a.has(s)&&n.add(o.source)}return n}loadURL(t,n={},i){this.fire(new B("dataloading",{dataType:"style"})),n.validate=typeof n.validate=="boolean"?n.validate:!0;let o=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;let a=this._loadStyleRequest;cn(o,this._loadStyleRequest).then(s=>{this._loadStyleRequest=null,this._load(s.data,n,i)}).catch(s=>{this._loadStyleRequest=null,s&&!a.signal.aborted&&this.fire(new J(s))})}loadJSON(t,n={},i){this.fire(new B("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,ne.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,i)}).catch(()=>{})}loadEmpty(){this.fire(new B("dataloading",{dataType:"style"})),this._load(GB,{validate:!1})}_load(t,n,i){var a,s,u;let o=n.transformStyle?n.transformStyle(i,t):t;if(!(n.validate&&Hp(this,je(o)))){this._loaded=!0,this.stylesheet=o;for(let c in o.sources)this.addSource(c,o.sources[c],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new Qc(this.stylesheet.light),this._setProjectionInternal(((a=this.stylesheet.projection)==null?void 0:a.type)||"mercator"),this.sky=new ep(this.stylesheet.sky),this.map.setTerrain((s=this.stylesheet.terrain)!=null?s:null),this.setGlobalState((u=this.stylesheet.state)!=null?u:null),this.fire(new B("data",{dataType:"style"})),this.fire(new B("style.load"))}}_createLayers(){let t=Mf(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(let n of t){let i=Xc(n);i.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=i}}_loadSprite(t,n=!1,i=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController;let o;xT(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(a=>{if(this._spriteRequest=null,a)for(let s in a){this._spritesImagesIds[s]=[];let u=this._spritesImagesIds[s]?this._spritesImagesIds[s].filter(c=>!(c in a)):[];for(let c of u)this.imageManager.removeImage(c),this._changedImages[c]=!0;for(let c in a[s]){let p=s==="default"?c:"".concat(s,":").concat(c);this._spritesImagesIds[s].push(p),p in this.imageManager.images?this.imageManager.updateImage(p,a[s][c],!1):this.imageManager.addImage(p,a[s][c]),n&&(this._changedImages[p]=!0)}}}).catch(a=>{this._spriteRequest=null,o=a,this.fire(new J(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new B("data",{dataType:"style"})),i&&i(o)})}_unloadSprite(){for(let t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new B("data",{dataType:"style"}))}_validateLayer(t){let n=this.sourceCaches[t.source];if(!n)return;let i=t.sourceLayer;if(!i)return;let o=n.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(i)===-1)&&this.fire(new J(new Error('Source layer "'.concat(i,'" ')+'does not exist on source "'.concat(o.id,'" ')+'as specified by style layer "'.concat(t.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,n=!1){let i=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n?yt(i):i);let o=[];for(let a of t)if(i[a]){let s=n?yt(i[a]):i[a];o.push(s)}return o}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};let n=Object.keys(this._layers);for(let i of n){let o=this._layers[i];o.type!=="custom"&&(t[i]=o.serialize())}return t}hasTransitions(){var t,n,i;if((t=this.light)!=null&&t.hasTransition()||(n=this.sky)!=null&&n.hasTransition()||(i=this.projection)!=null&&i.hasTransition())return!0;for(let o in this.sourceCaches)if(this.sourceCaches[o].hasTransition())return!0;for(let o in this._layers)if(this._layers[o].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;let n=this._changed;if(n){let o=Object.keys(this._updatedLayers),a=Object.keys(this._removedLayers);(o.length||a.length)&&this._updateWorkerLayers(o,a);for(let s in this._updatedSources){let u=this._updatedSources[s];if(u==="reload")this._reloadSource(s);else if(u==="clear")this._clearSource(s);else throw new Error("Invalid action ".concat(u))}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}let i={};for(let o in this.sourceCaches){let a=this.sourceCaches[o];i[o]=a.used,a.used=!1}for(let o of this._order){let a=this._layers[o];a.recalculate(t,this._availableImages),!a.isHidden(t.zoom)&&a.source&&(this.sourceCaches[a.source].used=!0)}for(let o in i){let a=this.sourceCaches[o];!!i[o]!=!!a.used&&a.fire(new B("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,n&&this.fire(new B("data",{dataType:"style"}))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){var u;this._checkLoaded();let i=this.serialize();if(t=n.transformStyle?n.transformStyle(i,t):t,((u=n.validate)!=null?u:!0)&&Hp(this,je(t)))return!1;t=yt(t),t.layers=Mf(t.layers);let a=k1(i,t),s=this._getOperationsToPerform(a);if(s.unimplemented.length>0)throw new Error("Unimplemented: ".concat(s.unimplemented.join(", "),"."));if(s.operations.length===0)return!1;for(let c of s.operations)c();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){let n=[],i=[];for(let o of t)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":n.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":n.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,o.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setSky":n.push(()=>this.setSky.apply(this,o.args));break;case"setProjection":this.setProjection.apply(this,o.args);break;case"setGlobalState":n.push(()=>this.setGlobalState.apply(this,o.args));break;case"setTransition":n.push(()=>{});break;default:i.push(o.command);break}return{operations:n,unimplemented:i}}addImage(t,n){if(this.getImage(t))return this.fire(new J(new Error('An image named "'.concat(t,'" already exists.'))));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new J(new Error('An image named "'.concat(t,'" does not exist.'))));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new B("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,i={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error('Source "'.concat(t,'" already exists.'));if(!n.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(n).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(je.source,"sources.".concat(t),n,null,i))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let s=this.sourceCaches[t]=new Jr(t,n,this.dispatcher);s.style=this,s.setEventedParent(this,()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:t})),s.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(let i in this._layers)if(this._layers[i].source===t)return this.fire(new J(new Error('Source "'.concat(t,'" cannot be removed while layer "').concat(i,'" is using it.'))));let n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new B("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID=".concat(t));let i=this.sourceCaches[t].getSource();if(i.type!=="geojson")throw new Error("geojsonSource.type is ".concat(i.type,", which is !== 'geojson"));i.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,i={}){this._checkLoaded();let o=t.id;if(this.getLayer(o)){this.fire(new J(new Error('Layer "'.concat(o,'" already exists on this map.'))));return}let a;if(t.type==="custom"){if(Hp(this,dT(t)))return;a=Xc(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(o,t.source),t=yt(t),t=G(t,{source:o})),this._validate(je.layer,"layers.".concat(o),t,{arrayIndex:-1},i))return;a=Xc(t),this._validateLayer(a),a.setEventedParent(this,{layer:{id:o}})}let s=n?this._order.indexOf(n):this._order.length;if(n&&s===-1){this.fire(new J(new Error('Cannot add layer "'.concat(o,'" before non-existing layer "').concat(n,'".'))));return}if(this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=a,this._removedLayers[o]&&a.source&&a.type!=="custom"){let u=this._removedLayers[o];delete this._removedLayers[o],u.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t]){this.fire(new J(new Error("The layer '".concat(t,"' does not exist in the map's style and cannot be moved."))));return}if(t===n)return;let o=this._order.indexOf(t);this._order.splice(o,1);let a=n?this._order.indexOf(n):this._order.length;if(n&&a===-1){this.fire(new J(new Error('Cannot move layer "'.concat(t,'" before non-existing layer "').concat(n,'".'))));return}this._order.splice(a,0,t),this._layerOrderChanged=!0}removeLayer(t){this._checkLoaded();let n=this._layers[t];if(!n){this.fire(new J(new Error('Cannot remove non-existing layer "'.concat(t,'".'))));return}n.setEventedParent(null);let i=this._order.indexOf(t);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,i){this._checkLoaded();let o=this.getLayer(t);if(!o){this.fire(new J(new Error('Cannot set the zoom range of non-existing layer "'.concat(t,'".'))));return}o.minzoom===n&&o.maxzoom===i||(n!=null&&(o.minzoom=n),i!=null&&(o.maxzoom=i),this._updateLayer(o))}setFilter(t,n,i={}){this._checkLoaded();let o=this.getLayer(t);if(!o){this.fire(new J(new Error('Cannot filter non-existing layer "'.concat(t,'".'))));return}if(!Jt(o.filter,n)){if(n==null){o.setFilter(void 0),this._updateLayer(o);return}this._validate(je.filter,"layers.".concat(o.id,".filter"),n,null,i)||(o.setFilter(yt(n)),this._updateLayer(o))}}getFilter(t){return yt(this.getLayer(t).filter)}setLayoutProperty(t,n,i,o={}){this._checkLoaded();let a=this.getLayer(t);if(!a){this.fire(new J(new Error('Cannot style non-existing layer "'.concat(t,'".'))));return}Jt(a.getLayoutProperty(n),i)||(a.setLayoutProperty(n,i,o),this._updateLayer(a))}getLayoutProperty(t,n){let i=this.getLayer(t);if(!i){this.fire(new J(new Error('Cannot get style of non-existing layer "'.concat(t,'".'))));return}return i.getLayoutProperty(n)}setPaintProperty(t,n,i,o={}){this._checkLoaded();let a=this.getLayer(t);if(!a){this.fire(new J(new Error('Cannot style non-existing layer "'.concat(t,'".'))));return}if(Jt(a.getPaintProperty(n),i))return;a.setPaintProperty(n,i,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();let i=t.source,o=t.sourceLayer,a=this.sourceCaches[i];if(a===void 0){this.fire(new J(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let s=a.getSource().type;if(s==="geojson"&&o){this.fire(new J(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(s==="vector"&&!o){this.fire(new J(new Error("The sourceLayer parameter must be provided for vector source types.")));return}t.id===void 0&&this.fire(new J(new Error("The feature id parameter must be provided."))),a.setFeatureState(o,t.id,n)}removeFeatureState(t,n){this._checkLoaded();let i=t.source,o=this.sourceCaches[i];if(o===void 0){this.fire(new J(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let a=o.getSource().type,s=a==="vector"?t.sourceLayer:void 0;if(a==="vector"&&!s){this.fire(new J(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(n&&typeof t.id!="string"&&typeof t.id!="number"){this.fire(new J(new Error("A feature id is required to remove its specific state property.")));return}o.removeFeatureState(s,t.id,n)}getFeatureState(t){this._checkLoaded();let n=t.source,i=t.sourceLayer,o=this.sourceCaches[n];if(o===void 0){this.fire(new J(new Error("The source '".concat(n,"' does not exist in the map's style."))));return}if(o.getSource().type==="vector"&&!i){this.fire(new J(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return t.id===void 0&&this.fire(new J(new Error("The feature id parameter must be provided."))),o.getFeatureState(i,t.id)}getTransition(){return G({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let t=Yo(this.sourceCaches,a=>a.serialize()),n=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,o=this.stylesheet;return jl({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,projection:o.projection,sources:t,layers:n,terrain:i},a=>a!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let n=l(s=>this._layers[s].type==="fill-extrusion","isLayer3D"),i={},o=[];for(let s=this._order.length-1;s>=0;s--){let u=this._order[s];if(n(u)){i[u]=s;for(let c of t){let p=c[u];if(p)for(let h of p)o.push(h)}}}o.sort((s,u)=>u.intersectionZ-s.intersectionZ);let a=[];for(let s=this._order.length-1;s>=0;s--){let u=this._order[s];if(n(u))for(let c=o.length-1;c>=0;c--){let p=o[c].feature;if(i[p.layer.id]<s)break;a.push(p),o.pop()}else for(let c of t){let p=c[u];if(p)for(let h of p)a.push(h.feature)}}return a}queryRenderedFeatures(t,n,i){n&&n.filter&&this._validate(je.filter,"queryRenderedFeatures.filter",n.filter,null,n);let o={};if(n&&n.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new J(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(let h of n.layers){let m=this._layers[h];if(!m)return this.fire(new J(new Error("The layer '".concat(h,"' does not exist in the map's style and cannot be queried for features.")))),[];o[m.source]=!0}}let a=[];n.availableImages=this._availableImages;let s=this._serializedAllLayers(),u=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,c=St($e({},n),{layers:u});for(let p in this.sourceCaches)n.layers&&!o[p]||a.push(MT(this.sourceCaches[p],this._layers,s,t,c,i,this.map.terrain?(h,m,f)=>this.map.terrain.getElevation(h,m,f):void 0));return this.placement&&a.push(CT(this._layers,s,this.sourceCaches,t,c,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(t,n){n&&n.filter&&this._validate(je.filter,"querySourceFeatures.filter",n.filter,null,n);let i=this.sourceCaches[t];return i?AT(i,n):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();let i=this.light.getLight(),o=!1;for(let s in t)if(!Jt(t[s],i[s])){o=!0;break}if(!o)return;let a={now:ne.now(),transition:G({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(a)}getProjection(){var t;return(t=this.stylesheet)==null?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=t,this._setProjectionInternal(t.type)}getSky(){var t;return(t=this.stylesheet)==null?void 0:t.sky}setSky(t,n={}){this._checkLoaded();let i=this.getSky(),o=!1;if(!t&&!i)return;if(t&&!i)o=!0;else if(!t&&i)o=!0;else for(let s in t)if(!Jt(t[s],i[s])){o=!0;break}if(!o)return;let a={now:ne.now(),transition:G({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(a)}_setProjectionInternal(t){let n=G2(t);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(let i in this.sourceCaches)this.sourceCaches[i].reload()}_validate(t,n,i,o,a={}){return a&&a.validate===!1?!1:Hp(this,t.call(je,G({key:n,style:this.serialize(),value:i,styleSpec:E},o)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Dn().off(Bs,this._rtlPluginLoaded);for(let n in this._layers)this._layers[n].setEventedParent(null);for(let n in this.sourceCaches){let i=this.sourceCaches[n];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(let n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,i,o,a=!1){let s=!1,u=!1,c={};for(let h of this._order){let m=this._layers[h];if(m.type!=="symbol")continue;if(!c[m.source]){let d=this.sourceCaches[m.source];c[m.source]=d.getRenderableIds(!0).map(g=>d.getTileByID(g)).sort((g,x)=>x.tileID.overscaledZ-g.tileID.overscaledZ||(g.tileID.isLessThan(x.tileID)?-1:1))}let f=this.crossTileSymbolIndex.addLayer(m,c[m.source],t.center.lng);s=s||f}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||i===0,(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ne.now(),t.zoom))&&(this.pauseablePlacement=new Cp(t,this.map.terrain,this._order,a,n,i,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ne.now()),u=!0),s&&this.pauseablePlacement.placement.setStale()),u||s)for(let h of this._order){let m=this._layers[h];m.type==="symbol"&&this.placement.updateLayerOpacities(m,c[m.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ne.now())}_releaseSymbolFadeTiles(){for(let t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}async getImages(t,n){let i=await this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();let o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,n.icons),i}async getGlyphs(t,n){let i=await this.glyphManager.getGlyphs(n.stacks),o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),!(t&&this._validate(je.glyphs,"glyphs",t,null,n))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,i={},o){this._checkLoaded();let a=[{id:t,url:n}],s=[...Po(this.stylesheet.sprite),...a];this._validate(je.sprite,"sprite",s,null,i)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,o))}removeSprite(t){this._checkLoaded();let n=Po(this.stylesheet.sprite);if(!n.find(i=>i.id===t)){this.fire(new J(new Error('Sprite "'.concat(t,"\" doesn't exists on this map."))));return}if(this._spritesImagesIds[t])for(let i of this._spritesImagesIds[t])this.imageManager.removeImage(i),this._changedImages[i]=!0;n.splice(n.findIndex(i=>i.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new B("data",{dataType:"style"}))}getSprite(){return Po(this.stylesheet.sprite)}setSprite(t,n={},i){this._checkLoaded(),!(t&&this._validate(je.sprite,"sprite",t,null,n))&&(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,i):(this._unloadSprite(),i&&i(null)))}};l(g_,"Style");var Oo=g_;y();y();var Z2=Ee([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);y();y();var x_=class x_{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,n,i,o,a,s,u,c){this.context=e;let p=this.boundPaintVertexBuffers.length!==i.length;for(let m=0;!p&&m<i.length;m++)this.boundPaintVertexBuffers[m]!==i[m]&&(p=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==n||p||this.boundIndexBuffer!==o||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==u||this.boundDynamicVertexBuffer3!==c?this.freshBind(t,n,i,o,a,s,u,c):(e.bindVertexArray.set(this.vao),s&&s.bind(),o&&o.dynamicDraw&&o.bind(),u&&u.bind(),c&&c.bind())}freshBind(e,t,n,i,o,a,s,u){let c=e.numAttributes,p=this.context,h=p.gl;this.vao&&this.destroy(),this.vao=p.createVertexArray(),p.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=i,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=u,t.enableAttributes(h,e);for(let m of n)m.enableAttributes(h,e);a&&a.enableAttributes(h,e),s&&s.enableAttributes(h,e),u&&u.enableAttributes(h,e),t.bind(),t.setVertexAttribPointers(h,e,o);for(let m of n)m.bind(),m.setVertexAttribPointers(h,e,o);a&&(a.bind(),a.setVertexAttribPointers(h,e,o)),i&&i.bind(),s&&(s.bind(),s.setVertexAttribPointers(h,e,o)),u&&(u.bind(),u.setVertexAttribPointers(h,e,o)),p.currentNumAttributes=c}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};l(x_,"VertexArrayObject");var Wp=x_;y();var q2=l((r,e)=>({u_depth:new te(r,e.u_depth),u_terrain:new te(r,e.u_terrain),u_terrain_dim:new j(r,e.u_terrain_dim),u_terrain_matrix:new tt(r,e.u_terrain_matrix),u_terrain_unpack:new xt(r,e.u_terrain_unpack),u_terrain_exaggeration:new j(r,e.u_terrain_exaggeration)}),"terrainPreludeUniforms"),H2=l((r,e)=>({u_texture:new te(r,e.u_texture),u_ele_delta:new j(r,e.u_ele_delta),u_fog_matrix:new tt(r,e.u_fog_matrix),u_fog_color:new _t(r,e.u_fog_color),u_fog_ground_blend:new j(r,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new j(r,e.u_fog_ground_blend_opacity),u_horizon_color:new _t(r,e.u_horizon_color),u_horizon_fog_blend:new j(r,e.u_horizon_fog_blend),u_is_globe_mode:new j(r,e.u_is_globe_mode)}),"terrainUniforms"),W2=l((r,e)=>({u_ele_delta:new j(r,e.u_ele_delta)}),"terrainDepthUniforms"),$2=l((r,e)=>({u_texture:new te(r,e.u_texture),u_terrain_coords_id:new j(r,e.u_terrain_coords_id),u_ele_delta:new j(r,e.u_ele_delta)}),"terrainCoordsUniforms"),X2=l((r,e,t,n,i)=>({u_texture:0,u_ele_delta:r,u_fog_matrix:e,u_fog_color:t?t.properties.get("fog-color"):Y.white,u_fog_ground_blend:t?t.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:i?0:t?t.calculateFogBlendOpacity(n):0,u_horizon_color:t?t.properties.get("horizon-color"):Y.white,u_horizon_fog_blend:t?t.properties.get("horizon-fog-blend"):1,u_is_globe_mode:i?1:0}),"terrainUniformValues"),Y2=l(r=>({u_ele_delta:r}),"terrainDepthUniformValues"),K2=l((r,e)=>({u_terrain_coords_id:r/255,u_texture:0,u_ele_delta:e}),"terrainCoordsUniformValues");y();var J2=l((r,e)=>({u_projection_matrix:new tt(r,e.u_projection_matrix),u_projection_tile_mercator_coords:new xt(r,e.u_projection_tile_mercator_coords),u_projection_clipping_plane:new xt(r,e.u_projection_clipping_plane),u_projection_transition:new j(r,e.u_projection_transition),u_projection_fallback_matrix:new tt(r,e.u_projection_fallback_matrix)}),"projectionUniforms"),Q2={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function $p(r){let e=[];for(let t=0;t<r.length;t++){if(r[t]===null)continue;let n=r[t].split(" ");e.push(n.pop())}return e}l($p,"getTokenizedAttributesAndUniforms");var __=class __{constructor(e,t,n,i,o,a,s,u,c=[]){let p=e.gl;this.program=p.createProgram();let h=$p(t.staticAttributes),m=n?n.getBinderAttributes():[],f=h.concat(m),d=zt.prelude.staticUniforms?$p(zt.prelude.staticUniforms):[],g=s.staticUniforms?$p(s.staticUniforms):[],x=t.staticUniforms?$p(t.staticUniforms):[],_=n?n.getBinderUniforms():[],b=d.concat(g).concat(x).concat(_),v=[];for(let L of b)v.indexOf(L)<0&&v.push(L);let w=n?n.defines():[];Xt(p)&&w.unshift("#version 300 es"),o&&w.push("#define OVERDRAW_INSPECTOR;"),a&&w.push("#define TERRAIN3D;"),u&&w.push(u),c&&w.push(...c);let T=w.concat(zt.prelude.fragmentSource,s.fragmentSource,t.fragmentSource).join("\n"),S=w.concat(zt.prelude.vertexSource,s.vertexSource,t.vertexSource).join("\n");Xt(p)||(T=A2(T),S=C2(S));let A=p.createShader(p.FRAGMENT_SHADER);if(p.isContextLost()){this.failedToCreate=!0;return}if(p.shaderSource(A,T),p.compileShader(A),!p.getShaderParameter(A,p.COMPILE_STATUS))throw new Error("Could not compile fragment shader: ".concat(p.getShaderInfoLog(A)));p.attachShader(this.program,A);let M=p.createShader(p.VERTEX_SHADER);if(p.isContextLost()){this.failedToCreate=!0;return}if(p.shaderSource(M,S),p.compileShader(M),!p.getShaderParameter(M,p.COMPILE_STATUS))throw new Error("Could not compile vertex shader: ".concat(p.getShaderInfoLog(M)));p.attachShader(this.program,M),this.attributes={};let I={};this.numAttributes=f.length;for(let L=0;L<this.numAttributes;L++)f[L]&&(p.bindAttribLocation(this.program,L,f[L]),this.attributes[f[L]]=L);if(p.linkProgram(this.program),!p.getProgramParameter(this.program,p.LINK_STATUS))throw new Error("Program failed to link: ".concat(p.getProgramInfoLog(this.program)));p.deleteShader(M),p.deleteShader(A);for(let L=0;L<v.length;L++){let D=v[L];if(D&&!I[D]){let F=p.getUniformLocation(this.program,D);F&&(I[D]=F)}}this.fixedUniforms=i(e,I),this.terrainUniforms=q2(e,I),this.projectionUniforms=J2(e,I),this.binderUniforms=n?n.getUniforms(e,I):[]}draw(e,t,n,i,o,a,s,u,c,p,h,m,f,d,g,x,_,b,v){let w=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(n),e.setStencilMode(i),e.setColorMode(o),e.setCullFace(a),u){e.activeTexture.set(w.TEXTURE2),w.bindTexture(w.TEXTURE_2D,u.depthTexture),e.activeTexture.set(w.TEXTURE3),w.bindTexture(w.TEXTURE_2D,u.texture);for(let S in this.terrainUniforms)this.terrainUniforms[S].set(u[S])}if(c)for(let S in c){let A=Q2[S];this.projectionUniforms[A].set(c[S])}if(s)for(let S in this.fixedUniforms)this.fixedUniforms[S].set(s[S]);x&&x.setUniforms(e,this.binderUniforms,d,{zoom:g});let T=0;switch(t){case w.LINES:T=2;break;case w.TRIANGLES:T=3;break;case w.LINE_STRIP:T=1;break}for(let S of f.get()){let A=S.vaos||(S.vaos={});(A[p]||(A[p]=new Wp)).bind(e,this,h,x?x.getPaintVertexBuffers():[],m,S.vertexOffset,_,b,v),w.drawElements(t,S.primitiveLength*T,w.UNSIGNED_SHORT,S.primitiveOffset*T*2)}}};l(__,"Program");var Xp=__;y();y();y();function Yp(r,e,t){let n=1/nt(t,1,e.transform.tileZoom),i=Math.pow(2,t.tileID.overscaledZ),o=t.tileSize*Math.pow(2,e.transform.tileZoom)/i,a=o*(t.tileID.canonical.x+t.tileID.wrap*i),s=o*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture.size,u_scale:[n,r.fromScale,r.toScale],u_fade:r.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[a&65535,s&65535]}}l(Yp,"patternUniformValues");function eM(r,e,t,n){let i=t.imageManager.getPattern(r.from.toString()),o=t.imageManager.getPattern(r.to.toString()),{width:a,height:s}=t.imageManager.getPixelSize(),u=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,t.transform.tileZoom)/u,p=c*(n.tileID.canonical.x+n.tileID.wrap*u),h=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:e.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/nt(n,1,t.transform.tileZoom),u_pixel_coord_upper:[p>>16,h>>16],u_pixel_coord_lower:[p&65535,h&65535]}}l(eM,"bgPatternUniformValues");var tM=l((r,e)=>({u_lightpos:new it(r,e.u_lightpos),u_lightpos_globe:new it(r,e.u_lightpos_globe),u_lightintensity:new j(r,e.u_lightintensity),u_lightcolor:new it(r,e.u_lightcolor),u_vertical_gradient:new j(r,e.u_vertical_gradient),u_opacity:new j(r,e.u_opacity),u_fill_translate:new Q(r,e.u_fill_translate)}),"fillExtrusionUniforms"),rM=l((r,e)=>({u_lightpos:new it(r,e.u_lightpos),u_lightpos_globe:new it(r,e.u_lightpos_globe),u_lightintensity:new j(r,e.u_lightintensity),u_lightcolor:new it(r,e.u_lightcolor),u_vertical_gradient:new j(r,e.u_vertical_gradient),u_height_factor:new j(r,e.u_height_factor),u_opacity:new j(r,e.u_opacity),u_fill_translate:new Q(r,e.u_fill_translate),u_image:new te(r,e.u_image),u_texsize:new Q(r,e.u_texsize),u_pixel_coord_upper:new Q(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new Q(r,e.u_pixel_coord_lower),u_scale:new it(r,e.u_scale),u_fade:new j(r,e.u_fade)}),"fillExtrusionPatternUniforms"),b_=l((r,e,t,n)=>{let i=r.style.light,o=i.properties.get("position"),a=[o.x,o.y,o.z],s=Ur.create();i.properties.get("anchor")==="viewport"&&Ur.fromRotation(s,r.transform.bearingInRadians),V.transformMat3(a,a,s);let u=r.transform.transformLightDirection(a),c=i.properties.get("color");return{u_lightpos:a,u_lightpos_globe:u,u_lightintensity:i.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+e,u_opacity:t,u_fill_translate:n}},"fillExtrusionUniformValues"),nM=l((r,e,t,n,i,o,a)=>G(b_(r,e,t,n),Yp(o,r,a),{u_height_factor:-Math.pow(2,i.overscaledZ)/a.tileSize/8}),"fillExtrusionPatternUniformValues");y();var iM=l((r,e)=>({u_fill_translate:new Q(r,e.u_fill_translate)}),"fillUniforms"),oM=l((r,e)=>({u_image:new te(r,e.u_image),u_texsize:new Q(r,e.u_texsize),u_pixel_coord_upper:new Q(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new Q(r,e.u_pixel_coord_lower),u_scale:new it(r,e.u_scale),u_fade:new j(r,e.u_fade),u_fill_translate:new Q(r,e.u_fill_translate)}),"fillPatternUniforms"),aM=l((r,e)=>({u_world:new Q(r,e.u_world),u_fill_translate:new Q(r,e.u_fill_translate)}),"fillOutlineUniforms"),sM=l((r,e)=>({u_world:new Q(r,e.u_world),u_image:new te(r,e.u_image),u_texsize:new Q(r,e.u_texsize),u_pixel_coord_upper:new Q(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new Q(r,e.u_pixel_coord_lower),u_scale:new it(r,e.u_scale),u_fade:new j(r,e.u_fade),u_fill_translate:new Q(r,e.u_fill_translate)}),"fillOutlinePatternUniforms"),v_=l((r,e,t,n)=>G(Yp(e,r,t),{u_fill_translate:n}),"fillPatternUniformValues"),lM=l(r=>({u_fill_translate:r}),"fillUniformValues"),uM=l((r,e)=>({u_world:r,u_fill_translate:e}),"fillOutlineUniformValues"),cM=l((r,e,t,n,i)=>G(v_(r,e,t,i),{u_world:n}),"fillOutlinePatternUniformValues");y();var pM=l((r,e)=>({u_camera_to_center_distance:new j(r,e.u_camera_to_center_distance),u_scale_with_map:new te(r,e.u_scale_with_map),u_pitch_with_map:new te(r,e.u_pitch_with_map),u_extrude_scale:new Q(r,e.u_extrude_scale),u_device_pixel_ratio:new j(r,e.u_device_pixel_ratio),u_globe_extrude_scale:new j(r,e.u_globe_extrude_scale),u_translate:new Q(r,e.u_translate)}),"circleUniforms"),hM=l((r,e,t,n,i)=>{let o=r.transform,a,s,u=0;if(t.paint.get("circle-pitch-alignment")==="map"){let c=nt(e,1,o.zoom);a=!0,s=[c,c],u=c/(8192*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*i}else a=!1,s=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(t.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+a,u_device_pixel_ratio:r.pixelRatio,u_extrude_scale:s,u_globe_extrude_scale:u,u_translate:n}},"circleUniformValues");y();var mM=l((r,e)=>({u_pixel_extrude_scale:new Q(r,e.u_pixel_extrude_scale)}),"collisionUniforms"),fM=l((r,e)=>({u_viewport_size:new Q(r,e.u_viewport_size)}),"collisionCircleUniforms"),dM=l(r=>({u_pixel_extrude_scale:[1/r.width,1/r.height]}),"collisionUniformValues"),yM=l(r=>({u_viewport_size:[r.width,r.height]}),"collisionCircleUniformValues");y();var gM=l((r,e)=>({u_color:new _t(r,e.u_color),u_overlay:new te(r,e.u_overlay),u_overlay_scale:new j(r,e.u_overlay_scale)}),"debugUniforms"),w_=l((r,e=1)=>({u_color:r,u_overlay:0,u_overlay_scale:e}),"debugUniformValues");y();var xM=l((r,e)=>({u_extrude_scale:new j(r,e.u_extrude_scale),u_intensity:new j(r,e.u_intensity),u_globe_extrude_scale:new j(r,e.u_globe_extrude_scale)}),"heatmapUniforms"),_M=l((r,e)=>({u_matrix:new tt(r,e.u_matrix),u_world:new Q(r,e.u_world),u_image:new te(r,e.u_image),u_color_ramp:new te(r,e.u_color_ramp),u_opacity:new j(r,e.u_opacity)}),"heatmapTextureUniforms"),P_=l((r,e,t,n)=>{let o=nt(r,1,e)/(8192*Math.pow(2,r.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:nt(r,1,e),u_intensity:t,u_globe_extrude_scale:o}},"heatmapUniformValues"),T_=l((r,e,t,n)=>{let i=z.create();z.ortho(i,0,r.width,r.height,0,0,1);let o=r.context.gl;return{u_matrix:i,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:t,u_color_ramp:n,u_opacity:e.paint.get("heatmap-opacity")}},"heatmapTextureUniformValues");y();var bM=l((r,e)=>({u_image:new te(r,e.u_image),u_latrange:new Q(r,e.u_latrange),u_exaggeration:new j(r,e.u_exaggeration),u_altitudes:new ns(r,e.u_altitudes),u_azimuths:new ns(r,e.u_azimuths),u_accent:new _t(r,e.u_accent),u_method:new te(r,e.u_method),u_shadows:new rs(r,e.u_shadows),u_highlights:new rs(r,e.u_highlights)}),"hillshadeUniforms"),vM=l((r,e)=>({u_matrix:new tt(r,e.u_matrix),u_image:new te(r,e.u_image),u_dimension:new Q(r,e.u_dimension),u_zoom:new j(r,e.u_zoom),u_unpack:new xt(r,e.u_unpack)}),"hillshadePrepareUniforms"),wM=l((r,e,t)=>{let n=t.paint.get("hillshade-accent-color"),i;switch(t.paint.get("hillshade-method")){case"basic":i=4;break;case"combined":i=1;break;case"igor":i=2;break;case"multidirectional":i=3;break;case"standard":default:i=0;break}let o=t.getIlluminationProperties();for(let a=0;a<o.directionRadians.length;a++)t.paint.get("hillshade-illumination-anchor")==="viewport"&&(o.directionRadians[a]+=r.transform.bearingInRadians);return{u_image:0,u_latrange:ZB(r,e.tileID),u_exaggeration:t.paint.get("hillshade-exaggeration"),u_altitudes:o.altitudeRadians,u_azimuths:o.directionRadians,u_accent:n,u_method:i,u_highlights:o.highlightColor,u_shadows:o.shadowColor}},"hillshadeUniformValues"),PM=l((r,e)=>{let t=e.stride,n=z.create();return z.ortho(n,0,8192,-8192,0,0,1),z.translate(n,n,[0,-8192,0]),{u_matrix:n,u_image:1,u_dimension:[t,t],u_zoom:r.overscaledZ,u_unpack:e.getUnpackVector()}},"hillshadeUniformPrepareValues");function ZB(r,e){let t=Math.pow(2,e.canonical.z),n=e.canonical.y;return[new de(0,n/t).toLngLat().lat,new de(0,(n+1)/t).toLngLat().lat]}l(ZB,"getTileLatRange");y();var TM=l((r,e)=>({u_image:new te(r,e.u_image),u_unpack:new xt(r,e.u_unpack),u_dimension:new Q(r,e.u_dimension),u_elevation_stops:new te(r,e.u_elevation_stops),u_color_stops:new te(r,e.u_color_stops),u_opacity:new j(r,e.u_opacity)}),"colorReliefUniforms"),SM=l((r,e)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_opacity:r.paint.get("color-relief-opacity")}),"colorReliefUniformValues");y();var MM=l((r,e)=>({u_translation:new Q(r,e.u_translation),u_ratio:new j(r,e.u_ratio),u_device_pixel_ratio:new j(r,e.u_device_pixel_ratio),u_units_to_pixels:new Q(r,e.u_units_to_pixels)}),"lineUniforms"),CM=l((r,e)=>({u_translation:new Q(r,e.u_translation),u_ratio:new j(r,e.u_ratio),u_device_pixel_ratio:new j(r,e.u_device_pixel_ratio),u_units_to_pixels:new Q(r,e.u_units_to_pixels),u_image:new te(r,e.u_image),u_image_height:new j(r,e.u_image_height)}),"lineGradientUniforms"),AM=l((r,e)=>({u_translation:new Q(r,e.u_translation),u_texsize:new Q(r,e.u_texsize),u_ratio:new j(r,e.u_ratio),u_device_pixel_ratio:new j(r,e.u_device_pixel_ratio),u_image:new te(r,e.u_image),u_units_to_pixels:new Q(r,e.u_units_to_pixels),u_scale:new it(r,e.u_scale),u_fade:new j(r,e.u_fade)}),"linePatternUniforms"),IM=l((r,e)=>({u_translation:new Q(r,e.u_translation),u_ratio:new j(r,e.u_ratio),u_device_pixel_ratio:new j(r,e.u_device_pixel_ratio),u_units_to_pixels:new Q(r,e.u_units_to_pixels),u_patternscale_a:new Q(r,e.u_patternscale_a),u_patternscale_b:new Q(r,e.u_patternscale_b),u_sdfgamma:new j(r,e.u_sdfgamma),u_image:new te(r,e.u_image),u_tex_y_a:new j(r,e.u_tex_y_a),u_tex_y_b:new j(r,e.u_tex_y_b),u_mix:new j(r,e.u_mix)}),"lineSDFUniforms"),Kp=l((r,e,t,n)=>{let i=r.transform;return{u_translation:DM(r,e,t),u_ratio:n/nt(e,1,i.zoom),u_device_pixel_ratio:r.pixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},"lineUniformValues"),EM=l((r,e,t,n,i)=>G(Kp(r,e,t,n),{u_image:0,u_image_height:i}),"lineGradientUniformValues"),LM=l((r,e,t,n,i)=>{let o=r.transform,a=RM(e,o);return{u_translation:DM(r,e,t),u_texsize:e.imageAtlasTexture.size,u_ratio:n/nt(e,1,o.zoom),u_device_pixel_ratio:r.pixelRatio,u_image:0,u_scale:[a,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},"linePatternUniformValues"),kM=l((r,e,t,n,i,o)=>{let a=r.transform,s=r.lineAtlas,u=RM(e,a),c=t.layout.get("line-cap")==="round",p=s.getDash(i.from,c),h=s.getDash(i.to,c),m=p.width*o.fromScale,f=h.width*o.toScale;return G(Kp(r,e,t,n),{u_patternscale_a:[u/m,-p.height/2],u_patternscale_b:[u/f,-h.height/2],u_sdfgamma:s.width/(Math.min(m,f)*256*r.pixelRatio)/2,u_image:0,u_tex_y_a:p.y,u_tex_y_b:h.y,u_mix:o.t})},"lineSDFUniformValues");function RM(r,e){return 1/nt(r,1,e.tileZoom)}l(RM,"calculateTileRatio");function DM(r,e,t){return Ct(r.transform,e,t.paint.get("line-translate"),t.paint.get("line-translate-anchor"))}l(DM,"calculateTranslation");y();var FM=l((r,e)=>({u_tl_parent:new Q(r,e.u_tl_parent),u_scale_parent:new j(r,e.u_scale_parent),u_buffer_scale:new j(r,e.u_buffer_scale),u_fade_t:new j(r,e.u_fade_t),u_opacity:new j(r,e.u_opacity),u_image0:new te(r,e.u_image0),u_image1:new te(r,e.u_image1),u_brightness_low:new j(r,e.u_brightness_low),u_brightness_high:new j(r,e.u_brightness_high),u_saturation_factor:new j(r,e.u_saturation_factor),u_contrast_factor:new j(r,e.u_contrast_factor),u_spin_weights:new it(r,e.u_spin_weights),u_coords_top:new xt(r,e.u_coords_top),u_coords_bottom:new xt(r,e.u_coords_bottom)}),"rasterUniforms"),zM=l((r,e,t,n,i)=>({u_tl_parent:r,u_scale_parent:e,u_buffer_scale:1,u_fade_t:t.mix,u_opacity:t.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:WB(n.paint.get("raster-saturation")),u_contrast_factor:HB(n.paint.get("raster-contrast")),u_spin_weights:qB(n.paint.get("raster-hue-rotate")),u_coords_top:[i[0].x,i[0].y,i[1].x,i[1].y],u_coords_bottom:[i[3].x,i[3].y,i[2].x,i[2].y]}),"rasterUniformValues");function qB(r){r*=Math.PI/180;let e=Math.sin(r),t=Math.cos(r);return[(2*t+1)/3,(-Math.sqrt(3)*e-t+1)/3,(Math.sqrt(3)*e-t+1)/3]}l(qB,"spinWeights");function HB(r){return r>0?1/(1-r):1+r}l(HB,"contrastFactor");function WB(r){return r>0?1-1/(1.001-r):-r}l(WB,"saturationFactor");y();var BM=l((r,e)=>({u_is_size_zoom_constant:new te(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new te(r,e.u_is_size_feature_constant),u_size_t:new j(r,e.u_size_t),u_size:new j(r,e.u_size),u_camera_to_center_distance:new j(r,e.u_camera_to_center_distance),u_pitch:new j(r,e.u_pitch),u_rotate_symbol:new te(r,e.u_rotate_symbol),u_aspect_ratio:new j(r,e.u_aspect_ratio),u_fade_change:new j(r,e.u_fade_change),u_label_plane_matrix:new tt(r,e.u_label_plane_matrix),u_coord_matrix:new tt(r,e.u_coord_matrix),u_is_text:new te(r,e.u_is_text),u_pitch_with_map:new te(r,e.u_pitch_with_map),u_is_along_line:new te(r,e.u_is_along_line),u_is_variable_anchor:new te(r,e.u_is_variable_anchor),u_texsize:new Q(r,e.u_texsize),u_texture:new te(r,e.u_texture),u_translation:new Q(r,e.u_translation),u_pitched_scale:new j(r,e.u_pitched_scale)}),"symbolIconUniforms"),OM=l((r,e)=>({u_is_size_zoom_constant:new te(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new te(r,e.u_is_size_feature_constant),u_size_t:new j(r,e.u_size_t),u_size:new j(r,e.u_size),u_camera_to_center_distance:new j(r,e.u_camera_to_center_distance),u_pitch:new j(r,e.u_pitch),u_rotate_symbol:new te(r,e.u_rotate_symbol),u_aspect_ratio:new j(r,e.u_aspect_ratio),u_fade_change:new j(r,e.u_fade_change),u_label_plane_matrix:new tt(r,e.u_label_plane_matrix),u_coord_matrix:new tt(r,e.u_coord_matrix),u_is_text:new te(r,e.u_is_text),u_pitch_with_map:new te(r,e.u_pitch_with_map),u_is_along_line:new te(r,e.u_is_along_line),u_is_variable_anchor:new te(r,e.u_is_variable_anchor),u_texsize:new Q(r,e.u_texsize),u_texture:new te(r,e.u_texture),u_gamma_scale:new j(r,e.u_gamma_scale),u_device_pixel_ratio:new j(r,e.u_device_pixel_ratio),u_is_halo:new te(r,e.u_is_halo),u_translation:new Q(r,e.u_translation),u_pitched_scale:new j(r,e.u_pitched_scale)}),"symbolSDFUniforms"),VM=l((r,e)=>({u_is_size_zoom_constant:new te(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new te(r,e.u_is_size_feature_constant),u_size_t:new j(r,e.u_size_t),u_size:new j(r,e.u_size),u_camera_to_center_distance:new j(r,e.u_camera_to_center_distance),u_pitch:new j(r,e.u_pitch),u_rotate_symbol:new te(r,e.u_rotate_symbol),u_aspect_ratio:new j(r,e.u_aspect_ratio),u_fade_change:new j(r,e.u_fade_change),u_label_plane_matrix:new tt(r,e.u_label_plane_matrix),u_coord_matrix:new tt(r,e.u_coord_matrix),u_is_text:new te(r,e.u_is_text),u_pitch_with_map:new te(r,e.u_pitch_with_map),u_is_along_line:new te(r,e.u_is_along_line),u_is_variable_anchor:new te(r,e.u_is_variable_anchor),u_texsize:new Q(r,e.u_texsize),u_texsize_icon:new Q(r,e.u_texsize_icon),u_texture:new te(r,e.u_texture),u_texture_icon:new te(r,e.u_texture_icon),u_gamma_scale:new j(r,e.u_gamma_scale),u_device_pixel_ratio:new j(r,e.u_device_pixel_ratio),u_is_halo:new te(r,e.u_is_halo),u_translation:new Q(r,e.u_translation),u_pitched_scale:new j(r,e.u_pitched_scale)}),"symbolTextAndIconUniforms"),S_=l((r,e,t,n,i,o,a,s,u,c,p,h,m)=>{let f=a.transform;return{u_is_size_zoom_constant:+(r==="constant"||r==="source"),u_is_size_feature_constant:+(r==="constant"||r==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:f.cameraToCenterDistance,u_pitch:f.pitch/360*2*Math.PI,u_rotate_symbol:+t,u_aspect_ratio:f.width/f.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:u,u_is_text:+p,u_pitch_with_map:+n,u_is_along_line:i,u_is_variable_anchor:o,u_texsize:h,u_texture:0,u_translation:c,u_pitched_scale:m}},"symbolIconUniformValues"),M_=l((r,e,t,n,i,o,a,s,u,c,p,h,m,f)=>{let d=a.transform;return G(S_(r,e,t,n,i,o,a,s,u,c,p,h,f),{u_gamma_scale:n?Math.cos(d.pitch*Math.PI/180)*d.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:+m})},"symbolSDFUniformValues"),UM=l((r,e,t,n,i,o,a,s,u,c,p,h,m)=>G(M_(r,e,t,n,i,o,a,s,u,c,!0,p,!0,m),{u_texsize_icon:h,u_texture_icon:1}),"symbolTextAndIconUniformValues");y();var jM=l((r,e)=>({u_opacity:new j(r,e.u_opacity),u_color:new _t(r,e.u_color)}),"backgroundUniforms"),NM=l((r,e)=>({u_opacity:new j(r,e.u_opacity),u_image:new te(r,e.u_image),u_pattern_tl_a:new Q(r,e.u_pattern_tl_a),u_pattern_br_a:new Q(r,e.u_pattern_br_a),u_pattern_tl_b:new Q(r,e.u_pattern_tl_b),u_pattern_br_b:new Q(r,e.u_pattern_br_b),u_texsize:new Q(r,e.u_texsize),u_mix:new j(r,e.u_mix),u_pattern_size_a:new Q(r,e.u_pattern_size_a),u_pattern_size_b:new Q(r,e.u_pattern_size_b),u_scale_a:new j(r,e.u_scale_a),u_scale_b:new j(r,e.u_scale_b),u_pixel_coord_upper:new Q(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new Q(r,e.u_pixel_coord_lower),u_tile_units_to_pixels:new j(r,e.u_tile_units_to_pixels)}),"backgroundPatternUniforms"),GM=l((r,e)=>({u_opacity:r,u_color:e}),"backgroundUniformValues"),ZM=l((r,e,t,n,i)=>G(eM(t,i,e,n),{u_opacity:r}),"backgroundPatternUniformValues");y();var qM=l((r,e)=>({u_sun_pos:new it(r,e.u_sun_pos),u_atmosphere_blend:new j(r,e.u_atmosphere_blend),u_globe_position:new it(r,e.u_globe_position),u_globe_radius:new j(r,e.u_globe_radius),u_inv_proj_matrix:new tt(r,e.u_inv_proj_matrix)}),"atmosphereUniforms"),HM=l((r,e,t,n,i)=>({u_sun_pos:r,u_atmosphere_blend:e,u_globe_position:t,u_globe_radius:n,u_inv_proj_matrix:i}),"atmosphereUniformValues");y();var WM=l((r,e)=>({u_sky_color:new _t(r,e.u_sky_color),u_horizon_color:new _t(r,e.u_horizon_color),u_horizon:new Q(r,e.u_horizon),u_horizon_normal:new Q(r,e.u_horizon_normal),u_sky_horizon_blend:new j(r,e.u_sky_horizon_blend),u_sky_blend:new j(r,e.u_sky_blend)}),"skyUniforms"),$M=l((r,e,t)=>{let n=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),o=Co(e),s=e.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:r.properties.get("sky-color"),u_horizon_color:r.properties.get("horizon-color"),u_horizon:[(e.width/2-o*i)*t,(e.height/2+o*n)*t],u_horizon_normal:[-i,n],u_sky_horizon_blend:r.properties.get("sky-horizon-blend")*e.height/2*t,u_sky_blend:s}},"skyUniformValues");var XM=l((r,e)=>{},"emptyUniforms"),YM={fillExtrusion:tM,fillExtrusionPattern:rM,fill:iM,fillPattern:oM,fillOutline:aM,fillOutlinePattern:sM,circle:pM,collisionBox:mM,collisionCircle:fM,debug:gM,depth:XM,clippingMask:XM,heatmap:xM,heatmapTexture:_M,hillshade:bM,hillshadePrepare:vM,colorRelief:TM,line:MM,lineGradient:CM,linePattern:AM,lineSDF:IM,raster:FM,symbolIcon:BM,symbolSDF:OM,symbolTextAndIcon:VM,background:jM,backgroundPattern:NM,terrain:H2,terrainDepth:W2,terrainCoords:$2,projectionErrorMeasurement:k2,atmosphere:qM,sky:WM};y();y();var C_=class C_{constructor(e,t,n){this.context=e;let i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!n,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};l(C_,"IndexBuffer");var Jp=C_;y();var $B={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},A_=class A_{constructor(e,t,n,i){this.length=t.length,this.attributes=n,this.itemSize=t.bytesPerElement,this.dynamicDraw=i,this.context=e;let o=e.gl;this.buffer=o.createBuffer(),e.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error("Length of new data is ".concat(e.length,", which doesn't match current length of ").concat(this.length));let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let n=0;n<this.attributes.length;n++){let i=this.attributes[n],o=t.attributes[i.name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,t,n){for(let i=0;i<this.attributes.length;i++){let o=this.attributes[i],a=t.attributes[o.name];a!==void 0&&e.vertexAttribPointer(a,o.components,e[$B[o.type]],!1,this.itemSize,o.offset+this.itemSize*(n||0))}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};l(A_,"VertexBuffer");var Qp=A_;y();y();var I_=class I_{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}};l(I_,"BaseValue");var Ie=I_,E_=class E_ extends Ie{getDefault(){return Y.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}};l(E_,"ClearColor");var eh=E_,L_=class L_ extends Ie{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}};l(L_,"ClearDepth");var th=L_,k_=class k_ extends Ie{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}};l(k_,"ClearStencil");var rh=k_,R_=class R_ extends Ie{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}};l(R_,"ColorMask");var nh=R_,D_=class D_ extends Ie{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}};l(D_,"DepthMask");var ih=D_,F_=class F_ extends Ie{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}};l(F_,"StencilMask");var oh=F_,z_=class z_ extends Ie{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;e.func===t.func&&e.ref===t.ref&&e.mask===t.mask&&!this.dirty||(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}};l(z_,"StencilFunc");var ah=z_,B_=class B_ extends Ie{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&!this.dirty||(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}};l(B_,"StencilOp");var sh=B_,O_=class O_ extends Ie{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}};l(O_,"StencilTest");var lh=O_,V_=class V_ extends Ie{getDefault(){return[0,1]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}};l(V_,"DepthRange");var uh=V_,U_=class U_ extends Ie{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}};l(U_,"DepthTest");var ch=U_,j_=class j_ extends Ie{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}};l(j_,"DepthFunc");var ph=j_,N_=class N_ extends Ie{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}};l(N_,"Blend");var hh=N_,G_=class G_ extends Ie{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}};l(G_,"BlendFunc");var mh=G_,Z_=class Z_ extends Ie{getDefault(){return Y.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}};l(Z_,"BlendColor");var fh=Z_,q_=class q_ extends Ie{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}};l(q_,"BlendEquation");var dh=q_,H_=class H_ extends Ie{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}};l(H_,"CullFace");var yh=H_,W_=class W_ extends Ie{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}};l(W_,"CullFaceSide");var gh=W_,$_=class $_ extends Ie{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}};l($_,"FrontFace");var xh=$_,X_=class X_ extends Ie{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};l(X_,"ProgramValue");var _h=X_,Y_=class Y_ extends Ie{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}};l(Y_,"ActiveTextureUnit");var bh=Y_,K_=class K_ extends Ie{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}};l(K_,"Viewport");var vh=K_,J_=class J_ extends Ie{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}};l(J_,"BindFramebuffer");var wh=J_,Q_=class Q_ extends Ie{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}};l(Q_,"BindRenderbuffer");var Ph=Q_,eb=class eb extends Ie{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}};l(eb,"BindTexture");var Th=eb,tb=class tb extends Ie{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}};l(tb,"BindVertexBuffer");var Sh=tb,rb=class rb extends Ie{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}};l(rb,"BindElementBuffer");var Mh=rb,nb=class nb extends Ie{getDefault(){return null}set(e){var n;if(e===this.current&&!this.dirty)return;let t=this.gl;Xt(t)?t.bindVertexArray(e):(n=t.getExtension("OES_vertex_array_object"))==null||n.bindVertexArrayOES(e),this.current=e,this.dirty=!1}};l(nb,"BindVertexArray");var Ch=nb,ib=class ib extends Ie{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}};l(ib,"PixelStoreUnpack");var Ah=ib,ob=class ob extends Ie{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}};l(ob,"PixelStoreUnpackPremultiplyAlpha");var Ih=ob,ab=class ab extends Ie{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}};l(ab,"PixelStoreUnpackFlipY");var Eh=ab,sb=class sb extends Ie{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}};l(sb,"FramebufferAttachment");var el=sb,lb=class lb extends el{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}};l(lb,"ColorAttachment");var Lh=lb,ub=class ub extends el{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}};l(ub,"DepthAttachment");var kh=ub,cb=class cb extends el{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}};l(cb,"DepthStencilAttachment");var Rh=cb;y();var KM="Framebuffer is not complete";function JM(r){return r.message===KM}l(JM,"isFramebufferNotCompleteError");function QM(){return new Error(KM)}l(QM,"createFramebufferNotCompleteError");var pb=class pb{constructor(e,t,n,i,o){this.context=e,this.width=t,this.height=n;let a=e.gl,s=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new Lh(e,s),i)this.depthAttachment=o?new Rh(e,s):new kh(e,s);else if(o)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw QM()}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let n=this.depthAttachment.get();n&&e.deleteRenderbuffer(n)}e.deleteFramebuffer(this.framebuffer)}};l(pb,"Framebuffer");var Dh=pb;var hb=class hb{constructor(e){var t,n;if(this.gl=e,this.clearColor=new eh(this),this.clearDepth=new th(this),this.clearStencil=new rh(this),this.colorMask=new nh(this),this.depthMask=new ih(this),this.stencilMask=new oh(this),this.stencilFunc=new ah(this),this.stencilOp=new sh(this),this.stencilTest=new lh(this),this.depthRange=new uh(this),this.depthTest=new ch(this),this.depthFunc=new ph(this),this.blend=new hh(this),this.blendFunc=new mh(this),this.blendColor=new fh(this),this.blendEquation=new dh(this),this.cullFace=new yh(this),this.cullFaceSide=new gh(this),this.frontFace=new xh(this),this.program=new _h(this),this.activeTexture=new bh(this),this.viewport=new vh(this),this.bindFramebuffer=new wh(this),this.bindRenderbuffer=new Ph(this),this.bindTexture=new Th(this),this.bindVertexBuffer=new Sh(this),this.bindElementBuffer=new Mh(this),this.bindVertexArray=new Ch(this),this.pixelStoreUnpack=new Ah(this),this.pixelStoreUnpackPremultiplyAlpha=new Ih(this),this.pixelStoreUnpackFlipY=new Eh(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),Xt(e)){this.HALF_FLOAT=e.HALF_FLOAT;let i=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(t=e.RGBA16F)!=null?t:i==null?void 0:i.RGBA16F_EXT,this.RGB16F=(n=e.RGB16F)!=null?n:i==null?void 0:i.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let i=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=i==null?void 0:i.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new Jp(this,e,t)}createVertexBuffer(e,t,n){return new Qp(this,e,t,n)}createRenderbuffer(e,t,n){let i=this.gl,o=i.createRenderbuffer();return this.bindRenderbuffer.set(o),i.renderbufferStorage(i.RENDERBUFFER,e,t,n),this.bindRenderbuffer.set(null),o}createFramebuffer(e,t,n,i){return new Dh(this,e,t,n,i)}clear({color:e,depth:t,stencil:n}){let i=this.gl,o=0;e&&(o|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),typeof t<"u"&&(o|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),typeof n<"u"&&(o|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(n),this.stencilMask.set(255)),i.clear(o)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){Jt(e.blendFunction,Me.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return Xt(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return Xt(this.gl)?this.gl.deleteVertexArray(e):(t=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}};l(hb,"Context");var Fh=hb;y();var Bh=oe(ue(),1);y();var zh;function mb(r,e,t,n,i){let o=r.context,a=r.transform,s=o.gl,u=r.useProgram("collisionBox"),c=[],p=0,h=0;for(let _=0;_<n.length;_++){let b=n[_],w=e.getTile(b).getBucket(t);if(!w)continue;let T=i?w.textCollisionBox:w.iconCollisionBox,S=w.collisionCircleArray;S.length>0&&(c.push({circleArray:S,circleOffset:h,coord:b}),p+=S.length/4,h=p),T&&u.draw(o,s.LINES,re.disabled,le.disabled,r.colorModeForRenderPass(),ie.disabled,dM(r.transform),r.style.map.terrain&&r.style.map.terrain.getTerrainData(b),a.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),t.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,null,r.transform.zoom,null,null,T.collisionVertexBuffer)}if(!i||!c.length)return;let m=r.useProgram("collisionCircle"),f=new hc;f.resize(p*4),f._trim();let d=0;for(let _ of c)for(let b=0;b<_.circleArray.length/4;b++){let v=b*4,w=_.circleArray[v+0],T=_.circleArray[v+1],S=_.circleArray[v+2],A=_.circleArray[v+3];f.emplace(d++,w,T,S,A,0),f.emplace(d++,w,T,S,A,1),f.emplace(d++,w,T,S,A,2),f.emplace(d++,w,T,S,A,3)}(!zh||zh.length<p*2)&&(zh=XB(p));let g=o.createIndexBuffer(zh,!0),x=o.createVertexBuffer(f,NP.members,!0);for(let _ of c){let b=yM(r.transform);m.draw(o,s.TRIANGLES,re.disabled,le.disabled,r.colorModeForRenderPass(),ie.disabled,b,r.style.map.terrain&&r.style.map.terrain.getTerrainData(_.coord),null,t.id,x,g,he.simpleSegment(0,_.circleOffset*2,_.circleArray.length,_.circleArray.length/2),null,r.transform.zoom,null,null,null)}x.destroy(),g.destroy()}l(mb,"drawCollisionDebug");function XB(r){let e=r*2,t=new fc;t.resize(e),t._trim();for(let n=0;n<e;n++){let i=n*6;t.uint16[i+0]=n*4+0,t.uint16[i+1]=n*4+1,t.uint16[i+2]=n*4+2,t.uint16[i+3]=n*4+2,t.uint16[i+4]=n*4+3,t.uint16[i+5]=n*4+0}return t}l(XB,"createQuadTriangles");var YB=z.identity(new Float32Array(16));function rC(r,e,t,n,i,o){if(r.renderPass!=="translucent")return;let{isRenderingToTexture:a}=o,s=le.disabled,u=r.colorModeForRenderPass();(t._unevaluatedLayout.hasValue("text-variable-anchor")||t._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&JB(n,r,t,e,t.layout.get("text-rotation-alignment"),t.layout.get("text-pitch-alignment"),t.paint.get("text-translate"),t.paint.get("text-translate-anchor"),i),t.paint.get("icon-opacity").constantOr(1)!==0&&eC(r,e,t,n,!1,t.paint.get("icon-translate"),t.paint.get("icon-translate-anchor"),t.layout.get("icon-rotation-alignment"),t.layout.get("icon-pitch-alignment"),t.layout.get("icon-keep-upright"),s,u,a),t.paint.get("text-opacity").constantOr(1)!==0&&eC(r,e,t,n,!0,t.paint.get("text-translate"),t.paint.get("text-translate-anchor"),t.layout.get("text-rotation-alignment"),t.layout.get("text-pitch-alignment"),t.layout.get("text-keep-upright"),s,u,a),e.map.showCollisionBoxes&&(mb(r,e,t,n,!0),mb(r,e,t,n,!1))}l(rC,"drawSymbols");function KB(r,e,t,n,i,o){let{horizontalAlign:a,verticalAlign:s}=jc(r),u=-(a-.5)*e,c=-(s-.5)*t;return new Bh.default((u/i+n[0])*o,(c/i+n[1])*o)}l(KB,"calculateVariableRenderShift");function JB(r,e,t,n,i,o,a,s,u){let c=e.transform,p=e.style.map.terrain,h=i==="map",m=o==="map";for(let f of r){let d=n.getTile(f),g=d.getBucket(t);if(!g||!g.text||!g.text.segments.get().length)continue;let x=g.textSizeData,_=wi(x,c.zoom),b=nt(d,1,e.transform.zoom),v=Us(h,e.transform,b),w=t.layout.get("icon-text-fit")!=="none"&&g.hasIconData();if(_){let T=Math.pow(2,c.zoom-d.tileID.overscaledZ),S=p?(M,I)=>p.getElevation(f,M,I):null,A=Ct(c,d,a,s);e3(g,h,m,u,c,v,T,_,w,A,f.toUnwrapped(),S)}}}l(JB,"updateVariableAnchors");function QB(r,e,t,n,i,o){let a=e.tileAnchorPoint.add(new Bh.default(e.translation[0],e.translation[1]));if(e.pitchWithMap){let s=n.mult(o);t||(s=s.rotate(-i));let u=a.add(s);return vp(u.x,u.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}else if(t){let u=On(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(r),c=Math.atan(u.y/u.x)+(u.x<0?Math.PI:0);return r.add(n.rotate(c))}else return r.add(n)}l(QB,"getShiftedAnchor");function e3(r,e,t,n,i,o,a,s,u,c,p,h){let m=r.text.placedSymbolArray,f=r.text.dynamicLayoutVertexArray,d=r.icon.dynamicLayoutVertexArray,g={};f.clear();for(let x=0;x<m.length;x++){let _=m.get(x),b=r.allowVerticalPlacement&&!_.placedOrientation,v=!_.hidden&&_.crossTileID&&!b?n[_.crossTileID]:null;if(!v)Ei(_.numGlyphs,f);else{let w=new Bh.default(_.anchorX,_.anchorY),T={getElevation:h,width:i.width,height:i.height,pitchedLabelPlaneMatrix:o,lineVertexArray:null,pitchWithMap:t,transform:i,projectionCache:null,tileAnchorPoint:w,translation:c,unwrappedTileID:p},S=t?wx(w.x,w.y,T):On(w.x,w.y,T),A=bx(i.cameraToCenterDistance,S.signedDistanceFromCamera),M=vo(r.textSizeData,s,_)*A/En;t&&(M*=r.tilePixelRatio/a);let{width:I,height:L,anchor:D,textOffset:F,textBoxScale:U}=v,C=KB(D,I,L,F,U,M),k=i.getPitchedTextCorrection(w.x+c[0],w.y+c[1],p),H=QB(S.point,T,e,C,-i.bearingInRadians,k),$=r.allowVerticalPlacement&&_.placedOrientation===2?Math.PI/2:0;for(let K=0;K<_.numGlyphs;K++)Pi(f,H,$);u&&_.associatedIconIndex>=0&&(g[_.associatedIconIndex]={shiftedAnchor:H,angle:$})}}if(u){d.clear();let x=r.icon.placedSymbolArray;for(let _=0;_<x.length;_++){let b=x.get(_);if(b.hidden)Ei(b.numGlyphs,d);else{let v=g[_];if(!v)Ei(b.numGlyphs,d);else for(let w=0;w<b.numGlyphs;w++)Pi(d,v.shiftedAnchor,v.angle)}}r.icon.dynamicLayoutVertexBuffer.updateData(d)}r.text.dynamicLayoutVertexBuffer.updateData(f)}l(e3,"updateVariableAnchorsForBucket");function t3(r,e,t){return t.iconsInText&&e?"symbolTextAndIcon":r?"symbolSDF":"symbolIcon"}l(t3,"getSymbolProgramName");function eC(r,e,t,n,i,o,a,s,u,c,p,h,m){let f=r.context,d=f.gl,g=r.transform,x=s==="map",_=u==="map",b=s!=="viewport"&&t.layout.get("symbol-placement")!=="point",v=x&&!_&&!b,w=!t.layout.get("symbol-sort-key").isConstant(),T=!1,S=r.getDepthModeForSublayer(0,re.ReadOnly),A=t._unevaluatedLayout.hasValue("text-variable-anchor")||t._unevaluatedLayout.hasValue("text-variable-anchor-offset"),M=[],I=g.getCircleRadiusCorrection();for(let L of n){let D=e.getTile(L),F=D.getBucket(t);if(!F)continue;let U=i?F.text:F.icon;if(!U||!U.segments.get().length||!U.hasVisibleVertices)continue;let C=U.programConfigurations.get(t.id),k=i||F.sdfIcons,H=i?F.textSizeData:F.iconSizeData,$=_||g.pitch!==0,K=r.useProgram(t3(k,i,F),C),me=wi(H,g.zoom),Ve=r.style.map.terrain&&r.style.map.terrain.getTerrainData(L),_e,ye=[0,0],We,rt,bt=null,st;if(i){if(We=D.glyphAtlasTexture,rt=d.LINEAR,_e=D.glyphAtlasTexture.size,F.iconsInText){ye=D.imageAtlasTexture.size,bt=D.imageAtlasTexture;let Kt=H.kind==="composite"||H.kind==="camera";st=$||r.options.rotating||r.options.zooming||Kt?d.LINEAR:d.NEAREST}}else{let Kt=t.layout.get("icon-size").constantOr(0)!==1||F.iconsNeedLinear;We=D.imageAtlasTexture,rt=k||r.options.rotating||r.options.zooming||Kt||$?d.LINEAR:d.NEAREST,_e=D.imageAtlasTexture.size}let Yt=nt(D,1,r.transform.zoom),wr=Us(x,r.transform,Yt),on=z.create();z.invert(on,wr);let sr=eS(_,x,r.transform,Yt),Pr=Ct(g,D,o,a),Cl=g.getProjectionData({overscaledTileID:L,applyGlobeMatrix:!m,applyTerrainMatrix:!0}),ym=A&&F.hasTextData(),gm=t.layout.get("icon-text-fit")!=="none"&&ym&&F.hasIconData();if(b){let Kt=r.style.map.terrain?(ur,Vr)=>r.style.map.terrain.getElevation(L,ur,Vr):null,pt=t.layout.get("text-rotation-alignment")==="map";tS(F,r,i,wr,on,_,c,pt,L.toUnwrapped(),g.width,g.height,Pr,Kt)}let zi=i&&A||gm,xm=_?wr:r.transform.clipSpaceToPixelsMatrix,Bi=b||zi?YB:xm,Tr=k&&t.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1)!==0,lr;k?F.iconsInText?lr=UM(H.kind,me,v,_,b,zi,r,Bi,sr,Pr,_e,ye,I):lr=M_(H.kind,me,v,_,b,zi,r,Bi,sr,Pr,i,_e,!0,I):lr=S_(H.kind,me,v,_,b,zi,r,Bi,sr,Pr,i,_e,I);let Zn={program:K,buffers:U,uniformValues:lr,projectionData:Cl,atlasTexture:We,atlasTextureIcon:bt,atlasInterpolation:rt,atlasInterpolationIcon:st,isSDF:k,hasHalo:Tr};if(w&&F.canOverlap){T=!0;let Kt=U.segments.get();for(let pt of Kt)M.push({segments:new he([pt]),sortKey:pt.sortKey,state:Zn,terrainData:Ve})}else M.push({segments:U.segments,sortKey:0,state:Zn,terrainData:Ve})}T&&M.sort((L,D)=>L.sortKey-D.sortKey);for(let L of M){let D=L.state;if(f.activeTexture.set(d.TEXTURE0),D.atlasTexture.bind(D.atlasInterpolation,d.CLAMP_TO_EDGE),D.atlasTextureIcon&&(f.activeTexture.set(d.TEXTURE1),D.atlasTextureIcon&&D.atlasTextureIcon.bind(D.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),D.isSDF){let F=D.uniformValues;D.hasHalo&&(F.u_is_halo=1,tC(D.buffers,L.segments,t,r,D.program,S,p,h,F,D.projectionData,L.terrainData)),F.u_is_halo=0}tC(D.buffers,L.segments,t,r,D.program,S,p,h,D.uniformValues,D.projectionData,L.terrainData)}}l(eC,"drawLayerSymbols");function tC(r,e,t,n,i,o,a,s,u,c,p){let h=n.context,m=h.gl;i.draw(h,m.TRIANGLES,o,a,s,ie.backCCW,u,p,c,t.id,r.layoutVertexBuffer,r.indexBuffer,e,t.paint,n.transform.zoom,r.programConfigurations.get(t.id),r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer)}l(tC,"drawSymbolElements");y();function nC(r,e,t,n,i){if(r.renderPass!=="translucent")return;let{isRenderingToTexture:o}=i,a=t.paint.get("circle-opacity"),s=t.paint.get("circle-stroke-width"),u=t.paint.get("circle-stroke-opacity"),c=!t.layout.get("circle-sort-key").isConstant();if(a.constantOr(1)===0&&(s.constantOr(1)===0||u.constantOr(1)===0))return;let p=r.context,h=p.gl,m=r.transform,f=r.getDepthModeForSublayer(0,re.ReadOnly),d=le.disabled,g=r.colorModeForRenderPass(),x=[],_=m.getCircleRadiusCorrection();for(let b=0;b<n.length;b++){let v=n[b],w=e.getTile(v),T=w.getBucket(t);if(!T)continue;let S=t.paint.get("circle-translate"),A=t.paint.get("circle-translate-anchor"),M=Ct(m,w,S,A),I=T.programConfigurations.get(t.id),L=r.useProgram("circle",I),D=T.layoutVertexBuffer,F=T.indexBuffer,U=r.style.map.terrain&&r.style.map.terrain.getTerrainData(v),C=hM(r,w,t,M,_),k=m.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),H={programConfiguration:I,program:L,layoutVertexBuffer:D,indexBuffer:F,uniformValues:C,terrainData:U,projectionData:k};if(c){let $=T.segments.get();for(let K of $)x.push({segments:new he([K]),sortKey:K.sortKey,state:H})}else x.push({segments:T.segments,sortKey:0,state:H})}c&&x.sort((b,v)=>b.sortKey-v.sortKey);for(let b of x){let{programConfiguration:v,program:w,layoutVertexBuffer:T,indexBuffer:S,uniformValues:A,terrainData:M,projectionData:I}=b.state,L=b.segments;w.draw(p,h.TRIANGLES,f,d,g,ie.backCCW,A,M,I,t.id,T,S,L,t.paint,r.transform.zoom,v)}}l(nC,"drawCircles");y();function iC(r,e,t,n,i){if(t.paint.get("heatmap-opacity")===0)return;let o=r.context,{isRenderingToTexture:a,isRenderingGlobe:s}=i;if(r.style.map.terrain){for(let u of n){let c=e.getTile(u);e.hasRenderableParent(u)||(r.renderPass==="offscreen"?i3(r,c,t,u,s):r.renderPass==="translucent"&&o3(r,t,u,a,s))}o.viewport.set([0,0,r.width,r.height])}else r.renderPass==="offscreen"?r3(r,e,t,n):r.renderPass==="translucent"&&n3(r,t)}l(iC,"drawHeatmap");function r3(r,e,t,n){let i=r.context,o=i.gl,a=r.transform,s=le.disabled,u=new Me([o.ONE,o.ONE],Y.transparent,[!0,!0,!0,!0]);a3(i,r,t),i.clear({color:Y.transparent});for(let c=0;c<n.length;c++){let p=n[c];if(e.hasRenderableParent(p))continue;let h=e.getTile(p),m=h.getBucket(t);if(!m)continue;let f=m.programConfigurations.get(t.id),d=r.useProgram("heatmap",f),g=a.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),x=a.getCircleRadiusCorrection();d.draw(i,o.TRIANGLES,re.disabled,s,u,ie.backCCW,P_(h,a.zoom,t.paint.get("heatmap-intensity"),x),null,g,t.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,t.paint,a.zoom,f)}i.viewport.set([0,0,r.width,r.height])}l(r3,"prepareHeatmapFlat");function n3(r,e){let t=r.context,n=t.gl;t.setColorMode(r.colorModeForRenderPass());let i=e.heatmapFbos.get(po);if(!i)return;t.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,i.colorAttachment.get()),t.activeTexture.set(n.TEXTURE1),aC(t,e).bind(n.LINEAR,n.CLAMP_TO_EDGE),r.useProgram("heatmapTexture").draw(t,n.TRIANGLES,re.disabled,le.disabled,r.colorModeForRenderPass(),ie.disabled,T_(r,e,0,1),null,null,e.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,e.paint,r.transform.zoom)}l(n3,"renderHeatmapFlat");function i3(r,e,t,n,i){let o=r.context,a=o.gl,s=le.disabled,u=new Me([a.ONE,a.ONE],Y.transparent,[!0,!0,!0,!0]),c=e.getBucket(t);if(!c)return;let p=n.key,h=t.heatmapFbos.get(p);h||(h=oC(o,e.tileSize,e.tileSize),t.heatmapFbos.set(p,h)),o.bindFramebuffer.set(h.framebuffer),o.viewport.set([0,0,e.tileSize,e.tileSize]),o.clear({color:Y.transparent});let m=c.programConfigurations.get(t.id),f=r.useProgram("heatmap",m,!i),d=r.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=r.style.map.terrain.getTerrainData(n);f.draw(o,a.TRIANGLES,re.disabled,s,u,ie.disabled,P_(e,r.transform.zoom,t.paint.get("heatmap-intensity"),1),g,d,t.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,t.paint,r.transform.zoom,m)}l(i3,"prepareHeatmapTerrain");function o3(r,e,t,n,i){let o=r.context,a=o.gl,s=r.transform;o.setColorMode(r.colorModeForRenderPass());let u=aC(o,e),c=t.key,p=e.heatmapFbos.get(c);if(!p)return;o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,p.colorAttachment.get()),o.activeTexture.set(a.TEXTURE1),u.bind(a.LINEAR,a.CLAMP_TO_EDGE);let h=s.getProjectionData({overscaledTileID:t,applyTerrainMatrix:i,applyGlobeMatrix:!n});r.useProgram("heatmapTexture").draw(o,a.TRIANGLES,re.disabled,le.disabled,r.colorModeForRenderPass(),ie.disabled,T_(r,e,0,1),null,h,e.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments,e.paint,s.zoom),p.destroy(),e.heatmapFbos.delete(c)}l(o3,"renderHeatmapTerrain");function a3(r,e,t){let n=r.gl;r.activeTexture.set(n.TEXTURE1),r.viewport.set([0,0,e.width/4,e.height/4]);let i=t.heatmapFbos.get(po);i?(n.bindTexture(n.TEXTURE_2D,i.colorAttachment.get()),r.bindFramebuffer.set(i.framebuffer)):(i=oC(r,e.width/4,e.height/4),t.heatmapFbos.set(po,i))}l(a3,"bindFramebuffer");function oC(r,e,t){var u,c;let n=r.gl,i=n.createTexture();n.bindTexture(n.TEXTURE_2D,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR);let o=(u=r.HALF_FLOAT)!=null?u:n.UNSIGNED_BYTE,a=(c=r.RGBA16F)!=null?c:n.RGBA;n.texImage2D(n.TEXTURE_2D,0,a,e,t,0,n.RGBA,o,null);let s=r.createFramebuffer(e,t,!1,!1);return s.colorAttachment.set(i),s}l(oC,"createHeatmapFbo");function aC(r,e){return e.colorRampTexture||(e.colorRampTexture=new we(r,e.colorRamp,r.gl.RGBA)),e.colorRampTexture}l(aC,"getColorRampTexture");y();function sC(r,e,t,n,i){if(r.renderPass!=="translucent")return;let{isRenderingToTexture:o}=i,a=t.paint.get("line-opacity"),s=t.paint.get("line-width");if(a.constantOr(1)===0||s.constantOr(1)===0)return;let u=r.getDepthModeForSublayer(0,re.ReadOnly),c=r.colorModeForRenderPass(),p=t.paint.get("line-dasharray"),h=t.paint.get("line-pattern"),m=h.constantOr(1),f=t.paint.get("line-gradient"),d=t.getCrossfadeParameters(),g=m?"linePattern":p?"lineSDF":f?"lineGradient":"line",x=r.context,_=x.gl,b=r.transform,v=!0;for(let w of n){let T=e.getTile(w);if(m&&!T.patternsLoaded())continue;let S=T.getBucket(t);if(!S)continue;let A=S.programConfigurations.get(t.id),M=r.context.program.get(),I=r.useProgram(g,A),L=v||I.program!==M,D=r.style.map.terrain&&r.style.map.terrain.getTerrainData(w),F=h.constantOr(null);if(F&&T.imageAtlas){let $=T.imageAtlas,K=$.patternPositions[F.to.toString()],me=$.patternPositions[F.from.toString()];K&&me&&A.setConstantPatternPositions(K,me)}let U=b.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),C=b.getPixelScale(),k=m?LM(r,T,t,C,d):p?kM(r,T,t,C,p,d):f?EM(r,T,t,C,S.lineClipsArray.length):Kp(r,T,t,C);if(m)x.activeTexture.set(_.TEXTURE0),T.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),A.updatePaintBuffers(d);else if(p&&(L||r.lineAtlas.dirty))x.activeTexture.set(_.TEXTURE0),r.lineAtlas.bind(x);else if(f){let $=S.gradients[t.id],K=$.texture;if(t.gradientVersion!==$.version){let me=256;if(t.stepInterpolant){let Ve=e.getSource().maxzoom,_e=w.canonical.z===Ve?Math.ceil(1<<r.transform.maxZoom-w.canonical.z):1,rt=S.maxLineLength/8192*1024*_e;me=se(U0(rt),256,x.maxTextureSize)}$.gradient=Sc({expression:t.gradientExpression(),evaluationKey:"lineProgress",resolution:me,image:$.gradient||void 0,clips:S.lineClipsArray}),$.texture?$.texture.update($.gradient):$.texture=new we(x,$.gradient,_.RGBA),$.version=t.gradientVersion,K=$.texture}x.activeTexture.set(_.TEXTURE0),K.bind(t.stepInterpolant?_.NEAREST:_.LINEAR,_.CLAMP_TO_EDGE)}let H=r.stencilModeForClipping(w);I.draw(x,_.TRIANGLES,u,H,c,ie.disabled,k,D,U,t.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,t.paint,r.transform.zoom,A,S.layoutVertexBuffer2),v=!1}}l(sC,"drawLine");y();y();function Oh(r,e,t,n,i){if(!t||!n||!n.imageAtlas)return;let o=n.imageAtlas.patternPositions,a=o[t.to.toString()],s=o[t.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){let u=i.getPaintProperty(e);a=o[u],s=o[u]}a&&s&&r.setConstantPatternPositions(a,s)}l(Oh,"updatePatternPositionsInProgram");function uC(r,e,t,n,i){let o=t.paint.get("fill-color"),a=t.paint.get("fill-opacity");if(a.constantOr(1)===0)return;let{isRenderingToTexture:s}=i,u=r.colorModeForRenderPass(),c=t.paint.get("fill-pattern"),p=r.opaquePassEnabledForLayer()&&!c.constantOr(1)&&o.constantOr(Y.transparent).a===1&&a.constantOr(0)===1?"opaque":"translucent";if(r.renderPass===p){let h=r.getDepthModeForSublayer(1,r.renderPass==="opaque"?re.ReadWrite:re.ReadOnly);lC(r,e,t,n,h,u,!1,s)}if(r.renderPass==="translucent"&&t.paint.get("fill-antialias")){let h=r.getDepthModeForSublayer(t.getPaintProperty("fill-outline-color")?2:0,re.ReadOnly);lC(r,e,t,n,h,u,!0,s)}}l(uC,"drawFill");function lC(r,e,t,n,i,o,a,s){let u=r.context.gl,c="fill-pattern",p=t.paint.get(c),h=p&&p.constantOr(1),m=t.getCrossfadeParameters(),f,d,g,x,_,b=r.transform,v=t.paint.get("fill-translate"),w=t.paint.get("fill-translate-anchor");a?(d=h&&!t.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=u.LINES):(d=h?"fillPattern":"fill",f=u.TRIANGLES);let T=p.constantOr(null);for(let S of n){let A=e.getTile(S);if(h&&!A.patternsLoaded())continue;let M=A.getBucket(t);if(!M)continue;let I=M.programConfigurations.get(t.id),L=r.useProgram(d,I),D=r.style.map.terrain&&r.style.map.terrain.getTerrainData(S);h&&(r.context.activeTexture.set(u.TEXTURE0),A.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),I.updatePaintBuffers(m)),Oh(I,c,T,A,t);let F=b.getProjectionData({overscaledTileID:S,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),U=Ct(b,A,v,w);if(!a)x=M.indexBuffer,_=M.segments,g=h?v_(r,m,A,U):lM(U);else{x=M.indexBuffer2,_=M.segments2;let k=[u.drawingBufferWidth,u.drawingBufferHeight];g=d==="fillOutlinePattern"&&h?cM(r,m,A,k,U):uM(k,U)}let C=r.stencilModeForClipping(S);L.draw(r.context,f,i,C,o,ie.backCCW,g,D,F,t.id,M.layoutVertexBuffer,x,_,t.paint,r.transform.zoom,I)}}l(lC,"drawFillTiles");y();function cC(r,e,t,n,i){let o=t.paint.get("fill-extrusion-opacity");if(o===0)return;let{isRenderingToTexture:a}=i;if(r.renderPass==="translucent"){let s=new re(r.context.gl.LEQUAL,re.ReadWrite,r.depthRangeFor3D);if(o===1&&!t.paint.get("fill-extrusion-pattern").constantOr(1)){let u=r.colorModeForRenderPass();fb(r,e,t,n,s,le.disabled,u,a)}else fb(r,e,t,n,s,le.disabled,Me.disabled,a),fb(r,e,t,n,s,r.stencilModeFor3D(),r.colorModeForRenderPass(),a)}}l(cC,"drawFillExtrusion");function fb(r,e,t,n,i,o,a,s){let u=r.context,c=u.gl,p="fill-extrusion-pattern",h=t.paint.get(p),m=h.constantOr(1),f=t.getCrossfadeParameters(),d=t.paint.get("fill-extrusion-opacity"),g=h.constantOr(null),x=r.transform;for(let _ of n){let b=e.getTile(_),v=b.getBucket(t);if(!v)continue;let w=r.style.map.terrain&&r.style.map.terrain.getTerrainData(_),T=v.programConfigurations.get(t.id),S=r.useProgram(m?"fillExtrusionPattern":"fillExtrusion",T);m&&(r.context.activeTexture.set(c.TEXTURE0),b.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),T.updatePaintBuffers(f));let A=x.getProjectionData({overscaledTileID:_,applyGlobeMatrix:!s,applyTerrainMatrix:!0});Oh(T,p,g,b,t);let M=Ct(x,b,t.paint.get("fill-extrusion-translate"),t.paint.get("fill-extrusion-translate-anchor")),I=t.paint.get("fill-extrusion-vertical-gradient"),L=m?nM(r,I,d,M,_,f,b):b_(r,I,d,M);S.draw(u,u.gl.TRIANGLES,i,o,a,ie.backCCW,L,w,A,t.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,t.paint,r.transform.zoom,T,r.style.map.terrain&&v.centroidVertexBuffer)}}l(fb,"drawExtrusionTiles");y();function pC(r,e,t,n,i){if(r.renderPass!=="offscreen"&&r.renderPass!=="translucent")return;let{isRenderingToTexture:o}=i,a=r.context,u=r.style.projection.useSubdivision,c=r.getDepthModeForSublayer(0,re.ReadOnly),p=r.colorModeForRenderPass();if(r.renderPass==="offscreen")s3(r,e,n,t,c,le.disabled,p),a.viewport.set([0,0,r.width,r.height]);else if(r.renderPass==="translucent")if(u){let[h,m,f]=r.stencilConfigForOverlapTwoPass(n);db(r,e,t,f,h,c,p,!1,o),db(r,e,t,f,m,c,p,!0,o)}else{let[h,m]=r.getStencilConfigForOverlapAndUpdateStencilID(n);db(r,e,t,m,h,c,p,!1,o)}}l(pC,"drawHillshade");function db(r,e,t,n,i,o,a,s,u){var x;let c=r.style.projection,p=r.context,h=r.transform,m=p.gl,f=["#define NUM_ILLUMINATION_SOURCES ".concat(t.paint.get("hillshade-highlight-color").values.length)],d=r.useProgram("hillshade",null,!1,f),g=!r.options.moving;for(let _ of n){let b=e.getTile(_),v=b.fbo;if(!v)continue;let w=c.getMeshFromTileID(p,_.canonical,s,!0,"raster"),T=(x=r.style.map.terrain)==null?void 0:x.getTerrainData(_);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,v.colorAttachment.get());let S=h.getProjectionData({overscaledTileID:_,aligned:g,applyGlobeMatrix:!u,applyTerrainMatrix:!0});d.draw(p,m.TRIANGLES,o,i[_.overscaledZ],a,ie.backCCW,wM(r,b,t),T,S,t.id,w.vertexBuffer,w.indexBuffer,w.segments)}}l(db,"renderHillshade");function s3(r,e,t,n,i,o,a){let s=r.context,u=s.gl;for(let c of t){let p=e.getTile(c),h=p.dem;if(!h||!h.data||!p.needsHillshadePrepare)continue;let m=h.dim,f=h.stride,d=h.getPixels();if(s.activeTexture.set(u.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),p.demTexture=p.demTexture||r.getTileTexture(f),p.demTexture){let x=p.demTexture;x.update(d,{premultiply:!1}),x.bind(u.NEAREST,u.CLAMP_TO_EDGE)}else p.demTexture=new we(s,d,u.RGBA,{premultiply:!1}),p.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);s.activeTexture.set(u.TEXTURE0);let g=p.fbo;if(!g){let x=new we(s,{width:m,height:m,data:null},u.RGBA);x.bind(u.LINEAR,u.CLAMP_TO_EDGE),g=p.fbo=s.createFramebuffer(m,m,!0,!1),g.colorAttachment.set(x.texture)}s.bindFramebuffer.set(g.framebuffer),s.viewport.set([0,0,m,m]),r.useProgram("hillshadePrepare").draw(s,u.TRIANGLES,i,o,a,ie.disabled,PM(p.tileID,h),null,null,n.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments),p.needsHillshadePrepare=!1}}l(s3,"prepareHillshade");y();function hC(r,e,t,n,i){if(r.renderPass!=="translucent"||!n.length)return;let{isRenderingToTexture:o}=i,s=r.style.projection.useSubdivision,u=r.getDepthModeForSublayer(0,re.ReadOnly),c=r.colorModeForRenderPass();if(s){let[p,h,m]=r.stencilConfigForOverlapTwoPass(n);yb(r,e,t,m,p,u,c,!1,o),yb(r,e,t,m,h,u,c,!0,o)}else{let[p,h]=r.getStencilConfigForOverlapAndUpdateStencilID(n);yb(r,e,t,h,p,u,c,!1,o)}}l(hC,"drawColorRelief");function yb(r,e,t,n,i,o,a,s,u){var x;let c=r.style.projection,p=r.context,h=r.transform,m=p.gl,f=r.useProgram("colorRelief"),d=!r.options.moving,g=!0;for(let _ of n){let b=e.getTile(_),v=b.dem;if(g){let I=m.getParameter(m.MAX_TEXTURE_SIZE),{elevationTexture:L,colorTexture:D}=t.getColorRampTextures(p,I,v.getUnpackVector());p.activeTexture.set(m.TEXTURE1),L.bind(m.NEAREST,m.CLAMP_TO_EDGE),p.activeTexture.set(m.TEXTURE4),D.bind(m.LINEAR,m.CLAMP_TO_EDGE),g=!1}if(!v||!v.data)continue;let w=v.stride,T=v.getPixels();if(p.activeTexture.set(m.TEXTURE0),p.pixelStoreUnpackPremultiplyAlpha.set(!1),b.demTexture=b.demTexture||r.getTileTexture(w),b.demTexture){let I=b.demTexture;I.update(T,{premultiply:!1}),I.bind(m.LINEAR,m.CLAMP_TO_EDGE)}else b.demTexture=new we(p,T,m.RGBA,{premultiply:!1}),b.demTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE);let S=c.getMeshFromTileID(p,_.canonical,s,!0,"raster"),A=(x=r.style.map.terrain)==null?void 0:x.getTerrainData(_),M=h.getProjectionData({overscaledTileID:_,aligned:d,applyGlobeMatrix:!u,applyTerrainMatrix:!0});f.draw(p,m.TRIANGLES,o,i[_.overscaledZ],a,ie.backCCW,SM(t,b.dem),A,M,t.id,S.vertexBuffer,S.indexBuffer,S.segments)}}l(yb,"renderColorRelief");y();var tl=oe(ue(),1);var gb=[new tl.default(0,0),new tl.default(8192,0),new tl.default(8192,8192),new tl.default(0,8192)];function mC(r,e,t,n,i){if(r.renderPass!=="translucent"||t.paint.get("raster-opacity")===0||!n.length)return;let{isRenderingToTexture:o}=i,a=e.getSource(),u=r.style.projection.useSubdivision;if(a instanceof Ht)Vh(r,e,t,n,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(u){let[c,p,h]=r.stencilConfigForOverlapTwoPass(n);Vh(r,e,t,h,c,!1,!0,gb,!1,o),Vh(r,e,t,h,p,!0,!0,gb,!1,o)}else{let[c,p]=r.getStencilConfigForOverlapAndUpdateStencilID(n);Vh(r,e,t,p,c,!1,!0,gb,!1,o)}}l(mC,"drawRaster");function Vh(r,e,t,n,i,o,a,s,u=!1,c=!1){let p=n[n.length-1].overscaledZ,h=r.context,m=h.gl,f=r.useProgram("raster"),d=r.transform,g=r.style.projection,x=r.colorModeForRenderPass(),_=!r.options.moving;for(let b of n){let v=r.getDepthModeForSublayer(b.overscaledZ-p,t.paint.get("raster-opacity")===1?re.ReadWrite:re.ReadOnly,m.LESS),w=e.getTile(b);w.registerFadeDuration(t.paint.get("raster-fade-duration"));let T=e.findLoadedParent(b,0),S=e.findLoadedSibling(b),M=l3(w,T||S||null,e,t,r.transform,r.style.map.terrain),I,L,D=t.paint.get("raster-resampling")==="nearest"?m.NEAREST:m.LINEAR;h.activeTexture.set(m.TEXTURE0),w.texture.bind(D,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(m.TEXTURE1),T?(T.texture.bind(D,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),I=Math.pow(2,T.tileID.overscaledZ-w.tileID.overscaledZ),L=[w.tileID.canonical.x*I%1,w.tileID.canonical.y*I%1]):w.texture.bind(D,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),w.texture.useMipmap&&h.extTextureFilterAnisotropic&&r.transform.pitch>20&&m.texParameterf(m.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);let F=r.style.map.terrain&&r.style.map.terrain.getTerrainData(b),U=d.getProjectionData({overscaledTileID:b,aligned:_,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),C=zM(L||[0,0],I||1,M,t,s),k=g.getMeshFromTileID(h,b.canonical,o,a,"raster"),H=i?i[b.overscaledZ]:le.disabled;f.draw(h,m.TRIANGLES,v,H,x,u?ie.frontCCW:ie.backCCW,C,F,U,t.id,k.vertexBuffer,k.indexBuffer,k.segments)}}l(Vh,"drawTiles");function l3(r,e,t,n,i,o){let a=n.paint.get("raster-fade-duration");if(!o&&a>0){let s=ne.now(),u=(s-r.timeAdded)/a,c=e?(s-e.timeAdded)/a:-1,p=t.getSource(),h=Ai(i,{tileSize:p.tileSize,roundZoom:p.roundZoom}),m=!e||Math.abs(e.tileID.overscaledZ-h)>Math.abs(r.tileID.overscaledZ-h),f=m&&r.refreshedUponExpiration?1:se(m?u:1-c,0,1);return r.refreshedUponExpiration&&u>=1&&(r.refreshedUponExpiration=!1),e?{opacity:1,mix:1-f}:{opacity:f,mix:0}}else return{opacity:1,mix:0}}l(l3,"getFadeValues");y();function fC(r,e,t,n,i){let o=t.paint.get("background-color"),a=t.paint.get("background-opacity");if(a===0)return;let{isRenderingToTexture:s}=i,u=r.context,c=u.gl,p=r.style.projection,h=r.transform,m=h.tileSize,f=t.paint.get("background-pattern");if(r.isPatternMissing(f))return;let d=!f&&o.a===1&&a===1&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==d)return;let g=le.disabled,x=r.getDepthModeForSublayer(0,d==="opaque"?re.ReadWrite:re.ReadOnly),_=r.colorModeForRenderPass(),b=r.useProgram(f?"backgroundPattern":"background"),v=n||Bn(h,{tileSize:m,terrain:r.style.map.terrain});f&&(u.activeTexture.set(c.TEXTURE0),r.imageManager.bind(r.context));let w=t.getCrossfadeParameters();for(let T of v){let S=h.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),A=f?ZM(a,r,f,{tileID:T,tileSize:m},w):GM(a,o),M=r.style.map.terrain&&r.style.map.terrain.getTerrainData(T),I=p.getMeshFromTileID(u,T.canonical,!1,!0,"raster");b.draw(u,c.TRIANGLES,x,g,_,ie.backCCW,A,M,S,t.id,I.vertexBuffer,I.indexBuffer,I.segments)}}l(fC,"drawBackground");y();var u3=new Y(1,0,0,1),c3=new Y(0,1,0,1),p3=new Y(0,0,1,1),h3=new Y(1,0,1,1),m3=new Y(0,1,1,1);function gC(r){let e=r.transform.padding,t=3;dC(r,r.transform.height-(e.top||0),t,u3),dC(r,e.bottom||0,t,c3),yC(r,e.left||0,t,p3),yC(r,r.transform.width-(e.right||0),t,h3);let n=r.transform.centerPoint;f3(r,n.x,r.transform.height-n.y,m3)}l(gC,"drawDebugPadding");function f3(r,e,t,n){Uh(r,e-2/2,t-20/2,2,20,n),Uh(r,e-20/2,t-2/2,20,2,n)}l(f3,"drawCrosshair");function dC(r,e,t,n){Uh(r,0,e+t/2,r.transform.width,t,n)}l(dC,"drawHorizontalLine");function yC(r,e,t,n){Uh(r,e-t/2,0,t,r.transform.height,n)}l(yC,"drawVerticalLine");function Uh(r,e,t,n,i,o){let a=r.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*r.pixelRatio,t*r.pixelRatio,n*r.pixelRatio,i*r.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}l(Uh,"drawDebugSSRect");function xC(r,e,t){for(let n=0;n<t.length;n++)d3(r,e,t[n])}l(xC,"drawDebug");function d3(r,e,t){let n=r.context,i=n.gl,o=r.useProgram("debug"),a=re.disabled,s=le.disabled,u=r.colorModeForRenderPass(),c="$debug",p=r.style.map.terrain&&r.style.map.terrain.getTerrainData(t);n.activeTexture.set(i.TEXTURE0);let h=e.getTileByID(t.key).latestRawTileData,m=h&&h.byteLength||0,f=Math.floor(m/1024),d=e.getTile(t).tileSize,g=512/Math.min(d,512)*(t.overscaledZ/r.transform.zoom)*.5,x=t.canonical.toString();t.overscaledZ!==t.canonical.z&&(x+=" => ".concat(t.overscaledZ));let _="".concat(x," ").concat(f,"kB");y3(r,_);let b=r.transform.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(n,i.TRIANGLES,a,s,Me.alphaBlended,ie.disabled,w_(Y.transparent,g),null,b,c,r.debugBuffer,r.quadTriangleIndexBuffer,r.debugSegments),o.draw(n,i.LINE_STRIP,a,s,u,ie.disabled,w_(Y.red),p,b,c,r.debugBuffer,r.tileBorderIndexBuffer,r.debugSegments)}l(d3,"drawDebugTile");function y3(r,e){r.initDebugOverlayCanvas();let t=r.debugOverlayCanvas,n=r.context.gl,i=r.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,t.width,t.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(e,5,5),i.strokeText(e,5,5),r.debugOverlayTexture.update(t),r.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}l(y3,"drawTextToOverlay");function _C(r,e){let t=null,i=Object.values(r._layers).flatMap(u=>u.source&&!u.isHidden(e)?[r.sourceCaches[u.source]]:[]),o=i.filter(u=>u.getSource().type==="vector"),a=i.filter(u=>u.getSource().type!=="vector"),s=l(u=>{(!t||t.getSource().maxzoom<u.getSource().maxzoom)&&(t=u)},"considerSource");return o.forEach(u=>s(u)),t||a.forEach(u=>s(u)),t}l(_C,"selectDebugSource");y();function bC(r,e,t,n){let{isRenderingGlobe:i}=n,o=r.context,a=t.implementation,s=r.style.projection,u=r.transform,c=u.getProjectionDataForCustomLayer(i),p={farZ:u.farZ,nearZ:u.nearZ,fov:u.fov*Math.PI/180,modelViewProjectionMatrix:u.modelViewProjectionMatrix,projectionMatrix:u.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:"const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n".concat(s.shaderPreludeCode.vertexSource),define:s.shaderDefine},defaultProjectionData:c},h=a.renderingMode?a.renderingMode:"2d";if(r.renderPass==="offscreen"){let m=a.prerender;m&&(r.setCustomLayerDefaults(),o.setColorMode(r.colorModeForRenderPass()),m.call(a,o.gl,p),o.setDirty(),r.setBaseState())}else if(r.renderPass==="translucent"){r.setCustomLayerDefaults(),o.setColorMode(r.colorModeForRenderPass()),o.setStencilMode(le.disabled);let m=h==="3d"?r.getDepthModeFor3D():r.getDepthModeForSublayer(0,re.ReadOnly);o.setDepthMode(m),a.render(o.gl,p),o.setDirty(),r.setBaseState(),o.bindFramebuffer.set(null)}}l(bC,"drawCustom");y();function vC(r,e){let t=r.context,n=t.gl,i=r.transform,o=Me.unblended,a=new re(n.LEQUAL,re.ReadWrite,[0,1]),s=e.sourceCache.getRenderableTiles(),u=r.useProgram("terrainDepth");t.bindFramebuffer.set(e.getFramebuffer("depth").framebuffer),t.viewport.set([0,0,r.width/devicePixelRatio,r.height/devicePixelRatio]),t.clear({color:Y.transparent,depth:1});for(let c of s){let p=e.getTerrainMesh(c.tileID),h=e.getTerrainData(c.tileID),m=i.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),f=Y2(e.getMeshFrameDelta(i.zoom));u.draw(t,n.TRIANGLES,a,le.disabled,o,ie.backCCW,f,h,m,"terrain",p.vertexBuffer,p.indexBuffer,p.segments)}t.bindFramebuffer.set(null),t.viewport.set([0,0,r.width,r.height])}l(vC,"drawDepth");function wC(r,e){let t=r.context,n=t.gl,i=r.transform,o=Me.unblended,a=new re(n.LEQUAL,re.ReadWrite,[0,1]),s=e.getCoordsTexture(),u=e.sourceCache.getRenderableTiles(),c=r.useProgram("terrainCoords");t.bindFramebuffer.set(e.getFramebuffer("coords").framebuffer),t.viewport.set([0,0,r.width/devicePixelRatio,r.height/devicePixelRatio]),t.clear({color:Y.transparent,depth:1}),e.coordsIndex=[];for(let p of u){let h=e.getTerrainMesh(p.tileID),m=e.getTerrainData(p.tileID);t.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,s.texture);let f=K2(255-e.coordsIndex.length,e.getMeshFrameDelta(i.zoom)),d=i.getProjectionData({overscaledTileID:p.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});c.draw(t,n.TRIANGLES,a,le.disabled,o,ie.backCCW,f,m,d,"terrain",h.vertexBuffer,h.indexBuffer,h.segments),e.coordsIndex.push(p.tileID.key)}t.bindFramebuffer.set(null),t.viewport.set([0,0,r.width,r.height])}l(wC,"drawCoords");function xb(r,e,t,n){let{isRenderingGlobe:i}=n,o=r.context,a=o.gl,s=r.transform,u=r.colorModeForRenderPass(),c=r.getDepthModeFor3D(),p=r.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,r.width,r.height]);for(let h of t){let m=e.getTerrainMesh(h.tileID),f=r.renderToTexture.getTexture(h),d=e.getTerrainData(h.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,f.texture);let g=e.getMeshFrameDelta(s.zoom),x=s.calculateFogMatrix(h.tileID.toUnwrapped()),_=X2(g,x,r.style.sky,s.pitch,i),b=s.getProjectionData({overscaledTileID:h.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});p.draw(o,a.TRIANGLES,c,le.disabled,u,ie.backCCW,_,d,b,"terrain",m.vertexBuffer,m.indexBuffer,m.segments)}}l(xb,"drawTerrain");y();function PC(r,e){if(!e.mesh){let t=new mt;t.emplaceBack(-1,-1),t.emplaceBack(1,-1),t.emplaceBack(1,1),t.emplaceBack(-1,1);let n=new Ne;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),e.mesh=new Bt(r.createVertexBuffer(t,$t.members),r.createIndexBuffer(n),he.simpleSegment(0,0,t.length,n.length))}return e.mesh}l(PC,"getMesh");function TC(r,e){let t=r.context,n=t.gl,i=$M(e,r.style.map.transform,r.pixelRatio),o=new re(n.LEQUAL,re.ReadWrite,[0,1]),a=le.disabled,s=r.colorModeForRenderPass(),u=r.useProgram("sky"),c=PC(t,e);u.draw(t,n.TRIANGLES,o,a,s,ie.disabled,i,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}l(TC,"drawSky");function g3(r,e){let t=r.properties.get("position"),n=[-t.x,-t.y,-t.z],i=z.identity(new Float64Array(16));return r.properties.get("anchor")==="map"&&(z.rotateZ(i,i,e.rollInRadians),z.rotateX(i,i,-e.pitchInRadians),z.rotateZ(i,i,e.bearingInRadians),z.rotateX(i,i,e.center.lat*Math.PI/180),z.rotateY(i,i,-e.center.lng*Math.PI/180)),V.transformMat4(n,n,i),n}l(g3,"getSunPos");function SC(r,e,t){let n=r.context,i=n.gl,o=r.useProgram("atmosphere"),a=new re(i.LEQUAL,re.ReadOnly,[0,1]),s=r.transform,u=g3(t,r.transform),c=s.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),p=e.properties.get("atmosphere-blend")*c.projectionTransition;if(p===0)return;let h=Ri(s.worldSize,s.center.lat),m=s.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,Re.transformMat4(f,f,s.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,Re.transformMat4(f,f,m),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;let d=[f[0],f[1],f[2]],g=HM(u,p,d,h,m),x=PC(n,e);o.draw(n,i.TRIANGLES,a,le.disabled,Me.alphaBlended,ie.disabled,g,null,null,"atmosphere",x.vertexBuffer,x.indexBuffer,x.segments)}l(SC,"drawAtmosphere");var _b=class _b{constructor(e,t){this.context=new Fh(e),this.transform=t,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:z.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Jr.maxUnderzooming+Jr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Io}resize(e,t,n){if(this.width=Math.floor(e*n),this.height=Math.floor(t*n),this.pixelRatio=n,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let i of this.style._order)this.style._layers[i].resize()}setup(){let e=this.context,t=new mt;t.emplaceBack(0,0),t.emplaceBack(8192,0),t.emplaceBack(0,8192),t.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(t,$t.members),this.tileExtentSegments=he.simpleSegment(0,0,4,2);let n=new mt;n.emplaceBack(0,0),n.emplaceBack(8192,0),n.emplaceBack(0,8192),n.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(n,$t.members),this.debugSegments=he.simpleSegment(0,0,4,5);let i=new nc;i.emplaceBack(0,0,0,0),i.emplaceBack(8192,0,8192,0),i.emplaceBack(0,8192,0,8192),i.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=e.createVertexBuffer(i,Z2.members),this.rasterBoundsSegments=he.simpleSegment(0,0,4,2);let o=new mt;o.emplaceBack(0,0),o.emplaceBack(8192,0),o.emplaceBack(0,8192),o.emplaceBack(8192,8192),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(o,$t.members),this.rasterBoundsSegmentsPosOnly=he.simpleSegment(0,0,4,5);let a=new mt;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,$t.members),this.viewportSegments=he.simpleSegment(0,0,4,2);let s=new Qa;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);let u=new Ne;u.emplaceBack(1,0,2),u.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(u);let c=this.context.gl;this.stencilClearMode=new le({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new Bt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let n=z.create();z.ortho(n,0,this.width,this.height,0,0,1),z.scale(n,n,[t.drawingBufferWidth,t.drawingBufferHeight,0]);let i={mainMatrix:n,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:n};this.useProgram("clippingMask",null,!0).draw(e,t.TRIANGLES,re.disabled,this.stencilClearMode,Me.disabled,ie.disabled,null,null,i,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let i=this.context;i.setColorMode(Me.disabled),i.setDepthMode(re.disabled);let o={};for(let a of t)o[a.key]=this.nextStencilID++;this._renderTileMasks(o,t,n,!0),this._renderTileMasks(o,t,n,!1),this._tileClippingMaskIDs=o}_renderTileMasks(e,t,n,i){let o=this.context,a=o.gl,s=this.style.projection,u=this.transform,c=this.useProgram("clippingMask");for(let p of t){let h=e[p.key],m=this.style.map.terrain&&this.style.map.terrain.getTerrainData(p),f=s.getMeshFromTileID(this.context,p.canonical,i,!0,"stencil"),d=u.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!n,applyTerrainMatrix:!0});c.draw(o,a.TRIANGLES,re.disabled,new le({func:a.ALWAYS,mask:0},h,255,a.KEEP,a.KEEP,a.REPLACE),Me.disabled,n?ie.disabled:ie.backCCW,null,m,d,"$clipping",f.vertexBuffer,f.indexBuffer,f.segments)}}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,n=this.style.projection,i=this.transform,o=this.useProgram("depth"),a=this.getDepthModeFor3D(),s=Bn(i,{tileSize:i.tileSize});for(let u of s){let c=this.style.map.terrain&&this.style.map.terrain.getTerrainData(u),p=n.getMeshFromTileID(this.context,u.canonical,!0,!0,"raster"),h=i.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(e,t.TRIANGLES,a,le.disabled,Me.disabled,ie.backCCW,null,c,h,"$clipping",p.vertexBuffer,p.indexBuffer,p.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new le({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new le({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,n=e.sort((a,s)=>s.overscaledZ-a.overscaledZ),i=n[n.length-1].overscaledZ,o=n[0].overscaledZ-i+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let a={};for(let s=0;s<o;s++)a[s+i]=new le({func:t.GEQUAL,mask:255},s+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=o,[a,n]}return[{[i]:le.disabled},n]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,n=e.sort((a,s)=>s.overscaledZ-a.overscaledZ),i=n[n.length-1].overscaledZ,o=n[0].overscaledZ-i+1;if(this.clearStencil(),o>1){let a={},s={};for(let u=0;u<o;u++)a[u+i]=new le({func:t.GREATER,mask:255},o+1+u,255,t.KEEP,t.KEEP,t.REPLACE),s[u+i]=new le({func:t.GREATER,mask:255},1+u,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=o*2+1,[a,s,n]}else return this.nextStencilID=3,[{[i]:new le({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[i]:new le({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},n]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Me([e.CONSTANT_COLOR,e.ONE],new Y(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Me.unblended:Me.alphaBlended}getDepthModeForSublayer(e,t,n){if(!this.opaquePassEnabledForLayer())return re.disabled;let i=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new re(n||this.context.gl.LEQUAL,t,[i,i])}getDepthModeFor3D(){return new re(this.context.gl.LEQUAL,re.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,t){var p,h;this.style=e,this.options=t,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(ne.now()),this.imageManager.beginFrame();let n=this.style._order,i=this.style.sourceCaches,o={},a={},s={},u={isRenderingToTexture:!1,isRenderingGlobe:((p=e.projection)==null?void 0:p.transitionState)>0};for(let m in i){let f=i[m];f.used&&f.prepare(this.context),o[m]=f.getVisibleCoordinates(!1),a[m]=o[m].slice().reverse(),s[m]=f.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let m=0;m<n.length;m++){let f=n[m];if(this.style._layers[f].is3D()){this.opaquePassCutoff=m;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let m of n){let f=this.style._layers[m];if(!f.hasOffscreenPass()||f.isHidden(this.transform.zoom))continue;let d=a[f.source];f.type!=="custom"&&!d.length||this.renderLayer(this,i[f.source],f,d,u)}if((h=this.style.projection)==null||h.updateGPUdependent({context:this.context,useProgram:l(m=>this.useProgram(m),"useProgram")}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?Y.black:Y.transparent,depth:1}),this.clearStencil(),this.style.sky&&TC(this,this.style.sky),this._showOverdrawInspector=t.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){let m=this.style._layers[n[this.currentLayer]],f=i[m.source],d=o[m.source];this._renderTileClippingMasks(m,d,!1),this.renderLayer(this,f,m,d,u)}this.renderPass="translucent";let c=!1;for(this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){let m=this.style._layers[n[this.currentLayer]],f=i[m.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(m,u))continue;!this.opaquePassEnabledForLayer()&&!c&&(c=!0,u.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let d=(m.type==="symbol"?s:a)[m.source];this._renderTileClippingMasks(m,o[m.source],!!this.renderToTexture),this.renderLayer(this,f,m,d,u)}if(u.isRenderingGlobe&&SC(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let m=_C(this.style,this.transform.zoom);m&&xC(this,m,m.getVisibleCoordinates())}this.options.showPadding&&gC(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let t=this.terrainFacilitator.matrix,n=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.dirty;i||(i=e?!z.exactEquals(t,n):!z.equals(t,n)),i||(i=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),i&&(z.copy(t,n),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,vC(this,this.style.map.terrain),wC(this,this.style.map.terrain))}renderLayer(e,t,n,i,o){n.isHidden(this.transform.zoom)||n.type!=="background"&&n.type!=="custom"&&!(i||[]).length||(this.id=n.id,lT(n)?rC(e,t,n,i,this.style.placement.variableOffsets,o):$w(n)?nC(e,t,n,i,o):Qw(n)?iC(e,t,n,i,o):OP(n)?sC(e,t,n,i,o):dP(n)?uC(e,t,n,i,o):AP(n)?cC(e,t,n,i,o):rP(n)?pC(e,t,n,i,o):oP(n)?hC(e,t,n,i,o):fT(n)?mC(e,t,n,i,o):pT(n)?fC(e,t,n,i,o):yT(n)&&bC(e,t,n,o))}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),n=this.imageManager.getPattern(e.to.toString());return!t||!n}useProgram(e,t,n=!1,i=[]){this.cache=this.cache||{};let o=!!this.style.map.terrain,a=this.style.projection,s=n?zt.projectionMercator:a.shaderPreludeCode,u=n?$x:a.shaderDefine,c="/".concat(n?Xx:a.shaderVariantName),p=t?t.cacheKey:"",h=this._showOverdrawInspector?"/overdraw":"",m=o?"/terrain":"",f=i?"/".concat(i.join("/")):"",d=e+p+c+h+m+f;return this.cache[d]||(this.cache[d]=new Xp(this.context,zt[e],t,YM[e],this._showOverdrawInspector,o,s,u,i)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new we(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}};l(_b,"Painter");var jh=_b;y();y();function Nh(r,e){let t=!1,n=null,i=null,o,a=l(()=>{n=null,t&&(r.apply(i,o),n=setTimeout(a,e),t=!1)},"later");return(...s)=>(t=!0,i=this,o=s,n||a(),n)}l(Nh,"throttle");var bb=class bb{constructor(e){this._getCurrentHash=l(()=>{let e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(n=>n.split("=")).forEach(n=>{n[0]===this._hashName&&(t=n)}),(t&&t[1]||"").split("/")}return e.split("/")},"_getCurrentHash");this._onHashChange=l(()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},"_onHashChange");this._updateHashUnthrottled=l(()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},"_updateHashUnthrottled");this._removeHash=l(()=>{let e=this._getCurrentHash();if(e.length===0)return;let t=e.join("/"),n=t;n.split("&").length>0&&(n=n.split("&")[0]),this._hashName&&(n="".concat(this._hashName,"=").concat(t));let i=window.location.hash.replace(n,"");i.startsWith("#&")?i=i.slice(0,1)+i.slice(2):i==="#"&&(i="");let o=window.location.href.replace(/(#.+)?$/,i);o=o.replace("&&","&"),window.history.replaceState(window.history.state,null,o)},"_removeHash");this._updateHash=Nh(this._updateHashUnthrottled,30*1e3/100);this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),n=Math.round(this._map.getZoom()*100)/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,i),a=Math.round(t.lng*o)/o,s=Math.round(t.lat*o)/o,u=this._map.getBearing(),c=this._map.getPitch(),p="";if(e?p+="/".concat(a,"/").concat(s,"/").concat(n):p+="".concat(n,"/").concat(s,"/").concat(a),(u||c)&&(p+="/".concat(Math.round(u*10)/10)),c&&(p+="/".concat(Math.round(c))),this._hashName){let h=this._hashName,m=!1,f=window.location.hash.slice(1).split("&").map(d=>{let g=d.split("=")[0];return g===h?(m=!0,"".concat(g,"=").concat(p)):d}).filter(d=>d);return m||f.push("".concat(h,"=").concat(p)),"#".concat(f.join("&"))}return"#".concat(p)}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new X(+e[2],+e[1])}catch(o){return!1}let t=+e[0],n=+(e[3]||0),i=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&n>=-180&&n<=180&&i>=this._map.getMinPitch()&&i<=this._map.getMaxPitch()}};l(bb,"Hash");var rl=bb;y();y();var MC=oe(ue(),1);var ol={linearity:.3,easing:$o(0,0,.3,1)},x3=G({deceleration:2500,maxSpeed:1400},ol),_3=G({deceleration:20,maxSpeed:1400},ol),b3=G({deceleration:1e3,maxSpeed:360},ol),v3=G({deceleration:1e3,maxSpeed:90},ol),w3=G({deceleration:1e3,maxSpeed:360},ol),vb=class vb{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ne.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=ne.now(),n=160;for(;e.length>0&&t-e[0].time>n;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let t={zoom:0,bearing:0,pitch:0,roll:0,pan:new MC.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:a}of this._inertiaBuffer)t.zoom+=a.zoomDelta||0,t.bearing+=a.bearingDelta||0,t.pitch+=a.pitchDelta||0,t.roll+=a.rollDelta||0,a.panDelta&&t.pan._add(a.panDelta),a.around&&(t.around=a.around),a.pinchAround&&(t.pinchAround=a.pinchAround);let i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(t.pan.mag()){let a=il(t.pan.mag(),i,G({},x3,e||{})),s=t.pan.mult(a.amount/t.pan.mag()),u=this._map.cameraHelper.handlePanInertia(s,this._map.transform);o.center=u.easingCenter,o.offset=u.easingOffset,nl(o,a)}if(t.zoom){let a=il(t.zoom,i,_3);o.zoom=this._map.transform.zoom+a.amount,nl(o,a)}if(t.bearing){let a=il(t.bearing,i,b3);o.bearing=this._map.transform.bearing+se(a.amount,-179,179),nl(o,a)}if(t.pitch){let a=il(t.pitch,i,v3);o.pitch=this._map.transform.pitch+a.amount,nl(o,a)}if(t.roll){let a=il(t.roll,i,w3);o.roll=this._map.transform.roll+se(a.amount,-179,179),nl(o,a)}if(o.zoom||o.bearing){let a=t.pinchAround===void 0?t.around:t.pinchAround;o.around=a?this._map.unproject(a):this._map.getCenter()}return this.clear(),G(o,{noMoveStart:!0})}};l(vb,"HandlerInertia");var Gh=vb;function nl(r,e){(!r.duration||r.duration<e.duration)&&(r.duration=e.duration,r.easing=e.easing)}l(nl,"extendDuration");function il(r,e,t){let{maxSpeed:n,linearity:i,deceleration:o}=t,a=se(r*i/(e/1e3),-n,n),s=Math.abs(a)/(o*i);return{easing:t.easing,duration:s*1e3,amount:a*(s/2)}}l(il,"calculateEasing");y();y();var CC=oe(ue(),1);var wb=class wb extends B{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n,i={}){n=n instanceof MouseEvent?n:new MouseEvent(e,n);let o=O.mousePos(t.getCanvas(),n),a=t.unproject(o);super(e,G({point:o,lngLat:a,originalEvent:n},i)),this._defaultPrevented=!1,this.target=t}};l(wb,"MapMouseEvent");var ft=wb,Pb=class Pb extends B{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n){let i=e==="touchend"?n.changedTouches:n.touches,o=O.touchPos(t.getCanvasContainer(),i),a=o.map(c=>t.unproject(c)),s=o.reduce((c,p,h,m)=>c.add(p.div(m.length)),new CC.default(0,0)),u=t.unproject(s);super(e,{points:o,point:s,lngLats:a,lngLat:u,originalEvent:n}),this._defaultPrevented=!1}};l(Pb,"MapTouchEvent");var jn=Pb,Tb=class Tb extends B{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}};l(Tb,"MapWheelEvent");var al=Tb;var Sb=class Sb{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new al(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new ft(e.type,this._map,e))}mouseup(e){this._map.fire(new ft(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new ft(e.type,this._map,e))}dblclick(e){return this._firePreventable(new ft(e.type,this._map,e))}mouseover(e){this._map.fire(new ft(e.type,this._map,e))}mouseout(e){this._map.fire(new ft(e.type,this._map,e))}touchstart(e){return this._firePreventable(new jn(e.type,this._map,e))}touchmove(e){this._map.fire(new jn(e.type,this._map,e))}touchend(e){this._map.fire(new jn(e.type,this._map,e))}touchcancel(e){this._map.fire(new jn(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};l(Sb,"MapEventHandler");var Zh=Sb,Mb=class Mb{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new ft(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ft("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new ft(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};l(Mb,"BlockableMapEventHandler");var qh=Mb;y();y();var AC=oe(ue(),1);var Cb=class Cb{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(AC.default.convert(e),this._map.terrain)}};l(Cb,"TransformProvider");var ar=Cb;var Ab=class Ab{constructor(e,t){this._map=e,this._tr=new ar(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(O.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let n=t;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)return;let i=this._startPos;this._lastPos=n,this._box||(this._box=O.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let o=Math.min(i.x,n.x),a=Math.max(i.x,n.x),s=Math.min(i.y,n.y),u=Math.max(i.y,n.y);O.setTransform(this._box,"translate(".concat(o,"px,").concat(s,"px)")),this._box.style.width="".concat(a-o,"px"),this._box.style.height="".concat(u-s,"px")}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let n=this._startPos,i=t;if(this.reset(),O.suppressClick(),n.x===i.x&&n.y===i.y)this._fireEvent("boxzoomcancel",e);else return this._map.fire(new B("boxzoomend",{originalEvent:e})),{cameraAnimation:l(o=>o.fitScreenCoordinates(n,i,this._tr.bearing,{linear:!0}),"cameraAnimation")}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(O.remove(this._box),this._box=null),O.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new B(e,{originalEvent:t}))}};l(Ab,"BoxZoomHandler");var sl=Ab;y();y();var IC=oe(ue(),1);y();function ll(r,e){if(r.length!==e.length)throw new Error("The number of touches and points are not equal - touches ".concat(r.length,", points ").concat(e.length));let t={};for(let n=0;n<r.length;n++)t[r[n].identifier]=e[n];return t}l(ll,"indexTouches");function P3(r){let e=new IC.default(0,0);for(let t of r)e._add(t);return e.div(r.length)}l(P3,"getCentroid");var Eb=500,T3=500,Hh=30,Lb=class Lb{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=P3(t),this.touches=ll(n,t)))}touchmove(e,t,n){if(this.aborted||!this.centroid)return;let i=ll(n,t);for(let o in this.touches){let a=this.touches[o],s=i[o];(!s||s.dist(a)>Hh)&&(this.aborted=!0)}}touchend(e,t,n){if((!this.centroid||e.timeStamp-this.startTime>T3)&&(this.aborted=!0),n.length===0){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}};l(Lb,"SingleTapRecognizer");var Ib=Lb,kb=class kb{constructor(e){this.singleTap=new Ib(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,n){this.singleTap.touchstart(e,t,n)}touchmove(e,t,n){this.singleTap.touchmove(e,t,n)}touchend(e,t,n){let i=this.singleTap.touchend(e,t,n);if(i){let o=e.timeStamp-this.lastTime<Eb,a=!this.lastTap||this.lastTap.dist(i)<Hh;if((!o||!a)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}};l(kb,"TapRecognizer");var Di=kb;var Rb=class Rb{constructor(e){this._tr=new ar(e),this._zoomIn=new Di({numTouches:1,numTaps:2}),this._zoomOut=new Di({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,n){this._zoomIn.touchstart(e,t,n),this._zoomOut.touchstart(e,t,n)}touchmove(e,t,n){this._zoomIn.touchmove(e,t,n),this._zoomOut.touchmove(e,t,n)}touchend(e,t,n){let i=this._zoomIn.touchend(e,t,n),o=this._zoomOut.touchend(e,t,n),a=this._tr;if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:l(s=>s.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(i)},{originalEvent:e}),"cameraAnimation")};if(o)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:l(s=>s.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(o)},{originalEvent:e}),"cameraAnimation")}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};l(Rb,"TapZoomHandler");var Wh=Rb;y();var EC=oe(ue(),1);y();var Db=class Db{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let n=this._lastPoint;if(!n)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let i=Array.isArray(t)?t[0]:t;if(!(!this._moved&&i.dist(n)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(n,i)}dragEnd(e){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(e)&&(this._moved&&O.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};l(Db,"DragHandler");var rn=Db;y();var S3=0,M3=2,C3={[S3]:1,[M3]:2};function A3(r,e){let t=C3[e];return r.buttons===void 0||(r.buttons&t)!==t}l(A3,"buttonNoLongerPressed");var zb=class zb{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=O.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!A3(e,this._eventButton)}isValidEndEvent(e){return O.mouseButton(e)===this._eventButton}};l(zb,"MouseMoveStateManager");var Nn=zb,Bb=class Bb{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){let t=e.targetTouches[0].identifier;this._firstTouch=t}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}};l(Bb,"OneFingerTouchMoveStateManager");var Fb=Bb,Ob=class Ob{constructor(e=new Nn({checkCorrectEvent:l(()=>!0,"checkCorrectEvent")}),t=new Fb){this.mouseMoveStateManager=e;this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,n){if(e instanceof MouseEvent)return t(e);if(typeof TouchEvent<"u"&&e instanceof TouchEvent)return n(e)}startMove(e){this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.startMove(t),t=>this.oneFingerTouchMoveStateManager.startMove(t))}endMove(e){this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.endMove(t),t=>this.oneFingerTouchMoveStateManager.endMove(t))}isValidStartEvent(e){return this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(e){return this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(e){return this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}};l(Ob,"MouseOrTouchMoveStateManager");var $h=Ob;var Vb=0,Ub=2,Xh=l(r=>{r.mousedown=r.dragStart,r.mousemoveWindow=r.dragMove,r.mouseup=r.dragEnd,r.contextmenu=e=>{e.preventDefault()}},"assignEvents");function LC({enable:r,clickTolerance:e}){let t=new Nn({checkCorrectEvent:l(n=>O.mouseButton(n)===Vb&&!n.ctrlKey,"checkCorrectEvent")});return new rn({clickTolerance:e,move:l((n,i)=>({around:i,panDelta:i.sub(n)}),"move"),activateOnStart:!0,moveStateManager:t,enable:r,assignEvents:Xh})}l(LC,"generateMousePanHandler");function kC({enable:r,clickTolerance:e,aroundCenter:t=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:i=.8},o){let a=new Nn({checkCorrectEvent:l(s=>O.mouseButton(s)===Vb&&s.ctrlKey||O.mouseButton(s)===Ub&&!s.ctrlKey,"checkCorrectEvent")});return new rn({clickTolerance:e,move:l((s,u)=>{let c=o();if(t&&Math.abs(c.y-s.y)>n)return{bearingDelta:Gl(new EC.default(s.x,u.y),u,c)};let p=(u.x-s.x)*i;return t&&u.y<c.y&&(p=-p),{bearingDelta:p}},"move"),moveStateManager:a,enable:r,assignEvents:Xh})}l(kC,"generateMouseRotationHandler");function RC({enable:r,clickTolerance:e,pitchDegreesPerPixelMoved:t=-.5}){let n=new Nn({checkCorrectEvent:l(i=>O.mouseButton(i)===Vb&&i.ctrlKey||O.mouseButton(i)===Ub,"checkCorrectEvent")});return new rn({clickTolerance:e,move:l((i,o)=>({pitchDelta:(o.y-i.y)*t}),"move"),moveStateManager:n,enable:r,assignEvents:Xh})}l(RC,"generateMousePitchHandler");function DC({enable:r,clickTolerance:e,rollDegreesPerPixelMoved:t=.3},n){let i=new Nn({checkCorrectEvent:l(o=>O.mouseButton(o)===Ub&&o.ctrlKey,"checkCorrectEvent")});return new rn({clickTolerance:e,move:l((o,a)=>{let s=n(),u=(a.x-o.x)*t;return a.y<s.y&&(u=-u),{rollDelta:u}},"move"),moveStateManager:i,enable:r,assignEvents:Xh})}l(DC,"generateMouseRollHandler");y();var Yh=oe(ue(),1);var jb=class jb{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new Yh.default(0,0)}_shouldBePrevented(e){let t=this._map.cooperativeGestures.isEnabled()?2:1;return e<t}touchstart(e,t,n){return this._calculateTransform(e,t,n)}touchmove(e,t,n){if(this._active){if(this._shouldBePrevented(n.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,t,n)}}touchend(e,t,n){this._calculateTransform(e,t,n),this._active&&this._shouldBePrevented(n.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,n){n.length>0&&(this._active=!0);let i=ll(n,t),o=new Yh.default(0,0),a=new Yh.default(0,0),s=0;for(let p in i){let h=i[p],m=this._touches[p];m&&(o._add(h),a._add(h.sub(m)),s++,i[p]=h)}if(this._touches=i,this._shouldBePrevented(s)||!a.mag())return;let u=a.div(s);return this._sum._add(u),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:u}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};l(jb,"TouchPanHandler");var Kh=jb;y();var Gb=class Gb{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,n){if(!this._firstTwoTouches)return;e.preventDefault();let[i,o]=this._firstTwoTouches,a=Jh(n,t,i),s=Jh(n,t,o);if(!a||!s)return;let u=this._aroundCenter?null:a.add(s).div(2);return this._move([a,s],u,e)}touchend(e,t,n){if(!this._firstTwoTouches)return;let[i,o]=this._firstTwoTouches,a=Jh(n,t,i),s=Jh(n,t,o);a&&s||(this._active&&O.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};l(Gb,"TwoFingersTouchHandler");var ul=Gb;function Jh(r,e,t){for(let n=0;n<r.length;n++)if(r[n].identifier===t)return e[n]}l(Jh,"getTouchById");var I3=.1;function FC(r,e){return Math.log(r/e)/Math.LN2}l(FC,"getZoomDelta");var Zb=class Zb extends ul{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let n=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(FC(this._distance,this._startDistance))<I3))return this._active=!0,{zoomDelta:FC(this._distance,n),pinchAround:t}}};l(Zb,"TwoFingersTouchZoomHandler");var cl=Zb,E3=25;function zC(r,e){return r.angleWith(e)*180/Math.PI}l(zC,"getBearingDelta");var qb=class qb extends ul{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,n){let i=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:zC(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=Math.PI*this._minDiameter,n=E3/t*360,i=zC(e,this._startVector);return Math.abs(i)<n}};l(qb,"TwoFingersTouchRotateHandler");var pl=qb;function Nb(r){return Math.abs(r.y)>Math.abs(r.x)}l(Nb,"isVertical");var L3=100,Hb=class Hb extends ul{constructor(t){super();this._currentTouchCount=0;this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,i){super.touchstart(t,n,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,Nb(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let o=t[0].sub(this._lastPoints[0]),a=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,a,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,i){if(this._valid!==void 0)return this._valid;let o=2,a=t.mag()>=o,s=n.mag()>=o;if(!a&&!s)return;if(!a||!s)return this._firstMove===void 0&&(this._firstMove=i),i-this._firstMove<L3?void 0:!1;let u=t.y>0==n.y>0;return Nb(t)&&Nb(n)&&u}};l(Hb,"TwoFingersTouchPitchHandler");var hl=Hb;y();var k3={panStep:100,bearingStep:15,pitchStep:10},Wb=class Wb{constructor(e){this._tr=new ar(e);let t=k3;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,n=0,i=0,o=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?n=-1:(e.preventDefault(),o=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),o=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,i=0),{cameraAnimation:l(s=>{let u=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:R3,zoom:t?Math.round(u.zoom)+t*(e.shiftKey?2:1):u.zoom,bearing:u.bearing+n*this._bearingStep,pitch:u.pitch+i*this._pitchStep,offset:[-o*this._panStep,-a*this._panStep],center:u.center},{originalEvent:e})},"cameraAnimation")}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};l(Wb,"KeyboardHandler");var ml=Wb;function R3(r){return r*(2-r)}l(R3,"easeOut");y();var BC=4.000244140625,D3=1/100,F3=1/450,z3=2,B3=5,$b=class $b{constructor(e,t){this._onTimeout=l(e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},"_onTimeout");this._map=e,this._tr=new ar(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=D3,this._wheelZoomRate=F3}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,n=ne.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,t!==0&&t%BC===0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t=t/4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=O.mousePos(this._map.getCanvas(),e),n=this._tr;this._aroundCenter?this._aroundPoint=n.transform.locationToScreenPoint(X.convert(n.center)):this._aroundPoint=t,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let s=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=s),typeof this._targetZoom=="number"&&(this._targetZoom+=s)}if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>BC?this._wheelZoomRate:this._defaultZoomRate,u=z3/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&u!==0&&(u=1/u);let c=typeof this._targetZoom!="number"?e.scale:Ye(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),Ze(c*u)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,n=this._startZoom,i=this._easing,o=!1,a;if(this._type==="wheel"&&n&&i){let s=ne.now()-this._lastWheelEventTime,u=Math.min((s+B3)/200,1),c=i(u);a=Ae.number(n,t,c),u<1?this._frameId||(this._frameId=!0):o=!0}else a=t,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=a,{noInertia:!0,needsRenderFrame:!o,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=Xo;if(this._prevEase){let n=this._prevEase,i=(ne.now()-n.start)/n.duration,o=n.easing(i+.01)-n.easing(i),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.27*.27-a*a);t=$o(a,s,.25,1)}return this._prevEase={start:ne.now(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}};l($b,"ScrollZoomHandler");var fl=$b;y();var Xb=class Xb{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}};l(Xb,"DoubleClickZoomHandler");var dl=Xb;y();var Yb=class Yb{constructor(e){this._tr=new ar(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:l(n=>{n.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})},"cameraAnimation")}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};l(Yb,"ClickZoomHandler");var Qh=Yb;y();var Kb=class Kb{constructor(){this._tap=new Di({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,n){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,n);else{let i=t[0],o=e.timeStamp-this._tapTime<Eb,a=this._tapPoint.dist(i)<Hh;!o||!a?this.reset():n.length>0&&(this._swipePoint=i,this._swipeTouch=n[0].identifier)}}touchmove(e,t,n){if(!this._tapTime)this._tap.touchmove(e,t,n);else if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;let i=t[0],o=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:o/128}}}touchend(e,t,n){if(this._tapTime)this._swipePoint&&n.length===0&&this.reset();else{let i=this._tap.touchend(e,t,n);i&&(this._tapTime=e.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};l(Kb,"TapDragZoomHandler");var em=Kb;y();var Jb=class Jb{constructor(e,t,n){this._el=e,this._mousePan=t,this._touchPan=n}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}};l(Jb,"DragPanHandler");var yl=Jb;y();var Qb=class Qb{constructor(e,t,n,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=n,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}};l(Qb,"DragRotateHandler");var gl=Qb;y();var ev=class ev{constructor(e,t,n,i){this._el=e,this._touchZoom=t,this._touchRotate=n,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}};l(ev,"TwoFingersTouchZoomRotateHandler");var xl=ev;y();var tv=class tv{constructor(e,t){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey";this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=O.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let n=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=t,this._container.appendChild(i);let o=document.createElement("div");o.className="maplibregl-mobile-message",o.textContent=n,this._container.appendChild(o),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(O.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new B("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}};l(tv,"CooperativeGesturesHandler");var _l=tv;var OC=oe(ue(),1);var tm=l(r=>r.zoom||r.drag||r.roll||r.pitch||r.rotate,"isMoving"),iv=class iv extends B{};l(iv,"RenderFrameEvent");var nv=iv;function rv(r){return r.panDelta&&r.panDelta.mag()||r.zoomDelta||r.bearingDelta||r.pitchDelta||r.rollDelta}l(rv,"hasChange");var ov=class ov{constructor(e,t){this.handleWindowEvent=l(e=>{this.handleEvent(e,"".concat(e.type,"Window"))},"handleWindowEvent");this.handleEvent=l((e,t)=>{if(e.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let n=e.type==="renderFrame"?void 0:e,i={needsRenderFrame:!1},o={},a={};for(let{handlerName:c,handler:p,allowed:h}of this._handlers){if(!p.isEnabled())continue;let m;if(this._blockedByActive(a,h,c))p.reset();else if(p[t||e.type]){if(J0(e,t||e.type)){let f=O.mousePos(this._map.getCanvas(),e);m=p[t||e.type](e,f)}else if(K0(e,t||e.type)){let f=e.touches,d=this._getMapTouches(f),g=O.touchPos(this._map.getCanvas(),d);m=p[t||e.type](e,g,d)}else Q0(t||e.type)||(m=p[t||e.type](e));this.mergeHandlerResult(i,o,m,c,n),m&&m.needsRenderFrame&&this._triggerRenderFrame()}(m||p.isActive())&&(a[c]=p)}let s={};for(let c in this._previousActiveHandlers)a[c]||(s[c]=n);this._previousActiveHandlers=a,(Object.keys(s).length||rv(i))&&(this._changes.push([i,o,s]),this._triggerRenderFrame()),(Object.keys(a).length||rv(i))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:u}=i;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))},"handleEvent");this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Gh(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(t);let n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]];for(let[i,o,a]of this._listeners)O.addEventListener(i,o,i===document?this.handleWindowEvent:this.handleEvent,a)}destroy(){for(let[e,t,n]of this._listeners)O.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){let t=this._map,n=t.getCanvasContainer();this._add("mapEvent",new Zh(t,e));let i=t.boxZoom=new sl(t,e);this._add("boxZoom",i),e.interactive&&e.boxZoom&&i.enable();let o=t.cooperativeGestures=new _l(t,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();let a=new Wh(t),s=new Qh(t);t.doubleClickZoom=new dl(s,a),this._add("tapZoom",a),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let u=new em;this._add("tapDragZoom",u);let c=t.touchPitch=new hl(t);this._add("touchPitch",c),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let p=l(()=>t.project(t.getCenter()),"getCenter"),h=kC(e,p),m=RC(e),f=DC(e,p);t.dragRotate=new gl(e,h,m,f),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",m,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let d=LC(e),g=new Kh(e,t);t.dragPan=new yl(n,d,g),this._add("mousePan",d),this._add("touchPan",g,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let x=new pl,_=new cl;t.touchZoomRotate=new xl(n,_,x,u),this._add("touchRotate",x,["touchPan","touchZoom"]),this._add("touchZoom",_,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate);let b=t.scrollZoom=new fl(t,()=>this._triggerRenderFrame());this._add("scrollZoom",b,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let v=t.keyboard=new ml(t);this._add("keyboard",v),e.interactive&&e.keyboard&&t.keyboard.enable(),this._add("blockableMapEvent",new qh(t))}_add(e,t,n){this._handlers.push({handlerName:e,handler:t,allowed:n}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!tm(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,n){for(let i in e)if(i!==n&&(!t||t.indexOf(i)<0))return!0;return!1}_getMapTouches(e){let t=[];for(let n of e){let i=n.target;this._el.contains(i)&&t.push(n)}return t}mergeHandlerResult(e,t,n,i,o){if(!n)return;G(e,n);let a={handlerName:i,originalEvent:n.originalEvent||o};n.zoomDelta!==void 0&&(t.zoom=a),n.panDelta!==void 0&&(t.drag=a),n.rollDelta!==void 0&&(t.roll=a),n.pitchDelta!==void 0&&(t.pitch=a),n.bearingDelta!==void 0&&(t.rotate=a)}_applyChanges(){let e={},t={},n={};for(let[i,o,a]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new OC.default(0,0))._add(i.panDelta)),i.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+i.pitchDelta),i.rollDelta&&(e.rollDelta=(e.rollDelta||0)+i.rollDelta),i.around!==void 0&&(e.around=i.around),i.pinchAround!==void 0&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),G(t,o),G(n,a);this._updateMapTransform(e,t,n),this._changes=[]}_updateMapTransform(e,t,n){let i=this._map,o=i._getTransformForUpdate(),a=i.terrain;if(!rv(e)&&!(a&&this._terrainMovement))return this._fireEvents(t,n,!0);i._stop(!0);let{panDelta:s,zoomDelta:u,bearingDelta:c,pitchDelta:p,rollDelta:h,around:m,pinchAround:f}=e;f!==void 0&&(m=f),m=m||i.transform.centerPoint,a&&!o.isPointOnMapSurface(m)&&(m=o.centerPoint);let d={panDelta:s,zoomDelta:u,rollDelta:h,pitchDelta:p,bearingDelta:c,around:m};this._map.cameraHelper.useGlobeControls&&!o.isPointOnMapSurface(m)&&(m=o.centerPoint);let g=m.distSqr(o.centerPoint)<.01?o.center:o.screenPointToLocation(s?m.sub(s):m);a?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,o),!this._terrainMovement&&(t.drag||t.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(d,o,g)):t.drag&&this._terrainMovement?o.setCenter(o.screenPointToLocation(o.centerPoint.sub(s))):this._map.cameraHelper.handleMapControlsPan(d,o,g)):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,o),this._map.cameraHelper.handleMapControlsPan(d,o,g)),i._applyUpdatedTransform(o),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,n,!0)}_fireEvents(e,t,n){let i=tm(this._eventsInProgress),o=tm(e),a={};for(let h in e){let{originalEvent:m}=e[h];this._eventsInProgress[h]||(a["".concat(h,"start")]=m),this._eventsInProgress[h]=e[h]}!i&&o&&this._fireEvent("movestart",o.originalEvent);for(let h in a)this._fireEvent(h,a[h]);o&&this._fireEvent("move",o.originalEvent);for(let h in e){let{originalEvent:m}=e[h];this._fireEvent(h,m)}let s={},u;for(let h in this._eventsInProgress){let{handlerName:m,originalEvent:f}=this._eventsInProgress[h];this._handlersById[m].isActive()||(delete this._eventsInProgress[h],u=t[m]||f,s["".concat(h,"end")]=u)}for(let h in s)this._fireEvent(h,s[h]);let c=tm(this._eventsInProgress),p=(i||o)&&!c;if(p&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let h=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&h.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(h)}if(n&&p){this._updatingCamera=!0;let h=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),m=l(f=>f!==0&&-this._bearingSnap<f&&f<this._bearingSnap,"shouldSnapToNorth");h&&(h.essential||!ne.prefersReducedMotion)?(m(h.bearing||this._map.getBearing())&&(h.bearing=0),h.freezeElevation=!0,this._map.easeTo(h,{originalEvent:u})):(this._map.fire(new B("moveend",{originalEvent:u})),m(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new B(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new nv("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}};l(ov,"HandlerManager");var rm=ov;y();var Vo=oe(ue(),1);var av=class av extends be{constructor(t,n,i){super();this._renderFrameCallback=l(()=>{let t=Math.min((ne.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},"_renderFrameCallback");this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this.cameraHelper=n,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(t,n){t.apply(this.transform),this.transform=t,this.cameraHelper=n}getCenter(){return new X(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,n){return this.jumpTo({elevation:t},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,n,i){return t=Vo.default.convert(t).mult(-1),this.panTo(this.transform.center,G({offset:t},n),i)}panTo(t,n,i){return this.easeTo(G({center:t},n),i)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,i){return this.easeTo(G({zoom:t},n),i)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,n){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new B("movestart",n)).fire(new B("move",n)).fire(new B("moveend",n))),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,i){return this.easeTo(G({bearing:t},n),i)}resetNorth(t,n){return this.rotateTo(0,G({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(G({bearing:0,pitch:0,roll:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}getRoll(){return this.transform.roll}setRoll(t,n){return this.jumpTo({roll:t},n),this}cameraForBounds(t,n){t=ot.convert(t).adjustAntiMeridian();let i=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,n)}_cameraForBoxAndBearing(t,n,i,o){let a={top:0,bottom:0,right:0,left:0};if(o=G({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},o),typeof o.padding=="number"){let p=o.padding;o.padding={top:p,bottom:p,right:p,left:p}}let s=G(a,o.padding);o.padding=s;let u=this.transform,c=new ot(t,n);return this.cameraHelper.cameraForBoxAndBearing(o,s,c,i,u)}fitBounds(t,n,i){return this._fitInternal(this.cameraForBounds(t,n),n,i)}fitScreenCoordinates(t,n,i,o,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(Vo.default.convert(t)),this.transform.screenPointToLocation(Vo.default.convert(n)),i,o),o,a)}_fitInternal(t,n,i){return t?(n=G(t,n),delete n.padding,n.linear?this.easeTo(n,i):this.flyTo(n,i)):this}jumpTo(t,n){this.stop();let i=this._getTransformForUpdate(),o=!1,a=!1,s=!1,u=i.zoom;this.cameraHelper.handleJumpToCenterZoom(i,t);let c=i.zoom!==u;return"elevation"in t&&i.elevation!==+t.elevation&&i.setElevation(+t.elevation),"bearing"in t&&i.bearing!==+t.bearing&&(o=!0,i.setBearing(+t.bearing)),"pitch"in t&&i.pitch!==+t.pitch&&(a=!0,i.setPitch(+t.pitch)),"roll"in t&&i.roll!==+t.roll&&(s=!0,i.setRoll(+t.roll)),t.padding!=null&&!i.isPaddingEqual(t.padding)&&i.setPadding(t.padding),this._applyUpdatedTransform(i),this.fire(new B("movestart",n)).fire(new B("move",n)),c&&this.fire(new B("zoomstart",n)).fire(new B("zoom",n)).fire(new B("zoomend",n)),o&&this.fire(new B("rotatestart",n)).fire(new B("rotate",n)).fire(new B("rotateend",n)),a&&this.fire(new B("pitchstart",n)).fire(new B("pitch",n)).fire(new B("pitchend",n)),s&&this.fire(new B("rollstart",n)).fire(new B("roll",n)).fire(new B("rollend",n)),this.fire(new B("moveend",n))}calculateCameraOptionsFromTo(t,n,i,o=0){let a=de.fromLngLat(t,n),s=de.fromLngLat(i,o),u=s.x-a.x,c=s.y-a.y,p=s.z-a.z,h=Math.hypot(u,c,p);if(h===0)throw new Error("Can't calculate camera options with same From and To");let m=Math.hypot(u,c),f=Ze(this.transform.cameraToCenterDistance/h/this.transform.tileSize),d=Math.atan2(u,-c)*180/Math.PI,g=Math.acos(m/h)*180/Math.PI;return g=p<0?90-g:90+g,{center:s.toLngLat(),elevation:o,zoom:f,pitch:g,bearing:d}}calculateCameraOptionsFromCameraLngLatAltRotation(t,n,i,o,a){let s=this.transform.calculateCenterFromCameraLngLatAlt(t,n,i,o);return{center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:i,pitch:o,roll:a}}easeTo(t,n){this._stop(!1,t.easeId),t=G({offset:[0,0],duration:500,easing:Xo},t),(t.animate===!1||!t.essential&&ne.prefersReducedMotion)&&(t.duration=0);let i=this._getTransformForUpdate(),o=this.getBearing(),a=i.pitch,s=i.roll,u="bearing"in t?this._normalizeBearing(t.bearing,o):o,c="pitch"in t?+t.pitch:a,p="roll"in t?this._normalizeBearing(t.roll,s):s,h="padding"in t?t.padding:i.padding,m=Vo.default.convert(t.offset),f,d;t.around&&(f=X.convert(t.around),d=i.locationToScreenPoint(f));let g={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},x=this.cameraHelper.handleEaseTo(i,{bearing:u,pitch:c,roll:p,padding:h,around:f,aroundPoint:d,offsetAsPoint:m,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||o!==u,this._pitching=this._pitching||c!==a,this._rolling=this._rolling||p!==s,this._padding=!i.isPaddingEqual(h),this._zooming=this._zooming||x.isZooming,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,g),this.terrain&&this._prepareElevation(x.elevationCenter),this._ease(_=>{x.easeFunc(_),this.terrain&&!t.freezeElevation&&this._updateElevation(_),this._applyUpdatedTransform(i),this._fireMoveEvents(n)},_=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,_)},t),this}_prepareEase(t,n,i={}){this._moving=!0,!n&&!i.moving&&this.fire(new B("movestart",t)),this._zooming&&!i.zooming&&this.fire(new B("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new B("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new B("pitchstart",t)),this._rolling&&!i.rolling&&this.fire(new B("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,o=(n-(i*t+this._elevationStart))/(1-t);this._elevationStart+=t*(i-o),this._elevationTarget=n}this.transform.setElevation(Ae.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(t){return{}}_applyUpdatedTransform(t){let n=[];if(n.push(o=>this._elevateCameraIfInsideTerrain(o)),this.transformCameraUpdate&&n.push(o=>this.transformCameraUpdate(o)),!n.length)return;let i=t.clone();for(let o of n){let a=i.clone(),{center:s,zoom:u,roll:c,pitch:p,bearing:h,elevation:m}=o(a);s&&a.setCenter(s),m!==void 0&&a.setElevation(m),u!==void 0&&a.setZoom(u),c!==void 0&&a.setRoll(c),p!==void 0&&a.setPitch(p),h!==void 0&&a.setBearing(h),i.apply(a)}this.transform.apply(i)}_fireMoveEvents(t){this.fire(new B("move",t)),this._zooming&&this.fire(new B("zoom",t)),this._rotating&&this.fire(new B("rotate",t)),this._pitching&&this.fire(new B("pitch",t)),this._rolling&&this.fire(new B("roll",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;let i=this._zooming,o=this._rotating,a=this._pitching,s=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new B("zoomend",t)),o&&this.fire(new B("rotateend",t)),a&&this.fire(new B("pitchend",t)),s&&this.fire(new B("rollend",t)),this.fire(new B("moveend",t))}flyTo(t,n){if(!t.essential&&ne.prefersReducedMotion){let C=Sr(t,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(C,n)}this.stop(),t=G({offset:[0,0],speed:1.2,curve:1.42,easing:Xo},t);let i=this._getTransformForUpdate(),o=i.bearing,a=i.pitch,s=i.roll,u=i.padding,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,p="pitch"in t?+t.pitch:a,h="roll"in t?this._normalizeBearing(t.roll,s):s,m="padding"in t?t.padding:i.padding,f=Vo.default.convert(t.offset),d=i.centerPoint.add(f),g=i.screenPointToLocation(d),x=this.cameraHelper.handleFlyTo(i,{bearing:c,pitch:p,roll:h,padding:m,locationAtOffset:g,offsetAsPoint:f,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),_=t.curve,b=Math.max(i.width,i.height),v=b/x.scaleOfZoom,w=x.pixelPathLength;if(typeof x.scaleOfMinZoom=="number"){let C=b/x.scaleOfMinZoom;_=Math.sqrt(C/w*2)}let T=_*_;function S(C){let k=(v*v-b*b+(C?-1:1)*T*T*w*w)/(2*(C?v:b)*T*w);return Math.log(Math.sqrt(k*k+1)-k)}l(S,"zoomOutFactor");function A(C){return(Math.exp(C)-Math.exp(-C))/2}l(A,"sinh");function M(C){return(Math.exp(C)+Math.exp(-C))/2}l(M,"cosh");function I(C){return A(C)/M(C)}l(I,"tanh");let L=S(!1),D=l(function(C){return M(L)/M(L+_*C)},"w"),F=l(function(C){return b*((M(L)*I(L+_*C)-A(L))/T)/w},"u"),U=(S(!0)-L)/_;if(Math.abs(w)<2e-6||!isFinite(U)){if(Math.abs(b-v)<1e-6)return this.easeTo(t,n);let C=v<b?-1:1;U=Math.abs(Math.log(v/b))/_,F=l(()=>0,"u"),D=l(k=>Math.exp(C*_*k),"w")}if("duration"in t)t.duration=+t.duration;else{let C="screenSpeed"in t?+t.screenSpeed/_:+t.speed;t.duration=1e3*U/C}return t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=o!==c,this._pitching=p!==a,this._rolling=h!==s,this._padding=!i.isPaddingEqual(m),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(x.targetCenter),this._ease(C=>{let k=C*U,H=1/D(k),$=F(k);this._rotating&&i.setBearing(Ae.number(o,c,C)),this._pitching&&i.setPitch(Ae.number(a,p,C)),this._rolling&&i.setRoll(Ae.number(s,h,C)),this._padding&&(i.interpolatePadding(u,m,C),d=i.centerPoint.add(f)),x.easeFunc(C,H,$,d),this.terrain&&!t.freezeElevation&&this._updateElevation(C),this._applyUpdatedTransform(i),this._fireMoveEvents(n)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let o=this._onEaseEnd;delete this._onEaseEnd,o.call(this,n)}return t||(i=this.handlers)==null||i.stop(!1),this}_ease(t,n,i){i.animate===!1||i.duration===0?(t(1),n()):(this._easeStart=ne.now(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=Qt(t,-180,180);let i=Math.abs(t-n);return Math.abs(t-360-n)<i&&(t-=360),Math.abs(t+360-n)<i&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(X.convert(t),this.transform.tileZoom):null}};l(av,"Camera");var nm=av;var nn=oe(ue(),1);y();var sv={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},lv=class lv{constructor(e=sv){this._toggleAttribution=l(()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},"_toggleAttribution");this._updateData=l(e=>{e&&(e.sourceDataType==="metadata"||e.sourceDataType==="visibility"||e.dataType==="style"||e.type==="terrain")&&this._updateAttributions()},"_updateData");this._updateCompact=l(()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},"_updateCompact");this._updateCompactMinimize=l(()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},"_updateCompactMinimize");this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=O.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=O.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=O.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){O.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let n=this._map._getUIString("AttributionControl.".concat(t));e.title=n,e.setAttribute("aria-label",n)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(i=>typeof i!="string"?"":i)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let t=this._map.style.sourceCaches;for(let i in t){let o=t[i];if(o.used||o.usedForTerrain){let a=o.getSource();a.attribution&&e.indexOf(a.attribution)<0&&e.push(a.attribution)}}e=e.filter(i=>String(i).trim()),e.sort((i,o)=>i.length-o.length),e=e.filter((i,o)=>{for(let a=o+1;a<e.length;a++)if(e[a].indexOf(i)>=0)return!1;return!0});let n=e.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,e.length?(this._innerContainer.innerHTML=O.sanitize(n),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}};l(lv,"AttributionControl");var bl=lv;y();var uv=class uv{constructor(e={}){this._updateCompact=l(()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},"_updateCompact");this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=O.create("div","maplibregl-ctrl");let t=O.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){O.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};l(uv,"LogoControl");var vl=uv;y();var cv=class cv{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,n=t?this._queue.concat(t):this._queue;for(let i of n)if(i.id===e){i.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];for(let n of t)if(!n.cancelled&&(n.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};l(cv,"TaskQueue");var im=cv;y();var am=(n=>(n.create="create",n.load="load",n.fullLoad="fullLoad",n))(am||{}),om=null,wl=[],O3=60,pv=1e3/O3,hv="loadTime",mv="fullLoadTime",Uo={mark(r){performance.mark(r)},frame(r){let e=r;if(om!=null){let t=e-om;wl.push(t)}om=e},clearMetrics(){om=null,wl=[],performance.clearMeasures(hv),performance.clearMeasures(mv);for(let r in am)performance.clearMarks(am[r])},getPerformanceMetrics(){performance.measure(hv,"create","load"),performance.measure(mv,"create","fullLoad");let r=performance.getEntriesByName(hv)[0].duration,e=performance.getEntriesByName(mv)[0].duration,t=wl.length,i=1/(wl.reduce((s,u)=>s+u,0)/t/1e3),o=wl.filter(s=>s>pv).reduce((s,u)=>s+(u-pv)/pv,0),a=o/(t+o)*100;return{loadTime:r,fullLoadTime:e,fps:i,percentDroppedFrames:a,totalFrames:t}}};y();y();var VC=Ee([{name:"a_pos3d",type:"Int16",components:3}]);y();var fv=class fv extends be{constructor(t){super();this._lastTilesetChange=ne.now();this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];let i={};for(let o of Bn(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))i[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.terrainRttPosMatrix32f=new Float64Array(16),z.ortho(o.terrainRttPosMatrix32f,0,8192,8192,0,0,1),this._tiles[o.key]=new Mo(o,this.tileSize),this._lastTilesetChange=ne.now());for(let o in this._tiles)i[o]||delete this._tiles[o]}freeRtt(t){for(let n in this._tiles){let i=this._tiles[n];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,n){return n?this._getTerrainCoordsForTileRanges(t,n):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let n={};for(let i of this._renderableTilesKeys){let o=this._tiles[i].tileID,a=t.clone(),s=pr();if(o.canonical.equals(t.canonical))z.ortho(s,0,8192,8192,0,0,1);else if(o.canonical.isChildOf(t.canonical)){let u=o.canonical.z-t.canonical.z,c=o.canonical.x-(o.canonical.x>>u<<u),p=o.canonical.y-(o.canonical.y>>u<<u),h=8192>>u;z.ortho(s,0,h,h,0,0,1),z.translate(s,s,[-c*h,-p*h,0])}else if(t.canonical.isChildOf(o.canonical)){let u=t.canonical.z-o.canonical.z,c=t.canonical.x-(t.canonical.x>>u<<u),p=t.canonical.y-(t.canonical.y>>u<<u),h=8192>>u;z.ortho(s,0,8192,8192,0,0,1),z.translate(s,s,[c*h,p*h,0]),z.scale(s,s,[1/2**u,1/2**u,0])}else continue;a.terrainRttPosMatrix32f=new Float32Array(s),n[i]=a}return n}_getTerrainCoordsForTileRanges(t,n){let i={};for(let o of this._renderableTilesKeys){let a=this._tiles[o].tileID;if(!this._isWithinTileRanges(a,n))continue;let s=t.clone(),u=pr();if(a.canonical.z===t.canonical.z){let c=t.canonical.x-a.canonical.x,p=t.canonical.y-a.canonical.y;z.ortho(u,0,8192,8192,0,0,1),z.translate(u,u,[c*8192,p*8192,0])}else if(a.canonical.z>t.canonical.z){let c=a.canonical.z-t.canonical.z,p=a.canonical.x-(a.canonical.x>>c<<c),h=a.canonical.y-(a.canonical.y>>c<<c),m=t.canonical.x-(a.canonical.x>>c),f=t.canonical.y-(a.canonical.y>>c),d=8192>>c;z.ortho(u,0,d,d,0,0,1),z.translate(u,u,[-p*d+m*8192,-h*d+f*8192,0])}else{let c=t.canonical.z-a.canonical.z,p=t.canonical.x-(t.canonical.x>>c<<c),h=t.canonical.y-(t.canonical.y>>c<<c),m=(t.canonical.x>>c)-a.canonical.x,f=(t.canonical.y>>c)-a.canonical.y,d=8192<<c;z.ortho(u,0,d,d,0,0,1),z.translate(u,u,[p*8192+m*d,h*8192+f*d,0])}s.terrainRttPosMatrix32f=new Float32Array(u),i[o]=s}return i}getSourceTile(t,n){let i=this.sourceCache._source,o=t.overscaledZ-this.deltaZoom;if(o>i.maxzoom&&(o=i.maxzoom),o<i.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(o).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if(!(a&&a.dem)&&n)for(;o>=i.minzoom&&!(a&&a.dem);)a=this.sourceCache.getTileByID(t.scaledTo(o--).key);return a}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,n){return n[t.canonical.z]&&t.canonical.x>=n[t.canonical.z].minTileX&&t.canonical.x<=n[t.canonical.z].maxTileX&&t.canonical.y>=n[t.canonical.z].minTileY&&t.canonical.y<=n[t.canonical.z].maxTileY}};l(fv,"TerrainSourceCache");var sm=fv;var dv=class dv{constructor(e,t,n){this._meshCache={};this.painter=e,this.sourceCache=new sm(t),this.options=n,this.exaggeration=typeof n.exaggeration=="number"?n.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,t,n,i=8192){var f;if(!(t>=0&&t<i&&n>=0&&n<i))return 0;let o=this.getTerrainData(e),a=(f=o.tile)==null?void 0:f.dem;if(!a)return 0;let s=lt.transformMat4([],[t/i*8192,n/i*8192],o.u_terrain_matrix),u=[s[0]*a.dim,s[1]*a.dim],c=Math.floor(u[0]),p=Math.floor(u[1]),h=u[0]-c,m=u[1]-p;return a.get(c,p)*(1-h)*(1-m)+a.get(c+1,p)*h*(1-m)+a.get(c,p+1)*(1-h)*m+a.get(c+1,p+1)*h*m}getElevationForLngLatZoom(e,t){if(!zT(t,e.wrap()))return 0;let{tileID:n,mercatorX:i,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(n,i%8192,o%8192,8192)}getElevation(e,t,n,i=8192){return this.getDEMElevation(e,t,n,i)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let i=this.painter.context,o=new Se({width:1,height:1},new Uint8Array(1*4));this._emptyDepthTexture=new we(i,o,i.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new we(i,new Se({width:1,height:1}),i.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=z.identity([])}let t=this.sourceCache.getSourceTile(e,!0);if(t&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let i=this.painter.context;t.demTexture=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new we(i,t.dem.getPixels(),i.gl.RGBA,{premultiply:!1}),t.demTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let n=t&&t+t.tileID.key+e.key;if(n&&!this._demMatrixCache[n]){let i=this.sourceCache.sourceCache._source.maxzoom,o=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=i?o=e.canonical.z-i:ce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=e.canonical.x-(e.canonical.x>>o<<o),s=e.canonical.y-(e.canonical.y>>o<<o),u=z.fromScaling(new Float64Array(16),[1/(8192<<o),1/(8192<<o),0]);z.translate(u,u,[a*8192,s*8192,0]),this._demMatrixCache[e.key]={matrix:u,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:t&&t.dem&&t.dem.dim||1,u_terrain_matrix:n?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:t&&t.dem&&t.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t&&t.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(e){let t=this.painter,n=t.width/devicePixelRatio,i=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==n||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new we(t.context,{width:n,height:i,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new we(t.context,{width:n,height:i,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(n,i,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,i))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let t=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let o=0,a=0;o<this._coordsTextureSize;o++)for(let s=0;s<this._coordsTextureSize;s++,a+=4)t[a+0]=s&255,t[a+1]=o&255,t[a+2]=s>>8<<4|o>>8,t[a+3]=0;let n=new Se({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(t.buffer)),i=new we(e,n,e.gl.RGBA,{premultiply:!1});return i.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=i,i}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let t=new Uint8Array(4),n=this.painter.context,i=n.gl,o=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);n.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(o,s-a-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),n.bindFramebuffer.set(null);let u=t[0]+(t[2]>>4<<8),c=t[1]+((t[2]&15)<<8),p=this.coordsIndex[255-t[3]],h=p&&this.sourceCache.getTileByID(p);if(!h)return null;let m=this._coordsTextureSize,f=(1<<h.tileID.canonical.z)*m;return new de((h.tileID.canonical.x*m+u)/f+h.tileID.wrap,(h.tileID.canonical.y*m+c)/f,this.getElevation(h.tileID,u,c,m))}depthAtPoint(e){let t=new Uint8Array(4),n=this.painter.context,i=n.gl;return n.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),i.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),n.bindFramebuffer.set(null),(t[0]/(256*256*256)+t[1]/(256*256)+t[2]/256+t[3])/256}getTerrainMesh(e){var A;let t=((A=this.painter.style.projection)==null?void 0:A.transitionState)>0,n=t&&e.canonical.y===0,i=t&&e.canonical.y===(1<<e.canonical.z)-1,o="m_".concat(n?"n":"","_").concat(i?"s":"");if(this._meshCache[o])return this._meshCache[o];let a=this.painter.context,s=new rc,u=new Ne,c=this.meshSize,p=8192/c,h=c*c;for(let M=0;M<=c;M++)for(let I=0;I<=c;I++)s.emplaceBack(I*p,M*p,0);for(let M=0;M<h;M+=c+1)for(let I=0;I<c;I++)u.emplaceBack(I+M,c+I+M+1,c+I+M+2),u.emplaceBack(I+M,c+I+M+2,I+M+1);let m=s.length,f=0,d=m+(c+1),g=(c+1)*c,x=n?Dr:0,_=n?0:1,b=i?Xr:8192,v=i?0:1;for(let M=0;M<=c;M++)s.emplaceBack(M*p,x,_);for(let M=0;M<=c;M++)s.emplaceBack(M*p,b,v);for(let M=0;M<c;M++)u.emplaceBack(g+M,d+M,d+M+1),u.emplaceBack(g+M,d+M+1,g+M+1),u.emplaceBack(f+M,m+M+1,m+M),u.emplaceBack(f+M,f+M+1,m+M+1);let w=s.length,T=w+(c+1)*2;for(let M of[0,1])for(let I=0;I<=c;I++)for(let L of[0,1])s.emplaceBack(M*8192,I*p,L);for(let M=0;M<c*2;M+=2)u.emplaceBack(w+M,w+M+1,w+M+3),u.emplaceBack(w+M,w+M+3,w+M+2),u.emplaceBack(T+M,T+M+3,T+M+1),u.emplaceBack(T+M,T+M+2,T+M+3);let S=new Bt(a.createVertexBuffer(s,VC.members),a.createIndexBuffer(u),he.simpleSegment(0,0,s.length,u.length));return this._meshCache[o]=S,S}getMeshFrameDelta(e){return 2*Math.PI*Ft/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,t){var i;let{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(e,t);return(i=this.getMinMaxElevation(n).minElevation)!=null?i:0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,n={minElevation:null,maxElevation:null};return t&&t.dem&&(n.minElevation=t.dem.min*this.exaggeration,n.maxElevation=t.dem.max*this.exaggeration),n}_getOverscaledTileIDFromLngLatZoom(e,t){let n=de.fromLngLat(e.wrap()),i=(1<<t)*8192,o=n.x*i,a=n.y*i,s=Math.floor(o/8192),u=Math.floor(a/8192);return{tileID:new Oe(t,0,t,s,u),mercatorX:o,mercatorY:a}}};l(dv,"Terrain");var lm=dv;y();y();var yv=class yv{constructor(e,t,n){this._context=e;this._size=t;this._tileSize=n;this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let t=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),n=new we(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return n.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),t.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),t.colorAttachment.set(n.texture),{id:e,fbo:t,texture:n,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(t=>e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return this._objects.length<this._size?!1:this._objects.some(e=>!e.inUse)===!1}};l(yv,"RenderPool");var um=yv;var jo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},gv=class gv{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new um(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(n=>!e._layers[n].isHidden(t)),this._coordsAscending={};for(let n in e.sourceCaches){this._coordsAscending[n]={};let i=e.sourceCaches[n].getVisibleCoordinates(),o=e.sourceCaches[n].getSource(),a=o instanceof Ht?o.terrainTileRanges:null;for(let s of i){let u=this.terrain.sourceCache.getTerrainCoords(s,a);for(let c in u)this._coordsAscending[n][c]||(this._coordsAscending[n][c]=[]),this._coordsAscending[n][c].push(u[c])}}this._coordsAscendingStr={};for(let n of e._order){let i=e._layers[n],o=i.source;if(jo[i.type]&&!this._coordsAscendingStr[o]){this._coordsAscendingStr[o]={};for(let a in this._coordsAscending[o])this._coordsAscendingStr[o][a]=this._coordsAscending[o][a].map(s=>s.key).sort().join()}}for(let n of this._renderableTiles)for(let i in this._coordsAscendingStr){let o=this._coordsAscendingStr[i][n.tileID.key];o&&o!==n.rttCoords[i]&&(n.rtt=[])}}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let n=St($e({},t),{isRenderingToTexture:!0}),i=e.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(jo[i]&&((!this._prevType||!jo[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(jo[this._prevType]||jo[i]&&a){this._prevType=i;let s=this._stacks.length-1,u=this._stacks[s]||[];for(let c of this._renderableTiles){if(this.pool.isFull()&&(xb(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(c),c.rtt[s]){let h=this.pool.getObjectForId(c.rtt[s].id);if(h.stamp===c.rtt[s].stamp){this.pool.useObject(h);continue}}let p=this.pool.getOrCreateFreeObject();this.pool.useObject(p),this.pool.stampObject(p),c.rtt[s]={id:p.id,stamp:p.stamp},o.context.bindFramebuffer.set(p.fbo.framebuffer),o.context.clear({color:Y.transparent,stencil:0}),o.currentStencilSource=void 0;for(let h=0;h<u.length;h++){let m=o.style._layers[u[h]],f=m.source?this._coordsAscending[m.source][c.tileID.key]:[c.tileID];o.context.viewport.set([0,0,p.fbo.width,p.fbo.height]),o._renderTileClippingMasks(m,f,!0),o.renderLayer(o,o.style.sourceCaches[m.source],m,f,n),m.source&&(c.rttCoords[m.source]=this._coordsAscendingStr[m.source][c.tileID.key])}}return xb(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],this.pool.freeAllObjects(),jo[i]}return!1}};l(gv,"RenderToTexture");var cm=gv;y();var UC={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"};var V3=Il.version,hm=-2,NC=22,Gn=0,GC=60,pm=180,jC={hash:!1,interactive:!0,bearingSnap:7,attributionControl:sv,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:hm,maxZoom:NC,minPitch:Gn,maxPitch:GC,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:ut.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},_v=class _v extends nm{constructor(t){var u,c;Uo.mark("create");let n=St($e($e({},jC),t),{canvasContextAttributes:$e($e({},jC.canvasContextAttributes),t.canvasContextAttributes)});if(n.minZoom!=null&&n.maxZoom!=null&&n.minZoom>n.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(n.minPitch!=null&&n.maxPitch!=null&&n.minPitch>n.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(n.minPitch!=null&&n.minPitch<Gn)throw new Error("minPitch must be greater than or equal to ".concat(Gn));if(n.maxPitch!=null&&n.maxPitch>pm)throw new Error("maxPitch must be less than or equal to ".concat(pm));let i=new en,o=new tn;n.minZoom!==void 0&&i.setMinZoom(n.minZoom),n.maxZoom!==void 0&&i.setMaxZoom(n.maxZoom),n.minPitch!==void 0&&i.setMinPitch(n.minPitch),n.maxPitch!==void 0&&i.setMaxPitch(n.maxPitch),n.renderWorldCopies!==void 0&&i.setRenderWorldCopies(n.renderWorldCopies);super(i,o,{bearingSnap:n.bearingSnap});this._idleTriggered=!1;this._crossFadingFactor=1;this._renderTaskQueue=new im;this._controls=[];this._mapId=Ul();this._contextLost=l(t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new B("webglcontextlost",{originalEvent:t}))},"_contextLost");this._contextRestored=l(t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new B("webglcontextrestored",{originalEvent:t}))},"_contextRestored");this._onMapScroll=l(t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},"_onMapScroll");this._onWindowOnline=l(()=>{this._update()},"_onWindowOnline");if(this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=$e({},n.canvasContextAttributes),this._trackResize=n.trackResize===!0,this._bearingSnap=n.bearingSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=n.refreshExpiredTiles===!0,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=n.crossSourceCollisions===!0,this._collectResourceTiming=n.collectResourceTiming===!0,this._locale=$e($e({},UC),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this.transformCameraUpdate=n.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=n.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Pt.addThrottleControl(()=>this.isMoving()),this._requestManager=new $l(n.transformRequest),typeof n.container=="string"){if(this._container=document.getElementById(n.container),!this._container)throw new Error("Container '".concat(n.container,"' not found."))}else if(n.container instanceof HTMLElement)this._container=n.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(n.maxBounds&&this.setMaxBounds(n.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let p=!1,h=Nh(m=>{this._trackResize&&!this._removed&&(this.resize(m),this.redraw())},50);this._resizeObserver=new ResizeObserver(m=>{if(!p){p=!0;return}h(m)}),this._resizeObserver.observe(this._container)}this.handlers=new rm(this,n);let a=typeof n.hash=="string"&&n.hash||void 0;this._hash=n.hash&&new rl(a).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,G({},n.fitBoundsOptions,{duration:0}))));let s=typeof n.style=="string"||((c=(u=n.style)==null?void 0:u.projection)==null?void 0:c.type)!=="globe";this.resize(null,s),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new bl(typeof n.attributionControl=="boolean"?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new vl,n.logoPosition),this.on("style.load",()=>{if(s||this._resizeTransform(),this.transform.unmodified){let p=Sr(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(p)}}),this.on("data",p=>{this._update(p.dataType==="style"),this.fire(new B("".concat(p.dataType,"data"),p))}),this.on("dataloading",p=>{this.fire(new B("".concat(p.dataType,"dataloading"),p))}),this.on("dataabort",p=>{this.fire(new B("sourcedataabort",p))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,n){return this.style.setGlobalStateProperty(t,n),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,n){if(n===void 0&&(t.getDefaultPosition?n=t.getDefaultPosition():n="top-right"),!t||!t.onAdd)return this.fire(new J(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=t.onAdd(this);this._controls.push(t);let o=this._controlPositions[n];return n.indexOf("bottom")!==-1?o.insertBefore(i,o.firstChild):o.appendChild(i),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new J(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let n=this._controls.indexOf(t);return n>-1&&this._controls.splice(n,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,n,i,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,n,i,o)}resize(t,n=!0){let[i,o]=this._containerDimensions(),a=this._getClampedPixelRatio(i,o);if(this._resizeCanvas(i,o,a),this.painter.resize(i,o,a),this.painter.overLimit()){let u=this.painter.context.gl;this._maxCanvasSize=[u.drawingBufferWidth,u.drawingBufferHeight];let c=this._getClampedPixelRatio(i,o);this._resizeCanvas(i,o,c),this.painter.resize(i,o,c)}this._resizeTransform(n);let s=!this._moving;return s&&(this.stop(),this.fire(new B("movestart",t)).fire(new B("move",t))),this.fire(new B("resize",t)),s&&this.fire(new B("moveend",t)),this}_resizeTransform(t=!0){var o;let[n,i]=this._containerDimensions();this.transform.resize(n,i,t),(o=this._requestedCameraState)==null||o.resize(n,i,t)}_getClampedPixelRatio(t,n){let{0:i,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),s=t*a,u=n*a,c=s>i?i/s:1,p=u>o?o/u:1;return Math.min(c,p)*a}getPixelRatio(){var t;return(t=this._overridePixelRatio)!=null?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(ot.convert(t)),this._update()}setMinZoom(t){if(t=t==null?hm:t,t>=hm&&t<=this.transform.maxZoom)return this.transform.setMinZoom(t),this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between ".concat(hm," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if(t=t==null?NC:t,t>=this.transform.minZoom)return this.transform.setMaxZoom(t),this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if(t=t==null?Gn:t,t<Gn)throw new Error("minPitch must be greater than or equal to ".concat(Gn));if(t>=Gn&&t<=this.transform.maxPitch)return this.transform.setMinPitch(t),this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between ".concat(Gn," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if(t=t==null?GC:t,t>pm)throw new Error("maxPitch must be less than or equal to ".concat(pm));if(t>=this.transform.minPitch)return this.transform.setMaxPitch(t),this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.setRenderWorldCopies(t),this._update()}project(t){return this.transform.locationToScreenPoint(X.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.screenPointToLocation(nn.default.convert(t),this.terrain)}isMoving(){var t;return this._moving||((t=this.handlers)==null?void 0:t.isMoving())}isZooming(){var t;return this._zooming||((t=this.handlers)==null?void 0:t.isZooming())}isRotating(){var t;return this._rotating||((t=this.handlers)==null?void 0:t.isRotating())}_createDelegatedListener(t,n,i){if(t==="mouseenter"||t==="mouseover"){let o=!1;return{layers:n,listener:i,delegates:{mousemove:l(u=>{let c=n.filter(h=>this.getLayer(h)),p=c.length!==0?this.queryRenderedFeatures(u.point,{layers:c}):[];p.length?o||(o=!0,i.call(this,new ft(t,this,u.originalEvent,{features:p}))):o=!1},"mousemove"),mouseout:l(()=>{o=!1},"mouseout")}}}else if(t==="mouseleave"||t==="mouseout"){let o=!1;return{layers:n,listener:i,delegates:{mousemove:l(u=>{let c=n.filter(h=>this.getLayer(h));(c.length!==0?this.queryRenderedFeatures(u.point,{layers:c}):[]).length?o=!0:o&&(o=!1,i.call(this,new ft(t,this,u.originalEvent)))},"mousemove"),mouseout:l(u=>{o&&(o=!1,i.call(this,new ft(t,this,u.originalEvent)))},"mouseout")}}}else{let o=l(a=>{let s=n.filter(c=>this.getLayer(c)),u=s.length!==0?this.queryRenderedFeatures(a.point,{layers:s}):[];u.length&&(a.features=u,i.call(this,a),delete a.features)},"delegate");return{layers:n,listener:i,delegates:{[t]:o}}}}_saveDelegatedListener(t,n){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(n)}_removeDelegatedListener(t,n,i){if(!this._delegatedListeners||!this._delegatedListeners[t])return;let o=this._delegatedListeners[t];for(let a=0;a<o.length;a++){let s=o[a];if(s.listener===i&&s.layers.length===n.length&&s.layers.every(u=>n.includes(u))){for(let u in s.delegates)this.off(u,s.delegates[u]);o.splice(a,1);return}}}on(t,n,i){if(i===void 0)return super.on(t,n);let o=typeof n=="string"?[n]:n,a=this._createDelegatedListener(t,o,i);this._saveDelegatedListener(t,a);for(let s in a.delegates)this.on(s,a.delegates[s]);return{unsubscribe:l(()=>{this._removeDelegatedListener(t,o,i)},"unsubscribe")}}once(t,n,i){if(i===void 0)return super.once(t,n);let o=typeof n=="string"?[n]:n,a=this._createDelegatedListener(t,o,i);for(let s in a.delegates){let u=a.delegates[s];a.delegates[s]=(...c)=>{this._removeDelegatedListener(t,o,i),u(...c)}}this._saveDelegatedListener(t,a);for(let s in a.delegates)this.once(s,a.delegates[s]);return this}off(t,n,i){if(i===void 0)return super.off(t,n);let o=typeof n=="string"?[n]:n;return this._removeDelegatedListener(t,o,i),this}queryRenderedFeatures(t,n){if(!this.style)return[];let i,o=t instanceof nn.default||Array.isArray(t),a=o?t:[[0,0],[this.transform.width,this.transform.height]];if(n=n||(o?{}:t)||{},a instanceof nn.default||typeof a[0]=="number")i=[nn.default.convert(a)];else{let s=nn.default.convert(a[0]),u=nn.default.convert(a[1]);i=[s,new nn.default(u.x,s.y),u,new nn.default(s.x,u.y),s]}return this.style.queryRenderedFeatures(i,n,this.transform)}querySourceFeatures(t,n){return this.style.querySourceFeatures(t,n)}setStyle(t,n){return n=G({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},n),n.diff!==!1&&n.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,n),this):(this._localIdeographFontFamily=n.localIdeographFontFamily,this._updateStyle(t,n))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let n=this._locale[t];if(n==null)throw new Error("Missing UI string '".concat(t,"'"));return n}_updateStyle(t,n){var o,a;if(n.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(t,n));return}let i=this.style&&n.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t)this.style=new Oo(this,n||{});else return(a=(o=this.style)==null?void 0:o.projection)==null||a.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof t=="string"?this.style.loadURL(t,n,i):this.style.loadJSON(t,n,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new Oo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,n){if(typeof t=="string"){let i=t,o=this._requestManager.transformRequest(i,"Style");cn(o,new AbortController).then(a=>{this._updateDiff(a.data,n)}).catch(a=>{a&&this.fire(new J(a))})}else typeof t=="object"&&this._updateDiff(t,n)}_updateDiff(t,n){try{this.style.setState(t,n)&&this._update(!0)}catch(i){ce("Unable to perform style diff: ".concat(i.message||i.error||i,". Rebuilding the style from scratch.")),this._updateStyle(t,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():ce("There is no style added to the map.")}addSource(t,n){return this._lazyInitEmptyStyle(),this.style.addSource(t,n),this._update(!0)}isSourceLoaded(t){let n=this.style&&this.style.sourceCaches[t];if(n===void 0){this.fire(new J(new Error("There is no source with ID '".concat(t,"'"))));return}return n.loaded()}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!t)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);else{let n=this.style.sourceCaches[t.source];if(!n)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(t.source));this.terrain===null&&n.reload();for(let i in this.style._layers){let o=this.style._layers[i];o.type==="hillshade"&&o.source===t.source&&ce("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),o.type==="color-relief"&&o.source===t.source&&ce("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new lm(this.painter,n,t),this.painter.renderToTexture=new cm(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var o;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId===t.source&&!this._elevationFreeze&&(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((o=i.source)==null?void 0:o.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new B("terrain",{terrain:t})),this}getTerrain(){var t,n;return(n=(t=this.terrain)==null?void 0:t.options)!=null?n:null}areTilesLoaded(){let t=this.style&&this.style.sourceCaches;for(let n in t){let o=t[n]._tiles;for(let a in o){let s=o[a];if(!(s.state==="loaded"||s.state==="errored"))return!1}}return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}setSourceTileLodParams(t,n,i){if(i){let o=this.getSource(i);if(!o)throw new Error('There is no source with ID "'.concat(i,'", cannot set LOD parameters'));o.calculateTileZoom=dp(Math.max(1,t),Math.max(1,n))}else for(let o in this.style.sourceCaches)this.style.sourceCaches[o].getSource().calculateTileZoom=dp(Math.max(1,t),Math.max(1,n));return this._update(!0),this}refreshTiles(t,n){let i=this.style.sourceCaches[t];if(!i)throw new Error('There is no source cache with ID "'.concat(t,'", cannot refresh tile'));n===void 0?i.reload(!0):i.refreshTiles(n.map(o=>new kn(o.z,o.x,o.y)))}addImage(t,n,i={}){let{pixelRatio:o=1,sdf:a=!1,stretchX:s,stretchY:u,content:c,textFitWidth:p,textFitHeight:h}=i;this._lazyInitEmptyStyle();let m=0;if(n instanceof HTMLImageElement||At(n)){let{width:f,height:d,data:g}=ne.getImageData(n);this.style.addImage(t,{data:new Se({width:f,height:d},g),pixelRatio:o,stretchX:s,stretchY:u,content:c,textFitWidth:p,textFitHeight:h,sdf:a,version:m})}else{if(n.width===void 0||n.height===void 0)return this.fire(new J(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:f,height:d,data:g}=n,x=n;return this.style.addImage(t,{data:new Se({width:f,height:d},new Uint8Array(g)),pixelRatio:o,stretchX:s,stretchY:u,content:c,textFitWidth:p,textFitHeight:h,sdf:a,version:m,userImage:x}),x.onAdd&&x.onAdd(this,t),this}}}updateImage(t,n){let i=this.style.getImage(t);if(!i)return this.fire(new J(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let o=n instanceof HTMLImageElement||At(n)?ne.getImageData(n):n,{width:a,height:s,data:u}=o;if(a===void 0||s===void 0)return this.fire(new J(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==i.data.width||s!==i.data.height)return this.fire(new J(new Error("The width and height of the updated image must be that same as the previous version of the image")));let c=!(n instanceof HTMLImageElement||At(n));return i.data.replace(u,c),this.style.updateImage(t,i),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new J(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return Pt.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,n){return this._lazyInitEmptyStyle(),this.style.addLayer(t,n),this._update(!0)}moveLayer(t,n){return this.style.moveLayer(t,n),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,n,i){return this.style.setLayerZoomRange(t,n,i),this._update(!0)}setFilter(t,n,i={}){return this.style.setFilter(t,n,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,n,i,o={}){return this.style.setPaintProperty(t,n,i,o),this._update(!0)}getPaintProperty(t,n){return this.style.getPaintProperty(t,n)}setLayoutProperty(t,n,i,o={}){return this.style.setLayoutProperty(t,n,i,o),this._update(!0)}getLayoutProperty(t,n){return this.style.getLayoutProperty(t,n)}setGlyphs(t,n={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,n),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,n,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,n,i,o=>{o||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,n={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,n,i=>{i||this._update(!0)}),this}setLight(t,n={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,n),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,n={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,n),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,n){return this.style.setFeatureState(t,n),this._update()}removeFeatureState(t,n){return this.style.removeFeatureState(t,n),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,n=0;return this._container&&(t=this._container.clientWidth||400,n=this._container.clientHeight||300),[t,n]}_setupContainer(){let t=this._container;t.classList.add("maplibregl-map");let n=this._canvasContainer=O.create("div","maplibregl-canvas-container",t);this._interactive&&n.classList.add("maplibregl-interactive"),this._canvas=O.create("canvas","maplibregl-canvas",n),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let i=this._containerDimensions(),o=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],o);let a=this._controlContainer=O.create("div","maplibregl-control-container",t),s=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(u=>{s[u]=O.create("div","maplibregl-ctrl-".concat(u," "),a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,n,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*n),this._canvas.style.width="".concat(t,"px"),this._canvas.style.height="".concat(n,"px")}_setupPainter(){let t=St($e({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),n=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{n={requestedAttributes:t},o&&(n.statusMessage=o.statusMessage,n.type=o.type)},{once:!0});let i=null;if(this._canvasContextAttributes.contextType?i=this._canvas.getContext(this._canvasContextAttributes.contextType,t):i=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t),!i){let o="Failed to initialize WebGL";throw n?(n.message=o,new Error(JSON.stringify(n))):new Error(o)}this.painter=new jh(i,this.transform),ea.testSupport(i)}migrateProjection(t,n){super.migrateProjection(t,n),this.painter.transform=t,this.fire(new B("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){var u,c,p,h,m;let n=this._idleTriggered?this._fadeDuration:0,i=((u=this.style.projection)==null?void 0:u.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let f=this.transform.zoom,d=ne.now();this.style.zoomHistory.update(f,d);let g=new ve(f,{now:d,fadeDuration:n,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),x=g.crossFadingFactor();(x!==1||x!==this._crossFadingFactor)&&(o=!0,this._crossFadingFactor=x),this.style.update(g)}let a=((c=this.style.projection)==null?void 0:c.transitionState)>0!==i;(p=this.style.projection)==null||p.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((h=this.style.projection)==null?void 0:h.transitionState,(m=this.style.projection)==null?void 0:m.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||a)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,n,this._crossSourceCollisions,a),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:n,showPadding:this.showPadding}),this.fire(new B("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,Uo.mark("load"),this.fire(new B("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new B("idle")),this._loaded&&!this._fullyLoaded&&!s&&(this._fullyLoaded=!0,Uo.mark("fullLoad")),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var n;this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Pt.removeThrottleControl(this._imageQueueHandle),(n=this._resizeObserver)==null||n.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),O.remove(this._canvasContainer),O.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),Uo.clearMetrics(),this._removed=!0,this.fire(new B("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ne.frame(this._frameRequest,t=>{Uo.frame(t),this._frameRequest=null;try{this._render(t)}catch(n){if(!t1(n)&&!JM(n))throw n}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return V3}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}};l(_v,"Map");var xv=_v;y();var bv=oe(ue(),1);var U3={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0},Pv=class Pv{constructor(e){this._updateZoomButtons=l(()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),n=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())},"_updateZoomButtons");this._rotateCompassArrow=l(()=>{if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform="scale(".concat(1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5),") rotateZ(").concat(-this._map.transform.roll,"deg) rotateX(").concat(this._map.transform.pitch,"deg) rotateZ(").concat(-this._map.transform.bearing,"deg)");return}if(this.options.visualizePitch){this._compassIcon.style.transform="scale(".concat(1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5),") rotateX(").concat(this._map.transform.pitch,"deg) rotateZ(").concat(-this._map.transform.bearing,"deg)");return}if(this.options.visualizeRoll){this._compassIcon.style.transform="rotate(".concat(-this._map.transform.bearing-this._map.transform.roll,"deg)");return}this._compassIcon.style.transform="rotate(".concat(-this._map.transform.bearing,"deg)")},"_rotateCompassArrow");this._setButtonTitle=l((e,t)=>{let n=this._map._getUIString("NavigationControl.".concat(t));e.title=n,e.setAttribute("aria-label",n)},"_setButtonTitle");this.options=G({},U3,e),this._container=O.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),O.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),O.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=O.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new wv(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){O.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let n=O.create("button",e,this._container);return n.type="button",n.addEventListener("click",t),n}};l(Pv,"NavigationControl");var vv=Pv,Tv=class Tv{constructor(e,t,n=!1){this.mousedown=l(e=>{this.startMove(e,O.mousePos(this.element,e)),O.addEventListener(window,"mousemove",this.mousemove),O.addEventListener(window,"mouseup",this.mouseup)},"mousedown");this.mousemove=l(e=>{this.move(e,O.mousePos(this.element,e))},"mousemove");this.mouseup=l(e=>{this._rotatePitchHanlder.dragEnd(e),this.offTemp()},"mouseup");this.touchstart=l(e=>{e.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=O.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),O.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),O.addEventListener(window,"touchend",this.touchend))},"touchstart");this.touchmove=l(e=>{e.targetTouches.length!==1?this.reset():(this._lastPos=O.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos))},"touchmove");this.touchend=l(e=>{e.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},"touchend");this.reset=l(()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},"reset");this._clickTolerance=10,this.element=t;let i=new $h;this._rotatePitchHanlder=new rn({clickTolerance:3,move:l((o,a)=>{let s=t.getBoundingClientRect(),u=new bv.default((s.bottom-s.top)/2,(s.right-s.left)/2),c=Gl(new bv.default(o.x,a.y),a,u),p=n?(a.y-o.y)*-.5:void 0;return{bearingDelta:c,pitchDelta:p}},"move"),moveStateManager:i,enable:!0,assignEvents:l(()=>{},"assignEvents")}),this.map=e,O.addEventListener(t,"mousedown",this.mousedown),O.addEventListener(t,"touchstart",this.touchstart,{passive:!1}),O.addEventListener(t,"touchcancel",this.reset)}startMove(e,t){this._rotatePitchHanlder.dragStart(e,t),O.disableDrag()}move(e,t){let n=this.map,{bearingDelta:i,pitchDelta:o}=this._rotatePitchHanlder.dragMove(e,t)||{};i&&n.setBearing(n.getBearing()+i),o&&n.setPitch(n.getPitch()+o)}off(){let e=this.element;O.removeEventListener(e,"mousedown",this.mousedown),O.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),O.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),O.removeEventListener(window,"touchend",this.touchend),O.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){O.enableDrag(),O.removeEventListener(window,"mousemove",this.mousemove),O.removeEventListener(window,"mouseup",this.mouseup),O.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),O.removeEventListener(window,"touchend",this.touchend)}};l(Tv,"MouseRotateWrapper");var wv=Tv;y();y();var Fi;async function ZC(r=!1){if(Fi!==void 0&&!r)return Fi;if(window.navigator.permissions===void 0)return Fi=!!window.navigator.geolocation,Fi;try{Fi=(await window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch(e){Fi=!!window.navigator.geolocation}return Fi}l(ZC,"checkGeolocationSupport");y();var Tl=oe(ue(),1);y();function mm(r,e,t,n=!1){if(n||!t.getCoveringTilesDetailsProvider().allowWorldCopies())return r==null?void 0:r.wrap();let i=new X(r.lng,r.lat);if(r=new X(r.lng,r.lat),e){let o=new X(r.lng-360,r.lat),a=new X(r.lng+360,r.lat),s=t.locationToScreenPoint(r).distSqr(e);t.locationToScreenPoint(o).distSqr(e)<s?r=o:t.locationToScreenPoint(a).distSqr(e)<s&&(r=a)}for(;Math.abs(r.lng-t.center.lng)>180;){let o=t.locationToScreenPoint(r);if(o.x>=0&&o.y>=0&&o.x<=t.width&&o.y<=t.height)break;r.lng>t.center.lng?r.lng-=360:r.lng+=360}return r.lng!==i.lng&&t.isPointOnMapSurface(t.locationToScreenPoint(r))?r:i}l(mm,"smartWrap");y();var Pl={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function fm(r,e,t){let n=r.classList;for(let i in Pl)n.remove("maplibregl-".concat(t,"-anchor-").concat(i));n.add("maplibregl-".concat(t,"-anchor-").concat(e))}l(fm,"applyAnchorClass");var Sv=class Sv extends be{constructor(t){super();this._onKeyPress=l(t=>{let n=t.code,i=t.charCode||t.keyCode;(n==="Space"||n==="Enter"||i===32||i===13)&&this.togglePopup()},"_onKeyPress");this._onMapClick=l(t=>{let n=t.originalEvent.target,i=this._element;this._popup&&(n===i||i.contains(n))&&this.togglePopup()},"_onMapClick");this._update=l(t=>{if(!this._map)return;let n=this._map.loaded()&&!this._map.isMoving();((t==null?void 0:t.type)==="terrain"||(t==null?void 0:t.type)==="render"&&!n)&&this._map.once("render",this._update),this._lngLat=mm(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?i="rotateZ(".concat(this._rotation,"deg)"):this._rotationAlignment==="map"&&(i="rotateZ(".concat(this._rotation-this._map.getBearing(),"deg)"));let o="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?o="rotateX(0deg)":this._pitchAlignment==="map"&&(o="rotateX(".concat(this._map.getPitch(),"deg)")),!this._subpixelPositioning&&(!t||t.type==="moveend")&&(this._pos=this._pos.round()),O.setTransform(this._element,"".concat(Pl[this._anchor]," translate(").concat(this._pos.x,"px, ").concat(this._pos.y,"px) ").concat(o," ").concat(i)),ne.frameAsync(new AbortController).then(()=>{this._updateOpacity(t&&t.type==="moveend")}).catch(()=>{})},"_update");this._onMove=l(t=>{if(!this._isDragging){let n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new B("dragstart"))),this.fire(new B("drag")))},"_onMove");this._onUp=l(()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new B("dragend")),this._state="inactive"},"_onUp");this._addDragHandler=l(t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},"_addDragHandler");if(this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),!t||!t.element){this._defaultMarker=!0,this._element=O.create("div");let n=O.createNS("http://www.w3.org/2000/svg","svg"),i=41,o=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height","".concat(i,"px")),n.setAttributeNS(null,"width","".concat(o,"px")),n.setAttributeNS(null,"viewBox","0 0 ".concat(o," ").concat(i));let a=O.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");let s=O.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");let u=O.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"transform","translate(3.0, 29.0)"),u.setAttributeNS(null,"fill","#000000");let c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let b of c){let v=O.createNS("http://www.w3.org/2000/svg","ellipse");v.setAttributeNS(null,"opacity","0.04"),v.setAttributeNS(null,"cx","10.5"),v.setAttributeNS(null,"cy","5.80029008"),v.setAttributeNS(null,"rx",b.rx),v.setAttributeNS(null,"ry",b.ry),u.appendChild(v)}let p=O.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"fill",this._color);let h=O.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),p.appendChild(h);let m=O.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"opacity","0.25"),m.setAttributeNS(null,"fill","#000000");let f=O.createNS("http://www.w3.org/2000/svg","path");f.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),m.appendChild(f);let d=O.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"transform","translate(6.0, 7.0)"),d.setAttributeNS(null,"fill","#FFFFFF");let g=O.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(8.0, 8.0)");let x=O.createNS("http://www.w3.org/2000/svg","circle");x.setAttributeNS(null,"fill","#000000"),x.setAttributeNS(null,"opacity","0.25"),x.setAttributeNS(null,"cx","5.5"),x.setAttributeNS(null,"cy","5.5"),x.setAttributeNS(null,"r","5.4999962");let _=O.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),g.appendChild(x),g.appendChild(_),s.appendChild(u),s.appendChild(p),s.appendChild(m),s.appendChild(d),s.appendChild(g),n.appendChild(s),n.setAttributeNS(null,"height","".concat(i*this._scale,"px")),n.setAttributeNS(null,"width","".concat(o*this._scale,"px")),this._element.appendChild(n),this._offset=Tl.default.convert(t&&t.offset||[0,-14])}else this._element=t.element,this._offset=Tl.default.convert(t&&t.offset||[0,0]);if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),fm(this._element,this._anchor,"marker"),t&&t.className)for(let n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),O.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=X.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){let o=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,(38.1-13.5+o)*-1],"bottom-right":[-o,(38.1-13.5+o)*-1],left:[13.5,(38.1-13.5)*-1],right:[-13.5,(38.1-13.5)*-1]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){let t=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(t)t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map));else return this;return this}_updateOpacity(t=!1){var g,x;let n=(g=this._map)==null?void 0:g.terrain,i=this._map.transform.isLocationOccluded(this._lngLat);if(!n||i){let _=i?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==_&&(this._element.style.opacity=_);return}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,a=o.terrain.depthAtPoint(this._pos),s=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom),u=o.transform.lngLatToCameraDepth(this._lngLat,s),c=.006;if(u-a<c){this._element.style.opacity=this._opacity;return}let p=-this._offset.y/o.transform.pixelsPerMeter,h=Math.sin(o.getPitch()*Math.PI/180)*p,m=o.terrain.depthAtPoint(new Tl.default(this._pos.x,this._pos.y-this._offset.y)),d=o.transform.lngLatToCameraDepth(this._lngLat,s+h)-m>c;(x=this._popup)!=null&&x.isOpen()&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=Tl.default.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return(this._opacity===void 0||t===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}};l(Sv,"Marker");var No=Sv;var j3={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},dm=0,Sl=!1,Cv=class Cv extends be{constructor(t){super();this._onSuccess=l(t=>{if(this._map){if(this._isOutOfMapMaxBounds(t)){this._setErrorState(),this.fire(new B("outofmaxbounds",t)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new B("geolocate",t)),this._finish()}},"_onSuccess");this._updateCamera=l(t=>{let n=new X(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,o=this._map.getBearing(),a=G({bearing:o},this.options.fitBoundsOptions),s=ot.fromLngLat(n,i);this._map.fitBounds(s,a,{geolocateSource:!0})},"_updateCamera");this._updateMarker=l(t=>{if(t){let n=new X(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},"_updateMarker");this._onZoom=l(()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},"_onZoom");this._onError=l(t=>{if(this._map){if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Sl)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new B("error",t)),this._finish()}},"_onError");this._finish=l(()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},"_finish");this._setupUI=l(()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=O.create("button","maplibregl-ctrl-geolocate",this._container),O.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},"_setupUI");this._finishSetupUI=l(t=>{if(this._map){if(t===!1){ce("Geolocation support is not available so the GeolocateControl will be disabled.");let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{let n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=O.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new No({element:this._dotElement}),this._circleElement=O.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new No({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{let i=n.originalEvent&&n.originalEvent.type==="resize";!n.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!i&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new B("trackuserlocationend")),this.fire(new B("userlocationlostfocus")))})}},"_finishSetupUI");this.options=G({},j3,t)}onAdd(t){return this._map=t,this._container=O.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),ZC().then(n=>this._finishSetupUI(n)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),O.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,dm=0,Sl=!1}_isOutOfMapMaxBounds(t){let n=this._map.getMaxBounds(),i=t.coords;return n&&(i.longitude<n.getWest()||i.longitude>n.getEast()||i.latitude<n.getSouth()||i.latitude>n.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}}_updateCircleRadius(){let t=this._map.getBounds(),n=t.getSouthEast(),i=t.getNorthEast(),o=n.distanceTo(i),a=this._map._container.clientHeight,s=Math.ceil(2*(this._accuracy/(o/a)));this._circleElement.style.width="".concat(s,"px"),this._circleElement.style.height="".concat(s,"px")}trigger(){if(!this._setup)return ce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new B("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":dm--,Sl=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new B("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new B("trackuserlocationstart")),this.fire(new B("userlocationfocus"));break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),dm++;let t;dm>1?(t={maximumAge:6e5,timeout:0},Sl=!0):(t=this.options.positionOptions,Sl=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};l(Cv,"GeolocateControl");var Mv=Cv;y();var N3={maxWidth:100,unit:"metric"},Iv=class Iv{constructor(e){this._onMove=l(()=>{qC(this._map,this._container,this.options)},"_onMove");this.setUnit=l(e=>{this.options.unit=e,qC(this._map,this._container,this.options)},"setUnit");this.options=$e($e({},N3),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=O.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){O.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}};l(Iv,"ScaleControl");var Av=Iv;function qC(r,e,t){let n=t&&t.maxWidth||100,i=r._container.clientHeight/2,o=r._container.clientWidth/2,a=r.unproject([o-n/2,i]),s=r.unproject([o+n/2,i]),u=Math.round(r.project(s).x-r.project(a).x),c=Math.min(n,u,r._container.clientWidth),p=a.distanceTo(s);if(t&&t.unit==="imperial"){let h=3.2808*p;if(h>5280){let m=h/5280;Ml(e,c,m,r._getUIString("ScaleControl.Miles"))}else Ml(e,c,h,r._getUIString("ScaleControl.Feet"))}else if(t&&t.unit==="nautical"){let h=p/1852;Ml(e,c,h,r._getUIString("ScaleControl.NauticalMiles"))}else p>=1e3?Ml(e,c,p/1e3,r._getUIString("ScaleControl.Kilometers")):Ml(e,c,p,r._getUIString("ScaleControl.Meters"))}l(qC,"updateScale");function Ml(r,e,t,n){let i=Z3(t),o=i/t;r.style.width="".concat(e*o,"px"),r.innerHTML="".concat(i," ").concat(n)}l(Ml,"setScale");function G3(r){let e=Math.pow(10,Math.ceil(-Math.log(r)/Math.LN10));return Math.round(r*e)/e}l(G3,"getDecimalRoundNum");function Z3(r){let e=Math.pow(10,"".concat(Math.floor(r)).length-1),t=r/e;return t=t>=10?10:t>=5?5:t>=3?3:t>=2?2:t>=1?1:G3(t),e*t}l(Z3,"getRoundNum");y();var Lv=class Lv extends be{constructor(t={}){super();this._onFullscreenChange=l(()=>{var n;let t=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;(n=t==null?void 0:t.shadowRoot)!=null&&n.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},"_onFullscreenChange");this._onClickFullscreen=l(()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},"_onClickFullscreen");this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:ce("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=O.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){O.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let t=this._fullscreenButton=O.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);O.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new B("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new B("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}};l(Lv,"FullscreenControl");var Ev=Lv;y();var Rv=class Rv{constructor(e){this._toggleTerrain=l(()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},"_toggleTerrain");this._updateTerrainIcon=l(()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},"_updateTerrainIcon");this.options=e}onAdd(e){return this._map=e,this._container=O.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=O.create("button","maplibregl-ctrl-terrain",this._container),O.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){O.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}};l(Rv,"TerrainControl");var kv=Rv;y();var Fv=class Fv{constructor(){this._toggleProjection=l(()=>{var t;let e=(t=this._map.getProjection())==null?void 0:t.type;e==="mercator"||!e?this._map.setProjection({type:"globe"}):this._map.setProjection({type:"mercator"}),this._updateGlobeIcon()},"_toggleProjection");this._updateGlobeIcon=l(()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((e=this._map.getProjection())==null?void 0:e.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))},"_updateGlobeIcon")}onAdd(e){return this._map=e,this._container=O.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=O.create("button","maplibregl-ctrl-globe",this._container),O.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){O.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}};l(Fv,"GlobeControl");var Dv=Fv;y();var Qe=oe(ue(),1);var q3={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},H3=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Bv=class Bv extends be{constructor(t){super();this._updateOpacity=l(()=>{this.options.locationOccludedOpacity!==void 0&&(this._map.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity="".concat(this.options.locationOccludedOpacity):this._container.style.opacity=void 0)},"_updateOpacity");this.remove=l(()=>(this._content&&O.remove(this._content),this._container&&(O.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new B("close"))),this),"remove");this._onMouseUp=l(t=>{this._update(t.point)},"_onMouseUp");this._onMouseMove=l(t=>{this._update(t.point)},"_onMouseMove");this._onDrag=l(t=>{this._update(t.point)},"_onDrag");this._update=l(t=>{let n=this._lngLat||this._trackPointer;if(!this._map||!n||!this._content)return;if(!this._container){if(this._container=O.create("div","maplibregl-popup",this._map.getContainer()),this._tip=O.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let u of this.options.className.split(" "))this._container.classList.add(u);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=mm(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!t)return;let i=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));let o=this.options.anchor,a=HC(this.options.offset);if(!o){let u=this._container.offsetWidth,c=this._container.offsetHeight,p;i.y+a.bottom.y<c?p=["top"]:i.y>this._map.transform.height-c?p=["bottom"]:p=[],i.x<u/2?p.push("left"):i.x>this._map.transform.width-u/2&&p.push("right"),p.length===0?o="bottom":o=p.join("-")}let s=i.add(a[o]);this.options.subpixelPositioning||(s=s.round()),O.setTransform(this._container,"".concat(Pl[o]," translate(").concat(s.x,"px,").concat(s.y,"px)")),fm(this._container,o,"popup"),this._updateOpacity()},"_update");this._onClose=l(()=>{this.remove()},"_onClose");this.options=G(Object.create(q3),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new B("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=X.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){let n=document.createDocumentFragment(),i=document.createElement("body"),o;for(i.innerHTML=t;o=i.firstChild,!!o;)n.appendChild(o);return this.setDOMContent(n)}getMaxWidth(){var t;return(t=this._container)==null?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=O.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}_createCloseButton(){this.options.closeButton&&(this._closeButton=O.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let t=this._container.querySelector(H3);t&&t.focus()}};l(Bv,"Popup");var zv=Bv;function HC(r){if(r)if(typeof r=="number"){let e=Math.round(Math.abs(r)/Math.SQRT2);return{center:new Qe.default(0,0),top:new Qe.default(0,r),"top-left":new Qe.default(e,e),"top-right":new Qe.default(-e,e),bottom:new Qe.default(0,-r),"bottom-left":new Qe.default(e,-e),"bottom-right":new Qe.default(-e,-e),left:new Qe.default(r,0),right:new Qe.default(-r,0)}}else if(r instanceof Qe.default||Array.isArray(r)){let e=Qe.default.convert(r);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}else return{center:Qe.default.convert(r.center||[0,0]),top:Qe.default.convert(r.top||[0,0]),"top-left":Qe.default.convert(r["top-left"]||[0,0]),"top-right":Qe.default.convert(r["top-right"]||[0,0]),bottom:Qe.default.convert(r.bottom||[0,0]),"bottom-left":Qe.default.convert(r["bottom-left"]||[0,0]),"bottom-right":Qe.default.convert(r["bottom-right"]||[0,0]),left:Qe.default.convert(r.left||[0,0]),right:Qe.default.convert(r.right||[0,0])};else return HC(new Qe.default(0,0))}l(HC,"normalizeOffset");var W3=oe(ue(),1);var $3=Il.version;function w_e(r,e){return Dn().setRTLTextPlugin(r,e)}l(w_e,"setRTLTextPlugin");function P_e(){return Dn().getRTLTextPluginStatus()}l(P_e,"getRTLTextPluginStatus");function T_e(){return $3}l(T_e,"getVersion");function S_e(){return Ln.workerCount}l(S_e,"getWorkerCount");function M_e(r){Ln.workerCount=r}l(M_e,"setWorkerCount");function C_e(){return ut.MAX_PARALLEL_IMAGE_REQUESTS}l(C_e,"getMaxParallelImageRequests");function A_e(r){ut.MAX_PARALLEL_IMAGE_REQUESTS=r}l(A_e,"setMaxParallelImageRequests");function I_e(){return ut.WORKER_URL}l(I_e,"getWorkerUrl");function E_e(r){ut.WORKER_URL=r}l(E_e,"setWorkerUrl");function L_e(r){return sp().broadcast("IS",r)}l(L_e,"importScriptInWorkers");export{ut as a,ik as b,ok as c,un as d,B as e,be as f,$z as g,Xz as h,X as i,ot as j,de as k,Es as l,Mi as m,Ls as n,ks as o,Ht as p,Fs as q,zs as r,sB as s,Eo as t,F2 as u,Oo as v,Nh as w,rl as x,ft as y,jn as z,al as A,sl as B,cl as C,pl as D,hl as E,ml as F,fl as G,dl as H,yl as I,gl as J,xl as K,_l as L,bl as M,vl as N,xv as O,vv as P,No as Q,Mv as R,Av as S,Ev as T,kv as U,Dv as V,zv as W,W3 as X,w_e as Y,P_e as Z,T_e as _,S_e as $,M_e as aa,C_e as ba,A_e as ca,I_e as da,E_e as ea,L_e as fa};
|